:root {
  color-scheme: dark;
  --bg: #0a0a0b; --surface: #131316; --surface2: #1a1a1e;
  --line: #26262b; --line2: #3a3a42;
  --fg: #f4f4f5; --dim: #8b8b94;
  --acc: #ff6b00; --acc-soft: rgba(255, 107, 0, .16);
  --err: #ff5c5c; --ok: #3ddc84;
  --r: 6px;
  --mono: ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg);
  font: 17px/1.45 ui-sans-serif, Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; }
#app { max-width: 480px; margin: 0 auto; min-height: 100%; padding: 20px 18px 56px;
  display: flex; flex-direction: column; gap: 12px; }

h1 { font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin: 10px 0 4px; padding-right: 56px; }
h1.brand::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 12px;
  background: var(--acc); transform: translateY(-1px); }
p { margin: 0; }
.dim { color: var(--dim); font-size: 14px; }
.eyebrow { font: 500 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.err { color: var(--err); }
.ok { color: var(--ok); }
.center { text-align: center; }
.spacer { flex: 1; }
.row { display: flex; gap: 10px; }
.row > button { flex: 1; }
.list { display: flex; flex-direction: column; gap: 8px; }

/* Buttons: quiet by default, orange only for the one action to take next */
button { font: inherit; font-weight: 500; padding: 16px; width: 100%;
  background: var(--surface); color: var(--fg); border: 1px solid var(--line2); border-radius: var(--r);
  transition: border-color .15s, background .15s; }
button:active { background: var(--surface2); border-color: var(--fg); }
button:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
button:disabled { opacity: .45; }
button.small { width: auto; padding: 10px 14px; font-size: 14px; }
button.primary { background: var(--acc); border-color: var(--acc); color: #0a0a0b; font-weight: 700;
  animation: nudge 2.4s ease-in-out infinite; }
button.primary:active { background: #ff8533; border-color: #ff8533; }
button.danger { color: var(--err); border-color: rgba(255, 92, 92, .45); }
button.danger:active { background: rgba(255, 92, 92, .12); border-color: var(--err); }
button.sel { border-color: var(--acc); color: var(--acc); box-shadow: inset 3px 0 0 var(--acc); }
@keyframes nudge { 0%, 100% { box-shadow: 0 0 0 0 var(--acc-soft); } 50% { box-shadow: 0 0 0 7px var(--acc-soft); } }
@media (prefers-reduced-motion: reduce) { button.primary { animation: none; } }

/* Scanner */
.viewfinder { position: relative; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: #000; }
.viewfinder video { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.viewfinder::after { content: ""; position: absolute; inset: 14%; pointer-events: none;
  --c: var(--acc); --l: 22px; --w: 3px;
  background:
    linear-gradient(var(--c), var(--c)) top left / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) top left / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) top right / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) top right / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) bottom left / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) bottom left / var(--w) var(--l),
    linear-gradient(var(--c), var(--c)) bottom right / var(--l) var(--w),
    linear-gradient(var(--c), var(--c)) bottom right / var(--w) var(--l);
  background-repeat: no-repeat; }

/* Card screens */
.q { font-size: min(58vw, 230px); font-weight: 200; text-align: center; line-height: 1; margin: 18px 0; color: var(--fg); }
.year { font-size: min(34vw, 140px); font-weight: 200; letter-spacing: -.04em; text-align: center; line-height: 1; margin: 18px 0 6px;
  font-variant-numeric: tabular-nums; }
.year::after { content: ""; display: block; width: 36px; height: 3px; background: var(--acc); margin: 16px auto 0; }
.title { font-size: 26px; font-weight: 600; letter-spacing: -.01em; text-align: center; }
.artist { font: 500 13px/1.4 var(--mono); letter-spacing: .12em; text-transform: uppercase; text-align: center; color: var(--dim); }

/* History */
.hist { display: flex; gap: 14px; align-items: baseline; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.hist-year { font-size: 22px; font-weight: 300; min-width: 3.2em; font-variant-numeric: tabular-nums; }
.hist-title { font-weight: 600; }

/* Menu, debug log, version */
.burger { position: fixed; right: 12px; top: max(12px, env(safe-area-inset-top)); z-index: 11;
  font-size: 20px; line-height: 1; padding: 9px 13px; background: var(--acc); border-color: var(--acc); color: #0a0a0b; }
.burger:active { background: #ff8533; border-color: #ff8533; }
.logpanel { position: fixed; inset: 0; background: var(--bg); padding: 16px; display: flex; flex-direction: column; gap: 10px; z-index: 10; }
.logpanel[hidden] { display: none; }
.menu { overflow-y: auto; }
.logpanel:not(.menu) { z-index: 12; }
.logbox { flex: 1; width: 100%; background: #000; color: #b8f5c8; font: 11px/1.4 var(--mono);
  border: 1px solid var(--line); border-radius: var(--r); padding: 10px; }
.ver { position: fixed; left: 14px; bottom: max(10px, env(safe-area-inset-bottom)); font: 11px var(--mono);
  letter-spacing: .08em; color: var(--dim); opacity: .8; pointer-events: none; }

/* Background pattern layer (js/background.js) */
#bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: var(--bg); }
#bg svg { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity 1.4s ease; }
#bg svg * { transition: fill 4s ease-in-out, stroke 4s ease-in-out; }
#bg::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(rgba(10,10,11,.55), rgba(10,10,11,.3) 35%, rgba(10,10,11,.3) 65%, rgba(10,10,11,.65)); }
#app { position: relative; z-index: 1; }
.tile { cursor: pointer; }

/* speed run */
input[type=text] { flex: 1; min-width: 0; background: var(--surface); color: var(--fg, #f4f4f5); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; font: inherit; }
input[type=text]:focus { outline: none; border-color: var(--acc); }
.speed-row { display: flex; gap: 8px; align-items: center; }
.speed-row > button:first-child { flex: 1; text-align: left; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; min-width: 4.5em; text-align: right; }
.totals { margin-top: 28px; }
.totals h2 { font: 500 12px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--dim); margin: 0; }
.speed-row .cur { color: var(--acc); }
.speed-row > span:first-child { flex: 1; }

/* clue card result: one word, no explanation */
.verdict { font-size: min(16vw, 80px); font-weight: 300; letter-spacing: -.02em; text-align: center; margin: 22vh 0 0; }
.verdict.ok { color: var(--ok); }
.verdict.bad { color: var(--err); }

/* Menu: pages (leave the menu), sub-menus (arrow), options (value shown, stay in the menu) */
.menu-h { margin: 10px 0 0; }
button.item { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; }
button.item .aside { color: var(--dim); font-weight: 400; white-space: nowrap; }
button.item.sub { background: transparent; border-style: dashed; }
button.item.sub .aside { font-size: 22px; line-height: 1; color: var(--fg); }
button.item.opt .aside { color: var(--acc); }
button.item.here { border-color: var(--acc); box-shadow: inset 3px 0 0 var(--acc); }
button.item.here .aside::after { content: "you are here"; font-size: 12px; color: var(--acc); }
button.menu-back { align-self: flex-start; }
button.menu-close { align-self: center; margin-top: 10px; }
