/* ============================================================
   MISSION GLEISDREIECK — Styles
   Bewusst hell gehalten: Die App wird draußen bei Tageslicht
   benutzt, da gewinnt maximaler Kontrast gegen Dark Mode.
   ============================================================ */

:root {
  --bg: #F2F4EA;
  --surface: #FFFFFF;
  --surface2: #E9EDDA;
  --ink: #1B2B23;
  --ink-soft: #55655A;
  --line: #CBD3BC;
  --leaf: #B3C532;
  --leaf-ink: #55650F;
  --signal: #C2372F;
  --signal-dark: #9E2A23;
  --ok: #2F7D4F;
  --warn: #B07A18;
  --radius: 12px;
  --tap: 52px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { background: var(--bg); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Barlow", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  padding-bottom: env(safe-area-inset-bottom);
}

h1, h2, h3 {
  font-family: "Barlow Condensed", "Arial Narrow", sans-serif;
  line-height: 1.08;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: 40px; font-weight: 700; letter-spacing: .3px; }
h2 { font-size: 27px; font-weight: 600; }
h3 { font-size: 21px; font-weight: 600; }
p { margin: 0 0 12px; }

.wrap { max-width: 640px; margin: 0 auto; padding: 20px 16px 40px; }

.eyebrow {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2.2px;
  font-size: 13px;
  color: var(--leaf-ink);
}

.muted { color: var(--ink-soft); }
.small { font-size: 14.5px; }
.center { text-align: center; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-variant-numeric: tabular-nums; }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
  padding-top: calc(10px + env(safe-area-inset-top));
}
.topbar .teamchip {
  background: var(--surface2);
  border-radius: 999px;
  padding: 4px 13px;
  font-weight: 600;
  font-size: 14.5px;
  white-space: nowrap;
  max-width: 55%;
  overflow: hidden; text-overflow: ellipsis;
}
.topbar .fortschritt {
  margin-left: auto;
  font-size: 14.5px;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- Karten ---------- */
.karte {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.karte.flach { background: var(--surface2); border-color: transparent; }

/* ---------- Buttons ---------- */
button, .btn {
  font-family: inherit;
  font-size: 17px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid transparent;
  min-height: var(--tap);
  padding: 13px 20px;
  cursor: pointer;
  width: 100%;
  display: block;
  text-align: center;
  text-decoration: none;
  transition: transform .06s ease, background-color .12s ease;
}
button:active, .btn:active { transform: scale(.985); }
button:focus-visible, .btn:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--leaf);
  outline-offset: 2px;
}

.btn-primary { background: var(--signal); color: #fff; }
.btn-primary:hover { background: var(--signal-dark); }
.btn-secondary { background: var(--surface2); color: var(--ink); border-color: var(--line); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
button:disabled { opacity: .45; cursor: not-allowed; }

.btn-reihe { display: flex; gap: 10px; }
.btn-reihe > * { flex: 1; }

/* ---------- Eingaben ---------- */
input[type="text"], input[type="number"], input[type="password"], textarea, select {
  font-family: inherit;
  font-size: 17px;
  width: 100%;
  padding: 13px 14px;
  min-height: var(--tap);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
}
textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 15.5px; }
.feld { margin-bottom: 16px; }

/* ---------- Antwortoptionen ---------- */
.option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 9px;
  cursor: pointer;
  min-height: var(--tap);
  font-size: 16.5px;
  line-height: 1.45;
  text-align: left;
  width: 100%;
  font-weight: 400;
}
.option:hover { border-color: var(--leaf); }
.option.gewaehlt { border-color: var(--signal); background: #FDF3F2; }
.option .marke {
  flex: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: 2px solid var(--line);
  margin-top: 1px;
}
.option.gewaehlt .marke { border-color: var(--signal); background: var(--signal); box-shadow: inset 0 0 0 4px #fff; }

/* ---------- Sortieren ---------- */
.sortier-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.4;
}
.sortier-item .pos {
  flex: none;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--surface2);
  font-weight: 700;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  font-family: "Barlow Condensed", sans-serif;
}
.sortier-item .txt { flex: 1; }
.pfeile { display: flex; flex-direction: column; gap: 4px; flex: none; }
.pfeile button {
  width: 40px; min-height: 30px; padding: 0;
  font-size: 16px; line-height: 1;
  background: var(--surface2); border: 1px solid var(--line); color: var(--ink);
  border-radius: 7px;
}

