/* Saved & Calm · Home dashboard and charts. */

/* Chart ink: single hue per chart. Debt uses a deeper coral than the brand coral so the
   line keeps contrast on paper; dark mode gets its own lighter steps. */
:root {
  --mark-save: #2F7A57;
  --mark-save-wash: rgba(47, 122, 87, .16);
  --mark-debt: #C9603F;
  --mark-debt-wash: rgba(233, 135, 107, .22);
  --mark-pot: #C99A2E;
}
:root[data-theme="dark"] {
  --mark-save: #6CC89A;
  --mark-save-wash: rgba(108, 200, 154, .18);
  --mark-debt: #F0A088;
  --mark-debt-wash: rgba(240, 160, 136, .18);
  --mark-pot: #E8B949;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mark-save: #6CC89A;
    --mark-save-wash: rgba(108, 200, 154, .18);
    --mark-debt: #F0A088;
    --mark-debt-wash: rgba(240, 160, 136, .18);
    --mark-pot: #E8B949;
  }
}

/* ── Layout ────────────────────────────────────────── */
/* One calm column: header, Today's one thing, two tiles, Coming up, then progress and charts. */
.dash { display: grid; gap: 20px; }
.dash__wide { min-width: 0; }
.nowrap { white-space: nowrap; }

/* Short labels on phones ("Smaller one", "2 days"); full ones elsewhere. */
.when-narrow { display: none; }
@media (max-width: 480px) {
  .when-wide { display: none; }
  .when-narrow { display: inline; }
}

/* ── Header ────────────────────────────────────────── */
.home-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s-3) var(--s-5);
  margin: var(--s-2) 0 var(--s-5);
}
.home-head__text { display: grid; gap: 2px; min-width: 0; flex: 1 1 320px; }
.home-head h1 { font-size: clamp(1.9rem, 6vw, 2.6rem); line-height: 1.1; overflow-wrap: anywhere; }
.home-head__line { margin-top: var(--s-1); color: var(--ink-soft); }
.home-head__line b { color: var(--accent-strong); font-weight: 650; }
.home-head__pills { display: flex; flex-wrap: nowrap; align-items: center; gap: var(--s-2); min-width: 0; }
@media (max-width: 600px) { .home-head { flex-direction: column; align-items: stretch; } .home-head__text { flex-basis: auto; } }

/* A personal cover: its pattern as a soft band behind the header. */
.home-head--cover {
  padding: var(--s-4) var(--s-5); border-radius: 24px;
  background: linear-gradient(120deg, color-mix(in srgb, var(--fill-1) 30%, var(--surface)), color-mix(in srgb, var(--fill-2) 22%, var(--surface)));
  border: 1px solid var(--line);
}
.home-head--cover::before { opacity: .35; }
.home-head--cover { padding-right: 56px; }
.home-head__edit { position: absolute; top: var(--s-2); right: var(--s-2); background: var(--surface); }

.pill-btn {
  display: inline-flex; align-items: center; gap: 6px; flex: none; white-space: nowrap;
  min-height: 44px; padding: 0 var(--s-4); border-radius: var(--r-pill);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  font-size: var(--step--1); font-weight: 500; text-decoration: none; cursor: pointer;
  transition: transform .15s var(--ease), box-shadow .2s;
}
.pill-btn:hover { box-shadow: var(--shadow-1); }
.pill-btn:active { transform: scale(.97); }
.pill-btn[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-strong); font-weight: 600; }
.pill-btn--streak { background: var(--gold-wash); border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); color: var(--gold-ink); }
.pill-btn--streak b { font-weight: 650; }
.week-dots { display: inline-flex; gap: 3px; margin-left: 4px; }
.week-dots i { width: 7px; height: 7px; border-radius: 50%; background: color-mix(in srgb, var(--gold) 30%, transparent); }
.week-dots i.is-saved { background: var(--gold); }
.week-dots i.is-today:not(.is-saved) { background: transparent; box-shadow: inset 0 0 0 1.5px var(--gold); }
@media (max-width: 480px) {
  .home-head--cover { padding: var(--s-4); }
  .home-head__pills { gap: 6px; }
  .pill-btn { padding: 0 10px; gap: 5px; font-size: .78rem; }
  .week-dots { gap: 2px; margin-left: 2px; }
  .week-dots i { width: 6px; height: 6px; }
}

