/*
  B-STATS — MODERN MINIMALIST
  Aesthetic: Sports intelligence dossier. Data as document.
  Palette:   Warm off-white + ink black + dim slate. One dark accent panel.
  Type:      Space Grotesk (display) + Outfit (data) + JetBrains Mono (labels)
  Rule:      Every element earns its space. Function IS the form.
*/

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&family=Outfit:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@300;400;500;600;700;800&display=swap');

/* ─── Tokens ──────────────────────────────────────────── */
:root {
  --bg: #F5F4F0;
  --bg-secondary: #EDECE8;
  --surface: #FFFFFF;
  --surface-hover: #F0EFEb;
  --border: rgba(0, 0, 0, 0.08);
  --border-mid: rgba(0, 0, 0, 0.15);
  --border-strong: rgba(0, 0, 0, 0.35);

  --text-primary: #0C0C0C;
  --text-secondary: #666666;
  --text-dim: #AAAAAA;

  --ink: #0C0C0C;
  --accent: #0C0C0C;

  --sidebar-w: 188px;

  --font-display: 'Space Grotesk', sans-serif;
  --font-data: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dark mode */
:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-secondary: #111111;
  --surface: #161616;
  --surface-hover: #1e1e1e;
  --border: rgba(255, 255, 255, 0.08);
  --border-mid: rgba(255, 255, 255, 0.14);
  --border-strong: rgba(255, 255, 255, 0.32);

  --text-primary: #F0F0F0;
  --text-secondary: #888888;
  --text-dim: #444444;
  --ink: #F0F0F0;
  --accent: #F0F0F0;
}

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

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ─── Base ────────────────────────────────────────────── */
body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr;
  overflow: hidden;
}

/* remove decorative layers */
.surface-depth-layer,
.ambient-bg,
.ambient-noise,
.scanline-overlay {
  display: none;
}

:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* ─── Sidebar ─────────────────────────────────────────── */
.sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-mid);
  background: var(--surface);
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-brand {
  padding: 24px 20px 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-primary);
  display: block;
  line-height: 1;
}

.sidebar-brand-sub {
  font-family: var(--font-mono);
  font-size: 0.52rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
  display: block;
  margin-top: 4px;
}

/* Sidebar selectors (player / season) */
.sidebar-selectors {
  padding: 16px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* Must be visible so absolutley-positioned menus can escape */
  overflow: visible;
}

.profile-container {
  position: relative;
  width: 100%;
  z-index: 50;
}

/* Boost z-index on whichever container has an open menu */
.profile-container:has(.profile-menu:not([hidden])) {
  z-index: 200;
}

.profile-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid var(--border-mid);
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  width: 100%;
  border-radius: 0;
  text-align: left;
}

.profile-trigger:hover {
  background: var(--bg);
  border-color: var(--border-strong);
}

.profile-label {
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.55rem;
  white-space: nowrap;
}

.profile-active-name {
  flex: 1;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.chevron-icon {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: transform 0.3s var(--ease-out);
  flex-shrink: 0;
  color: var(--text-dim);
}

.profile-trigger[aria-expanded="true"] .chevron-icon {
  transform: rotate(180deg);
}

.profile-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
  transition: opacity 0.2s var(--ease-out), transform 0.2s var(--ease-out);
  z-index: 100;
}

.profile-menu:not([hidden]) {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.profile-menu-scroll {
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--text-dim) transparent;
}

.profile-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-bottom: 1px solid var(--border);
}

.profile-item:hover,
.profile-item:focus-within {
  background: var(--bg);
  color: var(--text-primary);
}

.profile-item.is-active {
  color: var(--text-primary);
  font-weight: 600;
}

.profile-item-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-profile-action {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 3px;
  display: grid;
  place-items: center;
  transition: color 0.2s;
  opacity: 0;
}

.profile-item:hover .btn-profile-action,
.profile-item:focus-within .btn-profile-action {
  opacity: 1;
}

.btn-profile-action:hover {
  color: var(--text-primary);
}

