:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-tertiary: #1f2937;
  --bg-card: #111827;
  --bg-row: #0f1623;
  --bg-row-hover: #192234;
  --border-subtle: #374151;
  --border-muted: rgba(55, 65, 81, 0.55);
  --text-main: #f9fafb;
  --text-muted: #9ca3af;
  --text-dim: #7c8594;
  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-orange: #fb923c;
  --accent-purple: #8b5cf6;
  --accent-rose: #f43f5e;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

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

[hidden]:not([hidden="until-found"]) {
  display: none !important;
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 72px;
}

/* Visually hidden utility (accessible to screen readers; reveals skip links on focus) */
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.skip-link:focus {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: var(--accent-blue);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 8px;
  text-decoration: none;
}

:where(a, button, input, select, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--accent-blue);
  outline-offset: 2px;
}

.container {
  max-width: 1440px;
  margin: 0 auto;
  padding-inline: 20px;
}

/* Header */
header {
  background: linear-gradient(180deg, #111827 0%, rgba(10, 14, 23, 0.96) 100%);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
}

.header-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-block: 14px;
}

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

.brand-logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #2563eb 0%, #10b981 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 17px;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  flex-shrink: 0;
}

.brand-text h1 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.brand-text p {
  font-size: 12px;
  color: var(--text-muted);
}

.header-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.control-pair {
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.meta-select {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  border-radius: 8px;
  padding: 6px 10px;
  min-block-size: 34px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
}

.stage-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(59, 130, 246, 0.14);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.35);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 9999px;
}

.stage-pill.stage-early_preview {
  background: rgba(139, 92, 246, 0.16);
  color: #c4b5fd;
  border-color: rgba(139, 92, 246, 0.4);
}

.stage-pill.stage-gameday_inactives {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.35);
}

.updated-text {
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1px solid rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.14);
  color: #34d399;
}

.tier-badge.is-free {
  background: rgba(156, 163, 175, 0.14);
  color: #d1d5db;
  border-color: rgba(156, 163, 175, 0.35);
}

.action-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 6px 12px;
  min-block-size: 34px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.action-btn:hover {
  background: var(--bg-tertiary);
  border-color: var(--text-muted);
}

/* Error Alert Banner */
.error-banner {
  margin-top: 14px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(244, 63, 94, 0.5);
  background: rgba(244, 63, 94, 0.12);
  color: #fecdd3;
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.error-banner[hidden] {
  display: none;
}

/* Single-Row Scrollable Tablist */
.tabs-shell {
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-primary);
}

.tabs-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
  scroll-snap-type: inline proximity;
}

.tab-btn {
  position: relative;
  flex: none;
  scroll-snap-align: start;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 13px 18px;
  min-block-size: 44px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn[aria-selected="true"] {
  color: #60a5fa;
}

.tab-btn[aria-selected="true"]::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  border-block-end: 3px solid var(--accent-blue);
}

.tab-pro-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(139, 92, 246, 0.18);
  color: #c4b5fd;
  border: 1px solid rgba(139, 92, 246, 0.35);
}

/* Zero spacing on tabpanel itself (matches hidden="until-found" requirement) */
.tab-panel {
  margin: 0;
  padding: 0;
  border: 0;
}

.panel-inner {
  padding-top: 18px;
}

/* Preview Notice Banner */
.preview-banner {
  margin-bottom: 14px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(139, 92, 246, 0.35);
  background: rgba(139, 92, 246, 0.12);
  color: #ddd6fe;
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.preview-banner[hidden] {
  display: none;
}

/* Toolbars & Filters */
.toolbar {
  padding-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.pill-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 6px 12px;
  min-block-size: 32px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.pill-btn:hover {
  border-color: var(--text-muted);
  color: var(--text-main);
}

.pill-btn[aria-pressed="true"],
.pill-btn.active {
  background: var(--accent-blue);
  border-color: var(--accent-blue);
  color: #ffffff;
}

.scoring-toggle {
  display: inline-flex;
  background: var(--bg-secondary);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  gap: 2px;
}

.scoring-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 5px 11px;
  min-block-size: 28px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.scoring-btn[aria-pressed="true"],
.scoring-btn.active {
  background: var(--bg-tertiary);
  color: #ffffff;
}

.scoring-static-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  min-block-size: 28px;
  font-size: 12px;
  font-weight: 600;
  color: #d1d5db;
  background: var(--bg-tertiary);
  border-radius: 6px;
}

.check-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  padding: 5px 10px;
  min-block-size: 32px;
  border-radius: 6px;
  cursor: pointer;
}

