/* ==========================================================================
   Boxydot Rewards (1.17.0): the trophy room and the "New badge" note.
   Uses the theme's own colour variables, so light, dark and the comfort
   settings (comfort.css) apply automatically. Sizes are in rem so they grow
   with the visitor's text size. Calm by design: soft cards, one warm amber
   accent for things earned, no flashing.
   ========================================================================== */

.bxd-rewards { margin-inline: auto; width: 100%; display: grid; gap: var(--bxd-space-section); align-content: start; }
.bxd-rewards [data-rw-root] { display: grid; gap: var(--bxd-space-section); }
.bxd-rewards__head { display: grid; gap: .5rem; }
.bxd-rewards__title { margin: 0; font-size: clamp(1.75rem, 4.5vw, 2.5rem); font-weight: 900; line-height: 1.15; letter-spacing: -.015em; }
.bxd-rewards__lead { margin: 0; max-width: 40rem; font-size: 1.0625rem; color: var(--muted); }
.bxd-rewards__note { max-width: 48rem; }

/* ---------- Top: level card and numbers ---------- */
.bxd-rw-top { display: grid; gap: 1rem; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { .bxd-rw-top { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: stretch; } }

.bxd-rw-hero {
  display: flex; align-items: center; gap: 1.25rem; padding: 1.25rem 1.5rem; border: 1px solid var(--line); border-radius: var(--bxd-radius);
  background: var(--surface); box-shadow: var(--shadow);
}
.bxd-rw-hero__badge {
  position: relative; flex: none; display: grid; place-items: center; width: 5rem; height: 5rem; border-radius: 50%;
  background: var(--bxd-amber); color: var(--bxd-navy-deep);
}
.bxd-rw-hero__star { position: absolute; inset: 0; display: grid; place-items: center; opacity: .22; }
.bxd-rw-hero__star .bxd-icon { width: 4.25rem; height: 4.25rem; fill: currentColor; }
.bxd-rw-hero__lv { position: relative; font-size: 1.875rem; font-weight: 900; line-height: 1; }
.bxd-rw-hero__body { display: grid; gap: .25rem; min-width: 0; flex: 1; }
.bxd-rw-hero__k { font-size: .6875rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); }
.bxd-rw-hero__name { margin: 0; font-size: 1.5rem; font-weight: 900; line-height: 1.1; }
.bxd-rw-hero__stars { margin: 0; font-weight: 700; color: var(--muted); }
.bxd-rw-hero__next { margin: .125rem 0 0; font-size: .8125rem; color: var(--muted); }

.bxd-rw-bar { height: .625rem; border-radius: 999px; background: var(--chip); border: 1px solid var(--line); overflow: hidden; }
.bxd-rw-bar__fill { display: block; height: 100%; border-radius: 999px; background: var(--bxd-teal); transition: width .5s ease; }

.bxd-rw-stats { display: grid; gap: .75rem; margin: 0; padding: 0; list-style: none; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 560px) { .bxd-rw-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.bxd-rw-stat {
  position: relative; display: grid; gap: .125rem; align-content: start; padding: .875rem 1rem; border: 1px solid var(--line);
  border-radius: 1rem; background: var(--surface);
}
.bxd-rw-stat__ico { position: absolute; top: .75rem; inset-inline-end: .75rem; color: var(--accent-text); opacity: .85; }
.bxd-rw-stat__ico .bxd-icon { width: 1.125rem; height: 1.125rem; }
.bxd-rw-stat__n { font-size: 1.625rem; font-weight: 900; line-height: 1.1; }
.bxd-rw-stat__l { font-size: .8125rem; font-weight: 600; color: var(--muted); }
.bxd-rw-stat__s { font-size: .75rem; color: var(--muted); opacity: .9; }

/* ---------- Sections ---------- */
.bxd-rw-sec { display: grid; gap: var(--bxd-space-head); }
.bxd-rw-sec__head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: .75rem 1rem; }
.bxd-rw-sec__title { margin: 0; font-size: 1.375rem; font-weight: 800; line-height: 1.2; }
.bxd-rw-sec__sub { margin: .125rem 0 0; font-size: .875rem; color: var(--muted); }

