/* ============================================================================
   components.css — UI-Bausteine
   ----------------------------------------------------------------------------
   Klassenlose Primitives, die auf mehreren Screens wiederverwendet werden:
   Topbar, Status-Punkt, Logo, Icon-Button, Kacheln, Code-Pille, Toast,
   Buttons, Felder, Panel, Glasmorphismus-Karten.

   Welle 2/3 ergänzen: .sheet (Bottom-Sheet aus cosmic.html:500-626),
   .dialog (H4) und die H1-Statuszustände (verbunden / verbindet neu /
   getrennt) am .status-dot. --game-accent bleibt unverändert, damit die
   Game-Registrierung ihre Inline-Variable weiter setzen kann.
   ============================================================================ */

/* ── Topbar (cosmic.html:213-267, angepasst an Desktop) ─────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  height: 52px;
  flex-shrink: 0;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--nebula-cyan);
  box-shadow: 0 0 12px var(--nebula-cyan), 0 0 24px rgba(34, 211, 238, 0.5);
  animation: pulse 2.2s ease-in-out infinite;
  flex-shrink: 0;
}

.logo {
  font-weight: 800;
  letter-spacing: 3px;
  font-size: 16px;
  background: linear-gradient(90deg, var(--nebula-cyan) 0%, var(--nebula-magenta) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.me { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 13px; }
.me .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--bg-panel);
  border: 1px solid rgba(34, 211, 238, 0.18);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.2s var(--ease-out);
  font-family: inherit;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover, .icon-btn:focus-visible {
  outline: none;
  border-color: var(--nebula-cyan);
  box-shadow: 0 0 16px rgba(34, 211, 238, 0.4);
  transform: translateY(-1px);
}
.icon-btn:active { transform: translateY(0) scale(0.96); }

/* ── Symbole aus der Sammlung (#iconSprite in index.html) ───────────────
   Ein <use href="#ic-…"> erbt keine Größe, deshalb hier eine feste. `em`
   statt `px`: die Symbole skalieren mit der Schriftgröße ihres Knopfes,
   ein .btn.tiny bekommt also automatisch kleinere Icons. `currentColor`
   im Symbol plus vertical-align hält sie auf der Textgrundlinie. */
.icon {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
  flex: none;
  pointer-events: none;
}
.icon-btn .icon { width: 18px; height: 18px; vertical-align: 0; }
/* Zwischen Symbol und Beschriftung darf kein Zeilenumbruch liegen — sonst
   steht das Symbol allein über dem Text („+ Bot" wurde zweizeilig). Bewusst
   nur `white-space`: ein `display` an dieser Stelle würde mit den
   `.hidden`-Regeln weiter unten um die Sichtbarkeit streiten. */
.btn:has(> .icon), .badge:has(> .icon) { white-space: nowrap; }

/* ── Spiel-Badge (style.css:147-160) ────────────────────────────────── */
.game-badge {
  display: inline-block;
  background: var(--game-accent, var(--accent));
  color: #0c0c10;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 3px 8px;
  border-radius: 6px;
  margin-right: 8px;
  vertical-align: middle;
}
.game-badge.small { font-size: 10px; padding: 2px 6px; margin-right: 6px; }
.logo .game-badge { margin-right: 10px; }

/* ── Kacheln (cosmic.html:300-412) ───────────────────────────────────── */
.tile {
  aspect-ratio: 1;
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  font-family: inherit;
  color: var(--text-primary);
  transition: transform 0.3s var(--ease-bounce),
              box-shadow 0.3s var(--ease-out),
              border-color 0.3s var(--ease-out);
  --c: var(--nebula-cyan);
  isolation: isolate;
}
.tile::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius-lg);
  padding: 1px;
  background: linear-gradient(135deg, var(--c) 0%, transparent 50%, var(--c) 100%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0.35;
  transition: opacity 0.3s var(--ease-out);
  z-index: 1;
}
.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 100%, var(--c), transparent 65%);
  opacity: 0;
  transition: opacity 0.3s var(--ease-out);
  z-index: 0;
}
.tile-cyan    { --c: var(--nebula-cyan); }
.tile-magenta { --c: var(--nebula-magenta); }
.tile-pink    { --c: var(--nebula-pink); }
.tile-gold    { --c: var(--star-warm); }

.tile:hover, .tile:focus-visible {
  outline: none;
  transform: translateY(-3px) scale(1.02);
  border-color: transparent;
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.45),
    0 0 24px color-mix(in srgb, var(--c) 30%, transparent);
}
.tile:hover::before, .tile:focus-visible::before { opacity: 1; }
.tile:hover::after,  .tile:focus-visible::after  { opacity: 0.18; }
.tile:active { transform: translateY(-1px) scale(0.99); transition-duration: 0.1s; }

