:root {
  color-scheme: light dark;
  --bg: #150a30;
  --surface: #211440;
  --border: #3a2568;
  --text: #f4f1fb;
  --text-dim: #b6a8d9;
  --accent: #f5b942;
  --accent-fg: #1a0f2e;
  --danger: #ff6b6b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem;
}

.btn {
  display: inline-block;
  padding: 0.6rem 1rem;
  min-height: 2.75rem;
  margin: 4px;
  border: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  background: var(--accent);
  color: var(--accent-fg);
  cursor: pointer;
  transition: transform 100ms ease-out, opacity 100ms ease-out;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: default; }

.btn--secondary {
  background: var(--border);
  color: var(--text);
}

.btn--outline-danger {
  background: none;
  border: 1px solid rgba(255, 107, 107, 0.5);
  color: var(--danger);
}

.screen--start, .lobby-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 24px;
  border-radius: 12px;
  max-width: 420px;
  margin: 0 auto;
}

.screen--start input, .lobby-card input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 8px;
  margin: 4px 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
}

.error { color: var(--danger); font-size: 13px; }

.card {
  display: inline-block;
  position: absolute;
  width: 48px;
  height: 68px;
  border-radius: 6px;
  overflow: hidden;
  transition: left 200ms ease-out, top 200ms ease-out;
}

.card--clickable { cursor: pointer; }
.card--disabled { filter: grayscale(0.6) brightness(0.6); }

/* Sponsor-Branding auf verdeckten Kartenrueckseiten -- wie bei knack. */
.card--ad { background: #fff; }

.card-ad-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card--ad-text {
  background: var(--surface);
  color: var(--text);
  font-size: 0.55rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.1;
  padding: 2px;
  word-break: break-word;
}

.hand-container {
  position: relative;
  margin: 12px 0;
}

.discard-pile, .draw-pile {
  display: inline-block;
  position: relative;
  width: 60px;
  height: 84px;
  margin: 8px;
}

/* Tisch: Nachziehstapel, Ablage und die aktive Farbe nebeneinander. */
.table-area {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px;
  margin: 12px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 108px;
}

.pile-count {
  position: absolute;
  bottom: -2px;
  right: -2px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

/* Aktive Farbe -- nach einer Wild-Karte sonst nirgends ablesbar. */
.color-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
}

.color-indicator__label {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.color-indicator__dot {
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.45);
}

/* Zugrichtung -- ohne die Anzeige war eine Reverse-Karte nur an der
   ploetzlich vertauschten Zugreihenfolge erkennbar, nicht direkt sichtbar. */
.direction-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
}

