/* ============================================================
   The Wealth Lab — FTX-inspired dark trading terminal theme
   Font: Inter | 13px base | 8px spacing grid
   ============================================================ */

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

:root {
    /* FTX color palette */
    --color-bg: #0A0E17;
    --color-surface: #111722;
    --color-surface-2: #1C2230;
    --color-surface-3: #2B2E3B;
    --color-surface-hover: #3A3C47;
    --color-border: #2A2F38;
    --color-text: #FFFFFF;
    --color-text-muted: #878A9B;
    --color-text-disabled: #505363;
    --color-primary: #00B4C9;
    --color-primary-hover: #00A2C7;
    --color-primary-dark: #00566B;
    --color-primary-link: #3EC7E3;
    --color-success: #02C77A;
    --color-danger: #FF3B69;
    --color-warning: #FFB11A;
    --color-green: #02C77A;
    --color-red: #FF3B69;
    --color-nav-bg: #000000;
    --radius: 8px;
    --font-mono: Consolas, "Courier New", monospace;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
    font-feature-settings: "ss01" on;
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 13px;
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: var(--color-primary-link); text-decoration: none; }
a:hover { color: var(--color-primary); text-decoration: none; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; width: 100%; }

main.container { flex: 1; padding-top: 24px; padding-bottom: 32px; }

/* Monospace utility for numeric data */
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ============================================================
   Navigation — pure black top bar, teal active indicator
   ============================================================ */
.nav {
    background: var(--color-nav-bg);
    border-bottom: 1px solid var(--color-border);
    padding: 0;
    height: 48px;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 1000;
}
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 100%; }
.nav-brand {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-primary);
    text-decoration: none;
    letter-spacing: -0.3px;
}
.nav-brand:hover { color: var(--color-primary-link); }
.nav-links { display: flex; align-items: center; gap: 24px; height: 100%; }
.nav-links a {
    color: var(--color-text-muted);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    height: 100%;
    display: flex;
    align-items: center;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.nav-links a:hover { color: var(--color-text); border-bottom-color: var(--color-surface-3); }
.nav-links a.active { color: var(--color-text); border-bottom-color: var(--color-primary); }
.nav-user { color: var(--color-text-muted); font-size: 13px; }
.nav-logout {
    color: var(--color-text-muted) !important;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    padding: 0;
    transition: color 0.15s;
}
.nav-logout:hover { color: var(--color-danger) !important; }

/* ============================================================
   Buttons — teal primary, green buy, pink-red sell
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, opacity 0.15s;
    line-height: 1.4;
    height: 36px;
    background: var(--color-surface-2);
    color: var(--color-text);
}
.btn:hover { text-decoration: none; filter: brightness(1.15); }
.btn-primary { background: #007994; color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-success, .btn-buy { background: var(--color-success); color: #fff; }
.btn-success:hover, .btn-buy:hover { opacity: 0.9; }
.btn-danger, .btn-sell { background: var(--color-danger); color: #fff; }
.btn-danger:hover, .btn-sell:hover { opacity: 0.9; }
.btn-secondary {
    background: transparent;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
}
.btn-secondary:hover { background: var(--color-surface-2); color: var(--color-text); }
.btn-sm { padding: 4px 12px; font-size: 12px; height: 28px; }

/* ============================================================
   Forms — dark inputs with teal focus
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 8px 12px;
    background: var(--color-surface-3);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    font-family: inherit;
    font-size: 13px;
    height: 36px;
    transition: border-color 0.15s;
}
.form-group textarea { height: auto; min-height: 80px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; min-width: 0; }
.form-error { color: var(--color-danger); font-size: 11px; margin-top: 4px; }

/* ============================================================
   Login — full-page split layout
   ============================================================ */

/* Hide nav and footer on login page */
body:has(.login-page) .nav,
body:has(.login-page) .footer { display: none; }
body:has(.login-page) main.container { padding: 0; max-width: none; }

.login-page {
    display: flex;
    min-height: 100vh;
    width: 100%;
}

/* Left panel — hero with background */
.login-left {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(0, 180, 201, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 121, 148, 0.1) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(2, 199, 122, 0.08) 0%, transparent 50%),
        linear-gradient(160deg, #0A0E17 0%, #111722 40%, #0A0E17 100%);
}
.login-left::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(90deg, rgba(255,255,255,0.02) 0px, transparent 1px, transparent 80px),
        repeating-linear-gradient(0deg, rgba(255,255,255,0.02) 0px, transparent 1px, transparent 80px);
    pointer-events: none;
}
.login-left::after {
    content: '';
    position: absolute;
    top: 10%;
    left: 5%;
    width: 90%;
    height: 80%;
    border: 1px solid rgba(0, 180, 201, 0.06);
    border-radius: 24px;
    pointer-events: none;
}

.login-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, transparent 70%, var(--color-bg) 100%);
    pointer-events: none;
}

.login-hero {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 48px;
}
.login-hero-title {
    font-size: 48px;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -1.5px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #FFFFFF 0%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.login-hero-tagline {
    font-size: 18px;
    color: var(--color-text-muted);
    font-weight: 400;
    margin-bottom: 48px;
    letter-spacing: 2px;
    text-transform: uppercase;
}

.login-hero-stats {
    display: flex;
    gap: 40px;
    justify-content: center;
}
.login-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}
.login-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--color-primary);
    font-family: var(--font-mono);
}
.login-stat-label {
    font-size: 11px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Rob's team. Under the stats on a wide screen; under the form on a phone,
   so the form stays near the top. */
.login-team { margin: 40px auto 0; max-width: 440px; }
.login-team img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}
.login-team figcaption { margin-top: 10px; font-size: 13px; color: var(--color-text-muted); }
.login-team-phone { display: none; }

