/* Ortskunde-Simulator – gemeinsames Stylesheet (Leitung, Teams, Startseite) */
:root {
  --rot: #c8102e;
  --rot-dunkel: #9d0c24;
  --rot-hell: #fdecef;
  --tinte: #1b1f24;
  --text: #22272e;
  --text-leise: #5d6671;
  --linie: #dde1e6;
  --flaeche: #ffffff;
  --seite: #f1f2f4;
  --gruen: #1a7f37;
  --gruen-hell: #e6f4ea;
  --gelb: #9a6700;
  --gelb-hell: #fff6dd;
  --radius: 12px;
  --schatten: 0 2px 12px rgba(20, 28, 38, .14);
  --schrift: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--schrift); font-size: 16px; line-height: 1.45; color: var(--text); background: var(--seite); -webkit-text-size-adjust: 100%; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
[hidden] { display: none !important; }
a { color: var(--rot-dunkel); }
.leise { color: var(--text-leise); }
.klein { font-size: .875rem; }
.zahl { font-variant-numeric: tabular-nums; }

/* ---------- Kopfzeile ---------- */
.kopf { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 16px; background: var(--tinte); color: #fff; border-bottom: 3px solid var(--rot); flex: none; }
.kopf .logo { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--rot); font-weight: 800; font-size: 15px; letter-spacing: .02em; }
.kopf .titel { font-weight: 700; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kopf .titel small { font-weight: 400; opacity: .7; margin-left: 6px; }
.kopf .rechts { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.kopf a { color: #fff; text-decoration: none; opacity: .85; }
.verbindung { display: none; background: #b42318; color: #fff; text-align: center; font-weight: 600; padding: 6px 12px; font-size: .9rem; }
.verbindung.an { display: block; }

/* ---------- Bausteine ---------- */
.karte-box, .box { background: var(--flaeche); border-radius: var(--radius); box-shadow: var(--schatten); padding: 16px; }
.btn { appearance: none; border: 1px solid var(--linie); background: var(--flaeche); color: var(--text); font: inherit; font-weight: 600; min-height: 48px; padding: 10px 18px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:hover { border-color: #b9c0c8; }
.btn:focus-visible, input:focus-visible, select:focus-visible, .chip:focus-within { outline: 3px solid #1f6feb; outline-offset: 2px; }
.btn.primaer { background: var(--rot); border-color: var(--rot); color: #fff; }
.btn.primaer:hover { background: var(--rot-dunkel); }
.btn.gross { min-height: 60px; font-size: 1.15rem; padding: 12px 24px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.text { border-color: transparent; background: transparent; min-height: 36px; padding: 4px 10px; color: var(--text-leise); }
input[type=text], input[type=number], select { font: inherit; min-height: 48px; padding: 8px 12px; border: 1px solid #b9c0c8; border-radius: 10px; background: #fff; color: var(--text); width: 100%; }
label.feld { display: block; font-weight: 600; margin-bottom: 14px; }
label.feld > span { display: block; margin-bottom: 4px; }
label.feld small { font-weight: 400; color: var(--text-leise); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid #b9c0c8; border-radius: 999px; background: #fff; cursor: pointer; user-select: none; min-height: 36px; }
.chip input { accent-color: var(--rot); width: 18px; height: 18px; margin: 0; }
.chip:has(input:checked) { border-color: var(--rot); background: var(--rot-hell); }
.auswahl-zeile { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--linie); border-radius: 10px; margin-bottom: 8px; cursor: pointer; background: #fff; }
.auswahl-zeile:has(input:checked) { border-color: var(--rot); background: var(--rot-hell); }
.auswahl-zeile input { accent-color: var(--rot); width: 20px; height: 20px; margin-top: 2px; }
.auswahl-zeile b { display: block; }
.fehler { color: #b42318; font-weight: 600; margin: 8px 0 0; }

/* Team-Marker und -Kennzeichnung */
.punkt { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--c, #888); flex: none; }
.teamnr { display: inline-grid; place-items: center; min-width: 26px; height: 26px; border-radius: 50%; background: var(--c, #888); color: #fff; font-weight: 700; font-size: .85rem; flex: none; }
.tm-icon { background: none; border: 0; }
.tm { width: 30px; height: 30px; border-radius: 50%; background: var(--c); border: 3px solid #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .45); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 14px; }
.tm-gross { width: 38px; height: 38px; font-size: 17px; border-width: 4px; }
.tm-name { position: absolute; left: 34px; top: 4px; white-space: nowrap; font-weight: 700; font-size: 12px; background: rgba(255, 255, 255, .92); border-radius: 6px; padding: 1px 6px; color: #222; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); }
.tm-neu { animation: tm-ein .45s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes tm-ein { from { transform: scale(0); } to { transform: scale(1); } }
.ziel-icon { background: none; border: 0; }
.ziel { width: 34px; height: 34px; border-radius: 50%; border: 4px solid #e11d48; background: rgba(255, 255, 255, .85); box-shadow: 0 0 0 4px rgba(225, 29, 72, .25); position: relative; animation: puls 1.6s ease-out infinite; }
.ziel::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: #e11d48; }
@keyframes puls { 0% { box-shadow: 0 0 0 0 rgba(225, 29, 72, .5); } 100% { box-shadow: 0 0 0 16px rgba(225, 29, 72, 0); } }
.ortsteil-icon { background: none; border: 0; }
.ortsteil-name { transform: translate(-50%, -50%); white-space: nowrap; font-weight: 700; font-size: 13px; color: #3c4650; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 5px #fff; pointer-events: none; display: inline-block; }
.ortsteil-name.treffer { color: #c8102e; font-size: 15px; }
.leaflet-container { background: #f2efe8; font-family: var(--schrift); }
.leaflet-container .leaflet-control-attribution { font-size: 10px; }
.leaflet-bar a { width: 38px; height: 38px; line-height: 38px; font-size: 20px; }

/* Ergebnis-Tabellen */
table.tab { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.tab th { text-align: left; font-weight: 600; color: var(--text-leise); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; padding: 4px 6px; }
table.tab td { padding: 7px 6px; border-top: 1px solid var(--linie); vertical-align: middle; }
table.tab td.r, table.tab th.r { text-align: right; }
table.tab tr.ich td { background: var(--gelb-hell); }
.team-zelle { display: flex; align-items: center; gap: 8px; min-width: 0; }
.team-zelle span.name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.plus { color: var(--gruen); font-weight: 700; }
.status { font-size: .8rem; font-weight: 700; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.status.wartet { background: #eceff3; color: var(--text-leise); }
.status.vorlaeufig { background: var(--gelb-hell); color: var(--gelb); }
.status.abgegeben { background: var(--gruen-hell); color: var(--gruen); }
.online { width: 9px; height: 9px; border-radius: 50%; background: #c3c9d0; flex: none; }
.online.an { background: #2da44e; }

/* Zeit */
.zeitbalken { height: 6px; background: #d7dbe0; flex: none; }
.zeitbalken > div { height: 100%; width: 0; background: var(--gruen); transition: width .3s linear, background-color .3s; }
.zeitbalken.knapp > div { background: #d4a000; }
.zeitbalken.kritisch > div { background: #d1242f; }
.uhr { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.35rem; min-width: 3.2em; text-align: right; }
.uhr.kritisch { color: #ff8f99; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .55; } }

/* ---------- Startseite ---------- */
.start { max-width: 880px; margin: 0 auto; padding: 24px 16px 40px; }
.start .held { margin: 12px 0 24px; }
.start .held h1 { font-size: 2rem; }
.start .zwei { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .start .zwei { grid-template-columns: 1fr; } .start .held h1 { font-size: 1.6rem; } }

/* ---------- Leitung ---------- */
.einrichten { max-width: 880px; margin: 0 auto; padding: 20px 16px 48px; display: grid; gap: 16px; }
.einrichten .raster2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .einrichten .raster2 { grid-template-columns: 1fr; } }
.spiel-raster { display: grid; grid-template-columns: minmax(0, 1fr) 440px; height: calc(100vh - 55px); }
.spiel-raster .karte-spalte { position: relative; min-height: 0; }
.spiel-raster #karte { position: absolute; inset: 0; }
.spiel-raster .seite { overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--seite); border-left: 1px solid var(--linie); }
@media (max-width: 960px) {
  .spiel-raster { grid-template-columns: 1fr; grid-template-rows: 50vh auto; height: auto; }
  .spiel-raster .seite { border-left: 0; }
}
.frage-gross .nr { font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--rot-dunkel); }
.frage-gross .text { font-size: 1.55rem; font-weight: 700; line-height: 1.25; margin: 4px 0 10px; }
.timer-gross { font-size: 3.4rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.timer-gross.kritisch { color: #d1242f; animation: blink 1s steps(2) infinite; }
.aktionen { display: flex; flex-wrap: wrap; gap: 8px; }
.aktionen .btn { flex: 1 1 auto; }
.beitritt { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.beitritt .qr { width: 150px; height: 150px; background: #fff; border: 1px solid var(--linie); border-radius: 10px; padding: 6px; }
.beitritt .qr svg { width: 100%; height: 100%; display: block; }
.code-gross { font-size: 2.6rem; font-weight: 800; letter-spacing: .18em; font-variant-numeric: tabular-nums; line-height: 1; }
.url { word-break: break-all; font-weight: 600; }
.podest { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 10px 0 16px; }
.podest .stufe { flex: 1; max-width: 130px; text-align: center; }
.podest .balken { border-radius: 10px 10px 0 0; background: var(--c); color: #fff; font-weight: 800; font-size: 1.6rem; padding-top: 8px; }
.podest .p1 .balken { height: 110px; } .podest .p2 .balken { height: 80px; } .podest .p3 .balken { height: 56px; }
.podest .name { font-weight: 700; margin-bottom: 4px; overflow-wrap: anywhere; }

/* ---------- Team ---------- */
body.team { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.beitritt-seite { max-width: 460px; margin: 0 auto; padding: 24px 16px; width: 100%; overflow-y: auto; }
#spiel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#karte-wrap { position: relative; flex: 1; min-height: 0; }
#karte-wrap #karte { position: absolute; inset: 0; }
.frage-karte { position: absolute; z-index: 900; left: 10px; right: 10px; top: 10px; background: rgba(255, 255, 255, .96); border-radius: var(--radius); box-shadow: var(--schatten); padding: 10px 14px; pointer-events: none; }
.frage-karte .nr { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--rot-dunkel); }
.frage-karte .text { font-size: 1.15rem; font-weight: 700; line-height: 1.25; }
.unterleiste { flex: none; background: #fff; border-top: 1px solid var(--linie); padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); max-height: 46vh; overflow-y: auto; }
.optionen { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.optionen .btn { min-height: 52px; }
.optionen .btn[aria-pressed=true] { background: var(--rot-hell); border-color: var(--rot); color: var(--rot-dunkel); box-shadow: inset 0 0 0 1px var(--rot); }
.hinweis-zeile { text-align: center; color: var(--text-leise); margin: 0 0 10px; font-weight: 500; }
.ergebnis-gross { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.ergebnis-gross .pkt { font-size: 2.2rem; font-weight: 800; color: var(--gruen); line-height: 1; }
.ergebnis-gross .pkt.null { color: var(--text-leise); }
.ortsteil-wahl-ansicht { flex: 1; overflow-y: auto; padding: 14px; background: var(--seite); }
.ortsteil-wahl-ansicht .box { padding: 16px; }
.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); background: #1b1f24; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 5000; font-weight: 600; max-width: 90vw; box-shadow: var(--schatten); }

/* ---------- Rechtliche Seiten ---------- */
.rechtlich { max-width: 760px; margin: 0 auto; padding: 24px 16px 48px; }
.rechtlich h2 { margin-top: 1.6em; }
.rechtlich ul { padding-left: 1.2em; }
.rechtlich .entwurf { background: var(--gelb-hell); border: 1px solid #e6c866; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 20px; }
mark.platzhalter { background: #ffe58a; color: #3d2f00; padding: 0 4px; border-radius: 4px; font-weight: 600; }
.fuss { text-align: center; font-size: .85rem; color: var(--text-leise); padding: 18px 16px 28px; }
.fuss a { color: var(--text-leise); margin: 0 8px; }

.fuss-klein { flex: none; margin: 0; padding: 3px 8px calc(3px + env(safe-area-inset-bottom)); text-align: center; font-size: .72rem; background: #fff; border-top: 1px solid var(--linie); }
.fuss-klein a { color: var(--text-leise); margin: 0 8px; text-decoration: none; }