.btn-profile-action svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

.profile-menu-actions {
  padding: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.btn-new-profile {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  letter-spacing: 0.04em;
}

.btn-new-profile:hover {
  background: var(--bg);
  color: var(--text-primary);
  border-color: var(--border-mid);
}

.btn-new-profile svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* Sidebar Nav */
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  font-family: var(--font-data);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: default;
  border-left: 2px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  user-select: none;
  letter-spacing: 0.01em;
}

.sidebar-nav-item.is-active {
  color: var(--text-primary);
  border-left-color: var(--text-primary);
  background: var(--bg);
}

.sidebar-nav-item:hover:not(.is-active) {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.sidebar-nav-item svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  flex-shrink: 0;
}

/* Sidebar bottom utilities */
.sidebar-bottom {
  padding: 16px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* Archetype section in sidebar */
.sidebar-archetypes {
  padding: 12px;
  border-top: 1px solid var(--border);
}

.archetype-label {
  font-family: var(--font-mono);
  font-size: 0.52rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 8px;
  display: block;
}

.archetype-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.archetype-card {
  position: relative;
}

.archetype-card input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.archetype-card label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 5px 3px 4px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: transparent;
  transition: border-color 0.2s, background 0.2s;
  text-align: center;
  user-select: none;
}

.archetype-card label:hover {
  background: var(--bg);
  border-color: var(--border-mid);
}

.archetype-card input[type="checkbox"]:checked+label {
  border-color: var(--border-strong);
  background: var(--bg);
}

.archetype-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  transition: color 0.2s;
}

.archetype-icon svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.archetype-card label:hover .archetype-icon,
.archetype-card input[type="checkbox"]:checked+label .archetype-icon {
  color: var(--text-primary);
}

.archetype-name {
  font-family: var(--font-mono);
  font-size: 0.48rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  line-height: 1.2;
}

.archetype-card input[type="checkbox"]:checked+label .archetype-name {
  color: var(--text-primary);
}

.archetype-tag {
  font-family: var(--font-mono);
  font-size: 0.42rem;
  color: var(--text-dim);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ─── Theme Toggle ────────────────────────────────────── */
.theme-toggle-container {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-theme {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  opacity: 0;
  position: relative;
}

.btn-theme:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg);
}

.btn-theme svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  position: absolute;
  transition: opacity 0.3s, transform 0.3s var(--ease-out);
}

.btn-theme .icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

.btn-theme .icon-moon {
  opacity: 1;
  transform: scale(1);
}

:root[data-theme="light"] .btn-theme .icon-sun {
  opacity: 1;
  transform: scale(1);
}

:root[data-theme="light"] .btn-theme .icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

:root[data-theme="dark"] .btn-theme .icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

:root[data-theme="dark"] .btn-theme .icon-moon {
  opacity: 1;
  transform: scale(1);
}

/* ─── Main Layout ─────────────────────────────────────── */
.layout-main {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}

/* ─── Top Bar (inside main) ───────────────────────────── */
.top-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 32px;
  height: 52px;
  border-bottom: 1px solid var(--border-mid);
  background: var(--surface);
  flex-shrink: 0;
}

.top-bar-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.top-bar-tabs {
  display: flex;
  align-items: center;
  gap: 0;
  margin-left: 4px;
}

.top-bar-tab {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 0 16px;
  height: 52px;
  display: flex;
  align-items: center;
  border-bottom: 2px solid transparent;
  cursor: default;
  transition: color 0.2s, border-color 0.2s;
}

.top-bar-tab.is-active {
  color: var(--text-primary);
  border-bottom-color: var(--text-primary);
}

.top-bar-spacer {
  flex: 1;
}

/* ─── Header = editorial hero ─────────────────────────── */
.editorial-header {
  padding: 28px 32px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  opacity: 0;
  /* JS reveals */
}

.header-command {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.header-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 0.9;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--text-primary);
  margin: 0 0 12px;
}

