:root {
  --bg: #06060f;
  --panel: #0d0d1e;
  --panel-2: #09091a;
  --border: #1e1e42;
  --cyan: #22d3ee;
  --magenta: #ec4899;
  --yellow: #fbbf24;
  --green: #34d399;
  --red: #ff2d55;
  --text: #d0e4ff;
  --muted: rgba(208, 228, 255, 0.58);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: 'Rajdhani', sans-serif;
  overflow-x: hidden;
}

.scanlines,
.grid-bg {
  pointer-events: none;
  position: fixed;
  inset: 0;
}

.scanlines {
  z-index: 30;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 0, 0, 0.16) 2px, rgba(0, 0, 0, 0.16) 4px);
}

.grid-bg {
  z-index: 0;
  background-image:
    linear-gradient(rgba(34, 211, 238, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(34, 211, 238, 0.04) 1px, transparent 1px);
  background-size: 42px 42px;
}

.oca-header {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(6, 6, 15, 0.9);
}

.back-home,
.oca-btn,
.player-count {
  font-family: 'Orbitron', monospace;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.back-home {
  color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.35);
  padding: 8px 12px;
  text-decoration: none;
  font-size: 11px;
}

.back-games {
  color: var(--magenta);
  border-color: rgba(236, 72, 153, 0.4);
}

.oca-brand {
  margin-left: auto;
  font-family: 'Orbitron', monospace;
  font-size: clamp(17px, 3vw, 26px);
  font-weight: 900;
  letter-spacing: 3px;
}

.oca-brand span,
.oca-status,
.setup-panel h1,
.win-card h2 {
  color: var(--yellow);
  text-shadow: 0 0 16px rgba(251, 191, 36, 0.45);
}

.oca-status {
  font-family: 'Share Tech Mono', monospace;
  letter-spacing: 2px;
}

.oca-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.setup-panel,
.board-panel,
.side-panel,
.win-card {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(13, 13, 30, 0.96), rgba(8, 8, 22, 0.98));
  box-shadow: 0 0 28px rgba(34, 211, 238, 0.08);
}

.setup-panel {
  min-height: 520px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  padding: 32px;
  text-align: center;
}

.panel-label,
.tiny-label {
  font-family: 'Share Tech Mono', monospace;
  color: var(--muted);
  letter-spacing: 3px;
  font-size: 11px;
}

.setup-panel h1 {
  margin: 0;
  font-family: 'Orbitron', monospace;
  font-size: clamp(36px, 8vw, 74px);
  line-height: 0.95;
}

.setup-copy {
  max-width: 460px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.player-select {
  display: flex;
  gap: 10px;
}

.player-count {
  width: 58px;
  height: 48px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}

.player-count.is-selected {
  color: var(--yellow);
  border-color: var(--yellow);
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.16);
}

.oca-btn {
  min-height: 42px;
  border: 1px solid;
  background: transparent;
  padding: 11px 14px;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
}

.oca-btn.primary {
  color: var(--cyan);
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.1);
}

.oca-btn.secondary {
  color: var(--magenta);
  border-color: var(--magenta);
  background: rgba(236, 72, 153, 0.1);
}

.oca-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.game-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
}

.board-panel,
.side-panel {
  min-width: 0;
  padding: 18px;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(9, minmax(48px, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.board-cell {
  position: relative;
  min-height: 76px;
  border: 1px solid rgba(34, 211, 238, 0.2);
  background: rgba(34, 211, 238, 0.055);
  padding: 7px;
  overflow: hidden;
}

.board-cell::after {
  content: "";
  position: absolute;
  inset: auto 8px 6px 8px;
  height: 3px;
  background: rgba(34, 211, 238, 0.2);
}

.cell-number {
  font-family: 'Orbitron', monospace;
  color: var(--text);
  font-size: 15px;
}

.cell-special {
  display: block;
  margin-top: 2px;
  min-height: 14px;
  color: var(--muted);
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  text-transform: uppercase;
}

.cell-tokens {
  position: absolute;
  right: 6px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 3px;
  max-width: calc(100% - 12px);
}

.token {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 2px solid #0a0a0a;
  border-radius: 50%;
  background: var(--token-color);
  color: #050816;
  font-family: 'Orbitron', monospace;
  font-size: 11px;
  font-weight: 900;
}

.is-goose {
  border-color: rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.11);
}

.is-bridge {
  border-color: rgba(34, 211, 238, 0.55);
}

.is-inn,
.is-well,
.is-prison {
  border-color: rgba(236, 72, 153, 0.5);
  background: rgba(236, 72, 153, 0.08);
}

.is-labyrinth,
.is-skull {
  border-color: rgba(255, 45, 85, 0.55);
  background: rgba(255, 45, 85, 0.08);
}

.side-panel {
  display: grid;
  align-content: start;
  gap: 14px;
}

.turn-card,
.players-card,
.rules-card {
  border: 1px solid rgba(34, 211, 238, 0.16);
  background: rgba(5, 8, 22, 0.64);
  padding: 14px;
}

.turn-card strong {
  display: block;
  margin-top: 6px;
  color: var(--yellow);
  font-family: 'Orbitron', monospace;
  font-size: 20px;
}

.die {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  margin: 14px auto;
  border: 2px solid var(--cyan);
  color: var(--cyan);
  font-family: 'Orbitron', monospace;
  font-size: 34px;
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.16);
}

.turn-card .oca-btn {
  width: 100%;
}

.turn-message {
  min-height: 50px;
  margin: 12px 0 0;
  color: var(--muted);
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
}

.players-list,
.rules-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.player-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-height: 36px;
  color: var(--muted);
  font-family: 'Share Tech Mono', monospace;
}

.player-row.is-active {
  color: var(--text);
}

.player-row strong {
  color: var(--yellow);
}

.player-row em {
  grid-column: 2 / -1;
  color: var(--magenta);
  font-style: normal;
  font-size: 11px;
}

.rules-list span {
  color: var(--muted);
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
}

.win-overlay[hidden],
[hidden] {
  display: none !important;
}

.win-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.78);
}

.win-card {
  width: min(440px, 100%);
  padding: 24px;
  text-align: center;
  border-color: var(--yellow);
}

.win-card h2 {
  margin: 8px 0;
  font-family: 'Orbitron', monospace;
}

.win-card p {
  color: var(--muted);
  font-family: 'Share Tech Mono', monospace;
}

.win-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

@media (max-width: 940px) {
  .game-panel {
    grid-template-columns: 1fr;
  }

  .side-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .oca-header {
    flex-wrap: wrap;
  }

  .oca-brand {
    width: 100%;
    order: 3;
  }

  .oca-shell {
    padding: 16px;
  }

  .board-grid {
    grid-template-columns: repeat(7, minmax(42px, 1fr));
  }

  .board-cell {
    min-height: 64px;
    padding: 5px;
  }

  .cell-special {
    font-size: 8px;
  }

  .side-panel {
    grid-template-columns: 1fr;
  }
}
