* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: #14141c;
  color: #eee;
  min-height: 100vh;
}

header {
  text-align: center;
  padding: 20px 10px 10px;
}

header h1 {
  margin: 0;
  font-size: 2.2rem;
  background: linear-gradient(90deg, #ff5f6d, #ffc371, #43cea2, #185a9d);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  margin: 4px 0 0;
  color: #999;
}

.hidden {
  display: none !important;
}

.card {
  background: #1e1e2a;
  border-radius: 12px;
  padding: 20px 24px;
  margin: 16px auto;
  max-width: 560px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.card h2 {
  margin-top: 8px;
  font-size: 1.1rem;
  color: #bbb;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.mode-buttons {
  display: flex;
  gap: 12px;
}

.mode-btn {
  flex: 1;
  padding: 14px;
  font-size: 1rem;
  border: 2px solid #444;
  border-radius: 8px;
  background: #262636;
  color: #ddd;
  cursor: pointer;
}

.mode-btn.active {
  border-color: #ffc371;
  background: #33334a;
  color: #fff;
}

.player-count-label {
  display: block;
  margin-bottom: 12px;
  color: #ccc;
}

.player-count-label input {
  width: 64px;
  margin-left: 8px;
  padding: 6px;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid #555;
  background: #14141c;
  color: #eee;
}

.player-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.player-row .player-number {
  width: 20px;
  color: #888;
}

.player-row input[type="text"] {
  flex: 1;
  padding: 8px 10px;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid #555;
  background: #14141c;
  color: #eee;
}

.player-row select {
  padding: 8px;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid #555;
  background: #14141c;
  color: #eee;
}

button.primary {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 14px;
  font-size: 1.1rem;
  font-weight: bold;
  border: none;
  border-radius: 8px;
  background: linear-gradient(90deg, #ff5f6d, #ffc371);
  color: #1a1a1a;
  cursor: pointer;
}

button.primary:disabled {
  opacity: 0.4;
  cursor: default;
}

.error {
  color: #ff6b6b;
  min-height: 1.2em;
}

/* ============ GAME LAYOUT ============ */
.game-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  padding: 10px 20px 30px;
  max-width: 1200px;
  margin: 0 auto;
}

#scoreboard {
  background: #1e1e2a;
  border-radius: 12px;
  padding: 16px 20px;
  min-width: 220px;
  position: sticky;
  top: 10px;
}

#scoreboard h2 {
  margin: 0 0 2px;
  font-size: 1.1rem;
}

.golf-note {
  margin: 0 0 10px;
  font-size: 0.8rem;
  color: #888;
}

#score-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

#score-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  border-bottom: 1px solid #2c2c3c;
}

#score-list li .rank {
  width: 22px;
  color: #999;
  font-size: 0.85rem;
}

#score-list li .chip {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}

#score-list li .pname {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#score-list li .pscore {
  font-weight: bold;
}

#score-list li.it-player .pname::after {
  content: " 🎯";
}

#round-indicator {
  margin-top: 12px;
  color: #999;
  font-size: 0.85rem;
}

main {
  flex: 1;
  min-width: 0;
}

#clue-banner {
  text-align: center;
  background: #262636;
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 12px;
  font-size: 1.15rem;
}

#clue-banner .clue-word {
  font-weight: bold;
  color: #ffc371;
  letter-spacing: 1px;
}

#clue-2-display {
  margin-left: 16px;
}

#phase-panel {
  max-width: none;
  margin: 0 0 14px;
  padding: 14px 20px;
  text-align: center;
}

#phase-panel h3 {
  margin: 4px 0 10px;
}

#phase-panel .subtle {
  color: #999;
  font-size: 0.85rem;
}

.target-options {
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.target-swatch {
  width: 90px;
  height: 90px;
  border-radius: 10px;
  border: 3px solid transparent;
  cursor: pointer;
  position: relative;
}

.target-swatch:hover {
  border-color: #fff;
}

.target-swatch .coord {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.75rem;
  color: #fff;
  text-shadow: 0 0 4px #000, 0 0 4px #000;
}

#phase-panel input[type="text"] {
  padding: 10px 12px;
  font-size: 1.1rem;
  border-radius: 8px;
  border: 1px solid #555;
  background: #14141c;
  color: #eee;
  width: min(360px, 80%);
  text-align: center;
}

.clue-target {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 12px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 2px solid #fff;
  background: #262636;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.clue-swatch {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.clue-coord {
  font-weight: bold;
  letter-spacing: 1px;
}

#phase-panel button.inline {
  margin-left: 10px;
  padding: 10px 18px;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  background: #43cea2;
  color: #10201a;
  font-weight: bold;
  cursor: pointer;
}

#phase-panel button.inline:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ============ BOARD ============ */
#board-wrap {
  overflow-x: auto;
}

#board {
  display: grid;
  grid-template-columns: repeat(30, 1fr);
  gap: 2px;
  min-width: 640px;
  user-select: none;
}

.cell {
  aspect-ratio: 1;
  border-radius: 2px;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

#board.clickable .cell {
  cursor: crosshair;
}

#board.clickable .cell:hover {
  outline: 2px solid rgba(255, 255, 255, 0.7);
  z-index: 1;
}

.cell.target {
  outline: 3px solid #fff;
  outline-offset: -1px;
  z-index: 2;
  animation: pulse 1.2s infinite;
}

@keyframes pulse {
  50% {
    outline-color: rgba(255, 255, 255, 0.3);
  }
}

.marker {
  width: 46%;
  height: 46%;
  border-radius: 50%;
  border: 2px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(6px, 1vw, 11px);
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 3px #000;
  margin: 1px;
}

.marker.round2 {
  background: transparent !important;
  border-width: 3px;
}

.marker.tentative {
  border-style: dashed;
  animation: pulse 1s infinite;
}

.marker.faded {
  opacity: 0.45;
}

/* ============ RESULTS ============ */
.results-table {
  margin: 10px auto 0;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.results-table th,
.results-table td {
  padding: 6px 14px;
  text-align: left;
  border-bottom: 1px solid #2c2c3c;
}

.results-table th {
  color: #999;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.results-table td .chip {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: -1px;
}

.winner-line {
  font-size: 1.3rem;
  margin: 8px 0;
}

@media (max-width: 800px) {
  .game-layout {
    flex-direction: column;
  }
  #scoreboard {
    position: static;
    width: 100%;
  }
}
