/* Analysewerkzeug FC Aldekerk -- dunkles TV-Design.
 *
 * Eine Datei für die ganze App-Hülle und die Ansichten Start, Konto,
 * Szenensuche und Hilfe. Editor und Vorführen bringen ihr eigenes Stück
 * Stil mit (eigene Datei oder <style> in ihrer Ansicht), benutzen aber
 * dieselben Farben und Knöpfe: alles läuft über die Variablen unten.
 *
 * Farben: Hintergrund fast schwarz wie ein Fernsehstudio. Die Hauptfarbe
 * markiert, was man bedienen soll: gefüllte Knöpfe in `--haupt` (Dunkelblau
 * #010C78, Wunsch des Benutzers vom 12.10.2026 -- vorher Gelb #ffd200),
 * Schrift, Ränder und Fokus in `--akzent`, einem hellen Blau desselben
 * Farbtons, weil #010C78 auf fast Schwarz nicht zu lesen wäre. Grün (Rasen)
 * steht für "in Ordnung/gespeichert", Rot nur für Fehler und Löschen. Die
 * Grafik im Video (Ringe, Pfeile, ...) bleibt gelb -- das ist Spielfeld,
 * nicht Bedienung.
 *
 * Handy UND Laptop: Mindestgröße der Bedienflächen 40 px (Daumen),
 * Spalten brechen unter 720 px Breite in eine Spalte um, nichts muss
 * quer gescrollt werden.
 */

:root {
  --haupt: #010c78;        /* gefüllte Flächen (Primärknöpfe), Schrift darauf weiß */
  --haupt-hell: #1a2aa8;   /* Hover der gefüllten Flächen */
  --akzent: #8c98ff;       /* Schrift, Ränder, Fokus auf dunklem Grund */
  --akzent-dunkel: #3a47b0;
  --akzent-tint: #12173f;  /* dunkel getönte Flächen (gewählt, Hinweis) */
  --gruen: #2fbf4a;
  --rot: #ff5d5d;
  --hg: #0c0f14;
  --hg2: #161b22;
  --hg3: #1f2630;
  --rand: #2a313c;
  --text: #e8e8e8;
  --text-leise: #9aa4b2;
  --radius: 8px;
  --schrift: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--hg);
  color: var(--text);
  font-family: var(--schrift);
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

body { overflow-x: hidden; }

/* `display: flex` o. ä. auf einer Klasse überstimmt sonst das Attribut `hidden`
   (die Kopfzeile blieb im Vollbild stehen). */
[hidden] { display: none !important; }

h1, h2, h3 { margin: 0 0 8px; line-height: 1.2; }
h1 { font-size: 1.6rem; color: var(--akzent); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; color: var(--akzent); }
p { margin: 0 0 10px; }
a { color: var(--akzent); }
small, .leise { color: var(--text-leise); }

/* ------------------------------------------------------------ Hülle */

.app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }

.laedt { margin: 40px auto; color: var(--text-leise); text-align: center; padding: 0 16px; }
.laedt.fehler { color: var(--rot); }

.kopfzeile {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  background: var(--hg2);
  border-bottom: 2px solid var(--akzent);
  position: sticky; top: 0; z-index: 20;
}
.kopfzeile img { height: 34px; width: auto; }
.kopfzeile .titel { font-weight: 700; color: var(--akzent); font-size: 1.05rem; white-space: nowrap; }
.kopfzeile .platz { flex: 1; }
.kopfzeile nav { display: flex; gap: 6px; flex-wrap: wrap; }

.inhalt { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 16px 14px 40px; }
.inhalt.breit { max-width: none; padding: 10px 10px 30px; }
.inhalt.voll { max-width: none; padding: 0; min-height: 0; }

/* "offline": gelb-grau, auffällig, aber kein Alarm -- offline ist ein
   normaler Zustand (Kabine ohne Netz), kein Fehler. */
