/* Somebodle (SPEC 12): a museum after hours. One column, mobile first. */
:root {
  --night: #1b1418;
  --panel: #24181d;
  --panel-2: #2e2026;
  --wine: #5a1e2a;
  --crimson: #a3203a;
  --gold: #d6b04f;
  --gold-dark: #9c7a2c;
  --cream: #f6ead6;
  --muted: #cbbfae;
  --ink: #2a1f1a;
  --marble: #e8e2d6;
  --far: #9fb4c7;
  --off: #ffd75e;
  --warm: #ffa94d;
  --close: #ff5a4a;
  --correct: #ffd23f;
  --loss: #cfc8bb;
  --last: #9064c0;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--night); color: var(--cream); }
body {
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.top {
  width: 100%;
  max-width: 560px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 0 10px;
}
.brand { margin: 0; line-height: 0; }
.tools { display: flex; gap: 2px; }
.tools button {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  border-radius: 0;
  cursor: pointer;
}
.tools button:hover { background: var(--panel-2); }

main { width: 100%; max-width: 560px; flex: 1; }

#scene-box {
  position: relative;
  width: 100%;
  height: min(clamp(200px, 46dvh, 420px), 75vw);
  background: var(--night);
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: pointer;
}
@media (min-width: 860px) {
  #scene-box { height: min(clamp(260px, 52dvh, 480px), 420px); }
}
#scene, #confetti { image-rendering: pixelated; }
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

#panel { padding: 12px 14px 24px; background: var(--panel); min-height: 200px; }
.loading { color: var(--muted); }

h2, h3 { margin: 0.4em 0 0.3em; line-height: 1.2; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; color: var(--gold); }
p { margin: 0.4em 0; }
a { color: var(--gold); }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--cream); outline-offset: 2px; }

.btn {
  font: inherit;
  font-weight: 700;
  min-height: 48px;
  padding: 0 18px;
  background: var(--gold);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 0;
  box-shadow: 0 3px 0 var(--gold-dark);
  cursor: pointer;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--gold-dark); }
.btn[disabled] { opacity: 0.6; cursor: default; }
.btn.secondary { background: transparent; color: var(--cream); border-color: var(--muted); box-shadow: none; font-weight: 600; }
.btn.wide { width: 100%; }

/* ---- the title view (SPEC 12.3) -------------------------------------------- */
.title { text-align: center; }
.title .tagline { color: var(--muted); margin-top: 0; }
.title .btn { margin: 10px 0 14px; min-width: 200px; }
.howto { text-align: left; padding-left: 1.2em; margin: 0.6em 0; }
.howto li { margin: 0.3em 0; }
.legend { list-style: none; padding: 0; margin: 0.8em 0; text-align: left; }
.legend li { padding: 6px 10px; border-left: 4px solid; margin: 4px 0; background: var(--panel-2); }
.legend b { font-weight: 700; }
.legend .far { border-color: var(--far); } .legend .far b { color: var(--far); }
.legend .off { border-color: var(--off); } .legend .off b { color: var(--off); }
.legend .warm { border-color: var(--warm); } .legend .warm b { color: var(--warm); }
.legend .close { border-color: var(--close); } .legend .close b { color: var(--close); }
.legend .correct { border-color: var(--correct); } .legend .correct b { color: var(--correct); }
.small { font-size: 0.9rem; color: var(--muted); }

