/* Wardle palette: stormy teal #0f7173, bone #d0ceba, graphite #353238, terracotta clay #b2675e,
   blushed brick #bf4342. Light uses bone and graphite; dark flips them. Light is the default, and dark applies
   only when the player picks it with the theme button (data-theme="dark"). */
:root {
  color-scheme: light;
  --bg: #d0ceba;
  --page: radial-gradient(circle at 6% -8%, #a8c9c0 0, transparent 40%), radial-gradient(circle at 100% 6%, #dcb9ad 0, transparent 36%), #d0ceba;
  --surface: #eceadb;
  --deep: #e1dfcc;
  --line: #b8b59f;
  --text: #353238;
  --muted: #5f5a63;
  --faint: #7a7580;
  --brand: #0f7173;
  --brand-soft: #c5dcd4;
  --brand-edge: #7fb1ad;
  --brand-ring: #0f717333;
  --brand-hover: #138a8d;
  --on-brand: #f4f2e6;
  --good: #0b5f61;
  --good-soft: #c5dcd4;
  --warn: #7d4038;
  --warn-soft: #e8d3c6;
  --warn-edge: #c99a8e;
  --bad: #a53433;
  --bad-soft: #ecd0cb;
  --bad-edge: #d29a96;
  --input-line: #a9a690;
  --placeholder: #77727c;
  --pop: #f3f1e5;
  --pop-line: #b8b59f;
  --shadow: #35323826;
  --backdrop: #353238b3;
  --btn-shadow: #0a4f51;
  --lift: #a7a48f99;
  --lvl-easy: #0f7173;
  --lvl-medium: #b2675e;
  --lvl-hard: #bf4342;
  --r-lg: 24px;
  --r-md: 14px;
  --r-sm: 10px;
  --accent: var(--lvl-easy);
  --track: -.01em;
  --track-sm: 0;
  --display: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --mono: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --sans: 'Nunito', system-ui, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #232126;
  --page: radial-gradient(circle at 6% -8%, #0f717366 0, transparent 40%), radial-gradient(circle at 100% 8%, #b2675e44 0, transparent 38%), #232126;
  --surface: #353238;
  --deep: #2b292e;
  --line: #4d4950;
  --text: #d0ceba;
  --muted: #a5a29a;
  --faint: #8f8c86;
  --brand: #4bb5b7;
  --brand-soft: #1d4a4c;
  --brand-edge: #2f8486;
  --brand-ring: #4bb5b733;
  --brand-hover: #68c7c9;
  --on-brand: #1b1a1e;
  --good: #5fc3c4;
  --good-soft: #1d4a4c;
  --warn: #e0a79d;
  --warn-soft: #4a3532;
  --warn-edge: #7a554f;
  --bad: #f0908d;
  --bad-soft: #4d2f30;
  --bad-edge: #864a4a;
  --input-line: #5b575f;
  --placeholder: #8d8a8f;
  --pop: #3f3b43;
  --pop-line: #5a565e;
  --shadow: #00000066;
  --backdrop: #141316cc;
  --btn-shadow: #1d6f71;
  --lift: #00000044;
  --lvl-easy: #4bb5b7;
  --lvl-medium: #d9958a;
  --lvl-hard: #ec6f6c;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--page);
  color: var(--text);
  font: 600 16px/1.5 var(--sans);
}
button, input, textarea { font: inherit; }
h1, h2, h3, .result-title, .active-clue { overflow-wrap: anywhere; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .64; }
a { color: var(--brand); text-underline-offset: .17em; }
[hidden] { display: none !important; }
body[data-level="medium"] { --accent: var(--lvl-medium); }
body[data-level="hard"] { --accent: var(--lvl-hard); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 4px; }
.shell { width: min(1060px, calc(100% - 64px)); margin: 0 auto; padding-bottom: env(safe-area-inset-bottom); }
.masthead, .footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.masthead { min-height: 98px; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 13px; }
.logo { flex: 0 0 auto; }
.brand-name { font-family: var(--display); display: block; font-size: 25px; line-height: 1; font-weight: 700; letter-spacing: var(--track); }
.brand-descriptor { display: block; margin-top: 6px; color: var(--muted); font: 500 9px/1 var(--mono); letter-spacing: .12em; }
.utility, .quiet, .secondary {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: var(--r-md);
  padding: 9px 13px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}
.utility span, .quiet span { margin-left: 3px; color: var(--brand); }
.utility:hover, .quiet:hover, .secondary:hover { border-color: var(--brand); }
.intro { padding: 52px 0 31px; }
.eyebrow, .setting h2, .panel-top, .round-head, label, .streak > span, .result-label {
  font: 600 11px/1.25 var(--mono);
  letter-spacing: .10em;
}
.eyebrow { display: flex; align-items: center; gap: 11px; color: var(--brand); }
.beacon { width: 7px; height: 7px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-ring); }
h1, .result-title, dialog h2 { font-family: var(--display); }
h1 {
  margin: 8px 0 0;
  font-size: clamp(42px, 6.9vw, 80px);
  line-height: .99;
  font-weight: 700;
  letter-spacing: var(--track);
}
h1 span { color: var(--brand); }
.layout { display: grid; grid-template-columns: 238px minmax(0, 1fr); gap: 22px; align-items: start; }
.rail, .case-panel {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
}
.rail { padding: 20px 16px 14px; }
.setting + .setting { margin-top: 24px; }
.setting h2 { margin: 0 0 9px; color: var(--muted); }
.setting p { color: var(--muted); font-size: 12px; margin: 9px 0 0; min-height: 3.6em; line-height: 1.45; }
.segments { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 3px; border-radius: var(--r-md); background: var(--deep); border: 1px solid var(--line); }
.segments button { min-height: 36px; padding: 8px 4px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); font-weight: 700; font-size: 12px; white-space: nowrap; }
.segments button:hover { color: var(--text); }
.segments button[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }
.streak { background: var(--deep); margin-top: 17px; padding: 12px 13px; border-radius: var(--r-md); }
.streak-line { color: var(--warn); display: flex; align-items: center; gap: 8px; }
.streak-line strong { font-size: 26px; font-weight: 700; line-height: 1; }
.streak > span { color: var(--muted); font-size: 10px; }
.panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.panel-symbol { margin-right: 6px; color: var(--brand); }
.case-state {
  color: var(--brand);
  border-radius: 5px;
  border: 1px solid var(--brand-edge);
  background: var(--brand-soft);
  padding: 4px 7px;
  letter-spacing: .08em;
}
.panel-body { padding: 24px; min-height: 341px; }
.loading { color: var(--muted); margin: 0; }
.round-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--brand); margin-bottom: 12px; }
#rounds { display: flex; gap: 4px; margin: 0; padding: 0; list-style: none; }
#rounds li { width: clamp(16px, 4vw, 27px); height: 21px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 10px; }
#rounds .current { color: var(--brand); border-color: var(--brand-edge); background: var(--brand-soft); }
#rounds .wrong { color: var(--bad); border-color: var(--bad-edge); background: var(--bad-soft); }
#rounds .skip { color: var(--warn); }
#rounds .correct { color: var(--on-brand); border-color: var(--good); background: var(--good); }
.active-clue {
  background: var(--deep);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-md);
  padding: 22px;
  min-height: 105px;
  display: flex;
  align-items: center;
  font-size: clamp(19px, 2.5vw, 26px);
  line-height: 1.35;
  letter-spacing: var(--track-sm);
}
details { color: var(--muted); font-size: 14px; margin-top: 12px; }
summary { cursor: pointer; width: fit-content; color: var(--brand); }
.clue-list { padding-left: 25px; margin-bottom: 0; }
.clue-list li { padding-left: 5px; margin-bottom: 8px; }
.turn-feedback { display: block; font-size: 12px; margin-top: 3px; }
#guess-form, #gate-form { margin-top: 24px; }
label { display: block; margin-bottom: 8px; color: var(--muted); }
.guess-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.guess-field { position: relative; }
input {
  width: 100%; min-height: 47px; font-size: 16px; color: var(--text); background: var(--deep);
  border: 1px solid var(--input-line); border-radius: var(--r-md); padding: 10px 12px;
}
input::placeholder { color: var(--placeholder); }
.primary {
  border: 1px solid var(--brand); border-radius: var(--r-md); background: var(--brand); color: var(--on-brand);
  min-height: 46px; padding: 9px 17px; font-weight: 700;
}
.primary:hover { background: var(--brand-hover); }
.primary span { margin-left: 4px; }
.play-row { grid-template-columns: minmax(0, 1fr) auto auto; }
.quiet { border-color: transparent; padding-right: 0; }
.utility, .quiet, .secondary, .primary { min-height: 44px; }
#suggestions {
  position: absolute; z-index: 2; top: calc(100% + 4px); left: 0; right: 0;
  margin: 0; padding: 4px; list-style: none; background: var(--pop);
  border: 1px solid var(--pop-line); border-radius: var(--r-md); box-shadow: 0 10px 25px var(--shadow);
}
#suggestions li { cursor: pointer; padding: 8px 10px; border-radius: 4px; overflow-wrap: anywhere; }
#suggestions li:hover, #suggestions [aria-selected=true] { background: var(--brand-soft); color: var(--brand); }
.result-label { color: var(--brand); margin: 13px 0 5px; }
.result-title { font-size: clamp(25px, 4vw, 42px); line-height: 1.04; letter-spacing: var(--track); margin: 0 0 12px; }
.result-copy { color: var(--muted); margin: 0 0 6px; max-width: 58ch; }
.reference { font-size: 13px; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 20px 0 6px; }
.metric { background: var(--deep); border: 1px solid var(--line); border-radius: var(--r-md); padding: 11px 12px; }
.metric strong { display: block; color: var(--brand); font-size: 24px; line-height: 1.1; }
.metric span { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }
.stat-note { color: var(--muted); font-size: 12px; margin: 0 0 12px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 19px; }
.share-status { flex-basis: 100%; font-size: 13px; color: var(--brand); }

