:root {
  --bg-top: #dfe9f6;
  --bg-bottom: #f3f5f8;
  --panel: rgba(242, 245, 247, 0.94);
  --panel-clear: rgba(243, 248, 255, 0);
  --panel-strong: rgba(242, 245, 247, 0.96);
  --line: rgba(217, 210, 195, 0.62);
  --line-strong: rgba(217, 210, 195, 0.88);
  --ink: #102536;
  --muted: #3b556a;
  --accent: #2f6b57;
  --accent-deep: #204f40;
  --ocean-slate: #1e3e56;
  --ivory-soft: #eaf1f5;
  --mint: #daf5e4;
  --danger: #b03a2e;
  --shadow: 0 24px 60px rgba(16, 37, 54, 0.12);
  --radius: 24px;
  --header-photo: url("./assets/charleston-header.jpg");
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Public Sans", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(7, 20, 33, 0.62), rgba(7, 20, 33, 0.46)),
    var(--header-photo) center / cover fixed no-repeat;
}

.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  display: none;
}

.topbar {
  position: sticky;
  top: 10px;
  z-index: 10;
  width: min(1240px, calc(100vw - 32px));
  margin: 14px auto 0;
  padding: 16px 20px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(9, 24, 39, 0.42);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 16px;
  align-items: center;
}

.brand-mark {
  margin: 0;
  font-family: "Archivo", "Arial Narrow", sans-serif;
  letter-spacing: 0.02em;
  font-size: 1.15rem;
  font-weight: 800;
  color: #f5f9ff;
}

.brand-sub {
  margin: 2px 0 0;
  color: rgba(235, 244, 255, 0.85);
  font-size: 0.84rem;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.top-nav a {
  text-decoration: none;
  color: rgba(236, 244, 255, 0.95);
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 600;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.top-nav a:hover {
  background: rgba(255, 255, 255, 0.17);
  color: #fff;
}

.data-source-chip {
  margin: 0;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #eaf3ff;
  border: 1px solid rgba(255, 255, 255, 0.36);
  border-radius: 999px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.12);
}

.data-source-chip.live {
  color: #e7ffef;
  border-color: rgba(159, 243, 195, 0.8);
  background: rgba(35, 121, 70, 0.34);
}

main {
  width: min(1240px, calc(100vw - 32px));
  margin: 18px auto 48px;
  display: grid;
  gap: 16px;
}

.hero,
.panel {
  border: 0;
  border-radius: var(--radius);
  background: var(--panel-clear);
  backdrop-filter: none;
  box-shadow: var(--shadow);
}

.admin-surface {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}

.hero {
  padding: clamp(20px, 4vw, 38px);
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  align-items: start;
}

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

.eyebrow,
.section-kicker {
  display: inline-block;
  margin: 0 0 10px;
  color: var(--accent-deep);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Archivo", "Arial Narrow", sans-serif;
  letter-spacing: -0.01em;
}

h1 {
  font-size: clamp(1.85rem, 5vw, 3.1rem);
  line-height: 1.02;
  max-width: 16ch;
}

h2 {
  font-size: clamp(1.2rem, 3.2vw, 2rem);
}

h3 {
  font-size: 1rem;
}

.lead {
  margin-top: 12px;
  max-width: 60ch;
  color: var(--muted);
  line-height: 1.55;
}

.hero-metrics {
  display: grid;
  gap: 8px;
  justify-items: start;
  align-content: start;
}

.metric-card {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 8px 10px;
  width: min(210px, 100%);
  min-height: 0;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 0.66rem;
  margin-bottom: 3px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  font-size: 1rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.panel {
  padding: clamp(16px, 3vw, 30px);
}

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

.panel-head-stack {
  align-items: start;
}

.hero .eyebrow,
.hero h1,
.panel .section-kicker,
.panel .panel-head h2 {
  color: var(--ivory-soft);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

.hero .eyebrow,
.panel .section-kicker {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(16, 37, 54, 0.55);
}

.hero .lead {
  color: rgba(234, 241, 245, 0.92);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.segment-group {
  display: inline-flex;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.65);
}

.segment {
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 0.84rem;
  font-weight: 700;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.segment.active {
  background: var(--accent);
  color: #f2f5f7;
}

.toggle-stack {
  display: grid;
  gap: 8px;
}

.inline-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--ivory-soft);
  font-weight: 600;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.inline-select {
  min-width: 180px;
  border-radius: 999px;
  padding: 8px 12px;
}

.table-shell {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(242, 245, 247, 0.94);
  padding: 4px;
}

.th-sort {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
  cursor: pointer;
  padding: 0;
}

.th-sort:hover {
  color: #2a5d85;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: rgba(242, 245, 247, 0.98);
  border-radius: 12px;
  overflow: hidden;
}

thead th {
  background: #dce5ec;
  text-align: left;
  color: var(--ocean-slate);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  white-space: nowrap;
}

tbody tr:hover {
  background: rgba(220, 229, 236, 0.62);
}

.footnote {
  margin: 10px 0 0;
  color: rgba(234, 241, 245, 0.92);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  font-size: 0.82rem;
}

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

.summary-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-strong);
  padding: 12px;
}

.summary-card h3 {
  margin-bottom: 6px;
}

.summary-line {
  color: var(--muted);
  font-size: 0.9rem;
}

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

.game-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel-strong);
  padding: 14px;
  display: grid;
  gap: 10px;
}

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

