/* ============================================================================
   Songcheck. Ein Bildschirm pro Song, Daumen zuerst.

   Schriftwahl: bewusst der System-Stack. Auf dem iPhone ist das SF Pro, also
   genau die Schrift, in der der Rest des Geräts gesetzt ist. Ein Webfont würde
   hier nichts gewinnen und drei Dinge kosten: Ladezeit im Handynetz, einen
   Textsprung beim Laden und eine Datei, die offline fehlen kann. Ziffern laufen
   über einen eigenen Mono-Stack, damit Skalenwerte und Codenamen sauber stehen.

   Ein Akzent, durchgehend: Kobaltblau. Grün und Bernstein sind AUSSCHLIESSLICH
   Statusfarben (fertig / offen) und nie Dekoration. Deshalb ist der Akzent kein
   Grün mehr: sonst hieße dieselbe Farbe an einer Stelle "Marke" und an der
   nächsten "erledigt".

   Radien, eine Regel: Flächen 16, Bedienelemente 12, Chips rund, Avatar Kreis.
   ========================================================================= */

:root {
  color-scheme: light dark;

  --grund: #faf9f7;
  --flaeche: #ffffff;
  --flaeche-2: #f3f1ed;
  --tinte: #17171a;
  --leise: #6b6965;
  --linie: rgb(23 23 26 / 0.10);
  --linie-stark: rgb(23 23 26 / 0.20);

  --akzent: #2b57c4;
  --akzent-weich: #e9eefb;
  --akzent-tinte: #1c3c8c;

  --gut: #1c7a4f;
  --gut-weich: #e2f1e9;
  --warte: #8a5a12;
  --warte-weich: #f9eeda;
  --stopp: #a52f2b;
  --stopp-weich: #fbeae9;

  --r-flaeche: 16px;
  --r-feld: 12px;
  --r-chip: 999px;

  --spalte: 34rem;
  --schrift: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ziffern: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --kurve: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --grund: #101012;
    --flaeche: #18181b;
    --flaeche-2: #212126;
    --tinte: #f1f0ed;
    --leise: #a3a19c;
    --linie: rgb(255 255 255 / 0.10);
    --linie-stark: rgb(255 255 255 / 0.22);

    --akzent: #86a8ff;
    --akzent-weich: #1a2340;
    --akzent-tinte: #c8d8ff;

    --gut: #5fc493;
    --gut-weich: #14301f;
    --warte: #e0ab5f;
    --warte-weich: #2f2410;
    --stopp: #f08b86;
    --stopp-weich: #351817;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--grund);
  color: var(--tinte);
  font: 400 16px/1.55 var(--schrift);
  letter-spacing: -0.005em;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ------------------------------------------------------------------ Gerüst */

.kopf {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: max(14px, env(safe-area-inset-top)) 20px 14px;
  background: color-mix(in srgb, var(--grund) 88%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--linie);
}

@media (prefers-reduced-transparency: reduce) {
  .kopf { background: var(--grund); backdrop-filter: none; -webkit-backdrop-filter: none; }
}

.marke {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--tinte);
}

.marke::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--akzent);
  transform: rotate(45deg);
}

.nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
}

.nav a {
  color: var(--leise);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: var(--r-chip);
  transition: color 0.15s var(--kurve), background 0.15s var(--kurve);
}

.nav a:hover { color: var(--tinte); background: var(--flaeche-2); }
.nav .wer { color: var(--leise); padding-left: 6px; }

/* Die Kopfzeile muss auf EINER Zeile bleiben. Auf schmalen Geräten fliegt der
   eigene Name raus: Wer angemeldet ist, weiß man selbst, die Ziele nicht. */
@media (max-width: 560px) {
  .kopf { padding-left: 16px; padding-right: 16px; gap: 8px; }
  .nav .wer { display: none; }
  .nav { gap: 0; }
  .nav a { padding: 6px 8px; }
}

.inhalt {
  max-width: var(--spalte);
  margin: 0 auto;
  padding: 28px 20px 40px;
}

.fuss {
  max-width: var(--spalte);
  margin: 0 auto;
  padding: 0 20px 40px;
  font-size: 13px;
  color: var(--leise);
}

