/* Release Roulette v3 – Progressive/Deep-Cover-Typo trifft Retro-Web um 2000:
   matte Nachtfarben, Korn & Dither, abgeschrägte Fenster, LCD-Anzeigen, Laufband. */
:root {
  --night: #070a18;
  --night-2: #0c1230;
  --night-3: #161d4a;
  --ultra: #2e2bd6;
  --magenta: #ff2d6f;
  --red: #e2262d;
  --paper: #f0ebe3;
  --sand: #c8b597;
  --muted: #8b90ab;
  --lcd: #9fe7ff;
  --lcd-bg: #04060f;
  --line: rgba(240, 235, 227, .14);
  --line-strong: rgba(240, 235, 227, .32);
  --bev-hi: rgba(240, 235, 227, .30);
  --bev-lo: rgba(0, 0, 0, .75);
  --card-w: min(360px, calc(100vw - 32px));
  --sans: "Montserrat", "Helvetica Neue", Arial, sans-serif;
  --thin: "Jost", "Futura", "Century Gothic", sans-serif;
  --pixel: "VT323", "Courier New", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; background: var(--night); }
/* Rausfliegende Karten dürfen die Seite nicht verbreitern – sonst zoomt Safari auf dem iPhone heraus.
   clip statt hidden: erzeugt keinen Scroll-Container, „sticky“ am Desktop bleibt intakt. */
html, body { overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--paper);
  font-family: var(--thin);
  background-color: var(--night);
  background:
    radial-gradient(55vw 40vw at 8% -5%, rgba(255, 45, 111, .34), transparent 70%),
    radial-gradient(50vw 45vw at 105% 25%, rgba(46, 43, 214, .5), transparent 70%),
    radial-gradient(60vw 40vw at 40% 115%, rgba(200, 181, 151, .10), transparent 70%),
    linear-gradient(180deg, #0a0f2a 0%, var(--night) 60%);
  background-attachment: fixed;
}
/* Dither-Raster wie ein 256-Farben-Hintergrund */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: repeating-conic-gradient(rgba(0, 0, 0, .5) 0 25%, transparent 0 50%) 0 0 / 3px 3px;
  opacity: .22;
}
a { color: var(--paper); }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 1px dotted var(--paper); outline-offset: 2px; }

/* Filmkorn + VHS-Zeilen */
.grain {
  position: fixed; inset: -50%; z-index: 60; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .07;
  animation: grain 1.2s steps(4) infinite;
}
.grain::after {
  content: ""; position: fixed; inset: 0;
  background: repeating-linear-gradient(180deg, rgba(0, 0, 0, .35) 0 1px, transparent 1px 4px);
  opacity: .45;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 25% { transform: translate(-3%, 2%); }
  50% { transform: translate(2%, -3%); } 75% { transform: translate(-2%, -1%); } 100% { transform: translate(0, 0); }
}

main, .masthead, .foot { position: relative; z-index: 1; }
main { z-index: 2; }  /* feste Steuerleiste (in main) liegt über der Fußzeile */

