/* Spiral Wars — Fluss-Layout ueber mzone-ui.
 *
 * Bewusst KEIN position:fixed und keine 100vh-Buehne: das Artefakt wird unter
 * /published/{slug}/ auch in kurzen oder eingebetteten Viewports geoeffnet, und
 * dort ueberlappen fixierte Leisten den Spielbereich, statt sich zu stapeln.
 * Stattdessen: eine begrenzte Buehne mit fixem Seitenverhaeltnis, HUD darueber,
 * Dock darunter, Overlay absolut INNERHALB der Buehne.
 *
 * Die Teamfarben stehen als --c auf jedem Element, das eine KI vertritt;
 * gesetzt wird sie in game.js aus der AI-Tabelle, damit Farbe und Sigille
 * nie auseinanderlaufen. */

:root {
  --glass: rgba(9, 17, 26, 0.62);
  --glass-line: rgba(150, 200, 235, 0.16);
}

html, body {
  margin: 0;
  background: #030a10;
  overscroll-behavior-y: none;
}

body.mz-body { background: #030a10; }

.wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 14px 16px 20px;
  box-sizing: border-box;
}

/* ------------------------------------------------------------- Buehne */

#stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 74vh;
  margin: 0 auto;
  border-radius: 14px;
  overflow: hidden;
  background: #041018;
  box-shadow: inset 0 0 0 1px var(--glass-line), 0 18px 50px rgba(0, 0, 0, 0.55);
}

#view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

#vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(130% 90% at 50% 45%, transparent 46%, rgba(0, 6, 12, 0.45) 100%),
    linear-gradient(180deg, rgba(0, 8, 14, 0.5) 0%, transparent 18%, transparent 80%, rgba(0, 8, 14, 0.55) 100%);
}

/* ------------------------------------------------------------------ HUD */

#hud {
  display: grid;
  grid-template-columns: minmax(150px, 200px) 1fr minmax(150px, 200px);
  align-items: center;
  gap: 18px;
}

.hud__name {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--mz-text-strong);
  line-height: 1.15;
  text-shadow: 0 0 26px rgba(124, 196, 255, 0.25);
}

/* --------------------------------------------------- KI-Chips + Balken */

.hud__center { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

.teams {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.chip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 11px;
  border-radius: 10px;
  background: var(--glass);
  box-shadow: inset 0 0 0 1px var(--glass-line), 0 6px 20px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  transition: box-shadow 240ms ease, transform 240ms ease, opacity 400ms ease, filter 400ms ease;
}

.chip::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--c);
  box-shadow: 0 0 14px var(--c);
}

/* Feste Kantenlaenge auf dem Wrapper UND auf dem svg: ein svg ohne width/height
 * faellt sonst auf seine 300x150-Ersatzgroesse zurueck, sobald es in einem
 * Flex- oder Grid-Item ohne Groessenvorgabe landet. */
.chip__sigil { width: 18px; height: 18px; flex: none; color: var(--c); filter: drop-shadow(0 0 6px var(--c)); }
.chip__sigil svg { width: 18px; height: 18px; display: block; }

.chip__text { display: flex; flex-direction: column; min-width: 0; }

.chip__name {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mz-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chip__pct {
  font-family: var(--mz-mono);
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--mz-text-strong);
  line-height: 1.1;
}

.chip__pct small { font-size: 10px; opacity: 0.55; margin-left: 1px; }

.chip.leader {
  transform: translateY(-1px);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c) 55%, transparent), 0 8px 26px rgba(0, 0, 0, 0.45);
}

.chip.leader::after {
  content: "FÜHRT";
  position: absolute;
  right: 8px;
  top: 4px;
  font-family: var(--mz-mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--c);
  opacity: 0.85;
}

.chip.out { opacity: 0.34; filter: grayscale(0.75); }
.chip.out .chip__pct { text-decoration: line-through; }

.chip.out::after {
  content: "RAUS";
  position: absolute;
  right: 8px;
  top: 4px;
  font-family: var(--mz-mono);
  font-size: 8px;
  letter-spacing: 0.16em;
  color: var(--mz-text-muted);
}

.bar {
  position: relative;
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(180deg, #071723, #04101a);
  box-shadow: inset 0 0 0 1px var(--glass-line), inset 0 2px 8px rgba(0, 0, 0, 0.6);
}

.bar__seg {
  height: 100%;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 88%, white), var(--c));
  box-shadow: 0 0 16px color-mix(in srgb, var(--c) 60%, transparent);
  transition: width 140ms linear;
}