/* ── Today's one thing ─────────────────────────────── */
.hero-card {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s-5);
  overflow: hidden; isolation: isolate;
  padding: 34px; border-radius: 24px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--accent-wash) 70%, var(--surface)), var(--surface) 60%);
  border-color: color-mix(in srgb, var(--accent) 16%, var(--line));
  box-shadow: var(--shadow-2);
}
/* The soft glow: mint top right, a faint gold circle bottom right. */
.hero-card::before, .hero-card::after { content: ""; position: absolute; z-index: -1; border-radius: 50%; pointer-events: none; }
.hero-card::before { width: 420px; height: 420px; top: -210px; right: -120px; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent-wash) 90%, transparent), transparent); }
.hero-card::after { width: 300px; height: 300px; bottom: -150px; right: 40px; background: color-mix(in srgb, var(--gold) 12%, transparent); }
:root[data-theme="dark"] .hero-card::after { opacity: .4; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero-card::after { opacity: .4; } }
.hero-card__body { display: grid; justify-items: start; min-width: 0; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: var(--r-pill);
  background: var(--accent-wash); color: var(--accent-strong);
  font-size: .72rem; font-weight: 650; letter-spacing: .12em; text-transform: uppercase;
}
.card .hero-card__title {
  margin: var(--s-3) 0 var(--s-1);
  font-size: clamp(2rem, 7vw, 3rem); line-height: 1.08; letter-spacing: -.01em;
  color: var(--accent-strong); overflow-wrap: anywhere;
}
.hero-card__title a { color: inherit; text-decoration: none; }
.hero-card__title a:hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
/* A soft gold highlighter underline under the amount. Straight, no slanted marker. */
mark.hl {
  color: inherit; padding: 0 .06em;
  background: linear-gradient(to bottom, transparent 60%, color-mix(in srgb, var(--gold) 50%, transparent) 60%, color-mix(in srgb, var(--gold) 50%, transparent) 90%, transparent 90%);
}
.hero-card__sub { color: var(--ink-soft); font-size: var(--step-1); max-width: 46ch; }
.hero-card__progress { display: grid; gap: var(--s-2); margin-top: var(--s-4); width: 100%; max-width: 560px; }
.hero-squares { display: flex; flex-wrap: wrap; gap: 5px; }
.hero-squares i { width: 11px; height: 11px; border-radius: 4px; background: var(--surface-sunk); }
.hero-squares i.is-filled { background: var(--accent); }
.hero-squares i.is-today { background: transparent; box-shadow: inset 0 0 0 2px var(--gold); }
/* Dark mode: lift the empty squares off the card so they stay visible. */
:root[data-theme="dark"] .hero-squares i:not(.is-filled):not(.is-today) { background: color-mix(in srgb, var(--ink) 22%, var(--surface)); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero-squares i:not(.is-filled):not(.is-today) { background: color-mix(in srgb, var(--ink) 22%, var(--surface)); }
}
.hero-bar { display: block; height: 8px; border-radius: var(--r-pill); background: var(--surface-sunk); overflow: hidden; }
.hero-bar i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.hero-card__meta { color: var(--ink-soft); font-size: var(--step--1); }
.hero-card__meta b { color: var(--ink); font-weight: 650; }
.hero-card__btns { display: flex; flex-wrap: nowrap; align-items: center; gap: var(--s-3); margin-top: var(--s-5); max-width: 100%; }
.hero-card__btns .btn { white-space: nowrap; font-weight: 600; }
.btn--big { min-height: 56px; padding: 0 var(--s-6); font-size: 1.05rem; }
.btn--outline { background: var(--surface); border: 1.5px solid var(--line-strong); }
.hero-card__other { margin: var(--s-2) 0 0; font-size: var(--step--1); }

.hero-card__art { position: relative; display: grid; justify-items: center; }
.hero-card__circle {
  display: grid; place-items: center; width: 190px; height: 190px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent-wash) 80%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent) 14%, var(--line));
}
.hero-card__circle .hero-pip { position: static; width: 150px; }
.hero-card__circle .hero-pip svg { width: 100%; height: auto; }
.hero-card__emoji { font-size: 4rem; line-height: 1; }
.hero-card__bubble {
  position: absolute; z-index: 1; top: -14px; right: 120px; white-space: nowrap;
  padding: 8px 14px; border-radius: 14px 14px 4px 14px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  font-size: var(--step--1); font-weight: 500; color: var(--ink);
}

