/* Akkord-App – Design-Tokens und allgemeines Layout.
   Leitbild: ein ruhiges Notenblatt auf dem Notenständer. Warmes Papier, Tinte, Akkorde rot,
   Abschnitte blau (wie im PDF). Große Bedienelemente (≥ 44 px), keine Effekte, die ablenken.
   live.css (Live-Ansicht) benutzt nur die Variablen unter :root. */

/* ------------------------------------------------------------------ Tokens */

:root {
  color-scheme: light dark;

  /* Pflicht-Tokens (siehe docs/web-app-spezifikation.md) */
  --hintergrund: #F5F1E8;   /* warmes Papier */
  --flaeche: #FFFDF8;       /* Karten, Leisten */
  --flaeche-2: #ECE6D9;     /* Felder, Umschalter, Hover */
  --text: #1E1A15;          /* Tinte */
  --text-leise: #675F54;
  --rand: #DCD3C3;
  --akkord: #B3361B;        /* Akkordfarbe wie im PDF */
  --abschnitt: #2F4F6F;     /* Abschnittsfarbe wie im PDF */
  --gut: #2E7A4A;
  --warnung: #9A600B;
  --fehler: #B42318;
  --radius: 10px;
  --schatten: 0 1px 2px rgba(44, 32, 18, 0.06), 0 4px 14px rgba(44, 32, 18, 0.07);
  --schrift: system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Schriftfamilie für Akkordnamen – immer fett verwenden (font-weight: var(--gewicht-akkord)) */
  --schrift-akkord: system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Ergänzungen */
  --gewicht-akkord: 700;
  --schrift-titel: "Iowan Old Style", "Palatino", "Palatino Linotype", "Book Antiqua", Charter, Georgia, serif;
  --rand-stark: #C4B9A5;
  --auf-akzent: #FFFFFF;    /* Schrift auf --akkord */
  --haupt: #2F4F6F;         /* Hauptknöpfe: ruhiges Blau, Rot bleibt den Akkorden */
  --auf-haupt: #FFFFFF;
  --auf-fehler: #FFFFFF;    /* Schrift auf --fehler (Löschen-Knopf) */
  --markierung: rgba(179, 54, 27, 0.10); /* aktuelle Zeile beim Mitspielen */
  --fokus: #2F6FB0;
  --schatten-hoch: 0 2px 6px rgba(44, 32, 18, 0.08), 0 14px 40px rgba(44, 32, 18, 0.16);
  --inhalt-breite: 1100px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --hintergrund: #171513;
    --flaeche: #211E1B;
    --flaeche-2: #2D2925;
    --text: #EFE9DF;
    --text-leise: #ADA495;
    --rand: #3B3530;
    --akkord: #F08A6C;      /* heller Rotton */
    --abschnitt: #8FB6DC;   /* heller Blauton */
    --gut: #6CCB93;
    --warnung: #E5B454;
    --fehler: #F2837A;
    --schatten: 0 1px 2px rgba(0, 0, 0, 0.35), 0 6px 18px rgba(0, 0, 0, 0.3);

    --rand-stark: #564E46;
    --auf-akzent: #1B1411;
    --haupt: #8FB6DC;
    --auf-haupt: #10161C;
    --auf-fehler: #1B1411;
    --markierung: rgba(240, 138, 108, 0.14);
    --fokus: #8FB6DC;
    --schatten-hoch: 0 2px 6px rgba(0, 0, 0, 0.4), 0 16px 44px rgba(0, 0, 0, 0.5);
  }
}

/* ------------------------------------------------------------------ Grundlagen */

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 106.25%; /* 17 px: etwas größer, man liest aus Armlänge */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--hintergrund);
  color: var(--text);
  font-family: var(--schrift);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-family: var(--schrift-titel); font-weight: 600; font-size: clamp(1.8rem, 1.3rem + 1.8vw, 2.4rem); letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; }
p { margin: 0 0 0.8em; }
a { color: var(--abschnitt); }
img, svg { max-width: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled, .knopf[aria-disabled="true"] { cursor: not-allowed; opacity: 0.45; }

:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; border-radius: 6px; }
main:focus { outline: none; }

.leise { color: var(--text-leise); }
.fehler-text { color: var(--fehler); }
.gefahr-text { color: var(--fehler) !important; }
.unterstrichen { text-decoration: underline; text-underline-offset: 3px; }
.unsichtbar {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; padding: 0; margin: -1px;
}

.springen {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--haupt); color: var(--auf-haupt); padding: 10px 16px; border-radius: 8px;
  text-decoration: none; font-weight: 600;
}
.springen:focus { top: 12px; }

.symbol { display: inline-flex; flex: none; }
.symbol svg { width: 1.2em; height: 1.2em; display: block; }

/* ------------------------------------------------------------------ Kopfzeile */

