:root {
  color-scheme: light;
  --ink: #17211c;
  --muted: #657068;
  --line: #dce4dd;
  --surface: #ffffff;
  --soft: #f4f7f2;
  --field: #0e6b4e;
  --field-dark: #0a4939;
  --gold: #d7a84f;
  --sky: #dbeaf0;
  --danger: #af3f32;
  --shadow: 0 18px 50px rgba(18, 35, 28, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: linear-gradient(180deg, var(--sky) 0, var(--soft) 280px, #eef3ee 100%);
}

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

button {
  border: 0;
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px;
  color: #eef7f1;
  background: linear-gradient(180deg, var(--field-dark), #12362f);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 8px;
  color: #13241e;
  background: var(--gold);
  font-weight: 800;
}

.brand h1,
.brand p,
.section-heading h3,
.section-heading p,
.topbar h2,
.topbar p {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.1;
}

.brand p {
  margin-top: 4px;
  color: rgba(238, 247, 241, 0.72);
  font-size: 13px;
}

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

.tab-button,
.ghost-button {
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  color: rgba(238, 247, 241, 0.82);
  background: transparent;
  text-align: left;
}

.tab-button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
}

.tab-button span {
  width: 22px;
  color: var(--gold);
  text-align: center;
}

.tab-button.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.event-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

label {
  color: inherit;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.event-card input,
.event-card select,
.input-row input,
.filter-row input,
.filter-row select,
.score-input,
.status-select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.event-card input,
.event-card select {
  min-height: 38px;
  padding: 0 10px;
}

.event-row {
  display: grid;
  grid-template-columns: 1fr 78px;
  align-items: center;
  gap: 12px;
}

.ghost-button {
  margin-top: auto;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

main {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 38%);
  align-items: stretch;
  gap: 20px;
  margin-bottom: 22px;
}

.tournament-title {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.major-logo {
  width: 92px;
  height: 92px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(18, 35, 28, 0.1);
}

.eyebrow {
  color: var(--field);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar h2 {
  margin-top: 6px;
  font-size: clamp(30px, 5vw, 54px);
  line-height: 0.98;
}

.save-status {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.save-status.saving {
  color: var(--field);
}

.save-status.error {
  color: var(--danger);
}

.hero-strip {
  min-height: 136px;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(14, 107, 78, 0.18), rgba(215, 168, 79, 0.12)),
    url("https://images.unsplash.com/photo-1535131749006-b7f58c99034b?auto=format&fit=crop&w=900&q=80")
      center / cover;
  box-shadow: var(--shadow);
}

.panel {
  display: none;
}

.active-panel {
  display: block;
}

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

.section-heading h3 {
  font-size: 22px;
}

.section-heading p {
  margin-top: 4px;
  color: var(--muted);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 18px;
}

.work-surface,
.table-wrap,
.leaderboard {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: var(--shadow);
}

.work-surface {
  padding: 16px;
}

.input-row,
.filter-row {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.input-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.filter-row {
  grid-template-columns: minmax(0, 1fr) 118px;
}

.input-row input,
.filter-row input,
.filter-row select {
  min-height: 42px;
  padding: 0 12px;
}

.input-row button,
.secondary-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  color: #fff;
  background: var(--field);
  font-weight: 800;
}

.secondary-button {
  color: var(--field-dark);
  background: #e3eadf;
}

.teams-grid,
.golfer-list,
.leaderboard {
  display: grid;
  gap: 10px;
}

.team-card,
.golfer-card,
.standing-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.team-card {
  padding: 12px;
}

.team-card.current {
  border-color: var(--gold);
  box-shadow: inset 4px 0 0 var(--gold);
}

.card-head,
.golfer-card,
.standing-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-head strong,
.golfer-meta strong {
  display: block;
}

.card-head span,
.golfer-meta span,
.standing-card span,
.empty {
  color: var(--muted);
  font-size: 13px;
}

.team-roster {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.team-roster li,
.status-pill {
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--field-dark);
  background: #eaf0e7;
  font-size: 12px;
  font-weight: 800;
}

.golfer-card {
  padding: 10px 12px;
}

.pick-button,
.icon-button {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fff;
  background: var(--field);
  font-weight: 900;
}

.pick-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

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

table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.score-input {
  max-width: 72px;
  min-height: 34px;
  padding: 0 8px;
}

.status-select {
  min-width: 104px;
  min-height: 34px;
  padding: 0 8px;
}

.leaderboard {
  padding: 14px;
}

.standing-card {
  padding: 14px;
}

.rank {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  color: var(--field-dark);
  background: var(--gold);
  font-weight: 900;
}

.standing-main {
  flex: 1;
  min-width: 0;
}

.standing-main strong {
  display: block;
  overflow-wrap: anywhere;
}

.standing-score {
  color: var(--field-dark);
  font-size: 26px;
  font-weight: 900;
}

.standing-card {
  padding: 12px;
}

.standing-head {
  width: 100%;
  cursor: pointer;
  list-style: none;
}

.standing-head::-webkit-details-marker {
  display: none;
}

.standing-head::after {
  content: "+";
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--field-dark);
  font-weight: 900;
}

.standing-card[open] .standing-head::after {
  content: "−";
}

.standing-breakdown {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.standing-breakdown-major {
  display: grid;
  gap: 6px;
}

.standing-breakdown-major > div,
.standing-breakdown-major li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.standing-breakdown-major > div span {
  color: var(--muted);
  white-space: nowrap;
}

.standing-breakdown-major ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.standing-breakdown-major li {
  min-height: 28px;
  padding: 4px 0;
  border-top: 1px solid rgba(20, 48, 39, 0.08);
}

.breakdown-player {
  min-width: 0;
  overflow-wrap: anywhere;
}

.breakdown-stat {
  display: grid;
  grid-template-columns: repeat(3, minmax(72px, max-content));
  gap: 6px;
  align-items: center;
  color: var(--muted);
  white-space: nowrap;
}

.breakdown-stat span {
  display: inline-flex;
  justify-content: space-between;
  gap: 6px;
  min-width: 72px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7faf6;
}

.breakdown-stat strong {
  color: var(--field-dark);
}

dialog {
  width: min(720px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
}

dialog::backdrop {
  background: rgba(12, 25, 20, 0.52);
}

dialog form {
  padding: 16px;
}

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

.dialog-head h3 {
  margin: 0;
}

textarea {
  width: 100%;
  min-height: 320px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

@media (max-width: 880px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    gap: 16px;
  }

  .tabs {
    grid-template-columns: repeat(3, 1fr);
  }

  .tab-button {
    justify-content: center;
  }

  .ghost-button {
    margin-top: 0;
  }

  .topbar,
  .split-layout {
    grid-template-columns: 1fr;
  }

  .tournament-title {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 14px;
  }

  .major-logo {
    width: 72px;
    height: 72px;
    padding: 10px;
  }
}

@media (max-width: 560px) {
  main,
  .sidebar {
    padding: 16px;
  }

  .section-heading,
  .standing-head {
    align-items: stretch;
    flex-direction: column;
  }

  .standing-head::after {
    width: 100%;
    flex-basis: 28px;
  }

  .standing-breakdown-major li {
    align-items: stretch;
    flex-direction: column;
  }

  .breakdown-stat {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    white-space: normal;
  }

  .input-row,
  .filter-row {
    grid-template-columns: 1fr;
  }

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