:root {
  color-scheme: dark;
  --bg: #0f1214;
  --surface-lowest: #0a0c0d;
  --surface-low: #181b1d;
  --surface: #1f2325;
  --elevated: #292d2f;
  --surface-highest: #353a3d;
  --text: #f4f0e5;
  --muted: #b5b1a4;
  --muted-2: #797a71;
  --border: #444640;
  --strong-border: #706c5b;
  --paper: #e6decb;
  --paper-muted: #bab099;
  --ink: #141616;
  --accent: #dfae56;
  --accent-pressed: #c5b897;
  --success: #5bd68a;
  --error: #ff685b;
  --warning: #e7bb67;
  --shadow: 0 24px 60px rgba(0, 0, 0, .22);
  --radius: 18px;
  --radius-sm: 12px;
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
}

body[data-theme="light"] {
  color-scheme: light;
  --bg: #f4efe4;
  --surface-lowest: #fffdf5;
  --surface-low: #ece5d6;
  --surface: #f8f3e8;
  --elevated: #fffaf0;
  --surface-highest: #e5dccb;
  --text: #1c1d1b;
  --muted: #656156;
  --muted-2: #938c7a;
  --border: #d6cdbA;
  --strong-border: #a89979;
  --paper: #141616;
  --paper-muted: #736853;
  --ink: #f4efe4;
  --accent: #a06f24;
  --accent-pressed: #6c4919;
  --success: #26804c;
  --error: #b83428;
  --warning: #a06f24;
  --shadow: 0 20px 48px rgba(81, 65, 36, .12);
}
body[data-theme="light"] .auth-brand img, body[data-theme="light"] .brand img { content: url("assets/fypedia-logo-light.png"); }

* { box-sizing: border-box; }
html { min-width: 0; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
a { color: inherit; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 7px; color: var(--paper-muted); font-size: 11px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.serif { font-family: var(--font-serif); }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 28px;
  padding: 28px 18px 22px; border-right: 1px solid var(--border); background: rgba(10, 12, 13, .46);
}
body[data-theme="light"] .rail { background: rgba(255, 252, 244, .66); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 34px; height: 34px; border-radius: 11px; object-fit: cover; }
.brand-name { font-family: var(--font-serif); font-size: 24px; font-weight: 700; letter-spacing: -.03em; }
.brand-subtitle { margin: 2px 0 0 44px; color: var(--muted); font-size: 11px; }
.nav-label { margin: 0 12px 10px; color: var(--muted-2); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.nav-list { display: grid; gap: 5px; }
.nav-button {
  width: 100%; display: flex; align-items: center; gap: 11px; padding: 12px 13px; border: 1px solid transparent;
  border-radius: 12px; color: var(--muted); background: transparent; text-align: left; transition: .18s ease;
}
.nav-button:hover { color: var(--text); background: var(--surface-low); }
.nav-button.active { color: var(--text); border-color: var(--border); background: var(--surface); box-shadow: inset 3px 0 0 var(--accent); }
.nav-icon { width: 20px; color: var(--paper-muted); text-align: center; font-size: 16px; }
.rail-footer { margin-top: auto; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-low); }
.rail-footer strong { display: block; font-size: 13px; }
.rail-footer span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.45; }

