/* Stadtrally - mobile zuerst, alle Bedienelemente gross genug fuer Daumen. */

:root {
    --dunkel:       #16323f;
    --mittel:       #1f5c73;
    --hell:         #2a7593;
    --akzent:       #e08a1e;
    --gruen:        #2f7d46;
    --gruen-hell:   #e8f4ec;
    --rot:          #b3261e;
    --rot-hell:     #fdecea;
    --grau:         #5d6b72;
    --grau-hell:    #eef1f3;
    --rand:         #d5dde1;
    --kopf-text:    #ffffff;
    --fokus:        rgba(42, 117, 147, .35);
    --grund:        #f6f8f9;
    --karte:        #ffffff;
    --radius:       12px;
}

* { box-sizing: border-box; }

/* Eigene display-Regeln (.knopf, .aufnahme-anzeige, audio ...) sind Klassen
   und schlagen damit das eingebaute [hidden] des Browsers. Ohne diese Zeile
   waeren versteckte Elemente trotz hidden-Attribut sichtbar. */
[hidden] { display: none !important; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--grund);
    color: #1b2429;
    font: 17px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-text-size-adjust: 100%;

    /* Damit die Fusszeile auch auf kurzen Seiten unten steht und nicht mitten
       im Bild haengt: der Inhalt dazwischen dehnt sich (.inhalt weiter unten). */
    min-height: 100vh;
    /* Auf dem Handy rechnet 100vh mit eingeklappter Adressleiste und ist damit
       immer ein Stueck zu hoch - unten faellt dann etwas aus dem Bild. 100dvh
       meint den Platz, der gerade wirklich da ist. Aeltere Browser kennen die
       Einheit nicht und ueberlesen die Zeile; dann gilt weiter 100vh. */
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

/* Links ohne eigene Regel - etwa der Google-Maps-Hinweis unter der Karte.
   Ohne das faellt der Browser auf sein eigenes Blau zurueck, das mit der
   uebrigen Palette nicht zusammenpasst. Spezifischere Regeln weiter unten
   (.kopf-nav a, .fuss-hinweis a ...) gewinnen weiterhin. */
a { color: var(--mittel); }

/* ----------------------------------------------------------- Ausklapp --- */

/* Aufklappbarer Text (Geschichte, Aufgabe). Der Umschalter sitzt in der Zeile
   der Ueberschrift, rechts als kleiner "Details"-Link - so kostet er keine
   eigene Zeile. Ob er beim Laden offen ist, steht in config.json; siehe
   ausklapptext() in lib/layout.php. */

.ausklapp { margin: 0 0 14px; }

.ausklapp > summary {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    /* Das eingebaute Marker-Dreieck weg: hier zeigt der "Details"-Link an,
       dass es etwas zu sehen gibt. list-style deckt Firefox ab, die
       ::-webkit-Regel die Browser auf WebKit-Basis. */
    list-style: none;
}

.ausklapp > summary::-webkit-details-marker { display: none; }

.ausklapp > summary h1,
.ausklapp > summary h2,
.ausklapp > summary h3,
.ausklapp > summary h4 { margin: 0; }

.ausklapp-mehr {
    flex: 0 0 auto;
    font-size: 14px;
    font-weight: 600;
    color: var(--mittel);
    text-decoration: underline;
    white-space: nowrap;
    /* Die Zeile ist als Ganzes anklickbar; der Link markiert nur, wo. */
    padding: 4px 0;
}

.ausklapp[open] > summary .ausklapp-mehr { opacity: .7; }

.ausklapp > summary:focus-visible {
    outline: 3px solid var(--fokus);
    outline-offset: 3px;
    border-radius: 6px;
}

.ausklapp > :not(summary) { margin-top: 10px; }

/* Die Mindestanforderungen auf der Startseite: eine Karte, die zugleich
   aufklappt. Die Ueberschrift ist kleiner als sonst - der Kasten soll neben
   "Neues Spiel" und "Weiterspielen" nicht wie ein dritter Schritt
   aussehen. */
.anforderungen > summary h2 { font-size: 17px; }
.anforderungen ul { margin: 0; padding-left: 20px; }
.anforderungen li { margin-bottom: 8px; }
.anforderungen li:last-child { margin-bottom: 0; }

/* ----------------------------------------------------------- Vorlesen --- */

/* Sprachausgabe des aufgeklappten Textes. Der Knopf ist im HTML verborgen und
   wird von assets/vorlesen.js eingeblendet - kann der Browser keine
   Sprachausgabe, bleibt er weg. */

.vorlesen { margin: 0 0 12px; }