.rail-toggle { display: none; }
.rail-body { display: block; }
.case-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin-bottom: 12px; }
.chip { display: inline-block; font: 600 10px/1 var(--mono); letter-spacing: .1em; color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 5px 7px; }
.misses { display: flex; align-items: center; gap: 6px; font: 600 10px/1 var(--mono); letter-spacing: .1em; color: var(--muted); }
.pip { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--accent); }
.pip.used { background: var(--accent); }
.clue-text { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.clue-clinical { display: block; }
.clue-plain { display: block; border-left: 2px solid var(--line); padding-left: 12px; font-size: .72em; line-height: 1.4; letter-spacing: -.01em; color: var(--muted); font-weight: 500; }
.plain-tag { display: block; font: 600 9px/1 var(--mono); letter-spacing: .12em; color: var(--brand); margin-bottom: 5px; }
.clue-text.small { gap: 6px; font-size: 14px; }
.clue-text.small .clue-plain { font-size: 13px; padding-left: 10px; }
.result-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: -2px 0 12px; }
.review-wrap { margin: 18px 0 14px; padding-top: 16px; border-top: 1px solid var(--line); }
.review-title { margin: 0 0 8px; font: 600 11px/1.25 var(--mono); letter-spacing: .10em; color: var(--brand); }
details.review { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--deep); padding: 4px 13px; margin-top: 8px; color: var(--text); }
details.review > summary { padding: 9px 0; min-height: 40px; font-weight: 700; font-size: 14px; }
.walk { list-style: none; counter-reset: step; margin: 4px 0 8px; padding: 0; }
.walk li { counter-increment: step; position: relative; padding: 0 0 16px 34px; }
.walk li::before { content: counter(step); position: absolute; left: 0; top: 1px; width: 22px; height: 22px; border-radius: 5px; border: 1px solid var(--line); display: grid; place-items: center; font: 600 11px/1 var(--mono); color: var(--brand); }
.why { display: block; margin-top: 7px; color: var(--brand); font-size: 13px; line-height: 1.45; }
.others { list-style: none; margin: 4px 0 10px; padding: 0; display: grid; gap: 10px; }
.others li { display: grid; gap: 2px; font-size: 14px; color: var(--muted); }
.others strong { color: var(--text); }
.facts { margin: 4px 0 10px; font-size: 14px; }
.facts dt { font: 600 11px/1.25 var(--mono); letter-spacing: .1em; color: var(--brand); margin-top: 10px; }
.facts dd { margin: 4px 0 0; color: var(--muted); }
.pearl { margin: 12px 0 0; padding: 12px 14px; border-radius: var(--r-md); background: var(--warn-soft); color: var(--warn); font-size: 14px; }
.pearl-tag { display: block; font: 600 10px/1 var(--mono); letter-spacing: .12em; margin-bottom: 6px; }
textarea { width: 100%; min-height: 90px; color: var(--text); background: var(--deep); border: 1px solid var(--input-line); border-radius: var(--r-md); padding: 10px 12px; font-size: 16px; }
.diagnosis-copy { margin: 0 0 14px; color: var(--text); font-size: 15px; line-height: 1.65; max-width: 70ch; }
.figure { margin: 14px 0; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; background: #f7f4ec; }
.figure img { display: block; width: 100%; height: auto; max-height: 420px; object-fit: contain; background: #f7f4ec; }
.figure figcaption { display: grid; gap: 3px; padding: 10px 12px; background: var(--deep); color: var(--muted); font-size: 13px; line-height: 1.45; }
.figure-credit { font: 500 10px/1.4 var(--mono); letter-spacing: .06em; color: var(--faint); }
.why.herring { color: var(--warn); }
.herring-tag { display: inline-block; margin-right: 8px; padding: 3px 6px; border-radius: 4px; border: 1px solid var(--warn-edge); background: var(--warn-soft); font: 600 9px/1 var(--mono); letter-spacing: .12em; vertical-align: 1px; }
.learn-more { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.learn-label { display: block; margin-bottom: 8px; font: 600 11px/1.25 var(--mono); letter-spacing: .1em; color: var(--muted); }
.learn-more ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; }
.learn-more li { margin: 0; }
.learn-more a { display: inline-block; padding: 6px 0; font-size: 14px; }
.credit { margin-top: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--deep); }
.credit-title { margin: 0 0 6px; font-weight: 700; font-size: 14px; }
.credit-line { margin: 0; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.disclaimer { max-width: 60ch; }
dialog { max-height: calc(100svh - 32px); overflow: auto; }
.footer { border-top: 1px solid var(--line); margin-top: 38px; padding: 16px 0 22px; color: var(--muted); font-size: 12px; }
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--line); padding: 0; border-radius: var(--r-lg); width: min(500px, calc(100% - 32px)); }
dialog::backdrop { background: var(--backdrop); }
.dialog-inner { padding: 22px; }
.dialog-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-top h2 { margin: 0; }
dialog ol { padding-left: 24px; }
dialog li { margin: 8px 0; }
dialog p { color: var(--muted); }
@media (max-width: 760px) {
  .long { display: none; }
  .shell { width: min(100% - 32px, 560px); }
  .masthead { min-height: 68px; }
  .intro { padding: 28px 0 18px; }
  .layout { grid-template-columns: 1fr; gap: 12px; }
  .rail { padding: 0; overflow: hidden; }
  .rail-toggle {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
    min-height: 52px; padding: 10px 14px; background: transparent; border: 0; color: var(--text); text-align: left;
  }
  .rail-text { display: grid; gap: 4px; min-width: 0; }
  .rail-label { font: 700 10px/1 var(--mono); letter-spacing: .14em; color: var(--brand); }
  .rail-summary { font: 600 12px/1.3 var(--mono); letter-spacing: .02em; color: var(--text); }
  .rail-change { flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center; border: 2px solid var(--line); border-radius: 50%; color: var(--brand); font-size: 13px; transition: transform .2s ease; }
  .rail.open .rail-change { transform: rotate(180deg); background: var(--brand-soft); border-color: var(--brand-edge); }
  .rail-body { display: none; padding: 4px 14px 14px; border-top: 1px solid var(--line); }
  .rail.open .rail-body { display: grid; gap: 16px; padding-top: 14px; }
  .setting + .setting { margin: 0; }
  .setting p { min-height: 0; }
  .segments button { min-height: 44px; font-size: 13px; }
  .streak { margin: 0; display: flex; align-items: center; gap: 9px; padding: 8px 10px; }
  .streak-line strong { font-size: 18px; }
  .panel-top { padding: 12px 14px; }
  .panel-body { padding: 16px 14px; min-height: 0; }
  h1 { font-size: 34px; }
  .active-clue { padding: 16px; min-height: 0; font-size: 18px; }
  .guess-row { grid-template-columns: 1fr; }
  .play-row { grid-template-columns: 1fr 1fr; gap: 8px; }
  .play-row .guess-field { grid-column: 1 / -1; }
  .case-panel { overflow: clip; }
  /* Pin the answer box to the bottom of the screen so it is always in reach. */
  #guess-form {
    position: sticky; bottom: 0; z-index: 3; margin: 18px -14px -16px;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 2px solid var(--line); box-shadow: 0 -10px 18px -12px var(--shadow);
  }
  #guess-form label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; margin: 0; }
  #guess-form #suggestions { top: auto; bottom: calc(100% + 6px); }
  #feedback { margin-bottom: 8px; }
  .result-actions > button { flex: 1 1 140px; }
  .metrics { gap: 6px; }
  .footer { flex-direction: column; gap: 4px; margin-top: 25px; align-items: flex-start; }
}
@media (max-width: 360px) {
  .shell { width: calc(100% - 20px); }
  .brand-name { font-size: 21px; }
  .logo { width: 34px; height: 34px; }
  .utility { padding: 8px 10px; }
  .metric { padding: 8px; }
  .metric strong { font-size: 20px; }
  .walk li { padding-left: 30px; }
}

