:root {
  color-scheme: dark;
  --bg: #07111f;
  --bg-alt: #0d1b2d;
  --panel: rgba(13, 27, 45, 0.92);
  --panel-border: rgba(139, 180, 255, 0.18);
  --text: #eef5ff;
  --muted: #93a8c7;
  --accent: #64d2ff;
  --accent-2: #8b5cf6;
  --success: #34d399;
  --danger: #fb7185;
  --warning: #fbbf24;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 100%),
    radial-gradient(circle at 80% 30%, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 100%),
    radial-gradient(circle at top, rgba(100, 210, 255, 0.12), transparent 30%),
    radial-gradient(circle at bottom right, rgba(139, 92, 246, 0.16), transparent 28%),
    linear-gradient(180deg, #050b14, #091426 55%, #07111f);
  background-size: auto, auto, auto, auto, auto;
  color: var(--text);
}

input {
  font: inherit;
}

button {
  font: inherit;
}

.app-shell,
.shell {
  padding: 20px;
  max-width: 1680px;
  margin: 0 auto;
}

#app-root {
  display: grid;
  gap: 18px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(480px, 1fr) minmax(280px, 340px);
  gap: 18px;
  align-items: start;
}

.sidebar,
.center-panel {
  display: grid;
  gap: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-body {
  padding: 16px;
}

.card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 14px;
}

.cosmic-glass {
  background:
    linear-gradient(180deg, rgba(10, 18, 34, 0.92), rgba(10, 18, 34, 0.84)),
    radial-gradient(circle at top right, rgba(100, 210, 255, 0.12), transparent 42%);
  backdrop-filter: blur(18px);
}

.card:hover,
.player-row:hover,
.system-card:hover,
.planet-card:hover {
  border-color: rgba(100, 210, 255, 0.22);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.panel-header h2 {
  margin: 0;
  font-size: 1rem;
}

.status-content,
.prompt-content,
.action-content,
.encounter-content,
.board-content,
.hand-content,
.score-content,
.log-content {
  padding: 16px;
}

.phase-badge,
.small-pill,
.token-badge,
.card-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(100, 210, 255, 0.12);
  border: 1px solid rgba(100, 210, 255, 0.2);
  color: var(--accent);
  font-size: 0.8rem;
}

.pill-ai {
  color: #a7f3d0;
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.24);
}

.pill-human {
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.16);
  border-color: rgba(139, 92, 246, 0.24);
}

.pill-success {
  color: var(--success);
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.24);
}

.pill-warning {
  color: var(--warning);
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.24);
}

.primary-btn,
.secondary-btn,
.option-btn,
.ghost-btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease, background 120ms ease;
}

.primary-btn:hover,
.secondary-btn:hover,
.option-btn:hover,
.ghost-btn:hover {
  transform: translateY(-1px);
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), #3b82f6);
  color: #04111e;
  font-weight: 700;
}

.secondary-btn,
.option-btn {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ghost-btn {
  background: transparent;
  color: var(--muted);
  border: 1px dashed rgba(255, 255, 255, 0.16);
}

.action-content {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 0;
}

.notes-list,
.bullet-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.list-tight {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.4;
}

.audit-card {
  border-color: rgba(251, 191, 36, 0.2);
  background: rgba(251, 191, 36, 0.06);
}

.victory-card {
  border-color: rgba(52, 211, 153, 0.24);
  background: rgba(52, 211, 153, 0.08);
}

.coverage-card {
  border-color: rgba(148, 163, 184, 0.18);
  background: rgba(15, 23, 42, 0.45);
}

.oracle-card {
  border-color: rgba(96, 165, 250, 0.25);
  background: rgba(96, 165, 250, 0.08);
}

.stack-lg,
.stack-md,
.stack-sm,
.column {
  display: grid;
}

.stack-lg {
  gap: 16px;
}

.stack-md,
.column {
  gap: 12px;
}

.column,
.panel,
.panel-body,
.card {
  min-width: 0;
}

.stack-sm {
  gap: 8px;
}

.wrap {
  flex-wrap: wrap;
}

.slim {
  gap: 6px;
}

.grow {
  flex: 1 1 auto;
}

.center-content {
  justify-items: center;
  text-align: center;
}

.setup-grid,
.app-grid {
  display: grid;
  gap: 18px;
}

.setup-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.app-grid {
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr) minmax(280px, 360px);
  align-items: start;
}

.broadcast-panel {
  position: relative;
  overflow: hidden;
}

.broadcast-panel::after {
  content: '';
  position: absolute;
  inset: auto -10% -120px auto;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(100, 210, 255, 0.16), transparent 68%);
  pointer-events: none;
}

.broadcast-stage {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: center;
}