.kopfzeile {
  background: var(--hintergrund);
  border-bottom: 1px solid var(--rand);
}
.kopfzeile-innen {
  max-width: var(--inhalt-breite);
  margin: 0 auto;
  padding: 10px 16px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  display: flex; align-items: center; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap;
}
.marke {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px;
  color: var(--text); text-decoration: none;
  font-family: var(--schrift-titel); font-size: 1.3rem; font-weight: 600; letter-spacing: -0.01em;
}
.marke-zeichen { width: 32px; height: 32px; flex: none; }

.navigation {
  display: flex; gap: 4px; padding: 4px;
  background: var(--flaeche-2); border-radius: 12px;
}
.navigation a {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 0 16px; border-radius: 9px;
  color: var(--text-leise); font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}
.navigation a:hover { color: var(--text); }
.navigation a[aria-current="page"] {
  background: var(--flaeche); color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1), 0 0 0 1px var(--rand);
}
.live-punkt {
  width: 8px; height: 8px; border-radius: 50%; margin-right: 8px;
  background: var(--akkord); box-shadow: 0 0 0 3px var(--markierung);
}

@media (max-width: 560px) {
  .navigation { width: 100%; }
  .navigation a { flex: 1; padding: 0 8px; }
}

/* ------------------------------------------------------------------ Inhalt */

main#inhalt {
  display: block;
  max-width: var(--inhalt-breite);
  margin: 0 auto;
  padding: 0 16px 64px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
}
body.mit-spieler main#inhalt { padding-bottom: 150px; }
@media (max-width: 700px) { body.mit-spieler main#inhalt { padding-bottom: 190px; } }

.seitenkopf {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap;
  margin: 28px 0 22px;
}
.seitenkopf h1 { margin: 0; }
.seitenkopf p { margin: 6px 0 0; }

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

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border: 1px solid var(--rand); border-radius: var(--radius);
  background: var(--flaeche); color: var(--text);
  font-weight: 600; font-size: 0.95rem; line-height: 1.2; text-decoration: none; white-space: nowrap;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  transition: background-color 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}
.knopf:hover { border-color: var(--rand-stark); background: color-mix(in srgb, var(--flaeche-2) 45%, var(--flaeche)); }
.knopf:active { transform: translateY(1px); }
.knopf.haupt { background: var(--haupt); color: var(--auf-haupt); border-color: transparent; }
.knopf.haupt:hover { background: color-mix(in srgb, var(--haupt) 88%, var(--text)); }
.knopf.leise { background: transparent; border-color: transparent; color: var(--text-leise); }
.knopf.leise:hover { background: var(--flaeche-2); color: var(--text); }
.knopf.gross { min-height: 54px; padding: 0 26px; font-size: 1.05rem; border-radius: 12px; }
.knopf.klein { min-height: 36px; padding: 0 12px; font-size: 0.88rem; }
.knopf.gefahr { background: var(--fehler); color: var(--auf-fehler); border-color: transparent; }
.knopf.gefahr-leise { color: var(--fehler); }
.knopf .symbol svg { width: 1.15em; height: 1.15em; }
.knopf-reihe { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.knopf-symbol {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--text-leise);
}
.knopf-symbol:hover { background: var(--flaeche-2); color: var(--text); }

.knopf-quadrat {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 0; border-radius: 9px;
  background: transparent; color: var(--text); font-weight: 700;
}
.knopf-quadrat:hover:not(:disabled) { background: var(--flaeche); }
.knopf-quadrat.klein-a { font-size: 0.85rem; }
.knopf-quadrat.gross-a { font-size: 1.25rem; }

.knopf-text {
  border: 0; background: none; color: var(--abschnitt); font-weight: 600;
  min-height: 44px; padding: 0 6px; text-decoration: underline; text-underline-offset: 3px;
}

.knopf-rund {
  display: inline-flex; align-items: center; justify-content: center;
  width: 60px; height: 60px; border-radius: 50%; border: 0; flex: none;
  background: var(--akkord); color: var(--auf-akzent);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--akkord) 35%, transparent);
  transition: transform 0.12s;
}
.knopf-rund:active { transform: scale(0.96); }
.knopf-rund .symbol svg { width: 28px; height: 28px; }

/* ------------------------------------------------------------------ Formularteile */

.eingabe, .auswahl {
  width: 100%; min-height: 46px; padding: 10px 12px;
  border: 1px solid var(--rand-stark); border-radius: var(--radius);
  background: var(--flaeche); color: var(--text); font-size: 1rem;
}
.eingabe::placeholder { color: var(--text-leise); opacity: 0.8; }
.eingabe:focus, .auswahl:focus { border-color: var(--fokus); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--fokus) 30%, transparent); }
.songtext { min-height: 13em; line-height: 1.55; resize: vertical; }
.auswahl {
  width: auto; min-width: 11em; padding-right: 38px; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238A8176' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px;
}

