/* Bauteile der Anwendung (REQ-010 Schritt 13, übernommen aus den Gestaltungs-Mockups (REQ-012),
   REQ-012). Farben, Schriften und Abstände nur über var(--…) aus tokens.css (AK-31).
   Pfade relativ zu dieser Datei (../img/). Zustände als Modifier am Bauteil (is-*, station--*).
   Keine Inline-Stile (CSP style-src 'self'): Lagen- und Stapelindizes kommen aus :nth-child,
   nicht aus style="--l:…". Einbindung: tokens.css, base.css, layout.css, components.css. */

/* ===== 1. Symbole (Sprite img/icons.svg, CI-Icons img/ci-*.svg) ===== */
.icon {
  width: 28px;
  height: 28px;
  flex: none;
  color: var(--color-ink);
  fill: none;
  --icon-fill: var(--ci-pastel-blue);
  --icon-fill-2: var(--ci-pastel-yellow);
  --icon-detail: var(--ci-gray);
  vertical-align: middle;
}
.icon--s { width: 20px; height: 20px; }
.icon--m { width: 24px; height: 24px; }
.icon--l { width: 36px; height: 36px; }
.icon--xl { width: 48px; height: 48px; }
.icon--guard { width: 96px; height: 96px; }
.icon--hourglass { width: 48px; height: 116px; }
.icon--hourglass-s { width: 14px; height: 32px; }
.icon--ready { color: var(--color-ready); --icon-fill: var(--ci-pastel-yellow-note); }
.icon--red { color: var(--color-red-edge); --icon-fill: var(--color-red-sheet); }
.icon--offline { color: var(--color-offline); }
.icon--muted { color: var(--color-ink-muted); }
.icon--plain { --icon-fill: transparent; }
/* KI trägt ihre Farbe im Symbol, nicht in der Fläche (E-79, REQ-011 AK-9) */
.icon--ai { --icon-fill: var(--color-ai); }

/* Fertig-Signal: Winken beim Erscheinen, danach sanftes Heben (REQ-002-gestaltung, 4) */
.wave { transform-origin: 50% 90%; animation: wave 400ms var(--ease-out) 1, lift 2s ease-in-out 400ms infinite; }
@keyframes wave { 0%, 100% { rotate: 0deg; } 25% { rotate: -8deg; } 50% { rotate: 8deg; } 75% { rotate: -8deg; } }
@keyframes lift { 0%, 80%, 100% { translate: 0 0; } 90% { translate: 0 -3px; } }

/* ===== 2. Knöpfe und Felder (Trefferfläche ≥ 44 × 44 px über --hit-min) ===== */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--hit-min);
  min-width: var(--hit-min);
  padding: var(--space-2) var(--space-4);
  border: 0;
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-ink);
  font: 700 var(--fs-2)/1.2 var(--font-ui);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: var(--shadow-note);
}
/* handgezeichneter Rahmen, vorgezeichnet als Maske (ci-design-tokens.md, 3.2) */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-scribble);
  -webkit-mask: url("../img/frame-2.svg") 0 0 / 100% 100% no-repeat;
  mask: url("../img/frame-2.svg") 0 0 / 100% 100% no-repeat;
  pointer-events: none;
}
.btn:nth-of-type(2n)::before { -webkit-mask-image: url("../img/frame-3.svg"); mask-image: url("../img/frame-3.svg"); }
.btn .icon { width: 24px; height: 24px; }
.btn:hover { background: var(--ci-gray-lighter); }
.btn--primary { background: var(--color-accent); color: var(--color-surface); }
.btn--primary .icon { color: var(--color-surface); --icon-fill: transparent; }
.btn--primary:hover { background: var(--color-accent); filter: brightness(.92); }
.btn--strong { background: var(--color-ink); color: var(--color-surface); }
.btn--strong .icon { color: var(--color-surface); --icon-fill: transparent; }
.btn--strong:hover { background: var(--color-ink-muted); }
.btn--small { min-height: var(--hit-min); padding: var(--space-1) var(--space-3); font-size: var(--fs-1); }
.btn--icon { padding: 0; width: var(--hit-min); }
.btn--wide { width: 100%; font-size: var(--fs-3); min-height: 52px; }
.btn:disabled, .btn[aria-disabled="true"] {
  background: var(--ci-gray-lighter);
  color: var(--color-ink-muted);
  box-shadow: none;
  cursor: not-allowed;
  filter: none;
}
.btn:disabled::before, .btn[aria-disabled="true"]::before { background: var(--color-ink-muted); }
.btn:disabled .icon, .btn[aria-disabled="true"] .icon { color: var(--color-ink-muted); }