.inhalt a, .fuss a { color: var(--akzent); text-underline-offset: 3px; }

/* ------------------------------------------------------------------- Typo */

h1 {
  margin: 0 0 6px;
  font-size: clamp(26px, 7vw, 31px);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

h2 {
  margin: 36px 0 12px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.leise { color: var(--leise); font-size: 14.5px; margin: 0 0 24px; }
.mono { font-family: var(--ziffern); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- Flächen */

.karte {
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--r-flaeche);
  padding: 18px;
  margin-bottom: 14px;
}

/* --------------------------------------------------------------- Player */

.player {
  position: sticky;
  top: calc(52px + env(safe-area-inset-top));
  z-index: 10;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--r-flaeche);
  padding: 14px;
  margin-bottom: 28px;
}

.player-kopf { display: flex; align-items: center; gap: 14px; }

.play {
  flex: none;
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: var(--akzent);
  color: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.12s var(--kurve), filter 0.12s var(--kurve);
}

.play:hover { filter: brightness(1.08); }
.play:active { transform: scale(0.94); }
.play svg { width: 20px; height: 20px; fill: currentColor; }

.player-name {
  font-family: var(--ziffern);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.player-unter { font-size: 13px; color: var(--leise); margin-top: 1px; }

.leiste {
  height: 4px;
  border-radius: var(--r-chip);
  background: var(--flaeche-2);
  margin-top: 14px;
  cursor: pointer;
  overflow: hidden;
}

.leiste > div {
  height: 100%;
  width: 0;
  border-radius: var(--r-chip);
  background: var(--akzent);
}

.zeiten {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-family: var(--ziffern);
  font-size: 11.5px;
  color: var(--leise);
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- Fragen */

.frage { margin-bottom: 30px; }

.frage-kopf {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 11px;
}

.frage-nr {
  font-family: var(--ziffern);
  font-size: 12px;
  color: var(--leise);
  font-variant-numeric: tabular-nums;
  padding-top: 1px;
}

.frage-text { font-size: 15.5px; line-height: 1.35; }

.frage.fehlt { border-left: 2px solid var(--stopp); padding-left: 14px; margin-left: -16px; }
.pflicht-fehlt { color: var(--stopp); font-size: 13px; margin-top: 8px; }

/* Skala: ein durchgehendes Feld statt sieben Einzelknöpfe. Die Trennlinien
   liegen zwischen den Werten, damit die Reihe als EINE Achse gelesen wird. */
.skala {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--r-feld);
  overflow: hidden;
}

.skala input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.skala label {
  padding: 14px 0;
  text-align: center;
  font-family: var(--ziffern);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  user-select: none;
  border-left: 1px solid var(--linie);
  transition: background 0.12s var(--kurve), color 0.12s var(--kurve);
}

.skala label:first-of-type { border-left: 0; }
.skala label:hover { background: var(--flaeche-2); }

.skala input:checked + label {
  background: var(--tinte);
  color: var(--grund);
  border-color: var(--tinte);
}

.skala-enden {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--leise);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.chips label {
  padding: 11px 15px;
  border: 1px solid var(--linie);
  border-radius: var(--r-chip);
  background: var(--flaeche);
  font-size: 14.5px;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s var(--kurve), color 0.12s var(--kurve),
              border-color 0.12s var(--kurve), transform 0.12s var(--kurve);
}

.chips label:hover { border-color: var(--linie-stark); }
.chips label:active { transform: scale(0.97); }

.chips input:checked + label {
  background: var(--tinte);
  color: var(--grund);
  border-color: var(--tinte);
}

.skala input:focus-visible + label,
.chips input:focus-visible + label,
.schalter input:focus-visible {
  outline: 2px solid var(--akzent);
  outline-offset: 2px;
}

.schalter {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid var(--linie);
  border-radius: var(--r-feld);
  background: var(--flaeche);
  cursor: pointer;
  font-size: 15px;
}

.schalter input { width: 22px; height: 22px; accent-color: var(--akzent); flex: none; }

/* ------------------------------------------------------------- Eingaben */

label.feld { display: block; font-size: 14px; color: var(--leise); margin-bottom: 7px; }

select, textarea, input[type=file],
input[type=text], input[type=number], input[type=email], input[type=password] {
  width: 100%;
  padding: 13px 14px;
  font: inherit;
  font-size: 16px;
  color: var(--tinte);
  background: var(--flaeche);
  border: 1px solid var(--linie);
  border-radius: var(--r-feld);
  transition: border-color 0.15s var(--kurve), box-shadow 0.15s var(--kurve);
}

select:focus, textarea:focus, input:focus {
  outline: 0;
  border-color: var(--akzent);
  box-shadow: 0 0 0 3px var(--akzent-weich);
}

::placeholder { color: var(--leise); opacity: 1; }
textarea { min-height: 84px; resize: vertical; }

/* Datei-Auswahl: Das native Bedienelement sieht auf jeder Plattform anders aus
   und lässt sich nicht zuverlässig gestalten (::file-selector-button hat im
   Test einen leeren Knopf hinterlassen). Deshalb Eingabefeld verstecken und das
   umgebende Label als Ablagefläche gestalten. Klick und Tastatur funktionieren
   unverändert, weil das echte Feld darin liegt. */
.ablage {
  display: block;
  padding: 22px 18px;
  border: 1px dashed var(--linie-stark);
  border-radius: var(--r-feld);
  background: var(--flaeche);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s var(--kurve), background 0.15s var(--kurve);
}

.ablage:hover { border-color: var(--akzent); background: var(--akzent-weich); }
.ablage:focus-within { border-color: var(--akzent); box-shadow: 0 0 0 3px var(--akzent-weich); }
.ablage input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.ablage-text { display: block; font-size: 14.5px; color: var(--leise); }

.ablage-datei {
  display: none;
  margin-top: 8px;
  font-family: var(--ziffern);
  font-size: 13px;
  color: var(--tinte);
  word-break: break-all;
}

.ablage.gewaehlt { border-style: solid; border-color: var(--akzent); }
.ablage.gewaehlt .ablage-datei { display: block; }

/* --------------------------------------------------------------- Knöpfe */

.knopf {
  display: block;
  width: 100%;
  padding: 15px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #fff;
  background: var(--akzent);
  border: 0;
  border-radius: var(--r-feld);
  cursor: pointer;
  transition: transform 0.12s var(--kurve), filter 0.12s var(--kurve);
}

@media (prefers-color-scheme: dark) { .knopf { color: #0d1226; } }

.knopf:hover { filter: brightness(1.06); }
.knopf:active { transform: translateY(1px) scale(0.995); }

.knopf.leise {
  background: var(--flaeche);
  color: var(--tinte);
  border: 1px solid var(--linie-stark);
}

.knopf.leise:hover { background: var(--flaeche-2); filter: none; }
.knopf.klein { width: auto; padding: 10px 16px; font-size: 14px; }
.knopf-reihe { display: flex; gap: 8px; flex-wrap: wrap; }

.hinweis { font-size: 13px; color: var(--leise); text-align: center; margin: 12px 0 0; }

/* Meldungen: farbige Fläche plus Randlinie derselben Familie, damit sie auch
   ohne Farbwahrnehmung als eigener Block lesbar bleiben. */
.meldung {
  padding: 13px 15px;
  border-radius: var(--r-feld);
  font-size: 14.5px;
  margin-bottom: 20px;
  border-left: 3px solid;
}

.meldung.warnung { background: var(--warte-weich); color: var(--warte); border-color: var(--warte); }
.meldung.fehler  { background: var(--stopp-weich); color: var(--stopp); border-color: var(--stopp); }
.meldung.gut     { background: var(--gut-weich);   color: var(--gut);   border-color: var(--gut); }

/* ---------------------------------------------------- Fortschritt + Leiste */

/* Zahlen tabellarisch, aber die Wörter in der normalen Schrift: "von" in einer
   Mono-Schrift zu setzen sieht nach Terminal aus, nicht nach Fortschritt. */
.fortschritt-zeile {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--leise);
  margin-bottom: 28px;
  font-variant-numeric: tabular-nums;
}

.fortschritt-spur {
  flex: 1;
  height: 3px;
  border-radius: var(--r-chip);
  background: var(--flaeche-2);
  overflow: hidden;
}

.fortschritt-spur > div {
  height: 100%;
  width: 0;
  background: var(--akzent);
  border-radius: var(--r-chip);
  transition: width 0.3s var(--kurve);
}

/* Bewusst NICHT klebend: Eine fixierte Leiste am unteren Rand hat im Test das
   letzte Feld (Freitext) verdeckt, und da alle Pflichtfragen ohnehin beantwortet
   sein müssen, bringt ein früher erreichbarer Knopf nichts. Die Fortschritts-
   zeile oben übernimmt die Aufgabe "wie weit bin ich". */
.absenden-leiste {
  margin-top: 36px;
  padding-bottom: env(safe-area-inset-bottom);
}

/* ------------------------------------------------------------- Ergebnisse */

.zeile {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--linie);
}

.zeile:last-child { border-bottom: 0; }
.zeile:first-child { padding-top: 0; }
/* Tabellenziffern, aber normale Schrift: In "0 von 2" würde eine Mono-Schrift
   auch das Wort erfassen und die Zeile nach Konsole aussehen lassen. */
.zeile .wert { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; }

.balken { height: 4px; border-radius: var(--r-chip); background: var(--flaeche-2); margin-top: 8px; overflow: hidden; }
.balken > div { height: 100%; border-radius: var(--r-chip); background: var(--akzent); }

.kuerzel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  padding: 5px 9px;
  margin: 0 6px 6px 0;
  border-radius: var(--r-chip);
  font-family: var(--ziffern);
  font-size: 12.5px;
  letter-spacing: 0.03em;
}

.kuerzel.fertig { background: var(--gut-weich); color: var(--gut); }
.kuerzel.offen  { background: var(--warte-weich); color: var(--warte); }

/* Listeneinträge: Zeilen mit Trennlinie statt Kartenstapel. Bei fünf gleichen
   Elementen untereinander sind Karten Rahmen ohne Funktion. */
.liste { border-top: 1px solid var(--linie); margin-bottom: 8px; }

.liste-eintrag {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 17px 4px;
  border-bottom: 1px solid var(--linie);
  text-decoration: none;
  color: var(--tinte);
  transition: padding-left 0.15s var(--kurve), background 0.15s var(--kurve);
}

.liste-eintrag:hover { background: var(--flaeche-2); padding-left: 10px; }
.liste-eintrag .code { font-family: var(--ziffern); font-weight: 600; letter-spacing: 0.02em; }
.liste-eintrag .pfeil { margin-left: auto; color: var(--leise); font-size: 20px; line-height: 1; }
.liste-eintrag .nebentext { color: var(--leise); font-size: 13.5px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 8px 11px 0; border-bottom: 1px solid var(--linie); }
th { color: var(--leise); font-weight: 500; font-size: 12.5px; }
td.mono, code { font-family: var(--ziffern); font-size: 12.5px; }

code {
  background: var(--flaeche-2);
  padding: 2px 6px;
  border-radius: 5px;
  word-break: break-all;
}

audio { width: 100%; margin-bottom: 14px; }

/* Leerzustand: benennt, was fehlt, und was als Nächstes passiert. */
.leerzustand {
  padding: 40px 20px;
  text-align: center;
  border: 1px dashed var(--linie-stark);
  border-radius: var(--r-flaeche);
  color: var(--leise);
}

.leerzustand strong { display: block; color: var(--tinte); font-weight: 600; margin-bottom: 6px; }

.schritte { counter-reset: schritt; }

.schritte li {
  counter-increment: schritt;
  list-style: none;
  display: flex;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--linie);
}

.schritte li:last-child { border-bottom: 0; }

.schritte li::before {
  content: counter(schritt);
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--flaeche-2);
  color: var(--leise);
  font-family: var(--ziffern);
  font-size: 13px;
  display: grid;
  place-items: center;
}

ul.schritte { padding: 0; margin: 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
