/* Magic Rings — two rings of glass marbles in an enamel tray, on pearl by day
   and on a starry night in the dark. The board is one full-screen canvas; the
   bars float over it as frosted glass. Light and dark follow the system unless
   the player picks one (html[data-theme]). */

:root {
  color-scheme: light;
  --bg: #ece6f6;
  --ink: #1e1a38;
  --muted: #5d5680;
  --paper: #fbfaff;
  --paper-2: #f0ecf8;
  --glass: rgba(251, 250, 255, 0.8);
  --line: rgba(60, 40, 120, 0.13);
  --accent: #6a4ddc;
  --accent-soft: rgba(106, 77, 220, 0.12);
  --ca-accent: #6a4ddc; /* the accounts SDK's sheets and chip (white on it 5.7:1) */
  --star: #f0ae32;
  --star-off: rgba(60, 40, 120, 0.16);
  --shadow: 0 12px 34px -14px rgba(60, 35, 130, 0.4), 0 2px 6px -2px rgba(60, 35, 130, 0.14);
  --backdrop: rgba(24, 14, 60, 0.34);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Varela Round", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ease-out: cubic-bezier(0.2, 0.9, 0.25, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --band-easy: #22a870;
  --band-medium: #2f7fe8;
  --band-hard: #e98a1f;
  --band-master: #9a5ae6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121233;
    --ink: #efeaff;
    --muted: #b2abd8;
    --paper: #1d1d46;
    --paper-2: #28295c;
    --glass: rgba(32, 32, 76, 0.74);
    --line: rgba(255, 255, 255, 0.11);
    --accent: #7357e6;
    --accent-soft: rgba(166, 140, 255, 0.16);
    --ca-accent: #6a4ddc;
    --star: #f5bb46;
    --star-off: rgba(255, 255, 255, 0.16);
    --shadow: 0 14px 36px -14px rgba(0, 0, 0, 0.75), 0 2px 6px -2px rgba(0, 0, 0, 0.4);
    --backdrop: rgba(3, 3, 14, 0.56);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121233;
  --ink: #efeaff;
  --muted: #b2abd8;
  --paper: #1d1d46;
  --paper-2: #28295c;
  --glass: rgba(32, 32, 76, 0.74);
  --line: rgba(255, 255, 255, 0.11);
  --accent: #7357e6;
  --accent-soft: rgba(166, 140, 255, 0.16);
  --ca-accent: #6a4ddc;
  --star: #f5bb46;
  --star-off: rgba(255, 255, 255, 0.16);
  --shadow: 0 14px 36px -14px rgba(0, 0, 0, 0.75), 0 2px 6px -2px rgba(0, 0, 0, 0.4);
  --backdrop: rgba(3, 3, 14, 0.56);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }

/* ------------------------------------------------------------ the board */
.board {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  outline: none;
  transition: opacity 0.22s ease;
}
.board.swap { opacity: 0; }
.board:focus-visible { outline: 3px solid var(--accent); outline-offset: -8px; border-radius: 22px; }