.game-status {
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 5px 8px;
  border: 1px solid var(--line);
}

.game-status.final {
  background: var(--mint);
  border-color: rgba(57, 163, 112, 0.3);
  color: #0f5d34;
}

.game-status.scheduled {
  background: rgba(47, 107, 87, 0.12);
  border-color: rgba(47, 107, 87, 0.32);
  color: var(--accent-deep);
}

.game-meta {
  color: var(--muted);
  font-size: 0.83rem;
  display: grid;
  gap: 3px;
}

.score-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 0.97rem;
}

.score-line strong {
  font-family: "Archivo", "Arial Narrow", sans-serif;
  font-size: 1.2rem;
}

.admin-panel {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 30;
  background: rgba(9, 21, 32, 0.58);
  padding: 26px 14px;
  overflow-y: auto;
}

.admin-panel.open {
  display: block;
}

.admin-surface {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 18px;
  background: rgba(242, 245, 247, 0.96);
}

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

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1.8fr;
  gap: 12px;
}

.admin-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f2f5f7;
  padding: 14px;
  min-width: 0;
}

.admin-card.wide {
  grid-column: span 1;
}

.admin-card.full {
  grid-column: 1 / -1;
}

.admin-player-game {
  order: 1;
  grid-column: 1 / -1;
}

.admin-schedule {
  order: 2;
  grid-column: 1 / -1;
}

.admin-teams {
  order: 3;
}

.admin-roster {
  order: 4;
}

.admin-copy {
  color: var(--muted);
  margin: 4px 0 10px;
}

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

.grid-form.compact {
  grid-template-columns: 1fr auto;
}

.grid-form.compact .compact-check {
  padding-top: 28px;
}

label {
  display: grid;
  gap: 4px;
  font-size: 0.78rem;
  color: #456079;
  font-weight: 600;
}

label.inline-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 9px 10px;
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.9);
}

.checkbox-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-top: 20px;
  color: #456079;
  font-size: 0.82rem;
}

.compact-check {
  padding-top: 0;
}

.checkbox-control input {
  width: 16px;
  height: 16px;
}

input:focus,
select:focus,
button:focus-visible {
  outline: 2px solid rgba(0, 113, 227, 0.35);
  outline-offset: 1px;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.86rem;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff;
}

.btn-ghost {
  background: rgba(16, 37, 54, 0.08);
  color: var(--ink);
}

.btn-admin {
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.34);
  color: #fff;
}

.admin-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
}

.admin-list li {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.admin-item-copy {
  display: grid;
  gap: 2px;
}

.admin-item-copy small {
  color: var(--muted);
}

.row-actions {
  display: inline-flex;
  gap: 7px;
}

.btn-row {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 5px 8px;
  font-size: 0.74rem;
  font-weight: 700;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.btn-row.danger {
  color: var(--danger);
}

.form-message {
  min-height: 1em;
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 0.84rem;
}

.form-message.success {
  color: #0f5d34;
}

.hidden {
  display: none;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

@media (max-width: 1120px) {
  .topbar {
    grid-template-columns: 1fr;
    gap: 10px;
  }

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

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

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

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

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

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

@media (max-width: 760px) {
  .topbar,
  main {
    width: calc(100vw - 20px);
  }

  .panel,
  .hero {
    border-radius: 18px;
    padding: 14px;
  }

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

  .grid-form,
  .grid-form.compact {
    grid-template-columns: 1fr;
  }

  .top-nav {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .top-nav a {
    white-space: nowrap;
  }

  .admin-surface {
    padding: 14px;
  }
}