.main { min-width: 0; padding: 26px clamp(18px, 4vw, 58px) 48px; }
.main-inner { width: min(1120px, 100%); margin: 0 auto; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.topbar h1 { margin: 0; font-family: var(--font-serif); font-size: clamp(28px, 4vw, 42px); letter-spacing: -.04em; }
.topbar p { margin: 7px 0 0; color: var(--muted); font-size: 14px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.session-count { display: inline-flex; align-items: center; gap: 7px; padding: 10px 13px; color: var(--accent); font-size: 13px; font-weight: 700; }
.avatar { display: grid; place-items: center; width: 42px; height: 42px; border: 0; border-radius: 50%; color: var(--ink); background: var(--accent); font-weight: 800; }

.section { margin-top: 30px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.section-heading h2 { margin: 0; font-family: var(--font-serif); font-size: 24px; letter-spacing: -.025em; }
.section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.text-button { padding: 5px 0; border: 0; color: var(--accent); background: transparent; font-size: 13px; font-weight: 700; }

.card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: 0 2px 0 rgba(255,255,255,.015); }
.paper-card { border-color: transparent; color: var(--ink); background: linear-gradient(135deg, var(--paper), #cfc3a6); }
.learning-strip { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 22px; padding: 20px; }
.learning-strip h2 { margin: 0; font-family: var(--font-serif); font-size: 25px; }
.learning-strip .sub { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.strip-progress { grid-column: 1 / -1; }
.progress-track { height: 8px; overflow: hidden; border-radius: 99px; background: var(--surface-highest); }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .35s ease; }
.progress-label { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }

.topic-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.topic-card { position: relative; min-height: 190px; overflow: hidden; border: 1px solid var(--border); border-radius: 15px; background: var(--surface-low); text-align: left; transition: transform .18s ease, border-color .18s ease; }
.topic-card:hover { transform: translateY(-2px); border-color: var(--strong-border); }
.topic-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.topic-art { min-height: 126px; display: flex; align-items: end; padding: 13px; color: white; background-size: cover; background-position: center; }
.topic-art::after { content: ""; position: absolute; inset: 0 0 64px; background: linear-gradient(180deg, transparent 30%, rgba(0,0,0,.65)); pointer-events: none; }
.topic-art-icon { position: relative; z-index: 1; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.4); border-radius: 10px; background: rgba(0,0,0,.25); font-size: 18px; backdrop-filter: blur(10px); }
.topic-copy { padding: 11px 13px 14px; }
.topic-copy h3 { margin: 0; font-size: 15px; line-height: 1.2; }
.topic-copy p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.35; }
.topic-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; color: var(--paper-muted); font-size: 11px; }
.selection-dot { position: absolute; top: 11px; right: 11px; z-index: 2; width: 11px; height: 11px; border: 2px solid rgba(255,255,255,.8); border-radius: 50%; }
.topic-card.selected .selection-dot { border-color: var(--accent); background: var(--accent); }

.discover-grid { display: grid; grid-auto-flow: column; grid-auto-columns: 164px; gap: 12px; overflow-x: auto; padding-bottom: 5px; }
.discover-card { min-width: 0; border: 1px solid var(--border); border-radius: 14px; overflow: hidden; background: var(--surface); }
.discover-card .topic-art { min-height: 150px; position: relative; }
.discover-card .topic-art::after { inset: 0; }
.discover-plus { position: absolute; right: 10px; bottom: 10px; z-index: 2; display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; color: var(--ink); background: var(--accent); font-size: 19px; font-weight: 500; }
.discover-card .topic-copy { min-height: 74px; }

.search-row { display: flex; gap: 10px; margin: 14px 0 16px; }
.input, .search-input { width: 100%; min-height: 46px; border: 1px solid var(--border); border-radius: 11px; padding: 0 14px; color: var(--text); outline: none; background: var(--surface-low); }
.input:focus, .search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.search-row .input { min-width: 0; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 17px; border: 1px solid transparent; border-radius: 11px; color: var(--ink); background: var(--accent); font-size: 13px; font-weight: 800; transition: transform .16s ease, background .16s ease; }
.button:hover { transform: translateY(-1px); background: var(--accent-pressed); }
.button.secondary { color: var(--text); border-color: var(--border); background: var(--surface-low); }
.button.ghost { color: var(--muted); border-color: transparent; background: transparent; }
.button.danger { color: var(--error); border-color: color-mix(in srgb, var(--error) 35%, var(--border)); background: transparent; }
.button.small { min-height: 38px; padding: 0 12px; font-size: 12px; }
.button.full { width: 100%; }
.button.compact { min-height: 44px; border-radius: 999px; }
.button:focus-visible, .nav-button:focus-visible, .topic-card:focus-visible, .library-select:focus-visible, .library-accessory:focus-visible, .google-button:focus-visible, .inline-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.form-error { margin: 0 0 14px; color: var(--error); font-size: 13px; line-height: 1.45; }
.google-button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; border: 1px solid var(--border); border-radius: 999px; color: var(--text); background: var(--surface-lowest); font-size: 14px; font-weight: 700; }
.google-button.full { width: 100%; }
.google-button:hover { border-color: var(--strong-border); }
.google-mark { font-family: Arial, sans-serif; font-size: 20px; font-weight: 800; color: #4285f4; }
.inline-link { padding: 0; border: 0; color: var(--accent); background: transparent; font-size: inherit; text-decoration: underline; text-underline-offset: 2px; }
.auth-page { align-items: start; }
.auth-brand { margin-top: 24px; }
.auth-brand h1, .auth-brand > p { display: none; }
.auth-brand img { width: 96px; height: 96px; border-radius: 0; box-shadow: none; }
.auth-card { border: 0; background: transparent; box-shadow: none; padding: 0; }
.auth-card h2, .auth-card .intro { text-align: center; }
.auth-card h2 { font-size: 34px; }
.auth-card .intro { margin-bottom: 24px; }
.auth-card .form-stack .button { margin-top: 16px; border-radius: 999px; background: var(--surface-lowest); color: var(--text); border-color: var(--border); font-size: 14px; }
.loading-panel { display: grid; justify-items: center; gap: 12px; margin-top: 20vh; color: var(--muted); }
.loading-panel img { width: 72px; height: 72px; }
.auth-divider { margin: 13px 0; }
.auth-divider::before, .auth-divider::after { opacity: .45; }
.home-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; margin-bottom: 20px; }
.home-header .brand-subtitle { margin-left: 42px; }
.home-header .session-count { display: inline-flex; }
.learning-strip { border: 0; background: var(--surface-low); box-shadow: none; border-radius: 18px; padding: 16px; gap: 16px; }
.learning-strip h2 { font-family: var(--font-sans); font-size: 16px; font-weight: 600; }
.learning-strip .eyebrow { color: var(--text); font-family: var(--font-serif); font-size: 20px; letter-spacing: 0; text-transform: none; }
.learning-strip .sub { display: none; }
.topic-grid { grid-auto-flow: column; grid-auto-columns: min(360px, calc(100% - 28px)); grid-template-columns: none; gap: 16px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 8px; scrollbar-width: none; }
.topic-grid::-webkit-scrollbar, .discover-grid::-webkit-scrollbar { display: none; }
.topic-card { height: 286px; min-height: 286px; display: flex; align-items: end; scroll-snap-align: start; border-radius: 22px; background: var(--surface-low); }
.topic-card:hover { transform: none; }
.topic-card .topic-art { position: absolute; inset: 0; min-height: 0; padding: 0; }
.topic-card .topic-art::after { inset: 0; background: linear-gradient(180deg, transparent 30%, rgba(0,0,0,.83)); }
.topic-card .topic-art-icon { display: none; }
.topic-card .topic-copy { position: relative; z-index: 1; width: 100%; padding: 16px; color: #fff; }
.topic-card .topic-copy h3 { margin: 8px 0 4px; font-family: var(--font-serif); font-size: 24px; line-height: 1.15; }
.topic-card .topic-copy p { display: block; margin: 0; color: rgba(255,255,255,.78); font-size: 12px; }
.topic-card-meta, .topic-selected { display: flex; gap: 6px; color: rgba(255,255,255,.78); font-size: 12px; }
.topic-selected { margin-top: 14px; color: #fff; }
.topic-card .topic-meta { display: none; }
.view-all-topic-card { display: flex; flex-direction: column; align-items: start; justify-content: end; gap: 12px; height: 286px; padding: 16px; border: 1px solid var(--border); border-radius: 22px; color: var(--text); background: var(--surface-low); text-align: left; scroll-snap-align: start; }
.view-all-topic-card strong { font-family: var(--font-serif); font-size: 24px; }
.view-all-topic-card span:not(.view-all-icon) { color: var(--muted); font-size: 13px; line-height: 1.4; }
.view-all-topic-card em { width: 100%; padding: 11px; border-radius: 99px; color: var(--ink); background: var(--accent); font-size: 13px; font-style: normal; font-weight: 700; text-align: center; }
.view-all-icon { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: auto; border-radius: 50%; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); font-size: 24px; }
.discover-card .topic-card { display: block; width: 100%; height: auto; min-height: 0; }
.discover-card .topic-card .topic-art { position: relative; height: 164px; }
.discover-card .topic-card .topic-art-icon { display: none; }
.discover-card .topic-card .topic-copy { color: var(--text); padding: 10px 0 0; }
.discover-card .topic-card .topic-copy h3 { margin: 0; font-family: var(--font-sans); font-size: 14px; }
.discover-card .topic-card .topic-meta { display: block; margin-top: 3px; color: var(--muted); }
.discover-card { border: 0; background: transparent; }
.library-content { max-width: 620px; margin: 0 auto; }
.library-intro { margin-top: 0; color: var(--muted); font-size: 14px; }
.list-title { margin: 24px 0 8px; font-size: 15px; font-weight: 700; }
.library-list { gap: 0; padding: 4px 0; border-radius: 18px; background: var(--surface-low); }
.library-row { display: flex; grid-template-columns: none; gap: 8px; padding: 8px 12px; }
.library-row + .library-row { border-top: 1px solid var(--border); }
.library-select { display: flex; align-items: center; flex: 1; min-width: 0; gap: 12px; border: 0; color: var(--text); background: transparent; text-align: left; }
.library-select .topic-art { flex: 0 0 64px; width: 64px; height: 64px; min-height: 64px; border-radius: 12px; }
.library-copy { display: grid; min-width: 0; gap: 4px; }
.library-copy strong { font-size: 15px; }
.library-copy small { color: var(--muted); font-size: 12px; line-height: 1.3; }
.library-accessory { flex: 0 0 44px; width: 44px; height: 44px; border: 0; border-radius: 50%; color: var(--ink); background: var(--accent); font-size: 24px; }
.library-accessory:disabled { opacity: .4; }
.selected-indicator { color: var(--accent); }
.profile-grid { display: block; width: min(560px, 100%); margin: 0 auto; }
.profile-header { padding: 8px 0; }
.profile-avatar { width: 48px; height: 48px; border-radius: 50%; color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); font-size: 18px; }
.profile-header h2 { font-family: var(--font-sans); font-size: 16px; }
.stats-grid { margin-top: 12px; padding: 12px 16px; border-radius: 18px; background: var(--surface-low); }
.stat { padding: 0; background: transparent; }
.stat strong { font-family: var(--font-sans); font-size: 22px; }
.settings-stack { margin-top: 16px; }
.settings-card { border: 0; background: var(--surface-low); box-shadow: none; }
.settings-row .button { min-height: 44px; padding: 0; }
.question-backdrop, .modal-backdrop { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.question-sheet, .modal { max-height: min(760px, calc(100dvh - 32px)); overscroll-behavior: contain; }
.question-sheet { padding-bottom: calc(22px + env(safe-area-inset-bottom)); }
.toast { bottom: calc(20px + env(safe-area-inset-bottom)); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }

.empty-state { padding: 24px; border: 1px dashed var(--border); border-radius: var(--radius); color: var(--muted); text-align: center; }
.library-list { display: grid; gap: 10px; }
.library-row { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 14px; padding: 10px; }
.library-row .topic-art { min-height: 70px; border-radius: 10px; }
.library-row h3 { margin: 0; font-family: var(--font-serif); font-size: 18px; }
.library-row p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.stat-chip { padding: 5px 8px; border-radius: 999px; color: var(--paper-muted); background: var(--surface-low); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }

.profile-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr); gap: 16px; }
.profile-card { padding: 22px; }
.profile-header { display: flex; align-items: center; gap: 15px; }
.profile-avatar { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 18px; color: var(--ink); background: var(--accent); font-size: 21px; font-weight: 800; }
.profile-header h2 { margin: 0; font-family: var(--font-serif); font-size: 27px; }
.profile-header p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 22px; }
.stat { padding: 13px; border-radius: 11px; background: var(--surface-low); }
.stat strong { display: block; font-family: var(--font-serif); font-size: 24px; }
.stat span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; }
.settings-stack { display: grid; gap: 12px; }
.settings-card { padding: 18px; }
.settings-card h3 { margin: 0 0 12px; font-family: var(--font-serif); font-size: 18px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 45px; border-top: 1px solid var(--border); color: var(--text); font-size: 13px; }
.settings-row:first-of-type { border-top: 0; }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 9px; background: var(--surface-low); }
.segmented button { min-height: 34px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; }
.segmented button.active { color: var(--text); background: var(--surface-highest); }

