:root {
  --navy: #102542;
  --blue: #2563eb;
  --gold: #f2b705;
  --orange: #f46b45;
  --cream: #fff7e6;
  --green: #2e8b57;
  --purple: #7c3aed;
  --red: #dc2626;
  --ink: #1f2937;
  --muted: #64748b;
  --card: #ffffff;
  --river: #93c5fd;
  --park: #bbf7d0;
  --road: #334155;
  --shadow: 0 12px 30px rgba(16, 37, 66, 0.16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(135deg, var(--cream), #f8fafc);
  color: var(--ink);
}

.hero {
  background: linear-gradient(135deg, var(--navy), #203a5f);
  color: white;
  padding: 34px 20px;
  text-align: center;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  font-weight: bold;
  margin: 0 0 8px;
}

h1 { font-size: clamp(2rem, 6vw, 4rem); margin: 0; }
h2, h3 { margin-top: 0; }

.tagline {
  max-width: 850px;
  margin: 14px auto 0;
  font-size: 1.1rem;
}

.app {
  max-width: 1400px;
  margin: 0 auto;
  padding: 22px;
}

.panel, .stat-card, .card-box {
  background: var(--card);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.setup-panel {
  display: grid;
  grid-template-columns: 220px 1fr 220px;
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
}

.setup-panel h2 { grid-column: 1 / -1; }

.player-inputs {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
}

label {
  font-weight: bold;
  display: block;
  margin-bottom: 6px;
}

input, select, button {
  width: 100%;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid #cbd5e1;
  font-size: 1rem;
}

button {
  cursor: pointer;
  border: none;
  background: var(--navy);
  color: white;
  font-weight: bold;
  transition: transform 0.15s, opacity 0.15s;
}

button:hover:not(:disabled) { transform: translateY(-1px); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

#nextBtn { background: var(--green); margin-top: 10px; }
#resetBtn { background: var(--orange); margin-top: 10px; }

.dashboard {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

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

.stat-card strong {
  display: block;
  font-size: 1.35rem;
  margin-top: 4px;
}

.game-layout {
  display: grid;
  grid-template-columns: 300px 1fr 340px;
  gap: 18px;
}

.player-cards {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.player-card {
  border: 2px solid #e2e8f0;
  border-left-width: 10px;
  border-radius: 14px;
  padding: 12px;
  background: #f8fafc;
}

.player-card.active {
  outline: 3px solid rgba(244, 107, 69, .28);
  border-color: var(--orange);
  background: #fff7ed;
}

.player-card h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  color: white;
  font-size: 0.75rem;
}

.stats-mini {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  font-size: 0.86rem;
}

.map-wrap { min-width: 0; }

.map-note {
  color: var(--muted);
  margin-top: -6px;
}

.map-board {
  position: relative;
  min-height: 720px;
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 26% 24%, rgba(187, 247, 208, .9) 0 10%, transparent 11%),
    radial-gradient(circle at 67% 72%, rgba(187, 247, 208, .9) 0 9%, transparent 10%),
    linear-gradient(120deg, transparent 0 72%, rgba(147, 197, 253, .8) 73% 100%),
    linear-gradient(135deg, #e0f2fe, #fef3c7 48%, #dcfce7);
  box-shadow: var(--shadow);
  border: 5px solid white;
}

.map-board::before {
  content: "Connecticut River";
  position: absolute;
  right: -22px;
  top: 0;
  width: 155px;
  height: 100%;
  background: linear-gradient(180deg, #60a5fa, #bfdbfe);
  color: #073763;
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  font-weight: bold;
  letter-spacing: .08em;
  opacity: .8;
}

.map-board::after {
  content: "";
  position: absolute;
  left: 7%;
  top: 52%;
  width: 80%;
  height: 10px;
  background: repeating-linear-gradient(90deg, var(--road), var(--road) 22px, #f8fafc 22px, #f8fafc 34px);
  transform: rotate(-8deg);
  border-radius: 999px;
  opacity: .75;
}

.space {
  position: absolute;
  width: 132px;
  min-height: 84px;
  background: rgba(255,255,255,.94);
  border: 2px solid #e2e8f0;
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 7px 14px rgba(15, 23, 42, 0.16);
  z-index: 2;
}

.space.active {
  border-color: var(--orange);
  outline: 4px solid rgba(244, 107, 69, 0.22);
}

.num {
  display: block;
  font-size: .72rem;
  color: var(--muted);
  font-weight: bold;
}

.name {
  display: block;
  margin-top: 4px;
  font-weight: bold;
  font-size: .88rem;
}

.type {
  display: inline-block;
  margin-top: 5px;
  font-size: .7rem;
  padding: 2px 7px;
  border-radius: 999px;
  background: #e0f2fe;
}

.token-row {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 5px;
}

.player-token {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: bold;
  border: 2px solid white;
  font-size: .75rem;
}

.card-box {
  min-height: 250px;
  border: 3px solid var(--gold);
}

.card-type {
  display: inline-block;
  background: var(--navy);
  color: white;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  margin-bottom: 10px;
}

.choice-box {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.choice-box button {
  text-align: left;
  background: var(--green);
}

.log-panel { margin-top: 18px; }

.log {
  max-height: 210px;
  overflow: auto;
  line-height: 1.5;
}

.log-entry {
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 0;
}

.winner {
  background: linear-gradient(135deg, #fff7cc, #ffffff);
  border-color: var(--gold);
}

@media (max-width: 1150px) {
  .setup-panel, .dashboard, .game-layout {
    grid-template-columns: 1fr;
  }

  .player-inputs {
    grid-template-columns: 1fr 1fr;
  }

  .map-board {
    min-height: 920px;
  }

  .space {
    width: 120px;
  }
}

@media (max-width: 650px) {
  .player-inputs {
    grid-template-columns: 1fr;
  }

  .map-board {
    min-height: 1180px;
  }

  .space {
    width: 112px;
    font-size: .85rem;
  }
}

/* ---- Music button ---- */
.music-btn {
  margin-top: 16px;
  display: inline-block;
  width: auto;
  padding: 10px 22px;
  background: var(--gold);
  color: #1f2937;
  border-radius: 999px;
  font-weight: bold;
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.music-btn.playing {
  background: var(--green);
  color: white;
}

/* ---- Dice ---- */
.dice-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}

.dice {
  width: 64px;
  height: 64px;
  background: white;
  border: 3px solid var(--navy);
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 2.4rem;
  box-shadow: 0 6px 14px rgba(15,23,42,0.25);
  cursor: default;
  user-select: none;
}

.dice.rolling {
  animation: diceShake 0.08s infinite;
}

@keyframes diceShake {
  0% { transform: rotate(-8deg) scale(1); }
  50% { transform: rotate(8deg) scale(1.08); }
  100% { transform: rotate(-8deg) scale(1); }
}

.dice-result {
  font-weight: bold;
  color: var(--navy);
  min-height: 1.2em;
}

/* ---- The Pivot Start space ---- */
.space[data-index="1"] {
  background: linear-gradient(135deg, var(--gold), var(--orange));
  border-color: var(--navy);
  z-index: 2;
}

.space[data-index="1"] .name,
.space[data-index="1"] .num {
  color: #1f2937;
}

.space[data-index="1"] .type {
  background: var(--navy);
  color: white;
}

/* ---- Player pieces ---- */
.player-token {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  font-weight: bold;
  font-size: 0.8rem;
  border: 2px solid white;
  box-shadow: 0 3px 8px rgba(0,0,0,0.35);
  transition: all 0.4s ease;
}

.token-row {
  position: absolute;
  bottom: 4px;
  right: 4px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