.vorlesen-knopf {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 8px 15px 8px 12px;
    background: transparent;
    color: var(--mittel);
    border: 1px solid var(--rand);
    border-radius: 999px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.vorlesen-knopf:active { background: var(--grau-hell); }

/* Dreieck = abspielen. */
.vorlesen-symbol {
    flex: 0 0 auto;
    width: 0;
    height: 0;
    border-left: 11px solid currentColor;
    border-top: 7px solid transparent;
    border-bottom: 7px solid transparent;
}

/* Waehrend des Vorlesens ein Quadrat = anhalten. */
.vorlesen-knopf.laeuft .vorlesen-symbol {
    width: 12px;
    height: 12px;
    margin: 0 1px;
    border: 0;
    background: currentColor;
}

/* ---------------------------------------------------------------- Kopf --- */

.kopf {
    background: var(--dunkel);
    color: var(--kopf-text);
    padding: env(safe-area-inset-top) 0 0;
    position: sticky;
    top: 0;
    z-index: 20;
}

.kopf-zeile {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 16px;
}

.kopf-team { min-width: 0; }   /* damit der lange Stationsname kuerzen darf */

.kopf-team strong {
    display: block;
    font-size: 18px;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kopf-label {
    display: block;
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .65;
}

.kopf-punkte {
    text-align: right;
    flex: 0 0 auto;
    /* Auf der Kartenseite gibt mehrmaliges Tippen hierauf den Weiter-Knopf von
       Hand frei (siehe karte.js). Ohne das markiert das schnelle Tippen die
       Schrift blau, und auf dem Handy springt die Lupe auf. */
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.kopf-punkte strong { font-size: 24px; line-height: 1; color: var(--akzent); }

.kopf-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, .08);
    font-size: 14px;
}

.kopf-nav a { color: var(--kopf-text); text-decoration: none; border-bottom: 1px solid rgba(255,255,255,.5); }
.kopf-code { opacity: .8; letter-spacing: .05em; }

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

.inhalt {
    max-width: 640px;
    margin: 0 auto;
    /* Unten weniger als frueher: den Abstand zum Bildschirmrand macht jetzt
       die Fusszeile. */
    padding: 18px 16px 32px;
    /* Nimmt den Platz zwischen Kopf und Fuss ein - siehe body. */
    flex: 1 0 auto;
    width: 100%;
}

/* Fusszeile auf jeder Seite. Zurueckhaltend wie im Buchhaltungsprojekt: eine
   Trennlinie, kleine graue Schrift, mittig. Das safe-area-Padding haelt sie
   auf dem iPhone ueber dem Streifen fuer die Home-Geste. */
.fuss {
    border-top: 1px solid var(--rand);
    background: var(--karte);
    padding: 14px 16px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    text-align: center;
    font-size: 13px;
    color: var(--grau);
    /* Drei Spalten: der Text bleibt in der Mitte, egal ob rechts der Link
       zur Verwaltung steht oder nicht (in leitung/ steht er nicht). */
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
}

.fuss-text { grid-column: 2; }

/* Bewusst unauffaellig - eine Zeile im Fuss, kein Knopf. */
.fuss-verwaltung {
    grid-column: 3;
    justify-self: end;
    color: var(--grau);
    text-decoration: underline;
    text-underline-offset: 2px;
    white-space: nowrap;
}

.fuss-verwaltung:hover,
.fuss-verwaltung:focus-visible { color: var(--mittel); }

/* Die Auswertung der Spielleitung wird am Rechner gemacht und nutzt den
   ganzen Bildschirm - die Matrix hat eine Spalte je Station. Das Spiel selbst
   laeuft auf Handys und bleibt schmal. */
.inhalt.breit {
    max-width: none;
    padding-left: 24px;
    padding-right: 24px;
}

h1 { font-size: 26px; line-height: 1.2; margin: 0 0 4px; }
h2 { font-size: 20px; margin: 28px 0 10px; }
p  { margin: 0 0 14px; }

.schritt {
    font-size: 13px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--mittel);
    font-weight: 600;
    margin-bottom: 2px;
}

.karte-block {
    background: var(--karte);
    border: 1px solid var(--rand);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 18px;
}

.geschichte p:last-child { margin-bottom: 0; }

.hinweis-box {
    background: #fff8ec;
    border: 1px solid #f0d9b0;
    border-left: 5px solid var(--akzent);
    border-radius: var(--radius);
    padding: 16px 18px;
    margin-bottom: 20px;
}

.hinweis-box h2 { margin-top: 0; }

/* Zeitgenoessische Zitate (Chronik Dochtermann) - bewusst abgesetzt, weil das
   alte Deutsch sonst wie ein Tippfehler im Fliesstext wirkt. */
.zitat {
    background: #f2eee6;
    border-left: 4px solid #c9b896;
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: 14px 16px;
    margin: 0 0 18px;
    font-family: Georgia, "Times New Roman", serif;
    font-style: italic;
    font-size: 15.5px;
    color: #4a4235;
}

.zitat p:last-child { margin-bottom: 0; }

.zitat-quelle {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-style: normal;
    font-size: 12px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: #8a7d68;
    margin-bottom: 8px;
}

/* ------------------------------------------------------------ Aufgaben --- */

/* Einleitung ueber den Eingabefeldern - der eigentliche Auftrag, wenn die
   Felder selbst nur kurze Beschriftungen tragen. */
.aufgabentext {
    margin-bottom: 14px;
}

.aufgabentext p:last-child { margin-bottom: 0; }

/* Aufzaehlungen in Geschichte, Hinweis und Aufgabentext. */
.aufgabentext ul,
.geschichte ul,
.hinweis-box ul {
    margin: 0 0 14px;
    padding-left: 22px;
}

.aufgabentext li,
.geschichte li,
.hinweis-box li { margin-bottom: 4px; }

.aufgabentext ul:last-child,
.geschichte ul:last-child,
.hinweis-box ul:last-child { margin-bottom: 0; }

/* Tabelle in einer Aufgabenstellung (z. B. die Farb-Punkte-Liste am Ulmer
   Tor). Der Rahmen scrollt notfalls fuer sich, damit die Seite auf schmalen
   Handys nicht seitlich wandert. */