.header-meta {
  font-family: var(--font-data);
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 400;
  max-width: 440px;
  line-height: 1.5;
  margin: 0;
}

/* ─── HUD Dashboard Cluster ───────────────────────────── */
.hud-dashboard-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

/* Stat Cards */
.player-bio-container,
.career-highs-container,
.career-totals-container {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  padding: 14px 18px 14px;
  display: flex;
  flex-wrap: wrap;
  row-gap: 10px;
  column-gap: 20px;
  align-items: flex-end;
  transition: border-color 0.2s;
  flex: 1 1 220px;
}

.player-bio-container:hover,
.career-highs-container:hover,
.career-totals-container:hover {
  border-color: var(--border-strong);
}

.career-totals-container {
  flex: 1 1 100%;
}

.container-badge {
  position: absolute;
  top: 0;
  left: 0;
  background: var(--text-primary);
  color: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.48rem;
  font-weight: 600;
  padding: 3px 8px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  z-index: 10;
}

.container-badge--totals {
  background: var(--text-secondary);
  color: var(--bg);
}

/* HUD Items */
.bio-item,
.high-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  position: relative;
}

.bio-item:not(:first-child)::before,
.high-item:not(:first-child)::before {
  content: '';
  position: absolute;
  left: -11px;
  top: 50%;
  transform: translateY(-50%);
  height: 20px;
  width: 1px;
  background: var(--border-mid);
}

.bio-label,
.high-label {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  letter-spacing: 0.25em;
  color: var(--text-dim);
  text-transform: uppercase;
  white-space: nowrap;
}

.bio-value,
.high-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.4rem, 2.2vw, 2rem);
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1;
}

.bio-value {
  cursor: pointer;
  padding: 0 2px;
  margin-left: -2px;
  display: inline-block;
  min-height: 1.2rem;
  transition: color 0.2s;
}

.bio-value:hover,
.bio-value:focus-visible {
  color: var(--text-secondary);
  outline: none;
}

/* Total Items */
.total-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  position: relative;
}

.total-item:not(:first-child)::before {
  content: '';
  position: absolute;
  left: -11px;
  top: 50%;
  transform: translateY(-50%);
  height: 20px;
  width: 1px;
  background: var(--border-mid);
}

.total-label {
  font-family: var(--font-mono);
  font-size: 0.5rem;
  letter-spacing: 0.25em;
  color: var(--text-dim);
  text-transform: uppercase;
  white-space: nowrap;
}

.total-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 2.4vw, 2.2rem);
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1;
}

/* ─── Data Container ──────────────────────────────────── */
.data-container {
  position: relative;
  background: var(--surface);
  border-top: 1px solid var(--border-mid);
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  opacity: 0;
  /* JS reveals */
  min-height: 0;
}

.scroll-context {
  width: 100%;
  overflow-x: auto;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--text-dim) transparent;
  flex: 1;
  min-height: 0;
}

.scroll-context::-webkit-scrollbar {
  height: 3px;
  width: 3px;
}

.scroll-context::-webkit-scrollbar-track {
  background: transparent;
}

.scroll-context::-webkit-scrollbar-thumb {
  background: var(--border-mid);
}

/* ─── Stats Table ─────────────────────────────────────── */
.stats-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-variant-numeric: tabular-nums;
}

.stats-grid th,
.stats-grid td {
  padding: 7px 12px;
  text-align: right;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  height: 34px;
  position: relative;
}

.stats-grid th:first-child,
.stats-grid td:first-child {
  text-align: center;
  width: 68px;
  min-width: 68px;
  position: sticky;
  left: 0;
  z-index: 10;
}

.stats-grid th {
  font-family: var(--font-mono);
  font-size: 0.52rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-dim);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
  cursor: pointer;
  user-select: none;
  transition: color 0.2s;
  border-bottom: 1px solid var(--border-mid);
  border-right: 1px solid var(--border);
}

.stats-grid th:last-child {
  border-right: none;
}

.stats-grid th:first-child {
  z-index: 30;
  cursor: default;
}

