*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  font-size: 14px;
}

/* -----------------------------------------------------------------------
   App layout
   ----------------------------------------------------------------------- */
#app {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto auto auto;
  gap: 12px;
  padding: 12px;
  min-height: 100vh;
}

/* -----------------------------------------------------------------------
   Player boards
   ----------------------------------------------------------------------- */
[data-player] {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 8px;
  padding: 12px;
}

[data-player][data-active-player] {
  border-color: #f8e16c;
  box-shadow: 0 0 0 2px rgba(248, 225, 108, 0.35);
}

[data-player] h2 {
  font-size: 1rem;
  margin-bottom: 8px;
  color: #e94560;
}

.player-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.player-badge {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
}

.player-badge.active-turn { background: #f8e16c; color: #1a1a2e; }
.player-badge.first-player { background: #89b4fa; color: #09111d; }
.player-badge.token-holder { background: #a6e3a1; color: #09111d; }

.player-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

.player-stats span { color: #a8b2d8; }
.player-stats strong { color: #cdd6f4; }

/* Production area */
.production-area {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

/* Individual production slots */
.slot {
  width: 80px;
  height: 100px;
  border: 1px dashed #4a4a6a;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  text-align: center;
  background: #0d1b2a;
  position: relative;
}

.slot.empty { color: #4a4a6a; }
.slot.occupied { border-color: #7986cb; background: #1a237e; }
.slot.stardom { border-color: #ffd700; }
.slot.stardom.occupied { background: #332800; border-color: #ffd700; }
.slot.risk-slot { border-color: #e53935; }

.slot-label {
  position: absolute;
  top: 3px;
  left: 3px;
  font-size: 0.6rem;
  color: #888;
  text-transform: uppercase;
}

.card-name { font-weight: bold; color: #cdd6f4; }
.card-genre { color: #89b4fa; font-size: 0.65rem; }
.card-cost { color: #a6e3a1; }

/* Scripts in hand */
.scripts-hand {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.script-card {
  background: #1e3a5f;
  border: 1px solid #3a6fa8;
  border-radius: 4px;
  padding: 4px 6px;
  font-size: 0.7rem;
  cursor: pointer;
}

.script-card:hover { background: #2a4f7f; }

/* Rep tokens */
.rep-tokens {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.token {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: inline-block;
}

.token.rep { background: #7986cb; }
.token.starter { background: #ffd700; border: 1px solid #b8860b; }
.token.risk { background: #e53935; }

/* Trendiness bars */
.trendiness {
  display: flex;
  gap: 8px;
  font-size: 0.75rem;
  margin-top: 4px;
}

.trend-genre { display: flex; align-items: center; gap: 3px; }
.trend-genre span { color: #89dceb; }

/* -----------------------------------------------------------------------
   Market
   ----------------------------------------------------------------------- */
[data-market] {
  grid-column: 1 / -1;
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 8px;
  padding: 12px;
}

[data-market] h2 { font-size: 1rem; margin-bottom: 8px; color: #cba6f7; }

.market-cards {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.market-card {
  width: 80px;
  min-height: 100px;
  background: #0d1b2a;
  border: 1px solid #4a4a6a;
  border-radius: 4px;
  padding: 6px;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.market-card:hover { border-color: #7986cb; background: #1a1f3a; }
.market-card .card-type { color: #fab387; font-size: 0.6rem; text-transform: uppercase; }

/* -----------------------------------------------------------------------
   Trend ladder
   ----------------------------------------------------------------------- */
[data-trend-ladder] {
  grid-column: 1 / -1;
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 8px;
  padding: 12px;
}

[data-trend-ladder] h2 { font-size: 1rem; margin-bottom: 8px; color: #a6e3a1; }

.trend-track {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  margin-bottom: 8px;
}

.trend-step {
  width: 32px;
  min-height: 32px;
  background: #0d1b2a;
  border: 1px solid #2a2a4a;
  border-radius: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  font-size: 0.65rem;
  padding: 2px;
  position: relative;
}

.trend-step-label { color: #888; }

[data-trend-marker] {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  font-size: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #000;
}

/* -----------------------------------------------------------------------
   Action panel
   ----------------------------------------------------------------------- */
[data-action-panel] {
  grid-column: 1 / -1;
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 8px;
  padding: 12px;
}

[data-action-panel] h2 { font-size: 1rem; margin-bottom: 8px; color: #f38ba8; }

.action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.action-status {
  color: #a8b2d8;
  margin-bottom: 8px;
  font-size: 0.85rem;
}

button[data-action] {
  background: #2a3f6f;
  color: #cdd6f4;
  border: 1px solid #3a5f9f;
  border-radius: 4px;
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
}

button[data-action]:hover:not(:disabled) { background: #3a5f9f; }
button[data-action]:disabled { opacity: 0.35; cursor: not-allowed; }

/* -----------------------------------------------------------------------
   Log
   ----------------------------------------------------------------------- */
[data-log] {
  grid-column: 1 / -1;
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 8px;
  padding: 12px;
  max-height: 180px;
  overflow-y: auto;
}

[data-log] h2 { font-size: 1rem; margin-bottom: 6px; color: #89b4fa; }

[data-log-entry] {
  padding: 3px 0;
  border-bottom: 1px solid #1e2a4a;
  font-size: 0.78rem;
  color: #a8b2d8;
}

/* -----------------------------------------------------------------------
   Modal
   ----------------------------------------------------------------------- */
#modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#modal[hidden] { display: none; }

.modal-box {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 10px;
  padding: 24px;
  max-width: 480px;
  width: 90%;
}

.modal-box h2 { margin-bottom: 12px; color: #f38ba8; }
.modal-box p  { margin-bottom: 16px; color: #a8b2d8; font-size: 0.9rem; }

.modal-box button[data-action="continue"] {
  background: #e94560;
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 8px 20px;
  font-size: 0.9rem;
  cursor: pointer;
}

.modal-box button[data-action="continue"]:hover { background: #c73652; }

/* -----------------------------------------------------------------------
   Player marker colours (up to 4 players)
   ----------------------------------------------------------------------- */
[data-trend-marker="0"] { background: #89b4fa; }
[data-trend-marker="1"] { background: #a6e3a1; }
[data-trend-marker="2"] { background: #fab387; }
[data-trend-marker="3"] { background: #cba6f7; }

/* -----------------------------------------------------------------------
   Phase 6 — Card inspector
   ----------------------------------------------------------------------- */
#card-inspector {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 240px;
  background: #16213e;
  border-left: 1px solid #0f3460;
  padding: 16px;
  overflow-y: auto;
  z-index: 50;
}

#card-inspector[hidden] { display: none; }

#card-inspector h3 { color: #cba6f7; margin-bottom: 10px; }

.inspector-row {
  font-size: 0.8rem;
  margin-bottom: 6px;
  color: #a8b2d8;
}

.inspector-label { color: #89b4fa; font-weight: bold; }

/* -----------------------------------------------------------------------
   Phase 6 — Hot-seat overlay
   ----------------------------------------------------------------------- */
#hotseat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

#hotseat-overlay[hidden] { display: none; }

.hotseat-inner {
  text-align: center;
}

.hotseat-inner h2 {
  font-size: 1.8rem;
  color: #cdd6f4;
  margin-bottom: 12px;
}

.hotseat-inner p {
  color: #a8b2d8;
  margin-bottom: 24px;
}

.hotseat-inner button[data-action="ready"] {
  background: #e94560;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 12px 32px;
  font-size: 1.1rem;
  cursor: pointer;
}

/* -----------------------------------------------------------------------
   Phase 6 — Game-end scores + picker
   ----------------------------------------------------------------------- */
.scores-table { margin: 12px 0; }

.score-row {
  display: flex;
  gap: 16px;
  padding: 6px 0;
  border-bottom: 1px solid #1e2a4a;
  font-size: 0.85rem;
}

.score-name { flex: 1; font-weight: bold; }
.score-trends, .score-money, .score-rep { color: #a8b2d8; }

.picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.picker-card {
  background: #1e3a5f;
  border: 1px solid #3a6fa8;
  border-radius: 4px;
  padding: 8px 12px;
  color: #cdd6f4;
  cursor: pointer;
  font-size: 0.8rem;
}

.picker-card:hover { background: #2a4f7f; }

button[data-action="cancel"] {
  background: #3a3a5a;
  color: #a8b2d8;
  border: 1px solid #5a5a8a;
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 0.8rem;
  cursor: pointer;
  margin-top: 8px;
}
