/* Night-club look: deep violet, neon pink and cyan. Phone first; the game is one column with the
   actions in thumb reach. Print: A4 sheets of 60 mm cards (see the end of the file). */

:root {
  --bg: #f6f2fc; --panel: #fff; --fg: #1d1530; --muted: #6c6380; --line: #ddd4ec;
  --pink: #e0207a; --cyan: #0a8fa6; --pink-fg: #fff;
  --radius: 14px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #120a24; --panel: #1e1338; --fg: #f3eefc; --muted: #a497c0; --line: #33255a;
    --pink: #ff3d9a; --cyan: #2fd6f0; --pink-fg: #12061d;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #120a24; --panel: #1e1338; --fg: #f3eefc; --muted: #a497c0; --line: #33255a;
  --pink: #ff3d9a; --cyan: #2fd6f0; --pink-fg: #12061d;
  color-scheme: dark;
}
/* The game is always dark: it's played in the evening, and the record should glow. */
body.game {
  --bg: #120a24; --panel: #1e1338; --fg: #f3eefc; --muted: #a497c0; --line: #33255a;
  --pink: #ff3d9a; --cyan: #2fd6f0; --pink-fg: #12061d;
  color-scheme: dark;
  background: radial-gradient(120% 70% at 50% 0%, #2c1458 0%, var(--bg) 60%) fixed, var(--bg);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--fg); font: 16px/1.45 var(--font);
  -webkit-tap-highlight-color: transparent; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 12px max(16px, env(safe-area-inset-left)); }
.logo { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.logo b { color: var(--pink); }
.logo small { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 4px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px;
  padding: 10px 18px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--panel);
  font-weight: 650; text-decoration: none; cursor: pointer; touch-action: manipulation; white-space: nowrap; }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--pink); border-color: var(--pink); color: var(--pink-fg); }
