:root {
  --ground: #16211f;
  --surface: #1c2926;
  --surface-2: #22302c;
  --line: #354540;
  --stone: #c9b98f;
  --ink: #f2ead6;
  --muted: #9db0aa;
  --gold: #c9a227;

  --p-red: #b3392c;
  --p-blue: #3563a6;
  --p-green: #3f7d4a;
  --p-purple: #6f4291;
  --p-orange: #d0791f;
  --p-gold: #d4af2c;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--ground);
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
}

body {
  display: flex;
  flex-direction: column;
}

.exhibition-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: #101917;
}
.exhibition-header span { color: var(--gold); font: 700 10px/1.4 Arial, sans-serif; letter-spacing: .16em; }
.exhibition-header h1 { margin: 2px 0; color: var(--ink); font-size: 30px; letter-spacing: .08em; }
.exhibition-header p { margin: 0; color: var(--muted); font: 13px/1.4 Arial, sans-serif; }
.exhibition-header nav { display: flex; gap: 8px; }
.mode-btn { padding: 9px 13px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); background: var(--surface-2); cursor: pointer; }
.mode-btn.selected { border-color: var(--gold); color: #171207; background: var(--gold); }
.exhibition-note { padding: 10px 22px 14px; color: var(--muted); background: #101917; font: 11px/1.5 Arial, sans-serif; text-align: center; }

/* ---------- Setup screen ---------- */

#setup-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.setup-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 32px 36px;
  width: min(480px, 100%);
}

.setup-card h1 {
  margin: 0 0 4px;
  font-size: 36px;
  letter-spacing: 0.04em;
  color: var(--gold);
}

.setup-tagline {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 14px;
}

.setup-field {
  display: block;
  margin-bottom: 20px;
}

.setup-field > span {
  display: block;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 8px;
}

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

.btn-row button {
  flex: 1 1 auto;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}

.btn-row button.selected {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 22%, var(--surface-2));
}

.setup-field input[type="range"] {
  width: 100%;
}

.setup-estimate {
  font-size: 13px;
  color: var(--stone);
  margin: 4px 0 24px;
  min-height: 18px;
}

.setup-estimate.unconfirmed {
  color: var(--gold);
}

.start-btn {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: none;
  background: var(--gold);
  color: #1a1408;
  font: inherit;
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 0.04em;
  cursor: pointer;
}

/* ---------- Game screen: bottom panel ---------- */

#game-screen {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1 1 auto;
}

.bottom-panel {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 12px 20px;
  flex: 0 0 auto;
}

.panel-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 6px 0;
}

.panel-row + .panel-row {
  border-top: 1px solid var(--line);
}

.current-player {
  display: flex;
  align-items: center;
  gap: 8px;
}

.current-player .swatch {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-block;
}

.current-player .name {
  font-size: 15px;
  font-weight: bold;
}

.sprint-chip {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
}

.sprint-chip.active {
  color: var(--gold);
}

.turn-order {
  display: flex;
  gap: 6px;
}

.turn-order .chip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--chip-color);
  opacity: 0.5;
}

.turn-order .chip.active {
  opacity: 1;
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.towers-progress {
  display: flex;
  gap: 10px;
  margin-left: auto;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.progress-chip {
  color: var(--chip-color);
}

.dice {
  display: flex;
  gap: 6px;
}

.die {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  font-weight: bold;
}

.movement-total {
  color: var(--stone);
  font-size: 13px;
}

.extra-turn-badge {
  background: var(--gold);
  color: #1a1408;
  font-weight: bold;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  animation: badge-pulse 0.5s ease;
}

@keyframes badge-pulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.roll-btn {
  margin-left: auto;
  padding: 8px 22px;
  border-radius: 8px;
  border: none;
  background: var(--gold);
  color: #1a1408;
  font: inherit;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}

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

@media (max-width: 720px) {
  .exhibition-header { align-items: flex-start; flex-direction: column; padding: 13px 14px; }
  .exhibition-header p { display: none; }
  .exhibition-header nav { width: 100%; }
  .mode-btn { flex: 1; padding: 8px; font-size: 11px; }
  .bottom-panel { padding: 8px 10px; }
  .panel-row { gap: 9px; }
  .log { display: none; }
}

.result-text {
  font-size: 13px;
  color: var(--ink);
  min-height: 18px;
}

.log {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  max-width: 50%;
}

.log-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.win-banner {
  text-align: center;
  padding: 10px;
  font-size: 18px;
  font-weight: bold;
  color: var(--gold);
}