.tabelle-rahmen {
    overflow-x: auto;
    margin-bottom: 16px;
    border: 1px solid var(--rand);
    border-radius: var(--radius);
    background: var(--karte);
}

.inhalt-tabelle {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

.inhalt-tabelle th,
.inhalt-tabelle td {
    padding: 9px 12px;
    text-align: left;
    border-bottom: 1px solid var(--grau-hell);
    white-space: nowrap;
}

.inhalt-tabelle th {
    background: var(--grau-hell);
    font-size: 12px;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--grau);
}

.inhalt-tabelle tr:last-child td { border-bottom: 0; }
.inhalt-tabelle .rechts { text-align: right; font-weight: 600; }

/* Zweite Spalte darf umbrechen, wenn es eng wird - sie traegt den Fliesstext. */
.inhalt-tabelle td:nth-child(2) { white-space: normal; }

.farbfleck {
    display: inline-block;
    width: 13px;
    height: 13px;
    border-radius: 3px;
    margin-right: 8px;
    vertical-align: -1px;
    border: 1px solid rgba(0, 0, 0, .2);
}

.aufgabe {
    background: var(--karte);
    border: 1px solid var(--rand);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
}

.aufgabe.fehlerhaft { border-color: var(--rot); background: var(--rot-hell); }

/* Auf der Stationsseite stehen alle Aufgaben in EINER Box, durch duenne
   Linien getrennt. Einzelne Karten untereinander kosteten je Aufgabe rund
   45 Pixel nur fuer Rahmen und Abstand - bei vier Feldern fast eine halbe
   Bildschirmhoehe. Der Ortswahl-Bildschirm benutzt .aufgabe weiterhin
   allein, deshalb sind die Aenderungen auf .aufgaben-box beschraenkt. */

.aufgaben-box {
    background: var(--karte);
    border: 1px solid var(--rand);
    border-radius: var(--radius);
    padding: 0 16px;
    margin-bottom: 14px;
    /* Ein fehlerhaftes Feld reicht bis an den Rand der Box - ohne das
       schauen seine eckigen Ecken aus den runden der Box heraus. */
    overflow: hidden;
}

.aufgaben-box .aufgabe {
    background: none;
    border: 0;
    border-top: 1px solid var(--rand);
    border-radius: 0;
    padding: 14px 0;
    margin: 0;
}

.aufgaben-box .aufgabe:first-child { border-top: 0; }

/* Ein fehlerhaftes Feld faerbt sich ueber die ganze Breite der Box ein und
   bekommt links einen Streifen - ein eigener Rahmen wuerde die Box zerlegen.
   Die negativen Raender heben das Innenpolster der Box wieder auf. */
.aufgaben-box .aufgabe.fehlerhaft {
    margin: 0 -16px;
    padding: 14px 16px 14px 12px;
    border-left: 4px solid var(--rot);
    background: var(--rot-hell);
}

.aufgabe-kopf {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}

.aufgabe-frage { font-weight: 600; }

.aufgabe-punkte {
    flex: 0 0 auto;
    background: var(--grau-hell);
    color: var(--grau);
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 13px;
    white-space: nowrap;
}

.hilfe { font-size: 14px; color: var(--grau); margin: 6px 0 0; }

.feld-fehler { color: var(--rot); font-size: 14px; font-weight: 600; margin: 8px 0 0; }

input[type="text"],
input[type="number"],
input[type="password"],
input[type="file"],
select,
textarea {
    width: 100%;
    font: inherit;
    padding: 12px 14px;
    border: 1px solid var(--rand);
    border-radius: 10px;
    background: #fff;
    color: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: 3px solid var(--fokus);
    border-color: var(--hell);
}

.zeit-felder { display: flex; align-items: center; gap: 10px; }
.zeit-felder input { width: 90px; }
.zeit-felder span { color: var(--grau); font-size: 15px; }

.haken {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-weight: 600;
}

.haken input { width: 26px; height: 26px; accent-color: var(--mittel); }

.foto-vorschau {
    margin-top: 12px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--rand);
}

.foto-vorschau img { display: block; width: 100%; height: auto; }

/* Das Dateifeld bleibt im Formular und mit der Tastatur erreichbar, ist aber
   nicht zu sehen - angetippt wird der Knopf (ein <label>) darueber.
   display:none waere hier falsch: damit fiele das Feld aus der Reihenfolge der
   Tastaturbedienung heraus, und der Fokusrahmen haette nichts zu umrahmen. */
.foto-eingabe {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: 0;
    border: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Der Fokus liegt unsichtbar auf dem Feld - gezeigt wird er am Knopf. */
.foto-eingabe:focus-visible + .foto-knopf {
    outline: 3px solid var(--fokus);
    outline-offset: 2px;
}

/* Knopf und Stand unter der Karte im Koordinaten-Werkzeug. Nebeneinander,
   damit "3 Nadeln verschoben" gleich neben dem Knopf steht, der sie
   uebernimmt; auf schmalen Fenstern rutscht der Text darunter. */
.karte-aktionen {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.karte-aktionen .hilfe { margin: 0; }

/* ------------------------------------------------------------ Aufnahme --- */

.aufnahme-steuerung {
    background: #f4f7f8;
    border: 1px solid var(--rand);
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 12px;
}

.aufnahme-steuerung .knopf { margin-top: 0; }

.aufnahme-anzeige {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    font-size: 22px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--dunkel);
}

.aufnahme-max { font-size: 15px; font-weight: 400; color: var(--grau); }

.aufnahme-punkt {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--rot);
    animation: aufnahme-blinken 1s steps(2, start) infinite;
}