.stats-grid th:hover,
.stats-grid th:focus-visible {
  color: var(--text-primary);
}

.stats-grid th:first-child:hover {
  color: var(--text-dim);
}

th[aria-sort] {
  color: var(--text-primary);
}

.sort-indicator {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-left: 4px;
  opacity: 0;
  transition: transform 0.3s var(--ease-out), opacity 0.2s;
  vertical-align: middle;
}

.sort-indicator svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

th[aria-sort="ascending"] .sort-indicator {
  opacity: 1;
  transform: rotate(180deg);
}

th[aria-sort="descending"] .sort-indicator {
  opacity: 1;
  transform: rotate(0deg);
}

.stats-grid tbody tr {
  transition: background-color 0.15s;
}

.stats-grid tbody tr:nth-child(even) {
  background-color: rgba(0, 0, 0, 0.02);
}

:root[data-theme="dark"] .stats-grid tbody tr:nth-child(even) {
  background-color: rgba(255, 255, 255, 0.012);
}

.stats-grid tbody tr:is(:hover, :focus-within) {
  background-color: var(--surface-hover);
}

.stats-grid td:first-child {
  background: var(--bg);
  color: var(--text-dim);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  border-right: 1px solid var(--border);
  font-family: var(--font-mono);
  transition: background 0.15s;
}

.stats-grid tbody tr:is(:hover, :focus-within) td:first-child {
  background: var(--surface-hover);
}

.cell-interactive {
  cursor: pointer;
  transition: color 0.15s;
}

.cell-interactive:hover {
  color: var(--text-secondary);
}

.cell-computed {
  color: var(--text-dim);
}

.input-edit {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--text-primary);
  color: var(--text-primary);
  font-family: inherit;
  font-size: inherit;
  text-align: right;
  padding: 0 0 2px;
  outline: none;
  caret-color: var(--text-primary);
}

.action-context {
  position: absolute;
  left: 6px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity 0.15s;
  display: flex;
}

.stats-grid tbody tr:hover .action-context,
.stats-grid tbody tr:focus-within .action-context {
  opacity: 1;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 3px;
  display: grid;
  place-items: center;
  transition: color 0.15s;
}

.btn-icon:hover {
  color: var(--text-primary);
}

.btn-icon svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* Footer */
.stats-grid tfoot {
  position: relative;
  z-index: 15;
}

.stats-grid tfoot td {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-mid);
  border-bottom: none;
  font-weight: 600;
  color: var(--text-primary);
  padding: 12px 12px;
  position: sticky;
  bottom: 0;
  letter-spacing: 0.02em;
  font-family: var(--font-data);
  font-weight: 500;
  font-size: 0.85rem;
}

.stats-grid tfoot td:first-child {
  background: var(--bg-secondary);
  z-index: 30;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.52rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ─── Empty State ─────────────────────────────────────── */
.empty-state {
  position: absolute;
  inset: 0;
  top: 34px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
  background: var(--surface);
  z-index: 5;
}

.empty-state.is-active {
  opacity: 1;
  pointer-events: auto;
}

.calibration-grid {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 160px;
  height: 160px;
  border: 1px solid var(--border-mid);
  display: flex;
  align-items: center;
  justify-content: center;
}

.calibration-grid::before {
  content: '';
  position: absolute;
  inset: 20%;
  border: 1px solid var(--border);
}

.radar-sweep {
  display: none;
}

.crosshair-h {
  position: absolute;
  width: 140%;
  height: 1px;
  background: var(--border);
}

.crosshair-v {
  position: absolute;
  height: 140%;
  width: 1px;
  background: var(--border);
}

.target-bracket {
  position: absolute;
  width: 8px;
  height: 8px;
  border: 1px solid var(--border-mid);
}

.tb-tl {
  top: -4px;
  left: -4px;
  border-right: none;
  border-bottom: none;
}

.tb-tr {
  top: -4px;
  right: -4px;
  border-left: none;
  border-bottom: none;
}

.tb-bl {
  bottom: -4px;
  left: -4px;
  border-right: none;
  border-top: none;
}

.tb-br {
  bottom: -4px;
  right: -4px;
  border-left: none;
  border-top: none;
}

.empty-text-wrap {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 14px 24px;
  border: 1px solid var(--border-mid);
  background: var(--bg);
}

.empty-message {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin: 0 0 4px;
}

.empty-hint {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  margin: 0;
  text-transform: uppercase;
}

/* ─── FAB / Action Panel ──────────────────────────────── */
.fab-container {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  background: var(--surface);
  padding: 10px 20px;
  border-top: 1px solid var(--border-mid);
  width: 100%;
  flex-shrink: 0;
}

.fab-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  transition: opacity 0.3s var(--ease-out), transform 0.3s var(--ease-out);
  transform-origin: right center;
}