/* Right panel — sign-in form */
.login-right {
    width: 480px;
    min-width: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg);
    padding: 48px;
}
.login-card {
    width: 100%;
    max-width: 360px;
}
.login-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 32px;
    letter-spacing: -0.5px;
}
.login-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 8px;
}
.login-subtitle {
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.5;
    margin-bottom: 32px;
}
.login-footer-text {
    font-size: 12px;
    color: var(--color-text-disabled);
    margin-top: 24px;
    line-height: 1.5;
}
.login-footer-text a {
    color: var(--color-text-muted);
    text-decoration: underline;
    text-decoration-color: var(--color-text-disabled);
}
.login-footer-text a:hover { color: var(--color-primary-link); }

/* ============================================================
   Sections & Headings
   ============================================================ */
h1 { font-size: 22px; font-weight: 600; line-height: 1.3; letter-spacing: -0.3px; }
h2 { font-size: 17px; font-weight: 600; line-height: 1.3; }
h3 { font-size: 15px; font-weight: 600; line-height: 1.3; }

.section { margin-bottom: 24px; }
.section h2 { margin-bottom: 12px; }

/* ============================================================
   Game Cards
   ============================================================ */
.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.game-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
    transition: border-color 0.15s, background 0.15s;
}
.game-card:hover { border-color: var(--color-surface-3); background: var(--color-surface-2); }
.game-card h3 { margin-bottom: 4px; font-size: 15px; }
.game-card h3 a { color: var(--color-text); }
.game-card h3 a:hover { color: var(--color-primary-link); }
.game-card p { color: var(--color-text-muted); font-size: 12px; margin-top: 4px; }
.game-dates { font-size: 12px; color: var(--color-text-muted); }

/* ============================================================
   Badges — compact uppercase
   ============================================================ */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.badge-pending { background: rgba(255, 177, 26, 0.15); color: var(--color-warning); }
.badge-active { background: rgba(2, 199, 122, 0.15); color: var(--color-success); }
.badge-finished { background: rgba(135, 138, 155, 0.15); color: var(--color-text-muted); }
.badge-cancelled { background: rgba(255, 59, 105, 0.15); color: var(--color-danger); }
.badge-pick { background: rgba(255, 177, 26, 0.15); color: var(--color-warning); }

/* ============================================================
   Tables — FTX-style ultra-subtle borders
   ============================================================ */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 12px; text-align: left; }
th {
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--color-border);
}
td {
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
tr:hover td { background: rgba(255, 255, 255, 0.02); }
tr:last-child td { border-bottom: none; }

/* Right-align numeric columns */
td.num, th.num { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ============================================================
   Flash Messages
   ============================================================ */
.flash {
    padding: 10px 20px;
    margin: 12px auto;
    max-width: 1200px;
    border-radius: var(--radius);
    font-size: 13px;
}
.flash-success { background: rgba(2, 199, 122, 0.1); color: var(--color-success); border: 1px solid rgba(2, 199, 122, 0.25); }
.flash-error { background: rgba(255, 59, 105, 0.1); color: var(--color-danger); border: 1px solid rgba(255, 59, 105, 0.25); }
.flash-info { background: rgba(0, 180, 201, 0.1); color: var(--color-primary); border: 1px solid rgba(0, 180, 201, 0.25); }

/* ============================================================
   Toasts
   ============================================================ */
/* Solid backgrounds: a see-through toast over a busy page can't be read. */
#toast-container { position: fixed; top: 12px; right: 12px; z-index: 10001; display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.toast {
    padding: 12px 16px 12px 14px;
    border-radius: var(--radius);
    border-left: 4px solid;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--color-text);
    background: var(--color-surface-2);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
    cursor: pointer;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast-show { opacity: 1; transform: none; }
.toast-success { background: #0E3B2C; border-color: var(--color-success); }
.toast-error { background: #4A1424; border-color: var(--color-danger); }
.toast-info { background: #0C3640; border-color: var(--color-primary); }

/* ============================================================
   Footer
   ============================================================ */
.footer {
    padding: 20px 0;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 12px;
    text-align: center;
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.footer-links a { color: var(--color-text-muted); font-size: 12px; }
.footer-links a:hover { color: var(--color-text); }

/* ============================================================
   Utility classes
   ============================================================ */
.text-green { color: var(--color-green); }
.text-red { color: var(--color-red); }
.text-muted { color: var(--color-text-muted); }

/* ============================================================
   Page Header
   ============================================================ */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.page-header h1 { margin: 0; }
.page-header-actions { display: flex; gap: 8px; align-items: center; }

/* ============================================================
   Detail Grid
   ============================================================ */
.detail-grid { display: grid; grid-template-columns: 1fr 400px; gap: 24px; }
.detail-sidebar {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
}
.detail-sidebar h2 { margin-bottom: 12px; font-size: 15px; }

/* ============================================================
   Info Grid — compact stat items
   ============================================================ */
.info-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-bottom: 20px; }
.info-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 12px 16px;
}
.info-label {
    display: block;
    font-size: 11px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}
.info-value { font-size: 15px; font-weight: 600; }

/* ============================================================
   Price Stats Bar
   ============================================================ */
.price-stats { display: flex; align-items: baseline; gap: 20px; margin-bottom: 12px; flex-wrap: wrap; padding: 8px 0; }
.price-current {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    font-family: var(--font-mono);
}
.price-change { font-size: 15px; font-weight: 600; }
.price-range { font-size: 12px; color: var(--color-text-muted); }
.price-range span:first-child { margin-right: 8px; }

/* ============================================================
   Chart Container
   ============================================================ */
.chart-container {
    width: 100%;
    height: 400px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--color-border);
    margin-bottom: 20px;
    background: var(--color-surface);
}

/* ============================================================
   Stat Cards — uppercase labels, large values
   ============================================================ */
.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px 20px;
    text-align: center;
}
.stat-label {
    display: block;
    font-size: 11px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}
.stat-value {
    font-size: 20px;
    font-weight: 700;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* Portfolio Summary */
.portfolio-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 24px; }

/* Section Header */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-header h2 { margin: 0; }

/* ============================================================
   Form Card
   ============================================================ */
.form-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    max-width: 700px;
}