.field { display: grid; gap: var(--space-1); }
.field__label { font-weight: 700; font-size: var(--fs-2); }
.field__input {
  min-height: 48px;
  padding: var(--space-2) var(--space-3);
  border: var(--border) solid var(--color-ink);
  border-radius: 10px;
  background: var(--color-surface);
  color: var(--color-ink);
  font: 400 var(--fs-3)/1.2 var(--font-ui);
  width: 100%;
}
.field__input--code { font-family: var(--font-numeric); letter-spacing: .12em; text-transform: uppercase; }
.field__input[aria-invalid="true"] { border-width: 3px; border-color: var(--color-red-edge); }
.field__error { display: flex; align-items: center; gap: var(--space-2); color: var(--color-red-edge); font-weight: 700; }

/* Haftnotiz (Lobby, Auswertung): Pastellfläche, leicht gedreht */
.note {
  position: relative;
  padding: var(--space-5);
  background: var(--ci-pastel-yellow-note);
  box-shadow: var(--shadow-note);
  rotate: calc(var(--rotate-note) * -1);
}
.note--blue { background: var(--ci-pastel-blue-light); rotate: var(--rotate-note); }
.note--pink { background: var(--ci-pastel-pink-light); }
.note--white { background: var(--color-surface); rotate: 0deg; }

/* Titel mit Pinselstrich-Linie (ci-design-tokens.md, 3.1 Nr. 4) */
.title { position: relative; display: inline-block; font-family: var(--font-display); font-weight: 400; line-height: var(--lh-display); }
.title::after {
  content: "";
  position: absolute;
  left: -4px;
  right: -8px;
  bottom: -6px;
  height: 8px;
  background: var(--ci-yellow);
  -webkit-mask: url("../img/edge-torn.svg") 0 0 / 120px 8px repeat-x;
  mask: url("../img/edge-torn.svg") 0 0 / 120px 8px repeat-x;
  z-index: -1;
}
.title--xl { font-size: var(--fs-7); }
.title--l { font-size: var(--fs-5); }
.title--m { font-size: var(--fs-4); }

/* ===== 3. Timer, Zähler, WIP ===== */
/* Timer m:ss, feste Ziffernbreite; Ring füllt sich in Live-Runden bis 2:00 */
.timer { display: flex; align-items: center; gap: var(--space-2); }
.timer__ring { width: 40px; height: 40px; rotate: -90deg; }
.timer__track { fill: none; stroke: var(--ci-gray-light); stroke-width: 4; }
.timer__progress { fill: none; stroke: var(--color-ink); stroke-width: 4; stroke-linecap: round; }
.timer__digits {
  min-width: 4ch;
  font-family: var(--font-numeric);
  font-size: var(--font-timer);
  line-height: var(--lh-numeric);
  font-variant-numeric: tabular-nums;
}
.timer.is-trial .timer__digits { color: var(--color-ink-muted); }
.timer.is-overtime .timer__progress { stroke: var(--color-red-sheet); }
.timer.is-overtime .timer__digits { font-weight: 700; }
.timer__red { display: inline-flex; }
.timer__red .icon { width: 26px; height: 26px; }

.counter { display: inline-flex; align-items: center; gap: var(--space-2); }
.counter__value { font-family: var(--font-numeric); font-size: var(--font-counter); line-height: var(--lh-numeric); min-width: 2ch; }
.counter--harbor { justify-content: center; }

/* WIP steht in der linken Gruppe der Moderator-Kopfleiste (siehe layout.css) */
.wip { display: flex; align-items: baseline; gap: var(--space-2); }
.wip__label { font-weight: 700; font-size: var(--fs-1); }
.wip__value { font-family: var(--font-numeric); font-size: var(--font-counter); line-height: 1; min-width: 3ch; }

/* Beitrittsdaten (Moderator): Link oben, Code darunter */
.join {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: var(--space-2);
  margin: 0;
  font-size: var(--fs-1);
  line-height: 1.3;
}
.join dt { font-weight: 700; color: var(--color-ink-muted); }
.join dd { margin: 0; }
.join__link { font-family: var(--font-numeric); }
.join__code { font-family: var(--font-numeric); font-size: var(--fs-3); letter-spacing: .1em; }

