/* Music TRIVLE: a late-night record shop. Dark storefront, warm neon, cream card stock. */
@font-face { font-family: 'Monoton'; src: url('/fonts/monoton-latin-400-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Righteous'; src: url('/fonts/righteous-latin-400-normal.woff2') format('woff2'); font-display: swap; }
@font-face { font-family: 'Work Sans'; src: url('/fonts/work-sans-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Work Sans'; src: url('/fonts/work-sans-latin-600-normal.woff2') format('woff2'); font-weight: 600; font-display: swap; }

:root {
  --night: #140d0c;
  --wall: #1f1513;
  --wall-2: #2a1c19;
  --line: #3d2a25;
  --neon: #ff4438;
  --neon-glow: rgba(255, 68, 56, .55);
  --amber: #ffb547;
  --amber-glow: rgba(255, 181, 71, .45);
  --cream: #f4e7c9;
  --cream-2: #e9d8b0;
  --ink: #2b1d16;
  --ink-soft: #6b5546;
  --text: #f3e9dc;
  --muted: #b9a596;
  --right: #3fbf73;
  --wrong: #e2483d;
  --radius: 10px;
  --display: 'Monoton', 'Righteous', system-ui, sans-serif;
  --sign: 'Righteous', 'Work Sans', system-ui, sans-serif;
  --body: 'Work Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--night); color: var(--text);
  font: 400 1rem/1.5 var(--body);
  background-image:
    radial-gradient(ellipse 120% 50% at 50% -10%, rgba(255, 68, 56, .16), transparent 60%),
    repeating-linear-gradient(90deg, transparent 0 46px, rgba(255, 255, 255, .012) 46px 48px);
}
button { font: inherit; color: inherit; }
a { color: var(--amber); }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }

.shop { max-width: 34rem; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); min-height: 100dvh; display: flex; flex-direction: column; }