@keyframes aufnahme-blinken {
    to { visibility: hidden; }
}

.aufnahme audio,
.antwort-liste audio {
    display: block;
    width: 100%;
    margin-top: 12px;
}

/* Kein Mikrofon und keine Dateiauswahl (AUDIO_NUR_AUFNAHME): dann steht hier
   statt der Knoepfe, woran es liegt. Deutlich, weil die Station sonst nicht
   zu beantworten ist. */
.aufnahme-kein-mikro {
    margin: 0;
    padding: 12px 14px;
    border-radius: var(--radius);
    background: var(--rot-hell);
    color: var(--rot);
    font-size: 15px;
    line-height: 1.5;
}

.aufnahme-kein-mikro code {
    font-family: Consolas, monospace;
    font-size: 14px;
}

.aufnahme-gespeichert {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--rand);
}

.knopf.rot { background: var(--rot); }

/* ------------------------------------------------------------- Buttons --- */

.knopf {
    display: block;
    width: 100%;
    font: inherit;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    padding: 16px 20px;
    border: 0;
    border-radius: var(--radius);
    background: var(--mittel);
    color: #fff;
    cursor: pointer;
    margin-top: 8px;
}

.knopf:active { background: var(--dunkel); }
.knopf:disabled { background: var(--rand); color: var(--grau); cursor: not-allowed; }
.knopf.gruen { background: var(--gruen); }
.knopf.hell { background: #fff; color: var(--mittel); border: 1px solid var(--rand); }

.knopf-reihe { display: grid; gap: 10px; margin-top: 16px; }

/* -------------------------------------------------------------- Meldung --- */

.meldung {
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 16px;
    font-weight: 600;
}

.meldung.fehler  { background: var(--rot-hell);  color: var(--rot);   border: 1px solid #f3c6c2; }
.meldung.erfolg  { background: var(--gruen-hell); color: var(--gruen); border: 1px solid #bfe0ca; }
.meldung.info    { background: #e9f2f6; color: var(--dunkel); border: 1px solid #c6dde7; }

/* ------------------------------------------------------------ Ortswahl --- */

#ortsfeld.falsch { border-color: var(--rot); background: var(--rot-hell); color: var(--rot); }
#ortsfeld.richtig { border-color: var(--gruen); background: var(--gruen-hell); color: var(--gruen); }

#ortsmeldung { margin-top: 10px; font-weight: 600; }
#ortsmeldung.falsch { color: var(--rot); }
#ortsmeldung.richtig { color: var(--gruen); }

/* ---------------------------------------------------------------- Karte --- */

#karte {
    height: 55vh;
    min-height: 320px;
    border-radius: var(--radius);
    border: 1px solid var(--rand);
    margin-bottom: 16px;
    z-index: 1;
}

/* ---------------------------------------------------------- Kartenseite --- */

/*
 * Der Kartenbildschirm des Spiels soll auf einen Handy-Bildschirm passen.
 *
 * Vorher stand die Karte auf 55vh mit 320px Mindesthoehe - zusammen mit Kopf,
 * Ueberschrift und Fusszeile rutschte der Knopf "Wir sind angekommen" unter
 * die Kante. Hochwischen half nicht: ein Finger auf der Karte zieht die Karte,
 * nicht die Seite.
 *
 * Jetzt bekommt die Karte, was uebrig bleibt. Auf einem grossen Handy ist das
 * viel, auf einem kleinen wenig - der Knopf steht in beiden Faellen im Bild.
 * Wichtig ist das min-height:0: ohne das schrumpft ein Flex-Element nicht
 * unter seinen Inhalt, und die ganze Rechnung ginge nicht auf.
 */
.inhalt.karte-seite {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding-bottom: 16px;
}

.karte-seite #karte {
    flex: 1 1 auto;
    height: auto;
    min-height: 180px;
    margin-bottom: 12px;
}

/* Ziel und Schrittzahl in einer Zeile statt in dreien - jede gesparte Zeile
   ist Karte. */
.karte-ziel {
    margin: 0 0 10px;
    font-size: 15px;
    color: var(--grau);
}

.karte-ziel strong {
    display: block;
    font-size: 21px;
    line-height: 1.25;
    color: inherit;
    color: #1b2429;
}

.karte-seite .karte-hinweis {
    margin: 10px 0 0;
    font-size: 13px;
    color: var(--grau);
    text-align: center;
}

/* Statuszeile ueber dem Knopf: erst "wird ermittelt", dann die Entfernung. */
.ankunft-status {
    margin: 0 0 8px;
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    color: var(--grau);
}

.ankunft-status.wartet::after {
    content: '';
    display: inline-block;
    width: 0.9em;
    text-align: left;
    animation: ankunftPunkte 1.2s steps(4, end) infinite;
}

@keyframes ankunftPunkte {
    0%   { content: ''; }
    25%  { content: '.'; }
    50%  { content: '..'; }
    75%  { content: '...'; }
}

@media (prefers-reduced-motion: reduce) {
    .ankunft-status.wartet::after { animation: none; content: '...'; }
}

/* Kein Standort, kein JavaScript - dann muss deutlich dastehen, woran es
   liegt, statt dass die Gruppe auf einen Knopf wartet, der nie kommt. */
.ankunft-kein-gps {
    margin: 0 0 8px;
    padding: 12px 14px;
    border-radius: 10px;
    background: #fdf3f3;
    border: 1px solid #f0cfcf;
    font-size: 15px;
    color: #7d2a2a;
}

.karte-hinweis { font-size: 14px; color: var(--grau); }

/* ------------------------------------------------------------ Uebersicht --- */

.fortschritt-balken {
    height: 10px;
    background: var(--grau-hell);
    border-radius: 999px;
    overflow: hidden;
    margin: 6px 0 20px;
}

.fortschritt-balken div { height: 100%; background: var(--gruen); }

.station-eintrag {
    background: var(--karte);
    border: 1px solid var(--rand);
    border-radius: var(--radius);
    margin-bottom: 12px;
    overflow: hidden;
}

.station-eintrag.gesperrt { background: var(--grau-hell); border-style: dashed; color: var(--grau); }
.station-eintrag.aktuell { border-color: var(--hell); border-width: 2px; }

.station-eintrag > summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.station-eintrag > summary::-webkit-details-marker { display: none; }

.station-nummer {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--grau-hell);
    color: var(--grau);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 15px;
}

.station-eintrag.geloest .station-nummer { background: var(--gruen); color: #fff; }
.station-eintrag.aktuell .station-nummer { background: var(--hell); color: #fff; }

.station-titel { flex: 1; font-weight: 600; }
.station-meta { font-size: 13px; color: var(--grau); font-weight: 400; display: block; }

.station-punkte { flex: 0 0 auto; font-weight: 700; color: var(--gruen); }

.station-details { padding: 0 16px 16px; border-top: 1px solid var(--rand); }
.station-details h3 { font-size: 15px; margin: 16px 0 6px; color: var(--mittel); }

/* Vierstelliger Code der Spielleitung auf der Freigabeseite. Weit gesperrt,
   damit die vier Punkte einzeln zu erkennen sind. */
.code-feld {
    text-align: center;
    letter-spacing: .5em;
    /* Die Sperrung haengt hinten am letzten Zeichen mit dran - der Einzug
       gleicht das aus, damit die Punkte mittig stehen. */
    text-indent: .5em;
    font-size: 24px;
    font-weight: 700;
}

/* Verdeckt die Ziffern, ohne ein type="password" zu brauchen - Firefox
   bietet sonst bei jedem Abschicken an, den Code zu speichern, und laesst sich
   davon durch kein autocomplete abhalten. Firefox kennt die Eigenschaft seit
   122, Chrome und Safari lange. Aeltere Browser bekommen ueber ein kleines
   Skript in spiel.php doch ein Passwortfeld. */
.code-verdeckt {
    -webkit-text-security: disc;
    text-security: disc;
}

.freigabe-zurueck { margin-top: 12px; }

/* ----------------------------------------------------------- Hinweise --- */

/* Mehrere Hinweise in einer Box: der erste steht oben, jeder falsch geratene
   Ort legt einen weiteren darunter. Der letzte nennt das Ziel. */

.hinweis-stufe + .hinweis-stufe {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(0, 0, 0, .12);
}

.hinweis-nummer {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--grau);
}


/* Bilder in Hinweisen - dort ist HTML erlaubt. */
.hinweis-stufe img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 10px 0 0;
    border-radius: 10px;
}

.hinweis-stufe p:last-child { margin-bottom: 0; }

.hinweis-offen { margin-top: 14px; }

/* --------------------------------------------------------- Transkript --- */

/* Der automatisch erkannte Text einer Tonaufnahme. Bewusst abgesetzt und
   als "automatisch" beschriftet: er ist eine Lesehilfe, nicht die Antwort -
   die Spielleitung hoert im Zweifel die Aufnahme. */

.transkript {
    margin-top: 10px;
    padding: 10px 12px;
    background: var(--grau-hell);
    border-radius: 10px;
}

.transkript-kopf {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--grau);
}