.btn.accent { background: transparent; border-color: var(--cyan); color: var(--cyan); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: 6px 12px; font-size: 14px; }
.btn.big { min-height: 56px; font-size: 18px; padding: 12px 28px; }
.btn.danger { color: var(--pink); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* --- game --- */

.play { display: flex; flex-direction: column; align-items: center; padding: 8px 16px max(24px, env(safe-area-inset-bottom)); }
.view { width: 100%; max-width: 420px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
#idle { min-height: 70dvh; justify-content: center; }
.hint { margin: 0; color: var(--muted); text-align: center; font-size: 14px; }

.scan-disc { width: min(72vw, 300px); aspect-ratio: 1; border-radius: 50%; border: 0; cursor: pointer;
  background: radial-gradient(circle, var(--pink) 0 30%, transparent 31%),
    repeating-radial-gradient(circle, #1a1030 0 3px, #24173f 3px 5px);
  box-shadow: 0 0 0 3px var(--pink), 0 0 60px -10px var(--pink); color: var(--pink-fg);
  font-size: 20px; font-weight: 800; line-height: 1.15; animation: pulse 2.4s ease-in-out infinite; }
.scan-disc span { display: inline-block; max-width: 30%; }
@keyframes pulse { 50% { box-shadow: 0 0 0 3px var(--pink), 0 0 90px 0 var(--pink); } }

.stage { position: relative; width: min(78vw, 320px); aspect-ratio: 1; margin-top: 8px; }
/* The player has to exist and play, but its title and picture would give the answer away. */
.stage iframe, #yt { position: absolute; inset: 15%; width: 70%; height: 70%; border: 0; }
.record { position: absolute; inset: 0; border-radius: 50%; display: grid; place-items: center;
  background:
    conic-gradient(from 30deg, transparent 0 12%, rgba(255,255,255,.08) 15%, transparent 20% 60%, rgba(255,255,255,.06) 64%, transparent 70%),
    repeating-radial-gradient(circle, #0d0819 0 2px, #1b1230 2px 4px);
  box-shadow: 0 0 0 2px #33255a, 0 20px 60px -20px #000; }
.record .label { width: 34%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, var(--bg) 0 8%, transparent 9%), conic-gradient(var(--pink), var(--cyan), var(--pink)); }
.record .label { display: grid; place-items: center; }
.count { font-size: 44px; font-weight: 900; color: var(--pink-fg); line-height: 1; }
.waiting .record { animation: wait 1.2s ease-in-out infinite; }
@keyframes wait { 50% { box-shadow: 0 0 0 3px var(--cyan), 0 0 60px -10px var(--cyan); } }
#ready { width: 100%; }
.modes { display: flex; align-items: center; gap: 6px; margin-top: 28px; font-size: 14px; color: var(--muted); }
.modes button { min-height: 36px; padding: 6px 12px; border: 1.5px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--muted); font-weight: 600; cursor: pointer; }
.modes button[aria-checked="true"] { border-color: var(--cyan); color: var(--cyan); }
.spinning .record { animation: spin 2.2s linear infinite; box-shadow: 0 0 0 2px var(--pink), 0 0 70px -10px var(--pink); }
@keyframes spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) { .spinning .record, .scan-disc { animation: none; } }

.status { margin: 0; min-height: 1.45em; font-weight: 650; text-align: center; }
.controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
#next { width: 100%; min-height: 52px; margin-top: 6px; }
.reveal { width: 100%; color: var(--muted); font-size: 14px; text-align: center; }
.reveal summary { cursor: pointer; padding: 6px; }
.reveal p { margin: 4px 0 0; color: var(--fg); }

.scanner { position: fixed; inset: 0; z-index: 10; background: #000; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; gap: 16px; padding: 24px 16px max(28px, env(safe-area-inset-bottom)); }
.scanner video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scanner .frame { position: absolute; top: 45%; left: 50%; width: min(70vw, 300px); aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 24px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.55), inset 0 0 0 3px var(--cyan); }
.scanner .scan-hint, .scanner .btn { position: relative; }
.scan-hint { margin: 0; color: #fff; font-weight: 650; text-align: center; text-shadow: 0 1px 4px #000; }

.toast { position: fixed; left: 16px; right: 16px; bottom: max(20px, env(safe-area-inset-bottom)); z-index: 20; margin: 0 auto;
  max-width: 420px; padding: 12px 16px; border-radius: var(--radius); background: var(--pink); color: var(--pink-fg); font-weight: 650; }

/* --- card editor --- */

.cards { max-width: 860px; margin: 0 auto; padding: 0 16px 40px; display: flex; flex-direction: column; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.panel h2 { margin: 0; font-size: 18px; }
details.panel summary { cursor: pointer; list-style: none; }
details.panel summary h2 { display: inline; }
details.panel summary::before { content: '▸ '; color: var(--muted); }
details.panel[open] summary::before { content: '▾ '; }
.field { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.field input, .field textarea, .row input { width: 100%; min-width: 0; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--bg); color: var(--fg); font-size: 16px; }
.field textarea { resize: vertical; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.progress { color: var(--muted); font-size: 14px; }
.list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.list-head .actions { margin-top: 0; }
.count { color: var(--muted); font-weight: 500; }
.panel > .hint { text-align: left; margin-top: 8px; }
.tools { border-top: 1px solid var(--line); padding-top: 12px; }

.list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.row { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; }
.row.todo { border-color: var(--cyan); }
.row.bad { border-color: var(--pink); opacity: 0.8; }
.thumb img { display: block; width: 96px; height: 54px; object-fit: cover; border-radius: 6px; background: var(--line); }
.fields { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.row input { padding: 7px 10px; }
.row .artist { font-weight: 650; }
.line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.line .year { width: 5.2em; }
.src { min-width: 1.6em; font-size: 12px; font-weight: 700; color: var(--muted); cursor: help; }
.start { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); }
.start input { width: 4em; }
.line .del { margin-left: auto; }
.orig, .warn { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.orig { color: var(--muted); }
.warn { color: var(--pink); }
.warn:empty, .orig:empty { display: none; }
@media (max-width: 480px) {
  .row { grid-template-columns: 64px 1fr; gap: 10px; }
  .thumb img { width: 64px; height: 64px; }
  .line .del { margin-left: 0; }
}

/* --- print: A4, 3 x 4 cards of 60 mm, centered on the page so a mirrored back lines up --- */

#sheets { display: none; }
@media print {
  @page { size: A4; margin: 0; }
  html, body { background: #fff !important; color: #000; min-height: 0; }
  body > :not(#sheets) { display: none !important; }
  #sheets { display: block; }
  .sheet { width: 210mm; height: 296mm; overflow: hidden; display: grid; grid-template-columns: repeat(3, 60mm);
    grid-auto-rows: 60mm; justify-content: center; align-content: center; break-after: page; }
  .pc { position: relative; outline: 0.2mm dashed #bbb; outline-offset: -0.1mm; overflow: hidden;
    print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .front { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2mm; background: #fff; }
  .front .qr { width: 40mm; height: 40mm; }
  .front .brand { font: 800 3.4mm/1 var(--font); letter-spacing: -0.02em; color: #000; }
  .front .brand b { color: #e0207a; }
  .back { display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 5mm 4mm;
    text-align: center; background: hsl(var(--h) var(--s, 75%) 88%); color: #120a24; }
  .back p { margin: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
  .back .artist { font: 700 4.2mm/1.15 var(--font); }
  .back .year { font: 900 17mm/1 var(--font); letter-spacing: -0.04em; }
  .back .song { font: italic 500 3.9mm/1.2 var(--font); }
}
