:root {
  --bg: #0b0b14;
  --surface: #161625;
  --text: #f4f2ff;
  --muted: #9a97b5;
  --pink: #ff2d87;
  --yellow: #ffd23f;
  --cyan: #2ec5f0;
  --purple: #9b5cff;
  --level: 0;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
  overflow-x: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}

.logo {
  margin: 0;
  font-size: 1.4rem;
  letter-spacing: .18em;
  font-weight: 800;
  background: linear-gradient(90deg, var(--pink), var(--purple), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.icon-btn, .text-btn {
  background: none;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  padding: 8px;
  font: inherit;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ---------- Podium met de actuele kaart ---------- */

.stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 8px 16px 20px;
}

[hidden] { display: none !important; }

.card-slot {
  position: relative;
  width: min(78vw, 360px);
  aspect-ratio: 1;
  perspective: 1200px;
}

.card {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .55);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card-slot > .card { position: relative; width: 100%; height: 100%; }

.card-back {
  background: #05050a;
  overflow: hidden;
}

.rings {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}

.rings span {
  position: absolute;
  border-radius: 50%;
  border: 2px solid;
  border-left-color: transparent;
  transition: transform .12s linear;
}
.rings span:nth-child(1) { width: 34%; height: 34%; border-color: var(--cyan);   border-left-color: transparent; }
.rings span:nth-child(2) { width: 48%; height: 48%; border-color: var(--yellow); border-bottom-color: transparent; }
.rings span:nth-child(3) { width: 62%; height: 62%; border-color: var(--pink);   border-right-color: transparent; }
.rings span:nth-child(4) { width: 76%; height: 76%; border-color: var(--purple); border-top-color: transparent; }
.rings span:nth-child(5) { width: 90%; height: 90%; border-color: var(--pink);   border-left-color: transparent; opacity: .7; }

.listening .rings span { animation: spin 6s linear infinite; }
.listening .rings span:nth-child(even) { animation-direction: reverse; animation-duration: 9s; }
.listening .rings span:nth-child(1) { transform: scale(calc(1 + var(--level) * .35)); }
.listening .rings span:nth-child(3) { transform: scale(calc(1 + var(--level) * .18)); }

@keyframes spin { to { rotate: 360deg; } }

.back-label {
  position: relative;
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  max-width: 30%;
}

/* ---------- Voorkant ---------- */

.card-front {
  background: var(--era, linear-gradient(135deg, #555, #333));
  color: #111;
  cursor: pointer;
  justify-content: space-between;
}

.card-front .artist {
  font-weight: 700;
  font-size: clamp(.9rem, 4.2vw, 1.25rem);
}

.card-front .year {
  font-weight: 900;
  font-style: italic;
  font-size: clamp(3.4rem, 19vw, 6rem);
  letter-spacing: -.02em;
  line-height: 1;
}

.card-front .title {
  font-style: italic;
  font-size: clamp(.9rem, 4.2vw, 1.25rem);
}

.card-front .play-hint {
  position: absolute;
  right: 10px;
  bottom: 8px;
  font-size: .7rem;
  font-weight: 700;
  opacity: .55;
}

/* ---------- Flip ---------- */

.card-flip {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.2, .8, .2, 1);
}

.card-flip .card-back { transform: rotateY(180deg); cursor: pointer; }
.card-flip.hidden { transform: rotateY(180deg); }
.card-flip.enter { animation: deal .6s cubic-bezier(.2, .8, .2, 1); }

@keyframes deal {
  from { opacity: 0; translate: 0 40px; scale: .9; }
  to   { opacity: 1; translate: 0 0; scale: 1; }
}

/* ---------- Status & knop ---------- */

.status {
  margin: 0;
  min-height: 1.3em;
  color: var(--muted);
  font-size: .95rem;
  text-align: center;
}

.listen-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, var(--pink), var(--purple));
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(255, 45, 135, .35);
}

.listen-btn .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #fff;
}

.listen-btn.on { background: #26263a; box-shadow: none; }
.listen-btn.on .dot { background: var(--pink); animation: pulse 1.2s ease-in-out infinite; }

@keyframes pulse { 50% { opacity: .25; } }

/* ---------- Tijdlijn ---------- */

.timeline-wrap {
  padding: 0 0 16px;
  min-height: 0;
}

.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}

.timeline-head h2 {
  margin: 0;
  font-size: .8rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--muted);
}

.timeline {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 10px 16px 6px;
  scroll-snap-type: x proximity;
}

.timeline:empty::after {
  content: "Herkende nummers verschijnen hier, gesorteerd op jaar.";
  color: var(--muted);
  font-size: .85rem;
}

.mini {
  flex: 0 0 auto;
  width: 112px;
  aspect-ratio: 1;
  border-radius: 4px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  color: #111;
  background: var(--era);
  border: 0;
  font: inherit;
  cursor: pointer;
  scroll-snap-align: start;
}

.mini .artist, .mini .title {
  font-size: .62rem;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.mini .artist { font-weight: 700; }
.mini .title { font-style: italic; }
.mini .year { font-weight: 900; font-style: italic; font-size: 1.6rem; }

/* ---------- Instellingen ---------- */

dialog {
  width: min(92vw, 420px);
  border: 0;
  border-radius: 14px;
  padding: 0;
  background: var(--surface);
  color: var(--text);
}
dialog::backdrop { background: rgba(0, 0, 0, .6); }

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
}
.settings-form h2 { margin: 0 0 4px; font-size: 1.1rem; }
.settings-form label { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; }
.settings-form label.check { flex-direction: row; align-items: center; gap: 10px; }

.settings-form input[type=text], .settings-form select {
  font: inherit;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #33334a;
  background: #0f0f1a;
  color: var(--text);
}

.hint { margin: 0; font-size: .8rem; color: var(--muted); }

.actions { display: flex; justify-content: flex-end; gap: 8px; }

.primary {
  font: inherit;
  font-weight: 700;
  padding: 10px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--pink);
  color: #fff;
  cursor: pointer;
}

@media (min-width: 800px) {
  .card-slot { width: 380px; }
}