.transkript p:last-child { margin-bottom: 0; }

.transkript-leer {
    margin: 8px 0 0;
    font-size: 14px;
    color: var(--grau);
    font-style: italic;
}

.transkript-knopf {
    display: inline-block;
    width: auto;
    margin-top: 10px;
    padding: 8px 14px;
    font-size: 14px;
}

.antwort-liste { list-style: none; margin: 0; padding: 0; }

.antwort-liste li {
    padding: 10px 0;
    border-bottom: 1px solid var(--grau-hell);
}

.antwort-liste li:last-child { border-bottom: 0; }
.antwort-frage { font-size: 14px; color: var(--grau); }
.antwort-wert { font-weight: 600; }
.antwort-wert.richtig { color: var(--gruen); }
.antwort-wert.falsch { color: var(--rot); }
.antwort-punkte { float: right; font-size: 14px; color: var(--grau); font-weight: 600; }
.antwort-liste img { max-width: 220px; border-radius: 8px; margin-top: 8px; display: block; }

/* ------------------------------------------------------------- Startseite --- */

.start-logo {
    text-align: center;
    padding: 28px 0 10px;
}

.start-logo h1 { font-size: 30px; color: var(--dunkel); }
.start-logo p { color: var(--grau); }

.code-eingabe {
    text-align: center;
    letter-spacing: .35em;
    font-size: 26px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 16px !important;
}

