/* Dartboard chrome — uses the shared theme tokens/components directly
   (box-sizing, [hidden], body basics, fonts come from shared/theme.css).
   The pixel treatment is folded into each rule; values match the old
   base-plus-override cascade. */

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
}

.app-header {
  max-width: 520px;
}

.screen {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

h1 {
  font-size: 1rem;
  line-height: 1.5;
  margin: 8px 0 0;
  text-align: center;
}

h2 {
  font-size: 1rem;
  line-height: 1.5;
  margin: 0;
}

/* ── Setup screen ── */

.setup-card {
  width: 100%;
  background: var(--surface);
  border: 3px solid var(--border);
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field-row label {
  color: var(--ink-dim);
  font-size: 0.95rem;
}

.field-row select,
.field-row input[type='checkbox'] {
  font-size: 1rem;
}

select {
  background: #12121a;
  color: var(--ink);
  border: 2px solid var(--border);
  padding: 8px 10px;
}

input[type='checkbox'] {
  width: 20px;
  height: 20px;
}

.players-row {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-row {
  display: flex;
  gap: 8px;
}

.player-name-input {
  flex: 1;
  background: #12121a;
  color: var(--ink);
  border: 2px solid var(--border);
  padding: 10px 12px;
  font-size: 1rem;
}

.remove-player-btn {
  background: #12121a;
  border: 2px solid var(--border);
  color: var(--danger);
  width: 40px;
  font-size: 1.2rem;
  cursor: pointer;
}

.btn-primary,
.btn-ghost {
  padding: 12px 16px;
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: 3px 3px 0 var(--shadow);
  touch-action: manipulation;
}

.btn-primary:active,
.btn-ghost:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--shadow);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent-border);
  color: var(--accent-ink);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--border);
}

/* ── Game screen ── */

.scoreboard {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.player-card {
  background: var(--surface);
  border: 3px solid var(--border);
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 10px 12px;
  text-align: center;
  transition: border-color 0.15s;
}

.player-card.active {
  border-color: var(--accent);
  box-shadow: 4px 4px 0 var(--shadow);
}

.player-name {
  font-size: 0.85rem;
  color: var(--ink-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-score {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.2;
}

.player-meta {
  font-size: 0.75rem;
  color: var(--ink-dim);
}

.board-wrap {
  position: relative;
  width: 100%;
  max-width: 460px;
}

#dartboard {
  width: 100%;
  height: auto;
  display: block;
  touch-action: pan-x; /* allow the pane swipe; taps still land */
  cursor: crosshair;
  user-select: none;
}

#dartboard text { font-family: var(--font-display); }

.mode-cricket #dartboard [data-cricket='no'] { opacity: 0.3; }

.dart-toast {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  background: rgba(0, 0, 0, 0.75);
  border: 2px solid var(--accent);
  color: #fff;
  padding: 8px 16px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  opacity: 0;
  pointer-events: none;
}

.dart-toast.show {
  animation: toast-pop 0.9s ease-out forwards;
}

@keyframes toast-pop {
  0% {
    opacity: 0;
    transform: translateX(-50%) scale(0.85);
  }
  15% {
    opacity: 1;
    transform: translateX(-50%) scale(1.05);
  }
  30% {
    transform: translateX(-50%) scale(1);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

.turn-panel {
  width: 100%;
  background: var(--surface);
  border: 3px solid var(--border);
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.turn-darts {
  display: flex;
  gap: 8px;
}

.dart-slot {
  flex: 1;
  background: #12121a;
  border: 2px solid var(--border);
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.dart-slot.bust {
  color: var(--danger);
  border-color: var(--danger);
}

.turn-total {
  font-size: 0.95rem;
  color: var(--ink-dim);
}

.checkout-hint {
  font-size: 0.95rem;
  color: var(--good);
  min-height: 1.2em;
}

.turn-actions {
  display: flex;
  gap: 8px;
}

.turn-actions button {
  flex: 1;
}

.status-msg {
  font-weight: 700;
}

/* ── Winner overlay (scrim/centering from .modal-overlay) ── */

.overlay {
  padding: 16px;
}

.overlay-card {
  background: var(--surface);
  border: 3px solid var(--border);
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 24px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.winner-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--ink-dim);
}

.overlay-actions {
  display: flex;
  gap: 10px;
}

.overlay-actions button {
  flex: 1;
}

/* ── Swipe panes, cricket, confirm (tonitown) ── */

.game-panes {
  width: 100%;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.game-panes::-webkit-scrollbar { display: none; }

.pane {
  min-width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 0 8px; /* keep hard shadows from bleeding into the next pane */
}

.pane-dots {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.dot {
  width: 10px;
  height: 10px;
  background: var(--border);
}
.dot.active { background: var(--accent); }

.mini-status {
  width: 100%;
  text-align: center;
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--accent);
  min-height: 1.2em;
}

.cricket-table {
  width: 100%;
  table-layout: fixed;   /* player columns share the width equally, whatever the names */
  border-collapse: collapse;
  background: var(--surface);
  border: 3px solid var(--border);
  box-shadow: 4px 4px 0 var(--shadow);
  font-family: var(--font-display);
  text-align: center;
}
.cricket-table th,
.cricket-table td {
  padding: 9px 6px;
  border-bottom: 2px solid var(--border);
  font-size: 13px;
  font-weight: 400;
}
.cricket-table th { font-size: 10px; color: var(--ink-dim); overflow-wrap: anywhere; }
.cricket-table th:first-child { width: 44px; }   /* the number-label column, sized once for "bull"/"pts" */
.cricket-table th.active { color: var(--accent); }
.cricket-table td.active { background: rgba(255, 210, 63, 0.07); }
.cricket-table .cricket-num {
  font-size: 10px;
  color: var(--ink-dim);
}
.cricket-table td.closed { color: var(--good); }
.cricket-table .cricket-points td {
  font-size: 14px;
  color: var(--accent);
  border-bottom: none;
}
.cricket-table .cricket-points td:first-child { font-size: 10px; color: var(--ink-dim); }

.confirm-turn-btn { width: 100%; }

/* ── Help overlay ── */

.help-btn {
  font-size: 14px;
  padding: 8px 14px;
  min-height: 40px;
  min-width: 40px;
}

.help-card {
  text-align: left;
  max-height: 84vh;
  overflow-y: auto;
}

.help-card h2 {
  font-size: 0.9rem;
  text-align: center;
}

.help-text h3 {
  font-family: var(--font-display);
  font-size: 0.7rem;
  color: var(--accent);
  margin: 14px 0 6px;
}

.help-text p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--ink);
}