.feld { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.feld-name { font-weight: 650; font-size: 0.97rem; }
.feld-hinweis { font-size: 0.88rem; color: var(--text-leise); margin: 2px 0 0; line-height: 1.45; }
.feld-raster { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 0 22px; }

/* Umschalter (Segmente) – als Knöpfe mit aria-pressed oder als Radio-Labels */
.segmente {
  display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px;
  background: var(--flaeche-2); border-radius: 11px; align-self: flex-start;
}
.segment, .segment-radio {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 38px; min-width: 44px; padding: 0 14px;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--text-leise); font-weight: 650; cursor: pointer; white-space: nowrap;
  transition: background-color 0.15s, color 0.15s;
}
.segment:hover, .segment-radio:hover { color: var(--text); }
.segment[aria-pressed="true"], .segment-radio:has(input:checked) {
  background: var(--flaeche); color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12), 0 0 0 1px var(--rand);
}
.segment-radio input { position: absolute; opacity: 0; pointer-events: none; }
.segment-radio:has(input:focus-visible) { outline: 3px solid var(--fokus); outline-offset: 1px; }
.segmente.klein .segment { min-height: 34px; padding: 0 12px; font-size: 0.9rem; }

/* Schalter (Checkbox als Kippschalter) */
.schalter {
  display: inline-flex; align-items: center; gap: 12px; min-height: 44px;
  font-weight: 600; cursor: pointer; margin: 0 0 12px;
}
.schalter input {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0;
  width: 48px; height: 28px; border-radius: 14px; position: relative; cursor: pointer;
  background: var(--rand-stark); transition: background-color 0.2s;
}
.schalter input::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s;
}
.schalter input:checked { background: var(--gut); }
.schalter input:checked::before { transform: translateX(20px); }
.schalter input:disabled { opacity: 0.5; }
.schalter input:disabled + span { color: var(--text-leise); }

/* Fortschrittsbalken */
.fortschritt {
  display: block; position: relative; height: 10px; overflow: hidden;
  background: var(--flaeche-2); border-radius: 5px;
}
.fortschritt.klein { height: 6px; border-radius: 3px; }
.fortschritt .balken {
  display: block; height: 100%; width: 0; border-radius: inherit;
  background: var(--abschnitt); transition: width 0.8s ease;
}
.fortschritt.wartend .balken {
  width: 30% !important; opacity: 0.45;
  animation: wartend 1.6s ease-in-out infinite;
}
@keyframes wartend {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(360%); }
}

/* Ladeanzeige und Fehler */
.ladeanzeige {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 72px 16px; color: var(--text-leise);
}
.lade-punkte { display: inline-flex; gap: 5px; }
.lade-punkte i {
  width: 7px; height: 7px; border-radius: 50%; background: var(--akkord);
  animation: punkt 1.1s ease-in-out infinite;
}
.lade-punkte i:nth-child(2) { animation-delay: 0.15s; }
.lade-punkte i:nth-child(3) { animation-delay: 0.3s; }
@keyframes punkt { 0%, 80%, 100% { opacity: 0.25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-4px); } }

.fehler-kasten {
  max-width: 580px; margin: 48px auto; padding: 22px 24px;
  background: var(--flaeche); border: 1px solid var(--rand); border-left: 5px solid var(--fehler);
  border-radius: 12px; box-shadow: var(--schatten);
}
.fehler-kasten h2 { font-family: var(--schrift-titel); font-weight: 600; font-size: 1.4rem; }
.fehler-kasten .knopf-reihe { margin-top: 16px; }

/* ------------------------------------------------------------------ Meldungen (Toasts) */

/* unten, damit Kopfzeile und Titel frei bleiben; beim Mitspielen über der Leiste */
.meldungen {
  position: fixed; z-index: 100; bottom: max(16px, env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%); width: min(520px, calc(100% - 24px));
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.meldung {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 6px 10px 16px;
  background: var(--flaeche); color: var(--text);
  border: 1px solid var(--rand); border-left: 5px solid var(--abschnitt); border-radius: 12px;
  box-shadow: var(--schatten-hoch);
  animation: meldung-rein 0.22s ease-out;
  transition: opacity 0.2s, transform 0.2s;
}
.meldung.gut { border-left-color: var(--gut); }
.meldung.warnung { border-left-color: var(--warnung); }
.meldung.fehler { border-left-color: var(--fehler); }
.meldung.geht { opacity: 0; transform: translateY(6px); }
body.mit-spieler .meldungen { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 112px); }
@media (max-width: 700px) { body.mit-spieler .meldungen { bottom: calc(max(12px, env(safe-area-inset-bottom)) + 150px); } }
.meldung-text { flex: 1; padding: 8px 0; line-height: 1.4; }
.meldung-zu {
  flex: none; width: 40px; height: 40px; border: 0; border-radius: 8px;
  background: none; color: var(--text-leise); font-size: 1.5rem; line-height: 1;
}
.meldung-zu:hover { background: var(--flaeche-2); color: var(--text); }
@keyframes meldung-rein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ Dialoge */