.trenner {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--grau);
    font-size: 14px;
    margin: 26px 0 18px;
}

.trenner::before, .trenner::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--rand);
}

.fuss-hinweis {
    text-align: center;
    font-size: 14px;
    color: var(--grau);
    margin-top: 24px;
}

.fuss-hinweis a { color: var(--mittel); }

/* -------------------------------------------------------------- Ergebnis --- */

.ergebnis-zahl {
    text-align: center;
    font-size: 56px;
    font-weight: 800;
    color: var(--gruen);
    line-height: 1;
    margin: 10px 0 2px;
}

.ergebnis-zeile {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--grau-hell);
}

.ergebnis-zeile:last-child { border-bottom: 0; }

/* --------------------------------------------------------- Spielleitung --- */

/* Kopfleiste der Auswertung: Titel, Werkzeuge und Knoepfe in einer Zeile.
   Auf dem Auswertungsbildschirm ist Hoehe kostbar - drei Zeilen untereinander
   waren zwei zu viel.

   Dieselben Farben wie die Kopfzeile im Spiel (--dunkel / --kopf-text), damit
   die Auswertung erkennbar zur selben Anwendung gehoert. Die negativen Raender
   heben das Innenpolster von .inhalt.breit auf, damit die Leiste von Rand zu
   Rand geht. */
.leitung-leiste {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    margin: -18px -24px 18px;
    padding: 12px 24px;
    background: var(--dunkel);
    color: var(--kopf-text);
}

.leitung-leiste h1 {
    margin: 0;
    font-size: 20px;
    white-space: nowrap;
    color: var(--kopf-text);
}

/* Rechts ausgerichtet wird ueber die Navigation: sie nimmt den freien Platz
   ein, alles dahinter rutscht ans Ende. Frueher hing das an einem
   margin-left: auto am Berechnen-Knopf - den gibt es aber nur in der
   Auswertung, weshalb "Abmelden" auf den Werkzeugseiten mitten in der Leiste
   klebte. */

/* Das versteckte Formular soll die Leiste nicht auseinanderziehen. */
.leitung-leiste form { display: contents; }

.leitung-kopf {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

/* margin-left: auto greift nur, wenn noch Platz uebrig ist - in der vollen
   Leiste nimmt den die Navigation. Gebraucht wird es fuer den Fall, dass
   die Leiste auf einem schmalen Bildschirm umbricht: dann steht Abmelden
   auch in der zweiten Zeile rechts. */
.leitung-abmelden {
    width: auto;
    margin-top: 0;
    margin-left: auto;
    padding: 8px 14px;
    font-size: 14px;
}

/* Werkzeugleiste der Spielleitung. */
.leitung-nav {
    display: flex;
    flex-wrap: wrap;
    flex: 1 1 auto;
    gap: 4px;
}

.leitung-nav a {
    padding: 6px 12px;
    border-radius: 999px;
    color: var(--kopf-text);
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    opacity: .8;
}

/* Eine Aktion, die aussieht wie ein Navigationslink. */
.leitung-nav .nav-aktion {
    padding: 6px 12px;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--kopf-text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    opacity: .8;
    cursor: pointer;
}

.leitung-nav a:hover,
.leitung-nav .nav-aktion:hover { background: rgba(255, 255, 255, .12); opacity: 1; }

.leitung-nav a.hier {
    background: rgba(255, 255, 255, .16);
    opacity: 1;
}

/* ------------------------------------------------------------- Codes ----- */

/* Erklaerung und das Erzeugen-Formular nebeneinander, damit die Liste
   darunter frueh anfaengt. */
.codes-kopf {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 12px 24px;
    margin-bottom: 16px;
}

.codes-kopf > .hilfe { flex: 1 1 380px; }

.codes-erzeugen {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.codes-erzeugen label { font-size: 14px; color: var(--grau); }
.codes-erzeugen input { width: 90px; margin: 0; text-align: center; }
.codes-erzeugen .knopf { width: auto; margin: 0; padding: 10px 16px; }

/* Der Code selbst ist das, was abgeschrieben oder ausgeschnitten wird. */
.code-gross {
    font-family: Consolas, monospace;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .18em;
}

/* Gerade erzeugt - damit man sie in einer langen Liste wiederfindet. */
.matrix tr.frisch td { background: var(--gruen-hell); }

/* Beim Ausdrucken der Codeliste stoeren Leiste und Knoepfe nur. */
@media print {
    .leitung-leiste,
    .codes-erzeugen,
    .nicht-drucken { display: none !important; }

    .matrix-rahmen {
        max-height: none;
        overflow: visible;
        border: 0;
    }

    .matrix tr.frisch td { background: none; }
}

/* ------------------------------------------------------- Gruppenmatrix --- */

/* Eine Zeile je Gruppe, eine Spalte je Station. Der Rahmen scrollt in beide
   Richtungen; das ist die Bedingung dafuer, dass position: sticky greift -
   ein Kasten mit overflow-x allein scrollt senkrecht nicht und haette nichts,
   woran der Kopf kleben koennte. */

.matrix-rahmen {
    overflow: auto;
    max-height: 75vh;
    margin-bottom: 16px;
    border: 1px solid var(--rand);
    border-radius: var(--radius);
    background: var(--karte);
}

/* separate statt collapse: bei collapse verschwinden die Rahmenlinien unter
   den klebenden Zellen. */
.matrix {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    white-space: nowrap;
}

.matrix th,
.matrix td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--rand);
    text-align: left;
    vertical-align: top;
}

