/* =====================================================
   TALON GAME — Board & UI CSS
   Uses design tokens from theme.css
   ===================================================== */

.game-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  padding: 0 0 40px;
}

/* ── HEADER ── */
.game-header {
  width: 100%;
  max-width: 860px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  gap: 16px;
}

.logo {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.2em;
  color: var(--amber);
  text-decoration: none;
}

.game-meta {
  display: flex;
  align-items: center;
  gap: 16px;
}

.match-label {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

.match-wins {
  font-size: 13px;
  font-weight: 500;
  color: var(--off-white);
  background: var(--bg-elevated);
  padding: 4px 10px;
  border-radius: 2px;
}

.btn-new-game {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--amber);
  padding: 8px 16px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-new-game:hover {
  background: var(--amber);
  color: #111;
}

/* ── STATUS BAR ── */
.status-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--divider);
  padding: 10px 20px;
  border-radius: 2px;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  max-width: 860px;
  width: calc(100% - 48px);
}

.status-icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
}

.status-icon.player-turn { background: #22c55e; }
.status-icon.ai-turn { background: #ef4444; }
.status-icon.neutral { background: var(--amber); }
.status-icon.victory { background: #22c55e; box-shadow: 0 0 8px #22c55e; }
.status-icon.defeat { background: #ef4444; }

/* ── BOARD ── */
.board-wrap {
  padding: 0 24px;
  width: 100%;
  max-width: 860px;
}

.board {
  background: var(--bg-surface);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 4px;
  padding: 16px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  overflow: hidden;
}

.board::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 70% 60% at 50% 50%, rgba(245, 158, 11, 0.04) 0%, transparent 70%);
  pointer-events: none;
}

/* Pip markers (bar count indicators) */
.pip-markers {
  display: none; /* shown via JS when bar has pieces */
}

.ai-bar-top, .player-bar-bottom {
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0 10px;
}

.pip-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.5);
  border: 1px solid rgba(239, 68, 68, 0.7);
  flex-shrink: 0;
}

/* Quadrant layout */
.quadrant {
  display: flex;
  gap: 0;
}

.top-ai {
  flex-direction: row-reverse;
}

.point-row {
  display: flex;
  flex: 1;
  gap: 3px;
}

.top-row {
  flex-direction: row;
  border-bottom: 1px solid rgba(245, 158, 11, 0.1);
  padding-bottom: 6px;
  margin-bottom: 0;
}

.bottom-row {
  flex-direction: row;
  border-top: 1px solid rgba(245, 158, 11, 0.1);
  padding-top: 6px;
}

/* Point (triangle peg) */
.point {
  flex: 1;
  min-width: 28px;
  max-width: 46px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: opacity 0.15s;
}

.point:hover {
  opacity: 0.85;
}

.point.has-moves {
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.5);
}

.point.has-moves::after {
  content: '';
  position: absolute;
  inset: -2px;
  border: 1px solid rgba(245, 158, 11, 0.6);
  border-radius: 2px;
  pointer-events: none;
}

/* Triangle base */
.point::before {
  content: '';
  width: 100%;
  height: 28px;
  clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
  background: rgba(245, 158, 11, 0.08);
  flex-shrink: 0;
}

.point.p1::before { background: rgba(245, 158, 11, 0.06); }
.point.p5::before { background: rgba(245, 158, 11, 0.18); }
.point.p7::before { background: rgba(245, 158, 11, 0.18); }
.point.p11::before { background: rgba(245, 158, 11, 0.10); }
.point.p12::before { background: rgba(245, 158, 11, 0.22); }
.point.p13::before { background: rgba(245, 158, 11, 0.06); }
.point.p17::before { background: rgba(245, 158, 11, 0.22); }
.point.p19::before { background: rgba(245, 158, 11, 0.10); }
.point.p20::before { background: rgba(245, 158, 11, 0.06); }
.point.p24::before { background: rgba(245, 158, 11, 0.18); }

.point.ai-point::before {
  clip-path: polygon(50% 100%, 0% 0%, 100% 0%);
}

