/* stil.css - Kassenzähl-Cockpit
 *
 * Gebaut für eine Hand, im Stehen, am Automaten, mit Handschuh, bei Sonne.
 * Alles andere ist zweitrangig.
 *
 * Die Zahlen sind nicht gegriffen:
 *  - Tapziel 56 px statt der üblichen 44. Ein behandschuhter Finger deckt
 *    15-18 mm ab, ein nackter 9-11 mm; 44 px sind rund 8 mm und liegen
 *    darunter. Primäraktionen bekommen 72 px, Weichen 96 px.
 *  - Mindestlücke 12 px, weil der häufigste Fehler der Nachbartreffer ist.
 *  - Eingabeschrift 17 px, sonst zoomt iOS-Safari das Layout kaputt.
 *  - Kontrast mindestens 7:1 (AAA) statt 4,5:1, weil Reflexion im Freien den
 *    Kontrast halbiert.
 *  - Gold #FAA819 hat auf Weiß nur 1,9:1 und ist deshalb als TEXTFARBE
 *    verboten. Es trägt immer Anthrazit-Text (≈ 8,7:1).
 *
 * Kein Framework, kein Bauschritt, keine fremde Herkunft. Die Richtlinie im
 * Server erlaubt kein Inline-CSS - deshalb steht hier wirklich alles.
 */