/* Cute theme extras: chunky buttons, pill segments, bounce and confetti. */
.primary { box-shadow: 0 4px 0 var(--btn-shadow); transition: transform .12s ease, box-shadow .12s ease, background .12s ease; }
.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--btn-shadow); }
.secondary, .utility, .quiet { transition: transform .12s ease, border-color .12s ease; }
.secondary:hover, .utility:hover { transform: translateY(-1px); }
.segments button { transition: background .15s ease, transform .12s ease; }
.segments button:active { transform: scale(.96); }
.segments { border-radius: 999px; border-width: 2px; }
.segments button { border-radius: 999px; }
.rail, .case-panel { box-shadow: 0 8px 0 var(--lift), 0 14px 30px var(--shadow); border-width: 2px; }
.active-clue { border-width: 2px; border-left-width: 6px; }
h1 { font-weight: 700; }
.case-state { border-radius: 999px; padding: 5px 11px; }
.chip, .herring-tag, .plain-tag { border-radius: 999px; }
#rounds li { border-radius: 8px; }
.logo { border-radius: 14px; transform: rotate(-4deg); transition: transform .25s ease; }
.logo:hover { transform: rotate(6deg) scale(1.08); }
h1 span { display: inline-block; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-6px) rotate(-6deg); } }
.theme-toggle { min-width: 44px; padding: 9px 12px; }
.masthead-actions { display: flex; align-items: center; gap: 8px; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 20; }
.confetti span { position: absolute; top: -40px; font-size: 26px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); opacity: .9; } }
@media (prefers-reduced-motion: reduce) {
  h1 span { animation: none; }
  .confetti { display: none; }
  .primary, .secondary, .utility, .quiet, .segments button { transition: none; }
}