/* ---- the playing view (SPEC 12.4) ------------------------------------------- */
.pips { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.pips canvas { display: block; }
.pips .label { margin-left: auto; font-weight: 700; }
.pips .label.last { color: var(--last); }
.clues { list-style: none; padding: 0; margin: 0.3em 0 0.8em; counter-reset: clue; }
.clues li {
  counter-increment: clue;
  position: relative;
  padding: 8px 10px 8px 38px;
  margin: 6px 0;
  background: var(--panel-2);
  border-left: 3px solid var(--gold-dark);
}
.clues li::before {
  content: counter(clue);
  position: absolute;
  left: 10px;
  top: 8px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.85rem;
}
.clues li.fresh { animation: fresh 600ms ease-out; }
@keyframes fresh { from { background: var(--cream); color: var(--ink); } to { background: var(--panel-2); } }
.lastshot { display: flex; align-items: center; gap: 12px; padding: 10px; margin: 8px 0; background: var(--wine); border: 2px solid var(--last); }
.lastshot canvas { flex: none; }
.lastshot h3 { color: var(--cream); margin-top: 0; }

.inrow { position: relative; display: flex; gap: 8px; margin-top: 8px; }
.inrow input {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  font: inherit;
  padding: 0 12px;
  background: var(--cream);
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 0;
}
.dropdown {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 4px);
  margin: 0;
  padding: 0;
  list-style: none;
  background: var(--cream);
  color: var(--ink);
  border: 2px solid var(--ink);
  z-index: 5;
  max-height: 60vh;
  overflow: auto;
}
.dropdown.below { bottom: auto; top: calc(100% + 4px); }
.dropdown li { padding: 10px 12px; min-height: 44px; cursor: pointer; border-bottom: 1px solid #d8d0c2; }
.dropdown li[aria-selected="true"], .dropdown li:hover { background: var(--gold); }
.dropdown .ep { color: #6b5a4a; font-size: 0.9rem; }
.dropdown .al { color: #6b5a4a; font-size: 0.85rem; margin-right: 4px; }
.msg { min-height: 1.4em; color: var(--off); margin: 6px 0; }
.skip { margin-top: 4px; }

.rows { list-style: none; padding: 0; margin: 14px 0 0; }
.rows li {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin: 6px 0;
  background: var(--panel-2);
  border-left: 4px solid;
}
.rows .mini { display: flex; align-items: flex-end; justify-content: center; height: 44px; }
.rows .who b { display: block; }
.rows .who span { color: var(--muted); font-size: 0.9rem; }
.rows .phrase { font-weight: 700; }
.rows .dir { color: var(--muted); font-size: 0.9rem; text-align: right; white-space: nowrap; }
.band-far { border-color: var(--far) !important; } .band-far .phrase { color: var(--far); }
.band-off { border-color: var(--off) !important; } .band-off .phrase { color: var(--off); }
.band-warm { border-color: var(--warm) !important; } .band-warm .phrase { color: var(--warm); }
.band-close { border-color: var(--close) !important; } .band-close .phrase { color: var(--close); }
.band-correct { border-color: var(--correct) !important; background: #3a2e14 !important; } .band-correct .phrase { color: var(--correct); }

/* ---- results (SPEC 12.6) ---------------------------------------------------------- */
.results .headline { font-size: 28px; letter-spacing: 0.06em; margin: 0.2em 0 0; color: var(--correct); }
.results .headline.loss { color: var(--cream); }
.answer { display: flex; gap: 12px; align-items: flex-start; padding: 10px; margin: 10px 0; background: var(--panel-2); }
.answer h2 { margin: 0; }
.answer .life { color: var(--muted); margin: 0; }
.lineup { overflow-x: auto; padding: 6px 0; }
.myclues { padding-left: 1.4em; }
.myclues li { margin: 0.4em 0; }
.myclues a { font-size: 0.85rem; margin-left: 4px; }
.hist { display: grid; gap: 4px; margin: 8px 0; }
.hist .bar { display: grid; grid-template-columns: 20px 1fr; gap: 6px; align-items: center; font-size: 0.9rem; }
.hist .fill { background: var(--panel-2); color: var(--cream); padding: 2px 6px; min-width: 2.4em; text-align: right; }
.hist .me .fill { background: var(--gold); color: var(--ink); font-weight: 700; }
.share { margin: 12px 0; }
.toast { color: var(--correct); margin-left: 8px; }
.countdown { font-variant-numeric: tabular-nums; }

/* ---- panels (SPEC 12.7) ------------------------------------------------------------ */
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; margin: 10px 0; }
.stat-grid div { background: var(--panel-2); padding: 8px 4px; }
.stat-grid b { display: block; font-size: 1.4rem; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--panel-2); }
.setting select { font: inherit; min-height: 44px; background: var(--cream); color: var(--ink); border: 2px solid var(--ink); }
.err { padding: 12px; background: var(--wine); }

.foot { width: 100%; max-width: 560px; padding: 12px 14px 24px; color: var(--muted); font-size: 0.85rem; text-align: center; }
.noscript { padding: 20px; text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .clues li.fresh { animation: none; }
}
.reduced .clues li.fresh { animation: none; }

.results .headline:focus, .panel-head h2:focus { outline: none; }
