/* Spielseite — Aussehen.
 *
 * Farben aus gemeinsam/design-farben.css, erzeugt aus dem Flutter-Design.
 * Gebaut fürs Telefon im Gehen: große Flächen zum Antippen, wenig Text,
 * nichts, wofür man stehen bleiben muss.
 */

@font-face {
  font-family: 'Bebas Neue';
  src: url('gemeinsam/schrift/BebasNeue-Regular.ttf') format('truetype');
  font-weight: 400;
  font-display: swap;
}

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

html, body {
  margin: 0;
  height: 100%;
  overscroll-behavior: none;
}

body {
  background: var(--primary-dark);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
      'Helvetica Neue', Arial, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.ansicht { min-height: 100dvh; }

.mitte {
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  padding: 32px 20px calc(32px + env(safe-area-inset-bottom));
  text-align: center;
  background-image: linear-gradient(180deg, var(--secondary-dark) 0%, #000 70%);
}

/* Mittig, aber ohne abzuschneiden.
 *
 * `justify-content: center` sieht gut aus, solange der Inhalt passt — ist er
 * höher als der Bildschirm, wird oben abgeschnitten und man kann nicht
 * hinscrollen. Genau das passierte auf einem quer gehaltenen Handy und auf
 * einem 320 Pixel breiten Android. Zwei leere Elemente mit `margin: auto`
 * schlucken den freien Platz und fallen in sich zusammen, wenn keiner da
 * ist — dasselbe Aussehen, ohne den Fallstrick. */
.mitte::before,
.mitte::after { content: ''; margin: auto; }

.marke {
  margin: 0 0 8px;
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 18px;
  letter-spacing: 6px;
  color: var(--steel);
  text-transform: uppercase;
}

.gross {
  margin: 0 0 24px;
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: clamp(40px, 13vw, 64px);
  line-height: 1;
  letter-spacing: 1px;
}

.abschnitt {
  margin: 0 0 14px;
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 28px;
  letter-spacing: 2px;
  color: var(--steel-light);
  text-transform: uppercase;
}

.karte {
  width: 100%;
  max-width: 420px;
  padding: 24px 20px;
  background: var(--glass-white);
  border: 1px solid var(--glass-border);
  border-radius: 18px;
}

.fuehrung { margin: 0 0 14px; font-size: 18px; }
.klein { color: var(--text-tertiary); font-size: 13px; margin: 12px 0 0; }
.beschriftung {
  display: block;
  margin: 18px 0 6px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: left;
}
.fehler { margin: 12px 0 0; color: var(--error-red); font-size: 14px; }

/* ── Eingaben ──────────────────────────────────────────────────────────── */

.eingabe {
  width: 100%;
  padding: 16px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: var(--tertiary-dark);
  color: var(--text-primary);
  font-size: 17px;      /* nie kleiner — sonst zoomt iOS beim Antippen */
  font-family: inherit;
}
.eingabe:focus { outline: 2px solid var(--steel-blue); }

.eingabe.code {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 40px;
  letter-spacing: 10px;
  text-align: center;
  text-transform: uppercase;
}

/* ── Knöpfe ────────────────────────────────────────────────────────────── */

.knopf {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--steel-blue-light);
  border-radius: 12px;
  background: linear-gradient(180deg, var(--steel-blue-light), var(--steel-blue));
  color: #fff;
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 22px;
  letter-spacing: 2px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.knopf:active { filter: brightness(0.88); }
.knopf:disabled { opacity: 0.5; }
.knopf.gross-knopf { padding: 20px; font-size: 26px; }
.knopf.leise {
  background: transparent;
  border-color: var(--glass-border);
  color: var(--text-secondary);
}
/* Der Hilfe-Knopf ist ein Link (tel:), kein Knopf — deshalb muss die
   Zeilenhöhe nachgestellt werden, sonst sitzt der Text nicht mittig. */
.knopf.hilfe {
  border-color: var(--success-green);
  color: var(--success-green);
  background: transparent;
  line-height: 1.2;
}

.knopf.warnung {
  background: transparent;
  border-color: var(--warning-orange);
  color: var(--warning-orange);
}

/* ── Wappenwahl ────────────────────────────────────────────────────────── */

.wappenwahl {
  display: grid;
  /* Nicht sechs feste Spalten: Auf 320 Pixel Breite blieben davon 37 Pixel
     je Feld, und darunter trifft ein Daumen nicht mehr zuverlässig. So
     werden es auf schmalen Geräten eben fünf. */
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 6px;
}
.wappen {
  aspect-ratio: 1;
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  background: var(--tertiary-dark);
  font-size: 22px;
  cursor: pointer;
}
.wappen[aria-pressed="true"] {
  border-color: var(--steel-blue);
  background: rgba(70, 130, 180, 0.25);
}

/* ── Spielansicht ──────────────────────────────────────────────────────── */

.spiel { display: flex; flex-direction: column; height: 100dvh; }

.leiste {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--secondary-dark);
  border-bottom: 1px solid var(--glass-border);
}
.leiste-block { display: flex; flex-direction: column; line-height: 1.05; }
.leiste-zahl {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 26px;
  color: var(--steel-blue-light);
}
.leiste-zahl.knapp { color: var(--error-red); }
.leiste-text {
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-tertiary);
  text-transform: uppercase;
}
/* Wartende Antworten — dieselbe Sprache wie das gelbe Feld auf den Tablets,
   damit ein Spielleiter es wiedererkennt. */