/* Answer feedback sits right above the box. */
#feedback {
  margin: 0 0 10px; padding: 8px 12px; border-radius: var(--r-md); border: 1px solid var(--warn-edge);
  background: var(--warn-soft); color: var(--warn); font-size: 14px; font-weight: 700;
}
#feedback[data-tone="bad"] { background: var(--bad-soft); color: var(--bad); border-color: var(--bad-edge); }
#feedback:empty { display: none; }
.label-hint { color: var(--faint); letter-spacing: .04em; }
.guess-field.shake { animation: shake .42s ease; }
@keyframes shake { 15% { transform: translateX(-7px); } 35% { transform: translateX(6px); } 55% { transform: translateX(-4px); } 75% { transform: translateX(3px); } }
.play-row .secondary { border-width: 2px; border-color: var(--brand-edge); color: var(--brand); }
.play-row .secondary:hover { background: var(--brand-soft); }
.play-row .secondary span, .play-row .primary span { margin-left: 4px; }

/* End-of-day card. */
.next-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin: 14px 0 4px; padding: 14px 16px; border: 2px solid var(--brand-edge); border-radius: var(--r-md); background: var(--brand-soft); }
.next-streak { display: flex; align-items: baseline; gap: 7px; color: var(--brand); font-weight: 700; }
.next-streak .spark { color: var(--warn); }
.next-streak strong { font: 700 30px/1 var(--display); }
.next-timer { text-align: right; }
.next-label { display: block; font: 600 10px/1 var(--mono); letter-spacing: .12em; color: var(--muted); margin-bottom: 4px; }
.next-timer strong { font: 700 22px/1 var(--display); color: var(--text); }
.next-note { flex-basis: 100%; margin: 0; font-size: 13px; color: var(--muted); }