.matrix tbody tr:last-child th,
.matrix tbody tr:last-child td { border-bottom: 0; }

.matrix thead th {
    position: sticky;
    top: 0;
    z-index: 3;
    background: var(--grau-hell);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--grau);
}

/* Die Teamspalte bleibt beim Scrollen nach rechts stehen. */
.matrix .spalte-team {
    position: sticky;
    left: 0;
    z-index: 2;
    background: var(--karte);
    white-space: normal;
    min-width: 150px;
    box-shadow: 1px 0 0 var(--rand);
}

.matrix thead .spalte-team {
    z-index: 4;
    background: var(--grau-hell);
}

.matrix .spalte-team a { color: inherit; text-decoration: none; }
.matrix .spalte-team a:hover strong { text-decoration: underline; }

/* Sortierbare Ueberschriften. Sie sollen wie Ueberschriften aussehen und nicht
   wie Links - erst beim Zeigen darauf wird sichtbar, dass sie anklickbar
   sind. */
.matrix thead a {
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.matrix thead a:hover { text-decoration: underline; }

.matrix thead th.sortiert { color: var(--dunkel); }

.sort-pfeil {
    margin-left: 3px;
    font-size: 10px;
    vertical-align: 1px;
}

/* Code, Start, Ende und Dauer stehen in einer Zeile unter dem Teamnamen -
   drei eigene Spalten dafuer haben zu viel Platz gekostet, den die zehn
   Stationsspalten besser gebrauchen koennen. */
.matrix-unterzeile {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    color: var(--grau);
    white-space: nowrap;
}

.matrix-unterzeile .code {
    font-family: Consolas, monospace;
    letter-spacing: .1em;
}

.matrix .rechts { text-align: right; }

.matrix-punkte { display: block; font-weight: 700; font-variant-numeric: tabular-nums; }
.matrix-punkte.offen { color: var(--grau); font-weight: 400; }

.matrix-zeit {
    display: block;
    font-size: 12px;
    color: var(--grau);
    font-variant-numeric: tabular-nums;
}

.matrix-leer { color: var(--rand); }

/* Punktabzug fuer zusaetzlich gebrauchte Hinweise. */
.matrix-abzug {
    margin-left: 4px;
    color: var(--rot);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.matrix-abzug.gross { margin-left: 0; }

/* Die Textspalte auf der Seite "Tonaufnahmen" ist die einzige, die umbrechen
   darf - sonst schiebt ein langer Satz die Tabelle beliebig weit nach rechts.
   Sie bekommt den ganzen uebrigen Platz. */
.matrix .transkript-spalte {
    white-space: normal;
    width: 100%;
    min-width: 300px;
}

.transkript-spalte audio {
    height: 30px;
    max-width: 260px;
    vertical-align: middle;
}

.ergebnis-endsumme {
    border-top: 2px solid var(--rand);
    font-size: 17px;
}

/* Legende des Koordinaten-Werkzeugs. */
.legende-station { color: var(--mittel); font-weight: 700; }
.legende-sonst   { color: var(--grau);   font-weight: 700; }

/* Formular des Hinweis-Werkzeugs. */
.hinweis-feld { margin-top: 12px; }

.hinweis-feld label {
    display: block;
    margin-bottom: 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--grau);
}

.hinweis-feld textarea { font: 15px/1.5 inherit; }

.erzeugter-code {
    width: 100%;
    font: 13px/1.5 Consolas, monospace;
}

/* ---------------------------------------------------------- Anleitung --- */

/* SETUP.md als Seite. Zweispaltig: links das Inhaltsverzeichnis, das beim
   Scrollen stehen bleibt, rechts der Text mit begrenzter Zeilenlaenge - der
   Rest der Auswertung nutzt die volle Breite, ein Fliesstext ueber 2000 Pixel
   liest sich aber schlecht. */
.anleitung {
    display: flex;
    align-items: flex-start;
    gap: 32px;
}

.anleitung-inhalt {
    position: sticky;
    top: 16px;
    flex: 0 0 240px;
    max-height: calc(100vh - 40px);
    overflow: auto;
    font-size: 14px;
}

.anleitung-inhalt-kopf {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--grau);
}

.anleitung-inhalt ul { list-style: none; margin: 0; padding: 0; }
.anleitung-inhalt li { margin: 2px 0; }
.anleitung-inhalt li.stufe-3 { padding-left: 14px; font-size: 13px; }
.anleitung-inhalt a { color: var(--mittel); text-decoration: none; }
.anleitung-inhalt a:hover { text-decoration: underline; }

.anleitung-text {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 78ch;
}

.anleitung-text h1 { font-size: 26px; margin: 0 0 12px; }
.anleitung-text h2 { font-size: 21px; margin: 32px 0 10px; padding-top: 8px; border-top: 1px solid var(--rand); }
.anleitung-text h3 { font-size: 17px; margin: 22px 0 8px; color: var(--mittel); }
.anleitung-text hr { border: 0; border-top: 1px solid var(--rand); margin: 24px 0; }