.broadcast-player-card,
.encounter-side {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}

.inspectable-card,
.icon-button,
.text-button,
.table-planet,
.table-system-head {
  cursor: pointer;
}

.inspectable-card,
.icon-button,
.text-button,
.table-planet,
.table-system-head {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  text-align: left;
}

.inspectable-card:hover {
  border-color: rgba(100, 210, 255, 0.26);
}

.icon-button {
  display: inline-flex;
  border-radius: 18px;
}

.text-button:hover {
  color: var(--accent);
}

.muted-button {
  color: var(--muted);
}

.muted-button:hover {
  color: var(--accent);
}

.broadcast-player-card.ghosted,
.encounter-side.ghosted {
  opacity: 0.7;
}

.broadcast-vs,
.encounter-versus {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--accent);
  background: rgba(100, 210, 255, 0.1);
  border: 1px solid rgba(100, 210, 255, 0.22);
  box-shadow: 0 0 24px rgba(100, 210, 255, 0.16);
}

.hero-callout,
.timeline-card {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-callout h3,
.timeline-card h3 {
  margin-top: 0;
  margin-bottom: 10px;
}

.timeline-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.showcase-card {
  display: grid;
  gap: 10px;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.library-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.library-chip strong {
  color: var(--text);
  text-transform: capitalize;
}

.showcase-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.showcase-thumb {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  padding: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

.alien-portrait {
  width: 68px;
  height: 68px;
  flex: 0 0 68px;
  object-fit: contain;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(214, 229, 255, 0.88));
  padding: 6px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

.alien-portrait.large {
  width: 88px;
  height: 88px;
  flex-basis: 88px;
}

.alien-portrait.placeholder {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02));
  border: 1px dashed rgba(255, 255, 255, 0.15);
}

.encounter-hero {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 14px;
  align-items: center;
}

.private-hero {
  display: flex;
  align-items: center;
  gap: 16px;
}

.draft-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.field-label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.toggle-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.text-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.text-input::placeholder {
  color: var(--muted);
}

.short-input {
  max-width: 120px;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.setup-player-card {
  position: relative;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--player-color) 40%, rgba(255, 255, 255, 0.08));
}

.setup-player-card::before,
.player-row::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--player-color, var(--accent));
}

.setup-player-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.stat-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-card span {
  color: var(--muted);
  font-size: 0.85rem;
}

.stat-card strong {
  color: var(--text);
}

.encounter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.encounter-card,
.player-card,
.score-row,
.log-entry,
.hand-card,
.system-card,
.planet-card,
.choice-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
}

.encounter-card,
.player-card,
.system-card,
.choice-card {
  padding: 14px;
}

.encounter-card h3,
.system-card h3,
.player-card h3,
.choice-card h3 {
  margin: 0 0 10px;
  font-size: 0.96rem;
}

.metric-line,
.stat-line,
.choice-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

.metric-line strong,
.stat-line strong,
.choice-line strong {
  color: var(--text);
}

.board-grid {
  display: grid;
  gap: 14px;
}

.current-turn-pill {
  color: #e0f2fe;
  background: rgba(14, 165, 233, 0.2);
  border-color: rgba(56, 189, 248, 0.4);
}

/* ---------------------------------------------------------------------------
   The table: a Cosmic Encounter tabletop. Player systems (rows of planet
   discs with stacked ship tokens) sit above and below a central hub holding
   the warp, the hyperspace gate, and the decks.
--------------------------------------------------------------------------- */

.cosmic-table {
  display: grid;
  gap: 20px;
  padding: 22px;
  border-radius: 26px;
  border: 1px solid rgba(100, 210, 255, 0.14);
  background:
    radial-gradient(ellipse at 50% 45%, rgba(100, 210, 255, 0.07), transparent 62%),
    radial-gradient(circle at 16% 12%, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 100%),
    radial-gradient(circle at 82% 78%, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 100%),
    rgba(4, 10, 20, 0.55);
  min-width: 0;
}

.table-systems {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  min-width: 0;
}

.table-system {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 22px;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--player-color) 20%, transparent), transparent 55%),
    rgba(255, 255, 255, 0.03);
  border: 1px solid color-mix(in srgb, var(--player-color) 38%, rgba(255, 255, 255, 0.08));
  min-width: 0;
}

.table-system.current-system {
  box-shadow:
    0 0 0 2px color-mix(in srgb, var(--player-color) 45%, transparent),
    0 0 24px color-mix(in srgb, var(--player-color) 22%, transparent);
}

.table-system.under-attack {
  border-color: rgba(251, 191, 36, 0.55);
}

.table-system-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  width: 100%;
  border-radius: 16px;
  cursor: pointer;
}

