/* Stimmbildung — Oberfläche. Ein Akzent (Blau) für Handlung, Grün/Rot/Orange nur für Status.
   Farben als Rollen (Variablen), Hell/Dunkel folgt dem System (kein eigener Schalter). */
:root {
  color-scheme: light dark;
  --grund: #f2f2f7;          /* Seitenhintergrund */
  --flaeche: #ffffff;        /* Karten */
  --flaeche-2: #f2f2f7;      /* eingelassene Felder, Auswahl */
  --text: #1c1c1e;
  --text-2: #595960;         /* 6,9:1 auf Weiß */
  --linie: #d8d8de;
  --akzent: #0a60e0;         /* 5,6:1 auf Weiß, Weiß darauf 5,6:1 */
  --akzent-schwach: #e6efff;
  --gut: #1b7a3a;
  --schlecht: #b3261e;
  --warn: #8a5a00;
  --warn-grund: #fff6dc;
  --radius: 14px;
  --schatten: 0 1px 2px rgba(0, 0, 0, .06), 0 2px 8px rgba(0, 0, 0, .04);
}
@media (prefers-color-scheme: dark) {
  :root {
    --grund: #000000;
    --flaeche: #1c1c1e;
    --flaeche-2: #2c2c2e;
    --text: #f2f2f7;
    --text-2: #a1a1a8;
    --linie: #3a3a3c;
    --akzent: #3d8bff;
    --akzent-schwach: #12294d;
    --gut: #4cd27a;
    --schlecht: #ff6b62;
    --warn: #f2b84b;
    --warn-grund: #2e2410;
    --schatten: none;
  }
  button.gross, .ms-schlag.an { color: #000; }
}

* { box-sizing: border-box; }
body { margin: 0; font: 17px/1.5 -apple-system, BlinkMacSystemFont, system-ui, "Helvetica Neue", sans-serif;
  color: var(--text); background: var(--grund); -webkit-font-smoothing: antialiased; }
h2 { font-size: 1.3rem; line-height: 1.25; margin: 0 0 .75rem; letter-spacing: -.01em; }
h3 { font-size: 1rem; margin: 1.1rem 0 .4rem; color: var(--text-2); font-weight: 600; }
p { margin: 0 0 .6rem; }

/* Kopf: ein Titel, darunter Umschalter — schwebt beim Scrollen mit */
.kopf { position: sticky; top: 0; z-index: 10; background: color-mix(in srgb, var(--flaeche) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--linie); padding-top: env(safe-area-inset-top); }
/* Sprungziele (scrollIntoView) nicht unter dem klebenden Kopf verstecken: am Handy ist er ca. 108 px hoch */
#no-ergebnis { scroll-margin-top: calc(7.5rem + env(safe-area-inset-top)); }
.kopf-innen { max-width: 40rem; margin: 0 auto; padding: .6rem 1rem .7rem; display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
h1 { font-size: 1.15rem; margin: 0; flex: 0 0 auto; letter-spacing: -.01em; }
nav { display: flex; flex: 1 1 14rem; gap: 2px; padding: 2px; background: var(--flaeche-2); border-radius: 10px; }
nav button { flex: 1; border: 0; border-radius: 8px; background: none; color: var(--text-2); min-height: 2.5rem;
  padding: 0 .9rem; font: inherit; font-size: .95rem; font-weight: 500; cursor: pointer; }
nav button.aktiv { background: var(--flaeche); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }

main { max-width: 40rem; margin: 0 auto; padding: 1rem 1rem 12rem; }   /* unten Platz für die feste Transportleiste */
.bereich[hidden] { display: none; }

/* Karten: eine Aufgabe pro Karte */
.karte, .feedback { background: var(--flaeche); border-radius: var(--radius); padding: 1.1rem 1.1rem 1rem;
  margin-bottom: 1rem; box-shadow: var(--schatten); }
.karte > h2 + h3 { margin-top: 0; }

/* Eingabeelemente */
button { font: inherit; }
button, select, input { color: var(--text); }
button:not(.gross):not(nav button) { min-height: 2.75rem; padding: 0 1rem; font-size: 1rem; font-weight: 500;
  border-radius: 10px; border: 0; background: var(--akzent-schwach); color: var(--akzent); cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
button.gross { width: 100%; min-height: 3.25rem; font-size: 1.1rem; font-weight: 600; border: 0; border-radius: 14px;
  background: var(--akzent); color: #fff; cursor: pointer; }
button.gross:disabled { opacity: .4; }
select, input[type=search], input[type=text], input[type=password] { font: inherit; min-height: 2.75rem; padding: 0 .8rem;
  border: 1px solid var(--linie); border-radius: 10px; background: var(--flaeche-2); }
select { max-width: 100%; }
input[type=file] { font: inherit; max-width: 100%; color: var(--text-2); }
input[type=file]::file-selector-button { font: inherit; min-height: 2.75rem; padding: 0 1rem; margin-right: .75rem; border: 0;
  border-radius: 10px; background: var(--akzent-schwach); color: var(--akzent); font-weight: 500; cursor: pointer; }
:focus-visible { outline: 3px solid var(--akzent); outline-offset: 2px; }
@media (hover: hover) { button:not(:disabled):hover { filter: brightness(.95); } }

.knoepfe { display: flex; flex-direction: column; gap: .6rem; margin: 1rem 0 0; }
@media (min-width: 600px) { .knoepfe { flex-direction: row; } }

/* Stimmbildung */
.auswahl { display: grid; grid-template-columns: 1fr; gap: .75rem; margin-bottom: .9rem; }
@media (min-width: 520px) { .auswahl { grid-template-columns: 1fr 1fr; } }
.auswahl label { display: grid; gap: .3rem; font-size: .85rem; font-weight: 600; color: var(--text-2); }
.auswahl select { font-size: 1rem; font-weight: 400; color: var(--text); }
.anleitung { color: var(--text); margin-bottom: .75rem; }
.noten { margin: 0; padding: .7rem .9rem; background: var(--flaeche-2); border-radius: 10px; font-weight: 600;
  letter-spacing: .03em; word-spacing: .4em; }
#zaehler { font-size: 3.5rem; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; min-height: 4rem; line-height: 4rem; }
#zaehler:empty { min-height: 0; line-height: 0; }
#status, #no-status, #bib-status, #ms-status { color: var(--text-2); min-height: 1.5rem; margin: .6rem 0 0; }
#status:empty, #no-status:empty, #bib-status:empty, #ms-status:empty { min-height: 0; margin: 0; }
#status.fehler, #no-status.fehler, #bib-status.fehler, .bib-admin-status.fehler, #ms-status { color: var(--schlecht); }
.hinweis-leise { color: var(--text-2); font-size: .95rem; }
.hinweis { color: var(--warn); background: var(--warn-grund); border-radius: 10px; padding: .6rem .8rem; font-size: .95rem; }

/* Feedback */
.feedback h3 { margin: 0 0 .5rem; font-size: 1.15rem; color: var(--text); }
.feedback p { margin: 0 0 .6rem; white-space: pre-wrap; }
.feedback .quelle { font-size: .85rem; color: var(--text-2); }

/* Notenliste (Feedback pro Ton) */
.notenliste { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: .5rem; }
.notenliste li { background: var(--flaeche); border-radius: 12px; padding: .65rem .85rem; box-shadow: var(--schatten);
  display: grid; grid-template-columns: 3.2rem 1fr; gap: .1rem .6rem; }
.notenliste .ton { grid-row: span 2; font-size: 1.2rem; font-weight: 700; align-self: center; }
.notenliste .befund-nb { color: var(--warn); font-style: italic; }
.notenliste .stufe-sauber { color: var(--gut); }
.notenliste .stufe-deutlich { color: var(--schlecht); }
.notenliste .stufe-falscher_ton { color: var(--schlecht); font-weight: 700; }

/* Notenübung: Stimmenliste, Wiedergabe */
.wg-transport { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; gap: .4rem; max-width: 40rem; margin: 0 auto;
  background: color-mix(in srgb, var(--flaeche) 86%, transparent); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--linie); border-radius: var(--radius) var(--radius) 0 0;
  padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom)); }
.wg-zeile { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.wg-zeile label { display: flex; align-items: center; gap: .4rem; }
.wg-zeile select { min-height: 2.5rem; max-width: 11rem; }
.wg-zeile input[type=range] { flex: 1; min-width: 6rem; min-height: 2.5rem; accent-color: var(--akzent); }
.wg-transport button.gross { width: auto; flex: 0 0 auto; min-width: 7rem; min-height: 2.75rem; padding: 0 1.2rem; }
.wg-zeit { font-variant-numeric: tabular-nums; min-width: 5.5rem; color: var(--text-2); font-size: .95rem; }
.wg-bedienung { display: grid; gap: .6rem; margin-bottom: .75rem; }
.wg-bedienung label { display: flex; align-items: center; gap: .6rem; }
.wg-bedienung select { min-height: 2.75rem; }
.wg-bedienung input[type=range] { flex: 1; min-height: 2.6rem; accent-color: var(--akzent); }
.wg-meldung { color: var(--text-2); min-height: 1.5rem; }
.wg-noten { margin-top: .5rem; border-radius: 10px; }
.wg-noten .sp-scroll { -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
#btn-neues-foto { background: var(--flaeche-2); color: var(--text); }

/* Mitsingen */
.ms-hinweis { border-radius: 12px; padding: .75rem 1rem; margin: .75rem 0; background: var(--warn-grund); color: var(--text); }
.ms-hinweis p { margin: 0 0 .5rem; }
.ms-zaehler { position: fixed; top: calc(.4rem + env(safe-area-inset-top)); left: .4rem; right: .4rem; z-index: 30; max-width: 39rem; margin: 0 auto;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .25); display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .5rem .6rem;
  border-radius: var(--radius); background: var(--akzent-schwach); border: 2px solid var(--akzent); }
.ms-zaehler[hidden] { display: none; }
.ms-schlag { flex: 1 1 0; min-width: 2.5rem; text-align: center; font-size: 1.6rem; font-weight: 700; padding: .1rem 0; border-radius: 10px;
  background: var(--flaeche); color: var(--text-2); border: 2px solid var(--linie); }
.ms-schlag.an { background: var(--akzent); color: #fff; border-color: var(--akzent); }
.ms-zaehlstopp { flex: 1 1 100%; background: var(--flaeche) !important; color: var(--schlecht) !important; border: 1px solid var(--schlecht) !important; }
.ms-zaehltext { flex: 1 1 100%; margin: 0; font-weight: 600; text-align: center; }
.wg-noten.wg-einsatz .sp-cursor { width: 8px; margin-left: -4px; background: rgba(0, 150, 60, .85); }

/* Mikrofon-Auswahl */
.mikro { margin: 0; }
.mikro-zeile { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.mikro select { flex: 1 1 12rem; }
.mikro button { margin-top: .4rem; }
.mikro-hinweis { margin: .4rem 0 0; color: var(--text-2); font-size: .95rem; }
.mikro-hinweis.warnung { border-radius: 10px; padding: .5rem .75rem; background: var(--warn-grund); color: var(--warn); }

/* Meine Stücke / Programm: Listenzeilen */
.ms-liste { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.ms-liste li { background: var(--flaeche-2); border-radius: 12px; padding: .7rem .85rem; display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.ms-liste .ms-info { flex: 1 1 100%; display: grid; }
.ms-liste .ms-info span { color: var(--text-2); font-size: .9rem; }
.ms-liste:empty { display: none; }

/* Stück suchen */
.bib-zeile { display: flex; gap: .5rem; }
.bib-zeile input { flex: 1; min-width: 0; }
.bib-zeile button[aria-expanded=true] { background: var(--akzent); color: #fff; }
.bib button:disabled, .bib input:disabled { opacity: .5; cursor: default; }
.bib-treffer { list-style: none; margin: .5rem 0 0; padding: 0; background: var(--flaeche-2); border-radius: 12px; max-height: 60vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.bib-treffer-eintrag { display: flex; align-items: center; gap: .5rem; padding: .6rem .85rem; min-height: 3rem; cursor: pointer; border-bottom: 1px solid var(--linie); }
.bib-treffer-eintrag:last-child { border-bottom: 0; }
.bib-treffer-eintrag.aktiv, .bib-treffer-eintrag:hover { background: var(--akzent-schwach); }
.bib-text { flex: 1; display: grid; min-width: 0; }
.bib-text strong { overflow-wrap: anywhere; }
.bib-text span { color: var(--text-2); font-size: .9rem; }
.bib-programm { background: var(--flaeche-2); border-radius: 12px; padding: .6rem .9rem 1rem; margin-top: .6rem; }
.bib-programm h4 { margin: .4rem 0; font-size: 1.05rem; }
.bib-programm .ms-liste li { background: var(--flaeche); }
.bib-anmerkung { color: var(--warn); font-size: .9rem; }
.bib-admin { margin-top: 1rem; border-top: 1px solid var(--linie); padding-top: .6rem; }
.bib-admin summary { cursor: pointer; min-height: 2.75rem; display: flex; align-items: center; font-weight: 600; color: var(--text-2); }
.bib-admin label { display: grid; gap: .2rem; margin: .5rem 0; }
.bib-admin input[type=text], .bib-admin input[type=password] { width: 100%; }
.bib-admin .ms-info input { margin-top: .3rem; }
.beschaeftigt { cursor: progress; }
@media (max-width: 480px) { .bib-treffer-eintrag { flex-wrap: wrap; } }

/* Bewegung zurücknehmen, wenn gewünscht */
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media (prefers-reduced-transparency: reduce) { .kopf, .wg-transport { background: var(--flaeche); -webkit-backdrop-filter: none; backdrop-filter: none; } }

/* ---- Überarbeitung: Stimmbildung (Abspielkopf) und ruhigere Wiedergabe ---- */
button.klein { min-height: 2.5rem; font-size: .95rem; }
button.gross.zweit { background: var(--akzent-schwach); color: var(--akzent); }
#sb-hoeren button.rund { flex: 0 0 auto; width: 3.5rem; height: 3.5rem; min-height: 0; padding: 0; border-radius: 50%; font-size: 1.3rem;
  background: var(--akzent); color: #fff; display: grid; place-items: center; }
#sb-hoeren button.rund:disabled { opacity: .4; }
@media (prefers-color-scheme: dark) { #sb-hoeren button.rund { color: #000; } }
.sb-kopf { display: flex; align-items: center; gap: .9rem; margin-bottom: .9rem; }
.sb-spur { position: relative; flex: 1; min-width: 0; }
.sb-noten { display: flex; height: 3.5rem; border-radius: 10px; overflow: hidden; background: var(--flaeche-2); }
.sb-ton { flex: 1 1 0; min-width: 0; display: grid; place-items: center; font-size: .85rem; font-weight: 600;
  border-right: 2px solid var(--flaeche); background: var(--akzent-schwach); color: var(--akzent); overflow: hidden; }
.sb-ton:last-child { border-right: 0; }
.sb-ton.an { background: var(--akzent); color: #fff; }
@media (prefers-color-scheme: dark) { .sb-ton.an { color: #000; } }
.sb-luecke { flex: 1 1 0; background: transparent; }
.sb-kopfmarke { position: absolute; top: -4px; bottom: -4px; left: 0; width: 3px; margin-left: -1.5px; border-radius: 2px; background: var(--text); pointer-events: none; }
.sb-kopfmarke[hidden] { display: none; }
#sb-singen #zaehler { margin: 0; }
#sb-singen .knoepfe { margin-top: 0; }
.sb-mikro { margin-top: 1rem; border-top: 1px solid var(--linie); padding-top: .4rem; }
.sb-mikro summary { cursor: pointer; min-height: 2.5rem; display: flex; align-items: center; color: var(--text-2); font-size: .95rem; font-weight: 600; }
.sb-mikro .mikro { padding-bottom: .4rem; }
#sb-hoeren .klein { width: 100%; background: var(--flaeche-2); color: var(--text); }
@media (min-width: 520px) { #sb-hoeren .klein { width: auto; } }

/* Wiedergabe: Noten zuerst, Optionen leise, eine ruhige Leiste unten */
.klein-abstand { margin: 1rem 0 .5rem; }
.wg-bedienung { order: 0; margin: 0 0 .5rem; }
.wg-bedienung label { font-size: .9rem; color: var(--text-2); }
.wg-bedienung .wg-tempo { min-width: 3.2rem; text-align: right; font-variant-numeric: tabular-nums; }
.wg-meldung:empty { display: none; }
.wg-noten { border: 1px solid var(--linie); background: #fff; padding: .25rem; overflow: hidden; }   /* Notenbild bleibt hell: SVG ist schwarz auf transparent */
#no-mitsingen { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--linie); }
#no-mitsingen h3 { margin-top: 0; color: var(--text); font-size: 1.1rem; }
#no-mitsingen .knoepfe { margin-top: .75rem; }
#no-mitsingen .knoepfe .gross + .gross { background: var(--akzent-schwach); color: var(--akzent); }
#btn-neues-foto { width: 100%; }
@media (min-width: 520px) { #btn-neues-foto { width: auto; } }
.wg-transport { gap: .5rem; box-shadow: 0 -4px 20px rgba(0, 0, 0, .08); }
.wg-zeile label { font-size: .85rem; color: var(--text-2); }
.wg-zeile select { color: var(--text); font-size: .95rem; min-height: 2.5rem; padding: 0 .5rem; }
.wg-zeile:nth-child(2) { justify-content: space-between; }
.wg-zeile:nth-child(2) label:last-child { flex: 1; }
.wg-zeile:nth-child(2) label:last-child input { min-width: 4rem; }
.wg-transport button.gross { border-radius: 999px; min-width: 6.5rem; }

/* Kartenkopf: Titel links, Aktion rechts */
.karte-kopf { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.karte-kopf h2 { margin: 0; }
.karte-kopf button { flex: 0 0 auto; background: var(--flaeche-2); color: var(--text); }
