:root {
  --bg: #f3f7f2;
  --card: #ffffff;
  --text: #172117;
  --muted: #607060;
  --line: #dce6dc;
  --primary: #176b3a;
  --primary-dark: #0f4d29;
  --danger-bg: #fff1f1;
  --danger-text: #8a1f1f;
  --notice-bg: #f8f3dc;
  --notice-text: #6a5200;

  font-size: 19px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: radial-gradient(circle at top, #ffffff 0%, var(--bg) 55%);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.45;
  overflow-x: hidden;
}

.page-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

.card {
  width: 100%;
  max-width: 680px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 20px 60px rgba(23, 33, 23, 0.12);
  padding: 34px;
}

.admin-card {
  max-width: 920px;
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1 {
  margin: 0;
  font-size: 2.35rem;
  line-height: 1.1;
}

h2 {
  margin: 0 0 18px;
  font-size: 1.45rem;
  line-height: 1.2;
}

.badge {
  padding: 10px 14px;
  border-radius: 999px;
  background: #ecf7ef;
  color: var(--primary-dark);
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
}

.round-panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  background: #fbfdfb;
  margin-bottom: 24px;
}

.round-details {
  display: grid;
  gap: 12px;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.detail-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.detail-row span {
  color: var(--muted);
}

.lookup-form {
  margin-top: 10px;
}

.lookup-form label,
.admin-grid label,
.team-card label {
  display: block;
  font-weight: 700;
  margin-bottom: 10px;
}

.input-row {
  display: flex;
  gap: 12px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 15px 16px;
  font-size: 1.05rem;
  background: #ffffff;
  touch-action: manipulation;
}

button {
  border: none;
  border-radius: 14px;
  background: var(--primary);
  color: #ffffff;
  padding: 15px 18px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  touch-action: manipulation;
}

button:hover {
  background: var(--primary-dark);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.secondary-button {
  background: #eef6f0;
  color: var(--primary-dark);
  border: 1px solid var(--line);
}

.secondary-button:hover {
  background: #dfeee3;
}

.message {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--danger-bg);
  color: var(--danger-text);
}

.notice {
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--notice-bg);
  color: var(--notice-text);
}

.matches {
  margin-top: 20px;
  display: grid;
  gap: 12px;
}

.match-button {
  width: 100%;
  text-align: left;
  background: #f2f8f4;
  color: var(--text);
  border: 1px solid var(--line);
}

.match-button:hover {
  background: #e5f2e9;
}

.match-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.95rem;
}

.admin-options {
  margin-top: 20px;
  display: grid;
  gap: 12px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.teams-container {
  display: grid;
  gap: 18px;
}

.team-card {
  position: relative;
}

.team-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.team-rating {
  padding: 10px 14px;
  border-radius: 14px;
  background: #ecf7ef;
  color: var(--primary-dark);
  font-weight: 700;
  white-space: nowrap;
}

.team-card label {
  margin-top: 14px;
}

.muted {
  color: var(--muted);
}

.hidden {
  display: none;
}

.scorecard-card {
  max-width: 980px;
}

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

.hole-nav {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  gap: 10px;
}

.hole-button {
  padding: 12px 8px;
  text-align: center;
}

.active-hole {
  background: var(--primary);
  color: #ffffff;
}

.score-team-card {
  margin-bottom: 0;
}

.score-entry-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
}

.individual-score-row {
  grid-template-columns: 1.4fr 1fr auto;
}

.score-player-name {
  font-weight: 700;
}

.scorecard-table-wrapper {
  width: 100%;
  overflow-x: auto;
  margin-top: 18px;
}

.scorecard-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.scorecard-table th,
.scorecard-table td {
  border: 1px solid var(--line);
  padding: 12px 10px;
  text-align: center;
  vertical-align: middle;
}

.scorecard-table th {
  background: #ecf7ef;
  color: var(--primary-dark);
  font-weight: 800;
}