.table-system-title {
  display: grid;
  gap: 2px;
  text-align: left;
}

.table-system-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
  justify-content: flex-end;
}

.table-planets {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.table-planet {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 12px 8px 10px;
  min-width: 96px;
  flex: 1 1 96px;
  border-radius: 18px;
  border: 1px solid transparent;
  cursor: pointer;
}

.table-planet:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(100, 210, 255, 0.22);
}

.planet-disc {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.5), transparent 42%),
    radial-gradient(circle at 68% 74%, rgba(0, 0, 0, 0.45), transparent 55%),
    radial-gradient(circle, color-mix(in srgb, var(--player-color) var(--planet-mix, 45%), #22364f), color-mix(in srgb, var(--player-color) 18%, #0a1526) 72%);
  box-shadow:
    inset -6px -8px 14px rgba(0, 0, 0, 0.5),
    0 0 12px color-mix(in srgb, var(--player-color) 28%, transparent);
}

.table-planet.targeted .planet-disc {
  box-shadow:
    inset -6px -8px 14px rgba(0, 0, 0, 0.5),
    0 0 0 3px rgba(251, 191, 36, 0.75),
    0 0 22px rgba(251, 191, 36, 0.45);
}

.table-planet.selectable {
  border-color: rgba(52, 211, 153, 0.5);
  animation: planet-pulse 1.4s ease-in-out infinite;
}

@keyframes planet-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0.08); }
}

.planet-name {
  font-size: 0.82rem;
  letter-spacing: 0.04em;
}

.planet-ships {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  min-height: 22px;
}

.planet-empty {
  color: var(--muted);
  font-size: 0.78rem;
}

.gate-marker {
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 12px solid rgba(251, 191, 36, 0.9);
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.7));
}

.ship-stack {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px 2px 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid color-mix(in srgb, var(--ship-color) 55%, transparent);
  font-size: 0.8rem;
}

.ship-token {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 30%, rgba(255, 255, 255, 0.75), transparent 45%),
    var(--ship-color, var(--accent));
  box-shadow:
    0 1px 0 1px color-mix(in srgb, var(--ship-color) 55%, #000),
    0 0 8px color-mix(in srgb, var(--ship-color) 45%, transparent);
}

.ship-stack-count {
  font-weight: 600;
}

/* Central hub: warp, hyperspace gate, decks */

.table-hub {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.3fr) minmax(180px, 1fr);
  align-items: stretch;
  gap: 16px;
}

.hub-piece {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 8px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(3, 8, 16, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.07);
  text-align: center;
  min-width: 0;
}

.hub-label {
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.hub-ships {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
}

.warp-swirl {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(3, 8, 16, 0.95) 0 18%, transparent 19%),
    conic-gradient(from 0deg, rgba(139, 92, 246, 0.85), rgba(100, 210, 255, 0.25), rgba(139, 92, 246, 0.85), rgba(100, 210, 255, 0.25), rgba(139, 92, 246, 0.85));
  box-shadow: 0 0 24px rgba(139, 92, 246, 0.35), inset 0 0 18px rgba(0, 0, 0, 0.8);
  animation: warp-spin 14s linear infinite;
}

@keyframes warp-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .warp-swirl,
  .table-planet.selectable {
    animation: none;
  }
}

.gate-cone {
  width: 0;
  height: 0;
  border-left: 26px solid transparent;
  border-right: 26px solid transparent;
  border-bottom: 44px solid rgba(100, 210, 255, 0.28);
  filter: drop-shadow(0 0 8px rgba(100, 210, 255, 0.25));
}

.hyperspace-gate.gate-active .gate-cone {
  border-bottom-color: rgba(100, 210, 255, 0.75);
  filter: drop-shadow(0 0 14px rgba(100, 210, 255, 0.6));
}

.gate-line {
  font-size: 0.92rem;
}

.table-decks {
  gap: 12px;
}

.deck-stack {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.deck-card {
  width: 34px;
  height: 48px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow:
    2px 2px 0 rgba(10, 20, 36, 0.9),
    3px 3px 0 rgba(255, 255, 255, 0.08),
    5px 5px 0 rgba(10, 20, 36, 0.9);
}

.deck-card-cosmic {
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.25) 0 1px, transparent 2px),
    radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.2) 0 1px, transparent 2px),
    linear-gradient(140deg, #1b2c4a, #101b31 70%);
}