/* ---------- marquee ---------- */
.marquee { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center; padding: 8px 0 14px; border-bottom: 1px solid var(--line); }
.disc { grid-row: 1 / span 2; width: 58px; height: 58px; animation: spin 3.2s linear infinite; filter: drop-shadow(0 0 10px var(--neon-glow)); }
.disc-vinyl { fill: #0b0707; stroke: var(--neon); stroke-width: 1.5; }
.disc-groove { fill: none; stroke: #2d2220; stroke-width: 1.2; }
.disc-shine { fill: none; stroke: rgba(255, 255, 255, .18); stroke-width: 3; stroke-linecap: round; }
.disc-label { fill: var(--neon); }
.disc-hole { fill: #0b0707; }
@keyframes spin { to { transform: rotate(360deg); } }

.neon { margin: 0; font: 400 clamp(1.7rem, 8.4vw, 2.6rem)/1.05 var(--display); letter-spacing: .02em; text-transform: uppercase; }
.neon-a { color: #ffd9d4; text-shadow: 0 0 4px #fff3, 0 0 10px var(--neon), 0 0 22px var(--neon), 0 0 42px var(--neon-glow); }
.neon-b { color: #fff0d6; text-shadow: 0 0 4px #fff3, 0 0 10px var(--amber), 0 0 22px var(--amber), 0 0 42px var(--amber-glow); animation: flicker 9s infinite; }
@keyframes flicker { 0%, 91%, 93%, 95%, 100% { opacity: 1; } 92%, 94% { opacity: .55; } }
.dateline { margin: 2px 0 0; font: 400 .85rem/1.2 var(--sign); color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }

/* ---------- screens ---------- */
.screen { flex: 1; padding: 18px 0 8px; outline: none; }
.loading { color: var(--muted); text-align: center; margin-top: 3rem; }

/* Hand-lettered sale card: today's theme */
.sign { position: relative; background: var(--cream); color: var(--ink); border-radius: 4px; padding: 14px 16px 16px; transform: rotate(-1.2deg); box-shadow: 0 10px 24px rgba(0, 0, 0, .45), inset 0 0 0 2px var(--cream-2); margin: 4px 4px 22px; }
.sign::before, .sign::after { content: ''; position: absolute; top: -7px; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #d9d2c4, #7c7468); box-shadow: 0 2px 3px rgba(0, 0, 0, .5); }
.sign::before { left: 14px; } .sign::after { right: 14px; }
.sign-kicker { margin: 0; font: 400 .8rem/1 var(--sign); letter-spacing: .14em; text-transform: uppercase; color: var(--neon); }
.sign-theme { margin: 6px 0 0; font: 400 clamp(1.5rem, 7vw, 2rem)/1.1 var(--sign); }
.sign-sub { margin: 6px 0 0; color: var(--ink-soft); font-size: .9rem; }

.rules { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 10px; }
.rules li { display: flex; gap: 12px; align-items: baseline; color: var(--muted); }
.rules b { color: var(--text); font-weight: 600; }
.rules .n { flex: none; width: 1.8rem; height: 1.8rem; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); font: 400 .85rem var(--sign); color: var(--amber); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 22px; border-radius: 999px; border: 0; cursor: pointer; font: 400 1.1rem/1 var(--sign); letter-spacing: .06em; text-transform: uppercase; text-decoration: none; }
.btn-primary { width: 100%; background: var(--neon); color: #fff; box-shadow: 0 0 0 2px #ff8a80 inset, 0 0 18px var(--neon-glow); }
.btn-primary:active { transform: translateY(1px); }
.btn-primary:disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn-ghost:disabled { opacity: .35; cursor: default; }
.btn-row { display: flex; gap: 10px; margin-top: 14px; }
.btn-row .btn { flex: 1; }
.linkish { background: none; border: 0; padding: 4px 0; color: var(--amber); text-decoration: underline; cursor: pointer; font-size: .95rem; }

/* ---------- question ---------- */
.progress { display: flex; gap: 6px; justify-content: center; margin: 0 0 16px; padding: 0; list-style: none; }
.progress li { width: 30px; height: 30px; border-radius: 50%; background: #0b0707; border: 2px solid var(--line); position: relative; }
.progress li::after { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: var(--wall-2); }
.progress li.done::after { background: var(--amber); }
.progress li.now { border-color: var(--neon); box-shadow: 0 0 10px var(--neon-glow); }
.progress li.now::after { background: var(--neon); }

.tab { display: inline-block; background: var(--wall-2); border: 1px solid var(--line); border-bottom: 0; border-radius: 8px 8px 0 0; padding: 6px 14px 5px; font: 400 .8rem/1 var(--sign); letter-spacing: .12em; text-transform: uppercase; color: var(--amber); }
.bin { background: var(--wall); border: 1px solid var(--line); border-radius: 0 var(--radius) var(--radius) var(--radius); padding: 16px; }
.prompt { margin: 0 0 16px; font: 600 1.18rem/1.35 var(--body); }

.options { display: grid; gap: 10px; }
.opt { display: grid; grid-template-columns: 2rem 1fr; gap: 10px; align-items: center; width: 100%; min-height: 56px; text-align: left; padding: 10px 14px; border: 0; border-radius: 6px; background: var(--cream); color: var(--ink); cursor: pointer; font: 600 1rem/1.3 var(--body); box-shadow: 0 3px 0 var(--cream-2), 0 6px 14px rgba(0, 0, 0, .35); transition: transform .08s ease; }
.opt:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--cream-2); }
.opt .letter { width: 2rem; height: 2rem; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--ink); font: 400 .95rem var(--sign); }
.opt[aria-checked="true"] { background: var(--amber); box-shadow: 0 3px 0 #c9852a, 0 0 18px var(--amber-glow); }
.opt[aria-checked="true"] .letter { background: var(--ink); color: var(--amber); }

/* ---------- review ---------- */
.review { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.review button { width: 100%; text-align: left; display: grid; grid-template-columns: 2.2rem 1fr; gap: 10px; align-items: start; padding: 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--wall); cursor: pointer; }
.review .q { font-size: .92rem; color: var(--muted); }
.review .a { display: block; margin-top: 4px; font-weight: 600; color: var(--text); }
.review .a.none { color: var(--wrong); }
.review .num { font: 400 1rem var(--sign); color: var(--amber); padding-top: 2px; }
.h2 { font: 400 1.4rem/1.2 var(--sign); margin: 0 0 6px; letter-spacing: .03em; }
.lede { margin: 0 0 16px; color: var(--muted); }

/* ---------- results ---------- */
.score { text-align: center; margin: 0 0 18px; }
.score-num { font: 400 clamp(3.2rem, 18vw, 4.6rem)/1 var(--display); color: #fff0d6; text-shadow: 0 0 10px var(--amber), 0 0 30px var(--amber-glow); }
.score-msg { margin: 6px 0 0; font: 400 1.1rem var(--sign); color: var(--text); }
.grid { font-size: 1.6rem; letter-spacing: .12em; margin: 8px 0 0; }

.statrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 18px 0; text-align: center; }
.statrow div { background: var(--wall); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 4px; }
.statrow b { display: block; font: 400 1.5rem/1.1 var(--sign); color: var(--amber); }
.statrow span { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }

.answers { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 12px; }
.ans { background: var(--wall); border: 1px solid var(--line); border-left: 5px solid var(--wrong); border-radius: var(--radius); padding: 14px; }
.ans.ok { border-left-color: var(--right); }
.ans h3 { margin: 0 0 8px; font: 600 1rem/1.35 var(--body); }
.ans p { margin: 6px 0 0; font-size: .95rem; }
.ans .yours.bad { color: #ff9b93; text-decoration: line-through; }
.ans .right { color: #8fe3b0; font-weight: 600; }
.ans .pct { color: var(--muted); font-size: .85rem; }
.ans .why { color: var(--muted); }
.clip { margin-top: 10px; }
.clip-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 6px; overflow: hidden; background: #000; }
.clip-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.clip-btn { display: inline-flex; gap: 8px; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--wall-2); cursor: pointer; font-size: .9rem; text-decoration: none; color: var(--text); }

.dist { margin: 18px 0; }
.dist h3 { font: 400 1rem var(--sign); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.bar { display: grid; grid-template-columns: 1.4rem 1fr 3rem; gap: 8px; align-items: center; font-size: .85rem; margin: 4px 0; }
.bar i { display: block; height: 18px; border-radius: 3px; background: var(--wall-2); min-width: 3px; }
.bar.me i { background: var(--amber); }
.bar span:last-child { color: var(--muted); text-align: right; }

.next { text-align: center; color: var(--muted); margin: 18px 0 4px; }
.next b { display: block; font: 400 1.8rem var(--sign); color: var(--text); letter-spacing: .06em; }

.closed { text-align: center; padding: 2rem 0; }
.closed .neon-sign { font: 400 2rem/1.2 var(--display); color: #ffd9d4; text-shadow: 0 0 10px var(--neon), 0 0 30px var(--neon-glow); text-transform: uppercase; }

.preview-banner { margin: 0 0 14px; padding: 8px 12px; border: 1px dashed var(--amber); border-radius: var(--radius); color: var(--amber); font-size: .9rem; text-align: center; }
.preview-banner b { font: 400 .85rem var(--sign); letter-spacing: .12em; text-transform: uppercase; margin-right: 4px; }
#ptoken { width: 100%; min-height: 48px; padding: 10px 12px; border-radius: 6px; border: 1px solid var(--line); background: var(--night); color: var(--text); font: 1rem ui-monospace, Menlo, monospace; }

.footer { color: var(--muted); font-size: .78rem; text-align: center; padding-top: 12px; border-top: 1px solid var(--line); }
.footer p { margin: 0; }

.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--cream); color: var(--ink); padding: 10px 18px; border-radius: 999px; font-weight: 600; box-shadow: 0 8px 24px rgba(0, 0, 0, .5); z-index: 10; max-width: calc(100% - 32px); text-align: center; }

@media (prefers-reduced-motion: reduce) {
  .disc, .neon-b { animation: none; }
  .opt { transition: none; }
}

/* ---------- admin ---------- */
.admin .shop { max-width: 64rem; }
.admin table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.admin th, .admin td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.admin th { color: var(--muted); font-weight: 600; }
.admin .pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .78rem; background: var(--wall-2); }
.admin .pill.approved { background: #1f4d33; color: #bff0d0; }
.admin .pill.draft { background: #4d3a1f; color: #ffe0ad; }
.admin textarea, .admin input[type=password], .admin select { width: 100%; background: var(--wall); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 10px; font: .9rem/1.4 ui-monospace, Menlo, monospace; }
.admin textarea { min-height: 14rem; }
.admin .panel { background: var(--wall); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 0 0 16px; }
.admin .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.admin .btn { min-height: 40px; font-size: .9rem; padding: 0 16px; }
.admin .small { font-size: .8rem; color: var(--muted); }
.admin .err { color: #ff9b93; white-space: pre-wrap; }
.admin .table-wrap { overflow-x: auto; }
.admin ol.qs { padding-left: 1.2rem; }
.admin ol.qs li { margin-bottom: 10px; }
.admin .correct { color: #8fe3b0; font-weight: 600; }
.btn-row + .h2 { margin-top: 22px; }