dialog.dialog {
  border: 0; padding: 0; border-radius: 16px;
  width: min(470px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  background: var(--flaeche); color: var(--text); box-shadow: var(--schatten-hoch);
}
dialog.dialog-breit { width: min(700px, calc(100vw - 32px)); }
dialog.dialog::backdrop { background: rgba(22, 17, 12, 0.5); }
.dialog form { display: flex; flex-direction: column; gap: 10px; padding: 22px 24px 20px; }
.dialog-titel { font-family: var(--schrift-titel); font-weight: 600; font-size: 1.55rem; margin: 0 0 4px; }
.dialog-inhalt { display: flex; flex-direction: column; gap: 8px; }
.dialog-inhalt .feld { margin-bottom: 8px; }
.dialog-knoepfe { justify-content: flex-end; margin-top: 10px; }
.dialog .feld-raster { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.dialog .auswahl { width: 100%; }

/* ------------------------------------------------------------------ Bibliothek */

.suche-zeile { margin: -8px 0 18px; max-width: 420px; }

.karten-raster {
  list-style: none; margin: 0; padding: 0;
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 310px), 1fr));
}
.lied-karte {
  display: grid; grid-template-columns: 64px 1fr; gap: 16px; align-items: start;
  height: 100%; padding: 16px 18px 16px 16px;
  background: var(--flaeche); color: var(--text); text-decoration: none;
  border: 1px solid var(--rand); border-radius: 14px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.lied-karte:hover { border-color: var(--rand-stark); box-shadow: var(--schatten); transform: translateY(-1px); }
.lied-karte.ist-fehler { border-color: color-mix(in srgb, var(--fehler) 40%, var(--rand)); }

.karte-zeichen {
  width: 64px; height: 64px; border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--flaeche-2); color: var(--akkord);
}
.karte-zeichen b { font-family: var(--schrift-titel); font-weight: 600; font-size: 1.95rem; line-height: 1; }
.karte-zeichen small {
  margin-top: 4px; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--text-leise);
}
.karte-zeichen.ist-leer { color: var(--abschnitt); }
.karte-zeichen.ist-fehler { color: var(--fehler); }
.lied-karte.laeuft .karte-zeichen b { animation: atmen 2.4s ease-in-out infinite; }
@keyframes atmen { 50% { opacity: 0.35; } }

.karte-text { display: flex; flex-direction: column; min-width: 0; }
.karte-titel {
  font-family: var(--schrift-titel); font-weight: 600; font-size: 1.22rem; line-height: 1.25;
  overflow-wrap: anywhere;
}
.karte-info { margin-top: 4px; font-size: 0.92rem; color: var(--text-leise); }
.karte-status { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; font-size: 0.88rem; }
.karte-schritt { color: var(--text); }
.karte-datum { margin-top: 8px; font-size: 0.8rem; color: var(--text-leise); }

/* Leere Bibliothek */
.leer-zustand { max-width: 860px; margin: 40px auto 24px; text-align: center; }
.leer-zustand h1 { font-size: clamp(2rem, 1.5rem + 2vw, 2.8rem); }
.leer-zustand .einleitung { font-size: 1.1rem; color: var(--text-leise); max-width: 34em; margin: 0 auto 30px; }
.schritte {
  list-style: none; margin: 0 0 32px; padding: 0; text-align: left;
  display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.schritt {
  display: flex; gap: 14px; padding: 18px;
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 14px;
}
.schritt-nr {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--schrift-titel); font-weight: 600; font-size: 1.15rem;
  background: var(--akkord); color: var(--auf-akzent);
}
.schritt h3 { font-size: 1.05rem; margin: 6px 0 4px; }
.schritt p { margin: 0; color: var(--text-leise); font-size: 0.93rem; line-height: 1.45; }
.leer-zustand .knopf-reihe { justify-content: center; }

/* ------------------------------------------------------------------ Hochladen */

.neu-seite { max-width: 760px; margin: 0 auto; }
.hochladen.gesperrt .feld, .hochladen.gesperrt .schalter, .hochladen.gesperrt .weitere { opacity: 0.6; }
/* während des Hochladens gibt es nichts abzubrechen – das Hochladen läuft auch beim Seitenwechsel weiter */
.hochladen.gesperrt .absenden-zeile .knopf.leise { display: none; }