.fab-container.is-collapsed .fab-actions {
  opacity: 0;
  pointer-events: none;
  transform: translateX(8px);
  position: absolute;
  right: 62px;
  visibility: hidden;
}

.btn-fab-mini {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-dim);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  opacity: 0;
  z-index: 2;
}

.btn-fab-mini:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg);
}

.btn-fab-mini svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: transform 0.4s var(--ease-out);
}

.fab-container.is-collapsed .btn-fab-mini svg.icon-collapse {
  transform: rotate(180deg);
}

.btn-fab {
  height: 36px;
  padding: 0 18px;
  background: var(--text-primary);
  color: var(--bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 500;
  transition: opacity 0.2s, transform 0.2s var(--ease-out);
  opacity: 0;
}

.btn-fab:hover {
  opacity: 0.8;
  transform: translateY(-1px);
}

.btn-fab:active {
  transform: scale(0.97);
}

.fab-actions:has(.btn-fab:hover) .btn-fab:not(:hover) {
  opacity: 0.3;
}

.btn-fab svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
}

/* ─── Skeleton ────────────────────────────────────────── */
.skeleton-row td span {
  display: block;
  height: 10px;
  background: linear-gradient(90deg, var(--bg) 0%, var(--surface-hover) 50%, var(--bg) 100%);
  background-size: 200% 100%;
  opacity: 0.6;
  animation: skeleton-shimmer 1.6s ease-in-out infinite;
}

@keyframes skeleton-shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ─── Modal ───────────────────────────────────────────── */
.modal-dialog {
  padding: 0;
  border: 1px solid var(--border-mid);
  background: var(--surface);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
  color: var(--text-primary);
  max-width: 400px;
  width: 90vw;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out);
  margin: auto;
  border-radius: 0;
}

:root[data-theme="dark"] .modal-dialog {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.modal-dialog[open] {
  opacity: 1;
  transform: translateY(0);
}

.modal-dialog::backdrop {
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.25s;
}

:root[data-theme="dark"] .modal-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.modal-dialog[open]::backdrop {
  opacity: 1;
}

.modal-content {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  color: var(--text-primary);
  line-height: 0.92;
}

.modal-desc {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  margin: 0;
  line-height: 1.5;
}

.input-modern {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border-mid);
  padding: 10px 12px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  outline: none;
  border-radius: 0;
  transition: border-color 0.2s;
}

.input-modern:focus {
  border-color: var(--border-strong);
}

select.input-modern {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg xmlns='http://www.w3.org/2000/svg' width='292' height='292'%3E%3Cpath fill='%23888' d='M287 69a18 18 0 00-13-5H18a18 18 0 00-13 18c0 5 2 9 5 13l128 128c4 4 8 5 13 5s9-1 13-5L287 95c4-4 5-8 5-13 0-5-2-9-5-13z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 9px;
}

