/* NovelHub v2 — design system and components. No build step; works in every evergreen browser. */

/* ---------------------------------------------------------------- fonts (self-hosted, SIL OFL) */
@font-face {
  font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("assets/fonts/inter-latin-wght-normal.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: "Fraunces"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("assets/fonts/fraunces-latin-opsz-normal.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-style: normal; font-weight: 200 900; font-display: swap;
  src: url("assets/fonts/literata-latin-wght-normal.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-style: italic; font-weight: 200 900; font-display: swap;
  src: url("assets/fonts/literata-latin-wght-italic.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;
}

/* ---------------------------------------------------------------- tokens */
:root {
  --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-read: "Literata", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;

  --r-xs: 6px; --r-sm: 9px; --r-md: 13px; --r-lg: 18px; --r-xl: 26px; --r-pill: 999px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --hdr-h: 64px;
  --wrap: 1320px;
  --gutter: clamp(16px, 4vw, 40px);
  --player-h: 0px;

  /* dark (default) */
  color-scheme: dark;
  --bg: #0c0a13;
  --bg-glow: rgba(124, 58, 237, .16);
  --surface: #15121e;
  --surface-2: #1c1828;
  --surface-3: #262134;
  --overlay: rgba(12, 10, 19, .72);
  --line: rgba(255, 255, 255, .075);
  --line-2: rgba(255, 255, 255, .13);
  --text: #f2eff9;
  --text-2: #b9b3cc;
  --text-3: #8d87a3;
  --accent: #b69cff;
  --accent-2: #d8c8ff;
  --accent-fill: #7c3aed;
  --accent-fill-2: #9d4edd;
  --accent-soft: rgba(167, 139, 250, .15);
  --accent-line: rgba(167, 139, 250, .42);
  --on-accent: #ffffff;
  --ok: #4ade80; --ok-soft: rgba(74, 222, 128, .14);
  --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, .14);
  --bad: #fb7185; --bad-soft: rgba(251, 113, 133, .14);
  --hl: rgba(167, 139, 250, .26);
  --hl-line: rgba(196, 175, 255, .75);
  --focus: #c4b0ff;
  --shimmer: rgba(255, 255, 255, .06);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, .5), 0 8px 22px -10px rgba(0, 0, 0, .75);
  --shadow-card-hover: 0 2px 4px rgba(0, 0, 0, .5), 0 22px 40px -14px rgba(0, 0, 0, .85), 0 0 0 1px rgba(182, 156, 255, .18);
  --shadow-pop: 0 18px 50px -12px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .06);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23b9b3cc' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f5fb;
  --bg-glow: rgba(124, 58, 237, .09);
  --surface: #ffffff;
  --surface-2: #f1eef8;
  --surface-3: #e7e2f2;
  --overlay: rgba(247, 245, 251, .8);
  --line: rgba(30, 18, 60, .09);
  --line-2: rgba(30, 18, 60, .16);
  --text: #17121f;
  --text-2: #4b4560;
  --text-3: #68627c;
  --accent: #6d28d9;
  --accent-2: #5b21b6;
  --accent-fill: #7c3aed;
  --accent-fill-2: #9333ea;
  --accent-soft: rgba(124, 58, 237, .1);
  --accent-line: rgba(124, 58, 237, .38);
  --on-accent: #ffffff;
  --ok: #166534; --ok-soft: rgba(21, 128, 61, .1);
  --warn: #b45309; --warn-soft: rgba(180, 83, 9, .1);
  --bad: #be123c; --bad-soft: rgba(190, 18, 60, .09);
  --hl: rgba(124, 58, 237, .14);
  --hl-line: rgba(109, 40, 217, .55);
  --focus: #7c3aed;
  --shimmer: rgba(255, 255, 255, .7);
  --shadow-sm: 0 1px 2px rgba(30, 18, 60, .08);
  --shadow-card: 0 1px 2px rgba(30, 18, 60, .1), 0 10px 24px -12px rgba(30, 18, 60, .32);
  --shadow-card-hover: 0 2px 4px rgba(30, 18, 60, .1), 0 22px 40px -16px rgba(50, 20, 110, .42), 0 0 0 1px rgba(124, 58, 237, .14);
  --shadow-pop: 0 20px 50px -14px rgba(30, 18, 60, .35), 0 0 0 1px rgba(30, 18, 60, .08);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234b4560' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
[data-theme="sepia"] {
  color-scheme: light;
  --bg: #f4ecda;
  --bg-glow: rgba(150, 90, 30, .08);
  --surface: #fbf6ea;
  --surface-2: #efe5cf;
  --surface-3: #e6d8ba;
  --overlay: rgba(244, 236, 218, .82);
  --line: rgba(90, 60, 20, .13);
  --line-2: rgba(90, 60, 20, .22);
  --text: #35281a;
  --text-2: #5b4731;
  --text-3: #6f5a40;
  --accent: #7a3b87;
  --accent-2: #632d70;
  --accent-fill: #7a3b87;
  --accent-fill-2: #8f4a7a;
  --accent-soft: rgba(122, 59, 135, .1);
  --accent-line: rgba(122, 59, 135, .38);
  --on-accent: #ffffff;
  --ok: #355f24; --ok-soft: rgba(63, 111, 42, .12);
  --warn: #8a5a00; --warn-soft: rgba(138, 90, 0, .12);
  --bad: #a4302a; --bad-soft: rgba(164, 48, 42, .1);
  --hl: rgba(196, 140, 40, .26);
  --hl-line: rgba(150, 100, 20, .6);
  --focus: #7a3b87;
  --shimmer: rgba(255, 250, 238, .75);
  --shadow-sm: 0 1px 2px rgba(80, 50, 10, .1);
  --shadow-card: 0 1px 2px rgba(80, 50, 10, .12), 0 10px 24px -12px rgba(80, 50, 10, .35);
  --shadow-card-hover: 0 2px 4px rgba(80, 50, 10, .12), 0 22px 40px -16px rgba(80, 50, 10, .45), 0 0 0 1px rgba(122, 59, 135, .16);
  --shadow-pop: 0 20px 50px -14px rgba(80, 50, 10, .38), 0 0 0 1px rgba(80, 50, 10, .1);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235b4731' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--hdr-h) + 16px); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
  font: 400 15px/1.55 var(--font-ui); font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto 0; height: 560px; z-index: -1; pointer-events: none;
  background: radial-gradient(60% 70% at 12% -10%, var(--bg-glow), transparent 70%), radial-gradient(50% 60% at 95% -20%, var(--bg-glow), transparent 70%);
}
body.has-player { padding-bottom: calc(var(--player-h) + env(safe-area-inset-bottom, 0px)); }
img, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent-2); }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 650; letter-spacing: -.012em; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus { outline: none; }
:focus-visible { outline: 2.5px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[tabindex="-1"]:focus { outline: none; }
::selection { background: rgba(167, 139, 250, .38); }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding-inline: var(--gutter); }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.nowrap { white-space: nowrap; }
.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 16px; height: 16px; }
.i-xs { width: 13px; height: 13px; stroke-width: 2.1; }
.i-lg { width: 24px; height: 24px; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: var(--r-sm); background: var(--accent-fill); color: #fff; font-weight: 600; text-decoration: none; transition: top .2s; }
.skip:focus { top: 12px; color: #fff; }

/* ---------------------------------------------------------------- buttons, pills, chips, inputs */
.btn {
  --b-bg: var(--surface-2); --b-fg: var(--text); --b-bd: var(--line-2);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: var(--r-pill);
  border: 1px solid var(--b-bd); background: var(--b-bg); color: var(--b-fg);
  font-size: 14.5px; font-weight: 600; line-height: 1; text-decoration: none; white-space: nowrap;
  transition: background .18s, border-color .18s, color .18s, transform .18s var(--ease), box-shadow .18s;
  -webkit-tap-highlight-color: transparent; user-select: none;
}
.btn:hover { --b-bg: var(--surface-3); color: var(--b-fg); }
.btn:active { transform: translateY(1px) scale(.985); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.btn-primary {
  --b-fg: var(--on-accent); --b-bd: transparent;
  background: linear-gradient(135deg, var(--accent-fill), var(--accent-fill-2));
  box-shadow: 0 6px 20px -8px rgba(124, 58, 237, .7), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-primary:hover { background: linear-gradient(135deg, var(--accent-fill), var(--accent-fill-2)); filter: brightness(1.08) saturate(1.05); color: var(--on-accent); }
.btn-ghost { --b-bg: transparent; --b-bd: transparent; color: var(--text-2); }
.btn-ghost:hover { --b-bg: var(--surface-2); color: var(--text); }
.btn-outline { --b-bg: transparent; }
.btn-danger { --b-fg: var(--bad); }
.btn-sm { min-height: 34px; padding: 0 13px; font-size: 13.5px; gap: 6px; }
.btn-xs { min-height: 28px; padding: 0 10px; font-size: 12.5px; gap: 5px; }
.btn-lg { min-height: 50px; padding: 0 24px; font-size: 15.5px; }
.btn-icon { width: 40px; min-height: 40px; padding: 0; border-radius: 50%; }
.btn-icon.btn-sm { width: 34px; min-height: 34px; }
.btn.is-on { --b-bg: var(--accent-soft); --b-bd: var(--accent-line); color: var(--accent); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%;
  border: 1px solid transparent; background: transparent; color: var(--text-2);
  transition: background .18s, color .18s, border-color .18s;
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn[aria-expanded="true"] { background: var(--surface-2); color: var(--text); border-color: var(--line); }

.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--r-xs);
  font-size: 11px; font-weight: 700; letter-spacing: .045em; text-transform: uppercase; line-height: 1; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line);
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill-lang { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.pill-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill-accent { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.pill-plain { text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 0 14px; border-radius: var(--r-pill);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  font-size: 13.5px; font-weight: 550; text-decoration: none; white-space: nowrap;
  transition: background .18s, border-color .18s, color .18s;
}
.chip:hover { background: var(--surface-2); border-color: var(--accent-line); color: var(--text); }
.chip .count { font-size: 12px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="true"], .chip.is-on { background: var(--accent-fill); border-color: transparent; color: #fff; }
.chip[aria-pressed="true"] .count, .chip.is-on .count { color: rgba(255, 255, 255, .94); }
.chip-sm { min-height: 30px; padding: 0 11px; font-size: 12.5px; }
.tag-link { color: var(--text-2); text-decoration: none; font-size: 13px; padding: 4px 10px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); }
.tag-link:hover { color: var(--text); border-color: var(--accent-line); }

.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 0 14px; border-radius: var(--r-md);
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  font-size: 15px; transition: border-color .18s, box-shadow .18s, background .18s;
}
.textarea { padding: 12px 14px; min-height: 180px; resize: vertical; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--accent-line); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); outline: none; }
.select { appearance: none; -webkit-appearance: none; padding-right: 38px; background: var(--surface) var(--select-arrow) no-repeat right 14px center; cursor: pointer; text-overflow: ellipsis; }
.select option { background: var(--surface); color: var(--text); }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
.field { display: grid; gap: 6px; }
.field > span, .label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.search-field { position: relative; }
.search-field > .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search-field .input { padding-left: 42px; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); }
.seg button { min-height: 32px; padding: 0 12px; border: 0; border-radius: var(--r-pill); background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; white-space: nowrap; }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.seg-block { display: flex; width: 100%; }
.seg-block button { flex: 1; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; border: 0; background: none; padding: 0; color: var(--text); font-size: 14px; font-weight: 550; text-align: left; }
.switch .track { position: relative; width: 40px; height: 24px; flex: none; border-radius: 99px; background: var(--surface-3); border: 1px solid var(--line-2); transition: background .2s; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform .2s var(--ease-out); }
.switch[aria-checked="true"] .track { background: var(--accent-fill); border-color: transparent; }
.switch[aria-checked="true"] .track::after { transform: translateX(16px); }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
.spinner-lg { width: 34px; height: 34px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }
kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; border: 1px solid var(--line-2); border-bottom-width: 2px; background: var(--surface-2); color: var(--text-2); font: 600 11.5px/1 var(--font-ui); }