.ablage {
  display: flex; align-items: center; justify-content: center; min-height: 170px;
  padding: 24px; text-align: center; cursor: pointer;
  background: var(--flaeche); border: 2px dashed var(--rand-stark); border-radius: 16px;
  transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
}
.ablage:hover, .ablage.ziehen { border-color: var(--abschnitt); background: color-mix(in srgb, var(--abschnitt) 6%, var(--flaeche)); }
.ablage.ziehen { transform: scale(1.01); border-style: solid; }
.ablage.hinweis { border-color: var(--fehler); animation: stupsen 0.4s ease; }
.ablage[aria-disabled="true"] { cursor: default; }
@keyframes stupsen { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.ablage-text { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.ablage-symbol {
  display: flex; align-items: center; justify-content: center; width: 52px; height: 52px; margin-bottom: 4px;
  border-radius: 50%; background: var(--flaeche-2); color: var(--abschnitt);
}
.ablage-symbol .symbol svg { width: 26px; height: 26px; }
.ablage-symbol.ok { background: var(--akkord); color: var(--auf-akzent); }
.ablage-titel { font-size: 1.15rem; }
.ablage.hat-datei { min-height: 96px; border-style: solid; border-color: var(--rand); justify-content: flex-start; text-align: left; }
.ablage.hat-datei .ablage-text { flex-direction: row; gap: 14px; width: 100%; }
.ablage.hat-datei .ablage-symbol { margin: 0; flex: none; }
.ablage-datei { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.ablage-datei strong { overflow-wrap: anywhere; }

.weitere {
  margin: 6px 0 22px; background: var(--flaeche);
  border: 1px solid var(--rand); border-radius: 12px;
}
.weitere > summary {
  display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 0 16px;
  font-weight: 650; cursor: pointer; list-style: none;
}
.weitere > summary::-webkit-details-marker { display: none; }
.weitere > summary::before, .griffe-titel::before {
  content: ""; width: 8px; height: 8px; flex: none;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform 0.15s; margin-right: 2px;
}
.weitere[open] > summary::before, .griff-uebersicht[open] .griffe-titel::before { transform: rotate(45deg); }
.weitere-inhalt { padding: 6px 16px 4px; border-top: 1px solid var(--rand); padding-top: 16px; }

.wahl-karten { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.wahl-karte {
  position: relative; display: flex; flex-direction: column; gap: 2px; min-height: 64px;
  padding: 12px 14px; cursor: pointer;
  border: 1.5px solid var(--rand); border-radius: 12px; background: var(--flaeche);
}
.wahl-karte input { position: absolute; opacity: 0; pointer-events: none; }
.wahl-karte:has(input:checked) { border-color: var(--haupt); background: color-mix(in srgb, var(--haupt) 8%, var(--flaeche)); }
.wahl-karte:has(input:focus-visible) { outline: 3px solid var(--fokus); outline-offset: 2px; }
.wahl-titel { font-weight: 700; text-transform: capitalize; }
.wahl-text { font-size: 0.85rem; color: var(--text-leise); line-height: 1.35; }

.form-fehler { color: var(--fehler); font-weight: 600; margin: 0 0 12px; }
.absenden-zeile { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.absenden { position: relative; overflow: hidden; min-width: 240px; }
.knopf-balken {
  position: absolute; inset: 0; background: rgba(255, 255, 255, 0.24);
  transform: scaleX(0); transform-origin: left; transition: transform 0.25s ease; pointer-events: none;
}
.absenden:not(.laedt) .knopf-balken { display: none; }
.knopf-text-inhalt { position: relative; }
.absenden.laedt:disabled { opacity: 1; cursor: progress; }

/* ------------------------------------------------------------------ Lied: Status (Analyse läuft) */

.lied-status { max-width: 680px; margin: 0 auto; }
.lied-status .seitenkopf { margin: 18px 0 8px; }
.status-karte {
  padding: 26px 26px 18px; background: var(--flaeche);
  border: 1px solid var(--rand); border-radius: 16px; box-shadow: var(--schatten);
}
.status-karte.ist-fehler { border-left: 5px solid var(--fehler); }
.status-karte .lied-titel { margin-bottom: 14px; }
.status-zeile { font-weight: 650; font-size: 1.1rem; }
.status-karte .fortschritt { margin: 14px 0 10px; }
.schritt-text { font-size: 1rem; min-height: 1.5em; }
.status-karte .knopf-reihe { margin: 18px 0 8px; }

/* ------------------------------------------------------------------ Lied: Kopf und Werkzeuge */

.lied-seite { max-width: 980px; margin: 0 auto; }
.zurueck { margin: 14px 0 0 -12px; padding-left: 8px; }
.lied-kopf { padding: 0 0 18px; }
.titel-zeile { display: flex; align-items: flex-start; gap: 4px; margin: 6px 0 2px; }
.titel-zeile .knopf-symbol { flex: none; margin-top: 2px; }
.lied-titel {
  min-width: 0; margin: 0; font-family: var(--schrift-titel); font-weight: 600;
  font-size: clamp(1.9rem, 1.3rem + 2.2vw, 2.7rem); line-height: 1.1; letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}
.titel-form { display: flex; flex-wrap: wrap; gap: 8px; width: 100%; }
.titel-eingabe { flex: 1 1 260px; font-family: var(--schrift-titel); font-size: 1.5rem; }
.lied-info {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px;
  margin: 8px 0 16px; color: var(--text-leise);
}
.lied-info strong { color: var(--text); font-weight: 650; }
.trenner { color: var(--rand-stark); }
.lied-aktionen { display: flex; flex-wrap: wrap; gap: 8px; }

.menue { position: relative; }
.menue > summary { list-style: none; }
.menue > summary::-webkit-details-marker { display: none; }
.menue-liste {
  position: absolute; z-index: 25; right: 0; top: calc(100% + 6px); min-width: 250px;
  display: flex; flex-direction: column; padding: 6px;
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 12px; box-shadow: var(--schatten-hoch);
}
.menue-punkt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 46px; padding: 0 12px;
  border: 0; border-radius: 8px; background: none; color: var(--text);
  font-weight: 550; text-align: left; text-decoration: none;
}
.menue-punkt:hover { background: var(--flaeche-2); }
@media (max-width: 640px) {
  .menue-liste { position: fixed; left: 12px; right: 12px; top: auto; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 60; }
}

.hinweis-liste {
  margin: 0 0 16px; padding: 12px 16px 12px 34px; font-size: 0.93rem;
  background: color-mix(in srgb, var(--warnung) 10%, var(--flaeche));
  border: 1px solid color-mix(in srgb, var(--warnung) 35%, var(--rand)); border-radius: 12px;
}

/* Neu-Analyse über dem Blatt: läuft (Fortschritt) oder gescheitert – das bisherige Blatt gilt weiter */
.analyse-hinweis {
  margin: 0 0 16px; padding: 12px 16px;
  background: color-mix(in srgb, var(--abschnitt) 10%, var(--flaeche));
  border-left: 5px solid var(--abschnitt); border-radius: 10px;
}
.analyse-hinweis.ist-fehler {
  background: color-mix(in srgb, var(--fehler) 8%, var(--flaeche));
  border-left-color: var(--fehler);
}
.analyse-hinweis p { margin: 0 0 4px; }
.analyse-hinweis .fortschritt { margin: 10px 0 6px; }
.analyse-hinweis .knopf-reihe { margin-top: 10px; }

.werkzeugleiste {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 26px;
  padding: 14px 18px; margin-bottom: 16px;
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 14px;
}
.werkzeug { display: flex; flex-direction: column; gap: 6px; }
.werkzeug-name {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--text-leise);
}
.werkzeug:has(.knopf-text) { display: grid; grid-template-columns: auto auto; column-gap: 4px; align-items: center; }
.werkzeug:has(.knopf-text) .werkzeug-name { grid-column: 1 / -1; }
.stepper {
  display: inline-flex; align-items: center; gap: 2px; padding: 3px;
  background: var(--flaeche-2); border-radius: 11px;
}
.stepper .knopf-quadrat { width: 40px; height: 38px; }
.stepper-wert {
  display: inline-flex; align-items: baseline; justify-content: center; gap: 8px;
  min-width: 8.5em; padding: 0 6px; font-variant-numeric: tabular-nums;
}
.stepper-zahl { font-weight: 800; }
.stepper-text { color: var(--text-leise); font-weight: 600; }

.kapo-hinweis {
  margin: 0 0 16px; padding: 12px 16px;
  background: color-mix(in srgb, var(--abschnitt) 10%, var(--flaeche));
  border-left: 5px solid var(--abschnitt); border-radius: 10px;
}
.kapo-hinweis strong { color: var(--abschnitt); }

/* Griff-Übersicht */
.griff-uebersicht {
  margin: 0 0 20px; padding: 0 18px;
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: 14px;
}
.griffe-kopf {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  min-height: 56px; cursor: pointer; list-style: none;
}
.griffe-kopf::-webkit-details-marker { display: none; }
.griffe-titel { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; }
.griffe-titel .leise { font-weight: 500; }
.griffe-liste {
  display: flex; flex-wrap: wrap; gap: 6px 10px; padding: 4px 0 16px;
  border-top: 1px solid var(--rand); padding-top: 14px;
}
.griff { margin: 0; width: 108px; display: flex; flex-direction: column; align-items: center; }
.griffe-liste.klavier .griff { width: 190px; }
.griff-knopf {
  display: flex; flex-direction: column; align-items: center; width: 100%;
  padding: 4px 4px 2px; border: 0; border-radius: 10px; background: none; color: inherit;
}
.griff-knopf:hover { background: var(--flaeche-2); }
.griff-name {
  font-family: var(--schrift-akkord); font-weight: var(--gewicht-akkord); font-size: 1.2rem;
  color: var(--akkord); line-height: 1.3;
}
.griff-bild { width: 100%; color: var(--text); }
.griff-bild svg { display: block; width: 100%; height: auto; }
.griff-bild.leer { display: none; }
.griff-variante { font-size: 0.72rem; color: var(--text-leise); font-variant-numeric: tabular-nums; }
.griffe-fehlen { width: 100%; margin: 4px 0 0; font-size: 0.9rem; }

/* Klaviatur (griffe.js) im dunklen Schema: sie zeichnet mit currentColor, hell auf dunkel wären die
   schwarzen Tasten die hellsten. Hier: weiße Tasten als dunkle Fläche, schwarze Tasten noch dunkler
   mit feinem Rand – wie ein Klavier bei gedimmtem Licht; die Punkte bleiben hell bzw. in Akkordfarbe.
   (Gilt auch für die Live-Ansicht.) CSS schlägt die fill-Attribute des SVG. */
@media (prefers-color-scheme: dark) {
  .klavier-weiss { fill: var(--flaeche-2); fill-opacity: 1; stroke-opacity: 0.35; }
  .klavier-weiss.klavier-markiert { fill: color-mix(in srgb, var(--akkord) 20%, var(--flaeche-2)); }
  .klavier-weiss.klavier-grundton { fill: color-mix(in srgb, var(--akkord) 32%, var(--flaeche-2)); }
  .klavier-schwarz { fill: var(--hintergrund); fill-opacity: 1; stroke: currentColor; stroke-opacity: 0.45; stroke-width: 1; }
}
@media (max-width: 480px) {
  .griff-uebersicht { padding: 0 12px; }
  .griffe-liste { gap: 6px 4px; }
  .griff { width: 96px; }
  .griffe-liste.klavier .griff { width: 100%; max-width: 240px; }
}

/* ------------------------------------------------------------------ Das Blatt */

.blatt {
  --zeilen-einzug: 10px; /* fest, damit große Schrift am Handy nicht über den Rand ragt */
  font-size: calc(1.3rem * var(--blatt-faktor, 1));
  line-height: 1.3;
  padding: 6px 0 4px;
}
.druck-kopf { display: none; }
.abschnitt { margin: 0 0 0.9em; }

.ueberschrift {
  display: flex; align-items: center; gap: 0.7em;
  margin: 1.3em 0 0.45em; font-family: var(--schrift);
  font-size: 0.7em; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--abschnitt);
}
.ueberschrift::after { content: ""; flex: 1; height: 1px; background: var(--rand); }
.abschnitt:first-of-type .ueberschrift { margin-top: 0.4em; }

.zeile, .instrumental {
  margin: 0 calc(-1 * var(--zeilen-einzug));
  padding: 0.08em var(--zeilen-einzug) 0.14em;
  border-radius: 0.35em;
  transition: background-color 0.25s ease, box-shadow 0.25s ease;
}
.zeile { display: flex; flex-wrap: wrap; align-items: flex-end; }
.zeile + .zeile { margin-top: 0.12em; }
.wort { display: inline-flex; align-items: flex-end; }
.seg { display: inline-flex; flex-direction: column; }
.akk {
  min-height: 1.25em; padding-right: 0.5em; white-space: nowrap;
  font-family: var(--schrift-akkord); font-weight: var(--gewicht-akkord);
  font-size: 0.92em; line-height: 1.3; color: var(--akkord);
}
.akk b { font-weight: inherit; border-radius: 0.2em; transition: background-color 0.15s, color 0.15s, box-shadow 0.15s; }
/* Leere Akkordplätze nehmen keine Höhe ein: Die Wörter stehen unten bündig (align-items: flex-end),
   so bekommt eine umbrochene Zeile ohne Akkord keine leere Akkordzeile darüber. */
.akk.leer { min-height: 0; }
.txt { white-space: pre; }
/* Akkord mitten im Wort und breiter als die Silbe: Lücke mit feinem Strich überbrücken */
.seg.weiter .txt { display: flex; }
.seg.weiter .txt::after {
  content: ""; flex: 1 1 auto; min-width: 0; align-self: center;
  border-bottom: 0.08em solid currentColor; opacity: 0.3; margin-top: 0.15em;
}

.instrumental {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2em 0.8em;
  margin-top: 0.4em; margin-bottom: 0.4em;
}
.instrumental-titel {
  font-size: 0.7em; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--abschnitt);
}
.takte { display: flex; flex-wrap: wrap; row-gap: 0.2em; }
.takte .akk { padding-right: 0; min-height: 0; }
.takte .akk + .akk::before {
  content: "|"; padding: 0 0.5em; color: var(--rand-stark); font-weight: 400;
}

/* Mitspielen: aktuelle Zeile und aktueller Akkord */
@media (hover: hover) {
  .springbar { cursor: pointer; }
  .springbar:hover { background: color-mix(in srgb, var(--flaeche-2) 55%, transparent); }
}
/* erst markieren, wenn mitgespielt wird (vorher lenkt es beim Lesen nur ab) */
.mitspielen-aktiv .zeile.aktuell, .mitspielen-aktiv .instrumental.aktuell, .mitspielen-aktiv .springbar.aktuell:hover {
  background: var(--markierung);
  box-shadow: inset 0.22em 0 0 var(--akkord);
}
.mitspielen-aktiv .akk.aktuell b {
  background: var(--akkord); color: var(--auf-akzent);
  box-shadow: 0 0 0 0.14em var(--akkord);
}

.hinweis-automatisch { margin: 28px 0 8px; font-size: 0.85rem; color: var(--text-leise); }

/* ------------------------------------------------------------------ Mitspielen (Leiste unten) */

.spieler {
  position: fixed; z-index: 30;
  left: 50%; transform: translateX(-50%);
  bottom: max(12px, env(safe-area-inset-bottom));
  width: min(1060px, calc(100% - 24px));
  display: grid; align-items: center; gap: 6px 20px;
  grid-template-columns: minmax(10.5em, auto) auto minmax(0, 1fr) auto;
  grid-template-areas: "akkorde spielen leiste tempo" "status status status status";
  padding: 10px 18px 10px 20px;
  background: var(--flaeche);
  background: color-mix(in srgb, var(--flaeche) 93%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid var(--rand); border-radius: 18px;
  box-shadow: var(--schatten-hoch);
}
.spieler-akkorde { grid-area: akkorde; display: flex; align-items: stretch; gap: 18px; }
.spieler .spielen { grid-area: spielen; }
.spieler-leiste { grid-area: leiste; display: flex; align-items: center; gap: 10px; min-width: 0; }
.spieler .tempo { grid-area: tempo; }
.spieler-status { grid-area: status; font-size: 0.85rem; color: var(--warnung); }
.spieler-status:empty { display: none; }

.jetzt-block, .gleich-block { display: flex; flex-direction: column; justify-content: space-between; }
.etikett {
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-leise);
}
.akkord-jetzt {
  min-width: 2.3em; font-family: var(--schrift-akkord); font-weight: 800;
  font-size: 2.7rem; line-height: 1.05; color: var(--akkord); letter-spacing: -0.02em;
}
.akkord-gleich {
  min-width: 2.2em; min-height: 1.2em; font-family: var(--schrift-akkord); font-weight: var(--gewicht-akkord);
  font-size: 1.55rem; line-height: 1.2; color: var(--text-leise);
}
.countdown { display: block; height: 3px; margin-top: 3px; border-radius: 2px; overflow: hidden; background: var(--rand); }
.countdown i { display: block; height: 100%; background: var(--text-leise); transform-origin: left; transform: scaleX(0); }
.akkord-gleich:empty + .countdown { visibility: hidden; }

.zeit { flex: none; min-width: 2.8em; font-size: 0.9rem; color: var(--text-leise); font-variant-numeric: tabular-nums; text-align: center; }
.position { flex: 1; min-width: 60px; height: 44px; margin: 0; accent-color: var(--akkord); cursor: pointer; }
.tempo { display: flex; align-items: center; gap: 2px; padding: 3px; background: var(--flaeche-2); border-radius: 11px; }
.tempo .etikett { padding: 0 6px 0 8px; }
.tempo .knopf-quadrat { width: 40px; height: 38px; }
.tempo-wert { min-width: 3.4em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 700px) {
  .spieler {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "akkorde spielen" "leiste tempo" "status status";
    gap: 4px 10px; padding: 8px 12px 8px 16px; border-radius: 16px;
  }
  .akkord-jetzt { font-size: 2.3rem; }
  .akkord-gleich { font-size: 1.35rem; }
  .spieler-leiste { gap: 4px; }
  .spieler-leiste .zeit:last-child { display: none; }
  .tempo .etikett { display: none; }
  .tempo .knopf-quadrat { width: 36px; }
  .tempo-wert { min-width: 2.9em; font-size: 0.9rem; }
}

/* ------------------------------------------------------------------ Bewegung reduzieren */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
}