/* ---------- Retro-Web-Bausteine ---------- */
.win {
  background: var(--night-2);
  border: 2px solid; border-color: var(--bev-hi) var(--bev-lo) var(--bev-lo) var(--bev-hi);
  box-shadow: 1px 1px 0 #000, 0 24px 50px rgba(0, 0, 0, .45);
}
.inset { border: 2px solid; border-color: var(--bev-lo) var(--bev-hi) var(--bev-hi) var(--bev-lo); }
.titlebar {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  height: 24px; padding: 0 3px 0 8px; flex: none;
  background: linear-gradient(90deg, #121a5c, var(--ultra) 55%, #6a1f63);
  font: 19px/1 var(--pixel); letter-spacing: .02em; color: var(--paper);
  white-space: nowrap; overflow: hidden;
}
.titlebar > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.tb-btns { display: flex; gap: 2px; flex: none; }
.tb-btns i {
  width: 17px; height: 16px; display: grid; place-items: center; font: normal 15px/1 var(--pixel);
  background: var(--night-3); border: 1px solid; border-color: var(--bev-hi) var(--bev-lo) var(--bev-lo) var(--bev-hi);
}
.lcd {
  font-family: var(--pixel); color: var(--lcd); background: var(--lcd-bg);
  text-shadow: 0 0 4px rgba(159, 231, 255, .35);
  letter-spacing: .03em;
}

/* ---------- Kopf ---------- */
.thin { font-family: var(--thin); font-weight: 300; text-transform: lowercase; letter-spacing: -.01em; }
.bold { font-family: var(--sans); font-weight: 900; text-transform: uppercase; letter-spacing: -.02em; }

.masthead {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  max-width: 1180px; margin: 0 auto; padding: 30px 16px 18px;
}
.logo { min-width: 0; flex: 1; }
.logo h1 { margin: 0; font-size: clamp(30px, 6vw, 64px); line-height: .95; display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .25em; }
.logo .bold { text-shadow: 3px 0 0 rgba(255, 45, 111, .55), -3px 0 0 rgba(46, 43, 214, .7); } /* VHS-Farbversatz */
.logo .num { font-family: var(--pixel); font-weight: 400; color: var(--lcd); font-size: .8em; letter-spacing: 0; }
.tag { display: block; margin-top: 10px; font: 700 11px var(--sans); letter-spacing: .04em; color: var(--red); }
.tag b { font-weight: 800; }
.marquee {
  margin-top: 12px; width: min(620px, 100%); overflow: hidden; white-space: nowrap;
  background: var(--lcd-bg); color: var(--lcd); font: 20px/1.35 var(--pixel);
  text-shadow: 0 0 4px rgba(159, 231, 255, .35);
}
.marquee span { display: inline-block; padding-left: 100%; animation: marquee 28s linear infinite; }
@keyframes marquee { to { transform: translateX(-100%); } }

.kiste-btn {
  flex: none; padding: 8px 12px; background: var(--night-3);
  border: 2px solid; border-color: var(--bev-hi) var(--bev-lo) var(--bev-lo) var(--bev-hi);
  font: 700 11px var(--sans); letter-spacing: .14em; text-transform: uppercase;
}
.kiste-btn b { font: 400 20px/1 var(--pixel); color: var(--magenta); margin-left: 6px; letter-spacing: 0; }
.kiste-btn:active { border-color: var(--bev-lo) var(--bev-hi) var(--bev-hi) var(--bev-lo); }

main { max-width: 1180px; margin: 0 auto; padding: 0 16px 24px; display: grid; gap: 20px; grid-template-columns: 1fr; }
main > * { min-width: 0; }
@media (min-width: 980px) {
  main { grid-template-columns: 400px 1fr; grid-template-areas: "panel timeline" "panel stage"; align-items: start; }
  .deck-panel { grid-area: panel; position: sticky; top: 16px; }
  .stage { grid-area: stage; }
  .timeline { grid-area: timeline; }
}

/* ---------- Filter-Fenster ---------- */
.deck-panel { display: grid; gap: 20px 18px; grid-template-columns: 1fr 1fr; padding-bottom: 18px; background: rgba(12, 18, 48, .92); }
.deck-panel > .titlebar { grid-column: 1 / -1; margin-bottom: -2px; }
.deck-panel > .ctl:not(.ctl-wide):nth-child(2) { margin-left: 18px; }
.deck-panel > .ctl:not(.ctl-wide):nth-child(3) { margin-right: 18px; }
.deck-panel > .ctl-wide, .deck-panel > .launch, .deck-panel > .auto-note { margin-left: 18px; margin-right: 18px; }
.ctl { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.ctl-wide { grid-column: 1 / -1; }
.ctl-label { font: 700 10px var(--sans); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.ctl-label i { font: normal 18px/1 var(--pixel); color: var(--red); letter-spacing: 0; }
.ctl-label small { font: 300 12px var(--thin); letter-spacing: 0; text-transform: none; }
.ctl-hint { font-size: 14px; color: var(--muted); }
.ctl-hint b { font: 400 20px/1 var(--pixel); color: var(--magenta); }

.stepper { display: flex; align-items: stretch; gap: 8px; }
.years { display: flex; align-items: baseline; gap: 6px; padding: 0 10px; min-width: 0; }
.years span { font-size: 58px; line-height: 1; }
.years small { font-size: 20px; color: var(--muted); text-shadow: none; }
.step-btns { display: flex; flex-direction: column; gap: 4px; justify-content: center; }
.step-btns .sq { min-width: 30px; min-height: 26px; font-size: 16px; }
.genre { font: 300 30px/1.1 var(--thin); text-transform: lowercase; }

.sq {
  min-width: 40px; min-height: 40px; padding: 0;
  background: var(--night-3);
  border: 2px solid; border-color: var(--bev-hi) var(--bev-lo) var(--bev-lo) var(--bev-hi);
  font: 500 18px/1 var(--thin);
}
.sq:hover { background: #202a66; }
.sq:active { border-color: var(--bev-lo) var(--bev-hi) var(--bev-hi) var(--bev-lo); }
.sq-text, .knob-text { padding: 0 12px; font: 700 10px var(--sans); letter-spacing: .16em; text-transform: uppercase; }

.toggle { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); cursor: pointer; }
.toggle input { position: absolute; opacity: 0; }
.box {
  width: 15px; height: 15px; flex: none; display: grid; place-items: center; background: var(--lcd-bg);
  border: 2px solid; border-color: var(--bev-lo) var(--bev-hi) var(--bev-hi) var(--bev-lo);
  font: 16px/1 var(--pixel); color: var(--magenta);
}
.toggle input:checked + .box::after { content: "x"; transform: translateY(-1px); }
.toggle input:focus-visible + .box { outline: 1px dotted var(--paper); outline-offset: 2px; }

.field {
  width: 100%; padding: 7px 9px; border-radius: 0;
  background: var(--lcd-bg); color: var(--paper); font: 400 16px var(--thin);
  border: 2px solid; border-color: var(--bev-lo) var(--bev-hi) var(--bev-hi) var(--bev-lo);
}
.field::placeholder { color: #5d6282; }
.field:focus { outline: none; box-shadow: inset 0 0 0 1px var(--magenta); }

.chips { display: flex; flex-wrap: wrap; gap: 5px; max-height: 196px; overflow-y: auto; padding: 1px; }
.chip {
  padding: 5px 9px; font: 400 14px var(--thin); background: var(--night-3);
  border: 2px solid; border-color: var(--bev-hi) var(--bev-lo) var(--bev-lo) var(--bev-hi);
}
.chip small { margin-left: 6px; font: 17px/1 var(--pixel); color: var(--muted); }
.chip:hover { background: #202a66; }
.chip[aria-pressed="true"] { background: var(--red); color: #fff; border-color: var(--bev-lo) rgba(255, 255, 255, .35) rgba(255, 255, 255, .35) var(--bev-lo); }
.chip[aria-pressed="true"] small { color: rgba(255, 255, 255, .8); }
.muted { color: var(--muted); font-size: 14px; }

.launch {
  grid-column: 1 / -1; padding: 13px 16px; background: var(--red); color: #fff;
  border: 2px solid; border-color: rgba(255, 255, 255, .45) rgba(0, 0, 0, .6) rgba(0, 0, 0, .6) rgba(255, 255, 255, .45);
  font: 800 13px var(--sans); letter-spacing: .2em; text-transform: uppercase;
  display: flex; justify-content: space-between; align-items: center;
}
.launch span { font: 26px/1 var(--pixel); letter-spacing: 0; }
.launch:hover { background: #f03a41; }
.launch:active { border-color: rgba(0, 0, 0, .6) rgba(255, 255, 255, .45) rgba(255, 255, 255, .45) rgba(0, 0, 0, .6); }
.launch[disabled] { opacity: .6; cursor: progress; }
.auto-note { grid-column: 1 / -1; margin-top: -8px; margin-bottom: 0; font: 18px/1.15 var(--pixel); color: var(--sand); display: flex; gap: 8px; align-items: baseline; }
.auto-note::before { content: "●"; color: var(--magenta); animation: blink 1.4s steps(1) infinite; }
.auto-note[hidden] { display: none; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Wochen-Display ---------- */
.timeline { display: flex; gap: 8px; align-items: stretch; }
.week {
  flex: 1 1 0; min-width: 0; min-height: 44px; padding: 5px 12px;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 14px;
}
.week-kw { font-size: 32px; line-height: 1; color: var(--paper); }
.week-range { font-size: 22px; line-height: 1.2; }
.week-count { font-size: 19px; color: var(--magenta); text-shadow: none; }
.week-error { color: var(--magenta); }

/* ---------- Kartenstapel ---------- */
.stage { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.deck { position: relative; width: var(--card-w); height: 784px; }
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); gap: 22px; font: 21px/1.2 var(--pixel); }
.end-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.end-actions .sq { min-height: 38px; }
.vinyl-spin {
  width: 170px; height: 170px; border-radius: 50%;
  background:
    radial-gradient(circle, var(--night) 0 3%, var(--red) 3.5% 30%, #0b0b10 30.5%),
    repeating-radial-gradient(circle, #0c0c12 0 2px, #17172a 2px 3px);
  box-shadow: inset 0 0 0 1px #24243c;
  animation: spin 9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.card {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  touch-action: pan-y; user-select: none;
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .35s;
  will-change: transform;
  overflow: hidden;
}
.card.dragging { transition: none; cursor: grabbing; }
.card:not(.top) { pointer-events: none; }
.card.pos-1 { transform: translate(10px, 10px); opacity: .6; }
.card.pos-2 { transform: translate(20px, 20px); opacity: .3; }

/* Cover: echtes Bild oder generiertes Duoton-„Foto“ mit Cover-Typo */
.cover { position: relative; aspect-ratio: 1 / 1; flex: none; margin: 8px 8px 0; max-height: 292px; overflow: hidden; background: var(--night); }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--lcd-bg); }  /* Artwork immer komplett */
/* Cover gehört zur Karte: kein Bild-Ziehen, kein „Bild sichern“-Menü, Wischen geht an die Karte */
.card { -webkit-touch-callout: none; -webkit-user-select: none; }
.card .cover, .card .cover * { pointer-events: none; -webkit-user-drag: none; user-select: none; }
.cover-fallback {
  position: absolute; inset: 0; padding: 16px;
  display: flex; flex-direction: column; justify-content: flex-end; gap: 2px;
  background: linear-gradient(180deg, transparent 40%, rgba(4, 6, 16, .55)), var(--duo);
  isolation: isolate;
}
.cover-fallback::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    repeating-linear-gradient(180deg, rgba(0, 0, 0, .28) 0 1px, transparent 1px 3px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay; opacity: .8;
}
.duo-0 { --duo: radial-gradient(70% 60% at 25% 20%, #ff2d6f, transparent 70%), radial-gradient(60% 70% at 85% 60%, #2e2bd6, transparent 70%), #120a2e; }
.duo-1 { --duo: radial-gradient(80% 60% at 70% 15%, #3c5a9a, transparent 70%), radial-gradient(45% 35% at 22% 30%, #d8e2f0, transparent 75%), #0a1024; }
.duo-2 { --duo: radial-gradient(90% 60% at 50% 10%, #e39152, transparent 70%), radial-gradient(70% 50% at 50% 95%, #3a2418, transparent 70%), #7c4a2c; }
.duo-3 { --duo: radial-gradient(60% 50% at 80% 30%, #e2262d, transparent 70%), radial-gradient(70% 70% at 10% 90%, #1b1b1b, transparent 70%), #3a0c14; }
.duo-4 { --duo: radial-gradient(70% 60% at 30% 30%, #69c2d8, transparent 70%), radial-gradient(60% 60% at 90% 90%, #0d2f55, transparent 70%), #13335a; }
.fc-cat { font: 20px/1 var(--pixel); color: var(--lcd); }
.fc-artist { font: 900 30px/.95 var(--sans); text-transform: uppercase; letter-spacing: -.03em; color: #fff; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; text-shadow: 2px 0 0 rgba(255, 45, 111, .45), -2px 0 0 rgba(46, 43, 214, .55); }
.fc-title { font: 300 20px/1.1 var(--thin); text-transform: lowercase; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.stamp { position: absolute; left: 0; top: 12px; padding: 2px 10px; font: 20px/1.2 var(--pixel); background: var(--magenta); color: #fff; display: none; }
.card.is-fav .stamp-fav { display: block; }

.card-body { padding: 12px 14px 2px; display: flex; flex-direction: column; gap: 3px; min-height: 0; overflow: hidden; }
.card-body > * { flex-shrink: 0; }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 2px; }
.card-code { font: 19px/1 var(--pixel); color: var(--red); white-space: nowrap; }
.card-style { font: 700 9.5px var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.artist { font: 800 13px var(--sans); letter-spacing: .06em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title { margin: 0; font: 400 22px/1.12 var(--thin); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.label-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; margin-top: 2px; }
.lbl-tag { flex: none; padding: 1px 5px; font: 800 8.5px/1.4 var(--sans); letter-spacing: .14em; color: var(--night); background: var(--sand); }
.lbl-name { font: 700 14px var(--sans); color: var(--sand); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lbl-cat { flex: none; font: 18px/1 var(--pixel); color: var(--lcd); }
.meta { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.date { font: 19px/1.1 var(--pixel); color: var(--magenta); margin-top: 2px; }

/* Werte: Tracklisting-Zeilen mit LCD-Ziffern */
.stats { width: 100%; border-collapse: collapse; margin-top: 6px; background: var(--lcd-bg); border: 2px solid; border-color: var(--bev-lo) var(--bev-hi) var(--bev-hi) var(--bev-lo); }
.stats td { padding: 1px 8px; border-top: 1px dotted rgba(159, 231, 255, .14); vertical-align: middle; }
.stats tr:first-child td { border-top: 0; }
.stats td:first-child { font: 600 9.5px var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); width: 36%; }
.stats td:nth-child(2) { font: 19px/1.15 var(--pixel); color: var(--lcd); text-align: right; width: 22%; white-space: nowrap; text-shadow: 0 0 4px rgba(159, 231, 255, .35); }
.bar { height: 6px; background: repeating-linear-gradient(90deg, rgba(159, 231, 255, .12) 0 4px, transparent 4px 6px); }
.bar i { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--magenta) 0 4px, transparent 4px 6px); }
.stats .na { color: #3d4466; text-shadow: none; }

.player { margin-top: 8px; display: grid; gap: 6px; }
.player[hidden] { display: none; }
.player iframe { width: 100%; aspect-ratio: 16 / 9; border: 2px solid; border-color: var(--bev-lo) var(--bev-hi) var(--bev-hi) var(--bev-lo); background: #000; }

.card-actions { margin-top: auto; padding: 10px 14px 14px; display: flex; gap: 8px; }
.card-actions .play {
  flex: 1; padding: 10px; background: var(--paper); color: var(--night);
  border: 2px solid; border-color: #fff #8d877e #8d877e #fff;
  font: 800 11px var(--sans); letter-spacing: .16em; text-transform: uppercase;
}
.card-actions .play:hover { background: #fff; }
.card-actions .play:active { border-color: #8d877e #fff #fff #8d877e; }
.card-actions .dg {
  display: inline-flex; align-items: center; padding: 0 12px; text-decoration: none; background: var(--night-3);
  border: 2px solid; border-color: var(--bev-hi) var(--bev-lo) var(--bev-lo) var(--bev-hi);
  font: 700 10px var(--sans); letter-spacing: .14em; text-transform: uppercase;
}

.swipe-tag { position: absolute; top: 44px; padding: 2px 12px; font: 34px/1.1 var(--pixel); opacity: 0; pointer-events: none; }
.swipe-tag-left { left: 16px; background: var(--paper); color: var(--night); }
.swipe-tag-right { right: 16px; background: var(--magenta); color: #fff; }

.deck-controls { display: flex; align-items: stretch; gap: 8px; position: relative; z-index: 5; }  /* immer vor dem Kartenstapel */
.deck-controls[hidden] { display: none; }
.pad { width: 50px; height: 50px; font-size: 20px; background: #232c70; color: var(--paper); }
.pad:hover { background: #2d3890; }
.deck-controls .pad-skip { background: var(--paper); color: var(--night); border-color: #fff #8d877e #8d877e #fff; }
.deck-controls .pad-skip:active { border-color: #8d877e #fff #fff #8d877e; }
.deck-controls .pad-fav { background: var(--magenta); color: #fff; border-color: rgba(255, 255, 255, .5) rgba(0, 0, 0, .55) rgba(0, 0, 0, .55) rgba(255, 255, 255, .5); }
.deck-controls .pad-fav:active { border-color: rgba(0, 0, 0, .55) rgba(255, 255, 255, .5) rgba(255, 255, 255, .5) rgba(0, 0, 0, .55); }
.counter { min-width: 104px; display: grid; place-items: center; font-size: 30px; line-height: 1; padding: 0 8px; }
.swipe-hint { margin: 0; font: 18px var(--pixel); color: var(--muted); text-align: center; }

/* ---------- Plattenkiste ---------- */
.kiste { position: fixed; inset: 0; z-index: 40; background: rgba(4, 6, 16, .72); display: flex; justify-content: flex-end; padding: 12px; }
.kiste[hidden] { display: none; }
.kiste-inner { width: min(460px, 100%); height: 100%; overflow-y: auto; display: flex; flex-direction: column; }
.kiste-inner header { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 12px; }
.kiste-inner h2 { margin: 0; font-size: 30px; line-height: 1; }
.kiste-tools { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 8px; }
.kiste-tools .sq { min-height: 34px; display: inline-flex; align-items: center; text-decoration: none; }
.kiste-tools .sq[disabled] { opacity: .45; cursor: not-allowed; }
.kiste-msg { padding: 0 16px 8px; }
.kiste-seg { padding: 0 16px 6px; }
.kiste-hint { margin: 0; padding: 0 16px 8px; font: 17px var(--pixel); color: var(--muted); }
#kisteList li.k-item { display: block; position: relative; padding: 0; overflow: hidden; }
#kisteList .k-row {
  position: relative; z-index: 1; display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 0; background: var(--night-2); touch-action: pan-y; transition: transform .18s ease-out;
}
#kisteList li.swiping .k-row { transition: none; cursor: grabbing; }
#kisteList .k-swipe-bg {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font: 20px var(--pixel); color: var(--muted); background: var(--lcd-bg);
  background-image: repeating-linear-gradient(90deg, rgba(159, 231, 255, .06) 0 4px, transparent 4px 8px);
}
#kisteList li.armed .k-swipe-bg { color: #fff; background: var(--magenta); }
#kisteList li.leaving { max-height: 0; transition: max-height .2s ease-in .15s; }
#kisteList .k-links .arch { color: var(--sand); }
#kisteList .k-links .wl { color: var(--lcd); }
#kisteList .k-links .wl-done { color: var(--sand); text-decoration: none; cursor: default; }
#kisteList { list-style: none; margin: 0; padding: 0 16px 16px; display: grid; }
#kisteList li { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px dotted var(--line-strong); }
#kisteList li.muted { display: block; font: 19px var(--pixel); }
#kisteList .thumb { width: 56px; height: 56px; background: var(--duo, #111); background-size: cover; background-position: center; border: 2px solid; border-color: var(--bev-lo) var(--bev-hi) var(--bev-hi) var(--bev-lo); }
#kisteList .k-artist { font: 800 11px var(--sans); letter-spacing: .08em; text-transform: uppercase; }
#kisteList .k-title { font: 400 17px var(--thin); }
#kisteList .k-meta { font: 17px var(--pixel); color: var(--lcd); }
#kisteList .k-links { display: flex; flex-direction: column; gap: 4px; align-items: flex-end; font: 18px var(--pixel); }
#kisteList .k-links button { background: none; border: 0; color: var(--magenta); padding: 0; font: inherit; }

.foot { text-align: center; font: 17px var(--pixel); color: var(--muted); padding: 18px 16px 28px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.foot p { margin: 0; }
.foot-thanks { font: 300 18px var(--thin); color: var(--paper); }
.foot-guide a, .guide-link a { color: var(--lcd); font: 19px var(--pixel); }
.guide-link { margin: 2px 0 0; text-align: center; }
.foot-thanks .heart { color: var(--magenta); display: inline-block; animation: beat 1.6s ease-in-out infinite; }
@keyframes beat { 0%, 60%, 100% { transform: scale(1); } 30% { transform: scale(1.25); } }
.foot-donate { font-size: 18px; color: var(--sand); }
.foot-donate a { color: var(--lcd); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.badge {  /* 88×31-Webbuttons wie um 2000 */
  width: 88px; height: 31px; display: grid; grid-template-rows: 1fr 1fr; place-items: center; text-decoration: none;
  border: 2px solid; border-color: var(--bev-hi) var(--bev-lo) var(--bev-lo) var(--bev-hi);
  font: 15px/1 var(--pixel); overflow: hidden;
}
.badge b { font: 800 9px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase; align-self: end; }
.badge span { align-self: start; padding-top: 1px; }
.badge-paypal { background: linear-gradient(180deg, #003087 0 50%, #0070e0 50%); color: #fff; }
.badge-paypal b { color: #ffc439; }
.badge-paypal:hover { filter: brightness(1.15); }
.badge-paypal:active { border-color: var(--bev-lo) var(--bev-hi) var(--bev-hi) var(--bev-lo); }
.badge-note { background: var(--lcd-bg); color: var(--lcd); }
.badge-note b { color: var(--muted); }

.kb-icon, .range-short { display: none; }
.tb-close { position: relative; cursor: pointer; }
.tb-close::after { content: ""; position: absolute; inset: -4px -6px -4px -14px; }  /* größere Tippfläche, Optik bleibt klein */
@media (max-width: 979px) {
  .titlebar:has(.tb-close) { overflow: visible; }
  .titlebar .tb-close { width: 26px; height: 20px; font-size: 18px; }
  .tb-close::after { inset: -8px -10px -14px -22px; }  /* ~58×42 px Tippfläche */
}

/* ---------- Kleine Smartphones (z.B. iPhone 13 mini): alles auf eine Bildschirmhöhe ---------- */
@media (max-width: 520px) {
  .deck-panel { grid-template-columns: 1fr; }
  .deck-panel > .ctl:not(.ctl-wide) { margin-left: 18px; margin-right: 18px; }

  /* Kopf: eine schmale Zeile */
  .masthead { padding: 10px 12px 8px; align-items: center; gap: 8px; }
  .logo h1 { font-size: 23px; flex-wrap: nowrap; white-space: nowrap; }
  .logo .num, .tag, .marquee { display: none; }
  .head-btns { flex-wrap: nowrap; gap: 6px; }
  .kiste-btn { padding: 5px 8px; font-size: 10px; }
  .kb-label { display: none; }
  .kb-icon { display: inline; color: var(--magenta); font-size: 14px; }
  .kiste-btn b { font-size: 18px; margin-left: 2px; }
  .user-btn span { font-size: 17px; }
  main { padding: 0 12px 12px; gap: 10px; }

  /* Wochenzeile: schmal, kurzes Datum */
  .timeline { gap: 6px; }
  .timeline .sq { min-width: 34px; min-height: 34px; font-size: 16px; }
  .timeline .sq-text { padding: 0 8px; font-size: 9px; letter-spacing: .12em; }
  .week { min-height: 34px; padding: 3px 8px; flex-wrap: nowrap; align-items: center; gap: 8px; overflow: hidden; }
  .week-kw { font-size: 22px; white-space: nowrap; }
  .week-range { font-size: 18px; white-space: nowrap; }
  .range-long, .week-count { display: none; }
  .range-short { display: inline; }

  /* Karte: füllt die verfügbare Höhe, das Cover gibt nach */
  .stage { gap: 8px; }
  .deck { height: clamp(400px, calc(100svh - 188px), 700px); }
  .card .titlebar { height: 20px; font-size: 16px; }
  .cover { flex: 1 1 0; aspect-ratio: auto; max-height: none; min-height: 80px; margin: 6px 6px 0; }
  .cover-fallback { padding: 12px; }
  .fc-artist { font-size: 22px; -webkit-line-clamp: 2; }
  .fc-title { font-size: 16px; }
  .card-body { flex: none; padding: 8px 10px 0; gap: 1px; }
  .card-top { margin-bottom: 0; }
  .artist { font-size: 12px; }
  .title { font-size: 18px; -webkit-line-clamp: 1; }
  .meta { font-size: 13px; }
  .date { font-size: 17px; }
  .stats { display: grid; grid-template-columns: 1fr 1fr; margin-top: 5px; }
  .stats tr { display: grid; grid-template-columns: 1fr auto; align-items: center; border-top: 1px dotted rgba(159, 231, 255, .14); }
  .stats tr:nth-child(-n+2) { border-top: 0; }
  .stats tr:nth-child(odd) { border-right: 1px dotted rgba(159, 231, 255, .14); }
  .stats td { border: 0; padding: 1px 6px; width: auto !important; }
  .stats td:first-child { font-size: 8.5px; letter-spacing: .1em; }
  .stats td:nth-child(2) { font-size: 17px; }
  .stats td:nth-child(3) { display: none; }
  .player iframe { max-height: 200px; }
  .card-actions { padding: 8px 10px 10px; }
  .card-actions .play { padding: 9px; }
  .swipe-tag { top: 30px; font-size: 26px; }

  .pad { width: 44px; height: 44px; font-size: 18px; }
  .counter { min-width: 88px; font-size: 24px; }
  .swipe-hint { display: none; }
}
/* ---------- Sehr kleine Displays (iPhone SE 1. Gen., 320 px breit / sehr niedrig) ---------- */
@media (max-width: 360px) {
  .logo h1 { font-size: 19px; }
  .user-btn span { display: inline-block; max-width: 52px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
  .week-kw { font-size: 18px; }
  .week-range { font-size: 16px; }
  .timeline .sq-text { padding: 0 6px; }
  .range-yr { display: none; }
}
@media (max-width: 520px) and (max-height: 620px) {
  .deck { height: clamp(330px, calc(100svh - 184px), 700px); }
  .card .titlebar { display: none; }
  .meta, .date { display: none; }
  .card-top { font-size: 10px; }
  .stats td:nth-child(2) { font-size: 15px; }
  .card-actions { padding: 6px 8px 8px; }
  .card-actions .play { padding: 7px; }
  .pad { width: 40px; height: 40px; }
  .counter { font-size: 20px; min-width: 76px; }
  .taskbar .task { min-height: 30px; }
  html body { padding-bottom: calc(42px + env(safe-area-inset-bottom)); }
  html body[data-tab="results"] { padding-bottom: calc(92px + env(safe-area-inset-bottom)); }
  .deck-controls { bottom: calc(38px + env(safe-area-inset-bottom)); padding: 4px 6px; }
}

/* ---------- Konto: Login- und Einstellungsfenster ---------- */
.head-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.user-btn span { font: 400 19px/1 var(--pixel); letter-spacing: 0; text-transform: none; color: var(--lcd); }
.overlay { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 16px; overflow-y: auto; background: rgba(4, 6, 16, .78); }
.overlay[hidden] { display: none; }
.dialog { width: min(420px, 100%); }
.dialog-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.dialog-body h2 { margin: 0 0 6px; font-size: 32px; line-height: 1; }
.dialog-body .ctl-label { margin-top: 6px; }
.dialog-body .launch { margin-top: 8px; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg .sq { flex: 1; min-height: 36px; }
.seg .sq[aria-pressed="true"] { background: var(--lcd-bg); color: var(--lcd); border-color: var(--bev-lo) var(--bev-hi) var(--bev-hi) var(--bev-lo); }
.form-msg { margin: 0; min-height: 1.1em; font: 19px/1.1 var(--pixel); color: var(--magenta); }
.form-msg:empty { min-height: 0; }
.hint { margin: 0; font-size: 14px; color: var(--muted); }
.hint a { color: var(--lcd); }
.who { margin: 0 0 4px; font: 19px var(--pixel); color: var(--muted); }
.who b { color: var(--lcd); font-weight: 400; }
.token-state { margin: 0; padding: 6px 10px; font-size: 19px; }
.row { display: flex; gap: 8px; }
.row .field { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack .sq { align-self: flex-start; min-height: 36px; }
.linklike { align-self: flex-start; background: none; border: 0; padding: 0; font: 18px var(--pixel); color: var(--magenta); text-decoration: underline; }
.tb-close { width: 17px; height: 16px; padding: 0; display: grid; place-items: center; font: 15px/1 var(--pixel); color: var(--paper); background: var(--night-3); border: 1px solid; border-color: var(--bev-hi) var(--bev-lo) var(--bev-lo) var(--bev-hi); }
.admin-area { display: flex; flex-direction: column; gap: 10px; }
.admin-list { list-style: none; margin: 0; padding: 0; display: grid; max-height: 260px; overflow-y: auto; background: var(--lcd-bg); border: 2px solid; border-color: var(--bev-lo) var(--bev-hi) var(--bev-hi) var(--bev-lo); }
.admin-list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; align-items: center; padding: 7px 10px; border-top: 1px dotted rgba(159, 231, 255, .14); }
.admin-list li:first-child { border-top: 0; }
.admin-list li.muted { display: block; font: 18px var(--pixel); }
.admin-list .a-main { font: 20px/1.1 var(--pixel); color: var(--lcd); text-shadow: 0 0 4px rgba(159, 231, 255, .35); overflow-wrap: anywhere; }
.admin-list .a-sub { grid-column: 1; font: 17px/1.1 var(--pixel); color: var(--muted); }
.admin-list .a-actions { grid-row: 1 / span 2; grid-column: 2; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.admin-list .a-actions button { background: none; border: 0; padding: 0; font: 18px var(--pixel); color: var(--paper); text-decoration: underline; }
.admin-list .a-actions .danger { color: var(--magenta); }
.admin-list .st-open { color: var(--lcd); }
.admin-list .st-used { color: var(--sand); }
.admin-list .st-expired { color: #5d6282; text-decoration: line-through; }
.logout { background: var(--night-3); }
.logout:hover { background: #202a66; }

/* ---------- Mobil: Filter und Ergebnisse als Tabs in einer Taskleiste ---------- */
.taskbar { display: none; }
@media (max-width: 979px) {
  .taskbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
    padding: 3px 6px calc(3px + env(safe-area-inset-bottom));
    background: var(--night-3);
    border-top: 2px solid var(--bev-hi);
    box-shadow: 0 -1px 0 #000;
  }
  .task {
    display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 32px;
    background: var(--night-2); font: 700 10px var(--sans); letter-spacing: .14em; text-transform: uppercase;
    border: 2px solid; border-color: var(--bev-hi) var(--bev-lo) var(--bev-lo) var(--bev-hi);
  }
  .task-ico { font: 17px/1 var(--pixel); color: var(--muted); letter-spacing: 0; }
  .task b { font: 400 18px/1 var(--pixel); color: var(--magenta); letter-spacing: 0; }
  .task[aria-pressed="true"] {
    background: var(--lcd-bg); color: var(--lcd);
    border-color: var(--bev-lo) var(--bev-hi) var(--bev-hi) var(--bev-lo);
  }
  .task[aria-pressed="true"] .task-ico { color: var(--red); }
  /* Kartensteuerung als eigene Leiste direkt über Filter/Ergebnisse */
  .deck-controls {
    position: fixed; left: 0; right: 0; bottom: calc(40px + env(safe-area-inset-bottom)); z-index: 31;
    gap: 5px; padding: 5px 6px; background: var(--night-3);
    border-top: 2px solid var(--bev-hi); box-shadow: 0 -8px 18px rgba(0, 0, 0, .45);
  }
  .deck-controls .pad { flex: 1 1 0; width: auto; height: 42px; }
  .deck-controls .counter { flex: 1.3 1 0; min-width: 0; }
  body[data-tab="filter"] .timeline,
  body[data-tab="filter"] .stage,
  body[data-tab="results"] .deck-panel { display: none; }
  body { padding-bottom: calc(44px + env(safe-area-inset-bottom)); }
  body[data-tab="results"] { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .grain, .vinyl-spin, .marquee span, .auto-note::before, .foot-thanks .heart { animation: none; }
  .card { transition: none; }
}
