/* MotorHub — design system
   Colour language borrowed from the timing screen: purple = session best (also
   the brand), green = personal best / positive, yellow = caution, red = live or
   red flag, cyan = interactive data. Saira (variable width) for display and
   numbers; the native system face for reading. */

:root {
  --asphalt: #0C0F14;
  --surface: #141922;
  --raised: #1B2230;
  --line: #273041;
  --line-soft: rgba(255, 255, 255, 0.06);
  --text: #E9EEF6;
  --muted: #8C98AB;
  --faint: #5A6577;

  --brand: #B15CFF;      /* sector purple */
  --brand-ink: #1A0B2B;
  --brand-glow: rgba(177, 92, 255, 0.35);
  --pb: #2EE37A;         /* personal best */
  --caution: #FFD60A;
  --live: #FF3045;
  --data: #3BD8FF;

  --font-display: 'Saira', 'Barlow', system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', 'Segoe UI', Roboto, system-ui, sans-serif;

  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --gutter: 16px;
  --tabbar-h: 58px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  color-scheme: dark;
}

/* Pro themes swap the brand channel only; "daylight" is a full light theme. */
[data-theme='papaya'] { --brand: #FF8A1F; --brand-ink: #2A1400; --brand-glow: rgba(255, 138, 31, 0.35); }
[data-theme='rosso'] { --brand: #FF2A3D; --brand-ink: #2B0005; --brand-glow: rgba(255, 42, 61, 0.35); }
[data-theme='teal'] { --brand: #20E3C8; --brand-ink: #00261F; --brand-glow: rgba(32, 227, 200, 0.3); }
[data-theme='gold'] { --brand: #E8C25A; --brand-ink: #261B00; --brand-glow: rgba(232, 194, 90, 0.3); }
[data-theme='british'] { --brand: #3FCB7E; --brand-ink: #002612; --brand-glow: rgba(63, 203, 126, 0.3); --asphalt: #0A1310; --surface: #111C17; --raised: #18261F; --line: #24362D; }
[data-theme='daylight'] {
  color-scheme: light;
  --asphalt: #EEF1F5; --surface: #FFFFFF; --raised: #F5F7FA; --line: #D6DCE5; --line-soft: rgba(0, 0, 0, 0.06);
  --text: #121722; --muted: #5B6676; --faint: #8D97A6;
  --brand: #7A2BE0; --brand-ink: #FFFFFF; --brand-glow: rgba(122, 43, 224, 0.2);
  --pb: #0E9F52; --caution: #B88A00; --live: #E0122B; --data: #0077B6;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--asphalt); }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--asphalt);
  color: var(--text);
  font: 16px/1.45 var(--font-body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid var(--data); outline-offset: 2px; border-radius: 6px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-family: var(--font-display); font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }

/* Carbon weave: two offset diagonal hatches. Used sparingly on chrome. */
.carbon {
  background-color: #10141B;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.035) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.035) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.035) 75%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.25));
  background-size: 6px 6px, 6px 6px, 100% 100%;
  background-position: 0 0, 3px 3px, 0 0;
}
[data-theme='daylight'] .carbon { background-color: #1A1F29; color: #E9EEF6; }

/* ───────────── App chrome ───────────── */
.app { min-height: 100dvh; padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px); }

.topbar {
  position: sticky; top: 0; z-index: 30;
  padding: calc(var(--safe-top) + 8px) var(--gutter) 8px;
  background: color-mix(in srgb, var(--asphalt) 82%, transparent);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
.topbar.scrolled { border-bottom-color: var(--line-soft); }
.topbar-row { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.topbar-title {
  flex: 1; min-width: 0;
  font: 700 34px/1.05 var(--font-display);
  font-stretch: 88%;
  letter-spacing: -0.01em;
  margin: 6px 0 2px;
  transition: font-size 0.2s var(--ease);
}
.topbar.compact .topbar-title { font-size: 21px; margin: 0; }
.topbar-sub { color: var(--muted); font-size: 14px; margin: 0 0 4px; }
.topbar.compact .topbar-sub { display: none; }
.topbar-center { flex: 1; min-width: 0; text-align: center; display: flex; flex-direction: column; line-height: 1.2; }
.topbar-center b { font: 700 17px/1.2 var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-center small { color: var(--muted); font-size: 12px; }
.icon-btn {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  border-radius: 50%; background: var(--surface); border: 1px solid var(--line-soft); color: var(--text);
}
.icon-btn svg { width: 20px; height: 20px; }
.back-btn { display: inline-flex; align-items: center; gap: 2px; color: var(--brand); font-weight: 600; height: 40px; margin-left: -6px; }
.back-btn svg { width: 24px; height: 24px; }

main#view { padding: 4px 0 0; outline: none; }
.view-enter { animation: viewIn 0.24s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* Tab bar with a timing-sector indicator above the active tab. */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 6px var(--safe-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(170%) blur(20px);
  -webkit-backdrop-filter: saturate(170%) blur(20px);
  border-top: 1px solid var(--line-soft);
}
.tab {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
}
.tab svg { width: 24px; height: 24px; }
.tab::before {
  content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px;
  background: var(--brand); box-shadow: 0 0 12px var(--brand-glow);
  transform: scaleX(0); transition: transform 0.25s var(--ease);
}
.tab[aria-current='page'] { color: var(--text); }
.tab[aria-current='page']::before { transform: scaleX(1); }
.tab .tab-badge { position: absolute; top: 5px; right: calc(50% - 22px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--live); color: #fff; font: 700 10.5px/17px var(--font-display); font-style: normal; text-align: center; box-shadow: 0 0 0 2px var(--surface); }
.tab .live-dot { position: absolute; top: 9px; right: calc(50% - 18px); width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 2px var(--surface); }

/* ───────────── Building blocks ───────────── */
.section { padding: 0 var(--gutter); margin: 18px 0 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.section h2 { margin: 0; font: 700 21px/1.2 var(--font-display); font-stretch: 92%; }
.section .link { color: var(--brand); font-size: 15px; font-weight: 600; }
.pad { padding: 0 var(--gutter); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.stack > * + * { margin-top: 10px; }

.chips { scroll-padding-inline: var(--gutter); display: flex; gap: 8px; overflow-x: auto; padding: 2px var(--gutter) 6px; scrollbar-width: none; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line); color: var(--muted);
  font-weight: 600; font-size: 14px; white-space: nowrap; scroll-snap-align: start;
}
.chip .swatch { width: 8px; height: 8px; border-radius: 2px; background: var(--c, var(--brand)); }
.chip[aria-pressed='true'] { color: var(--text); background: color-mix(in srgb, var(--c, var(--brand)) 18%, var(--surface)); border-color: color-mix(in srgb, var(--c, var(--brand)) 60%, transparent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 20px; border-radius: 14px; font-weight: 700; font-size: 16px;
  background: var(--raised); border: 1px solid var(--line); color: var(--text);
  transition: transform 0.12s var(--ease), background 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--brand); border-color: transparent; color: var(--brand-ink); box-shadow: 0 6px 24px -8px var(--brand-glow); }
.btn.block { width: 100%; }
.btn.small { height: 36px; padding: 0 14px; font-size: 14px; border-radius: 10px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }

.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.list { margin: 0 var(--gutter); background: var(--surface); border-radius: var(--r-md); border: 1px solid var(--line-soft); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 14px; }
.row + .row { border-top: 1px solid var(--line-soft); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; }
.row .sub { color: var(--muted); font-size: 13px; }
.row > svg { width: 22px; height: 22px; flex: none; color: var(--muted); }
.row .chev { color: var(--faint); width: 18px; height: 18px; flex: none; }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font: 700 12px/1 var(--font-display); letter-spacing: 0.02em; background: var(--raised); color: var(--muted); }
.badge.live { background: var(--live); color: #fff; }
.badge.live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: #fff; animation: pulse 1.4s infinite; }
.badge.pro { background: var(--brand); color: var(--brand-ink); }
.badge.series { background: color-mix(in srgb, var(--c) 22%, transparent); color: color-mix(in srgb, var(--c) 70%, var(--text)); }
@keyframes pulse { 50% { opacity: 0.35; } }

.empty { text-align: center; padding: 36px var(--gutter); color: var(--muted); }
.empty h3 { color: var(--text); margin: 8px 0 4px; font: 700 19px/1.2 var(--font-display); }
.empty .btn { margin-top: 14px; }
.notice { margin: 0 var(--gutter) 12px; padding: 12px 14px; border-radius: var(--r-md); background: color-mix(in srgb, var(--caution) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--caution) 30%, transparent); font-size: 14px; }
.notice strong { display: block; margin-bottom: 2px; }

.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--raised) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite linear; border-radius: var(--r-md); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ───────────── Sector bar: the signature element ───────────── */
.sectors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.sectors i { display: block; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; position: relative; }
.sectors i::after { content: ''; position: absolute; inset: 0; transform-origin: left; transform: scaleX(var(--fill, 0)); background: var(--seg, var(--brand)); transition: transform 0.6s var(--ease); }
.sectors i:nth-child(1) { --seg: var(--brand); }
.sectors i:nth-child(2) { --seg: var(--pb); }
.sectors i:nth-child(3) { --seg: var(--caution); }

/* Next-up hero */
.nextup { margin: 4px var(--gutter) 0; padding: 18px 18px 16px; border-radius: var(--r-lg); position: relative; overflow: hidden; border: 1px solid var(--line-soft); }
.nextup::after { content: ''; position: absolute; right: -40px; top: -40px; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c, var(--brand)) 35%, transparent), transparent 70%); pointer-events: none; }
.nextup-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.nextup h3 { margin: 8px 0 2px; font: 700 26px/1.08 var(--font-display); font-stretch: 85%; }
.nextup .where { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.countdown { display: flex; align-items: baseline; gap: 14px; margin-bottom: 12px; }
.countdown div { display: flex; flex-direction: column; }
.countdown b { font: 700 38px/1 var(--font-display); font-variant-numeric: tabular-nums; font-stretch: 80%; letter-spacing: -0.01em; }
.countdown span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.nextup-session { display: flex; justify-content: space-between; color: var(--muted); font-size: 14px; margin-top: 10px; }
.nextup-session b { color: var(--text); font-weight: 600; }
.nextup-scroller { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 var(--gutter); scrollbar-width: none; }
.nextup-scroller::-webkit-scrollbar { display: none; }
.nextup-scroller .nextup { flex: 0 0 calc(100% - 36px); margin: 0; scroll-snap-align: center; }
.nextup-scroller .nextup:only-child { flex-basis: 100%; }

/* ───────────── News ───────────── */
.feed { display: grid; gap: 12px; padding: 0 var(--gutter); }
.story { display: grid; grid-template-columns: 1fr 104px; gap: 12px; padding: 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-soft); text-align: left; width: 100%; }
.story:active { background: var(--raised); }
.story .thumb { width: 104px; height: 78px; border-radius: 10px; object-fit: cover; background: var(--raised); }
.story h3 { margin: 4px 0 6px; font-size: 16px; line-height: 1.3; font-weight: 650; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.story .meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.story .meta .src { color: var(--text); font-weight: 600; }
.story.lead { grid-template-columns: 1fr; padding: 0; overflow: hidden; }
.story.lead .thumb { width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 0; }
.story.lead .body { padding: 12px 14px 14px; }
.story.lead h3 { font: 700 22px/1.15 var(--font-display); font-stretch: 90%; -webkit-line-clamp: 4; }
.story.noimg { grid-template-columns: 1fr; }
.story .also { color: var(--faint); font-size: 12.5px; }

/* Article reader */
.reader { padding-bottom: 24px; }
.reader-hero { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--raised); }
.reader-body { padding: 16px var(--gutter) 0; max-width: 680px; margin: 0 auto; }
.reader h1 { font: 700 28px/1.12 var(--font-display); font-stretch: 88%; margin: 10px 0 10px; }
.reader .byline { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.reader .excerpt { font-size: 18px; line-height: 1.55; margin: 18px 0; }
.reader .source-cta { margin: 18px 0 8px; padding: 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-soft); }
.reader .source-cta p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.reader .also-list { margin: 12px 0 0; display: flex; gap: 8px; flex-wrap: wrap; }

/* ───────────── Ads (free tier) ───────────── */
.ad { margin: 0 var(--gutter); border-radius: var(--r-md); border: 1px dashed var(--line); background: var(--surface); padding: 10px 12px 12px; min-height: 96px; position: relative; }
.ad-label { font-size: 11px; color: var(--faint); margin-bottom: 6px; display: flex; justify-content: space-between; }
.ad-label button { color: var(--brand); font-weight: 600; font-size: 11px; }
.feed .ad, .reader .ad { margin: 0; }
.ad-house { display: flex; gap: 12px; align-items: center; }
.ad-house .mark { width: 52px; height: 52px; border-radius: 12px; flex: none; display: grid; place-items: center; }
.ad-house strong { display: block; font-size: 15px; }
.ad-house span { color: var(--muted); font-size: 13px; }
.ad-banner { min-height: 64px; margin-top: 14px; }

/* ───────────── Live timing tower ───────────── */
.session-card { margin: 0 var(--gutter); padding: 14px 16px; border-radius: var(--r-lg); position: relative; overflow: hidden; border: 1px solid var(--line-soft); }
.session-card .flagbar { position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--flag, var(--pb)); }
.session-card h3 { margin: 6px 0 2px; font: 700 24px/1.1 var(--font-display); font-stretch: 86%; }
.session-card .facts { display: flex; gap: 18px; margin-top: 12px; flex-wrap: wrap; }
.session-card .facts div { display: flex; flex-direction: column; }
.session-card .facts b { font: 700 20px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.session-card .facts span { color: var(--muted); font-size: 12px; margin-top: 3px; }
[data-flag='green'] { --flag: var(--pb); }
[data-flag='sc'], [data-flag='vsc'] { --flag: var(--caution); }
[data-flag='red'] { --flag: var(--live); }
[data-flag='chequered'] { --flag: repeating-linear-gradient(0deg, #fff 0 6px, #111 6px 12px); }

.tower { margin: 12px var(--gutter) 0; border-radius: var(--r-md); overflow: hidden; background: var(--surface); border: 1px solid var(--line-soft); }
.tower-head, .tower-row {
  display: grid; align-items: center; gap: 8px;
  grid-template-columns: 26px 4px minmax(44px, 1fr) 76px 72px 34px;
  padding: 0 12px;
}
.tower.pro .tower-head, .tower.pro .tower-row { grid-template-columns: 22px 4px minmax(34px, 1fr) 54px 62px 62px 24px; gap: 6px; padding: 0 10px; }
.tower.pro .who small { display: none; }
.tower.pro .t { font-size: 13.5px; }
.tower-head { height: 30px; color: var(--faint); font-size: 11.5px; font-weight: 600; border-bottom: 1px solid var(--line-soft); }
.tower-head span:nth-child(n+4) { text-align: right; }
.tower-row { height: 44px; font-size: 15px; transition: background 0.4s; }
.tower-row + .tower-row { border-top: 1px solid var(--line-soft); }
.tower-row .p { font: 700 16px/1 var(--font-display); text-align: center; font-variant-numeric: tabular-nums; }
.tower-row .bar { height: 22px; border-radius: 2px; background: var(--c, var(--muted)); }
.tower-row .who { min-width: 0; display: flex; align-items: baseline; gap: 6px; }
.tower-row .who b { font: 700 16px/1 var(--font-display); letter-spacing: 0.02em; }
.tower-row .who small { color: var(--faint); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tower-row .t { font: 600 14.5px/1 var(--font-display); font-variant-numeric: tabular-nums; text-align: right; color: var(--muted); }
.tower-row .t.purple { color: var(--brand); }
.tower-row .t.green { color: var(--pb); }
.tower-row .t.lead { color: var(--text); }
.tower-row.moved-up { background: color-mix(in srgb, var(--pb) 12%, transparent); }
.tower-row.moved-down { background: color-mix(in srgb, var(--live) 10%, transparent); }
.tower-row.out { opacity: 0.45; }
.tyre { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--tc, var(--muted)); display: grid; place-items: center; font: 800 10px/1 var(--font-display); justify-self: end; color: var(--text); }
.tyre[data-c='SOFT'] { --tc: #FF3B3B; } .tyre[data-c='MEDIUM'] { --tc: #FFD60A; } .tyre[data-c='HARD'] { --tc: #F2F2F2; }
.tyre[data-c='INTERMEDIATE'] { --tc: #2EE37A; } .tyre[data-c='WET'] { --tc: #3B8BFF; }
.tyre svg { width: 11px; height: 11px; color: var(--faint); }
.pit { font: 700 10px/1 var(--font-display); color: var(--data); justify-self: end; }

.rc-list { margin: 0 var(--gutter); }
.rc { display: grid; grid-template-columns: 44px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-soft); font-size: 14px; }
.rc:first-child { border-top: 0; }
.rc .lap { color: var(--faint); font: 600 13px/1.3 var(--font-display); }
.rc .flag-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; background: var(--fc, var(--muted)); vertical-align: 1px; }

.schedule-list .row .when { text-align: right; font-size: 13px; color: var(--muted); }
.schedule-list .row .when b { display: block; color: var(--text); font: 600 15px/1.2 var(--font-display); font-variant-numeric: tabular-nums; }
.schedule-list .row.past { opacity: 0.5; }
.schedule-list .row.now { background: color-mix(in srgb, var(--live) 10%, transparent); }

.segmented { display: flex; margin: 0 var(--gutter); padding: 3px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line-soft); }
.segmented button { flex: 1; height: 34px; border-radius: 9px; font-weight: 600; font-size: 14px; color: var(--muted); }
.segmented button[aria-pressed='true'] { background: var(--raised); color: var(--text); box-shadow: 0 1px 0 var(--line-soft) inset; }

/* Standings */
.standing .pos { width: 26px; text-align: center; font: 700 16px/1 var(--font-display); color: var(--muted); }
.standing .pts { font: 700 17px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.standing .teamdot { width: 4px; height: 28px; border-radius: 2px; background: var(--c, var(--faint)); flex: none; }

/* Charts (Pro) */
.chart { margin: 0 var(--gutter); padding: 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-soft); }
.chart svg { width: 100%; height: auto; display: block; }
.chart .legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.chart .legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: 3px; background: var(--c); }

/* Pro lock */
.locked { position: relative; }
.locked > .lock-veil { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; text-align: center; padding: 20px; background: color-mix(in srgb, var(--asphalt) 55%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border-radius: var(--r-md); }
.lock-veil p { margin: 6px 0 12px; color: var(--muted); font-size: 14px; max-width: 260px; }
.lock-veil strong { font: 700 18px/1.2 var(--font-display); display: block; }

/* ───────────── Odds ───────────── */
.market { margin: 0 var(--gutter) 12px; padding: 14px; }
.market h3 { margin: 0 0 2px; font: 700 18px/1.2 var(--font-display); font-stretch: 92%; }
.market .meta { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.runner { display: grid; grid-template-columns: 1fr auto 64px; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line-soft); }
.runner .name { font-weight: 600; font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.runner .prob { height: 4px; margin-top: 5px; border-radius: 2px; background: var(--line); position: relative; overflow: hidden; }
.runner .prob::after { content: ''; position: absolute; inset: 0; width: var(--p); background: var(--brand); border-radius: 2px; }
.runner .pct { font: 600 14px/1 var(--font-display); color: var(--muted); font-variant-numeric: tabular-nums; }
.runner .price { justify-self: end; min-width: 60px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--raised); border: 1px solid var(--line); font: 700 15px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.runner .delta { font-size: 11px; font-weight: 700; }
.runner .delta.up { color: var(--pb); } .runner .delta.down { color: var(--live); }
.gamble-note { margin: 18px var(--gutter) 0; font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.gamble-note a { color: var(--text); text-decoration: underline; }

/* ───────────── Chat ───────────── */
.room-icon { --s: 44px; width: var(--s); height: var(--s); border-radius: calc(var(--s) * 0.28); display: grid; place-items: center; flex: none;
  font: 800 calc(var(--s) * 0.29)/1 var(--font-display); color: #0C0F14; letter-spacing: 0.02em;
  background: linear-gradient(145deg, color-mix(in srgb, var(--c, var(--brand)) 82%, #fff), var(--c, var(--brand))); box-shadow: inset 0 -2px 0 rgba(0,0,0,.18); }
.room-icon.long { font-size: calc(var(--s) * 0.22); letter-spacing: 0; }
.room-icon.pro { background: conic-gradient(from 210deg, var(--brand), #fff 30%, var(--brand) 60%); }

.av { --s: 36px; position: relative; width: var(--s); height: var(--s); border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden;
  background: color-mix(in srgb, var(--c, var(--data)) 85%, #000); color: #0C0F14; font: 800 calc(var(--s) * 0.38)/1 var(--font-display); }
.av i { font-style: normal; }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.av.group { background: var(--raised); color: var(--brand); border: 1px solid var(--line); }
.av.group svg { width: 52%; height: 52%; }

.chat-tabs { margin-top: 4px; }
.segmented button { position: relative; }
.tab-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--live); color: #fff; font: 700 11px/1 var(--font-display); vertical-align: 1px; }
.join-card { display: flex; align-items: center; gap: 14px; margin: 0 var(--gutter) 14px; padding: 14px 16px; border-radius: var(--r-md); border: 1px solid color-mix(in srgb, var(--brand) 35%, transparent); }
.join-card div { flex: 1; min-width: 0; }
.join-card b { display: block; font: 700 17px/1.2 var(--font-display); }
.join-card span { color: var(--muted); font-size: 13.5px; }
.chat-row { gap: 12px; }
.chat-row .meta-col { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex: none; }
.chat-row .time { color: var(--faint); font-size: 12px; }
.chat-row .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: var(--brand-ink); font: 700 12px/20px var(--font-display); text-align: center; }
.chat-row.unread .title { font-weight: 800; }
.chat-row.unread .sub { color: var(--text); }
.chat-row .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row .badge.pro { margin-left: 4px; vertical-align: 2px; }
.action-row { display: flex; gap: 8px; margin: 6px 0 12px; flex-wrap: wrap; }
.small-btn { width: 34px; height: 34px; }
.small-btn svg { width: 16px; height: 16px; }
.search-box { display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.search-box:focus-within { border-color: var(--brand); }
.search-box svg { width: 18px; height: 18px; color: var(--faint); flex: none; }
.search-box input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; outline: none; font-size: 16px; }
.pick-list .check { width: 22px; height: 22px; accent-color: var(--brand); }
.empty-icon { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line-soft); color: var(--brand); }
.empty-icon svg { width: 30px; height: 30px; }

/* Thread header in the top bar */
.thread-head { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 10px; }
.thread-head .grow { min-width: 0; display: flex; flex-direction: column; line-height: 1.2; flex: 0 1 auto; }
.thread-head b { font: 700 17px/1.2 var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-head small { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread-head .room-icon, .thread-head .av { --s: 34px; }

/* Thread */
.chat { position: fixed; left: 0; right: 0; top: calc(var(--safe-top) + 57px); bottom: calc(var(--tabbar-h) + var(--safe-bottom)); display: flex; flex-direction: column; z-index: 5;
  background: radial-gradient(120% 60% at 50% -10%, color-mix(in srgb, var(--room, var(--brand)) 10%, transparent), transparent 60%), var(--asphalt); }
.chat.kb { bottom: var(--kb, 0px); }
.chat-scroll { flex: 1; overflow-y: auto; padding: 10px var(--gutter) 8px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.chat-empty { padding-top: 12vh; }
.chat-empty .room-icon, .chat-empty .av { margin: 0 auto; }
.day-sep { display: flex; justify-content: center; margin: 14px 0 10px; }
.day-sep span { padding: 4px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line-soft); color: var(--muted); font-size: 12px; font-weight: 600; }

.msg-row { display: flex; align-items: flex-end; gap: 8px; margin-top: 2px; }
.msg-row.first { margin-top: 12px; }
.msg-row.mine { justify-content: flex-end; }
.msg-av { width: 30px; flex: none; }
.msg-col { display: flex; flex-direction: column; align-items: flex-start; max-width: min(78%, 560px); min-width: 0; }
.mine .msg-col { align-items: flex-end; }
.msg-name { display: flex; align-items: center; gap: 6px; margin: 0 0 3px 12px; font-size: 12.5px; font-weight: 700; color: color-mix(in srgb, var(--c, var(--data)) 80%, #fff); }
.badge.mini { height: 16px; padding: 0 5px; font-size: 9.5px; border-radius: 4px; }
.bubble { padding: 8px 13px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line-soft); font-size: 15.5px; line-height: 1.4; overflow-wrap: anywhere; }
.bubble p { margin: 0; white-space: pre-wrap; }
.msg-row:not(.mine):not(.first) .bubble { border-top-left-radius: 6px; }
.msg-row:not(.mine):not(.last) .bubble { border-bottom-left-radius: 6px; }
.msg-row.mine .bubble { background: linear-gradient(160deg, color-mix(in srgb, var(--brand) 88%, #fff), var(--brand)); color: var(--brand-ink); border-color: transparent; }
.msg-row.mine:not(.first) .bubble { border-top-right-radius: 6px; }
.msg-row.mine:not(.last) .bubble { border-bottom-right-radius: 6px; }
.bubble.media { padding: 0; background: none !important; border: 0; }
.bubble .gif { display: block; border-radius: 16px; max-width: min(260px, 64vw); max-height: 240px; object-fit: cover; background: var(--raised); }
.bubble p + .gif { margin-top: 6px; }
.msg-time { margin: 3px 10px 0; color: var(--faint); font-size: 11px; }
.reacts { display: flex; gap: 4px; margin-top: -6px; padding: 0 8px; flex-wrap: wrap; position: relative; z-index: 1; }
.react { height: 24px; padding: 0 7px; border-radius: 999px; background: var(--raised); border: 1px solid var(--line); font-size: 13px; display: inline-flex; align-items: center; gap: 4px; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.react[aria-pressed='true'] { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 22%, var(--raised)); }
.react b { font: 600 11.5px/1 var(--font-display); }
.typing { min-height: 18px; padding: 0 var(--gutter) 2px; color: var(--faint); font-size: 12px; }
.presence { color: var(--pb); display: inline-flex; align-items: center; gap: 5px; }
.presence::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--pb); }

/* Composer */
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px var(--gutter) 10px; }
.composer-box { flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 2px; padding: 4px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); transition: border-color .15s, box-shadow .15s; }
.composer-box:focus-within { border-color: color-mix(in srgb, var(--brand) 70%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 14%, transparent); }
.composer-box textarea { flex: 1; min-width: 0; resize: none; min-height: 36px; max-height: 140px; padding: 8px 6px; border: 0; background: none; outline: none; font-size: 16px; line-height: 1.35; }
.cbtn { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 50%; color: var(--muted); }
.cbtn:hover { color: var(--text); background: var(--raised); }
.cbtn svg { width: 21px; height: 21px; }
.gif-btn { width: auto; height: 24px; padding: 0 8px; margin: 6px 6px 6px 2px; border-radius: 7px; font: 800 11px/1 var(--font-display); letter-spacing: .04em; border: 1.5px solid currentColor; }
.send { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--brand); color: var(--brand-ink); box-shadow: 0 6px 20px -6px var(--brand-glow); transition: transform .15s var(--ease), opacity .15s, filter .15s; }
.send svg { width: 20px; height: 20px; transform: translateX(-1px); }
.send:disabled { opacity: .35; box-shadow: none; filter: grayscale(.4); cursor: default; }
.send:not(:disabled):active { transform: scale(.92); }
.join-bar { display: flex; align-items: center; gap: 12px; margin: 8px var(--gutter) 10px; padding: 10px 10px 10px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); font-size: 14.5px; }
.join-bar span { flex: 1; color: var(--muted); }
.react-bar { display: flex; justify-content: space-between; gap: 4px; padding: 8px var(--gutter); }
.react-bar button { font-size: 26px; width: 44px; height: 44px; border-radius: 14px; background: var(--raised); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; padding: 0 var(--gutter) 8px; }
.emoji-grid button { font-size: 26px; aspect-ratio: 1; border-radius: 12px; background: var(--raised); }
.gif-grid { columns: 2; column-gap: 8px; padding: 0 var(--gutter) 12px; }
.gif-grid button { display: block; width: 100%; margin-bottom: 8px; border-radius: 10px; overflow: hidden; background: var(--raised); break-inside: avoid; }
.gif-grid img { width: 100%; height: auto; }

/* Sign-in */
.auth-head { text-align: center; padding: 4px var(--gutter) 16px; }
.auth-head img { margin: 0 auto 10px; border-radius: 12px; }
.auth-head h2 { margin: 0 0 4px; font: 800 26px/1.1 var(--font-display); }
.auth-head p { margin: 0; color: var(--muted); }
.auth-step[data-step='choose'] { display: grid; gap: 10px; padding: 0 var(--gutter); }
.auth-step[hidden] { display: none !important; }
.auth .btn.block { justify-content: center; }
.auth-google { background: #fff; color: #1f1f1f; border-color: #fff; }
.auth-note, .auth-legal { text-align: center; }
.code-input { letter-spacing: .4em; font: 700 22px/1 var(--font-display) !important; text-align: center; }
.username-input { display: flex; align-items: center; height: 46px; padding: 0 14px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line); }
.username-input:focus-within { border-color: var(--brand); }
.username-input b { color: var(--muted); margin-right: 2px; }
.username-input input { flex: 1; border: 0 !important; background: none !important; height: 100% !important; padding: 0 !important; outline: none; }

/* ───────────── Sheets, toasts, forms ───────────── */
.sheet-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(0, 0, 0, 0.5); opacity: 0; transition: opacity 0.25s; }
.sheet-backdrop.open { opacity: 1; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-height: 88dvh; overflow-y: auto; background: var(--surface); border-radius: 22px 22px 0 0; border-top: 1px solid var(--line); padding: 8px 0 calc(var(--safe-bottom) + 16px); transform: translateY(100%); transition: transform 0.32s var(--ease); overscroll-behavior: contain; }
.sheet.open { transform: none; }
.sheet .grabber { width: 38px; height: 5px; border-radius: 3px; background: var(--line); margin: 0 auto 10px; }
.sheet h2 { margin: 4px var(--gutter) 12px; font: 700 22px/1.2 var(--font-display); }
.sheet .list { background: var(--raised); }
@media (min-width: 720px) { .sheet { left: 50%; right: auto; width: 520px; transform: translate(-50%, 100%); } .sheet.open { transform: translate(-50%, 0); } }

.toasts { position: fixed; left: 0; right: 0; top: calc(var(--safe-top) + 10px); z-index: 80; display: grid; justify-items: center; gap: 8px; pointer-events: none; }
.toast { pointer-events: auto; max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 14px; background: var(--raised); border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); font-size: 14.5px; animation: toastIn 0.3s var(--ease); display: flex; gap: 12px; align-items: center; }
.toast button { color: var(--brand); font-weight: 700; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }

.field { display: block; margin: 0 var(--gutter) 12px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; height: 46px; padding: 0 14px; border-radius: 12px; background: var(--raised); border: 1px solid var(--line); font-size: 16px; outline: none; }
.field textarea { height: auto; min-height: 80px; padding: 10px 14px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); }
.switch { position: relative; width: 51px; height: 31px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background 0.2s; }
.switch span::after { content: ''; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25); transition: transform 0.2s var(--ease); }
.switch input:checked + span { background: var(--pb); }
.switch input:checked + span::after { transform: translateX(20px); }

/* Sport picker */
.picker-group { margin: 0 0 18px; }
.picker-group h3 { margin: 0 var(--gutter) 8px; font-size: 14px; color: var(--muted); font-weight: 600; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; padding: 0 var(--gutter); }
.pick { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; border-radius: 12px; background: var(--raised); border: 1.5px solid var(--line); text-align: left; font-weight: 600; font-size: 14.5px; }
.pick .tag { font: 800 11px/1 var(--font-display); padding: 5px 6px; border-radius: 5px; background: var(--c); color: #0C0F14; min-width: 38px; text-align: center; letter-spacing: 0.02em; }
.pick[aria-pressed='true'] { border-color: var(--c); background: color-mix(in srgb, var(--c) 14%, var(--raised)); }
.pick .tick { margin-left: auto; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line); display: grid; place-items: center; flex: none; }
.pick[aria-pressed='true'] .tick { background: var(--c); border-color: var(--c); color: #0C0F14; }
.pick .tick svg { width: 12px; height: 12px; opacity: 0; }
.pick[aria-pressed='true'] .tick svg { opacity: 1; }

/* Onboarding */
.onboard { min-height: 100dvh; display: flex; flex-direction: column; padding: calc(var(--safe-top) + 24px) 0 calc(var(--safe-bottom) + 20px); }
.onboard .hero { padding: 0 var(--gutter); }
.onboard .hero h1 { font: 800 44px/0.98 var(--font-display); font-stretch: 78%; margin: 18px 0 10px; letter-spacing: -0.01em; }
.onboard .hero p { color: var(--muted); margin: 0 0 22px; font-size: 17px; max-width: 34ch; }
.onboard .foot { margin-top: auto; padding: 16px var(--gutter) 0; position: sticky; bottom: 0; background: linear-gradient(transparent, var(--asphalt) 30%); }
.logo-mark { width: 56px; height: 56px; }

/* Pro screen */
.pro-hero { margin: 0 var(--gutter); padding: 22px 18px; border-radius: var(--r-lg); position: relative; overflow: hidden; border: 1px solid var(--line-soft); }
.pro-hero h2 { font: 800 34px/1 var(--font-display); font-stretch: 80%; margin: 12px 0 8px; }
.pro-hero p { color: var(--muted); margin: 0 0 16px; }
.perk { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: start; }
.perk .ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--brand) 16%, var(--raised)); color: var(--brand); }
.perk .ico svg { width: 20px; height: 20px; }
.perk b { display: block; font-size: 15.5px; }
.perk span { color: var(--muted); font-size: 14px; }
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 var(--gutter); }
.plan { padding: 14px; border-radius: var(--r-md); background: var(--surface); border: 1.5px solid var(--line); text-align: left; }
.plan[aria-pressed='true'] { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.plan b { display: block; font: 700 18px/1.2 var(--font-display); }
.plan span { color: var(--muted); font-size: 13px; }
.themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 0 var(--gutter); }
.theme-swatch { aspect-ratio: 1; border-radius: 14px; border: 2px solid var(--line); background: linear-gradient(135deg, var(--sw-bg) 55%, var(--sw) 55%); position: relative; }
.theme-swatch[aria-pressed='true'] { border-color: var(--text); }
.theme-swatch span { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: 11.5px; color: var(--muted); }
.themes-wrap { padding-bottom: 18px; }

.install-tip { display: flex; gap: 12px; align-items: center; margin: 0 var(--gutter) 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line-soft); font-size: 14px; }
.install-tip svg { width: 22px; height: 22px; flex: none; color: var(--data); }
.install-tip button { margin-left: auto; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ───────────── Story thumbnails: series-coloured artwork behind every image ───────────── */
.thumb.ph { position: relative; display: grid; place-items: center; overflow: hidden;
  background:
    radial-gradient(circle at 78% 18%, color-mix(in srgb, var(--c, var(--brand)) 55%, transparent), transparent 62%),
    linear-gradient(45deg, rgba(255,255,255,.035) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.035) 75%) 0 0 / 6px 6px,
    linear-gradient(45deg, rgba(255,255,255,.035) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.035) 75%) 3px 3px / 6px 6px,
    #10141B; }
.thumb.ph b { font: 800 20px/1 var(--font-display); font-stretch: 80%; letter-spacing: 0.02em; color: color-mix(in srgb, var(--c, var(--brand)) 70%, #fff); }
.thumb.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.story.lead .thumb.ph b { font-size: 64px; opacity: 0.9; }
.story { transition: background 0.15s, border-color 0.15s; }
@media (hover: hover) {
  .story:hover { background: var(--raised); border-color: var(--line); }
  .row[href]:hover, button.row:hover { background: var(--raised); }
  .chip:hover { color: var(--text); }
}

/* Preview banner when opened from disk */
.demo-bar { display: flex; gap: 12px; align-items: center; margin: 0 var(--gutter) 12px; padding: 10px 14px; border-radius: var(--r-md);
  background: color-mix(in srgb, var(--data) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--data) 35%, transparent); font-size: 13.5px; }
.demo-bar b { color: var(--data); }
.demo-bar button { margin-left: auto; color: var(--muted); flex: none; }
.demo-bar svg { width: 18px; height: 18px; }

.topbar-logo { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.rail-brand, .rail-pro { display: none; }

/* ───────────── Tablet: centred phone column ───────────── */
@media (min-width: 720px) and (max-width: 999px) {
  .app { max-width: 760px; margin: 0 auto; }
  .tabbar { left: 50%; right: auto; width: 760px; transform: translateX(-50%); border-radius: 20px 20px 0 0; }
  .feed { grid-template-columns: 1fr 1fr; }
  .feed .story.lead, .feed .ad { grid-column: 1 / -1; }
  .chat { left: 50%; right: auto; width: 760px; transform: translateX(-50%); }
}

/* ───────────── Desktop: sidebar rail + wide content ───────────── */
@media (min-width: 1000px) {
  :root { --rail: 248px; --gutter: 24px; }
  .tabbar {
    top: 0; bottom: 0; left: 0; right: auto; width: var(--rail); height: auto;
    display: flex; flex-direction: column; gap: 4px; padding: 26px 14px 20px;
    border-top: 0; border-right: 1px solid var(--line-soft); transform: none; border-radius: 0;
    background: var(--surface);
  }
  .rail-brand { display: flex; align-items: center; gap: 11px; padding: 0 10px 26px; font: 800 23px/1 var(--font-display); font-stretch: 85%; }
  .rail-brand img { border-radius: 9px; }
  .tab { flex-direction: row; justify-content: flex-start; gap: 14px; flex: none; height: 46px; padding: 0 14px; border-radius: 12px; font-size: 15px; font-weight: 600; color: var(--muted); }
  .tab svg { width: 22px; height: 22px; }
  .tab:hover { background: var(--raised); color: var(--text); }
  .tab[aria-current='page'] { background: color-mix(in srgb, var(--brand) 14%, transparent); color: var(--text); }
  .tab::before { left: -14px; right: auto; top: 11px; bottom: 11px; width: 4px; height: auto; border-radius: 0 4px 4px 0; transform: scaleY(0); }
  .tab[aria-current='page']::before { transform: scaleY(1); }
  .tab .live-dot { position: static; margin-left: auto; box-shadow: none; }
  .tab .tab-badge { position: static; margin-left: auto; box-shadow: none; }
  .rail-pro { display: block; margin-top: auto; padding: 16px; border-radius: 16px; border: 1px solid color-mix(in srgb, var(--brand) 40%, transparent);
    background: radial-gradient(circle at 90% 0%, var(--brand-glow), transparent 60%), var(--raised); }
  .rail-pro b { display: block; font: 700 16px/1.2 var(--font-display); color: var(--brand); margin-bottom: 4px; }
  .rail-pro span { color: var(--muted); font-size: 13px; line-height: 1.4; }

  .app { margin-left: var(--rail); max-width: none; padding-bottom: 48px; }
  .topbar { padding-top: 22px; }
  .topbar-row, main#view > * { max-width: 960px; margin-left: auto; margin-right: auto; }
  .topbar-row { padding: 0 var(--gutter); }
  .topbar { padding-left: 0; padding-right: 0; }
  main#view > .chat { max-width: none; }
  .topbar-title { font-size: 40px; }

  .feed { grid-template-columns: 1fr 1fr; gap: 14px; }
  .feed .story.lead, .feed .ad { grid-column: 1 / -1; }
  .story.lead { grid-template-columns: 1.35fr 1fr; align-items: stretch; }
  .story.lead .thumb { aspect-ratio: auto; height: 100%; min-height: 280px; }
  .story.lead .body { padding: 22px 22px 22px 6px; display: flex; flex-direction: column; justify-content: center; }
  .story.lead h3 { font-size: 30px; }
  .story .thumb { width: 132px; height: 96px; }
  .story { grid-template-columns: 1fr 132px; }

  .nextup-scroller .nextup { flex-basis: calc(50% - 6px); }
  .nextup-scroller .nextup:only-child { flex-basis: 100%; }
  .reader-hero { max-width: 912px; margin: 0 auto; border-radius: var(--r-lg); aspect-ratio: 21 / 9; }
  .chat { left: var(--rail); right: 0; width: auto; transform: none; top: 76px; bottom: 0; }
  .msg-col { max-width: min(64%, 620px); }
  .chat-scroll, .composer, .typing { width: 100%; max-width: 960px; margin-left: auto; margin-right: auto; }
  .picker-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
  .onboard { max-width: 960px; margin: 0 auto; }
  .onboard .hero h1 { font-size: 72px; }
  .sheet { left: calc(50% + var(--rail) / 2); }
  .toasts { left: var(--rail); }
}

.no-nav .app { margin-left: 0 !important; }
.no-nav .demo-bar { display: none; }
@media (min-width: 1000px) { .mobile-only { display: none !important; } .demo-bar { max-width: 912px; margin: 0 auto 12px; } }