/* ---------------------------------------------------------------- header */
.hdr {
  position: sticky; top: 0; z-index: 40; height: var(--hdr-h);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid var(--line);
}
.hdr-in { height: 100%; display: flex; align-items: center; gap: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; flex: none; margin-right: 10px; border-radius: 10px; }
.brand:hover { color: var(--text); }
.brand .gem { width: 30px; height: 30px; filter: drop-shadow(0 4px 10px rgba(124, 58, 237, .45)); }
.brand .word { font: 650 21px/1 var(--font-display); letter-spacing: -.02em; }
.brand .word span { background: linear-gradient(135deg, var(--accent), var(--accent-fill-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav { display: flex; gap: 2px; }
.nav a { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 13px; border-radius: var(--r-pill); color: var(--text-2); font-weight: 560; font-size: 14.5px; text-decoration: none; transition: background .18s, color .18s; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.nav a .i { width: 17px; height: 17px; opacity: .8; }
.hdr-search { position: relative; margin-left: auto; flex: 0 1 360px; min-width: 0; }
.hdr-search form { position: relative; }
.hdr-search .i-search { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; width: 18px; height: 18px; }
.hdr-search input {
  width: 100%; height: 40px; padding: 0 44px 0 40px; border-radius: var(--r-pill);
  border: 1px solid var(--line-2); background: color-mix(in srgb, var(--surface) 85%, transparent); color: var(--text); font-size: 14.5px;
  transition: border-color .18s, box-shadow .18s, background .18s;
}
.hdr-search input::placeholder { color: var(--text-3); }
.hdr-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); background: var(--surface); }
.hdr-search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.hdr-search input:focus ~ kbd, .hdr-search input:not(:placeholder-shown) ~ kbd { display: none; }
.hdr-tools { display: flex; align-items: center; gap: 4px; flex: none; }
.search-toggle, .menu-toggle { display: none; }

.sugg {
  position: absolute; top: calc(100% + 8px); right: 0; width: max(100%, 380px); max-width: calc(100vw - 24px); z-index: 50;
  padding: 6px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-pop); border: 1px solid var(--line);
  max-height: min(70vh, 520px); overflow: auto; overscroll-behavior: contain;
}
.sugg-item { display: flex; align-items: center; gap: 12px; padding: 7px 10px 7px 7px; border-radius: var(--r-md); color: var(--text); text-decoration: none; cursor: pointer; }
.sugg-item .cover { width: 36px; flex: none; border-radius: 6px; }
.sugg-item .s-body { min-width: 0; flex: 1; }
.sugg-item .s-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sugg-item .s-title mark { background: none; color: var(--accent); }
.sugg-item .s-meta { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.sugg-item .s-meta > span:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; } /* a long author name */
.sugg-item .pill { height: 18px; padding: 0 5px; font-size: 10px; flex: none; }
.sugg-item[aria-selected="true"], .sugg-item:hover { background: var(--surface-2); }
.sugg-item[aria-selected="true"] { box-shadow: inset 0 0 0 1px var(--accent-line); }
.sugg-all { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-top: 4px; padding: 11px 12px; border-top: 1px solid var(--line); border-radius: 0 0 var(--r-md) var(--r-md); font-size: 13.5px; font-weight: 600; color: var(--accent); }
.sugg-empty { padding: 18px 14px; font-size: 14px; color: var(--text-2); text-align: center; }

.menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 50; min-width: 210px; padding: 6px;
  border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-pop); border: 1px solid var(--line);
}
.menu-title { padding: 8px 10px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.menu-item { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text); font-size: 14px; font-weight: 550; text-align: left; text-decoration: none; }
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); outline: none; }
.menu-item .check { margin-left: auto; color: var(--accent); opacity: 0; }
.menu-item[aria-checked="true"] .check { opacity: 1; }
.swatch { width: 22px; height: 22px; border-radius: 50%; flex: none; border: 1px solid var(--line-2); display: grid; place-items: center; font: 700 10px/1 var(--font-display); }
.swatch-dark { background: #15121e; color: #f2eff9; }
.swatch-light { background: #ffffff; color: #17121f; }
.swatch-sepia { background: #f4ecda; color: #35281a; }
.theme-wrap { position: relative; }

.mnav { position: absolute; top: 100%; left: 0; right: 0; z-index: 39; padding: 10px var(--gutter) 16px; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 24px 40px -20px rgba(0, 0, 0, .6); }
.mnav a { display: flex; align-items: center; gap: 12px; height: 50px; padding: 0 12px; border-radius: var(--r-md); color: var(--text); font-weight: 600; font-size: 16px; text-decoration: none; }
.mnav a:hover, .mnav a[aria-current="page"] { background: var(--surface-2); }
.mnav a[aria-current="page"] { color: var(--accent); }
.mnav .i { color: var(--text-3); }

@media (max-width: 960px) {
  .nav { display: none; }
  .menu-toggle { display: inline-grid; }
}
@media (max-width: 680px) {
  :root { --hdr-h: 58px; }
  .brand .word { font-size: 19px; }
  .brand .gem { width: 27px; height: 27px; }
  .search-toggle { display: inline-grid; }
  .hdr-search { position: absolute; left: 0; right: 0; top: 100%; margin: 0; padding: 10px var(--gutter) 12px; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: 0 24px 40px -20px rgba(0, 0, 0, .5); display: none; flex: none; }
  .hdr.search-open .hdr-search { display: block; }
  .hdr-search kbd { display: none; }
  .hdr-search input { height: 44px; font-size: 16px; }
  .sugg { position: static; width: 100%; max-width: none; margin-top: 8px; box-shadow: none; border: 1px solid var(--line); }
  .hdr-tools { margin-left: auto; }
}

/* ---------------------------------------------------------------- page structure */
main { flex: 1; width: 100%; padding-bottom: 56px; }
main:focus { outline: none; }
.page { padding-top: 26px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-title { font: 600 clamp(28px, 4.2vw, 40px)/1.08 var(--font-display); letter-spacing: -.022em; }
.page-sub { margin-top: 6px; color: var(--text-2); font-size: 15px; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 13.5px; color: var(--text-3); margin-bottom: 14px; }
.crumbs a { color: var(--text-2); text-decoration: none; }
.crumbs a:hover { color: var(--text); text-decoration: underline; }
.crumbs .i { width: 14px; height: 14px; }
.sec { margin-top: 48px; }
.sec:first-child { margin-top: 0; }
#bGut > .sec:first-child { margin-top: 44px; } /* search results: the Gutenberg block sits under the library results */
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.sec-title { font: 600 clamp(21px, 2.4vw, 25px)/1.15 var(--font-display); letter-spacing: -.015em; }
.sec-title .lang-native { color: var(--text-3); font-weight: 500; }
.sec-sub { margin-top: 4px; font-size: 13.5px; color: var(--text-3); }
.sec-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.more-link { display: inline-flex; align-items: center; gap: 4px; padding: 6px 4px 6px 10px; border-radius: var(--r-pill); color: var(--text-2); font-size: 14px; font-weight: 600; text-decoration: none; }
.more-link:hover { color: var(--accent); }
button.more-link { background: none; border: 0; cursor: pointer; font-family: inherit; padding: 6px 10px; }
/* the mature-novels switch is a quiet text link at the end of the stats strip (it only renders when something is hidden or shown) */
.mature-btn { display: inline-flex; align-items: center; gap: 7px; min-height: 28px; padding: 2px 8px; margin: -2px -8px; border-radius: var(--r-pill); border: 0; background: none; color: var(--text-2); font: inherit; font-size: 13.5px; font-weight: 600; text-align: left; cursor: pointer; text-decoration: underline dotted; text-decoration-color: var(--line-2); text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.mature-btn:hover { color: var(--accent); text-decoration-color: currentColor; }
.mature-btn .i { width: 16px; height: 16px; flex: none; color: var(--accent); }
@media (pointer: coarse) { .mature-btn { min-height: 40px; } }
.rail-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); display: none; place-items: center; transition: background .18s, opacity .18s; }
.rail-btn:hover:not(:disabled) { background: var(--surface-3); }
.rail-btn:disabled { opacity: .35; }
@media (hover: hover) and (pointer: fine) and (min-width: 561px) { .has-overflow .rail-btn { display: inline-grid; } }
.sec-head > div:first-child { min-width: 0; }

/* ---------------------------------------------------------------- covers */
.cover {
  position: relative; aspect-ratio: 2 / 3; width: 100%; border-radius: var(--r-md); overflow: hidden; isolation: isolate;
  background: var(--surface-2); container-type: inline-size;
}
.cover > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .5s var(--ease), transform .6s var(--ease-out); z-index: 1; }
.cover.is-loaded > img { opacity: 1; }
.cover.is-fallback > img { display: none; }
.cover::before { /* shimmer skeleton */
  content: ""; position: absolute; inset: 0; z-index: 0; opacity: 0; transition: opacity .35s;
  background: linear-gradient(105deg, transparent 30%, var(--shimmer) 50%, transparent 70%) var(--surface-2);
  background-size: 250% 100%;
}
.cover.is-loading::before { opacity: 1; animation: shimmer 1.5s linear infinite; }
@keyframes shimmer { from { background-position: 130% 0; } to { background-position: -30% 0; } }
.cover::after { /* hairline that sits above the art, like a printed jacket edge */
  content: ""; position: absolute; inset: 0; z-index: 4; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .09), inset 0 1px 0 rgba(255, 255, 255, .08);
}
[data-theme="light"] .cover::after, [data-theme="sepia"] .cover::after { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
/* book-like covers in cards, the hero and the novel page: a soft spine shadow and fold highlight on the left edge
   (kept under the pills and the chapter scrim) */
.card .cover::after, .slide-cover .cover::after, .nv-cover .cover::after {
  z-index: 2;
  background: linear-gradient(90deg, rgba(0, 0, 0, .26) 0, rgba(0, 0, 0, .06) 1.5%, rgba(255, 255, 255, .16) 2.4%, rgba(255, 255, 255, .03) 4.6%, rgba(0, 0, 0, .07) 5.6%, transparent 9%);
}

/* designed fallback cover: serif title on a jewel-tone gradient, faint pattern, NovelHub mark */
.fb {
  position: absolute; inset: 0; z-index: 0; display: flex; flex-direction: column; padding: 11% 10% 9%;
  color: #fff; opacity: 0; transition: opacity .4s var(--ease);
  background:
    radial-gradient(120% 70% at 100% 0%, color-mix(in srgb, var(--c1) 55%, #fff 0%) 0%, transparent 62%),
    radial-gradient(90% 60% at 0% 100%, rgba(0, 0, 0, .35), transparent 70%),
    linear-gradient(158deg, var(--c1), var(--c2));
}
.cover.is-fallback .fb { opacity: 1; }
.cover.is-fallback::before { opacity: 0; animation: none; }
/* a cover that is still loading after a moment (slow connection, or a lazy image not started yet) shows its designed
   cover instead of an empty shimmer; the real image then fades in over it (keep-fb holds it underneath meanwhile) */
.cover.is-loading .fb { animation: fb-wait .5s var(--ease) .7s both; }
.cover.keep-fb .fb { opacity: 1; }
@keyframes fb-wait { from { opacity: 0; } to { opacity: 1; } }
.fb::before { /* pattern */
  content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .16) 1px, transparent 1.3px),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, .035) 0 1px, transparent 1px 10px);
  background-size: 12px 12px, auto;
  -webkit-mask-image: linear-gradient(170deg, #000 0%, rgba(0, 0, 0, .25) 70%); mask-image: linear-gradient(170deg, #000 0%, rgba(0, 0, 0, .25) 70%);
}
.fb::after { /* inner frame */
  content: ""; position: absolute; inset: 5.5cqi; border: 1px solid rgba(255, 255, 255, .2); border-radius: calc(var(--r-md) - 4px); pointer-events: none;
}
.fb > * { position: relative; }
.fb-mark { display: flex; align-items: center; gap: 4px; font: 700 max(7px, 5.2cqi)/1 var(--font-ui); letter-spacing: .16em; text-transform: uppercase; color: rgba(255, 255, 255, .72); }
.fb-mark svg { width: max(8px, 6.5cqi); height: max(8px, 6.5cqi); }
.fb-title {
  margin-top: auto; font: 600 clamp(9px, var(--fs, 12.2cqi), 34px)/1.08 var(--font-display); letter-spacing: -.01em;
  text-wrap: balance; overflow-wrap: break-word; text-shadow: 0 1px 12px rgba(0, 0, 0, .3);
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden;
}
/* inside cards the corners carry pills and the bottom carries the chapter scrim: keep the art clear of both */
.cover.has-ov .fb { padding: 21cqi 10cqi 25cqi; }
.cover.has-ov .fb-mark { margin-top: auto; gap: 0; }
.cover.has-ov .fb-mark span { display: none; }
.cover.has-ov .fb-mark svg { width: 9cqi; height: 9cqi; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .35)); }
.cover.has-ov .fb-title { margin-top: 5cqi; -webkit-line-clamp: 5; }
.cover.has-ov .fb-rule { margin: 6cqi 0 4cqi; }
.fb-rule { width: 22%; height: 2px; margin: 8cqi 0 5cqi; border-radius: 2px; background: rgba(255, 255, 255, .55); flex: none; }
.fb-author { font: 600 max(8px, 6.4cqi)/1.25 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: rgba(255, 255, 255, .78); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.25em; }
.fb-mono { display: none; position: absolute; inset: 0; place-items: center; font: 600 46cqi/1 var(--font-display); color: rgba(255, 255, 255, .92); text-shadow: 0 1px 8px rgba(0, 0, 0, .3); }
@container (max-width: 96px) {
  .fb { padding: 0; }
  .fb > :not(.fb-mono) { display: none; }
  .fb-mono { display: grid; }
  .fb::after { inset: 3px; border-radius: 4px; }
}
.cover-xs { border-radius: 6px; }
.cover-xs::after { border-radius: 6px; }