.auth-page, .onboarding-page { min-height: 100vh; display: grid; place-items: center; padding: 28px 18px; }
.auth-panel { width: min(420px, 100%); }
.auth-brand { display: grid; justify-items: center; gap: 10px; margin-bottom: 34px; }
.auth-brand img { width: 88px; height: 88px; border-radius: 26px; box-shadow: var(--shadow); }
.auth-brand h1 { margin: 0; font-family: var(--font-serif); font-size: 42px; letter-spacing: -.05em; }
.auth-brand p { margin: 0; color: var(--muted); font-size: 14px; }
.auth-card { padding: 24px; }
.auth-card h2 { margin: 0; font-family: var(--font-serif); font-size: 26px; }
.auth-card .intro { margin: 7px 0 21px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.form-stack { display: grid; gap: 11px; }
.label { display: grid; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 700; }
.auth-divider { display: flex; align-items: center; gap: 10px; margin: 18px 0 14px; color: var(--muted-2); font-size: 11px; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--border); }
.auth-switch { margin: 17px 0 0; color: var(--muted); text-align: center; font-size: 13px; }
.auth-switch button { border: 0; color: var(--text); background: transparent; font-weight: 800; }
.legal-note { margin: 18px 0 0; color: var(--muted-2); font-size: 11px; line-height: 1.5; text-align: center; }
.onboarding-panel { width: min(720px, 100%); }
.onboarding-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.onboarding-head h1 { margin: 0; font-family: var(--font-serif); font-size: clamp(30px, 5vw, 44px); letter-spacing: -.04em; }
.onboarding-head p { max-width: 510px; margin: 9px 0 0; color: var(--muted); font-size: 14px; line-height: 1.45; }
.count-pill { flex: 0 0 auto; padding: 8px 11px; border-radius: 999px; color: var(--paper-muted); background: var(--surface); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.count-pill.ready { color: var(--ink); background: var(--accent); }
.onboarding-topics { display: flex; flex-wrap: wrap; gap: 9px; }
.topic-chip { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 13px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: var(--surface); font-size: 13px; transition: .18s ease; }
.topic-chip:hover { border-color: var(--strong-border); color: var(--text); }
.topic-chip.selected { border-color: var(--accent); color: var(--ink); background: var(--accent); }
.goal-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.goal-option { padding: 15px 12px; border: 1px solid var(--border); border-radius: 11px; color: var(--muted); background: var(--surface); text-align: left; }
.goal-option strong { display: block; color: var(--text); font-family: var(--font-serif); font-size: 21px; }
.goal-option span { display: block; margin-top: 4px; font-size: 11px; }
.goal-option.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, var(--surface)); }
.onboarding-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 20px; }