/* ===== 4. Werkstück (Falt-Engine renderView) und Platzhalter ===== */
.workpiece {
  position: relative;
  width: 100%;
  height: 100%;
  /* Farben des Blatts: --fold-* in tokens.css (REQ-003 AK-30) */
}
/* Platzhalter, solange (oder falls) die Engine nicht geladen ist: flaches Blatt */
.workpiece:not(.is-rendered)::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  height: 86%;
  max-width: 86%;
  aspect-ratio: 100 / 140;
  translate: -50% -50%;
  background: var(--color-paper-sheet);
  border: 1.5px solid var(--color-paper-edge);
  border-radius: 2px;
}
.workpiece[data-fit="model"]:not(.is-rendered)::before { height: 56%; }
.workpiece.is-red:not(.is-rendered)::before { background: var(--color-red-sheet); border-color: var(--color-red-edge); }
/* Glanzring hinter dem roten Teil, folgt der Form (REQ-002-gestaltung, 5) */
.workpiece.is-red > svg, .workpiece.is-red:not(.is-rendered)::before {
  filter: drop-shadow(0 0 3px var(--color-red-sheet)) drop-shadow(0 0 5px var(--color-red-sheet-back));
}

/* leere Mulde in Blattform */
.slot {
  width: auto;
  height: 70%;
  max-width: 80%;
  aspect-ratio: 100 / 140;
  margin: auto;
  border: 2px dashed var(--color-ink-muted);
  border-radius: 6px;
}
.slot--mini { height: 78%; border-width: 1.5px; border-radius: 3px; }
.slot--large { height: 62%; border-width: 3px; }

/* statischer Griff: Doppelkontur Weiß unter Blau, Trefferfläche ≥ 44 px (30 px + 2 × 10 px) */
.grip {
  position: absolute;
  right: -8px;
  top: 50%;
  z-index: 2;
  width: 30px;
  height: 30px;
  margin-top: -15px;
  border-radius: 50%;
  border: 3px solid var(--color-accent);
  background: var(--color-accent-soft);
  box-shadow: 0 0 0 3px var(--color-halo-light);
  animation: grip-pulse 1.2s ease-in-out infinite;
}
.grip::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; }
.grip--own { right: 14%; }
.grip--stack { top: auto; bottom: 23px; right: -14px; margin-top: 0; }
@keyframes grip-pulse { 0%, 100% { scale: 1; } 50% { scale: 1.2; } }

/* ===== 5. Straßenkachel (REQ-005) ===== */
.tile {
  position: relative;
  height: var(--tile-h);
  display: grid;
  grid-template-rows: 22px minmax(0, 1fr) 20px;
  gap: 2px;
  padding: 4px 6px 5px;
  border-radius: 8px;
  background: var(--color-surface);
  border: 2px solid var(--ci-gray-light);
}
.tile__head { display: flex; align-items: center; justify-content: space-between; gap: 2px; }
.tile__no { font-family: var(--font-numeric); font-size: var(--fs-3); line-height: 1; }
/* Signale rechts oben, Reihenfolge laut JS: offline vor Hand (B-01). Je 20 px (icon--s);
   bis drei Symbole passen neben die Nummer (Kachel ca. 94 px, innen ca. 80 px). */
.tile__signals { display: flex; align-items: center; gap: 2px; min-width: 0; }
.tile__body { display: flex; align-items: flex-end; gap: 4px; min-height: 0; }
.tile__body .workpiece, .tile__body .slot--mini { flex: 1 1 auto; min-width: 0; }
/* Namenszeile: Symbol "simuliert" (falls da) vor dem Namen, nebeneinander; der Name kürzt sich
   mit Ellipse, das Symbol schrumpft nie (B-01) */
.tile__name { display: flex; align-items: center; justify-content: center; gap: 3px; min-width: 0; }
.tile__name .icon { flex: none; }
.tile__text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--fs-1); line-height: 20px; }
/* kleines Symbol "simuliert" neben dem Namen (offline (sim)); allein ohne Namen bleibt es 20 px */
.tile__name .icon:not(:only-child) { width: 16px; height: 16px; }
/* eigene Station: Kontur in Akzentfarbe UND Zeiger nach unten zur eigenen Arbeitsfläche (AK-3) */
.tile.is-own { border: 3px solid var(--color-accent); padding: 3px 5px 4px; }
.tile.is-own::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 18px;
  height: 10px;
  translate: -50% 1px;
  background: var(--color-accent);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
