/* Reading-room design system. app.css retains the review mechanics and legacy
   component geometry; this file owns the current palette, shell and new views. */
:root, :root[data-theme="dark"] {
  --bg: #1C1B1D; --bg-2: #1C1B1D; --bg-deep: #181719;
  --panel: #262427; --panel2: #302D30; --panel-solid: #262427;
  --panel-sunk: #211F22; --panel-violet: #302D30;
  --ink: #E7E1DC; --ink2: #CDC4C0; --ink3: #B4AAA7;
  --ink-onbg: #E7E1DC; --ink-onbg2: #B4AAA7;
  --line: #51484C; --line2: #3B3539; --line-onbg: #51484C;
  --cy: #A45159; --cy2: #99444F; --cy-text: #E2A5AC;
  --cy-dim: #A451591A; --accent: var(--cy); --on-accent: #FFF5F0;
  --gold: #B5C6AE; --gold2: #CED8C6; --gold-dim: #B5C6AE14;
  --mint: #ACC4AE; --rose: #EEA6A6; --amber: #D6B88D;
  --east: #B0BFCD; --orient: #D6B69F; --shared: #B4AAA7;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --font-display: 'Newsreader', Georgia, serif;
  --font-serif: 'Newsreader', Georgia, serif;
  --font-mono: 'IBM Plex Mono', monospace;
  --radius: 16px; --radius-sm: 10px; --rail-w: 224px;
  --shadow-card: 0 6px 20px #0000000A; --shadow-lift: 0 12px 32px #00000014;
  --shadow-accent: none;
  --cover-video: #49363C; --cover-scripture: #514043; --cover-text: #3D383C;
  --cover-ink: #EDDDD7; --rail-bg: #19181A;
  color-scheme: dark;
}
:root[data-theme="day"] {
  --bg: #F0ECE7; --bg-2: #F0ECE7; --bg-deep: #E7E1DC;
  --panel: #F8F4EF; --panel2: #FCF8F4; --panel-solid: #F8F4EF;
  --panel-sunk: #EAE4DE; --panel-violet: #EAE1DE;
  --ink: #302A2C; --ink2: #51484B; --ink3: #706265;
  --ink-onbg: #302A2C; --ink-onbg2: #706265;
  --line: #B9ABAC; --line2: #D9CDCB; --line-onbg: #B9ABAC;
  --cy: #98444D; --cy2: #843741; --cy-text: #923D47; --on-accent: #FFF8F2;
  --cy-dim: #98444D10;
  --mint: #45654B; --rose: #A03340; --gold: #45654B; --gold2: #354F3B;
  --east: #455E75; --orient: #79533C; --shared: #706265; --rail-bg: #E8E2DD;
  color-scheme: light;
}
body { background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.6; }
body::before { content: ''; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 95% 0, #98596206, transparent 60%); z-index: -1; }
h1, h2, h3 { font-weight: 500; letter-spacing: -.025em; }
h1 { font-size: clamp(34px, 3vw, 46px); line-height: 1.08; }
h2 { font-size: 29px; } h3 { font-size: 22px; }
a { color: var(--cy-text); font-weight: 500; }
a:hover { color: var(--ink); }
svg { flex-shrink: 0; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button, a { touch-action: manipulation; }
.eyebrow, .section-kicker { font-family: var(--font-body); font-size: 10px; font-weight: 600; line-height: 1.5; letter-spacing: .15em; text-transform: uppercase; color: var(--ink3); }
.mono { font-size: 11px; font-family: var(--font-mono); font-weight: 400; letter-spacing: 0; text-transform: none; }
.screen { gap: 24px; }
.screen-head h1 .dot, .study-welcome .dot { color: var(--cy-text); }
.lede { max-width: 70ch; color: var(--ink2); font-size: 15px; line-height: 1.8; }
.panel, .big-card, .hero-card { border: 1px solid var(--line2); background: var(--panel); box-shadow: var(--shadow-card); padding: 25px; border-radius: var(--radius); }
.panel-title { margin-bottom: 18px; padding-bottom: 0; border: 0; }
.panel .eyebrow { color: var(--ink3); }
.section-head { margin: 0; }
.section-head h2 { color: var(--ink); }
.big-card[class*="tint-"] { background: var(--panel); }
.btn, .icon-btn, .cmd-btn { border: 1px solid var(--line); background: transparent; color: var(--ink); box-shadow: none; font-size: 13px; font-weight: 500; border-radius: 9px; }
.btn { min-height: 42px; padding: 10px 17px; gap: 9px; }
.btn svg { width: 17px; height: 17px; }
.btn-lg { min-height: 48px; padding: 12px 22px; }
.btn-sm { min-height: 36px; padding: 7px 12px; font-size: 12px; }
.btn-primary, .btn-gold { background: var(--cy); border-color: var(--cy); color: var(--on-accent); }
.btn-primary:hover, .btn-gold:hover { background: var(--cy2); border-color: var(--cy2); color: var(--on-accent); }
.btn:hover, .icon-btn:hover { transform: translateY(-1px); box-shadow: none; border-color: var(--cy-text); }
.btn-ghost { border-color: transparent; color: var(--ink2); }
.btn-danger { color: var(--rose); border-color: color-mix(in srgb, var(--rose) 40%, transparent); }
.btn-block { display: flex; width: 100%; justify-content: space-between; }
.input, .textarea, .select { background: var(--panel-sunk); border: 1px solid var(--line2); border-radius: 9px; color: var(--ink); font-size: 14px; padding: 12px 14px; min-height: 44px; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--cy-text); box-shadow: 0 0 0 3px var(--cy-dim); }
.input::placeholder, .textarea::placeholder { color: var(--ink3); opacity: .85; }
.field label, .label { color: var(--ink2); font-size: 12px; font-weight: 500; }
.help { color: var(--ink3); font-size: 12px; line-height: 1.7; }
.tag { font-family: var(--font-body); border: 1px solid var(--line); border-radius: 5px; padding: 3px 7px; font-size: 10px; font-weight: 500; background: transparent; letter-spacing: .015em; }
.tag-card, .tag-question { color: var(--cy-text); }
.tag-recall { color: var(--mint); }
.tag-eastern { color: var(--east); } .tag-oriental { color: var(--orient); }
.tag-both, .tag-dual, .tag-contested { color: var(--ink2); }
.badge { background: var(--panel-sunk); color: var(--ink2); border-radius: 6px; font-size: 11px; }
.error-text, .progress-line.fail { color: var(--rose); }
.progress-line.done { color: var(--mint); }
.key { background: var(--panel-sunk); border-color: var(--line); font-family: var(--font-mono); font-size: 10px; }
.quiet-link { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink2); }
.quiet-link svg { width: 15px; height: 15px; transition: transform .2s; }
.quiet-link:hover { color: var(--cy-text); }
.quiet-link:hover svg { transform: translateX(3px); }