/* ---------- This week ---------- */
.bxd-rw-week {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .5rem; margin: 0; padding: 1rem; list-style: none;
  border: 1px solid var(--line); border-radius: 1rem; background: var(--surface);
}
.bxd-rw-week__day { display: grid; gap: .375rem; justify-items: center; }
.bxd-rw-week__col { display: flex; align-items: flex-end; width: 100%; max-width: 2.5rem; height: 5.5rem; border-radius: .625rem; background: var(--chip); overflow: hidden; }
.bxd-rw-week__fill { display: block; width: 100%; border-radius: .625rem; background: var(--line); }
.bxd-rw-week__day.has-n .bxd-rw-week__fill { background: var(--bxd-teal); }
.bxd-rw-week__day.is-today .bxd-rw-week__col { outline: 2px solid var(--bxd-amber); outline-offset: 2px; }
.bxd-rw-week__name { font-size: .75rem; font-weight: 700; color: var(--muted); }
.bxd-rw-week__day.is-today .bxd-rw-week__name { color: var(--text); }

/* ---------- Badges ---------- */
.bxd-rw-tabs { display: inline-flex; gap: .25rem; padding: .25rem; border: 1px solid var(--line); border-radius: 999px; background: var(--chip); }
.bxd-rw-tab {
  min-height: 2.25rem; padding: .25rem .875rem; border: 0; border-radius: 999px; background: transparent; color: var(--muted);
  font: inherit; font-size: .8125rem; font-weight: 700; cursor: pointer;
}
.bxd-rw-tab:hover { background: var(--hover); }
.bxd-rw-tab.is-on { background: var(--bxd-teal); color: var(--on-accent); }
.bxd-rw-tab:focus-visible { outline: 3px solid var(--bxd-teal); outline-offset: 2px; }

.bxd-rw-shelf { display: grid; gap: 1.75rem; }
.bxd-rw-group { display: grid; gap: .75rem; }
.bxd-rw-group__title { margin: 0; font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.bxd-rw-badges { display: grid; gap: .75rem; margin: 0; padding: 0; list-style: none; grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr)); }
.bxd-rw-badge {
  position: relative; display: flex; align-items: flex-start; gap: .875rem; padding: .875rem 1rem; border: 1px solid var(--line);
  border-radius: 1rem; background: var(--surface);
}
.bxd-rw-badge__art {
  flex: none; display: grid; place-items: center; width: 3.25rem; height: 3.25rem; border-radius: 50%;
  background: var(--chip); border: 1px dashed var(--line); color: var(--muted);
}
.bxd-rw-badge__ico .bxd-icon, .bxd-rw-badge__art .bxd-icon { width: 1.5rem; height: 1.5rem; }
.bxd-rw-badge.is-got { border-color: rgba(230, 180, 92, .6); }
.bxd-rw-badge.is-got .bxd-rw-badge__art { background: var(--bxd-amber); border: 0; color: var(--bxd-navy-deep); box-shadow: 0 0 0 4px rgba(230, 180, 92, .22); }
.bxd-rw-badge.is-locked { opacity: .92; }
.bxd-rw-badge.is-locked .bxd-rw-badge__name { color: var(--muted); }
.bxd-rw-badge__body { display: grid; gap: .125rem; min-width: 0; flex: 1; }
.bxd-rw-badge__name { font-size: .9375rem; font-weight: 800; line-height: 1.25; }
.bxd-rw-badge__desc { font-size: .8125rem; color: var(--muted); line-height: 1.35; }
.bxd-rw-badge__body .bxd-rw-bar { margin-top: .375rem; height: .5rem; }
.bxd-rw-badge__count { font-size: .6875rem; font-weight: 700; color: var(--muted); }
.bxd-rw-badge__new {
  justify-self: start; padding: .0625rem .5rem; border-radius: 999px; background: var(--bxd-teal); color: var(--on-accent);
  font-size: .6875rem; font-weight: 800; letter-spacing: .03em;
}
.bxd-rw-badge.is-new { animation: bxd-rw-pop .5s ease both; }
@keyframes bxd-rw-pop { 0% { transform: scale(.96); } 60% { transform: scale(1.02); } 100% { transform: scale(1); } }

