/* ============================================================
   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; }

/* ============================================================
   Top bar and tab bar (_nav.html): the same five sections on
   every signed-in page. Fixed sizes throughout, so nothing in the
   bar moves as the page loads.
   ============================================================ */
/* The scrollbar's space is always kept, so a page growing past the
   window's height doesn't shift the centred layout sideways. */
html { scrollbar-gutter: stable; }
.topbar {
    position: sticky; top: 0; z-index: 1000; height: 56px;
    background: var(--color-nav-bg); border-bottom: 1px solid var(--color-border);
}
.topbar-inner { display: flex; align-items: center; gap: 32px; height: 100%; }
.brand {
    display: flex; align-items: center; gap: 8px; flex-shrink: 0;
    font-size: 15px; font-weight: 700; letter-spacing: -0.3px; color: var(--color-text);
}
.brand:hover { color: var(--color-text); }
.brand-mark { width: 26px; height: 26px; border-radius: 6px; flex-shrink: 0; }
.topbar-links { display: flex; align-items: stretch; gap: 24px; height: 100%; }
.topbar-links a {
    display: flex; align-items: center; margin-bottom: -1px;
    font-size: 14px; font-weight: 500; color: var(--color-text-muted);
    border-bottom: 2px solid transparent; transition: color 0.15s, border-color 0.15s;
}
.topbar-links a:hover { color: var(--color-text); }
.topbar-links a.active { color: var(--color-text); border-bottom-color: var(--color-primary); }
.topbar-links svg { display: none; }
.topbar-end { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.topbar-icon {
    position: relative; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
    width: 40px; height: 40px; border-radius: 50%; color: var(--color-text-muted);
    cursor: pointer; list-style: none; -webkit-tap-highlight-color: transparent;
}
.topbar-icon::-webkit-details-marker { display: none; }
.topbar-icon:hover, .topbar-icon.active, .acct[open] > .topbar-icon { color: var(--color-text); background: var(--color-surface-2); }
.topbar-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bell-count {
    position: absolute; top: 3px; right: 1px; min-width: 18px; height: 18px; padding: 0 4px;
    border: 2px solid var(--color-nav-bg); border-radius: 9px; background: var(--color-danger);
    color: #fff; font-size: 10px; font-weight: 700; line-height: 14px; text-align: center;
}
.acct { position: relative; }
.acct-avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.acct-menu {
    position: absolute; top: calc(100% + 8px); right: 0; z-index: 1001; width: 260px; padding: 6px 0;
    background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}
.acct-who { display: flex; flex-direction: column; min-width: 0; padding: 8px 16px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--color-border); }
.acct-who span { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-menu a, .acct-menu button {
    display: block; width: 100%; padding: 9px 16px; text-align: left;
    font: inherit; font-size: 14px; color: var(--color-text); background: none; border: 0; cursor: pointer;
}
.acct-menu a:hover, .acct-menu button:hover { background: var(--color-surface-hover); color: var(--color-text); }
.acct-menu button { color: var(--color-text-muted); }
.acct-menu hr { margin: 6px 0; border: 0; border-top: 1px solid var(--color-border); }
.topbar-public { display: flex; align-items: center; gap: 20px; margin-left: auto; }
.topbar-public a:not(.btn) { font-size: 14px; font-weight: 500; color: var(--color-text-muted); }
.topbar-public a:not(.btn):hover { color: var(--color-text); }

/* Cash, value and P&L, in the top bar on a game's pages. */
.game-bar-stats { display: flex; gap: 20px; margin-right: 10px; font-size: 13px; white-space: nowrap; }
a.game-bar-stats, a.game-bar-stats:hover { color: var(--color-text); }
a.game-bar-stats:hover .game-bar-label { color: var(--color-text); }
.game-bar-label { color: var(--color-text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; margin-right: 4px; }

/* On a page of a game other than this month's: which game, and the way back. */
.game-strip { background: var(--color-surface); border-bottom: 1px solid var(--color-border); font-size: 13px; }
.game-strip-inner { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 20px; min-height: 44px; padding-top: 6px; padding-bottom: 6px; }
.game-strip-links { display: flex; gap: 16px; }
.game-strip-links a { color: var(--color-text-muted); }
.game-strip-links a:hover, .game-strip-links a[aria-current] { color: var(--color-text); }
.game-strip-links a[aria-current] { font-weight: 600; }
.game-strip-back { margin-left: auto; font-weight: 600; }

.dock { display: none; }

/* Players | Activity, at the top of the Ranks pages. */
.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--color-surface-2); }
.segmented a { padding: 6px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--color-text-muted); }
.segmented a:hover { color: var(--color-text); }
.segmented a[aria-current] { background: var(--color-surface-3); color: var(--color-text); }