.warten {
  margin-left: auto;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(241, 196, 15, 0.18);
  border: 1px solid rgba(241, 196, 15, 0.5);
  color: var(--warning-yellow);
  font-size: 12px;
  white-space: nowrap;
}
.warten + .leiste-knopf { margin-left: 8px; }

.leiste-knopf {
  margin-left: auto;
  width: 42px; height: 42px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: var(--tertiary-dark);
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
}
.leiste-knopf + .leiste-knopf { margin-left: 0; }

.karte-flaeche { flex: 1 1 auto; background: var(--tertiary-dark); }
.leaflet-container { background: #1a1a1a; font-family: inherit; }

.hinweisleiste {
  padding: 10px 14px;
  background: rgba(243, 156, 18, 0.15);
  border-top: 1px solid rgba(243, 156, 18, 0.4);
  color: var(--warning-orange);
  font-size: 13px;
}

.schwebeknopf {
  position: absolute;
  right: 14px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  width: 48px; height: 48px;
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  background: var(--secondary-dark);
  color: var(--steel-blue-light);
  font-size: 22px;
  z-index: 500;
  cursor: pointer;
}

.fussleiste {
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--secondary-dark);
  border-top: 1px solid var(--glass-border);
  text-align: center;
  font-size: 14px;
  color: var(--text-secondary);
  min-height: 56px;
}

/* Marker: im Code gemalt, damit sie ohne Ladezeit und offline stehen. */
.stift {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  border: 2px solid rgba(0, 0, 0, 0.45);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}
.stift > span { transform: rotate(45deg); }
.stift.offen { background: var(--steel-blue); }
.stift.fertig { background: var(--success-green); }
.stift.gemeldet { background: var(--warning-orange); }
.stift.dienst { background: var(--steel); }

.ich {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--steel-blue-light);
  border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(90, 155, 212, 0.28);
}

/* ── Blatt (Aufgabe, Rangliste, Menü) ──────────────────────────────────── */

.blatt {
  position: fixed;
  inset: 0;
  /* Über Leaflet: dessen Bedienelemente und der Nachweis unten rechts liegen
     auf z-index 1000. Mit 900 stand die Herkunftsangabe quer über der
     Aufgabe. */
  z-index: 1200;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: flex-end;
}

.blatt-inhalt {
  position: relative;
  width: 100%;
  max-height: 92dvh;
  overflow-y: auto;
  padding: 24px 20px calc(28px + env(safe-area-inset-bottom));
  background: var(--secondary-dark);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--glass-border);
}
@media (min-width: 720px) {
  .blatt { align-items: center; justify-content: center; }
  .blatt-inhalt {
    max-width: 560px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
  }
}

.blatt-zu {
  position: absolute;
  top: 12px; right: 12px;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--tertiary-dark);
  color: var(--text-primary);
  font-size: 24px;
  cursor: pointer;
}