/* ---------- Topic passport ---------- */
.bxd-rw-passport { display: grid; gap: .75rem; margin: 0; padding: 0; list-style: none; grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
.bxd-rw-topic { display: grid; gap: .5rem; padding: .875rem 1rem; border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); }
.bxd-rw-topic__top { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; }
.bxd-rw-topic__name { font-weight: 800; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
a.bxd-rw-topic__name:hover { text-decoration: underline; }
.bxd-rw-topic__n { flex: none; font-size: .75rem; font-weight: 700; color: var(--muted); }
.bxd-rw-topic.is-full { border-color: rgba(230, 180, 92, .6); }
.bxd-rw-topic.is-full .bxd-rw-bar__fill { background: var(--bxd-amber); }

/* ---------- Recently explored ---------- */
.bxd-rw-recent { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.bxd-rw-recent__item { display: flex; align-items: center; gap: .75rem; padding: .625rem .875rem; border: 1px solid var(--line); border-radius: .875rem; background: var(--surface); }
.bxd-rw-recent__ico { flex: none; color: var(--accent-text); }
.bxd-rw-recent__ico .bxd-icon { width: 1.25rem; height: 1.25rem; }
.bxd-rw-recent__txt { display: grid; min-width: 0; flex: 1; }
.bxd-rw-recent__title { font-weight: 700; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.bxd-rw-recent__title:hover { text-decoration: underline; }
.bxd-rw-recent__txt small { color: var(--muted); font-size: .75rem; }
.bxd-rw-recent__done { color: var(--accent-text); }
.bxd-rw-recent__done .bxd-icon { width: 1.125rem; height: 1.125rem; }

.bxd-rw-foot { display: flex; justify-content: flex-start; }

/* ---------- "New badge" note on item pages ---------- */
.bxd-rw-toast {
  position: fixed; left: 50%; bottom: calc(var(--bxd-tabbar-h) + 1rem + env(safe-area-inset-bottom, 0px)); z-index: 210;
  display: flex; align-items: center; gap: .75rem; max-width: calc(100% - 2rem); padding: .625rem .875rem; border-radius: 1rem;
  background: var(--bxd-navy-soft); color: var(--bxd-ivory); border: 1px solid rgba(230, 180, 92, .7); box-shadow: var(--shadow);
  opacity: 0; transform: translate(-50%, 12px); pointer-events: none; transition: opacity .25s ease, transform .25s ease;
}
.bxd-rw-toast.is-on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
@media (min-width: 860px) { body:not(.bxd-tabbar-always) .bxd-rw-toast { bottom: 1.5rem; } }
.bxd-rw-toast__ico { flex: none; display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 50%; background: var(--bxd-amber); color: var(--bxd-navy-deep); }
.bxd-rw-toast__ico .bxd-icon { width: 1.25rem; height: 1.25rem; }
.bxd-rw-toast__txt { display: grid; min-width: 0; line-height: 1.25; }
.bxd-rw-toast__txt strong { font-size: .8125rem; }
.bxd-rw-toast__txt span { font-size: .8125rem; opacity: .9; }
.bxd-rw-toast__link { flex: none; padding: .375rem .75rem; border-radius: 999px; background: var(--bxd-teal); color: var(--bxd-navy-deep); font-size: .8125rem; font-weight: 800; text-decoration: none; }
.bxd-rw-toast__link:focus-visible { outline: 3px solid var(--bxd-ivory); outline-offset: 2px; }

/* ---------- Phones ---------- */
@media (max-width: 559px) {
  .bxd-rw-hero { padding: 1rem; gap: 1rem; }
  .bxd-rw-hero__badge { width: 4rem; height: 4rem; }
  .bxd-rw-hero__star .bxd-icon { width: 3.5rem; height: 3.5rem; }
  .bxd-rw-hero__lv { font-size: 1.5rem; }
  .bxd-rw-hero__name { font-size: 1.25rem; }
  .bxd-rw-week { gap: .25rem; padding: .75rem .5rem; }
  .bxd-rw-week__col { height: 4.5rem; }
  .bxd-rw-sec__head { align-items: stretch; }
  .bxd-rw-tabs { width: 100%; }
  .bxd-rw-tab { flex: 1; padding-inline: .5rem; }
}

/* ---------- Calm: no movement when the visitor asked for none ---------- */
@media (prefers-reduced-motion: reduce) {
  .bxd-rw-badge.is-new { animation: none; }
  .bxd-rw-bar__fill, .bxd-rw-toast { transition: none; }
}
html[data-bxd-motion="reduce"] .bxd-rw-badge.is-new { animation: none; }
html[data-bxd-motion="reduce"] .bxd-rw-bar__fill,
html[data-bxd-motion="reduce"] .bxd-rw-toast { transition: none; }
