/* Marcapáginas — "Noche" design (claude.ai/design canvas "Marcapáginas · Listas y sagas"). */
@font-face { font-family: Manrope; font-weight: 200 800; font-display: swap; src: url(fonts/manrope-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Manrope; font-weight: 200 800; font-display: swap; src: url(fonts/manrope-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Literata; font-weight: 200 900; font-display: swap; src: url(fonts/literata-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Literata; font-weight: 200 900; font-display: swap; src: url(fonts/literata-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #0e1014; --panel: #12141a; --surface: #161920; --surface2: #1f232b; --surface3: #262a33;
  --line: #262a33; --line2: #2a2f39; --line3: #3a404c; --dash: #4a5160;
  --text: #ecebe6; --soft: #c3c5cc; --muted: #a3a6ae; --faint: #8b8f99;
  --accent: #f0b44c; --accent-ink: #0e1014; --accent-soft: rgba(240, 180, 76, .12); --accent-soft2: rgba(240, 180, 76, .2);
  --danger: oklch(0.72 0.15 25); --danger-bg: oklch(0.6 0.18 25);
  --page: #15171c; --page-ink: #dedbd2; --page-faint: #8b8f99;
  --overlay: rgba(5, 6, 9, .74); --pop-shadow: 0 24px 60px rgba(0, 0, 0, .6); --cover-shadow: 0 10px 24px rgba(0, 0, 0, .45);
  --serif: Literata, Georgia, serif;
  color-scheme: dark;
}
:root[data-theme=light] {
  --bg: #f3f1ea; --panel: #ebe8df; --surface: #ffffff; --surface2: #efece4; --surface3: #e4e0d6;
  --line: #e4e0d6; --line2: #dcd8cd; --line3: #c9c4b8; --dash: #b3ad9f;
  --text: #1c1d21; --soft: #43464e; --muted: #5f626b; --faint: #7b7e86;
  --accent: #f0b44c; --accent-ink: #1c1d21; --accent-soft: rgba(214, 150, 40, .14); --accent-soft2: rgba(214, 150, 40, .22);
  --danger: oklch(0.55 0.17 25);
  --page: #fffdf8; --page-ink: #26241f; --page-faint: #85817a;
  --overlay: rgba(20, 18, 14, .45); --pop-shadow: 0 20px 50px rgba(30, 25, 10, .22); --cover-shadow: 0 8px 18px rgba(30, 25, 10, .22);
  color-scheme: light;
}
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: Manrope, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased; }
* { box-sizing: border-box; }
a { color: var(--accent); } a:hover { color: var(--text); }
input, select, textarea, button { font-family: inherit; color: inherit; font-size: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .5; cursor: default; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .12em; color: var(--faint); text-transform: uppercase; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- buttons & fields ---------- */
.btn { border: 0; height: 40px; padding: 0 20px; border-radius: 20px; font-weight: 800; font-size: 13.5px; background: var(--accent);
  color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; gap: 7px; text-decoration: none; white-space: nowrap; }
.btn:hover { color: var(--accent-ink); filter: brightness(1.06); }
.btn.ghost { background: transparent; border: 1px solid var(--line2); color: var(--text); font-weight: 700; }
.btn.ghost:hover { border-color: var(--line3); background: var(--surface2); }
.btn.soft { background: var(--accent-soft); color: var(--accent); }
.btn.danger { background: var(--danger-bg); color: #fff; }
.btn.sm { height: 32px; padding: 0 14px; border-radius: 16px; font-size: 12.5px; }
.btn.xs { height: 26px; padding: 0 10px; border-radius: 13px; font-size: 11.5px; }
.btn.dashed { background: transparent; border: 1px dashed var(--dash); color: var(--soft); font-weight: 700; }
.link-btn { border: 0; background: transparent; padding: 0; color: var(--accent); font-size: 13px; font-weight: 700; }
.link-btn:hover { color: var(--text); }
.danger-link { border: 0; background: transparent; padding: 0; font-size: 13px; font-weight: 800; color: var(--danger); }
.icon-btn { border: 0; width: 32px; height: 32px; border-radius: 16px; background: var(--surface3); color: var(--text); display: inline-flex;
  align-items: center; justify-content: center; padding: 0; flex-shrink: 0; }
.icon-btn:hover { background: var(--line3); }
.icon-btn.plain { background: transparent; color: var(--faint); }
.icon-btn.plain:hover { background: var(--surface2); color: var(--text); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); min-width: 0; }
.input { height: 38px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg); font-size: 13.5px;
  color: var(--text); outline: none; width: 100%; min-width: 0; font-weight: 500; }
.input:focus { border-color: var(--accent); }
textarea.input { height: auto; padding: 10px 12px; line-height: 1.5; resize: vertical; font-size: 13px; }
select.input { padding: 0 10px; }
.input.big { height: 44px; border-radius: 12px; font-size: 16px; font-weight: 800; padding: 0 14px; }
.pill-input { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 19px; background: var(--surface);
  border: 1px solid var(--line2); color: var(--muted); }
.pill-input:focus-within { border-color: var(--accent); }
.pill-input input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; color: var(--text); font-size: 13px; }
.pill-select { height: 38px; padding: 0 12px; border-radius: 19px; background: var(--surface); border: 1px solid var(--line2); color: var(--text); font-size: 13px; }
.toggle { height: 38px; padding: 0 14px; border-radius: 19px; border: 1px solid var(--line2); background: transparent; color: var(--muted);
  font-weight: 700; font-size: 13px; white-space: nowrap; }
.toggle.sm { height: 32px; border-radius: 16px; font-size: 12.5px; }
.toggle.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.seg { display: flex; padding: 3px; border-radius: 19px; background: var(--surface); border: 1px solid var(--line2); }
.seg button { border: 0; height: 30px; padding: 0 14px; border-radius: 15px; font-weight: 700; font-size: 12.5px; background: transparent; color: var(--muted); }
.seg button.on { background: var(--text); color: var(--bg); }
.chip { height: 32px; padding: 0 14px; border-radius: 16px; font-size: 12.5px; font-weight: 700; border: 1px solid var(--line2);
  background: transparent; color: var(--muted); }
.chip.on { border-color: var(--text); background: var(--text); color: var(--bg); }
.sdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.bar { height: 4px; border-radius: 2px; background: var(--line2); overflow: hidden; }
.bar > div { height: 100%; }
input[type=range] { accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; flex-shrink: 0; }
.card { background: var(--surface); border-radius: 16px; }

/* ---------- app shell: icon rail (desktop), top bar + tab bar (phones) ---------- */
.shell { min-height: 100vh; display: flex; }
.rail { width: 84px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; background: var(--bg); border-right: 1px solid var(--surface2);
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px 0; z-index: 30; }
.logo-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--accent); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.logo-mark svg { width: 62%; height: 62%; }
.rail-add { width: 40px; height: 40px; margin: 10px 0 14px; border-radius: 12px; border: 1px dashed var(--dash); background: transparent;
  color: var(--text); display: flex; align-items: center; justify-content: center; }
.rail-add:hover { border-color: var(--accent); color: var(--accent); }
.nav-btn { width: 64px; height: 56px; border-radius: 12px; border: 0; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 4px; background: transparent; color: var(--muted); font-size: 10.5px; font-weight: 700; text-decoration: none; }
.nav-btn:hover { color: var(--text); }
.nav-btn.on { background: var(--surface3); color: var(--accent); }
.rail .spacer { flex: 1; }
.rail-theme { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; color: var(--muted); display: flex; align-items: center; justify-content: center; }
.rail-theme:hover { color: var(--text); background: var(--surface2); }
.avatar { width: 36px; height: 36px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; flex-shrink: 0; border: 0; padding: 0; }
.main { flex: 1; min-width: 0; padding: 28px 36px 64px; }
.topbar, .tabbar { display: none; }
.page { display: flex; flex-direction: column; gap: 22px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px 16px; }
.page-head h1, .h1 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.page-sub { font-size: 13px; color: var(--muted); }
.tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.loading { min-height: 60vh; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 14px; }
.empty { padding: 56px 20px; border: 1.5px dashed var(--line3); border-radius: 18px; text-align: center; display: flex;
  flex-direction: column; gap: 8px; align-items: center; }
.empty b { font-size: 16px; }

/* ---------- covers: image when there is one, otherwise generated with title (and author) ---------- */
.cover { position: relative; overflow: hidden; border-radius: 7px; color: var(--ink); background: var(--cbg); display: flex;
  flex-direction: column; justify-content: space-between; font: 700 12.5px/1.15 var(--serif); }
.cover > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover .c-kind { font: 800 9px Manrope, sans-serif; letter-spacing: .14em; opacity: .8; }
.cover .c-title { font-family: var(--serif); font-weight: 700; line-height: 1.15; text-wrap: balance; overflow-wrap: anywhere; }
.cover .c-author { font: 600 11px Manrope, sans-serif; opacity: .85; }
.cover.none { background: transparent; border: 1px dashed var(--dash); color: var(--muted); }
.cover.done-dim { opacity: .45; }
.cover.tiny { width: 26px; height: 38px; border-radius: 3px; flex-shrink: 0; }
.cover.mini { width: 54px; height: 80px; border-radius: 6px; flex-shrink: 0; padding: 6px; font-size: 8px; display: block; box-shadow: 0 8px 20px rgba(0, 0, 0, .45); }
.stack { position: relative; display: block; aspect-ratio: 2 / 3; }
.stack .back { position: absolute; inset: 0; border-radius: 7px; background: var(--cbg); padding: 0; }
.stack .back.b1 { transform: translate(8px, -8px); opacity: .45; }
.stack .back.b2 { transform: translate(4px, -4px); opacity: .7; }
.stack > .cover { position: absolute; inset: 0; padding: 10px; box-shadow: var(--cover-shadow); }
.stack.saga { margin: 8px 8px 0 0; }
.count-badge { position: absolute; bottom: 9px; right: 7px; height: 20px; padding: 0 7px; border-radius: 10px; background: var(--accent);
  color: #0e1014; font: 800 11px/20px Manrope, sans-serif; z-index: 2; white-space: nowrap; }
.count-badge.inline { position: static; display: inline-block; height: 18px; line-height: 18px; font-size: 10.5px; flex-shrink: 0; }
.tag { position: absolute; top: 7px; right: 7px; height: 20px; padding: 0 6px; border-radius: 6px; background: rgba(0, 0, 0, .6); color: #ecebe6;
  font: 800 10px/20px Manrope, sans-serif; letter-spacing: .06em; z-index: 2; }
.tag.left { right: auto; left: 7px; height: 18px; line-height: 18px; font-size: 9.5px; }
.pbar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0, 0, 0, .4); z-index: 2; }
.pbar > div { height: 100%; }