/* fertig: grüne Innenlinie und Hand */
.tile.is-ready { box-shadow: inset 0 0 0 3px var(--color-ready); }
.tile.is-sim { background: var(--color-surface-neighbor); }
/* offline (sim), REQ-005 B-01: grau getönt wie simuliert, gestrichelter Rahmen in
   --color-offline (≥ 3:1 gegen Kachel und Straße), Werkstück voll sichtbar (keine Transparenz).
   Bedeutung nicht nur über Farbe: Strichelung + Symbol "offline" + Symbol "simuliert". */
.tile.is-offline { background: var(--color-surface-neighbor); }
.tile.is-offline:not(.is-own) { border-style: dashed; border-color: var(--color-offline); }
/* Absicherung: die eigene Kachel zeigt nie Offline-Merkmale, ihre Markierung gewinnt immer
   (REQ-005 "Eigene Kachel", H-6). Das JS setzt is-offline dort nicht; falls doch, bleibt sie
   wie .is-own ohne Tönung. */
.tile.is-own.is-offline { border: 3px solid var(--color-accent); background: var(--color-surface); }

/* Mini-Stapel (Straße: bis 6 Lagen, ab 6 mit Zahl; Moderator: bis 40 Lagen). Lagen von der
   Seite, älteste unten. Die Lagen stehen als erste Kinder im Element, in Reihenfolge; die Höhe
   kommt aus :nth-child (kein style-Attribut, CSP). */
.ministack { position: relative; flex: none; width: 18px; height: 100%; }
.ministack.is-none { width: 0; }
.ministack__layer {
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: calc(var(--l, 0) * 5px);
  height: 5px;
  border: 1px solid var(--color-paper-edge);
  border-radius: 1px;
  background: var(--color-paper-sheet);
}
.ministack__layer:nth-child(2) { --l: 1; }
.ministack__layer:nth-child(3) { --l: 2; }
.ministack__layer:nth-child(4) { --l: 3; }
.ministack__layer:nth-child(5) { --l: 4; }
.ministack__layer:nth-child(6) { --l: 5; }
.ministack__layer:nth-child(7) { --l: 6; }
.ministack__layer:nth-child(8) { --l: 7; }
.ministack__layer:nth-child(9) { --l: 8; }
.ministack__layer:nth-child(10) { --l: 9; }
.ministack__layer:nth-child(11) { --l: 10; }
.ministack__layer:nth-child(12) { --l: 11; }
.ministack__layer:nth-child(13) { --l: 12; }
.ministack__layer:nth-child(14) { --l: 13; }
.ministack__layer:nth-child(15) { --l: 14; }
.ministack__layer:nth-child(16) { --l: 15; }
.ministack__layer:nth-child(17) { --l: 16; }
.ministack__layer:nth-child(18) { --l: 17; }
.ministack__layer:nth-child(19) { --l: 18; }
.ministack__layer:nth-child(20) { --l: 19; }
.ministack__layer:nth-child(21) { --l: 20; }
.ministack__layer:nth-child(22) { --l: 21; }
.ministack__layer:nth-child(23) { --l: 22; }
.ministack__layer:nth-child(24) { --l: 23; }
.ministack__layer:nth-child(25) { --l: 24; }
.ministack__layer:nth-child(26) { --l: 25; }
.ministack__layer:nth-child(27) { --l: 26; }
.ministack__layer:nth-child(28) { --l: 27; }
.ministack__layer:nth-child(29) { --l: 28; }
.ministack__layer:nth-child(30) { --l: 29; }
.ministack__layer:nth-child(31) { --l: 30; }
.ministack__layer:nth-child(32) { --l: 31; }
.ministack__layer:nth-child(33) { --l: 32; }
.ministack__layer:nth-child(34) { --l: 33; }
.ministack__layer:nth-child(35) { --l: 34; }
.ministack__layer:nth-child(36) { --l: 35; }
.ministack__layer:nth-child(37) { --l: 36; }
.ministack__layer:nth-child(38) { --l: 37; }
.ministack__layer:nth-child(39) { --l: 38; }
.ministack__layer:nth-child(40) { --l: 39; }
.ministack__layer.is-red { background: var(--color-red-sheet); border-color: var(--color-red-edge); }
.ministack__count {
  position: absolute;
  left: 50%;
  bottom: 32px;
  translate: -50% 0;
  font-family: var(--font-numeric);
  font-size: var(--fs-1);
  line-height: 1;
}
.ministack.is-empty::before {
  content: "";
  position: absolute;
  left: 1px;
  right: 1px;
  bottom: 0;
  height: 8px;
  border: 1.5px dashed var(--color-ink-muted);
  border-radius: 2px;
}
.ministack .icon { position: absolute; bottom: 0; left: -1px; }

