:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-hover: #243044;
  --border: #2d3a4d;
  --text: #e6edf3;
  --text-muted: #8b9eb5;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --radius: 8px;
  --font-sans: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 11;
}

.header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: none;
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  margin: 8px 12px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  color: var(--text);
  transition: background 0.15s;
}
.menu-toggle:hover {
  background: var(--surface-hover);
}
.menu-toggle[aria-expanded="true"] {
  background: var(--surface-hover);
}
.menu-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(2) {
  opacity: 0;
}
.menu-toggle[aria-expanded="true"] .menu-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.mobile-menu-wrap {
  position: relative;
}

.mobile-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  width: min(280px, 85vw);
  max-height: 70vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 1000;
}
.mobile-menu.is-open {
  display: block;
}
.mobile-menu[hidden] {
  display: none !important;
}

.mobile-menu-list {
  list-style: none;
  margin: 0;
  padding: 24px 0 32px;
}
.mobile-menu-list > li {
  margin: 0;
  border-bottom: 1px solid var(--border);
}
.mobile-menu-list > li:last-child {
  border-bottom: none;
}

.mobile-menu-item {
  display: block;
  width: 100%;
  padding: 16px 24px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: none;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.mobile-menu-item:hover,
.mobile-menu-item:focus {
  background: var(--surface-hover);
  outline: none;
}

.mobile-menu-label {
  display: block;
  padding: 14px 24px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.mobile-menu-sublist {
  list-style: none;
  margin: 0 0 8px;
  padding: 0;
}
.mobile-menu-sublist .mobile-menu-item {
  padding: 12px 24px 12px 32px;
  font-size: 0.9375rem;
  color: var(--text-muted);
}
.mobile-menu-sublist .mobile-menu-item:hover,
.mobile-menu-sublist .mobile-menu-item:focus {
  color: var(--text);
}

.logo {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: 999px;
  overflow: hidden;
}

.logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: none;
  mix-blend-mode: normal;
}

.site-title {
  margin: 0;
  font-size: 28px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 10;
  overflow: visible;
}

.tab {
  padding: 10px 18px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.tab:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.tab.active {
  color: var(--text);
  background: var(--surface-hover);
  color: var(--accent);
}

.tab-dropdown-wrap {
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  position: relative;
  z-index: 1;
}
.tab-dropdown-wrap.is-open {
  z-index: 100;
}

.tab-dropdown-wrap.active .tab-dropdown-trigger {
  color: var(--accent);
}

.tab-dropdown-trigger {
  padding: 10px 14px 10px 18px;
  min-width: 120px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  background-color: var(--surface);
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
}
.tab-dropdown-trigger:hover {
  color: var(--text);
  background-color: var(--surface-hover);
}
.tab-dropdown-trigger:focus {
  outline: none;
  color: var(--text);
  background-color: var(--surface-hover);
}

.tab-dropdown-panel {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 2px;
  min-width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 200;
  padding: 4px 0;
}
.tab-dropdown-panel[hidden] {
  display: none !important;
}

.tab-dropdown-option {
  display: block;
  width: 100%;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text);
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
  text-align: left;
  -webkit-appearance: none;
  appearance: none;
}
.tab-dropdown-option:hover,
.tab-dropdown-option:focus {
  background: var(--surface-hover);
  outline: none;
}

.section-season {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 16px;
}

.section-season-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.section-season-select {
  padding: 8px 12px;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 100px;
  cursor: pointer;
}

.section-season-select:focus {
  outline: none;
  border-color: var(--accent);
}

.main {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* Schedule stretches full viewport width */
.content-card--schedule {
  max-width: none;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-left: 24px;
  padding-right: 24px;
  box-sizing: border-box;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.content-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 32px;
}

.content-card h2 {
  margin: 0 0 16px;
  font-size: 1.375rem;
  font-weight: 600;
}

.content-card p {
  margin: 0 0 12px;
  color: var(--text-muted);
}

.content-card p:last-of-type {
  margin-bottom: 0;
}

.content-card ul {
  margin: 12px 0;
  padding-left: 1.25rem;
  color: var(--text-muted);
}

.content-card li {
  margin-bottom: 8px;
}

.form-card .score-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-row label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.form-row input,
.form-row select {
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 320px;
}

.form-row input::placeholder {
  color: var(--text-muted);
}

.form-row input:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

.form-hint {
  font-size: 0.875rem;
  margin: -4px 0 0 !important;
}

.inline-group {
  max-width: 160px;
}

.form-row-indent {
  padding-left: 1rem;
  margin-top: -6px;
}

.form-row-indent .form-row-indent {
  padding-left: 0;
}

.player-section {
  max-width: 100%;
}

.player-fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 0;
}

.player-fieldset legend {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  padding: 0 8px;
}

.radio-group {
  margin-top: 12px;
}

.radio-group:first-of-type {
  margin-top: 0;
}

.radio-group-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.player-radios {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.player-radio-label {
  display: inline-flex;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.player-radio-label input {
  margin: 0 6px 0 0;
  width: auto;
  max-width: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.btn {
  padding: 12px 20px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary {
  color: #fff;
  background: var(--accent);
  max-width: 200px;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.standings-intro {
  margin-bottom: 20px !important;
}

.standings-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
}

.standings-tab {
  padding: 10px 18px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.standings-tab:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.standings-tab.active {
  color: var(--accent);
  background: var(--surface-hover);
  border-color: var(--accent);
}

.standings-panel {
  display: none;
}

.standings-panel.active {
  display: block;
}

.standings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.standings-table th,
.standings-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.standings-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.standings-table tbody tr:hover {
  background: var(--surface-hover);
}

.schedule-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
}

.schedule-tab {
  padding: 10px 18px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.schedule-tab:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.schedule-tab.active {
  color: var(--accent);
  background: var(--surface-hover);
  border-color: var(--accent);
}

.box-league {
  margin-top: 8px;
}

.box-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 12px;
}

.box-tab {
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.box-tab:hover {
  color: var(--text);
  background: var(--surface-hover);
}

.box-tab.active {
  color: var(--accent);
  background: var(--surface-hover);
  border-color: var(--accent);
}

.box-totals-row td {
  border-top: 2px solid var(--border);
}

.schedule-panel {
  display: none;
}

.schedule-panel.active {
  display: block;
}

.table-scroll {
  overflow-x: auto;
  margin: 0 -2px;
}

.schedule-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.schedule-table th,
.schedule-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.schedule-table th {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.schedule-table td {
  white-space: normal;
  max-width: 140px;
}

.schedule-table tbody tr:hover {
  background: var(--surface-hover);
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.9375rem;
  padding: 24px 0;
}

/* Wall of Fame */
.content-card--fame {
  max-width: 720px;
}

.content-card--fame h2 {
  margin-top: 0;
  margin-bottom: 24px;
}

.fame-section {
  margin-bottom: 40px;
}

.fame-section:last-child {
  margin-bottom: 0;
}

.fame-section h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.fame-figure {
  margin: 0 0 16px;
}

.fame-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.fame-caption {
  margin: 8px 0 0;
  font-size: 0.875rem;
  color: var(--text-muted);
  font-style: italic;
}

.fame-teams {
  font-size: 0.9375rem;
  line-height: 1.6;
}

.fame-teams p {
  margin: 0 0 8px;
}

.fame-teams p:last-child {
  margin-bottom: 0;
}

/* Rules */
.rules-dropdown-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}

.rules-content {
  margin-top: 8px;
}

.rules-content h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 1.25em 0 0.5em;
  color: var(--text);
}

.rules-content h3:first-of-type {
  margin-top: 0;
}

.rules-content ul {
  margin: 0 0 1em;
  padding-left: 1.25em;
}

.rules-content li {
  margin-bottom: 0.35em;
}

.rules-source {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 1em;
}

.rules-source a {
  color: var(--accent);
}

.rules-source a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }
  .tabs {
    display: none;
  }
}

@media (max-width: 640px) {
  .header {
    padding: 12px 16px;
  }
  .top-bar .header {
    padding: 12px 16px 12px 24px;
  }
  .tabs {
    padding: 10px 16px;
  }
  .tab {
    padding: 8px 14px;
    font-size: 0.875rem;
  }
  .main {
    padding: 20px 16px;
  }
  .content-card {
    padding: 20px 20px;
  }
  .form-row input,
  .form-row select {
    max-width: none;
  }
  .mobile-menu {
    width: min(280px, 92vw);
  }
}

body.menu-open {
  overflow: hidden;
}