/* ---------- library ---------- */
.continue { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.cont-card { display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: 16px; border: 0; text-align: left; color: var(--text);
  background: linear-gradient(110deg, oklch(0.27 0.06 var(--h)), var(--surface) 75%); min-width: 0; }
:root[data-theme=light] .cont-card { background: linear-gradient(110deg, oklch(0.9 0.05 var(--h)), var(--surface) 75%); }
.cont-card .play { width: 38px; height: 38px; border-radius: 50%; background: var(--accent); color: #0e1014; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; }
.cont-card .sub { font-size: 12px; color: var(--soft); }
.status-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.stab { display: flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: 16px; border: 0; background: transparent;
  color: var(--muted); font-size: 12.5px; font-weight: 600; }
.stab:hover { color: var(--text); }
.stab.on { background: var(--text); color: var(--bg); font-weight: 700; }
.stab .n { font-size: 11.5px; opacity: .7; }
.boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 26px 18px; }
.bcard { border: 0; background: transparent; padding: 0; text-align: left; color: inherit; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.bcard .stack { margin-top: 8px; transition: transform .15s; }
.bcard .stack.saga { margin-top: 8px; }
.bcard:hover .stack { transform: translateY(-2px); }
.bcard .t { font-size: 13px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bcard .st { font-size: 11.5px; color: var(--muted); }
.bcard .st.reading { color: var(--accent); font-weight: 700; }

.table-wrap { background: var(--surface); border-radius: 16px; overflow-x: auto; }
.trow { display: grid; grid-template-columns: 76px minmax(160px, 2.2fr) minmax(110px, 1.3fr) 64px 70px 56px 140px 120px minmax(120px, 1fr);
  gap: 12px; align-items: center; padding: 8px 18px; font-size: 13px; border-top: 1px solid var(--surface2); min-width: 1040px; cursor: pointer; }
.trow:hover { background: var(--surface2); }
.trow.head { font-size: 11px; font-weight: 800; letter-spacing: .1em; color: var(--faint); border-top: 0; padding: 12px 18px; cursor: default; }
.trow.head:hover { background: transparent; }
.trow.open { background: #1d2129; }
.trow.child { background: #12151a; }
:root[data-theme=light] .trow.open { background: #f5f1e6; }
:root[data-theme=light] .trow.child { background: #faf8f2; }
.trow .lead { display: flex; align-items: center; gap: 8px; align-self: stretch; }
.trow .chev-slot { width: 14px; flex-shrink: 0; align-self: stretch; display: flex; align-items: center; justify-content: center; }
.trow .chev { border: 0; background: transparent; padding: 0; color: var(--muted); display: flex; transition: transform .15s; }
.trow.open .chev { transform: rotate(90deg); }
.trow .vline { width: 2px; align-self: stretch; margin: -8px 0; background: var(--accent); opacity: .55; }
.trow.child .cover { margin-left: 24px; }
.trow.child .tt { padding-left: 24px; }
.trow .tt { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; }
.trow .m { color: var(--muted); }
.trow select { height: 28px; border: 0; border-radius: 8px; background: transparent; font-size: 13px; padding: 0 4px; color: var(--text); max-width: 100%; }
.trow select:hover { background: var(--surface3); }

/* ---------- lists ---------- */
.list-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.picker { position: relative; min-width: 0; }
.picker-btn { display: flex; align-items: center; gap: 10px; height: 44px; max-width: 100%; padding: 0 14px 0 18px; border-radius: 22px;
  border: 1px solid var(--line2); background: var(--surface); color: var(--text); font-size: 16px; font-weight: 800; }
.picker-btn.open { border-color: var(--accent); }
.picker-btn .chev { transition: transform .15s; flex-shrink: 0; }
.picker-btn.open .chev { transform: rotate(180deg); }
.menu { position: absolute; top: calc(100% + 8px); left: 0; z-index: 25; width: min(380px, calc(100vw - 32px)); background: var(--surface2);
  border: 1px solid var(--line3); border-radius: 16px; box-shadow: var(--pop-shadow); padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.menu .search { height: 36px; margin-bottom: 6px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line3); background: var(--surface);
  color: var(--text); font-size: 13px; outline: none; }
.menu .search:focus { border-color: var(--accent); }
.menu .sec { padding: 8px 8px 4px; font-size: 10.5px; font-weight: 800; letter-spacing: .12em; color: var(--faint); }
.menu .scroll { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.mrow { display: flex; align-items: center; gap: 4px; border-radius: 9px; }
.mrow.on { background: var(--line2); }
.mrow .go { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border: 0; background: transparent;
  color: var(--soft); font-size: 13.5px; text-align: left; border-radius: 9px; }
.mrow .go:hover { background: var(--surface3); color: var(--text); }
.mrow.on .go { color: var(--text); font-weight: 800; }
.mrow .go .n { font-size: 11.5px; color: var(--faint); }
.mrow .pin { width: 30px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: #5c6372; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mrow .pin.on { color: var(--accent); }
.mrow .pin:hover { background: var(--surface3); }
.menu .foot { margin-top: 6px; padding: 10px; border-top: 1px solid var(--line2); font-size: 13px; font-weight: 800; color: var(--accent);
  border-left: 0; border-right: 0; border-bottom: 0; background: transparent; text-align: left; }
.hero { display: flex; gap: 28px; align-items: flex-end; padding: 24px; border-radius: 20px;
  background: radial-gradient(circle at 12% 30%, oklch(0.33 0.07 var(--h)), var(--surface) 70%); }
:root[data-theme=light] .hero { background: radial-gradient(circle at 12% 30%, oklch(0.88 0.06 var(--h)), var(--surface) 70%); }
.hero .cover { width: 116px; height: 174px; flex-shrink: 0; padding: 12px; font-size: 15px; box-shadow: 0 20px 40px rgba(0, 0, 0, .5); }
.hero .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 9px; }
.hero .kicker { font-size: 12px; font-weight: 800; letter-spacing: .14em; color: var(--accent); }
.hero .ttl { font-size: 32px; font-weight: 800; letter-spacing: -.02em; line-height: 1.05; overflow-wrap: anywhere; }
.hero .sub { font-size: 14px; color: var(--soft); }
.hero .acts { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .btn { height: 44px; padding: 0 22px; border-radius: 22px; font-size: 14px; }
.order-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.order { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 22px 18px; align-items: start; }
.ocard { position: relative; border: 0; background: transparent; padding: 0; text-align: left; color: inherit; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.ocard .stack { width: 96px; max-width: 100%; margin-top: 8px; border-radius: 7px; }
.ocard .stack.saga { margin-right: 0; }
.ocard.sel .stack { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--accent); }
.ocard .num { font-size: 22px; font-weight: 800; color: var(--line3); line-height: 1; }
.ocard .t { font-size: 12.5px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.ocard .st { font-size: 11.5px; color: var(--faint); }
.ocard .st.reading { color: var(--accent); font-weight: 700; }
.ocard .rm { position: absolute; top: 2px; left: -6px; z-index: 3; width: 24px; height: 24px; border-radius: 12px; border: 0; background: var(--surface3);
  color: var(--text); display: none; align-items: center; justify-content: center; padding: 0; }
.ocard:hover .rm, .ocard:focus-within .rm { display: flex; }
.ocard.dragging { opacity: .35; }
.ocard.drop-before::before { content: ""; position: absolute; left: -11px; top: 8px; bottom: 0; width: 3px; border-radius: 2px; background: var(--accent); }
.ocard .moves { display: flex; gap: 4px; }
.ocard .moves button { flex: 1; height: 26px; border: 1px solid var(--line2); border-radius: 13px; background: transparent; color: var(--text); padding: 0; }
.saga-strip { display: flex; flex-direction: column; gap: 12px; padding: 16px 20px; border-radius: 16px; background: var(--surface); }
.saga-strip .head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; font-weight: 800; }
.saga-strip .books { display: flex; gap: 14px; overflow-x: auto; padding: 6px 4px 4px; }
.vbook { width: 58px; flex-shrink: 0; border: 0; background: transparent; padding: 0; color: inherit; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.vbook .cover { width: 56px; height: 84px; border-radius: 5px; padding: 0; }
.vbook.next .cover { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--accent); }
.vbook .l { font-size: 10.5px; line-height: 1.2; color: var(--muted); overflow-wrap: anywhere; }
.vbook.next .l { color: var(--accent); font-weight: 800; }

/* ---------- sagas ---------- */
.saga-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); gap: 16px; }
.saga-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: 18px; background: var(--surface); color: var(--text);
  border: 0; text-align: left; min-width: 0; }
.saga-card:hover { background: var(--surface2); }
.saga-card .covers { display: flex; gap: 8px; height: 96px; align-items: flex-end; overflow: hidden; }
.saga-card .covers .cover { flex: 0 1 62px; min-width: 24px; height: 93px; border-radius: 5px; padding: 0; }
.saga-card .covers .cover.cur { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); margin: 0 4px; }
.saga-card .row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.saga-card .segs { display: flex; gap: 3px; height: 5px; }
.saga-card .segs span { flex: 1; border-radius: 3px; background: var(--line2); }

/* ---------- modals ---------- */
.modal-bg { position: fixed; inset: 0; background: var(--overlay); display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 40px 100px rgba(0, 0, 0, .6); max-height: 92vh;
  overflow-y: auto; width: 100%; }
.modal .m-head { padding: 22px 24px 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal .m-title { font-size: 19px; font-weight: 800; }
.modal .m-body { padding: 18px 24px; display: flex; flex-direction: column; gap: 14px; }
.modal .m-foot { display: flex; align-items: center; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal .m-foot .grow { flex: 1; }
.pad { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.detail { max-width: 880px; display: flex; flex-direction: column; overflow-y: auto; }
.detail-grid { display: flex; gap: 26px; padding: 26px; }
.detail-side { width: 200px; flex-shrink: 0; display: flex; flex-direction: column; gap: 10px; }
.detail-side > .cover { height: 300px; padding: 16px; box-shadow: 0 20px 40px rgba(0, 0, 0, .5); font-size: 21px; }
.detail-side > .cover .c-title { font-size: 21px; }
.detail-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.rating-btns { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.rating-btns button { border: 0; height: 32px; border-radius: 8px; font-weight: 800; font-size: 12.5px; background: var(--bg); color: var(--muted); padding: 0; }
.rating-btns button.on { background: var(--accent); color: #0e1014; }
.audio-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; background: var(--bg); font-size: 12.5px; }
.audio-box .row { display: flex; flex-wrap: wrap; gap: 6px; }
.dd { position: relative; display: flex; flex-direction: column; gap: 6px; }
.dd-btn { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 10px; background: var(--bg); color: var(--text);
  font-size: 13.5px; border: 1px solid var(--line2); text-align: left; }
.dd-btn.open { border-color: var(--accent); }
.dd-btn .chev { transition: transform .15s; flex-shrink: 0; }
.dd-btn.open .chev { transform: rotate(180deg); }
.dd-pop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 5; background: var(--surface2); border: 1px solid var(--line3); border-radius: 12px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, .55); padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.dd-pop .search { height: 34px; margin-bottom: 4px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line3); background: var(--surface); color: var(--text); font-size: 13px; outline: none; }
.dd-pop .scroll { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.dd-pop label { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; font-size: 13px; cursor: pointer; color: var(--text); font-weight: 500; }
.dd-pop label:hover { background: var(--surface3); }
.dd-pop label .note { font-size: 11.5px; color: var(--muted); }
.dd-pop .foot { margin-top: 4px; padding: 8px; border: 0; border-top: 1px solid var(--line2); font-size: 13px; font-weight: 700; color: var(--accent); background: transparent; text-align: left; }
.drop { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 44px 20px; border-radius: 18px; border: 2px dashed var(--accent);
  background: rgba(240, 180, 76, .06); color: var(--text); cursor: pointer; text-align: center; }
.drop .ic { width: 52px; height: 52px; border-radius: 16px; background: var(--accent); color: #0e1014; display: flex; align-items: center; justify-content: center; }
.drop.over { background: rgba(240, 180, 76, .14); }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; font-weight: 700; }
.opt-row select { max-width: 60%; }
.opt-row .hint { display: block; font-size: 11.5px; font-weight: 500; color: var(--faint); }
.confirm-ic { width: 46px; height: 46px; border-radius: 14px; background: oklch(0.32 0.08 25); color: oklch(0.8 0.13 25); display: flex; align-items: center; justify-content: center; }
.srow { display: flex; align-items: center; gap: 12px; padding: 7px 10px; border-radius: 12px; background: var(--bg); }
.srow.dragging { opacity: .4; }
.srow.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.srow .grip { cursor: grab; color: var(--dash); display: flex; }
.srow .n { width: 16px; font-size: 12.5px; font-weight: 800; color: var(--faint); }
.srow .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; border: 0; background: transparent; padding: 2px 4px;
  margin: -2px -4px; border-radius: 8px; color: var(--text); text-align: left; }
.srow .info:hover { background: var(--surface2); }
.srow .info:hover .t { text-decoration: underline; text-decoration-color: var(--accent); }
.srow .info .t { font-weight: 700; font-size: 13.5px; }
.srow .info .m { font-size: 12px; color: var(--faint); }
.srow .info .m.reading { color: var(--accent); }
.srow .next-btn { height: 26px; padding: 0 10px; border-radius: 13px; border: 1px solid var(--line2); background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 700; }
.srow .next-btn.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.res { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 14px; background: var(--bg); }
.res .thumb { position: relative; width: 42px; height: 54px; flex-shrink: 0; }
.res .thumb .cover { position: absolute; bottom: 0; left: 0; width: 32px; height: 46px; border-radius: 4px; padding: 0; }
.res .thumb .back { position: absolute; top: 0; left: 8px; width: 32px; height: 46px; border-radius: 4px; opacity: .5; background: var(--cbg); }
.res .added { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.callout { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; border: 1.5px dashed var(--line3); flex-wrap: wrap; }
.toast { position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%); z-index: 80; background: var(--text); color: var(--bg);
  padding: 11px 18px; border-radius: 12px; font-size: 13.5px; font-weight: 700; box-shadow: 0 10px 30px rgba(0, 0, 0, .3); max-width: 90vw; }

/* ---------- voices ---------- */
.voices-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 20px; align-items: start; }
.voice-form { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.voice-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px; border-radius: 14px; border: 1.5px dashed var(--line3);
  cursor: pointer; text-align: center; background: var(--bg); }
.voice-drop:hover, .voice-drop.over { border-color: var(--accent); }
.voice-row { padding: 14px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.voice-row .avatar { width: 44px; height: 44px; font-size: 15px; }
.pill { font-size: 10.5px; font-weight: 800; letter-spacing: .04em; padding: 3px 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); }
.pill.grey { background: var(--surface3); color: var(--muted); }

/* ---------- profile ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { padding: 18px; display: flex; flex-direction: column; gap: 4px; }
.stat .v { font-size: 28px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.section { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.section h2 { margin: 0; font-weight: 800; font-size: 15px; }
.heat { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 6px; overflow-x: auto; }
.heat-months, .heat-cells { display: grid; gap: 4px; min-width: 900px; }
.heat-cells { grid-template-rows: repeat(7, auto); grid-auto-flow: column; }
.heat-cells div { aspect-ratio: 1; border-radius: 4px; }
.heat-days { display: grid; grid-template-rows: repeat(7, 1fr); gap: 4px; font-size: 10.5px; color: var(--muted); align-items: center; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 96px; padding: 40px 24px; }
.collage { position: relative; width: 420px; height: 520px; flex-shrink: 0; }
.collage .cover { position: absolute; width: 168px; height: 252px; border-radius: 10px; padding: 16px; font-size: 17px; box-shadow: 0 24px 50px rgba(0, 0, 0, .55); }
.login-box { width: min(400px, 100%); display: flex; flex-direction: column; gap: 22px; }
.login-box .logo-mark { width: 48px; height: 48px; border-radius: 14px; }
.login-box h1 { margin: 0; font-size: 38px; font-weight: 800; letter-spacing: -.02em; line-height: 1.05; }
.collage .cover.deco { display: flex; flex-direction: column; gap: 8px; padding: 18px 16px; background: var(--cbg); color: var(--ink); }
.collage .cover.deco i { display: block; height: 9px; width: 80%; border-radius: 5px; background: currentColor; opacity: .5; }
.collage .cover.deco i.s { width: 55%; }
.collage .cover.deco i.xs { height: 6px; width: 45%; opacity: .35; }
.collage .cover.deco .grow { flex: 1; }
.login-input { height: 46px; border-radius: 12px; font-size: 14.5px; }
.login-btn { height: 48px; border-radius: 12px; font-size: 15px; }
.login-error { margin-top: -8px; font-size: 13px; font-weight: 700; color: var(--danger); }
.login-error:empty { display: none; }
.login-foot { display: flex; flex-direction: column; gap: 6px; padding-top: 16px; border-top: 1px solid var(--surface2); font-size: 12.5px; line-height: 1.5; }
.check-row { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--soft); line-height: 1.4; cursor: pointer; }
.check-row input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex-shrink: 0; }

/* ---------- accounts and sharing: readers, notes, catalogue, users ---------- */
.text { color: var(--text); }
.soft { color: var(--soft); }
.avatar.xs { width: 22px; height: 22px; font-size: 9px; font-weight: 800; flex-shrink: 0; }
.avatar.dashed { background: transparent; border: 1px dashed var(--dash); color: var(--muted); font-size: 12px; font-weight: 800; flex-shrink: 0; }
.readers { display: flex; flex-direction: column; gap: 2px; padding: 12px; border-radius: 14px; background: var(--bg); }
.readers .eyebrow { margin-bottom: 4px; }
.rdr { display: flex; align-items: center; gap: 8px; height: 28px; font-size: 12.5px; }
.rv { flex-shrink: 0; font-weight: 700; }
.rv.done { color: var(--accent); font-weight: 800; }
.rv.pending, .rv.dropped { color: var(--faint); font-weight: 500; }
.share-note { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 12px; background: var(--bg); font-size: 12.5px; line-height: 1.4; color: var(--soft); }
.share-note svg { flex-shrink: 0; color: var(--accent); }
.share-note.own { background: var(--accent-soft); }
.input[readonly] { background: var(--surface2); border-color: transparent; color: var(--soft); }
.saga-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap; min-height: 24px; }
.sreader { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--soft); }
.effects { margin: 0; padding: 12px 14px 12px 30px; border-radius: 12px; background: oklch(0.22 0.04 25); color: #e6c9c4; font-size: 13px; line-height: 1.6; }
:root[data-theme=light] .effects { background: oklch(0.95 0.03 25); color: oklch(0.4 0.12 25); }
.danger-edge { border-color: oklch(0.45 0.12 25); }
.confirm-ic.soft { background: var(--surface3); color: var(--text); }

.cat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.catcard { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 0; border-radius: 16px; background: var(--surface); color: var(--text); text-align: left; min-width: 0; }
.catcard:hover { background: var(--surface2); }
.catcard.sel { box-shadow: 0 0 0 2px var(--accent); }
.catcard .cc { position: relative; height: 170px; display: flex; }
.catcard .cc > .cover { width: 100%; height: 100%; border-radius: 8px; }
.catcard .cc .stack { position: relative; width: 100%; height: 100%; }
.catcard .cc .stack > .cover { position: absolute; left: 0; bottom: 0; right: 24px; top: 8px; width: auto; height: auto; border-radius: 8px; box-shadow: 0 6px 16px rgba(0, 0, 0, .35); }
.catcard .cc .stack > .back { position: absolute; top: 0; bottom: 8px; width: auto; height: auto; border-radius: 8px; }
.catcard .cc .stack > .b1 { left: 24px; right: 0; opacity: .45; }
.catcard .cc .stack > .b2 { left: 12px; right: 12px; top: 4px; opacity: .7; }
.catcard .kind { position: absolute; top: 8px; left: 8px; height: 20px; padding: 0 8px; border-radius: 10px; background: var(--text); color: var(--bg);
  font-size: 10.5px; font-weight: 800; display: flex; align-items: center; z-index: 2; }
.catcard .have { position: absolute; top: 8px; right: 8px; height: 20px; padding: 0 8px; border-radius: 10px; background: rgba(14, 16, 20, .85); color: var(--accent);
  font-size: 10.5px; font-weight: 800; display: flex; align-items: center; z-index: 2; }
.catcard .kind ~ .have { top: auto; bottom: 8px; }
.catcard .t { font-size: 13px; font-weight: 800; }
.catcard .a { font-size: 11.5px; color: var(--muted); margin-top: -6px; }
.catcard .m { display: flex; justify-content: space-between; gap: 6px; font-size: 11.5px; color: var(--faint); }
.catcard .m b { color: var(--accent); }
.cat-panel { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: 20px; }
.cp-head { display: flex; gap: 14px; }
.cp-head > .cover, .cp-head > .stack { width: 84px; height: 126px; flex-shrink: 0; border-radius: 8px; }
.cp-head > .stack > .cover { width: 100%; height: 100%; border-radius: 8px; }
.cp-title { font: 700 19px/1.15 Literata, Georgia, serif; }
.cp-syn { margin: 0; font-size: 13px; line-height: 1.5; color: var(--soft); display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.tomes { display: flex; flex-direction: column; gap: 2px; padding: 8px; border-radius: 14px; background: var(--bg); max-height: 280px; overflow-y: auto; }
.tome { display: flex; align-items: center; gap: 10px; min-height: 30px; padding: 0 6px; border-radius: 8px; font-size: 12.5px; cursor: pointer; }
.tome:hover { background: var(--surface2); }
.tome input { width: 15px; height: 15px; margin: 0; accent-color: var(--accent); flex-shrink: 0; }
.tome .n { width: 16px; font-weight: 800; color: var(--faint); }
.tome .note { flex-shrink: 0; font-size: 11.5px; color: var(--faint); }
.tome .note.on { color: var(--accent); font-weight: 800; }

.users-table { overflow-x: auto; }
.urow { display: grid; grid-template-columns: minmax(180px, 2.2fr) 1.1fr 0.9fr 1fr 1.4fr minmax(220px, 2fr); gap: 16px; align-items: center;
  padding: 14px 20px; border-top: 1px solid var(--surface2); font-size: 13.5px; min-width: 900px; }
.urow.head { border-top: 0; padding: 12px 20px; font-size: 11px; font-weight: 800; letter-spacing: .1em; color: var(--faint); }
.urow.off { opacity: .55; }
.urow .who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.urow .acts { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.role-admin { color: var(--accent); font-weight: 800; }
.link-btn.danger { color: var(--danger); font-weight: 800; }
.sw-cell { display: flex; align-items: center; gap: 10px; }
.switch { width: 42px; height: 24px; flex-shrink: 0; border-radius: 12px; border: 0; padding: 3px; display: flex; justify-content: flex-start; background: var(--line3); }
.switch span { width: 18px; height: 18px; border-radius: 50%; background: #fff; }
.switch.on { background: var(--accent); justify-content: flex-end; }
.switch:disabled { opacity: .5; }
.invite-row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-radius: 16px; border: 1px dashed var(--line3); font-size: 13.5px; flex-wrap: wrap; }
.invite-row .btn svg, .link-box .btn svg { margin-right: 6px; }
.info-box { display: flex; gap: 14px; padding: 16px 20px; font-size: 13px; line-height: 1.55; color: var(--muted); }
.info-box svg { flex-shrink: 0; color: var(--accent); margin-top: 1px; }
.pill svg { width: 12px; height: 12px; vertical-align: -2px; margin-right: 5px; }
.link-box { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px; background: var(--bg); border: 1px solid var(--line); }

/* ---------- reader ---------- */
.reader { height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
.r-head { height: 64px; flex-shrink: 0; display: flex; align-items: center; gap: 16px; padding: 0 24px; border-bottom: 1px solid var(--surface2); }
.r-head .back { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 10px; border-radius: 18px; border: 0;
  background: var(--surface); color: var(--text); font-size: 13px; font-weight: 700; flex-shrink: 0; }
.r-head .title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 1px; text-align: center; }
.r-head .title b { font-size: 14px; font-weight: 800; max-width: 100%; }
.r-head .title span { font-size: 12px; color: var(--muted); max-width: 100%; }
.r-head .saved { font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.r-tools { display: flex; gap: 6px; flex-shrink: 0; }
.r-tools button { width: 40px; height: 40px; border-radius: 12px; border: 0; display: flex; align-items: center; justify-content: center;
  background: transparent; color: var(--muted); padding: 0; }
.r-tools button:hover { color: var(--text); background: var(--surface); }
.r-tools button.on { background: rgba(240, 180, 76, .16); color: var(--accent); }
.r-body { flex: 1; min-height: 0; display: flex; position: relative; }
.r-stage { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; padding: 28px 24px 18px; gap: 16px; }
.r-row { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 18px; width: 100%; }
.r-nav { border: 0; flex-shrink: 0; width: 44px; height: 44px; border-radius: 22px; background: var(--surface); color: var(--muted);
  display: flex; align-items: center; justify-content: center; padding: 0; }
.r-nav:hover { color: var(--text); }
.r-page { flex: 1; min-width: 0; max-width: 700px; height: 100%; max-height: 1000px; background: var(--page); color: var(--page-ink); border-radius: 6px;
  padding: 40px 48px 20px; display: flex; flex-direction: column; font-family: var(--serif); line-height: 1.75; position: relative; }
:root[data-theme=light] .r-page { box-shadow: 0 2px 6px rgba(0, 0, 0, .06), 0 18px 40px rgba(0, 0, 0, .08); }
.r-text { flex: 1; min-height: 0; overflow: hidden; position: relative; }
.r-text p { margin: 0 0 .9em; text-indent: 1.4em; text-align: justify; hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
.r-text > :first-child { margin-top: 0; }
.r-text p.cont { text-indent: 0; }
.r-text p.brk { text-align-last: justify; }
.r-text p.h { text-indent: 0; text-align: left; font-weight: 700; font-size: 1.3em; line-height: 1.3; margin: .2em 0 .8em; }
.r-text .ch-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 1.4em; font-family: Manrope, sans-serif; }
.r-text .ch-head .lbl { font-size: 11px; font-weight: 800; letter-spacing: .14em; color: var(--page-faint); }
.r-text .ch-head .ttl { font-family: var(--serif); font-weight: 700; font-size: 1.5em; line-height: 1.2; }
.r-text .s { border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; transition: background .2s, box-shadow .2s; }
.r-text .s.on { background: rgba(240, 180, 76, .2); box-shadow: 0 0 0 3px rgba(240, 180, 76, .2); color: var(--text); }
:root[data-theme=light] .r-text .s.on { background: rgba(240, 180, 76, .3); box-shadow: 0 0 0 3px rgba(240, 180, 76, .3); }
.r-text .w.on { box-shadow: inset 0 -2px 0 var(--accent); }
.r-measure { position: absolute; left: -10000px; top: 0; visibility: hidden; font-family: var(--serif); line-height: 1.75; }
.r-foot { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; min-height: 30px; padding-top: 8px;
  font: 500 11.5px Manrope, sans-serif; color: var(--page-faint); flex-shrink: 0; }
.r-scrub { width: 100%; max-width: 700px; display: flex; align-items: center; gap: 12px; flex-shrink: 0; font-size: 11.5px; color: var(--faint); }
.r-scrub input { flex: 1; min-width: 0; }
.r-scrub .lbl { white-space: nowrap; }
.r-scrub .mnav { display: none; }
.r-side { width: 340px; flex-shrink: 0; overflow-y: auto; background: var(--panel); border-left: 1px solid var(--surface2); padding: 20px;
  display: flex; flex-direction: column; gap: 20px; }
.r-side .side-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 16px; font-weight: 800; }
.r-side .grid6 { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.r-side .grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.opt { border: 1px solid var(--line2); background: var(--surface); color: var(--text); border-radius: 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; padding: 0; }
.opt.on { border-color: var(--accent); background: var(--accent-soft); }
.src-box { display: flex; flex-direction: column; gap: 8px; padding: 14px; border-radius: 14px; background: var(--surface); font-size: 12.5px; line-height: 1.5; color: var(--soft); }
.toc { display: flex; flex-direction: column; gap: 2px; }
.toc button { text-align: left; border: 0; background: transparent; padding: 10px 12px; border-radius: 10px; font-size: 13px; line-height: 1.4; display: flex; gap: 10px; color: var(--soft); }
.toc button:hover { background: var(--surface); }
.toc button.on { background: var(--surface2); color: var(--text); font-weight: 700; }
.toc .n { width: 22px; flex-shrink: 0; font-weight: 800; color: var(--faint); }
.toc button.on .n { color: var(--accent); }
.r-bar { flex-shrink: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px; min-height: 84px; padding: 12px 28px;
  border-top: 1px solid var(--surface2); background: var(--panel); }
.r-ctl { display: flex; align-items: center; gap: 8px; }
.r-ctl button { border: 0; width: 38px; height: 38px; border-radius: 19px; background: transparent; color: var(--soft); display: flex;
  align-items: center; justify-content: center; padding: 0; }
.r-ctl .skip { width: auto; height: 34px; padding: 0 10px; border-radius: 17px; background: var(--surface2); font-size: 12px; font-weight: 800; }
.r-ctl .play { width: 52px; height: 52px; border-radius: 26px; background: var(--accent); color: #0e1014; }
.r-live { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 3px; }
.r-live .st { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.r-live .wd { font: 600 14px var(--serif); color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-remain { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.r-remain b { color: var(--text); font-weight: 800; }
.r-voice { display: flex; align-items: center; gap: 8px; }
.r-voice .v { height: 32px; padding: 0 12px; border-radius: 16px; background: var(--surface2); font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; }
.r-voice .sp { height: 32px; padding: 0 10px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); font-size: 12.5px; font-weight: 800; display: inline-flex; align-items: center; }
.sel-pop { position: fixed; transform: translate(-50%, -100%); z-index: 65; display: flex; flex-direction: column; align-items: center; }
.sel-pop button { border: 0; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 12px; background: var(--surface3);
  color: var(--text); font-weight: 700; font-size: 13.5px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); white-space: nowrap; }
.sel-pop .ic { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #0e1014; display: flex; align-items: center; justify-content: center; }
.sel-pop .ic svg { width: 11px; height: 11px; }
.sel-pop .tip { width: 10px; height: 10px; background: var(--surface3); transform: rotate(45deg); margin-top: -5px; }
.r-page.marking .r-text { cursor: text; }
.r-page.marking .r-text ::selection { background: rgba(231, 200, 79, .45); }
/* highlights: underlined in their colour */
.r-text mark.hl { background: none; color: inherit; text-decoration: underline; text-decoration-color: var(--hl); text-decoration-thickness: 3px;
  text-underline-offset: 4px; text-decoration-skip-ink: none; cursor: pointer; }
.hl-list { display: flex; flex-direction: column; gap: 10px; }
.hl-card { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 12px; background: var(--surface); cursor: pointer; }
.hl-card:hover { background: var(--surface2); }
.hl-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--faint); }
.hl-meta .pg { display: flex; align-items: center; gap: 8px; }
.hl-edit svg { width: 14px; height: 14px; }
.hl-text { font: 400 14px/1.5 var(--serif); color: var(--page-ink); padding-left: 10px; border-left: 3px solid var(--dot); overflow-wrap: anywhere; }
.hl-note { font-size: 12.5px; line-height: 1.45; color: var(--soft); white-space: pre-wrap; overflow-wrap: anywhere; }
.hl-quote { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--bg); font: 400 15px/1.55 var(--serif); color: var(--page-ink);
  max-height: 30vh; overflow-y: auto; overflow-wrap: anywhere; }
.hl-quote span { text-decoration: underline; text-decoration-color: var(--dot); text-decoration-thickness: 3px; text-underline-offset: 4px; }
.hl-colors { display: flex; flex-wrap: wrap; gap: 10px; }
.hl-sw { width: 40px; height: 40px; border-radius: 20px; border: 0; background: var(--dot); padding: 0; }
.hl-sw.on { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--text); }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .cat-layout { grid-template-columns: minmax(0, 1fr); }
  .cat-panel { position: static; order: -1; }
  .cat-panel.empty-panel { display: none; }
  .cat-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .catcard .cc { height: 150px; }
  .shell { display: block; padding-bottom: 72px; }
  .rail { display: none; }
  .topbar { display: flex; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 30; height: 56px; padding: 0 16px;
    background: var(--bg); border-bottom: 1px solid var(--surface2); }
  .topbar .logo-mark { width: 34px; height: 34px; border-radius: 10px; }
  .topbar b { flex: 1; font-size: 16px; font-weight: 800; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--bg); border-top: 1px solid var(--surface2);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around; }
  .tabbar .nav-btn { width: auto; flex: 1; height: 52px; }
  .main { padding: 18px 16px 40px; }
  .page { gap: 18px; }
  .page-head h1, .h1 { font-size: 26px; }
  .tools { width: 100%; }
  .tools .pill-input { flex: 1; min-width: 150px; }
  .boards { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 20px 14px; }
  .hero { flex-wrap: wrap; gap: 16px; padding: 18px; }
  .hero .cover { width: 84px; height: 126px; }
  .hero .info { min-width: 180px; }
  .hero .ttl { font-size: 24px; }
  .order { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 18px 12px; }
  .ocard .stack { width: 100%; }
  .ocard .rm { display: flex; }
  .modal-bg { padding: 10px; align-items: flex-end; }
  .modal { max-height: 94vh; border-radius: 20px; }
  .detail-grid { flex-direction: column; padding: 18px; gap: 18px; }
  .detail-side { width: 100%; display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; align-items: start; }
  .detail-side > .cover { height: 165px; grid-row: span 5; padding: 10px; }
  .detail-side > .cover .c-title { font-size: 14px; }
  .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal .m-head, .modal .m-body { padding-left: 18px; padding-right: 18px; }
  .modal .m-foot { padding: 12px 18px; }
  .pad { padding: 18px; }
  .opt-row { flex-direction: column; align-items: stretch; }
  .opt-row select { max-width: none; }
  .login { flex-direction: column; gap: 28px; justify-content: flex-start; padding-top: 32px; }
  .collage { display: none; }
  .login-box h1 { font-size: 30px; }
  .toast { bottom: 150px; }
  /* reader */
  .r-head { gap: 8px; padding: 0 10px; height: 56px; }
  .r-head .back { padding: 0 10px; }
  .r-head .back .lbl, .r-head .saved { display: none; }
  .r-head .title { align-items: flex-start; text-align: left; }
  .r-tools { gap: 2px; }
  .r-tools button { width: 36px; height: 36px; }
  .r-stage { padding: 10px 8px 8px; gap: 8px; }
  .r-row { gap: 0; }
  .r-row > .r-nav { display: none; }
  .r-scrub .mnav { display: inline-flex; width: 34px; height: 34px; }
  .r-page { padding: 28px 22px 10px; max-height: none; }
  .r-side { position: absolute; right: 0; top: 0; bottom: 0; width: min(340px, 92vw); z-index: 20; box-shadow: var(--pop-shadow); }
  .r-bar { padding: 10px 12px; gap: 8px 12px; justify-content: center; min-height: 0; }
  .r-live { order: -1; min-width: 100%; }
  .r-remain { flex-direction: row; gap: 14px; order: 1; min-width: 100%; justify-content: center; }
  .r-voice { display: none; }
}
@media (max-width: 420px) {
  .r-ctl .skip { padding: 0 7px; }
  .r-tools button { width: 32px; }
}