/* ===== 6. Station: Bauteile (REQ-002 AK-12) ===== */
.badge-no {
  position: absolute;
  top: 10px;
  left: 12px;
  z-index: 1;
  display: grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 4px;
  border: 2px solid var(--color-ink);
  border-radius: 13px;
  background: var(--color-surface);
  font-family: var(--font-numeric);
  font-size: var(--fs-1);
  line-height: 1;
}
.badge-no--own { min-width: 36px; height: 36px; border-radius: 18px; font-size: var(--fs-3); }

/* eigener Arbeitsbereich: weiß, Scribble-Rahmen; fertig = Rahmen 5 px grün + Hand */
.workarea {
  position: relative;
  height: 100%;
  border-radius: var(--radius);
  background: var(--color-surface);
}
.workarea::before, .workarea::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-scribble);
  -webkit-mask: url("../img/frame-1.svg") 0 0 / 100% 100% no-repeat;
  mask: url("../img/frame-1.svg") 0 0 / 100% 100% no-repeat;
  pointer-events: none;
}
.workarea::after { display: none; }
.workarea.is-ready::before, .workarea.is-ready::after { display: block; background: var(--color-ready); }
.workarea.is-ready::after { inset: 2px; -webkit-mask-image: url("../img/frame-2.svg"); mask-image: url("../img/frame-2.svg"); }
.workarea.is-target, .stack.is-target {
  outline: 3px dashed var(--color-accent);
  outline-offset: -14px;
}
.stack.is-target { outline-offset: 4px; border-radius: 8px; }
.workarea__signals { position: absolute; top: 10px; right: 14px; z-index: 1; display: flex; gap: var(--space-2); }
.workarea__piece { position: absolute; inset: 52px 44px 28px; display: flex; }
.workarea.is-waiting .workarea__piece { opacity: .45; }
.workarea__wait { position: absolute; left: 50%; top: 50%; translate: -50% -50%; }

/* Nachbarfenster k−1 / k+1: kleiner, blasser Grund, Form "alter Bildschirm" */
.neighbor {
  position: relative;
  height: 168px;
  background: var(--color-scribble);
  -webkit-mask: url("../img/mask-screen.svg") 0 0 / 100% 100% no-repeat;
  mask: url("../img/mask-screen.svg") 0 0 / 100% 100% no-repeat;
}
.station--pull .neighbor { height: 240px; }
.neighbor__screen {
  position: absolute;
  inset: 3px;
  background: var(--color-surface-neighbor);
  -webkit-mask: url("../img/mask-screen.svg") 0 0 / 100% 100% no-repeat;
  mask: url("../img/mask-screen.svg") 0 0 / 100% 100% no-repeat;
}
.neighbor.is-ready { background: var(--color-ready); }
.neighbor.is-ready .neighbor__screen { inset: 5px; }
.neighbor .badge-no { top: 8px; left: 10px; }
.neighbor__signals { position: absolute; top: 7px; right: 12px; z-index: 1; display: flex; gap: 2px; }
.neighbor__piece { position: absolute; inset: 40px 14px 12px; display: flex; }
.station--pull .neighbor__piece { inset: 48px 22px 18px; }

/* Stapel: Turm mit Entnahme unten, ältestes Teil ragt zur Arbeitsfläche (REQ-002-gestaltung, 2).
   Höchstens 8 Teile gezeichnet, ältestes als erstes Kind; Lage und Drehung aus :nth-child. */