/* ============================================================
   Trade Layout
   ============================================================ */
.trade-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.trade-info {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
}
.trade-info h3 { margin-bottom: 12px; }
.trade-forms { display: flex; flex-direction: column; gap: 12px; }
.trade-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
}
.trade-card h3 { margin-bottom: 12px; }

/* ============================================================
   Estimate Box
   ============================================================ */
.estimate-box {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin: 12px 0;
}
.estimate-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 12px;
    color: var(--color-text-muted);
}
.estimate-row span:last-child {
    color: var(--color-text);
    font-weight: 500;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}
.estimate-total { border-top: 1px solid var(--color-border); margin-top: 4px; padding-top: 8px; }
.estimate-total span { color: var(--color-text) !important; font-weight: 700 !important; font-size: 14px; }

/* ============================================================
   Slider
   ============================================================ */
.slider {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    outline: none;
    margin: 8px 0 4px;
}
.slider::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--color-primary); cursor: pointer;
    border: 2px solid var(--color-bg);
}
.slider::-moz-range-thumb {
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--color-primary); cursor: pointer;
    border: 2px solid var(--color-bg);
}
.slider-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--color-text-muted); }

/* ============================================================
   Search
   ============================================================ */
.search-bar { margin-bottom: 20px; }
.search-input {
    width: 100%;
    max-width: 400px;
    padding: 8px 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    font-family: inherit;
    font-size: 13px;
    height: 36px;
    transition: border-color 0.15s;
}
.search-input:focus { outline: none; border-color: var(--color-primary); }
.search-input::placeholder { color: var(--color-text-disabled); }

/* ============================================================
   Misc Layout
   ============================================================ */
.participant-actions, .creator-actions, .join-form { margin-top: 16px; display: flex; gap: 8px; }
.admin-links { display: flex; gap: 8px; }

/* Highlight row */
.highlight-row { background: rgba(0, 180, 201, 0.08); }

/* Leaderboard */
.leaderboard-table { font-size: 13px; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 12px; margin-top: 20px; justify-content: center; }

/* Game card header */
.game-card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.game-card-header h3 { margin: 0; }

/* Game description */
.game-description { color: var(--color-text-muted); margin-bottom: 20px; line-height: 1.6; font-size: 13px; }

/* Checkbox */
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; padding-top: 16px; }
.checkbox-label input[type="checkbox"] { width: auto; accent-color: var(--color-primary); }

/* Empty state */
.empty-state { text-align: center; padding: 48px 16px; color: var(--color-text-muted); }
.empty-state .btn { margin-top: 12px; }

/* Button group */
.btn-group { display: flex; gap: 8px; }

/* ============================================================
   Chat
   ============================================================ */
.chat-container { max-width: 800px; }
.chat-form { display: flex; gap: 8px; margin-bottom: 20px; }
.chat-input {
    flex: 1;
    padding: 8px 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    color: var(--color-text);
    font-family: inherit;
    font-size: 13px;
    height: 36px;
}
.chat-input:focus { outline: none; border-color: var(--color-primary); }
.messages-list { display: flex; flex-direction: column; gap: 0; }
.chat-message {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.chat-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.chat-meta strong { font-size: 13px; }
.chat-meta .text-muted { font-size: 11px; }
.chat-message p { font-size: 13px; color: var(--color-text-muted); margin: 0; }

/* ============================================================
   Achievements
   ============================================================ */
.achievements-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.achievement-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: border-color 0.15s;
}
.achievement-earned { border-color: var(--color-success); }
.achievement-locked { opacity: 0.4; }
.achievement-icon { font-size: 28px; min-width: 36px; text-align: center; }
.achievement-info h3 { font-size: 14px; margin-bottom: 2px; }
.achievement-info p { font-size: 12px; color: var(--color-text-muted); margin: 0; }

/* ============================================================
   Activity Feed
   ============================================================ */
.activity-feed { display: flex; flex-direction: column; gap: 0; }
.activity-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.activity-content { flex: 1; }
.activity-content strong { font-size: 13px; }
.activity-detail { font-size: 12px; color: var(--color-text-muted); margin-left: 8px; }
.activity-time { display: block; font-size: 11px; color: var(--color-text-disabled); }