/* ------------------------------------------------------------------ Drucken: nur das Blatt, zweispaltig */

@media print {
  :root {
    --hintergrund: #fff; --flaeche: #fff; --flaeche-2: #fff; --text: #1a1a1a; --text-leise: #6b6b6b;
    --rand: #cfcfcf; --rand-stark: #bbb; --akkord: #B3361B; --abschnitt: #2F4F6F; --markierung: transparent;
  }
  @page { size: A4; margin: 14mm 14mm 15mm; }
  html { font-size: 100%; }
  body { background: #fff; color: #1a1a1a; }
  .kopfzeile, .meldungen, .springen, .spieler, .lied-kopf, .werkzeugleiste, .griff-uebersicht,
  .hinweis-liste, .analyse-hinweis, .kapo-hinweis, dialog, .lied-status, .zurueck { display: none !important; }
  main#inhalt, body.mit-spieler main#inhalt { max-width: none; padding: 0; margin: 0; }
  .lied-seite { max-width: none; }

  .blatt {
    font-size: 10.5pt !important; line-height: 1.25;
    columns: 2; column-gap: 10mm; padding: 0;
  }
  .druck-kopf { display: block; column-span: all; margin-bottom: 5mm; padding-bottom: 2mm; border-bottom: 0.6pt solid #cfcfcf; }
  .druck-kopf h1 { font-family: var(--schrift); font-weight: 700; font-size: 20pt; margin: 0 0 1.5mm; }
  .druck-kopf p { font-size: 8.5pt; color: #6b6b6b; margin: 0; }
  .abschnitt { break-inside: avoid; page-break-inside: avoid; }
  .ueberschrift { break-after: avoid; }
  .zeile, .instrumental { break-inside: avoid; }
  .zeile, .instrumental, .springbar:hover { background: none !important; box-shadow: none !important; }
  .akk b, .akk.aktuell b { background: none !important; color: #B3361B !important; box-shadow: none !important; }
  .seg.weiter .txt::after { opacity: 0.4; }
  .hinweis-automatisch { font-size: 7.5pt; color: #6b6b6b; margin-top: 6mm; }
}