/* Checkers stack */
.checkers {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.checkers.top { bottom: 30px; }
.checkers.bottom { top: 30px; }

.checker {
  width: 24px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

.checker.p1, .checker.p3, .checker.p5, .checker.p7, .checker.p9 {
  background: linear-gradient(180deg, #F59E0B 0%, #B4720A 100%);
  border: 1px solid #FBBF24;
}

.checker.ai {
  background: linear-gradient(180deg, #2d2d2d 0%, #1a1a1a 100%);
  border: 1px solid #444;
}

.checker.selected {
  box-shadow: 0 0 10px var(--amber-glow), 0 0 20px rgba(251, 191, 36, 0.4);
  transform: scale(1.15);
}

.checker.stacked-label {
  font-size: 9px;
  font-weight: 700;
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 10px;
}

.checker.ai.stacked-label {
  color: var(--off-white);
}

/* Point pip count label */
.pip-count {
  position: absolute;
  font-size: 10px;
  font-weight: 700;
  pointer-events: none;
}

.point.ai-point .pip-count {
  color: #888;
}

.point:not(.ai-point) .pip-count {
  color: #888;
}

/* ── CENTER BAR ── */
.center-bar {
  display: flex;
  align-items: stretch;
  height: 56px;
  margin: 6px 0;
}

.bar-zone {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bar-checkers {
  display: flex;
  gap: 3px;
  align-items: center;
}

.bar-zone:hover {
  background: rgba(245, 158, 11, 0.04);
  cursor: pointer;
}

.bar-divider {
  width: 2px;
  background: rgba(245, 158, 11, 0.12);
}

/* ── CONTROLS ── */
.controls {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 24px;
  padding: 0 24px;
  width: 100%;
  max-width: 860px;
}

.dice-area {
  display: flex;
  gap: 10px;
}

.die {
  width: 48px;
  height: 48px;
  background: var(--bg-elevated);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 900;
  color: var(--amber);
  cursor: pointer;
  user-select: none;
}

.die.used {
  opacity: 0.4;
}

.die.dominate-die {
  border-color: rgba(251, 191, 36, 0.6);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.2);
}

.die .pip-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: 2px;
  width: 28px;
  height: 28px;
}

.pip {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
  margin: auto;
}

.btn-roll {
  background: var(--amber);
  color: #111;
  font-family: 'Cinzel', serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border: none;
  padding: 14px 28px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-roll:hover:not(:disabled) {
  background: var(--amber-glow);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.35);
}

.btn-roll:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-power {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: transparent;
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--muted);
  padding: 10px 16px;
  border-radius: 2px;
  cursor: not-allowed;
  transition: all 0.2s;
  min-width: 90px;
}

.btn-power.available {
  border-color: var(--amber);
  color: var(--amber);
  cursor: pointer;
  background: rgba(245, 158, 11, 0.05);
}

.btn-power.available:hover {
  background: rgba(245, 158, 11, 0.15);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.25);
}

.power-name {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.power-desc {
  font-size: 10px;
  font-weight: 300;
}

/* ── POWER METER ── */
.power-meter-wrap {
  margin-top: 16px;
  padding: 0 24px;
  width: 100%;
  max-width: 860px;
}

.power-meter-label {
  display: flex;
  justify-content: space-between;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 6px;
}

.power-meter-track {
  height: 3px;
  background: var(--bg-elevated);
  border-radius: 2px;
  overflow: hidden;
}

.power-meter-fill {
  height: 100%;
  background: var(--amber);
  border-radius: 2px;
  transition: width 0.4s ease;
  width: 0%;
}

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.modal {
  background: var(--bg-surface);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 4px;
  padding: 48px 56px;
  text-align: center;
  max-width: 380px;
  width: 90%;
}

.modal-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.modal-title {
  font-family: 'Cinzel', serif;
  font-size: 28px;
  font-weight: 900;
  color: var(--off-white);
  margin-bottom: 12px;
}

.modal-body {
  font-size: 15px;
  font-weight: 300;
  color: var(--muted);
  margin-bottom: 32px;
  line-height: 1.6;
}

.modal-btn {
  display: inline-block;
  background: var(--amber);
  color: #111;
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 14px 36px;
  border-radius: 2px;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}

.modal-btn:hover {
  background: var(--amber-glow);
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.4);
}

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  .board-wrap { padding: 0 8px; }
  .point { min-width: 18px; }
  .checker { width: 18px; height: 8px; }
  .checkers.top { bottom: 24px; }
  .checkers.bottom { top: 24px; }
  .controls { gap: 10px; }
  .btn-roll { padding: 10px 18px; font-size: 11px; }
  .die { width: 40px; height: 40px; font-size: 16px; }
  .game-meta .match-label { display: none; }
}