/* Seitenrahmen der Anwendung (REQ-010 Schritt 13, übernommen aus den Gestaltungs-Mockups (REQ-012),
   REQ-012). Nur Raster und Rahmen, die Bauteile stehen in components.css.
   Farben, Schriften und Abstände nur über var(--…) aus tokens.css (AK-31). Keine Inline-Stile (CSP). */

/* ===== Seite ===== */
/* 100dvh folgt der sichtbaren Höhe (Tablet-Leisten), 100vh ist der Fallback für ältere Browser. */
.app__root { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }

/* Moderatoransicht und Auswertung unter 768 px Höhe (E-80): Seite scrollt senkrecht, statt
   Kacheln und Tafeln zu stauchen oder abzuschneiden. Der Rahmen bleibt mindestens 768 px hoch
   (Layout wie bei 1024 × 768), die Kopfleiste mit Timer bleibt beim Scrollen oben stehen.
   Die Station (app--station) ist ausgenommen: Sie passt ab 560 px ohne Scrollen
   (Rechnung in docs/design/ci-design-tokens.md, Abschnitt 5). */
@media (max-height: 767.98px) {
  .app__root--moderator, .app__root--results { min-height: 768px; }
  .app__root--moderator > .topbar, .app__root--results > .topbar { position: sticky; top: 0; }
}

/* ===== Kopfleiste mit Risskante ===== */
.topbar {
  --topbar-h: 56px;
  position: relative;
  z-index: 3;
  flex: 0 0 var(--topbar-h);
  height: var(--topbar-h);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-4);
  background: var(--color-surface);
  filter: drop-shadow(0 1px 0 var(--ci-gray-light));
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 10px;
  background: var(--color-surface);
  -webkit-mask: url("../img/edge-torn.svg") 0 0 / 240px 10px repeat-x;
  mask: url("../img/edge-torn.svg") 0 0 / 240px 10px repeat-x;
}
.topbar__group { display: flex; align-items: center; gap: var(--space-4); min-width: 0; }
.topbar__group--center { justify-content: center; }
.topbar__group--end { justify-content: flex-end; }

/* Moderator und Auswertung: Timer zur Seite zentriert wie in der Stationsansicht (E-78,
   Nacharbeit PR #37). Gleich breite Seitenspalten, solange Platz ist (sonst nie Überlappung).
   In der Mitte steht nur der Timer; WIP steht in der linken Gruppe neben dem Rundennamen
   (links: Runde und Zustand, Mitte: Zeit, rechts: Zugang). Bei 1024 px: Mitte ≤ 160 px,
   jede Seite ≥ 400 px, Beitrittsdaten ca. 370 px. */
.topbar--moderator { --topbar-h: 72px; grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr); }
.topbar--moderator .title { white-space: nowrap; }

/* ===== Station: Nachbarn, Stapel, Arbeitsbereich (REQ-002 AK-12) ===== */
.station {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  align-items: end;
  gap: var(--space-3);
  padding: 22px var(--space-4) var(--space-4);
  grid-template-rows: minmax(0, 1fr);
}
.station--push { grid-template-columns: 130px 110px minmax(400px, 1fr) 110px 130px; grid-template-areas: "left so work sn right"; }
.station--push.station--first { grid-template-areas: "left left work sn right"; }
.station--push.station--last { grid-template-areas: "left so work right right"; }
.station--pull { grid-template-columns: 200px minmax(400px, 1fr) 200px; grid-template-areas: "left work right"; }
.station__cell--left { grid-area: left; }
.station__cell--stack-own { grid-area: so; }
.station__cell--work { grid-area: work; height: 100%; min-height: 0; }
.station__cell--stack-next { grid-area: sn; }
.station__cell--right { grid-area: right; }

/* ===== Straßenansicht (REQ-005) ===== */
/* Direktes Kind von .app__root zwischen Kopfleiste und .station (feste Höhe, die Station
   schrumpft). Bei 1024 × 768: Station 564 px, Arbeitsbereich 464 × 526 px (Breite × Höhe, Push), AK-5. */
.street {
  flex: none;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr); /* N = 5 bis 10 füllen die ganze Breite */
  gap: var(--street-gap);
  margin: var(--street-margin) var(--space-4) 0;
}

/* ===== Moderatoransicht (REQ-010 AK-12) ===== */
.controls {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin: 22px var(--space-4) 0;
}
.controls__group { display: flex; gap: var(--space-2); }
.controls__group--end { margin-left: auto; }

.board {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: var(--space-2);
  margin: var(--space-3) var(--space-4) var(--space-4);
}

/* ===== Auswertung (REQ-010 AK-13) ===== */
.results {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  gap: var(--space-4);
  padding: 26px var(--space-4) var(--space-4);
}

/* ===== Lobby / Beitritt (REQ-006) ===== */
.lobby {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  padding: var(--space-6);
  overflow: hidden;
}
/* große Pastellkreise hinter dem Motiv (ci-design-tokens.md, 3.1 Nr. 8) */
.lobby::before, .lobby::after {
  content: "";
  position: absolute;
  z-index: -1;
  border-radius: 50%;
}
.lobby::before { width: 420px; height: 420px; left: 6%; top: 18%; background: var(--ci-pastel-blue-light); }
.lobby::after { width: 300px; height: 300px; right: 8%; bottom: 8%; background: var(--ci-pastel-pink-light); }

/* ===== Sperrhinweis für zu kleine Fenster (E-06, E-80: unter 1024 × 560, ersetzt 768 aus E-75 (2)) =====
   Grenze 1024 × 560, damit ein maximiertes Chrome-Fenster auf 1366 × 768 oder 1280 × 720 ohne
   Sperre spielt. Bei 560 px Höhe hat der Arbeitsbereich der Station 318 px (über 400 × 300 px).
   Die Lobby (body.app--lobby, auch der Beitritt unter /j/…) sperrt nur nach der Breite und
   scrollt bei wenig Höhe; die Station setzt beim Beitritt app--station und sperrt nach beidem. */
.size-guard {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  padding: var(--space-5);
  background: var(--color-bg);
  text-align: center;
}
.size-guard__art { display: flex; align-items: center; gap: var(--space-4); }
.size-guard__text { max-width: 22em; font-size: var(--fs-3); font-weight: 700; }
.size-guard__rotate { display: none; }
@media (max-width: 1023.98px) {
  .size-guard { display: flex; }
}
@media (max-height: 559.98px) {
  body:not(.app--lobby) > .size-guard { display: flex; }
}
/* Tablet im Hochformat: Drehen-Symbol statt "größeres Fenster" (REQ-002-gestaltung, 8) */
@media (orientation: portrait) and (min-width: 768px) and (max-width: 1023.98px) {
  .size-guard__art--resize, .size-guard__text--resize { display: none; }
  .size-guard__rotate { display: flex; }
}