@media (max-width: 760px) {
  .hero-card { grid-template-columns: minmax(0, 1fr); padding: var(--s-5); }
  /* Pip goes small in the top-right corner, without the bubble. */
  .hero-card__art { position: absolute; top: var(--s-4); right: var(--s-4); }
  .hero-card__circle { width: 68px; height: 68px; }
  .hero-card__circle .hero-pip { width: 54px; }
  .hero-card__emoji { font-size: 1.9rem; }
  .hero-card__bubble { display: none; }
  .hero-tag { margin-right: 72px; }
  .card .hero-card__title { font-size: clamp(1.8rem, 8.4vw, 2.4rem); }
  .hero-card__sub { font-size: var(--step-0); }
}
@media (max-width: 480px) {
  .hero-card__btns { gap: var(--s-2); }
  .hero-card__btns .btn { flex: 1 1 auto; min-width: 0; padding: 0 var(--s-4); font-size: 1rem; }
  .hero-card::after { width: 200px; height: 200px; bottom: -120px; right: -60px; }
}
.dash--low { max-width: 680px; }

/* ── Stat tiles ────────────────────────────────────── */
.tiles { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 720px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile {
  display: flex; align-items: center; gap: var(--s-4); min-width: 0;
  padding: var(--s-5); border-radius: 24px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
}
.tile__icon { display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 16px; font-size: 1.6rem; }
.tile__icon--mint { background: var(--accent-wash); }
.tile__icon--gold { background: var(--gold-wash); }
.tile__body { display: grid; justify-items: start; gap: 2px; min-width: 0; flex: 1 1 auto; }
.tile__label { font-size: var(--step--1); color: var(--ink-soft); }
.tile__value {
  font-family: var(--font-display); font-variation-settings: var(--soft);
  font-size: clamp(1.5rem, 6vw, 2rem); font-weight: 600; line-height: 1.1; letter-spacing: -.01em;
  color: var(--accent-strong); overflow-wrap: anywhere;
}
.tile__value a { color: inherit; text-decoration: none; }
.tile__value a:hover { text-decoration: underline; text-underline-offset: 4px; }
.tile__sub { font-size: var(--step--1); color: var(--ink-soft); }
.tile__link { font-weight: 600; color: var(--accent); white-space: nowrap; }
.chip-soft {
  display: inline-flex; margin-top: var(--s-1); padding: 3px 10px; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--ink-soft); font-size: .78rem; white-space: nowrap;
}
.tile__spark { flex: 0 1 120px; min-width: 56px; align-self: center; }
.tile__spark svg { width: 100%; height: auto; }
.spark__line { fill: none; stroke: var(--mark-save); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark__area { fill: var(--mark-save-wash); }
.spark__dot { fill: var(--mark-save); stroke: var(--surface); stroke-width: 1.5; }

/* ── Coming up ─────────────────────────────────────── */
.coming { padding: var(--s-5); border-radius: 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1); }
.coming__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2); }
.coming__head h2 { font-size: var(--step-1); }
.coming__head .link-btn { margin: 0; font-weight: 600; }
.coming ul { margin: var(--s-2) 0 0; padding: 0; list-style: none; }
.coming li { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) 0; border-top: 1px dashed var(--line-strong); }
.caltile {
  display: grid; justify-items: center; flex: none; width: 46px; padding: 4px 0 5px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
}
.caltile small { font-size: .62rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--coral-ink); }
.caltile b { font-size: 1.15rem; line-height: 1; }
.coming__text { display: grid; flex: 1 1 auto; min-width: 0; }
.coming__text a { color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.coming__text a:hover { color: var(--accent-strong); text-decoration: underline; }
.coming__text small { color: var(--ink-faint); font-size: var(--step--1); }
.coming__cta { flex: none; margin: 0; color: var(--accent); font-weight: 600; font-size: var(--step--1); text-decoration: none; white-space: nowrap; }
.coming__cta:hover { text-decoration: underline; }

@media (min-width: 900px) {
  .hero-card, .tile, .coming { padding: 34px; }
  .tile { padding: 28px 30px; }
}

/* ── Progress cards ────────────────────────────────── */
.prog-grid { display: grid; gap: var(--s-3); margin: 0; padding: 0; list-style: none; grid-template-columns: 1fr; }
@media (min-width: 560px) { .prog-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1280px) { .prog-grid { grid-template-columns: repeat(3, 1fr); } }
.prog-card {
  display: flex; align-items: center; gap: var(--s-3); height: 100%;
  padding: var(--s-3) var(--s-4); border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  color: inherit; text-decoration: none; transition: transform .2s var(--ease), box-shadow .2s;
}
.prog-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.prog-card__ring { position: relative; display: grid; place-items: center; flex: none; }
.prog-card__ring b { position: absolute; font-size: .8rem; font-weight: 600; }
.prog-card__text { display: grid; min-width: 0; }
.prog-card__title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prog-card__text small { color: var(--ink-soft); }

.ring__track { fill: none; stroke: var(--surface-sunk); }
.ring__arc { fill: none; stroke-linecap: round; transition: stroke-dasharray .6s var(--ease); }
.ring.tone-save .ring__arc { stroke: var(--mark-save); }
.ring.tone-pot .ring__arc { stroke: var(--mark-pot); }
.ring.tone-debt .ring__arc { stroke: var(--mark-debt); }

/* ── Charts ────────────────────────────────────────── */
.chart-grid { display: grid; gap: var(--s-4); grid-template-columns: 1fr; }
@media (min-width: 1280px) { .chart-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.chart-card {
  margin: 0; padding: var(--s-4) var(--s-4) var(--s-3); min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-1);
}
.chart-card h3 { font-size: 1.1rem; }
.chart-card__summary { margin-top: 2px; color: var(--ink-soft); font-size: var(--step--1); }
.chart-card__note { font-size: var(--step--1); color: var(--ink-faint); }
.chart { position: relative; height: 210px; margin-top: var(--s-3); touch-action: pan-y; border-radius: var(--r-xs); }
.chart-svg { display: block; overflow: visible; }
.chart-gridline { stroke: var(--line); stroke-width: 1; }
.chart-zero { stroke: var(--line-strong); stroke-width: 1; }
.chart-axis { fill: var(--ink-faint); font-size: 11px; font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.chart-value { fill: var(--ink); font-size: 12px; font-weight: 600; font-family: var(--font-body); font-variant-numeric: tabular-nums; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.chart-bar { transition: opacity .15s; }
.tone-save .chart-bar { fill: var(--mark-save); }
.tone-save .chart-bar.is-neg { fill: var(--ink-faint); }
.chart-bar.is-dim { opacity: .35; }
.chart-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-line.is-projected { stroke-dasharray: 5 5; opacity: .75; }
.tone-save .chart-line { stroke: var(--mark-save); }
.tone-debt .chart-line { stroke: var(--mark-debt); }
.tone-save .chart-area { fill: var(--mark-save-wash); }
.tone-debt .chart-area { fill: var(--mark-debt-wash); }
.chart-dot { stroke: var(--surface); stroke-width: 2; }
.tone-save .chart-dot { fill: var(--mark-save); }
.tone-debt .chart-dot { fill: var(--mark-debt); }
.chart-dot--hover { r: 5; }
.chart-cross { stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-tip {
  position: absolute; z-index: 2; pointer-events: none;
  display: grid; gap: 1px; padding: 6px 10px; border-radius: var(--r-xs);
  background: var(--ink); color: var(--bg); font-size: var(--step--1); white-space: nowrap;
  box-shadow: var(--shadow-2);
}
.chart-tip[hidden] { display: none; }
.chart-tip span { opacity: .75; }
.chart-tip b { font-variant-numeric: tabular-nums; }
.chart:focus-visible { box-shadow: var(--ring); }

.chart-table { margin-top: var(--s-2); font-size: var(--step--1); }
.chart-table summary { min-height: 44px; display: flex; align-items: center; color: var(--accent); cursor: pointer; width: max-content; }
.chart-table table { width: 100%; border-collapse: collapse; margin-top: var(--s-2); font-variant-numeric: tabular-nums; }
.chart-table th, .chart-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; }
.chart-table td { text-align: right; }
.chart-table thead th { color: var(--ink-soft); font-weight: 500; }
.chart-table thead th:last-child { text-align: right; }

/* ── Streak, reminders, backup nudge, low-energy ───── */
.energy-toggle {
  justify-self: end; min-height: 44px; padding: 0 var(--s-4);
  border: 1px solid var(--line-strong); border-radius: var(--r-pill);
  background: var(--surface); color: var(--ink-soft); font-size: var(--step--1); cursor: pointer;
}
.energy-toggle[aria-pressed="true"] { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-strong); font-weight: 550; }
@media (max-width: 560px) { .page-head--row .energy-toggle { justify-self: start; } }

.streak-card {
  grid-column: 1 / -1; display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-3) var(--s-4); border-radius: var(--r);
  background: linear-gradient(120deg, var(--gold-wash), var(--surface) 80%);
  border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--line)); box-shadow: var(--shadow-1);
  color: inherit; text-decoration: none; transition: transform .2s var(--ease);
}
.streak-card:hover { transform: translateY(-2px); }
.streak-card__num {
  display: grid; place-items: center; flex: none; width: 60px; height: 60px; border-radius: 20px;
  background: var(--gold); color: #2B2008;
  font-family: var(--font-display); font-variation-settings: var(--soft); font-size: 1.8rem; font-weight: 700;
}
.streak-card__text { display: grid; min-width: 0; }
.streak-card__text small { color: var(--ink-soft); }
.streak-card__badge { margin-top: 2px; color: var(--gold-ink) !important; font-weight: 500; }