.deck-card-destiny {
  background:
    radial-gradient(circle at 50% 40%, rgba(251, 191, 36, 0.35), transparent 60%),
    linear-gradient(140deg, #3a2a12, #1c1408 70%);
}

.deck-info {
  display: grid;
  justify-items: start;
  gap: 1px;
  font-size: 0.8rem;
  text-align: left;
}

.deck-info strong {
  font-size: 1.05rem;
}

/* Mobile table: hub compacts, systems stack, planets scroll sideways. */
@media (max-width: 900px) {
  .cosmic-table {
    padding: 14px;
    gap: 14px;
  }

  .table-hub {
    grid-template-columns: 1fr 1fr;
  }

  .hyperspace-gate {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .warp-swirl {
    width: 56px;
    height: 56px;
  }

  .table-systems {
    grid-template-columns: 1fr;
  }

  .table-planets {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
    -webkit-overflow-scrolling: touch;
  }

  .table-planet {
    min-width: 92px;
    flex: none;
  }

  .table-system-pills {
    margin-left: 0;
    justify-content: flex-start;
  }
}

.readonly-row {
  padding: 8px 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.inspector-panel {
  position: sticky;
  top: 16px;
}

.system-header,
.planet-header,
.player-title,
.ally-row,
.colony-editor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ally-row,
.colony-editor-row {
  flex-wrap: wrap;
}

.player-title {
  justify-content: flex-start;
}

.player-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.player-row {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.ai-player {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.08), rgba(255, 255, 255, 0.04));
}

.human-player {
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.08), rgba(255, 255, 255, 0.04));
}

.system-card.active-system {
  border-color: rgba(100, 210, 255, 0.46);
  box-shadow: inset 0 0 0 1px rgba(100, 210, 255, 0.35);
}

.planets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.planet-card {
  padding: 12px;
  min-height: 116px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 60%),
    rgba(255, 255, 255, 0.04);
}

.planet-card.targeted {
  border-color: rgba(251, 191, 36, 0.6);
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.35);
}

.planet-card.clickable {
  cursor: pointer;
}

.planet-card.clickable:hover {
  background: rgba(255, 255, 255, 0.08);
}

.planet-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
}

.colony-list {
  display: grid;
  gap: 6px;
}

.colony-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 0.82rem;
}

.colony-chip .dot,
.player-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.player-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.score-list,
.hand-grid,
.log-list,
.choices-grid {
  display: grid;
  gap: 10px;
}

.score-row {
  padding: 12px;
}

.score-row.active-player {
  border-color: rgba(52, 211, 153, 0.45);
}

.hand-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* ---------------------------------------------------------------------------
   The hand: cards rendered as playing cards in a fan. Each card sits in a
   shrinkable slot, so the fan overlaps automatically when space runs out.
   Tapping a card lifts it and opens a single detail panel with its rules
   text and actions.
--------------------------------------------------------------------------- */

.hand-fan {
  display: flex;
  align-items: flex-end;
  padding: 16px 10px 8px 2px;
  min-height: 152px;
  overflow: visible;
}

.fan-slot {
  position: relative;
  flex: 1 1 0;
  min-width: 24px;
  max-width: 102px;
  height: 132px;
}

/* The last card always shows at full width so the fan never spills out of the panel. */
.fan-slot:last-child {
  flex: 0 0 94px;
  min-width: 94px;
}

.play-card {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  width: 94px;
  height: 132px;
  padding: 7px 8px 8px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45);
  color: #f4f8ff;
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.fan-slot:hover,
.fan-slot:focus-within {
  z-index: 40;
}

.fan-slot:hover .play-card,
.play-card:focus-visible {
  transform: translateY(-10px);
}

.play-card.selected {
  transform: translateY(-16px);
  box-shadow:
    0 0 0 2px rgba(100, 210, 255, 0.8),
    0 10px 22px rgba(0, 0, 0, 0.55);
}

.fan-slot:has(.play-card.selected) {
  z-index: 45;
}

.play-card.playable {
  animation: card-pulse 1.4s ease-in-out infinite;
}

@keyframes card-pulse {
  0%, 100% { box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45), 0 0 0 0 rgba(52, 211, 153, 0.5); }
  50% { box-shadow: 0 3px 10px rgba(0, 0, 0, 0.45), 0 0 0 5px rgba(52, 211, 153, 0.12); }
}

.play-card.selected.playable {
  animation: none;
  box-shadow:
    0 0 0 2px rgba(52, 211, 153, 0.85),
    0 10px 22px rgba(0, 0, 0, 0.55);
}

@media (prefers-reduced-motion: reduce) {
  .play-card.playable {
    animation: none;
  }
}

.play-card-corner {
  justify-self: start;
  font-size: 0.82rem;
  font-weight: 700;
  opacity: 0.9;
}

.play-card-center {
  align-self: center;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
}

.play-card-center.named {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: break-word;
  max-width: 100%;
}

.play-card-sub {
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
}