/* ---------------------------------------------------------------- cards */
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--card-min, 152px), 1fr)); gap: 30px clamp(14px, 1.8vw, 22px); }
.grid > li { min-width: 0; }
.card { position: relative; display: flex; flex-direction: column; color: var(--text); text-decoration: none; border-radius: var(--r-md); -webkit-tap-highlight-color: transparent; }
.card:hover { color: var(--text); }
.card .cover { box-shadow: var(--shadow-card); transition: transform .4s var(--ease-out), box-shadow .4s var(--ease-out); }
.card:focus-visible { outline: none; }
.card:focus-visible .cover { outline: 3px solid var(--focus); outline-offset: 3px; }
.cv-top { position: absolute; z-index: 3; top: 7px; left: 7px; right: 7px; display: flex; align-items: flex-start; gap: 6px; pointer-events: none; }
.cv-pill {
  display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 7px; border-radius: 6px;
  font: 700 10.5px/1 var(--font-ui); letter-spacing: .05em; text-transform: uppercase; color: #fff; white-space: nowrap;
  background: rgba(14, 10, 24, .66); -webkit-backdrop-filter: blur(8px) saturate(1.4); backdrop-filter: blur(8px) saturate(1.4);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16);
}
.cv-lang { background: linear-gradient(135deg, rgba(124, 58, 237, .92), rgba(157, 78, 221, .92)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25), 0 2px 8px rgba(0, 0, 0, .3); }
.cv-status { margin-left: auto; }
.cv-status .dot { width: 6px; height: 6px; border-radius: 50%; background: #c4b0ff; box-shadow: 0 0 0 2px rgba(196, 176, 255, .22); }
.cv-status[data-s="Completed"] .dot { background: #4ade80; box-shadow: 0 0 0 2px rgba(74, 222, 128, .25); }
/* Completed is the common state: a quiet dot-only badge so it never hides cover art; Ongoing/Hiatus keep their words */
.cv-status[data-s="Completed"] { padding: 0 6px; }
.cv-status[data-s="Completed"] .txt { display: none; }
.cv-status[data-s="Hiatus"] .dot { background: #fbbf24; box-shadow: 0 0 0 2px rgba(251, 191, 36, .25); }
.cv-pill { flex: none; }
/* narrow covers (phone rails) get proportionally smaller pills */
@container (max-width: 150px) { .cv-top { top: 6px; left: 6px; right: 6px; gap: 4px; } .cv-pill { height: 19px; padding: 0 5px; font-size: 9.5px; letter-spacing: .04em; gap: 4px; } }
@container (max-width: 126px) { .cv-status { padding: 0 5px; } }
/* a long language pill (EN·FR·ES) leaves no room for "Completed": keep just the coloured dot */
/* two language codes + a long status word in a ~132px cover: tighten, keep the words */
@container (max-width: 140px) { .cv-top.is-multi { gap: 3px; top: 5px; left: 5px; right: 5px; } .cv-top.is-multi .cv-pill { padding: 0 4px; font-size: 8.5px; letter-spacing: 0; gap: 3px; } .cv-top.is-multi .cv-status .dot { width: 5px; height: 5px; box-shadow: none; } }
/* never reduce the status to a bare dot: when the language pill is long, the status wraps to a second row */
.cv-top.is-long, .cv-top.is-multi { flex-wrap: wrap; row-gap: 3px; }
@container (max-width: 178px) { .cv-top.is-long .cv-status, .cv-top.is-multi .cv-status { margin-left: 0; } }
/* Completed reads as a tick, not a bare dot (the state is also in the pill's title and the card's screen-reader text) */
.cv-top .cv-status[data-s="Completed"] { aspect-ratio: 1; padding: 0; justify-content: center; }
.cv-top .cv-status[data-s="Completed"] .dot { position: relative; flex: none; width: 13px; height: 13px; background: #4ade80; box-shadow: none; }
.cv-top .cv-status[data-s="Completed"] .dot::after { content: ""; position: absolute; left: 4.3px; top: 1.9px; width: 3.4px; height: 6.4px; border: solid #05290f; border-width: 0 1.8px 1.8px 0; transform: rotate(40deg); }
@container (max-width: 150px) { .cv-top .cv-status[data-s="Completed"] .dot { width: 12px; height: 12px; } .cv-top .cv-status[data-s="Completed"] .dot::after { left: 3.9px; top: 1.6px; } }
.cv-bottom {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: 0; display: grid; align-items: end; justify-items: start;
  padding: 38px 9px 9px; pointer-events: none;
  background: linear-gradient(to top, rgba(8, 6, 14, .88), rgba(8, 6, 14, .45) 55%, transparent);
  color: #fff; font-size: 11.5px; font-weight: 600;
}
.cv-bottom > * { grid-area: 1 / 1; }
.cv-count { display: inline-flex; align-items: center; gap: 5px; min-height: 26px; white-space: nowrap; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); font-variant-numeric: tabular-nums; transition: opacity .2s var(--ease), transform .3s var(--ease-out); }
.cv-count:empty { display: none; }
.cv-count .i { width: 13px; height: 13px; opacity: .85; }
.cv-count .short { display: none; }
@container (max-width: 150px) { .cv-count .full { display: none; } .cv-count .short { display: inline; } }
/* a bilingual novel's other edition ("2,067 chapters · FR 229"), where the cover is wide enough */
.cv-count .cv-more { display: none; opacity: .78; font-weight: 550; }
@container (min-width: 196px) { .cv-count .cv-more { display: inline; } }
.card-cta {
  display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px 0 11px; border-radius: var(--r-pill);
  background: #fff; color: #1a1030; font-size: 12px; font-weight: 700; white-space: nowrap;
  opacity: 0; transform: translateY(8px); transition: opacity .25s var(--ease), transform .3s var(--ease-out);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}
.card-cta .i { width: 13px; height: 13px; stroke-width: 2.4; }
.card-body { padding: 11px 2px 0; min-width: 0; }
.card-title { font-size: 14.5px; font-weight: 620; line-height: 1.32; letter-spacing: -.006em;display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.card-meta { margin-top: 4px; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; min-width: 0; }
.card-meta .cm-g { flex: 0 1 auto; min-width: 0; max-width: 45%; overflow: hidden; text-overflow: ellipsis; }
.card-meta .cm-sep { flex: none; white-space: pre; }
.card-meta .cm-a { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: var(--text-2); }
.card-prog { margin-top: 9px; }
/* Continue cards of different title lengths: the progress bars line up along the bottom of the rail / grid row */
li:has(> .card-cont) { display: flex; }
li:has(> .card-cont) > .card-cont { flex: 1 1 0; min-width: 0; }
.card-cont .card-body { flex: 1 1 auto; display: flex; flex-direction: column; }
.card-cont .card-prog { margin-top: auto; padding-top: 9px; }
.bar { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; width: var(--p, 0%); border-radius: inherit; background: linear-gradient(90deg, var(--accent-fill), var(--accent)); }
.card-prog .prog-txt { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; font-weight: 550; }
.card:focus-visible .card-cta { opacity: 1; transform: none; }
.card:focus-visible .cv-count { opacity: 0; transform: translateY(-6px); }
@media (hover: hover) and (pointer: fine) {
  .card:hover .cover { transform: translateY(-5px); box-shadow: var(--shadow-card-hover); }
  .card:hover .cover > img { transform: scale(1.055); }
  .card:hover .card-cta { opacity: 1; transform: none; }
  .card:hover .cv-count { opacity: 0; transform: translateY(-6px); }
  .card:hover .card-title { color: var(--accent-2); }
  [data-theme="light"] .card:hover .card-title, [data-theme="sepia"] .card:hover .card-title { color: var(--accent); }
}

/* rails */
.rail-wrap { position: relative; }
.rail {
  list-style: none; margin: 0 calc(var(--gutter) * -1); padding: 6px var(--gutter) 16px; display: grid; grid-auto-flow: column;
  grid-auto-columns: clamp(132px, 14.5vw, 176px); gap: clamp(14px, 1.6vw, 20px); overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }
.has-overflow .rail {
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 calc(var(--gutter) * .7), #000 calc(100% - var(--gutter) * 1.2), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 calc(var(--gutter) * .7), #000 calc(100% - var(--gutter) * 1.2), transparent 100%);
}
.rail > li { scroll-snap-align: start; min-width: 0; }
.rail-lg { grid-auto-columns: clamp(150px, 17vw, 200px); }

/* ---------------------------------------------------------------- hero carousel */
.hero { position: relative; margin-top: 22px; border-radius: var(--r-xl); overflow: hidden; isolation: isolate; background: #120d1f; color: #fff; box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .7); }
.hero-track { display: grid; }
.slide { grid-area: 1 / 1; position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: clamp(20px, 4vw, 56px); padding: clamp(26px, 4.6vw, 60px) clamp(22px, 5vw, 64px) clamp(70px, 6vw, 80px); opacity: 0; visibility: hidden; transition: opacity .8s var(--ease), visibility 0s linear .8s; }
.slide.is-active { opacity: 1; visibility: visible; transition: opacity .8s var(--ease), visibility 0s; z-index: 1; }
.slide-bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; background: linear-gradient(135deg, var(--c1, #3b1d74), var(--c2, #140b26)); }
.slide-bg img { position: absolute; inset: -12%; width: 124%; height: 124%; max-width: none; object-fit: cover; filter: blur(42px) saturate(1.5) brightness(.62); transform: scale(1.06); opacity: 0; transition: opacity .8s; }
.slide-bg img.is-loaded { opacity: 1; }
.slide-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10, 6, 20, .9) 0%, rgba(10, 6, 20, .66) 46%, rgba(10, 6, 20, .25) 100%), linear-gradient(0deg, rgba(10, 6, 20, .6), transparent 40%); }
.slide-body { min-width: 0; max-width: 640px; }
.slide-kicker { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: rgba(255, 255, 255, .72); }
.slide-kicker .spark { color: #d8c8ff; }
.slide-title { font: 600 clamp(30px, 4.6vw, 54px)/1.03 var(--font-display); letter-spacing: -.025em; text-wrap: balance; overflow-wrap: anywhere; }
.slide-title a { color: inherit; text-decoration: none; }
.slide-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin-top: 14px; font-size: 14px; color: rgba(255, 255, 255, .78); }
.slide-meta span { display: inline-flex; align-items: center; gap: 6px; }
.slide-meta .i { width: 16px; height: 16px; opacity: .8; }
.slide-desc { margin-top: 16px; max-width: 58ch; font-size: 15.5px; line-height: 1.6; color: rgba(255, 255, 255, .82); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.slide-cta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.btn-light { --b-bg: #fff; --b-fg: #1a1030; --b-bd: transparent; box-shadow: 0 8px 24px -8px rgba(0, 0, 0, .5); }
.btn-light:hover { --b-bg: #f1ebff; color: #1a1030; }
.btn-glass { --b-bg: rgba(255, 255, 255, .12); --b-fg: #fff; --b-bd: rgba(255, 255, 255, .22); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.btn-glass:hover { --b-bg: rgba(255, 255, 255, .2); color: #fff; }
.slide-cover { display: block; width: clamp(170px, 19vw, 248px); transform: rotate(2deg); transition: transform .5s var(--ease-out); border-radius: var(--r-md); }
.slide-cover:hover { transform: rotate(0) translateY(-4px); }
.slide-cover .cover { box-shadow: 0 30px 60px -18px rgba(0, 0, 0, .85), 0 0 0 1px rgba(255, 255, 255, .1); }
.hero-ctrl { position: absolute; z-index: 5; left: clamp(22px, 5vw, 64px); right: clamp(22px, 5vw, 64px); bottom: clamp(20px, 2.6vw, 28px); display: flex; align-items: center; gap: 10px; }
.hero-dots { display: flex; align-items: center; gap: 4px; }
.hero-dot { width: 26px; height: 26px; padding: 0; border: 0; background: none; display: grid; place-items: center; border-radius: 50%; }
.hero-dot::before { content: ""; width: 8px; height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .35); transition: width .35s var(--ease-out), background .3s; }
.hero-dot[aria-current="true"]::before { width: 22px; background: #fff; }
.hero-dot:hover::before { background: rgba(255, 255, 255, .7); }
.hero-ctrl .sp { flex: 1; }
.hero-ctrl .icon-btn { color: rgba(255, 255, 255, .8); width: 38px; height: 38px; border: 1px solid rgba(255, 255, 255, .18); background: rgba(255, 255, 255, .06); }
.hero-ctrl .icon-btn:hover { background: rgba(255, 255, 255, .16); color: #fff; }
/* narrow phones: 5 dots + 3 touch-sized buttons need ~318px, the row has 300px at 360px wide (and 260px at 320px) - tighten, then drop the dots (the arrows stay; the dots keep their touch area) */
@media (max-width: 400px) { .hero-ctrl { gap: 6px; } .hero-dots { gap: 2px; } .hero-dot { width: 22px; } }
@media (max-width: 340px) { .hero-dots { display: none; } }
.hero-stats { display: flex; flex-wrap: wrap; gap: 10px 26px; margin-top: 18px; padding: 0 4px; font-size: 13.5px; color: var(--text-3); }
.hero-stats b { color: var(--text); font-weight: 650; font-variant-numeric: tabular-nums; }
.hero-stats span { display: inline-flex; align-items: center; gap: 7px; }
.hero-stats .i { width: 16px; height: 16px; color: var(--accent); }
@media (min-width: 721px) { .hero-stats .hs-mature { margin-left: auto; } }
@media (max-width: 560px) { .hero-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; } .hero-stats .hs-wide, .hero-stats .hs-mature { grid-column: 1 / -1; } }
@media (max-width: 720px) {
  .hero { margin-top: 14px; border-radius: var(--r-lg); }
  .slide { grid-template-columns: minmax(0, 1fr); padding: 24px 20px 70px; }
  .slide-cover { display: none; }
  .slide-title { font-size: clamp(27px, 7.4vw, 34px); }
  .slide-desc { -webkit-line-clamp: 4; font-size: 14.5px; }
  .slide-cta .btn { min-height: 42px; padding: 0 16px; }
  .slide-cta .btn-details { display: none; }
  .hero-ctrl { left: 14px; right: 14px; bottom: 14px; }
}
@media (max-width: 380px) {
  .slide-cta .btn { padding: 0 14px; font-size: 14px; }
}

/* ---------------------------------------------------------------- updates feed */
.updates { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 12px; }
.upd { display: flex; gap: 14px; align-items: center; height: 100%; padding: 10px 14px 10px 10px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; transition: border-color .18s, background .18s, transform .25s var(--ease-out); }
.upd:hover { border-color: var(--accent-line); color: var(--text); }
@media (hover: hover) { .upd:hover { transform: translateY(-2px); } }
.upd .cover { width: 52px; flex: none; border-radius: 8px; box-shadow: var(--shadow-sm); }
.upd-body { min-width: 0; flex: 1; }
.upd-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.upd-title { font-weight: 620; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upd-top .pill { height: 19px; padding: 0 6px; font-size: 10px; flex: none; }
.upd-line { margin-top: 4px; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upd-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; color: var(--text-3); }
.badge-add { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 11.5px; }
.badge-new { background: var(--ok-soft); color: var(--ok); }

/* genres */
.genre-cloud .chip { min-height: 40px; padding: 0 16px; font-size: 14px; }
.genre-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 14px; }
.gtile { position: relative; display: flex; align-items: center; gap: 12px; height: 132px; padding: 18px 18px 18px 20px; border-radius: var(--r-lg); overflow: hidden; isolation: isolate; color: #fff; text-decoration: none; background: linear-gradient(140deg, var(--c1), var(--c2)); box-shadow: var(--shadow-card); transition: transform .3s var(--ease-out), box-shadow .3s; }
.gtile:hover { color: #fff; transform: translateY(-3px); box-shadow: var(--shadow-card-hover); }
.gtile::before { content: ""; position: absolute; inset: 0; z-index: -1; opacity: .45; background-image: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .14) 1px, transparent 1.3px); background-size: 12px 12px; }
.gtile-txt { position: relative; z-index: 2; min-width: 0; flex: 1; }
.gtile-name { font: 600 21px/1.12 var(--font-display); letter-spacing: -.01em; text-wrap: balance; }
.gtile-count { margin-top: 6px; font-size: 13px; color: rgba(255, 255, 255, .78); font-weight: 600; }
.gtile-stack { position: relative; width: 118px; height: 100%; flex: none; }
.gtile-stack .cover { position: absolute; top: 50%; width: 62px; border-radius: 7px; box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .7); }
.gtile-stack .cover:nth-child(1) { right: 0; transform: translateY(-50%) rotate(8deg); }
.gtile-stack .cover:nth-child(2) { right: 26px; transform: translateY(-50%) rotate(-2deg); z-index: 1; }
.gtile-stack .cover:nth-child(3) { right: 54px; transform: translateY(-50%) rotate(-11deg); z-index: 2; }
.gtile-stack .cover:not(:last-child) .fb-mono { display: none; }
.lang-tiles { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 12px; }
/* the tile fills its grid cell, so a tile whose name wraps does not leave its neighbours shorter */
.lang-tiles > li { display: flex; min-width: 0; }
.lang-tiles .ltile { flex: 1 1 auto; min-width: 0; }
.ltile-name { overflow-wrap: break-word; }
/* the native name sits on its own line in every tile ("Vietnamese ·" / "Tiếng Việt" used to break mid-phrase and leave the dot dangling) */
.ltile-native { display: block; font-size: 13.5px; font-weight: 500; line-height: 1.3; color: var(--text-2); }
.ltile-native .sep { display: none; }
.lbl-short { display: none; }
@media (max-width: 360px) { .lbl-long { display: none; } .lbl-short { display: inline; } }
.ltile { display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); color: var(--text); text-decoration: none; transition: border-color .18s, transform .25s var(--ease-out); }
.ltile:hover { border-color: var(--accent-line); color: var(--text); transform: translateY(-2px); }
.ltile-code { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); font: 700 15px/1 var(--font-ui); letter-spacing: .04em; flex: none; }
.ltile-name { font-weight: 650; font-size: 15.5px; }
.ltile-sub { font-size: 13px; color: var(--text-3); margin-top: 2px; }
/* phone: these come after the base rules (they used to sit before them and never applied) so the name gets room to stay in one piece */
@media (max-width: 560px) {
  .lang-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ltile { padding: 12px; gap: 10px; }
  .ltile .ltile-code { width: 38px; height: 38px; font-size: 13px; border-radius: 10px; }
  .ltile-native { font-size: 12.5px; }
}
@media (max-width: 360px) { .ltile .ltile-code { display: none; } }

/* ---------------------------------------------------------------- browse */
.filters { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); gap: 10px; }
.lang-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.lang-bar .lbl { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-3); margin-right: 4px; }
.result-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 22px 0 18px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.result-count { font-size: 14px; color: var(--text-2); }
.result-count b { color: var(--text); font-weight: 650; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.af { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px 0 12px; border-radius: var(--r-pill); border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 600; }
.af:hover { filter: brightness(1.1); }
.af .i { width: 14px; height: 14px; stroke-width: 2.4; }
@media (max-width: 860px) { .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); } .filters .search-field { grid-column: 1 / -1; } }
@media (max-width: 560px) {
  .lang-bar { flex-wrap: nowrap; overflow-x: auto; margin-inline: calc(var(--gutter) * -1); padding: 2px var(--gutter); scrollbar-width: none;
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent); }
  .lang-bar::-webkit-scrollbar { display: none; }
  .lang-bar .chip { flex: none; }
}
@media (max-width: 520px) { .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); } .filters .f-sort { grid-column: 1 / -1; } }