/* ============================================================
   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; }
/* A button that's off, including one hx-disable turns off while its request
   runs, looks it. */
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }
/* The lobby's Send spins while Claude checks the message (about a second). */
.chat-form.htmx-request .btn::after {
    content: ""; width: 12px; height: 12px; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent;
    animation: btn-spin 0.7s linear infinite;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .chat-form.htmx-request .btn::after { animation-duration: 2s; } }
.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) .topbar,
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; }

/* Two phone screenshots of the game, the second set lower. Placed like the
   team photo: in the hero on a wide screen, under the form on a phone. */
.login-shots { margin: 40px auto 0; }
.login-shots-row { display: flex; justify-content: center; align-items: flex-start; gap: 16px; }
.login-shots img {
    display: block;
    width: 180px;
    min-width: 0;
    height: auto;
    border-radius: 18px;
    border: 1px solid var(--color-border);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}
.login-shots img + img { margin-top: 28px; }
.login-shots figcaption { margin-top: 10px; font-size: 13px; color: var(--color-text-muted); }
.login-shots-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;
    white-space: nowrap;
}
.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); }
.badge-held { background: rgba(0, 180, 201, 0.15); color: var(--color-primary-link); }

/* ============================================================
   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; }

/* A sum that reconciles: lines, then a subtotal and a total (My history). */
.ledger { max-width: 480px; margin-bottom: 24px; }
.ledger tr:hover td { background: none; }
.ledger-sub td { border-top: 1px solid var(--color-border); font-weight: 600; }
.ledger-total td { border-top: 2px solid var(--color-border); font-weight: 700; font-size: 15px; }

/* ============================================================
   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. */
/* The container itself lets taps through to the page; only toasts take them. */
#toast-container { position: fixed; top: 12px; right: 12px; z-index: 10001; display: flex; flex-direction: column; gap: 8px; max-width: 420px; pointer-events: none; }
#toast-container .toast { pointer-events: auto; }
.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); }

/* ============================================================
   Confirm dialog (askConfirm in app.js)
   ============================================================ */
/* No padding on the dialog itself, so a click whose target is the dialog
   is a click on the backdrop. The reset's margin: 0 would pin it top-left. */
dialog.confirm {
    width: min(400px, calc(100vw - 32px));
    margin: auto;
    padding: 0;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-surface);
    color: var(--color-text);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.7);
}
dialog.confirm[open] { animation: confirm-in 0.15s ease-out; }
dialog.confirm::backdrop { background: rgba(5, 8, 14, 0.75); }
dialog.confirm form { padding: 20px; }
.confirm-msg { margin: 0 0 20px; font-size: 15px; line-height: 1.5; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; }
@keyframes confirm-in { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) { dialog.confirm[open] { animation: none; } }
/* On a phone it sits at the bottom, under the thumb, with full-width buttons. */
@media (max-width: 767px) {
    dialog.confirm { margin: auto auto calc(16px + env(safe-area-inset-bottom)); }
    .confirm-actions .btn { flex: 1; height: 44px; font-size: 15px; }
}

/* ============================================================
   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; }

/* ============================================================
   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;
}
.stat-sub { display: block; margin-top: 4px; font-size: 12px; color: var(--color-text-muted); }

/* 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;
}

/* ============================================================
   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);
}
/* The form inputs' box styling outranks .slider, so undo it here. */
.form-group input.slider { height: 4px; padding: 0; border: 0; border-radius: 2px; background: var(--color-border); }
.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
   ============================================================ */
.creator-actions, .join-form { margin-top: 16px; display: flex; gap: 8px; }
.admin-links { display: flex; gap: 8px; }
/* The admin links at the top of every /admin page; the page you're on is outlined. */
.admin-nav { flex-wrap: wrap; margin-bottom: 20px; }
.admin-nav .btn[aria-current] { background: var(--color-primary-dark); box-shadow: inset 0 0 0 2px var(--color-primary); }

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

/* Leaderboard */
.leaderboard-table { font-size: 13px; }
.leaderboard-table .leaderboard-gap td { text-align: center; color: var(--color-text-muted); padding-top: 2px; padding-bottom: 2px; }

/* 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; }
/* A message moderation blocked: only admins see it, to review. */
.chat-blocked { border: 1px dashed rgba(255, 59, 105, 0.4); border-radius: 6px; margin: 4px 0; opacity: 0.85; }
.chat-message .chat-reason { font-size: 12px; color: var(--color-danger); margin-top: 4px; }
.chat-actions { display: flex; gap: 8px; margin-top: 8px; }
.chat-admin-filter { font-size: 0.85rem; margin: 0 0 0.5rem; }