/* ============================================================
   Avatars
   ============================================================ */
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.avatar-nav { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.avatar-lg { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.avatar-placeholder-sm {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700;
}

/* Nav user with avatar */
.nav-user-link { display: flex; align-items: center; gap: 6px; text-decoration: none !important; }
.nav-user-link:hover .nav-user { color: var(--color-text); }

/* ============================================================
   Profile
   ============================================================ */
.profile-section { max-width: 700px; }
.current-avatar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
}
.avatar-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.avatar-option { text-align: center; }
.avatar-option.locked { opacity: 0.35; }
.avatar-option.selected .avatar-btn { border-color: var(--color-success); box-shadow: 0 0 0 2px rgba(2, 199, 122, 0.3); }
.avatar-btn {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    background: var(--color-surface); border: 2px solid var(--color-border); border-radius: var(--radius);
    padding: 12px 8px; cursor: pointer; width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s; color: var(--color-text);
}
.avatar-btn:hover:not(:disabled) { border-color: var(--color-primary); }
.avatar-btn:disabled { cursor: not-allowed; }
.avatar-preview { width: 48px; height: 48px; border-radius: 50%; }
.avatar-name { font-size: 10px; color: var(--color-text-muted); }
.avatar-lock { font-size: 10px; }

/* ============================================================
   Notifications
   ============================================================ */
.notifications-list { display: flex; flex-direction: column; gap: 0; }
.notification-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.notification-unread { background: rgba(0, 180, 201, 0.05); border-left: 3px solid var(--color-primary); }
.notification-title { font-weight: 600; font-size: 13px; }
.notification-message { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.notif-badge {
    background: var(--color-danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 10px;
    margin-left: 4px;
    vertical-align: super;
}
.notif-badge:empty { display: none; }
.nav-notif { position: relative; }

/* ============================================================
   Analytics
   ============================================================ */
.analytics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 24px; }
.analytics-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
}
.analytics-card h3 { font-size: 14px; margin-bottom: 12px; }
.analytics-rows { display: flex; flex-direction: column; }
.analytics-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.analytics-row:last-child { border-bottom: none; }
.analytics-row-highlight { font-weight: 700; }

/* ============================================================
   Compare
   ============================================================ */
.compare-form { margin-bottom: 24px; max-width: 400px; }
.compare-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.compare-col {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
}
.compare-col h2 { margin-bottom: 12px; font-size: 15px; }
.compare-placeholder { display: flex; align-items: center; justify-content: center; min-height: 200px; color: var(--color-text-disabled); }
.compact-table { font-size: 12px; }

/* ============================================================
   Sector Chart
   ============================================================ */
.chart-row { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.sector-list { display: flex; flex-direction: column; gap: 8px; }
.sector-item { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.sector-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ============================================================
   Templates
   ============================================================ */
.template-meta { display: flex; gap: 8px; font-size: 11px; color: var(--color-text-muted); margin: 4px 0; flex-wrap: wrap; }
.template-meta span { background: var(--color-surface-2); padding: 2px 8px; border-radius: 4px; }
.template-action { margin-top: 8px; }
.template-action .form-row { align-items: flex-end; margin: 0; }
.template-action .form-group { margin-bottom: 0; }

/* Watchlist button */
.btn-watchlist-active { background: var(--color-success); color: #fff; }

/* ============================================================
   Nav Mobile Toggle
   ============================================================ */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--color-text);
    transition: transform 0.2s;
}

/* ============================================================
   Legal / Prose Content
   ============================================================ */
.legal-content { max-width: 800px; line-height: 1.8; }
.legal-content h2 { margin-top: 24px; margin-bottom: 8px; font-size: 17px; }
.legal-content ul, .legal-content ol { padding-left: 20px; margin: 8px 0; }
.legal-content li { margin-bottom: 4px; }
.legal-content p { margin-bottom: 12px; }
.disclaimer-box {
    background: var(--color-surface);
    border-left: 3px solid var(--color-warning);
    padding: 12px 16px;
    border-radius: var(--radius);
    margin: 12px 0;
}

/* ============================================================
   FAQ
   ============================================================ */
.faq-section { margin-bottom: 24px; }
.faq-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    margin-bottom: 8px;
    overflow: hidden;
}
.faq-item summary {
    padding: 10px 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: '+ '; color: var(--color-text-muted); }
.faq-item[open] summary::before { content: '- '; }
.faq-item p { padding: 0 16px 12px; margin: 0; font-size: 13px; color: var(--color-text-muted); }

/* ============================================================
   Settings
   ============================================================ */
.settings-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
}
.settings-card h2 { margin-bottom: 12px; font-size: 15px; }
.profile-info { display: flex; align-items: center; gap: 16px; }
.profile-avatar { width: 64px; height: 64px; border-radius: 50%; }
.profile-details p { margin: 4px 0; font-size: 13px; }

.danger-zone { border-color: var(--color-danger); }
.danger-zone h2 { color: var(--color-danger); }

/* Unread row highlight */
.row-unread { background: rgba(0, 180, 201, 0.06); }

/* Disclaimer banner */
.disclaimer-banner {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 8px 16px;
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: center;
    margin-bottom: 20px;
}

/* ============================================================
   Game Bar — which game you're in, under the nav
   ============================================================ */
