:root {
  --bg: #0b0f13;
  --panel: rgba(245, 248, 251, 0.94);
  --panel-strong: rgba(255, 255, 255, 0.98);
  --ink: #13212f;
  --muted: #637384;
  --line: rgba(19, 33, 47, 0.12);
  --green: #1f8f5f;
  --green-dark: #0c6d48;
  --gold: #ddc36c;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.28);
  --mono: "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg-photo: url("/masters-background.png");
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background:
    linear-gradient(rgba(7, 11, 16, 0.58), rgba(7, 11, 16, 0.48)),
    var(--bg-photo),
    linear-gradient(180deg, #11202f, #0b0f13);
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

body.site-locked {
  overflow: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

.hidden {
  display: none;
}

.site-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 42vh 0 48px;
}

.hero,
.content-grid,
.admin-grid,
.form-grid {
  display: grid;
  gap: 16px;
}

.hero {
  grid-template-columns: 1fr;
  margin-bottom: 14px;
}

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

.hero-panel,
.panel,
.modal-card,
.overlay-shell {
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero-panel {
  padding: 16px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(15, 90, 53, 0.96), rgba(12, 78, 45, 0.94)),
    linear-gradient(120deg, rgba(255, 255, 255, 0.08), transparent 45%);
  color: #f1d98a;
  position: relative;
  overflow: hidden;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -70px -110px auto;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(31, 143, 95, 0.18), transparent 68%);
  pointer-events: none;
}

.hero-main {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
}

.hero-center {
  display: grid;
  gap: 12px;
  justify-items: center;
}

.hero-copy {
  padding: 2px 6px;
  text-align: center;
}

.hero-copy h1,
.hero-copy .hero-text,
.hero-copy #event-name {
  color: #f6e7b1;
}

.hero-controls {
  display: grid;
  gap: 10px;
  justify-items: end;
  align-self: start;
}