.nudge {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3);
  padding: var(--s-4); border-radius: var(--r); background: var(--accent-wash);
}
.nudge > span { font-size: 1.6rem; }
.nudge > div:first-of-type { flex: 1 1 260px; }
.nudge h2 { font-size: var(--step-1); }
.nudge p { color: var(--ink-soft); font-size: var(--step--1); margin-top: 2px; }
.nudge__actions { display: flex; gap: var(--s-2); }

.dash--low .streak-card { grid-column: auto; }

/* ── Wins wall ─────────────────────────────────────── */
.wins-link {
  display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-4);
  padding: var(--s-4); border-radius: var(--r);
  background: linear-gradient(120deg, var(--gold-wash), var(--surface)); border: 1px solid color-mix(in srgb, var(--gold) 35%, var(--line));
  color: inherit; text-decoration: none;
}
.wins-link > span:first-child { font-size: 1.6rem; }
.wins-link > span:nth-child(2) { flex: 1; display: grid; }
.wins-link small { color: var(--ink-soft); }

.wins-streak {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-5);
  padding: var(--s-5); margin-bottom: var(--s-4); border-radius: var(--r-lg);
  background: radial-gradient(90% 120% at 0% 0%, color-mix(in srgb, var(--gold) 35%, transparent), transparent 60%), var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-2);
}
.wins-streak__num { display: grid; justify-items: center; }
.wins-streak__num .num { font-family: var(--font-display); font-variation-settings: var(--soft); font-size: 4.5rem; font-weight: 700; line-height: 1; color: var(--gold-ink); }
.wins-streak__num small { color: var(--ink-soft); }
.wins-streak__text { flex: 1 1 240px; display: grid; gap: var(--s-2); }
.grace { display: flex; align-items: center; gap: 6px; font-size: var(--step--1); color: var(--ink-soft); }
.grace i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--gold); }
.grace i.on { background: var(--gold); }
.grace span { margin-left: 4px; }

