:root {
  --bg: #0e0f11;
  --fl: #16171a;
  --fl2: #1e2024;
  --fl3: #26282d;
  --linie: #2a2c31;
  --text: #ececed;
  --leise: #a0a3ab;
  --leiser: #73767e;
  --akz: #f4a63b;
  --akz-text: #1b1306;
  --rot: #ef5350;
  --rot-text: #ff8f8c;
  --r: 14px;
  --schrift: "Segoe UI Variable Text", "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Roboto, Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 var(--schrift);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button, .knopf, .pl-eintrag, .lied { user-select: none; -webkit-user-select: none; }
img { display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--akz); outline-offset: 2px; }
svg { flex: none; }

/* ---------- Bausteine ---------- */
.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--linie); background: var(--fl2);
  font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap;
}
.knopf:hover { background: var(--fl3); }
.knopf svg { width: 17px; height: 17px; }
.knopf.haupt { background: var(--akz); border-color: var(--akz); color: var(--akz-text); }
.knopf.haupt:hover { background: #f7b658; }
.knopf.gefahr { background: transparent; color: var(--rot-text); border-color: #4b2a2b; }
.knopf.gefahr:hover { background: #2b1819; }
.knopf.rot { background: var(--rot); border-color: var(--rot); color: #fff; }
.knopf.rot:hover { background: #f26966; }
.knopf.klein { height: 32px; padding: 0 14px; font-size: 13px; }
.knopf:disabled { opacity: .55; cursor: default; }

.symbol-knopf {
  width: 38px; height: 38px; border-radius: 50%;
  display: inline-grid; place-items: center; color: var(--leise);
}
.symbol-knopf:hover { background: var(--fl3); color: var(--text); }
.symbol-knopf.loeschen:hover { background: #2b1819; color: var(--rot-text); }
.symbol-knopf svg { width: 18px; height: 18px; }

.ikon-strich { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.text-knopf { color: var(--leise); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.text-knopf:hover { color: var(--text); }

.marke { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.marke-zeichen { width: 26px; height: 26px; }

.leise { color: var(--leise); }
.hinweis { margin: 0; color: var(--leise); font-size: 13px; line-height: 1.45; }

/* ---------- Anmelden ---------- */
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.login-karte {
  width: 100%; max-width: 360px; display: grid; gap: 14px;
  background: var(--fl); border: 1px solid var(--linie); border-radius: 18px; padding: 30px 28px 28px;
}
.login-karte .marke { justify-content: center; font-size: 24px; margin-bottom: 8px; }
.login-karte .marke-zeichen { width: 32px; height: 32px; }
.login-karte label, .konto-form label { display: grid; gap: 6px; font-size: 13px; color: var(--leise); font-weight: 600; }
.login-karte input, .konto-form input {
  height: 46px; border-radius: 10px; border: 1px solid var(--linie); background: var(--bg);
  color: var(--text); padding: 0 13px; font: inherit; font-size: 16px;
}
.login-karte input:focus, .konto-form input:focus { outline: none; border-color: var(--akz); }
.login-fehler { margin: 0; min-height: 19px; color: var(--rot-text); font-size: 13px; }
.login-karte .knopf { height: 46px; font-size: 15px; }

/* ---------- Rahmen ---------- */
.kopf {
  position: sticky; top: 0; z-index: 20;
  height: 64px; display: flex; align-items: center; gap: 32px; padding: 0 28px;
  background: rgba(14, 15, 17, .94); border-bottom: 1px solid var(--linie);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.reiter { display: flex; gap: 4px; }
.reiter button { height: 36px; padding: 0 16px; border-radius: 999px; color: var(--leise); font-weight: 600; font-size: 14px; }
.reiter button:hover { color: var(--text); }
.reiter button.aktiv { background: var(--fl2); color: var(--text); }
.konto { margin-left: auto; display: flex; align-items: center; gap: 16px; color: var(--leise); font-size: 14px; }
#benutzer-name { color: var(--text); font-weight: 600; }

main { max-width: 1240px; margin: 0 auto; padding: 24px 28px 112px; }

/* ---------- Kennzahlen ---------- */
.zahlen { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.zahl { background: var(--fl); border: 1px solid var(--linie); border-radius: var(--r); padding: 13px 18px 14px; min-width: 0; }
.zahl small { display: block; color: var(--leise); font-size: 13px; font-weight: 600; }
.zahl b { display: block; margin-top: 2px; font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.zahl b span { margin-left: 8px; color: var(--leise); font-size: 13px; font-weight: 600; letter-spacing: 0; }

/* ---------- Playlists ---------- */
.zwei-spalten { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.liste-spalte { position: sticky; top: 80px; background: var(--fl); border: 1px solid var(--linie); border-radius: var(--r); padding: 10px; }
.liste-spalte h2 { margin: 6px 8px 8px; font-size: 13px; font-weight: 600; color: var(--leise); }
.pl-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.pl-eintrag { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px; border-radius: 10px; text-align: left; }
.pl-eintrag:hover { background: var(--fl2); }
.pl-eintrag.aktiv { background: var(--fl3); }
.pl-text { min-width: 0; display: grid; }
.pl-text b { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-text small { color: var(--leise); font-size: 13px; }
.pl-liste .leer { padding: 10px 8px; color: var(--leise); font-size: 14px; }

.mosaik { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; border-radius: 8px; background: var(--fl3); flex: none; }
.mosaik.eins { grid-template-columns: 1fr; }
.mosaik img { width: 100%; height: 100%; object-fit: cover; }
.mosaik.leer { display: grid; place-items: center; color: var(--leiser); }
.mosaik.leer svg { width: 40%; height: 40%; }
.pl-eintrag .mosaik { width: 52px; height: 52px; border-radius: 7px; }

.detail-spalte { background: var(--fl); border: 1px solid var(--linie); border-radius: var(--r); padding: 22px 22px 14px; min-width: 0; }
.detail-spalte > .leer, .detail-spalte > .laden { margin: 0; padding: 28px 4px; color: var(--leise); }
.zurueck { margin-bottom: 14px; }
.detail-kopf {
  display: grid; grid-template-columns: 128px minmax(0, 1fr); column-gap: 22px; align-items: center;
  padding-bottom: 20px; border-bottom: 1px solid var(--linie);
}
.detail-kopf .mosaik { grid-row: 1 / span 2; width: 128px; height: 128px; border-radius: 10px; }
.detail-text { min-width: 0; align-self: end; }
.detail-text h1 { margin: 0; font-size: 26px; line-height: 1.2; letter-spacing: -.02em; overflow-wrap: anywhere; }
.meta { margin-top: 5px; color: var(--leise); font-size: 14px; }
.meta.leiser { margin-top: 1px; color: var(--leiser); font-size: 13px; }
.detail-knoepfe { grid-column: 2; align-self: start; display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.lied-kopf, .lied {
  display: grid; align-items: center; gap: 14px;
  grid-template-columns: 26px 44px minmax(0, 1fr) 56px 64px 82px;
}
.lied-kopf { padding: 12px 10px 6px; color: var(--leiser); font-size: 12.5px; font-weight: 600; }
.lied-kopf .rechts, .lied .zeit, .lied .mb { text-align: right; }
.lieder { list-style: none; margin: 0; padding: 0; }
.lied { padding: 6px 10px; border-radius: 10px; cursor: pointer; }
.lied:hover { background: var(--fl2); }
.lied.spielt { background: #221e17; }
.lied.spielt .titel { color: var(--akz); }
.lied.weg { opacity: .35; pointer-events: none; }
.lied .nr { color: var(--leiser); font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.lied .nr svg { width: 16px; height: 16px; color: var(--akz); margin-left: auto; }
.lied img { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: var(--fl3); }
.lied-text { min-width: 0; display: grid; }
.titel, .interpret { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titel { font-weight: 600; }
.interpret { color: var(--leise); font-size: 13.5px; }
.lied .zeit, .lied .mb { color: var(--leise); font-size: 14px; font-variant-numeric: tabular-nums; }
.aktionen { display: flex; justify-content: flex-end; gap: 2px; }
.lied { -webkit-touch-callout: none; }
.lied img { pointer-events: none; -webkit-user-drag: none; }
.lied.zieht { position: relative; z-index: 3; background: var(--fl3); box-shadow: 0 10px 28px rgba(0, 0, 0, .55); }
body.am-ziehen, body.am-ziehen .lied { cursor: grabbing; }
body.am-ziehen .lied:not(.zieht) { transition: transform .15s ease; }
body.am-ziehen .lied:not(.zieht):hover { background: none; }
@media (prefers-reduced-motion: reduce) { body.am-ziehen .lied:not(.zieht) { transition: none; } }

/* ---------- Apps ---------- */
.karte { background: var(--fl); border: 1px solid var(--linie); border-radius: var(--r); padding: 20px 22px; min-width: 0; }
.karte h2 { margin: 0 0 14px; font-size: 16px; letter-spacing: -.01em; }
.zugang-karte { margin-bottom: 16px; }
.zugang { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px 28px; }
.feld { min-width: 0; }
.feld small { display: block; margin-bottom: 4px; color: var(--leise); font-size: 13px; font-weight: 600; }
.feld-wert { display: flex; align-items: center; gap: 12px; min-height: 32px; }
.feld-wert b { font-size: 15.5px; overflow-wrap: anywhere; }
.feld-wert .leise { font-size: 14px; }
.zugang + .hinweis { margin-top: 14px; }

/* ---------- Konto ---------- */
.konto-karten { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 900px; align-items: start; }
.konto-form { display: flex; flex-direction: column; gap: 12px; }
.konto-form h2 { margin-bottom: 4px; }
.konto-form .knopf { margin-top: 4px; align-self: flex-start; }
.form-fehler { margin: 0; color: var(--rot-text); font-size: 13px; }
.form-fehler:empty { display: none; }
.konto-hinweis { margin-top: 14px; }

.app-karten { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.app-karte { display: flex; flex-direction: column; gap: 16px; }
.app-kopf { display: flex; align-items: center; gap: 14px; }
.app-kopf img { width: 56px; height: 56px; border-radius: 14px; }
.app-kopf b { display: block; font-size: 17px; }
.app-kopf small { color: var(--leise); font-size: 13.5px; }
.qr { display: flex; align-items: center; gap: 16px; }
.qr img { width: 112px; height: 112px; border-radius: 10px; background: #fff; }
.qr p { margin: 0; color: var(--leise); font-size: 13.5px; }
.app-karte .hinweis { margin-top: -4px; }

/* ---------- Player ---------- */
.spieler {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  height: 76px; padding: 0 24px; gap: 24px;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 560px) minmax(0, 1fr); align-items: center;
  background: #141518; border-top: 1px solid var(--linie);
}
.sp-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.sp-info img { width: 48px; height: 48px; border-radius: 6px; object-fit: cover; background: var(--fl3); }
.sp-text { min-width: 0; display: grid; }
.sp-text b, .sp-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-text small { color: var(--leise); font-size: 13px; }
.sp-mitte { display: grid; justify-items: center; gap: 2px; min-width: 0; }
.sp-tasten { display: flex; align-items: center; gap: 8px; padding-left: 46px; }
.sp-play { width: 38px; height: 38px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; }
.sp-play:hover { background: #fff; }
.sp-play svg { width: 18px; height: 18px; }
.sp-leiste { width: 100%; display: flex; align-items: center; gap: 10px; color: var(--leise); font-size: 12px; font-variant-numeric: tabular-nums; }
.sp-leiste span { width: 38px; }
.sp-leiste span:first-child { text-align: right; }
.sp-rechts { justify-self: end; }

input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; height: 16px; margin: 0; background: transparent; cursor: pointer; --stand: 0%; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(to right, var(--text) var(--stand), var(--fl3) var(--stand)); }
input[type=range]::-moz-range-track { height: 4px; border-radius: 4px; background: var(--fl3); }
input[type=range]::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--text); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; margin-top: -4px; border-radius: 50%; background: var(--text); border: 0; }
input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--text); border: 0; }

/* ---------- Dialog + Meldung ---------- */
.dialog-hinter { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .62); }
.dialog { width: 100%; max-width: 400px; background: var(--fl); border: 1px solid var(--linie); border-radius: 16px; padding: 22px; }
.dialog h2 { margin: 0 0 8px; font-size: 18px; }
.dialog p { margin: 0 0 20px; color: var(--leise); font-size: 14.5px; }
.dialog-knoepfe { display: flex; justify-content: flex-end; gap: 10px; }

.meldung {
  position: fixed; left: 0; right: 0; bottom: 96px; z-index: 60; margin: 0 auto;
  width: max-content; max-width: calc(100% - 32px); padding: 11px 18px; border-radius: 999px; text-align: center;
  background: var(--text); color: var(--bg); font-weight: 600; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.meldung.sichtbar { opacity: 1; }
.meldung.fehler { background: var(--rot); color: #fff; }

.unten-leiste { display: none; }

/* ---------- PC: Bedienelemente nur dort ---------- */
@media (min-width: 761px) {
  .nur-handy { display: none !important; }
}

/* ---------- Handy ---------- */
@media (max-width: 760px) {
  body { font-size: 15px; }
  .kopf { height: 56px; padding: 0 16px; gap: 16px; }
  .kopf .reiter { display: none; }
  .konto { gap: 12px; font-size: 13.5px; }
  main { padding: 12px 14px calc(84px + env(safe-area-inset-bottom)); }
  body.mit-spieler main { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }

  .zahlen { gap: 6px; margin-bottom: 14px; }
  .zahl { padding: 9px 10px 10px; border-radius: 12px; }
  .zahl small { font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .zahl b { font-size: 17px; }
  .zahl b span { display: none; }

  .zwei-spalten { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .liste-spalte { position: static; padding: 6px; }
  body.detail-offen .liste-spalte, body.detail-offen .zahlen { display: none; }
  body:not(.detail-offen) .detail-spalte { display: none; }
  .detail-spalte { padding: 0; background: none; border: 0; border-radius: 0; }

  .nur-pc { display: none !important; }
  .detail-kopf { grid-template-columns: 88px minmax(0, 1fr); column-gap: 14px; padding-bottom: 14px; }
  .detail-kopf .mosaik { grid-row: 1; width: 88px; height: 88px; border-radius: 9px; }
  .detail-text { align-self: center; }
  .detail-text h1 { font-size: 21px; }
  .meta { font-size: 13px; margin-top: 3px; }
  .meta.leiser { font-size: 12.5px; }
  .detail-knoepfe { grid-column: 1 / -1; flex-wrap: nowrap; gap: 8px; margin-top: 14px; }
  .detail-knoepfe .knopf { flex: 1; height: 40px; padding: 0 12px; font-size: 14px; }

  .lied-kopf { display: none; }
  .lieder { margin-top: 6px; }
  .lied { grid-template-columns: 44px minmax(0, 1fr) auto 36px; gap: 12px; padding: 6px 4px; }
  .lied .nr, .lied .mb { display: none; }
  .lied .zeit { font-size: 13px; }
  .aktionen .symbol-knopf { width: 36px; height: 36px; }

  #ansicht-apps:not([hidden]) { display: flex; flex-direction: column; gap: 10px; }
  .app-karten { order: 1; grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .zugang-karte { order: 2; margin: 0; }
  .qr { display: none; }
  .karte { padding: 14px 16px; }
  .karte h2 { margin-bottom: 10px; font-size: 15px; }
  .app-karte { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px 12px; }
  .app-karte .knopf { height: 38px; padding: 0 16px; }
  .app-karte .hinweis { grid-column: 1 / -1; margin: 0; }
  .app-kopf { gap: 12px; }
  .app-kopf img { width: 44px; height: 44px; border-radius: 11px; }
  .app-kopf b { font-size: 16px; }
  .zugang { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  /* Handy: «Kopieren» neben die Überschrift, der Wert bekommt die ganze Breite (lange Adresse bricht nicht um) */
  .feld { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; }
  .feld-wert { display: contents; }
  .feld small { grid-area: 1 / 1; font-size: 12.5px; margin: 0; }
  .feld-wert .knopf { grid-area: 1 / 2; }
  .feld-wert b, .feld-wert .leise { grid-column: 1 / -1; grid-row: 2; margin-top: 2px; }
  .feld-wert b { overflow-wrap: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .konto-karten { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .konto-form .knopf { align-self: stretch; height: 44px; }

  .unten-leiste {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 31;
    display: flex; height: calc(60px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: #141518; border-top: 1px solid var(--linie);
  }
  .unten-leiste button { flex: 1; display: grid; justify-items: center; align-content: center; gap: 3px; color: var(--leiser); font-size: 11.5px; font-weight: 600; }
  .unten-leiste button.aktiv { color: var(--text); }
  .unten-leiste svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

  .spieler {
    bottom: calc(60px + env(safe-area-inset-bottom)); height: 62px; padding: 0 6px 0 10px; gap: 4px;
    grid-template-columns: minmax(0, 1fr) auto auto;
  }
  .sp-info img { width: 42px; height: 42px; }
  .sp-text b { font-size: 14px; }
  .sp-mitte { display: contents; }
  .sp-tasten { padding-left: 0; gap: 2px; }
  .sp-play { width: 38px; height: 38px; }
  .sp-leiste { position: absolute; left: 0; right: 0; top: -7px; }
  .sp-leiste span { display: none; }
  .sp-leiste input[type=range] { height: 14px; }
  .sp-leiste input[type=range]::-webkit-slider-runnable-track { height: 3px; border-radius: 0; }
  .sp-leiste input[type=range]::-webkit-slider-thumb { width: 0; height: 0; margin-top: 0; }
  .sp-leiste input[type=range]::-moz-range-thumb { width: 0; height: 0; }
  .meldung { bottom: calc(80px + env(safe-area-inset-bottom)); }
  body.mit-spieler .meldung { bottom: calc(142px + env(safe-area-inset-bottom)); }
}

@media (max-width: 380px) {
  .zahl { padding: 8px 8px 9px; }
  .zahl b { font-size: 16px; }
  .konto #benutzer-name { display: none; }
}
