:root {
  color-scheme: dark;
  --bg: #121212;
  --surface: #1e1e1e;
  --text: #f2f2f2;
  --muted: #a0a0a0;
  --accent: #1db954;
  --danger: #ff6b6b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

header { display: flex; align-items: center; justify-content: space-between; }
h1 { font-size: 1.4rem; margin: 0; }
h2 { margin-top: 0; }

section { display: flex; flex-direction: column; gap: 12px; }

label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: .9rem; }
label.check { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-size: 1rem; }

input, select {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid #333;
  border-radius: 10px;
  padding: 12px;
  width: 100%;
}
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); }

button {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid #333;
  border-radius: 999px;
  padding: 12px 20px;
  cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #000; font-weight: 600; }
button.big { font-size: 1.25rem; padding: 20px; }
button.icon { background: none; border: none; padding: 8px; font-size: 1.3rem; }
button:active { transform: scale(.98); }

.hint { color: var(--muted); font-size: .85rem; margin: 0; }
code { word-break: break-all; color: var(--text); }
.error { color: var(--danger); background: #2a1515; padding: 12px; border-radius: 10px; margin: 0; }

.device-row { display: flex; align-items: flex-end; gap: 8px; }
.device-row label { flex: 1; }

#stage { flex: 1; display: flex; flex-direction: column; justify-content: center; }
#stage > div { display: none; flex-direction: column; align-items: stretch; gap: 16px; text-align: center; }
#stage[data-current=idle] > [data-state=idle],
#stage[data-current=scanning] > [data-state=scanning],
#stage[data-current=loading] > [data-state=loading],
#stage[data-current=armed] > [data-state=armed],
#stage[data-current=playing] > [data-state=playing],
#stage[data-current=stopped] > [data-state=stopped],
#stage[data-current=revealed] > [data-state=revealed] { display: flex; }

details { color: var(--muted); }
summary { cursor: pointer; padding: 8px; }
.link-form { display: flex; gap: 8px; margin-top: 8px; }

.video-wrap { border-radius: 16px; overflow: hidden; aspect-ratio: 1; background: #000; }
video { width: 100%; height: 100%; object-fit: cover; }

.big-text { font-size: 1.5rem; font-weight: 600; margin: 0; }
.flip-icon, .pulse { font-size: 4rem; }
.pulse { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.15); opacity: .7; } }

.reveal { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.reveal img { width: 70%; max-width: 280px; aspect-ratio: 1; border-radius: 12px; object-fit: cover; }
.reveal .year { font-size: 3.5rem; font-weight: 800; color: var(--accent); line-height: 1.1; }
.reveal .title { font-size: 1.4rem; font-weight: 700; }
.reveal .artist { color: var(--muted); font-size: 1.1rem; }

dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid #333;
  border-radius: 16px;
  width: min(420px, calc(100vw - 32px));
}
dialog form { display: flex; flex-direction: column; gap: 14px; }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