.anleitung-text pre {
    margin: 0 0 14px;
    padding: 12px 14px;
    background: var(--grau-hell);
    border-radius: var(--radius);
    overflow-x: auto;
}

.anleitung-text pre code { font: 13px/1.55 Consolas, monospace; }

.anleitung-text code {
    padding: 1px 5px;
    background: var(--grau-hell);
    border-radius: 5px;
    font: 14px/1.4 Consolas, monospace;
}

.anleitung-text blockquote {
    margin: 0 0 14px;
    padding: 10px 14px;
    background: #fff8ec;
    border-left: 5px solid var(--akzent);
    border-radius: var(--radius);
}

.anleitung-text blockquote > :last-child { margin-bottom: 0; }
.anleitung-text ul, .anleitung-text ol { margin: 0 0 14px; padding-left: 22px; }
.anleitung-text li { margin-bottom: 4px; }
.anleitung-text a { color: var(--mittel); }
.anleitung-text .tabelle-rahmen { max-width: 100%; }

/* Auf schmalen Fenstern untereinander. */
@media (max-width: 900px) {
    .anleitung { display: block; }
    .anleitung-inhalt { position: static; max-height: none; margin-bottom: 20px; }
}

/* -------------------------------------------------- Auswertungshilfe --- */

/* Steht in der Spielleitung zwischen den Antworten der Gruppe und dem
   Punktefeld - genau da, wo entschieden wird. Deutlich abgesetzt, damit sie
   nicht mit den Antworten der Gruppe verwechselt wird. */
.auswertungshilfe {
    margin: 16px 0 0;
    padding: 12px 14px;
    background: #fff8ec;
    border: 1px solid #f0d9b0;
    border-left: 5px solid var(--akzent);
    border-radius: var(--radius);
    font-size: 15px;
}

.auswertungshilfe-kopf {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--grau);
}

.auswertungshilfe p:last-child,
.auswertungshilfe ul:last-child { margin-bottom: 0; }

.auswertungshilfe ul { margin: 0 0 10px; padding-left: 20px; }

.berechnen-knopf {
    display: inline-block;
    width: auto;
    margin: 0;
    padding: 8px 16px;
    font-size: 14px;
}

.zeilen-knoepfe {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.bearbeiten-knopf,
.loeschen-knopf {
    display: inline-block;
    width: auto;
    margin: 0;
    padding: 6px 12px;
    font-size: 13px;
    border-color: var(--rand);
    white-space: nowrap;
}

.bearbeiten-knopf { text-decoration: none; }
.bearbeiten-knopf:hover { border-color: var(--mittel); }

.loeschen-knopf { color: var(--rot); }

.loeschen-knopf:hover { border-color: var(--rot); }

.leitung-tabelle {
    width: 100%;
    border-collapse: collapse;
    background: var(--karte);
    border: 1px solid var(--rand);
    border-radius: var(--radius);
    overflow: hidden;
    font-size: 15px;
}

.leitung-tabelle th,
.leitung-tabelle td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--grau-hell);
    text-align: left;
}

.leitung-tabelle th {
    background: var(--grau-hell);
    font-size: 13px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--grau);
}

.leitung-tabelle tr:last-child td { border-bottom: 0; }
.leitung-tabelle .rechts { text-align: right; }
.leitung-tabelle .code { letter-spacing: .1em; font-family: Consolas, monospace; }
.leitung-tabelle a { color: var(--mittel); text-decoration: none; white-space: nowrap; }
.offen { color: var(--grau); font-size: 14px; font-weight: 400; }

.leitung-station {
    background: var(--karte);
    border: 1px solid var(--rand);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
}

.leitung-station.offen { background: var(--grau-hell); border-style: dashed; }

/* Jede Station ist ein eigener Aufklapper: bewertet = zu, offen = auf. Der
   Kopf ist das <summary> und damit die ganze Zeile anklickbar. */
.leitung-station-kopf {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    /* Eigenes Dreieck statt des eingebauten - siehe .ausklapp. */
    list-style: none;
}

.leitung-station-kopf::-webkit-details-marker { display: none; }

.leitung-station-kopf::after {
    content: "";
    flex: 0 0 auto;
    width: 0;
    height: 0;
    margin-left: 4px;
    border-left: 7px solid var(--grau);
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    transition: transform .15s ease;
}

.leitung-station[open] > .leitung-station-kopf::after { transform: rotate(90deg); }

.leitung-station[open] > .leitung-station-kopf { margin-bottom: 4px; }

.leitung-station-kopf:focus-visible {
    outline: 3px solid var(--fokus);
    outline-offset: 3px;
    border-radius: 6px;
}

/* Punktestand rechts im Kopf - damit man zugeklappt sieht, was drinsteht. */
.station-stand {
    margin-left: auto;
    flex: 0 0 auto;
    font-size: 15px;
    color: var(--grau);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.station-stand strong { color: inherit; font-size: 17px; }

.leitung-punkte {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--rand);
}

.leitung-punkte label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

.leitung-punkte-eingabe {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.leitung-punkte-eingabe input { width: 100px; }
.leitung-punkte-eingabe span { color: var(--grau); }

.vorschlag-knopf {
    width: auto;
    margin-top: 0;
    padding: 10px 14px;
    font-size: 14px;
    white-space: nowrap;
}