/* ============================================================
   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-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;
}
/* ============================================================
   Avatars in Settings
   ============================================================ */
.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;
}
.settings-card .current-avatar { padding: 0; border: 0; background: none; }
.current-avatar + .name-form { margin-top: 16px; }
.name-form .form-group { max-width: 320px; }
.avatar-picker { margin-top: 16px; border-top: 1px solid var(--color-border); }
.avatar-picker summary { padding: 12px 0; font-weight: 600; color: var(--color-primary-link); cursor: pointer; }
.avatar-picker > p { margin-bottom: 10px; font-size: 13px; }
.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; }

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

/* ============================================================
   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; }

.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;
}

/* The game switcher, on the home page when a player is in more than one game. */
.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); }

/* ============================================================
   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; }
.chart-ranges { margin-bottom: 8px; }
.chart-ranges .chip { font: inherit; font-size: 13px; padding: 5px 14px; cursor: pointer; }
/* Stock chart (stockchart.js): the change over the range, then a line on
   phones or candles on wider screens, both filling .chart-container. */
.chart-change { min-height: 22px; margin-bottom: 6px; font-size: 14px; }
.chart-move { font-weight: 600; font-variant-numeric: tabular-nums; }
.chart-span { color: var(--color-text-muted); font-size: 13px; }
.chart-line, .chart-candles { width: 100%; height: 100%; }
.chart-line { background: var(--color-surface); touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.chart-line svg { display: block; color: var(--color-green); }
.chart-line svg.down { color: var(--color-red); }
.chart-line .stroke { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-line .area { fill: url(#chart-fill); stroke: none; }
.chart-line .fill-top { stop-color: currentColor; stop-opacity: 0.22; }
.chart-line .fill-bottom { stop-color: currentColor; stop-opacity: 0; }
.chart-line .grid { stroke: var(--color-border); stroke-width: 1; }
.chart-line .axis { fill: var(--color-text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-line .mark line { stroke: var(--color-text-muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-line .mark circle { fill: currentColor; stroke: var(--color-surface); stroke-width: 2; }
.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; }
/* Buy/Sell: a small labelled toggle with a slanted divide, tinted rather than
   filled, so it doesn't look like the button that places the order. */
.ticket-side-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ticket-side-label { font-size: 11px; font-weight: 500; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.ticket-sides { position: relative; display: flex; width: 168px; border: 1px solid var(--color-border); border-radius: 999px; overflow: hidden; isolation: isolate; }
.ticket-sides input { position: absolute; opacity: 0; pointer-events: none; }
.ticket-sides label { position: relative; flex: 1; text-align: center; padding: 5px 0; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--color-text-muted); }
.ticket-sides label:hover { color: var(--color-text); }
/* The tint is a skewed block that runs past the outer end (clipped by the
   rounded edge) and meets the other half on a slant. */
.ticket-sides input:checked + label::before { content: ""; position: absolute; top: 0; bottom: 0; z-index: -1; transform: skewX(-20deg); }
#side-buy:checked + label::before { left: -16px; right: 0; background: rgba(2, 199, 122, 0.18); }
#side-sell:checked + label::before { left: 0; right: -16px; background: rgba(255, 59, 105, 0.18); }
#side-buy:checked + label { color: var(--color-success); }
#side-sell:checked + label { color: var(--color-danger); }
.ticket-sides input:focus-visible + label { outline: 2px solid var(--color-primary); outline-offset: -2px; border-radius: 999px; }
.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; }
/* The confirmation after a trade; the form shows again on "Trade again". */
.ticket-done { margin-bottom: 14px; padding: 12px; border-radius: var(--radius); background: rgba(2, 199, 122, 0.1); border: 1px solid rgba(2, 199, 122, 0.3); }
.ticket-done-msg { margin: 0 0 10px; font-weight: 600; color: var(--color-success); line-height: 1.4; }
.ticket-done-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.ticket-done-actions .btn { width: 100%; justify-content: center; }
.ticket-done-link { font-size: 13px; }
.ticket.is-done #ticket-form { display: none; }
/* The sheet's header and the Buy/Sell bar are for phones only. */
.ticket-head, .trade-bar, .sheet-backdrop { display: none; }
.back-link { display: inline-flex; align-items: center; min-height: 32px; margin-bottom: 6px; font-size: 14px; color: var(--color-text-muted); }
.back-link:hover { color: var(--color-text); }

/* ============================================================
   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: 220px; }
.game-rules-link { margin-top: 24px; font-size: 13px; }

/* The home page: the game's name and days left, then the summary card
   with the player's place and the month's chart in it. */
.home-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-bottom: 12px; }
.home-head h1 { margin: 0; }
.hero-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hero-rank {
    display: inline-flex; align-items: baseline; gap: 4px; padding: 4px 10px; border-radius: 999px;
    background: var(--color-surface-2); color: var(--color-text-muted); font-size: 13px; white-space: nowrap;
}
.hero-rank:hover { color: var(--color-text); background: var(--color-surface-3); }
.rank-place { font-size: 15px; font-weight: 700; color: var(--color-primary); }
.hero-gap { margin-top: 6px; font-size: 13px; }
.portfolio-hero .perf-chart { margin: 14px -4px 0; }

/* Orders waiting to fill, on the home page. */
.order-list { list-style: none; }
.order-list li {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 0; border-bottom: 1px solid var(--color-border); font-size: 14px;
}
.order-list li:last-child { border-bottom: 0; }
.order-list a { color: var(--color-text); }

/* A first visit: three steps, numbered. */
.howto {
    list-style: none; counter-reset: howto; display: grid; gap: 10px; margin-bottom: 24px; padding: 16px;
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
}
.howto li { counter-increment: howto; position: relative; padding-left: 34px; font-size: 14px; line-height: 22px; }
.howto li::before {
    content: counter(howto); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%;
    background: var(--color-primary-dark); color: #fff; font-size: 12px; font-weight: 700;
    line-height: 22px; text-align: center;
}
.home-search { margin: 16px 0 8px; }

/* Sectors on the home page: one bar each, so no colour key is needed. */
.sector-bars { list-style: none; display: grid; gap: 12px; max-width: 560px; }
.sector-bars li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 14px; }
.sb-pct { font-weight: 600; }
.sb-track { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--color-surface-2); overflow: hidden; }
.sb-fill { display: block; height: 100%; min-width: 4px; border-radius: 4px; background: var(--color-primary); }

/* 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; }
/* a.stretch makes the whole row a link; buttons and the star sit above it.
   In a table, app.js follows it from a click anywhere in the row. Don't use
   an overlay here: Safari won't keep one inside a table row (WebKit bug
   240961), so every row's overlay covered the top of the page and an iPad
   opened the list's last stock whatever was tapped. On a phone the row is a
   card, and the link's ::after covers it (below). */
.rtable tr:has(a.stretch) { cursor: pointer; }
.rtable tr:has(a.stretch):hover td { background: var(--color-surface-2); }
.rtable .c-action, .rtable .c-watch { position: relative; z-index: 1; }
.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: 72px; }
/* The stock page under the chart: the player's position, key stats,
   About and the folded financials, as label-and-value lists. */
.stock-section { margin-top: 28px; max-width: 880px; }
.stock-h2 { margin-bottom: 8px; font-size: 16px; }
.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 32px; }
.kv > div {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
    min-height: 38px; padding: 8px 0; border-bottom: 1px solid var(--color-border);
}
.kv dt { color: var(--color-text-muted); }
.kv dd { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.kv abbr { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.position .kv dd .pill { margin-right: 4px; }
.about summary { list-style: none; cursor: pointer; line-height: 1.6; color: var(--color-text-muted); }
.about summary::-webkit-details-marker { display: none; }
.about:not([open]) .about-text { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.about-more { display: block; margin-top: 4px; font-weight: 600; color: var(--color-primary-link); }
.about-more::after { content: "More"; }
.about[open] .about-more::after { content: "Less"; }
.about-meta { margin-top: 10px; font-size: 13px; }
.fin-note { margin: -4px 0 8px; font-size: 12px; }
.fin { border-top: 1px solid var(--color-border); }
.fin:last-child { border-bottom: 1px solid var(--color-border); }
.fin summary {
    display: flex; align-items: center; justify-content: space-between; min-height: 48px;
    font-weight: 600; cursor: pointer; list-style: none;
}
.fin summary::-webkit-details-marker { display: none; }
.fin summary::after { content: "+"; font-size: 20px; font-weight: 400; color: var(--color-text-muted); }
.fin[open] summary::after { content: "\2212"; }
.fin .kv { padding-bottom: 12px; }
.fin .kv > div:last-child, .fin .kv > div:nth-last-child(2):nth-child(odd) { border-bottom: 0; }
@media (max-width: 768px) {
    .stock-section { margin-top: 24px; }
    .kv { grid-template-columns: 1fr; }
    .kv > div { min-height: 44px; }
    .fin .kv > div:nth-last-child(2):nth-child(odd) { border-bottom: 1px solid var(--color-border); }
}
 /* clear of the sticky top bar */

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .stock-layout { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; }
    .game-grid { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr 1fr; }
    .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; }
    .login-shots-wide { display: none; }
    .login-shots-phone { display: block; margin-top: 32px; text-align: center; }
    .login-shots-phone img { flex: 1 1 0; width: auto; max-width: 180px; }

    /* 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; }
    .page-header { margin-bottom: 16px; }
    /* One row that scrolls sideways, so the links don't push the page down. */
    .admin-nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-bottom: 16px; }
    .admin-nav::-webkit-scrollbar { display: none; }
    .admin-nav .btn { flex-shrink: 0; }

    /* 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(.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; }

    .page-header:has(.segmented) { row-gap: 10px; }
    .page-header .segmented { width: 100%; }
    .segmented a { flex: 1; padding: 9px 0; text-align: center; font-size: 14px; }

    /* Top bar: the mark (home), the cash on a game's pages, the bell and
       the account menu. The sections are in the tab bar at the bottom. */
    .topbar { position: static; height: 52px; }
    .topbar-inner { gap: 12px; }
    .topbar-links { display: none; }
    .topbar-end { gap: 0; margin-right: -8px; }
    .topbar-icon { width: 44px; height: 44px; }
    .topbar:has(.game-bar-stats) .brand-name { display: none; }
    .game-bar-stats { margin-right: 6px; }
    .game-bar-stats > span { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
    .game-bar-label { margin: 0; font-size: 10px; }
    .game-bar-stats .mono { font-size: 14px; font-weight: 600; }
    /* The account menu opens as a sheet above the tab bar. */
    .acct-menu {
        position: fixed; top: auto; left: 8px; right: 8px; width: auto;
        bottom: calc(68px + env(safe-area-inset-bottom)); max-height: calc(100dvh - 136px); overflow-y: auto;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.6);
    }
    .acct-menu a, .acct-menu button { padding: 13px 20px; font-size: 16px; }
    .game-strip-back { margin-left: 0; }

    .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);
    }
    .dock a {
        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);
        -webkit-tap-highlight-color: transparent;
    }
    .dock svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
    .dock a.active { color: var(--color-primary); }
    body:has(.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; }
    .rtable tr:has(a.stretch):hover td { background: none; }
    .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: 180px; }

    /* 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 { width: 180px; }
    .ticket-sides label { padding: 8px 0; font-size: 15px; }
    .ticket .slider, .ticket .form-group input.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; }
    .back-link { min-height: 44px; margin: -10px 0 0; font-size: 15px; }

    /* The ticket is a sheet that slides up over the page from the Buy and
       Sell bar, which sits above the tab bar (ticket.js opens it). */
    .trade-bar {
        display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
        position: fixed; left: 0; right: 0; bottom: calc(60px + env(safe-area-inset-bottom)); z-index: 999;
        padding: 8px 16px; background: var(--color-nav-bg); border-top: 1px solid var(--color-border);
    }
    .trade-bar .btn { height: 46px; font-size: 16px; font-weight: 600; justify-content: center; }
    .trade-bar .btn:disabled { opacity: 0.4; }
    body:has(.trade-bar) { padding-bottom: calc(122px + env(safe-area-inset-bottom)); }
    body:has(.trade-bar) #toast-container { bottom: calc(136px + env(safe-area-inset-bottom)); }
    .ticket-sheet {
        position: fixed; left: 0; right: 0; bottom: 0; z-index: 1002;
        max-height: 88dvh; overflow-y: auto; overscroll-behavior: contain;
        border-radius: 16px 16px 0 0; border-bottom: 0;
        padding: 0 16px calc(16px + env(safe-area-inset-bottom));
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.6);
        transform: translateY(100%); visibility: hidden;
        transition: transform 0.25s ease, visibility 0s linear 0.25s;
    }
    .ticket-open .ticket-sheet { transform: none; visibility: visible; transition: transform 0.25s ease; }
    .ticket-open { overflow: hidden; }
    /* Over the sheet a toast would hide the order button: show it at the top. */
    body.ticket-open #toast-container { top: calc(12px + env(safe-area-inset-top)); bottom: auto; }
    .ticket-sheet .ticket-head {
        display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 1;
        margin: 0 -16px 8px; padding: 18px 8px 6px 16px; background: var(--color-surface); font-size: 17px;
    }
    .ticket-grab { position: absolute; top: 6px; left: 50%; width: 36px; height: 4px; margin-left: -18px; border-radius: 2px; background: var(--color-border); }
    .ticket-close { width: 44px; height: 44px; border: 0; background: none; color: var(--color-text-muted); font-size: 28px; line-height: 1; cursor: pointer; }
    .sheet-backdrop { position: fixed; inset: 0; z-index: 1001; background: rgba(0, 0, 0, 0.6); }
    .ticket-open .sheet-backdrop { display: block; }

    .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; }