/* ── Cover-Bereich der Tile: ist Träger der Live-Hover-Demo ─────── */
.tile-cover {
  position: relative;
  width: calc(100% - 16px);
  margin: 8px 8px 0;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.01));
  isolation: isolate;
}
.tile-cover .tile-icon {
  transition: transform 0.4s var(--ease-bounce),
              opacity 0.3s var(--ease-out);
}
.tile-cover.demo-on .tile-icon { opacity: 0; }
.tile-cover .demo-host {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.tile-cover .demo-host canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Hover-Iconskalierung gegen nicht-Hover gedreht (cover behält die Ruhe) */
.tile:hover .tile-cover .tile-icon { transform: scale(1.06); }
.tile-icon {
  width: 56px;
  height: 56px;
  color: var(--c);
  filter: drop-shadow(0 0 10px var(--c));
  z-index: 2;
  transition: transform 0.4s var(--ease-bounce);
}
.tile:hover .tile-icon { transform: scale(1.1) rotate(-3deg); }

.tile-label {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  z-index: 2;
}
.tile-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.2em;
  color: var(--text-dim);
  text-transform: uppercase;
  z-index: 2;
}

.ripple {
  position: absolute;
  border-radius: 50%;
  background: var(--c, var(--nebula-cyan));
  transform: scale(0);
  animation: ripple-expand 0.65s var(--ease-out);
  pointer-events: none;
  opacity: 0.45;
  z-index: 3;
}
@keyframes ripple-expand {
  to {
    transform: scale(5);
    opacity: 0;
  }
}

/* ── Code-Pille (cosmic.html:421-498) ────────────────────────────────── */
.code-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  background: var(--bg-panel-strong);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-lg);
  position: relative;
  overflow: hidden;
}
.code-pill::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    rgba(34, 211, 238, 0.06) 0%,
    rgba(232, 121, 249, 0.06) 100%);
  pointer-events: none;
}
.code-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  z-index: 1;
}
.code-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.28em;
  color: var(--text-dim);
  text-transform: uppercase;
}
.code-value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.18em;
  background: linear-gradient(90deg, var(--nebula-cyan), var(--nebula-magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.copy-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--nebula-cyan) 0%, var(--nebula-blue) 100%);
  border: none;
  color: var(--bg-space);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 0 18px rgba(34, 211, 238, 0.5),
    inset 0 0 0 1px rgba(255, 255, 255, 0.15);
  transition: all 0.25s var(--ease-bounce);
  flex-shrink: 0;
  z-index: 1;
  font-family: inherit;
}
.copy-btn svg { width: 18px; height: 18px; }
.copy-btn:hover, .copy-btn:focus-visible {
  outline: none;
  transform: scale(1.08);
  box-shadow: 0 0 28px rgba(34, 211, 238, 0.75);
}
.copy-btn:active { transform: scale(0.95); }
.copy-btn.copied {
  background: linear-gradient(135deg, var(--nebula-magenta) 0%, var(--nebula-pink) 100%);
  box-shadow: 0 0 28px rgba(232, 121, 249, 0.7);
}

/* ── Toast (cosmic.html:628-654) ────────────────────────────────────── */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 100px);
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-panel-strong);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: var(--radius-md);
  padding: 10px 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--nebula-cyan);
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
  z-index: 200;
  white-space: nowrap;
  max-width: 80%;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
/* Fallback-Zustände (style.css:663-664) — werden in Welle 3 (H9 ERRORS)
   zusätzlich mit Aktionsknöpfen versehen. */
.toast.err { border-color: var(--nebula-pink); color: var(--nebula-pink); }
.toast.ok  { border-color: var(--nebula-cyan); color: var(--nebula-cyan); }

/* ── Buttons (style.css:87-110) ─────────────────────────────────────── */
.btn {
  background: var(--btn);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease;
  font-family: inherit;
}
.btn:hover { background: var(--btn-hover); }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: linear-gradient(135deg, var(--nebula-cyan), var(--nebula-pink));
  border: none;
  color: var(--bg-space);
  font-weight: 700;
  letter-spacing: 1px;
  width: 100%;
  padding: 12px;
  margin-top: 8px;
}
.btn.primary:hover { filter: brightness(1.1); }
.btn.tiny { padding: 6px 10px; font-size: 12px; }
/* Destruktive Aktion (Raum verlassen, loeschen) — gleicher Rotton wie
   die .danger-Eintraege im Bottom-Sheet, damit der Button auffaellt ohne
   den Topbar-Look zu sprengen. */
.btn.danger {
  background: rgba(255, 27, 141, 0.12);
  border-color: rgba(255, 27, 141, 0.4);
  color: var(--nebula-pink);
}
.btn.danger:hover {
  background: rgba(255, 27, 141, 0.2);
  border-color: var(--nebula-pink);
}

