:root {
  --bg: #1b1f24;
  --panel: #262b33;
  --panel-border: #3a4048;
  --text: #eef1f4;
  --text-dim: #9aa4af;
  --accent: #4f9dff;
  --accent-dark: #2f6fcc;
  --gold: #f0c04a;
  --coin-face: #c98a3f;
  --coin-edge: #8a5a20;
  --danger: #e0574f;
  --success: #4fd18a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.subtitle {
  text-align: center;
  color: var(--text-dim);
  margin: 0 0 4px;
  font-size: 0.9rem;
}

.subtitle:last-of-type {
  margin-bottom: 20px;
}

#game {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 18px;
}

button {
  appearance: none;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  min-height: 44px;
  transition: background 0.15s, opacity 0.15s, transform 0.05s;
}

button:active { transform: scale(0.98); }

button:disabled {
  background: #3d4451;
  color: var(--text-dim);
  cursor: not-allowed;
}

#score {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

#score span.name { color: var(--text); font-weight: 600; }

#status {
  text-align: center;
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 18px;
  min-height: 1.4em;
}

#status.turn-human { color: var(--accent); }
#status.turn-computer,
#status.turn-p2 { color: var(--gold); }

#board {
  display: flex;
  justify-content: space-around;
  align-items: flex-end;
  gap: 10px;
  min-height: 220px;
  padding: 10px 0 16px;
}

.pile {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
}

.coins {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.coin {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #e8b467, var(--coin-face) 55%, var(--coin-edge) 100%);
  border: 2px solid var(--coin-edge);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: #4a2e0a;
  cursor: pointer;
  user-select: none;
  transition: transform 0.1s, box-shadow 0.15s, outline 0.1s;
  box-shadow: 0 2px 3px rgba(0,0,0,0.4);
}

.coin::after {
  content: "1¢";
}

.coin.selected {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  box-shadow: 0 0 10px rgba(240, 192, 74, 0.7);
  transform: translateY(-2px);
}

.coin.disabled,
.coin.locked {
  cursor: not-allowed;
  filter: grayscale(0.5) brightness(0.8);
}

.pile-label {
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

#controls {
  display: flex;
  gap: 10px;
  margin-bottom: 4px;
}

#controls button { flex: 1; }

#roundEnd {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--panel-border);
  text-align: center;
}

#roundEndMessage {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 14px;
}

#roundEndMessage.win { color: var(--success); }
#roundEndMessage.lose { color: var(--danger); }

#roundEnd button {
  width: 100%;
  margin-bottom: 8px;
}

#newGameBtn {
  background: #3d4451;
  color: var(--text);
}

@media (max-width: 400px) {
  .coin { width: 36px; height: 36px; font-size: 0.6rem; }
  #app { padding: 14px 10px 30px; }
}