.session-page { min-height: 100vh; padding: 18px; background: #080a0b; }
.session-shell { width: min(1200px, 100%); min-height: calc(100vh - 36px); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 18px; }
.session-main { display: flex; flex-direction: column; min-width: 0; }
.session-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.session-top .brand { color: var(--text); }
.session-back { color: var(--muted); border: 0; background: transparent; }
.session-progress { display: flex; gap: 5px; flex: 1; max-width: 460px; }
.session-progress span { height: 4px; flex: 1; border-radius: 99px; background: rgba(255,255,255,.17); }
.session-progress span.active { background: var(--accent); }
.video-stage { position: relative; min-height: min(70vh, 720px); overflow: hidden; border: 1px solid #2c302d; border-radius: 20px; background: #111516; box-shadow: var(--shadow); }
.video-stage iframe { width: 100%; height: 100%; min-height: 520px; border: 0; display: block; }
.video-fallback { min-height: 520px; display: grid; place-items: center; padding: 28px; text-align: center; background: radial-gradient(circle at 50% 28%, rgba(223, 174, 86, .22), transparent 28%), linear-gradient(155deg, #1f2627, #0b0e10); }
.video-fallback h2 { margin: 10px 0 8px; font-family: var(--font-serif); font-size: 32px; }
.video-fallback p { max-width: 480px; margin: 0 auto 18px; color: #b9b6aa; line-height: 1.55; }
.video-orb { display: grid; place-items: center; width: 68px; height: 68px; border: 1px solid rgba(255,255,255,.2); border-radius: 20px; color: var(--paper); background: rgba(223,174,86,.15); font-size: 28px; }
.video-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 20px; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.67), transparent 27%, transparent 67%, rgba(0,0,0,.83)); }
.video-label { align-self: flex-start; padding: 7px 9px; border-radius: 999px; color: var(--paper); background: rgba(7,9,10,.58); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.video-info { max-width: 680px; }
.video-info h1 { margin: 8px 0 7px; color: #fff; font-family: var(--font-serif); font-size: clamp(25px, 4vw, 42px); line-height: 1.04; letter-spacing: -.04em; }
.video-info p { margin: 0; color: rgba(255,255,255,.7); font-size: 13px; line-height: 1.45; }
.session-rail { padding: 20px; border: 1px solid #2c302d; border-radius: 20px; background: #111516; }
.session-rail h2 { margin: 0; color: #fff; font-family: var(--font-serif); font-size: 22px; }
.session-rail .rail-copy { margin: 8px 0 18px; color: #a6a79f; font-size: 13px; line-height: 1.45; }
.session-note { margin-top: 16px; padding: 15px; border-radius: 13px; color: var(--ink); background: linear-gradient(135deg, var(--paper), #cfc3a6); }
.session-note h3 { margin: 0 0 7px; font-family: var(--font-serif); font-size: 19px; }
.session-note p { margin: 0; font-size: 12px; line-height: 1.5; }
.rail-actions { display: grid; gap: 8px; margin-top: 18px; }
.session-footer { display: flex; justify-content: space-between; gap: 10px; margin-top: 13px; }
.session-footer .button { min-width: 120px; }

.preparing-card { width: min(620px, 100%); margin: 13vh auto 0; padding: 30px; }
.preparing-icon { display: grid; place-items: center; width: 72px; height: 72px; margin-bottom: 21px; border-radius: 18px; color: var(--ink); background: linear-gradient(135deg, var(--paper), #cfc3a6); font-size: 28px; }
.preparing-card h1 { margin: 0; font-family: var(--font-serif); font-size: clamp(31px, 5vw, 48px); letter-spacing: -.05em; }
.preparing-card p { margin: 8px 0 24px; color: var(--muted); font-size: 14px; }
.prep-steps { display: grid; gap: 0; border-top: 1px solid var(--border); }
.prep-step { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.prep-step.active { color: var(--text); }
.prep-step.done { color: var(--success); }
.prep-dot { width: 9px; height: 9px; border: 1px solid currentColor; border-radius: 50%; }
.prep-step.active .prep-dot { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 17%, transparent); }
.prep-step.done .prep-dot { border-color: var(--success); background: var(--success); }

.question-backdrop { position: fixed; inset: 0; z-index: 10; display: grid; place-items: end center; padding: 20px; background: rgba(0,0,0,.68); }
.question-sheet { width: min(650px, 100%); max-height: min(760px, 92vh); overflow: auto; padding: 22px; border: 1px solid var(--border); border-radius: 20px 20px 12px 12px; color: var(--text); background: var(--surface-low); box-shadow: var(--shadow); }
.sheet-handle { width: 42px; height: 4px; margin: 0 auto 20px; border-radius: 99px; background: var(--muted-2); }
.question-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--paper-muted); font-size: 11px; font-weight: 800; letter-spacing: .09em; }
.question-sheet h2 { margin: 19px 0; font-family: var(--font-serif); font-size: clamp(23px, 4vw, 31px); line-height: 1.15; }
.choices { display: grid; gap: 9px; }
.choice { display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 10px; width: 100%; min-height: 54px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 11px; color: var(--text); background: var(--surface); text-align: left; }
.choice:hover:not(:disabled) { border-color: var(--strong-border); background: var(--elevated); }
.choice-letter { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--paper-muted); background: var(--surface-highest); font-size: 12px; font-weight: 800; }
.choice.correct { border-color: var(--success); background: color-mix(in srgb, var(--success) 12%, var(--surface)); }
.choice.correct .choice-letter { color: var(--ink); background: var(--success); }
.choice.incorrect { border-color: var(--error); background: color-mix(in srgb, var(--error) 12%, var(--surface)); }
.choice.incorrect .choice-letter { color: var(--ink); background: var(--error); }
.evidence { margin-top: 16px; padding: 15px; border-radius: 12px; background: var(--surface); }
.evidence strong { display: block; margin-bottom: 5px; font-size: 12px; }
.evidence p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.48; }
.question-actions { display: grid; gap: 9px; margin-top: 18px; }

.results-page { min-height: 100vh; padding: 28px 18px 56px; }
.results-shell { width: min(760px, 100%); margin: 0 auto; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 24px; }
.results-head h1 { margin: 0; font-family: var(--font-serif); font-size: 30px; }
.mastery-card { padding: 24px; border: 0; border-radius: 18px; color: var(--ink); background: linear-gradient(135deg, var(--paper), #cfc3a6); }
.mastery-top { display: flex; align-items: center; gap: 18px; }
.mastery-ring { display: grid; place-items: center; width: 108px; height: 108px; border-radius: 50%; background: conic-gradient(var(--accent) var(--score), rgba(20,22,22,.13) 0); }
.mastery-ring::after { content: ""; position: absolute; width: 80px; height: 80px; border-radius: 50%; background: var(--paper); }
.mastery-ring span { position: relative; z-index: 1; font-family: var(--font-serif); font-size: 30px; font-weight: 700; }
.mastery-card h2 { margin: 0; font-family: var(--font-serif); font-size: 27px; }
.mastery-card p { margin: 6px 0 0; opacity: .68; font-size: 13px; line-height: 1.45; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; margin-top: 22px; border-top: 1px solid rgba(20,22,22,.16); padding-top: 18px; }
.metric { text-align: center; }
.metric + .metric { border-left: 1px solid rgba(20,22,22,.16); }
.metric strong { display: block; font-family: var(--font-serif); font-size: 22px; }
.metric span { display: block; margin-top: 3px; opacity: .58; font-size: 11px; }
.results-section { margin-top: 25px; }
.results-section h2 { margin: 0 0 10px; font-family: var(--font-serif); font-size: 22px; }
.results-section p { color: var(--muted); line-height: 1.55; }
.insight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.insight { padding: 15px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.insight h3 { margin: 0 0 6px; font-size: 12px; }
.insight p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.answer-list { display: grid; gap: 8px; }
.answer-row { display: grid; grid-template-columns: 30px 1fr auto; align-items: center; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); }
.answer-number { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--ink); background: var(--paper-muted); font-size: 12px; font-weight: 800; }
.answer-row strong { display: block; font-size: 13px; }
.answer-row span { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.answer-status { font-size: 12px; font-weight: 800; }
.answer-status.correct { color: var(--success); }
.answer-status.incorrect { color: var(--error); }
.results-actions { display: grid; gap: 9px; margin-top: 24px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; background: rgba(0,0,0,.66); }
.modal { width: min(620px, 100%); max-height: 84vh; overflow: auto; padding: 24px; border: 1px solid var(--border); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; gap: 15px; align-items: start; }
.modal h2 { margin: 0; font-family: var(--font-serif); font-size: 26px; }
.modal p { color: var(--muted); line-height: 1.6; font-size: 13px; }
.close-button { width: 36px; height: 36px; border: 1px solid var(--border); border-radius: 50%; color: var(--muted); background: transparent; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 30; max-width: 340px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 11px; color: var(--text); background: var(--elevated); box-shadow: var(--shadow); font-size: 13px; opacity: 0; transform: translateY(12px); pointer-events: none; transition: .22s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .rail { position: fixed; z-index: 5; bottom: 0; top: auto; width: 100%; height: auto; display: block; padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); border-right: 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(20px); }
  .rail .brand, .rail .nav-label, .rail-footer { display: none; }
  .nav-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .nav-button { display: grid; justify-items: center; gap: 3px; padding: 8px 4px; border-radius: 10px; text-align: center; font-size: 10px; }
  .nav-button.active { box-shadow: inset 0 2px 0 var(--accent); }
  .nav-icon { width: auto; font-size: 16px; }
  .main { padding-bottom: 100px; }
  .session-shell { grid-template-columns: 1fr; }
  .session-rail { display: none; }
  .video-stage, .video-fallback { min-height: calc(100vh - 130px); }
  .video-stage iframe { min-height: calc(100vh - 130px); }
}

@media (max-width: 640px) {
  .main { padding: 20px 14px 100px; }
  .topbar { align-items: start; margin-bottom: 22px; }
  .session-count { display: none; }
  .topic-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .topic-card { min-height: 164px; }
  .topic-art { min-height: 100px; }
  .topic-copy { padding: 10px; }
  .topic-copy p { display: none; }
  .learning-strip { grid-template-columns: 1fr; gap: 15px; }
  .learning-strip .button { width: 100%; }
  .profile-grid { grid-template-columns: 1fr; }
  .library-row { grid-template-columns: 58px 1fr auto; gap: 10px; }
  .library-row .topic-art { min-height: 58px; }
  .library-row h3 { font-size: 16px; }
  .library-row p { display: none; }
  .onboarding-head { align-items: start; flex-direction: column; }
  .goal-options { grid-template-columns: 1fr 1fr 1fr; }
  .onboarding-actions { flex-direction: column-reverse; align-items: stretch; }
  .session-page { padding: 10px; }
  .session-shell { min-height: calc(100vh - 20px); }
  .session-top { gap: 8px; }
  .session-top .brand-name, .session-top .brand-subtitle { display: none; }
  .session-progress { max-width: none; }
  .video-stage, .video-fallback { min-height: calc(100vh - 90px); border-radius: 15px; }
  .video-stage iframe { min-height: calc(100vh - 90px); }
  .video-overlay { padding: 15px; }
  .video-info h1 { font-size: 29px; }
  .video-info p { font-size: 12px; }
  .mastery-top { align-items: start; }
  .mastery-card h2 { font-size: 24px; }
  .mastery-ring { width: 88px; height: 88px; }
  .mastery-ring::after { width: 66px; height: 66px; }
  .mastery-ring span { font-size: 24px; }
  .insight-grid { grid-template-columns: 1fr; }
}

/* SwiftUI's compact screens keep one featured card in view and reserve space for both bottom bars. */
@media (max-width: 900px) {
  .rail { left: 50%; width: min(340px, calc(100% - 32px)); bottom: calc(4px + env(safe-area-inset-bottom)); transform: translateX(-50%); padding: 4px; border: 1px solid var(--border); border-radius: 18px; background: color-mix(in srgb, var(--surface) 75%, transparent); }
  .nav-button { min-height: 48px; border: 0; box-shadow: none !important; }
  .nav-button.active { color: var(--accent); background: var(--surface-highest); }
  .main { padding-bottom: calc(162px + env(safe-area-inset-bottom)); }
  .main:has(.home-content) { padding-bottom: calc(190px + env(safe-area-inset-bottom)); }
  .home-action-bar { position: fixed; z-index: 4; left: 50%; bottom: calc(88px + env(safe-area-inset-bottom)); width: min(560px, calc(100% - 32px)); transform: translateX(-50%); display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; border: 1px solid var(--border); border-radius: 18px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(18px); }
  .home-action-bar strong, .home-action-bar small { display: block; }
  .home-action-bar strong { font-size: 13px; }
  .home-action-bar small { margin-top: 3px; color: var(--muted); font-size: 11px; }
  .home-action-bar .button { flex: 0 0 auto; }
}
@media (min-width: 901px) {
  .home-action-bar { display: none; }
  .main-inner { max-width: 1120px; }
  .topic-grid { grid-auto-columns: min(360px, calc(50% - 16px)); }
  .discover-grid { grid-auto-columns: max(220px, calc((100% - 32px) / 3)); gap: 16px; }
}
@media (max-width: 640px) {
  .main { padding: 12px 20px calc(105px + env(safe-area-inset-bottom)); }
  .home-header { margin-bottom: 16px; }
  .home-header .brand-name { font-size: 20px; }
  .home-header .session-count { display: inline-flex; }
  .topic-grid { grid-auto-columns: min(360px, calc(100% - 28px)); grid-template-columns: none; gap: 16px; }
  .topic-card { min-height: 286px; }
  .topic-art { min-height: 0; }
  .topic-copy p { display: block; }
  .learning-strip { grid-template-columns: 1fr auto; gap: 12px; }
  .learning-strip .button { width: auto; }
  .section { margin-top: 24px; }
  .section-heading h2 { font-size: 22px; }
  .search-row .button { min-width: 48px; padding: 0 10px; }
  .onboarding-page { display: block; min-height: 100dvh; padding: calc(20px + env(safe-area-inset-top)) 24px calc(120px + env(safe-area-inset-bottom)); }
  .onboarding-head { flex-direction: row; align-items: end; }
  .onboarding-head h1 { font-size: 28px; }
  .onboarding-head p { font-size: 13px; }
  .goal-options { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .goal-option { min-width: 0; padding: 12px 8px; }
  .goal-option strong { font-size: 17px; }
  .onboarding-actions { position: fixed; z-index: 6; left: 0; right: 0; bottom: 0; display: block; margin: 0; padding: 10px 24px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(18px); }
  .onboarding-actions .button { width: 100%; }
  .onboarding-actions .ghost { display: none; }
  .auth-page { display: block; min-height: 100dvh; padding: calc(20px + env(safe-area-inset-top)) 24px calc(30px + env(safe-area-inset-bottom)); }
  .auth-panel { margin: 0 auto; }
  .auth-brand { margin-top: 4px; margin-bottom: 20px; }
  .auth-card h2 { font-size: 32px; }
  .question-backdrop, .modal-backdrop { padding: 0; }
  .question-sheet { max-height: calc(100dvh - env(safe-area-inset-top)); border-radius: 22px 22px 0 0; }
  .modal { width: 100%; max-height: calc(100dvh - env(safe-area-inset-top)); border-radius: 22px 22px 0 0; }
  .modal-backdrop { place-items: end center; }
  .session-page { min-height: 100dvh; padding: 8px; }
  .session-shell { min-height: calc(100dvh - 16px); }
  .video-stage, .video-fallback, .video-stage iframe { min-height: calc(100dvh - 146px); }
}
@media (max-width: 360px) {
  .main { padding-inline: 14px; }
  .onboarding-page, .auth-page { padding-inline: 16px; }
  .count-pill { font-size: 10px; padding: 6px; }
  .search-row .button { font-size: 11px; }
  .home-action-bar { width: calc(100% - 20px); padding-inline: 10px; }
  .home-action-bar .button { padding-inline: 10px; }
}

/* Keep list and settings overrides after the original component rules. */
body .library-content { max-width: 620px; margin-inline: auto; }
body .library-list { display: grid; gap: 0; padding: 4px 0; border-radius: 18px; background: var(--surface-low); }
body .library-row { display: flex; grid-template-columns: none; align-items: center; gap: 8px; padding: 8px 12px; }
body .library-row + .library-row { border-top: 1px solid var(--border); }
body .library-row .topic-art { flex: 0 0 64px; width: 64px; height: 64px; min-height: 64px; border-radius: 12px; }
body .library-row .topic-art::after { inset: 0; }
body .library-row .topic-art-icon { width: 28px; height: 28px; font-size: 15px; }
body .topic-art { position: relative; }
body .profile-grid { display: block; grid-template-columns: none; width: min(560px, 100%); margin-inline: auto; }
body .profile-avatar { width: 48px; height: 48px; border-radius: 50%; color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); font-size: 18px; }
body .profile-header h2 { font-family: var(--font-sans); font-size: 16px; }
body .stats-grid { margin-top: 12px; padding: 12px 16px; border-radius: 18px; background: var(--surface-low); }
body .stat { padding: 0; background: transparent; }
body .stat strong { font-family: var(--font-sans); font-size: 22px; }

/* Newcomer landing page: the same charcoal, paper, amber, and editorial type as the study app. */
.landing-page {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}
.landing-nav {
  width: min(1180px, calc(100% - 64px));
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--border);
}
.landing-nav .brand-name { font-size: 22px; }
.landing-nav .brand img, .landing-footer .brand img { width: 30px; height: 30px; border-radius: 10px; }
.landing-nav-actions { display: flex; align-items: center; gap: 14px; }
.landing-nav-note { color: var(--muted); font-size: 12px; }
.landing-nav .button.ghost { min-height: 36px; padding-inline: 0; color: var(--text); }
.landing-wrap { width: min(1180px, calc(100% - 64px)); margin: 0 auto; }
.landing-hero {
  min-height: 650px;
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(380px, .98fr);
  align-items: center;
  gap: clamp(44px, 8vw, 110px);
  padding: 92px 0 106px;
}
.landing-copy { max-width: 590px; }
.landing-copy h1 {
  max-width: 560px;
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(58px, 8vw, 102px);
  font-weight: 700;
  letter-spacing: -.075em;
  line-height: .92;
}
.landing-lede {
  max-width: 500px;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 1.55vw, 19px);
  line-height: 1.55;
}
.landing-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 20px; margin-top: 34px; }
.landing-primary { min-height: 52px; padding-inline: 22px; border-radius: 10px; }
.landing-text-link { color: var(--text); font-size: 13px; font-weight: 700; text-underline-offset: 4px; }
.landing-text-link span { margin-left: 4px; color: var(--accent); }
.landing-note { display: flex; align-items: center; gap: 9px; margin: 30px 0 0; color: var(--paper-muted); font-size: 12px; }
.landing-note-mark { display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 15%, transparent); }
.landing-demo { position: relative; padding: 25px; border: 1px solid var(--strong-border); border-radius: 19px; background: var(--surface-low); }
.landing-demo::before { content: ""; position: absolute; inset: 10px -10px -10px 10px; z-index: -1; border: 1px solid var(--border); border-radius: 19px; background: var(--surface-lowest); }
.landing-demo-head { display: flex; align-items: start; justify-content: space-between; gap: 14px; }
.landing-demo-head strong { display: block; margin-top: 7px; font-family: var(--font-serif); font-size: 25px; letter-spacing: -.035em; }
.landing-demo-label { color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.landing-time { padding: 7px 9px; border: 1px solid var(--border); border-radius: 999px; color: var(--paper-muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.landing-demo-rule { height: 1px; margin: 23px 0 5px; background: var(--border); }
.landing-session-row { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 11px; padding: 17px 0; border-bottom: 1px solid var(--border); }
.landing-session-row-active { color: var(--text); }
.landing-step { align-self: start; padding-top: 2px; color: var(--muted-2); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.landing-session-row-active .landing-step { color: var(--accent); }
.landing-session-row strong { display: block; font-size: 14px; }
.landing-session-row div span { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.landing-row-state { align-self: start; padding-top: 2px; color: var(--muted-2); font-size: 11px; }
.landing-session-row-active .landing-row-state { color: var(--accent); }
.landing-demo-foot { display: flex; align-items: center; gap: 8px; padding-top: 20px; color: var(--muted); font-size: 11px; }
.landing-live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.landing-foot-arrow { margin-left: auto; color: var(--accent); font-size: 16px; }
.landing-loop { display: grid; grid-template-columns: minmax(250px, .8fr) minmax(0, 1.2fr); gap: clamp(45px, 10vw, 150px); padding: 112px 0; border-top: 1px solid var(--border); }
.landing-section-intro h2, .landing-topics h2, .landing-cta h2 { margin: 0; font-family: var(--font-serif); font-size: clamp(34px, 4.2vw, 54px); letter-spacing: -.055em; line-height: .98; }
.landing-section-intro p { max-width: 330px; margin: 18px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.landing-steps { border-top: 1px solid var(--border); }
.landing-step-item { display: grid; grid-template-columns: 53px minmax(0,1fr); gap: 17px; padding: 23px 0; border-bottom: 1px solid var(--border); }
.landing-step-number { color: var(--accent); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.landing-step-item h3 { margin: 0; font-family: var(--font-serif); font-size: 23px; letter-spacing: -.025em; }
.landing-step-item p { max-width: 520px; margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.landing-topics { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: 30px; align-items: center; padding: 112px 0; border-top: 1px solid var(--border); }
.landing-topic-cloud { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.landing-topic-pill { padding: 11px 14px; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: var(--surface-low); font-size: 13px; }
.landing-topic-pill.is-featured { border-color: var(--accent); color: var(--ink); background: var(--accent); }
.landing-cta { display: flex; align-items: end; justify-content: space-between; gap: 30px; padding: 62px 0 68px; border-top: 1px solid var(--border); }
.landing-cta .button { flex: 0 0 auto; }
.landing-footer { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 0 34px; border-top: 1px solid var(--border); color: var(--muted-2); font-size: 11px; }
.landing-footer .brand-name { color: var(--text); font-size: 19px; }
.landing-footer .brand { gap: 8px; }
@media (max-width: 820px) {
  .landing-nav, .landing-wrap { width: min(100% - 40px, 600px); }
  .landing-hero { min-height: auto; grid-template-columns: 1fr; gap: 64px; padding: 70px 0 92px; }
  .landing-copy h1 { max-width: 500px; font-size: clamp(58px, 16vw, 90px); }
  .landing-demo { width: min(100%, 500px); }
  .landing-loop, .landing-topics { grid-template-columns: 1fr; gap: 44px; padding: 82px 0; }
  .landing-topic-cloud { justify-content: flex-start; }
  .landing-cta { align-items: start; flex-direction: column; padding: 54px 0 60px; }
}
@media (max-width: 520px) {
  .landing-nav, .landing-wrap { width: calc(100% - 32px); }
  .landing-nav { min-height: 68px; }
  .landing-nav-note { display: none; }
  .landing-hero { gap: 48px; padding: 58px 0 72px; }
  .landing-copy h1 { font-size: clamp(54px, 17vw, 78px); }
  .landing-lede { margin-top: 21px; font-size: 16px; }
  .landing-actions { align-items: stretch; flex-direction: column; gap: 16px; margin-top: 28px; }
  .landing-actions .button { width: 100%; }
  .landing-text-link { text-align: center; }
  .landing-demo { padding: 19px; }
  .landing-demo-head strong { font-size: 21px; }
  .landing-session-row { grid-template-columns: 28px minmax(0,1fr); gap: 8px; }
  .landing-row-state { display: none; }
  .landing-section-intro h2, .landing-topics h2, .landing-cta h2 { font-size: 39px; }
  .landing-step-item { grid-template-columns: 37px minmax(0,1fr); gap: 10px; }
  .landing-step-item h3 { font-size: 21px; }
  .landing-footer { align-items: start; flex-direction: column; gap: 11px; }
}
body .settings-stack { margin-top: 16px; }
body .settings-card { border: 0; background: var(--surface-low); box-shadow: none; }
body .settings-row .button { min-height: 44px; padding-inline: 0; }