.panel {
  padding: 16px;
  border-radius: 16px;
  background: var(--panel);
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--green);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-meta {
  margin: 0;
  color: rgba(82, 97, 113, 0.9);
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.section-meta-center {
  text-align: center;
  white-space: nowrap;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.03em;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
  max-width: none;
  white-space: nowrap;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.05rem;
}

.hero-text,
.modal-copy {
  color: rgba(238, 244, 248, 0.78);
  max-width: 42rem;
  line-height: 1.45;
  font-size: 0.94rem;
}

.hero-actions,
.overlay-actions,
.admin-footer,
.section-heading,
.overlay-header,
.scoreboard-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.scoreboard-top {
  margin-bottom: 10px;
  color: rgba(241, 217, 138, 0.82);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.button {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 15px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button-solid {
  background: linear-gradient(180deg, #259a67, #14764c);
  color: white;
  box-shadow: 0 10px 24px rgba(20, 118, 76, 0.28);
}

.button-outline {
  background: rgba(255, 255, 255, 0.08);
  color: #f6e7b1;
  border-color: rgba(241, 217, 138, 0.28);
}

.modal-close {
  margin-left: auto;
  margin-bottom: 8px;
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 6px 11px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(238, 244, 248, 0.84);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
}

.rules-list {
  margin: 10px 0 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  line-height: 1.35;
  font-size: 0.9rem;
}

.rules-accordion {
  border: 1px solid rgba(241, 217, 138, 0.22);
  border-radius: 14px;
  background: rgba(7, 38, 22, 0.22);
  padding: 10px 12px 12px;
  width: min(560px, 100%);
}

.rules-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: pointer;
  list-style: none;
  color: #f6e7b1;
  font-weight: 600;
}

.rules-summary::-webkit-details-marker {
  display: none;
}

.rules-summary-meta {
  color: rgba(241, 217, 138, 0.66);
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.rules-accordion .rules-list {
  color: rgba(252, 246, 224, 0.92);
  margin-top: 12px;
}

.preview-standings,
.portal-standings,
.player-grid,
.admin-grid {
  margin-top: 12px;
}

.leaderboard-board {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-strong);
}

.standings-panel,
.players-panel {
  overflow: hidden;
}

.leaderboard-head,
.leaderboard-row {
  display: grid;
  grid-template-columns: 52px minmax(190px, 1.2fr) 74px repeat(4, minmax(110px, 1fr)) 76px;
}

.leaderboard-head {
  background: #e7edf3;
  color: #526171;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
}

.leaderboard-row {
  border-bottom: 1px solid rgba(19, 33, 47, 0.08);
}

.leaderboard-row:last-child {
  border-bottom: 0;
}

.leaderboard-row.is-leader {
  background: linear-gradient(90deg, rgba(31, 143, 95, 0.08), transparent 65%);
}

.leaderboard-head span,
.leaderboard-cell {
  padding: 7px 8px;
  border-right: 1px solid rgba(19, 33, 47, 0.07);
}

.leaderboard-head span:last-child,
.leaderboard-cell:last-child {
  border-right: 0;
}

.leaderboard-cell {
  display: flex;
  align-items: center;
  min-height: 42px;
}

.leaderboard-rank,
.leaderboard-total,
.leaderboard-pick {
  justify-content: center;
  font-family: var(--mono);
  font-weight: 700;
}

.leaderboard-total,
.leaderboard-pick strong {
  font-size: 0.92rem;
}

.leaderboard-pick {
  flex-direction: column;
  gap: 2px;
  line-height: 1.05;
}

.leaderboard-pick span {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 600;
  text-transform: uppercase;
}

.leaderboard-team {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
}

.leaderboard-team strong {
  font-size: 0.86rem;
  line-height: 1.1;
}

.leaderboard-team small,
.leaderboard-golfer span,
.team-card--locked p {
  color: var(--muted);
}

.leaderboard-team small {
  font-size: 0.62rem;
  font-family: var(--mono);
  text-transform: uppercase;
}

.leaderboard-golfer {
  display: grid;
  align-content: center;
  gap: 2px;
}

.leaderboard-golfer strong,
.leaderboard-golfer em {
  font-family: var(--mono);
  font-style: normal;
}

.leaderboard-golfer strong {
  font-size: 0.74rem;
  line-height: 1.05;
}

.leaderboard-golfer span {
  font-size: 0.6rem;
}

.leaderboard-golfer em {
  font-size: 0.74rem;
}

.leaderboard-golfers-mobile,
.leaderboard-golfer-box {
  display: none;
}

.leaderboard-empty {
  padding: 20px;
}

.team-card--locked {
  padding: 18px;
  border: 1px dashed rgba(255, 255, 255, 0.3);
  border-radius: 12px;
  color: white;
}

.field-board {
  display: grid;
  gap: 12px;
}

.field-board-header {
  display: flex;
  justify-content: flex-start;
  gap: 16px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.field-board-titles {
  display: grid;
  gap: 4px;
  font-family: var(--mono);
  text-transform: uppercase;
  font-size: 0.76rem;
  color: var(--muted);
}

.field-board-titles strong {
  color: var(--ink);
  font-size: 0.92rem;
}

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

.field-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-strong);
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
}

.field-summary {
  list-style: none;
  cursor: pointer;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.field-summary::-webkit-details-marker {
  display: none;
}

.field-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.field-name-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.field-name-line strong {
  font-size: 1rem;
}

.field-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.field-stats span {
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(19, 33, 47, 0.06);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.field-stats span label {
  text-transform: uppercase;
  opacity: 0.78;
}

.field-stats span strong {
  color: var(--ink);
  font-size: 0.76rem;
}

.owner-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.owner-chip {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(31, 143, 95, 0.14);
  color: var(--green-dark);
  font-family: var(--mono);
  font-size: 0.68rem;
  line-height: 1.1;
  white-space: nowrap;
}

.owner-chip.muted {
  background: rgba(99, 115, 132, 0.1);
  color: var(--muted);
}

.field-scorecard-stack,
.round-grid-stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.scorecard-segment {
  display: grid;
  grid-template-columns: 44px repeat(9, minmax(22px, 1fr));
  gap: 4px;
  align-items: center;
}

.field-scorecard-rowlabel,
.field-hole-head,
.round-grid-head,
.field-hole-cell,
.field-par-cell {
  min-height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 0.71rem;
}

.field-scorecard-rowlabel {
  justify-content: start;
  color: var(--muted);
}

.field-hole-head,
.round-grid-head {
  background: rgba(19, 33, 47, 0.05);
  color: var(--muted);
}

.field-par-cell {
  background: rgba(19, 33, 47, 0.05);
  color: var(--muted);
}

.field-hole-cell {
  background: rgba(31, 143, 95, 0.06);
  color: var(--ink);
  font-weight: 700;
  border: 1px solid transparent;
}

.field-hole-cell.is-empty {
  color: rgba(99, 115, 132, 0.45);
  background: rgba(19, 33, 47, 0.04);
}

.field-hole-cell.is-birdie {
  border-color: rgba(31, 143, 95, 0.68);
  border-radius: 999px;
  background: rgba(31, 143, 95, 0.08);
}

.field-hole-cell.is-eagle {
  border: 2px double rgba(31, 143, 95, 0.92);
  border-radius: 999px;
  background: rgba(31, 143, 95, 0.12);
}

.field-hole-cell.is-bogey {
  border-color: rgba(190, 108, 62, 0.76);
  border-radius: 0;
  background: rgba(190, 108, 62, 0.06);
}

.field-hole-cell.is-double-bogey {
  border: 2px double rgba(190, 108, 62, 0.92);
  border-radius: 0;
  background: rgba(190, 108, 62, 0.09);
}

.field-details {
  padding: 0 12px 12px;
  display: grid;
  gap: 10px;
}

.round-card {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.round-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--muted);
}

.empty-round {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.76rem;
}

.player-grid {
  display: block;
}

.modal,
.portal {
  position: fixed;
  inset: 0;
  padding: 24px;
  overflow: auto;
  background: rgba(5, 8, 12, 0.74);
  backdrop-filter: blur(10px);
}

.modal-card,
.overlay-shell {
  width: min(1280px, 100%);
  margin: 5vh auto;
  border-radius: 22px;
  background: rgba(249, 251, 253, 0.96);
  padding: 22px;
}

.gate-card {
  width: min(480px, 100%);
  background: rgba(10, 17, 26, 0.9);
  color: #eef4f8;
}

.gate-card .section-kicker,
.gate-card .modal-copy,
.gate-card .auth-error {
  color: rgba(238, 244, 248, 0.8);
}

.auth-form,
.form-grid {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.auth-form input,
.form-grid input,
.form-grid select,
.code-area {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.admin-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.admin-shell,
.admin-shell h2,
.admin-shell h3,
.admin-shell p,
.admin-shell label,
.admin-shell .section-kicker,
.admin-shell .overlay-header,
.admin-shell .admin-footer,
.admin-shell .team-entry-head strong {
  color: var(--ink);
}

.admin-shell .button-outline {
  color: var(--ink);
  border-color: rgba(19, 33, 47, 0.16);
  background: rgba(19, 33, 47, 0.04);
}

.admin-team-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.participants-builder {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  max-height: 680px;
  overflow: auto;
  padding-right: 4px;
}

.team-entry-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.84);
  padding: 14px;
}

.team-entry-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.team-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.team-entry-grid label {
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
}

.danger-button {
  color: #9a3f39;
  border-color: rgba(154, 63, 57, 0.24);
  background: rgba(154, 63, 57, 0.06);
}

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

.form-grid label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
}

.span-2 {
  grid-column: 1 / -1;
}

.code-area {
  min-height: 360px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 0.8rem;
}

@media (max-width: 980px) {
  .hero,
  .hero-main,
  .admin-grid,
  .team-entry-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .hero-controls {
    justify-items: start;
  }

  .leaderboard-head,
  .leaderboard-row {
    grid-template-columns: 54px minmax(170px, 1fr) 80px repeat(2, minmax(140px, 1fr)) 72px;
  }

  .leaderboard-head-g3,
  .leaderboard-head-g4,
  .leaderboard-cell-g3,
  .leaderboard-cell-g4 {
    display: none;
  }
}

@media (max-width: 860px) {
  .site-shell {
    width: min(100vw - 16px, 1480px);
    padding-top: 24vh;
  }

  h1 {
    white-space: normal;
  }

  .hero-copy,
  .panel,
  .modal-card,
  .overlay-shell {
    padding: 16px;
  }

  .field-scorecard-stack,
  .round-grid-stack {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .site-shell {
    width: calc(100vw - 16px);
    padding-top: 34vh;
    padding-bottom: 28px;
  }

  .hero {
    margin-bottom: 12px;
  }

  .hero-panel,
  .panel {
    width: 100%;
    border-radius: 16px;
  }

  .hero-panel {
    padding: 14px;
  }

  .scoreboard-top {
    font-size: 0.62rem;
    gap: 8px;
  }

  .hero-main {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .hero-center {
    gap: 10px;
  }

  .hero-copy {
    width: 100%;
    padding: 0;
  }

  h1 {
    font-size: clamp(1.8rem, 8vw, 2.35rem);
    line-height: 0.95;
    white-space: normal;
  }

  .rules-accordion {
    width: 100%;
    padding: 10px 12px;
  }

  .hero-controls {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    justify-items: stretch;
  }

  .hero-controls .button {
    width: 100%;
    padding: 10px 12px;
  }

  .section-heading {
    align-items: flex-start;
  }

  .section-meta-center {
    width: 100%;
    order: 3;
    text-align: left;
    white-space: normal;
  }

  .section-heading h2 {
    font-size: 1.2rem;
  }

  .leaderboard-board {
    border-radius: 12px;
  }

  .leaderboard-head {
    display: none;
  }

  .leaderboard-row {
    display: flex;
    flex-wrap: wrap;
    padding: 0;
  }

  .leaderboard-row .leaderboard-cell {
    min-width: 0;
    min-height: auto;
    padding: 8px 6px;
  }

  .leaderboard-cell-rank {
    order: 1;
    width: 36px;
  }

  .leaderboard-cell-team {
    order: 2;
    flex: 1 1 calc(100% - 148px);
  }

  .leaderboard-cell-total {
    order: 3;
    width: 56px;
  }

  .leaderboard-cell-pick {
    order: 4;
    display: grid;
    width: 56px;
  }

  .leaderboard-cell-desktop-golfer,
  .leaderboard-head-g1,
  .leaderboard-head-g2,
  .leaderboard-head-g3,
  .leaderboard-head-g4 {
    display: none;
  }

  .leaderboard-golfers-mobile {
    order: 5;
    display: grid;
    width: 100%;
  }

  .leaderboard-golfers-mobile {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    align-items: stretch;
    border-top: 1px solid rgba(19, 33, 47, 0.07);
    padding: 0;
  }

  .leaderboard-rank,
  .leaderboard-total,
  .leaderboard-pick {
    align-items: flex-start;
    padding-top: 10px;
    font-size: 0.82rem;
  }

  .leaderboard-pick {
    justify-content: flex-start;
    border-left: 1px solid rgba(19, 33, 47, 0.07);
  }

  .leaderboard-pick strong {
    font-size: 0.74rem;
  }

  .leaderboard-pick span {
    font-size: 0.5rem;
  }

  .leaderboard-team {
    padding-right: 2px;
  }

  .leaderboard-team strong {
    font-size: 0.8rem;
  }

  .leaderboard-team small {
    font-size: 0.58rem;
  }

  .leaderboard-golfer-box {
    display: grid;
    grid-template-rows: auto auto auto;
    align-content: center;
    justify-items: center;
    text-align: center;
    min-height: 78px;
    padding: 10px 4px 8px;
    border-right: 1px solid rgba(19, 33, 47, 0.07);
    border-top: 0;
    min-width: 0;
    overflow: hidden;
  }

  .leaderboard-golfer-box:last-child {
    border-right: 0;
  }

  .leaderboard-golfer-box strong {
    font-size: 0.58rem;
    line-height: 1.05;
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .leaderboard-golfer-box span {
    font-size: 0.48rem;
    line-height: 1;
  }

  .leaderboard-golfer-box em {
    font-size: 0.56rem;
    line-height: 1.05;
  }

  .modal-close {
    padding: 5px 10px;
    font-size: 0.72rem;
  }

  .field-row {
    border-radius: 12px;
  }

  .field-summary {
    padding: 10px;
    gap: 8px;
  }

  .field-meta {
    gap: 10px;
  }

  .field-name-line strong {
    font-size: 0.92rem;
  }

  .owner-list {
    gap: 5px;
  }

  .owner-chip {
    font-size: 0.62rem;
    padding: 3px 7px;
  }

  .field-stats {
    gap: 6px;
  }

  .field-stats span {
    padding: 4px 7px;
    font-size: 0.66rem;
    gap: 5px;
  }

  .field-stats span strong {
    font-size: 0.7rem;
  }

  .field-scorecard-stack,
  .round-grid-stack {
    gap: 6px;
  }

  .scorecard-segment {
    grid-template-columns: 34px repeat(9, minmax(0, 1fr));
    gap: 3px;
  }

  .field-scorecard-rowlabel,
  .field-hole-head,
  .round-grid-head,
  .field-hole-cell,
  .field-par-cell {
    min-height: 20px;
    font-size: 0.58rem;
  }

  .field-details {
    padding: 0 10px 10px;
  }

  .round-card-top {
    font-size: 0.68rem;
  }

  .portal,
  .modal {
    padding: 12px;
  }

  .modal-card,
  .overlay-shell {
    padding: 16px;
    border-radius: 18px;
    width: 100%;
  }
}