select.input-modern option {
  background: var(--bg);
  color: var(--text-primary);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.btn-ghost,
.btn-primary {
  padding: 9px 20px;
  border-radius: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  border: none;
  transition: background 0.2s, color 0.2s, opacity 0.2s;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-mid);
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-primary {
  background: var(--text-primary);
  color: var(--bg);
  font-weight: 600;
  border: 1px solid transparent;
}

.btn-primary:not(:disabled):hover {
  opacity: 0.8;
}

.btn-primary:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ─── Onboarding ──────────────────────────────────────── */
.onboarding-dialog {
  border: 1px solid var(--border-mid);
  background: var(--surface);
  border-radius: 0;
}

.onboarding-terminal {
  padding: 36px 24px;
  background: #0C0C0C;
  color: #F0F0F0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 180px;
  border-bottom: 1px solid var(--border);
}

.terminal-text {
  white-space: pre-wrap;
}

.terminal-cursor {
  display: inline-block;
  width: 7px;
  height: 1em;
  background-color: #F0F0F0;
  vertical-align: middle;
  animation: blink 1s step-end infinite;
  margin-left: 2px;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.ob-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--border-mid);
  transition: background 0.2s, transform 0.2s;
}

.ob-dot.active {
  background: var(--text-primary);
  transform: scale(1.4);
}

.ob-desc {
  font-family: var(--font-mono);
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* ─── Onboarding Spotlight ────────────────────────────── */
.ob-spotlight-container {
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
  display: flex;
}

.ob-spotlight-backdrop {
  position: absolute;
  background: rgba(5, 5, 5, 0.4);
  backdrop-filter: blur(14px);
  transition: all 0.5s var(--ease-out);
  pointer-events: auto;
}

:root[data-theme="light"] .ob-spotlight-backdrop {
  background: rgba(247, 247, 247, 0.5);
}

.ob-spotlight-hole-bracket {
  position: absolute;
  transition: all 0.5s var(--ease-out);
  pointer-events: none;
  z-index: 10;
}

.ob-bracket-corner {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1px solid var(--text-primary);
}

.ob-bracket-corner.top-left {
  top: -1px;
  left: -1px;
  border-right: none;
  border-bottom: none;
}

.ob-bracket-corner.top-right {
  top: -1px;
  right: -1px;
  border-left: none;
  border-bottom: none;
}

.ob-bracket-corner.bottom-left {
  bottom: -1px;
  left: -1px;
  border-right: none;
  border-top: none;
}

.ob-bracket-corner.bottom-right {
  bottom: -1px;
  right: -1px;
  border-left: none;
  border-top: none;
}

.ob-crosshair {
  position: absolute;
  background: rgba(255, 255, 255, 0.08);
}

:root[data-theme="light"] .ob-crosshair {
  background: rgba(0, 0, 0, 0.08);
}

.ob-crosshair.x-axis {
  top: 50%;
  left: -40px;
  right: -40px;
  height: 1px;
}

.ob-crosshair.y-axis {
  left: 50%;
  top: -40px;
  bottom: -40px;
  width: 1px;
}

.ob-scan-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--text-primary);
  opacity: 0;
  animation: scan-bracket 3s ease-in-out infinite;
}

@keyframes scan-bracket {
  0% {
    top: 0%;
    opacity: 0;
  }

  10% {
    opacity: 0.5;
  }

  90% {
    opacity: 0.5;
  }

  100% {
    top: 100%;
    opacity: 0;
  }
}

.ob-spotlight-tooltip {
  position: absolute;
  width: 340px;
  background: var(--surface);
  border: 1px solid var(--border-mid);
  padding: 24px;
  z-index: 20;
  pointer-events: auto;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.15);
}

:root[data-theme="dark"] .ob-spotlight-tooltip {
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
}

.ob-spotlight-terminal-text {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--text-dim);
  margin-bottom: 18px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.ob-status-indicator {
  display: inline-block;
  width: 4px;
  height: 4px;
  background: var(--text-secondary);
  border-radius: 50%;
  animation: blink 1.2s ease-in-out infinite alternate;
}

.ob-coord-readout {
  margin-left: auto;
  color: var(--text-dim);
}

.ob-spotlight-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 0 0 8px;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  line-height: 0.92;
}