.fun-total { font-size: var(--step-1); }
.fun-total b { color: var(--accent-strong); }
.fun-list { display: flex; flex-wrap: wrap; gap: var(--s-2); margin: var(--s-3) 0 0; padding: 0; list-style: none; }
.fun-list li { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--r-pill); background: var(--surface-2); }

.badges { display: grid; gap: var(--s-3); margin: 0; padding: 0; list-style: none; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 620px) { .badges { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .badges { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.badge {
  display: grid; justify-items: center; gap: 4px; padding: var(--s-4) var(--s-3); text-align: center;
  border-radius: var(--r); border: 1.5px dashed var(--line-strong); background: transparent; color: var(--ink-faint);
}
.badge b { font-weight: 550; font-size: var(--step--1); color: var(--ink-soft); }
.badge small { font-size: .75rem; }
.badge__icon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--surface-2); font-size: 1.6rem; filter: grayscale(1); opacity: .6; }
.badge.is-earned { border-style: solid; border-color: color-mix(in srgb, var(--gold) 45%, var(--line)); background: var(--surface); box-shadow: var(--shadow-1); color: var(--ink-soft); }
.badge.is-earned b { color: var(--ink); }
.badge.is-earned .badge__icon { filter: none; opacity: 1; background: var(--gold-wash); box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--gold); }

