/* Nachbarschafts-Olympiade – festliches Sport-Design.
   Bewusst KEINE olympischen Ringe und kein offizielles Emblem, sondern
   allgemeine Wettkampf-Motive: Fackel, Lorbeer, Siegerpodest, Medaillen. */

:root {
  --nacht: #0b1f3a;
  --nacht-hell: #16375f;
  --gold: #c9a227;
  --gold-hell: #e8c96a;
  --grund: #f6f3ea;
  --karte: #ffffff;
  --schrift: #1f2421;
  --leise: #6b7280;
  --linie: #e3ddcd;
  --radius: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --grund: #12161b;
    --karte: #1c2229;
    --schrift: #ece8dd;
    --leise: #99a1ab;
    --linie: #2f373f;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 0 0 84px;
  background: var(--grund);
  color: var(--schrift);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Kopf mit Fackel ---------- */
#kopf {
  background: linear-gradient(155deg, #0b1f3a 0%, #16375f 55%, #0d2748 100%);
  color: #fff;
  padding: 12px 14px 0;
  position: sticky; top: 0; z-index: 20;
  padding-top: max(12px, env(safe-area-inset-top));
  box-shadow: 0 2px 14px rgba(11, 31, 58, .25);
}
.kopf-zeile { display: flex; align-items: center; gap: 8px; }
#kopf h1 {
  font-size: 15.5px; margin: 0; flex: 1; font-weight: 800; line-height: 1.2;
  letter-spacing: .2px; text-transform: uppercase;
}
#kopf p { margin: 2px 0 0; font-size: 12px; opacity: .82; line-height: 1.3; }
.stand-info { font-size: 11px !important; opacity: .6 !important; }
.icon-knopf {
  background: rgba(255,255,255,.14); border: 0; color: #fff; flex: 0 0 auto;
  width: 34px; height: 34px; border-radius: 50%; font-size: 16px; cursor: pointer;
}
.icon-knopf:active { background: rgba(255,255,255,.3); }
.icon-knopf.dreht { animation: dreh .8s linear infinite; }
.icon-knopf.stumm { opacity: .4; }
@keyframes dreh { to { transform: rotate(360deg); } }