/* ------------------------------------------------------------ the bars */
.bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) calc(env(safe-area-inset-right) + 12px) 8px calc(env(safe-area-inset-left) + 12px);
  pointer-events: none;
  z-index: 2;
}
.bar > * { pointer-events: auto; }
.bar-tools { display: flex; align-items: center; gap: 8px; }
.pill, .icon-btn, .dock, .coach, .toast, .goal {
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  min-width: 0;
  padding: 0 10px 0 8px;
  border-radius: 999px;
  color: var(--ink);
  transition: transform 0.18s var(--ease-out);
}
.pill:active { transform: scale(0.96); }
.pill-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; min-width: 0; }
.pill-main { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pill-sub { font-size: 12px; font-weight: 650; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; }
.pill-chev { width: 18px; height: 18px; color: var(--muted); flex: none; }
.gem {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, 0.22), inset 0 2px 3px rgba(255, 255, 255, 0.6), 0 2px 6px -2px rgba(0, 0, 0, 0.35);
}
.g-1 { background: radial-gradient(circle at 34% 30%, #fff 0 12%, #ece6f4 40%, #b9aed0 100%); }
.g-2 { background: radial-gradient(circle at 34% 30%, #ffe7b8 0 10%, #f2a73a 45%, #a2560e 100%); }
.g-3 { background: radial-gradient(circle at 34% 30%, #c9f5e2 0 10%, #2fb184 45%, #0f6347 100%); }
.g-4 { background: radial-gradient(circle at 34% 30%, #cfe0ff 0 10%, #3a6fe0 45%, #182f86 100%); }
.g-5 { background: radial-gradient(circle at 34% 30%, #fff 0 12%, #c9ecff 40%, #6aa5d6 100%); }
.gem.zen { position: relative; }
.gem.zen::after { content: ""; position: absolute; inset: 7px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.85); box-shadow: 0 0 6px rgba(255, 255, 255, 0.6); }
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink);
  transition: transform 0.18s var(--ease-out);
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn svg { width: 22px; height: 22px; }
.chip-slot { min-width: 36px; display: grid; place-items: center; }

/* the goal card: where the layout leaves room (app.js places it) */
.goal {
  position: fixed;
  left: var(--gx, 12px);
  top: var(--gy, 70px);
  width: var(--gw, 140px);
  height: var(--gh, 90px);
  padding: 22px 8px 6px;
  border-radius: 20px;
  color: var(--ink);
  z-index: 1;
  transition: transform 0.18s var(--ease-out), opacity 0.3s ease;
}
.goal[hidden] { display: none; }
.goal.swap { opacity: 0; }
.goal:active { transform: scale(0.96); }
.goal-label {
  position: absolute;
  left: 12px;
  top: 6px;
  font-size: 11.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.goal-mini { display: block; width: 100%; height: 100%; }
.goal.pulse { animation: goal-pulse 1.2s var(--ease-out); }

.dock {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 10px);
  transform: translateX(-50%);
  width: min(520px, calc(100vw - 20px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: center;
  gap: 2px;
  padding: 6px;
  border-radius: 24px;
  z-index: 2;
}
.tool {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 66px;
  height: 54px;
  padding: 0 8px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--ink);
  transition: background 0.18s ease, transform 0.18s var(--ease-out), opacity 0.2s ease, color 0.2s ease;
}
.tool svg { width: 23px; height: 23px; }
.tool span { font-size: 11.5px; font-weight: 650; line-height: 1.1; white-space: nowrap; }
.tool:active:not(:disabled) { transform: scale(0.93); background: var(--accent-soft); }
.tool:disabled { opacity: 0.36; cursor: default; }
.tool.sure, .tool.armed { color: #fff; background: var(--accent); }
.score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-width: 0;
}
.score-n { display: flex; flex-direction: column; align-items: center; line-height: 1; min-width: 40px; }
.score-n b { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.score-n small { margin-top: 4px; font-size: 11px; font-weight: 650; color: var(--muted); white-space: nowrap; }
.score-n b.bump { animation: bump 0.32s var(--spring); }
.hud-stars { display: flex; gap: 3px; }
.hud-zen { display: none; color: var(--accent); }
.hud-zen svg { width: 26px; height: 26px; display: block; }
.zen-mode .hud-stars { display: none; }
.zen-mode .hud-zen { display: block; }
.hud-stars i, .result-stars i, .st-stars i {
  display: block;
  width: 15px;
  height: 15px;
  background: var(--star);
  clip-path: polygon(50% 2%, 62% 36%, 98% 37%, 69% 59%, 80% 94%, 50% 73%, 20% 94%, 31% 59%, 2% 37%, 38% 36%);
  transition: background 0.3s ease, transform 0.3s var(--spring);
}
.hud-stars i.off, .result-stars i.off, .st-stars i.off { background: var(--star-off); }
.hud-stars i.lost { animation: lose 0.42s ease; }

/* landscape phones: the dock becomes a rail on the right */
@media (orientation: landscape) and (max-height: 540px) {
  .bar { padding-top: calc(env(safe-area-inset-top) + 6px); }
  .dock {
    left: auto;
    right: calc(env(safe-area-inset-right) + 10px);
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
    width: auto;
    grid-template-columns: auto;
    grid-auto-flow: row;
    gap: 0;
    padding: 6px 4px;
  }
  .score { flex-direction: column; gap: 6px; padding: 6px 0; }
  .tool { min-width: 64px; height: 50px; }
}

/* ------------------------------------------------------------ coach and toast */
.coach {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 86px);
  transform: translateX(-50%);
  width: min(440px, calc(100vw - 32px));
  margin: 0;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  z-index: 2;
  pointer-events: none;
  animation: rise 0.38s var(--ease-out);
}
.coach p { margin: 0; }
.coach[hidden] { display: none; }
.toast {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top) + 66px);
  transform: translate(-50%, -8px);
  width: max-content;
  max-width: min(360px, calc(100vw - 32px));
  padding: 10px 18px;
  border-radius: 18px;
  text-align: center;
  font-size: 14px;
  font-weight: 650;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.3s var(--ease-out);
  z-index: 3;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (orientation: landscape) and (max-height: 540px) {
  .coach { bottom: calc(env(safe-area-inset-bottom) + 12px); width: min(420px, calc(100vw - 200px)); }
}

/* ------------------------------------------------------------ sheets */
.sheet {
  border: 0;
  padding: 0;
  margin: auto auto 0;
  width: 100%;
  max-width: 560px;
  max-height: min(88dvh, 860px);
  border-radius: 26px 26px 0 0;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 -20px 60px -20px rgba(24, 14, 60, 0.5);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sheet:not([open]) { display: none; }
.sheet[open] { animation: sheet-up 0.36s var(--ease-out); }
.sheet.closing { animation: sheet-down 0.24s ease forwards; }
.sheet::backdrop { background: var(--backdrop); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); }
.sheet[open]::backdrop { animation: fade 0.3s ease; }
@media (min-width: 720px) and (min-height: 600px) {
  .sheet { margin: auto; border-radius: 26px; box-shadow: var(--shadow), 0 30px 80px -30px rgba(24, 14, 60, 0.5); }
  .sheet[open] { animation: sheet-pop 0.32s var(--ease-out); }
  .sheet.closing { animation: sheet-out 0.2s ease forwards; }
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 10px 22px;
}
.sheet-head h2 { margin: 0; font-size: 23px; font-weight: 800; letter-spacing: -0.015em; }
.close {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: var(--paper-2);
  color: var(--muted);
}
.close svg { width: 20px; height: 20px; }
.sheet-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 4px 22px calc(22px + env(safe-area-inset-bottom));
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.row.last { border-bottom: 0; }
.row .two { display: flex; flex-direction: column; }
.note { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.row select {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  font-weight: 600;
}
.switch {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  position: relative;
  width: 50px;
  height: 30px;
  margin: 0;
  border-radius: 999px;
  background: var(--star-off);
  transition: background 0.2s ease;
  cursor: pointer;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.24s var(--spring);
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }
.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border-radius: 13px;
  background: var(--paper-2);
  border: 1px solid var(--line);
}
.seg button {
  border: 0;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  background: transparent;
  font-size: 14px;
  font-weight: 650;
  color: var(--muted);
  transition: background 0.18s ease, color 0.18s ease;
}
.seg button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12); }
.seg.small button { padding: 0 10px; font-size: 13px; }
.seg.big { flex: 1; max-width: 320px; }
.seg.big button { flex: 1; min-height: 40px; font-size: 15.5px; font-weight: 750; }
.link-btn { border: 0; background: none; padding: 8px 0; color: var(--accent); font-weight: 700; }
.version { font-size: 13px; color: var(--muted); font-weight: 500; }

.btn {
  min-height: 48px;
  padding: 0 18px;
  border-radius: 15px;
  border: 0;
  font-weight: 750;
  font-size: 16px;
  transition: transform 0.16s var(--ease-out), background 0.2s ease;
}
.btn:active { transform: scale(0.96); }
.btn.primary { background: var(--accent); color: #fff; box-shadow: 0 8px 20px -10px var(--accent); }
.btn.ghost { background: var(--paper-2); color: var(--ink); }
.btn.wide { width: 100%; margin-top: 14px; }

/* ------------------------------------------------------------ stages */
.summary { margin: 0 0 10px; font-size: 14px; font-weight: 650; }
.tier { border: 1px solid var(--line); border-radius: 20px; background: var(--paper-2); margin: 0 0 10px; overflow: hidden; }
.tier-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 10px 14px;
  border: 0;
  background: transparent;
  text-align: left;
}
.tier-head .gem { width: 34px; height: 34px; }
.tier-name { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.tier-name b { font-size: 16.5px; font-weight: 800; }
.tier-name small { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.tier-stars { margin-left: auto; font-size: 13px; font-weight: 750; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tier-chev { width: 18px; height: 18px; color: var(--muted); transition: transform 0.25s var(--ease-out); flex: none; }
.tier[data-open="true"] .tier-chev { transform: rotate(180deg); }
.tier-body { display: none; padding: 2px 14px 14px; }
.tier[data-open="true"] .tier-body { display: block; animation: fade 0.25s ease; }
.band { margin-top: 8px; }
.band-name { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; font-size: 11.5px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.band-name::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--band-c); }
.b-easy { --band-c: var(--band-easy); }
.b-medium { --band-c: var(--band-medium); }
.b-hard { --band-c: var(--band-hard); }
.b-master { --band-c: var(--band-master); }
.st-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.st {
  position: relative;
  aspect-ratio: 1;
  min-height: 48px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 0;
  font-weight: 800;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
  transition: transform 0.16s var(--ease-out);
  box-shadow: inset 0 -3px 0 color-mix(in srgb, var(--band-c) 55%, transparent);
}
.st:active:not(:disabled) { transform: scale(0.93); }
.st.cur { box-shadow: 0 0 0 2.5px var(--accent), inset 0 -3px 0 color-mix(in srgb, var(--band-c) 55%, transparent); }
.st:disabled { opacity: 0.38; cursor: default; }
.st .lock { position: absolute; right: 6px; top: 6px; width: 11px; height: 11px; color: var(--muted); }
.st-stars { display: flex; gap: 1px; }
.st-stars i { width: 9px; height: 9px; }

.zen-intro { margin: 0 0 6px; font-size: 14.5px; font-weight: 550; }
.zen-h { margin: 16px 0 8px; font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.tier-chips, .kind-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 6px 14px 6px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  font-size: 14.5px;
  font-weight: 700;
  transition: background 0.18s ease, box-shadow 0.18s ease, transform 0.16s var(--ease-out);
}
.chip.plain { padding-left: 14px; }
.chip .gem { width: 26px; height: 26px; }
.chip small { font-size: 12px; font-weight: 650; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--paper); box-shadow: 0 0 0 2px var(--accent); }
.chip:active { transform: scale(0.95); }
.zen-note { margin: 10px 0 0; font-size: 13.5px; font-weight: 550; min-height: 2.6em; }
.zen-count { margin: 10px 0 0; text-align: center; font-size: 13px; font-weight: 650; }

.friends { margin: 18px 0 4px; padding-top: 16px; border-top: 1px solid var(--line); }
.friends h3 { margin: 0 0 10px; font-size: 15px; font-weight: 750; }
.friends-board { min-height: 120px; margin-top: 12px; }
.friends.in-result { margin: 4px 0 16px; padding-top: 12px; text-align: left; }
.friends.in-result .friends-board { margin-top: 4px; min-height: 90px; }

/* ------------------------------------------------------------ help */
.goal-card { padding: 4px 0 16px; border-bottom: 1px solid var(--line); }
.goal-card h3 { margin: 0 0 8px; font-size: 17px; font-weight: 800; }
.goal-big {
  display: block;
  width: 100%;
  height: 170px;
  border-radius: 18px;
  background: radial-gradient(ellipse at 50% 40%, var(--paper), var(--paper-2));
  border: 1px solid var(--line);
}
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 6px; padding: 0; list-style: none; font-size: 13.5px; font-weight: 650; }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend canvas { width: 16px; height: 16px; }
.goal-card p { margin: 6px 0 0; font-size: 14.5px; color: var(--muted); font-weight: 500; }
.help .rule { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 14px; align-items: start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.help .rule.plain { grid-template-columns: minmax(0, 1fr); }
.help h3 { margin: 0 0 3px; font-size: 16px; font-weight: 750; }
.help .rule p { margin: 0; font-size: 14.5px; color: var(--muted); font-weight: 500; }
.help .version { margin-top: 16px; }
.fig { width: 112px; height: auto; display: block; }
.fig-track { fill: none; stroke: var(--paper-2); stroke-width: 12; }
.fig-track.live { stroke: color-mix(in srgb, var(--accent) 22%, var(--paper-2)); }
.fig-screen { fill: var(--paper-2); stroke: var(--line); }
.fig-split { stroke: var(--muted); stroke-width: 1.2; stroke-dasharray: 3 3; opacity: 0.6; }
.fig-arrow { fill: none; stroke: var(--accent); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.fig-finger { fill: var(--accent); opacity: 0.28; }
.help .fig circle[class^="c"] { stroke: rgba(0, 0, 0, 0.25); stroke-width: 0.8; }
.c0 { fill: #e8464e; }
.c1 { fill: #f4b62a; }
.c2 { fill: #22a870; }
.c3 { fill: #2f7fe8; }
.c4 { fill: #9a5ae6; }
.c5 { fill: #ece8e1; }
.fig .shared { stroke: var(--ink) !important; stroke-width: 1.4 !important; }
.fig .dim { opacity: 0.45; }

/* ------------------------------------------------------------ result */
.result { text-align: center; padding: 26px 22px calc(22px + env(safe-area-inset-bottom)); overflow-y: auto; }
.result-stars { display: flex; justify-content: center; gap: 10px; margin: 4px 0 12px; }
.result-stars i { width: 46px; height: 46px; transform: scale(0.3); opacity: 0; }
.result[open] .result-stars i { animation: star-pop 0.5s var(--spring) forwards; }
.result[open] .result-stars i:nth-child(2) { animation-delay: 0.14s; }
.result[open] .result-stars i:nth-child(3) { animation-delay: 0.28s; }
.result-zen { display: none; justify-content: center; margin: 0 0 8px; color: var(--accent); }
.result-zen svg { width: 54px; height: 54px; }
.result.zen-mode .result-stars { display: none; }
.result.zen-mode .result-zen { display: flex; }
.result[open] .result-zen svg { animation: star-pop 0.6s var(--spring); }
.result h2 { margin: 0; font-size: 27px; font-weight: 850; letter-spacing: -0.02em; }
.result-line { margin: 6px 0 0; font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.result-sub { margin: 4px 0 14px; font-size: 14px; font-weight: 600; min-height: 1.4em; }
.result-sub .best { color: var(--accent); }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.result-actions .primary { order: -1; flex: 1 1 100%; }
.result-actions .ghost { flex: 1 1 0; }
.result-actions [hidden] { display: none; }
@media (min-width: 520px) {
  .result-actions .primary { order: 0; flex: 1.4 1 0; }
}

/* ------------------------------------------------------------ motion */
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes sheet-pop { from { transform: translateY(14px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes sheet-out { to { transform: translateY(10px) scale(0.98); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } }
@keyframes bump { 40% { transform: scale(1.25); } }
@keyframes lose { 30% { transform: scale(1.3) rotate(-12deg); } 100% { transform: none; } }
@keyframes star-pop { 0% { transform: scale(0.3) rotate(-30deg); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes goal-pulse { 0% { box-shadow: var(--shadow), 0 0 0 0 rgba(106, 77, 220, 0.5); } 100% { box-shadow: var(--shadow), 0 0 0 14px rgba(106, 77, 220, 0); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
  .result-stars i { transform: none; opacity: 1; }
}
:root.reduce *, :root.reduce *::before, :root.reduce *::after { animation-duration: 0.01ms !important; animation-delay: 0ms !important; transition-duration: 0.01ms !important; }
:root.reduce .result-stars i { transform: none; opacity: 1; }