/* Phones swipe the row; a mouse can't scroll a hidden scrollbar, so wrap. */
@media (min-width: 768px) { .chips { 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; }

/* News on the stock page */
.news-list { list-style: none; padding: 0; margin: 0; max-width: 80ch; }
.news-list li { padding: 12px 0; border-bottom: 1px solid var(--color-border); }
.news-title { display: block; color: var(--color-text); font-weight: 600; line-height: 1.35; }
.news-meta { margin-top: 4px; font-size: 12px; color: var(--color-text-muted); }
.news-summary {
    margin: 6px 0 0; font-size: 14px; line-height: 1.45; color: var(--color-text-muted);
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.news-list .btn { margin-top: 10px; }

/* 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; }

@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; }
}

/* ============================================================
   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-menus { display: flex; gap: 8px; }
.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; }
.chip-sep { flex-shrink: 0; align-self: stretch; width: 1px; margin: 2px 4px; background: var(--color-border); }
/* Where the chips wrap, the financial ones start a new line instead. */
@media (min-width: 768px) { .chip-sep { flex-basis: 100%; height: 0; margin: 0; background: none; } }
/* relative keeps each chip's hidden radio inside the chip; otherwise it
   sits past the screen edge on a phone and the page scrolls sideways. */
.screener-chips .chip { cursor: pointer; position: relative; }
.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; }
.screener-explain { margin: -6px 0 10px; font-size: 13px; }

.sc-stock { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sc-text { min-width: 0; }
/* Sentence case like the health badge, to fit a phone's narrow name column;
   if it still doesn't, it wraps rather than running into the spark. */
.sc-text .badge-held { margin-top: 3px; max-width: 100%; white-space: normal; text-transform: none; letter-spacing: 0; }
/* Wraps on a phone too: the .c-sub ellipsis would clip the figure's number. */
.rtable .sc-fin { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; margin-top: 2px; white-space: normal; overflow: visible; }
.badge-health { background: var(--color-surface-3); color: var(--color-text-muted); text-transform: none; }
.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; }
.rtable .c-watch { width: 1%; padding-left: 0; padding-right: 0; text-align: center; }
.watch-star {
    width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%; background: none;
    font-size: 22px; line-height: 1; color: var(--color-text-muted); cursor: pointer;
}
.watch-star:hover { color: var(--color-warning); background: var(--color-surface-3); }
.watch-star.on { color: var(--color-warning); }

@media (max-width: 768px) {
    .screener-controls { grid-template-columns: minmax(0, 1fr); }
    .screener-sector { height: 44px; font-size: 16px; flex: 1 1 0; min-width: 0; }
    .screener .c-spark { order: 0; width: auto; }
    /* A narrower spark and gaps leave the name column room for its badges. */
    .screener .spark { width: 48px; }
    .rtable.screener tr { column-gap: 10px; }
    .screener .c-end { text-align: right; }
    .rtable .c-watch { order: 0; width: auto; margin-right: -8px; }
    .screener .sc-logo { width: 28px; height: 28px; }
}

/* Connect your AI (/settings/api): text to paste, each with a Copy button,
   and the lists of keys and connected apps. */
.copy-box { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0 14px; }
.copy-box pre {
    flex: 1; min-width: 0; margin: 0; padding: 10px 12px;
    background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius);
    font-family: var(--font-mono); font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.copy-box .btn { flex: none; }
.key-new { border-color: var(--color-success); }
.key-list { list-style: none; padding: 0; margin: 0; }
.key-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--color-border); }
.key-list li:first-child { border-top: 0; }
.key-list .text-muted { font-size: 12px; }
.ai-steps { margin: 4px 0 8px 20px; }
.ai-steps li { margin-bottom: 4px; }
.ai-badge { margin-left: 4px; font-size: 13px; text-decoration: none; }