.direction-indicator__label {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.direction-indicator__arrow {
  display: inline-block;
  font-size: 18px;
  line-height: 1;
}

/* Farbwahl nach einer Wild-Karte. */
.color-picker {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 12px;
  margin: 12px 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.color-picker .btn {
  width: 56px;
  min-width: 56px;
  height: 56px;
  margin: 0;
  border: 2px solid var(--border);
  border-radius: 10px;
}

.round-over-banner {
  padding: 10px 14px;
  margin: 0 0 12px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--surface);
  color: var(--accent);
  font-weight: 700;
  text-align: center;
}

.player-list {
  list-style: none;
  padding: 0;
  margin: 12px 0;
}

.player-list li {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid var(--border);
}

.player-list li.is-current-turn { color: var(--accent); font-weight: 700; }

/* Spielbildschirm: Gegner oben, ich unten -- jeweils in derselben Box mit
   Rahmen, der sich aktiviert, sobald diese Person am Zug ist (wie knack). */
.opponents {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.player-box {
  outline: 2px dashed var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  flex: 1 1 160px;
}

.player--turn {
  outline: 2px solid var(--accent);
}

.player-box__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
}

.turn-badge {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.8rem;
}

@keyframes action-toast-fade {
  0% { opacity: 0; transform: translateY(-3px); }
  15% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

/* Globale Status-Zone (Zeitbalken + Aktions-Einblendung) statt je einer
   Kopie pro Spieler-Box -- siehe
   games/docs/superpowers/specs/2026-09-24-layout-stable-action-timer-ui-design.md.
   .turn-progress-slot braucht display: flow-root zusaetzlich zu min-height
   als strukturelle Absicherung, weil ein alleiniges min-height
   CSS-Margin-Collapsing nicht stoppt -- der margin-top eines Kind-Elements
   kann sonst durch den Wrapper hindurch nach oben ausbrechen (siehe
   horde/knack, gleiche Aufgabenreihe). Anders als overflow: hidden erzeugt
   flow-root dabei keinen Scrollport, der Inhalt abschneiden koennte.
   .action-toast-slot braucht das NICHT: es ist bereits display: flex, und
   Flex-Items nehmen ohnehin nie an Margin-Collapsing teil -- ohne eigenes
   overflow bleibt hier auch das erste Frame der -3px-translateY-Fade-in-
   Animation des Toasts unclipped. */
.turn-progress-slot {
  min-height: 26px;
  margin-bottom: 6px;
  display: flow-root;
}

.action-toast-slot {
  min-height: 22px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
}

.turn-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.turn-progress-row__label {
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.turn-progress-row .turn-progress {
  flex: 1;
}

.action-toast {
  background: var(--danger);
  color: #1a0f2e;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  animation: action-toast-fade 2.5s ease-in-out forwards;
}

@media (prefers-reduced-motion: reduce) {
  .action-toast {
    animation: none;
  }
}

.player-box--me {
  margin-top: 12px;
}

/* Verdeckte Mini-Karten bei den Mitspielern -- zeigen die Handgroesse
   plastisch statt nur als Zahl, und sind die Werbeflaeche auf den
   Kartenrueckseiten (siehe games/docs/game-ip-check.md-Nachbarthema
   knack/docs/werbung-kartenrueckseite.md) auch bei fremden Haenden
   sichtbar -- deutlich kleiner als die eigene Hand, da EINS-Haende durch
   Ziehe-2/Ziehe-4-Strafen viel groesser werden koennen als bei knack. */
.opponent-hand-backs {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  margin-top: 6px;
}

.card--small {
  position: static;
  display: inline-block;
  width: 18px;
  height: 26px;
  transition: none;
}

.card--small svg { width: 100%; height: 100%; display: block; }

@keyframes card-reveal-in {
  from { transform: scale(0.85); opacity: 0.3; }
  to { transform: scale(1); opacity: 1; }
}

.card--reveal-anim {
  animation: card-reveal-in 280ms ease-out;
}

@media (prefers-reduced-motion: reduce) {
  .card--reveal-anim {
    animation: none;
  }
}

/* Countdown-Balken fuer den aktuellen Zug -- wie knacks .turn-progress.
   Label liegt als inset:0-Overlay auf dem Balken (nicht darunter), sonst
   wuerde .turn-progress' eigenes overflow:hidden es abschneiden. */
.turn-progress {
  position: relative;
  width: 100%;
  height: 18px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
}

.turn-progress-fill {
  height: 100%;
  transition: width 1s linear, background-color 300ms ease-out;
}

.turn-progress-fill--ok { background: #38d9a9; }
.turn-progress-fill--warn { background: #ffd166; }
.turn-progress-fill--urgent { background: #ff6b6b; }

.turn-progress-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
}

/* Bestaetigungsmodal fuers Verlassen waehrend des laufenden Spiels -- wie
   bei knack. Der Hintergrund liegt technisch bereits korrekt oben (blockiert
   Klicks ueberall, siehe elementFromPoint()-Check), aber 0.5 Deckkraft
   Schwarz auf dem ohnehin fast schwarzen --bg (#150a30) ist kaum sichtbar --
   die bunten Handkarten dahinter blieben knapp genauso leuchtend wie ohne
   Modal und wirkten dadurch "davor", obwohl sie es nicht sind. Deutlich
   hoehere Deckkraft + ein Schatten am Modal selbst schaffen den noetigen
   Kontrast.
*/
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 1rem;
  border-radius: 8px;
  max-width: 320px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Rundenende-Pause mit "Weiter"-Bereitschaft -- wie bei knacks Aufdeck-Halte
   zeit. Der Fortschrittsbalken teilt sich absichtlich .turn-progress* mit
   dem Zug-Countdown (gleiche Optik, gleiche Rolle: "wie lange noch bis
   automatisch weitergeht"). .round-over-banner existiert bereits weiter
   oben in dieser Datei.
*/
.round-ready {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.version-footer {
  font-size: 0.7rem;
  opacity: 0.6;
  text-align: center;
  margin-top: 1rem;
}

.voice-bar {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.voice-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.voice-participants {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.voice-participant {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.voice-participant-name {
  min-width: 5rem;
}

.voice-hostmute {
  font-size: 0.85rem;
  padding: 2px 6px;
}

.games-connection-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  text-align: center;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.games-connection-banner--reconnecting {
  background: var(--accent);
  color: var(--accent-fg);
}
.games-connection-banner--offline {
  background: var(--danger);
  color: #fff;
}

/* WebGL-Tisch (Basis: games/shared/gl/gl.css) */
.gl-wrap .direction-indicator,
.gl-wrap .color-indicator {
  position: absolute;
  top: 8px;
  z-index: 2;
  pointer-events: none;
}
.gl-wrap .direction-indicator { left: 8px; }
.gl-wrap .color-indicator { right: 8px; }
.hud-players {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 4px 0;
}
.player-chip {
  padding: 4px 10px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.9rem;
}
.player-chip.player--turn { border-color: var(--accent, #f5b942); }
.gl-actions { display: flex; gap: 8px; justify-content: center; min-height: 44px; }

/* Sitz-Labels im WebGL-Tisch */
.seat-label__name { max-width: 7.5em; overflow: hidden; text-overflow: ellipsis; }
.seat-label__count {
  min-width: 1.6em;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  text-align: center;
  font-weight: 800;
}
.seat-label__tag {
  padding: 1px 6px;
  border-radius: 999px;
  background: #2fae5b;
  color: #fff;
  font-weight: 800;
  font-size: 0.7rem;
}
.seat-label__tag[hidden] { display: none; }
.seat-label--low .seat-label__count { background: var(--danger); color: #fff; }
.seat-label--dense .seat-label__name { max-width: 4.5em; }
