:root {
  /* Light: identical palette to Klarheit / Haushaltsbuch (turquoise as the only primary colour) */
  --bg: #f6f7f9;
  --card: #ffffff;
  --card2: #eef0f3;
  --text: #101418;
  --muted: #5d6570;
  --line: #e8eaee;
  --accent: #0f8b8d;
  --accent-2: #14a3a0;
  --accent-hover: #0b7476;
  --accent-soft: #e4f4f3;
  --accent-glow: rgba(15, 139, 141, .32);
  --good: #2e8540;
  --danger: #d1342b;
  --gold: #f5b301;
  --fg: #101418;
  --prop: #d6dae0;
  --prop-strong: #8a929c;
  --band: #f6821f;
  --reached-bg: linear-gradient(135deg, #e6f5f4, #d3eeec);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 8px -2px rgba(16, 24, 40, .05);
  --r: 20px;
  --tabs-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
/* Dark: automatically by system setting, or forced via Einstellungen → Darstellung */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1420; --card: #182030; --card2: #1f293b; --text: #f1f2f6; --muted: #949bab; --line: #273246;
    --accent: #14a3a0; --accent-2: #2bbfbb; --accent-hover: #1bb3b0; --accent-soft: #143536; --accent-glow: rgba(20, 163, 160, .35);
    --fg: #e9ecf3; --prop: #2c374b; --prop-strong: #7d8799; --danger: #ff6b61;
    --reached-bg: linear-gradient(135deg, #143536, #18403f); --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1420; --card: #182030; --card2: #1f293b; --text: #f1f2f6; --muted: #949bab; --line: #273246;
  --accent: #14a3a0; --accent-2: #2bbfbb; --accent-hover: #1bb3b0; --accent-soft: #143536; --accent-glow: rgba(20, 163, 160, .35);
  --fg: #e9ecf3; --prop: #2c374b; --prop-strong: #7d8799; --danger: #ff6b61;
  --reached-bg: linear-gradient(135deg, #143536, #18403f); --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}
body.noscroll { overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; }
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 750; }
h3 { font-size: 17px; font-weight: 700; }
h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 8px; }
p { margin: 8px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

#app { padding: calc(var(--safe-t) + 14px) 16px calc(var(--tabs-h) + var(--safe-b) + 24px); max-width: 560px; margin: 0 auto; }

/* ---------- top ---------- */
.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 6px 0 16px; }
.hello { color: var(--muted); font-size: 14px; font-weight: 600; }
.icon-btn { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); color: var(--text); flex: none; text-decoration: none; }
.icon-btn.sm { width: 34px; height: 34px; border-radius: 10px; background: transparent; box-shadow: none; color: var(--muted); }
.icon-btn.sm svg { width: 18px; height: 18px; }
.eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* ---------- week strip ---------- */
.weekstrip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-bottom: 16px; }
.wd { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.wd .dot { position: relative; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; color: #fff; transition: .2s; }
.wd .dot svg { width: 18px; height: 18px; stroke-width: 3; }
.wd.done .dot { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; box-shadow: 0 4px 12px var(--accent-glow); }
.wd.today .dot { border-color: var(--accent); }
.wd.today.done .dot { outline: 2px solid var(--accent); outline-offset: 2px; }
.wd.future .dot { border-style: dashed; opacity: .6; }
.wd .multi { position: absolute; top: -6px; right: -6px; background: var(--text); color: var(--bg); font-size: 10px; border-radius: 8px; padding: 0 5px; line-height: 15px; }
.wd .lbl { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .04em; }
.wd.today .lbl { color: var(--accent); }

/* ---------- cards ---------- */
.card { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; }
.card h3 { margin-bottom: 12px; }
.goal .goal-top { display: flex; justify-content: space-between; align-items: flex-start; }
.goal-num { font-size: 15px; color: var(--muted); margin-top: 2px; }
.goal-num b { font-size: 30px; color: var(--text); font-weight: 800; }
.gstars { display: flex; gap: 6px; margin: 12px 0 6px; flex-wrap: wrap; }
.gstar svg { width: 30px; height: 30px; fill: var(--card2); stroke: var(--line); stroke-width: 1.4; }
.gstar.on svg { fill: var(--gold); stroke: #d99a00; animation: pop .4s ease; }
.gstar.extra.on svg { fill: var(--accent-2); stroke: var(--accent); }
.goal-msg { font-size: 14px; color: var(--muted); }
.goal.reached { background: var(--reached-bg); }
.streak { display: inline-block; margin-left: 4px; color: var(--accent); font-weight: 700; }
@keyframes pop { 0% { transform: scale(.4); } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }

.chip-btn { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 650; padding: 7px 12px; border-radius: 999px; background: var(--card2); color: var(--text); }
.chip-btn svg { width: 16px; height: 16px; }
.chip-btn.accent { background: var(--accent); color: #fff; }

.sec-head { display: flex; justify-content: space-between; align-items: center; margin: 22px 0 10px; }
.wcard { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.wthumbs { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; width: 64px; height: 64px; flex: none; background: var(--card2); border-radius: 14px; padding: 4px; }
.wthumbs span { display: grid; place-items: center; }
.wthumbs .fig { width: 100%; height: 100%; }
.wbody { flex: 1; min-width: 0; }
.wbody h3 { margin: 0 0 3px; font-size: 16px; }
.meta { font-size: 13px; color: var(--muted); }
.meta.small { font-size: 12px; margin-top: 2px; }
.play-btn { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; box-shadow: 0 6px 16px var(--accent-glow); }
.play-btn svg { width: 20px; height: 20px; margin-left: 2px; stroke: none; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* ---------- figure ---------- */
.fig { display: block; width: 100%; height: 100%; overflow: hidden; }
.fig polyline { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.fg-body, .fg-limb { stroke: var(--fg); stroke-width: 4.6; }
.fg-far { stroke: var(--fg); stroke-width: 4.2; opacity: .35; }
.fg-head { fill: var(--fg); }
.fg-floor { stroke: var(--line); stroke-width: 1.5; }
.fg-prop { stroke: var(--prop); stroke-width: 4; }
.fg-box { fill: var(--prop); }
.fg-bar { stroke: var(--prop-strong); stroke-width: 3.5; stroke-linecap: round; }
.fg-band { stroke: var(--band); stroke-width: 2; stroke-dasharray: 3 2; }
.fg-db { fill: var(--accent); }

/* ---------- tabs ---------- */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around; padding: 6px 8px calc(var(--safe-b) + 6px); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); border-top: 1px solid var(--line); }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 650; color: var(--muted); padding: 4px 10px; min-width: 70px; }
.tab.on { color: var(--accent); }
.tab svg { width: 24px; height: 24px; }
body[data-view="w"] .tabs { display: none; }

/* ---------- library ---------- */
.searchbar { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 14px; padding: 0 12px; box-shadow: var(--shadow); color: var(--muted); }
.searchbar input { flex: 1; border: 0; background: transparent; padding: 12px 0; outline: none; color: var(--text); font-size: 16px; }
.chips { display: flex; gap: 6px; margin: 10px -16px 0; padding: 0 16px; }
.chips.scroll { overflow-x: auto; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; margin: 0; padding: 0; }
.chip { white-space: nowrap; padding: 8px 13px; border-radius: 999px; background: var(--card); font-size: 14px; font-weight: 600; box-shadow: var(--shadow); }
.chip.on { background: var(--text); color: var(--bg); }
.chips.small .chip { font-size: 12px; padding: 6px 11px; }
.chip.ghost { background: transparent; border: 1.5px solid var(--line); box-shadow: none; }
.chip.ghost.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn.primary:active, .play-btn:active, .ctrl.main:active { background: var(--accent-hover); }
.lib-cat { margin: 22px 0 8px; font-size: 15px; }
.lib-cat span { color: var(--muted); font-weight: 500; font-size: 13px; }
.exlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.exrow { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 16px; padding: 8px 10px 8px 8px; box-shadow: var(--shadow); cursor: pointer; }
.exrow.current { outline: 2px solid var(--accent); }
.exlist.compact .exrow { box-shadow: none; background: var(--card2); }
.thumb { width: 56px; height: 48px; flex: none; background: var(--card2); border-radius: 12px; padding: 3px; display: grid; place-items: center; }
.exlist.compact .thumb { background: var(--card); }
.thumb.lg { width: 96px; height: 80px; }
.exinfo { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.exinfo b { font-size: 15px; font-weight: 650; }
.exmeta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.exmeta.big { font-size: 14px; margin: 6px 0 4px; }
.lvl { display: inline-flex; gap: 2px; }
.lvl i { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.lvl i.on { background: var(--accent); }
.add-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.add-btn.added { background: var(--good); color: #fff; }
.exhero { background: var(--card2); border-radius: 18px; height: 200px; padding: 16px; margin-bottom: 14px; }

/* ---------- sheets ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 100; }
.sheet-bg { position: absolute; inset: 0; background: rgba(0, 0, 0, .4); opacity: 0; transition: opacity .25s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88dvh; overflow-y: auto; background: var(--bg); border-radius: 24px 24px 0 0; padding: 8px 18px calc(var(--safe-b) + 20px); transform: translateY(100%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); max-width: 600px; margin: 0 auto; overscroll-behavior: contain; }
.sheet.tall { height: 92dvh; max-height: 92dvh; }
.sheet-wrap.open .sheet-bg { opacity: 1; }
.sheet-wrap.open .sheet { transform: translateY(0); }
.sheet-grab { width: 100%; height: 22px; display: grid; place-items: center; touch-action: none; }
.sheet-grab::before { content: ""; width: 40px; height: 5px; border-radius: 3px; background: var(--line); }
.sheet h3 { margin: 4px 0 6px; font-size: 20px; }
.picker-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; position: sticky; top: -8px; background: var(--bg); padding: 4px 0 8px; z-index: 2; }
.picker-head h3 { font-size: 17px; margin: 0; }

.btn { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 14px; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); font-weight: 650; margin-top: 10px; text-decoration: none; color: var(--text); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px var(--accent-glow); }
.btn.danger { color: var(--danger); }
.btn.big { padding: 17px; font-size: 17px; }
.btn-col { display: flex; flex-direction: column; margin-top: 8px; }
.btn-row { display: flex; gap: 10px; }

.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.set-row:last-child { border-bottom: 0; }
.set-row b { display: block; font-weight: 650; font-size: 15px; }
.set-row span { display: block; font-size: 12px; color: var(--muted); }
.stepper { display: flex; align-items: center; background: var(--card2); border-radius: 12px; flex: none; }
.stepper button { width: 40px; height: 40px; font-size: 22px; font-weight: 500; color: var(--accent); }
.stepper output { min-width: 56px; text-align: center; font-weight: 750; font-variant-numeric: tabular-nums; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch i { position: absolute; inset: 0; border-radius: 15px; background: var(--line); transition: .2s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }
.keybox { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 12px; padding: 8px 8px 8px 12px; }
.keybox code { flex: 1; font-size: 12px; word-break: break-all; color: var(--muted); }
.goal-pick { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 14px 0; }
.gp { aspect-ratio: 1; border-radius: 14px; background: var(--card); box-shadow: var(--shadow); font-weight: 800; font-size: 18px; }
.gp.on { background: var(--accent); color: #fff; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--card2); border-radius: 12px; padding: 3px; margin: 14px 0 4px; }
.seg button { padding: 9px; border-radius: 10px; font-weight: 650; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.item-sheet-head { display: flex; gap: 14px; align-items: center; }
.item-sheet-head h3 { font-size: 18px; }

.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + var(--safe-b) + 20px); transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600; opacity: 0; transition: .25s; z-index: 300; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- editor ---------- */
.edit-top { align-items: center; }
.title-input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; padding: 6px 4px; border-radius: 10px; outline: none; }
.title-input:focus { background: var(--card); }
.edit-meta { color: var(--muted); font-size: 13px; margin: -8px 0 12px 4px; }
.pauses { padding: 4px 16px; }
.round { padding: 12px; }
.round-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.rnum { width: 28px; height: 28px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); font-weight: 800; display: grid; place-items: center; font-size: 14px; flex: none; }
.round-name { flex: 1; min-width: 0; border: 0; background: transparent; font-weight: 700; font-size: 16px; padding: 6px; border-radius: 8px; outline: none; }
.round-name:focus { background: var(--card2); }
.items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item-row { display: flex; align-items: center; gap: 8px; background: var(--card2); border-radius: 14px; padding: 6px; transition: transform .18s; }
.item-row.dragging { transition: none; z-index: 5; position: relative; box-shadow: 0 12px 30px rgba(0, 0, 0, .2); background: var(--card); scale: 1.02; }
.handle { width: 30px; height: 44px; display: grid; place-items: center; color: var(--muted); touch-action: none; cursor: grab; flex: none; }
.handle svg { width: 20px; height: 20px; fill: currentColor; stroke: none; }
.item-row .thumb { background: var(--card); width: 50px; height: 42px; }
.item-main { flex: 1; min-width: 0; text-align: left; display: flex; flex-direction: column; padding: 4px; }
.item-main b { font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-main span { font-size: 13px; color: var(--accent); font-weight: 650; }
.add-row { width: 100%; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 11px; margin-top: 8px; border: 1.5px dashed var(--line); border-radius: 14px; color: var(--muted); font-weight: 650; font-size: 14px; }
.add-row svg { width: 18px; height: 18px; }
.edit-actions { margin-bottom: 14px; }
.edit-actions .btn { margin-top: 0; font-size: 14px; }
.sticky-start { position: sticky; bottom: calc(var(--safe-b) + 10px); padding-top: 8px; }
body[data-view="w"] #app { padding-bottom: calc(var(--safe-b) + 20px); }

/* ---------- player ---------- */
.player { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; padding: calc(var(--safe-t) + 8px) 16px calc(var(--safe-b) + 12px); user-select: none; -webkit-user-select: none; overflow: hidden; touch-action: pan-y; }
.p-top { display: flex; align-items: center; gap: 10px; }
.p-info { flex: 1; text-align: center; font-size: 13px; font-weight: 650; color: var(--muted); }
.timeline { display: flex; gap: 8px; margin: 14px 0 8px; }
.tl-round { flex: 1; display: flex; gap: 2px; }
.tl-round i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); transition: .3s; }
.tl-round i.done { background: var(--accent); }
.tl-round i.cur { background: var(--accent-2); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.p-stage { flex: 1; display: flex; flex-direction: column; justify-content: center; min-height: 0; }
.p-card { background: var(--card); border-radius: 28px; box-shadow: var(--shadow); padding: 18px 18px 22px; display: flex; flex-direction: column; align-items: center; transition: transform .2s, opacity .2s; will-change: transform; }
.p-fig { width: 100%; height: min(36dvh, 280px); }
.p-fig.small { height: min(22dvh, 170px); opacity: .8; }
.p-name { font-size: 24px; text-align: center; margin-top: 6px; }
.p-reps { font-size: 88px; font-weight: 850; line-height: 1; letter-spacing: -0.04em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.p-reps small { font-size: 44px; color: var(--muted); margin-left: 2px; }
.p-label { font-size: 15px; font-weight: 700; color: var(--accent); min-height: 21px; margin-top: 4px; }
.p-timer { position: relative; width: 150px; height: 150px; margin-top: 8px; }
.p-timer svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { stroke: var(--card2); stroke-width: 9; }
.ring { stroke: var(--accent); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset .12s linear; }
.phase-lead .ring { stroke: var(--gold); }
.p-card.rest .ring { stroke: var(--good); }
.p-time { position: absolute; inset: 0; display: grid; place-items: center; font-size: 52px; font-weight: 850; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.p-time.hot { color: var(--accent); animation: tickpop .5s ease; }
@keyframes tickpop { 0% { transform: scale(1.18); } 100% { transform: scale(1); } }
.p-rest-title { font-size: 30px; font-weight: 850; margin: 4px 0 8px; }
.p-upnext { font-size: 14px; color: var(--muted); text-align: center; }
.swipe-hint { text-align: center; color: var(--muted); font-size: 13px; margin-top: 12px; font-weight: 600; }
.swipe-hint.dim { opacity: .5; }
.p-bottom { display: flex; flex-direction: column; gap: 12px; }
.p-next { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 18px; padding: 8px; box-shadow: var(--shadow); }
.p-next > div { display: flex; flex-direction: column; }
.p-next b { font-size: 15px; }
.p-next span:last-child { font-size: 13px; color: var(--accent); font-weight: 650; }
.p-next.last { justify-content: center; padding: 14px; }
.p-ctrl { display: flex; align-items: center; justify-content: center; gap: 26px; }
.ctrl { width: 54px; height: 54px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); display: grid; place-items: center; }
.ctrl.flip svg { transform: scaleX(-1); }
.ctrl.main { width: 70px; height: 70px; background: var(--accent); color: #fff; box-shadow: 0 8px 20px var(--accent-glow); }
.ctrl.main svg { width: 28px; height: 28px; }
.ctrl.main.done svg { stroke-width: 3; }
.paused-banner { position: absolute; top: calc(var(--safe-t) + 60px); left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 13px; }

/* finish */
.finish { flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; text-align: center; padding: 30px 4px 10px; position: relative; }
.finish-emoji { font-size: 76px; animation: pop .6s ease; }
.finish h1 { margin: 8px 0 0; }
.finish h3 { margin: 18px 0 10px; }
.finish .card { width: 100%; margin-top: 14px; }
.finish .gstars { justify-content: center; }
.finish .btn { margin-top: 22px; }
.rate { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; width: 100%; }
.rate button { background: var(--card); border-radius: 16px; padding: 12px 4px; font-size: 13px; font-weight: 650; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rate button span { font-size: 28px; }
.rate button.on { outline: 2.5px solid var(--accent); }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -10px; left: calc(var(--i) * 4.2%); width: 8px; height: 14px; border-radius: 2px; background: hsl(calc(var(--i) * 37), 90%, 60%); animation: fall 2.4s ease-in calc(var(--i) * 0.05s) forwards; }
@keyframes fall { to { transform: translateY(105dvh) rotate(calc(var(--i) * 90deg)); opacity: .2; } }

/* ---------- stats ---------- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.tile { background: var(--card); border-radius: 18px; padding: 14px; box-shadow: var(--shadow); }
.tile b { display: block; font-size: 26px; font-weight: 850; letter-spacing: -0.03em; }
.tile span { font-size: 13px; color: var(--muted); }
.bars { display: flex; gap: 6px; height: 150px; align-items: stretch; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar-col > span { font-size: 9px; color: var(--muted); }
.bar-area { position: relative; flex: 1; width: 100%; display: flex; align-items: flex-end; }
.bar { width: 100%; background: var(--card2); border-radius: 6px 6px 3px 3px; display: flex; justify-content: center; font-size: 11px; font-weight: 700; color: var(--muted); padding-top: 3px; min-height: 0; }
.bar-col.hit .bar { background: linear-gradient(var(--accent-2), var(--accent)); color: #fff; }
.bar-col.now .bar { outline: 2px solid var(--accent); outline-offset: 1px; }
.goal-line { position: absolute; left: -3px; right: -3px; border-top: 2px dashed var(--gold); }
.legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.lg-bar { width: 12px; height: 12px; border-radius: 3px; background: var(--accent); }
.lg-goal { width: 14px; border-top: 2px dashed var(--gold); margin-left: 10px; }
.hbar { display: grid; grid-template-columns: 120px 1fr 44px; align-items: center; gap: 8px; font-size: 13px; margin: 8px 0; }
.hbar div { height: 10px; background: var(--card2); border-radius: 5px; overflow: hidden; }
.hbar i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.hbar b { text-align: right; }
.toplist, .history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.toplist li { display: flex; gap: 10px; align-items: center; }
.history li { display: grid; grid-template-columns: 76px 1fr auto; gap: 8px; font-size: 14px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.history li:last-child { border: 0; }
.history em { font-style: normal; color: var(--muted); font-size: 12px; }
.ratings { display: flex; gap: 6px; font-size: 24px; flex-wrap: wrap; }

/* ---------- badges ---------- */
.stars-card { display: flex; gap: 16px; align-items: center; }
.big-star { position: relative; width: 84px; height: 84px; flex: none; }
.big-star svg { width: 100%; height: 100%; fill: var(--gold); stroke: #d99a00; stroke-width: 1; }
.big-star b { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; font-weight: 850; color: #6b4a00; padding-top: 4px; }
.star-weeks { display: grid; grid-template-columns: repeat(12, 1fr); gap: 2px; margin: 0 0 18px; }
.sw { display: flex; flex-direction: column; align-items: center; font-size: 9px; color: var(--muted); }
.sw svg { width: 100%; max-width: 26px; height: auto; aspect-ratio: 1; fill: var(--card2); stroke: var(--line); stroke-width: 1.4; }
.sw.on svg { fill: var(--gold); stroke: #d99a00; }
.sw.now span { color: var(--accent); font-weight: 700; }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.badge { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 3px; background: var(--card); border-radius: 18px; padding: 14px 6px; box-shadow: var(--shadow); }
.badge .patch { width: 62px; height: 62px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; background: var(--card2); filter: grayscale(1); opacity: .45; border: 3px dashed var(--line); }
.badge.on .patch { filter: none; opacity: 1; background: radial-gradient(circle at 30% 30%, #e9f7f6, #9fd5d3 60%, var(--accent-2)); border: 3px solid var(--card); box-shadow: 0 0 0 2px var(--accent), 0 6px 14px var(--accent-glow); }
.badge b { font-size: 12.5px; line-height: 1.2; margin-top: 4px; }
.badge small { font-size: 10.5px; color: var(--muted); line-height: 1.25; }
.badge:not(.on) b { color: var(--muted); }
.badges.new { display: flex; justify-content: center; flex-wrap: wrap; }
.badges.new .badge { animation: pop .5s ease; width: 31%; }

/* theme picker */
.seg.three { grid-template-columns: repeat(3, 1fr); margin: 4px 0 0; }