.game-bar { background: var(--color-surface); border-bottom: 1px solid var(--color-border); }
.game-bar-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 10px; }
.game-bar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.game-bar-name { font-size: 15px; font-weight: 700; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-bar-name:hover { color: var(--color-primary-link); }
.game-bar-stats { display: flex; gap: 20px; font-size: 13px; }
.game-bar-label { color: var(--color-text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; margin-right: 4px; }
.game-switcher { position: relative; }
.game-switcher summary { cursor: pointer; font-size: 12px; color: var(--color-primary-link); list-style: none; }
.game-switcher summary::-webkit-details-marker { display: none; }
.game-switcher summary::after { content: " \25BE"; }
.game-switcher ul {
    position: absolute; top: calc(100% + 6px); left: 0; z-index: 900;
    list-style: none; min-width: 220px; padding: 6px 0;
    background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}
.game-switcher li a { display: block; padding: 6px 14px; color: var(--color-text); white-space: nowrap; }
.game-switcher li a:hover { background: var(--color-surface-hover); }
.game-tabs { display: flex; gap: 20px; overflow-x: auto; scrollbar-width: none; margin-top: 6px; }
.game-tabs::-webkit-scrollbar { display: none; }
.game-tabs a {
    padding: 8px 0; white-space: nowrap; font-size: 13px; font-weight: 500;
    color: var(--color-text-muted); border-bottom: 2px solid transparent;
}
.game-tabs a:hover { color: var(--color-text); }
.game-tabs a.active { color: var(--color-text); border-bottom-color: var(--color-primary); }

/* Dashboard: back to the game you last opened */
.continue-card {
    display: flex; align-items: center; gap: 12px; margin: 16px 0 8px; padding: 14px 18px;
    background: var(--color-surface); border: 1px solid var(--color-primary-dark); border-radius: var(--radius);
    color: var(--color-text);
}
.continue-card:hover { border-color: var(--color-primary); color: var(--color-text); }
.continue-label { color: var(--color-text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.continue-name { font-size: 15px; font-weight: 700; }

/* ============================================================
   Stock page — chart beside the order ticket
   ============================================================ */
.stock-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; margin-bottom: 20px; }
.stock-main .chart-container { margin-bottom: 0; }
.ticket {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 16px;
}
.ticket-game { font-size: 12px; color: var(--color-text-muted); margin-bottom: 10px; }
.ticket-game strong { color: var(--color-text); }
.ticket-position { display: flex; gap: 20px; margin-bottom: 14px; }
.ticket-position .mono { font-size: 14px; font-weight: 600; }
.ticket-sides { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-bottom: 14px; border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.ticket-sides input { position: absolute; opacity: 0; pointer-events: none; }
.ticket-sides label { text-align: center; padding: 8px 0; font-weight: 600; cursor: pointer; color: var(--color-text-muted); background: var(--color-bg); }
.ticket-sides label:hover { color: var(--color-text); }
.ticket-sides input:focus-visible + label { outline: 2px solid var(--color-primary); outline-offset: -2px; }
#side-buy:checked + label { background: var(--color-success); color: #000; }
#side-sell:checked + label { background: var(--color-danger); color: #fff; }
.ticket-sides input:disabled + label { opacity: 0.4; cursor: not-allowed; }
.ticket .form-group { margin-bottom: 12px; }
.ticket-note { font-size: 12px; line-height: 1.45; margin-bottom: 12px; padding: 8px 10px; border-radius: var(--radius); background: rgba(255, 177, 26, 0.12); color: var(--color-warning); }
.ticket-note[hidden] { display: none; }

/* ============================================================
   Phone-first pieces: pills, portfolio summary, card tables, tab bar
   ============================================================ */
.pill {
    display: inline-block; padding: 2px 8px; border-radius: 6px;
    font-family: var(--font-mono); font-size: 13px; font-weight: 600; white-space: nowrap;
    background: rgba(135, 138, 155, 0.15); color: var(--color-text-muted);
}
.pill-up { background: rgba(2, 199, 122, 0.15); color: var(--color-success); }
.pill-down { background: rgba(255, 59, 105, 0.15); color: var(--color-danger); }

.portfolio-hero {
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
    padding: 18px 20px; margin-bottom: 24px;
}
.hero-value { font-size: 32px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.2; margin: 2px 0 8px; }
.hero-change { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.hero-split { display: flex; flex-wrap: wrap; gap: 10px 32px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--color-border); }
.hero-split .mono { font-size: 15px; font-weight: 600; }
.perf-chart { position: relative; height: 260px; }
.game-rules-link { margin-top: 24px; font-size: 13px; }

/* Your leaderboard spot, above the portfolio summary. */
.rank-strip {
    display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding: 10px 16px;
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
    color: var(--color-text);
}
.rank-strip:hover { color: var(--color-text); border-color: var(--color-primary); }
.rank-place { font-size: 22px; font-weight: 700; color: var(--color-primary); }
.rank-text { display: flex; flex-direction: column; font-size: 13px; line-height: 1.35; min-width: 0; }
.rank-more { margin-left: auto; font-size: 13px; color: var(--color-primary-link); white-space: nowrap; }

/* Today and Total in the holdings table: the % pill, then the amount. */
.rtable .c-move { white-space: nowrap; }
.rtable .c-amt { display: block; margin-top: 2px; font-size: 12px; color: var(--color-text-muted); font-family: var(--font-mono); }

/* rtable: a normal table on desktop; see the phone rules below. */
.rtable .c-sub { display: block; color: var(--color-text-muted); font-size: 12px; }
.rtable .c-main .badge { margin-right: 4px; }
.rtable .c-action form { display: inline; }
.show-sm { display: none !important; }

.stock-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.stock-title h1 { margin: 0; }
.stock-pick { margin-top: 4px; font-size: 13px; }
.stock-logo { width: 44px; height: 44px; border-radius: 8px; background: #fff; padding: 3px; object-fit: contain; flex-shrink: 0; }
#ticket { scroll-margin-top: 12px; }

.game-dock { display: none; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .nav-toggle { display: flex; }
    .stock-layout { grid-template-columns: 1fr; }
    .game-bar-stats { gap: 14px; }
    .nav { overflow: visible; }
    .nav-links {
        display: none;
        flex-direction: column;
        position: fixed;
        top: 48px;
        left: 0;
        right: 0;
        background: #000000;
        border-bottom: 1px solid var(--color-border);
        padding: 12px 24px;
        gap: 8px;
        z-index: 9999;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    }
    .nav-links a { height: auto; border-bottom: none; padding: 4px 0; }
    .nav-open .nav-links { display: flex; }
    .form-row { flex-direction: column; }
    .game-grid { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .trade-layout { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr 1fr; }
    .compare-grid { grid-template-columns: 1fr; }
    .analytics-grid { grid-template-columns: 1fr; }
    .chart-row { flex-direction: column; }
    .achievements-grid { grid-template-columns: 1fr; }

    /* Login responsive */
    .login-page { flex-direction: column; }
    .login-left { min-height: 40vh; }
    .login-right { width: 100%; min-width: 0; padding: 32px 24px; }
    .login-hero { padding: 32px 24px; }
    .login-hero-title { font-size: 32px; }
    .login-hero-stats { gap: 24px; }
    .login-stat-value { font-size: 18px; }
    .login-team-wide { display: none; }
    .login-team-phone { display: block; margin-top: 32px; text-align: center; }

    /* Readable type and thumb-sized targets. 16px inputs stop iOS
       zooming the page when a field is focused. */
    body { font-size: 15px; }
    .container { padding: 0 16px; }
    main.container { padding-top: 16px; }
    h1 { font-size: 22px; }
    td { font-size: 14px; }
    .btn { height: 44px; padding: 10px 18px; font-size: 15px; }
    .btn-sm { height: 36px; padding: 6px 14px; font-size: 14px; }
    .form-group input, .form-group select, .form-group textarea,
    .search-input, .chat-input { font-size: 16px; height: 44px; }
    .form-group textarea { height: auto; }
    .search-input { max-width: none; }
    .nav-links a, .nav-logout { font-size: 16px; padding: 10px 0; }
    .page-header { margin-bottom: 16px; }

    /* Toasts sit at the bottom, full width, above the tab bar. */
    #toast-container {
        top: auto; left: 12px; right: 12px; max-width: none;
        bottom: calc(12px + env(safe-area-inset-bottom));
    }
    body:has(.game-dock) #toast-container { bottom: calc(76px + env(safe-area-inset-bottom)); }
    .toast { font-size: 15px; padding: 14px 16px 14px 14px; transform: translateY(8px); }
    .toast-show { transform: none; }

    /* Game bar: name and stats only; the tab bar at the bottom replaces the tabs. */
    .game-bar-top { padding-top: 8px; padding-bottom: 8px; gap: 6px; }
    .game-bar-stats { width: 100%; justify-content: space-between; gap: 8px; font-size: 13px; }
    .game-bar-stats > span { display: flex; flex-direction: column; }
    .game-bar-label { font-size: 10px; }
    .game-bar.has-dock .game-tabs { display: none; }
    .game-bar:not(.has-dock) .game-tabs { margin-top: 0; }

    .game-dock {
        display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000;
        background: var(--color-nav-bg); border-top: 1px solid var(--color-border);
        padding-bottom: env(safe-area-inset-bottom);
    }
    .game-dock > a, .dock-more > summary {
        flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
        height: 60px; font-size: 11px; font-weight: 500; color: var(--color-text-muted);
        list-style: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
    }
    .dock-more { flex: 1; display: flex; }
    .dock-more > summary::-webkit-details-marker { display: none; }
    .game-dock svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
    .game-dock .active, .dock-more[open] > summary { color: var(--color-primary); }
    .dock-sheet {
        position: fixed; left: 8px; right: 8px; bottom: calc(68px + env(safe-area-inset-bottom));
        background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: 12px;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.6); padding: 6px 0;
    }
    .dock-sheet a { display: block; padding: 14px 20px; font-size: 16px; color: var(--color-text); }
    body:has(.game-dock) { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }

    /* Tables with no phone layout scroll sideways inside themselves
       rather than widening the whole page. */
    table:not(.rtable):not(.fit-sm) { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    th, td { padding: 8px 10px; }
    .hide-sm { display: none !important; }
    .show-sm { display: inline-flex !important; }

    /* rtable: each row becomes a card. The first line holds .c-main
       (stock) and .c-end (value); everything else wraps below it as
       small "label value" items. a.stretch makes the whole card a link. */
    .rtable { display: block; }
    .rtable thead { display: none; }
    .rtable tbody { display: flex; flex-direction: column; gap: 8px; }
    .rtable tr {
        position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px;
        padding: 12px 14px; background: var(--color-surface);
        border: 1px solid var(--color-border); border-radius: var(--radius);
    }
    .rtable tr::before { content: ""; order: 1; flex-basis: 100%; height: 0; }
    .rtable tr:hover td { background: none; }
    .rtable td { display: block; padding: 0; border: 0; order: 2; font-size: 13px; text-align: left; }
    .rtable td:empty { display: none; }
    .rtable td[data-label]::before { content: attr(data-label) " "; color: var(--color-text-muted); }
    .rtable .c-main { order: 0; flex: 1; min-width: 0; font-size: 15px; }
    .rtable .c-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
    .rtable .c-end { order: 0; text-align: right; font-size: 15px; font-weight: 600; }
    .rtable .c-cur { display: block; font-size: 11px; font-weight: 400; }
    .rtable .c-action { margin-left: auto; position: relative; z-index: 1; }
    .rtable a.stretch { color: var(--color-text); }
    .rtable a.stretch::after { content: ""; position: absolute; inset: 0; }
    .rtable td[colspan] { order: 0; }
    .rtable .c-amt { display: inline; margin: 0; }

    /* Portfolio */
    .portfolio-hero { padding: 16px; margin-bottom: 20px; }
    .hero-value { font-size: 30px; }
    .hero-split { gap: 10px 24px; }
    .perf-chart { height: 200px; }

    /* Stock page: shorter chart so the ticket is closer. */
    .stock-header { flex-wrap: nowrap; align-items: flex-start; }
    .stock-title { flex: 1; }
    .stock-logo { width: 40px; height: 40px; }
    .stock-header .page-header-actions { flex-shrink: 0; }
    .page-header-actions { flex-wrap: wrap; }
    .chart-container { height: 280px; }
    .price-stats { gap: 4px 14px; }
    .price-current { font-size: 26px; }
    .info-item { padding: 10px 12px; }
    .info-value { font-size: 14px; overflow-wrap: anywhere; }
    .ticket { padding: 14px; }
    .ticket-sides label { padding: 11px 0; font-size: 15px; }
    .ticket .slider { height: 6px; margin: 14px 0 6px; }
    .ticket .slider::-webkit-slider-thumb { width: 28px; height: 28px; }
    .ticket .slider::-moz-range-thumb { width: 28px; height: 28px; }
    .estimate-row { font-size: 14px; }
    #ticket-btn { height: 50px; font-size: 16px; }

    .footer-links { gap: 8px 20px; }
}

/* ============================================================
   Learn: Rob's videos, live streams and questions. Phones first:
   rows of cards scroll sideways, and wider screens show more.
   ============================================================ */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.learn-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.learn-brand { font-size: 20px; font-weight: 700; color: var(--color-text); }
.learn-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.learn-tabs::-webkit-scrollbar { display: none; }
.learn-tabs a {
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    padding: 8px 14px; border-radius: 999px; color: var(--color-text-muted); font-weight: 500;
}
.learn-tabs a:hover { color: var(--color-text); background: var(--color-surface-2); }
.learn-tabs a.active { color: #fff; background: var(--color-surface-3); }

.learn-search { display: flex; gap: 8px; margin-bottom: 12px; }
.learn-search input, .learn-search select {
    flex: 1; min-width: 0; height: 36px; padding: 0 12px; border-radius: var(--radius);
    background: var(--color-surface-2); border: 1px solid var(--color-border); color: var(--color-text); font: inherit;
}
.learn-search select { flex: 0 1 auto; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips-wrap { flex-wrap: wrap; overflow: visible; }
.chip {
    flex-shrink: 0; padding: 6px 12px; border-radius: 999px; white-space: nowrap; font-size: 13px;
    background: var(--color-surface-2); border: 1px solid var(--color-border); color: var(--color-text);
}
.chip:hover { border-color: var(--color-primary); color: var(--color-text); }
.chip-on { background: var(--color-primary-dark); border-color: var(--color-primary); }

.learn-section { margin: 24px 0; }
.learn-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.learn-h1 { font-size: 22px; }
.learn-h2 { font-size: 16px; font-weight: 600; margin-bottom: 10px; }
.learn-section-head .learn-h2 { margin-bottom: 0; }
.learn-more { white-space: nowrap; font-size: 13px; }
.learn-disclaimer {
    margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--color-border);
    color: var(--color-text-muted); font-size: 12px; line-height: 1.6;
}

/* Video cards */
.vrow {
    display: grid; grid-auto-flow: column; grid-auto-columns: 72%; gap: 12px;
    overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; scrollbar-width: thin;
}
.vrow > .vcard { scroll-snap-align: start; }
/* Only the Shorts row shows tall cards; mixed rows crop Shorts to 16:9 so
   the row lines up. */
.vrow-shorts { grid-auto-columns: 42%; }
.vgrid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.vlist { display: flex; flex-direction: column; gap: 12px; }
.vcard { display: flex; flex-direction: column; gap: 6px; color: var(--color-text); min-width: 0; }
.vcard:hover { color: var(--color-text); }
.vcard:hover .vtitle { color: var(--color-primary-link); }
.vthumb {
    position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden;
    border-radius: var(--radius); background: var(--color-surface-2);
}
.vrow-shorts .vthumb { aspect-ratio: 9 / 16; }
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vbadge, .vplatform {
    position: absolute; bottom: 6px; padding: 1px 6px; border-radius: 4px;
    font-size: 11px; font-weight: 600; background: rgba(0, 0, 0, 0.8); color: #fff;
}
.vbadge { right: 6px; }
.vplatform { left: 6px; }
.vplatform-tiktok { background: #000; box-shadow: -2px 0 #25F4EE, 2px 0 #FE2C55; }
.vplatform-facebook { background: #1877F2; }
.vplatform-instagram { background: #C13584; }
.vtitle {
    font-weight: 600; line-height: 1.35;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.vmeta { font-size: 12px; color: var(--color-text-muted); }
.vlist .vcard { flex-direction: row; gap: 10px; }
.vlist .vthumb { width: 42%; flex-shrink: 0; }
.vlist .vtitle { font-size: 13px; }

/* The click-to-play player */
.player {
    position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius);
    overflow: hidden; margin-bottom: 12px;
}
/* A Short leaves room for its title on a phone screen. */
.player-tall { aspect-ratio: 9 / 16; width: min(100%, calc(68vh * 9 / 16)); margin-left: auto; margin-right: auto; }
.player iframe, .player-start { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-start { padding: 0; background: #000; cursor: pointer; }
.player-start img { width: 100%; height: 100%; object-fit: cover; opacity: 0.85; }
.player-icon {
    position: absolute; top: 50%; left: 50%; width: 68px; height: 48px; transform: translate(-50%, -50%);
    border-radius: 12px; background: rgba(0, 0, 0, 0.75);
}
.player-icon::after {
    content: ""; position: absolute; top: 50%; left: 52%; transform: translate(-50%, -50%);
    border-style: solid; border-width: 11px 0 11px 18px; border-color: transparent transparent transparent #fff;
}
.player-start:hover .player-icon, .player-start:focus-visible .player-icon { background: #FF0033; }

.watch { display: grid; grid-template-columns: 1fr; gap: 24px; }
.watch-main { min-width: 0; }
.watch-title { font-size: 20px; line-height: 1.3; margin: 8px 0 4px; }
.watch-meta { margin-bottom: 12px; }
.watch-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.watch-desc { margin: 12px 0; padding: 12px 14px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.watch-desc summary { cursor: pointer; font-weight: 600; }
.watch-desc p { margin-top: 10px; overflow-wrap: anywhere; white-space: pre-line; }

/* Live */
.live-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #FF3B30;
    box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.7); animation: live-pulse 1.6s infinite;
}
@keyframes live-pulse {
    70% { box-shadow: 0 0 0 8px rgba(255, 59, 48, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); }
}
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.live-banner {
    display: flex; align-items: center; gap: 10px; padding: 10px 16px;
    background: #3A0D12; border-bottom: 1px solid #7A1F28; color: #fff; font-size: 14px;
}
.live-banner:hover { color: #fff; background: #4A1118; }
.live-banner-text { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-banner-cta { font-weight: 600; white-space: nowrap; }
.live-card {
    display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; margin-bottom: 16px;
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); color: var(--color-text);
}
.live-card:hover { color: var(--color-text); border-color: var(--color-primary); }
.live-card-on { border-color: #7A1F28; background: #1E0B0E; }
.live-card-title { font-size: 16px; font-weight: 600; }
.live-pill {
    align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px;
    border-radius: 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; background: #FF3B30; color: #fff;
}
.live-pill .live-dot { background: #fff; }
.live-pill-soon { background: var(--color-primary-dark); }
.live-pill-off { background: var(--color-surface-3); }
.event-row {
    display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; margin-bottom: 10px;
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
}
.event-main { display: flex; flex-direction: column; gap: 2px; color: var(--color-text); }
.event-main:hover { color: var(--color-text); }
.event-when { font-size: 12px; font-weight: 600; color: var(--color-primary-link); text-transform: uppercase; letter-spacing: 0.03em; }
.event-title { font-weight: 600; font-size: 15px; }
.event-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.event-past { display: flex; flex-direction: column; color: var(--color-text); padding: 8px 0; border-bottom: 1px solid var(--color-border); }
.admin-box summary { cursor: pointer; }

/* Questions */
.vote-form { flex-shrink: 0; }
.vote {
    display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0;
    width: 52px; height: 56px; border-radius: var(--radius); cursor: pointer; font: inherit;
    background: var(--color-surface-2); color: var(--color-text); border: 1px solid var(--color-border);
}
.vote:hover { color: var(--color-text); border-color: var(--color-primary); }
.vote-on { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.vote-arrow { font-size: 12px; line-height: 1; }
.vote-count { font-size: 16px; font-weight: 600; }
.q-card { display: flex; gap: 16px; align-items: flex-start; }
.q-title { font-weight: 600; font-size: 15px; }
.q-h1 { font-size: 18px; margin-bottom: 4px; }
.q-meta { font-size: 12px; margin-top: 4px; }
.q-filters { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; margin: 8px 0 12px; }
.answer-card { border-left: 3px solid var(--color-success); }
.qline { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--color-border); color: var(--color-text); }
.qline:hover { color: var(--color-primary-link); }
.qline-votes { min-width: 36px; text-align: center; font-weight: 600; color: var(--color-text-muted); }
.qline-tag { margin-left: auto; font-size: 11px; color: var(--color-success); white-space: nowrap; }
.ask-inline { display: flex; gap: 8px; margin-bottom: 12px; }
.ask-inline input {
    flex: 1; min-width: 0; height: 36px; padding: 0 12px; border-radius: var(--radius);
    background: var(--color-surface-2); border: 1px solid var(--color-border); color: var(--color-text); font: inherit;
}
.invite-list { list-style: none; margin: 0; padding: 0; }
.invite-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--color-border); font-size: 14px; }
.invite-email { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.queue { display: flex; flex-direction: column; gap: 10px; }
.queue-item { display: flex; align-items: center; gap: 12px; padding: 10px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); }
.queue-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.queue-text a { color: var(--color-text); font-weight: 500; }

.socials { display: flex; flex-wrap: wrap; gap: 8px; }
.social { padding: 8px 14px; border-radius: 999px; font-weight: 600; color: #fff; }
.social:hover { color: #fff; opacity: 0.9; }
.social-yt { background: #FF0033; }
.social-tt { background: #000; border: 1px solid #333; }
.social-ig { background: linear-gradient(45deg, #F58529, #DD2A7B, #8134AF); }
.social-fb { background: #1877F2; }
.social-x { background: #000; border: 1px solid #333; }

.admin-status { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.topic-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.nav-signin { height: 30px; color: #fff !important; border-bottom: 0 !important; }

@media (min-width: 600px) {
    .vrow { grid-auto-columns: calc((100% - 24px) / 3); }
    .vrow-shorts { grid-auto-columns: calc((100% - 48px) / 5); }
    .vgrid { grid-template-columns: repeat(2, 1fr); }
    .event-row { flex-direction: row; align-items: center; justify-content: space-between; }
}
@media (min-width: 900px) {
    .vrow { grid-auto-columns: calc((100% - 36px) / 4); }
    .vrow-shorts { grid-auto-columns: calc((100% - 72px) / 7); }
    .vgrid { grid-template-columns: repeat(4, 1fr); }
    .watch { grid-template-columns: minmax(0, 1fr) 340px; }
}
@media (max-width: 768px) {
    .learn-search input, .learn-search select, .ask-inline input { height: 44px; font-size: 16px; }
    .learn-brand { font-size: 18px; }
    .learn-head { margin-bottom: 12px; }
    .learn-tabs { width: 100%; }
    .chip { padding: 8px 14px; font-size: 14px; }
    /* Visitors have no menu button, so their two links stay in the bar. */
    .nav-links.nav-links-public {
        display: flex; position: static; flex-direction: row; gap: 16px; padding: 0;
        background: none; border: 0; box-shadow: none;
    }
    .nav-links-public a { font-size: 15px; padding: 0; }
}

/* ============================================================
   Stocks page: search, sector menu, chips and the stock list
   ============================================================ */
.screener-controls {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
    gap: 10px 12px; margin-bottom: 12px;
}
.screener-controls .search-input { max-width: none; }
#stock-filters { display: contents; }
.screener-sector {
    height: 38px; padding: 0 12px; border-radius: var(--radius); font: inherit;
    background: var(--color-surface-2); border: 1px solid var(--color-border); color: var(--color-text);
}
.screener-chips { grid-column: 1 / -1; margin-bottom: 0; }
.screener-chips .chip { cursor: pointer; }
.chip:has(:checked) { background: var(--color-primary-dark); border-color: var(--color-primary); }
.chip:has(:focus-visible) { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.screener-caption { margin: 4px 0 10px; font-weight: 600; }

.sc-stock { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sc-text { min-width: 0; }
.sc-logo {
    width: 32px; height: 32px; border-radius: 8px; background: #fff; padding: 2px;
    object-fit: contain; flex-shrink: 0;
}
.sc-letter {
    display: flex; align-items: center; justify-content: center; padding: 0;
    background: var(--color-surface-3); color: var(--color-text-muted); font-weight: 600;
}
.rtable .sc-note { color: var(--color-text); font-style: italic; white-space: normal; }
.screener .c-spark { width: 80px; }
.spark { display: block; width: 64px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.5; overflow: visible; }
.spark polyline { vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.spark-up { color: var(--color-success); }
.spark-down { color: var(--color-danger); }
.screener .c-end { white-space: nowrap; }
.sc-price { display: block; }
.screener .c-end .pill { margin-top: 3px; }

@media (max-width: 768px) {
    .screener-controls { grid-template-columns: minmax(0, 1fr); }
    .screener-sector { height: 44px; font-size: 16px; }
    .screener .c-spark { order: 0; width: auto; }
    .screener .c-end { text-align: right; }
    .screener .sc-logo { width: 28px; height: 28px; }
}