@font-face {
  font-family: 'Montserrat';
  src: url('../schrift/montserrat-400.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  src: url('../schrift/montserrat-600.woff2') format('woff2');
  font-weight: 600; font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  src: url('../schrift/montserrat-700.woff2') format('woff2');
  font-weight: 700; font-display: swap;
}

:root {
  --gold: #FAA819;
  --gold-tief: #8A5A08;
  --ink: #231F20;
  --gruen: #17692C;
  --gelb: #8A5A08;
  --rot: #A3231F;
  --bg: #FCF1DA;
  --flaeche: #FFFFFF;
  --linie: #C9BFAE;
  --text: #231F20;
  --text-leise: #4A4340;

  --tap-min: 56px;
  --tap-primaer: 72px;
  --tap-weiche: 96px;
  --abstand: 12px;
  --fs-input: 17px;
  --fs-zahl: 64px;
  --fs-gross: 34px;
  --radius: 14px;
  --unten: env(safe-area-inset-bottom, 0px);
  --oben: env(safe-area-inset-top, 0px);
}

/* Sonnenmodus: eigener Schalter, NICHT an prefers-color-scheme gekoppelt.
   Draußen ist es hell, egal was das Gerät über die Uhrzeit denkt. */
html[data-modus='sonne'] {
  --bg: #FFFFFF; --flaeche: #FFFFFF; --text: #000000; --text-leise: #1A1A1A;
  --linie: #000000; --gruen: #0B5A22; --gelb: #6B4405; --rot: #8C1A16;
}
html[data-modus='dunkel'] {
  --bg: #141211; --flaeche: #221F1E; --text: #F4EFE7; --text-leise: #CFC7BC;
  --linie: #4A423C; --gruen: #4CB963; --gelb: #E0A21A; --rot: #F2554A;
  --gold: #FAA819; --gold-tief: #FFCB6B;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg); color: var(--text);
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: var(--fs-input);
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

body { padding-top: var(--oben); }

/* Zahlen laufen nie: gleiche Ziffernbreite, sonst zappelt die Live-Summe */
.zahl, .summe, .kachel-wert, .schrittzahl {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

/* ---------------------------------------------------------------- Gerüst */
.rahmen { display: flex; flex-direction: column; min-height: 100dvh; }

.kopf {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; min-height: var(--tap-min);
  background: var(--flaeche); border-bottom: 2px solid var(--linie);
  position: sticky; top: 0; z-index: 10;
}
.kopf h1 { font-size: 18px; margin: 0; font-weight: 700; flex: 1;
           overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.fortschritt { height: 8px; background: var(--linie); }
.fortschritt > i { display: block; height: 100%; background: var(--gold);
                   transition: width 90ms linear; }

.buehne { flex: 1; padding: 16px 12px 8px; }
.fuss {
  display: flex; gap: var(--abstand); padding: 12px;
  padding-bottom: calc(12px + var(--unten));
  background: var(--flaeche); border-top: 2px solid var(--linie);
  position: sticky; bottom: 0;
}

/* --------------------------------------------------------------- Knöpfe */
button {
  font: inherit; font-weight: 600; color: var(--text);
  background: var(--flaeche); border: 2px solid var(--linie);
  border-radius: var(--radius); min-height: var(--tap-min);
  min-width: var(--tap-min); padding: 8px 14px; cursor: pointer;
  touch-action: manipulation;
}
button:active { transform: translateY(1px); }
button:focus-visible { outline: 3px solid var(--gold-tief); outline-offset: 2px; }

.primaer {
  min-height: var(--tap-primaer); flex: 1;
  background: var(--gold); border-color: var(--gold-tief);
  color: var(--ink); font-weight: 700; font-size: 19px;
}
.zurueck { min-height: var(--tap-primaer); min-width: 96px; }
.weiche { min-height: var(--tap-weiche); flex: 1; font-size: 19px; }
.gefahr { border-color: var(--rot); color: var(--rot); }
button[disabled] { opacity: .45; cursor: not-allowed; }

/* --------------------------------------------------- Ein Wert, ein Bild */
.sorte { text-align: center; }
.sorte .muenze {
  width: 84px; height: 84px; margin: 0 auto 8px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 20px;
  border: 3px solid var(--gold-tief); background: var(--gold); color: var(--ink);
}
.sorte .muenze.schein { border-radius: 8px; width: 120px; height: 68px;
                        background: var(--flaeche); color: var(--text); }
.sorte .name { color: var(--text-leise); font-size: 15px; }
.sorte .zahl { font-size: var(--fs-zahl); font-weight: 700; line-height: 1.05; }
.sorte .teilsumme { font-size: 20px; font-weight: 600; color: var(--gold-tief); }
.sorte .laufsumme { font-size: 15px; color: var(--text-leise); margin-top: 6px; }
@media (max-height: 700px) { .sorte .zahl { font-size: 48px; } }

/* ---------------------------------------------------------- Ziffernblock */
.block { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
         margin-top: 12px; }
.block button { height: var(--tap-primaer); font-size: 26px; font-weight: 700; }
.block .null-weiter { background: var(--gold); border-color: var(--gold-tief);
                      color: var(--ink); font-size: 18px; }

/* -------------------------------------------------- Kacheln (Schnellgang) */
.kacheln { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--abstand); }
.kachel { background: var(--flaeche); border: 2px solid var(--linie);
          border-radius: var(--radius); padding: 10px; }
.kachel .kopfzeile { display: flex; justify-content: space-between;
                     align-items: baseline; }
.kachel .titel { font-weight: 700; font-size: 18px; }
.kachel .kachel-wert { font-size: var(--fs-gross); font-weight: 700;
                       text-align: center; margin: 2px 0; }
.kachel .euro { text-align: center; font-size: 15px; color: var(--text-leise); }
.kachel .pm { display: flex; gap: 10px; margin-top: 8px; }
.kachel .pm button { flex: 1; height: var(--tap-primaer); font-size: 28px; }
.kachel .erwartet { font-size: 13px; color: var(--text-leise); text-align: center; }

/* Mehrere Knöpfe nebeneinander brauchen den Mindestabstand - sonst trifft
   der behandschuhte Finger den Nachbarn. Nebeneinandergestellte Knöpfe ohne
   diese Klasse hat das Ergonomie-Gate sofort gemeldet (11.08.2026). */
/* 16 statt 12 px: die 12 sind das MINDESTMASS, kein Ziel. Bei exakt 12 lag
   der gemessene Abstand durch Teilpixel knapp darunter und das Gate schlug an
   - zu Recht. */
.knopfreihe { display: flex; gap: 16px; flex-wrap: wrap; margin: 16px 0; }
.knopfreihe > button { flex: 1 1 auto; }

/* ------------------------------------------------------------- Listen */
.liste { display: flex; flex-direction: column; gap: 10px; }
.karte {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 88px; text-align: left; padding: 12px;
  background: var(--flaeche); border: 2px solid var(--linie);
  border-radius: var(--radius);
}
.karte .haupt { flex: 1; min-width: 0; }
.karte .name { font-weight: 700; font-size: 18px;
               overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.karte .neben { color: var(--text-leise); font-size: 15px; }
.karte .betrag { font-weight: 700; font-size: 20px; }

/* Ampel: nie nur Farbe. Immer Farbe + Zeichen + Wort. */
.ampel { display: inline-flex; align-items: center; gap: 6px;
         font-weight: 700; font-size: 15px; }
.ampel::before { font-size: 18px; }
.ampel.gruen  { color: var(--gruen); } .ampel.gruen::before  { content: '●'; }
.ampel.gelb   { color: var(--gelb); }  .ampel.gelb::before   { content: '▲'; }
.ampel.rot    { color: var(--rot); }   .ampel.rot::before    { content: '■'; }
.ampel.grau   { color: var(--text-leise); } .ampel.grau::before { content: '□'; }
.ampel.schwarz{ color: var(--text); }  .ampel.schwarz::before{ content: '▬'; }

/* --------------------------------------------------------------- Zeilen */
.feld { margin-bottom: var(--abstand); }
.feld label { display: block; font-weight: 600; margin-bottom: 6px; }
input, select, textarea {
  font: inherit; font-size: var(--fs-input); width: 100%;
  min-height: var(--tap-min); padding: 10px 12px;
  border: 2px solid var(--linie); border-radius: var(--radius);
  background: var(--flaeche); color: var(--text);
}
textarea { min-height: 96px; }

.hinweis { padding: 12px; border-radius: var(--radius);
           border: 2px solid var(--linie); background: var(--flaeche);
           margin-bottom: var(--abstand); }
.hinweis.wichtig { border-color: var(--gold-tief); border-width: 3px; }
.hinweis.fehler { border-color: var(--rot); color: var(--rot); font-weight: 600; }
.hinweis h2 { font-size: 17px; margin: 0 0 6px; }

.rechenkette { width: 100%; border-collapse: collapse; }
.rechenkette td { padding: 6px 0; border-bottom: 1px solid var(--linie); }
.rechenkette td:last-child { text-align: right; font-weight: 700;
                             font-variant-numeric: tabular-nums; }
.rechenkette tr.ergebnis td { font-size: 20px; border-bottom: none; }

.streifen { padding: 8px 12px; font-weight: 600; text-align: center;
            background: var(--gold); color: var(--ink); }
.streifen.aus { background: var(--rot); color: #fff; }

.leise { color: var(--text-leise); font-size: 15px; }
.verborgen { display: none !important; }

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