
        :root {
            --bg-primary: #0d0d0d;
            --bg-secondary: #141414;
            --bg-hover: rgba(255, 255, 255, 0.03);
            --border: rgba(255, 255, 255, 0.08);
            --text-primary: #ffffff;
            --text-secondary: #888888;
            --text-muted: #555555;
            --accent: #00D9FF;
            --positive: #00FF88;
            --negative: #FF4757;
            --font-mono: 'SF Mono', 'Consolas', 'Monaco', monospace;
            --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
        }

        [data-theme="light"] {
            --bg-primary: #f5f6f8;
            --bg-secondary: #ffffff;
            --bg-hover: rgba(0, 0, 0, 0.03);
            --border: rgba(0, 0, 0, 0.1);
            --text-primary: #1a1a2e;
            --text-secondary: #555e68;
            --text-muted: #8e99a4;
            --accent: #0077cc;
            --positive: #00a854;
            --negative: #dc3545;
        }

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

        body {
            font-family: var(--font-sans);
            background: var(--bg-primary);
            color: var(--text-primary);
            min-height: 100vh;
            transition: background 0.3s, color 0.3s;
        }

        .theme-toggle {
            background: none;
            border: 1px solid var(--border);
            color: var(--text-secondary);
            cursor: pointer;
            font-size: 0.9rem;
            padding: 0.2rem 0.45rem;
            border-radius: 4px;
            transition: all 0.2s;
            line-height: 1;
        }

        .theme-toggle:hover {
            color: var(--text-primary);
            border-color: var(--accent);
        }

        /* ===== HEADER ===== */
        .header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.75rem 2rem;
            border-bottom: 1px solid var(--border);
        }

        .logo {
            font-size: 1.35rem;
            font-weight: 700;
            display: flex;
            align-items: center;
            gap: 0.4rem;
            cursor: pointer;
        }

        .logo span {
            background: linear-gradient(135deg, #00D9FF, #7B2FFF);
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .nav {
            display: flex;
            gap: 1.5rem;
            align-items: center;
        }

        .nav a {
            color: var(--text-secondary);
            text-decoration: none;
            font-size: 0.85rem;
            font-weight: 500;
            transition: color 0.2s;
        }

        .nav a:hover,
        .nav a.active {
            color: var(--text-primary);
        }

        .header-right {
            display: flex;
            align-items: center;
            gap: 1.25rem;
            min-width: 220px;
            justify-content: flex-end;
        }

        .market-badge {
            display: flex;
            align-items: center;
            gap: 0.4rem;
            font-size: 0.75rem;
            color: var(--text-secondary);
        }

        .status-dot {
            width: 7px;
            height: 7px;
            border-radius: 50%;
            background: var(--negative);
            animation: pulse 2s infinite;
        }

        .market-open .status-dot {
            background: var(--positive);
        }

        .market-open {
            color: var(--positive);
        }

        @keyframes pulse {

            0%,
            100% {
                opacity: 1
            }

            50% {
                opacity: 0.4
            }
        }

        .clock {
            font-family: 'Orbitron', monospace;
            display: flex;
            align-items: baseline;
            gap: 0.5rem;
        }

        .clock-time {
            font-size: 1.1rem;
            font-weight: 700;
            color: var(--accent);
            font-variant-numeric: tabular-nums;
            min-width: 5.5em;
            text-align: right;
        }

        .clock-date {
            font-size: 0.7rem;
            color: #7B2FFF;
        }

        /* ===== TICKER ===== */
        .ticker-bar {
            display: flex;
            flex-wrap: wrap;
            padding: 0.4rem 1.5rem;
            border-bottom: 1px solid var(--border);
            font-size: 0.8rem;
            background: var(--bg-primary);
        }

        .ticker-item {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 0.35rem;
            flex: 0 0 10%;
            padding: 0.2rem 0;
        }

        .ticker-symbol {
            color: var(--text-muted);
            font-weight: 500;
        }

        .ticker-price {
            font-weight: 600;
            font-family: var(--font-mono);
            color: var(--text-secondary);
        }

        .ticker-price.flip-up {
            animation: flipUp 0.3s ease;
            color: var(--positive);
        }

        .ticker-price.flip-down {
            animation: flipDown 0.3s ease;
            color: var(--negative);
        }

        @keyframes flipUp {
            0% {
                transform: translateY(8px);
                opacity: 0
            }

            100% {
                transform: translateY(0);
                opacity: 1
            }
        }

        @keyframes flipDown {
            0% {
                transform: translateY(-8px);
                opacity: 0
            }

            100% {
                transform: translateY(0);
                opacity: 1
            }
        }

        /* ===== CONTAINER ===== */
        .container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 2rem 2rem 0;
        }

        /* ===== ARENA LAYOUT ===== */
        .arena-main {
            display: flex;
            gap: 1.5rem;
            height: calc(100vh - 82px);
            padding: 1rem 2rem;
            max-width: 1800px;
            margin: 0 auto;
        }

        .arena-chart-section {
            flex: 3;
            display: flex;
            flex-direction: column;
            min-width: 0;
        }

        .arena-chart-section .chart-area {
            flex: 1;
            display: flex;
            flex-direction: column;
            margin-bottom: 0;
        }

        .arena-chart-section .chart-container {
            flex: 1;
            height: 0;
            min-height: 200px;
        }

        .arena-sidebar {
            flex: 1;
            display: flex;
            flex-direction: column;
            min-width: 220px;
            max-width: 350px;
            border-left: 1px solid var(--border);
            padding-left: 1.5rem;
        }

        .arena-sidebar .section-header {
            margin-bottom: 0.5rem;
        }

        .sidebar-table-wrap {
            flex: 1;
            overflow-y: auto;
        }

        .arena-sidebar .lb-table {
            font-size: 0.8rem;
        }

        .arena-sidebar .lb-table thead th,
        .arena-sidebar .lb-table tbody td {
            padding: 0.5rem 0.4rem;
        }

        .sidebar-rules {
            margin-top: auto;
            padding-top: 0.75rem;
            border-top: 1px solid var(--border);
            font-size: 0.72rem;
            color: var(--text-muted);
            line-height: 1.7;
        }

        .sidebar-rules strong {
            color: var(--text-secondary);
        }

        /* ===== SECTION LABEL (nof1 style) ===== */
        .section-label {
            font-size: 0.7rem;
            font-weight: 600;
            letter-spacing: 1.5px;
            text-transform: uppercase;
            color: var(--text-secondary);
            display: block;
            margin-bottom: 0.75rem;
        }

        /* ===== CHART AREA ===== */
        .chart-area {
            margin-bottom: 3rem;
        }

        .chart-toolbar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 0.5rem;
        }

        .chart-controls {
            display: flex;
            gap: 0.25rem;
            align-items: center;
        }

        .ctrl-btn {
            padding: 0.3rem 0.6rem;
            background: transparent;
            border: 1px solid var(--border);
            color: var(--text-secondary);
            font-size: 0.7rem;
            font-weight: 600;
            cursor: pointer;
            border-radius: 4px;
            font-family: var(--font-mono);
            transition: all 0.2s;
        }

        .ctrl-btn:hover {
            color: var(--text-primary);
            border-color: rgba(255, 255, 255, 0.2);
        }

        .ctrl-btn.active {
            color: var(--text-primary);
            border-color: var(--accent);
            background: rgba(0, 217, 255, 0.1);
        }

        .ctrl-divider {
            width: 1px;
            height: 16px;
            background: var(--border);
            margin: 0 0.35rem;
        }

        .chart-container {
            position: relative;
            height: 500px;
            width: 100%;
        }

        /* ===== LEADERBOARD TABLE (minimal) ===== */
        .lb-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.85rem;
        }

        .lb-table thead th {
            text-align: left;
            padding: 0.6rem 0.75rem;
            color: var(--text-muted);
            font-weight: 500;
            font-size: 0.7rem;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            border-bottom: 1px solid var(--border);
        }

        .lb-table tbody td {
            padding: 0.6rem 0.75rem;
            border-bottom: 1px solid rgba(255, 255, 255, 0.03);
        }

        .lb-table tbody tr:hover {
            background: var(--bg-hover);
        }

        .lb-table .col-rank {
            width: 40px;
        }

        .lb-table .col-return,
        .lb-table .col-value,
        .lb-table .col-trades {
            font-family: var(--font-mono);
            text-align: right;
        }

        .lb-table thead .col-return,
        .lb-table thead .col-value,
        .lb-table thead .col-trades {
            text-align: right;
        }

        .rank-gold {
            color: #FFD700;
            font-weight: 700;
        }

        .rank-silver {
            color: #C0C0C0;
            font-weight: 700;
        }

        .rank-bronze {
            color: #CD7F32;
            font-weight: 700;
        }

        .col-vibe { width: 140px; }
        .vibe-bar { display: flex; align-items: center; gap: 4px; font-size: 0.65rem; }
        .vibe-label { cursor: pointer; white-space: nowrap; user-select: none; }
        .vibe-label:hover { opacity: 0.7; }
        .vibe-rocket { color: #00D9FF; }
        .vibe-clown { color: #FF9F43; }
        .vibe-track {
            flex: 1; height: 6px; border-radius: 3px;
            background: #FF9F43;
            overflow: hidden; min-width: 40px;
        }
        .vibe-fill-rocket {
            height: 100%; border-radius: 3px;
            background: #00D9FF;
            transition: width 0.3s ease;
        }
        .vibe-empty {
            color: var(--text-muted); font-size: 0.6rem; cursor: pointer;
            text-align: center; white-space: nowrap;
        }
        .vibe-empty:hover { color: var(--text-secondary); }
        .vibe-track-empty {
            flex: 1; height: 6px; border-radius: 3px;
            background: var(--border);
            min-width: 40px;
        }
        .arena-sidebar .vibe-bar { font-size: 0.6rem; }
        .arena-sidebar .col-vibe { width: 110px; }

        .positive {
            color: var(--positive);
        }

        .negative {
            color: var(--negative);
        }

        /* ===== SECTION HEADER ===== */
        .section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 0.75rem;
        }

        .view-all-link {
            color: var(--accent);
            text-decoration: none;
            font-size: 0.8rem;
            font-weight: 500;
        }

        .view-all-link:hover {
            text-decoration: underline;
        }

        /* ===== BOARD TABS (underline style) ===== */
        .board-tabs {
            display: flex;
            gap: 1.5rem;
            margin-bottom: 1.5rem;
            border-bottom: 1px solid var(--border);
        }

        .tab {
            padding: 0.5rem 0;
            background: none;
            border: none;
            border-bottom: 2px solid transparent;
            color: var(--text-secondary);
            font-size: 0.85rem;
            font-weight: 500;
            cursor: pointer;
            font-family: var(--font-sans);
            transition: all 0.2s;
        }

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

        .tab.active {
            color: var(--accent);
            border-bottom-color: var(--accent);
        }

        /* Section dividers (rookies/dormant) */
        .section-divider {
            font-size: 0.7rem;
            text-transform: uppercase;
            letter-spacing: 1px;
            color: var(--text-muted);
            padding: 1rem 0 0.5rem;
            border-top: 1px solid var(--border);
            margin-top: 1rem;
        }

        .lb-table.muted tbody td {
            color: var(--text-secondary);
        }

        /* Page header */
        .page-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 1.5rem;
        }

        .page-title {
            font-size: 1.25rem;
            font-weight: 700;
        }

        .agent-count {
            color: var(--text-secondary);
            font-size: 0.85rem;
        }

        /* Rules details */
        .rules-details {
            margin-top: 2rem;
            border-top: 1px solid var(--border);
            padding-top: 1rem;
        }

        .rules-details summary {
            cursor: pointer;
            color: var(--text-secondary);
            font-size: 0.8rem;
            font-weight: 500;
        }

        .rules-details summary:hover {
            color: var(--text-primary);
        }

        .rules-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.5rem 2rem;
            margin-top: 0.75rem;
            font-size: 0.8rem;
            color: var(--text-secondary);
        }

        .rules-grid strong {
            color: var(--text-primary);
        }

        .metric-grid {
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 1rem;
            margin-bottom: 1.5rem;
        }

        .metric-card {
            background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 1rem 1.1rem;
        }

        .metric-label {
            color: var(--text-secondary);
            font-size: 0.72rem;
            letter-spacing: 0.8px;
            text-transform: uppercase;
            margin-bottom: 0.55rem;
        }

        .metric-value {
            font-size: 1.5rem;
            font-family: var(--font-mono);
            font-weight: 700;
            color: var(--text-primary);
        }

        .metric-footnote {
            margin-top: 0.45rem;
            color: var(--text-muted);
            font-size: 0.78rem;
        }

        .screener-layout {
            display: grid;
            grid-template-columns: minmax(0, 1.8fr) minmax(320px, 1fr);
            gap: 1.5rem;
            align-items: start;
        }

        .panel {
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 1.1rem 1.2rem;
        }

        .panel-title {
            font-size: 1rem;
            font-weight: 700;
            margin-bottom: 0.2rem;
        }

        .panel-subtitle {
            color: var(--text-secondary);
            font-size: 0.8rem;
            margin-bottom: 1rem;
        }

        .sub-tabs {
            display: flex;
            gap: 0.55rem;
            flex-wrap: wrap;
            margin-bottom: 1rem;
        }

        .sub-tab {
            border: 1px solid var(--border);
            background: transparent;
            color: var(--text-secondary);
            border-radius: 999px;
            padding: 0.38rem 0.75rem;
            font-size: 0.78rem;
            font-weight: 600;
            cursor: pointer;
        }

        .sub-tab.active,
        .sub-tab:hover {
            color: var(--text-primary);
            border-color: var(--accent);
            background: rgba(0, 217, 255, 0.08);
        }

        .screener-table td,
        .screener-table th {
            vertical-align: top;
        }

        .screener-name-link {
            color: var(--text-primary);
            text-decoration: none;
            font-weight: 600;
        }

        .screener-name-link:hover {
            color: var(--accent);
        }

        .mini-note {
            color: var(--text-muted);
            font-size: 0.75rem;
        }

        .mono-tight {
            font-family: var(--font-mono);
            font-size: 0.75rem;
        }

        .setup-chip {
            display: inline-flex;
            align-items: center;
            border: 1px solid var(--border);
            border-radius: 999px;
            padding: 0.2rem 0.5rem;
            font-size: 0.72rem;
            color: var(--text-secondary);
            background: var(--bg-hover);
        }

        .direction-bullish {
            color: var(--positive);
        }

        .direction-bearish {
            color: var(--negative);
        }

        .empty-panel {
            min-height: 180px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: var(--text-muted);
            font-size: 0.85rem;
            text-align: center;
        }

        /* ===== TWO COLUMN ===== */
        .two-col {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 2rem;
            margin-top: 2rem;
        }

        /* ===== DASHBOARD HEADER ===== */
        .dash-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            padding-bottom: 1.5rem;
            margin-bottom: 2rem;
            border-bottom: 1px solid var(--border);
        }

        .dash-header h2 {
            font-size: 1.5rem;
            margin-bottom: 0.25rem;
        }

        .muted {
            color: var(--text-muted);
        }

        .mono {
            font-family: var(--font-mono);
            font-size: 0.8rem;
        }

        .dash-equity {
            text-align: right;
        }

        .equity-value {
            font-size: 2rem;
            font-weight: 700;
            font-family: var(--font-mono);
            margin-bottom: 0.25rem;
        }

        .dash-equity>div:last-child {
            font-size: 0.85rem;
            color: var(--text-secondary);
        }

        .dash-equity>div:last-child strong {
            color: var(--text-primary);
        }

        /* ===== TRADE BADGES ===== */
        .trade-badge {
            display: inline-block;
            padding: 0.2rem 0.45rem;
            border-radius: 3px;
            font-size: 0.7rem;
            font-weight: 600;
            text-transform: uppercase;
            font-family: var(--font-mono);
        }

        .badge-buy {
            background: rgba(0, 255, 136, 0.1);
            color: var(--positive);
        }

        .badge-sell {
            background: rgba(255, 71, 87, 0.1);
            color: var(--negative);
        }

        /* Recent trades compact */
        .trade-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0.5rem 0;
            border-bottom: 1px solid rgba(255, 255, 255, 0.03);
            font-size: 0.8rem;
        }

        .trade-row:last-child {
            border-bottom: none;
        }

        /* ===== EMPTY STATE ===== */
        .empty-state {
            color: var(--text-muted);
            text-align: center;
            padding: 2rem;
            font-size: 0.85rem;
        }

        /* ===== FOOTER ===== */
        .footer {
            text-align: center;
            padding: 1.5rem;
            color: var(--text-muted);
            font-size: 0.7rem;
            border-top: 1px solid var(--border);
            margin-top: 3rem;
        }

        .footer-meta {
            margin-top: 0.25rem;
        }

        .footer a {
            color: var(--accent);
            text-decoration: none;
        }

        .footer a:hover {
            text-decoration: underline;
        }

        /* Hide footer when arena fills viewport */
        #view-arena.active~.footer {
            display: none;
        }

        /* ===== MODAL ===== */
        .modal-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.8);
            backdrop-filter: blur(5px);
            z-index: 1000;
            display: none;
            align-items: center;
            justify-content: center;
        }

        .modal {
            background: var(--bg-secondary);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 2rem;
            width: 100%;
            max-width: 380px;
        }

        .modal-title {
            font-size: 1.25rem;
            font-weight: 700;
            margin-bottom: 1.5rem;
            text-align: center;
            background: linear-gradient(135deg, #00D9FF, #7B2FFF);
            -webkit-background-clip: text;
            background-clip: text;
            -webkit-text-fill-color: transparent;
        }

        .form-group {
            margin-bottom: 1.25rem;
        }

        .form-group label {
            display: block;
            margin-bottom: 0.4rem;
            color: var(--text-secondary);
            font-size: 0.85rem;
        }

        .form-input {
            width: 100%;
            padding: 0.7rem;
            background: rgba(255, 255, 255, 0.05);
            border: 1px solid var(--border);
            border-radius: 8px;
            color: #fff;
            font-family: var(--font-mono);
            font-size: 0.85rem;
            outline: none;
            transition: border-color 0.2s;
        }

        .form-input:focus {
            border-color: var(--accent);
        }

        .btn-primary {
            width: 100%;
            padding: 0.7rem;
            border: none;
            border-radius: 8px;
            background: linear-gradient(135deg, #00D9FF, #7B2FFF);
            color: #fff;
            font-weight: 600;
            font-size: 0.9rem;
            cursor: pointer;
        }

        .btn-primary:hover {
            opacity: 0.9;
        }

        .btn-ghost {
            width: 100%;
            padding: 0.6rem;
            border: none;
            background: transparent;
            color: var(--text-secondary);
            font-size: 0.85rem;
            cursor: pointer;
            margin-top: 0.5rem;
        }

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

        /* Status dot in table */
        .status-indicator {
            display: inline-block;
            width: 7px;
            height: 7px;
            border-radius: 50%;
            margin-right: 0.4rem;
        }

        .status-active {
            background: var(--positive);
        }

        .status-idle {
            background: #FFD93D;
        }

        .status-rookie {
            background: #00D9FF;
        }

        .status-dormant {
            background: #555;
        }

        .status-offline {
            background: #666;
            opacity: 0.5;
        }

        /* ===== RESPONSIVE ===== */
        @media (max-width: 768px) {
            .two-col {
                grid-template-columns: 1fr;
            }

            .header {
                flex-wrap: wrap;
                gap: 0.5rem;
                padding: 0.75rem 1rem;
            }

            .chart-container {
                height: 300px !important;
            }

            .container {
                padding: 1rem;
            }

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

            .dash-header {
                flex-direction: column;
                gap: 1rem;
            }

            .metric-grid,
            .screener-layout {
                grid-template-columns: 1fr;
            }

            .dash-equity {
                text-align: left;
            }

            .header-right {
                display: none;
            }

            .arena-main {
                flex-direction: column;
                height: auto;
                padding: 1rem;
            }

            .arena-sidebar {
                max-width: 100%;
                border-left: none;
                padding-left: 0;
                border-top: 1px solid var(--border);
                padding-top: 1rem;
            }

            .arena-chart-section .chart-container {
                height: 300px !important;
                min-height: auto;
            }
        }

        /* Hide scrollbar for ticker */
        .ticker-bar::-webkit-scrollbar {
            display: none;
        }

        .ticker-bar {
            -ms-overflow-style: none;
            scrollbar-width: none;
        }

        /* View transitions */
        .view {
            display: none;
        }

        .view.active {
            display: block;
        }