/* ── Confetti ──────────────────────────────────────── */
.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 90; }

/* ── Badge shelf (Wins wall) ───────────────────────── */
.shelf {
  --wood: #C99A6B; --wood-dark: #A97A4E; --wood-edge: #8C6240; --panel: #FBF4E6;
  position: relative; margin-top: var(--s-4); padding: 14px 14px 0;
  border-radius: 18px 18px 10px 10px;
  background:
    repeating-linear-gradient(90deg, transparent 0 46px, rgba(140, 98, 64, .05) 46px 48px),
    var(--panel);
  border: 10px solid var(--wood); border-top-width: 14px;
  box-shadow: inset 0 6px 14px rgba(90, 60, 30, .12), 0 10px 24px rgba(60, 40, 20, .14);
}
.shelf__pip { position: absolute; top: -62px; right: 18px; z-index: 1; }
.shelf__rows {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); column-gap: 0; row-gap: 18px;
}
.trophy {
  position: relative; display: grid; justify-items: center; align-content: start; gap: 2px;
  padding: 6px 6px 30px; text-align: center;
}
/* Each badge stands on its own piece of plank; side by side they make one shelf. */
.trophy::after {
  content: ""; position: absolute; left: -1px; right: -1px; bottom: 0; height: 14px;
  background: linear-gradient(var(--wood) 0 60%, var(--wood-dark) 60% 100%);
  border-bottom: 3px solid var(--wood-edge);
  box-shadow: 0 6px 8px -4px rgba(60, 40, 20, .35);
}
.trophy__art { position: relative; width: 64px; height: 77px; }
.medal { width: 100%; height: 100%; display: block; }
.medal__ghost { fill: none; stroke: color-mix(in srgb, var(--wood-edge) 55%, transparent); stroke-width: 2.5; stroke-dasharray: 5 5; }
.trophy__emoji { position: absolute; left: 0; right: 0; top: 50%; text-align: center; font-size: 1.55rem; line-height: 1; }
.trophy b { font-size: .8rem; font-weight: 600; line-height: 1.2; color: #3B2C20; margin-top: 4px; }
.trophy small { font-size: .7rem; line-height: 1.25; color: #7A6450; }
.trophy.is-locked .trophy__emoji { filter: grayscale(1); opacity: .35; }
.trophy.is-locked b { color: #8A7462; font-weight: 500; }
.trophy.is-earned .trophy__art { filter: drop-shadow(0 4px 4px rgba(60, 40, 20, .25)); animation: medal-sway 5s ease-in-out infinite; transform-origin: 50% 0; }
.trophy.is-earned:nth-child(2n) .trophy__art { animation-delay: -2.5s; }
@keyframes medal-sway { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }
@media (prefers-reduced-motion: reduce) { .trophy.is-earned .trophy__art { animation: none; } }
@media (max-width: 420px) {
  .shelf { border-width: 8px; border-top-width: 12px; padding: 10px 8px 0; }
  .shelf__rows { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .trophy__art { width: 54px; height: 65px; }
  .trophy small { font-size: .66rem; }
}
:root[data-theme="dark"] .shelf { --wood: #6E4F36; --wood-dark: #5A3F2A; --wood-edge: #43301F; --panel: #2A2620; }
:root[data-theme="dark"] .trophy b { color: #F1E6D6; }
:root[data-theme="dark"] .medal__ghost { stroke: rgba(241, 230, 214, .4); }
:root[data-theme="dark"] .trophy.is-locked .trophy__emoji { opacity: .5; }
:root[data-theme="dark"] .trophy small, :root[data-theme="dark"] .trophy.is-locked b { color: #B9A792; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .shelf { --wood: #6E4F36; --wood-dark: #5A3F2A; --wood-edge: #43301F; --panel: #2A2620; }
  :root:not([data-theme="light"]) .trophy b { color: #F1E6D6; }
  :root:not([data-theme="light"]) .medal__ghost { stroke: rgba(241, 230, 214, .4); }
  :root:not([data-theme="light"]) .trophy.is-locked .trophy__emoji { opacity: .5; }
  :root:not([data-theme="light"]) .trophy small, :root:not([data-theme="light"]) .trophy.is-locked b { color: #B9A792; }
}