/* ---------------------------------------------------------------- empty / error / loading */
.empty { display: grid; justify-items: center; gap: 10px; padding: clamp(32px, 6vw, 64px) 20px; text-align: center; border-radius: var(--r-xl); border: 1px dashed var(--line-2); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.empty-ico { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 18px; background: var(--accent-soft); color: var(--accent); margin-bottom: 4px; }
.empty-ico .i { width: 26px; height: 26px; }
.empty h1, .empty h2, .empty h3 { font: 600 21px/1.2 var(--font-display); letter-spacing: -.01em; }
.empty h1 { font-size: clamp(22px, 3vw, 28px); }
.empty p { max-width: 46ch; color: var(--text-2); font-size: 14.5px; }
.empty .btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 8px; }
.empty-sm { padding: 26px 18px; }
.empty-sm .empty-ico { width: 46px; height: 46px; border-radius: 14px; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); color: var(--text-2); font-size: 14px; line-height: 1.5; }
.notice > .i { margin-top: 1px; color: var(--accent); }
.notice-warn { background: var(--warn-soft); border-color: transparent; color: var(--text); }
.notice-warn > .i { color: var(--warn); }
.notice-bad { background: var(--bad-soft); border-color: transparent; color: var(--text); }
.notice-bad > .i { color: var(--bad); }
.notice-ok { background: var(--ok-soft); border-color: transparent; color: var(--text); }
.notice-ok > .i { color: var(--ok); }
.loading-block { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 60px 20px; color: var(--text-2); }
.skel { border-radius: var(--r-md); background: linear-gradient(105deg, transparent 30%, var(--shimmer) 50%, transparent 70%) var(--surface-2); background-size: 250% 100%; animation: shimmer 1.5s linear infinite; }
.skel-line { height: 14px; border-radius: 6px; }
.skel-card .skel-cover { aspect-ratio: 2 / 3; }
.skel-card .skel-line { margin-top: 12px; width: 85%; }
.skel-card .skel-line + .skel-line { margin-top: 8px; width: 55%; }
.skel-hero { height: clamp(300px, 36vw, 420px); border-radius: var(--r-xl); margin-top: 22px; }

/* ---------------------------------------------------------------- novel page */
.nv { position: relative; }
.nv-banner { position: absolute; inset: 0 0 auto 0; height: 440px; overflow: hidden; z-index: -1; pointer-events: none; }
.nv-banner .bg { position: absolute; inset: -60px; background: linear-gradient(135deg, var(--c1), var(--c2)); opacity: .55; }
.nv-banner img { position: absolute; inset: -60px; width: calc(100% + 120px); height: calc(100% + 120px); max-width: none; object-fit: cover; filter: blur(50px) saturate(1.4); opacity: 0; transition: opacity .8s; }
.nv-banner img.is-loaded { opacity: .55; }
[data-theme="light"] .nv-banner img.is-loaded, [data-theme="sepia"] .nv-banner img.is-loaded { opacity: .38; }
.nv-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, color-mix(in srgb, var(--bg) 35%, transparent) 0%, var(--bg) 92%); }
.nv-head { display: grid; grid-template-columns: clamp(170px, 20vw, 250px) minmax(0, 1fr); gap: clamp(22px, 4vw, 48px); align-items: start; padding-top: 30px; }
[data-theme="light"] .nv-banner .bg, [data-theme="sepia"] .nv-banner .bg { opacity: .28; }
@media (min-width: 1024px) { .panel-ed-many { display: none; } }
.panel-ed-few { display: none; } /* the header switcher already lists 2-3 editions */
.nv-cover .cover { box-shadow: 0 30px 60px -22px rgba(0, 0, 0, .75), 0 0 0 1px var(--line); }
.nv-info { min-width: 0; padding-bottom: 4px; }
.nv-kicker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.nv-title { font: 600 clamp(30px, 4.6vw, 52px)/1.04 var(--font-display); letter-spacing: -.025em; text-wrap: balance; overflow-wrap: anywhere; }
.nv-author { margin-top: 10px; font-size: 16px; color: var(--text-2); }
.nv-author b { color: var(--text); font-weight: 600; }
.facts { display: flex; flex-wrap: wrap; gap: 8px 22px; margin: 18px 0 0; padding: 0; list-style: none; font-size: 14px; color: var(--text-2); }
.facts li { display: inline-flex; align-items: center; gap: 7px; }
.facts .i { width: 17px; height: 17px; color: var(--text-3); }
.facts b { color: var(--text); font-weight: 600; }
.nv-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.nv-genres { margin-top: 18px; }
.nv-body { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 22px 40px; margin-top: 44px; }
.nv-main { min-width: 0; }
.nv-side { min-width: 0; display: grid; gap: 16px; align-content: start; }
@media (min-width: 981px) { .nv-side { position: sticky; top: calc(var(--hdr-h) + 20px); align-self: start; } }
.panel { padding: 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.panel-title { font: 650 13px/1.2 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 12px; }
.syn { white-space: pre-line; font-size: 15.5px; line-height: 1.7; color: var(--text-2); max-width: 72ch; overflow-wrap: anywhere; }
.syn.is-clamped { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.link-btn { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; padding: 4px 0; border: 0; background: none; color: var(--accent); font-weight: 600; font-size: 14px; }
.link-btn:hover { color: var(--accent-2); }
.latest-card { display: flex; gap: 12px; align-items: center; padding: 12px 14px; margin: 0 -6px; border-radius: var(--r-md); color: var(--text); text-decoration: none; transition: background .18s; }
.latest-card:hover { background: var(--surface-2); color: var(--text); }
.latest-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); flex: none; }
.latest-card .lc-body { min-width: 0; }
.latest-card .lc-label { font-size: 12px; color: var(--text-3); font-weight: 600; }
.latest-card .lc-title { font-weight: 600; font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.attrib { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.attrib .i { color: var(--accent); margin-top: 1px; }
.attrib a { font-weight: 600; }
.lang-line { display: flex; align-items: center; gap: 10px; }
.lang-line .ltile-code { width: 40px; height: 40px; font-size: 13.5px; border-radius: 11px; color: var(--accent); } /* beats ".lang-line span" (text-3 was 4.29:1 on the tile) */
.lang-line b { display: block; font-size: 15px; }
.lang-line span { font-size: 13px; color: var(--text-3); }
@media (max-width: 980px) { .nv-body { grid-template-columns: minmax(0, 1fr); } .nv-side { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); } }
@media (max-width: 640px) {
  .nv-head { grid-template-columns: 1fr; justify-items: center; text-align: center; padding-top: 18px; gap: 20px; }
  .nv-cover { width: min(58vw, 210px); }
  .nv-kicker, .facts, .nv-genres .chips { justify-content: center; }
  /* compact header: cover beside kicker/title/author so the main button stays on the first screen */
  .nv-head { grid-template-columns: 112px minmax(0, 1fr); gap: 8px 16px; padding-top: 12px; text-align: left; justify-items: stretch; align-items: start; }
  .nv-info { display: contents; }
  .nv-cover { grid-column: 1; grid-row: 1 / span 3; width: 112px; }
  .nv-kicker, .nv-title, .nv-author { grid-column: 2; justify-content: flex-start; margin: 0; text-align: left; min-width: 0; }
  .nv-title { font-size: 24px; overflow-wrap: anywhere; }
  .nv-kicker { align-self: end; }
  .nv-info > :not(.nv-kicker):not(.nv-title):not(.nv-author) { grid-column: 1 / -1; }
  .facts { justify-content: flex-start; }
  .nv-genres .chips { justify-content: flex-start; }
  .nv-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
  .nv-actions .btn { width: 100%; min-width: 0; padding: 0 12px; font-size: 14.5px; }
  .nv-actions .btn span { overflow: hidden; text-overflow: ellipsis; }
  .nv-actions .btn-primary, .nv-actions .btn-ghost { grid-column: 1 / -1; }
  .nv-actions .btn-ghost { min-height: 40px; }
  .nv-body { margin-top: 32px; }
}

/* chapters */
.ch-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.ch-tools .search-field { flex: 1 1 240px; }
.ch-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 6px 10px; }
.ch {
  display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px; border-radius: var(--r-md);
  color: var(--text); text-decoration: none; background: var(--surface); border: 1px solid var(--line); font-size: 14px;
  transition: border-color .15s, background .15s;
}
.ch:hover { border-color: var(--accent-line); color: var(--text); background: var(--surface-2); }
.ch-n { flex: none; min-width: 34px; font-size: 12px; font-weight: 650; color: var(--text-3); font-variant-numeric: tabular-nums; }
.ch-t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-mark { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 650; color: var(--text-3); }
.ch .pill.ch-lang { flex: none; height: 19px; padding: 0 5px; font-size: 10px; }
.facts .mixed { color: var(--text-2); }
.ch.is-read .ch-t { color: var(--text-3); }
.ch.is-read .ch-mark { color: var(--ok); }
.ch.is-current { border-color: var(--accent-line); background: var(--accent-soft); }
.ch.is-current .ch-mark { color: var(--accent); }
.ch.is-locked .ch-t { color: var(--text-2); }
.ch.is-locked .ch-mark { color: var(--warn); }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 16px; }
.pager .select { width: auto; min-width: 180px; min-height: 38px; font-size: 14px; }
.pager-info { font-size: 13.5px; color: var(--text-3); }