/* Permanent desktop rail; compact assistant strip. */
.tabbar { position: fixed; inset: 0 auto 0 0; width: var(--rail-w); height: 100dvh; transform: none; border-radius: 0; border: 0; border-right: 1px solid var(--line2); background: var(--rail-bg); padding: 34px 20px 20px; display: flex; flex-direction: column; align-items: stretch; gap: 24px; box-shadow: none; }
.brand { display: flex; gap: 12px; align-items: center; color: var(--ink); order: 0; margin: 0 0 20px; padding: 0 6px; font-family: var(--font-display); font-size: 28px; letter-spacing: -.04em; line-height: 1.2; }
.brand-mark { width: 31px; height: 39px; color: var(--cy-text); }
.brand-mark svg { width: 100%; height: 100%; }
.brand-sub { display: block; font-family: var(--font-body); font-size: 9px; letter-spacing: .035em; color: var(--ink3); margin-top: 6px; }
.tabbar .nav-list { display: flex; flex-direction: column; align-items: stretch; gap: 5px; order: 1; width: 100%; }
.nav-item { flex: none; display: flex; flex-direction: row; gap: 12px; align-items: center; justify-content: flex-start; width: 100%; min-height: 43px; padding: 0 13px; border-radius: 8px; color: var(--ink3); border: 1px solid transparent; background: transparent; transition: color .15s, background .15s; }
.nav-item span { display: inline; font-family: var(--font-body); font-size: 13px; font-weight: 450; letter-spacing: 0; }
.nav-item svg { width: 18px; height: 18px; }
.nav-item:hover { color: var(--ink); background: var(--panel); }
.nav-item[aria-current="page"] { background: var(--panel2); color: var(--cy-text); border-color: var(--line2); box-shadow: none; }
.nav-item[aria-current="page"]::before, .nav-item[aria-current="page"]::after { display: none; }
.nav-more { display: none; }
.fab { position: static; width: 100%; height: 43px; transform: none; border-radius: 8px; background: transparent; border: 1px solid var(--line); color: var(--cy-text); box-shadow: none; order: 2; gap: 10px; }
.fab svg { width: 16px; height: 16px; }
.fab::after { content: 'Add material'; font-family: var(--font-body); font-size: 12px; font-weight: 500; }
.fab:hover { transform: none; background: var(--panel); }
.rail-foot { order: 3; margin-top: auto; }
.rail-note { display: block; font-family: var(--font-display); font-size: 25px; font-style: italic; line-height: 1.25; color: var(--ink3); padding: 0 12px 28px; }
.rail-profile { display: flex; align-items: center; gap: 10px; padding-top: 20px; border-top: 1px solid var(--line2); color: var(--ink); font-size: 11px; }
.rail-profile img { image-rendering: pixelated; background: var(--panel); border-radius: 8px; padding: 3px; }
.rail-profile small { display: block; color: var(--ink3); font-size: 10px; margin-top: 2px; }
.main-col { margin-left: var(--rail-w); }
.topbar, main.view { width: 100%; max-width: 1380px; margin: 0 auto; padding-left: clamp(28px, 4vw, 64px); padding-right: clamp(28px, 4vw, 64px); }
.topbar { min-height: 90px; padding-top: 20px; padding-bottom: 20px; gap: 12px; background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line2); }
.topbar .me-chip { display: none; }
.presence-wrap { flex: none; width: 32px; height: 32px; }
.presence-wrap svg { width: 32px; height: 32px; }
.presence .ring { stroke: var(--cy-text); } .presence .core { fill: var(--cy-text); }
.caption { flex: 1; min-width: 0; }
.assistant-label { display: flex; gap: 7px; align-items: center; font-size: 9px; letter-spacing: .16em; color: var(--ink3); margin-bottom: 3px; }
.assistant-label i { width: 4px; height: 4px; background: var(--mint); border-radius: 50%; }
.caption-line { font-family: var(--font-body); color: var(--ink2); font-size: 12px; line-height: 1.5; font-weight: 400; max-width: 65ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.caption-verse { display: none; }
.topbar-actions { gap: 7px; flex: none; }
.icon-btn { width: 34px; height: 34px; min-width: 34px; border: 0; border-radius: 8px; color: var(--ink3); background: transparent; }
.icon-btn svg { width: 18px; height: 18px; }
.cmd-btn { min-height: 34px; border-color: var(--line2); padding: 0 10px; gap: 14px; font-family: var(--font-body); font-size: 11px; letter-spacing: 0; }
.cmd-btn kbd { border: 1px solid var(--line); padding: 0 4px; color: var(--ink3); }
main.view { padding-top: 36px; padding-bottom: 40px; }
.more-menu { position: fixed; right: 12px; bottom: 96px; z-index: 110; width: min(300px, calc(100vw - 24px)); background: var(--panel2); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: 0 20px 50px #0005; }
.more-menu a { display: block; padding: 12px 0; border-bottom: 1px solid var(--line2); color: var(--ink); font-size: 14px; }
.more-menu a:last-child { border: 0; padding-bottom: 0; }
.more-menu a span { display: block; color: var(--ink3); font-size: 11px; }

/* The daily return. */
.study-home { gap: 28px; }
.study-welcome { display: flex; align-items: end; justify-content: space-between; gap: 18px; }
.study-welcome h1 { margin-top: 9px; font-size: 39px; }
.study-welcome .eyebrow { font-size: 10px; letter-spacing: .12em; }
.study-top-grid { display: grid; grid-template-columns: minmax(0, 1fr) 248px; gap: 18px; }
.study-hero { position: relative; overflow: hidden; display: flex; align-items: center; min-height: 312px; padding: 32px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(115deg, var(--panel2), var(--panel)); }
.hero-copy { position: relative; z-index: 1; flex: 1; }
.section-kicker { color: var(--ink3); display: flex; align-items: center; gap: 7px; }
.section-kicker > i { width: 5px; height: 5px; border-radius: 50%; background: var(--cy-text); }
.study-hero h2 { font-family: var(--font-display); font-size: clamp(32px, 3.05vw, 47px); line-height: 1.06; margin: 21px 0 17px; color: var(--ink); font-weight: 400; }
.study-hero h2 em { color: var(--cy-text); font-weight: 400; }
.study-hero p { font-size: 12px; line-height: 1.8; color: var(--ink2); max-width: 39ch; }
.study-hero .hero-actions { margin-top: 25px; gap: 16px; }
.session-estimate { font-size: 11px; color: var(--ink3); }
.session-estimate span { display: block; font-size: 10px; }
.hero-folio { position: relative; width: 36%; flex: none; max-width: 230px; margin-left: -20px; color: var(--cy-text); }
.folio-art { display: block; width: 100%; height: auto; stroke: currentColor; stroke-width: .8; }
.folio-arch { opacity: .55; } .folio-page { fill: var(--panel); stroke-width: 1.1; } .folio-star { fill: currentColor; stroke: none; }
.hero-folio > span { font-family: var(--font-mono); font-size: 7px; letter-spacing: .15em; text-align: center; display: block; margin-top: 3px; opacity: .8; }
.rhythm-panel { display: flex; flex-direction: column; padding: 25px 23px; border: 1px solid var(--line2); border-radius: 16px; }
.rhythm-streak { font-family: var(--font-display); font-size: 62px; line-height: 1; margin: 22px 0; }
.rhythm-streak > span { font-family: var(--font-body); font-size: 11px; color: var(--ink3); margin-left: 9px; }
.rhythm { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.rhythm-day { aspect-ratio: 1; border-radius: 3px; background: var(--line2); }
.rhythm-day.active { background: var(--mint); opacity: var(--intensity); }
.rhythm-day.current { outline: 1px solid var(--cy-text); outline-offset: 2px; }
.rhythm-legend { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 8px; color: var(--ink3); margin: 13px 0 17px; }
.rhythm-legend i { display: inline-block; width: 5px; height: 5px; border-radius: 1px; background: var(--mint); margin-right: 4px; }
.rhythm-panel > .quiet-link { margin-top: auto; font-size: 11px; }
.study-stats { display: grid; grid-template-columns: repeat(4, 1fr); padding: 3px 0 23px; border-bottom: 1px solid var(--line2); }
.study-stats > div { padding: 0 25px; border-right: 1px solid var(--line2); }
.study-stats > div:first-child { padding-left: 0; } .study-stats > div:last-child { border: 0; }
.stat-label { display: block; font-size: 10px; color: var(--ink3); margin-bottom: 10px; }
.study-stats b { font-family: var(--font-display); font-size: 32px; font-weight: 400; line-height: 1; }
.study-stats small { font-family: var(--font-body); font-size: 11px; color: var(--ink3); margin-left: 7px; }
.study-section-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; }
.study-section-head h2 { margin-top: 6px; font-size: 28px; }
.study-bottom-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 20px; }
.attention-panel h2 { font-size: 29px; margin: 18px 0 10px; }
.attention-panel p { color: var(--ink2); font-size: 13px; line-height: 1.8; }
.attention-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin-top: 22px; font-size: 10px; color: var(--ink3); }
.outlook-bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; height: 127px; margin: 20px 0 14px; }
.outlook-bars > div { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: end; height: 100%; padding-bottom: 22px; }
.outlook-bars i { height: calc(var(--bar) * .73); width: 100%; max-width: 26px; min-height: 3px; background: var(--line); border-radius: 3px 3px 0 0; }
.outlook-bars > div:first-child i { background: var(--cy); }
.outlook-bars span { font-family: var(--font-mono); font-size: 10px; color: var(--ink3); margin-bottom: 6px; }
.outlook-bars b { position: absolute; bottom: 0; font-size: 9px; font-weight: 400; color: var(--ink3); }
.study-footnote { display: flex; justify-content: space-between; color: var(--ink3); font-family: var(--font-display); font-style: italic; font-size: 16px; border-top: 1px solid var(--line2); padding-top: 20px; }
.study-footnote > span { font-family: var(--font-body); font-size: 10px; font-style: normal; }

