:root {
  --bg: #f4eedf;
  --bg-deep: #184c36;
  --bg-dark: #102d23;
  --panel: rgba(255, 249, 239, 0.9);
  --panel-strong: rgba(255, 253, 248, 0.96);
  --ink: #18211b;
  --muted: #5f6d63;
  --fairway: #2f7b57;
  --fairway-deep: #1d5d3f;
  --sand: #d9b774;
  --sky: #7ab7c9;
  --accent: #cb5c47;
  --line: rgba(24, 33, 27, 0.1);
  --shadow: 0 24px 60px rgba(16, 45, 35, 0.18);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: "Trebuchet MS", "Aptos", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #fff8ea 0, #f4eedf 34%, #d6e0c9 100%);
  position: relative;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4,
button,
.stat-number,
.rank-badge,
.metric-value {
  font-family: Georgia, "Palatino Linotype", "Book Antiqua", serif;
}

button,
input,
select {
  font: inherit;
}

.bg-orb,
.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.bg-orb {
  filter: blur(20px);
  opacity: 0.55;
}

.bg-orb-a {
  background: radial-gradient(circle, rgba(122, 183, 201, 0.38) 0, rgba(122, 183, 201, 0) 58%);
  transform: translate(-22%, -12%);
}

.bg-orb-b {
  background: radial-gradient(circle, rgba(47, 123, 87, 0.28) 0, rgba(47, 123, 87, 0) 62%);
  transform: translate(42%, 12%);
}

.bg-grid {
  background-image: linear-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.12) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.2), transparent 75%);
  opacity: 0.4;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
  position: relative;
  z-index: 1;
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero {
  padding: 30px;
  display: grid;
  gap: 20px;
  background:
    linear-gradient(135deg, rgba(24, 76, 54, 0.95), rgba(47, 123, 87, 0.88)),
    radial-gradient(circle at top right, rgba(255, 255, 255, 0.18), transparent 45%);
  color: #f8fbf7;
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -30px -100px auto;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(217, 183, 116, 0.42) 0, rgba(217, 183, 116, 0) 68%);
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.76rem;
  opacity: 0.86;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.5rem, 6vw, 4.6rem);
  line-height: 0.95;
}

.hero-text {
  max-width: 640px;
  margin: 12px 0 0;
  line-height: 1.55;
  color: rgba(248, 251, 247, 0.92);
}

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fffdf6;
}