.scorecard-table td:first-child,
.scorecard-table th:first-child {
  text-align: left;
  min-width: 180px;
}

.scorecard-table td:last-child,
.scorecard-table th:last-child {
  min-width: 110px;
}

.par-row td {
  background: #fbfdfb;
  color: var(--muted);
  font-weight: 700;
}

.scorecard-subtext {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

.scorecard-toolbar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px;
  align-items: center;
  text-align: center;
}

.full-width-button {
  width: 100%;
  margin-top: 14px;
}

.score-input-label {
  display: block;
  margin-top: 20px;
  margin-bottom: 8px;
  font-weight: 800;
}

.score-entry-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.compact-scorecard-card {
  padding-top: 26px;
}

.scorecard-top-bar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.scorecard-top-bar h1 {
  font-size: 2rem;
}

.scorecard-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.scorecard-top-actions .secondary-button {
  padding: 10px 14px;
}

.compact-toolbar {
  margin-bottom: 12px;
}

.compact-toolbar h2 {
  margin-bottom: 0;
  font-size: 1.35rem;
}

.clean-scorecard-table th,
.clean-scorecard-table td {
  padding: 10px 8px;
}

.clean-scorecard-table td:first-child,
.clean-scorecard-table th:first-child {
  min-width: 160px;
}

.clean-scorecard-table .small-enter-button {
  padding: 9px 10px;
  font-size: 0.9rem;
}

.score-entry-simple {
  text-align: center;
  padding: 8px 0 0;
}

.score-entry-simple h1 {
  font-size: 2rem;
  margin: 6px 0 12px;
}

.entry-subtitle {
  display: flex;
  justify-content: center;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
  font-size: 1.25rem;
  font-weight: 800;
}

.entry-subtitle span {
  padding: 10px 14px;
  border-radius: 14px;
  background: #ecf7ef;
  color: var(--primary-dark);
}

.centered-label {
  text-align: center;
  font-size: 1.35rem;
}

.big-score-input {
  max-width: 240px;
  margin: 0 auto;
  text-align: center;
  font-size: 3rem;
  font-weight: 800;
  padding: 18px;
}

.big-save-button {
  max-width: 300px;
  margin: 18px auto 0;
  display: block;
  font-size: 1.25rem;
  padding: 18px;
}

.scorecard-table th:first-child,
.scorecard-table td:first-child {
  position: sticky;
  left: 0;
  background-color: #ffffff; /* Keeps the text behind from showing through */
  z-index: 2;
  box-shadow: 2px 0 5px rgba(0,0,0,0.05); /* Adds a tiny shadow so you can tell it's overlapping */
}

/* Make sure the top-left header stays on top of everything */
.scorecard-table th:first-child {
  z-index: 3;
}

@media (max-width: 700px) {
  :root {
    font-size: 18px;
  }

  .page-shell {
    align-items: flex-start;
    padding: 16px;
  }

  .card {
    padding: 24px;
    border-radius: 20px;
  }

  .header {
    flex-direction: column;
  }

  .input-row {
    flex-direction: column;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .team-header {
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  .hole-nav {
    grid-template-columns: repeat(6, 1fr);
  }

  .score-entry-row,
  .individual-score-row {
    grid-template-columns: 1fr;
  }

  .scorecard-toolbar {
    grid-template-columns: 1fr;
  }

  .score-entry-actions {
    grid-template-columns: 1fr;
  }

  .scorecard-table {
    min-width: 620px;
  }

  .scorecard-table th,
  .scorecard-table td {
    padding: 10px 8px;
  }

  .compact-scorecard-card {
    padding: 18px;
  }

  .scorecard-top-bar {
    align-items: center;
  }

  .scorecard-top-bar h1 {
    font-size: 1.7rem;
  }

  .scorecard-top-actions {
    flex-direction: column;
    align-items: flex-end;
  }

  .entry-subtitle {
    flex-direction: column;
    gap: 8px;
  }

  .big-score-input {
    max-width: 100%;
  }
}
