:root {
  color-scheme: dark;
  --bg: #090b0f;
  --surface: #11151b;
  --surface-raised: #171c24;
  --line: #252c36;
  --text: #f1f3f5;
  --muted: #89919d;
  --faint: #3d444e;
  --accent: #ff654f;
  --accent-soft: #ff8a79;
  --reading-size: clamp(1.75rem, 3vw, 3.3rem);
  --reading-color: #a7adb6;
  /* 43.5 / 56.5 gives the right side roughly 30% more reading room. */
  --focus-x: 43.5%;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 101, 79, .045), transparent 30rem),
    var(--bg);
  overflow-x: hidden;
}
button, select, input { font: inherit; }
button, select { color: inherit; }
button { cursor: pointer; }

.auth-view {
  min-height: 100vh;
  padding: 24px;
  display: grid;
  place-items: center;
}
.auth-panel {
  width: min(420px, 100%);
  padding: 30px;
  display: grid;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(17,21,27,.9);
  box-shadow: 0 24px 80px rgba(0,0,0,.28);
}
.auth-brand { margin-bottom: 6px; }
.auth-panel h1 { margin: 8px 0 0; font-family: Georgia, "Times New Roman", serif; font-size: 3.1rem; line-height: .95; font-weight: 500; letter-spacing: -.04em; }
.auth-field { display: grid; gap: 8px; color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .12em; }
.auth-field input {
  width: 100%;
  height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  background: #0c1015;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}
.auth-field input:focus { border-color: #566171; }
.auth-remember { display: flex; align-items: center; gap: 10px; color: #a9b0ba; font-size: 12px; }
.auth-remember input { width: 16px; height: 16px; accent-color: var(--accent); }
.auth-error { margin: 0; padding: 10px 12px; border: 1px solid #673b36; border-radius: 10px; background: #271513; color: #ffd7d0; font-size: 12px; }

.topbar {
  height: 88px;
  padding: 0 clamp(20px, 4vw, 64px);
  display: grid;
  grid-template-columns: 1fr minmax(0, 1.25fr) 1fr;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,.055);
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; font-size: 15px; font-weight: 800; letter-spacing: .16em; width: max-content; }
.brand small { color: var(--muted); font-size: 9px; letter-spacing: .14em; font-weight: 650; padding-left: 1px; }
.brand-mark { width: 23px; height: 23px; display: grid; place-items: center; border: 1px solid #4c5561; border-radius: 50%; }
.brand-mark span { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px rgba(255,101,79,.8); }
.book-heading { text-align: center; min-width: 0; }
.book-heading strong { display: block; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; font-weight: 600; }
.eyebrow { color: var(--muted); text-transform: uppercase; letter-spacing: .18em; font-size: 9px; font-weight: 750; }
.topbar .button { justify-self: end; }
.topbar-actions { justify-self: end; display: flex; align-items: center; gap: 8px; }

.button { border: 0; border-radius: 100px; display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-weight: 700; transition: transform .2s ease, background .2s ease, border-color .2s ease; }
.button:hover { transform: translateY(-1px); }
.button-quiet { padding: 10px 16px; background: transparent; border: 1px solid var(--line); font-size: 12px; }
.button-quiet:hover { background: var(--surface-raised); border-color: #3c4552; }
.button-primary { padding: 15px 22px; background: var(--accent); color: #160603; box-shadow: 0 10px 34px rgba(255,101,79,.15); }
.button-primary:hover { background: var(--accent-soft); }

main { min-height: calc(100vh - 88px); }
.library { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: clamp(48px, 7vw, 92px) 0 72px; }
.library-hero { display: flex; align-items: end; justify-content: space-between; gap: 32px; margin-bottom: 48px; }
.library-hero h1 { margin: 8px 0 8px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(3rem, 6vw, 5.8rem); line-height: .95; font-weight: 500; letter-spacing: -.05em; }
.library-hero p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 14px; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.library-card { min-width: 0; min-height: 218px; padding: 20px; display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 22px; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(145deg, rgba(23,28,36,.9), rgba(13,16,21,.78)); transition: border-color .2s, transform .2s; }
.library-card:hover { border-color: #3b4552; transform: translateY(-2px); }
.book-cover { min-height: 176px; display: grid; place-items: center; border: 1px solid #303845; border-radius: 10px 17px 17px 10px; background: radial-gradient(circle at 50% 35%, rgba(255,101,79,.12), transparent 45%), #12171e; color: #c5cad1; font-family: Georgia, serif; font-size: 58px; box-shadow: inset 5px 0 12px rgba(0,0,0,.3), 0 12px 30px rgba(0,0,0,.18); }
.book-card-body { min-width: 0; display: flex; flex-direction: column; }
.book-card-top { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.book-card-top h2 { margin: 4px 0 0; display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; font-family: Georgia, serif; font-size: 21px; line-height: 1.15; font-weight: 600; }
.remove-book { flex: 0 0 auto; width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: #555e69; font-size: 18px; }
.remove-book:hover { background: #291716; color: #e78b7e; }
.book-card-meta { margin: 11px 0 auto; color: #686f79; font-size: 9px; line-height: 1.5; }
.card-progress { height: 2px; margin-top: 20px; overflow: hidden; border-radius: 2px; background: #29303a; }
.card-progress span { display: block; height: 100%; background: var(--accent); }
.book-card-footer { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 10px; }
.continue-button { border: 0; padding: 5px 0 5px 10px; background: transparent; color: #d7dbe0; font-size: 11px; font-weight: 700; }
.continue-button:hover { color: var(--accent-soft); }
.library-empty { min-height: 480px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border: 1px dashed var(--line); border-radius: 28px; }
.library-empty .empty-orbit { width: 78px; height: 78px; margin-bottom: 24px; }
.library-empty .empty-orbit span { font-size: 40px; }
.library-empty h2 { margin: 0 0 10px; font-family: Georgia, serif; font-size: 30px; }
.library-empty p { max-width: 470px; margin: 0 20px 24px; color: var(--muted); line-height: 1.6; }
.library-empty small { margin-top: 16px; color: #555d68; font-size: 10px; }
.profile { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: clamp(48px, 6vw, 78px) 0 72px; }
.profile-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 38px; }
.profile-heading h1 { margin: 8px 0 9px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.8rem, 5vw, 5rem); line-height: .96; font-weight: 500; letter-spacing: -.045em; }
.profile-heading p:not(.eyebrow) { margin: 0; color: var(--muted); font-size: 13px; }
.profile-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.profile-stat { min-height: 146px; padding: 22px; display: flex; flex-direction: column; justify-content: space-between; border: 1px solid var(--line); border-radius: 17px; background: linear-gradient(145deg, rgba(23,28,36,.82), rgba(12,15,20,.82)); }
.profile-stat > strong { display: block; margin: auto 0 5px; color: #d8dce1; font-family: Georgia, serif; font-size: clamp(1.8rem, 3vw, 2.7rem); font-weight: 500; letter-spacing: -.03em; }
.profile-stat > strong small { color: var(--muted); font-family: ui-sans-serif, sans-serif; font-size: 11px; font-weight: 650; letter-spacing: 0; }
.profile-stat > small { color: #626a75; font-size: 9px; }
.stat-today { border-color: rgba(255,101,79,.25); background: radial-gradient(circle at 85% 20%, rgba(255,101,79,.11), transparent 45%), #13171d; }
.stat-streak > strong { color: var(--accent-soft); }
.profile-dashboard { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(310px, .75fr); gap: 18px; }
.calendar-card, .week-card { min-height: 440px; padding: 26px; border: 1px solid var(--line); border-radius: 18px; background: rgba(16,20,26,.76); }
.card-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.card-heading h2 { margin: 6px 0 0; font-family: Georgia, serif; font-size: 24px; font-weight: 600; }
.month-controls { display: flex; align-items: center; gap: 5px; }
.month-controls button { height: 31px; min-width: 31px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); font-size: 9px; }
.month-controls button:hover { background: var(--surface-raised); color: var(--text); }
.calendar-weekdays, .calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 7px; }
.calendar-weekdays { margin: 27px 0 8px; color: #555d67; text-align: center; font-size: 8px; font-weight: 750; text-transform: uppercase; }
.calendar-day { aspect-ratio: 1.32; min-height: 42px; padding: 7px; position: relative; border: 1px solid #222933; border-radius: 9px; background: #0d1116; color: #676f79; font-size: 9px; font-variant-numeric: tabular-nums; }
.calendar-day.is-empty { visibility: hidden; }
.calendar-day.is-future { opacity: .35; }
.calendar-day.is-today { border-color: #59626e; color: var(--text); }
.calendar-day.has-reading { color: #d6d9de; }
.calendar-day::after { content: ""; position: absolute; right: 6px; bottom: 6px; width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.calendar-day.level-1 { background: rgba(255,101,79,.07); }
.calendar-day.level-1::after { background: rgba(255,101,79,.38); }
.calendar-day.level-2 { background: rgba(255,101,79,.12); }
.calendar-day.level-2::after { background: rgba(255,101,79,.55); }
.calendar-day.level-3 { background: rgba(255,101,79,.18); }
.calendar-day.level-3::after { background: rgba(255,101,79,.75); }
.calendar-day.level-4 { background: rgba(255,101,79,.24); border-color: rgba(255,101,79,.28); }
.calendar-day.level-4::after { background: var(--accent); box-shadow: 0 0 8px rgba(255,101,79,.35); }
.calendar-day small { position: absolute; left: 7px; right: 18px; bottom: 5px; overflow: hidden; color: #767e89; font-size: 7px; white-space: nowrap; text-overflow: ellipsis; }
.calendar-legend { margin-top: 14px; display: flex; justify-content: flex-end; align-items: center; gap: 5px; color: #535b65; font-size: 8px; }
.calendar-legend i { width: 9px; height: 9px; border-radius: 3px; background: rgba(255,101,79,.07); }
.calendar-legend i:nth-of-type(2) { background: rgba(255,101,79,.12); }
.calendar-legend i:nth-of-type(3) { background: rgba(255,101,79,.18); }
.calendar-legend i:nth-of-type(4) { background: rgba(255,101,79,.27); }
.week-card { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.week-bars { min-height: 250px; padding-top: 28px; display: grid; grid-template-columns: repeat(7, 1fr); align-items: end; gap: 10px; }
.week-bar { height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 8px; text-align: center; }
.week-bar-track { height: 100%; min-height: 180px; display: flex; align-items: end; justify-content: center; border-bottom: 1px solid #2b323c; }
.week-bar-fill { width: min(24px, 72%); min-height: 3px; border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, var(--accent), #9f3e32); opacity: .8; }
.week-bar.is-today .week-bar-fill { box-shadow: 0 0 15px rgba(255,101,79,.18); opacity: 1; }
.week-bar label { color: #626a75; font-size: 8px; text-transform: uppercase; }
.week-card > p { margin: 16px 0 0; color: #666e79; font-size: 10px; line-height: 1.5; }
.empty-state { width: min(760px, calc(100% - 40px)); min-height: calc(100vh - 88px); margin: 0 auto; padding: 8vh 0 9vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-orbit { width: 108px; height: 108px; margin-bottom: 42px; border: 1px solid #323a46; border-radius: 50%; display: grid; place-items: center; position: relative; }
.empty-orbit::before, .empty-orbit::after { content: ""; position: absolute; background: var(--accent); }
.empty-orbit::before { width: 1px; height: 19px; top: -10px; }
.empty-orbit::after { width: 19px; height: 1px; right: -10px; }
.empty-orbit span { font-family: Georgia, serif; font-size: 55px; font-weight: 700; }
.empty-state h1 { margin: 14px 0 22px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.4rem, 5.5vw, 5.2rem); line-height: .98; letter-spacing: -.045em; font-weight: 500; }
.empty-state h1 em { color: var(--muted); font-weight: 400; }
.empty-copy { max-width: 570px; margin: 0 0 30px; color: #a4abb5; font-size: 16px; line-height: 1.65; }
.privacy { margin-top: 17px; color: #555d68; font-size: 11px; }

.reader { width: min(1500px, 100%); min-height: calc(100vh - 88px); margin: 0 auto; padding: 25px clamp(20px, 4vw, 64px) 24px; display: grid; grid-template-rows: auto minmax(250px, 1fr) auto auto auto; }
.reader-meta { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 24px; min-width: 0; }
.chapter-picker { display: grid; gap: 5px; min-width: 0; }
.chapter-picker select, .neighbor-control select { appearance: none; border: 0; outline: 0; background: transparent; }
.chapter-picker select { max-width: min(55vw, 540px); font-family: Georgia, serif; font-size: 18px; font-weight: 600; text-overflow: ellipsis; }
.reader-actions { display: flex; align-items: center; gap: 8px; }
.meta-button { padding: 8px 11px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 650; }
.meta-button:hover { border-color: #3b4450; background: var(--surface); color: var(--text); }
.meta-button.is-saved { border-color: rgba(255,101,79,.32); color: var(--accent-soft); }
.meta-button span { margin-right: 4px; }
.reading-stats { justify-self: end; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.reading-stats .dot { margin: 0 8px; color: var(--faint); }

.focus-stage { min-height: 280px; position: relative; overflow: hidden; touch-action: none; user-select: none; }
.current-word { position: absolute; z-index: 3; left: var(--focus-x); top: 50%; display: inline-flex; align-items: baseline; white-space: nowrap; color: var(--reading-color); font-size: var(--reading-size); line-height: 1; letter-spacing: -.025em; font-weight: 620; will-change: transform; }
.current-word .orp { color: #da604f; text-shadow: 0 0 24px rgba(218,96,79,.11); }
.context { position: absolute; top: 50%; display: flex; align-items: baseline; gap: clamp(24px, 3.2vw, 58px); white-space: nowrap; transform: translateY(-50%); color: var(--reading-color); font-size: var(--reading-size); line-height: 1; font-weight: 600; letter-spacing: -.025em; }
.context-before { transform: translate(-100%, -50%); }
.context span { transition: opacity .15s ease; }
.focus-tick { position: absolute; z-index: 3; left: var(--focus-x); width: 1px; height: 20px; background: #da604f; transform: translateX(-50%); box-shadow: 0 0 9px rgba(218,96,79,.26); }
.focus-tick-top { top: calc(50% - clamp(54px, 8vw, 86px)); }
.focus-tick-bottom { top: calc(50% + clamp(54px, 8vw, 86px) - 20px); }
.pause-context { position: absolute; inset: 0; z-index: 2; padding: 3% 0; display: flex; flex-direction: column; justify-content: space-between; gap: clamp(36px, 7vw, 120px); pointer-events: none; }
.pause-passage { width: 100%; min-width: 0; color: #6f7680; font-family: Georgia, "Times New Roman", serif; font-size: clamp(20px, 2.25vw, 38px); line-height: 1.35; }
.pause-passage span { display: block; margin-bottom: 6px; color: #4e5661; font-family: ui-sans-serif, sans-serif; font-size: 8px; font-weight: 750; text-transform: uppercase; letter-spacing: .13em; }
.pause-passage p { margin: 0; display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; text-align: justify; }
.pause-passage-before p { -webkit-line-clamp: 3; }
.pause-passage-after p { -webkit-line-clamp: 3; }
.reader.is-paused .context { opacity: .08; transition: opacity .18s ease; }
.reader.is-paused .focus-tick { opacity: .45; }

.progress-wrap { width: 100%; }
.progress { --position: 0%; appearance: none; width: 100%; height: 14px; margin: 0; background: transparent; cursor: pointer; }
.progress::-webkit-slider-runnable-track { height: 2px; border-radius: 2px; background: linear-gradient(90deg, var(--accent) var(--position), var(--line) var(--position)); }
.progress::-moz-range-track { height: 2px; background: var(--line); }
.progress::-moz-range-progress { height: 2px; background: var(--accent); }
.progress::-webkit-slider-thumb { appearance: none; width: 10px; height: 10px; margin-top: -4px; border-radius: 50%; border: 2px solid var(--bg); background: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.progress::-moz-range-thumb { width: 8px; height: 8px; border: 2px solid var(--bg); border-radius: 50%; background: var(--accent); }
.progress-labels { display: flex; justify-content: space-between; margin-top: 7px; color: #555d68; font-size: 9px; text-transform: uppercase; letter-spacing: .12em; }
.progress-labels strong { color: var(--muted); font-weight: 700; }

.control-deck { margin-top: 17px; min-height: 104px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border: 1px solid var(--line); border-radius: 20px; background: rgba(17,21,27,.78); box-shadow: 0 20px 60px rgba(0,0,0,.18); backdrop-filter: blur(14px); }
.control-group { padding: 0 clamp(20px, 3vw, 44px); display: flex; align-items: center; gap: 18px; }
.control-label { color: var(--muted); text-transform: uppercase; letter-spacing: .13em; font-size: 9px; font-weight: 750; }
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button { width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
.stepper button:hover { background: var(--surface-raised); color: var(--text); }
.stepper output { min-width: 98px; text-align: center; font-size: 15px; font-weight: 750; font-variant-numeric: tabular-nums; }
.stepper output small { display: block; color: var(--muted); font-size: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; }
.playback { display: flex; align-items: center; gap: 18px; }
.playback button { display: grid; place-items: center; border: 0; border-radius: 50%; transition: transform .18s, background .18s; }
.playback button:hover { transform: scale(1.05); }
.play { width: 66px; height: 66px; padding-left: 4px; background: var(--accent); color: #170704; font-size: 19px; box-shadow: 0 10px 30px rgba(255,101,79,.16); }
.play.is-playing { padding-left: 0; }
.skip { width: 44px; height: 44px; background: var(--surface-raised); color: var(--muted); font-size: 10px; font-weight: 750; }
.neighbor-control { justify-content: flex-end; }
.neighbor-control select { padding-right: 20px; text-align: right; font-size: 13px; font-weight: 700; background: linear-gradient(45deg, transparent 50%, var(--muted) 50%) right 7px center / 5px 5px no-repeat; }
.shortcuts { margin: 12px 0 0; text-align: center; color: #4f5660; font-size: 9px; }
.shortcuts span { margin: 0 8px; }
kbd { padding: 2px 5px; border: 1px solid #292f38; border-radius: 4px; background: #11151b; font: inherit; color: #717986; }

.has-dialog { overflow: hidden; }
.navigator { position: fixed; inset: 0; z-index: 50; }
.navigator-backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(4,6,9,.72); backdrop-filter: blur(6px); }
.navigator-panel { position: absolute; top: 0; right: 0; width: min(760px, 92vw); height: 100%; display: grid; grid-template-rows: auto auto minmax(0, 1fr); border-left: 1px solid #303844; background: #0e1217; box-shadow: -30px 0 80px rgba(0,0,0,.35); }
.navigator-header { padding: 30px 34px 22px; display: flex; align-items: start; justify-content: space-between; }
.navigator-header h2 { margin: 7px 0 0; font-family: Georgia, serif; font-size: 30px; font-weight: 600; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); font-size: 24px; line-height: 1; }
.icon-button:hover { background: var(--surface-raised); color: var(--text); }
.navigator-tabs { padding: 0 34px; display: flex; gap: 22px; border-bottom: 1px solid var(--line); }
.navigator-tab { position: relative; padding: 12px 0 15px; border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; }
.navigator-tab.is-active { color: var(--text); }
.navigator-tab.is-active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); }
.navigator-tab span { margin-left: 4px; padding: 2px 6px; border-radius: 20px; background: var(--surface-raised); color: var(--muted); font-size: 9px; }
.navigator-content { min-height: 0; padding: 24px 34px 28px; display: grid; grid-template-rows: auto auto minmax(0, 1fr) auto; gap: 16px; }
.search-box { height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); }
.search-box:focus-within { border-color: #4b5563; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font-size: 13px; }
.search-box input::placeholder { color: #59616c; }
.text-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.text-toolbar select { max-width: 70%; border: 0; outline: 0; background: transparent; color: #d5d9df; font-family: Georgia, serif; font-size: 16px; font-weight: 600; text-overflow: ellipsis; }
.text-toolbar span { color: #5f6772; font-size: 9px; white-space: nowrap; }
.book-text { min-height: 0; overflow-y: auto; padding: 24px 26px; border: 1px solid #222933; border-radius: 15px; background: #0b0e12; color: #aab0b8; font-family: Georgia, "Times New Roman", serif; font-size: 18px; line-height: 1.9; scrollbar-color: #333b46 transparent; }
.book-word { position: relative; display: inline; margin: 0; padding: 1px 2px; border: 0; border-radius: 4px; background: transparent; color: inherit; font: inherit; line-height: inherit; text-align: left; }
.book-word:hover { background: #242c36; color: var(--text); }
.book-word.is-current { background: rgba(255,101,79,.14); color: var(--accent-soft); }
.book-word.has-bookmark::after { content: ""; position: absolute; left: 20%; right: 20%; bottom: -1px; height: 1px; background: var(--accent); }
.page-controls { display: flex; align-items: center; justify-content: space-between; }
.page-controls button { padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); font-size: 10px; }
.page-controls button:hover:not(:disabled) { border-color: #414b58; color: var(--text); }
.page-controls button:disabled { opacity: .3; cursor: default; }
.page-controls span { color: #626a75; font-size: 10px; }
.search-result { width: 100%; margin-bottom: 10px; padding: 16px; display: block; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: inherit; text-align: left; }
.search-result:hover { border-color: #46505d; background: var(--surface-raised); }
.search-result strong { display: block; color: #d7dbe0; font-family: ui-sans-serif, sans-serif; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.search-result p { margin: 8px 0; font-size: 15px; line-height: 1.5; }
.search-result span { color: var(--accent-soft); font-family: ui-sans-serif, sans-serif; font-size: 9px; font-weight: 700; }
.search-empty, .bookmark-empty { min-height: 220px; display: grid; place-content: center; text-align: center; color: var(--muted); }
.search-empty p, .bookmark-empty p { margin: 8px auto 0; max-width: 320px; font-size: 12px; line-height: 1.5; }
#bookmarksPanel { grid-template-rows: minmax(0, 1fr); }
.bookmark-list { min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 10px; }
.bookmark-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.bookmark-jump { min-width: 0; padding: 15px 16px; border: 0; background: transparent; color: inherit; text-align: left; }
.bookmark-jump:hover .bookmark-position { color: var(--accent-soft); }
.bookmark-position { color: #c9ced5; font-size: 10px; font-weight: 750; }
.bookmark-jump p { margin: 7px 0 0; overflow: hidden; color: var(--muted); font-family: Georgia, serif; font-size: 14px; line-height: 1.45; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.bookmark-remove { width: 34px; height: 34px; margin-right: 10px; border: 0; border-radius: 50%; background: transparent; color: #59616c; font-size: 18px; }
.bookmark-remove:hover { background: #2a1715; color: #e88779; }

.drop-overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(9,11,15,.9); backdrop-filter: blur(8px); }
.drop-overlay div { width: min(520px, calc(100% - 40px)); height: 270px; border: 1px dashed var(--accent); border-radius: 28px; display: grid; place-content: center; gap: 8px; text-align: center; }
.drop-overlay strong { font-family: Georgia, serif; font-size: 35px; }
.drop-overlay span { color: var(--muted); font-size: 12px; }
.loading { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 20px; background: rgba(9,11,15,.86); backdrop-filter: blur(9px); }
.loading strong { font-size: 13px; letter-spacing: .05em; }
.loader { width: 38px; height: 38px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; z-index: 40; left: 50%; bottom: 28px; transform: translateX(-50%); max-width: min(480px, calc(100% - 32px)); padding: 13px 18px; border: 1px solid #673b36; border-radius: 12px; background: #271513; color: #ffd7d0; text-align: center; font-size: 12px; box-shadow: 0 15px 50px #000; }
[hidden] { display: none !important; }

@media (max-width: 760px) {
  .topbar { height: 72px; grid-template-columns: 1fr auto; }
  .brand small, .book-heading { display: none; }
  main { min-height: calc(100vh - 72px); }
  .library { width: min(600px, calc(100% - 28px)); padding-top: 38px; }
  .profile { width: min(600px, calc(100% - 28px)); padding-top: 38px; }
  .profile-heading { align-items: start; margin-bottom: 26px; }
  .profile-heading h1 { font-size: 3.15rem; }
  .profile-heading p:not(.eyebrow) { display: none; }
  .profile-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-dashboard { grid-template-columns: 1fr; }
  .calendar-card, .week-card { min-height: 400px; padding: 19px; }
  .library-hero { align-items: start; margin-bottom: 28px; }
  .library-hero h1 { font-size: 3.3rem; }
  .library-hero p:not(.eyebrow) { display: none; }
  .library-hero .button { padding: 11px 15px; font-size: 11px; }
  .library-grid { grid-template-columns: 1fr; }
  .empty-state { min-height: calc(100vh - 72px); padding-top: 4vh; }
  .empty-orbit { width: 82px; height: 82px; margin-bottom: 28px; }
  .empty-orbit span { font-size: 43px; }
  .reader { min-height: calc(100vh - 72px); padding-top: 20px; grid-template-rows: auto minmax(260px, 1fr) auto auto; }
  .reader-meta { grid-template-columns: minmax(0, 1fr) auto; }
  .reader-actions { justify-self: end; }
  .meta-button { width: 38px; height: 38px; padding: 0; font-size: 0; }
  .meta-button span { margin: 0; font-size: 16px; }
  .reading-stats { display: none; }
  .chapter-picker select { max-width: 83vw; }
  .context { gap: 22px; }
  .context span:not(:last-child) { display: none; }
  .context-after span:not(:first-child) { display: none; }
  .pause-passage { font-size: 17px; line-height: 1.35; }
  .pause-context { padding: 3% 0; gap: 18px; }
  .pause-passage-before p { -webkit-line-clamp: 2; }
  .pause-passage-after p { -webkit-line-clamp: 2; }
  .control-deck { min-height: 92px; grid-template-columns: 1fr; }
  .speed-control, .neighbor-control { display: none; }
  .playback { justify-content: center; }
  .play { width: 62px; height: 62px; }
  .shortcuts { display: none; }
  .navigator-panel { width: 100%; }
  .navigator-header { padding: 22px 20px 16px; }
  .navigator-tabs { padding-inline: 20px; }
  .navigator-content { padding: 18px 16px 20px; }
  .book-text { padding: 18px; font-size: 17px; }
}

@media (max-width: 430px) {
  .topbar { padding-inline: 16px; }
  .button-quiet { width: 40px; height: 40px; padding: 0; font-size: 0; }
  .button-quiet span { font-size: 20px; }
  .reader { padding-inline: 16px; }
  .library-card { grid-template-columns: 88px minmax(0, 1fr); min-height: 178px; padding: 15px; gap: 16px; }
  .profile-heading .button { width: 40px; height: 40px; padding: 0; overflow: hidden; font-size: 0; }
  .profile-heading .button::before { content: "←"; font-size: 16px; }
  .profile-stats { gap: 9px; }
  .profile-stat { min-height: 126px; padding: 16px; }
  .profile-stat > strong { font-size: 1.7rem; }
  .calendar-day { min-height: 36px; padding: 5px; border-radius: 7px; }
  .calendar-day small { display: none; }
  .calendar-day::after { right: 5px; bottom: 5px; width: 5px; height: 5px; }
  .book-cover { min-height: 148px; font-size: 44px; }
  .book-card-top h2 { font-size: 18px; }
  .book-card-meta { font-size: 8px; }
  .empty-state h1 { font-size: 2.55rem; }
  .empty-copy { font-size: 14px; }
  :root { --reading-size: clamp(1.65rem, 7.5vw, 2.4rem); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