/* ---------------------------------------------------------------- language editions (§13) */
/* switcher: a segmented control under the title; chips for 4+ editions, above the chapter list and on phones */
.ed-block { margin-top: 20px; }
.ed-switch {
  display: inline-flex; align-items: stretch; gap: 4px; max-width: 100%; padding: 4px; border-radius: 17px;
  background: color-mix(in srgb, var(--surface-2) 84%, transparent); border: 1px solid var(--line-2);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .16); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.ed-opt {
  position: relative; display: flex; align-items: center; gap: 11px; min-width: 0; min-height: 54px; padding: 8px 20px 8px 9px;
  border-radius: 13px; color: var(--text-2); text-decoration: none; -webkit-tap-highlight-color: transparent;
  transition: background .2s, color .2s, box-shadow .3s var(--ease-out), transform .18s var(--ease);
}
.ed-opt:hover { color: var(--text); background: color-mix(in srgb, var(--surface-3) 72%, transparent); }
.ed-opt:active { transform: scale(.985); }
.ed-opt:focus-visible { outline-offset: 1px; border-radius: 13px; }
.ed-code {
  display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 10px;
  background: var(--surface-3); color: var(--text-2); font: 700 11.5px/1 var(--font-ui); letter-spacing: .07em;
  transition: background .2s, color .2s, box-shadow .2s;
}
.ed-txt { display: grid; gap: 1px; min-width: 0; text-align: left; }
.ed-name { font-size: 14.5px; font-weight: 650; line-height: 1.2; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ed-count { font-size: 12.5px; line-height: 1.3; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ed-num { display: none; }
.ed-opt.is-on { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--accent-line), 0 12px 26px -16px rgba(124, 58, 237, .85), var(--shadow-sm); }
.ed-opt.is-on .ed-code { background: linear-gradient(135deg, var(--accent-fill), var(--accent-fill-2)); color: #fff; box-shadow: 0 5px 14px -5px rgba(124, 58, 237, .75), inset 0 1px 0 rgba(255, 255, 255, .22); }
.ed-opt.is-on .ed-count { color: var(--accent); font-weight: 600; }
.ed-switch.is-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.ed-switch.is-chips .ed-opt { min-height: 38px; gap: 8px; padding: 0 5px 0 14px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line-2); box-shadow: none; }
.ed-switch.is-chips .ed-opt:hover { border-color: var(--accent-line); background: var(--surface-2); }
.ed-switch.is-chips .ed-code, .ed-switch.is-chips .ed-count { display: none; } /* the count is also in the option's screen-reader text */
.ed-switch.is-chips .ed-name { font-size: 13.5px; font-weight: 600; }
.ed-switch.is-chips .ed-num {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: var(--r-pill);
  background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums;
}
.ed-switch.is-chips[data-where="top"] .ed-opt { min-height: 42px; padding-left: 5px; }
.ed-switch.is-chips[data-where="top"] .ed-code { display: grid; width: 30px; height: 30px; border-radius: 50%; font-size: 10px; }
.ed-switch.is-chips .ed-opt.is-on { background: linear-gradient(135deg, var(--accent-fill), var(--accent-fill-2)); border-color: transparent; box-shadow: 0 8px 20px -10px rgba(124, 58, 237, .85), inset 0 1px 0 rgba(255, 255, 255, .18); }
.ed-switch.is-chips .ed-opt.is-on .ed-name { color: #fff; }
.ed-switch.is-chips .ed-opt.is-on .ed-num { background: rgba(20, 8, 50, .3); color: #fff; }
.ed-switch.is-chips .ed-opt.is-on .ed-code { background: rgba(255, 255, 255, .95); color: var(--accent-fill); box-shadow: none; }
.ed-note { display: flex; align-items: center; gap: 8px; margin-top: 11px; font-size: 13px; line-height: 1.45; color: var(--text-3); }
.ed-note .i { color: var(--accent); }
.ed-bar { display: flex; align-items: flex-start; gap: 10px 14px; margin: 0 0 16px; }
.ed-bar .ed-lbl { min-height: 38px; }
.ed-bar .ed-switch { flex: 1 1 0; min-width: 0; }
@media (max-width: 560px) { .ed-bar { flex-direction: column; } .ed-bar .ed-lbl { min-height: 0; } }
.ed-pick { flex: 1 1 0; min-width: 0; width: 100%; max-width: 460px; } /* many editions: one compact menu above the chapter list (the header already shows every chip) */
.ed-pick .select { width: 100%; min-height: 38px; font-size: 14px; font-weight: 600; }
.ed-lbl { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--text-3); }
.ed-lbl .i { color: var(--accent); }
/* side panel: every edition as a row */
.ed-rows { list-style: none; margin: 0 -8px; padding: 0; display: grid; gap: 4px; }
.ed-row { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--r-md); border: 1px solid transparent; color: var(--text); text-decoration: none; transition: background .18s, border-color .18s; }
.ed-row:hover { background: var(--surface-2); color: var(--text); }
.ed-row .ltile-code { width: 38px; height: 38px; font-size: 12.5px; border-radius: 11px; }
.ed-row-txt { flex: 1; min-width: 0; display: grid; gap: 1px; }
.ed-row-txt b { font-size: 14.5px; font-weight: 650; }
.ed-row-txt > span { font-size: 12.5px; color: var(--text-3); }
.ed-row-mark { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; color: var(--text-3); }
.ed-row.is-on { background: var(--accent-soft); border-color: var(--accent-line); }
.ed-row.is-on .ltile-code { background: linear-gradient(135deg, var(--accent-fill), var(--accent-fill-2)); color: #fff; }
.ed-row.is-on .ed-row-txt > span, .ed-row.is-on .subtle { color: var(--text-2); }
.ed-row.is-on .ed-row-mark { color: var(--accent); }
.panel-title .panel-sub { text-transform: none; letter-spacing: 0; font-weight: 600; }
.ed-side-note { margin-top: 12px; font-size: 12.5px; color: var(--text-3); }
@media (max-width: 680px) {
  .ed-switch:not(.is-chips) { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); width: 100%; }
  .ed-opt { padding-right: 12px; }
}
@media (max-width: 640px) {
  .nv-info .ed-switch.is-chips { justify-content: center; }
  .nv-info .ed-note { justify-content: center; text-align: center; }
  .nv-info .ed-note .i { display: none; }
}
/* same novel on several websites (§14.10): "Read from" switcher in the edition switcher's look, card pill, chapter pill (§14.11) */
.src-lbl { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 13px; font-weight: 600; color: var(--text-3); }
.src-lbl .i { color: var(--accent); }
.nv-info .src-pick + .ed-block { margin-top: 14px; }
.ed-switch.is-chips[data-where="src"] .ed-opt { min-height: 42px; padding-left: 5px; }
.ed-switch.is-chips[data-where="src"] .ed-code { display: grid; width: 30px; height: 30px; border-radius: 50%; font-size: 10px; }
.src-switch .ed-name { max-width: 17ch; }
@media (max-width: 480px) { .ed-switch.src-switch:not(.is-chips) { grid-template-columns: 1fr; } .src-switch .ed-name { max-width: none; } }
@media (max-width: 640px) { .nv-info .src-lbl { justify-content: center; } .nv-info .src-switch.is-chips { justify-content: center; } }
.card-src { display: inline-flex; align-items: center; gap: 4px; margin-top: 5px; padding: 2px 8px 2px 6px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 650; line-height: 1.4; }
.card-src .i { width: 12px; height: 12px; }
/* SPEC 14.12: every novel says which website it was taken from */
.card-from { display: block; margin-top: 4px; font-size: 11.5px; line-height: 1.35; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-src { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-free { display: inline-flex; align-items: center; gap: 4px; flex: none; margin-left: auto; padding: 2px 9px 2px 7px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--accent); font-size: 11.5px; font-weight: 650; white-space: nowrap; max-width: 46%; overflow: hidden; text-overflow: ellipsis; }
.ch-free + .ch-mark { margin-left: 8px; }
.rd-borrow { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 14px auto 0; max-width: 40em; padding: 9px 14px; border-radius: var(--r-md); background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--text-2); font-size: 13.5px; line-height: 1.45; text-align: left; }
.rd-borrow .i { color: var(--accent); flex: none; }
.rd-borrow b { color: var(--text); }
.t-also { color: var(--accent); font-size: 12.5px; font-weight: 600; }
/* reader: the edition in the header, "Read this chapter in …" links (a menu for 3+ other editions) */
.rd-meta .rd-ed { font-weight: 500; }
.rd-meta .rd-ed b { color: var(--text); font-weight: 650; }
.crumb-ed { color: var(--text-3); font-weight: 500; }
.rd-eds { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 16px; }
.ed-jump, .ed-menu summary {
  display: inline-flex; align-items: center; gap: 8px; min-height: 34px; padding: 0 14px 0 5px; border-radius: var(--r-pill);
  background: var(--surface); border: 1px solid var(--line-2); color: var(--text-2); font-size: 13px; font-weight: 600;
  text-decoration: none; cursor: pointer; transition: background .18s, border-color .18s, color .18s;
}
.ed-jump:hover, .ed-menu summary:hover { border-color: var(--accent-line); background: var(--surface-2); color: var(--text); }
.ed-jump .ed-code { width: 24px; height: 24px; border-radius: 50%; font-size: 9.5px; background: var(--accent-soft); color: var(--accent); }
.ed-jump .i { width: 13px; height: 13px; }
.ed-menu { position: relative; display: flex; justify-content: center; }
.ed-menu summary { list-style: none; padding-left: 12px; }
.ed-menu summary::-webkit-details-marker { display: none; }
.ed-menu summary .i { color: var(--accent); }
.ed-menu summary .i:last-child { width: 13px; height: 13px; color: var(--text-3); transition: transform .2s; }
.ed-menu[open] summary { border-color: var(--accent-line); color: var(--text); }
.ed-menu[open] summary .i:last-child { transform: rotate(180deg); }
.ed-menu ul {
  position: absolute; z-index: 20; top: calc(100% + 8px); left: 50%; transform: translateX(-50%); width: min(330px, calc(100vw - 32px));
  max-height: min(60vh, 420px); overflow: auto; list-style: none; margin: 0; padding: 6px; border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-pop); text-align: left;
}
.ed-menu li a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); color: var(--text); text-decoration: none; font-size: 14px; }
.ed-menu li a:hover { background: var(--surface-2); color: var(--text); }
.ed-menu li .ed-code { width: 30px; height: 30px; border-radius: 9px; font-size: 10px; }
.ed-menu .ed-mt { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ed-menu .ed-mt span { color: var(--text-3); font-size: 13px; }
.ed-menu .ed-mk { flex: none; font-size: 12px; font-weight: 650; color: var(--text-3); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- reader */
.rd-progress { position: fixed; z-index: 45; top: 0; left: 0; right: 0; height: 3px; pointer-events: none; }
.rd-progress i { display: block; height: 100%; width: 100%; transform-origin: 0 50%; transform: scaleX(var(--p, 0)); background: linear-gradient(90deg, var(--accent-fill), var(--accent)); box-shadow: 0 0 10px var(--accent-line); }
.rd-bar { position: sticky; top: var(--hdr-h); z-index: 30; background: color-mix(in srgb, var(--bg) 86%, transparent); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.rd-bar-in { display: flex; align-items: center; gap: 6px; height: 54px; }
.rd-bar .sp { flex: 1; }
.rd-bar .btn { min-height: 36px; }
.rd-bar .crumb-title { min-width: 0; max-width: 34ch; font-size: 13.5px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; padding: 0 6px; }
.rd-bar .crumb-title:hover { color: var(--text); }
.jump { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.jump input { width: 64px; height: 34px; padding: 0 8px; text-align: center; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface); font-weight: 650; font-size: 14px; -moz-appearance: textfield; appearance: textfield; }
.jump input::-webkit-inner-spin-button, .jump input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.aa-btn { font: 600 15px/1 var(--font-display); letter-spacing: -.01em; }
.rd {
  --rd-size: 19px; --rd-lh: 1.75; --rd-w: 40em; --rd-font: var(--font-read);
  max-width: calc(var(--rd-w) + 2 * var(--gutter)); margin: 0 auto; padding: 44px var(--gutter) 30px;
}
.rd-head { max-width: var(--rd-w); margin: 0 auto 34px; text-align: center; }
.rd-novel { display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); text-decoration: none; margin-bottom: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd-title { font: 600 clamp(26px, 4vw, 38px)/1.12 var(--font-display); letter-spacing: -.02em; text-wrap: balance; overflow-wrap: anywhere; }
.rd-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 16px; margin-top: 16px; font-size: 13.5px; color: var(--text-3); }
.rd-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.rd-meta .i { width: 15px; height: 15px; }
.rd-meta .rd-lang { color: var(--text-2); font-weight: 600; }
.rd-langnote { display: inline-flex; align-items: flex-start; gap: 8px; max-width: 34em; margin: 16px auto 0; padding: 9px 14px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--text-2); font-size: 13.5px; line-height: 1.45; text-align: left; }
.rd-langnote .i { color: var(--accent); margin-top: 1px; }
.rd-langnote b { color: var(--text); }
.rd-langnote a { color: var(--accent); font-weight: 650; text-underline-offset: 3px; white-space: nowrap; }
.rd-orn { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 26px; color: var(--text-3); }
.rd-orn::before, .rd-orn::after { content: ""; width: 48px; height: 1px; background: var(--line-2); }
.rd-orn svg { width: 14px; height: 14px; color: var(--accent); opacity: .8; }
.rd-text {
  max-width: var(--rd-w); margin: 0 auto; font-family: var(--rd-font); font-size: var(--rd-size); line-height: var(--rd-lh);
  color: var(--text); hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; font-variant-ligatures: common-ligatures;
}
.rd-text.is-sans { letter-spacing: -.004em; }
.rd-text p { margin: 0 0 1.05em; }
[data-theme="dark"] .rd-text { color: #e9e5f2; }
.rd-text .s { cursor: pointer; border-radius: 4px; transition: background-color .25s, box-shadow .25s; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
@media (hover: hover) and (pointer: fine) { .rd-text .s:hover { background: color-mix(in srgb, var(--hl) 45%, transparent); } }
.rd-text .s.is-on { background: var(--hl); box-shadow: 0 0 0 3px var(--hl); }
.rd-text .s.is-on::after { content: none; }
.rd-end { max-width: var(--rd-w); margin: 46px auto 0; }
.end-card { position: relative; display: grid; gap: 6px; padding: 24px; border-radius: var(--r-xl); overflow: hidden; background: var(--surface); border: 1px solid var(--line); text-align: center; }
.end-card .end-kicker { font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.end-card .end-title { font: 600 22px/1.2 var(--font-display); letter-spacing: -.01em; overflow-wrap: anywhere; }
.end-card .btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 12px; }
.end-card.is-next { background: linear-gradient(150deg, color-mix(in srgb, var(--accent-fill) 22%, var(--surface)), var(--surface) 70%); border-color: var(--accent-line); }
/* end of an edition: the offer to go on in another language names the chapter it opens (not a position number) */
.end-offer {
  display: flex; align-items: center; gap: 14px; width: min(100%, 520px); margin: 14px auto 0; padding: 12px 14px 12px 12px;
  border-radius: var(--r-lg); border: 1px solid var(--accent-line); text-align: left; text-decoration: none; color: var(--text);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-fill) 18%, var(--surface)), var(--surface) 82%);
  box-shadow: 0 12px 28px -20px rgba(124, 58, 237, .9);
  transition: transform .18s var(--ease), box-shadow .18s, border-color .18s;
}
.end-offer:hover { color: var(--text); transform: translateY(-1px); box-shadow: 0 16px 32px -18px rgba(124, 58, 237, .95); }
.end-offer:active { transform: translateY(1px) scale(.99); }
.end-offer .ed-code {
  width: 42px; height: 42px; border-radius: 12px; font-size: 12px; color: #fff;
  background: linear-gradient(135deg, var(--accent-fill), var(--accent-fill-2)); box-shadow: 0 6px 16px -6px rgba(124, 58, 237, .8), inset 0 1px 0 rgba(255, 255, 255, .22);
}
.eo-txt { flex: 1; min-width: 0; display: grid; gap: 3px; }
.eo-k { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.eo-t { font: 600 16.5px/1.3 var(--font-display); letter-spacing: -.005em; overflow: hidden; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.eo-go { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); color: var(--accent); transition: transform .2s var(--ease), background .2s; }
.eo-go .i { width: 16px; height: 16px; }
.end-offer:hover .eo-go { transform: translateX(3px); background: var(--accent-soft); }
@media (max-width: 480px) { .end-offer { gap: 11px; padding: 11px 12px 11px 10px; } .end-offer .ed-code { width: 36px; height: 36px; border-radius: 10px; } .eo-t { font-size: 15.5px; } .eo-go { width: 30px; height: 30px; } }
.rd-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.rd-error { max-width: 640px; margin: 40px auto; }
.rd-locked { max-width: 560px; margin: 40px auto; }
.follow-btn { position: fixed; z-index: 34; left: 50%; bottom: calc(var(--player-h) + 14px); transform: translateX(-50%); box-shadow: var(--shadow-pop); }
@media (max-width: 680px) {
  .rd { --rd-size: 18px; padding-top: 30px; }
  .rd-bar .crumb-title, .rd-bar .hide-sm { display: none; }
  .rd-bar-in { gap: 4px; }
  .jump input { width: 56px; }
}

/* popover + sheet */
.pop {
  position: absolute; z-index: 60; width: 340px; max-width: calc(100vw - 24px); padding: 18px;
  border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-pop); border: 1px solid var(--line);
}
.pop h2 { font: 650 13px/1.2 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 14px; }
.set-row { display: grid; gap: 8px; margin-top: 16px; }
.set-row:first-of-type { margin-top: 0; }
.set-row > .label { display: flex; justify-content: space-between; }
.set-row > .label output { color: var(--text); font-variant-numeric: tabular-nums; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper input[type="range"] { flex: 1; }
input[type="range"] { accent-color: var(--accent-fill); height: 24px; cursor: pointer; }
.theme-swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.theme-swatches button { display: grid; gap: 6px; justify-items: center; padding: 10px 6px 8px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--surface-2); font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.theme-swatches button[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); color: var(--text); }
.theme-swatches .swatch { width: 30px; height: 30px; font-size: 13px; }
.font-opt { font-size: 15px !important; }
.font-opt[data-v="serif"] { font-family: var(--font-read) !important; }
.backdrop.backdrop-clear { background: transparent; -webkit-backdrop-filter: none; backdrop-filter: none; } /* Aa sheet: the text above stays readable so changes preview live */
.backdrop { position: fixed; inset: 0; z-index: 58; background: rgba(5, 3, 10, .5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); animation: fade .2s var(--ease); }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
@keyframes slide-in { from { transform: translateX(-30px); opacity: 0; } }
.drawer {
  position: fixed; z-index: 59; top: 0; bottom: 0; left: 0; width: min(420px, 92vw); display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line); box-shadow: var(--shadow-pop); animation: slide-in .28s var(--ease-out);
}
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px 20px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { flex: 1; min-width: 0; font: 600 19px/1.2 var(--font-display); }
.drawer-head .sub { font-size: 12.5px; color: var(--text-3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-tools { display: grid; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.drawer-pager { display: flex; align-items: center; gap: 8px; }
.drawer-pager .select { min-height: 36px; font-size: 14px; }
.drawer-list { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 8px; list-style: none; margin: 0; }
.drawer-list .ch { background: transparent; border-color: transparent; min-height: 44px; }
.drawer-list .ch:hover { background: var(--surface-2); }
.drawer-list .ch.is-current { background: var(--accent-soft); border-color: var(--accent-line); }
@media (max-width: 680px) {
  .pop.as-sheet, .sheet {
    position: fixed !important; left: 0 !important; right: 0 !important; bottom: 0 !important; top: auto !important; width: 100%; max-width: none;
    max-height: 86vh; overflow: auto; border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 22px 18px calc(18px + env(safe-area-inset-bottom, 0px));
    animation: rise .28s var(--ease-out);
  }
  .pop.as-sheet::before, .sheet::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--line-2); margin: -10px auto 14px; }
  /* Aa sheet: short, so several lines of the chapter stay visible above it and resize live; its own controls scroll */
  .set-pop.as-sheet { max-height: max(40vh, 240px); max-height: max(40dvh, 240px); overflow-y: auto; overscroll-behavior: contain; }
}

/* ---------------------------------------------------------------- player */
#player {
  position: fixed; z-index: 35; left: 0; right: 0; bottom: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  -webkit-backdrop-filter: saturate(1.5) blur(20px); backdrop-filter: saturate(1.5) blur(20px);
  border-top: 1px solid var(--line); box-shadow: 0 -18px 40px -24px rgba(0, 0, 0, .55);
}
.pl-seek { position: absolute; left: 0; right: 0; top: -9px; height: 18px; margin: 0; padding: 0; background: transparent; cursor: pointer; -webkit-appearance: none; appearance: none; z-index: 2; }
.pl-seek::-webkit-slider-runnable-track { height: 3px; background: linear-gradient(90deg, var(--accent-fill) var(--p, 0%), var(--line-2) var(--p, 0%)); border-radius: 0; }
.pl-seek::-moz-range-track { height: 3px; background: linear-gradient(90deg, var(--accent-fill) var(--p, 0%), var(--line-2) var(--p, 0%)); }
.pl-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; margin-top: -5px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 4px var(--accent-soft), 0 1px 4px rgba(0, 0, 0, .4); opacity: 0; transition: opacity .2s; }
.pl-seek::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 0; opacity: 0; }
#player:hover .pl-seek::-webkit-slider-thumb, .pl-seek:focus-visible::-webkit-slider-thumb { opacity: 1; }
#player:hover .pl-seek::-moz-range-thumb, .pl-seek:focus-visible::-moz-range-thumb { opacity: 1; }
.pl-in { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px; min-height: 76px; padding-block: 8px; }
.pl-info { display: flex; align-items: center; gap: 12px; min-width: 0; }
.pl-info .cover { width: 40px; flex: none; border-radius: 6px; box-shadow: var(--shadow-sm); }
.pl-txt { min-width: 0; }
.pl-title { font-weight: 650; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-sub { font-weight: 500; color: var(--text-3); }
.pl-status { display: flex; align-items: center; gap: 7px; margin-top: 3px; font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 18px; }
.pl-status > span:not(.spinner):not(.lv):not(.pl-pos) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-status .pl-pos { flex: none; }
.pl-status .spinner { width: 12px; height: 12px; border-width: 2px; }
.pl-status.is-error { color: var(--bad); }
.pl-status .lv { display: inline-flex; gap: 2px; align-items: flex-end; height: 12px; }
.pl-status .lv i { width: 2.5px; border-radius: 2px; background: var(--accent); animation: eq 1s ease-in-out infinite; }
.pl-status .lv i:nth-child(1) { height: 40%; } .pl-status .lv i:nth-child(2) { height: 100%; animation-delay: -.3s; } .pl-status .lv i:nth-child(3) { height: 65%; animation-delay: -.6s; }
@keyframes eq { 50% { transform: scaleY(.35); } }
.pl-ctrl { display: flex; align-items: center; gap: 4px; }
.pl-ctrl .icon-btn { width: 40px; height: 40px; color: var(--text); }
.pl-ctrl .icon-btn:disabled { opacity: .35; background: none; }
.pl-play {
  position: relative; display: grid; place-items: center; width: 54px; height: 54px; margin: 0 6px; flex: none; border-radius: 50%; border: 0;
  background: linear-gradient(135deg, var(--accent-fill), var(--accent-fill-2)); color: #fff;
  box-shadow: 0 10px 26px -8px rgba(124, 58, 237, .75), inset 0 1px 0 rgba(255, 255, 255, .2); transition: transform .15s var(--ease), filter .15s;
}
.pl-play:hover { filter: brightness(1.08); }
.pl-play:active { transform: scale(.96); }
.pl-play:disabled { filter: grayscale(.8) brightness(.8); box-shadow: none; }
.pl-play .i { width: 24px; height: 24px; }
.pl-play .ring { position: absolute; inset: -4px; border-radius: 50%; pointer-events: none; background: conic-gradient(var(--accent) calc(var(--f, 0) * 1turn), transparent 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2.5px)); }
.pl-play.is-busy::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2.5px solid transparent; border-top-color: var(--accent); animation: spin .9s linear infinite; }
.pl-play.is-pulse { animation: pulse 2s var(--ease) infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 10px 26px -8px rgba(124, 58, 237, .75), 0 0 0 0 rgba(167, 139, 250, .5); } 50% { box-shadow: 0 10px 26px -8px rgba(124, 58, 237, .75), 0 0 0 10px rgba(167, 139, 250, 0); } }
.pl-opts { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; }
.pl-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border-radius: var(--r-pill); max-width: 220px;
  border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap;
}
.pl-chip:hover { background: var(--surface-3); }
.pl-chip[aria-expanded="true"] { border-color: var(--accent-line); background: var(--accent-soft); }
.pl-chip .lbl { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pl-chip .i { width: 16px; height: 16px; color: var(--text-2); }
.pl-chip.is-active { color: var(--accent); border-color: var(--accent-line); }
.pl-chip.is-active .i { color: var(--accent); }
.pl-more { display: none; }
.pl-pos { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.voice-pop { width: 380px; padding: 8px; max-height: min(70vh, 560px); overflow: auto; }
.voice-pop h2 { margin: 10px 10px 6px; }
.v-group + .v-group { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }
.v-group-title { display: flex; align-items: center; gap: 8px; padding: 10px 10px 6px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); }
.v-group-title .i { width: 15px; height: 15px; color: var(--accent); }
.v-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border: 0; border-radius: var(--r-md); background: none; text-align: left; color: var(--text); }
.v-item:hover:not(:disabled) { background: var(--surface-2); }
.v-item[aria-checked="true"] { background: var(--accent-soft); }
.v-item:disabled { opacity: .55; }
.v-radio { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); flex: none; display: grid; place-items: center; }
.v-item[aria-checked="true"] .v-radio { border-color: var(--accent); }
.v-item[aria-checked="true"] .v-radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.v-body { flex: 1; min-width: 0; }
.v-name { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-note { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.v-badge { flex: none; display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 700; padding: 3px 8px; border-radius: var(--r-pill); background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.v-badge.ready { background: var(--ok-soft); color: var(--ok); }
.v-badge .i { width: 12px; height: 12px; stroke-width: 2.4; }
.v-prog { height: 3px; border-radius: 3px; background: var(--surface-3); margin-top: 6px; overflow: hidden; }
.v-prog i { display: block; height: 100%; width: var(--p, 0%); background: var(--accent); transition: width .3s; }
.v-confirm { margin: 4px 10px 8px 40px; padding: 12px; border-radius: var(--r-md); background: var(--surface-2); font-size: 13px; color: var(--text-2); }
.v-confirm .btns { display: flex; gap: 8px; margin-top: 10px; }
.speed-pop, .sleep-pop { width: 300px; }
.speed-val { font: 650 28px/1 var(--font-ui); font-variant-numeric: tabular-nums; text-align: center; margin: 4px 0 10px; }
.speed-presets { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 12px; }
.speed-presets button { min-height: 32px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: var(--surface-2); font-size: 12.5px; font-weight: 650; color: var(--text-2); }
.speed-presets button[aria-pressed="true"] { background: var(--accent-fill); color: #fff; border-color: transparent; }
.opt-list { display: grid; gap: 2px; }
.sheet-sec + .sheet-sec { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.nudge {
  position: fixed; z-index: 36; right: max(16px, env(safe-area-inset-right)); bottom: calc(var(--player-h) + 14px); width: min(380px, calc(100vw - 32px));
  padding: 18px; border-radius: var(--r-lg); color: #fff; overflow: hidden; isolation: isolate;
  background: linear-gradient(150deg, #3b1d74, #1a0f33 70%); box-shadow: var(--shadow-pop); border: 1px solid rgba(196, 176, 255, .25);
  animation: rise .4s var(--ease-out);
}
.nudge::before { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(80% 60% at 100% 0%, rgba(196, 120, 255, .35), transparent 70%); }
.nudge-head { display: flex; align-items: flex-start; gap: 12px; }
.nudge-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: rgba(255, 255, 255, .12); flex: none; color: #e9ddff; }
.nudge h2 { font: 600 18px/1.25 var(--font-display); }
.nudge p { margin-top: 6px; font-size: 13.5px; line-height: 1.5; color: rgba(255, 255, 255, .8); }
.nudge .btns { display: flex; gap: 8px; margin-top: 14px; }
.nudge .close { position: absolute; top: 8px; right: 8px; color: rgba(255, 255, 255, .7); }
.nudge .close:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.nudge .bar { background: rgba(255, 255, 255, .18); margin-top: 14px; height: 6px; }
.nudge .bar > i { background: linear-gradient(90deg, #c4b0ff, #fff); }
.nudge .nudge-prog { margin-top: 8px; font-size: 12.5px; color: rgba(255, 255, 255, .78); font-variant-numeric: tabular-nums; }
@media (max-width: 1380px) {
  .pl-in { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .pl-opts { display: none; }
  .pl-more { display: inline-grid; }
}
@media (max-width: 900px) {
  .pl-ctrl .hide-md { display: none; }
}
.card-new { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 999px; background: var(--accent); color: #fff; font: 700 11.5px/1.5 var(--font-ui); }
.form-err:empty { display: none; }
html:not([data-routed]) .ftr { visibility: hidden; }
.backup-card { margin-top: 28px; }
.backup-card .btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.backup-card label.btn { cursor: pointer; }
.backup-card .form-err { margin-top: 10px; }
.backup-card .form-err:empty { display: none; }
@media (pointer: coarse) {
  .icon-btn, .pl-ctrl .icon-btn { min-width: 44px; min-height: 44px; }
  .chip-sm, .tab, .btn { min-height: 44px; }
  .hero-dot { position: relative; }
  .hero-dot::after { content: ''; position: absolute; inset: -9px; }
  .pl-seek { top: -14px; height: 28px; }
  .rd-bar .btn-icon.btn-sm, .rd-bar input[type="number"] { min-height: 44px; min-width: 44px; }
  .rd-bar .btn, .rd-bar .btn-sm, .aa-btn, .ed-jump, .ed-menu summary { min-height: 44px; }
  .ftr ul a, .crumbs a, .breadcrumb a { display: inline-block; padding: 10px 4px; }
}
@media (max-width: 560px) {
  /* compact one-row mini player: title + status left, controls right (about 64px tall) */
  .pl-in { grid-template-columns: minmax(0, 1fr) auto; gap: 6px; min-height: 0; padding-block: 8px; }
  .pl-info .cover { display: none; }
  .pl-txt { text-align: left; min-width: 0; }
  .pl-title { font-size: 13.5px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
  .pl-sub { display: none; }
  .pl-status { justify-content: flex-start; margin-top: 1px; }
  .pl-ctrl { justify-content: flex-end; gap: 0; }
  .pl-ctrl .icon-btn { width: 40px; height: 40px; }
  .pl-play { width: 48px; height: 48px; }
  .nudge { right: 12px; left: 12px; width: auto; }
}

/* ---------------------------------------------------------------- library / import */
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); width: max-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 16px; border-radius: var(--r-pill); border: 0; background: none; color: var(--text-2); font-weight: 600; font-size: 14px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.tab .count { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tabpanel { margin-top: 26px; }
@media (max-width: 560px) {
  .tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); width: 100%; }
  .tab { justify-content: center; gap: 5px; padding: 0 4px; font-size: 13px; }
  .tab .i { display: none; }
}
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.row-item { display: flex; align-items: center; gap: 14px; padding: 10px 14px 10px 10px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.row-item .cover { width: 44px; flex: none; border-radius: 7px; }
.row-main { flex: 1; min-width: 0; color: var(--text); text-decoration: none; }
.row-main:hover { color: var(--text); }
.row-main:hover .row-title { color: var(--accent); }
.row-title { font-weight: 620; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub { margin-top: 3px; font-size: 13px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-acts { display: flex; gap: 6px; flex: none; }
.import-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.drop { position: relative; display: grid; place-items: center; gap: 6px; padding: 22px; border-radius: var(--r-lg); border: 1.5px dashed var(--line-2); background: var(--surface); text-align: center; color: var(--text-2); font-size: 14px; transition: border-color .18s, background .18s; }
.drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop .i { color: var(--accent); width: 26px; height: 26px; }
.form-grid { display: grid; gap: 14px; }
.form-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.privacy { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--text-3); }
.privacy .i { color: var(--ok); margin-top: 1px; }
@media (max-width: 860px) {
  .import-grid { grid-template-columns: minmax(0, 1fr); }
  .import-grid.has-items > section:nth-child(2) { order: -1; } /* saved texts first: they would sit a screen below the form */
}
@media (max-width: 520px) { .row-acts .btn .lbl { display: none; } .row-acts .btn { padding: 0 10px; } }

/* gutenberg import + 404 */
.center-card { max-width: 520px; margin: 48px auto; padding: 34px 28px; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--line); text-align: center; display: grid; justify-items: center; gap: 12px; }
.center-card h1 { font: 600 26px/1.2 var(--font-display); letter-spacing: -.015em; }
.center-card p { color: var(--text-2); max-width: 42ch; }
.center-card .btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 8px; }
.nf-art { font: 600 96px/1 var(--font-display); letter-spacing: -.04em; background: linear-gradient(135deg, var(--accent), var(--accent-fill-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.steps { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; text-align: left; width: 100%; max-width: 340px; }
.steps li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-3); }
.steps li.is-done { color: var(--text-2); }
.steps li.is-done .st { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.steps li.is-now { color: var(--text); font-weight: 600; }
.steps .st { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; flex: none; }
.steps .st .i { width: 13px; height: 13px; stroke-width: 2.6; }
.steps li.is-now .st { border-color: var(--accent); }

/* ---------------------------------------------------------------- admin */
.login-card { max-width: 420px; margin: 56px auto; padding: 32px 28px; border-radius: var(--r-xl); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-card); }
.login-card .lock { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); margin-bottom: 16px; }
.login-card h1 { font: 600 26px/1.2 var(--font-display); }
.login-card p { margin-top: 6px; color: var(--text-2); font-size: 14.5px; }
.login-card form { display: grid; gap: 14px; margin-top: 22px; }
.form-err { color: var(--bad); font-size: 13.5px; font-weight: 600; min-height: 1em; }
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.state-pill { display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px; border-radius: var(--r-pill); font-size: 13px; font-weight: 650; background: var(--ok-soft); color: var(--ok); }
.state-pill.is-busy { background: var(--accent-soft); color: var(--accent); }
.state-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.state-pill.is-busy .dot { animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .25; } }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); gap: 12px; }
.stat { padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.stat-v { font: 650 28px/1.1 var(--font-ui); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-l { margin-top: 4px; font-size: 13px; color: var(--text-3); font-weight: 550; }
.stat .bar { margin-top: 10px; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; align-items: start; }
.dash-col { display: grid; gap: 16px; min-width: 0; }
.card-panel { padding: 20px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.card-panel > h2 { display: flex; align-items: center; gap: 9px; font: 650 15.5px/1.2 var(--font-ui); margin-bottom: 14px; }
.card-panel > h2 .i { color: var(--accent); width: 18px; height: 18px; }
.card-panel > h2 .aside { margin-left: auto; font-size: 12.5px; font-weight: 550; color: var(--text-3); }
.cmd-form { display: flex; gap: 8px; }
.cmd-form .input { font-family: var(--font-mono); font-size: 14px; }
.quick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.reply { margin-top: 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface-2); font: 13px/1.55 var(--font-mono); color: var(--text-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.reply.is-err { color: var(--bad); background: var(--bad-soft); }
.job-title { font-weight: 650; font-size: 15px; overflow-wrap: anywhere; }
.job-sub { margin-top: 4px; font-size: 13px; color: var(--text-3); overflow-wrap: anywhere; }
.job-bar { margin-top: 12px; height: 8px; }
.queue { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 6px; }
.queue li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--surface-2); font-size: 13.5px; overflow-wrap: anywhere; }
.queue .n { font-size: 12px; font-weight: 700; color: var(--text-3); }
.set-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.set-line > div:first-child { flex: 1 1 200px; min-width: 0; } /* the text takes the row: the switch stays on the right, a select drops under it only when there is no room */
.set-line:first-of-type { border-top: 0; padding-top: 0; }
.set-line .select { width: auto; min-width: 170px; min-height: 38px; font-size: 14px; }
.set-line .desc { font-size: 13px; color: var(--text-3); margin-top: 2px; }
.codebox { display: flex; align-items: stretch; gap: 0; margin-top: 8px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--surface-2); overflow: hidden; }
.codebox code { flex: 1; min-width: 0; padding: 10px 12px; font: 12.5px/1.5 var(--font-mono); color: var(--text); overflow-wrap: anywhere; word-break: break-all; }
.codebox button { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border: 0; border-left: 1px solid var(--line-2); background: var(--surface-3); color: var(--text); font-size: 12.5px; font-weight: 650; }
.codebox button:hover { background: var(--accent-soft); color: var(--accent); }
.howto { margin: 12px 0 0; padding-left: 20px; font-size: 13.5px; color: var(--text-2); display: grid; gap: 4px; }
.tbl-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.tbl-tools .search-field { flex: 1 1 220px; }
.tbl-tools .select { width: auto; min-width: 170px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); padding: 0 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .t-title a { color: var(--text); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.tbl .t-title a:hover { color: var(--accent); }
.tbl .t-sub { display: flex; align-items: center; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.tbl .t-sub .pill { height: 19px; font-size: 10px; padding: 0 6px; }
.tbl .t-checked { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.tbl .t-locked { display: block; font-size: 12px; }
.tbl .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .meter { width: 120px; }
.tbl .meter .bar { height: 6px; }
.tbl .meter span { display: block; margin-top: 5px; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
/* the row buttons wrap (a source-linked novel has up to five), so the table never needs a sideways scroll */
.tbl .acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.tbl td.t-title { min-width: 160px; }
.tbl-wrap { max-height: 620px; overflow: auto; margin: 0 -6px; padding: 0 6px; }
@media (max-width: 760px) {
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; }
  .tbl td { padding: 0; border: 0; min-width: 0; }
  .tbl td.t-title { grid-column: 1 / -1; min-width: 0; }
  .tbl td[data-l]::before { content: attr(data-l); display: block; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-3); margin-bottom: 3px; }
  .tbl tr > td:last-child { grid-column: 1 / -1; }
  .tbl .acts { justify-content: flex-start; }
  .tbl .meter { width: 100%; min-width: 120px; }
}
.log { height: 340px; overflow: auto; padding: 12px 14px; border-radius: var(--r-md); background: #0a0812; color: #d6d0ea; font: 12.5px/1.6 var(--font-mono); overflow-wrap: anywhere; }
.log .t { color: #8d86a8; margin-right: 8px; }
.log .warn { color: #fbbf24; }
.log .err { color: #fb7185; }
.log .ok { color: #4ade80; }
.hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.hist li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: var(--r-sm); background: var(--surface-2); font-size: 13px; }
.hist .res { color: var(--text-3); overflow-wrap: anywhere; }
.pw-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 10px; }
@media (max-width: 1060px) { .dash-grid { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------- dashboard: Websites panel (SPEC 14.7) */
.web-intro { margin: -4px 0 14px; font-size: 13.5px; color: var(--text-3); }
.src-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.src-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.src-row.is-paused { background: transparent; border-style: dashed; }
.src-row.is-paused .src-badge { filter: grayscale(.85); opacity: .75; }
.src-badge { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; font: 700 19px/1 var(--font-ui); color: #fff; background: linear-gradient(145deg, var(--c1, #6d3bd1), var(--c2, #1e0f40)); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); flex: none; }
.src-badge-book { --c1: #8a5a2b; --c2: #34200f; }
.src-badge-book .i { width: 22px; height: 22px; }
.src-main { min-width: 0; display: grid; gap: 6px; }
.src-title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 15px; min-width: 0; }
.src-title b { font-weight: 650; overflow-wrap: anywhere; }
.src-host { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-3); text-decoration: none; overflow-wrap: anywhere; }
.src-host:hover { color: var(--accent); text-decoration: underline; }
.src-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.src-counts { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.src-sub { font-size: 12.5px; color: var(--text-3); overflow-wrap: anywhere; }
.src-block { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: var(--r-sm, 10px); background: var(--bad-soft); color: var(--text-2); font-size: 13px; line-height: 1.45; }
.src-block .i { flex: none; margin-top: 2px; color: var(--bad); }
.src-block b { font-weight: 650; color: var(--text); }
.src-acts { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 260px; }
.src-empty { display: flex; align-items: center; gap: 10px; padding: 14px; border-radius: var(--r-md); background: var(--surface-2); font-size: 13.5px; color: var(--text-2); }
.src-add { margin-top: 14px; }
.src-form { display: grid; gap: 12px; padding: 16px; border-radius: var(--r-md); border: 1px solid var(--accent-line); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.src-form-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.src-form-head h3 { font: 650 15px/1.2 var(--font-ui); }
.src-probe-row { display: flex; gap: 8px; align-items: stretch; }
.src-probe-row .input { flex: 1; min-width: 0; }
.src-probe-row .btn { flex: none; }
.src-hint { margin: -4px 0 0; font-size: 12.5px; color: var(--text-3); }
.src-res { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.src-res p { margin: 3px 0 0; font-size: 13.5px; color: var(--text-2); overflow-wrap: anywhere; }
.src-res.is-ok { border-color: color-mix(in srgb, var(--ok) 45%, transparent); }
.src-res.is-bad { border-color: color-mix(in srgb, var(--bad) 45%, transparent); }
.src-res-ico { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--ok-soft); color: var(--ok); }
.src-res.is-bad .src-res-ico { background: var(--bad-soft); color: var(--bad); }
.src-res-ico .i { width: 16px; height: 16px; }
.src-samples { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.src-samples li { padding: 3px 10px; border-radius: var(--r-pill); background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); }
.src-confirm { display: grid; gap: 12px; padding-top: 4px; }
.src-confirm .check { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; line-height: 1.45; cursor: pointer; }
.src-confirm .check input { width: 18px; height: 18px; margin-top: 1px; flex: none; accent-color: var(--accent-fill); cursor: pointer; }
.src-confirm-btns { display: flex; gap: 8px; }
.src-confirm .form-err { margin: 0; }
.src-confirm .form-err:empty { display: none; }
.src-host:visited { color: var(--text-3); }
.t-src { font-size: 12px; font-weight: 600; color: var(--accent); }
.src-bar[hidden] { display: none; }
@media (max-width: 560px) {
  .src-row { grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 12px; }
  .src-acts { grid-column: 1 / -1; justify-content: flex-start; max-width: none; }
  .src-acts .btn { flex: 1 1 auto; justify-content: center; }
  .src-probe-row { flex-direction: column; }
  .src-host { min-height: 28px; }
  .src-confirm-btns .btn { width: 100%; }
}

/* ---------------------------------------------------------------- toasts */
/* bottom-left snackbars (bottom-centre on phones), above the player; they never swallow clicks except on their × */
.toasts { position: fixed; z-index: 90; left: max(16px, env(safe-area-inset-left, 0px)); bottom: calc(var(--player-h) + 16px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 10px; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
@media (max-width: 560px) { .toasts { left: 12px; right: 12px; width: auto; } }
.toast {
  display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r-md); pointer-events: none;
  background: var(--surface); color: var(--text); border: 1px solid var(--line-2); box-shadow: var(--shadow-pop);
  font-size: 14px; line-height: 1.45; animation: toast-in .35s var(--ease-out);
}
.toast .i { color: var(--accent); margin-top: 1px; }
.toast.is-bad .i { color: var(--bad); }
.toast.is-ok .i { color: var(--ok); }
.toast .x { margin: -6px -8px -6px auto; width: 30px; height: 30px; pointer-events: auto; }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: opacity .25s, transform .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ---------------------------------------------------------------- footer */
.ftr { margin-top: auto; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--surface) 40%, transparent); }
.ftr-in { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); gap: 28px; padding-block: 40px 28px; }
.ftr .brand { margin-bottom: 12px; }
.ftr p { font-size: 13.5px; color: var(--text-3); max-width: 46ch; line-height: 1.6; }
.ftr h2 { font: 700 12px/1 var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin-bottom: 12px; }
.ftr ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ftr ul a { color: var(--text-2); text-decoration: none; font-size: 14px; }
.ftr ul a:hover { color: var(--accent); }
.ftr-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding-block: 16px 22px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--text-3); }
.ftr-base a { color: var(--text-3); }
@media (max-width: 720px) { .ftr-in { grid-template-columns: 1fr 1fr; } .ftr-in > :first-child { grid-column: 1 / -1; } }
body.is-reading .ftr { display: none; }

/* boot screen (before app.js runs) */
.boot { display: grid; place-items: center; gap: 14px; padding: 18vh 20px; color: var(--text-3); font-size: 14px; }
.boot .gem { width: 44px; height: 44px; animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.noscript { max-width: 520px; margin: 60px auto; padding: 20px; text-align: center; }

/* ---------------------------------------------------------------- phone polish */
/* taps respond at once (no double-tap-to-zoom wait) */
a, button, summary, label, select, input, textarea, [role="button"] { touch-action: manipulation; }

/* iOS Safari zooms the whole page when a field with text under 16px gets focus: keep fields at 16px on phones and tablets */
@media (max-width: 860px), (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea, .input, .select, .textarea { font-size: 16px; }
}

/* home: "Light Novels | Novels" quick links under the banner */
.kind-quick { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.kind-quick .chip { min-height: 44px; padding: 0 18px; font-size: 15px; font-weight: 650; gap: 8px; }
.kind-quick .chip .i { color: var(--accent); }
.kind-quick .chip .count { font-size: 13px; }

@media (max-width: 720px) {
  /* a shorter banner, so the first shelf of covers shows above the fold on a phone */
  .slide { padding: 20px 18px 62px; }
  .slide-kicker { margin-bottom: 10px; }
  .slide-meta { margin-top: 10px; }
  .slide-desc { -webkit-line-clamp: 3; margin-top: 12px; }
  .slide-cta { margin-top: 18px; }
  .kind-quick { display: grid; grid-template-columns: 1fr 1fr; margin-top: 14px; }
  .kind-quick .chip { justify-content: center; padding: 0 10px; }
  .hero-stats { margin-top: 14px; }
}

.f-toggle { display: none; }
@media (max-width: 560px) {
  /* browse: search, sort and "Filters" + the type chips show first; genre, status, language and website open from the button */
  .filters { gap: 8px; }
  .filters .f-sort { grid-column: auto; }
  .f-toggle { display: inline-flex; justify-content: center; align-items: center; gap: 8px; min-height: 44px; width: 100%; }
  .f-toggle .count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--accent-fill); color: #fff; font-size: 12px; font-weight: 700; display: inline-grid; place-items: center; }
  .f-toggle .count:empty { display: none; }
  .f-toggle[aria-expanded="true"] { border-color: var(--accent-line); color: var(--accent); }
  .page:not(.show-more) .f-extra, .page:not(.show-more) #bLang, .page:not(.show-more) #bSrc { display: none; }
  .lang-bar { margin-top: 8px; }
  .result-bar { margin: 14px 0 12px; padding-bottom: 10px; }
}

@media (max-width: 680px) {
  /* reader: the site header slides away while you read down the page (see setupReaderHeader in app.js) */
  .hdr, .rd-bar { transition: transform .24s var(--ease), top .24s var(--ease); }
  body.hdr-away .hdr { transform: translateY(-100%); }
  body.hdr-away .rd-bar { top: 0; }
  .brand { min-height: 44px; }
}

/* ---------------------------------------------------------------- motion + print */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .cover.is-loading::before { animation: none !important; }
  .card:hover .cover, .upd:hover, .gtile:hover, .ltile:hover { transform: none !important; }
  .card:hover .cover > img { transform: none !important; }
}
html.reduce-motion *, html.reduce-motion *::before, html.reduce-motion *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
@media print {
  .hdr, .ftr, #player, .rd-bar, .rd-progress, .rd-end, .toasts, .nudge { display: none !important; }
  body { background: #fff; color: #000; }
  .rd-text { color: #000 !important; }
}