/* ── Felder (style.css:72-85) ───────────────────────────────────────── */
.field { display: block; text-align: left; margin: 12px 0; }
.field span {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 4px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.field input, .field select {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--fg);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  font-family: inherit;
}
.field input:focus, .field select:focus { border-color: var(--nebula-cyan); }
.field.checkbox-field { display: flex; align-items: center; gap: 8px; }
.field.checkbox-field input { width: auto; flex: none; }
.field.checkbox-field span {
  display: inline;
  margin: 0;
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--fg);
}
.field.hidden { display: none; }

.hint { color: var(--text-secondary); font-size: 12px; margin-top: 16px; }

/* ── Panel / Glasmorphismus (style.css:432-451) ─────────────────────── */
.panel {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.panel.grow { flex: 1; min-height: 0; }
.panel.hidden { display: none; }

.panel-title {
  background: var(--bg-3);
  padding: 10px 14px;
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.login-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  padding: 36px 44px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  width: 360px;
  text-align: center;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.title {
  font-size: 36px;
  letter-spacing: 4px;
  margin: 0 0 0;
  color: var(--text-primary);
  font-weight: 800;
}
.title-2 {
  font-size: 42px;
  background: linear-gradient(90deg, var(--nebula-cyan), var(--nebula-pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.subtitle { color: var(--text-secondary); margin: 4px 0 24px; }

/* ── Badges (style.css:131-143) ─────────────────────────────────────── */
.badge {
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.badge.playing { color: var(--warn); border-color: var(--warn); }
.badge.ended   { color: var(--nebula-pink); border-color: var(--nebula-pink); }
.badge.paused  { color: #ffd740; border-color: #ffd740; }
.badge.private-badge.hidden { display: none; }

/* ── Bedienhilfen (style.css:1157-1168) ─────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Wiederverbindungsband (Phase 1.10) ─────────────────────────────────── */
.reconnect-band {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 8px 14px;
  background: rgba(255, 27, 141, 0.18);
  border-bottom: 1px solid var(--nebula-pink);
  backdrop-filter: blur(8px);
  color: var(--nebula-pink);
  font-size: 12px;
  letter-spacing: 0.5px;
  font-family: 'JetBrains Mono', monospace;
}
.reconnect-band.hidden { display: none; }
.reconnect-band .btn { background: rgba(0,0,0,0.4); color: var(--nebula-pink); border-color: var(--nebula-pink); }

/* ── Dialog (Phase 1.8 / H4) ────────────────────────────────────────────── */
.dialog-root.hidden { display: none; }
.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 400;
  background: rgba(5, 8, 17, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.dialog-card {
  background: var(--bg-deep);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dialog-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--nebula-cyan);
  letter-spacing: 1px;
}
.dialog-body {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.5;
}
.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 4px;
}
.dialog-actions .btn.cancel {
  background: transparent;
  color: var(--text-secondary);
}

/* ── Bottom-Sheet (Phase 1.6) ──────────────────────────────────────────── */
.sheet-root.hidden { display: none; }
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 350;
  background: rgba(5, 8, 17, 0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.sheet-card {
  background: var(--bg-deep);
  border-top-left-radius: var(--radius-lg);
  border-top-right-radius: var(--radius-lg);
  border: 1px solid var(--border);
  width: min(520px, 100%);
  padding: 18px 14px calc(env(safe-area-inset-bottom, 0px) + 18px);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: sheet-up 0.3s var(--ease-out);
}
@keyframes sheet-up {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.sheet-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.sheet-item {
  width: 100%;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.sheet-item:hover, .sheet-item:focus-visible {
  outline: none;
  border-color: var(--nebula-cyan);
}
.sheet-item.danger { color: var(--nebula-pink); border-color: rgba(255, 27, 141, 0.3); }

/* Sichtbarer Fokusring für Tastaturbedienung — :focus-visible statt :focus,
   damit ein Mausklick keinen Ring hinterlässt. */
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--nebula-cyan);
  outline-offset: 2px;
}
.field input:focus-visible,
.field select:focus-visible {
  outline: 2px solid var(--nebula-cyan);
  outline-offset: 1px;
}

/* ── Deaktivierte Vorschau-Kachel (Phase 6, status === 'soon') ──────────
   Ein geplantes Spiel soll im Menü sichtbar sein, aber nicht klickbar.
   Wir tauschen den <button> gegen eine <div> und unterdrücken jede
   Interaktion. Der Glasmorphismus bleibt, nur der Glow greift nicht mehr. */
.game-card-soon {
  cursor: not-allowed;
  opacity: 0.55;
  filter: grayscale(0.35);
  pointer-events: none;
}
.game-card-soon:hover {
  border-color: var(--border);
  box-shadow: var(--shadow);
  transform: none;
}
.game-card-soon::before,
.game-card-soon::after { opacity: 0; }
.game-card-soon .game-card-title::after {
  content: ' — Demnächst';
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-left: 6px;
}

/* ── Statistikbereich (Phase 4) ─────────────────────────────────────────── */
/* screens.css enthielt seit Phase 1 einen #statsView-Stub mit display:flex.
   Die höhere Spezifität hier stellt den normalen .screen-Vertrag wieder her. */
#statsView.screen {
  display: none;
  min-width: 0;
  padding: 0;
  gap: 0;
  overflow: hidden;
}
#statsView.screen.show { display: flex; }

.stats-shell {
  width: min(1100px, 100%);
  min-width: 0;
  margin: 0 auto;
  padding: clamp(10px, 3vw, 28px);
  overflow-x: hidden;
  overflow-y: auto;
}

.stats-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 18px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-panel-strong);
}

.stats-tab {
  min-width: 0;
  padding: 10px 6px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.stats-tab.active {
  color: var(--bg-space);
  background: linear-gradient(135deg, var(--nebula-cyan), var(--nebula-magenta));
}

.stats-tab-panel { min-width: 0; }
.stats-tab-panel.hidden { display: none; }

.stats-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stats-kpi {
  min-width: 0;
  min-height: 104px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  overflow: hidden;
}
.stats-kpi-label {
  color: var(--text-secondary);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.stats-kpi-value {
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(22px, 5vw, 34px);
  line-height: 1;
}

.stats-overview-grid,
.stats-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
}
.stats-overview-grid > :first-child { grid-column: 1 / -1; }

.stats-chart-card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  overflow: hidden;
}
.stats-chart-title {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.stats-chart-host {
  width: 100%;
  min-width: 0;
  padding: 10px;
}
.stats-chart {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  overflow: visible;
}
.stats-chart text { font-family: 'JetBrains Mono', monospace; }
.stats-chart-empty { max-height: 180px; }

.stats-game-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
  min-width: 0;
}
.stats-game-card {
  min-width: 0;
  min-height: 100px;
}
.stats-game-card.active {
  border-color: var(--game-accent);
  box-shadow: 0 0 0 1px var(--game-accent), var(--shadow);
}
.stats-game-card .game-card-body { width: 100%; }
.stats-game-card .game-card-meta { overflow-wrap: anywhere; }

.stats-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.stats-filters .field {
  flex: 1 1 150px;
  min-width: 0;
  margin: 0;
}

.stats-kpi-grid > .stats-empty { grid-column: 1 / -1; }

.stats-empty {
  width: min(420px, 100%);
  margin: 20px auto;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  text-align: center;
}
.stats-empty .vector { width: min(280px, 100%); }
.stats-empty-hint {
  margin: 10px 0 16px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.stats-skeleton,
.stats-chart-skeleton {
  position: relative;
  overflow: hidden;
  background: linear-gradient(100deg, var(--bg-panel), var(--bg-panel-strong), var(--bg-panel));
  background-size: 200% 100%;
  animation: stats-skeleton-shift 1.3s ease-in-out infinite;
}
.stats-skeleton-line,
.stats-skeleton-value {
  display: block;
  border-radius: var(--radius-sm);
  background: var(--text-decor);
}
.stats-skeleton-line { width: 58%; height: 10px; }
.stats-skeleton-value { width: 74%; height: 28px; }
.stats-chart-skeleton {
  min-height: 180px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
@keyframes stats-skeleton-shift {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

@media (max-width: 640px) {
  .stats-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stats-kpi { min-height: 88px; padding: 12px; }
  .stats-overview-grid,
  .stats-detail-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .stats-overview-grid > :first-child { grid-column: auto; }
  .stats-tab { font-size: 11px; padding-inline: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  .stats-skeleton,
  .stats-chart-skeleton { animation: none; }
}

/* ── Gruppen-Panel auf der Front-Page ───────────────────────────── */
.group-panel {
  margin: 0 16px 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-panel);
}
.group-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.group-panel-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--text-secondary);
}
.group-panel-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.18em;
  color: var(--text-dim);
}
.group-player-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.group-player-list .empty {
  color: var(--text-dim);
  font-size: 12px;
  font-style: italic;
}
.group-player {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  font-size: 12px;
}
.group-player .swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}
.group-player .name { color: var(--text-primary); }
.group-player .badge-host {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--nebula-cyan);
}
.group-player .bot-marker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--text-dim);
}

/* ── Lobby-Karten: Mitspielernamen ──────────────────────────────── */
.room-card-players {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 8px;
}
.room-card-player {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  font-size: 11px;
  color: var(--text-secondary);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.room-card-player .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: none;
}
.room-card-player .bot-marker {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--text-dim);
}
.room-card-overflow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-dim);
  align-self: center;
}