.bar__seg.leader::after {
  content: "";
  display: block;
  height: 100%;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.5) 50%, transparent 80%);
  animation: shimmer 2.1s linear infinite;
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

/* ------------------------------------------------------------ Anzeigen */

.hud__right { display: flex; align-items: center; justify-content: flex-end; gap: 16px; }

.gauge { text-align: right; }

.gauge__value {
  font-family: var(--mz-mono);
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--mz-text-strong);
  line-height: 1.05;
}

.gauge__label {
  font-family: var(--mz-mono);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mz-text-muted);
}

.gauge.hot .gauge__value { color: var(--mz-accent); text-shadow: 0 0 16px rgba(255, 59, 47, 0.5); }

/* ---------------------------------------------------------------- Dock */

#dock {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 9px 14px;
  border-radius: 12px;
  background: var(--glass);
  box-shadow: inset 0 0 0 1px var(--glass-line), 0 10px 30px rgba(0, 0, 0, 0.45);
}

#dock .mz-control { gap: 8px; }
#dock .mz-control__label { white-space: nowrap; }
#dock .mz-range { width: 108px; }

.switch { display: flex; align-items: center; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .mz-t-toggle { pointer-events: none; }

/* ------------------------------------------------------------- Overlay */

#overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
  background: radial-gradient(90% 70% at 50% 50%, rgba(3, 12, 20, 0.72), rgba(2, 7, 12, 0.93));
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  transition: opacity 260ms ease;
}

#overlay.hidden { opacity: 0; pointer-events: none; }

.panel {
  width: min(560px, 100%);
  max-height: 100%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 26px 20px;
  box-sizing: border-box;
  text-align: center;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(16, 26, 36, 0.92), rgba(8, 15, 22, 0.92));
  box-shadow:
    inset 0 0 0 1px rgba(150, 200, 235, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 24px 70px rgba(0, 0, 0, 0.7);
}

.panel .mz-title { margin: 0; font-size: clamp(24px, 3.4vw, 36px); letter-spacing: 0.02em; }
.panel .mz-lead { margin: 0; max-width: 50ch; font-size: 14px; line-height: 1.5; }
.panel .mz-small { margin: 2px 0 0; }
.panel .mz-btn { margin-top: 4px; padding: 10px 24px; font-size: 15px; }

.standings {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 2px 0;
}

.standings.empty { display: none; }

.standings .row {
  display: grid;
  grid-template-columns: 16px 16px 1fr auto auto;
  align-items: center;
  gap: 9px;
  padding: 6px 11px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px rgba(150, 200, 235, 0.09);
  font-size: 12px;
}

.standings .row.out { opacity: 0.42; }
.standings .rank { font-family: var(--mz-mono); color: var(--mz-text-muted); font-size: 10px; }
.standings .sig { width: 16px; height: 16px; flex: none; color: var(--c); filter: drop-shadow(0 0 5px var(--c)); }
.standings .sig svg { width: 16px; height: 16px; display: block; }
.standings .who { color: var(--mz-text-strong); text-align: left; }
.standings .pct { font-family: var(--mz-mono); font-variant-numeric: tabular-nums; color: var(--mz-text); }
.standings .state { font-family: var(--mz-mono); font-size: 10px; letter-spacing: 0.12em; color: var(--mz-text-muted); min-width: 56px; text-align: right; }

/* ------------------------------------------------------------- Schmal */

@media (max-width: 860px) {
  .wrap { padding: 10px 10px 16px; gap: 10px; }
  #hud { grid-template-columns: 1fr auto; gap: 10px; }
  .hud__center { grid-column: 1 / -1; order: 3; }
  .teams { gap: 6px; }
  .chip { padding: 4px 7px 4px 9px; gap: 6px; }
  .chip__sigil, .chip__sigil svg { width: 14px; height: 14px; }
  .chip__pct { font-size: 13px; }
  .chip.leader::after, .chip.out::after { display: none; }
  .gauge__value { font-size: 16px; }
  #stage { aspect-ratio: 4 / 3; max-height: 60vh; }
  #dock { gap: 10px; padding: 8px 10px; }
  #dock .mz-range { width: 78px; }
}