.stack { position: relative; height: 300px; }
.stack__tower { position: absolute; inset: 0; }
.stack.is-tall .stack__tower { rotate: 2.5deg; transform-origin: 0 100%; }
.stack__item {
  position: absolute;
  left: 6px;
  right: 6px;
  bottom: calc(var(--i, 0) * 7px);
  height: 76px;
  rotate: var(--rot, 0deg);
}
.stack__item:nth-child(1) { --i: 0; --rot: -1.2deg; }
.stack__item:nth-child(2) { --i: 1; --rot: 1deg; }
.stack__item:nth-child(3) { --i: 2; --rot: -0.6deg; }
.stack__item:nth-child(4) { --i: 3; --rot: 1.4deg; }
.stack__item:nth-child(5) { --i: 4; --rot: -1.5deg; }
.stack__item:nth-child(6) { --i: 5; --rot: 0.8deg; }
.stack__item:nth-child(7) { --i: 6; --rot: -0.9deg; }
.stack__item:nth-child(8) { --i: 7; --rot: 1.2deg; }
.stack__item.is-oldest { translate: 10px 0; }
.stack__count {
  position: absolute;
  left: 50%;
  bottom: 150px;
  z-index: 1;
  translate: -50% 0;
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 36px;
  padding: 0 6px;
  border: 2px solid var(--color-ink);
  border-radius: 18px;
  background: var(--color-surface);
  font-family: var(--font-numeric);
  font-size: var(--fs-3);
  line-height: 1;
}
.stack.is-tall::after {
  content: "";
  position: absolute;
  left: 0;
  right: -6px;
  bottom: -8px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-ink);
  opacity: .18;
  filter: blur(3px);
}
.stack.is-empty { display: flex; align-items: flex-end; }
.stack.is-empty .slot { height: 76px; margin: 0 auto; }

/* Rohmaterial an Station 1: dicker Block Blätter */
.raw { position: relative; height: 230px; width: 170px; margin-left: auto; }
.raw__block {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 90px;
  border: 2px solid var(--color-paper-edge);
  border-radius: 3px;
  background: repeating-linear-gradient(to top, var(--color-paper-sheet) 0 4px, var(--color-paper-edge) 4px 5px);
}
.raw__top { position: absolute; left: 4px; right: 4px; bottom: 86px; height: 140px; display: flex; }

/* Hafen an Station N: Wasserstreifen, Zähler darüber (REQ-002-gestaltung, 6) */
.harbor { display: flex; flex-direction: column; align-items: stretch; gap: var(--space-3); height: 300px; justify-content: flex-end; }
.harbor__water {
  position: relative;
  height: 120px;
  border-radius: 14px 14px 4px 4px;
  background: var(--ci-pastel-blue-light);
  overflow: hidden;
}
.harbor__waves { position: absolute; left: 0; right: 0; bottom: 8px; width: 100%; height: 60px; }
.harbor__waves path { fill: none; stroke: var(--color-ink-muted); stroke-width: 2; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.harbor__boat { position: absolute; left: 50%; top: 8px; translate: -50% 0; animation: sail-in var(--dur-ship) var(--ease-out) 1 both, rock 3s ease-in-out var(--dur-ship) infinite; }
@keyframes sail-in { from { translate: -160% -30px; scale: 1.2; } to { translate: -50% 0; scale: 1; } }
@keyframes rock { 0%, 100% { rotate: 0deg; } 50% { rotate: 4deg; } }

/* Pause ‖, Beendet ■, älterer Tab (Schloss): abgedunkelte Fläche, Symbol in der Mitte */
.overlay {
  position: fixed;
  left: 0;
  right: 0;
  top: 66px;
  bottom: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  background: var(--color-overlay);
}
.overlay--full { top: 0; }
/* Mit Straße (REQ-005 AK-8): Overlay beginnt unter der Straße, auch beim älteren Tab (--full).
   Kopfleiste 56 px + Abstand + Kachel + 12 px für den Zeiger der eigenen Kachel = 216 px.
   Die Klasse has-street sitzt am body oder an .app__root. */
.has-street .overlay,
.has-street .overlay--full { top: calc(56px + var(--street-margin) + var(--tile-h) + 12px); }
.overlay__symbol {
  display: grid;
  place-items: center;
  width: 136px;
  height: 136px;
  border-radius: 50%;
  background: var(--color-surface);
  box-shadow: var(--shadow-note);
}
.overlay__symbol .icon { width: 80px; height: 80px; }
.is-frozen .grip, .is-frozen .wave, .is-frozen .harbor__boat { animation-play-state: paused; }

/* ===== 7. Moderatoransicht: Statuszeile und Stationskacheln (REQ-010 AK-12) ===== */
.status-line {
  flex: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 32px;
  margin: var(--space-3) var(--space-4) 0;
  font-size: var(--fs-2);
}
/* KI-Hinweis ohne Fläche (E-79): die KI-Farbe trägt nur das Symbol (.icon--ai) */
.status-line__ai { display: inline-flex; align-items: center; gap: var(--space-1); margin-left: var(--space-4); font-weight: 700; }

.board-tile {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 40px 84px minmax(0, 1fr) 28px auto;
  overflow: hidden;
  gap: var(--space-1);
  min-width: 0;
  padding: var(--space-2) var(--space-2);
  border-radius: 10px;
  background: var(--color-surface);
  box-shadow: var(--shadow-note);
}
.board-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-scribble);
  -webkit-mask: url("../img/frame-3.svg") 0 0 / 100% 100% no-repeat;
  mask: url("../img/frame-3.svg") 0 0 / 100% 100% no-repeat;
  pointer-events: none;
}
.board-tile:nth-child(2n)::before { -webkit-mask-image: url("../img/frame-1.svg"); mask-image: url("../img/frame-1.svg"); }
.board-tile__head { display: flex; align-items: center; justify-content: space-between; }
.board-tile__no { font-family: var(--font-numeric); font-size: var(--fs-5); line-height: 1; }
.board-tile__status { font-size: var(--fs-1); font-weight: 700; line-height: 1.2; min-height: 17px; }
.board-tile__signals { display: inline-flex; align-items: center; gap: 2px; }
.board-tile__name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
  font-size: var(--fs-1);
  line-height: 20px;
}
.board-tile__piece { display: flex; min-height: 0; padding: var(--space-1) 0; }
.board-tile__stack { position: relative; display: flex; align-items: flex-end; gap: var(--space-2); min-height: 0; }
.board-tile__count { font-family: var(--font-numeric); font-size: var(--font-counter); line-height: 1; }
.board-tile__nostack { color: var(--color-ink-muted); }
.board-tile__ready { display: flex; align-items: center; }
.board-tile__release { width: 100%; padding-left: 0; padding-right: 0; }
.board-tile__release-gap { display: block; height: var(--hit-min); }
/* fertig: grüne Innenlinie --border-ready (5 px). Der Scribble-Rahmen (::before, 3 px) liegt
   darüber; erst 5 px ergeben ein Band, das sichtbar breiter ist als der Rahmen allein
   (REQ-005 AK-3, B-30: im Push-Modus fehlt die Hand). */