.lorbeer-linie {
  display: flex; align-items: center; gap: 8px; margin: 7px 0 0;
  padding-bottom: 7px; font-size: 11px;
}
.lorbeer-linie::before, .lorbeer-linie::after {
  content: ""; flex: 1; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

/* Fackel */
.fackel { position: relative; width: 24px; height: 34px; flex: 0 0 24px; cursor: pointer; }
.fackel .stiel {
  position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 5px; height: 15px; border-radius: 2px;
  background: linear-gradient(#a98a4e, #6b5227);
}
.fackel .schale {
  position: absolute; bottom: 13px; left: 50%; transform: translateX(-50%);
  width: 15px; height: 7px; border-radius: 3px 3px 7px 7px;
  background: linear-gradient(var(--gold-hell), var(--gold));
}
.fackel .flamme {
  position: absolute; bottom: 18px; left: 50%; width: 12px; height: 17px;
  transform-origin: 50% 100%;
  background: radial-gradient(ellipse at 50% 82%, #fff6c4 0%, #ffc23d 42%, #ff6a1f 74%, rgba(255,106,31,0) 100%);
  border-radius: 50% 50% 45% 45% / 62% 62% 38% 38%;
  animation: flackern .85s ease-in-out infinite alternate;
}
@keyframes flackern {
  from { transform: translateX(-50%) scale(1) rotate(-4deg); opacity: .9; }
  to   { transform: translateX(-50%) scale(1.14, 1.26) rotate(4deg); opacity: 1; }
}
.fackel.aus .flamme { display: none; }
.fackel.aus .schale { background: #7b8794; }

/* ---------- Inhalt ---------- */
#inhalt { padding: 14px 14px 20px; max-width: 720px; margin: 0 auto; }
.laden { text-align: center; color: var(--leise); padding: 40px 0; }

h2.abschnitt {
  font-size: 12px; text-transform: uppercase; letter-spacing: .11em;
  color: var(--leise); margin: 22px 0 8px; font-weight: 800;
  display: flex; align-items: center; gap: 8px;
}
h2.abschnitt::after { content: ""; flex: 1; height: 1px; background: var(--linie); }
h2.abschnitt:first-child { margin-top: 4px; }

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

/* ---------- Kommentator ---------- */
.kommentar {
  display: flex; gap: 11px; align-items: flex-start; position: relative;
  background: linear-gradient(135deg, #143156, #0b1f3a);
  color: #f4efe2; border: 1px solid #2c4d78; border-left: 4px solid var(--gold);
  border-radius: var(--radius); padding: 13px 42px 13px 13px; margin-bottom: 12px;
}
.kommentar .mikro { font-size: 23px; flex: 0 0 auto; line-height: 1.1; }
.kommentar .wer {
  font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--gold-hell); font-weight: 800;
}
.kommentar .text { font-size: 14.5px; line-height: 1.45; margin-top: 3px; }
.kommentar .nochmal {
  position: absolute; top: 9px; right: 9px; width: 28px; height: 28px;
  background: rgba(255,255,255,.13); border: 0; color: #f4efe2;
  border-radius: 8px; font-size: 13px; cursor: pointer;
}
.kommentar .nochmal:active { background: rgba(255,255,255,.28); }

/* ---------- Punktestand ---------- */
.stand-gross { display: flex; gap: 10px; margin-bottom: 6px; }
.stand-team {
  flex: 1; border-radius: var(--radius); padding: 15px 10px 13px; color: #fff;
  text-align: center; position: relative; overflow: hidden;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.16);
}
.stand-team.fuehrt { box-shadow: inset 0 -3px 0 rgba(0,0,0,.16), 0 0 0 2.5px var(--gold); }
.stand-team .emoji { font-size: 25px; display: block; }
.stand-team .name {
  font-size: 13px; font-weight: 700; opacity: .96; margin-top: 2px;
  overflow-wrap: anywhere; text-transform: uppercase; letter-spacing: .04em;
}
.stand-team .punkte {
  font-size: 44px; font-weight: 800; line-height: 1.05; margin-top: 5px;
  font-variant-numeric: tabular-nums; text-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.stand-team .zusatz { font-size: 11.5px; opacity: .85; text-transform: uppercase; letter-spacing: .08em; }
.stand-team.fuehrt::after {
  content: "👑"; position: absolute; top: 5px; right: 7px; font-size: 16px;
}

.balken {
  display: flex; height: 11px; border-radius: 6px; overflow: hidden;
  margin: 8px 0 4px; background: var(--linie); border: 1px solid var(--linie);
}
.balken div { transition: width .6s cubic-bezier(.4,0,.2,1); }

.fortschritt { text-align: center; color: var(--leise); font-size: 13px; margin: 10px 0 4px; }

/* ---------- Siegerpodest ---------- */
.podest { display: flex; align-items: flex-end; justify-content: center; gap: 12px; padding: 6px 0 0; }
.podest .platz {
  border-radius: 9px 9px 0 0; color: #fff; text-align: center;
  padding: 9px 8px; min-width: 110px; position: relative;
  box-shadow: inset 0 -4px 0 rgba(0,0,0,.2);
  display: flex; flex-direction: column; justify-content: flex-start;
}
.podest .platz.eins { height: 112px; }
.podest .platz.zwei { height: 82px; }
.podest .medaille { font-size: 25px; line-height: 1.1; }
.podest .pname { font-size: 11.5px; font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; }
.podest .ppunkte { font-size: 17px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- Medaillenspiegel ---------- */
.spiegel-kopf, .spiegel-zeile {
  display: grid; grid-template-columns: 1fr 42px 42px 42px;
  align-items: center; gap: 4px; padding: 8px 0;
}
.spiegel-kopf { font-size: 11px; color: var(--leise); font-weight: 700; border-bottom: 1px solid var(--linie); padding-top: 0; }
.spiegel-zeile { border-bottom: 1px solid var(--linie); }
.spiegel-zeile:last-child { border-bottom: 0; }
.spiegel-zeile .tname { font-weight: 700; font-size: 14px; overflow-wrap: anywhere; }
.spiegel-kopf span:not(:first-child), .spiegel-zeile span:not(:first-child) {
  text-align: center; font-variant-numeric: tabular-nums; font-weight: 700;
}

/* ---------- Ablaufplan ---------- */
.karte.plan { padding: 4px 14px; }
.plan-zeile {
  display: grid; grid-template-columns: 50px 1fr; gap: 10px;
  padding: 12px 0; border-bottom: 1px solid var(--linie);
}
.plan-zeile:last-child { border-bottom: 0; }
.plan-zeit {
  font-variant-numeric: tabular-nums; font-weight: 800; font-size: 14px;
  color: var(--nacht); padding-top: 1px;
}
@media (prefers-color-scheme: dark) { .plan-zeit { color: var(--gold-hell); } }
.plan-kopf { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.plan-titel { font-weight: 700; font-size: 15px; }
.plan-unter { font-size: 12.5px; color: var(--leise); margin-top: 2px; }
.plan-notiz { font-size: 12.5px; color: var(--leise); margin-top: 4px; font-style: italic; }

.plan-zeile.erledigt .plan-titel { opacity: .55; }
.plan-zeile.erledigt .plan-zeit { opacity: .5; }
.plan-zeile.dran {
  background: linear-gradient(90deg, rgba(201,162,39,.16), transparent 70%);
  border-left: 3px solid var(--gold); margin-left: -14px; padding-left: 11px;
  border-radius: 4px 0 0 4px;
}
.marke.dran { background: var(--gold); color: #352804; }

.plan-zeile.fest .plan-titel { font-size: 14.5px; }
.plan-zeile.essen { background: rgba(201,162,39,.12); margin: 0 -14px; padding: 14px; }
.plan-zeile.essen .plan-titel { font-size: 16px; text-transform: uppercase; letter-spacing: .06em; }
.plan-zeile.ehrung .plan-titel, .plan-zeile.info .plan-titel { color: var(--nacht); }
@media (prefers-color-scheme: dark) {
  .plan-zeile.ehrung .plan-titel, .plan-zeile.info .plan-titel { color: var(--gold-hell); }
}

/* ---------- Listen ---------- */
.zeile { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--linie); }
.zeile:last-child { border-bottom: 0; }
.zeile .haupt { flex: 1; min-width: 0; }
.zeile .titel { font-weight: 600; }
.zeile .nr, .plan-titel .nr {
  display: inline-block; min-width: 20px; height: 20px; line-height: 20px;
  text-align: center; border-radius: 50%; background: var(--nacht); color: #fff;
  font-size: 11.5px; font-weight: 800; margin-right: 3px; vertical-align: 1px;
}
@media (prefers-color-scheme: dark) { .zeile .nr, .plan-titel .nr { background: var(--gold); color: #2a2109; } }
.zeile .unter { font-size: 12.5px; color: var(--leise); }

.marke {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px;
  border-radius: 20px; background: var(--linie); color: var(--leise);
}
.marke.fertig { background: #f4e6bd; color: #6b5210; }
.marke.offen { background: var(--linie); color: var(--leise); }
@media (prefers-color-scheme: dark) { .marke.fertig { background: #453a1c; color: #e8c96a; } }

.punkt-pille { font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: 20px; color: #fff; white-space: nowrap; }

.weg-knopf {
  background: none; border: 0; color: var(--leise); font-size: 17px;
  padding: 4px 6px; cursor: pointer; line-height: 1;
}

/* ---------- Knöpfe ---------- */
.knopf {
  background: var(--nacht); color: #fff; border: 0; border-radius: 11px;
  padding: 13px 16px; font-size: 15.5px; font-weight: 700; cursor: pointer; width: 100%;
}
.knopf:active { opacity: .82; }
.knopf.gold { background: linear-gradient(160deg, var(--gold-hell), var(--gold)); color: #402f05; }
.knopf.grau { background: var(--linie); color: var(--schrift); }
.knopf.klein { padding: 9px 12px; font-size: 14px; width: auto; }
.knopf:disabled { opacity: .45; }
.knopf-reihe { display: flex; gap: 8px; margin-top: 10px; }
.knopf-reihe .knopf { flex: 1; }
.knopf + .knopf { margin-top: 8px; }

input, select, textarea {
  width: 100%; padding: 12px; font-size: 16px; border-radius: 10px;
  border: 1px solid var(--linie); background: var(--grund); color: var(--schrift);
}
label.feld { display: block; margin-bottom: 10px; }
label.feld span { display: block; font-size: 12.5px; color: var(--leise); margin-bottom: 4px; font-weight: 600; }
label.haken { display: flex; align-items: center; gap: 9px; font-size: 14.5px; margin-bottom: 10px; }
label.haken input { width: auto; }

/* ---------- Stoppuhr ---------- */
.uhr {
  font-size: 52px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums;
  letter-spacing: -1px; margin: 6px 0 10px;
}
.uhr.laeuft { color: #b8860b; }
.team-wahl { display: flex; gap: 8px; }
.team-wahl button {
  flex: 1; border: 2px solid transparent; border-radius: 11px; padding: 14px 8px;
  font-size: 14.5px; font-weight: 700; color: #fff; cursor: pointer;
}
.team-wahl button.aus { opacity: .38; }

/* ---------- Navigation ---------- */
#navi {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  display: flex; background: var(--karte); border-top: 2px solid var(--gold);
  padding-bottom: env(safe-area-inset-bottom);
}
#navi button {
  flex: 1; min-width: 0; background: none; border: 0; padding: 8px 1px 9px; cursor: pointer;
  font-size: 10px; color: var(--leise); display: flex; flex-direction: column;
  align-items: center; gap: 2px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#navi button span { font-size: 19px; line-height: 1; }
#navi button.aktiv { color: var(--nacht); }
@media (prefers-color-scheme: dark) { #navi button.aktiv { color: var(--gold-hell); } }

/* ---------- Konfetti ---------- */
#konfetti { position: fixed; inset: 0; pointer-events: none; z-index: 45; }

/* ---------- Dialog & Toast ---------- */
.dialog {
  position: fixed; inset: 0; background: rgba(6,16,30,.62); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.dialog-karte {
  background: var(--karte); border-radius: 16px; padding: 18px; width: 100%; max-width: 420px;
  max-height: 84vh; overflow: auto; border-top: 4px solid var(--gold);
}
.dialog-karte h2 { margin: 0 0 10px; font-size: 18px; }
.dialog-knoepfe { display: flex; gap: 8px; margin-top: 14px; }
.dialog-knoepfe .knopf { flex: 1; margin-top: 0; }

.toast {
  position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%);
  background: #10233d; color: #fff; padding: 11px 18px; border-radius: 24px;
  font-size: 14px; z-index: 60; max-width: 90vw; text-align: center;
  border: 1px solid var(--gold);
}

.hinweis {
  background: #fdf3e0; border: 1px solid #e8cf9e; color: #7a5310;
  border-radius: 11px; padding: 11px 13px; font-size: 13.5px; margin-bottom: 12px;
}
@media (prefers-color-scheme: dark) {
  .hinweis { background: #33291a; border-color: #5c4826; color: #e8c68a; }
}

/* ---------- Auslosung ---------- */
.los-name {
  font-size: 20px; font-weight: 800; text-align: center; padding: 15px;
  border-radius: 12px; color: #fff; margin: 8px 0; animation: rein .35s ease;
  box-shadow: inset 0 -3px 0 rgba(0,0,0,.18);
}
@keyframes rein { from { opacity: 0; transform: scale(.85); } }

/* ---------- Wer das ausrichtet ---------- */
.macher {
  text-align: center; color: var(--leise); font-size: 12px; line-height: 1.7;
  margin: 24px 0 6px; padding-top: 14px; border-top: 1px solid var(--linie);
}
.macher b { color: var(--schrift); font-weight: 700; }

/* ---------- Urkunde ---------- */
.urkunde {
  background: #fffdf7; color: #1f2421; border: 3px solid var(--gold);
  outline: 1px solid var(--gold); outline-offset: 5px;
  border-radius: 4px; padding: 26px 22px; text-align: center; margin: 10px 6px 20px;
}
.urkunde .kranz { font-size: 38px; }
.urkunde .u-titel {
  font-size: 21px; letter-spacing: .22em; text-transform: uppercase;
  color: #9a7b16; font-weight: 800; margin: 6px 0 2px;
}
.urkunde .u-anlass { font-size: 12.5px; color: #6b7280; margin-bottom: 14px; }
.urkunde .u-name { font-size: 27px; font-weight: 800; margin: 10px 0 4px; overflow-wrap: anywhere; }
.urkunde .u-text { font-size: 14px; line-height: 1.6; margin: 8px auto; max-width: 30em; }
.urkunde .u-platz { font-size: 17px; font-weight: 700; margin: 10px 0; }
.urkunde .u-ehre { font-style: italic; }
.urkunde .u-linie {
  display: flex; align-items: center; gap: 10px;
  margin: 10px auto; max-width: 24em; font-size: 13px;
}
.urkunde .u-linie::before, .urkunde .u-linie::after {
  content: ""; flex: 1; height: 1.5px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.urkunde .u-fuss {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 14px;
  margin-top: 24px; font-size: 11.5px; color: #6b7280;
  border-top: 1px solid #e3d9bd; padding-top: 8px; text-align: left;
}
.urkunde .u-fuss-links { max-width: 48%; }
.urkunde .u-app { display: block; font-style: italic; font-size: 10.5px; margin-top: 3px; opacity: .8; }
.urkunde .u-sig { display: block; text-align: center; min-width: 46%; }
.urkunde .u-sig-strich {
  display: block; border-top: 1px solid #9a8a5e; margin: 0 auto 4px; width: 100%;
}
.urkunde .u-sig b { display: block; color: #1f2421; font-size: 12.5px; }
.urkunde .u-sig em { display: block; color: #9a7b16; font-size: 11px; font-style: italic; }

@media print {
  #kopf, #navi, #konfetti, .nicht-drucken, .hinweis, .kommentar { display: none !important; }
  body { padding: 0; background: #fff; }
  #inhalt { padding: 0; max-width: none; }
  /* Gedruckt darf die Urkunde deutlich groesser auftreten als auf dem Handy –
     sonst steht ein kleiner Textblock verloren mitten auf dem A4-Blatt. */
  .urkunde {
    page-break-after: always; margin: 0; min-height: 96vh;
    display: flex; flex-direction: column; justify-content: center;
    border-width: 5px; outline-offset: 9px; padding: 30px 34px;
  }
  .urkunde .kranz { font-size: 66px; }
  .urkunde .u-titel { font-size: 34px; letter-spacing: .3em; margin: 12px 0 4px; }
  .urkunde .u-anlass { font-size: 15px; margin-bottom: 20px; }
  .urkunde .u-linie { margin: 20px auto; max-width: 30em; font-size: 17px; }
  .urkunde .u-name { font-size: 48px; margin: 6px 0; }
  .urkunde .u-text { font-size: 18.5px; line-height: 1.65; max-width: 26em; margin: 12px auto; }
  .urkunde .u-platz { font-size: 25px; margin: 18px 0; }
  .urkunde .u-ehre { font-size: 17px; }
  /* Die Unterschriftszeile gehoert an den unteren Rand des Rahmens,
     der Rest bleibt mittig. */
  .urkunde { position: relative; }
  .urkunde .u-fuss {
    position: absolute; left: 34px; right: 34px; bottom: 26px;
    font-size: 13.5px; margin-top: 0; padding-top: 12px;
  }
  /* Luft ueber der Linie, damit man wirklich unterschreiben kann */
  .urkunde .u-sig-strich { margin-top: 46px; }
  .urkunde .u-sig b { font-size: 15px; }
  .urkunde .u-sig em { font-size: 12.5px; }
  .urkunde .u-app { font-size: 11.5px; }
  @page { size: A4; margin: 12mm; }
}