/* Bookshelf: real sources, not mock book jackets. */
.source-shelf { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.source-card { min-width: 0; border: 1px solid var(--line2); border-radius: 12px; overflow: hidden; background: var(--panel); color: var(--ink); transition: transform .2s, border-color .2s; }
.source-card:hover { transform: translateY(-4px); border-color: var(--cy-text); }
.source-cover { height: 144px; position: relative; padding: 16px 18px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; background: var(--cover-text); color: var(--cover-ink); border-left: 8px solid #0002; }
.source-card[data-kind="video"] .source-cover { background: var(--cover-video); }
.source-card[data-kind="scripture"] .source-cover { background: var(--cover-scripture); }
.cover-kind { display: flex; align-items: center; gap: 7px; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; z-index: 1; }
.cover-kind svg { width: 14px; height: 14px; }
.cover-art { position: absolute; right: 8px; top: -14px; width: 162px; opacity: .65; transform: rotate(-8deg); }
.cover-art .folio-page { fill: transparent; }
.cover-tradition { font-family: var(--font-display); font-style: italic; font-size: 16px; z-index: 1; max-width: 70%; }
.source-card-body { padding: 18px; }
.source-card h3 { font-family: var(--font-display); font-size: 21px; font-weight: 500; line-height: 1.2; min-height: 51px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.source-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 18px 0 13px; font-size: 10px; color: var(--ink3); }
.due-badge { color: var(--cy-text); background: var(--cy-dim); border: 1px solid color-mix(in srgb, var(--cy-text) 25%, transparent); padding: 1px 6px; border-radius: 4px; font-size: 9px; }
.shelf-progress { height: 3px; background: var(--line2); border-radius: 3px; overflow: hidden; }
.shelf-progress i { display: block; height: 100%; background: var(--mint); }
.source-card-foot { display: flex; justify-content: space-between; gap: 5px; font-size: 9px; color: var(--ink3); margin-top: 10px; }
.source-card-foot svg { width: 13px; height: 13px; }
.shelf-tools { display: flex; gap: 14px; align-items: center; }
.search-field { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; background: var(--panel); border: 1px solid var(--line2); border-radius: 9px; padding: 10px 14px; }
.search-field svg { width: 17px; height: 17px; color: var(--ink3); }
.search-field input { width: 100%; min-width: 0; color: var(--ink); background: transparent; border: 0; outline: 0; font-family: var(--font-body); font-size: 13px; line-height: 24px; }
.search-field:focus-within { outline: 2px solid var(--cy-text); outline-offset: 2px; }
.search-field input::placeholder { color: var(--ink3); }
.shelf-tools .select { width: auto; }
.shelf-tools .mono { white-space: nowrap; color: var(--ink3); }
.shelf-empty, .empty-shelf { grid-column: 1 / -1; text-align: center; padding: 40px; border: 1px dashed var(--line); border-radius: 14px; color: var(--ink); }
.empty-shelf > span, .empty-book { display: inline-flex; width: 48px; height: 48px; color: var(--cy-text); margin-bottom: 12px; }
.empty-shelf p, .shelf-empty p { color: var(--ink3); font-size: 13px; max-width: 50ch; margin: 10px auto 22px; }
.empty-shelf b { color: var(--cy-text); display: inline-flex; gap: 10px; align-items: center; font-size: 12px; }
.empty-shelf b svg { width: 17px; height: 17px; }

/* Stored-source reading and review. */
.back-link { font-size: 12px; color: var(--ink3); }
.source-reader-head { max-width: 950px; }
.source-reader-head h1 { font-size: clamp(30px, 3vw, 45px); margin: 16px 0 13px; line-height: 1.15; }
.source-reader-head .tag { margin-left: 10px; }
.reader-reference { color: var(--ink3); font-size: 12px; overflow-wrap: anywhere; }
.reader-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 23px; }
.reader-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; align-items: start; gap: 24px; }
.reading-pane { padding: 0; overflow: hidden; }
.reader-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line2); }
.reader-toolbar .search-field { border: 0; padding: 0; }
.reader-toolbar .mono { font-size: 9px; color: var(--ink3); }
.transcript { padding: 12px 30px 30px; }
.transcript-section { display: flex; gap: 20px; padding: 20px 0; border-bottom: 1px solid var(--line2); }
.transcript-section:last-child { border: 0; }
.transcript-section p { white-space: pre-line; color: var(--ink2); font-size: 15px; line-height: 1.85; overflow-wrap: anywhere; }
.timestamp { flex: none; display: flex; gap: 5px; align-items: center; align-self: start; padding: 4px 0; font-family: var(--font-mono); color: var(--cy-text); font-size: 10px; min-width: 56px; }
.timestamp svg { width: 10px; height: 10px; }
mark { background: var(--cy); color: var(--on-accent); border-radius: 2px; }
.reader-sidebar { display: grid; gap: 24px; position: sticky; top: 115px; }
.reader-card-count { font-family: var(--font-display); font-size: 54px; line-height: 1.3; margin: 15px 0 4px; }
.reader-card-count span { display: block; font-family: var(--font-body); color: var(--ink3); font-size: 12px; }
.reader-sidebar .muted { font-size: 12px; }
.reader-sidebar .btn-block { margin: 22px 0 28px; }
.reader-build { display: flex; gap: 8px; margin: 8px 0 12px; }
.reader-build .input { width: 78px; }
.reader-note { display: flex; gap: 12px; padding: 0 8px; font-size: 12px; line-height: 1.8; color: var(--ink3); }
.reader-note svg { width: 20px; height: 20px; }
.review-head { margin-bottom: 20px; flex-wrap: wrap; }
.review-grid { grid-template-columns: minmax(0, 1fr) 270px; }
.face { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: none; }
.face-body .prompt { font-family: var(--font-display); font-size: 29px; font-weight: 400; line-height: 1.3; }
.face-head, .face-source { color: var(--ink3); }
.option { border-radius: 9px; background: var(--panel-sunk); border-color: var(--line2); font-size: 14px; }
.option:hover { background: var(--panel2); }
.option .k { background: var(--panel2); border-radius: 6px; }
.option.correct, .option.wrong { background: var(--panel2); }
.option.correct .k { background: var(--mint); color: var(--bg-deep); }
.option.wrong .k { background: var(--rose); color: var(--bg-deep); }
.rate { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; color: var(--ink); box-shadow: none; padding: 13px 8px; }
.rate b { font-size: 13px; font-weight: 500; }
.rate.suggested { background: var(--cy-dim); border-color: var(--cy-text); }
.rate .iv { color: var(--ink3); font-family: var(--font-mono); font-size: 10px; }
.rate-1 b { color: var(--rose); } .rate-3 b, .rate-4 b { color: var(--mint); }
.review-source-link { margin-bottom: 16px; }
.memory b { font-family: var(--font-display); font-size: 25px; font-weight: 400; }
.review-focus .tabbar, .review-focus .topbar { display: none; }
.review-focus .main-col { margin-left: 0; }
.review-focus main.view { max-width: 1000px; padding-top: 30px; }
.review-focus .review-grid { grid-template-columns: minmax(0, 1fr); max-width: 760px; margin: 0 auto; }
.review-focus .review-side { display: none; }
.review-focus .review-head { max-width: 760px; margin-left: auto; margin-right: auto; }
.review-focus .face-body .prompt { font-size: 34px; }
.row-item { border-radius: 0; border: 0; border-bottom: 1px solid var(--line2); background: transparent; }
.row-item:hover { background: var(--panel2); }
.row-item .prompt { font-weight: 500; font-size: 14px; }
.row-item .sub, .row-item .right { font-size: 10px; }
.drawer, .modal-box, .palette-box { background: var(--panel); border-color: var(--line); }
.drawer h2 { font-size: 28px; }
.palette-input { color: var(--ink); font-size: 17px; border-color: var(--line2); }
.palette-item:hover, .palette-item.sel { background: var(--panel2); }
.palette-item { font-size: 13px; }
.palette-answer { color: var(--ink2); }
.toast { border: 1px solid var(--line); background: var(--panel2); color: var(--ink); }
.tabs { gap: 5px; border-color: var(--line2); }
.tab { padding: 10px 16px; font-size: 12px; font-weight: 500; border-radius: 6px 6px 0 0; }
.tab[aria-pressed="true"] { color: var(--cy-text); border-color: var(--cy-text); background: var(--cy-dim); }
.built-item { border-radius: 8px; }
.built-item .src { font-size: 10px; letter-spacing: 0; }
.source-list div { font-size: 13px; }
.source-list .n { font-size: 10px; letter-spacing: 0; }
.login h1 { font-size: 42px; }.login-box { max-width: 430px; }
body[data-screen="login"] .main-col { margin-left: 0; }
.setting .name { font-size: 13px; font-weight: 500; }.setting .desc { font-size: 12px; }
.settings-grid { gap: 20px; }.settings-grid .panel { min-width: 0; }
.switch[aria-checked="true"] { border-color: var(--cy-text); background: var(--cy-dim); }
.j-entry { background: var(--panel); border-color: var(--line2); }
.stat-tile { background: var(--panel); border: 1px solid var(--line2); box-shadow: none; }
.spotlit { outline-color: var(--cy-text); }