/* ---------- Textpaare (KI-Station) ---------- */
.paar { margin-bottom: 20px; }
.paar .thema {
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 600; text-transform: uppercase;
  letter-spacing: 1.5px; font-size: 13px;
  color: var(--leaf-ink); margin-bottom: 8px;
}
.textbox {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 9px;
  cursor: pointer;
  font-size: 15.5px;
  line-height: 1.55;
  text-align: left;
  width: 100%;
  font-weight: 400;
  min-height: auto;
}
.textbox .kopf {
  display: block;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700; font-size: 15px;
  letter-spacing: 1px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.textbox.gewaehlt { border-color: var(--signal); background: #FDF3F2; }
.textbox.gewaehlt .kopf { color: var(--signal); }

/* ---------- Stationsliste ---------- */
.stationszeile {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  width: 100%;
  text-align: left;
  font-weight: 400;
  min-height: auto;
}
.stationszeile .nummer {
  flex: none;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--signal); color: #fff;
  font-family: "Barlow Condensed", sans-serif;
  font-weight: 700; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.stationszeile.erledigt .nummer { background: var(--ok); }
.stationszeile.gesperrt { opacity: .55; }
.stationszeile.gesperrt .nummer { background: var(--ink-soft); }
.stationszeile .info { flex: 1; min-width: 0; }
.stationszeile .name { font-weight: 600; font-size: 17.5px; font-family: "Barlow Condensed", sans-serif; }
.stationszeile .ort { font-size: 14px; color: var(--ink-soft); }
.stationszeile .status { flex: none; font-size: 13.5px; color: var(--ink-soft); text-align: right; }

/* ---------- Hinweisboxen ---------- */
.hinweis {
  border-left: 4px solid var(--leaf);
  background: var(--surface2);
  border-radius: 0 8px 8px 0;
  padding: 12px 14px;
  margin: 14px 0;
  font-size: 15.5px;
}
.hinweis.warn { border-left-color: var(--warn); background: #FBF3E0; }
.hinweis.ok { border-left-color: var(--ok); background: #EAF4ED; }
.hinweis.fehler { border-left-color: var(--signal); background: #FDF3F2; }
.hinweis strong { font-weight: 600; }

/* ---------- Fortschrittsbalken ---------- */
.balken { height: 6px; background: var(--surface2); border-radius: 99px; overflow: hidden; margin: 14px 0; }
.balken > span { display: block; height: 100%; background: var(--leaf); transition: width .3s ease; }

/* ---------- Guide-Bereich ---------- */
.guide-box {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 16px;
  background: var(--surface2);
  margin-top: 16px;
}
.guide-box .label {
  font-family: "Barlow Condensed", sans-serif;
  text-transform: uppercase; letter-spacing: 1.8px;
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  margin-bottom: 10px;
}
.wertungsliste { list-style: none; padding: 0; margin: 12px 0 0; }
.wertungsliste li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 7px 0; border-bottom: 1px solid var(--line);
  font-size: 15.5px;
}
.wertungsliste li:last-child { border-bottom: none; }
.wertungsliste .p { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Tabellen (Orga) ---------- */
.tabellenbox { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 16px; }
th, td { text-align: left; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
th {
  font-family: "Barlow Condensed", sans-serif;
  text-transform: uppercase; letter-spacing: 1.2px;
  font-size: 13px; color: var(--ink-soft); font-weight: 600;
}
td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; padding-right: 0; }

/* ---------- Podest ---------- */
.platz {
  display: flex; align-items: center; gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
}
.platz .rang {
  flex: none; width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface2);
  font-family: "Barlow Condensed", sans-serif;
  font-size: 24px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.platz.sieger { border-color: var(--leaf); border-width: 2px; }
.platz.sieger .rang { background: var(--leaf); color: #2B3406; }
.platz .name { font-family: "Barlow Condensed", sans-serif; font-size: 23px; font-weight: 600; flex: 1; }
.platz .punkte { font-size: 23px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- Diverses ---------- */
.versteckt { display: none !important; }
.sync-hinweis {
  position: fixed; left: 12px; right: 12px; bottom: 12px;
  background: var(--ink); color: #fff;
  border-radius: 10px; padding: 11px 15px;
  font-size: 14.5px; z-index: 50;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.trenner { height: 1px; background: var(--line); margin: 24px 0; border: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