/* The home page (/dashboard), from Rob's mockup: a hero over a rising chart,
   three big tiles (three across on every screen, as in the mockup), the intro
   video in a card over faint candles, three points and a quote. Each tile
   sets --tile to its colour. The graphics are inline SVG in the template. */
.home-hero { position: relative; overflow: hidden; margin: -24px -24px 22px; padding: 44px 24px 34px; }
.home-hero::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: radial-gradient(60% 90% at 88% 10%, rgba(2, 199, 122, 0.22), transparent 70%);
}
.home-hero-art {
    position: absolute; right: 0; top: 0; width: 62%; height: 100%; pointer-events: none;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 35%), linear-gradient(to bottom, #000 60%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image: linear-gradient(to right, transparent 0, #000 35%), linear-gradient(to bottom, #000 60%, transparent 100%);
    mask-composite: intersect;
}
.home-hero-art .home-hero-line { fill: none; stroke: #02C77A; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; filter: drop-shadow(0 0 6px rgba(2, 199, 122, 0.8)); }
.home-hero-art .home-hero-head { fill: #02C77A; filter: drop-shadow(0 0 6px rgba(2, 199, 122, 0.8)); }
.home-candles path { stroke: #02C77A; stroke-width: 1.5; opacity: 0.18; }
.home-candles rect { fill: #02C77A; opacity: 0.16; }
.home-hero-text { position: relative; max-width: 640px; text-shadow: 0 2px 12px rgba(10, 14, 23, 0.9); }
.home-hero h1 { font-size: 46px; line-height: 1.08; font-weight: 700; letter-spacing: -0.02em; margin: 10px 0 14px; }
.home-hl { color: var(--color-green); }
.home-sub { font-size: 17px; color: #C9CCD6; max-width: 34em; }
.home-kicker { font-size: 12px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase; color: #C9CCD6; }
.home-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 28px; }
.home-tile {
    --tile: var(--color-primary);
    position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
    padding: 26px 16px 20px; border-radius: 16px; color: var(--color-text);
    background: linear-gradient(170deg, color-mix(in srgb, var(--tile) 34%, var(--color-surface)) 0%, color-mix(in srgb, var(--tile) 10%, var(--color-surface)) 100%);
    border: 1px solid color-mix(in srgb, var(--tile) 60%, transparent);
    box-shadow: 0 0 24px color-mix(in srgb, var(--tile) 18%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.home-tile:hover { color: var(--color-text); border-color: var(--tile); transform: translateY(-2px); box-shadow: 0 0 32px color-mix(in srgb, var(--tile) 32%, transparent); }
.home-tile:focus-visible { outline: 2px solid var(--tile); outline-offset: 2px; }
.home-tile-game { --tile: #10B981; }
.home-tile-ask { --tile: #7C5CF0; }
.home-tile-learn { --tile: #2F7BEA; }
.home-tile-icon { display: grid; place-items: center; height: 56px; color: color-mix(in srgb, var(--tile) 70%, #fff); }
.home-tile-icon svg { width: 52px; height: 52px; }
.home-tile-icon svg.stroke { fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.home-tile-icon .fill { fill: currentColor; }
.home-tile-icon .on-fill { fill: none; stroke: color-mix(in srgb, var(--tile) 55%, #000); stroke-width: 2.4; stroke-linecap: round; }
.home-tile-icon .on-fill-dot { fill: color-mix(in srgb, var(--tile) 55%, #000); }
.home-tile-icon .stroke-only { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.home-tile-title { font-size: 20px; font-weight: 700; }
.home-tile-text { font-size: 14px; color: #D5D8E0; line-height: 1.45; }
.home-tile-live { font-size: 12px; color: var(--color-text-muted); display: inline-flex; align-items: center; gap: 6px; }
.home-tile-live strong { color: var(--color-text); font-weight: 600; font-variant-numeric: tabular-nums; }
.home-tile-go {
    display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; margin-top: auto;
    background: color-mix(in srgb, var(--tile) 75%, #000); color: #fff;
}
.home-tile-go svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.home-video {
    position: relative; overflow: hidden; margin-bottom: 28px; padding: 26px 22px 22px; border-radius: 16px;
    background: linear-gradient(180deg, #111A24 0%, var(--color-surface) 100%); border: 1px solid var(--color-border);
}
.home-video-art { position: absolute; left: 0; top: 0; width: 100%; height: 190px; pointer-events: none; }
.home-video-head { position: relative; margin-bottom: 18px; }
.home-video h2 { font-size: 26px; line-height: 1.2; font-weight: 700; margin-top: 8px; }
.home-video-note {
    position: absolute; right: 4px; top: 6px; font-style: italic; font-size: 17px; line-height: 1.15;
    color: #C9CCD6; transform: rotate(-6deg); text-align: left;
}
.home-video-note svg { display: block; width: 34px; height: 34px; margin: 4px 0 0 -26px; fill: none; stroke: #C9CCD6; stroke-width: 1.6; stroke-linecap: round; }
.home-video .intro-video { position: relative; margin: 0 auto; max-width: 900px; }
.home-points { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 26px; text-align: center; }
.home-point { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.home-point-icon {
    display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; margin-bottom: 4px;
    background: rgba(2, 199, 122, 0.08); border: 1px solid rgba(2, 199, 122, 0.25); color: #4ADE9B;
}
.home-point-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.home-point strong { font-size: 16px; }
.home-point span:last-child { font-size: 13px; color: var(--color-text-muted); }
.home-quote { text-align: center; font-size: 22px; color: #5EEAD4; margin-bottom: 26px; }
.home-foot { font-size: 12px; margin-bottom: 8px; text-align: center; }
@media (max-width: 767px) {
    .home-hero { margin: -16px -16px 16px; padding: 26px 16px 22px; }
    .home-hero-art { width: 80%; height: 62%; opacity: 0.6; }
    .home-hero h1 { font-size: clamp(26px, 7.6vw, 34px); }
    .home-sub { font-size: 15px; }
    .home-kicker { font-size: 11px; }
    .home-tiles { gap: 8px; margin-bottom: 20px; }
    .home-tile { padding: 16px 6px 12px; gap: 6px; border-radius: 12px; }
    .home-tile-icon { height: 42px; }
    .home-tile-icon svg { width: 38px; height: 38px; }
    .home-tile-title { font-size: 14px; line-height: 1.2; }
    .home-tile-text { font-size: 11px; line-height: 1.35; }
    .home-tile-live { font-size: 10.5px; flex-wrap: wrap; justify-content: center; }
    .home-tile-go { width: 32px; height: 32px; }
    .home-tile-go svg { width: 16px; height: 16px; }
    .home-video { padding: 20px 14px 14px; }
    .home-video h2 { font-size: 20px; padding-right: 70px; }
    .home-video-note { font-size: 14px; }
    .home-point-icon { width: 52px; height: 52px; }
    .home-point strong { font-size: 14px; }
    .home-point span:last-child { font-size: 11.5px; }
    .home-quote { font-size: 18px; }
}
/* The sign-in pages take the home page's headline and chart into the hero
   (auth/_hero.html), and the sign-in page has the tiles, video and points
   under the form (auth/login.html). */
.login-hero-top { position: relative; }
.login-hero-art {
    position: absolute; left: -48px; top: -32px; width: calc(100% + 96px); height: calc(100% + 64px);
    z-index: -1; opacity: 0.5; pointer-events: none;
    -webkit-mask-image: linear-gradient(to bottom, #000 50%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 50%, transparent 100%);
}
.login-hero-top .login-hero-tagline { margin-bottom: 22px; }
.login-hero-head { font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -0.02em; color: var(--color-text); margin-bottom: 12px; text-shadow: 0 2px 12px rgba(10, 14, 23, 0.9); }
.login-hero-sub { font-size: 16px; color: #C9CCD6; max-width: 28em; margin: 0 auto 40px; }
.login-more { max-width: 1080px; margin: 0 auto; padding: 56px 48px 32px; }
.login-more-kicker { text-align: center; margin-bottom: 18px; }
.login-more .home-foot { margin-top: 28px; }
@media (max-width: 768px) {
    .login-hero-art { left: -24px; width: calc(100% + 48px); }
    .login-hero-top .login-hero-tagline { margin-bottom: 14px; }
    .login-hero-head { font-size: clamp(24px, 7vw, 30px); margin-bottom: 24px; }
    .login-hero-sub { display: none; }
    .login-more { padding: 32px 16px 24px; }
}
/* The site tour (partials/_introvideo.html), on the home and sign-in pages. */
.intro-video video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; }
.intro-frame { position: relative; }
/* The mockup's big play button (data-intro-play in app.js). Hidden when
   scripting is off, and once the video plays. */
.intro-play {
    position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px 0 0 -38px; border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.9); background: rgba(10, 14, 23, 0.45); cursor: pointer;
    backdrop-filter: blur(2px); transition: transform 0.15s, background 0.15s;
}
.intro-play::after {
    content: ""; position: absolute; left: 50%; top: 50%; margin: -14px 0 0 -8px;
    border-style: solid; border-width: 14px 0 14px 24px; border-color: transparent transparent transparent #fff;
}
.intro-play:hover, .intro-play:focus-visible { transform: scale(1.06); background: rgba(10, 14, 23, 0.65); }
.intro-frame.playing .intro-play { display: none; }
@media (scripting: none) { .intro-play { display: none; } }
@media (max-width: 767px) { .intro-play { width: 60px; height: 60px; margin: -30px 0 0 -30px; } .intro-play::after { margin: -11px 0 0 -6px; border-width: 11px 0 11px 19px; } }
