    /* ═══════════════════════════════════════════════════════════
       ROOT & RESET
    ═══════════════════════════════════════════════════════════ */
    *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

    :root, [data-theme="dark"] {
      --bg-base:      #06060b;
      --bg-deep:      #060910;
      --bg-surface:   rgba(13,17,23,0.6);
      --bg-raised:    rgba(15,23,42,0.55);
      --bg-panel:     #0f172a;
      --bg-card:      #0b1120;
      --bg-border:    rgba(255,255,255,0.06);
      --bg-border-solid: #1e293b;
      --bg-hover:     rgba(255,255,255,0.04);
      --bg-gradient:  linear-gradient(180deg, #0b1120 0%, #080d1a 100%);
      --text-primary: #e2e8f0;
      --text-bright:  #f1f5f9;
      --text-body:    #cbd5e1;
      --text-muted:   #94a3b8;
      --text-dim:     #475569;
      --text-placeholder: #334155;
      --accent-blue:  #3b82f6;
      --accent-blue-rgb: 59, 130, 246;
      --accent-green: #22c55e;
      --accent-green-rgb: 34, 197, 94;
      --accent-red:   #ef4444;
      --accent-red-rgb: 239, 68, 68;
      --accent-yellow:#eab308;
      --accent-purple:#a855f7;
      --accent-orange:#f97316;
      --accent-gradient: linear-gradient(135deg, #1e40af, #7c3aed);
      --glass-bg:     rgba(15,23,42,0.45);
      --glass-border: rgba(255,255,255,0.08);
      --glass-blur:   blur(12px);
      --font:         'JetBrains Mono', monospace;
      --transition-fast:   0.12s ease;
      --transition-normal: 0.2s ease;
      /* ── Spacing scale ────────────────────────────── */
      --sp-1: 2px;  --sp-2: 4px;  --sp-3: 6px;  --sp-4: 8px;
      --sp-5: 10px; --sp-6: 12px; --sp-8: 16px; --sp-10: 20px;
      /* ── Border radius ────────────────────────────── */
      --radius-sm: 3px;  --radius-md: 6px;  --radius-lg: 8px;  --radius-pill: 20px;
      /* ── Font sizes ───────────────────────────────── */
      --font-xs: 9px;  --font-sm: 10px;  --font-base: 11px;
      --font-md: 12px; --font-lg: 14px;  --font-xl: 18px;
      /* ── Component tokens ─────────────────────────── */
      --btn-padding: 4px 10px;
      --btn-radius: 3px;
      --btn-font: 10px;
      --card-padding: 8px 10px;
      --card-radius: 6px;
      --card-bg: var(--bg-card);
      --card-border: 1px solid var(--bg-border);
      --badge-size: 22px;
      --badge-radius: 3px;
      --bar-height: 4px;
      --bar-radius: 2px;
      --bar-bg: rgba(255,255,255,0.04);
    }

    /* ── OLED Theme — true black for AMOLED screens ── */
    [data-theme="oled"] {
      --bg-base:      #000000;
      --bg-deep:      #000000;
      --bg-surface:   rgba(8,8,12,0.8);
      --bg-raised:    rgba(10,15,25,0.7);
      --bg-panel:     #0a0e18;
      --bg-card:      #060a12;
      --bg-border:    rgba(255,255,255,0.04);
      --bg-border-solid: #141c2e;
      --bg-hover:     rgba(255,255,255,0.03);
      --bg-gradient:  linear-gradient(180deg, #050810 0%, #000000 100%);
      --glass-bg:     rgba(8,12,20,0.6);
      --glass-border: rgba(255,255,255,0.05);
    }

    /* ── Midnight Blue — softer navy feel ── */
    [data-theme="midnight"] {
      --bg-base:      #0c1222;
      --bg-deep:      #0a1020;
      --bg-surface:   rgba(16,24,48,0.6);
      --bg-raised:    rgba(20,30,55,0.6);
      --bg-panel:     #142040;
      --bg-card:      #101830;
      --bg-border:    rgba(100,140,255,0.08);
      --bg-border-solid: #1e3060;
      --bg-hover:     rgba(100,140,255,0.05);
      --bg-gradient:  linear-gradient(180deg, #101830 0%, #0a1020 100%);
      --accent-blue:  #60a5fa;
      --accent-gradient: linear-gradient(135deg, #2563eb, #8b5cf6);
      --glass-bg:     rgba(16,24,48,0.5);
      --glass-border: rgba(100,140,255,0.1);
    }

    /* ── Emerald — green-tinted dark theme ── */
    [data-theme="emerald"] {
      --bg-base:      #060d0b;
      --bg-deep:      #050c0a;
      --bg-surface:   rgba(10,20,16,0.6);
      --bg-raised:    rgba(12,28,22,0.6);
      --bg-panel:     #0c1f18;
      --bg-card:      #081610;
      --bg-border:    rgba(34,197,94,0.08);
      --bg-border-solid: #1a3a2a;
      --bg-hover:     rgba(34,197,94,0.04);
      --bg-gradient:  linear-gradient(180deg, #0a1a12 0%, #060d0b 100%);
      --accent-blue:  #34d399;
      --accent-green: #4ade80;
      --accent-gradient: linear-gradient(135deg, #065f46, #059669);
      --glass-bg:     rgba(10,20,16,0.5);
      --glass-border: rgba(34,197,94,0.1);
    }

    /* ── Light Theme ── */
    [data-theme="light"] {
      --bg-base:      #f8fafc;
      --bg-deep:      #f1f5f9;
      --bg-surface:   rgba(255,255,255,0.8);
      --bg-raised:    rgba(255,255,255,0.9);
      --bg-panel:     #ffffff;
      --bg-card:      #ffffff;
      --bg-border:    rgba(0,0,0,0.08);
      --bg-border-solid: #e2e8f0;
      --bg-hover:     rgba(0,0,0,0.04);
      --bg-gradient:  linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
      --text-primary: #1e293b;
      --text-bright:  #0f172a;
      --text-body:    #334155;
      --text-muted:   #64748b;
      --text-dim:     #94a3b8;
      --text-placeholder: #cbd5e1;
      --accent-blue:  #2563eb;
      --accent-green: #16a34a;
      --accent-red:   #dc2626;
      --accent-yellow:#ca8a04;
      --accent-purple:#7c3aed;
      --accent-orange:#ea580c;
      --accent-gradient: linear-gradient(135deg, #2563eb, #7c3aed);
      --glass-bg:     rgba(255,255,255,0.7);
      --glass-border: rgba(0,0,0,0.08);
    }

    html, body {
      height: 100%;
      background: var(--bg-base);
      color: var(--text-primary);
      font-family: var(--font);
      font-size: 13px;
      line-height: 1.5;
      overflow: hidden;
    }

    /* Subtle radial gradient background for depth */
    body::before {
      content: "";
      position: fixed;
      inset: 0;
      background:
        radial-gradient(ellipse at 20% 0%, rgba(30,64,175,0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(124,58,237,0.06) 0%, transparent 50%);
      pointer-events: none;
      z-index: 0;
    }

    #app-shell { position: relative; z-index: 1; }

    a { color: var(--accent-blue); text-decoration: none; }
    button { font-family: var(--font); cursor: pointer; }
    input, select { font-family: var(--font); }

    /* ═══════════════════════════════════════════════════════════
       SCROLLBAR
    ═══════════════════════════════════════════════════════════ */
    ::-webkit-scrollbar { width: 6px; height: 6px; }
    ::-webkit-scrollbar-track { background: var(--bg-base); }
    ::-webkit-scrollbar-thumb { background: var(--bg-border-solid); border-radius: 3px; }
    ::-webkit-scrollbar-thumb:hover { background: var(--text-placeholder); }

    /* ═══════════════════════════════════════════════════════════
       LAYOUT SHELL
    ═══════════════════════════════════════════════════════════ */
    #app-shell {
      display: flex;
      flex-direction: column;
      height: 100vh;
      overflow: hidden;
    }

    /* ═══════════════════════════════════════════════════════════
       TOPBAR (merged into #tab-nav)
    ═══════════════════════════════════════════════════════════ */
    #topbar-logo {
      display: flex;
      align-items: center;
      gap: 12px;
      white-space: nowrap;
      flex-shrink: 0;
      text-decoration: none;
      color: #fff;
    }

    #topbar-logo .logo-svg {
      width: clamp(22px, 2vw, 34px);
      height: clamp(22px, 2vw, 34px);
      flex-shrink: 0;
    }

    #topbar-logo .logo-text {
      color: #f1f5f9;
      font-size: clamp(12px, 1vw, 18px);
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: lowercase;
    }

    #meta-status {
      display: none !important;
    }

    #topbar-actions {
      display: flex;
      align-items: center;
      gap: 6px;
      flex-shrink: 0;
    }

    /* ═══════════════════════════════════════════════════════════
       BUTTONS — COMMON
    ═══════════════════════════════════════════════════════════ */
    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: clamp(4px, 0.4vw, 8px);
      height: clamp(24px, 2vw, 34px);
      padding: 0 clamp(8px, 0.8vw, 16px);
      font-size: clamp(9px, 0.7vw, 13px);
      font-weight: 600;
      font-family: var(--font);
      border: 1px solid var(--glass-border);
      border-radius: 4px;
      background: var(--glass-bg);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      color: var(--text-muted);
      cursor: pointer;
      transition: all 0.2s ease;
      letter-spacing: 0.03em;
    }

    .btn:hover { border-color: rgba(255,255,255,0.12); color: var(--text-primary); background: rgba(255,255,255,0.06); }
    .btn:active { transform: translateY(1px); }

    .btn-primary {
      background: var(--accent-gradient);
      border-color: transparent;
      color: white;
    }
    .btn-primary:hover { filter: brightness(1.15); box-shadow: 0 0 20px rgba(59,130,246,0.25); color: white; }

    .btn-danger {
      border-color: #7f1d1d;
      color: #ef4444;
    }
    .btn-danger:hover { background: #1c0a0a; border-color: var(--accent-red); }

    .btn-disabled, button:disabled {
      opacity: 0.4;
      cursor: not-allowed;
      pointer-events: none;
    }

    /* ═══════════════════════════════════════════════════════════
       UPLOAD SCREEN
    ═══════════════════════════════════════════════════════════ */
    #upload-screen {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      padding: 48px 24px 60px;
      overflow-y: auto;
      flex: 1;
    }

    #upload-header {
      text-align: center;
      margin-bottom: 40px;
    }

    #upload-header h1 {
      font-size: 26px;
      font-weight: 800;
      letter-spacing: 0.03em;
      color: #f1f5f9;
      margin-bottom: 8px;
      font-family: 'Outfit', var(--font);
    }

    #upload-header p {
      font-size: 13px;
      color: #64748b;
      letter-spacing: 0.02em;
      line-height: 1.5;
    }

    #upload-header .upload-divider {
      width: 56px;
      height: 2px;
      background: linear-gradient(90deg, #2563eb, #7c3aed);
      margin: 14px auto 0;
      border-radius: 2px;
    }

    #file-slots {
      display: flex;
      flex-direction: column;
      gap: 8px;
      width: 100%;
      max-width: 780px;
    }

    /* Slot card — built dynamically by upload.js */
    .slot-card {
      display: grid;
      grid-template-columns: 28px 1fr auto;
      align-items: center;
      gap: 16px;
      padding: 14px 18px;
      background: linear-gradient(180deg, rgba(15,23,42,0.4) 0%, rgba(10,15,26,0.5) 100%);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border: 1px solid rgba(30,41,59,0.4);
      border-radius: 8px;
      transition: all 0.2s ease;
    }

    .slot-card:hover { border-color: rgba(56,130,246,0.12); box-shadow: 0 2px 16px rgba(0,0,0,0.2); }

    .slot-dot-wrap { display: flex; align-items: center; justify-content: center; }

    .slot-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      flex-shrink: 0;
      transition: all 0.3s ease;
    }

    .dot-empty  { background: #1e293b; border: 2px solid #334155; width: 12px; height: 12px; }
    .dot-loaded { background: var(--accent-green); box-shadow: 0 0 8px rgba(34,197,94,0.5); }
    .dot-persisted { background: var(--accent-blue); box-shadow: 0 0 8px rgba(59,130,246,0.5); }
    .dot-error  { background: var(--accent-red); box-shadow: 0 0 8px rgba(239,68,68,0.5); }

    .slot-info { display: flex; flex-direction: column; gap: 4px; min-width: 0; }

    .slot-name-row {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }

    .slot-filename {
      font-size: 13px;
      font-weight: 700;
      color: #e2e8f0;
    }

    .slot-required {
      color: var(--accent-red);
      font-size: 12px;
      font-weight: 700;
    }

    .slot-badge {
      font-size: 9px;
      font-weight: 700;
      padding: 2px 8px;
      border-radius: 999px;
      letter-spacing: 0.06em;
    }

    .badge-jsonl { background: rgba(168,85,247,0.08); color: #c084fc; border: 1px solid rgba(168,85,247,0.2); }
    .badge-json  { background: rgba(59,130,246,0.08); color: #60a5fa; border: 1px solid rgba(59,130,246,0.2); }
    .badge-csv   { background: rgba(34,197,94,0.08);  color: #4ade80; border: 1px solid rgba(34,197,94,0.2); }

    .slot-desc {
      font-size: 11px;
      color: #64748b;
      line-height: 1.5;
    }

    .slot-status {
      font-size: 11px;
      color: #94a3b8;
    }

    .slot-status.status-error { color: var(--accent-red); }

    .slot-btn-wrap { flex-shrink: 0; }
    .slot-btn-dual { display: flex; flex-direction: column; gap: 6px; }

    .btn-browse {
      height: 30px;
      padding: 0 14px;
      font-size: 10px;
      font-weight: 700;
      font-family: var(--font);
      background: rgba(56,130,246,0.06);
      border: 1px solid rgba(56,130,246,0.15);
      border-radius: 6px;
      color: #3b82f6;
      cursor: pointer;
      letter-spacing: 0.06em;
      transition: all 0.2s ease;
      min-width: 72px;
    }
    .btn-browse:hover { border-color: rgba(56,130,246,0.35); background: rgba(56,130,246,0.1); box-shadow: 0 0 10px rgba(56,130,246,0.08); }

    .btn-browse-live {
      background: rgba(56,130,246,0.06);
      border-color: rgba(56,130,246,0.15);
      color: #3b82f6;
    }
    .btn-browse-online {
      background: rgba(34,197,94,0.06);
      border: 1px solid rgba(34,197,94,0.15);
      color: #22c55e;
    }
    .btn-browse-online:hover {
      border-color: rgba(34,197,94,0.35);
      background: rgba(34,197,94,0.1);
      box-shadow: 0 0 10px rgba(34,197,94,0.08);
    }

    .slot-status-online {
      font-size: 10px;
      color: var(--accent-green);
      margin-top: 2px;
    }

    #upload-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      max-width: 780px;
      margin-top: 24px;
      padding-top: 24px;
      border-top: 1px solid rgba(30,41,59,0.4);
    }

    #upload-footer .footer-note {
      font-size: 11px;
      color: #475569;
    }

    #btn-launch {
      height: 40px;
      padding: 0 32px;
      font-size: 13px;
      font-weight: 700;
      font-family: var(--font);
      background: linear-gradient(135deg, #2563eb, #7c3aed);
      border: none;
      border-radius: 8px;
      color: white;
      cursor: pointer;
      letter-spacing: 0.06em;
      transition: all 0.25s ease;
      box-shadow: 0 2px 12px rgba(37,99,235,0.2);
    }
    #btn-launch:hover:not(:disabled) { filter: brightness(1.12); box-shadow: 0 4px 28px rgba(59,130,246,0.35), 0 0 10px rgba(124,58,237,0.2); transform: translateY(-1px); }
    #btn-launch:disabled { opacity: 0.25; cursor: not-allowed; box-shadow: none; }

    /* ═══════════════════════════════════════════════════════════
       PROGRESS OVERLAY
    ═══════════════════════════════════════════════════════════ */
    #progress-overlay {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(6,9,16,0.94);
      z-index: 1000;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 20px;
      backdrop-filter: blur(8px);
    }

    #progress-overlay.visible { display: flex; }

    #progress-box {
      width: min(500px, 90vw);
      background: linear-gradient(180deg, rgba(15,23,42,0.7) 0%, rgba(10,15,26,0.8) 100%);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border: 1px solid rgba(56,130,246,0.1);
      border-radius: 12px;
      padding: 32px 32px 28px;
      display: flex;
      flex-direction: column;
      gap: 14px;
      box-shadow: 0 12px 48px rgba(0,0,0,0.5), 0 0 30px rgba(56,130,246,0.05);
    }

    #progress-box h3 {
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.12em;
      color: #475569;
      text-transform: uppercase;
      margin: 0;
    }

    #progress-phase {
      font-size: 13px;
      font-weight: 600;
      color: #e2e8f0;
      min-height: 1.5em;
      word-break: break-all;
      margin: 0;
    }

    #progress-bar-track {
      height: 5px;
      background: rgba(30,41,59,0.5);
      border-radius: 999px;
      overflow: hidden;
    }

    #progress-bar-fill {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, #2563eb, #7c3aed);
      border-radius: 999px;
      transition: width 0.3s ease;
      box-shadow: 0 0 12px rgba(59,130,246,0.4);
      position: relative;
    }
    #progress-bar-fill::after {
      content: '';
      position: absolute;
      top: 0; right: 0;
      width: 20px; height: 100%;
      background: inherit;
      filter: blur(6px);
      opacity: 0.6;
    }

    #progress-stats {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      flex-wrap: wrap;
      min-height: 1.2em;
    }

    #progress-detail,
    #progress-throughput,
    #progress-eta {
      font-size: 11px;
      color: #94a3b8;
      letter-spacing: 0.04em;
      font-variant-numeric: tabular-nums;
    }

    #progress-eta { margin-left: auto; color: #22c55e; font-weight: 600; }

    #progress-spinner {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 10px;
      color: #475569;
      letter-spacing: 0.04em;
    }

    .spinner-dot {
      width: 6px; height: 6px;
      border-radius: 50%;
      background: #3b82f6;
      animation: spin-pulse 1.2s infinite ease-in-out;
      flex-shrink: 0;
    }
    .spinner-dot:nth-child(2) { animation-delay: 0.2s; background: #7c3aed; }
    .spinner-dot:nth-child(3) { animation-delay: 0.4s; background: #3b82f6; }

    @keyframes spin-pulse {
      0%, 80%, 100% { opacity: 0.15; transform: scale(0.8); }
      40%            { opacity: 1;    transform: scale(1.3); }
    }

    /* ═══════════════════════════════════════════════════════════
       DASHBOARD
    ═══════════════════════════════════════════════════════════ */
    #dashboard {
      display: none;
      flex-direction: column;
      flex: 1;
      min-height: 0;
      overflow: hidden;
    }

    /* ── Leak Buster Dashboard Widget ──────────────────────────── */
    .dash-leak-widget {
      background: var(--card-bg, #1e293b);
      border: 1px solid var(--border, #334155);
      border-radius: 10px;
      padding: 14px 16px;
      margin: 10px 16px;
    }
    .leak-widget-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 10px;
    }
    .leak-widget-title {
      font-size: 13px;
      font-weight: 700;
      color: var(--text-heading, #f1f5f9);
      text-transform: uppercase;
      letter-spacing: .04em;
    }
    .leak-widget-link {
      font-size: 11px;
      color: var(--accent-blue, #3b82f6);
      cursor: pointer;
      font-weight: 600;
    }
    .leak-widget-link:hover { text-decoration: underline; }

    .leak-widget-cards { display: flex; flex-direction: column; gap: 8px; }

    .leak-card {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      padding: 8px 10px;
      background: rgba(255,255,255,.02);
      border-radius: 6px;
      border: 1px solid rgba(255,255,255,.04);
    }
    .leak-card-dot {
      width: 8px;
      height: 8px;
      border-radius: 50%;
      flex-shrink: 0;
      margin-top: 4px;
    }
    .leak-card-info {
      flex: 1;
      display: flex;
      flex-direction: column;
      gap: 2px;
      min-width: 0;
    }
    .leak-card-name {
      font-size: 12px;
      font-weight: 600;
      color: var(--text-heading, #f1f5f9);
    }
    .leak-card-cost {
      font-size: 10px;
      color: #ef4444;
      font-family: var(--font-mono, monospace);
      font-weight: 600;
    }
    .leak-card-fix {
      font-size: 10px;
      color: var(--text-muted, #64748b);
      line-height: 1.4;
    }
    .leak-card-drill {
      padding: 4px 10px;
      border-radius: 5px;
      border: 1px solid var(--accent-blue, #3b82f6);
      background: transparent;
      color: var(--accent-blue, #3b82f6);
      font-size: 10px;
      font-weight: 600;
      cursor: pointer;
      white-space: nowrap;
      flex-shrink: 0;
      font-family: var(--font, system-ui);
      margin-top: 2px;
    }
    .leak-card-drill:hover {
      background: var(--accent-blue, #3b82f6);
      color: #fff;
    }

    .leak-widget-empty {
      text-align: center;
      padding: 12px 0;
    }
    .leak-widget-empty p {
      font-size: 12px;
      color: var(--text-muted, #64748b);
      margin: 0 0 10px;
    }
    .leak-widget-cta {
      padding: 6px 16px;
      border-radius: 6px;
      border: none;
      background: var(--accent-blue, #3b82f6);
      color: #fff;
      font-size: 11px;
      font-weight: 700;
      cursor: pointer;
      font-family: var(--font, system-ui);
    }
    .leak-widget-cta:hover { background: #2563eb; }

    /* Tab nav */
    #tab-nav {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 clamp(12px, 1.5vw, 28px);
      height: clamp(40px, 3.6vw, 64px);
      background: linear-gradient(180deg, rgba(13,17,23,0.85) 0%, rgba(6,6,11,0.95) 100%);
      backdrop-filter: blur(20px) saturate(180%);
      -webkit-backdrop-filter: blur(20px) saturate(180%);
      border-bottom: 1px solid rgba(255,255,255,0.06);
      flex-shrink: 0;
      gap: clamp(10px, 1.2vw, 24px);
      scrollbar-width: none;
      position: relative;
      z-index: 10;
    }

    /* Subtle top highlight line */
    #tab-nav::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 1px;
      background: linear-gradient(90deg, transparent, rgba(59,130,246,0.15) 30%, rgba(124,58,237,0.12) 70%, transparent);
      pointer-events: none;
    }

    #tab-nav-center {
      display: flex;
      align-items: center;
      gap: 2px;
      overflow-x: auto;
      scrollbar-width: none;
    }
    #tab-nav-center::-webkit-scrollbar { height: 0; }

    #tab-nav::-webkit-scrollbar { height: 0; }

    .tab-btn {
      display: inline-flex;
      align-items: center;
      gap: clamp(4px, 0.5vw, 10px);
      height: clamp(28px, 2.4vw, 44px);
      padding: 0 clamp(8px, 1vw, 20px);
      font-size: clamp(10px, 0.8vw, 14px);
      font-weight: 600;
      font-family: var(--font);
      color: rgba(255,255,255,0.35);
      background: transparent;
      border: 1px solid transparent;
      border-radius: 7px;
      cursor: pointer;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      white-space: nowrap;
      transition: all 0.2s ease;
      position: relative;
    }

    .tab-btn .tab-icon {
      font-size: clamp(10px, 0.85vw, 15px);
      line-height: 1;
      opacity: 0.5;
      transition: all 0.2s ease;
    }

    .tab-btn:hover {
      color: rgba(255,255,255,0.7);
      background: rgba(255,255,255,0.04);
      border-color: rgba(255,255,255,0.06);
    }
    .tab-btn:hover .tab-icon { opacity: 0.85; }

    .tab-btn.active {
      color: #e2e8f0;
      background: rgba(59,130,246,0.1);
      border-color: rgba(59,130,246,0.2);
      box-shadow: 0 0 12px rgba(59,130,246,0.08), inset 0 1px 0 rgba(255,255,255,0.05);
    }
    .tab-btn.active .tab-icon { opacity: 1; color: #60a5fa; }

    /* Active indicator dot under text */
    .tab-btn.active::after {
      content: '';
      position: absolute;
      bottom: 4px;
      left: 50%;
      transform: translateX(-50%);
      width: 16px;
      height: 2px;
      border-radius: 1px;
      background: linear-gradient(90deg, #3b82f6, #7c3aed);
      opacity: 0.8;
    }

    /* Tab separator dots between buttons */
    .tab-sep {
      width: 3px;
      height: 3px;
      border-radius: 50%;
      background: rgba(255,255,255,0.06);
      flex-shrink: 0;
      margin: 0 1px;
    }

    /* ─── Dashboard sub-tabs ─────────────────────────────── */
    #dash-subtabs {
      overflow-x: auto;
      scrollbar-width: none;
    }
    #dash-subtabs::-webkit-scrollbar { height: 0; }

    /* Dashboard sub-tab groups */
    .dash-group-label {
      font-size: 8px; font-weight: 700; color: var(--text-dim);
      letter-spacing: 0.08em; padding: 0 4px; white-space: nowrap;
    }
    .dash-group-sep {
      width: 1px; height: 16px; background: var(--bg-border); margin: 0 4px; flex-shrink: 0;
    }
    .dash-subtab {
      padding: var(--btn-padding); font-size: var(--btn-font); font-weight: 600;
      font-family: var(--font); letter-spacing: 0.06em;
      border: 1px solid var(--bg-border); border-radius: var(--btn-radius);
      cursor: pointer; background: transparent; color: var(--text-muted); white-space: nowrap;
      transition: all 0.15s ease;
    }
    .dash-subtab.active {
      background: rgba(var(--accent-blue-rgb), 0.08); color: var(--accent-blue);
      border-color: rgba(var(--accent-blue-rgb), 0.2);
    }
    .dash-subtab:hover:not(.active) {
      background: var(--bg-hover); color: var(--text-body);
    }

    /* Tab content area */
    #tab-body {
      flex: 1;
      overflow: hidden;
      position: relative;
    }

    .tab-content {
      display: none;
      height: 100%;
      overflow-y: auto;
      overflow-x: hidden;
      padding: 16px;
      animation: tabFadeIn 0.2s ease;
    }

    @keyframes tabFadeIn {
      from { opacity: 0; transform: translateY(4px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    .tab-content.active { display: block; }
    /* Dashboard override — needs flex column for heatmap + challenge + sub-tabs layout */
    #tab-course.active { display: flex !important; flex-direction: column; }
    /* Replayer override — needs flex column for full-height layout */
    #tab-replayer.active { display: flex !important; flex-direction: column; }
    /* Ranges grid — ensure grid layout even if JS-injected styles haven't loaded */
    #tab-ranges { overflow-x: auto; overflow-y: auto; }
    /* Grid sizing now driven by CSS custom-properties in ranges.js getCSS() —
       do NOT override grid-template-columns/rows here or you'll break scaling */
    .re-grid {
      display: grid !important;
      user-select: none;
    }
    .re-grid-wrap { min-width: min-content; }
    .re-grid-view { min-width: min-content; }
    .re-content-area { overflow-x: auto; }

    /* ═══════════════════════════════════════════════════════════
       SECTION HEADERS
    ═══════════════════════════════════════════════════════════ */
    .section-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 12px;
      padding-bottom: 8px;
      border-bottom: 1px solid var(--bg-border);
    }

    .section-title {
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.08em;
      text-transform: uppercase;
      color: var(--text-muted);
    }

    /* ═══════════════════════════════════════════════════════════
       BADGE SYSTEM
    ═══════════════════════════════════════════════════════════ */
    .badge {
      display: inline-block;
      font-size: 10px;
      font-weight: 700;
      padding: 2px 7px;
      border-radius: 3px;
      letter-spacing: 0.05em;
    }

    .badge-tag     { background: rgba(59,130,246,0.18);  color: #60a5fa; }
    .badge-lag     { background: rgba(239,68,68,0.18);   color: #f87171; }
    .badge-nit     { background: rgba(34,197,94,0.18);   color: #4ade80; }
    .badge-sta     { background: rgba(234,179,8,0.18);   color: #facc15; }
    .badge-man     { background: rgba(168,85,247,0.18);  color: #c084fc; }
    .badge-unknown { background: rgba(100,116,139,0.18); color: #94a3b8; }

    /* ═══════════════════════════════════════════════════════════
       POOL TAB  (#pool)
    ═══════════════════════════════════════════════════════════ */
    #pool { padding: 0; }

    #pool-toolbar {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 16px;
      background: var(--glass-bg);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border-bottom: 1px solid var(--glass-border);
      flex-wrap: wrap;
    }

    #pool-search {
      height: 28px;
      padding: 0 10px;
      width: 200px;
      background: var(--bg-surface);
      border: 1px solid var(--bg-border);
      border-radius: 3px;
      color: var(--text-primary);
      font-size: 11px;
      font-family: var(--font);
    }
    #pool-search:focus { outline: none; border-color: var(--accent-blue); }
    #pool-search::placeholder { color: var(--text-dim); }

    #pool-arch-filter {
      height: 28px;
      padding: 0 8px;
      background: var(--bg-surface);
      border: 1px solid var(--bg-border);
      border-radius: 3px;
      color: var(--text-muted);
      font-size: 11px;
      font-family: var(--font);
    }
    #pool-arch-filter:focus { outline: none; }

    .slider-group {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 10px;
      color: var(--text-dim);
    }

    #pool-min-hands {
      -webkit-appearance: none;
      width: 110px;
      height: 3px;
      border-radius: 2px;
      background: var(--bg-border);
      outline: none;
    }
    #pool-min-hands::-webkit-slider-thumb {
      -webkit-appearance: none;
      width: 12px; height: 12px;
      border-radius: 50%;
      background: var(--accent-blue);
      cursor: pointer;
    }

    #pool-min-hands-label {
      min-width: 28px;
      text-align: right;
      color: var(--text-muted);
    }

    #pool-count {
      margin-left: auto;
      font-size: 10px;
      color: var(--text-dim);
    }

    #vtable-container {
      overflow-y: scroll;
      position: relative;
    }

    /* vtable rows built by pool.js */
    .vtable-header {
      position: sticky;
      top: 0;
      z-index: 2;
    }

    .pool-row {
      display: grid;
      border-bottom: 1px solid rgba(30,41,59,0.5);
      transition: background 0.1s;
    }
    .pool-row:hover { background: var(--bg-hover); }
    .pool-row.selected { background: rgba(59,130,246,0.08); border-left: 2px solid var(--accent-blue); }

    /* ═══════════════════════════════════════════════════════════
       ANALYTICS TAB  (#tab-analytics)
    ═══════════════════════════════════════════════════════════ */
    #tab-analytics {
      display: none;
    }

    #analytics-styles { display: none; }

    /* ═══════════════════════════════════════════════════════════
       LATENT SPACE SECTION (inside analytics tab)
    ═══════════════════════════════════════════════════════════ */
    #latent-section {
      display: none;
    }

    /* ═══════════════════════════════════════════════════════════
       DEEP DIVE PANEL (inside pool tab) — H2N style
    ═══════════════════════════════════════════════════════════ */
    #pool-deepdive {
      display: none;
      background: #0a0f1a;
    }

    /* Smooth open/close transition */
    #pool-deepdive.dd-open {
      animation: dd-slide-in 0.2s ease-out;
    }
    @keyframes dd-slide-in {
      from { opacity: 0; transform: translateY(8px); }
      to   { opacity: 1; transform: translateY(0); }
    }

    /* Top bar: back + player name */
    #dd-topbar {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 8px 14px;
      background: linear-gradient(180deg, #0d1320 0%, #0b1020 100%);
      border-bottom: 1px solid #1e293b;
    }
    .dd-back-btn {
      background: #1e293b;
      border: 1px solid #334155;
      border-radius: 4px;
      color: #94a3b8;
      font-size: 11px;
      font-family: 'JetBrains Mono', monospace;
      padding: 4px 10px;
      cursor: pointer;
      flex-shrink: 0;
      transition: all 0.15s;
    }
    .dd-back-btn:hover { background: #334155; color: #e2e8f0; border-color: #475569; }

    #dd-player-header {
      flex: 1;
      padding: 0;
      background: none;
      border: none;
    }

    #dd-search-input {
      flex: 1;
      max-width: 320px;
      height: 30px;
      padding: 0 10px;
      background: var(--bg-raised);
      border: 1px solid var(--bg-border);
      border-radius: 3px;
      color: var(--text-primary);
      font-size: 11px;
      font-family: var(--font);
      position: relative;
    }
    #dd-search-input:focus { outline: none; border-color: var(--accent-blue); }
    #dd-search-input::placeholder { color: var(--text-dim); }

    /* Autocomplete dropdown */
    #dd-autocomplete-wrap { position: relative; flex: 1; max-width: 320px; }
    #dd-autocomplete {
      display: none; position: absolute; top: calc(100% + 2px);
      left: 0; right: 0; background: var(--bg-raised);
      border: 1px solid var(--bg-border); border-radius: 3px;
      z-index: 200; max-height: 200px; overflow-y: auto;
    }
    #dd-ac-style { display: none; }

    /* ── H2N stat boxes row ── */
    #dd-stats-grid {
      display: flex;
      flex-wrap: wrap;
      gap: 0;
      padding: 0;
      background: linear-gradient(180deg, #0d1320 0%, #0c1220 100%);
      border-bottom: 1px solid #1e293b;
    }
    .dd-stat-box {
      display: flex;
      flex-direction: column;
      padding: clamp(6px, 0.7vw, 14px) clamp(10px, 1.3vw, 26px);
      border-right: 1px solid #1e293b;
      min-width: clamp(65px, 6vw, 110px);
      transition: background 0.15s;
    }
    .dd-stat-box:hover { background: rgba(59,130,246,0.03); }
    .dd-stat-box:last-child { border-right: none; }
    .dd-stat-value {
      font-size: clamp(16px, 1.6vw, 30px);
      font-weight: 700;
      font-family: 'JetBrains Mono', monospace;
      color: #f1f5f9;
      line-height: 1.2;
    }
    .dd-stat-value.positive { color: #22c55e; }
    .dd-stat-value.negative { color: #ef4444; }
    .dd-stat-value.accent { color: #3b82f6; }
    .dd-stat-value.warn { color: #eab308; }
    .dd-stat-label {
      font-size: clamp(7px, 0.6vw, 12px);
      color: #475569;
      text-transform: uppercase;
      letter-spacing: .5px;
      font-weight: 600;
      white-space: nowrap;
      margin-top: clamp(2px, 0.25vw, 5px);
    }

    /* Secondary stat row */
    #dd-stats-row2 {
      display: flex;
      flex-wrap: wrap;
      gap: 0;
      padding: 0;
      background: #0c1220;
      border-bottom: 1px solid #1e293b;
    }
    .dd-stat2 {
      padding: clamp(4px, 0.5vw, 10px) clamp(8px, 1vw, 22px);
      border-right: 1px solid #1e293b;
      min-width: clamp(55px, 5vw, 95px);
      transition: background 0.15s;
    }
    .dd-stat2:hover { background: rgba(59,130,246,0.03); }
    .dd-stat2:last-child { border-right: none; }
    .dd-stat2-value {
      font-size: clamp(12px, 1vw, 20px);
      font-weight: 600;
      font-family: 'JetBrains Mono', monospace;
      color: #e2e8f0;
    }
    .dd-stat2-value.positive { color: #22c55e; }
    .dd-stat2-value.negative { color: #ef4444; }
    .dd-stat2-label {
      font-size: clamp(7px, 0.55vw, 11px);
      color: #475569;
      text-transform: uppercase;
      letter-spacing: .5px;
      font-weight: 600;
      margin-top: 3px;
    }

    /* ── Tab bar ── */
    #dd-tab-bar {
      display: flex;
      gap: 0;
      background: #0d1320;
      border-bottom: 2px solid #1e293b;
      padding: 0 14px;
      overflow-x: auto;
      scrollbar-width: none;
    }
    #dd-tab-bar::-webkit-scrollbar { display: none; }
    .dd-tab {
      background: none;
      border: none;
      border-bottom: 2px solid transparent;
      margin-bottom: -2px;
      padding: clamp(5px, 0.55vw, 11px) clamp(8px, 1vw, 20px);
      font-size: clamp(9px, 0.7vw, 13px);
      font-family: 'JetBrains Mono', monospace;
      font-weight: 600;
      color: #475569;
      cursor: pointer;
      transition: color 0.15s, border-color 0.15s, background 0.15s;
      white-space: nowrap;
      letter-spacing: 0.02em;
    }
    .dd-tab:hover { color: #94a3b8; background: rgba(59,130,246,0.04); }
    .dd-tab.active {
      color: #e2e8f0;
      border-bottom-color: #3b82f6;
      background: rgba(59,130,246,0.06);
    }

    /* ── Tab panels ── */
    #dd-tab-content {
      flex: 1;
      overflow: hidden;
    }
    .dd-tab-panel {
      display: none;
      height: 100%;
      overflow-y: auto;
      scrollbar-width: thin;
      scrollbar-color: #1e293b transparent;
    }
    .dd-tab-panel::-webkit-scrollbar { width: 6px; }
    .dd-tab-panel::-webkit-scrollbar-track { background: transparent; }
    .dd-tab-panel::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 3px; }
    .dd-tab-panel.active {
      display: block;
    }

    /* ── Position table (in positions tab) ── */
    #dd-position-table {
      padding: 14px;
    }

    /* ── Profit chart (in graph tab) ── */
    #dd-profit-chart {
      height: 320px;
      padding: 14px;
    }

    /* ── Range mini (in explainer tab) ── */
    #dd-range-mini {
      background: var(--bg-raised);
      border: 1px solid var(--bg-border);
      border-radius: 3px;
      padding: 6px;
      margin: 10px;
      overflow: hidden;
    }
    #dd-range-toggle {
      font-size: 9px; color: var(--text-dim); cursor: pointer; margin-bottom: 4px;
    }
    #dd-range-toggle:hover { color: var(--accent-blue); }

    /* ── UMAP mini ── */
    #dd-umap-mini {
      height: 180px;
      background: var(--bg-raised);
      border: 1px solid var(--bg-border);
      border-radius: 3px;
      margin: 0 10px 10px;
      overflow: hidden;
    }
    #dd-umap-plotly { width: 100%; height: 100%; }

    /* ── Explainer ── */
    #dd-explainer { padding: 10px; }

    /* ── Hands list in deep dive ── */
    .dd-hands-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 4px 6px;
      background: #0d1320;
      border-bottom: 1px solid #1e293b;
    }
    .dd-hands-title {
      font-size: 9px;
      color: #334155;
      text-transform: uppercase;
      letter-spacing: 1px;
      font-weight: 600;
    }
    .dd-hands-count {
      font-size: 10px;
      color: #475569;
      font-family: 'JetBrains Mono', monospace;
    }
    /* ── H2N-style hand table ── */
    .h2n-sel {
      background: #0f172a; border: 1px solid #1e293b; color: #94a3b8;
      font-size: 10px; padding: 2px 5px; border-radius: 2px;
      font-family: 'JetBrains Mono', monospace;
    }

    /* Hand table wrapper */
    .h2n-table-wrap {
      width: 100%;
      overflow-x: auto;
    }

    /*  14-column responsive grid
        Fixed cols for cards/pot/stakes, 1fr for action cols that expand to fill.
        Preflop | Actions | Flop | Pot | Actions | Turn | Pot | Actions | River | Pot | Actions | Stakes | Won | EV Diff */
    .h2n-hdr, .h2n-row {
      display: grid;
      grid-template-columns:
        56px minmax(60px,1fr) 84px 42px minmax(60px,1fr) 30px 42px minmax(60px,1fr) 30px 42px minmax(60px,1fr) 50px 70px 54px;
      align-items: center;
      font-family: 'JetBrains Mono', monospace;
      font-size: 11px; line-height: 1.2; white-space: nowrap;
      width: 100%;
    }
    .h2n-hdr {
      font-size: 9px; color: #64748b; text-transform: uppercase;
      letter-spacing: .4px; border-bottom: 1px solid #1e293b;
      padding: 4px 0; position: sticky; top: 0;
      background: #0a0f1a; z-index: 1;
    }
    .h2n-hdr > span { padding: 0 3px; }
    .h2n-row {
      color: #e2e8f0; padding: 3px 0;
      border-bottom: 1px solid #0d1117;
      cursor: pointer; transition: background 0.08s;
    }
    .h2n-row > span { padding: 0 3px; overflow: hidden; text-overflow: ellipsis; }
    .h2n-row:hover { background: #1e293b; }
    .h2n-row:nth-child(even) { background: #0c1220; }
    .h2n-row:nth-child(even):hover { background: #1e293b; }

    /* Column overrides */
    .h2n-c-act   { overflow: hidden; text-overflow: ellipsis; }
    .h2n-c-pot   { text-align: right; color: #64748b; font-size: 10px; }
    .h2n-c-stakes{ text-align: center; color: #475569; font-size: 10px; }
    .h2n-c-won   { text-align: right; font-weight: 600; font-size: 11px; }
    .h2n-c-evdiff{ text-align: right; font-size: 10px; color: #475569; }
    .h2n-win     { color: #22c55e; }
    .h2n-loss    { color: #ef4444; }

    /* Card chips — colored background pills like H2N */
    .h2n-card {
      display: inline-block; padding: 1px 3px;
      border-radius: 2px; font-size: 11px; font-weight: 700;
      line-height: 17px; vertical-align: middle;
      font-family: 'JetBrains Mono', monospace;
      margin-right: 1px;
    }
    .h2n-suit { font-size: 8px; }

    /* Action tokens — colored text */
    .h2n-a { font-size: 10px; font-weight: 600; white-space: nowrap; margin-right: 2px; }
    .h2n-fold  { color: #94a3b8; }
    .h2n-check { color: #94a3b8; }
    .h2n-call  { color: #22c55e; }
    .h2n-raise { color: #f59e0b; }
    .h2n-bet   { color: #f59e0b; }
    .h2n-allin { color: #ef4444; font-weight: 700; }
    .h2n-sd { font-size: 7px; background: #1e293b; color: #64748b; padding: 0 2px; border-radius: 2px; margin-left: 1px; }
    .h2n-ai { font-size: 7px; background: #7f1d1d44; color: #ef4444; padding: 0 2px; border-radius: 2px; margin-left: 1px; }

    .dd-hands-pager {
      display: flex; align-items: center; justify-content: center;
      gap: 8px; padding: 4px 0;
    }
    .dd-hands-pager button {
      background: #1e293b; border: 1px solid #334155; color: #94a3b8;
      padding: 1px 6px; border-radius: 2px; font-size: 9px; cursor: pointer;
    }
    .dd-hands-pager button:disabled { opacity: 0.3; cursor: default; }
    .dd-hands-empty {
      color: #475569; font-size: 11px; padding: 12px 0; text-align: center;
    }

    /* ═══════════════════════════════════════════════════════════
       REPLAYER TAB  (#tab-replayer)
       — full-height, flush layout (rp-root takes over)
    ═══════════════════════════════════════════════════════════ */
    #tab-replayer {
      display: none;
      padding: 0 !important;
      overflow: hidden !important;
      flex-direction: column;
    }
    #tab-replayer.active { display: flex; }

    /* legacy stubs kept for backwards compat */
    #rep-seats {
      position: relative;
      min-height: 160px;
    }

    #rep-action-log {
      background: var(--bg-surface);
      border: 1px solid var(--bg-border);
      border-radius: 4px;
      padding: 10px;
      height: 100%;
      overflow-y: auto;
      font-size: 10px;
      color: var(--text-muted);
      line-height: 1.6;
    }

    /* ═══════════════════════════════════════════════════════════
       RANGES TAB  (#tab-ranges)
    ═══════════════════════════════════════════════════════════ */
    #tab-ranges {
      display: none;
      padding: 0;
    }

    #ranges-styles { display: none; }

    #ranges-layout {
      display: grid;
      grid-template-columns: 230px 1fr;
      height: 100%;
    }

    #ranges-sidebar {
      background: linear-gradient(180deg, rgba(10,15,26,0.95) 0%, rgba(6,9,15,0.98) 100%);
      border-right: 1px solid rgba(56,130,246,0.08);
      padding: 16px;
      overflow-y: auto;
      position: relative;
    }
    #ranges-sidebar::after {
      content: '';
      position: absolute;
      top: 0; right: 0;
      width: 1px; height: 100%;
      background: linear-gradient(180deg, transparent, rgba(56,130,246,0.1), transparent);
    }

    #ranges-arch-pills {
      display: flex;
      flex-direction: column;
      gap: 3px;
      margin-bottom: 18px;
    }

    #ranges-pos-pills {
      display: flex;
      flex-direction: column;
      gap: 3px;
      margin-bottom: 18px;
    }

    #ranges-view-pills {
      display: flex;
      flex-direction: column;
      gap: 3px;
    }

    .ranges-pill {
      display: flex;
      align-items: center;
      height: 32px;
      padding: 0 12px;
      font-size: 12px;
      font-weight: 600;
      font-family: var(--font);
      background: transparent;
      border: 1px solid transparent;
      border-radius: 6px;
      color: #475569;
      cursor: pointer;
      text-align: left;
      transition: all 0.2s ease;
      letter-spacing: 0.03em;
    }
    .ranges-pill:hover { color: #94a3b8; background: rgba(15,23,42,0.5); }
    .ranges-pill.active {
      color: #e2e8f0;
      background: rgba(56,130,246,0.08);
      border-color: rgba(56,130,246,0.15);
      box-shadow: 0 0 10px rgba(56,130,246,0.05);
    }

    #ranges-main {
      padding: 16px;
      overflow-y: auto;
      background: #060910;
    }

    #ranges-placeholder {
      display: flex;
      align-items: center;
      justify-content: center;
      height: 300px;
      color: #334155;
      font-size: 12px;
      font-weight: 600;
      letter-spacing: 0.1em;
    }

    #ranges-grid {
      /* Built by ranges.js */
    }

    #ranges-legend {
      display: flex;
      gap: 18px;
      flex-wrap: wrap;
      margin-top: 14px;
    }

    /* ═══════════════════════════════════════════════════════════
       SIMULATOR TAB  (#tab-simulator)
    ═══════════════════════════════════════════════════════════ */
    #tab-simulator {
      display: none;
    }

    #sim-styles { display: none; }

    #sim-layout {
      display: grid;
      grid-template-columns: 1fr 300px;
      gap: 16px;
      height: 100%;
    }

    /* Felt / Table */
    #sim-felt {
      background: linear-gradient(180deg, rgba(15,23,42,0.5) 0%, rgba(10,15,26,0.6) 100%);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border: 1px solid rgba(30,41,59,0.4);
      border-radius: 10px;
      padding: 22px;
      display: flex;
      flex-direction: column;
      gap: 14px;
      position: relative;
    }
    #sim-felt::before {
      content: '';
      position: absolute;
      top: 0; left: 20px; right: 20px;
      height: 1px;
      background: linear-gradient(90deg, transparent, rgba(56,130,246,0.1), transparent);
    }

    #sim-street-label {
      font-size: 11px;
      font-weight: 700;
      letter-spacing: 0.12em;
      text-transform: uppercase;
      color: #475569;
    }

    #sim-pot {
      font-size: 14px;
      font-weight: 700;
      color: #eab308;
      text-shadow: 0 0 12px rgba(234,179,8,0.15);
    }

    #sim-community {
      display: flex;
      gap: 8px;
      flex-wrap: wrap;
    }

    #sim-seats-row {
      display: flex;
      justify-content: space-between;
      align-items: flex-end;
      gap: 20px;
    }

    /* Hero seat */
    .sim-seat {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 6px;
    }

    .sim-seat-label {
      font-size: 9px;
      font-weight: 700;
      letter-spacing: 0.1em;
      text-transform: uppercase;
      color: #475569;
    }

    .sim-seat-cards {
      display: flex;
      gap: 5px;
    }

    .sim-seat-stack {
      font-size: 11px;
      color: #94a3b8;
      font-variant-numeric: tabular-nums;
    }

    #sim-hero-pos {
      font-size: 11px;
      color: #3b82f6;
      font-weight: 700;
    }

    #sim-dealer-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      background: #eab308;
      color: #0a0a0f;
      font-size: 9px;
      font-weight: 800;
      box-shadow: 0 0 8px rgba(234,179,8,0.3);
    }

    #sim-result-banner {
      display: none;
      padding: 14px 18px;
      border-radius: 8px;
      font-size: 14px;
      font-weight: 700;
      text-align: center;
    }

    /* Sidebar panel */
    #sim-sidebar {
      display: flex;
      flex-direction: column;
      gap: 12px;
    }

    #sim-action-panel {
      background: linear-gradient(180deg, rgba(15,23,42,0.5) 0%, rgba(10,15,26,0.6) 100%);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border: 1px solid rgba(30,41,59,0.4);
      border-radius: 8px;
      padding: 16px;
    }

    #sim-action-info {
      font-size: 11px;
      color: #94a3b8;
      margin-bottom: 12px;
      line-height: 1.6;
    }

    #sim-action-btns {
      display: flex;
      flex-direction: column;
      gap: 8px;
    }

    #sim-call-btn, #sim-raise-btn {
      height: 36px;
      font-size: 12px;
      font-weight: 700;
      font-family: var(--font);
      border: none;
      border-radius: 6px;
      cursor: pointer;
      width: 100%;
      transition: all 0.2s ease;
      letter-spacing: 0.03em;
    }

    #sim-call-btn  {
      background: rgba(34,197,94,0.1);
      color: #22c55e;
      border: 1px solid rgba(34,197,94,0.2);
    }
    #sim-raise-btn {
      background: rgba(239,68,68,0.1);
      color: #ef4444;
      border: 1px solid rgba(239,68,68,0.2);
    }
    #sim-call-btn:hover  { background: rgba(34,197,94,0.18); box-shadow: 0 0 12px rgba(34,197,94,0.1); }
    #sim-raise-btn:hover { background: rgba(239,68,68,0.18); box-shadow: 0 0 12px rgba(239,68,68,0.1); }

    #sim-size-row {
      display: flex;
      align-items: center;
      gap: 8px;
    }

    #sim-raise-input {
      flex: 1;
      height: 32px;
      padding: 0 10px;
      background: rgba(15,23,42,0.6);
      border: 1px solid rgba(30,41,59,0.5);
      border-radius: 6px;
      color: #e2e8f0;
      font-size: 12px;
      font-family: var(--font);
      font-variant-numeric: tabular-nums;
    }
    #sim-raise-input:focus { outline: none; border-color: rgba(239,68,68,0.35); box-shadow: 0 0 0 3px rgba(239,68,68,0.08); }

    #sim-score {
      display: flex;
      align-items: center;
      justify-content: space-between;
      font-size: 12px;
      color: #94a3b8;
    }

    #sim-reasoning-log {
      flex: 1;
      background: rgba(6,9,16,0.6);
      border: 1px solid rgba(30,41,59,0.3);
      border-radius: 6px;
      padding: 12px;
      overflow-y: auto;
      font-size: 11px;
      color: #94a3b8;
      line-height: 1.7;
      max-height: 200px;
    }

    #sim-thinking-entry {
      font-size: 10px;
      color: #64748b;
      line-height: 1.6;
    }

    /* Training overlay */
    #sim-training-overlay {
      display: none;
      position: absolute;
      inset: 0;
      background: rgba(6,9,16,0.92);
      z-index: 50;
      border-radius: 8px;
      align-items: center;
      justify-content: center;
      backdrop-filter: blur(4px);
    }

    #sim-training-inner {
      width: 360px;
      background: linear-gradient(180deg, rgba(15,23,42,0.8) 0%, rgba(10,15,26,0.9) 100%);
      border: 1px solid rgba(30,41,59,0.4);
      border-radius: 10px;
      padding: 24px;
    }

    #sim-training-toggle {
      font-size: 11px;
      color: #3b82f6;
      cursor: pointer;
      text-decoration: none;
      font-weight: 600;
      transition: color 0.15s;
    }
    #sim-training-toggle:hover { color: #60a5fa; }

    #sim-train-prompt {
      width: 100%;
      background: rgba(6,9,16,0.6);
      border: 1px solid rgba(30,41,59,0.4);
      border-radius: 6px;
      color: #e2e8f0;
      font-family: var(--font);
      font-size: 11px;
      padding: 10px;
      resize: vertical;
      min-height: 80px;
      margin: 10px 0;
    }

    #sim-train-result {
      font-size: 11px;
      color: #94a3b8;
      line-height: 1.6;
    }

    #btn-play-again {
      margin-top: 10px;
      height: 32px;
      padding: 0 18px;
      font-size: 11px;
      font-weight: 700;
      font-family: var(--font);
      background: rgba(56,130,246,0.06);
      border: 1px solid rgba(56,130,246,0.15);
      border-radius: 6px;
      color: #3b82f6;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    #btn-play-again:hover { background: rgba(56,130,246,0.12); border-color: rgba(56,130,246,0.3); color: #60a5fa; }

    /* ═══════════════════════════════════════════════════════════
       STATUS BAR
    ═══════════════════════════════════════════════════════════ */
    #statusbar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 16px;
      height: 26px;
      background: var(--glass-bg);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border-top: 1px solid var(--glass-border);
      flex-shrink: 0;
      font-size: 10px;
      color: var(--text-dim);
    }

    #statusbar-left { display: flex; align-items: center; gap: 14px; }
    #statusbar-right { display: flex; align-items: center; gap: 8px; }

    /* ═══════════════════════════════════════════════════════════
       DEBUG PANEL
    ═══════════════════════════════════════════════════════════ */
    #debug-panel {
      display: none;
      position: fixed;
      bottom: 26px;
      right: 16px;
      width: 420px;
      max-height: 200px;
      background: rgba(10,10,15,0.95);
      border: 1px solid var(--bg-border);
      border-radius: 4px;
      padding: 10px;
      overflow-y: auto;
      font-size: 10px;
      color: #4ade80;
      line-height: 1.6;
      z-index: 500;
      font-family: var(--font);
    }

    /* ═══════════════════════════════════════════════════════════
       CARD STYLES (referenced in cards.js output)
    ═══════════════════════════════════════════════════════════ */
    .card-face {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      position: relative;
      flex-shrink: 0;
    }

    .card-back {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      position: relative;
      flex-shrink: 0;
    }

    .card-slot-empty {
      display: inline-flex;
      flex-shrink: 0;
    }

    /* ═══════════════════════════════════════════════════════════
       STAT CARD
    ═══════════════════════════════════════════════════════════ */
    .stat-card {
      background: var(--glass-bg);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border: 1px solid var(--glass-border);
      border-radius: 6px;
      padding: 12px 14px;
    }

    .stat-card-label {
      font-size: 9px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--text-dim);
      margin-bottom: 4px;
    }

    .stat-card-value {
      font-size: 18px;
      font-weight: 700;
      color: var(--text-primary);
      line-height: 1;
    }

    .stat-card-sub {
      font-size: 10px;
      color: var(--text-dim);
      margin-top: 3px;
    }

    /* ═══════════════════════════════════════════════════════════
       UTILITY
    ═══════════════════════════════════════════════════════════ */
    .positive { color: var(--accent-green); }
    .negative { color: var(--accent-red); }
    .muted    { color: var(--text-muted); }
    .dim      { color: var(--text-dim); }

    .plotly-chart { width: 100%; }

    /* Confidence bar */
    .conf-bar-track {
      height: 3px;
      background: var(--bg-border);
      border-radius: 2px;
      margin-top: 4px;
    }
    .conf-bar-fill {
      height: 100%;
      border-radius: 2px;
      background: var(--accent-blue);
    }

    /* ═══════════════════════════════════════════════════════════
       RESPONSIVE / OVERFLOW
    ═══════════════════════════════════════════════════════════ */
    @media (max-width: 900px) {
      #sim-layout { grid-template-columns: 1fr; }
      #ranges-layout { grid-template-columns: 1fr; }
      #rep-stage { grid-template-columns: 1fr; }
      #dd-layout { grid-template-columns: 1fr; }
    }
  
    /* ═══════════════════════════════════════════════════════════
       UPLOAD TAB (upload screen embedded as a tab)
    ═══════════════════════════════════════════════════════════ */
    #tab-upload {
      padding: 0;
      overflow-y: auto;
    }

    #tab-upload #tab-upload-inner {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      padding: 40px 24px 60px;
      width: 100%;
      min-height: 100%;
    }

    /* Upload tab button — slightly distinct so it's easy to find */
    #tab-btn-upload {
      color: rgba(96,165,250,0.6);
    }
    #tab-btn-upload:hover { color: #93c5fd; }
    #tab-btn-upload.active { color: #e2e8f0; }

    /* ═══════════════════════════════════════════════════════════
       EMPTY STATES
    ═══════════════════════════════════════════════════════════ */
    .empty-state {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      padding: 80px 24px;
      min-height: 300px;
      animation: tabFadeIn 0.3s ease;
    }

    .empty-state-icon {
      font-size: 52px;
      line-height: 1;
      margin-bottom: 20px;
      opacity: 0.12;
      filter: grayscale(1);
    }

    .empty-state-title {
      font-size: 18px;
      font-weight: 800;
      color: #f1f5f9;
      letter-spacing: 0.02em;
      margin-bottom: 12px;
      font-family: 'Outfit', var(--font);
    }

    .empty-state-desc {
      font-size: 12px;
      color: #64748b;
      max-width: 440px;
      line-height: 1.75;
      margin-bottom: 24px;
    }

    .empty-state-desc strong {
      color: #94a3b8;
    }

    .empty-state-action {
      height: 36px;
      padding: 0 24px;
      font-size: 12px;
      font-weight: 700;
      font-family: var(--font);
      background: linear-gradient(135deg, #2563eb, #7c3aed);
      border: none;
      border-radius: 8px;
      color: white;
      cursor: pointer;
      letter-spacing: 0.04em;
      transition: all 0.25s ease;
      box-shadow: 0 2px 12px rgba(37,99,235,0.2);
    }

    .empty-state-action:hover {
      filter: brightness(1.12);
      box-shadow: 0 4px 24px rgba(59,130,246,0.3);
      transform: translateY(-1px);
    }

    /* ═══════════════════════════════════════════════════════════
       DOCS TAB
    ═══════════════════════════════════════════════════════════ */
    #tab-docs { overflow: hidden; }

    .docs-shell {
      display: grid;
      grid-template-columns: 220px 1fr;
      height: 100%;
      overflow: hidden;
    }

    .docs-sidebar {
      background: linear-gradient(180deg, rgba(10,15,26,0.95) 0%, rgba(6,9,15,0.98) 100%);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border-right: 1px solid rgba(56,130,246,0.08);
      padding: 24px 16px;
      overflow-y: auto;
      position: relative;
    }
    .docs-sidebar::after {
      content: '';
      position: absolute;
      top: 0; right: 0;
      width: 1px; height: 100%;
      background: linear-gradient(180deg, transparent, rgba(56,130,246,0.1), transparent);
    }

    .docs-sidebar-title {
      font-size: 10px;
      font-weight: 800;
      letter-spacing: 0.14em;
      color: #334155;
      text-transform: uppercase;
      margin-bottom: 18px;
      padding-bottom: 10px;
      border-bottom: 1px solid rgba(30,41,59,0.4);
    }

    .docs-nav { display: flex; flex-direction: column; gap: 2px; }

    .docs-nav-link {
      display: block;
      padding: 10px 12px;
      font-size: 12px;
      font-weight: 600;
      color: #475569;
      border-radius: 6px;
      cursor: pointer;
      transition: all 0.2s ease;
      text-decoration: none;
      border: 1px solid transparent;
    }
    .docs-nav-link:hover { color: #94a3b8; background: rgba(15,23,42,0.5); }
    .docs-nav-link.active {
      color: #e2e8f0;
      background: rgba(56,130,246,0.08);
      border-color: rgba(56,130,246,0.12);
      box-shadow: 0 0 12px rgba(56,130,246,0.05);
    }

    .docs-main {
      padding: 36px 48px 60px;
      overflow-y: auto;
      max-width: 920px;
    }

    .docs-section { display: none; }
    .docs-section.active { display: block; animation: tabFadeIn 0.2s ease; }

    .docs-h1 {
      font-size: 26px;
      font-weight: 800;
      color: #f1f5f9;
      letter-spacing: -0.01em;
      margin-bottom: 6px;
      font-family: 'Outfit', var(--font);
      line-height: 1.2;
    }

    .docs-subtitle {
      font-size: 13px;
      color: #64748b;
      margin-bottom: 32px;
      letter-spacing: 0.02em;
      line-height: 1.5;
    }

    .docs-h2 {
      font-size: 15px;
      font-weight: 700;
      color: #e2e8f0;
      letter-spacing: 0.03em;
      margin: 32px 0 16px;
      padding-bottom: 10px;
      border-bottom: 1px solid rgba(30,41,59,0.4);
      position: relative;
    }
    .docs-h2::after {
      content: '';
      position: absolute;
      bottom: -1px; left: 0;
      width: 40px; height: 2px;
      background: var(--accent-blue);
      border-radius: 1px;
    }

    .docs-text {
      font-size: 13px;
      color: #94a3b8;
      line-height: 1.75;
      margin-bottom: 18px;
    }

    /* Cards */
    .docs-card {
      background: linear-gradient(180deg, rgba(15,23,42,0.4) 0%, rgba(10,15,26,0.5) 100%);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border: 1px solid rgba(30,41,59,0.4);
      border-radius: 8px;
      padding: 18px 20px;
      margin-bottom: 12px;
      transition: border-color 0.2s;
    }
    .docs-card:hover { border-color: rgba(56,130,246,0.12); }

    .docs-card-highlight {
      border-color: rgba(59,130,246,0.2);
      background: linear-gradient(135deg, rgba(30,64,175,0.12), rgba(124,58,237,0.06));
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }

    .docs-card-highlight p { font-size: 13px; color: #94a3b8; line-height: 1.75; }

    .docs-card-icon { font-size: 28px; margin-bottom: 10px; opacity: 0.85; }
    .docs-card-title { font-size: 13px; font-weight: 700; color: #e2e8f0; margin-bottom: 8px; letter-spacing: 0.02em; }
    .docs-card-text { font-size: 12px; color: #94a3b8; line-height: 1.7; }

    .docs-list {
      list-style: none;
      padding: 0;
    }
    .docs-list li {
      font-size: 12px;
      color: #94a3b8;
      line-height: 1.7;
      padding: 4px 0;
      padding-left: 16px;
      position: relative;
    }
    .docs-list li::before {
      content: "";
      position: absolute;
      left: 2px; top: 12px;
      width: 5px; height: 5px;
      border-radius: 50%;
      background: #334155;
    }
    .docs-list li strong { color: #e2e8f0; font-weight: 600; }

    /* Grids */
    .docs-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
    .docs-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

    /* Flow diagram */
    .docs-flow-diagram {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 24px 20px;
      background: linear-gradient(180deg, rgba(15,23,42,0.4) 0%, rgba(10,15,26,0.5) 100%);
      border: 1px solid rgba(30,41,59,0.4);
      border-radius: 8px;
      margin-bottom: 18px;
      overflow-x: auto;
    }

    .docs-flow-step {
      text-align: center;
      min-width: 130px;
      flex: 1;
    }

    .docs-flow-num {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      border-radius: 50%;
      background: rgba(59,130,246,0.12);
      border: 1px solid rgba(59,130,246,0.2);
      color: var(--accent-blue);
      font-size: 13px;
      font-weight: 800;
      margin-bottom: 8px;
    }

    .docs-flow-label {
      font-size: 12px;
      font-weight: 700;
      color: #e2e8f0;
      margin-bottom: 4px;
    }

    .docs-flow-desc {
      font-size: 11px;
      color: #64748b;
      line-height: 1.5;
    }

    .docs-flow-arrow {
      font-size: 18px;
      color: #334155;
      flex-shrink: 0;
    }

    /* Parent archetype cards */
    .docs-parent-card {
      background: linear-gradient(180deg, rgba(15,23,42,0.4) 0%, rgba(10,15,26,0.5) 100%);
      border: 1px solid rgba(30,41,59,0.4);
      border-radius: 8px;
      padding: 16px 18px;
      margin-bottom: 10px;
      transition: border-color 0.2s;
    }
    .docs-parent-card:hover { border-color: rgba(56,130,246,0.1); }

    .docs-parent-badge {
      display: inline-block;
      font-size: 11px;
      font-weight: 800;
      padding: 3px 12px;
      border-radius: 999px;
      letter-spacing: 0.06em;
      margin-bottom: 8px;
    }

    .docs-parent-full {
      font-size: 13px;
      font-weight: 600;
      color: #e2e8f0;
      margin-bottom: 6px;
    }

    .docs-parent-desc {
      font-size: 12px;
      color: #94a3b8;
      line-height: 1.6;
      margin-bottom: 8px;
    }

    .docs-parent-stats {
      font-size: 11px;
      color: #64748b;
      font-family: var(--font);
      font-variant-numeric: tabular-nums;
    }

    /* Sub-archetype grid */
    .docs-arch-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
      gap: 12px;
    }

    .docs-sub-card {
      background: linear-gradient(180deg, rgba(15,23,42,0.4) 0%, rgba(10,15,26,0.5) 100%);
      border: 1px solid rgba(30,41,59,0.4);
      border-radius: 8px;
      padding: 16px;
      transition: border-color 0.2s;
    }
    .docs-sub-card:hover { border-color: rgba(56,130,246,0.1); }

    .docs-sub-header {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 10px;
    }

    .docs-sub-badge {
      font-size: 10px;
      font-weight: 700;
      padding: 3px 10px;
      border-radius: 999px;
      letter-spacing: 0.04em;
    }

    .docs-sub-parent {
      font-size: 10px;
      color: #475569;
    }

    .docs-sub-desc {
      font-size: 12px;
      color: #94a3b8;
      line-height: 1.6;
      margin-bottom: 10px;
    }

    .docs-sub-stats {
      display: flex;
      gap: 14px;
      font-size: 10px;
      color: #64748b;
      font-family: var(--font);
      font-variant-numeric: tabular-nums;
      padding-top: 8px;
      border-top: 1px solid rgba(30,41,59,0.3);
    }

    /* Pipeline stages */
    .docs-pipeline { margin-bottom: 28px; }

    .docs-pipe-stage {
      background: linear-gradient(180deg, rgba(15,23,42,0.4) 0%, rgba(10,15,26,0.5) 100%);
      border: 1px solid rgba(30,41,59,0.4);
      border-radius: 8px;
      overflow: hidden;
      transition: border-color 0.2s;
    }
    .docs-pipe-stage:hover { border-color: rgba(56,130,246,0.1); }

    .docs-pipe-header {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 18px;
      background: rgba(56,130,246,0.03);
      border-bottom: 1px solid rgba(30,41,59,0.3);
    }

    .docs-pipe-num {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 24px;
      height: 24px;
      border-radius: 50%;
      background: var(--accent-blue);
      color: white;
      font-size: 11px;
      font-weight: 800;
      flex-shrink: 0;
      box-shadow: 0 0 10px rgba(59,130,246,0.2);
    }

    .docs-pipe-title {
      font-size: 13px;
      font-weight: 700;
      color: #e2e8f0;
    }

    .docs-pipe-script {
      margin-left: auto;
      font-size: 10px;
      color: var(--accent-purple);
      font-family: var(--font);
      background: rgba(168,85,247,0.08);
      padding: 3px 10px;
      border-radius: 999px;
      border: 1px solid rgba(168,85,247,0.15);
    }

    .docs-pipe-body {
      padding: 16px 18px;
    }

    .docs-pipe-body p {
      font-size: 12px;
      color: #94a3b8;
      line-height: 1.7;
      margin-top: 12px;
    }

    .docs-pipe-io {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-wrap: wrap;
    }

    .docs-pipe-in, .docs-pipe-out {
      font-size: 10px;
      font-family: var(--font);
      padding: 4px 12px;
      border-radius: 999px;
    }

    .docs-pipe-in {
      background: rgba(239,68,68,0.08);
      color: #f87171;
      border: 1px solid rgba(239,68,68,0.15);
    }

    .docs-pipe-out {
      background: rgba(34,197,94,0.08);
      color: #4ade80;
      border: 1px solid rgba(34,197,94,0.15);
    }

    .docs-pipe-arrow { color: #334155; font-size: 16px; }

    .docs-pipe-connector {
      width: 2px;
      height: 18px;
      background: linear-gradient(180deg, rgba(56,130,246,0.15), rgba(30,41,59,0.4));
      margin: 0 auto;
    }

    .docs-pipe-outputs {
      margin-top: 12px;
      display: flex;
      flex-direction: column;
      gap: 5px;
      font-size: 11px;
      color: #64748b;
    }

    .docs-pipe-out-tag {
      display: inline;
      font-family: var(--font);
      color: #4ade80;
      font-weight: 600;
      margin-right: 8px;
    }

    /* Script reference cards */
    .docs-script-list { display: flex; flex-direction: column; gap: 14px; }

    .docs-script-card {
      background: linear-gradient(180deg, rgba(15,23,42,0.4) 0%, rgba(10,15,26,0.5) 100%);
      border: 1px solid rgba(30,41,59,0.4);
      border-radius: 8px;
      padding: 18px 20px;
      transition: border-color 0.2s;
    }
    .docs-script-card:hover { border-color: rgba(56,130,246,0.1); }

    .docs-script-header {
      display: flex;
      align-items: center;
      gap: 10px;
      margin-bottom: 8px;
    }

    .docs-script-name {
      font-size: 14px;
      font-weight: 700;
      color: #c084fc;
      font-family: var(--font);
    }

    .docs-script-version {
      font-size: 9px;
      color: #475569;
      background: rgba(30,41,59,0.4);
      padding: 2px 8px;
      border-radius: 999px;
      border: 1px solid rgba(30,41,59,0.5);
    }

    .docs-script-purpose {
      font-size: 12px;
      font-weight: 600;
      color: #e2e8f0;
      margin-bottom: 12px;
    }

    .docs-script-details { margin-bottom: 12px; }

    .docs-kv {
      font-size: 11px;
      line-height: 1.9;
    }
    .docs-k { color: #64748b; font-weight: 600; margin-right: 4px; }
    .docs-v { color: #94a3b8; }

    .docs-script-explain {
      font-size: 12px;
      color: #94a3b8;
      line-height: 1.7;
      padding-top: 12px;
      border-top: 1px solid rgba(30,41,59,0.3);
    }

    .docs-script-explain em { color: #e2e8f0; font-style: normal; font-weight: 600; }

    /* File format cards */
    .docs-file-grid { display: flex; flex-direction: column; gap: 14px; }

    .docs-file-card {
      background: linear-gradient(180deg, rgba(15,23,42,0.4) 0%, rgba(10,15,26,0.5) 100%);
      border: 1px solid rgba(30,41,59,0.4);
      border-radius: 8px;
      padding: 18px 20px;
      transition: border-color 0.2s;
    }
    .docs-file-card:hover { border-color: rgba(56,130,246,0.1); }

    .docs-file-required { border-color: rgba(239,68,68,0.15); }
    .docs-file-required:hover { border-color: rgba(239,68,68,0.25); }

    .docs-file-header {
      display: flex;
      align-items: center;
      gap: 8px;
      margin-bottom: 10px;
      flex-wrap: wrap;
    }

    .docs-file-name {
      font-size: 13px;
      font-weight: 700;
      color: #e2e8f0;
      font-family: var(--font);
    }

    .docs-file-badge {
      font-size: 9px;
      font-weight: 700;
      padding: 2px 8px;
      border-radius: 999px;
      letter-spacing: 0.06em;
    }

    .docs-badge-required { background: rgba(239,68,68,0.12); color: #ef4444; border: 1px solid rgba(239,68,68,0.2); }
    .docs-badge-optional { background: rgba(100,116,139,0.1); color: #94a3b8; border: 1px solid rgba(100,116,139,0.15); }
    .docs-badge-jsonl { background: rgba(168,85,247,0.08); color: #c084fc; border: 1px solid rgba(168,85,247,0.15); }
    .docs-badge-json { background: rgba(59,130,246,0.08); color: #60a5fa; border: 1px solid rgba(59,130,246,0.15); }
    .docs-badge-csv { background: rgba(34,197,94,0.08); color: #4ade80; border: 1px solid rgba(34,197,94,0.15); }

    .docs-file-desc {
      font-size: 12px;
      color: #94a3b8;
      line-height: 1.7;
      margin-bottom: 10px;
    }

    .docs-file-used {
      font-size: 11px;
      color: #64748b;
      line-height: 1.6;
      margin-bottom: 6px;
    }
    .docs-file-used strong { color: #94a3b8; }

    .docs-file-note {
      font-size: 11px;
      color: var(--accent-yellow);
      opacity: 0.85;
    }

    .docs-code {
      background: rgba(6,9,16,0.8);
      border: 1px solid rgba(30,41,59,0.4);
      border-radius: 6px;
      padding: 12px 14px;
      font-size: 11px;
      font-family: var(--font);
      color: #64748b;
      overflow-x: auto;
      line-height: 1.6;
      margin-top: 10px;
    }

    /* HUD tabs guide */
    .docs-tabs-list { display: flex; flex-direction: column; gap: 12px; }

    .docs-tab-card {
      background: linear-gradient(180deg, rgba(15,23,42,0.4) 0%, rgba(10,15,26,0.5) 100%);
      border: 1px solid rgba(30,41,59,0.4);
      border-radius: 8px;
      padding: 16px 20px;
      transition: border-color 0.2s;
    }
    .docs-tab-card:hover { border-color: rgba(56,130,246,0.1); }

    .docs-tab-header {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 10px;
      flex-wrap: wrap;
    }

    .docs-tab-icon { font-size: 18px; opacity: 0.7; }

    .docs-tab-name {
      font-size: 14px;
      font-weight: 700;
      color: #e2e8f0;
    }

    .docs-tab-requires {
      margin-left: auto;
      font-size: 9px;
      color: #64748b;
      font-family: var(--font);
      background: rgba(30,41,59,0.3);
      padding: 3px 10px;
      border-radius: 999px;
      border: 1px solid rgba(30,41,59,0.4);
    }

    .docs-tab-card p {
      font-size: 12px;
      color: #94a3b8;
      line-height: 1.7;
    }

    /* Docs responsive */
    @media (max-width: 768px) {
      .docs-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
      .docs-sidebar {
        border-right: none;
        border-bottom: 1px solid rgba(30,41,59,0.4);
        padding: 10px;
      }
      .docs-sidebar::after { display: none; }
      .docs-nav { flex-direction: row; flex-wrap: wrap; gap: 4px; }
      .docs-nav-link { padding: 6px 8px; font-size: 10px; }
      .docs-main { padding: 20px 16px 40px; }
      .docs-h1 { font-size: 20px; }
      .docs-grid-2, .docs-grid-3 { grid-template-columns: 1fr; }
      .docs-flow-diagram { flex-direction: column; }
      .docs-flow-arrow { transform: rotate(90deg); }
      .docs-arch-grid { grid-template-columns: 1fr; }
      .docs-tab-requires { margin-left: 0; }
    }

    /* ═══════════════════════════════════════════════════════════
       ENHANCED MOBILE RESPONSIVENESS
    ═══════════════════════════════════════════════════════════ */

    /* Ranges grid responsive (48px cells = 674px, add margins/padding) */
    @media (max-width: 690px) {
      #ranges-layout { grid-template-columns: 1fr !important; grid-template-rows: auto 1fr; }
      #ranges-sidebar {
        border-right: none !important;
        border-bottom: 1px solid var(--bg-border);
        padding: 10px;
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        overflow-x: auto;
      }
      #ranges-sidebar .section-title { width: 100%; }
      #ranges-arch-pills, #ranges-pos-pills, #ranges-view-pills {
        flex-direction: row !important;
        flex-wrap: wrap;
        gap: 4px;
        margin-bottom: 0 !important;
      }
      .ranges-pill { height: 26px; font-size: 10px; padding: 0 8px; }
    }

    /* Small tablets and large phones */
    @media (max-width: 768px) {
      /* Unified bar compact */
      #tab-nav { padding: 0 12px; gap: 8px; height: 46px; }
      #topbar-logo .logo-text { display: none; }
      #topbar-logo .logo-svg { width: 24px; height: 24px; }
      #meta-status { display: none; }
      .tab-btn { padding: 0 clamp(6px, 1.3vw, 10px); font-size: clamp(9px, 1.3vw, 10px); height: clamp(28px, 4.2vw, 32px); border-radius: 5px; }
      .tab-btn .tab-icon { font-size: clamp(9px, 1.4vw, 11px); }
      .tab-btn.active::after { width: 12px; bottom: 3px; }
      .tab-sep { display: none; }

      /* Pool toolbar stacking */
      #pool-toolbar { flex-direction: column; align-items: stretch; gap: 8px; padding: 8px 10px; }
      #pool-search { width: 100%; }
      #pool-count { margin-left: 0; text-align: right; }

      /* Simulator: stack felt above sidebar */
      #sim-layout { grid-template-columns: 1fr !important; grid-template-rows: auto auto; gap: 8px; }
      #sim-seats-row { flex-direction: row; gap: 10px; }

      /* Replayer: let it scroll */
      #tab-replayer { overflow-y: auto !important; }

      /* Deep dive stat boxes wrap better */
      #dd-stats-grid { flex-wrap: wrap; }
      .dd-stat-box { min-width: clamp(50px, 9vw, 70px); padding: clamp(5px, 1vw, 8px) clamp(8px, 1.5vw, 12px); }
      .dd-stat-value { font-size: clamp(14px, 2.6vw, 20px); }

      /* Upload screen tighter padding */
      #tab-upload-inner { padding: 20px 12px 40px !important; }

      /* Onboarding responsive */
      #onboarding-guide { margin-bottom: 16px; }
      #onboarding-guide > div { padding: 14px 16px; }

      /* H2N hand table: horizontal scroll */
      .h2n-hdr, .h2n-row { min-width: 900px; }

      /* Status bar compact */
      #statusbar { font-size: 9px; padding: 0 10px; }
    }

    /* Phones only */
    @media (max-width: 480px) {
      #topbar-logo .logo-text { font-size: clamp(9px, 2.3vw, 11px); }
      .tab-btn { padding: 0 clamp(4px, 1.2vw, 6px); font-size: clamp(7px, 1.9vw, 9px); height: clamp(24px, 5.8vw, 28px); gap: 3px; border-radius: 4px; }
      .tab-btn .tab-icon { display: none; }
      .tab-btn.active::after { width: 10px; bottom: 2px; }

      .empty-state { padding: 40px 16px; min-height: 200px; }
      .empty-state-icon { font-size: 36px; }
      .empty-state-title { font-size: 14px; }

      /* Stat boxes single column */
      .dd-stat-box { min-width: 100%; border-right: none; border-bottom: 1px solid #1e293b; }
      .dd-stat-box:last-child { border-bottom: none; }

      /* Action buttons full width */
      #topbar-actions { gap: 4px; }
      #topbar-actions .btn { padding: 0 8px; font-size: 10px; height: 24px; }
    }

    /* ═══════════════════════════════════════════════════════════
       TOPBAR ICON BUTTONS (Profile / Settings)
    ═══════════════════════════════════════════════════════════ */
    .topbar-icon-btn {
      height: 34px !important;
      width: 34px;
      padding: 0 !important;
      font-size: 14px !important;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 6px;
      border: 1px solid transparent !important;
      transition: all 0.2s ease;
    }
    .topbar-icon-btn .tab-icon { font-size: 14px !important; opacity: 0.4; }
    .topbar-icon-btn:hover {
      background: rgba(255,255,255,0.06) !important;
      border-color: rgba(255,255,255,0.08) !important;
    }
    .topbar-icon-btn:hover .tab-icon { opacity: 0.9; }
    .topbar-icon-btn.active {
      background: rgba(59,130,246,0.12) !important;
      border-color: rgba(59,130,246,0.2) !important;
      box-shadow: 0 0 8px rgba(59,130,246,0.1);
    }
    .topbar-icon-btn.active::after { display: none; }
    .topbar-icon-btn.active .tab-icon { opacity: 1; color: #60a5fa; }

    /* No-animation mode */
    .no-animations * { transition: none !important; animation: none !important; }
    .compact-mode #tab-body { font-size: 12px; }
    .compact-mode .tab-content { padding: 8px; }

    /* ═══════════════════════════════════════════════════════════
       PROFILE TAB
    ═══════════════════════════════════════════════════════════ */
    /* ═══════════════════════════════════════════════════════════
       PROFILE — RPG-Style Gamified Player Profile
       ═══════════════════════════════════════════════════════════ */
    .pf-rpg { max-width: 1000px; margin: 0 auto; padding: 20px 16px 40px; }

    /* ── Hero Card ── */
    .pf-hero-card {
      position: relative; border-radius: 14px; overflow: hidden;
      margin-bottom: 14px;
      border: 1px solid rgba(255,255,255,0.08);
    }
    .pf-hero-bg {
      position: absolute; inset: 0;
      background: linear-gradient(135deg,
        rgba(30,64,175,0.35) 0%,
        rgba(124,58,237,0.2) 40%,
        rgba(6,182,212,0.1) 100%);
      z-index: 0;
    }
    .pf-hero-bg::after {
      content: "";
      position: absolute; inset: 0;
      background: repeating-linear-gradient(
        0deg, transparent, transparent 2px,
        rgba(255,255,255,0.015) 2px, rgba(255,255,255,0.015) 4px);
      pointer-events: none;
    }
    .pf-hero-content {
      position: relative; z-index: 1;
      display: flex; align-items: flex-start; justify-content: space-between;
      padding: 22px 24px 20px;
    }
    .pf-hero-left { display: flex; align-items: flex-start; gap: 18px; flex: 1; min-width: 0; }
    .pf-hero-right { flex-shrink: 0; padding-top: 2px; }

    /* Avatar */
    .pf-hero-avatar-wrap { position: relative; flex-shrink: 0; }
    .pf-hero-avatar {
      width: 72px; height: 72px;
      background: linear-gradient(135deg, #1e1b4b 0%, #0f172a 100%);
      border-radius: 14px;
      display: flex; align-items: center; justify-content: center;
      font-size: 34px; user-select: none;
      position: relative; z-index: 2;
      box-shadow: 0 0 20px var(--tier-glow, rgba(59,130,246,0.3));
    }
    .pf-hero-avatar-ring {
      position: absolute; inset: -3px;
      border-radius: 16px;
      border: 2px solid var(--tier-color, #3b82f6);
      z-index: 1;
      box-shadow: 0 0 12px var(--tier-glow, rgba(59,130,246,0.3));
    }
    .pf-hero-level-badge {
      position: absolute; bottom: -6px; right: -6px; z-index: 3;
      min-width: 26px; height: 26px; padding: 0 6px;
      background: linear-gradient(135deg, var(--tier-color, #3b82f6), #1e1b4b);
      border: 2px solid var(--tier-color, #3b82f6);
      border-radius: 8px;
      color: #fff; font-size: 11px; font-weight: 900;
      display: flex; align-items: center; justify-content: center;
      box-shadow: 0 2px 8px rgba(0,0,0,0.5);
      font-family: var(--font);
    }
    .pf-hero-avatar-edit {
      position: absolute; top: -4px; right: -4px; z-index: 3;
      width: 22px; height: 22px;
      background: rgba(15,23,42,0.9); border: 1px solid rgba(255,255,255,0.15);
      border-radius: 6px; color: #94a3b8; font-size: 11px;
      cursor: pointer; display: flex; align-items: center; justify-content: center;
      transition: all 0.15s; opacity: 0;
    }
    .pf-hero-avatar-wrap:hover .pf-hero-avatar-edit { opacity: 1; }
    .pf-hero-avatar-edit:hover { background: var(--accent-blue); color: #fff; border-color: var(--accent-blue); }

    /* Hero Info */
    .pf-hero-info { flex: 1; min-width: 0; }
    .pf-hero-name-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
    .pf-hero-name {
      background: transparent; border: 1px solid transparent; border-radius: 6px;
      color: #f1f5f9; font-size: 22px; font-weight: 900;
      font-family: var(--font); padding: 1px 6px; max-width: 260px;
      transition: border-color 0.15s; letter-spacing: -0.01em;
    }
    .pf-hero-name:hover { border-color: rgba(255,255,255,0.1); }
    .pf-hero-name:focus { border-color: var(--accent-blue); outline: none; }

    .pf-hero-rank {
      display: inline-flex; align-items: center; gap: 5px;
      padding: 3px 12px; border-radius: 8px;
      font-size: 11px; font-weight: 800; letter-spacing: 0.06em;
      white-space: nowrap;
      color: var(--rank-color, #3b82f6);
      background: color-mix(in srgb, var(--rank-color, #3b82f6) 12%, transparent);
      border: 1px solid color-mix(in srgb, var(--rank-color, #3b82f6) 25%, transparent);
      text-shadow: 0 0 12px var(--rank-color, #3b82f6);
    }

    .pf-hero-sub {
      font-size: 11px; color: #64748b; margin-top: 4px; padding-left: 8px;
    }

    /* XP Bar */
    .pf-hero-xp-row { margin-top: 10px; padding-left: 8px; }
    .pf-hero-xp-bar {
      height: 8px; border-radius: 4px;
      background: rgba(255,255,255,0.06);
      position: relative; overflow: hidden;
      max-width: 340px;
    }
    .pf-hero-xp-fill {
      height: 100%; border-radius: 4px;
      background: linear-gradient(90deg, var(--tier-color, #3b82f6), color-mix(in srgb, var(--tier-color, #3b82f6) 60%, #fff));
      transition: width 0.8s ease;
      position: relative;
    }
    .pf-hero-xp-shimmer {
      position: absolute; top: 0; left: -50%; width: 50%; height: 100%;
      background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
      animation: pf-shimmer 2.5s infinite;
    }
    @keyframes pf-shimmer {
      0% { left: -50%; }
      100% { left: 150%; }
    }
    .pf-hero-xp-text {
      font-size: 10px; color: #64748b; margin-top: 3px; display: block;
      font-weight: 600;
    }

    /* Streak */
    .pf-hero-streak {
      font-size: 11px; color: #94a3b8; margin-top: 6px; padding-left: 8px;
    }
    .pf-streak-fire { font-size: 13px; animation: pf-fire 0.6s ease-in-out infinite alternate; }
    @keyframes pf-fire { 0% { transform: scale(1); } 100% { transform: scale(1.15); } }
    .pf-streak-dim { font-size: 13px; opacity: 0.3; filter: grayscale(1); }
    .pf-hero-streak strong { color: #f59e0b; font-weight: 800; }
    .pf-streak-best { color: #475569; font-size: 10px; }

    /* Edit Toggle */
    .pf-edit-toggle {
      background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
      border-radius: 8px; color: #94a3b8; font-size: 11px;
      font-family: var(--font); font-weight: 700; padding: 7px 16px;
      cursor: pointer; transition: all 0.15s; white-space: nowrap;
      letter-spacing: 0.03em;
    }
    .pf-edit-toggle:hover { background: rgba(255,255,255,0.1); color: #f1f5f9; }
    .pf-edit-toggle--open { background: rgba(239,68,68,0.12); border-color: rgba(239,68,68,0.25); color: #f87171; }

    /* ── Edit Panel ── */
    .pf-edit-panel {
      background: rgba(15,23,42,0.6); backdrop-filter: blur(8px);
      border: 1px solid rgba(255,255,255,0.06); border-radius: 12px;
      padding: 18px 20px; margin-bottom: 14px;
    }
    .pf-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
    @media (max-width: 600px) { .pf-edit-grid { grid-template-columns: 1fr; } }
    .pf-field { display: flex; flex-direction: column; gap: 4px; }
    .pf-label {
      font-size: 9px; font-weight: 700; color: var(--text-dim);
      text-transform: uppercase; letter-spacing: 0.08em;
    }
    .pf-input {
      background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.08);
      border-radius: 6px; color: #94a3b8; font-size: 12px;
      font-family: var(--font); padding: 7px 10px; transition: border-color 0.15s;
    }
    .pf-input:focus { border-color: var(--accent-blue); outline: none; color: #f1f5f9; }
    .pf-bio { min-height: 50px; max-height: 90px; resize: vertical; line-height: 1.5; }
    .pf-notes { min-height: 60px; max-height: 120px; resize: vertical; line-height: 1.5; }
    .pf-select { cursor: pointer; }
    .pf-edit-actions { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
    .pf-save {
      padding: 7px 24px; border-radius: 6px;
      background: var(--accent-gradient);
      border: none; color: white; font-size: 11px; font-weight: 700;
      font-family: var(--font); letter-spacing: 0.08em;
      cursor: pointer; transition: all 0.15s;
    }
    .pf-save:hover { filter: brightness(1.15); }
    .pf-save--ok { background: linear-gradient(135deg, #059669, #10b981); }
    .pf-member-date { font-size: 10px; color: var(--text-dim); }

    /* ── Power Stats ── */
    .pf-power-stats {
      display: grid; grid-template-columns: repeat(6, 1fr);
      gap: 8px; margin-bottom: 14px;
    }
    @media (max-width: 700px) { .pf-power-stats { grid-template-columns: repeat(3, 1fr); } }
    @media (max-width: 400px) { .pf-power-stats { grid-template-columns: repeat(2, 1fr); } }
    .pf-power-stat {
      background: rgba(15,23,42,0.5);
      border: 1px solid rgba(255,255,255,0.06); border-radius: 10px;
      padding: 14px 10px 10px; text-align: center;
      transition: all 0.2s; position: relative; overflow: hidden;
    }
    .pf-power-stat:hover {
      border-color: rgba(255,255,255,0.12);
      transform: translateY(-1px);
      box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    }
    .pf-power-icon { font-size: 18px; margin-bottom: 4px; }
    .pf-power-value { font-size: 22px; font-weight: 900; line-height: 1; }
    .pf-power-label {
      font-size: 8px; color: #475569; margin-top: 4px;
      text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
    }
    .pf-power-bar {
      height: 3px; background: rgba(255,255,255,0.04);
      border-radius: 2px; margin-top: 8px; overflow: hidden;
    }
    .pf-power-bar-fill {
      height: 100%; border-radius: 2px;
      transition: width 0.8s ease;
    }

    /* ── Panels (shared) ── */
    .pf-panel {
      background: rgba(15,23,42,0.5);
      border: 1px solid rgba(255,255,255,0.06);
      border-radius: 12px; padding: 16px 18px;
      margin-bottom: 14px;
    }
    .pf-panel-header {
      display: flex; align-items: center; gap: 6px;
      font-size: 11px; font-weight: 800; color: #94a3b8;
      letter-spacing: 0.1em; text-transform: uppercase;
      margin-bottom: 12px;
    }
    .pf-panel-icon { font-size: 14px; }

    /* ── Middle Row: Radar + Right Column ── */
    .pf-middle-row {
      display: grid; grid-template-columns: 1fr 1fr;
      gap: 14px; margin-bottom: 0;
    }
    @media (max-width: 700px) { .pf-middle-row { grid-template-columns: 1fr; } }
    .pf-right-col { display: flex; flex-direction: column; gap: 14px; }
    .pf-right-col .pf-panel { margin-bottom: 0; }

    .pf-chart-container { width: 100%; height: 260px; }
    .pf-chart-sm { height: 140px; }
    .pf-radar-panel { margin-bottom: 0; }

    .pf-empty-hint {
      font-size: 11px; color: #475569; text-align: center;
      padding: 12px 0; font-style: italic;
    }

    /* ── IQ Panel ── */
    .pf-iq-current {
      margin-left: auto;
      font-size: 18px; font-weight: 900; color: #8b5cf6;
      letter-spacing: -0.02em; text-transform: none;
    }

    /* ── Daily Challenge ── */
    .pf-challenge-panel { border-color: rgba(245,158,11,0.2); }
    .pf-challenge--done { border-color: rgba(16,185,129,0.25); }
    .pf-challenge-body { display: flex; align-items: center; gap: 12px; }
    .pf-challenge-icon { font-size: 28px; flex-shrink: 0; }
    .pf-challenge-info { flex: 1; min-width: 0; }
    .pf-challenge-text { font-size: 13px; font-weight: 700; color: #e2e8f0; }
    .pf-challenge-bar-wrap { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
    .pf-challenge-bar {
      flex: 1; height: 6px; background: rgba(255,255,255,0.06);
      border-radius: 3px; overflow: hidden;
    }
    .pf-challenge-bar-fill {
      height: 100%; background: linear-gradient(90deg, #f59e0b, #ef4444);
      border-radius: 3px; transition: width 0.5s;
    }
    .pf-challenge--done .pf-challenge-bar-fill { background: linear-gradient(90deg, #10b981, #059669); }
    .pf-challenge-progress { font-size: 10px; color: #94a3b8; font-weight: 700; white-space: nowrap; }
    .pf-challenge-check {
      width: 26px; height: 26px; border-radius: 50%;
      background: #10b981; color: #fff; font-size: 14px; font-weight: 900;
      display: flex; align-items: center; justify-content: center;
      box-shadow: 0 0 12px rgba(16,185,129,0.4);
    }

    /* ── Activity Heatmap ── */
    .pf-heatmap-panel { overflow: hidden; }
    .pf-heatmap-info { margin-left: auto; font-size: 10px; color: #475569; font-weight: 600; text-transform: none; }
    .pf-heatmap-grid {
      display: grid;
      grid-template-rows: repeat(7, 1fr);
      grid-auto-flow: column;
      grid-auto-columns: 1fr;
      gap: 2px;
      width: 100%; min-height: 90px;
    }
    .pf-heatmap-cell {
      aspect-ratio: 1; border-radius: 2px;
      min-width: 0; min-height: 0;
    }
    .pf-heatmap-0 { background: rgba(255,255,255,0.03); }
    .pf-heatmap-1 { background: rgba(59,130,246,0.2); }
    .pf-heatmap-2 { background: rgba(59,130,246,0.4); }
    .pf-heatmap-3 { background: rgba(59,130,246,0.6); }
    .pf-heatmap-4 { background: rgba(59,130,246,0.85); }
    .pf-heatmap-legend {
      display: flex; align-items: center; gap: 3px;
      justify-content: flex-end; margin-top: 6px;
      font-size: 9px; color: #475569;
    }
    .pf-heatmap-legend .pf-heatmap-cell { width: 10px; height: 10px; flex-shrink: 0; aspect-ratio: auto; }
    .pf-heatmap-less { margin-right: 3px; }
    .pf-heatmap-more { margin-left: 3px; }

    /* ── Achievements ── */
    .pf-ach-panel .pf-panel-header { margin-bottom: 14px; }
    .pf-ach-meter { display: flex; align-items: center; gap: 10px; margin-left: auto; }
    .pf-ach-track {
      width: 140px; height: 6px; background: rgba(255,255,255,0.06);
      border-radius: 3px; overflow: hidden;
    }
    .pf-ach-fill {
      height: 100%; border-radius: 3px;
      background: linear-gradient(90deg, #3b82f6, #8b5cf6);
      transition: width 0.6s ease;
    }
    .pf-ach-count { font-size: 11px; color: #3b82f6; font-weight: 700; white-space: nowrap; text-transform: none; }

    .pf-ach-category { margin-bottom: 16px; }
    .pf-ach-category:last-child { margin-bottom: 0; }
    .pf-ach-cat-label {
      font-size: 10px; font-weight: 700; color: #64748b;
      letter-spacing: 0.06em; text-transform: uppercase;
      margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
    }
    .pf-ach-cat-count { font-size: 9px; color: #475569; font-weight: 600; margin-left: 4px; }
    .pf-ach-cat-grid {
      display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
      gap: 6px;
    }

    /* Badge card */
    .pf-badge {
      display: flex; align-items: center; gap: 10px;
      background: rgba(10,15,30,0.5); border: 1px solid rgba(255,255,255,0.04);
      border-radius: 8px; padding: 10px 12px;
      opacity: 0.35; transition: all 0.25s;
      position: relative; overflow: hidden;
    }
    .pf-badge:hover { opacity: 0.5; }
    .pf-badge--on { opacity: 1; }
    .pf-badge--on:hover { transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }

    /* Rarity borders for unlocked */
    .pf-badge--on.pf-badge--common { border-color: rgba(59,130,246,0.25); background: rgba(59,130,246,0.05); }
    .pf-badge--on.pf-badge--rare { border-color: rgba(139,92,246,0.35); background: rgba(139,92,246,0.06); }
    .pf-badge--on.pf-badge--epic { border-color: rgba(245,158,11,0.35); background: rgba(245,158,11,0.06); }
    .pf-badge--on.pf-badge--legendary { border-color: rgba(244,114,182,0.4); background: rgba(244,114,182,0.08); }

    /* Glow effect for rare+ */
    .pf-badge-glow {
      position: absolute; inset: 0; opacity: 0; pointer-events: none;
      transition: opacity 0.3s;
    }
    .pf-badge--on.pf-badge--rare .pf-badge-glow { opacity: 1; background: radial-gradient(ellipse at 20% 50%, rgba(139,92,246,0.1) 0%, transparent 70%); }
    .pf-badge--on.pf-badge--epic .pf-badge-glow { opacity: 1; background: radial-gradient(ellipse at 20% 50%, rgba(245,158,11,0.12) 0%, transparent 70%); }
    .pf-badge--on.pf-badge--legendary .pf-badge-glow {
      opacity: 1;
      background: radial-gradient(ellipse at 20% 50%, rgba(244,114,182,0.15) 0%, transparent 70%);
      animation: pf-glow-pulse 2s ease-in-out infinite alternate;
    }
    @keyframes pf-glow-pulse {
      0% { opacity: 0.6; }
      100% { opacity: 1; }
    }

    .pf-badge-icon { font-size: 24px; flex-shrink: 0; width: 30px; text-align: center; position: relative; z-index: 1; }
    .pf-badge:not(.pf-badge--on) .pf-badge-icon { filter: grayscale(1); }
    .pf-badge-info { flex: 1; min-width: 0; position: relative; z-index: 1; }
    .pf-badge-name { font-size: 11px; font-weight: 700; color: #e2e8f0; }
    .pf-badge:not(.pf-badge--on) .pf-badge-name { color: #475569; }
    .pf-badge-desc { font-size: 9px; color: #475569; line-height: 1.3; margin-top: 1px; }
    .pf-badge-date { font-size: 8px; color: #3b82f6; margin-top: 2px; font-weight: 600; }

    .pf-badge-check {
      width: 20px; height: 20px; border-radius: 50%;
      background: #10b981; color: white; font-size: 11px; font-weight: 700;
      display: flex; align-items: center; justify-content: center;
      flex-shrink: 0; position: relative; z-index: 1;
      box-shadow: 0 0 8px rgba(16,185,129,0.3);
    }
    .pf-badge--epic .pf-badge-check { background: #f59e0b; box-shadow: 0 0 8px rgba(245,158,11,0.4); }
    .pf-badge--legendary .pf-badge-check { background: #f472b6; box-shadow: 0 0 8px rgba(244,114,182,0.4); }

    .pf-badge-progress {
      position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
      background: rgba(255,255,255,0.04); z-index: 1;
    }
    .pf-badge-progress-fill {
      height: 100%; background: #3b82f6; border-radius: 0 3px 0 0;
      transition: width 0.4s;
    }

    /* ── Hero Name Group ── */
    .pf-hero-name-group {
      margin-top: 8px; padding: 0 4px;
    }

    /* ═══════════════════════════════════════════════════════════
       SETTINGS TAB
    ═══════════════════════════════════════════════════════════ */
    .settings-shell {
      display: grid; grid-template-columns: 200px 1fr;
      height: 100%; overflow: hidden;
    }
    @media (max-width: 700px) {
      .settings-shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
      .settings-sidebar { flex-direction: row; overflow-x: auto; border-right: none !important; border-bottom: 1px solid var(--bg-border); padding: 8px; }
    }

    .settings-sidebar {
      background: rgba(10,12,18,0.6);
      border-right: 1px solid var(--bg-border);
      padding: 16px 12px;
      display: flex; flex-direction: column; gap: 2px;
      overflow-y: auto;
    }

    .settings-nav-title {
      font-size: 10px; font-weight: 700; color: var(--text-dim);
      letter-spacing: 0.1em; padding: 8px 10px 12px; text-transform: uppercase;
    }

    .settings-nav-btn {
      background: transparent; border: none; color: var(--text-dim);
      font-size: 12px; font-weight: 500; font-family: var(--font);
      padding: 8px 12px; border-radius: 4px; text-align: left;
      cursor: pointer; transition: all 0.15s; letter-spacing: 0.02em;
    }
    .settings-nav-btn:hover { background: rgba(255,255,255,0.04); color: var(--text-muted); }
    .settings-nav-btn.active { background: rgba(59,130,246,0.1); color: #93c5fd; }

    .settings-content {
      padding: 24px 32px; overflow-y: auto;
    }

    .settings-section { display: none; }
    .settings-section.active { display: block; }

    .settings-section-title {
      font-size: 16px; font-weight: 700; color: var(--text-primary);
      letter-spacing: 0.04em; margin-bottom: 4px;
    }
    .settings-section-desc {
      font-size: 11px; color: var(--text-dim); margin-bottom: 20px; line-height: 1.5;
    }

    .setting-row {
      display: flex; justify-content: space-between; align-items: center;
      padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
    }
    .setting-info { flex: 1; min-width: 0; }
    .setting-label { font-size: 13px; font-weight: 600; color: var(--text-primary); }
    .setting-desc { font-size: 10px; color: var(--text-dim); margin-top: 2px; }

    .setting-control {
      display: flex; align-items: center; gap: 8px; flex-shrink: 0;
    }
    .setting-control input[type="range"] { width: 120px; accent-color: var(--accent-blue); }
    .setting-control span { font-size: 11px; color: var(--text-muted); min-width: 36px; text-align: right; }

    .setting-select {
      background: rgba(0,0,0,0.3); border: 1px solid var(--bg-border);
      border-radius: 4px; color: var(--text-muted); font-size: 11px;
      font-family: var(--font); padding: 5px 10px;
    }
    .setting-select:focus { border-color: var(--accent-blue); outline: none; }

    .setting-input-num {
      background: rgba(0,0,0,0.3); border: 1px solid var(--bg-border);
      border-radius: 4px; color: var(--text-muted); font-size: 11px;
      font-family: var(--font); padding: 5px 8px; width: 70px; text-align: right;
    }
    .setting-input-num:focus { border-color: var(--accent-blue); outline: none; }

    /* Toggle switch */
    .setting-toggle { position: relative; display: inline-block; cursor: pointer; }
    .setting-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
    .toggle-track {
      display: block; width: 36px; height: 20px;
      background: #1e293b; border-radius: 10px;
      transition: background 0.2s;
    }
    .toggle-track::after {
      content: ""; position: absolute; top: 2px; left: 2px;
      width: 16px; height: 16px; border-radius: 50%;
      background: var(--text-dim); transition: transform 0.2s, background 0.2s;
    }
    .setting-toggle input:checked + .toggle-track { background: var(--accent-blue); }
    .setting-toggle input:checked + .toggle-track::after {
      transform: translateX(16px); background: white;
    }

    .setting-stats-grid {
      display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
      gap: 6px; margin-top: 8px;
    }
    .setting-stat-toggle {
      display: flex; align-items: center; gap: 8px;
      font-size: 11px; color: var(--text-muted); cursor: pointer;
      padding: 6px 10px; border-radius: 4px;
      background: rgba(0,0,0,0.2); border: 1px solid var(--bg-border);
    }
    .setting-stat-toggle:hover { border-color: rgba(255,255,255,0.1); }
    .setting-stat-toggle input { accent-color: var(--accent-blue); }

    .setting-actions {
      display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap;
    }
    .setting-storage-badge {
      font-size: 11px; color: var(--accent-blue); font-weight: 600;
      background: rgba(59,130,246,0.1); padding: 4px 10px; border-radius: 3px;
    }

    /* Hotkeys */
    .hotkey-grid { display: flex; flex-direction: column; gap: 4px; max-width: 500px; }
    .hotkey-row {
      display: flex; align-items: center; gap: 16px;
      padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.03);
    }
    .hotkey-key {
      display: inline-flex; align-items: center; justify-content: center;
      min-width: 60px; padding: 4px 10px;
      background: rgba(0,0,0,0.4); border: 1px solid var(--bg-border);
      border-radius: 4px; font-size: 11px; font-weight: 600; color: var(--text-primary);
      font-family: var(--font);
    }
    .hotkey-action { font-size: 12px; color: var(--text-muted); }

    /* About */
    .about-card {
      background: var(--glass-bg); border: 1px solid var(--glass-border);
      border-radius: 8px; padding: 32px; max-width: 500px; text-align: center;
    }
    .about-logo { margin-bottom: 16px; }
    .about-name { font-size: 18px; font-weight: 800; color: var(--text-primary); letter-spacing: 0.06em; }
    .about-version { font-size: 11px; color: var(--accent-blue); margin-top: 4px; }
    .about-desc { font-size: 11px; color: var(--text-dim); line-height: 1.6; margin-top: 16px; }
    .about-links { margin-top: 20px; text-align: left; }
    .about-link-row {
      display: flex; justify-content: space-between; padding: 6px 0;
      border-bottom: 1px solid rgba(255,255,255,0.04);
      font-size: 11px; color: var(--text-muted);
    }
    .about-link-label { font-weight: 600; color: var(--text-dim); }

    /* ═══════════════════════════════════════════════════════════
       AFFILIATES TAB
    ═══════════════════════════════════════════════════════════ */
    .aff-shell { max-width: 1200px; margin: 0 auto; padding: 0 20px 48px; }

    .aff-hero {
      background: linear-gradient(135deg, rgba(30,64,175,0.12) 0%, rgba(124,58,237,0.08) 50%, rgba(6,9,16,0.9) 100%);
      border: 1px solid rgba(56,130,246,0.12);
      border-radius: 12px;
      padding: 36px; margin: 28px 0;
      display: flex; justify-content: space-between; align-items: center;
      flex-wrap: wrap; gap: 24px;
      position: relative;
      overflow: hidden;
    }
    .aff-hero::before {
      content: '';
      position: absolute;
      top: 0; left: 0; right: 0;
      height: 1px;
      background: linear-gradient(90deg, transparent, rgba(56,130,246,0.2), rgba(168,85,247,0.15), transparent);
    }
    .aff-hero-title {
      font-size: 24px; font-weight: 800; color: #f1f5f9;
      letter-spacing: 0.04em;
      font-family: 'Outfit', var(--font);
    }
    .aff-hero-subtitle { font-size: 13px; color: #94a3b8; margin-top: 10px; max-width: 520px; line-height: 1.7; }
    .aff-hero-stats { display: flex; gap: 32px; }
    .aff-hero-stat { text-align: center; }
    .aff-hero-stat-value { font-size: 28px; font-weight: 800; color: var(--accent-blue); font-family: 'Outfit', var(--font); }
    .aff-hero-stat-label { font-size: 10px; color: #64748b; margin-top: 4px; letter-spacing: 0.05em; text-transform: uppercase; font-weight: 600; }

    .aff-filters {
      display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 24px;
    }
    .aff-filter-btn {
      background: rgba(15,23,42,0.5); border: 1px solid rgba(30,41,59,0.4);
      border-radius: 6px; color: #475569; font-size: 11px;
      font-weight: 600; font-family: var(--font); padding: 8px 16px;
      cursor: pointer; transition: all 0.2s ease; letter-spacing: 0.03em;
    }
    .aff-filter-btn:hover { border-color: rgba(56,130,246,0.15); color: #94a3b8; background: rgba(15,23,42,0.7); }
    .aff-filter-btn.active {
      background: rgba(56,130,246,0.1); border-color: rgba(56,130,246,0.25);
      color: #60a5fa; box-shadow: 0 0 12px rgba(56,130,246,0.08);
    }

    .aff-section-title {
      font-size: 12px; font-weight: 700; color: #64748b;
      letter-spacing: 0.12em; margin-bottom: 14px;
      text-transform: uppercase;
    }

    .aff-grid {
      display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
      gap: 16px;
    }

    .aff-card {
      background: linear-gradient(180deg, rgba(15,23,42,0.5) 0%, rgba(10,15,26,0.6) 100%);
      backdrop-filter: blur(8px);
      border: 1px solid rgba(30,41,59,0.4); border-radius: 10px;
      padding: 22px; display: flex; flex-direction: column; gap: 12px;
      position: relative; transition: all 0.2s ease;
    }
    .aff-card:hover {
      border-color: rgba(56,130,246,0.15);
      box-shadow: 0 4px 24px rgba(0,0,0,0.25);
      transform: translateY(-1px);
    }

    .aff-exclusive-badge {
      position: absolute; top: 14px; right: 14px;
      background: linear-gradient(135deg, #2563eb, #7c3aed); color: white;
      font-size: 9px; font-weight: 800; padding: 3px 10px;
      border-radius: 999px; letter-spacing: 0.08em;
      box-shadow: 0 2px 8px rgba(124,58,237,0.3);
    }

    .aff-card-header { display: flex; align-items: center; gap: 14px; }
    .aff-card-logo {
      width: 46px; height: 46px; border-radius: 10px;
      display: flex; align-items: center; justify-content: center;
      font-size: 15px; font-weight: 800; color: white;
      flex-shrink: 0; box-shadow: 0 3px 12px rgba(0,0,0,0.35);
    }
    .aff-card-title-wrap { flex: 1; }
    .aff-card-name { font-size: 15px; font-weight: 700; color: #f1f5f9; }
    .aff-card-rating { margin-top: 3px; }
    .aff-star { font-size: 13px; color: #334155; }
    .aff-star.filled { color: #eab308; text-shadow: 0 0 6px rgba(234,179,8,0.3); }
    .aff-star.half { color: #eab308; opacity: 0.6; }

    .aff-card-tagline { font-size: 12px; color: #64748b; line-height: 1.5; }

    .aff-card-bonus-row {
      display: flex; justify-content: space-between; align-items: center;
      padding: 8px 12px; background: rgba(6,9,16,0.5); border-radius: 6px;
      border: 1px solid rgba(30,41,59,0.25);
    }
    .aff-card-bonus-label { font-size: 9px; font-weight: 700; color: #475569; letter-spacing: 0.1em; text-transform: uppercase; }
    .aff-card-bonus-value { font-size: 12px; font-weight: 700; color: #22c55e; }

    .aff-card-features { display: flex; flex-wrap: wrap; gap: 5px; }
    .aff-feature-tag {
      font-size: 10px; padding: 3px 10px; border-radius: 999px;
      background: rgba(56,130,246,0.06); border: 1px solid rgba(56,130,246,0.12);
      color: #94a3b8; letter-spacing: 0.02em;
    }

    .aff-card-meta {
      display: flex; justify-content: space-between;
      font-size: 10px; color: #475569;
    }

    .aff-card-actions {
      display: flex; align-items: center; justify-content: space-between;
      margin-top: auto; padding-top: 10px;
      border-top: 1px solid rgba(30,41,59,0.3);
    }
    .aff-bonus-code { font-size: 11px; color: #64748b; }
    .aff-bonus-code strong { color: #eab308; font-weight: 700; }
    .aff-cta-btn {
      font-size: 11px !important; padding: 6px 18px !important;
      background: rgba(56,130,246,0.1) !important;
      border: 1px solid rgba(56,130,246,0.25) !important;
      border-radius: 6px !important;
      color: #3b82f6 !important;
      font-weight: 700 !important;
      letter-spacing: 0.06em !important;
      transition: all 0.15s ease !important;
    }
    .aff-cta-btn:hover {
      background: rgba(56,130,246,0.15) !important;
      border-color: rgba(56,130,246,0.4) !important;
      box-shadow: 0 0 14px rgba(56,130,246,0.12) !important;
      color: #60a5fa !important;
    }

    /* Comparison Table */
    .aff-table-wrap {
      overflow-x: auto; margin-bottom: 28px;
      border: 1px solid rgba(30,41,59,0.4);
      border-radius: 8px;
      background: rgba(10,15,26,0.5);
    }
    .aff-table {
      width: 100%; border-collapse: collapse; font-size: 12px;
    }
    .aff-table th {
      text-align: left; padding: 12px 14px;
      background: rgba(15,23,42,0.5); color: #64748b;
      font-weight: 700; letter-spacing: 0.08em; font-size: 10px;
      border-bottom: 1px solid rgba(30,41,59,0.4);
      text-transform: uppercase;
    }
    .aff-table td {
      padding: 12px 14px; border-bottom: 1px solid rgba(30,41,59,0.2);
      color: #94a3b8; vertical-align: middle;
    }
    .aff-table tr:last-child td { border-bottom: none; }
    .aff-table tr:hover td { background: rgba(56,130,246,0.03); }
    .aff-table-logo {
      display: inline-flex; align-items: center; justify-content: center;
      width: 24px; height: 24px; border-radius: 5px; font-size: 9px;
      font-weight: 800; color: white; vertical-align: middle; margin-right: 8px;
    }
    .aff-table-bonus { color: #22c55e; font-weight: 700; }

    .aff-rating-bar {
      width: 64px; height: 5px; background: rgba(30,41,59,0.5);
      border-radius: 999px; overflow: hidden; display: inline-block; vertical-align: middle;
    }
    .aff-rating-fill {
      height: 100%; background: linear-gradient(90deg, #3b82f6, #60a5fa); border-radius: 999px;
    }

    .aff-disclaimer {
      font-size: 11px; color: #475569; line-height: 1.7;
      padding: 18px; margin-top: 28px;
      background: rgba(15,23,42,0.3); border: 1px solid rgba(30,41,59,0.3);
      border-radius: 8px;
    }

@keyframes streak-pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}
.streak-pulse { animation: streak-pulse 0.6s ease; }

/* prof-ach-prog styles moved to Profile tab section */

/* ═══ Tab Availability Indicators ═══ */
.tab-btn.tab-locked {
  opacity: 0.45;
  pointer-events: auto;
  position: relative;
}
.tab-btn.tab-locked::after {
  content: "\1F512";
  font-size: 9px;
  margin-left: 4px;
  opacity: 0.6;
}

/* ═══ Upload Progress Summary Bar ═══ */
.upload-progress-summary {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; margin-bottom: 16px;
  background: rgba(15, 23, 42, 0.6); border-radius: 8px;
  border: 1px solid rgba(51, 65, 85, 0.3);
}
.progress-summary-bar { flex: 1; height: 6px; background: #1e293b; border-radius: 3px; overflow: hidden; display: flex; }
.progress-fill { height: 100%; transition: width 0.3s ease; }
.progress-fill-required { background: #22c55e; }
.progress-fill-optional { background: #3b82f6; }
.progress-summary-text { font-size: 11px; color: #64748b; white-space: nowrap; font-weight: 600; }

/* ═══ First-Visit Tab Tips ═══ */
.tip-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px;
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.12), rgba(124, 58, 237, 0.08));
  border: 1px solid rgba(59, 130, 246, 0.2); border-radius: 8px; margin-bottom: 12px;
  animation: tabFadeIn 0.3s ease;
}
.tip-bar-text { font-size: 12px; color: #94a3b8; line-height: 1.5; }
.tip-bar-dismiss { background: none; border: none; color: #475569; cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: 4px; }
.tip-bar-dismiss:hover { color: #94a3b8; background: rgba(255, 255, 255, 0.05); }

/* ═══ Help Icon Popovers ═══ */
.help-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; border-radius: 50%;
  border: 1px solid var(--text-dim); color: var(--text-dim);
  font-size: 9px; cursor: pointer; margin-left: 4px;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  vertical-align: middle;
}
.help-icon:hover { color: var(--accent-blue); border-color: var(--accent-blue); }

/* ═══ Focus-visible Accessibility ═══ */
:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}
.tab-btn:focus-visible, .dash-subtab:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: -2px;
}

/* ═══════════════════════════════════════════════════════════
   GATE / AUTH / CHECKOUT MODALS
═══════════════════════════════════════════════════════════ */

/* ── Shared overlay ── */
.sp-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  animation: sp-overlay-in 0.2s ease;
}
@keyframes sp-overlay-in { from { opacity: 0; } to { opacity: 1; } }
.sp-overlay--auth { z-index: 10000; }
.sp-overlay--checkout { z-index: 10001; }

/* ── Shared modal card ── */
.sp-modal {
  background: var(--bg-card, #0b1120); position: relative;
  border: 1px solid rgba(59,130,246,0.1);
  clip-path: polygon(0 10px, 10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%);
  overflow: hidden;
}
.sp-modal::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(59,130,246,0.04) 0%, transparent 40%);
  pointer-events: none;
}

/* ── Gate upgrade prompt ── */
.gate-modal { max-width: 400px; padding: 36px 32px; text-align: center; }
.gate-modal__icon {
  width: 44px; height: 44px; margin: 0 auto 16px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(59,130,246,0.06); border: 1px solid rgba(59,130,246,0.15);
  clip-path: polygon(0 6px, 6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
}
.gate-modal__icon svg { width: 20px; height: 20px; stroke: var(--accent-blue); fill: none; stroke-width: 2; }
.gate-modal__title {
  font-family: 'Rubik', var(--font); font-size: 18px; font-weight: 700;
  text-transform: uppercase; letter-spacing: -0.02em; color: #fff; margin-bottom: 8px;
}
.gate-modal__desc {
  font-size: 12px; color: rgba(255,255,255,0.3); line-height: 1.6; margin-bottom: 24px;
}
.gate-modal__btns { display: flex; gap: 10px; justify-content: center; }

/* ── Auth modal ── */
.auth-modal { max-width: 360px; padding: 40px 32px; }
.auth-modal__title {
  font-family: 'Rubik', var(--font); font-size: 22px; font-weight: 700;
  text-transform: uppercase; letter-spacing: -0.02em; text-align: center;
  color: #fff; margin-bottom: 6px;
}
.auth-modal__sub {
  font-size: 12px; color: rgba(255,255,255,0.3); text-align: center; margin-bottom: 28px;
}
.auth-btn {
  width: 100%; padding: 14px; display: flex; align-items: center; justify-content: center; gap: 10px;
  font-family: 'Rubik', var(--font); font-size: 12px; font-weight: 600;
  border: 1px solid rgba(255,255,255,0.08); background: rgba(255,255,255,0.03); color: #fff;
  clip-path: polygon(0 6px, 6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
  cursor: pointer; transition: all 0.2s; margin-bottom: 10px;
}
.auth-btn:hover { background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.15); }
.auth-btn--discord { border-color: rgba(88,101,242,0.3); background: rgba(88,101,242,0.06); }
.auth-btn--discord:hover { background: rgba(88,101,242,0.12); }
.auth-btn__icon { font-size: 16px; font-weight: 700; }
.auth-modal__legal {
  font-size: 9px; color: rgba(255,255,255,0.15); text-align: center;
  margin-top: 18px; line-height: 1.6;
}
.auth-modal__legal a { color: var(--accent-blue); text-decoration: none; }
.auth-modal__legal a:hover { text-decoration: underline; }

/* ── Checkout modal ── */
.checkout-modal { max-width: 420px; padding: 36px 32px; }
.checkout-modal__title {
  font-family: 'Rubik', var(--font); font-size: 20px; font-weight: 700;
  text-transform: uppercase; letter-spacing: -0.02em; margin-bottom: 16px;
}
.checkout-modal__price {
  font-family: 'JetBrains Mono', monospace; font-size: 48px; font-weight: 800;
  letter-spacing: -0.04em; color: #fff; line-height: 1; margin-bottom: 4px;
}
.checkout-modal__price span { font-size: 16px; font-weight: 400; color: rgba(255,255,255,0.25); }
.checkout-modal__period { font-size: 11px; color: rgba(255,255,255,0.2); margin-bottom: 8px; }
.checkout-modal__savings { font-size: 11px; color: var(--accent-green); font-weight: 600; margin-bottom: 16px; }
.checkout-modal__divider {
  height: 1px; margin: 20px 0;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,0.12), transparent);
}
.checkout-modal__features { list-style: none; margin-bottom: 24px; }
.checkout-modal__features li {
  font-size: 11px; color: rgba(255,255,255,0.4); padding: 4px 0;
  display: flex; align-items: center; gap: 10px;
}
.checkout-modal__features li::before {
  content: ''; width: 4px; height: 4px; flex-shrink: 0;
  background: var(--accent-blue); clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
}

/* ── Shared buttons for modals ── */
.sp-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 28px; font-family: 'Rubik', var(--font); font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; border: none; cursor: pointer;
  clip-path: polygon(0 8px, 8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
  transition: filter 0.2s, transform 0.15s; text-decoration: none; color: #fff;
}
.sp-btn:hover { filter: brightness(1.15); transform: translateY(-1px); }
.sp-btn--blue { background: var(--accent-blue); }
.sp-btn--gold { background: linear-gradient(135deg, #eab308, #d97706); color: #000; }
.sp-btn--ghost {
  background: rgba(59,130,246,0.08); color: var(--accent-blue);
  border: 1px solid rgba(59,130,246,0.2);
}
.sp-btn--full { width: 100%; text-align: center; }
.sp-btn--sm { padding: 8px 18px; font-size: 11px; }
.sp-btn--cancel {
  background: none; border: none; color: rgba(255,255,255,0.25);
  font-size: 11px; cursor: pointer; margin-top: 12px; text-align: center; width: 100%;
  font-family: 'Rubik', var(--font); text-transform: uppercase; letter-spacing: 0.04em;
}
.sp-btn--cancel:hover { color: rgba(255,255,255,0.5); }

/* ── Tier badge in nav ── */
.tier-badge {
  padding: 3px 10px; font-size: 8px; font-weight: 700;
  font-family: 'JetBrains Mono', monospace; letter-spacing: 0.08em; text-transform: uppercase;
  clip-path: polygon(0 3px, 3px 0, 100% 0, 100% calc(100% - 3px), calc(100% - 3px) 100%, 0 100%);
}
.tier-badge--pro { background: rgba(59,130,246,0.12); color: var(--accent-blue); }
.tier-badge--elite { background: rgba(234,179,8,0.12); color: #eab308; }

/* ── Avatar in nav ── */
.avatar-btn {
  width: 28px; height: 28px; border-radius: 4px;
  background: rgba(59,130,246,0.08); border: 1px solid rgba(59,130,246,0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; font-family: 'JetBrains Mono', monospace;
  color: var(--accent-blue); cursor: pointer; position: relative;
}
.avatar-dropdown {
  position: absolute; top: 100%; right: 0; margin-top: 6px;
  background: var(--bg-card, #0b1120); border: 1px solid rgba(59,130,246,0.1);
  clip-path: polygon(0 4px, 4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%);
  min-width: 160px; padding: 6px 0; z-index: 100; display: none;
}
.avatar-dropdown.active { display: block; }
.avatar-dropdown__item {
  padding: 8px 16px; font-size: 11px; color: rgba(255,255,255,0.5);
  cursor: pointer; font-family: 'Rubik', var(--font); transition: all 0.15s;
}
.avatar-dropdown__item:hover { background: rgba(59,130,246,0.06); color: #fff; }

/* ═══════════════════════════════════════════════════════════
   BILLING SECTION IN SETTINGS
═══════════════════════════════════════════════════════════ */
.billing-section {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
  padding: 20px; background: var(--bg-card, #0b1120);
  border: 1px solid var(--bg-border);
  clip-path: polygon(0 8px, 8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
}
.billing-label {
  font-size: var(--font-xs); font-weight: 700; font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); margin-bottom: 10px;
}
.billing-tier { font-size: 24px; font-weight: 800; color: var(--text-bright); }
.billing-badge {
  display: inline-flex; padding: 3px 10px;
  font-size: 8px; font-weight: 700; font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.08em; text-transform: uppercase;
  background: rgba(34,197,94,0.1); color: var(--accent-green);
  clip-path: polygon(0 3px, 3px 0, 100% 0, 100% calc(100% - 3px), calc(100% - 3px) 100%, 0 100%);
  margin-left: 8px; vertical-align: middle;
}
.billing-detail { font-size: 11px; color: var(--text-dim); margin-top: 4px; }
.usage-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px;
}
.usage-row__label { font-size: 10px; color: var(--text-muted); width: 120px; }
.usage-row__bar {
  flex: 1; height: 3px; background: rgba(255,255,255,0.04); border-radius: 2px; overflow: hidden;
}
.usage-row__fill {
  height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-blue), #6366f1);
}
.usage-row__fill--unlimited { background: var(--accent-green); }
.usage-row__val {
  font-size: 10px; font-family: 'JetBrains Mono', monospace;
  color: var(--text-dim); width: 80px; text-align: right;
}

/* ═══════════════════════════════════════════════════════════
   ONBOARDING WIZARD
═══════════════════════════════════════════════════════════ */
.onboarding-overlay {
  position: fixed; inset: 0; z-index: 10002;
  background: rgba(0,0,0,0.85); backdrop-filter: blur(12px);
  display: flex; align-items: center; justify-content: center;
  animation: sp-overlay-in 0.3s ease;
}
.onboarding-card {
  background: var(--bg-card, #0b1120); position: relative;
  border: 1px solid rgba(59,130,246,0.1);
  clip-path: polygon(0 12px, 12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%);
  max-width: 600px; width: 90%; padding: 40px 36px; overflow: hidden;
}
.onboarding-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(59,130,246,0.04) 0%, transparent 40%);
  pointer-events: none;
}
.onboarding-progress {
  display: flex; align-items: center; gap: 8px; margin-bottom: 32px; position: relative;
}
.onboarding-step-num {
  font-size: 10px; font-weight: 700; font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.1em; color: rgba(255,255,255,0.15);
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255,255,255,0.06); border-radius: 4px;
}
.onboarding-step-num.active { color: var(--accent-blue); border-color: rgba(59,130,246,0.3); background: rgba(59,130,246,0.06); }
.onboarding-step-num.done { color: var(--accent-green); border-color: rgba(34,197,94,0.3); background: rgba(34,197,94,0.06); }
.onboarding-step-line { flex: 1; height: 1px; background: rgba(255,255,255,0.06); }
.onboarding-step-line.done { background: rgba(34,197,94,0.2); }
.onboarding-title {
  font-family: 'Rubik', var(--font); font-size: 24px; font-weight: 700;
  text-transform: uppercase; letter-spacing: -0.02em; color: #fff; margin-bottom: 8px;
}
.onboarding-sub { font-size: 12px; color: rgba(255,255,255,0.3); margin-bottom: 28px; line-height: 1.6; }
.onboarding-options {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 28px;
}
.onboarding-option {
  padding: 20px 16px; text-align: center; cursor: pointer;
  background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.06);
  clip-path: polygon(0 6px, 6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
  transition: all 0.2s;
}
.onboarding-option:hover { border-color: rgba(59,130,246,0.2); background: rgba(59,130,246,0.04); }
.onboarding-option.selected { border-color: rgba(59,130,246,0.4); background: rgba(59,130,246,0.08); }
.onboarding-option__label {
  font-size: 12px; font-weight: 700; text-transform: uppercase; color: #fff;
  letter-spacing: -0.01em; margin-top: 8px;
}
.onboarding-option__desc { font-size: 10px; color: rgba(255,255,255,0.25); margin-top: 4px; }
.onboarding-nav { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; position: relative; }

/* ── Upload zone in onboarding ── */
.onboarding-upload {
  border: 2px dashed rgba(59,130,246,0.15); border-radius: 8px;
  padding: 40px 24px; text-align: center; margin-bottom: 20px;
  transition: border-color 0.2s, background 0.2s; cursor: pointer;
}
.onboarding-upload:hover { border-color: rgba(59,130,246,0.3); background: rgba(59,130,246,0.02); }
.onboarding-upload.dragover { border-color: var(--accent-blue); background: rgba(59,130,246,0.04); }
.onboarding-upload__label {
  font-size: 13px; font-weight: 600; color: rgba(255,255,255,0.4); margin-bottom: 6px;
}
.onboarding-upload__hint { font-size: 10px; color: rgba(255,255,255,0.15); }

/* ═══════════════════════════════════════════════════════════
   COOKIE CONSENT BANNER
═══════════════════════════════════════════════════════════ */
.cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9998;
  background: #0b1120; border-top: 1px solid rgba(59,130,246,0.08);
  padding: 14px 32px; display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: rgba(255,255,255,0.4);
  animation: cookie-slide-in 0.3s ease;
}
@keyframes cookie-slide-in { from { transform: translateY(100%); } to { transform: translateY(0); } }
.cookie-banner__text { flex: 1; }
.cookie-banner__btns { display: flex; gap: 8px; margin-left: 24px; }
.cookie-banner__btn {
  padding: 6px 16px; font-size: 10px; font-weight: 700;
  font-family: 'Rubik', var(--font); text-transform: uppercase; letter-spacing: 0.04em;
  border: none; cursor: pointer;
  clip-path: polygon(0 4px, 4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%);
}
.cookie-banner__btn--accept { background: var(--accent-blue); color: #fff; }
.cookie-banner__btn--decline { background: rgba(255,255,255,0.04); color: rgba(255,255,255,0.3); }

/* ═══════════════════════════════════════════════════════════
   TOAST NOTIFICATION
═══════════════════════════════════════════════════════════ */
.sp-toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 11000;
  background: var(--bg-card, #0b1120); border: 1px solid rgba(59,130,246,0.12);
  clip-path: polygon(0 6px, 6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
  padding: 12px 24px; font-size: 12px; color: var(--text-body);
  font-family: 'Rubik', var(--font);
  animation: toast-in 0.2s ease, toast-out 0.2s ease 2.8s forwards;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes toast-out { from { opacity: 1; } to { opacity: 0; } }

/* ═══════════════════════════════════════════════════════════
   PRICING TOGGLE (for landing.html inline use)
═══════════════════════════════════════════════════════════ */
.price-toggle {
  display: inline-flex; background: #060a14; border: 1px solid rgba(59,130,246,0.08);
  clip-path: polygon(0 6px, 6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
  overflow: hidden;
}
.price-toggle__opt {
  padding: 8px 20px; font-size: 10px; font-weight: 700;
  font-family: 'JetBrains Mono', monospace; letter-spacing: 0.08em;
  text-transform: uppercase; color: rgba(255,255,255,0.25);
  cursor: pointer; transition: all 0.2s; border: none; background: none;
}
.price-toggle__opt.active { background: rgba(59,130,246,0.12); color: var(--accent-blue); }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — MONETIZATION COMPONENTS
═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .billing-section { grid-template-columns: 1fr; }
  .onboarding-options { grid-template-columns: 1fr 1fr; }
  .cookie-banner { flex-direction: column; gap: 10px; text-align: center; }
  .cookie-banner__btns { margin-left: 0; }
}
@media (max-width: 480px) {
  .onboarding-options { grid-template-columns: 1fr; }
  .onboarding-card { padding: 24px 20px; }
  .gate-modal, .auth-modal, .checkout-modal { padding: 24px 20px; }
}

/* ── Source Toggle (Live / Online) ────────────────── */
.source-toggle {
  display: inline-flex;
  gap: 0;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  padding: 2px;
  margin-left: 8px;
}
.source-toggle-btn {
  padding: 3px 12px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font);
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.03em;
}
.source-toggle-btn.active {
  background: var(--accent-blue);
  color: #fff;
}
.source-toggle-btn:hover:not(.active) {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.06);
}
.session-active {
  color: var(--accent-green) !important;
  animation: pulse-gentle 2s ease-in-out infinite;
}
@keyframes pulse-gentle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
