:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #12313f;
  --muted: #5f7482;
  --accent: #0f766e;
  --accent-soft: #ccfbf1;
  --border: #dce7ef;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(180deg, #ecfeff 0%, var(--bg) 100%);
  color: var(--text);
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  max-width: 860px;
  margin: 0 auto;
  padding: 16px;
}

.hero-card,
.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.08);
}

.hero-card {
  padding: 24px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  font-weight: 700;
}

h1,
h2 {
  margin: 0 0 6px;
}

.hero-card p,
.muted {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.panel {
  padding: 16px;
  margin-bottom: 14px;
}

.admin-panel {
  border-style: dashed;
}

.admin-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-toggle {
  max-width: 140px;
}

.admin-action-block {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  margin-top: 12px;
  background: #f9fbff;
}

.admin-action-block h3 {
  margin: 0 0 4px;
}

.admin-player-controls {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  align-items: end;
  margin-top: 10px;
}

.admin-player-controls .btn {
  min-height: 40px;
  padding: 10px 8px;
}

.admin-hole-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  min-height: 40px;
}

.field-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}

.field span {
  font-size: 0.95rem;
}

.field input,
.field select {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 1rem;
  min-height: 48px;
}

.result-box,
.score-card,
.summary-row {
  border: 1px solid var(--border);
  background: #fbfdff;
  border-radius: 16px;
  padding: 12px;
  margin-top: 10px;
}

.summary-table-wrap {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow-x: auto;
  background: #fbfdff;
}

.summary-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 420px;
}

.summary-table th,
.summary-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e7eff5;
  text-align: center;
  white-space: nowrap;
}

.summary-table thead th {
  position: sticky;
  top: 0;
  background: #eff8ff;
  color: #0b3954;
  z-index: 1;
}

.summary-table tbody th,
.summary-table tfoot th {
  text-align: left;
}

.summary-table tfoot th,
.summary-table tfoot td {
  font-weight: 700;
  background: #f4f7fb;
}

.summary-row-discrepancy th {
  background: #fff1f2;
  color: #b91c1c;
}

.summary-cell-discrepancy {
  background: #fee2e2;
  color: #991b1b;
  font-weight: 700;
}

.summary-partner-note {
  font-weight: 600;
  color: #7c2d12;
}

.participant-list {
  display: grid;
  gap: 10px;
}

.partner-select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 1rem;
  min-height: 48px;
  background: white;
}

.round-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.score-stack {
  display: grid;
  gap: 10px;
}

.score-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 8px;
}

.score-head-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-size: 0.75rem;
  color: var(--muted, #888);
}

.focus-tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 999px;
  padding: 2px 8px;
}

.player-stats {
  font-size: 0.8rem;
  font-weight: 500;
}

.perf-under { color: #22c55e; }
.perf-over  { color: #ef4444; }
.perf-par   { color: #3b82f6; }

.score-card input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 1.45rem;
  font-weight: 700;
  text-align: center;
  min-height: 44px;
}

.score-card-error {
  padding: 12px;
  border: 2px solid #dc2626;
  border-radius: 12px;
  background-color: #fee2e2;
}

.score-card-error input {
  background-color: #fef2f2;
  border-color: #dc2626;
}

.score-card-focus {
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.mini-keypad {
  display: grid;
  grid-template-columns: repeat(var(--digit-count, 6), minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.digit-btn {
  border: none;
  border-radius: 10px;
  min-height: 42px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.scoring-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.scoring-actions .btn {
  padding: 12px 10px;
}

.btn {
  flex: 1;
  border: none;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 700;
  min-height: 48px;
  cursor: pointer;
  background: var(--accent);
  color: white;
}

.btn-secondary {
  background: #e2e8f0;
  color: var(--text);
}

.feedback {
  margin: 10px 0 0;
  min-height: 24px;
  color: var(--accent);
  font-weight: 600;
}

.feedback.success {
  color: #047857;
}

.feedback.error {
  color: #dc2626;
}

.feedback.warning {
  color: #b45309;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 10px;
  padding: 8px 10px;
}

.hidden {
  display: none;
}

@media (max-width: 699px) {
  .admin-player-controls {
    grid-template-columns: 1fr;
  }

  #scoringPanel {
    padding: 12px;
  }

  #scoringPanel .round-header {
    gap: 8px;
    margin-bottom: 6px;
  }

  #scoringPanel .pill {
    padding: 6px 10px;
    font-size: 0.88rem;
  }

  #scoringPanel .score-card {
    padding: 8px;
    margin-top: 6px;
    border-radius: 12px;
  }

  #scoringPanel .score-stack {
    gap: 8px;
  }

  #scoringPanel .score-head {
    margin-bottom: 6px;
  }

  #scoringPanel .score-head-right {
    font-size: 0.72rem;
    gap: 1px;
  }

  #scoringPanel .player-stats {
    font-size: 0.74rem;
  }

  #scoringPanel .score-card input {
    padding: 8px 10px;
    min-height: 40px;
    font-size: 1.3rem;
  }

  #scoringPanel .mini-keypad {
    gap: 6px;
    margin-top: 6px;
  }

  #scoringPanel .digit-btn {
    min-height: 38px;
    border-radius: 8px;
  }

  #scoringPanel .actions {
    gap: 8px;
    margin-top: 10px;
  }

  #scoringPanel .btn {
    min-height: 44px;
    padding: 10px 8px;
    font-size: 0.92rem;
  }

  .summary-table th,
  .summary-table td {
    padding: 7px 8px;
    font-size: 0.84rem;
  }
}

@media (min-width: 700px) {
  .app-shell {
    padding: 24px;
  }

  .scoring-actions {
    display: flex;
  }

  .field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
