/* Layout: one-screen dig site. The cross-section of the shaft fills the stage and the control panel sits beside it.
   Phones and portrait tablets stack the panel on top; landscape phones keep the side-by-side layout in a compact form. */
:root {
  --bg: #E3E8EA; --panel: #F7F9F9; --field: #FFFFFF; --chip: #EDF1F2;
  --ink: #1B2227; --muted: #57636B; --line: #C9D2D6;
  --accent: #F26B1D; --accent-deep: #B64A0E; --accent-ink: #1B2227; --accent-soft: #FCDCC8;
  --gem: #0B8F87; --gem-soft: #D3F2EF; --danger: #C7352A;
  --sky-top: #7DB4DD; --sky-bot: #DCEDF5; --hill-a: #8FB27A; --hill-b: #6F995D; --sun: #FFD873; --cloud: rgba(255,255,255,.88); --grass: #5A9842; --grass-hi: #77B356; --stars: 0;
  --hud-bg: rgba(18,14,11,.66); --hud-ink: #F6EEE3;
  --display: 'Big Shoulders', 'Big Shoulders Display', Impact, 'Arial Narrow', sans-serif;
  --stencil: 'Big Shoulders Stencil', 'Big Shoulders Stencil Display', 'Big Shoulders', 'Big Shoulders Display', Impact, sans-serif;
  --body: 'Barlow', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1316; --panel: #171D21; --field: #0F1417; --chip: #20282D;
    --ink: #E6ECEE; --muted: #93A1A9; --line: #2B353B;
    --accent: #FF7A2E; --accent-deep: #A9470F; --accent-ink: #15191C; --accent-soft: #46240F;
    --gem: #45DCCF; --gem-soft: #123A37; --danger: #FF6B5B;
    --sky-top: #070E26; --sky-bot: #24335A; --hill-a: #213528; --hill-b: #18291F; --sun: #EDE5CC; --cloud: rgba(70,86,122,.55); --grass: #2F5B2C; --grass-hi: #417A3B; --stars: 1;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1316; --panel: #171D21; --field: #0F1417; --chip: #20282D;
  --ink: #E6ECEE; --muted: #93A1A9; --line: #2B353B;
  --accent: #FF7A2E; --accent-deep: #A9470F; --accent-ink: #15191C; --accent-soft: #46240F;
  --gem: #45DCCF; --gem-soft: #123A37; --danger: #FF6B5B;
  --sky-top: #070E26; --sky-bot: #24335A; --hill-a: #213528; --hill-b: #18291F; --sun: #EDE5CC; --cloud: rgba(70,86,122,.55); --grass: #2F5B2C; --grass-hi: #417A3B; --stars: 1;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
img { max-width: 100%; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; overflow: hidden; overscroll-behavior: none;
  background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 16px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button, .stage { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

.app { height: 100vh; height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 420px); }
.stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: #3A2A1F; -webkit-user-select: none; user-select: none; }
.noscript { margin: 0; padding: 24px; font-size: 18px; }
#scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#insetProbe { position: absolute; visibility: hidden; pointer-events: none; padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.gauge {
  position: absolute; top: 12px; left: calc(66px + env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 3px; padding: 8px 12px 9px;
  border-radius: 6px; background: var(--hud-bg); color: var(--hud-ink); pointer-events: none;
}
.gauge-depth { font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1; font-variant-numeric: tabular-nums; }
.gauge-layer { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; opacity: .82; }

.panel {
  min-width: 0; min-height: 0; overflow-y: auto;
  background: var(--panel); border-left: 1px solid var(--line);
  padding-block: 20px 28px; padding-left: 26px; padding-right: max(26px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 22px;
}
.view { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.hud { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hud .brand { flex: none; white-space: nowrap; }
.stats { flex: none; gap: 16px; margin-left: auto; }
.icon-btn {
  flex: none; appearance: none; width: 38px; height: 38px; border-radius: 8px; cursor: pointer; padding: 0;
  display: grid; place-items: center; border: 1px solid var(--line); background: var(--field); color: var(--ink);
}
.icon-btn svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn .spk { fill: currentColor; }
.icon-btn .off { display: none; }
.icon-btn[aria-pressed="true"] { color: var(--muted); }
.icon-btn[aria-pressed="true"] .on { display: none; }
.icon-btn[aria-pressed="true"] .off { display: inline; }
.icon-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
.brand { font-family: var(--stencil); font-weight: 900; font-size: 28px; line-height: 1; letter-spacing: .06em; text-transform: uppercase; margin: 0; }
.brand b { color: var(--accent); font-weight: inherit; }
.stats { display: flex; gap: 20px; }
.stat { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.lbl { font-size: 11px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); }
.val { font-family: var(--display); font-weight: 800; font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }
.val small { font-size: 15px; font-weight: 700; color: var(--muted); }

/* Intro */
.intro-head h1 { font-family: var(--display); font-weight: 800; font-size: clamp(36px, 4.2vw, 48px); line-height: .96; margin: 0 0 12px; text-wrap: balance; }
.lede { margin: 0; color: var(--muted); max-width: 60ch; }
.rules { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.rules li { position: relative; padding-left: 20px; }
.rules li::before { content: ""; position: absolute; left: 2px; top: .55em; width: 8px; height: 8px; background: var(--accent); transform: rotate(45deg); }
.ladder-wrap h2, .log-wrap h2 { font-size: 11px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.ladder { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.ladder td { padding: 7px 0; border-bottom: 1px solid var(--line); }
.ladder td + td { text-align: right; padding-left: 12px; white-space: nowrap; }
.ladder td:last-child { color: var(--muted); }
.ladder tr.ultra td { color: var(--gem); font-weight: 600; }
.best { margin: 0; font-size: 14px; color: var(--muted); }

.btn {
  appearance: none; border: 0; border-radius: 6px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink);
  font-family: var(--display); font-weight: 800; font-size: 22px; letter-spacing: .05em; text-transform: uppercase;
  padding: 12px 22px 11px; box-shadow: 0 4px 0 var(--accent-deep);
  transition: transform .06s, box-shadow .06s, opacity .15s;
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--accent-deep); }
.btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.wide { width: 100%; }

/* Play */
.qblock { display: flex; flex-direction: column; gap: 6px; }
.qtext { font-family: var(--display); font-weight: 700; font-size: clamp(30px, 3.2vw, 38px); line-height: 1.04; margin: 0; text-wrap: balance; overflow-wrap: anywhere; }
.timer { display: flex; flex-direction: column; gap: 6px; }
.timer-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.fuse { position: relative; height: 8px; border-radius: 4px; background: repeating-linear-gradient(90deg, var(--line) 0 7px, transparent 7px 10px); }
.fuse-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 4px; background: var(--accent); }
.spark {
  position: absolute; top: 50%; left: 100%; width: 22px; height: 22px; margin: -11px 0 0 -11px; border-radius: 50%;
  background: radial-gradient(circle, #FFF8D6 0 18%, #FFC64D 34%, rgba(255,120,20,0) 70%);
  animation: flicker .11s infinite alternate;
}
.fuse.reading .fuse-fill { background: var(--muted); opacity: .55; }
.fuse.reading .spark, .fuse.spent .spark { display: none; }
.fuse.spent .fuse-fill { background: var(--muted); opacity: .4; }
.fuse.urgent .fuse-fill { background: var(--danger); }
@keyframes flicker { from { transform: scale(.82); opacity: .85; } to { transform: scale(1.12); opacity: 1; } }
.timenum { font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1; min-width: 2ch; text-align: right; font-variant-numeric: tabular-nums; }
.fuse.urgent + .timenum { color: var(--danger); }
.status { margin: 0; font-size: 13px; color: var(--muted); }

.answer { display: flex; gap: 10px; }
.answer input {
  flex: 1; min-width: 0; font-size: 18px; font-weight: 600; padding: 12px 14px;
  border-radius: 6px; border: 2px solid var(--line); background: var(--field); color: var(--ink);
}
.answer input::placeholder { color: var(--muted); font-weight: 500; }
.answer input:focus { outline: none; border-color: var(--accent); }
.answer input.locked { border-style: dashed; }
.answer input:read-only { color: var(--muted); }

.misses { display: flex; flex-direction: column; gap: 8px; margin-top: -8px; }
.miss-msg { margin: 0; font-size: 14px; color: var(--danger); font-weight: 600; overflow-wrap: anywhere; }
.chips.tried .chip { font-size: 13px; text-decoration: line-through; text-decoration-color: var(--danger); color: var(--muted); background: transparent; }
.answer input.wrong { border-color: var(--danger); animation: nudge .28s; }
.answer input.hit { border-color: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.btn.nope { animation: nudge .28s; }
.val, .pts, .final .big { display: inline-block; }
.pts { transform-origin: center 80%; }
.val { transform-origin: right center; }
.final .big { transform-origin: center 80%; }
.bump { animation: bump .45s cubic-bezier(.2, 1.9, .4, 1); }
@keyframes bump { 0% { transform: scale(1); } 30% { transform: scale(1.13); } 100% { transform: scale(1); } }
.rate.pop { animation: pop .4s cubic-bezier(.2, 1.9, .4, 1); }
@keyframes pop { 0% { transform: translateY(6px) scale(.8); opacity: 0; } 100% { transform: none; opacity: 1; } }
.log li.in { animation: rowin .32s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes rowin { from { transform: translateX(-10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
.reveal { display: flex; flex-direction: column; gap: 16px; border-top: 2px solid var(--ink); padding-top: 16px; }
.rbody { display: flex; flex-direction: column; gap: 14px; }
.score-line { display: flex; align-items: flex-end; gap: 20px; flex-wrap: wrap; }
.pts { font-family: var(--display); font-weight: 900; font-size: 72px; line-height: .82; font-variant-numeric: tabular-nums; }
.pts.zero { color: var(--muted); }
.pts.gem { color: var(--gem); }
.meta { display: flex; flex-direction: column; gap: 3px; padding-bottom: 3px; }
.rate { font-family: var(--display); font-weight: 800; font-size: 21px; line-height: 1; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.rate.lo { color: var(--ink); }
.rate.hi { color: var(--accent); }
.rate.gem { color: var(--gem); }
.gain { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.said { margin: 0; overflow-wrap: anywhere; }
.said strong { font-weight: 700; }
.ultra-banner { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: 6px; background: var(--gem-soft); }
.ultra-banner strong { font-family: var(--stencil); font-weight: 900; font-size: 32px; line-height: 1; letter-spacing: .06em; text-transform: uppercase; color: var(--gem); }
.ultra-banner span { font-size: 14px; }
.answers { display: grid; gap: 12px; }
.answers h3 { font-size: 11px; font-weight: 600; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 14px; padding: 3px 10px 4px; border-radius: 999px; background: var(--chip); border: 1px solid var(--line); }
.chip.you { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
.chip.more { background: transparent; border-style: dashed; color: var(--muted); }

/* End */
.final-head { display: flex; flex-direction: column; gap: 8px; }
.final-head h2 { font-family: var(--display); font-weight: 800; font-size: clamp(32px, 3.6vw, 42px); line-height: 1; margin: 0; text-wrap: balance; }
.final { display: flex; align-items: baseline; gap: 8px; }
.final .big { font-family: var(--display); font-weight: 900; font-size: 88px; line-height: .8; font-variant-numeric: tabular-nums; }
.final .of { font-family: var(--display); font-weight: 700; font-size: 26px; color: var(--muted); }
.endstats { display: flex; flex-wrap: wrap; gap: 12px 36px; padding-block: 12px; border-block: 1px solid var(--line); }
.endstats .stat { align-items: flex-start; min-width: 0; }
.endstats .val { font-size: 24px; overflow-wrap: break-word; }
@media (max-width: 420px) { .endstats { column-gap: 24px; } .endstats .val { font-size: 21px; } }
.log { list-style: none; margin: 0; padding: 0; display: grid; }
.log li { display: grid; grid-template-columns: 2em minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--line); }
.log .n { font-family: var(--display); font-weight: 800; font-size: 18px; color: var(--muted); font-variant-numeric: tabular-nums; }
.log .q { display: block; font-size: 12px; color: var(--muted); }
.log .a { font-weight: 600; overflow-wrap: anywhere; }
.log .a.miss { font-weight: 500; color: var(--muted); }
.log .p { text-align: right; font-family: var(--display); font-weight: 800; font-size: 21px; line-height: 1; font-variant-numeric: tabular-nums; }
.log .p small { display: block; margin-top: 3px; font-family: var(--body); font-size: 12px; font-weight: 500; color: var(--muted); }
.log li.ultra .p { color: var(--gem); }

@media (hover: hover) {
  .btn:hover:not(:disabled) { filter: brightness(1.07); }
  .icon-btn:hover { border-color: var(--muted); }
}
@media (pointer: coarse) {
  .icon-btn { width: 44px; height: 44px; }
  .btn { min-height: 48px; }
}
@media (min-width: 1600px) {
  .app { grid-template-columns: minmax(0, 1fr) minmax(400px, 480px); }
  .qtext { font-size: 42px; }
}
/* Landscape phones and small windows: side by side, narrower panel. */
@media (max-width: 859px) {
  .app { grid-template-columns: minmax(0, 1fr) minmax(290px, 360px); }
  .panel { padding-left: 18px; padding-right: max(18px, env(safe-area-inset-right, 0px)); }
}
/* Short landscape screens: tighter spacing so the question, fuse and answer box all fit. */
@media (max-height: 540px) and (orientation: landscape) {
  .panel { padding-block: 10px 14px; gap: 10px; }
  .view { gap: 10px; }
  .brand { font-size: 21px; }
  .val { font-size: 20px; }
  .lbl { font-size: 10px; }
  .intro-head h1 { font-size: 28px; }
  .lede, .rules { font-size: 14px; }
  .qtext { font-size: 22px; }
  .timenum { font-size: 26px; }
  .status { font-size: 12px; }
  .answer input { padding: 8px 12px; }
  .btn { font-size: 19px; padding: 8px 16px 7px; }
  .pts { font-size: 46px; }
  .final .big { font-size: 60px; }
  .gauge { top: 8px; padding: 5px 9px 6px; }
  .gauge-depth { font-size: 22px; }
  .site .panel { padding-bottom: max(14px, env(safe-area-inset-bottom, 0px)); }
}
/* Phones and portrait tablets: panel on top, dig site below. */
@media (max-width: 599px), (max-width: 1023px) and (orientation: portrait) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(170px, 1fr); }
  .panel {
    order: -1; border-left: 0; border-bottom: 1px solid var(--line); max-height: 62vh; max-height: 62dvh;
    padding-block: 14px 18px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
    gap: 16px;
  }
  body[data-view="end"] .panel, body[data-view="intro"] .panel { max-height: 70vh; max-height: 70dvh; }
  .site .panel { padding-top: max(14px, env(safe-area-inset-top, 0px)); }
  .view { gap: 16px; }
  .brand { font-size: 24px; }
  .val { font-size: 22px; }
  .qtext { font-size: 28px; }
  .pts { font-size: 60px; }
  .final .big { font-size: 72px; }
  .gauge { top: 10px; padding: 6px 10px 7px; }
  .gauge-depth { font-size: 24px; }
}
/* Tablets in portrait get a little more room for the panel. */
@media (min-width: 600px) and (max-width: 1023px) and (orientation: portrait) {
  .panel { padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); max-height: 56vh; max-height: 56dvh; }
  .qtext { font-size: 34px; }
}
/* Very narrow phones. */
@media (max-width: 370px) {
  .brand { font-size: 20px; letter-spacing: .04em; }
  .stats { gap: 10px; }
  .lbl { letter-spacing: .08em; }
  .val { font-size: 19px; }
  .qtext { font-size: 25px; }
  .icon-btn { width: 38px; height: 38px; }
}
@media (prefers-reduced-motion: reduce) {
  .spark { animation: none; }
  .answer input.wrong, .btn.nope, .bump, .rate.pop, .log li.in { animation: none; }
  .btn { transition: none; }
}

/* 404 page */
body.notfound { overflow: auto; display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding-block: 24px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.notfound-card { max-width: 30rem; display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.notfound-card h1 { font-family: var(--display); font-weight: 800; font-size: clamp(36px, 8vw, 52px); line-height: .96; margin: 0; text-wrap: balance; }
a.btn { text-decoration: none; display: inline-block; }

/* Start screen: username, daily, unlimited, leaderboard */
.card { display: flex; flex-direction: column; gap: 10px; padding: 14px 14px 16px; border-radius: 10px; background: var(--field); border: 1px solid var(--line); }
.card.nudge-card { animation: nudge .28s; }
.inline { display: flex; gap: 8px; }
.inline input {
  flex: 1; min-width: 0; font-size: 17px; font-weight: 600; padding: 10px 12px;
  border-radius: 6px; border: 2px solid var(--line); background: var(--field); color: var(--ink);
}
.inline input:focus { outline: none; border-color: var(--accent); }
.btn.small { font-size: 19px; padding: 9px 16px 8px; }
.btn.alt { background: var(--ink); color: var(--panel); box-shadow: 0 4px 0 color-mix(in srgb, var(--ink) 55%, #000); }
.btn.alt:active:not(:disabled) { box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 55%, #000); }
.hint { margin: 0; font-size: 13px; color: var(--muted); }
.hint.err { color: var(--danger); font-weight: 600; }
.daily-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.countdown { font-family: var(--display); font-weight: 800; font-size: 17px; letter-spacing: .02em; font-variant-numeric: tabular-nums; color: var(--muted); }
.daily-line { margin: 0; }
.unlimited-row { display: flex; flex-direction: column; gap: 6px; }
.board-wrap { display: flex; flex-direction: column; gap: 8px; }
.board-wrap h2 { margin: 0; }
.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.board .row {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 8px 12px 6px 8px; border-radius: 8px; background: var(--chip); border: 1px solid var(--line);
}
.board .row.me { border-color: var(--accent); background: var(--accent-soft); }
.board .who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .sc { font-family: var(--display); font-weight: 800; font-size: 21px; line-height: 1; text-align: right; font-variant-numeric: tabular-nums; }
.board .sc small { display: block; margin-top: 3px; font-family: var(--body); font-size: 11px; font-weight: 500; color: var(--muted); }
.board .empty { font-size: 14px; color: var(--muted); padding: 6px 2px; }
/* Medals: a struck disc on a ribbon for the top three, a plain ring for 4th and 5th. */
.medal {
  position: relative; width: 30px; height: 30px; margin-top: 7px; border-radius: 50%;
  display: grid; place-items: center; font-family: var(--display); font-weight: 900; font-size: 16px; line-height: 1;
}
.medal.gold { color: #4A3002; background: radial-gradient(circle at 34% 28%, #FFF6C4 0 10%, #F8D24A 38%, #D49A1C 72%, #A9740C 100%); box-shadow: inset 0 0 0 2px #E8B436, inset 0 -3px 0 rgba(120,70,0,.25), 0 1px 2px rgba(0,0,0,.3); }
.medal.silver { color: #2A3238; background: radial-gradient(circle at 34% 28%, #FFFFFF 0 10%, #E1E6EA 38%, #AAB4BB 72%, #7F8B93 100%); box-shadow: inset 0 0 0 2px #C3CBD1, inset 0 -3px 0 rgba(40,50,60,.2), 0 1px 2px rgba(0,0,0,.3); }
.medal.bronze { color: #3E1E07; background: radial-gradient(circle at 34% 28%, #FFE3C6 0 10%, #E7A468 38%, #B86A33 72%, #8A4719 100%); box-shadow: inset 0 0 0 2px #CF8A50, inset 0 -3px 0 rgba(80,30,0,.25), 0 1px 2px rgba(0,0,0,.3); }
.medal.gold::before, .medal.silver::before, .medal.bronze::before {
  content: ""; position: absolute; left: 50%; top: -9px; width: 16px; height: 10px; transform: translateX(-50%);
  clip-path: polygon(0 0, 100% 0, 78% 100%, 22% 100%);
}
.medal.gold::before { background: linear-gradient(90deg, #C7352A 0 50%, #A22A20 50%); }
.medal.silver::before { background: linear-gradient(90deg, #1E5BB8 0 50%, #174A96 50%); }
.medal.bronze::before { background: linear-gradient(90deg, #2E8A4E 0 50%, #23703F 50%); }
.medal.plain { margin-top: 0; color: var(--muted); box-shadow: inset 0 0 0 2px var(--line); }
details.howto { border-top: 1px solid var(--line); padding-top: 12px; }
details.howto summary { cursor: pointer; font-weight: 600; }
details.howto[open] summary { margin-bottom: 12px; }
details.howto .ladder-wrap { margin-top: 14px; }
.net { margin: 0; font-size: 14px; color: var(--danger); font-weight: 600; }
.link { appearance: none; background: none; border: 0; padding: 0; color: var(--accent-deep); font-weight: 700; text-decoration: underline; cursor: pointer; }
.end-actions { display: grid; gap: 12px; }
.icon-btn svg path { fill: none; }

/* Settings */
.sheet {
  width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto;
  border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px 22px;
  background: var(--panel); color: var(--ink); box-shadow: 0 18px 50px rgba(0,0,0,.35);
}
.sheet::backdrop { background: rgba(10,8,6,.55); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.sheet-head h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 28px; line-height: 1; }
.field { display: flex; flex-direction: column; gap: 8px; padding-block: 14px; border-top: 1px solid var(--line); }
.field.toggle { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
.toggle-text { display: flex; flex-direction: column; gap: 3px; }
.switch { appearance: none; flex: none; position: relative; width: 50px; height: 30px; padding: 0; border: 0; border-radius: 999px; background: var(--line); cursor: pointer; transition: background .15s; }
.switch span { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0,0,0,.35); transition: transform .15s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] span { transform: translateX(20px); }
.switch:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .card.nudge-card { animation: none; } .switch, .switch span { transition: none; } }