.check-toggle input {
  accent-color: var(--accent-blue);
  cursor: pointer;
}

.search-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  padding: 6px 12px;
  min-block-size: 34px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  width: 220px;
}

/* Responsive Data Table */
.table-shell {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

.table-wrapper {
  overflow: auto;
  max-inline-size: 100%;
  max-block-size: min(720px, 75vh);
  container-type: inline-size;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  text-align: left;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

thead {
  position: sticky;
  inset-block-start: 0;
  z-index: 3;
}

th[scope="col"] {
  background: #111827;
  color: var(--text-muted);
  padding: 11px 12px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

tbody tr {
  background: var(--bg-row);
}

tbody tr:hover {
  background: var(--bg-row-hover);
}

tbody th[scope="row"] {
  position: sticky;
  inset-inline-start: 0;
  z-index: 1;
  background: inherit;
  font-weight: 400;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-muted);
  border-right: 1px solid var(--border-muted);
  white-space: nowrap;
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-muted);
  white-space: nowrap;
}

.rank-cell {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--text-main);
}

.tier-chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 9999px;
  border: 1px solid transparent;
}

.tier-1 { background: rgba(16, 185, 129, 0.16); color: #34d399; border-color: rgba(16, 185, 129, 0.35); }
.tier-2 { background: rgba(59, 130, 246, 0.16); color: #60a5fa; border-color: rgba(59, 130, 246, 0.35); }
.tier-3 { background: rgba(139, 92, 246, 0.16); color: #a78bfa; border-color: rgba(139, 92, 246, 0.35); }
.tier-4 { background: rgba(245, 158, 11, 0.16); color: #fbbf24; border-color: rgba(245, 158, 11, 0.35); }
.tier-5,
.tier-6,
.tier-7,
.tier-8 { background: rgba(107, 114, 128, 0.2); color: #d1d5db; border-color: rgba(107, 114, 128, 0.35); }

.delta-up { color: #34d399; font-family: var(--font-mono); font-weight: 700; }
.delta-down { color: #fb7185; font-family: var(--font-mono); font-weight: 700; }
.delta-flat { color: var(--text-dim); font-family: var(--font-mono); }

.player-btn {
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-btn:hover .player-name {
  color: #93c5fd;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.player-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.player-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.player-name-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.player-name {
  font-weight: 700;
  font-size: 14px;
  color: #ffffff;
}

.player-sub {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.pos-tag {
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 10px;
}

.pos-QB { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.pos-RB { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.pos-WR { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.pos-TE { background: rgba(139, 92, 246, 0.2); color: #a78bfa; }
.pos-K { background: rgba(236, 72, 153, 0.2); color: #f472b6; }
.pos-DST { background: rgba(107, 114, 128, 0.25); color: #d1d5db; }
.pos-DL { background: rgba(244, 63, 94, 0.2); color: #fda4af; }
.pos-LB { background: rgba(14, 165, 233, 0.2); color: #7dd3fc; }
.pos-DB { background: rgba(20, 184, 166, 0.2); color: #5eead4; }

.status-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  text-transform: uppercase;
}

.status-Q { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.status-D { background: rgba(251, 146, 60, 0.2); color: #fdba74; }
.status-OUT,
.status-IR,
.status-INA,
.status-SUS { background: rgba(244, 63, 94, 0.22); color: #fda4af; }

.lock-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(107, 114, 128, 0.25);
  color: #d1d5db;
}

.points-val {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: #34d399;
}

.stat-val {
  font-family: var(--font-mono);
  color: #e5e7eb;
}

.range-bar-wrap {
  min-width: 126px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.range-bar-track {
  width: 100%;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 9999px;
  position: relative;
}

.range-bar-fill {
  position: absolute;
  height: 100%;
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.45) 0%, rgba(16, 185, 129, 0.7) 100%);
  border-radius: 9999px;
}

.range-bar-pip {
  position: absolute;
  top: -3px;
  width: 3px;
  height: 12px;
  background: #ffffff;
  border-radius: 2px;
  transform: translateX(-50%);
}

.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

/* Container-Responsive Stacked Mobile Cards */
@container (width < 600px) {
  table, thead, tbody, tr, th, td {
    display: block;
  }

  thead {
    display: none;
  }

  tbody tr {
    margin-bottom: 12px;
    border: 1px solid var(--border-subtle);
    border-radius: 10px;
    overflow: hidden;
  }

  tbody th[scope="row"] {
    position: sticky;
    inset-block-start: 0;
    z-index: 2;
    background: var(--bg-secondary);
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
  }

  tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 12px;
    white-space: normal;
  }

  tbody td[data-label]::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
  }
}

/* Pro Gate Card */
.pro-gate-card {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(16, 185, 129, 0.08));
  border: 1px solid rgba(59, 130, 246, 0.35);
  border-radius: 12px;
  padding: 28px;
  text-align: center;
  max-width: 680px;
  margin: 24px auto;
}

.pro-gate-card h2 {
  font-size: 20px;
  margin-bottom: 10px;
}

.pro-gate-card p {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 16px;
}

/* Scoring Studio */
.studio-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
}

@media (max-width: 1024px) {
  .studio-grid {
    grid-template-columns: 1fr;
  }
}

.studio-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
  height: fit-content;
}

.studio-panel h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.preset-btn-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-block: 14px 18px;
}

.slider-row {
  margin-bottom: 14px;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}

.slider-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: #60a5fa;
}

.slider-row input[type="range"] {
  width: 100%;
  accent-color: var(--accent-blue);
  cursor: pointer;
}

/* Toss-Up Comparison */
.tossup-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.tossup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 768px) {
  .tossup-controls,
  .tossup-grid {
    grid-template-columns: 1fr;
  }
}

.tossup-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 20px;
}

.tossup-card.is-recommended {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
}

.horizon-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(74px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.horizon-cell {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  font-size: 12px;
}

/* Methodology & Audit */
.methodology-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 28px;
  line-height: 1.7;
}

.methodology-box h2 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 12px;
}

.methodology-box h3 {
  font-size: 16px;
  font-weight: 700;
  margin: 20px 0 8px;
  color: #93c5fd;
}

.methodology-box p {
  color: #d1d5db;
  margin-bottom: 10px;
}

.compliance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-block: 18px;
}

.compliance-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  padding: 14px;
  border-radius: 8px;
  text-align: center;
}

.compliance-item .val {
  font-size: 22px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #34d399;
}

.compliance-item .lbl {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Native Player Detail Dialog */
dialog.player-dialog {
  margin: auto;
  max-width: 640px;
  width: calc(100% - 24px);
  background: var(--bg-secondary);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

dialog.player-dialog::backdrop {
  background: rgba(5, 8, 15, 0.75);
  backdrop-filter: blur(4px);
}

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

.dialog-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-block: 14px;
}

.dialog-metric-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px;
}

.dialog-metric-box .dm-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
}

.dialog-metric-box .dm-val {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  margin-top: 2px;
}

/* Footer */
footer {
  max-width: 1440px;
  margin: 48px auto 0;
  padding: 18px 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  border-top: 1px solid var(--border-subtle);
}

@media (pointer: coarse) {
  .pill-btn,
  .scoring-btn,
  .tab-btn,
  .action-btn,
  .meta-select {
    min-block-size: 44px;
  }
}