.board-tile.is-ready { box-shadow: var(--shadow-note), inset 0 0 0 var(--border-ready) var(--color-ready); }
.board-tile.is-sim { background: var(--color-surface-neighbor); }
.board-tile.is-offline { background: var(--color-surface-neighbor); }
.board-tile.is-offline::before { background: var(--color-offline); }
.board-tile.is-offline .board-tile__status { color: var(--color-ink); }
/* KI-Station: Band oben in KI-Farbe statt Vollfläche (E-79). Die Fläche bleibt dem
   Status (echt weiß, sim/offline grau), beides ist kombinierbar. */
.board-tile.is-ai::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: var(--border-ai);
  background: var(--color-ai);
  pointer-events: none;
}
.board-tile.is-ai.is-ready::after { top: var(--border-ready); left: var(--border-ready); right: var(--border-ready); }
/* Umsetzen per Drag and Drop (REQ-014 AK-1): Name ziehbar, Zielkachel in der Zielflächen-Farbe */
.board-tile.is-movable .board-tile__name { cursor: grab; touch-action: none; user-select: none; }
.board-tile.is-drag-source { opacity: 0.6; }
.board-tile.is-drop-target { background: var(--color-accent-soft); box-shadow: var(--shadow-note), inset 0 0 0 var(--border-ready) var(--color-accent); }
.board-drag-ghost {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  max-width: 160px;
  padding: var(--space-1) var(--space-2);
  overflow: hidden;
  border-radius: 6px;
  background: var(--color-surface);
  box-shadow: var(--shadow-note);
  font-size: var(--fs-1);
  white-space: nowrap;
  text-overflow: ellipsis;
  pointer-events: none;
  translate: -50% -120%;
}
.ministack--board { width: 30px; height: 100%; }
.ministack--board .ministack__layer { height: 5px; border-radius: 1px; }
.ministack--board.is-empty::before { height: 10px; }
/* mehr als 40: Turm bleibt 40 Lagen hoch, Bruchzeichen unter der obersten Lage (E-79) */
.ministack--board.is-capped::after {
  content: "";
  position: absolute;
  left: -4px;
  right: -4px;
  bottom: calc(37 * 5px);
  height: 6px;
  border-block: 2px solid var(--color-ink);
  background: var(--color-surface);
  rotate: -12deg;
}
.board-tile.is-sim .ministack--board.is-capped::after,
.board-tile.is-offline .ministack--board.is-capped::after { background: var(--color-surface-neighbor); }