/* ── Aufgabe ───────────────────────────────────────────────────────────── */

.aufgabe-bild {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 12px;
  margin-bottom: 16px;
  background: var(--tertiary-dark);
}
.aufgabe-titel {
  margin: 0 0 4px;
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 30px;
  letter-spacing: 1px;
  padding-right: 44px;
}
.aufgabe-punkte {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--text-tertiary);
}
.aufgabe-text { margin: 0 0 18px; white-space: pre-wrap; }
.aufgabe-vorwort {
  margin: 0 0 12px;
  color: var(--text-secondary);
  font-style: italic;
}

.wahl {
  display: block;
  width: 100%;
  margin-bottom: 8px;
  padding: 15px 16px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: var(--tertiary-dark);
  color: var(--text-primary);
  font-size: 16px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.wahl[aria-pressed="true"] {
  border-color: var(--steel-blue);
  background: rgba(70, 130, 180, 0.22);
}

.rueckmeldung {
  margin: 16px 0 0;
  padding: 16px;
  border-radius: 12px;
  white-space: pre-wrap;
}
.rueckmeldung.richtig {
  background: rgba(46, 204, 113, 0.14);
  border: 1px solid rgba(46, 204, 113, 0.45);
}
.rueckmeldung.falsch {
  background: rgba(231, 76, 60, 0.14);
  border: 1px solid rgba(231, 76, 60, 0.45);
}
.rueckmeldung b {
  display: block;
  margin-bottom: 6px;
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 22px;
  letter-spacing: 1px;
}

.balken {
  height: 6px;
  margin-top: 12px;
  border-radius: 3px;
  background: var(--tertiary-dark);
  overflow: hidden;
}
.balken > i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--steel-blue-light);
  transition: width 0.2s;
}

.meldeknopf {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 12px;
  border: 1px dashed var(--glass-border);
  border-radius: 12px;
  background: transparent;
  color: var(--text-tertiary);
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}

.gemeldet-hinweis {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(243, 156, 18, 0.14);
  border: 1px solid rgba(243, 156, 18, 0.4);
  color: var(--warning-orange);
  font-size: 13px;
}

/* ── Rangliste ─────────────────────────────────────────────────────────── */

.rangliste { list-style: none; margin: 0; padding: 0; }
.platz {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 8px;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  background: var(--glass-white);
}
.platz.selbst { border-color: var(--steel-blue); }
.platz .nr {
  width: 28px;
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 26px;
  color: var(--steel);
  text-align: center;
}
.platz .wer { flex: 1 1 auto; min-width: 0; }
.platz .wer strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.platz .wer span { font-size: 12px; color: var(--text-tertiary); }
.platz .pkt {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 26px;
  color: var(--steel-blue-light);
}

/* ── Spinner, Brot ─────────────────────────────────────────────────────── */

.spinner {
  width: 34px; height: 34px;
  margin-bottom: 16px;
  border: 3px solid var(--glass-border);
  border-top-color: var(--steel-blue-light);
  border-radius: 50%;
  animation: dreh 0.9s linear infinite;
}
@keyframes dreh { to { transform: rotate(360deg); } }

/* Kurze Meldung am unteren Rand — „Brot", weil Toast schon vergeben ist. */
.brot {
  position: fixed;
  left: 50%;
  bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 1300;
  max-width: 90vw;
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--tertiary-dark);
  border: 1px solid var(--glass-border);
  font-size: 14px;
  text-align: center;
}

/* ── Team-Code ─────────────────────────────────────────────────────────── */

.teamcode {
  margin: 16px 0;
  padding: 16px;
  border: 1px dashed var(--steel-blue-light);
  border-radius: 14px;
  background: rgba(70, 130, 180, 0.12);
  text-align: center;
}
.teamcode b {
  display: block;
  margin: 6px 0;
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 40px;
  letter-spacing: 10px;
  color: var(--steel-blue-light);
}
.teamcode.gross-code b { font-size: clamp(48px, 18vw, 78px); }
.teamcode-text {
  display: block;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--text-secondary);
  text-transform: uppercase;
}
.teamcode-text + b + .teamcode-text {
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-tertiary);
}
