:root {
            /* Brand identity — trading floor, not Google form */
            --primary: #00C853;           /* Profit green — vibrant, not Material */
            --accent: #5865F2;            /* Blurple — interactive/brand accent */
            --gold: #F5A623;              /* Premium/rank gold */

            /* Surface system — opaque tiers, not rgba mud */
            --color-bg: #111214;          /* Base background — flat, no gradient */
            --color-surface: #161819;     /* Level 1: cards, panels */
            --color-surface-strong: #1e2022; /* Level 2: elevated cards, inputs */
            --color-surface-hover: #262829;  /* Level 3: hover states, active items */
            --color-border: #2a2d30;      /* Subtle borders */
            --color-border-strong: #3a3d42;  /* Emphasized borders */

            /* Text — 3 tiers only */
            --color-text: #e4e6ea;        /* Primary text — not pure white */
            --color-text-muted: #8b8f96;  /* Secondary text */
            --color-text-subtle: #5c6068; /* Tertiary/disabled text */

            /* Semantic colors */
            --color-danger: #FF3B30;      /* Loss red — iOS red, not flat-ui */
            --color-danger-strong: #D32F2F;
            --color-success: var(--primary);
            --color-premium: var(--gold);
            --card-bg: var(--color-surface);

            /* Spacing scale */
            --space-1: 4px;
            --space-2: 8px;
            --space-3: 12px;
            --space-4: 16px;
            --space-5: 24px;
            --space-6: 32px;
            --space-7: 48px;

            /* Radius */
            --radius-sm: 8px;
            --radius-md: 12px;
            --radius-lg: 16px;
            --radius-xl: 20px;
            --radius-pill: 999px;

            /* Shadows */
            --shadow-panel: 0 12px 28px rgba(0,0,0,0.18);
            --shadow-float: 0 20px 40px rgba(0,0,0,0.28);

            /* Typography — 6-step scale */
            --font-display: clamp(1.75rem, 3vw, 2.25rem);
            --font-lg: 1.25rem;       /* section headers, stat values */
            --font-base: 0.9375rem;   /* 15px — body text, inputs, buttons */
            --font-sm: 0.8125rem;     /* 13px — secondary text, metadata */
            --font-xs: 0.6875rem;     /* 11px — captions, timestamps */

            /* Aliases for backward compat */
            --font-h1: var(--font-display);
            --font-h2: var(--font-lg);
            --font-h3: var(--font-base);
            --font-body: var(--font-base);
            --font-body-sm: var(--font-sm);
            --font-label: var(--font-xs);
            --font-number: var(--font-lg);

            /* Component sizing */
            --btn-height: 44px;
            --input-height: 46px;
            --tab-height: 42px;
        }

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

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: var(--color-bg);
            min-height: 100vh;
            color: var(--color-text);
            font-size: var(--font-body);
            line-height: 1.5;
        }

        /* ── Persistent Navigation Shell ── */
        .app-nav {
            position: fixed;
            left: 0;
            top: 0;
            bottom: 0;
            width: 72px;
            background: var(--color-surface);
            border-right: 1px solid var(--color-border);
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: var(--space-3) 0;
            z-index: 1000;
        }

        /* nav-brand removed — sidebar starts with nav items directly */

        .nav-items { display: flex; flex-direction: column; gap: var(--space-1); width: 100%; }
        .nav-footer { width: 100%; }

        /* Rooms Panel — Teams-style second column (240px) */
        .rooms-panel {
            position: fixed;
            left: 72px;
            top: 0;
            bottom: 0;
            width: 240px;
            background: var(--color-surface);
            border-right: 1px solid var(--color-border);
            display: flex;
            flex-direction: column;
            z-index: 999;
            overflow: hidden;
        }

        .rooms-panel-header {
            font-size: var(--font-sm);
            font-weight: 700;
            color: var(--color-text);
            padding: var(--space-4) var(--space-4) var(--space-3);
            border-bottom: 1px solid var(--color-border);
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        .rooms-panel-list {
            flex: 1;
            overflow-y: auto;
            padding: var(--space-2) 0;
        }

        .rooms-panel-empty {
            font-size: var(--font-sm);
            color: var(--color-text-subtle);
            padding: var(--space-4);
            text-align: center;
        }

        .rooms-panel-item {
            display: flex;
            flex-direction: column;
            width: 100%;
            padding: var(--space-3) var(--space-4);
            background: none;
            border: none;
            border-left: 3px solid transparent;
            color: var(--color-text-muted);
            cursor: pointer;
            text-align: left;
            transition: background 0.15s ease, border-color 0.15s ease;
        }

        .rooms-panel-item:hover { background: var(--color-surface-hover); }
        .rooms-panel-item.active {
            background: var(--color-surface-strong);
            border-left-color: var(--accent);
            color: var(--color-text);
        }

        .rooms-panel-item-name {
            font-size: var(--font-sm);
            font-weight: 600;
            margin-bottom: 2px;
        }

        .rooms-panel-item-meta {
            font-size: var(--font-xs);
            color: var(--color-text-subtle);
        }

        /* Adjust app-content when rooms panel is visible */
        .app-content.with-rooms-panel {
            margin-left: 312px; /* 72px nav + 240px rooms panel */
        }

        @media (max-width: 768px) {
            .rooms-panel { display: none !important; }
            .app-content.with-rooms-panel { margin-left: 0; }
        }

        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 2px;
            padding: var(--space-2) 0;
            background: none;
            border: none;
            color: var(--color-text-muted);
            cursor: pointer;
            font-size: var(--font-xs);
            width: 100%;
            transition: color 0.15s ease, background 0.15s ease;
        }

        .nav-item:hover { color: var(--color-text); background: var(--color-surface-strong); }
        .nav-item.active { color: var(--accent); }
        .nav-item.active::before {
            content: '';
            position: absolute;
            left: 0;
            width: 3px;
            height: 28px;
            background: var(--accent);
            border-radius: 0 3px 3px 0;
        }
        .nav-item { position: relative; }

        .app-content {
            margin-left: 72px;
        }

        /* Mobile: bottom nav bar */
        @media (max-width: 768px) {
            .app-nav {
                position: fixed;
                left: 0;
                right: 0;
                top: auto;
                bottom: 0;
                width: 100%;
                height: 64px;
                flex-direction: row;
                justify-content: space-around;
                border-right: none;
                border-top: 1px solid var(--color-border);
                padding: 0;
            }

            .nav-brand { display: none; }
            .nav-footer { display: none; }
            .nav-items { flex-direction: row; justify-content: space-around; gap: 0; }

            .nav-item { padding: var(--space-2) var(--space-3); }
            .nav-item.active::before {
                left: 50%;
                top: 0;
                bottom: auto;
                width: 24px;
                height: 3px;
                transform: translateX(-50%);
                border-radius: 0 0 3px 3px;
            }

            .app-content {
                margin-left: 0;
                padding-bottom: 72px; /* space for bottom nav */
            }
        }

        .screen {
            display: none;
            min-height: 100vh;
            padding: var(--space-5);
        }

        .screen.active {
            display: block;
        }

        h1 { font-size: var(--font-h1); margin-bottom: var(--space-2); font-weight: 700; letter-spacing: -0.02em; }
        h2 { font-size: var(--font-h2); margin-bottom: var(--space-4); color: var(--color-text); font-weight: 700; }
        h3 { font-size: var(--font-h3); font-weight: 700; }

        .subtitle { color: var(--color-text-subtle); margin-bottom: var(--space-5); font-size: var(--font-body-sm); }

        input[type="text"], input[type="number"], input[type="password"], select, textarea {
            min-height: var(--input-height);
            padding: 12px 14px;
            border-radius: var(--radius-sm);
            border: 1px solid var(--color-border);
            background: var(--color-surface);
            color: var(--color-text);
            font-size: var(--font-body);
            width: 100%;
            margin-bottom: var(--space-2);
            transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
        }

        input::placeholder, textarea::placeholder { color: var(--color-text-subtle); }

        input:focus, select:focus, textarea:focus {
            outline: none;
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(88, 101, 242, 0.25);
            background: var(--color-surface-strong);
        }

        .btn {
            min-height: var(--btn-height);
            padding: 0 18px;
            border-radius: var(--radius-sm);
            border: 1px solid transparent;
            font-size: var(--font-body);
            font-weight: 600;
            cursor: pointer;
            transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
            margin: var(--space-1);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: var(--space-2);
        }

        .btn:hover { transform: translateY(-1px); filter: brightness(1.1); }
        .btn:active { transform: translateY(0) scale(0.98); filter: brightness(0.95); }

        .btn-primary { background: var(--accent); color: #fff; }
        .btn-primary:hover { background: #6d75f7; }
        .btn-secondary { background: var(--color-surface-strong); color: var(--color-text); border-color: var(--color-border); }
        .btn-secondary:hover { background: var(--color-surface-hover); border-color: var(--color-border-strong); }
        .btn-danger { background: var(--color-danger); color: #fff; }
        .btn-buy { background: var(--primary); color: #111; font-weight: 700; }
        .btn-sell { background: var(--color-danger); color: #fff; font-weight: 700; }
        .btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; filter: none; }

        /* Loading state for trade buttons */
        .btn.loading {
            pointer-events: none;
            opacity: 0.7;
            position: relative;
        }
        .btn.loading::after {
            content: '';
            width: 16px;
            height: 16px;
            border: 2px solid transparent;
            border-top-color: currentColor;
            border-radius: 50%;
            animation: btn-spin 0.6s linear infinite;
            margin-left: var(--space-2);
        }
        @keyframes btn-spin { to { transform: rotate(360deg); } }

        .card {
            background: var(--card-bg);
            border-radius: var(--radius-md);
            padding: var(--space-5);
            margin-bottom: var(--space-4);
            border: 1px solid var(--color-border);
            box-shadow: var(--shadow-panel);
        }

        .green { color: var(--primary); }
        .red { color: var(--color-danger); }

        .title-screen {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
        }

        .logo { font-size: 4rem; margin-bottom: 20px; }

        .login-form { width: 100%; max-width: 350px; }

        .api-note { font-size: var(--font-sm); color: var(--color-text-subtle); margin-top: 10px; }
        .api-note a { color: var(--accent); }

        .lobby-container { max-width: 800px; margin: 0 auto; }

        .lobby-shell { max-width: 1400px; margin: 0 auto; }

        .room-tabs { display: flex; gap: var(--space-2); margin-bottom: var(--space-5); flex-wrap: wrap; }
        .room-tabs .btn { flex: 1; min-width: 100px; min-height: var(--tab-height); }
        .room-tabs .btn.active { background: var(--accent); color: #fff; border-color: transparent; }

        .room-list { max-height: 300px; overflow-y: auto; }

        .room-empty-state { color: var(--color-text-subtle); text-align: center; padding: 20px; grid-column: 1 / -1; }

        .room-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: var(--space-4);
            background: var(--color-surface);
            border-radius: var(--radius-sm);
            margin-bottom: var(--space-2);
            flex-wrap: wrap;
            gap: var(--space-2);
            border: 1px solid var(--color-border);
            transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
        }

        .room-item:hover { background: var(--color-surface-hover); border-color: var(--color-border-strong); transform: translateY(-1px); }

        .room-info h3 { font-size: var(--font-base); margin-bottom: 5px; }
        .room-info .details { font-size: var(--font-sm); color: var(--color-text-muted); margin-bottom: 6px; }

        .room-rules {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }

        .rule-tag {
            background: var(--color-surface-hover);
            padding: 3px 8px;
            border-radius: 4px;
            font-size: var(--font-xs);
            color: var(--color-text-muted);
        }

        .room-buttons { display: flex; gap: 8px; }

        .btn-view {
            background: var(--color-surface-hover);
            color: #fff;
            padding: 8px 15px;
            font-size: var(--font-sm);
        }

        .btn-view:hover { background: rgba(255,255,255,0.25); }

        .spectator-banner {
            background: var(--accent);
            padding: 10px 20px;
            border-radius: 8px;
            text-align: center;
            margin-bottom: 15px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 10px;
        }

        .spectator-banner span { font-weight: bold; }

        .account-failed-banner {
            background: var(--color-danger);
            padding: 10px 20px;
            border-radius: 8px;
            text-align: center;
            margin-bottom: 15px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 10px;
        }

        .account-failed-banner span { font-weight: bold; }

        .spectator-overlay {
            position: relative;
        }

        .spectator-overlay::after {
            content: '👁️ Spectating';
            position: absolute;
            top: 10px;
            right: 10px;
            background: var(--accent);
            padding: 4px 10px;
            border-radius: 12px;
            font-size: var(--font-xs);
            font-weight: bold;
        }

        .create-room-form { display: grid; gap: var(--space-2); }
        .form-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
        .form-row > * { flex: 1; min-width: 120px; }

        .game-container { max-width: 1000px; margin: 0 auto; }

        .game-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: var(--space-5);
            flex-wrap: wrap;
            gap: var(--space-2);
        }

        .room-title { font-size: var(--font-lg); }

        .room-code {
            background: var(--color-surface-hover);
            padding: 5px 15px;
            border-radius: 20px;
            font-family: monospace;
            font-size: var(--font-base);
        }

        .stats-bar {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
            gap: 10px;
            margin-bottom: 20px;
        }

        .stat-card {
            background: var(--color-surface);
            padding: 15px;
            border-radius: 10px;
            text-align: center;
        }

        .stat-value { font-size: var(--font-lg); font-weight: bold; }
        .stat-label { font-size: var(--font-xs); color: var(--color-text-muted); text-transform: uppercase; }

        .main-content {
            display: grid;
            grid-template-columns: 1fr 300px;
            gap: 20px;
        }

        /* Room layout — chat-first split panel */
        /* Old room layout styles removed — replaced by .room-split / .room-sidebar / .room-chat-main
        .room-layout { ... }
        .room-chat-panel { ... }
        .room-side-panel { ... }
        */

        .room-side-panel-legacy-placeholder {
            display: none; /* placeholder to maintain brace count */
        }

        .side-panel-tabs {
            display: flex;
            gap: var(--space-1);
            margin-bottom: var(--space-3);
            position: sticky;
            top: 0;
            z-index: 1;
            background: var(--color-bg);
            padding: var(--space-1) 0;
        }

        .side-tab {
            flex: 1;
            padding: var(--space-2) var(--space-3);
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-sm);
            color: var(--color-text-muted);
            cursor: pointer;
            font-size: var(--font-sm);
            font-weight: 600;
            transition: all 0.15s ease;
        }

        .side-tab:hover { background: var(--color-surface-strong); color: var(--color-text); }
        .side-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

        /* ── Trade Dialog — Robinhood-style order entry ── */
        .trade-dialog-panel {
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-lg);
            width: 680px;
            max-width: 95vw;
            max-height: 92vh;
            overflow-y: auto;
            padding: var(--space-5);
            position: relative;
            animation: modal-content-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
        }

        .td-header { text-align: center; margin-bottom: var(--space-3); }
        .td-symbol { font-size: var(--font-display); font-weight: 700; }
        .td-price { font-size: var(--font-lg); font-weight: 600; margin-top: 2px; }
        .td-change { font-size: var(--font-sm); margin-top: 2px; }

        .td-chart { height: 80px; margin: var(--space-3) 0; }
        .td-chart-range { display: flex; justify-content: center; gap: 4px; margin-bottom: var(--space-4); }

        /* Buy/Sell — tab-style with bottom border accent */
        .td-action-tabs {
            display: flex;
            border-bottom: 1px solid var(--color-border);
            margin-bottom: var(--space-4);
        }

        .td-action-tab {
            flex: 1;
            padding: var(--space-3) var(--space-4);
            border: none;
            border-bottom: 2px solid transparent;
            background: none;
            color: var(--color-text-subtle);
            font-weight: 600;
            font-size: var(--font-base);
            cursor: pointer;
            transition: color 0.15s ease, border-color 0.15s ease;
            margin-bottom: -1px;
        }

        .td-action-tab:hover { color: var(--color-text); }
        .td-action-tab.active[data-td-action="buy"] { color: var(--primary); border-bottom-color: var(--primary); }
        .td-action-tab.active[data-td-action="sell"] { color: var(--color-danger); border-bottom-color: var(--color-danger); }

        .td-form { display: flex; flex-direction: column; gap: var(--space-3); }

        .td-form-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .td-form-row label { font-size: var(--font-sm); color: var(--color-text-muted); }

        .td-input-group { display: flex; gap: var(--space-2); align-items: center; }
        .td-input-group input { width: 100px; margin: 0; text-align: right; }
        .td-max-btn {
            background: none;
            border: 1px solid var(--color-border);
            color: var(--accent);
            padding: var(--space-1) var(--space-2);
            border-radius: var(--radius-sm);
            cursor: pointer;
            font-size: var(--font-xs);
            font-weight: 700;
        }

        .td-bid-ask {
            display: flex;
            gap: var(--space-4);
            font-size: var(--font-sm);
            color: var(--color-text-muted);
        }

        .td-bid-ask strong { color: var(--color-text); }

        .td-form-row select { width: 180px; margin: 0; min-height: 38px; }

        /* Stocks/Options — subtle segmented pill control */
        .td-asset-toggle {
            display: flex;
            margin-bottom: var(--space-3);
            background: var(--color-surface-strong);
            border-radius: var(--radius-pill);
            padding: 2px;
            align-self: center;
            width: fit-content;
            margin-left: auto;
            margin-right: auto;
        }

        .td-asset-btn {
            padding: var(--space-1) var(--space-4);
            border: none;
            background: transparent;
            color: var(--color-text-muted);
            font-size: var(--font-xs);
            font-weight: 600;
            cursor: pointer;
            border-radius: var(--radius-pill);
            transition: all 0.15s ease;
        }

        .td-asset-btn:hover { color: var(--color-text); }
        .td-asset-btn.active { background: var(--color-surface-hover); color: var(--color-text); }

        /* Call/Put — pill segmented control matching Stocks/Options style */
        .td-option-type-toggle {
            display: flex;
            background: var(--color-surface-strong);
            border-radius: var(--radius-pill);
            padding: 2px;
            width: 180px;
        }
        .td-opt-btn {
            flex: 1;
            padding: var(--space-2) var(--space-3);
            border: none;
            background: transparent;
            color: var(--color-text-muted);
            border-radius: var(--radius-pill);
            cursor: pointer;
            font-weight: 600;
            font-size: var(--font-sm);
            transition: all 0.15s ease;
            text-align: center;
        }
        .td-opt-btn:hover { color: var(--color-text); }
        .td-opt-btn.active { background: var(--color-surface-hover); color: var(--color-text); }

        .td-buying-power-warn { color: var(--color-danger) !important; }

        /* Options chain grid */
        .td-expiry-pills {
            display: flex;
            gap: var(--space-1);
            overflow-x: auto;
            padding-bottom: var(--space-2);
            margin-bottom: var(--space-3);
            -webkit-overflow-scrolling: touch;
        }

        .td-expiry-pill {
            padding: var(--space-1) var(--space-3);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-pill);
            background: none;
            color: var(--color-text-muted);
            font-size: var(--font-xs);
            font-weight: 600;
            cursor: pointer;
            white-space: nowrap;
            transition: all 0.15s ease;
        }

        .td-expiry-pill:hover { border-color: var(--color-border-strong); color: var(--color-text); }
        .td-expiry-pill.active { background: var(--accent); border-color: var(--accent); color: #fff; }

        .options-chain-grid {
            max-height: 300px;
            overflow-y: auto;
            border: 1px solid var(--color-border);
            border-radius: var(--radius-sm);
            font-size: var(--font-xs);
        }

        .chain-header {
            display: grid;
            grid-template-columns: 1fr auto 1fr;
            background: var(--color-surface-strong);
            padding: var(--space-2) var(--space-3);
            font-weight: 700;
            color: var(--color-text-muted);
            text-transform: uppercase;
            letter-spacing: 0.05em;
            position: sticky;
            top: 0;
            z-index: 1;
        }

        .chain-header span:first-child { text-align: center; }
        .chain-header span:last-child { text-align: center; }
        .chain-header .chain-strike-label { text-align: center; }

        .chain-row {
            display: grid;
            grid-template-columns: 1fr auto 1fr;
            border-bottom: 1px solid var(--color-border);
            transition: background 0.1s ease;
        }

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

        .chain-cell {
            padding: var(--space-2) var(--space-3);
            cursor: pointer;
            display: flex;
            justify-content: space-between;
            gap: var(--space-2);
            transition: background 0.1s ease;
        }

        .chain-cell:hover { background: var(--color-surface-hover); }
        .chain-cell.selected { background: rgba(88, 101, 242, 0.15); }
        .chain-cell .bid { color: var(--color-text-muted); }
        .chain-cell .ask { color: var(--color-text); }

        .chain-strike {
            padding: var(--space-2) var(--space-3);
            text-align: center;
            font-weight: 700;
            color: var(--color-text);
            background: var(--color-surface-strong);
            min-width: 70px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .chain-row.itm .chain-cell:first-child { background: rgba(0, 200, 83, 0.05); }
        .chain-row.otm .chain-cell:last-child { background: rgba(0, 200, 83, 0.05); }

        .chain-atm-divider {
            grid-column: 1 / -1;
            height: 2px;
            background: var(--accent);
        }

        .td-divider {
            height: 1px;
            background: var(--color-border);
            margin: var(--space-2) 0;
        }

        .td-summary label { font-weight: 600; color: var(--color-text); }
        .td-summary strong { font-size: var(--font-lg); }

        .td-submit-btn {
            width: 100%;
            margin-top: var(--space-5);
            min-height: 52px;
            font-size: var(--font-lg);
            font-weight: 700;
            border-radius: var(--radius-md);
            letter-spacing: 0.01em;
        }

        .td-submit-btn.buy-mode { background: var(--primary); color: #111; }
        .td-submit-btn.buy-mode:hover { filter: brightness(1.1); }
        .td-submit-btn.sell-mode { background: var(--color-danger); color: #fff; }
        .td-submit-btn.sell-mode:hover { filter: brightness(1.1); }
        .td-submit-btn:disabled { opacity: 0.4; filter: none; cursor: not-allowed; }

        .td-review-summary {
            background: var(--color-surface-strong);
            border-radius: var(--radius-sm);
            padding: var(--space-4);
            margin-bottom: var(--space-3);
            font-size: var(--font-sm);
            line-height: 1.8;
        }

        .td-review-summary strong { color: var(--color-text); }

        /* ── Portfolio View — sectioned by asset class ── */
        /* Portfolio header */
        .pf-header {
            padding-bottom: var(--space-3);
            border-bottom: 1px solid var(--color-border);
            margin-bottom: var(--space-3);
        }

        .pf-header-top {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: var(--space-2);
        }

        .pf-total-value { font-size: var(--font-display); font-weight: 700; }
        .pf-total-pnl { font-size: var(--font-sm); margin-top: 2px; }

        .pf-header-stats {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: var(--space-2);
            margin-top: var(--space-3);
        }

        .pf-header-stat { text-align: center; }
        .pf-header-stat span { display: block; font-size: var(--font-xs); color: var(--color-text-subtle); }
        .pf-header-stat strong { font-size: var(--font-sm); }

        .pf-section { margin-bottom: var(--space-3); }
        .pf-section-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: var(--font-xs);
            font-weight: 700;
            color: var(--color-text-subtle);
            text-transform: uppercase;
            letter-spacing: 0.05em;
            margin-bottom: var(--space-2);
            padding: var(--space-2) 0;
            border-bottom: 1px solid var(--color-border);
            cursor: pointer;
        }

        .pf-section-header:hover { color: var(--color-text-muted); }

        .pf-section-value {
            font-size: var(--font-sm);
            font-weight: 600;
            color: var(--color-text);
            text-transform: none;
            letter-spacing: normal;
        }

        .pf-section.collapsed .pf-position-list { display: none; }

        .pf-section-arrow {
            display: inline-block;
            font-size: var(--font-xs);
            margin-right: 2px;
            transition: transform 0.15s ease;
        }

        .pf-position-list { display: flex; flex-direction: column; gap: var(--space-1); }

        .pf-position {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: var(--space-2) var(--space-2);
            border-radius: var(--radius-sm);
            cursor: pointer;
            transition: background 0.15s ease;
        }

        .pf-position:hover { background: var(--color-surface-hover); }

        .pf-position-left { display: flex; flex-direction: column; }
        .pf-position-symbol { font-weight: 700; font-size: var(--font-sm); }
        .pf-position-detail { font-size: var(--font-xs); color: var(--color-text-muted); }

        .pf-position-right { text-align: right; }
        .pf-position-value { font-size: var(--font-sm); font-weight: 600; }
        .pf-position-pnl { font-size: var(--font-xs); }

        /* Quick positions in sidebar */
        .quick-positions { margin-top: var(--space-3); }

        .quick-position-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: var(--space-2) var(--space-3);
            background: var(--color-surface-strong);
            border-radius: var(--radius-sm);
            margin-bottom: var(--space-2);
            cursor: pointer;
            transition: background 0.15s ease;
            font-size: var(--font-sm);
        }

        .quick-position-item:hover { background: var(--color-surface-hover); }

        /* ── Room Interior — Chat-first split panel ── */
        #game-screen.screen { padding: 0; }

        .room-shell {
            display: flex;
            flex-direction: column;
            height: 100vh;
            overflow: hidden;
        }

        .room-header-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: var(--space-3) var(--space-4);
            border-bottom: 1px solid var(--color-border);
            flex-shrink: 0;
        }

        .room-header-left {
            display: flex;
            align-items: center;
            gap: var(--space-3);
        }

        .room-header-left h1 { font-size: var(--font-lg); margin: 0; }
        .room-header-code { color: var(--color-text-subtle); font-size: var(--font-sm); font-family: monospace; }
        .room-header-members { color: var(--color-text-muted); font-size: var(--font-sm); }
        .room-header-aggregate { color: var(--primary); font-size: var(--font-sm); font-weight: 600; }
        .room-header-right { display: flex; gap: var(--space-2); }

        .room-split {
            flex: 1;
            display: flex;
            min-height: 0;
            position: relative;
        }

        /* LEFT: Chat feed — takes 60% */
        .room-chat-main {
            flex: 1;
            display: flex;
            flex-direction: column;
            min-width: 0;
            border-right: 1px solid var(--color-border);
        }

        .room-chat-main .chat-messages {
            flex: 1;
            overflow-y: auto;
            padding: var(--space-5) var(--space-5);
        }

        .room-chat-input {
            display: flex;
            gap: var(--space-2);
            padding: var(--space-3) var(--space-4);
            border-top: 1px solid var(--color-border);
            background: var(--color-surface);
        }

        .room-chat-input input { flex: 1; margin: 0; }
        .room-chat-input .btn { margin: 0; }

        /* Teams-style chat messages */
        .chat-msg {
            display: flex;
            gap: var(--space-3);
            padding: var(--space-4) 0;
        }

        .chat-msg + .chat-msg { border-top: 1px solid var(--color-border); }

        /* Grouped messages — same sender in a row */
        .chat-msg.grouped {
            padding-top: var(--space-1);
            border-top: none;
        }

        .chat-msg.grouped .chat-msg-avatar { visibility: hidden; }
        .chat-msg.grouped .chat-msg-header { display: none; }

        .chat-msg-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: var(--font-xs);
            color: #fff;
            flex-shrink: 0;
        }

        .chat-msg-body { flex: 1; min-width: 0; }

        .chat-msg-header {
            display: flex;
            align-items: baseline;
            gap: var(--space-2);
            margin-bottom: 2px;
        }

        .chat-msg-sender {
            font-weight: 700;
            font-size: var(--font-sm);
            color: var(--color-text);
            cursor: pointer;
        }

        .chat-msg-sender:hover { color: var(--accent); }
        .chat-sender-bold { font-weight: 800; }

        .chat-msg-title {
            font-size: var(--font-xs);
            color: var(--color-text-subtle);
            background: var(--color-surface-strong);
            padding: 1px 6px;
            border-radius: var(--radius-pill);
            margin-left: var(--space-1);
        }

        .chat-msg-time {
            font-size: var(--font-xs);
            color: var(--color-text-subtle);
        }

        .chat-msg-text {
            font-size: var(--font-base);
            color: var(--color-text);
            line-height: 1.5;
            word-break: break-word;
        }

        /* System messages */
        .chat-msg-system {
            text-align: center;
            padding: var(--space-2) 0;
            font-size: var(--font-xs);
            color: var(--color-text-subtle);
            font-style: italic;
        }

        /* Trade activity messages */
        .chat-msg-trade {
            display: flex;
            gap: var(--space-3);
            padding: var(--space-2) var(--space-3);
            background: var(--color-surface-strong);
            border-radius: var(--radius-sm);
            border-left: 3px solid var(--gold);
            margin: var(--space-2) 0;
        }

        .chat-msg-trade .chat-msg-text { color: var(--gold); font-size: var(--font-sm); }
        .chat-msg-indicator { display: none; }

        /* Delete button on hover */
        .chat-msg .delete-msg,
        .chat-msg-trade .delete-msg {
            opacity: 0;
            background: none;
            border: none;
            color: var(--color-text-subtle);
            cursor: pointer;
            font-size: var(--font-xs);
            margin-left: auto;
            transition: opacity 0.15s ease;
        }

        .chat-msg:hover .delete-msg,
        .chat-msg-trade:hover .delete-msg { opacity: 1; }
        .delete-msg:hover { color: var(--color-danger); }

        /* RIGHT: Sidebar — 380px fixed, collapsible */
        .room-sidebar {
            width: 380px;
            max-width: 380px;
            flex-shrink: 0;
            display: flex;
            flex-direction: column;
            overflow-y: auto;
            overflow-x: hidden;
            background: var(--color-surface);
            transition: width 0.25s ease, max-width 0.25s ease, opacity 0.2s ease;
        }

        .room-sidebar.collapsed {
            width: 0;
            max-width: 0;
            overflow: hidden;
            opacity: 0;
            padding: 0;
            border: none;
        }

        .room-aggregate {
            padding: var(--space-4) var(--space-4);
            border-bottom: 1px solid var(--color-border);
            text-align: center;
        }

        .aggregate-label { font-size: var(--font-xs); color: var(--color-text-subtle); text-transform: uppercase; letter-spacing: 0.05em; }
        .aggregate-value { font-size: var(--font-lg); font-weight: 700; margin-top: 2px; }

        .room-my-stats {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            border-bottom: 1px solid var(--color-border);
        }

        .my-stat {
            padding: var(--space-2) var(--space-3);
            text-align: center;
        }

        .my-stat span { display: block; font-size: var(--font-xs); color: var(--color-text-subtle); }
        .my-stat strong { font-size: var(--font-sm); }

        .room-sidebar .side-panel-tabs {
            padding: var(--space-2) var(--space-3);
            border-bottom: 1px solid var(--color-border);
            background: var(--color-bg);
            position: sticky;
            top: 0;
            z-index: 1;
        }

        .room-sidebar .side-tab-content {
            padding: var(--space-4);
            overflow-x: hidden;
            overflow-y: auto;
            min-width: 0;
            max-width: 100%;
        }

        .room-sidebar .portfolio-table {
            font-size: var(--font-xs);
            table-layout: fixed;
            width: 100%;
            max-width: 100%;
        }

        .room-sidebar .portfolio-table th,
        .room-sidebar .portfolio-table td {
            padding: 4px 3px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        .room-sidebar .portfolio-table th:first-child,
        .room-sidebar .portfolio-table td:first-child { width: 20%; }


        /* Mod controls sit below the member list */
        .room-sidebar #mod-room-controls {
            margin-top: var(--space-3);
            padding-top: var(--space-3);
            border-top: 1px solid var(--color-border);
        }

        .room-sidebar-toggle {
            display: none;
            position: fixed;
            bottom: 80px;
            right: var(--space-4);
            width: 48px;
            height: 48px;
            border-radius: 50%;
            background: var(--accent);
            color: #fff;
            border: none;
            cursor: pointer;
            z-index: 100;
            box-shadow: 0 4px 12px rgba(0,0,0,0.3);
            align-items: center;
            justify-content: center;
        }

        /* Mobile: sidebar collapses */
        @media (max-width: 768px) {
            .room-sidebar {
                position: fixed;
                top: 0;
                right: -100%;
                width: 85%;
                max-width: 380px;
                height: 100vh;
                z-index: 200;
                transition: right 0.3s ease;
                box-shadow: -4px 0 20px rgba(0,0,0,0.4);
            }

            .room-sidebar.open { right: 0; }

            .room-chat-main { border-right: none; }

            .room-sidebar-toggle { display: flex; }
        }

        .trading-panel {
            background: var(--color-surface);
            border-radius: 12px;
            padding: 20px;
        }

        .ticker-input-row {
            display: flex;
            gap: 10px;
            margin-bottom: 15px;
        }

        .ticker-input-row input { flex: 1; text-transform: uppercase; margin-bottom: 0; }
        .ticker-input-row button { white-space: nowrap; }

        .quote-display {
            text-align: center;
            padding: 20px;
            background: rgba(0,0,0,0.2);
            border-radius: 10px;
            margin-bottom: 15px;
        }

        .quote-symbol { font-size: var(--font-display); font-weight: bold; margin-bottom: 5px; }
        .quote-price { font-size: 2rem; font-weight: bold; }
        .quote-change { font-size: var(--font-base); margin-top: 5px; }

        .trade-form { display: grid; gap: 10px; }

        .quantity-row { display: flex; gap: 10px; align-items: center; }
        .quantity-row input { flex: 1; margin-bottom: 0; }
        .quantity-row .max-btn { padding: 8px 15px; font-size: var(--font-sm); }

        .trade-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

        .trade-preview {
            text-align: center;
            padding: 10px;
            background: rgba(0,0,0,0.2);
            border-radius: 8px;
            font-size: var(--font-sm);
            color: var(--color-text-muted);
        }

        .portfolio-table { width: 100%; font-size: var(--font-sm); }
        .portfolio-table th {
            text-align: left;
            padding: 10px 5px;
            color: var(--color-text-muted);
            font-weight: normal;
            border-bottom: 1px solid var(--color-surface-hover);
        }
        .portfolio-table td {
            padding: 10px 5px;
            border-bottom: 1px solid var(--color-surface);
        }
        .portfolio-table .symbol { font-weight: bold; color: var(--primary); }

        .leaderboard {
            background: var(--color-surface);
            border-radius: 12px;
            padding: 15px;
        }

        .leaderboard-item {
            display: flex;
            align-items: center;
            padding: 10px;
            border-bottom: 1px solid var(--color-surface);
        }
        .leaderboard-item:last-child { border-bottom: none; }

        .leaderboard-rank { width: 30px; font-weight: bold; color: var(--color-text-muted); }
        .leaderboard-rank.gold { color: var(--gold); }
        .leaderboard-rank.silver { color: #B0B3B8; }
        .leaderboard-rank.bronze { color: #CD7F32; }

        .leaderboard-name { flex: 1; }
        .leaderboard-name.you { color: var(--primary); }
        .leaderboard-value { font-weight: bold; }

        .chat-panel {
            background: var(--color-surface);
            border-radius: 12px;
            padding: 15px;
            display: flex;
            flex-direction: column;
            height: 300px;
        }

        .chat-messages { flex: 1; overflow-y: auto; margin-bottom: 10px; font-size: var(--font-sm); }

        .chat-message { margin-bottom: 8px; }
        .chat-message .sender { color: var(--primary); font-weight: bold; }
        .chat-message.system { color: var(--color-text-muted); font-style: italic; }
        .chat-message.trade { color: var(--gold); }

        .chat-input { display: flex; gap: 10px; }
        .chat-input input { flex: 1; margin-bottom: 0; }
        .chat-input button { padding: 10px 15px; }

        .notification {
            position: fixed;
            top: 20px;
            right: 20px;
            padding: 12px 20px;
            border-radius: var(--radius-sm);
            z-index: 2000;
            animation: notif-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
            font-size: var(--font-sm);
            font-weight: 600;
            max-width: 360px;
            box-shadow: 0 8px 24px rgba(0,0,0,0.3);
        }
        /* Stack multiple notifications */
        .notification:nth-child(2) { top: 70px; }
        .notification:nth-child(3) { top: 120px; }
        .notification.success { background: var(--primary); color: #111; }
        .notification.error { background: var(--color-danger); color: #fff; }
        @keyframes notif-in { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

        @keyframes slideIn {
            from { transform: translateX(100%); opacity: 0; }
            to { transform: translateX(0); opacity: 1; }
        }

        .loading {
            display: inline-block;
            width: 20px;
            height: 20px;
            border: 2px solid rgba(255,255,255,0.3);
            border-radius: 50%;
            border-top-color: #fff;
            animation: spin 1s ease-in-out infinite;
        }

        @keyframes spin { to { transform: rotate(360deg); } }

        .credit { text-align: center; color: var(--color-text-subtle); font-size: var(--font-xs); margin-top: 30px; }

        /* Options Trading Styles */
        .options-toggle {
            display: flex;
            align-items: center;
            gap: 10px;
            margin: 10px 0;
        }

        .toggle-switch {
            position: relative;
            width: 50px;
            height: 26px;
        }

        .toggle-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }

        .toggle-slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #333;
            transition: 0.3s;
            border-radius: 26px;
        }

        .toggle-slider:before {
            position: absolute;
            content: "";
            height: 20px;
            width: 20px;
            left: 3px;
            bottom: 3px;
            background-color: white;
            transition: 0.3s;
            border-radius: 50%;
        }

        .toggle-switch input:checked + .toggle-slider {
            background-color: var(--primary);
        }

        .toggle-switch input:checked + .toggle-slider:before {
            transform: translateX(24px);
        }

        .trade-type-tabs {
            display: flex;
            gap: 5px;
            margin-bottom: 15px;
        }

        .trade-type-tabs .btn {
            flex: 1;
            padding: 10px;
            font-size: var(--font-sm);
        }

        .trade-type-tabs .btn.active {
            background: var(--accent);
        }

        .sparkline {
            width: 100%;
            height: 60px;
            margin: 10px 0;
        }
        .sparkline path {
            fill: none;
            stroke-width: 2;
            stroke-linecap: round;
            stroke-linejoin: round;
        }
        .sparkline .up { stroke: var(--primary); }
        .sparkline .down { stroke: var(--color-danger); }
        .sparkline .fill-up { fill: rgba(0, 255, 136, 0.1); stroke: none; }
        .sparkline .fill-down { fill: rgba(255, 71, 87, 0.1); stroke: none; }

        .chart-range-btn {
            background: var(--color-surface-hover);
            border: none;
            color: var(--color-text-muted);
            padding: 4px 10px;
            border-radius: 4px;
            font-size: var(--font-xs);
            cursor: pointer;
            transition: all 0.2s;
        }
        .chart-range-btn:hover { background: rgba(255,255,255,0.2); color: #fff; }
        .chart-range-btn.active { background: var(--primary); color: #fff; }

        .options-chain {
            max-height: 300px;
            overflow-y: auto;
            margin: 10px 0;
        }

        .option-row {
            display: grid;
            grid-template-columns: 1fr auto auto auto;
            gap: 10px;
            padding: 8px 10px;
            background: var(--color-surface);
            border-radius: 6px;
            margin-bottom: 5px;
            cursor: pointer;
            font-size: var(--font-sm);
            align-items: center;
        }

        .option-row:hover {
            background: var(--color-surface-hover);
        }

        .option-row.selected {
            background: rgba(76, 175, 80, 0.3);
            border: 1px solid var(--accent);
        }

        .option-row .strike {
            font-weight: bold;
        }

        .option-row .call {
            color: var(--accent);
        }

        .option-row .put {
            color: var(--color-danger);
        }

        .option-row .price {
            color: var(--color-text);
        }

        .expiry-select {
            margin-bottom: 10px;
        }

        .options-help {
            font-size: var(--font-xs);
            color: var(--color-text-subtle);
            margin-bottom: 10px;
            padding: 10px;
            background: rgba(0,0,0,0.2);
            border-radius: 8px;
        }

        .option-type-toggle {
            display: flex;
            gap: 10px;
            margin-bottom: 10px;
        }

        .option-type-toggle .btn {
            flex: 1;
        }

        .option-type-toggle .btn.call-active {
            background: var(--accent);
        }

        .option-type-toggle .btn.put-active {
            background: var(--color-danger);
        }

        /* Moderation Styles */
        .mod-badge {
            background: var(--accent);
            color: #fff;
            padding: 2px 6px;
            border-radius: 4px;
            font-size: var(--font-xs);
            margin-left: 5px;
        }

        .host-badge {
            background: var(--gold);
            color: #fff;
            padding: 2px 6px;
            border-radius: 4px;
            font-size: var(--font-xs);
            margin-left: 5px;
        }

        .mod-actions {
            display: flex;
            gap: 5px;
            margin-left: auto;
        }

        .mod-btn {
            background: var(--color-surface-hover);
            border: none;
            color: var(--color-text-muted);
            padding: 4px 8px;
            border-radius: 4px;
            cursor: pointer;
            font-size: var(--font-xs);
        }

        .mod-btn:hover {
            background: rgba(255,255,255,0.2);
            color: #fff;
        }

        .mod-btn.kick {
            color: var(--color-danger);
        }

        .mod-btn.kick:hover {
            background: rgba(231, 76, 60, 0.3);
        }

        .chat-message {
            position: relative;
            padding-right: 30px;
        }

        .chat-message .delete-msg {
            position: absolute;
            right: 0;
            top: 0;
            background: none;
            border: none;
            color: var(--color-text-subtle);
            cursor: pointer;
            opacity: 0;
            transition: opacity 0.2s;
        }

        .chat-message:hover .delete-msg {
            opacity: 1;
        }

        .chat-message .delete-msg:hover {
            color: var(--color-danger);
        }

        .trading-hours-info {
            background: var(--color-surface);
            padding: 8px 12px;
            border-radius: 8px;
            font-size: var(--font-sm);
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .trading-hours-info .status {
            padding: 3px 8px;
            border-radius: 4px;
            font-weight: bold;
        }

        .trading-hours-info .status.open {
            background: var(--primary);
            color: #fff;
        }

        .trading-hours-info .status.closed {
            background: var(--color-danger);
            color: #fff;
        }

        .player-row {
            display: flex;
            align-items: center;
            padding: 8px 10px;
            background: var(--color-surface);
            border-radius: 6px;
            margin-bottom: 5px;
            gap: 8px;
        }

        .player-row .name {
            flex: 1;
        }

        /* Theme Picker */
        .theme-picker {
            position: fixed;
            bottom: 20px;
            right: 20px;
            z-index: 500;
        }

        .theme-toggle-btn {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            border: none;
            background: var(--card-bg);
            color: var(--text);
            font-size: var(--font-display);
            cursor: pointer;
            box-shadow: 0 4px 15px rgba(0,0,0,0.3);
            transition: all 0.3s;
        }

        .theme-toggle-btn:hover {
            transform: scale(1.1);
        }

        .theme-menu {
            position: absolute;
            bottom: 60px;
            right: 0;
            background: var(--bg-end);
            border-radius: 12px;
            padding: 10px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.4);
            display: none;
            min-width: 180px;
        }

        .theme-menu.open {
            display: block;
        }

        .theme-option {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px 15px;
            cursor: pointer;
            border-radius: 8px;
            transition: background 0.2s;
        }

        .theme-option:hover {
            background: var(--color-surface-hover);
        }

        .theme-option.active {
            background: var(--color-surface-hover);
        }

        .theme-swatch {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            border: 2px solid rgba(255,255,255,0.3);
        }

        .logo-img {
            width: 80px;
            height: 80px;
            border-radius: 12px;
            margin-bottom: 15px;
            object-fit: cover;
        }

        /* Player Profile Modal */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0,0,0,0.7);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1100;
            padding: 20px;
            animation: modal-backdrop-in 0.2s ease;
        }

        @keyframes modal-backdrop-in { from { opacity: 0; } to { opacity: 1; } }
        @keyframes modal-content-in { from { opacity: 0; transform: scale(0.95) translateY(10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

        .modal-content {
            background: var(--color-surface-strong);
            animation: modal-content-in 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
            border-radius: 16px;
            padding: 25px;
            max-width: 500px;
            width: 100%;
            max-height: 80vh;
            overflow-y: auto;
            position: relative;
        }

        .modal-close {
            position: absolute;
            top: 15px;
            right: 15px;
            background: none;
            border: none;
            color: var(--color-text-muted);
            font-size: var(--font-display);
            cursor: pointer;
        }

        .modal-close:hover { color: #fff; }

        .player-profile-header {
            display: flex;
            align-items: center;
            gap: 15px;
            margin-bottom: 20px;
            padding-bottom: 15px;
            border-bottom: 1px solid var(--color-surface-hover);
        }

        .player-avatar {
            width: 60px;
            height: 60px;
            border-radius: 50%;
            background: var(--accent);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: var(--font-display);
        }

        .player-profile-name { font-size: 1.3rem; font-weight: bold; }
        .player-profile-value { color: var(--primary); font-size: var(--font-lg); }

        .holdings-list, .trade-log {
            margin-top: 15px;
        }

        .holdings-list h3, .trade-log h3 {
            font-size: var(--font-base);
            color: var(--color-text-muted);
            margin-bottom: 10px;
        }

        .holding-item, .log-item {
            display: flex;
            justify-content: space-between;
            padding: 10px;
            background: var(--color-surface);
            border-radius: 8px;
            margin-bottom: 5px;
        }

        .log-item { font-size: var(--font-sm); }
        .log-item .time { color: var(--color-text-subtle); }

        .leaderboard-row {
            cursor: pointer;
            transition: background 0.2s;
        }

        .leaderboard-row:hover {
            background: var(--color-surface-hover);
        }

        .lobby-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 20px;
            flex-wrap: wrap;
            gap: 15px;
            padding-bottom: 15px;
            border-bottom: 1px solid var(--color-surface-hover);
        }

        .lobby-header h1 {
            flex: 1;
        }

        .lobby-user-info {
            display: flex;
            align-items: center;
            gap: 10px;
        }

        .lobby-user-info .username {
            color: var(--primary);
            font-weight: bold;
        }

        .btn-logout {
            background: var(--color-surface-hover);
            padding: 6px 12px;
            font-size: var(--font-sm);
        }

        .error-box {
            background: rgba(231, 76, 60, 0.2);
            border: 1px solid var(--color-danger);
            padding: 10px 15px;
            border-radius: 8px;
            margin-bottom: 15px;
            font-size: var(--font-sm);
        }

        /* Screen Transitions */
        .transition-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: var(--bg-start);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            z-index: 2000;
            opacity: 0;
            pointer-events: none;
            transition: opacity 0.3s ease;
        }

        .transition-overlay.active {
            opacity: 1;
            pointer-events: all;
        }

        .transition-overlay .logo {
            width: 120px;
            height: 120px;
            border-radius: 20px;
            animation: logoPulse 0.6s ease-in-out;
        }

        .transition-overlay .loading-text {
            margin-top: 20px;
            color: var(--text-muted);
            font-size: var(--font-sm);
            opacity: 0;
            animation: fadeInText 0.4s ease 0.2s forwards;
        }

        @keyframes logoPulse {
            0% { transform: scale(0.8); opacity: 0; }
            50% { transform: scale(1.1); }
            100% { transform: scale(1); opacity: 1; }
        }

        @keyframes fadeInText {
            to { opacity: 1; }
        }

        @keyframes fadeOutOverlay {
            0% { opacity: 1; }
            100% { opacity: 0; }
        }

        /* Analytics Styles */
        .analytics-btn {
            background: var(--accent);
            color: #fff;
            padding: 10px 20px;
            border: none;
            border-radius: 8px;
            cursor: pointer;
            font-size: var(--font-sm);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .analytics-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 15px;
            margin-top: 15px;
        }

        .analytics-card {
            background: var(--color-surface);
            border-radius: 10px;
            padding: 15px;
            text-align: center;
        }

        .analytics-card .value {
            font-size: 1.4rem;
            font-weight: bold;
            color: var(--primary);
            margin-bottom: 5px;
        }

        .analytics-card .label {
            font-size: var(--font-sm);
            color: var(--color-text-muted);
            text-transform: uppercase;
        }

        .analytics-card .detail {
            font-size: var(--font-sm);
            color: var(--color-text-muted);
            margin-top: 5px;
        }

        .analytics-section {
            margin-top: 20px;
            padding-top: 15px;
            border-top: 1px solid var(--color-surface-hover);
        }

        .analytics-section h3 {
            font-size: var(--font-base);
            color: var(--color-text-muted);
            margin-bottom: 10px;
        }

        .analytics-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .analytics-list-item {
            display: flex;
            justify-content: space-between;
            padding: 10px;
            background: var(--color-surface);
            border-radius: 6px;
        }

        .analytics-list-item .rank {
            color: var(--gold);
            font-weight: bold;
            margin-right: 10px;
        }

        /* FAQ Styles */
        .faq-section {
            margin-bottom: 20px;
            padding-bottom: 15px;
            border-bottom: 1px solid var(--color-surface-hover);
        }

        .faq-section:last-child {
            border-bottom: none;
        }

        .faq-section h3 {
            font-size: var(--font-base);
            color: var(--primary);
            margin-bottom: 10px;
        }

        .faq-section p {
            font-size: var(--font-sm);
            color: var(--color-text);
            margin-bottom: 8px;
            line-height: 1.5;
        }

        /* News Styles */
        .news-item {
            padding: 15px;
            background: var(--color-surface);
            border-radius: 8px;
            margin-bottom: 10px;
            cursor: pointer;
            transition: background 0.2s;
        }

        .news-item:hover {
            background: var(--color-surface-strong);
        }

        .news-item .headline {
            font-weight: bold;
            color: #fff;
            margin-bottom: 5px;
            line-height: 1.3;
        }

        .news-item .source {
            font-size: var(--font-xs);
            color: var(--primary);
            margin-bottom: 5px;
        }

        .news-item .summary {
            font-size: var(--font-sm);
            color: var(--color-text-muted);
            line-height: 1.4;
        }

        .news-item .time {
            font-size: var(--font-xs);
            color: var(--color-text-subtle);
            margin-top: 8px;
        }

        /* Social / Follow Styles */
        .follow-btn {
            padding: 8px 16px;
            border-radius: 20px;
            border: none;
            font-size: var(--font-sm);
            cursor: pointer;
            transition: all 0.2s;
        }

        .follow-btn.follow {
            background: var(--primary);
            color: #fff;
        }

        .follow-btn.following {
            background: var(--color-surface-hover);
            color: var(--color-text-muted);
        }

        .follow-btn.following:hover {
            background: rgba(231, 76, 60, 0.3);
            color: var(--color-danger);
        }

        .follow-stats {
            display: flex;
            gap: 20px;
            margin-top: 10px;
        }

        .follow-stat {
            text-align: center;
        }

        .follow-stat .count {
            font-size: var(--font-lg);
            font-weight: bold;
            color: var(--primary);
        }

        .follow-stat .label {
            font-size: var(--font-xs);
            color: var(--color-text-muted);
        }

        .social-feed {
            max-height: 400px;
            overflow-y: auto;
        }

        .activity-item {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            padding: 12px;
            background: var(--color-surface);
            border-radius: 8px;
            margin-bottom: 8px;
        }

        .activity-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: var(--accent);
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            flex-shrink: 0;
        }

        .activity-content {
            flex: 1;
        }

        .activity-name {
            font-weight: bold;
            color: var(--primary);
        }

        .activity-text {
            font-size: var(--font-sm);
            color: var(--color-text);
            margin-top: 3px;
        }

        .activity-time {
            font-size: var(--font-xs);
            color: var(--color-text-subtle);
            margin-top: 5px;
        }

        /* Enhanced Post Styles */
        .post-card {
            background: var(--color-surface);
            border-radius: 12px;
            padding: 15px;
            margin-bottom: 15px;
        }

        .post-header {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 12px;
        }

        .post-avatar {
            width: 45px;
            height: 45px;
            border-radius: 50%;
            background: var(--accent);
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            font-size: var(--font-lg);
            flex-shrink: 0;
        }

        .post-meta {
            flex: 1;
        }

        .post-author {
            font-weight: bold;
            color: var(--primary);
        }

        .post-time {
            font-size: var(--font-xs);
            color: var(--color-text-subtle);
        }

        .post-visibility-badge {
            font-size: var(--font-xs);
            padding: 2px 6px;
            border-radius: 4px;
            background: var(--color-surface-hover);
            color: var(--color-text-muted);
        }

        .post-title {
            font-size: var(--font-lg);
            font-weight: bold;
            margin-bottom: 8px;
            color: #fff;
        }

        .post-body {
            font-size: var(--font-base);
            color: var(--color-text);
            line-height: 1.5;
            margin-bottom: 10px;
            white-space: pre-wrap;
        }

        .post-image {
            max-width: 100%;
            max-height: 300px;
            border-radius: 8px;
            margin-bottom: 10px;
            cursor: pointer;
        }

        .post-actions {
            display: flex;
            gap: 15px;
            padding-top: 10px;
            border-top: 1px solid var(--color-surface);
        }

        .post-action-btn {
            background: none;
            border: none;
            color: var(--color-text-subtle);
            cursor: pointer;
            font-size: var(--font-sm);
            display: flex;
            align-items: center;
            gap: 5px;
            padding: 5px 10px;
            border-radius: 6px;
            transition: all 0.2s;
        }

        .post-action-btn:hover {
            background: var(--color-surface-hover);
            color: #fff;
        }

        .post-action-btn.liked {
            color: #e91e63;
        }

        .post-reactions {
            display: flex;
            gap: 5px;
            flex-wrap: wrap;
            margin-top: 8px;
        }

        .reaction-btn {
            background: var(--color-surface);
            border: 1px solid var(--color-surface-hover);
            border-radius: 15px;
            padding: 3px 8px;
            font-size: var(--font-sm);
            cursor: pointer;
            transition: all 0.2s;
        }

        .reaction-btn:hover {
            background: var(--color-surface-hover);
        }

        .reaction-btn.active {
            border-color: var(--primary);
            background: rgba(var(--primary), 0.2);
        }

        /* Comments */
        .post-comments {
            margin-top: 10px;
            padding-top: 10px;
            border-top: 1px solid var(--color-surface);
        }

        .comment-item {
            display: flex;
            gap: 10px;
            padding: 8px 0;
        }

        .comment-avatar {
            width: 30px;
            height: 30px;
            border-radius: 50%;
            background: var(--accent);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: var(--font-xs);
            font-weight: bold;
            flex-shrink: 0;
        }

        .comment-content {
            flex: 1;
        }

        .comment-author {
            font-weight: bold;
            color: var(--primary);
            font-size: var(--font-sm);
        }

        .comment-text {
            font-size: var(--font-sm);
            color: #bbb;
        }

        .comment-time {
            font-size: var(--font-xs);
            color: var(--color-text-subtle);
        }

        .comment-input-row {
            display: flex;
            gap: 10px;
            margin-top: 10px;
        }

        .comment-input-row input {
            flex: 1;
            padding: 8px 12px;
            border-radius: 20px;
            border: 1px solid #333;
            background: var(--color-surface);
            color: #fff;
            font-size: var(--font-sm);
        }

        .comment-input-row button {
            padding: 8px 15px;
            border-radius: 20px;
        }

        .reaction-picker {
            position: fixed;
            background: var(--bg-end);
            border-radius: 10px;
            padding: 8px;
            box-shadow: 0 4px 15px rgba(0,0,0,0.5);
            display: flex;
            gap: 5px;
            z-index: 3000;
        }

        .reaction-picker button {
            background: none;
            border: none;
            font-size: var(--font-lg);
            cursor: pointer;
            padding: 5px;
            border-radius: 5px;
            transition: all 0.2s;
        }

        .reaction-picker button:hover {
            background: var(--color-surface-hover);
            transform: scale(1.2);
        }


        .title-screen h1,
        .screen-header h1,
        .game-header h1 {
            font-size: var(--font-display);
            line-height: 1.05;
            margin-bottom: var(--space-2);
        }

        .api-note,
        .room-info .details,
        .rule-tag,
        .comment-time,
        .post-time,
        .quote-label {
            font-size: var(--font-label);
            color: var(--color-text-subtle);
        }

        .room-code,
        .quote-price,
        .portfolio-value,
        .stats-bar .value,
        .leaderboard-value {
            font-weight: 700;
        }

        .analytics-btn {
            border: 1px solid var(--color-border);
            box-shadow: var(--shadow-panel);
        }

        .lobby-user-info,
        .game-header > div,
        .room-buttons,
        .header-actions {
            gap: var(--space-2);
        }


        /* Phase A final system normalization */
        .screen-header,
        .section-header,
        .modal-content h2:first-child,
        .card h2:first-child {
            margin-bottom: var(--space-4);
        }

        .screen-header h1,
        .section-header h1,
        .modal-content h1:first-child,
        .card h1:first-child {
            margin-bottom: var(--space-2);
        }

        .screen-header p,
        .section-header p,
        .modal-content p,
        .card p {
            color: var(--color-text-muted);
        }

        .analytics-btn,
        .chart-range-btn,
        .follow-btn,
        .theme-toggle-btn,
        .modal-close {
            border-radius: var(--radius-sm);
            border: 1px solid var(--color-border);
            background: var(--color-surface-strong);
            color: var(--color-text);
            transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
        }

        .analytics-btn:hover,
        .chart-range-btn:hover,
        .follow-btn:hover,
        .theme-toggle-btn:hover,
        .modal-close:hover {
            background: var(--color-surface-hover);
            border-color: var(--color-border-strong);
            transform: translateY(-1px);
        }

        .chart-range-btn {
            min-height: 34px;
            padding: 0 12px;
            font-size: var(--font-label);
            font-weight: 600;
        }

        .follow-btn {
            min-height: 40px;
            padding: 0 14px;
            font-size: var(--font-body-sm);
            font-weight: 600;
        }

        .follow-btn.follow {
            background: var(--accent);
            border-color: transparent;
            color: white;
        }

        .follow-btn.following {
            background: var(--color-surface-strong);
            border-color: var(--color-border);
            color: var(--color-text);
        }

        .analytics-btn {
            min-width: 42px;
            min-height: 42px;
            padding: 0 12px;
        }

        .modal-overlay {
            backdrop-filter: blur(6px);
        }

        .modal-content {
            border-radius: var(--radius-lg);
            border: 1px solid var(--color-border-strong);
            box-shadow: var(--shadow-float);
            padding: var(--space-5);
        }

        .modal-close {
            width: 40px;
            height: 40px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            font-size: var(--font-lg);
            line-height: 1;
        }

        .quote-display,
        .post-card,
        .holding-item,
        .comment-item {
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-sm);
            box-shadow: var(--shadow-panel);
        }

        .lobby-user-info,
        .game-header,
        .room-tabs,
        .follow-stats,
        .player-profile-header,
        .comment-input-row {
            align-items: center;
        }

        @media (max-width: 768px) {
            .screen {
                padding: var(--space-4);
            }

            .card,
            .modal-content {
                padding: var(--space-4);
            }

            .analytics-btn,
            .btn,
            .chart-range-btn,
            .follow-btn {
                min-height: 40px;
            }
        }


        /* Phase B lobby redesign */
        .eyebrow-label,
        .section-kicker,
        .account-label {
            font-size: var(--font-label);
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: var(--color-text-subtle);
            font-weight: 700;
        }

        .lobby-header-modern {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            gap: var(--space-5);
            margin-bottom: var(--space-5);
        }

        .lobby-brand {
            display: flex;
            align-items: center;
            gap: var(--space-4);
            min-width: 0;
        }

        .lobby-brand-logo {
            width: 64px;
            height: 64px;
            object-fit: cover;
            border-radius: var(--radius-md);
            border: 1px solid var(--color-border-strong);
            box-shadow: var(--shadow-panel);
            flex-shrink: 0;
        }

        .lobby-brand-copy h1 {
            font-size: clamp(2rem, 4vw, 2.8rem);
            margin-bottom: var(--space-1);
        }

        .lobby-brand-copy .subtitle {
            margin-bottom: 0;
            max-width: 540px;
        }

        .lobby-header-actions {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
            gap: var(--space-3);
            min-width: 320px;
        }

        .lobby-utility-group {
            display: flex;
            flex-wrap: wrap;
            justify-content: flex-end;
            gap: var(--space-2);
        }

        .utility-pill.analytics-btn {
            min-width: 0;
            min-height: 38px;
            padding: 0 14px;
            font-size: var(--font-body-sm);
            font-weight: 600;
            background: var(--color-surface-strong) !important;
            color: var(--color-text);
        }

        .lobby-account-cluster {
            display: flex;
            align-items: center;
            gap: var(--space-3);
            padding: var(--space-2) var(--space-3);
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-pill);
            box-shadow: var(--shadow-panel);
        }

        .lobby-avatar-modern {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: var(--accent);
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-weight: bold;
            overflow: hidden;
            flex-shrink: 0;
        }

        .lobby-account-copy {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }

        .lobby-account-copy .username {
            margin: 0;
            font-weight: 700;
            color: var(--color-text);
        }

        .btn-logout {
            min-height: 40px;
            padding: 0 14px;
            border-radius: var(--radius-pill);
        }

        .lobby-intro-card {
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: var(--space-4);
            background: var(--color-surface-strong);
        }

        .lobby-intro-card h2 {
            margin-bottom: var(--space-2);
        }

        .room-tabs-modern {
            background: transparent;
            margin-bottom: var(--space-4);
        }

        .room-tabs-modern .btn {
            font-size: var(--font-body-sm);
            font-weight: 600;
            padding: 0 16px;
            border-radius: var(--radius-pill);
        }

        @media (max-width: 980px) {
            .lobby-header-modern {
                flex-direction: column;
                align-items: stretch;
            }

            .lobby-header-actions {
                min-width: 0;
                align-items: stretch;
            }

            .lobby-utility-group {
                justify-content: flex-start;
            }
        }

        @media (max-width: 640px) {
            .lobby-brand {
                align-items: flex-start;
            }

            .lobby-account-cluster {
                border-radius: var(--radius-md);
                align-items: flex-start;
            }

            .utility-pill.analytics-btn,
            .room-tabs-modern .btn {
                width: 100%;
                justify-content: center;
            }
        }

        /* Lobby V3 full replacement */
        /* ── Lobby V4 — 3-Column Dashboard ── */
        #lobby-screen.screen {
            padding: 0;
        }

        .lobby-shell-v4 {
            display: flex;
            flex-direction: column;
            height: 100vh;
            overflow: hidden;
            width: 100%;
        }

        .lobby-topbar-v4 {
            display: flex;
            align-items: center;
            gap: var(--space-4);
            padding: var(--space-3) var(--space-4);
            border-bottom: 1px solid var(--color-border);
            flex-shrink: 0;
        }

        .lobby-brand-v4 {
            display: flex;
            align-items: center;
            gap: var(--space-3);
        }
        .lobby-brand-v4 .lobby-brand-logo { width: 32px; height: 32px; border-radius: 6px; }
        .lobby-brand-v4 h1 { font-size: var(--font-lg); margin: 0; white-space: nowrap; }

        .lobby-search-v4 { flex: 1; max-width: 400px; }
        .lobby-search-v4 input { margin: 0; }

        .lobby-topbar-right {
            margin-left: auto;
            display: flex;
            align-items: center;
            gap: var(--space-3);
        }
        .lobby-greeting { color: var(--color-text-muted); font-size: var(--font-sm); }
        .topbar-level { font-size: var(--font-xs); color: var(--color-text-subtle); }

        /* Level progression card */
        .level-card { text-align: center; }
        .level-card-title { font-size: var(--font-lg); font-weight: 700; margin-bottom: 2px; }
        .level-card-tier { font-size: var(--font-xs); color: var(--color-text-muted); margin-bottom: var(--space-3); }

        .level-xp-bar {
            height: 6px;
            background: var(--color-surface-strong);
            border-radius: 3px;
            overflow: hidden;
            margin-bottom: var(--space-1);
        }

        .level-xp-fill {
            height: 100%;
            background: var(--accent);
            border-radius: 3px;
            transition: width 0.5s ease;
        }

        .level-xp-text { font-size: var(--font-xs); color: var(--color-text-subtle); }
        .level-next-unlock { font-size: var(--font-xs); color: var(--accent); margin-top: var(--space-2); }

        /* Initial-based avatar */
        .avatar-initial {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: var(--font-sm);
            cursor: pointer;
            color: #fff;
            background: var(--accent);
            flex-shrink: 0;
        }

        /* 3-column grid with header row */
        .lobby-dashboard {
            display: grid;
            grid-template-columns: 260px 1fr 300px;
            grid-template-rows: auto 1fr;
            gap: var(--space-3) var(--space-4);
            flex: 1;
            min-height: 0;
            overflow: hidden;
            padding: var(--space-4);
        }

        .lobby-col-left {
            grid-row: 1 / -1; /* left column spans both rows */
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: var(--space-3);
        }

        .lobby-col-right {
            overflow: hidden;
            display: flex;
            flex-direction: column;
            gap: var(--space-3);
        }

        /* Activity feed: constrained height, scrollable */
        .lobby-col-right .community-pulse-feed {
            max-height: 250px;
            overflow-y: auto;
        }

        /* Lobby chat: fills remaining vertical space */
        .lobby-panel-grow {
            flex: 1;
            display: flex;
            flex-direction: column;
            min-height: 0;
        }

        .lobby-chat-inline {
            flex: 1;
            display: flex;
            flex-direction: column;
            min-height: 0;
        }

        .lobby-chat-inline .chat-messages {
            flex: 1;
            overflow-y: auto;
            min-height: 80px;
        }

        .lobby-col-center {
            overflow-y: auto;
            min-height: 0;
        }

        .lobby-panel {
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-md);
            padding: var(--space-4);
        }

        .panel-header {
            font-size: var(--font-sm);
            font-weight: 700;
            color: var(--color-text-muted);
            text-transform: uppercase;
            letter-spacing: 0.05em;
            margin-bottom: var(--space-3);
        }

        .panel-header-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: var(--space-3);
            gap: var(--space-2);
        }
        .panel-header-row .panel-header { margin-bottom: 0; white-space: nowrap; }
        .panel-header-row .pulse-tabs {
            display: flex;
            gap: 2px;
            flex-shrink: 0;
        }
        .panel-header-row .pulse-tab {
            min-height: 28px;
            padding: 0 10px;
            font-size: var(--font-xs);
        }

        .panel-empty { color: var(--color-text-subtle); font-size: var(--font-sm); text-align: center; padding: var(--space-4); }

        /* Widget drag handle — hidden by default, visible on hover.
           Prep for gridstack.js integration: each .lobby-widget has
           data-widget-id and this handle. No drag behavior wired yet. */
        .lobby-widget { position: relative; }
        .widget-drag-handle {
            position: absolute;
            top: var(--space-2);
            right: var(--space-2);
            color: var(--color-text-subtle);
            font-size: var(--font-xs);
            cursor: grab;
            opacity: 0;
            transition: opacity 0.15s ease;
            user-select: none;
            letter-spacing: 2px;
        }
        .lobby-widget:hover .widget-drag-handle { opacity: 0.5; }
        .widget-drag-handle:hover { opacity: 1 !important; }

        /* Portfolio hero */
        .portfolio-hero { margin-bottom: var(--space-3); }
        .hero-equity { font-size: var(--font-display); font-weight: 700; letter-spacing: -0.02em; }
        .hero-pnl { font-size: var(--font-sm); color: var(--color-text-muted); }

        .portfolio-mini-stats {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: var(--space-2);
            margin-bottom: var(--space-3);
            padding-bottom: var(--space-3);
            border-bottom: 1px solid var(--color-border);
        }
        .mini-stat { text-align: center; }
        .mini-stat span { display: block; font-size: var(--font-xs); color: var(--color-text-subtle); }
        .mini-stat strong { font-size: var(--font-base); }

        .lobby-holdings-list { font-size: var(--font-sm); }

        /* Quick lookup */
        .quick-lookup-row { display: flex; gap: var(--space-2); }
        .quick-lookup-row input { flex: 1; margin: 0; }
        .quick-lookup-row .btn { margin: 0; white-space: nowrap; }
        .quick-lookup-result { margin-top: var(--space-3); font-size: var(--font-sm); }

        /* Lobby leaderboard */
        .lobby-leaderboard { font-size: var(--font-sm); }

        /* Rooms header with inline tabs — spans center + right columns */
        .rooms-header-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: var(--space-3);
            flex-wrap: wrap;
            grid-column: 2 / -1;
        }
        .rooms-title { margin: 0; font-size: var(--font-lg); }
        .rooms-tabs { display: flex; gap: var(--space-1); flex-wrap: wrap; }

        /* Room carousel — horizontal scroll */
        .room-carousel {
            display: flex;
            gap: var(--space-3);
            overflow-x: auto;
            padding-bottom: var(--space-2);
            scroll-snap-type: x mandatory;
            -webkit-overflow-scrolling: touch;
        }

        .room-carousel::-webkit-scrollbar { height: 4px; }
        .room-carousel::-webkit-scrollbar-track { background: transparent; }
        .room-carousel::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }

        .room-carousel-empty {
            color: var(--color-text-subtle);
            padding: var(--space-5);
            text-align: center;
            width: 100%;
        }

        .room-carousel-card {
            flex: 0 0 280px;
            scroll-snap-align: start;
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-md);
            padding: var(--space-4);
            display: flex;
            flex-direction: column;
            gap: var(--space-2);
            transition: border-color 0.2s ease, transform 0.2s ease;
            cursor: pointer;
        }

        .room-carousel-card:hover {
            border-color: var(--accent);
            transform: translateY(-2px);
        }

        .room-carousel-card .room-card-name {
            font-weight: 700;
            font-size: var(--font-base);
        }

        .room-carousel-card .room-card-meta {
            font-size: var(--font-xs);
            color: var(--color-text-muted);
        }

        .room-carousel-card .room-card-actions {
            display: flex;
            gap: var(--space-2);
            margin-top: auto;
        }

        .room-carousel-card .room-card-actions .btn {
            flex: 1;
            margin: 0;
            min-height: 36px;
            font-size: var(--font-sm);
        }

        .room-add-card {
            align-items: center;
            justify-content: center;
            text-align: center;
            border-style: dashed;
            opacity: 0.6;
            min-height: 100px;
        }

        .room-add-card:hover { opacity: 1; }

        .add-card-icon {
            font-size: 2rem;
            font-weight: 300;
            color: var(--color-text-muted);
            line-height: 1;
        }

        /* News feed placeholder */
        .news-feed-placeholder {
            display: flex;
            flex-direction: column;
        }

        .news-headline-row {
            display: flex;
            justify-content: space-between;
            align-items: baseline;
            gap: var(--space-3);
            padding: var(--space-2) 0;
            border-bottom: 1px solid var(--color-border);
        }

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

        .news-headline {
            font-size: var(--font-sm);
            color: var(--color-text);
            flex: 1;
        }

        .news-time {
            font-size: var(--font-xs);
            color: var(--color-text-subtle);
            white-space: nowrap;
        }

        /* Mobile: stack to single column */
        @media (max-width: 1024px) {
            .lobby-dashboard {
                grid-template-columns: 1fr 280px;
            }
            .lobby-col-left { display: none; }
        }

        @media (max-width: 768px) {
            .lobby-dashboard {
                grid-template-columns: 1fr;
                overflow-y: auto;
            }
            .lobby-col-right { order: 2; }
            .lobby-topbar-v4 { flex-wrap: wrap; }
            .lobby-search-v4 { order: 3; flex-basis: 100%; max-width: 100%; }
        }

        /* ── Legacy lobby v3 (kept for compat, dead code) ── */
        .lobby-v3-shell {
            max-width: 1480px;
            margin: 0 auto;
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        .lobby-v3-topbar {
            display: grid;
            grid-template-columns: 25% 45% 30%;
            align-items: center;
            gap: 16px;
            padding: 10px 0 6px;
        }

        .lobby-v3-brand,
        .lobby-v3-topbar-actions,
        .lobby-account-toggle,
        .lobby-v3-brand-copy {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .lobby-v3-brand-copy {
            gap: 2px;
            align-items: flex-start;
            flex-direction: column;
        }
        .lobby-v3-brand-copy h1 {
            margin: 0;
            font-size: 1.18rem;
            letter-spacing: -0.02em;
            color: var(--color-text);
            line-height: 1.05;
        }
        .product-context-label {
            font-size: 0.76rem;
            color: var(--color-text-subtle);
            font-weight: 600;
            letter-spacing: 0.01em;
        }
        .surface-label {
            font-size: var(--font-xs);
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--color-text-subtle);
            margin-bottom: 6px;
        }

        .lobby-search-input {
            margin: 0;
            background: rgba(255,255,255,0.025);
            border: 1px solid rgba(255,255,255,0.06);
            min-height: 42px;
            border-radius: 12px;
        }

        .lobby-v3-topbar-actions {
            justify-content: flex-end;
            gap: 10px;
        }

        .topbar-icon-btn {
            min-height: 38px;
            padding: 0 12px;
            border-radius: 10px;
            border: 1px solid rgba(255,255,255,0.06);
            background: transparent;
            color: var(--color-text-muted);
            font-weight: 600;
            cursor: pointer;
        }

        .topbar-utility-btn {
            font-size: 0.82rem;
            letter-spacing: 0.01em;
        }

        .lobby-account-menu-wrap { position: relative; }

        .lobby-account-toggle {
            border: 1px solid rgba(255,255,255,0.06);
            background: rgba(255,255,255,0.025);
            border-radius: 12px;
            min-height: 42px;
            padding: 6px 10px;
            color: var(--color-text);
            cursor: pointer;
            gap: 10px;
        }

        .lobby-account-identity {
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            gap: 1px;
            line-height: 1.1;
        }

        .account-chip-meta {
            font-size: var(--font-xs);
            color: var(--color-text-subtle);
        }

        .account-chip-caret {
            color: var(--color-text-subtle);
            font-size: var(--font-sm);
            margin-left: 2px;
        }

        .lobby-account-dropdown {
            position: absolute;
            top: calc(100% + 10px);
            right: 0;
            width: 300px;
            padding: 16px;
            border-radius: 16px;
            background: #151821;
            border: 1px solid var(--color-surface-strong);
            box-shadow: 0 24px 60px rgba(0,0,0,0.45);
            z-index: 40;
        }

        .account-dropdown-header,
        .account-dropdown-actions {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .account-dropdown-header { flex-direction: row; align-items: center; margin-bottom: 16px; }
        .lobby-avatar-modern.small { width: 40px; height: 40px; }
        .account-dropdown-name { font-weight: 700; color: var(--color-text); }
        .account-dropdown-rank { color: var(--color-text-muted); font-size: var(--font-sm); margin-top: 4px; }

        .account-dropdown-stats {
            display: grid;
            gap: 12px;
            margin-bottom: 16px;
        }

        .account-mini-stat {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding-bottom: 12px;
            border-bottom: 1px solid rgba(255,255,255,0.06);
        }
        .account-mini-stat:last-child { border-bottom: none; padding-bottom: 0; }
        .account-mini-stat span { color: var(--color-text-subtle); font-size: var(--font-sm); }
        .account-mini-stat strong { color: var(--color-text); }

        .account-menu-btn {
            min-height: 40px;
            border-radius: 12px;
            border: 1px solid var(--color-surface-strong);
            background: var(--color-surface);
            color: var(--color-text);
            cursor: pointer;
            text-align: left;
            padding: 0 12px;
        }
        .account-menu-btn.danger { color: #f7b1b1; }

        .lobby-control-strip {
            display: grid;
            grid-template-columns: minmax(0, 1fr) auto auto;
            gap: 16px;
            align-items: end;
            padding: 12px 16px;
        }

        .control-strip-group {
            display: flex;
            flex-direction: column;
            gap: 8px;
            min-width: 0;
        }

        .control-strip-actions {
            justify-self: end;
            align-self: center;
        }

        .control-strip-label {
            font-size: var(--font-xs);
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--color-text-subtle);
        }

        .lobby-scope-switch,
        .pulse-tabs,
        .room-card-actions {
            display: flex;
            gap: 12px;
            align-items: center;
            flex-wrap: wrap;
        }

        .scope-chip,
        .filter-chip,
        .pulse-tab {
            min-height: 36px;
            padding: 0 14px;
            border-radius: 999px;
            border: 1px solid var(--color-surface-strong);
            background: transparent;
            color: var(--color-text-muted);
            cursor: pointer;
            font-weight: 600;
        }

        .join-action-btn {
            min-height: 38px;
            padding: 0 16px;
            border-radius: 10px;
            white-space: nowrap;
        }

        .scope-chip.active,
        .filter-chip.active,
        .pulse-tab.active {
            background: rgba(103, 114, 255, 0.18);
            border-color: rgba(103, 114, 255, 0.36);
            color: #f3f5ff;
        }

        .lobby-v3-main {
            display: grid;
            grid-template-columns: minmax(0, 73%) minmax(280px, 27%);
            gap: 24px;
            align-items: start;
        }

        .lobby-market-column,
        .lobby-market-panel {
            display: flex;
            flex-direction: column;
            gap: 24px;
            min-width: 0;
        }

        .market-section-header h2,
        .pulse-rail-header h2,
        .discovery-action-card h2 { margin: 0; }

        .market-section-note {
            margin: 8px 0 0;
            color: var(--color-text-muted);
            font-size: 0.88rem;
            max-width: 560px;
        }

        .featured-room-slot,
        .private-featured-slot,
        .joined-featured-slot,
        .spotlight-room-slot,
        .standard-room-grid,
        .compact-room-grid {
            display: grid;
            gap: 16px;
        }

        .spotlight-room-slot { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .standard-room-grid,
        .compact-room-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

        .room-market-card {
            border-radius: 16px;
            border: 1px solid var(--color-border);
            background: var(--color-surface);
            box-shadow: 0 10px 28px rgba(0,0,0,0.16);
            display: flex;
            flex-direction: column;
            min-width: 0;
            transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
            cursor: pointer;
        }

        .room-market-card:hover {
            transform: translateY(-3px);
            border-color: var(--accent);
            box-shadow: 0 16px 36px rgba(0,0,0,0.24);
        }

        .featured-room-card { padding: 28px 32px; min-height: 300px; background: var(--color-surface-strong); }
        .spotlight-room-card { padding: 20px 24px; min-height: 210px; }
        .standard-room-card { padding: 16px; min-height: 196px; }
        .compact-room-card { padding: 12px 14px; min-height: 164px; }
        .private-room-card { background: rgba(128, 92, 255, 0.08); }
        .joined-room-card { background: rgba(56, 189, 248, 0.08); }

        .room-card-topline,
        .room-card-footer,
        .pulse-item-header,
        .pulse-item-actions,
        .pulse-rail-header {
            display: flex;
            justify-content: space-between;
            gap: 12px;
            align-items: center;
        }

        .room-card-kicker,
        .room-card-visibility,
        .pulse-item-type {
            font-size: var(--font-xs);
            letter-spacing: 0.08em;
            text-transform: uppercase;
            color: var(--color-text-subtle);
        }

        .room-card-head { margin-top: 10px; }
        .room-card-title { margin: 0; font-size: 1.28rem; line-height: 1.1; color: var(--color-text); }
        .spotlight-room-card .room-card-title { font-size: 1.05rem; }
        .standard-room-card .room-card-title,
        .compact-room-card .room-card-title { font-size: 0.98rem; }
        .room-card-subtitle { margin: 6px 0 0; color: var(--color-text-muted); font-size: var(--font-sm); }
        .room-card-story { margin: 10px 0 0; color: #d8dbe7; max-width: 66%; line-height: 1.42; font-size: var(--font-sm); }

        .room-card-metrics {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 12px;
            margin-top: 20px;
        }
        .standard-room-card .room-card-metrics,
        .compact-room-card .room-card-metrics { margin-top: 14px; gap: 10px; }

        .room-metric {
            display: flex;
            flex-direction: column;
            gap: 3px;
            padding: 10px 12px;
            border-radius: 10px;
            background: rgba(0,0,0,0.14);
            border: 1px solid rgba(255,255,255,0.035);
        }
        .room-metric span { font-size: var(--font-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-subtle); }
        .room-metric strong { color: var(--color-text); font-size: var(--font-sm); }

        .room-card-footer { margin-top: auto; padding-top: 20px; align-items: flex-end; }
        .standard-room-card .room-card-footer,
        .compact-room-card .room-card-footer { padding-top: 14px; }
        .room-card-code-block { display: flex; flex-direction: column; gap: 3px; }
        .room-card-code-label { font-size: var(--font-xs); color: var(--color-text-subtle); text-transform: uppercase; letter-spacing: 0.08em; }
        .room-card-code { font-family: monospace; color: var(--color-text); font-size: var(--font-sm); }
        .room-card-actions .btn { min-height: 38px; }
        .room-card-secondary { background: transparent !important; box-shadow: none; }

        .community-pulse-rail {
            position: sticky;
            top: 24px;
            padding: 14px;
            display: flex;
            flex-direction: column;
            gap: 14px;
            min-height: 720px;
        }

        .pulse-compose-btn {
            min-height: 38px;
            border-radius: 10px;
            border: 1px solid rgba(255,255,255,0.06);
            background: rgba(255,255,255,0.025);
            color: var(--color-text);
            cursor: pointer;
            font-weight: 600;
        }

        .community-pulse-feed {
            display: flex;
            flex-direction: column;
            gap: 10px;
            min-height: 0;
            overflow-y: auto;
            padding-right: 2px;
        }

        .pulse-item {
            padding: 10px 12px;
            border-radius: 10px;
            border: 1px solid var(--color-surface);
            background: rgba(0,0,0,0.12);
        }
        .pulse-item-message { border-left: 2px solid rgba(94, 234, 212, 0.5); }
        .pulse-item-activity { border-left: 2px solid rgba(129, 140, 248, 0.55); }
        .pulse-item-post { border-left: 2px solid rgba(244, 114, 182, 0.45); }
        .pulse-item-title-row {
            display: flex;
            justify-content: space-between;
            align-items: baseline;
            gap: 10px;
            margin-top: 6px;
        }
        .pulse-item-title { color: var(--color-text); font-weight: 600; font-size: var(--font-sm); }
        .pulse-item-recency { color: #cfd6ec; font-size: var(--font-xs); letter-spacing: 0.08em; text-transform: uppercase; }
        .pulse-item-body { margin-top: 6px; color: var(--color-text-muted); font-size: 0.84rem; line-height: 1.4; }
        .pulse-item-time { color: #d4dbef; font-size: 0.73rem; font-weight: 600; }
        .pulse-item-actions { margin-top: 8px; justify-content: flex-start; gap: 10px; }
        .pulse-link-btn {
            border: none;
            background: none;
            color: #cdd5ff;
            padding: 0;
            cursor: pointer;
            font-size: 0.78rem;
            font-weight: 600;
        }

        .feed-empty-state,
        .room-empty-state {
            color: #8d94aa;
            text-align: center;
            padding: 20px;
            border-radius: 16px;
            background: var(--color-surface);
            border: 1px dashed var(--color-surface-strong);
            grid-column: 1 / -1;
        }

        .discovery-action-card { padding: 24px; }
        .discovery-card-copy { color: var(--color-text-muted); margin: 12px 0 0; }

        @media (max-width: 1200px) {
            .lobby-v3-topbar { grid-template-columns: 1fr; }
            .lobby-v3-main { grid-template-columns: 1fr; }
            .community-pulse-rail { position: static; min-height: 0; }
        }

        @media (max-width: 980px) {
            .spotlight-room-slot,
            .standard-room-grid,
            .compact-room-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
            .lobby-control-strip { grid-template-columns: 1fr; align-items: stretch; }
            .control-strip-actions { justify-self: start; }
        }

        @media (max-width: 720px) {
            .spotlight-room-slot,
            .standard-room-grid,
            .compact-room-grid { grid-template-columns: 1fr; }
            .featured-room-card { padding: 24px; }
            .room-card-story { max-width: 100%; }
            .room-card-footer,
            .pulse-rail-header,
            .lobby-v3-topbar-actions { flex-direction: column; align-items: stretch; }
            .lobby-v3-search-wrap { display: none; }
        }

        /* Community Screen Styles */
        .community-control-strip {
            display: grid;
            grid-template-columns: 1fr auto;
            gap: 16px;
            align-items: end;
            padding: 12px 16px;
        }

        .community-main-layout {
            display: grid;
            grid-template-columns: minmax(0, 1fr) 300px;
            gap: 24px;
            align-items: start;
        }

        .community-feed-main {
            display: flex;
            flex-direction: column;
            gap: 16px;
        }

        .community-sidebar {
            position: sticky;
            top: 24px;
            padding: 16px;
        }

        .community-sidebar h3 {
            font-size: var(--font-sm);
            color: var(--color-text-muted);
            margin-bottom: 12px;
        }

        .trending-tickers-list,
        .active-rooms-list {
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        .trending-ticker-item,
        .active-room-item {
            padding: 10px 12px;
            background: var(--color-surface);
            border-radius: 8px;
            border: 1px solid rgba(255,255,255,0.06);
            cursor: pointer;
            transition: background 0.2s;
        }

        .trending-ticker-item:hover,
        .active-room-item:hover {
            background: var(--color-surface-strong);
        }

        .trending-ticker-symbol {
            font-weight: 700;
            color: var(--color-text);
            font-size: var(--font-base);
        }

        .trending-ticker-mentions {
            font-size: var(--font-xs);
            color: var(--color-text-subtle);
            margin-top: 2px;
        }

        .active-room-name {
            font-weight: 600;
            color: var(--color-text);
            font-size: var(--font-sm);
        }

        .active-room-meta {
            font-size: var(--font-xs);
            color: var(--color-text-subtle);
            margin-top: 2px;
        }

        /* Composer Modal */
        .composer-type-selector {
            display: flex;
            gap: 8px;
            margin-bottom: 16px;
        }

        .composer-type-btn {
            flex: 1;
            min-height: 42px;
            padding: 0 14px;
            border-radius: 10px;
            border: 1px solid var(--color-surface-strong);
            background: var(--color-surface);
            color: var(--color-text-muted);
            cursor: pointer;
            font-weight: 600;
            transition: all 0.2s;
        }

        .composer-type-btn.active {
            background: rgba(103, 114, 255, 0.18);
            border-color: rgba(103, 114, 255, 0.36);
            color: #f3f5ff;
        }

        .composer-form {
            display: none;
        }

        .composer-form.active {
            display: flex;
            flex-direction: column;
            gap: 12px;
        }

        .composer-guidance {
            font-size: var(--font-sm);
            color: var(--color-text-muted);
            padding: 10px;
            background: var(--color-surface);
            border-radius: 8px;
            border-left: 3px solid var(--accent);
        }

        .composer-input {
            min-height: 42px;
            padding: 10px 12px;
            border-radius: 8px;
            border: 1px solid var(--color-border);
            background: var(--color-surface);
            color: var(--color-text);
            font-size: var(--font-base);
        }

        .composer-textarea {
            min-height: 120px;
            padding: 12px;
            border-radius: 8px;
            border: 1px solid var(--color-border);
            background: var(--color-surface);
            color: var(--color-text);
            font-size: var(--font-base);
            resize: vertical;
            font-family: inherit;
        }

        .composer-footer {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: var(--font-sm);
        }

        .char-counter {
            color: var(--color-text-subtle);
        }

        .char-counter.valid {
            color: var(--color-success);
        }

        .char-counter.invalid {
            color: var(--color-danger);
        }

        .validation-message {
            color: var(--color-text-subtle);
            font-size: var(--font-xs);
        }

        .validation-message.error {
            color: var(--color-danger);
        }

        .validation-message.success {
            color: var(--color-success);
        }

        .composer-actions {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-top: 16px;
            padding-top: 16px;
            border-top: 1px solid var(--color-border);
            gap: 12px;
        }

        /* Community Post Card */
        .community-post-card {
            background: var(--color-surface);
            border-radius: 12px;
            padding: 18px;
            border: 1px solid rgba(255,255,255,0.06);
            box-shadow: var(--shadow-panel);
        }

        .community-post-type-badge {
            display: inline-block;
            font-size: var(--font-xs);
            padding: 3px 8px;
            border-radius: 4px;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        .post-type-post {
            background: rgba(244, 114, 182, 0.15);
            color: #f472b6;
        }

        .post-type-trade-idea {
            background: rgba(34, 197, 94, 0.15);
            color: #22c55e;
        }

        .post-type-dd {
            background: rgba(59, 130, 246, 0.15);
            color: #3b82f6;
        }

        .community-post-header {
            display: flex;
            align-items: flex-start;
            gap: 12px;
            margin-bottom: 12px;
        }

        .community-post-author-info {
            flex: 1;
        }

        .community-post-author-name {
            font-weight: 700;
            color: var(--color-text);
            cursor: pointer;
        }

        .community-post-meta {
            font-size: var(--font-xs);
            color: var(--color-text-subtle);
            margin-top: 2px;
        }

        .community-post-title {
            font-size: 1.15rem;
            font-weight: 700;
            margin-bottom: 8px;
            color: var(--color-text);
        }

        .community-post-body {
            font-size: var(--font-base);
            color: var(--color-text-muted);
            line-height: 1.5;
            margin-bottom: 12px;
        }

        .community-post-body.preview {
            display: -webkit-box;
            -webkit-line-clamp: 4;
            -webkit-box-orient: vertical;
            overflow: hidden;
        }

        .trade-idea-ticker-badge {
            display: inline-flex;
            align-items: center;
            gap: 6px;
            padding: 6px 12px;
            background: var(--color-surface-strong);
            border-radius: 8px;
            font-weight: 700;
            margin-bottom: 8px;
        }

        .bias-bullish {
            color: #22c55e;
        }

        .bias-bearish {
            color: #ef4444;
        }

        .bias-neutral {
            color: #a0a0a0;
        }

        .community-post-engagement {
            display: flex;
            gap: 16px;
            padding-top: 12px;
            border-top: 1px solid rgba(255,255,255,0.06);
            margin-top: 12px;
        }

        .engagement-btn {
            display: flex;
            align-items: center;
            gap: 6px;
            background: none;
            border: none;
            color: var(--color-text-muted);
            cursor: pointer;
            padding: 6px 10px;
            border-radius: 6px;
            font-size: var(--font-sm);
            transition: all 0.2s;
        }

        .engagement-btn:hover {
            background: var(--color-surface-strong);
            color: var(--color-text);
        }

        .engagement-btn.active {
            color: var(--accent);
        }

        .comment-section {
            margin-top: 12px;
            padding-top: 12px;
            border-top: 1px solid rgba(255,255,255,0.06);
        }

        .comment-list {
            display: flex;
            flex-direction: column;
            gap: 10px;
            margin-bottom: 12px;
        }

        .community-comment-item {
            display: flex;
            gap: 10px;
            padding: 10px;
            background: rgba(0,0,0,0.15);
            border-radius: 8px;
        }

        .comment-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            background: var(--accent);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: var(--font-sm);
            font-weight: 700;
            flex-shrink: 0;
        }

        .comment-content {
            flex: 1;
        }

        .comment-author-name {
            font-weight: 600;
            color: var(--color-text);
            font-size: var(--font-sm);
        }

        .comment-body {
            font-size: var(--font-sm);
            color: var(--color-text-muted);
            margin-top: 3px;
        }

        .comment-time {
            font-size: var(--font-xs);
            color: var(--color-text-subtle);
            margin-top: 4px;
        }

        .comment-input-form {
            display: flex;
            gap: 8px;
        }

        .comment-input {
            flex: 1;
            min-height: 36px;
            padding: 8px 12px;
            border-radius: 18px;
            border: 1px solid var(--color-border);
            background: var(--color-surface);
            color: var(--color-text);
            font-size: var(--font-sm);
        }

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

            .community-sidebar {
                position: static;
            }
        }

        @media (max-width: 640px) {
            .community-control-strip {
                grid-template-columns: 1fr;
            }

            .composer-type-selector {
                flex-direction: column;
            }
        }

        /* Community Post Card - Additional Styles */
        .post-header {
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 12px;
        }

        .post-author-info {
            display: flex;
            align-items: center;
            gap: 10px;
            flex: 1;
        }

        .post-author-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: var(--accent);
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            font-size: var(--font-lg);
            color: #fff;
        }

        .post-author-name {
            font-weight: 600;
            color: var(--color-text);
            font-size: var(--font-base);
        }

        .post-timestamp {
            font-size: var(--font-xs);
            color: var(--color-text-subtle);
        }

        .post-content {
            margin-bottom: 12px;
        }

        .post-actions {
            display: flex;
            gap: 12px;
            padding-top: 12px;
            border-top: 1px solid var(--color-border);
        }

        .post-action-btn {
            display: flex;
            align-items: center;
            gap: 6px;
            background: none;
            border: none;
            color: var(--color-text-subtle);
            cursor: pointer;
            padding: 6px 12px;
            border-radius: 6px;
            font-size: var(--font-sm);
            transition: all 0.2s;
        }

        .post-action-btn:hover {
            background: var(--color-surface-hover);
            color: var(--color-text);
        }

        .feed-empty-state {
            text-align: center;
            padding: 32px;
            color: var(--color-text-subtle);
            font-size: var(--font-base);
        }


        /* Community MVP */
        /* ── Community V2 ── */
        #community-screen.screen { padding: 0; }

        .community-v2 {
            display: flex;
            flex-direction: column;
            height: 100vh;
            overflow: hidden;
        }

        .community-header-bar {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: var(--space-3) var(--space-5);
            border-bottom: 1px solid var(--color-border);
            flex-shrink: 0;
            gap: var(--space-3);
        }

        .community-header-bar h1 { font-size: var(--font-lg); margin: 0; }
        .community-subtitle { font-size: var(--font-sm); color: var(--color-text-muted); }
        .community-header-actions { display: flex; align-items: center; gap: var(--space-3); }

        .community-layout {
            flex: 1;
            display: grid;
            grid-template-columns: 1fr 300px;
            gap: var(--space-4);
            padding: var(--space-4);
            overflow-y: auto;
            min-height: 0;
        }

        .community-feed-main { min-height: 0; overflow-y: auto; }

        .community-sidebar {
            display: flex;
            flex-direction: column;
            gap: var(--space-3);
        }

        .community-guidelines {
            margin: 0;
            padding-left: var(--space-4);
            color: var(--color-text-muted);
            font-size: var(--font-sm);
            display: flex;
            flex-direction: column;
            gap: var(--space-2);
        }

        .community-empty-prompt {
            text-align: center;
            padding: var(--space-7) var(--space-5);
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-md);
            color: var(--color-text);
        }

        .community-feed-list .feed-empty-state {
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-md);
            padding: var(--space-5);
            color: var(--color-text-muted);
        }

        @media (max-width: 768px) {
            .community-layout { grid-template-columns: 1fr; }
            .community-sidebar { display: none; }
            .community-header-bar { flex-wrap: wrap; }
        }

        /* Legacy community styles kept for card rendering */
        .community-shell { max-width: 1360px; margin: 0 auto; display:flex; flex-direction:column; gap:16px; }
        .community-topbar { display:flex; justify-content:space-between; align-items:center; gap:16px; padding:10px 0 6px; }
        .community-brand-block, .community-topbar-actions, .community-title-block, .community-composer-toprow, .community-counter-group { display:flex; gap:12px; align-items:center; }
        .community-title-block { flex-direction:column; align-items:flex-start; gap:2px; }
        .community-title-block h1 { margin:0; font-size:1.2rem; letter-spacing:-0.02em; }
        .community-sort-strip { padding:12px 16px; }
        .community-sort-tabs, .community-type-tabs { display:flex; gap:12px; flex-wrap:wrap; }
        .community-main-grid { display:grid; grid-template-columns:minmax(0,72%) minmax(280px,28%); gap:24px; align-items:start; }
        .community-feed-column { display:flex; flex-direction:column; gap:16px; min-width:0; }
        .community-composer { padding:20px; display:flex; flex-direction:column; gap:16px; }
        .community-composer-toprow { justify-content:space-between; align-items:flex-start; }
        .community-guidance { color:var(--color-text-muted); font-size:0.84rem; max-width:420px; text-align:right; }
        .community-composer-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
        .community-composer-grid textarea { grid-column:1 / -1; min-height:140px; resize:vertical; }
        .community-composer-footer { display:flex; justify-content:space-between; align-items:center; gap:12px; }
        .community-validation-text { font-size:0.84rem; color:var(--color-text-muted); }
        .community-counter { font-size:0.78rem; color:var(--color-text-subtle); }
        .community-feed-list { display:flex; flex-direction:column; gap:12px; }
        .community-card { padding:16px; border-radius:14px; border:1px solid rgba(255,255,255,0.06); background:var(--color-surface); display:flex; flex-direction:column; gap:12px; }
        .community-card-head, .community-card-footer, .community-thread-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; }
        .community-card-meta { display:flex; gap:8px; flex-wrap:wrap; color:var(--color-text-subtle); font-size:0.76rem; }
        .community-card-type { font-size:0.68rem; letter-spacing:0.08em; text-transform:uppercase; color:var(--color-text-subtle); }
        .community-card-title { margin:0; font-size:1rem; color:var(--color-text); }
        .community-card-body { color:var(--color-text-muted); line-height:1.45; font-size:0.92rem; }
        .community-tag-row { display:flex; gap:8px; flex-wrap:wrap; }
        .community-tag { padding:4px 8px; border-radius:999px; background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.06); font-size:0.74rem; color:var(--color-text-subtle); }
        .trade-idea-banner { display:flex; gap:8px; align-items:center; font-size:0.8rem; font-weight:600; color:var(--color-text); }
        .trade-bias-pill { padding:4px 8px; border-radius:999px; font-size:0.72rem; text-transform:capitalize; background:var(--color-surface); }
        .trade-bias-pill.bullish { color:#9be7b0; }
        .trade-bias-pill.bearish { color:#f5aaaa; }
        .trade-bias-pill.neutral { color:#d6d6d6; }
        .community-card-footer { align-items:center; }
        .community-stat-row { display:flex; gap:12px; color:var(--color-text-subtle); font-size:0.78rem; }
        .community-link-btn { border:none; background:none; color:#cdd5ff; font-size:0.8rem; font-weight:600; cursor:pointer; padding:0; }
        .community-comment-thread { display:none; padding-top:12px; border-top:1px solid rgba(255,255,255,0.06); }
        .community-comment-list { display:flex; flex-direction:column; gap:10px; margin-bottom:12px; }
        .community-comment-item { padding:10px 12px; border-radius:10px; background:rgba(0,0,0,0.14); border:1px solid rgba(255,255,255,0.04); }
        .community-comment-item p { margin:6px 0 0; color:var(--color-text-muted); font-size:0.88rem; }
        .community-comment-form { display:flex; gap:10px; align-items:flex-start; }
        .community-comment-form textarea { min-height:70px; resize:vertical; margin:0; }
        .community-context-rail { padding:16px; display:flex; flex-direction:column; gap:16px; position:sticky; top:24px; }
        .community-rule-list { margin:0; padding-left:18px; color:var(--color-text-muted); display:flex; flex-direction:column; gap:8px; }
        .community-context-box { padding:12px; border-radius:12px; background:var(--color-surface); border:1px solid rgba(255,255,255,0.06); }
        .context-kicker { font-size:0.72rem; text-transform:uppercase; letter-spacing:0.08em; color:var(--color-text-subtle); margin-bottom:8px; }
        .community-empty-state { padding:16px; }
        @media (max-width: 1100px) { .community-main-grid { grid-template-columns:1fr; } .community-context-rail { position:static; } }
        @media (max-width: 760px) { .community-topbar, .community-composer-toprow, .community-composer-footer, .community-comment-form { flex-direction:column; align-items:stretch; } .community-composer-grid { grid-template-columns:1fr; } }

        /* ══════════════════════════════════════════════════════════
           SETTINGS SCREEN
           ══════════════════════════════════════════════════════════ */

        #settings-screen.screen { padding: var(--space-5); }

        .settings-shell {
            max-width: 700px;
            margin: 0 auto;
        }

        .settings-shell h1 {
            font-size: var(--font-display);
            margin-bottom: var(--space-5);
        }

        .settings-section {
            margin-bottom: var(--space-6);
        }

        .settings-section h2 {
            font-size: var(--font-lg);
            margin-bottom: var(--space-2);
        }

        .settings-desc {
            color: var(--color-text-muted);
            font-size: var(--font-sm);
            margin-bottom: var(--space-4);
        }

        .theme-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
            gap: var(--space-3);
        }

        .theme-card {
            background: var(--color-surface);
            border: 2px solid var(--color-border);
            border-radius: var(--radius-md);
            padding: var(--space-3);
            cursor: pointer;
            transition: border-color 0.2s ease, transform 0.15s ease;
            text-align: center;
        }

        .theme-card:hover {
            border-color: var(--color-border-strong);
            transform: translateY(-2px);
        }

        .theme-card.active {
            border-color: var(--accent);
            box-shadow: 0 0 0 1px var(--accent);
        }

        .theme-swatches {
            display: flex;
            gap: 3px;
            margin-bottom: var(--space-2);
            height: 40px;
            border-radius: var(--radius-sm);
            overflow: hidden;
        }

        .theme-swatches span {
            flex: 1;
        }

        .theme-card-label {
            font-size: var(--font-xs);
            font-weight: 600;
            color: var(--color-text-muted);
            text-transform: uppercase;
            letter-spacing: 0.05em;
        }

        .settings-info-grid {
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: var(--radius-md);
            overflow: hidden;
        }

        .settings-info-row {
            display: flex;
            justify-content: space-between;
            padding: var(--space-3) var(--space-4);
            border-bottom: 1px solid var(--color-border);
        }

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

        .settings-label {
            font-size: var(--font-sm);
            color: var(--color-text-muted);
        }

        .settings-value {
            font-size: var(--font-sm);
            font-weight: 600;
        }

        /* ══════════════════════════════════════════════════════════
           THEME OVERRIDES — each theme overrides :root CSS variables
           ══════════════════════════════════════════════════════════ */

        body[data-theme="midnight"] {
            --color-bg: #0a0c10;
            --color-surface: #12151a;
            --color-surface-strong: #1a1e25;
            --color-surface-hover: #222830;
            --color-border: #262c36;
            --color-border-strong: #363e4a;
            --accent: #7c8cf5;
            --primary: #4ade80;
        }

        body[data-theme="ocean"] {
            --color-bg: #0a1628;
            --color-surface: #0f1d33;
            --color-surface-strong: #162640;
            --color-surface-hover: #1e304d;
            --color-border: #1e3a5f;
            --color-border-strong: #2a4d7a;
            --accent: #38bdf8;
            --primary: #34d399;
        }

        body[data-theme="ember"] {
            --color-bg: #141010;
            --color-surface: #1c1414;
            --color-surface-strong: #261a1a;
            --color-surface-hover: #302020;
            --color-border: #3d2828;
            --color-border-strong: #4d3333;
            --accent: #f97316;
            --primary: #fbbf24;
        }

        body[data-theme="synthwave"] {
            --color-bg: #0e0a1a;
            --color-surface: #150f24;
            --color-surface-strong: #1c1430;
            --color-surface-hover: #251c3d;
            --color-border: #2d2248;
            --color-border-strong: #3d2e60;
            --accent: #e879f9;
            --primary: #22d3ee;
        }

        body[data-theme="matrix"] {
            --color-bg: #060d06;
            --color-surface: #0c140c;
            --color-surface-strong: #121c12;
            --color-surface-hover: #1a261a;
            --color-border: #1e3a1e;
            --color-border-strong: #2d4d2d;
            --accent: #22c55e;
            --primary: #4ade80;
            --color-text: #a3e635;
            --color-text-muted: #65a30d;
            --color-text-subtle: #3f6212;
        }

        body[data-theme="arctic"] {
            --color-bg: #f0f4f8;
            --color-surface: #ffffff;
            --color-surface-strong: #e8ecf0;
            --color-surface-hover: #dce0e5;
            --color-border: #c8cdd3;
            --color-border-strong: #a8b0b8;
            --color-text: #1a2030;
            --color-text-muted: #5a6270;
            --color-text-subtle: #8a90a0;
            --accent: #3b82f6;
            --primary: #059669;
            --color-danger: #dc2626;
        }