/* ===== 8. Auswertung (REQ-010 AK-13, REQ-002 AK-28) ===== */
.results__kpis { grid-column: 1 / -1; padding: var(--space-3) var(--space-4); }
.kpi-table { width: 100%; border-collapse: collapse; }
.kpi-table th, .kpi-table td { padding: 6px var(--space-3); text-align: left; vertical-align: middle; }
.kpi-table thead th { font-size: var(--fs-3); font-weight: 700; border-bottom: var(--border) solid var(--color-ink); }
.kpi-table thead th .icon { margin-right: var(--space-2); }
.kpi-table tbody tr + tr th, .kpi-table tbody tr + tr td { border-top: 1px solid var(--ci-gray-light); }
.kpi-table__label { display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 400; }
.kpi-table__value { font-family: var(--font-numeric); font-size: var(--fs-5); line-height: 1; }
.kpi-table__note { margin-left: var(--space-3); font-size: var(--fs-1); color: var(--color-ink-muted); }

.panel {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: var(--space-3) var(--space-4) var(--space-4);
  border-radius: var(--radius);
  background: var(--color-surface);
  box-shadow: var(--shadow-note);
}
.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--color-scribble);
  -webkit-mask: url("../img/frame-2.svg") 0 0 / 100% 100% no-repeat;
  mask: url("../img/frame-2.svg") 0 0 / 100% 100% no-repeat;
  pointer-events: none;
}
.panel__title { font-size: var(--fs-3); font-weight: 700; margin-bottom: var(--space-2); }
.panel__hint { font-size: var(--fs-1); font-weight: 400; color: var(--color-ink-muted); }
.panel__body { position: relative; min-height: 0; flex: 1 1 auto; }
.panel__body--scroll { overflow: auto; overscroll-behavior: contain; }
.panel__body--split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); align-items: start; }

.bars__title { position: sticky; top: 0; padding-bottom: var(--space-1); background: var(--color-surface); font-size: var(--fs-2); }
.bars__list { display: grid; gap: 3px; }
.bars__item { display: grid; grid-template-columns: 22px 1fr auto 20px; align-items: center; gap: var(--space-2); min-height: 22px; }
.bars__no { font-family: var(--font-numeric); font-size: var(--fs-1); color: var(--color-ink-muted); text-align: right; }
.bars__track { height: 12px; }
/* Balkenlänge ohne style-Attribut (CSP): <svg class="bars__track" viewBox="0 0 100 12"
   preserveAspectRatio="none"><rect class="bars__bar" width="63.5" height="12" rx="2"/></svg> */
svg.bars__track { display: block; width: 100%; }
.bars__bar { display: block; height: 100%; border-radius: 2px; background: var(--color-ink-muted); fill: var(--color-ink-muted); }
.bars__item.is-red .bars__bar { background: var(--color-red-sheet); fill: var(--color-red-sheet); }
.bars__value { font-family: var(--font-numeric); font-size: var(--fs-1); }
.bars__gap { width: 20px; }

.chart { display: block; width: 100%; height: auto; min-width: 380px; }
.chart__grid { stroke: var(--ci-gray-light); stroke-width: 1; }
.chart__label { fill: var(--color-ink-muted); font: 400 12px var(--font-numeric); }
.chart__mark { stroke: var(--color-red-sheet); stroke-width: 2; stroke-dasharray: 4 3; }
.chart__line { fill: none; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart__line--push { stroke: var(--color-ink); }
.chart__line--pull { stroke: var(--color-accent); stroke-dasharray: 7 4; }
.chart__series { fill: var(--color-ink); font: 700 14px var(--font-ui); }

/* ===== 9. Lobby / Beitritt (REQ-006), Rahmen in layout.css ===== */
.lobby__logo { display: block; width: 185px; height: auto; }
.lobby__title { margin-bottom: var(--space-3); }
.lobby__card { width: 400px; display: grid; gap: var(--space-4); }
.lobby__message { justify-items: center; text-align: center; }
.lobby__message-text { font-size: var(--fs-4); font-weight: 700; }
.lobby__joined { grid-template-columns: auto auto auto; justify-content: center; align-items: center; gap: var(--space-6); }
.lobby__station-no {
  display: grid;
  place-items: center;
  min-width: 96px;
  height: 96px;
  border: 3px solid var(--color-ink);
  border-radius: 48px;
  background: var(--color-surface);
  font-family: var(--font-numeric);
  font-size: var(--fs-8);
  line-height: 1;
}

@media (prefers-reduced-motion: reduce) {
  .wave, .harbor__boat, .grip { animation: none; }
}
