@import url("https://fonts.googleapis.com/css2?family=Creepster&family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
  --bg: #0d0a12;
  --bg-2: #17111f;
  --card: #1e1628;
  --line: #3a2c4a;
  --text: #f3ecf9;
  --muted: #a898b8;
  --orange: #ff7a1a;
  --orange-2: #ffa24d;
  --purple: #9b5cff;
  --green: #4fd18b;
  --red: #ff5470;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 50% -200px, rgba(155, 92, 255, .25), transparent 70%),
    radial-gradient(800px 400px at 100% 100%, rgba(255, 122, 26, .12), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 560px; margin: 0 auto; padding: 28px 16px 64px; }
.wrap.wide { max-width: 900px; }

h1.spooky {
  font-family: "Creepster", cursive;
  font-weight: 400;
  font-size: clamp(2.6rem, 11vw, 4rem);
  line-height: 1;
  letter-spacing: .02em;
  margin: 8px 0 4px;
  color: var(--orange);
  text-shadow: 0 0 24px rgba(255, 122, 26, .45), 0 3px 0 #5a1f00;
  text-align: center;
}
.sub { text-align: center; color: var(--muted); margin: 0 0 28px; }
.emoji-row { text-align: center; font-size: 1.8rem; letter-spacing: .3em; }

.card {
  background: linear-gradient(180deg, var(--card), var(--bg-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, .45);
}

label { display: block; font-weight: 500; margin: 14px 0 6px; font-size: .95rem; }
label .opt { color: var(--muted); font-weight: 400; }
input, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px; /* verhindert Zoom auf iOS */
  color: var(--text);
  background: #120d18;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255, 122, 26, .2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700;
  border: 0; border-radius: 12px;
  padding: 14px 18px;
  cursor: pointer;
  color: #1a0b00;
  background: linear-gradient(180deg, var(--orange-2), var(--orange));
  box-shadow: 0 6px 20px rgba(255, 122, 26, .35);
  transition: transform .08s, filter .15s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; margin-top: 20px; font-size: 1.05rem; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.small { padding: 8px 12px; font-size: .9rem; border-radius: 10px; }

.msg { margin-top: 14px; padding: 12px 14px; border-radius: 12px; font-size: .95rem; }
.msg.err { background: rgba(255, 84, 112, .12); border: 1px solid rgba(255, 84, 112, .4); color: #ffc2cc; }
.msg.ok { background: rgba(79, 209, 139, .12); border: 1px solid rgba(79, 209, 139, .4); }
.hidden { display: none !important; }

.thanks { text-align: center; padding: 18px 4px; }
.thanks .big { font-size: 3.2rem; }
.thanks h2 { margin: 6px 0; }
.thanks p { color: var(--muted); }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.foot { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 22px; }
.foot a { color: var(--muted); }

/* ---------- DJ ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.topbar h1.spooky { font-size: 2.4rem; text-align: left; margin: 0; }
.topbar .right { display: flex; gap: 8px; align-items: center; }
.live { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .85rem; }
.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.live.on .dot { background: var(--green); box-shadow: 0 0 10px var(--green); }

.tabs { display: flex; gap: 6px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.tab { flex: 1; font: inherit; font-weight: 500; color: var(--muted); background: transparent; border: 0; border-radius: 9px; padding: 10px 8px; cursor: pointer; }
.tab.active { background: var(--card); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.tab .count { display: inline-block; min-width: 1.6em; padding: 0 6px; margin-left: 4px; border-radius: 99px; background: var(--line); font-size: .8rem; }
.tab.active .count { background: var(--orange); color: #1a0b00; }

.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input { flex: 1; min-width: 160px; padding: 10px 12px; }

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}
.item.new { animation: pop 1.2s ease-out; }
@keyframes pop { 0% { border-color: var(--orange); box-shadow: 0 0 0 4px rgba(255, 122, 26, .3); } 100% { border-color: var(--line); box-shadow: none; } }
.item.sortable-ghost { opacity: .35; }
.handle { cursor: grab; color: var(--muted); font-size: 1.3rem; padding: 6px 4px; touch-action: none; user-select: none; }
.num { color: var(--muted); font-size: .8rem; text-align: center; }
.info { min-width: 0; }
.song { font-weight: 700; font-size: 1.05rem; overflow-wrap: anywhere; }
.artist { color: var(--orange-2); overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: .82rem; margin-top: 4px; overflow-wrap: anywhere; }
.note { margin-top: 6px; font-size: .9rem; background: #120d18; border-radius: 8px; padding: 6px 8px; overflow-wrap: anywhere; }
.dup { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 99px; background: var(--purple); color: #fff; font-size: .75rem; font-weight: 700; vertical-align: middle; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.icon-btn {
  font: inherit; width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
  background: #120d18; color: var(--text); border: 1px solid var(--line); font-size: 1.05rem;
}
.icon-btn:hover { border-color: var(--orange); }
.icon-btn.done { background: rgba(79, 209, 139, .15); border-color: rgba(79, 209, 139, .5); }
.icon-btn.danger:hover { border-color: var(--red); }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

@media (max-width: 520px) {
  .item { grid-template-columns: auto 1fr; }
  .actions { grid-column: 1 / -1; justify-content: flex-start; }
}

/* ---------- QR ---------- */
.qr-sheet { text-align: center; }
.qr-box { background: #fff; display: inline-block; padding: 18px; border-radius: 18px; margin: 18px 0; }
.qr-box svg, .qr-box img { display: block; width: min(70vw, 340px); height: auto; }
.url { color: var(--muted); word-break: break-all; }
@media print {
  body { background: #fff; color: #000; }
  .no-print { display: none !important; }
  h1.spooky { color: #e05a00; text-shadow: none; }
  .sub, .url { color: #333; }
  .card { box-shadow: none; border: 0; background: #fff; }
}

/* ---------- Ergänzungen DJ ---------- */
.hint { color: var(--muted); font-size: .85rem; margin: 0 0 10px; }
.num { display: flex; flex-direction: column; align-items: center; min-width: 28px; }
.item.played .song { text-decoration: line-through; text-decoration-color: var(--muted); }
.item.played { opacity: .75; }
.icon-btn.armed { width: auto; padding: 0 10px; border-color: var(--red); background: rgba(255, 84, 112, .15); font-size: .85rem; font-weight: 700; }
.topbar form { margin: 0; }
a.btn { text-decoration: none; }

/* ---------- Spotify-Suche ---------- */
.search { position: relative; }
.results {
  list-style: none; margin: 6px 0 0; padding: 6px; position: absolute; left: 0; right: 0; z-index: 10;
  background: #120d18; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 20px 40px rgba(0,0,0,.5);
  max-height: 360px; overflow-y: auto;
}
.results li { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 9px; cursor: pointer; }
.results li:hover, .results li.active { background: var(--card); }
.results img, .results .nocover { width: 44px; height: 44px; border-radius: 6px; flex: none; object-fit: cover; background: var(--line); }
.results .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results .a { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results .txt { min-width: 0; }
.results .state { color: var(--muted); padding: 10px; cursor: default; }
.picked { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 10px; border-radius: 12px;
  background: rgba(30, 215, 96, .08); border: 1px solid rgba(30, 215, 96, .45); }
.picked img { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; background: var(--line); flex: none; }
.picked-info { flex: 1; min-width: 0; }
.picked-title { font-weight: 700; overflow-wrap: anywhere; }
.picked-artist { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.unpick { font: inherit; background: transparent; border: 1px solid var(--line); color: var(--text); border-radius: 10px; width: 36px; height: 36px; cursor: pointer; }
.or { color: var(--muted); font-size: .85rem; margin: 10px 0 0; }

/* ---------- DJ: Cover, Spotify, Push ---------- */
.cover { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; flex: none; background: var(--line); }
.info-row { display: flex; gap: 12px; align-items: center; min-width: 0; }
.spotify-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; font-size: .8rem; font-weight: 700;
  color: #1ed760; text-decoration: none; border: 1px solid rgba(30, 215, 96, .45); border-radius: 99px; padding: 2px 9px; }
.spotify-link:hover { background: rgba(30, 215, 96, .12); }
.btn.push-on { border-color: var(--green); color: var(--green); }
.hint-box { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: .9rem; }
.hint-box b { color: var(--orange-2); }
.info-text { min-width: 0; }

/* ---------- Rückblick / Nachtstatistik ---------- */
.stats-head { text-align: center; margin-bottom: 18px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: linear-gradient(180deg, var(--card), var(--bg-2)); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: center; }
.kv { font-size: 2rem; font-weight: 700; color: var(--orange); line-height: 1.1; }
.kl { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.stats-card { margin-bottom: 16px; }
.stats-card h2 { margin: 0 0 12px; font-size: 1.15rem; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stats-grid .stats-card { margin-bottom: 16px; }
@media (max-width: 760px) { .stats-grid { grid-template-columns: 1fr; } }
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rank li { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; background: #120d18; }
.medal { width: 32px; text-align: center; font-size: 1.3rem; color: var(--muted); font-weight: 700; flex: none; }
.rank .cover { width: 48px; height: 48px; }
.nocover { display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; }
.rank-info { flex: 1; min-width: 0; }
.count-big { font-weight: 700; font-size: 1.2rem; color: var(--orange-2); flex: none; }
.tag { display: inline-block; font-size: .7rem; padding: 1px 7px; border-radius: 99px; background: rgba(79, 209, 139, .15); color: var(--green); vertical-align: middle; font-weight: 600; }
.facts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.facts li { line-height: 1.4; }
.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--line); stroke-width: 1; }
.chart .bar { fill: var(--purple); }
.chart .bar.peak { fill: var(--orange); }
.chart .bar-val { fill: var(--text); font-size: 11px; text-anchor: middle; font-family: inherit; }
.chart .bar-label { fill: var(--muted); font-size: 10px; text-anchor: middle; font-family: inherit; }
.notes-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.notes-list li { background: #120d18; border-radius: 10px; padding: 8px 12px; }
.note-text { overflow-wrap: anywhere; }
.muted-p { color: var(--muted); }
.empty-stats { text-align: center; color: var(--muted); }
@media print {
  .stats-page { -webkit-print-color-adjust: exact; print-color-adjust: exact; background: #0d0a12 !important; color: var(--text) !important; }
  .stats-page .card { background: var(--card) !important; border: 1px solid var(--line) !important; break-inside: auto; }
  .stats-page h2 { break-after: avoid; }
  .stats-page .chart, .facts li, .notes-list li { break-inside: avoid; }
  .stats-page .sub, .stats-page .meta { color: var(--muted) !important; }
  .stats-page h1.spooky { color: var(--orange) !important; }
  .kpi, .rank li { break-inside: avoid; }
}
.kv.kv-text { font-size: 1.35rem; padding-top: 6px; }
.reset-card { margin-top: 28px; border-color: rgba(255, 84, 112, .35); }
.reset-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.reset-row input { flex: 1; min-width: 220px; }
.btn.danger-btn { background: linear-gradient(180deg, #ff6b81, var(--red)); color: #fff; box-shadow: none; }
.btn.danger-btn:disabled { background: var(--line); color: var(--muted); }
