:root {
  --green-950: #061311;
  --green-900: #0a1d19;
  --green-800: #102c25;
  --gold: #d8b464;
  --cream: #f6f2e8;
  --muted: #b7bcad;
  --line: rgba(246, 242, 232, 0.14);
  --surface: rgba(255, 255, 255, 0.08);
  --surface-strong: rgba(255, 255, 255, 0.12);
  --danger: #d9785f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px),
    radial-gradient(circle at 50% -10%, rgba(216, 180, 100, 0.19), transparent 32rem),
    linear-gradient(180deg, #071511 0%, #101a17 50%, #070b0a 100%);
  background-size: 38px 38px, 38px 38px, auto, auto;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
}

.captains-shell {
  width: min(100%, 680px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 14px 40px;
}

.captains-splash {
  min-height: calc(100vh - 62px);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 22px;
  padding: 28px 8px;
  text-align: center;
}

.castle-mark {
  width: min(132px, 34vw);
  height: auto;
  filter: drop-shadow(0 18px 36px rgba(0, 0, 0, 0.28));
}

.splash-copy {
  display: grid;
  justify-items: center;
  gap: 10px;
}

.splash-copy h1 {
  max-width: 9ch;
  margin: 0;
  font-size: clamp(3.1rem, 15vw, 5.7rem);
  line-height: 0.88;
}

.splash-copy p:not(.eyebrow) {
  max-width: 27rem;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  font-weight: 750;
}

.better-character {
  width: min(180px, 42vw);
  height: auto;
}

.splash-actions {
  display: grid;
  width: min(100%, 360px);
  gap: 16px;
  margin-top: 4px;
}

.splash-primary {
  width: 100%;
}

.splash-links {
  justify-content: center;
}

.splash-loading {
  margin: 2px 0 0;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.captains-hero {
  padding: 28px 6px 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 9ch;
  margin-bottom: 12px;
  font-size: clamp(2.45rem, 12vw, 4.4rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.captains-hero p:not(.eyebrow),
.notice,
.muted {
  color: var(--muted);
}

.captains-card,
.group-card,
.leaderboard-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.26);
}

.captains-card {
  padding: 18px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.button {
  min-height: 50px;
  padding: 12px 18px;
  border-radius: 10px;
  background: linear-gradient(180deg, #ecd37e, #d3ad53);
  color: #071511;
  font-weight: 900;
}

.ghost-link {
  color: var(--cream);
  font-weight: 800;
  text-underline-offset: 4px;
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.leaderboard {
  display: grid;
  gap: 10px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
}

.rank {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: rgba(216, 180, 100, 0.18);
  color: var(--gold);
  font-weight: 900;
}

.player-name {
  font-size: 1.05rem;
  font-weight: 900;
}

.score {
  color: var(--gold);
  font-size: 1.65rem;
  font-weight: 950;
}

.leader-score {
  display: grid;
  justify-items: end;
  min-width: 74px;
  gap: 1px;
}

.leader-score span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.score-under {
  color: #ff6f5f;
}

.score-over {
  color: var(--gold);
}

.score-level {
  color: var(--cream);
}

.group-list,
.admin-groups {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.group-card {
  padding: 16px;
}

.group-card h2 {
  margin-bottom: 12px;
  color: var(--gold);
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.group-player,
.admin-player-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid rgba(246, 242, 232, 0.1);
}

.group-player > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.group-player .muted {
  font-size: 0.78rem;
  font-weight: 800;
}

.group-player:first-of-type,
.admin-player-row:first-of-type {
  border-top: 0;
}

.admin-player-row {
  grid-template-columns: 1fr 76px 70px;
}

.admin-player-row input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.2);
  color: var(--cream);
  padding: 10px 12px;
}

.admin-player-row input[type="number"] {
  text-align: center;
  font-weight: 900;
}

.toast {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(216, 180, 100, 0.38);
  border-radius: 10px;
  background: rgba(216, 180, 100, 0.13);
  color: var(--cream);
  font-weight: 800;
}

.toast.danger {
  border-color: rgba(217, 120, 95, 0.5);
  background: rgba(217, 120, 95, 0.14);
}

.toast.success {
  border-color: rgba(98, 220, 132, 0.42);
  background: rgba(98, 220, 132, 0.12);
}

.compact-hero h1 {
  max-width: none;
  font-size: clamp(2.6rem, 15vw, 4.8rem);
}

.scorer-shell {
  padding: 10px 12px 18px;
}

.scorer-hero {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px;
  padding: 4px 2px 6px;
}

.scorer-hero .eyebrow {
  grid-column: 1 / -1;
  margin-bottom: -2px;
}

.scorer-hero h1 {
  margin: 0;
  font-size: clamp(1.9rem, 9vw, 3.2rem);
  line-height: 0.96;
}

.scorer-hero p:not(.eyebrow) {
  margin: 0 0 4px;
  color: var(--gold);
  font-size: 0.95rem;
  font-weight: 950;
}

.scorer-panel {
  display: grid;
  gap: 18px;
}

.minimal-scorer-panel {
  gap: 9px;
  padding: 4px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.scorer-toolbar {
  padding-inline: 2px;
  margin-bottom: 0;
}

.minimal-control-block {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  padding: 2px;
}

.minimal-control-block label {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.scorer-context {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(216, 180, 100, 0.28);
  border-radius: 999px;
  background: rgba(216, 180, 100, 0.08);
}

.scorer-context span,
.scorer-context em {
  color: var(--gold);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 950;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.scorer-context strong {
  min-width: 0;
  overflow: hidden;
  color: var(--cream);
  font-size: 0.9rem;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-select {
  width: 100%;
  min-height: 40px;
  border: 1px solid rgba(246, 242, 232, 0.16);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--cream);
  padding: 0 16px;
  font-weight: 950;
}

.group-picker,
.hole-picker {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 0 2px 4px;
  -webkit-overflow-scrolling: touch;
}

.picker-chip,
.hole-chip,
.secondary-button,
.scratch-button,
.step-button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--cream);
  font-weight: 900;
}

.picker-chip {
  flex: 0 0 auto;
  padding: 0 16px;
}

.picker-chip.active,
.hole-chip.active {
  border-color: rgba(216, 180, 100, 0.7);
  background: rgba(216, 180, 100, 0.18);
  color: #f8df93;
}

.hole-chip {
  display: grid;
  flex: 0 0 40px;
  gap: 0;
  place-items: center;
  padding: 5px 3px;
  min-height: 38px;
  border-radius: 999px;
}

.hole-chip span {
  font-size: 0.98rem;
}

.hole-chip small {
  color: var(--muted);
  font-size: 0.52rem;
  text-transform: uppercase;
}

.hole-chip.confirmed:not(.active) {
  border-color: rgba(98, 220, 132, 0.34);
  background: rgba(98, 220, 132, 0.09);
}

.scorer-players {
  display: grid;
  gap: 2px;
}

.score-entry-row {
  display: grid;
  grid-template-columns: 1fr 86px;
  gap: 7px 8px;
  align-items: center;
  padding: 8px 2px;
  border-top: 1px solid rgba(246, 242, 232, 0.12);
  background: transparent;
}

.score-entry-name {
  display: grid;
  gap: 2px;
  grid-column: 1 / -1;
  min-width: 0;
}

.score-entry-name strong {
  font-size: 0.96rem;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.score-entry-name span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.score-controls {
  display: grid;
  grid-template-columns: 38px minmax(54px, 1fr) 38px;
  gap: 5px;
  align-items: center;
  min-width: 0;
}

.score-controls input {
  width: 100%;
  height: 42px;
  border: 1px solid rgba(216, 180, 100, 0.28);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.18);
  color: var(--cream);
  text-align: center;
  font-size: 1.28rem;
  font-weight: 950;
}

.step-button {
  height: 42px;
  min-height: 42px;
  border-radius: 999px;
  font-size: 1.18rem;
}

.scratch-button {
  width: 100%;
  min-height: 42px;
  border-radius: 999px;
  font-size: 0.78rem;
  color: #f4d683;
}

.scratch-button.active,
.score-controls.scratch-active {
  border-color: rgba(216, 180, 100, 0.7);
}

.scratch-button.active {
  background: rgba(216, 180, 100, 0.2);
}

.scorer-actions {
  position: sticky;
  bottom: 6px;
  display: grid;
  grid-template-columns: 0.82fr 1.25fr 0.82fr;
  gap: 7px;
  padding: 8px 0 0;
  background: linear-gradient(180deg, rgba(7, 21, 17, 0), rgba(7, 21, 17, 0.96) 28%);
}

.secondary-button {
  min-height: 44px;
  padding: 8px 10px;
  font-size: 0.82rem;
}

.secondary-button:disabled,
.button:disabled {
  opacity: 0.45;
}

@media (min-width: 560px) {
  .score-entry-row {
    grid-template-columns: 1fr 170px 96px;
    align-items: center;
  }

  .score-entry-name {
    grid-column: auto;
  }

  .scorer-actions {
    grid-template-columns: 1fr 1.35fr 1fr;
  }
}

.sim-body {
  min-height: 100vh;
}

.sim-shell {
  width: min(100%, 1560px);
  margin: 0 auto;
  padding: 22px;
}

.sim-header {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 20px;
}

.sim-header h1 {
  max-width: none;
  margin: 0;
  font-size: clamp(2rem, 5vw, 4rem);
}

.phone-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(280px, 1fr));
  gap: 18px;
}

.phone-frame {
  display: grid;
  gap: 10px;
}

.phone-frame h2 {
  margin: 0;
  color: var(--gold);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.phone-frame iframe {
  width: 100%;
  height: 820px;
  border: 1px solid rgba(246, 242, 232, 0.18);
  border-radius: 28px;
  background: #071511;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
}

@media (max-width: 1180px) {
  .phone-grid {
    grid-template-columns: repeat(2, minmax(280px, 1fr));
  }
}

@media (max-width: 640px) {
  .phone-grid {
    grid-template-columns: 1fr;
  }
}

.desk-shell {
  width: min(100%, 1800px);
  margin: 0 auto;
  padding: 18px;
}

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

.desk-header h1 {
  max-width: none;
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 0.96;
}

.desk-board-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.26);
}

.desk-summary {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.desk-summary strong {
  color: var(--cream);
}

.desk-table-wrap {
  overflow-x: auto;
}

.desk-score-table {
  width: 100%;
  min-width: 0;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 0.78rem;
}

.desk-score-table th,
.desk-score-table td {
  border-right: 1px solid rgba(246, 242, 232, 0.08);
  border-bottom: 1px solid rgba(246, 242, 232, 0.08);
  padding: 5px 4px;
  text-align: center;
}

.desk-score-table thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #14251f;
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.desk-score-table tbody tr:nth-child(even) td,
.desk-score-table tbody tr:nth-child(even) th {
  background: rgba(255, 255, 255, 0.025);
}

.desk-score-table .player-col {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 176px;
  min-width: 176px;
  background: #102019;
  text-align: left;
}

.desk-score-table thead .player-col {
  z-index: 5;
}

.desk-score-table .player-col strong,
.desk-score-table .player-col span,
.desk-score-table .player-col small {
  display: block;
}

.desk-score-table .player-col span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.desk-score-table .player-col small {
  margin-top: 1px;
  color: rgba(246, 242, 232, 0.48);
  font-size: 0.58rem;
  font-weight: 850;
  letter-spacing: 0.02em;
}

.desk-score-table .hole-head {
  line-height: 1.05;
}

.desk-score-table .hole-head strong,
.desk-score-table .hole-head span {
  display: block;
}

.desk-score-table .hole-head span {
  margin-top: 3px;
  color: rgba(216, 180, 100, 0.72);
  font-size: 0.62rem;
  letter-spacing: 0;
  text-transform: none;
}

.desk-score-table .points-col,
.desk-score-table .total-col {
  position: sticky;
  z-index: 3;
  width: 70px;
  min-width: 70px;
  background: #102019;
  color: var(--gold);
  font-size: 1rem;
  font-weight: 950;
}

.desk-score-table .points-col {
  right: 70px;
}

.desk-score-table .total-col {
  right: 0;
}

.desk-score-table .total-col.negative {
  color: #ff6f5f;
}

.desk-score-table thead .points-col,
.desk-score-table thead .total-col {
  z-index: 5;
  font-size: 0.72rem;
}

.desk-hole-cell {
  width: 44px;
  min-width: 44px;
  color: var(--cream);
}

.desk-hole-cell strong,
.desk-hole-cell span {
  display: block;
}

.desk-hole-cell strong {
  font-size: 0.84rem;
}

.desk-hole-cell .score-mark {
  display: inline-grid;
  width: 24px;
  min-width: 24px;
  height: 24px;
  margin: 0 auto 2px;
  place-items: center;
  line-height: 1;
}

.desk-hole-cell .score-mark.one-point {
  border: 2px solid #356fbc;
  border-radius: 5px;
  background: #356fbc;
  color: #fff;
}

.desk-hole-cell .score-mark.zero-point {
  border: 3px double rgba(255, 255, 255, 0.86);
  border-radius: 5px;
  background: #3f4346;
  color: #fff;
}

.desk-hole-cell .score-mark.birdie-point {
  border: 2px solid #c8342e;
  border-radius: 999px;
  background: #c8342e;
  color: #fff;
}

.desk-hole-cell .score-mark.eagle-point {
  border: 2px solid #249b59;
  border-radius: 999px;
  background: #249b59;
  color: #fff;
}

.desk-hole-cell span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 850;
}

.desk-hole-cell.empty {
  color: rgba(246, 242, 232, 0.2);
}

.desk-hole-cell.zero {
  background: rgba(217, 120, 95, 0.16);
}

.desk-hole-cell.steady {
  background: rgba(255, 255, 255, 0.035);
}

.desk-hole-cell.good {
  background: rgba(216, 180, 100, 0.15);
}

.desk-hole-cell.excellent {
  background: rgba(98, 220, 132, 0.16);
}