.offline-pille {
  display: none;
  background: var(--akzent-tint); color: var(--akzent);
  border: 1px solid var(--akzent-dunkel); border-radius: 999px;
  padding: 3px 12px; font-size: 0.85rem; white-space: nowrap;
}
.app[data-offline="ja"] .offline-pille { display: inline-block; }

/* ------------------------------------------------------- Meldungen */

.meldungen {
  position: fixed; left: 0; right: 0; bottom: 12px; z-index: 50;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  pointer-events: none; padding: 0 12px;
}
.meldung {
  pointer-events: auto;
  max-width: 560px; width: 100%;
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--hg3); border: 1px solid var(--rand); border-left: 5px solid var(--akzent);
  border-radius: var(--radius); padding: 10px 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
}
.meldung.ok { border-left-color: var(--gruen); }
.meldung.fehler { border-left-color: var(--rot); }
.meldung .text { flex: 1; }
.meldung button { min-height: 30px; padding: 2px 10px; }

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

button, .knopf {
  font-family: inherit; font-size: 0.95rem; color: var(--text);
  background: var(--hg3); border: 1px solid var(--rand); border-radius: 6px;
  padding: 8px 14px; min-height: 40px; min-width: 40px;
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
button:hover, .knopf:hover { border-color: var(--akzent); }
button:focus-visible, .knopf:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--akzent); outline-offset: 1px;
}
button:disabled { opacity: 0.45; cursor: default; border-color: var(--rand); }
button.primaer { background: var(--haupt); color: #fff; border-color: var(--akzent-dunkel); font-weight: 700; }
button.primaer:hover { background: var(--haupt-hell); }
button.primaer:hover { background: #ffe14d; }
button.gefahr { color: var(--rot); }
button.gefahr:hover { border-color: var(--rot); }
button.klein { min-height: 32px; padding: 3px 10px; font-size: 0.85rem; }
button.text { background: transparent; border-color: transparent; color: var(--akzent); padding: 4px 6px; min-height: 32px; }
button.text:hover { text-decoration: underline; border-color: transparent; }

/* ------------------------------------------------------- Formulare */

label { display: block; font-size: 0.9rem; color: var(--text-leise); margin: 10px 0 4px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--text);
  background: var(--hg); border: 1px solid var(--rand); border-radius: 6px;
  padding: 9px 10px; min-height: 40px;
}
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--akzent); }
textarea { resize: vertical; min-height: 70px; }
.formular { max-width: 420px; }
.formular .knoepfe { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.fehlertext { color: var(--rot); min-height: 1.3em; margin: 8px 0 0; }

/* ----------------------------------------------------------- Karten */

.karte {
  background: var(--hg2); border: 1px solid var(--rand); border-radius: var(--radius);
  padding: 14px; margin-bottom: 14px;
}
.karte > h2:first-child, .karte > h3:first-child { margin-top: 0; }
.karte.anmeldung { max-width: 440px; margin: 30px auto; }
.karte.anmeldung .wappen { display: block; height: 90px; margin: 0 auto 10px; }

.raster { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.raster.drei { grid-template-columns: repeat(3, 1fr); }

.liste { list-style: none; margin: 0; padding: 0; }
.liste > li {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 4px; border-top: 1px solid var(--rand);
}
.liste > li:first-child { border-top: 0; }
.liste .haupt { flex: 1; min-width: 160px; }
.liste .haupt b { display: block; }
.liste .aktionen { display: flex; gap: 6px; flex-wrap: wrap; }
.leer { color: var(--text-leise); padding: 8px 4px; }

.pille {
  display: inline-block; font-size: 0.78rem; padding: 1px 9px; border-radius: 999px;
  background: var(--hg3); border: 1px solid var(--rand); color: var(--text-leise); white-space: nowrap;
}
.pille.gelb { color: var(--akzent); border-color: var(--akzent-dunkel); }
.pille.gruen { color: var(--gruen); border-color: #1f7a31; }
.pille.rot { color: var(--rot); border-color: #8a3030; }

.hinweis {
  background: var(--akzent-tint); border: 1px solid var(--akzent-dunkel); border-radius: var(--radius);
  padding: 10px 12px; margin-bottom: 12px;
}
.hinweis.rot { background: #2a1414; border-color: #8a3030; }
.hinweis.gruen { background: #112016; border-color: #1f7a31; }
.hinweis .knoepfe { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.kopf-aktion { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.kopf-aktion h1 { margin: 0; flex: 1; }

/* ----------------------------------------------------------- Dialog */

dialog {
  background: var(--hg2); color: var(--text);
  border: 1px solid var(--akzent-dunkel); border-radius: var(--radius);
  padding: 18px; max-width: min(480px, calc(100vw - 24px));
}
dialog::backdrop { background: rgba(0, 0, 0, 0.65); }
dialog .knoepfe { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 14px; }

/* Szene mitnehmen: Größe, Fortschritt, Stand je Szene */
dialog.mitnahme { width: min(460px, calc(100vw - 24px)); }
dialog.mitnahme h3 { margin: 0 0 10px; }
dialog.mitnahme progress { width: 100%; height: 14px; }
dialog.mitnahme .klein { color: var(--text-leise, inherit); opacity: 0.8; font-size: 0.85rem; }
dialog.mitnahme #mn-groesse { font-size: 1.15rem; font-weight: 600; }
dialog.mitnahme li[data-da="ja"]::before { content: "\2713  "; }
dialog.mitnahme li[data-da="nein"]::before { content: "\2013  "; }
button[data-mitgenommen="ja"] { border-color: var(--akzent-dunkel); }

/* Als Video exportieren: Wahl, Größe vorher, Fortschritt, Ergebnis */
dialog.exportdialog { width: min(480px, calc(100vw - 24px)); }
dialog.exportdialog h3 { margin: 0 0 10px; }
dialog.exportdialog progress { width: 100%; height: 14px; }
dialog.exportdialog .klein { opacity: 0.8; font-size: 0.85rem; margin: 4px 0; }
dialog.exportdialog .ex-feld { border: 1px solid var(--rand); border-radius: var(--radius); margin: 0 0 8px; padding: 6px 10px; }
dialog.exportdialog .ex-option { display: block; padding: 4px 0; }
dialog.exportdialog .ex-kosten { margin: 10px 0 2px; }
dialog.exportdialog #ex-groesse { display: inline; font-size: 1.15rem; font-weight: 600; }
dialog.exportdialog .ex-warnung { border-left: 3px solid var(--akzent-dunkel); padding-left: 8px; font-size: 0.9rem; }

/* ------------------------------------------------------- Szenensuche */

.sz-buehne { background: #000; border-radius: var(--radius); overflow: hidden; position: relative; }
.sz-buehne canvas { display: block; width: 100%; height: auto; aspect-ratio: 1920 / 720; background: #000; }
.sz-buehne .bildtext {
  position: absolute; left: 8px; bottom: 6px; background: rgba(0, 0, 0, 0.65);
  border-radius: 4px; padding: 2px 8px; font-size: 0.85rem; font-variant-numeric: tabular-nums;
}
.sz-buehne .bildmeldung {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 20px; color: var(--text-leise); background: rgba(0, 0, 0, 0.7);
}
.sz-buehne .bildmeldung[hidden] { display: none; }

.sz-steuerung { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
.sz-steuerung .zeit { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text-leise); }

.zeitleiste {
  position: relative; height: 64px; margin: 6px 0 4px;
  background: var(--hg2); border: 1px solid var(--rand); border-radius: var(--radius);
  touch-action: none; cursor: pointer; user-select: none;
}
.zeitleiste .abschnitt {
  position: absolute; top: 28px; height: 14px; background: #27405f; border-radius: 3px;
}
.zeitleiste .luecke { position: absolute; top: 28px; height: 14px; border-radius: 3px;
  background: repeating-linear-gradient(135deg, #2a313c 0 4px, #161b22 4px 8px); }
.zeitleiste .ereignis {
  position: absolute; top: 4px; transform: translateX(-50%);
  font-size: 0.72rem; color: var(--text); text-align: center; line-height: 1.1; pointer-events: none;
  white-space: nowrap;
}
.zeitleiste .ereignis::after {
  content: ""; display: block; width: 2px; height: 14px; margin: 1px auto 0; background: currentColor;
}
.zeitleiste .ereignis.tor { color: var(--gruen); }
.zeitleiste .ereignis.tor.gegner { color: var(--rot); }
.zeitleiste .ereignis.pfiff { color: var(--text-leise); }
.zeitleiste .marke { position: absolute; top: 42px; width: 12px; height: 18px; margin-left: -6px; pointer-events: none;
  background: var(--akzent); clip-path: polygon(50% 0, 100% 40%, 100% 100%, 0 100%, 0 40%); }
.zeitleiste .marke.gewaehlt { background: var(--gruen); }
.zeitleiste .szenenband { position: absolute; top: 24px; height: 22px; background: rgba(47, 191, 74, 0.28);
  border: 1px solid var(--gruen); border-radius: 3px; pointer-events: none; }
.zeitleiste .stand { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--akzent); pointer-events: none; }
.zeitleiste .vorschau {
  position: absolute; bottom: calc(100% + 6px); width: 160px; height: 60px; transform: translateX(-50%);
  border: 2px solid var(--akzent); border-radius: 4px; background-color: #000; background-repeat: no-repeat;
  pointer-events: none; display: none; z-index: 5;
}
.zeitleiste .vorschau span {
  position: absolute; left: 0; right: 0; bottom: -20px; text-align: center; font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.75); border-radius: 3px; padding: 0 4px; margin: 0 auto; width: max-content;
  left: 50%; transform: translateX(-50%);
}

.marken-liste { list-style: none; margin: 0; padding: 0; }
.marken-liste li { display: flex; align-items: center; gap: 8px; padding: 6px 2px; border-top: 1px solid var(--rand); }
.marken-liste li:first-child { border-top: 0; }
.marken-liste input[type="text"] { flex: 1; min-width: 0; min-height: 34px; padding: 4px 8px; }
.marken-liste .k { font-variant-numeric: tabular-nums; color: var(--text-leise); min-width: 4.5em; }
.marken-liste input[type="checkbox"] { width: 22px; height: 22px; }

/* ------------------------------------------------------------ Hilfe */

.hilfe h2 { margin-top: 22px; }
.hilfe ul, .hilfe ol { margin: 0 0 10px; padding-left: 22px; }
.hilfe li { margin-bottom: 4px; }
.hilfe .taste { display: inline-block; border: 1px solid var(--rand); border-bottom-width: 2px; border-radius: 4px;
  padding: 0 6px; font-size: 0.85rem; background: var(--hg3); }

.einfuehrung {
  position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, 0.8);
  display: flex; align-items: center; justify-content: center; padding: 12px;
}
.einfuehrung .tafel {
  background: var(--hg2); border: 2px solid var(--akzent); border-radius: 12px;
  max-width: 560px; width: 100%; padding: 22px; max-height: 100%; overflow: auto;
}
.einfuehrung .punkte { display: flex; gap: 6px; justify-content: center; margin: 10px 0 0; }
.einfuehrung .punkte i { width: 9px; height: 9px; border-radius: 50%; background: var(--rand); display: block; }
.einfuehrung .punkte i.jetzt { background: var(--akzent); }
.einfuehrung .knoepfe { display: flex; gap: 8px; justify-content: space-between; flex-wrap: wrap; margin-top: 16px; }

/* --------------------------------------------------------- Handybreite */

@media (max-width: 720px) {
  .raster, .raster.drei { grid-template-columns: 1fr; }
  .inhalt { padding: 12px 10px 40px; }
  .kopfzeile { padding: 6px 10px; gap: 6px; }
  .kopfzeile .titel { display: none; }
  h1 { font-size: 1.35rem; }
  .zeitleiste .ereignis { font-size: 0.66rem; }
  .meldungen { bottom: 6px; }
}