.face-attack {
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.14), transparent 55%),
    linear-gradient(160deg, #7f1d1d, #3f0d12 75%);
  border-color: rgba(251, 113, 133, 0.5);
}

.face-negotiate {
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.14), transparent 55%),
    linear-gradient(160deg, #14532d, #04231a 75%);
  border-color: rgba(52, 211, 153, 0.5);
}

.face-morph {
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.16), transparent 55%),
    linear-gradient(160deg, #4c1d95, #1e0a45 75%);
  border-color: rgba(167, 139, 250, 0.55);
}

.face-reinforcement {
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.14), transparent 55%),
    linear-gradient(160deg, #0c4a6e, #062033 75%);
  border-color: rgba(56, 189, 248, 0.5);
}

.face-artifact {
  background:
    radial-gradient(circle at 50% 32%, rgba(255, 255, 255, 0.16), transparent 55%),
    linear-gradient(160deg, #713f12, #2c1806 75%);
  border-color: rgba(251, 191, 36, 0.55);
}

.face-flare {
  background:
    radial-gradient(circle at 30% 24%, rgba(100, 210, 255, 0.3), transparent 50%),
    radial-gradient(circle at 72% 70%, rgba(139, 92, 246, 0.3), transparent 55%),
    linear-gradient(160deg, #134e4a, #071f26 75%);
  border-color: rgba(94, 234, 212, 0.5);
}

.face-other {
  background: linear-gradient(160deg, #334155, #131b28 75%);
}

.selected-card-panel {
  border-color: rgba(100, 210, 255, 0.35);
}

.fan-hint {
  margin: 4px 0 0;
  font-size: 0.85rem;
}

.give-label {
  font-size: 0.8rem;
  align-self: center;
}

.hand-card {
  padding: 12px;
  display: grid;
  gap: 8px;
  min-height: 150px;
  background:
    linear-gradient(180deg, rgba(100, 210, 255, 0.06), rgba(255, 255, 255, 0.04));
}

.hand-card.selected {
  border-color: rgba(100, 210, 255, 0.55);
  box-shadow: inset 0 0 0 1px rgba(100, 210, 255, 0.35);
}

.card-type {
  color: var(--accent);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.card-value {
  font-size: 1.45rem;
  font-weight: 800;
}

.card-text,
.muted {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.log-content {
  max-height: 420px;
  overflow: auto;
}

.log-entry {
  padding: 10px 12px;
  color: var(--muted);
  line-height: 1.45;
}

.log-list {
  max-height: 480px;
  overflow: auto;
}

.log-list::-webkit-scrollbar,
.log-content::-webkit-scrollbar {
  width: 10px;
}

.log-list::-webkit-scrollbar-thumb,
.log-content::-webkit-scrollbar-thumb {
  background: rgba(100, 210, 255, 0.22);
  border-radius: 999px;
}

.log-entry strong {
  color: var(--text);
}

.status-stack,
.choices-stack {
  display: grid;
  gap: 12px;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.empty-state {
  color: var(--muted);
  padding: 8px 0;
}

.draft-panel,
.private-panel,
.board-panel {
  backdrop-filter: blur(12px);
}

.dashboard-root {
  display: grid;
  gap: 18px;
}

.dashboard-shell {
  max-width: 1760px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.dashboard-grid.two-column {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-controls {
  display: grid;
  gap: 14px;
}

.dashboard-control-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.dashboard-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.92rem;
}

.dashboard-field input,
.dashboard-field select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 24px;
}

.checkbox-field input {
  width: auto;
}

.dashboard-status-card.success {
  border-color: rgba(52, 211, 153, 0.24);
  background: rgba(52, 211, 153, 0.08);
  color: #b7f7da;
}

.dashboard-status-card.warning {
  border-color: rgba(251, 191, 36, 0.24);
  background: rgba(251, 191, 36, 0.08);
  color: #fde68a;
}

.dashboard-status-card.danger {
  border-color: rgba(251, 113, 133, 0.24);
  background: rgba(251, 113, 133, 0.08);
  color: #fecdd3;
}

.dashboard-command-card h3 {
  margin: 0 0 12px;
}

.mono-inline {
  font-family: Consolas, 'Courier New', monospace;
  color: var(--text);
}

.dashboard-keyvalue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.compact-card h3 {
  font-size: 0.88rem;
  word-break: break-word;
}

.dashboard-feed {
  display: grid;
  gap: 10px;
  max-height: 620px;
  overflow: auto;
}

.dashboard-feed-entry {
  padding: 12px 14px;
}

.dashboard-feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.dashboard-chart-card {
  display: grid;
  gap: 12px;
  min-height: 220px;
}

.dashboard-chart-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.dashboard-chart-svg {
  width: 100%;
  height: 220px;
  display: block;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.chart-axis {
  stroke: rgba(255, 255, 255, 0.16);
  stroke-width: 2;
}

.chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dashboard-bar-row {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.dashboard-bar-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-bar-track {
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.dashboard-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #3b82f6);
}

.dashboard-bar-fill.pill-success {
  background: linear-gradient(90deg, rgba(52, 211, 153, 0.9), rgba(16, 185, 129, 0.85));
}

.dashboard-bar-fill.pill-warning {
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.95), rgba(245, 158, 11, 0.85));
}

.dashboard-bar-fill.pill-human {
  background: linear-gradient(90deg, rgba(139, 92, 246, 0.95), rgba(99, 102, 241, 0.85));
}

.dashboard-comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(480px, 1fr));
  gap: 10px 28px;
  align-items: start;
}

.comparison-card .metric-line.delta-up strong {
  color: var(--success);
}

.comparison-card .metric-line.delta-down strong {
  color: var(--danger);
}

@media (max-width: 1400px) {
  .app-grid {
    grid-template-columns: 1fr;
  }

  .broadcast-stage,
  .encounter-hero {
    grid-template-columns: 1fr;
  }

  .broadcast-vs,
  .encounter-versus {
    margin: 0 auto;
  }
}

@media (max-width: 1250px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .dashboard-grid,
  .dashboard-grid.two-column {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------------------
   Training server control panel
--------------------------------------------------------------------------- */
.danger-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: hsla(0, 70%, 44%, 0.85);
  color: #fff;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.danger-btn:hover:not(:disabled) {
  background: hsla(0, 70%, 38%, 0.95);
}
.danger-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.server-log-details {
  margin-top: 1rem;
}
.server-log-details summary {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  user-select: none;
  padding: 0.25rem 0;
}
.server-log-details summary:hover {
  color: var(--text);
}
.server-log-feed {
  margin-top: 0.5rem;
  height: 260px;
  overflow-y: auto;
  background: hsla(0, 0%, 0%, 0.35);
  border: 1px solid hsla(0, 0%, 100%, 0.08);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.76rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-all;
}
.server-log-line {
  color: hsla(0, 0%, 85%, 0.9);
}
.server-log-line:first-child {
  margin-top: 0;
}

/* Per-alien performance table */
.alien-scores-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.alien-scores-table th,
.alien-scores-table td {
  padding: 0.35rem 0.65rem;
  text-align: right;
  border-bottom: 1px solid hsla(0, 0%, 100%, 0.07);
}
.alien-scores-table th {
  color: hsla(0, 0%, 70%, 0.9);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid hsla(0, 0%, 100%, 0.15);
}
.alien-scores-table td.alien-name-cell {
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}
.alien-scores-table tbody tr:hover {
  background: hsla(0, 0%, 100%, 0.04);
}
.alien-scores-table tr.delta-up td:last-child { color: hsl(145, 60%, 60%); }
.alien-scores-table tr.delta-down td:last-child { color: hsl(0, 65%, 65%); }


/* Game director bar */
.director-bar {
  position: sticky;
  top: 10px;
  z-index: 60;
  border-width: 2px;
}

.director-bar.director-action {
  border-color: hsl(48, 92%, 56%);
  box-shadow: 0 0 0 1px hsla(48, 92%, 56%, 0.35), 0 18px 40px rgba(0, 0, 0, 0.45);
  background:
    linear-gradient(180deg, rgba(38, 32, 6, 0.96), rgba(24, 20, 6, 0.94));
}

.director-bar.director-victory {
  border-color: hsl(145, 60%, 55%);
  background:
    linear-gradient(180deg, rgba(8, 34, 20, 0.96), rgba(6, 24, 14, 0.94));
}

.director-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.director-message {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
}

.director-bar.director-action .director-message {
  color: hsl(48, 96%, 72%);
}

.director-bar.director-victory .director-message {
  color: hsl(145, 70%, 70%);
}

.director-actions {
  padding-top: 2px;
}

/* Collapsible tool panels */
.details-panel {
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  background: var(--panel);
}

.details-panel > summary {
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 600;
  color: hsla(0, 0%, 85%, 0.85);
  list-style: none;
}

.details-panel > summary::before {
  content: '▸ ';
  color: hsla(0, 0%, 60%, 0.8);
}

.details-panel[open] > summary::before {
  content: '▾ ';
}

.details-panel > *:not(summary) {
  padding: 0 12px 12px;
}

/* Deal negotiation builder */
.deal-row {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.deal-label {
  min-width: 170px;
  font-size: 0.85rem;
  font-weight: 600;
  color: hsla(0, 0%, 80%, 0.85);
}

.deal-note {
  font-size: 0.9rem;
  color: hsl(48, 96%, 72%);
}

/* Alien power previews in the director bar */
.power-preview-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.power-preview-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsla(0, 0%, 65%, 0.8);
  margin-right: 2px;
}

.power-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid hsla(0, 0%, 100%, 0.16);
  background: hsla(0, 0%, 100%, 0.05);
  color: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 120ms ease;
}

.power-chip:hover {
  border-color: hsla(196, 90%, 65%, 0.6);
}

.power-chip .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.power-chip strong {
  font-weight: 700;
}

.power-chip-meta {
  color: hsla(0, 0%, 70%, 0.85);
  font-size: 0.74rem;
}

.power-chip em {
  font-style: normal;
  color: hsla(196, 80%, 75%, 0.9);
  font-size: 0.74rem;
}

.power-chip.power-active {
  border-color: hsl(145, 60%, 55%);
}

.power-chip.power-zapped {
  opacity: 0.55;
}

.power-chip.power-zapped em,
.power-chip.power-zapped strong {
  text-decoration: line-through;
}

/* Training evolution & win-rate charts */
.chart-dot {
  fill: hsla(196, 90%, 65%, 0.28);
}

.chart-line-strong {
  stroke: hsl(48, 92%, 60%);
  stroke-width: 2.2;
  stroke-linejoin: round;
}

.chart-best-marker {
  fill: hsl(48, 92%, 60%);
  stroke: rgba(0, 0, 0, 0.55);
  stroke-width: 1;
}

.chart-grid {
  stroke: hsla(0, 0%, 100%, 0.08);
  stroke-width: 1;
}

.chart-tick-label {
  fill: hsla(0, 0%, 65%, 0.85);
  font-size: 10px;
}

.chart-area {
  fill: hsla(196, 90%, 60%, 0.16);
}

.chart-parity {
  stroke: hsla(0, 0%, 80%, 0.5);
  stroke-dasharray: 5 5;
  stroke-width: 1;
}

/* Tuning drift map */
.drift-group {
  margin-bottom: 14px;
}

.drift-group h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: hsla(196, 80%, 75%, 0.9);
  margin: 0 0 6px;
}

.drift-row {
  display: grid;
  grid-template-columns: minmax(150px, 230px) 76px minmax(90px, 1fr) 118px;
  align-items: center;
  gap: 10px;
  padding: 3px 0;
}

.drift-key {
  font-size: 0.8rem;
  color: hsla(0, 0%, 82%, 0.9);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drift-sparkline {
  width: 72px;
  height: 18px;
  display: inline-block;
}

.drift-sparkline-empty::after {
  content: '—';
  color: hsla(0, 0%, 50%, 0.5);
  font-size: 0.7rem;
}

.drift-track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: hsla(0, 0%, 100%, 0.07);
  border: 1px solid hsla(0, 0%, 100%, 0.08);
}

.drift-baseline {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  margin-left: -1px;
  background: hsla(0, 0%, 75%, 0.65);
}

.drift-marker {
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  transform: translate(-6px, -50%);
  background: hsl(196, 90%, 60%);
  box-shadow: 0 0 6px hsla(196, 90%, 60%, 0.6);
}

.drift-marker.drift-up {
  background: hsl(145, 60%, 55%);
  box-shadow: 0 0 6px hsla(145, 60%, 55%, 0.6);
}

.drift-marker.drift-down {
  background: hsl(0, 70%, 62%);
  box-shadow: 0 0 6px hsla(0, 70%, 62%, 0.6);
}

.drift-values {
  font-size: 0.8rem;
  text-align: right;
  color: hsla(0, 0%, 85%, 0.9);
}

.drift-values em {
  font-style: normal;
  color: hsla(0, 0%, 55%, 0.9);
  margin-left: 4px;
}

.drift-values.drift-up em { color: hsl(145, 60%, 60%); }
.drift-values.drift-down em { color: hsl(0, 65%, 65%); }

@media (max-width: 900px) {
  .drift-row {
    grid-template-columns: 150px 1fr 110px;
  }
  .drift-sparkline, .drift-sparkline-empty {
    display: none;
  }
}

/* Card counting hint */
.counting-pill {
  border-color: hsla(196, 90%, 65%, 0.5);
  color: hsl(196, 85%, 75%);
}

/* Table talk */
.talk-strip {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.talk-bubble {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  padding: 5px 12px;
  border-radius: 4px 14px 14px 14px;
  background: hsla(0, 0%, 100%, 0.07);
  border: 1px solid hsla(0, 0%, 100%, 0.12);
  font-size: 0.86rem;
  font-style: italic;
  color: hsla(0, 0%, 90%, 0.95);
}

.talk-bubble strong {
  font-style: normal;
  color: hsla(196, 80%, 75%, 0.95);
}

.talk-bubble .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.talk-latest {
  animation: talk-pop 260ms ease-out;
}

.talk-older {
  opacity: 0.5;
  font-size: 0.78rem;
}

@keyframes talk-pop {
  from { transform: translateY(4px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Reveal drama */
.reveal-banner {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 14px;
  padding: 6px 0;
}

.reveal-vs {
  align-self: center;
  font-size: 1.4rem;
}

.reveal-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 130px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 2px solid var(--player-color, #888);
  background: linear-gradient(170deg, rgba(20, 30, 50, 0.95), rgba(8, 14, 26, 0.95));
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
}

.reveal-card.reveal-negotiate {
  border-style: dashed;
}

.reveal-owner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: hsla(0, 0%, 75%, 0.9);
}

.reveal-owner .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.reveal-value {
  font-size: 1.9rem;
  line-height: 1.1;
  font-weight: 800;
}

.reveal-attack .reveal-value { color: hsl(0, 75%, 68%); }
.reveal-negotiate .reveal-value { color: hsl(145, 60%, 62%); }
.reveal-morph .reveal-value { color: hsl(276, 70%, 72%); }

.reveal-label {
  font-size: 0.72rem;
  color: hsla(0, 0%, 65%, 0.9);
}

.reveal-total {
  font-size: 0.8rem;
  font-weight: 700;
  color: hsl(48, 92%, 65%);
}

.reveal-flip {
  animation: reveal-flip 700ms cubic-bezier(0.2, 0.8, 0.3, 1.1) both;
  backface-visibility: hidden;
}

@keyframes reveal-flip {
  0% { transform: rotateY(90deg) scale(0.9); opacity: 0; }
  55% { transform: rotateY(-14deg) scale(1.04); opacity: 1; }
  100% { transform: rotateY(0) scale(1); }
}

.deal-thinking {
  animation: talk-pop 260ms ease-out;
  color: hsla(196, 85%, 75%, 0.95);
}

/* Coach & first-time tips */
.coach-tip {
  margin: 0;
  font-size: 0.86rem;
  color: hsl(48, 90%, 75%);
  background: hsla(48, 90%, 55%, 0.08);
  border: 1px solid hsla(48, 90%, 55%, 0.25);
  border-radius: 10px;
  padding: 6px 12px;
}

.coach-btn {
  border-style: dashed;
}

.coach-answer {
  flex-basis: 100%;
  font-size: 0.9rem;
  color: hsl(196, 85%, 78%);
  background: hsla(196, 85%, 55%, 0.08);
  border: 1px solid hsla(196, 85%, 55%, 0.3);
  border-radius: 10px;
  padding: 7px 12px;
  animation: talk-pop 260ms ease-out;
}

/* Game story screen */
.story-panel {
  border-color: hsl(48, 92%, 56%);
}

.story-headline {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.race-chart {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 10px 12px 6px;
}

.race-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 4px 6px 6px;
}

.race-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: hsla(0, 0%, 80%, 0.9);
}

.race-legend-item .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

/* ---------------------------------------------------------------------------
   Mobile: single-column play, touch-sized controls, decision bar first.
   --------------------------------------------------------------------------- */
@media (max-width: 880px) {
  body {
    padding: 8px;
  }

  .app-grid {
    grid-template-columns: 1fr;
  }

  .director-bar {
    top: 4px;
  }

  .director-bar .panel-body {
    padding: 10px;
  }

  .director-top {
    gap: 6px;
  }

  .director-message {
    font-size: 0.98rem;
  }

  /* Touch targets */
  .director-actions button,
  .deal-row button,
  .primary-btn,
  .secondary-btn,
  .option-btn {
    min-height: 42px;
  }

  .ghost-btn.small-btn,
  .option-btn.small-btn,
  .secondary-btn.small-btn,
  .primary-btn.small-btn {
    min-height: 38px;
  }

  .reveal-card {
    min-width: 104px;
    padding: 8px 10px;
  }

  .reveal-value {
    font-size: 1.5rem;
  }

  .hand-grid {
    grid-template-columns: 1fr;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .deal-row {
    grid-template-columns: 1fr;
    display: flex;
    flex-wrap: wrap;
  }

  .deal-label {
    min-width: 100%;
    margin-bottom: 2px;
  }

  .power-chip em {
    display: none; /* keep chips compact on small screens */
  }

  .story-grid {
    grid-template-columns: 1fr;
  }
}

/* Resume panel */
.resume-panel {
  border-color: hsl(196, 90%, 55%);
  grid-column: 1 / -1;
}

/* Daily Cosmic */
.daily-panel {
  border-color: hsl(276, 70%, 60%);
}