@media (min-width: 1500px) { .topbar, main.view { margin-left: auto; margin-right: auto; } }
@media (min-width: 900px) and (max-width: 1199px) {
  :root { --rail-w: 190px; }
  .tabbar { padding-left: 14px; padding-right: 14px; }
  .topbar, main.view { padding-left: 28px; padding-right: 28px; }
  .study-top-grid { grid-template-columns: minmax(0, 1fr) 205px; }
  .study-hero { padding: 25px; }.hero-folio { display: none; }
  .study-hero h2 { font-size: 37px; }
  .rhythm-panel { padding: 23px 18px; }
  .source-shelf { gap: 14px; }.source-card-body { padding: 14px; }
  .source-card h3 { font-size: 19px; }
  .reader-layout { grid-template-columns: minmax(0, 1fr) 230px; gap: 16px; }
  .review-grid { grid-template-columns: minmax(0, 1fr); }.review-side { position: static; }
}
@media (max-width: 899px) {
  .main-col { margin-left: 0; }
  .topbar, main.view { max-width: 760px; padding-left: 24px; padding-right: 24px; width: 100%; }
  main.view { padding-top: 26px; padding-bottom: 110px; }
  .topbar { min-height: 76px; padding-top: 13px; padding-bottom: 13px; }
  .topbar-actions { gap: 3px; }
  .caption-line { font-size: 11px; -webkit-line-clamp: 2; }.assistant-label { font-size: 8px; }
  .presence-wrap, .presence-wrap svg { width: 26px; height: 26px; }
  .cmd-btn { font-size: 0; width: 35px; padding: 0; justify-content: center; }
  .cmd-btn::after { content: '/'; font-family: var(--font-mono); font-size: 16px; }
  .cmd-btn kbd { display: none; }
  .icon-btn { min-width: 32px; width: 32px; height: 38px; }
  .tabbar { inset: auto 12px max(12px, env(safe-area-inset-bottom)); width: calc(100% - 24px); max-width: 500px; margin: 0 auto; height: 70px; border: 1px solid var(--line); border-radius: 18px; padding: 6px 8px; display: block; background: color-mix(in srgb, var(--panel) 96%, transparent); backdrop-filter: blur(16px); box-shadow: 0 10px 40px #0005; }
  .brand, .rail-foot, .nav-secondary { display: none; }
  .tabbar .nav-list { display: grid; grid-template-columns: 1fr 1fr 64px 1fr 1fr; gap: 2px; height: 100%; }
  .nav-item { min-height: 55px; padding: 7px 1px; display: flex; flex-direction: column; justify-content: center; gap: 4px; border: 0; border-radius: 9px; }
  .nav-secondary { display: none; }
  .nav-item span { font-size: 9px; line-height: 1.2; font-weight: 500; }
  .nav-item svg { width: 19px; height: 19px; }
  #nav-today { grid-column: 1; } #nav-sources { grid-column: 2; } #nav-forge { grid-column: 4; } #nav-more { grid-column: 5; grid-row: 1; }
  .fab { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); height: 44px; width: 44px; border-radius: 13px; background: var(--cy); color: var(--on-accent); border-color: var(--cy); }
  .fab::after { display: none; }.fab svg { width: 22px; height: 22px; }.fab:hover { transform: translate(-50%, -50%); background: var(--cy2); }
  .study-top-grid { grid-template-columns: minmax(0, 1fr) 200px; }
  .hero-folio { display: none; }.study-hero { padding: 26px; }.study-hero h2 { font-size: 36px; }
  .rhythm-panel { padding: 23px 18px; }.rhythm-streak { font-size: 50px; }
  .study-welcome h1 { font-size: 35px; }
  .study-welcome > .quiet-link { display: none; }
  .study-stats > div { padding: 0 15px; }
  .source-shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-shelf .source-card:last-child:nth-child(3) { display: none; }
  .study-bottom-grid { grid-template-columns: minmax(0, 1fr); }
  .reader-layout { grid-template-columns: minmax(0, 1fr); }.reader-sidebar { position: static; }
  .reader-sidebar .panel { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
  .reader-sidebar .panel > .eyebrow, .reader-sidebar .panel > .help { grid-column: 1 / -1; }
  .reader-card-count { margin: 0; }.reader-sidebar .btn-block { margin: 0; align-self: end; }.reader-build { margin: 0; }
  .reader-sidebar .label { align-self: center; }.transcript { padding: 6px 22px 22px; }
  .review-grid, .forge-grid, .gaps-grid { display: flex; flex-direction: column; }.review-grid > *, .forge-grid > *, .gaps-grid > * { width: 100%; }
  .review-side { position: static; }.review-head { gap: 9px; }.review-head .eyebrow { width: 100%; }
  .review-count { margin-left: auto; }.review-progress { max-width: none; }
  .review-focus main.view { padding-left: 20px; padding-right: 20px; }
  .review-focus .face-body .prompt { font-size: 27px; }
  .study-footnote > span { display: none; }
}
@media (max-width: 599px) {
  body { font-size: 14px; }
  .topbar, main.view { padding-left: 20px; padding-right: 20px; }
  .topbar { gap: 8px; }.caption-line { max-width: 100%; }.topbar .presence-wrap { display: none; }
  .study-home { gap: 24px; }.screen { gap: 22px; }
  .study-welcome h1 { font-size: 34px; }.study-welcome .eyebrow { font-size: 9px; }
  .study-top-grid { display: flex; flex-direction: column; gap: 16px; }
  .study-hero { min-height: 298px; padding: 25px; }.study-hero h2 { font-size: 38px; }
  .study-hero p { font-size: 12px; max-width: 34ch; }.hero-folio { display: block; position: absolute; width: 140px; right: -24px; top: 25px; opacity: .13; }
  .hero-folio > span { display: none; }.study-hero .hero-actions { gap: 12px; }.session-estimate { font-size: 10px; }
  .rhythm-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; padding: 19px 21px; align-items: center; }
  .rhythm-panel > .section-kicker { font-size: 8px; grid-column: 1; }.rhythm-streak { grid-column: 1; margin: 12px 0; font-size: 44px; }.rhythm-streak > span { font-size: 9px; margin-left: 6px; }
  .rhythm { grid-column: 2; grid-row: 1 / 4; gap: 4px; }.rhythm-legend { display: none; }.rhythm-panel > .quiet-link { grid-column: 1; font-size: 10px; margin: 0; }
  .study-stats { grid-template-columns: repeat(2, 1fr); gap: 20px 0; padding: 0 0 23px; }
  .study-stats > div { padding-left: 0; }.study-stats > div:nth-child(even) { padding-left: 22px; border: 0; }
  .study-stats b { font-size: 30px; }.stat-label { font-size: 10px; margin-bottom: 8px; }
  .study-section-head h2 { font-size: 27px; }.study-section-head > a { max-width: 105px; font-size: 10px; }.study-section-head .eyebrow { font-size: 9px; }
  .source-shelf { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .home-shelf .source-card:last-child:nth-child(3) { display: block; }
  .source-card { display: grid; grid-template-columns: 95px minmax(0, 1fr); }
  .source-cover { height: 100%; min-height: 170px; padding: 13px 10px; border-left-width: 5px; }
  .cover-kind { font-size: 7px; gap: 5px; }.cover-kind svg { width: 11px; height: 11px; }.cover-tradition { font-size: 13px; max-width: 100%; }
  .cover-art { width: 115px; right: -37px; top: 24px; }.source-card-body { padding: 16px; }
  .source-card h3 { min-height: 44px; font-size: 20px; line-height: 1.2; }.source-card-meta { margin: 13px 0 10px; }
  .source-card-foot { font-size: 8px; }.source-card-foot svg { display: none; }
  .shelf-tools { flex-wrap: wrap; gap: 10px; }.shelf-tools .search-field { flex-basis: 100%; }.shelf-tools .select { flex: 1; }.shelf-tools .mono { padding-right: 4px; }
  .panel { padding: 21px; }.attention-panel h2 { font-size: 27px; }
  .reader-actions .btn { font-size: 11px; padding: 10px 12px; }
  .reading-pane { padding: 0; }.reader-toolbar { padding: 17px; }.transcript { padding: 2px 18px 18px; }
  .transcript-section { flex-direction: column; gap: 8px; }.transcript-section p { font-size: 14px; line-height: 1.9; }
  .timestamp { font-size: 11px; min-height: 32px; }.source-reader-head h1 { font-size: 32px; }
  .reader-note { font-size: 11px; }.reader-sidebar .panel { padding: 21px; }
  .screen-head .btn { font-size: 11px; }.screen-head { align-items: start; }
  .face { padding: 23px; }.face-body .prompt { font-size: 27px; }.option { font-size: 13px; }
  .rate { padding: 13px 6px; }.rate b { font-size: 12px; }.rate .iv { font-size: 9px; }
  .rate .hintkey { display: none; }.review-head .btn { font-size: 11px; padding: 7px 10px; }
  .tabs .tab { font-size: 11px; padding: 10px 12px; }.intake-row { gap: 16px; }
  .input, .textarea, .select { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .screen, .source-card, .folio-art, .btn, .quiet-link svg { animation: none !important; transition: none !important; }
}
:root.rm .screen, :root.rm .source-card { animation: none !important; transition: none !important; }
/* Explicitly replace the legacy topbar ordering and button specificity. */
.topbar .presence-wrap { order: 0; }
.topbar .caption { order: 1; }
.topbar .topbar-actions { order: 2; }
.topbar-actions .icon-btn { width: 36px; height: 36px; min-width: 36px; background: transparent; color: var(--ink2); }
.topbar-actions .cmd-btn { background: transparent; color: var(--ink); font-size: 11px; font-weight: 500; border: 1px solid var(--line); white-space: nowrap; }
.topbar-actions .icon-btn:hover, .topbar-actions .cmd-btn:hover { background: var(--panel2); color: var(--ink); }
@media (max-width: 899px) {
  .topbar-actions .cmd-btn { width: 36px; height: 36px; min-width: 36px; padding: 0; gap: 0; }
  .cmd-label { display: none; }
}
@media (max-width: 599px) {
  .home-shelf .source-card:last-child:nth-child(3) { display: grid; }
}
.study-hero .hero-actions { display: flex; align-items: center; flex-wrap: wrap; }
:root[data-theme="day"] { --shadow-card: 0 6px 20px #00000005; --shadow-lift: 0 12px 32px #0000000A; }
/* Illustrated editions: artwork and colour stay attached to the source. */
.source-card[data-edition="arch"] .source-cover { background: #49363C; }
.source-card[data-edition="stars"] .source-cover { background: #3D353F; }
.source-card[data-edition="grove"] .source-cover { background: #443C3C; }
.source-card[data-edition="candle"] .source-cover { background: #594047; }
.source-card[data-edition="dawn"] .source-cover { background: #594747; }
.source-card[data-edition="mountains"] .source-cover { background: #37353A; }
.source-card .cover-art { opacity: .75; transform: rotate(-6deg); transition: transform .3s ease; }
.source-card:hover .cover-art { transform: rotate(0); }
.source-card[data-edition="stars"] .cover-art, .source-card[data-edition="dawn"] .cover-art { transform: rotate(0); }

/* Mitchel's original sprite remains the character; props belong to the scene. */
.companion-scene { position: relative; display: inline-flex; align-items: flex-end; justify-content: center; flex: none; isolation: isolate; }
.companion-scene .pixel-me { image-rendering: pixelated; position: relative; z-index: 1; transform-origin: 50% 100%; }
.companion-ground { position: absolute; bottom: -2px; width: 85%; height: 7px; background: var(--ink); opacity: .1; border-radius: 50%; }
.companion-prop { position: absolute; right: -7px; bottom: 1px; z-index: 2; color: var(--cy-text); }
.companion-prop svg { width: 30px; height: 30px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 5px; }
.companion-spark { font-size: 28px; color: var(--cy-text); }
.companion-celebrate .pixel-me { animation: companion-hop .65s ease-out 2; }
.companion-celebrate .companion-prop { bottom: auto; top: 3px; right: -15px; }
.companion-trigger { order: 0; border: 1px solid var(--line); border-radius: 13px; background: var(--panel); width: 48px; height: 48px; padding: 3px; cursor: pointer; flex: none; }
.companion-trigger:hover, .companion-trigger[aria-expanded="true"] { border-color: var(--cy-text); background: var(--panel2); }
.companion-trigger:hover .pixel-me { animation: companion-hop .45s ease-out; }
.topbar .presence-wrap { display: none; }
.companion-note { display: flex; gap: 18px; align-items: center; max-width: 720px; }
.companion-bubble { position: relative; border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; background: var(--panel); padding: 13px 19px; }
.companion-label { display: block; font-size: 9px; letter-spacing: .09em; text-transform: uppercase; color: var(--cy-text); margin-bottom: 3px; }
.companion-bubble p { margin: 0; font-size: 13px; line-height: 1.6; color: var(--ink2); }
.study-home > .companion-note { margin-top: -10px; }
.reader-sidebar > .companion-note { margin-top: 22px; gap: 10px; align-items: start; flex-direction: column; }
.reader-sidebar .companion-bubble { padding: 16px; }
.companion-review .companion-scene { float: right; margin: -5px 0 10px 12px; }
.companion-review::after { content: ''; display: block; clear: both; }
.companion-popover { position: fixed; top: 83px; left: calc(var(--rail-w) + 28px); z-index: 160; width: min(370px, calc(100vw - 40px)); padding: 20px; background: var(--panel2); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 18px 55px #0003; }
.companion-popover-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.companion-popover-head .icon-btn { width: 44px; height: 44px; }
.companion-conversation { display: flex; align-items: center; gap: 22px; padding: 12px 4px 22px; min-height: 135px; }
.companion-conversation p { margin: 0; color: var(--ink); font-family: var(--font-display); font-size: 21px; line-height: 1.3; }
.companion-popover > .quiet-link { min-height: 44px; }
.review-focus .companion-popover { display: none; }
@keyframes companion-hop { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-9px) rotate(-4deg); } 70% { transform: translateY(-2px) rotate(2deg); } }
@media (max-width: 899px) {
  .companion-popover { left: 20px; top: 80px; }
  .companion-trigger { width: 44px; height: 44px; padding: 1px; }
  .reader-sidebar > .companion-note { flex-direction: row; align-items: center; }
}
@media (max-width: 599px) {
  .companion-note { gap: 12px; }
  .companion-note .pixel-me { max-width: 58px; }
  .companion-bubble { padding: 12px 14px; }
  .companion-label { font-size: 8px; }
  .companion-bubble p { font-size: 12px; }
  .topbar .caption-line { font-size: 10px; }
  .source-card .cover-art { right: -20px; width: 112px; top: 27px; }
}
@media (prefers-reduced-motion: reduce) {
  .companion-scene .pixel-me { animation: none !important; }
  .source-card .cover-art { transition: none; }
}
:root.rm .companion-scene .pixel-me { animation: none !important; }
:root.rm .source-card .cover-art { transition: none; }
.companion-popover > button.quiet-link { background: transparent; border: 0; padding: 8px 0; font: inherit; font-size: 12px; cursor: pointer; }
.companion-scene { width: auto; }
.companion-scene .pixel-me { aspect-ratio: 1; object-fit: contain; }
.companion-poses { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 10px; }
.companion-poses summary { cursor: pointer; font-size: 12px; color: var(--ink2); padding: 8px 0; min-height: 44px; }
.companion-poses > div { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding-top: 8px; }
.companion-poses figure { margin: 0; text-align: center; }
.companion-poses .pixel-me { max-width: 100%; }
.companion-poses figcaption { font-size: 9px; color: var(--ink3); }
.companion-popover { max-height: calc(100dvh - 180px); overflow-y: auto; }

/* Keep filled actions legible in both palettes, including legacy components. */
:root[data-theme="day"] .btn-primary, :root[data-theme="dark"] .btn-primary,
.btn-primary, .fab-add { color: var(--on-accent); }
:root[data-theme="day"] .btn-primary:hover, :root[data-theme="dark"] .btn-primary:hover { color: var(--on-accent); }
.study-hero .folio-art { color: var(--cy-text); }

/* Daily-return header: useful status replaces the former microphone cluster. */
.return-status { display: inline-flex; align-items: center; gap: 9px; min-height: 38px; padding: 6px 11px; color: var(--ink); text-decoration: none; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.return-status:hover { border-color: color-mix(in srgb, var(--cy-text) 55%, var(--line)); background: var(--panel2); }
.return-status > span:last-child { display: grid; line-height: 1.1; }
.return-status b { font-size: 11px; font-weight: 650; }
.return-status small { margin-top: 3px; color: var(--ink3); font: 8px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.return-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cy-text); box-shadow: 0 0 0 4px color-mix(in srgb, var(--cy-text) 13%, transparent); }
.return-status.is-clear .return-dot { background: var(--ink3); box-shadow: none; }
.reminder-shortcut.active { color: var(--cy-text); border-color: color-mix(in srgb, var(--cy-text) 55%, var(--line)); }

/* Reminder settings use the same paper-and-burgundy language as source cards. */
.reminder-panel { overflow: hidden; }
.reminder-intro { display: flex; align-items: center; gap: 16px; margin: 4px 0 8px; padding: 18px; border-radius: 14px; background: color-mix(in srgb, var(--cy-text) 9%, var(--panel2)); }
.reminder-intro h2 { margin: 0 0 4px; font: 500 25px/1.1 var(--font-display); }
.reminder-intro p { margin: 0; color: var(--ink2); font-size: 13px; line-height: 1.5; }
.reminder-bell { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 14px; color: var(--on-accent); background: var(--cy-text); transform: rotate(-3deg); }
.reminder-bell svg { width: 25px; height: 25px; }
.reminder-state { padding: 4px 7px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink3); font: 8px/1 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; }
.reminder-state.granted { color: var(--cy-text); border-color: color-mix(in srgb, var(--cy-text) 42%, var(--line)); }
.reminder-state.needs-install { color: var(--cy-text); border-color: color-mix(in srgb, var(--cy-text) 42%, var(--line)); }
.reminder-time { width: 118px; }
.reminder-limit { margin: 13px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.phone-install { margin-top: 14px; padding: 16px 17px; border: 1px solid var(--line); border-radius: 13px; background: var(--panel2); }
.phone-install ol { margin: 10px 0; padding-left: 21px; color: var(--ink2); font-size: 13px; line-height: 1.65; }
.install-app-row { display: flex; align-items: center; gap: 14px; }
.install-app-row img { flex: none; border-radius: 15px; box-shadow: 0 8px 18px #0004; }
.phone-install li + li { margin-top: 3px; }
.phone-install p { margin: 0; color: var(--ink3); font-size: 11px; line-height: 1.5; }
.inline-setting, .range-row { display: flex; align-items: center; gap: 10px; }
.inline-setting .input { width: 110px; }
.inline-setting.wide .input { width: auto; flex: 1; }
.range-row .mono { min-width: 48px; }
.danger-list { margin-top: 12px; }
.spend-message, .spend-high { color: var(--cy-text); }
.spend-over { color: var(--rose); }

@media (max-width: 899px) {
  .return-status small { display: none; }
  .return-status { padding: 6px 9px; }
}
@media (max-width: 599px) {
  .return-status { border: 0; background: transparent; padding: 4px; }
  .return-status > span:last-child { display: none; }
  .return-dot { width: 9px; height: 9px; }
  .reminder-intro { align-items: flex-start; padding: 15px; }
  .reminder-intro h2 { font-size: 22px; }
  .install-app-row { align-items: flex-start; }
  .install-app-row img { width: 52px; height: 52px; border-radius: 12px; margin-top: 11px; }
}