.ob-spotlight-desc {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 24px;
}

.ob-spotlight-desc strong {
  color: var(--text-primary);
  background: var(--bg);
  padding: 1px 4px;
}

.ob-spotlight-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.ob-spotlight-dots {
  display: flex;
  gap: 6px;
}

.ob-spotlight-dot {
  width: 4px;
  height: 4px;
  background: var(--border-mid);
  border-radius: 50%;
  transition: background 0.3s, transform 0.3s;
}

.ob-spotlight-dot.active {
  background: var(--text-primary);
  transform: scale(1.4);
}

.ob-floating-target {
  position: relative !important;
  z-index: 100000 !important;
  pointer-events: none;
}

/* ─── Mobile Specific ─────────────────────────────────── */
.mobile-nav {
  display: none;
}
.sidebar-overlay {
  display: none;
}
.top-bar-profile-btn {
  display: none;
}

/* ─── Responsive ──────────────────────────────────────── */
@media (max-width: 900px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 990;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease-out);
    backdrop-filter: blur(4px);
  }
  .sidebar-overlay.is-active {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 1000;
    transform: translateX(-100%);
    transition: transform 0.3s var(--ease-out);
    display: flex; /* Override */
  }
  
  .sidebar.is-open {
    transform: translateX(0);
  }

  .layout-main {
    grid-column: 1;
    padding-bottom: calc(90px + env(safe-area-inset-bottom));
    overflow-y: auto;
    overflow-x: hidden;
  }

  .top-bar-tabs {
    display: none;
  }
  
  .top-bar-profile-btn {
    display: grid;
    place-items: center;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    width: 32px;
    height: 32px;
  }
  
  .top-bar-profile-btn svg {
    width: 20px;
    height: 20px;
  }

  .mobile-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(64px + env(safe-area-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: var(--surface);
    border-top: 1px solid var(--border-mid);
    z-index: 100;
    justify-content: space-around;
    align-items: center;
  }

  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    cursor: pointer;
    transition: color 0.2s;
  }
  
  .mobile-nav-item svg {
    width: 20px;
    height: 20px;
  }
  
  .mobile-nav-item.is-active {
    color: var(--text-primary);
  }

  .fab-container {
    position: relative;
    bottom: auto;
    right: auto;
    width: 100%;
    border: none;
    border-top: 1px solid var(--border-mid);
    background: transparent;
    padding: 24px 16px 32px;
    z-index: 10;
    justify-content: flex-end;
  }

  .fab-container.is-collapsed .fab-actions {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: none !important;
    visibility: visible !important;
    position: relative !important;
    right: auto !important;
  }

  .btn-fab-mini {
    display: none !important;
  }
  
  .data-container {
    overflow: visible;
  }
  
  .scroll-context {
    overflow-y: visible;
  }
}

@media (max-width: 640px) {
  .hud-dashboard-cluster {
    padding: 12px 16px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    gap: 12px;
  }

  .hud-dashboard-cluster::-webkit-scrollbar {
    display: none;
  }

  .player-bio-container,
  .career-highs-container,
  .career-totals-container {
    flex: 0 0 85%;
    scroll-snap-align: start;
    gap: 10px 16px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-auto-rows: min-content;
  }

  .container-badge {
    grid-column: 1 / -1;
    position: static;
    margin-bottom: -4px;
    align-self: start;
    justify-self: start;
    background: transparent;
    color: var(--text-dim);
    padding: 0;
  }

  .bio-item:not(:first-child)::before,
  .high-item:not(:first-child)::before,
  .total-item:not(:first-child)::before {
    display: none;
  }

  .editorial-header {
    padding: 20px 16px 14px;
  }

  .top-bar {
    padding: 0 16px;
  }

  .stats-grid th,
  .stats-grid td {
    padding: 6px 8px;
  }
}

/* ─── Animations ──────────────────────────────────────── */
@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

@keyframes pulse-dot {
  from {
    opacity: 0.3;
  }

  to {
    opacity: 1;
  }
}