.app-shell {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.dashboard-grid,
.secondary-grid,
.stats-grid {
  display: grid;
  gap: 18px;
}

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

.recap-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

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

.secondary-grid {
  grid-template-columns: 1.15fr 0.85fr;
}

.stat-card,
.leaderboard-panel,
.score-panel,
.recent-panel,
.course-panel,
.loading-panel {
  padding: 24px;
}

.stat-card {
  background: var(--panel-strong);
}

.recap-panel {
  padding: 24px;
}

.stat-label {
  color: var(--muted);
  font-size: 0.86rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-number {
  display: block;
  margin-top: 10px;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.stat-detail {
  margin-top: 8px;
  font-weight: 700;
}

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

.section-head,
.form-head,
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.section-head h2,
.form-head h2,
.panel-head h2 {
  margin: 0;
  font-size: 1.5rem;
}

.metric-toggle,
.auth-toggle {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  background: rgba(24, 33, 27, 0.06);
  border-radius: 999px;
  flex-wrap: wrap;
  justify-content: center;
}

.toggle-btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.toggle-btn:hover,
.toggle-btn:focus-visible {
  background: rgba(24, 33, 27, 0.08);
  color: var(--ink);
  outline: none;
}

.toggle-btn.is-active {
  background: linear-gradient(135deg, var(--fairway), var(--fairway-deep));
  color: #fcfff8;
}

.leaderboard-list,
.round-list,
.tee-list,
.demo-list {
  display: grid;
  gap: 12px;
}

.course-results,
.lookup-panel {
  display: grid;
  gap: 12px;
}

.leaderboard-row,
.round-row,
.tee-card,
.demo-item {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.leaderboard-row {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  min-width: 0;
}

.round-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  min-width: 0;
}

.leaderboard-entry {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.leaderboard-row > * {
  min-width: 0;
}

.round-row > * {
  min-width: 0;
}

.leaderboard-row--interactive {
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.leaderboard-row--interactive:hover,
.leaderboard-row--interactive:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(47, 123, 87, 0.22);
  background: rgba(255, 255, 255, 0.82);
  outline: none;
}

.leaderboard-row--expanded {
  border-color: rgba(47, 123, 87, 0.24);
  background: rgba(255, 255, 255, 0.84);
}

.rank-badge {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: 700;
}

.rank-badge--gold {
  background: linear-gradient(135deg, #c99818, #f7d76c);
  color: #4b3205;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.rank-badge--silver {
  background: linear-gradient(135deg, #8f97a6, #e3e8f0);
  color: #34404f;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.rank-badge--bronze {
  background: linear-gradient(135deg, #9b5b2e, #dca06f);
  color: #fff5ea;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.rank-badge--default {
  background: linear-gradient(135deg, #d9d4c7, #f5f1e8);
  color: #4f564d;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.player-name-line,
.round-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.player-name,
.round-main {
  font-weight: 700;
  font-size: 1.02rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(24, 33, 27, 0.06);
  color: var(--muted);
  font-size: 0.88rem;
}

.tee-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  border: 1px solid rgba(24, 33, 27, 0.15);
}

.metric-box {
  text-align: right;
  min-width: 0;
}

.metric-value {
  font-size: 1.8rem;
  line-height: 1;
}

.metric-label {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.metric-hint {
  margin-top: 6px;
  color: var(--fairway-deep);
  font-size: 0.78rem;
  font-weight: 700;
}

.empty-state {
  padding: 20px;
  border-radius: 18px;
  border: 1px dashed rgba(24, 33, 27, 0.18);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
}

.score-panel {
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.98), rgba(247, 244, 235, 0.92));
}

.score-panel.locked {
  position: relative;
}

.score-panel.locked::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

.profile-strip {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}

.profile-card {
  padding: 16px;
  border-radius: 18px;
  background: rgba(47, 123, 87, 0.08);
  border: 1px solid rgba(47, 123, 87, 0.18);
}

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

.logout-btn,
.ghost-btn,
.primary-btn {
  border: 0;
  border-radius: 999px;
  margin-bottom: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--accent), #e48956);
  color: #fff8f2;
  box-shadow: 0 14px 28px rgba(203, 92, 71, 0.26);
}

.ghost-btn,
.logout-btn {
  background: rgba(24, 33, 27, 0.06);
  color: var(--ink);
}

.primary-btn:hover,
.ghost-btn:hover,
.logout-btn:hover,
.primary-btn:focus-visible,
.ghost-btn:focus-visible,
.logout-btn:focus-visible {
  transform: translateY(-1px);
  outline: none;
}

.primary-btn:disabled,
.ghost-btn:disabled,
.logout-btn:disabled {
  cursor: default;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

.score-form,
.auth-form {
  display: grid;
  gap: 14px;
}

.search-actions,
.status-line,
.pagination-row,
.selection-summary {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

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

.field-grid--handicap {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.field {
  display: grid;
  gap: 8px;
}

.field--compact {
  justify-items: start;
}

.field label {
  font-size: 0.84rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.field input,
.field select {
  width: 100%;
  padding: 14px 14px;
  border-radius: 16px;
  border: 1px solid rgba(24, 33, 27, 0.1);
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(47, 123, 87, 0.18);
  border-color: rgba(47, 123, 87, 0.28);
}

.placeholder-input {
  position: relative;
}

.rotating-placeholder {
  position: absolute;
  top: 50%;
  left: 14px;
  right: 14px;
  transform: translateY(-50%);
  color: rgba(24, 33, 27, 0.46);
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 180ms ease, transform 180ms ease;
}

.rotating-placeholder.is-hidden {
  opacity: 0;
}

.rotating-placeholder.is-fading {
  opacity: 0;
  transform: translateY(calc(-50% - 3px));
}

.placeholder-input input:focus + .rotating-placeholder {
  opacity: 0;
}

.select--compact {
  width: auto;
  min-width: 140px;
  padding: 10px 36px 10px 12px;
  justify-self: start;
}

.preview-row,
.profile-metrics {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.preview-chip,
.profile-metric {
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(24, 33, 27, 0.05);
  border: 1px solid rgba(24, 33, 27, 0.08);
}

.selection-summary {
  margin-top: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(47, 123, 87, 0.18);
  background: rgba(47, 123, 87, 0.08);
}

.selection-title,
.course-result-title {
  font-weight: 700;
}

.course-result {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.7);
  display: grid;
  gap: 6px;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.course-result:hover,
.course-result:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(47, 123, 87, 0.28);
  outline: none;
}

.course-result.is-selected {
  border-color: rgba(47, 123, 87, 0.32);
  background: rgba(47, 123, 87, 0.09);
}

.course-result-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.status-actions {
  margin-top: 12px;
}

.preview-label,
.mini-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.preview-value,
.mini-value {
  display: block;
  margin-top: 6px;
  font-weight: 700;
}

.auth-card {
  display: grid;
  gap: 18px;
}

.auth-copy {
  line-height: 1.5;
}

.demo-item {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.demo-pin {
  font-family: Consolas, "Courier New", monospace;
  font-weight: 700;
}

.round-row {
  gap: 8px;
}

.round-meta,
.round-sub,
.mini-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.round-blurb {
  margin-top: 8px;
  color: var(--ink);
  font-style: italic;
  line-height: 1.45;
}

.leaderboard-detail {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 12px 14px 14px;
  border-radius: 18px;
  border: 1px solid rgba(24, 33, 27, 0.08);
  background: rgba(255, 255, 255, 0.62);
  overflow: hidden;
}

.leaderboard-detail-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 10px;
  min-width: 0;
}

.leaderboard-detail-label {
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.leaderboard-detail-strip {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

.net-round-chip {
  min-width: 76px;
  padding: 9px 10px;
  border-radius: 16px;
  border: 1px solid rgba(24, 33, 27, 0.1);
  background: rgba(255, 253, 248, 0.95);
  display: grid;
  gap: 4px;
  flex: 0 0 auto;
}

.net-round-gross {
  font-family: Georgia, "Palatino Linotype", "Book Antiqua", serif;
  font-size: 1.4rem;
  line-height: 1;
}

.net-round-meta,
.net-round-date {
  color: var(--muted);
  font-size: 0.82rem;
}

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

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

.tee-card {
  background: rgba(255, 255, 255, 0.72);
}

.tee-card.is-selected {
  border-color: rgba(47, 123, 87, 0.32);
  background: rgba(47, 123, 87, 0.09);
}

.tee-name-line {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.tee-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.footnote {
  margin-top: 18px;
  color: var(--muted);
  line-height: 1.55;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  min-width: 220px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(16, 45, 35, 0.92);
  color: #fbfdf9;
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: transform 180ms ease, opacity 180ms ease;
  box-shadow: 0 16px 32px rgba(16, 45, 35, 0.24);
  z-index: 999;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.fade-up {
  animation: fadeUp 500ms ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1024px) {
  .highlight-grid,
  .recap-grid,
  .stats-grid,
  .dashboard-grid,
  .secondary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 20px;
  }

  .hero,
  .stat-card,
  .leaderboard-panel,
  .score-panel,
  .recent-panel,
  .course-panel {
    padding: 20px;
  }

  .field-grid,
  .preview-row,
  .profile-metrics {
    grid-template-columns: 1fr;
  }

  .leaderboard-row {
    grid-template-columns: auto 1fr;
  }

  .metric-box {
    grid-column: 1 / -1;
    text-align: left;
    padding-left: 52px;
  }

  .leaderboard-row {
    grid-template-columns: 34px minmax(0, 1fr) max-content;
    gap: 10px;
  }

  .leaderboard-row .rank-badge {
    width: 34px;
    height: 34px;
    font-size: 1rem;
  }

  .leaderboard-row .pill {
    gap: 6px;
    padding: 4px 8px;
    font-size: 0.78rem;
  }

  .leaderboard-row .mini-meta {
    gap: 6px;
    font-size: 0.82rem;
  }

  .leaderboard-row .metric-box {
    grid-column: auto;
    justify-self: end;
    padding-left: 0;
    text-align: right;
  }

  .leaderboard-row .metric-value {
    font-size: 1.45rem;
  }

  .leaderboard-row .metric-label {
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
  }

  .round-row .metric-box {
    grid-column: auto;
    justify-self: end;
    align-self: start;
    padding-left: 0;
    text-align: right;
  }

  .round-row .metric-value {
    font-size: 1.45rem;
  }

  .round-row .metric-label {
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    white-space: nowrap;
  }

  .course-header,
  .section-head,
  .form-head,
  .panel-head,
  .profile-top,
  .search-actions,
  .status-line,
  .pagination-row,
  .selection-summary {
    align-items: flex-start;
    flex-direction: column;
  }
}