/* Tappable figures. */
.figure-zoom { position: relative; display: block; width: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.zoom-badge { position: absolute; right: 8px; bottom: 8px; padding: 5px 10px; border-radius: 999px; background: #353238d9; color: #f4f2e6; font: 600 11px/1 var(--mono); letter-spacing: .06em; pointer-events: none; }
dialog.zoom { width: min(1100px, calc(100% - 16px)); height: calc(100svh - 16px); max-height: none; overflow: hidden; }
dialog.zoom[open] { display: flex; flex-direction: column; }
.zoom-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.zoom-bar p { margin: 0; font-size: 12px; line-height: 1.4; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.zoom-tools { display: flex; gap: 6px; flex: 0 0 auto; }
.zoom-stage { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; background: #f7f4ec; }
.zoom-stage img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; }
dialog.zoom.actual .zoom-stage { place-items: start; }
dialog.zoom.actual .zoom-stage img { max-width: none; max-height: none; width: auto; cursor: zoom-out; }

/* Welcome tour. */
.tour { text-align: center; padding: 28px 24px 22px; }
.tour-art { font-size: 54px; line-height: 1; margin-bottom: 12px; }
.tour h2 { margin: 0 0 10px; font-size: 26px; }
.tour p { margin: 0 auto; max-width: 38ch; line-height: 1.55; }
.tour-dots { display: flex; justify-content: center; gap: 7px; padding: 0; margin: 18px 0; list-style: none; }
.tour-dots li { width: 9px; height: 9px; margin: 0; border-radius: 50%; border: 2px solid var(--brand-edge); }
.tour-dots li.on { background: var(--brand); border-color: var(--brand); }
.tour-actions { display: flex; align-items: center; gap: 8px; }
.tour-actions .spacer { flex: 1; }
@media (prefers-reduced-motion: reduce) { .guess-field.shake { animation: none; } .rail-change { transition: none; } }

.short { display: none; }
@media (max-width: 760px) { .short { display: inline; } }
.confirm-actions { justify-content: center; margin-top: 18px; flex-wrap: wrap; }

/* Stats dialog. */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 14px 0 18px; }
.dist { display: grid; gap: 6px; margin: 8px 0 12px; }
.dist-row { display: grid; grid-template-columns: 52px minmax(0, 1fr); align-items: center; gap: 8px; font-size: 13px; }
.dist-label { color: var(--muted); font-weight: 700; text-align: right; }
.dist-track { display: block; }
.dist-bar { display: block; min-width: 0; padding: 3px 8px; border-radius: 6px; background: var(--brand-edge); color: var(--on-brand); font-weight: 700; font-size: 12px; text-align: right; }
.dist-row.latest .dist-bar { background: var(--accent); }
.dist-bar:empty { display: none; }
@media (max-width: 400px) { .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Footer links, report form, install prompt. */
.footer-side { display: grid; gap: 4px; justify-items: end; text-align: right; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: flex-end; }
.linklike { border: 0; background: transparent; padding: 6px 0; min-height: 32px; color: var(--brand); font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: .17em; cursor: pointer; }
.report-line { margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.report-line .linklike { min-height: 0; padding: 0; font-size: 13px; }
select { width: 100%; min-height: 47px; font-size: 16px; color: var(--text); background: var(--deep); border: 1px solid var(--input-line); border-radius: var(--r-md); padding: 10px 12px; margin-bottom: 14px; }
#report-dialog label { margin-top: 12px; }
#report-dialog textarea { margin-bottom: 8px; }
#report-dialog .tour-actions { margin-top: 12px; }
.install-card { display: flex; align-items: center; gap: 12px; margin: 12px 0 0; padding: 12px 14px; border: 2px dashed var(--brand-edge); border-radius: var(--r-md); background: var(--deep); }
.install-text { flex: 1; display: grid; gap: 2px; font-size: 13px; color: var(--muted); }
.install-text strong { color: var(--text); font-size: 14px; }
.install-card .primary { min-height: 40px; padding: 6px 16px; }
.install-dismiss { padding: 0 6px; min-width: 32px; }
@media (max-width: 760px) { .footer-side { justify-items: start; text-align: left; } .footer-links { justify-content: flex-start; } }

/* Consult mode. */
.segments.three { grid-template-columns: repeat(3, 1fr); }
.consult-points { color: var(--warn); }
.consult-feedback { margin: 10px 0 0; font-size: 14px; font-weight: 700; color: var(--bad); }
.consult-feedback:empty { display: none; }
.consult-hint { margin: 12px 0 0; font-size: 13px; color: var(--muted); line-height: 1.5; }
.consult-file { margin-top: 18px; }
.consult-log { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 8px; }
.consult-entry { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--deep); }
.consult-entry:first-child { border-color: var(--accent); }
.consult-entry.herring { border-color: var(--warn-edge); background: var(--warn-soft); }
.consult-entry-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin-bottom: 6px; font-size: 13px; }
.consult-entry .herring-tag { color: var(--warn); }
.consult-menu { display: grid; gap: 14px; margin-top: 20px; }
.consult-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; margin-top: 6px; }
.consult-action { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 46px; padding: 8px 12px; border: 2px solid var(--line); border-radius: var(--r-md); background: var(--surface); color: var(--text); font-weight: 700; font-size: 14px; text-align: left; transition: border-color .12s ease, transform .12s ease; }
.consult-action:hover:not(:disabled) { border-color: var(--brand); transform: translateY(-1px); }
.consult-action.done { opacity: .55; }
.consult-cost { flex: 0 0 auto; padding: 3px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font: 600 11px/1 var(--mono); letter-spacing: .04em; }
.consult-pick { margin-top: 22px; padding-top: 16px; border-top: 2px solid var(--line); }
.consult-options { display: grid; gap: 8px; margin-top: 10px; }
.consult-option { display: grid; gap: 3px; padding: 12px 14px; border: 2px solid var(--brand-edge); border-radius: var(--r-md); background: var(--deep); color: var(--text); text-align: left; font-size: 15px; transition: background .12s ease, transform .12s ease; }
.consult-option span { color: var(--muted); font-size: 13px; font-weight: 600; }
.consult-option:hover:not(:disabled) { background: var(--brand-soft); transform: translateY(-1px); }
.consult-option.ruled-out { opacity: .5; text-decoration: line-through; border-color: var(--bad-edge); background: var(--bad-soft); }
.consult-score { display: grid; gap: 2px; margin: 4px 0 6px; padding: 12px 14px; border: 2px solid var(--brand-edge); border-radius: var(--r-md); background: var(--brand-soft); color: var(--brand); }
.consult-score strong { font: 700 20px/1.1 var(--display); }
.consult-score span { color: var(--muted); font-size: 13px; }
.consult-stars { font-size: 24px; letter-spacing: 2px; color: var(--warn) !important; }
@media (max-width: 760px) { .consult-actions { grid-template-columns: 1fr 1fr; } .consult-action { font-size: 13px; } }
@media (max-width: 380px) { .consult-actions { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { .consult-action, .consult-option { transition: none; } }

/* Community results. */
.community-title { margin-top: 18px; }
.top-guesses { list-style: none; margin: 8px 0 6px; padding: 0; display: grid; gap: 6px; }
.top-guesses li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--deep); font-size: 14px; }
.top-guesses strong { color: var(--bad); }

#feedback .egg-link { min-height: 0; padding: 0; font-size: 14px; }
