/* Tuế Nguyệt — giao diện người đọc. Ưu tiên mobile, chữ dễ đọc, vùng chạm ≥ 44px. */
/* Phông chữ --sans, --serif dùng chung cho toàn site, khai báo trong fonts.css. */

:root {
    --paper: #faf9f5;
    --surface: #fffefa;
    --ink: #243b34;
    --ink-soft: #3c4c45;
    --muted: #5d675d;
    --green: #214d40;
    --green-dark: #163c31;
    --on-accent: #fffefa;
    --line: #e3e5da;
    --line-strong: #cfd3c4;
    --soft: #eef1e8;
    --gold: #7a612b;
    --danger: #a33737;
    --danger-soft: #f9eeee;
    --on-danger: #fff;
    --warning-bg: #f7eac8;
    --warning-ink: #6b5115;
    --shadow: 0 12px 35px rgb(34 61 50 / 7%);
    --header-h: 72px;
    color-scheme: light;
}
:root[data-theme=sepia] {
    --paper: #f1e7d0;
    --surface: #f8f0dd;
    --ink: #3b2f22;
    --ink-soft: #4a3d2d;
    --muted: #67573f;
    --green: #2f5a45;
    --green-dark: #20402f;
    --on-accent: #f8f0dd;
    --line: #e0d2b2;
    --line-strong: #cdbb94;
    --soft: #ece0c4;
    --gold: #765a22;
    --danger: #973126;
    --danger-soft: #f3dfd1;
    --warning-bg: #ecd9a8;
    --warning-ink: #5a4310;
    --shadow: 0 12px 35px rgb(80 60 20 / 10%);
}
:root[data-theme=dark] {
    --paper: #151d19;
    --surface: #1c2722;
    --ink: #e4e9dd;
    --ink-soft: #cdd5c9;
    --muted: #a6b2a5;
    --green: #a7ceb3;
    --green-dark: #cfdec6;
    --on-accent: #10241b;
    --line: #33443a;
    --line-strong: #46594d;
    --soft: #25362c;
    --gold: #d9bf85;
    --danger: #ffaaaa;
    --danger-soft: #3a2224;
    --on-danger: #2a0d0d;
    --warning-bg: #4a3d1c;
    --warning-ink: #f3dca2;
    --shadow: 0 12px 35px rgb(0 0 0 / 20%);
    color-scheme: dark;
}

/* Nền tảng */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--green); }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, input, select, textarea, summary { touch-action: manipulation; }
button { cursor: pointer; }
img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, p { margin-top: 0; }
h1, h2 { font-family: var(--serif); font-weight: 500; line-height: 1.2; letter-spacing: -.02em; overflow-wrap: anywhere; }
h1 { font-size: 38px; }
h2 { font-size: 28px; }
h3 { font-size: 17px; line-height: 1.45; }
p { margin-bottom: 1em; }
strong { font-weight: 600; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
::selection { background: #d6dfc5; color: #173f35; }
[hidden] { display: none !important; }
.icon { flex: none; width: 20px; height: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 16px; top: -100px; z-index: 100; padding: 10px 14px; background: var(--surface); color: var(--green); border-radius: 6px; box-shadow: var(--shadow); }
.skip-link:focus { top: 12px; }
.container { width: min(1200px, calc(100% - 64px)); margin-inline: auto; }
.muted { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.eyebrow { margin-bottom: 14px; color: var(--green); font: 600 12px/1.4 var(--sans); letter-spacing: .16em; }
.eyebrow span { margin-right: 6px; font-size: 14px; }
kbd { display: inline-block; min-width: 24px; padding: 1px 6px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--paper); font: 13px var(--sans); text-align: center; }

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 28px; min-height: var(--header-h); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--green); font-family: var(--serif); font-size: 25px; line-height: 1.1; white-space: nowrap; }
.brand-mark { flex: none; width: 44px; height: 44px; }
.main-nav { display: flex; align-self: stretch; gap: 4px; }
.main-nav a { position: relative; display: flex; align-items: center; padding: 0 14px; color: var(--ink); font-size: 15px; }
.main-nav a:hover { color: var(--green); }
.main-nav a.active { color: var(--green); font-weight: 600; }
.main-nav a.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--green); }
.header-search { position: relative; flex: 0 1 280px; margin-left: auto; }
.header-search .icon { position: absolute; left: 13px; top: 50%; width: 18px; height: 18px; margin-top: -9px; color: var(--muted); pointer-events: none; }
.header-search input:not([type=checkbox]) { min-height: 42px; padding: 8px 14px 8px 40px; border-radius: 999px; background: var(--paper); font-size: 15px; }
.account-nav { display: flex; align-items: center; gap: 6px; }
.main-nav + .account-nav { margin-left: auto; }
.account-nav form { margin: 0; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 42px; height: 42px; padding: 0 10px; border: 0; border-radius: 999px; background: none; color: var(--ink); font-size: 14px; white-space: nowrap; }
.icon-button:hover { background: var(--soft); color: var(--green); }
.icon-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.account-link { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 4px 12px 4px 4px; border-radius: 999px; font-size: 14px; }
.account-link:hover { background: var(--soft); }
.avatar { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: #d9bf85; color: #173f35; font: 600 15px var(--sans); }
.account-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Thanh tab dưới đáy (mobile) */
.tab-bar { display: none; }

/* Nội dung chung */
.page-content { min-height: 60vh; padding-block: 32px 72px; }
.notice { margin-bottom: 24px; padding: 14px 18px; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: 8px; background: var(--surface); overflow-wrap: anywhere; }
.notice ul { margin: 6px 0 0; padding-left: 20px; }
.notice-error { border-color: #e3b7b7; border-left-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.panel { min-width: 0; margin-bottom: 28px; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0 0 20px; color: var(--muted); font-size: 14px; }
.breadcrumb a:hover { color: var(--green); text-decoration: underline; }
.breadcrumb > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60vw; }
.page-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 24px; }
.page-header h1 { margin: 0 0 4px; font-size: 34px; }
.page-header p { margin: 0; }
.section-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-heading h2 { margin: 0 0 6px; }
.section-heading .eyebrow { margin-bottom: 8px; }
.section-heading p { margin: 0; font-size: 15px; }
.section-heading-compact h2 { font-size: 26px; }
.section-link { flex: none; color: var(--green); font-size: 15px; font-weight: 600; }
.heading-dot { color: var(--gold); }

/* Nút */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px; border: 1px solid var(--green); border-radius: 8px; background: var(--green); color: var(--on-accent); font-size: 15px; font-weight: 600; line-height: 1.3; text-align: center; transition: background-color .15s, border-color .15s, color .15s, transform .15s; }
.button:hover { background: var(--green-dark); border-color: var(--green-dark); color: var(--on-accent); }
.button .icon { width: 18px; height: 18px; }
.button-secondary { background: var(--surface); color: var(--green); border-color: var(--line-strong); }
.button-secondary:hover { background: var(--soft); color: var(--green); border-color: var(--green); }
.button-small { min-height: 40px; padding: 7px 14px; font-size: 14px; }
.button-danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.button-danger:hover { background: var(--danger); border-color: var(--danger); color: var(--on-danger); filter: brightness(.92); }
.button-danger-outline { background: transparent; color: var(--danger); border-color: currentColor; }
.button-danger-outline:hover { background: var(--danger-soft); color: var(--danger); border-color: currentColor; }
.button-ghost { background: transparent; color: var(--muted); border-color: transparent; }
.button-ghost:hover { background: var(--soft); color: var(--danger); border-color: transparent; }
.button-block { width: 100%; }
.text-link { padding: 8px 0; border: 0; background: none; color: var(--green); font-size: 15px; font-weight: 600; }
.text-link:hover { text-decoration: underline; }
.badge { display: inline-flex; align-items: center; justify-content: center; padding: 2px 10px; border-radius: 999px; background: var(--green); color: var(--on-accent); font-size: 12.5px; font-weight: 600; line-height: 1.6; white-space: nowrap; vertical-align: middle; }
.badge-soft { background: var(--soft); color: var(--green); }
.badge-warning { background: var(--warning-bg); color: var(--warning-ink); }

/* Biểu mẫu */
label { font-size: 15px; font-weight: 600; }
input:where(:not([type=checkbox], [type=radio])), select, textarea { width: 100%; max-width: 100%; min-height: 48px; padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 16px; line-height: 1.4; }
input:where(:not([type=checkbox], [type=radio])):focus, select:focus, textarea:focus { border-color: var(--green); outline: 2px solid transparent; box-shadow: 0 0 0 3px rgb(33 77 64 / 18%); }
::placeholder { color: var(--muted); opacity: 1; }
textarea { min-height: 120px; line-height: 1.6; resize: vertical; }
input[type=checkbox], input[type=radio] { flex: none; width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--green); }
input[readonly] { background: var(--soft); }
fieldset { min-width: 0; margin: 0; }
.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field-help { margin: 0; color: var(--muted); font-size: 14px; }
.field-error, .error { color: var(--danger); font-size: 14px; }
.checkbox { display: inline-flex; align-items: flex-start; gap: 10px; font-weight: 400; cursor: pointer; }
.split-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.split-row a { color: var(--green); font-size: 15px; font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.actions form { margin: 0; }
.form-grid { display: grid; gap: 18px; }

/* Trang chủ: hero */
.hero { position: relative; display: grid; grid-template-columns: 1.15fr 1fr; min-height: 438px; overflow: hidden; border: 1px solid #e2e6d7; border-radius: 12px; background: #edf0e5; }
.hero-copy { position: relative; z-index: 2; padding: 44px 48px; }
.hero .eyebrow { color: #214d40; }
.hero h1 { margin-bottom: 20px; color: #1f493b; font-size: 66px; line-height: 1.12; letter-spacing: -.03em; }
.hero h1 em { font-weight: 400; color: #8b764a; }
.hero-copy > p:not(.eyebrow) { color: #4f5946; font-size: 16px; line-height: 1.8; }
.hero .button { margin-top: 8px; background: #214d40; color: #fffefa; border-color: #214d40; }
.hero .button:hover { background: #163c31; border-color: #163c31; }
.hero-note { display: flex; align-items: center; gap: 8px; margin-top: 20px; color: #545f4c; font-size: 13px; }
.tiny-moon { color: #9c875b; font-size: 18px; }
.hero-art { position: relative; min-height: 430px; }
.art-orbit { position: absolute; top: 24px; left: 24px; width: 400px; height: 400px; border: 1px solid #d2d8c3; border-radius: 50%; }
.orbit-two { top: 54px; left: 54px; width: 340px; height: 340px; }
.art-moon { position: absolute; top: 8px; right: 40px; color: #bca66e; font: 110px/1 var(--serif); transform: rotate(-25deg); }
.art-star { position: absolute; color: #a48c55; font-size: 30px; }
.star-one { top: 45px; left: 10px; }
.star-two { right: 32px; bottom: 65px; font-size: 20px; }
.art-book { position: absolute; width: 185px; height: 268px; overflow: hidden; border-radius: 2px 7px 7px 2px; box-shadow: 12px 18px 25px #324d3630, inset 6px 0 5px #0002; font-family: var(--serif); text-align: center; }
.book-back { top: 108px; left: 205px; padding: 38px 25px; border-right: 8px solid #dfe1d0; background: #b9bd9c; color: #3a4c39; font-size: 23px; transform: rotate(15deg); }
.book-back::after { content: ""; position: absolute; bottom: -20px; left: 20px; width: 150px; height: 130px; border-radius: 100% 100% 0 0; background: #8f9d7a; }
.book-front { top: 62px; left: 65px; padding: 20px 18px; border-right: 7px solid #e7e4cc; background: #214b40; color: #f6edd6; transform: rotate(-11deg); }
.art-book-label { display: block; font: 6px var(--sans); letter-spacing: .2em; }
.book-title { position: relative; z-index: 2; display: block; margin-top: 25px; font-size: 35px; line-height: 1.2; }
.book-front small { position: absolute; left: 0; right: 0; bottom: 18px; font: 6px var(--sans); letter-spacing: .2em; }
.book-landscape { position: absolute; bottom: -35px; left: -70px; width: 250px; height: 160px; border-radius: 50%; background: #9bab8833; box-shadow: 100px 0 0 #c4c6a044, 70px -20px 0 #57735880; }
.art-caption { position: absolute; bottom: 35px; left: 100px; color: #5f6a54; font-size: 11px; letter-spacing: .06em; }
.reading-values { display: flex; justify-content: center; gap: 56px; padding: 24px 0 32px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.reading-values b { margin-right: 9px; color: var(--green); font-size: 19px; font-weight: 400; vertical-align: middle; }

/* Trang chủ: đọc tiếp */
.continue-section { margin-bottom: 8px; }
.continue-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.continue-card { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 12px 14px 12px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s, box-shadow .15s; }
.continue-card:hover { border-color: var(--green); box-shadow: var(--shadow); color: inherit; }
.continue-card .story-thumb { width: 54px; height: 72px; }
.continue-card > .icon { margin-left: auto; color: var(--muted); }
.continue-info { display: flex; flex-direction: column; min-width: 0; font-size: 14px; line-height: 1.4; }
.continue-info strong { overflow: hidden; color: var(--ink); font: 600 17px/1.3 var(--serif); text-overflow: ellipsis; white-space: nowrap; }
.continue-info span:nth-child(2) { margin-top: 3px; color: var(--green); font-weight: 600; }
.continue-info .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Trang chủ: thư viện */
.catalog { padding-top: 40px; }
.catalog-total { color: var(--muted); font-size: 14px; white-space: nowrap; }
.search-bar { display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 18px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; }
.search-bar:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgb(33 77 64 / 15%); }
.search-bar > .icon { color: var(--muted); }
.search-bar input:not([type=checkbox]) { flex: 1; min-width: 0; min-height: 44px; padding: 8px 0; border: 0; background: transparent; box-shadow: none; }
.search-bar input:not([type=checkbox]):focus { box-shadow: none; }
.filter-form { margin-top: 14px; }
.chip-group { display: flex; align-items: center; gap: 14px; }
.chip-label { flex: none; min-width: 84px; color: var(--muted); font-size: 14px; font-weight: 600; }
.chip-row { position: relative; display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 38px; padding: 6px 15px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: 14px; white-space: nowrap; }
.chip:hover { border-color: var(--green); color: var(--green); }
.chip[aria-pressed=true] { background: var(--green); border-color: var(--green); color: var(--on-accent); font-weight: 600; }
.catalog-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 32px 0 24px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.catalog-toolbar h3 { margin: 0; font-size: 17px; font-weight: 600; }
.catalog-toolbar > a { color: var(--green); font-size: 14px; font-weight: 600; }
.catalog-toolbar > span { font-size: 14px; }

/* Thẻ truyện và bìa */
.story-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 32px 22px; }
.story-card { min-width: 0; }
.story-cover-link { position: relative; display: block; margin-bottom: 12px; }
.story-cover { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px; box-shadow: 3px 5px 12px rgb(33 63 52 / 16%); transition: transform .25s, box-shadow .25s; }
.story-cover-link:hover .story-cover { transform: translateY(-4px); box-shadow: 5px 12px 22px rgb(33 63 52 / 20%); }
.typographic-cover { position: relative; isolation: isolate; display: flex; flex-direction: column; align-items: center; justify-content: center; overflow: hidden; padding: 20px 14px; border-left: 4px solid #0002; background: #294c43; color: #f3ecd5; text-align: center; }
.typographic-cover::before { content: ""; position: absolute; inset: 9px; z-index: -1; border: 1px solid #e6e9d433; border-radius: 1px; }
.cover-imprint { position: absolute; top: 18px; font-size: 7px; letter-spacing: .2em; }
.cover-ornament { margin-bottom: 12px; color: #d5be8e; font: 28px var(--serif); }
.cover-title { position: relative; z-index: 2; font: 22px/1.23 var(--serif); text-wrap: balance; overflow-wrap: anywhere; }
.cover-author { position: absolute; bottom: 20px; z-index: 2; max-width: 90%; overflow: hidden; font-size: 9px; letter-spacing: .07em; text-overflow: ellipsis; white-space: nowrap; }
.cover-landscape { position: absolute; bottom: -30%; left: -20%; z-index: -1; width: 170%; height: 60%; border-radius: 50%; background: #c1c1a426; box-shadow: 40px -22px 0 #ddd7b511, 80px -10px 0 #a4ba9b30; }
.cover-tone-0 { background: #294c43; color: #f3ecd5; }
.cover-tone-1 { background: #76634b; color: #fff9e8; }
.cover-tone-2 { background: #4d5b64; color: #f8f3df; }
.cover-tone-3 { background: #65554c; color: #f4e9d9; }
.cover-tone-4 { background: #4c6652; color: #fffbdf; }
.cover-tone-5 { background: #52506d; color: #fff6e5; }
.story-cover-link:has(.cover-badge) .cover-author { display: none; }
.cover-badge { position: absolute; right: 8px; bottom: 10px; padding: 3px 8px; border-radius: 4px; background: #fffef4f0; color: #244a3a; font-size: 11px; font-weight: 600; }
.story-genre { margin-bottom: 4px; color: var(--gold); font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.story-info h3 { margin: 0 0 4px; font: 600 17px/1.35 var(--serif); overflow-wrap: anywhere; }
.story-author { margin-bottom: 6px; color: var(--muted); font-size: 14px; }
.story-meta { display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 13px; }
.story-meta span + span::before { content: "·"; padding-right: 6px; }
.latest-chapter { display: flex; justify-content: space-between; gap: 8px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); color: var(--green); font-size: 13.5px; font-weight: 600; }
.story-thumb { display: block; flex: none; width: 72px; height: 96px; object-fit: cover; border-radius: 4px; box-shadow: 0 2px 6px rgb(0 0 0 / 15%); }
.typographic-thumb { display: flex; align-items: center; justify-content: center; border-left: 3px solid #0002; font: 28px var(--serif); }
.shelf-callout { display: flex; align-items: center; gap: 24px; margin-top: 64px; padding: 30px 36px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; }
.shelf-callout > span { color: var(--gold); font-size: 60px; line-height: 1; transform: rotate(-20deg); }
.shelf-callout h2 { margin-bottom: 6px; font-size: 26px; }
.shelf-callout p { margin: 0; color: var(--muted); font-size: 15px; }
.shelf-callout .button { margin-left: auto; white-space: nowrap; }

/* Phân trang, trạng thái rỗng, lỗi */
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 18px; margin-block: 32px 4px; font-size: 15px; }
.pagination a, .pagination .disabled { display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); }
.pagination a:hover { border-color: var(--green); }
.pagination .disabled { color: var(--muted); opacity: .6; }
.empty-state { grid-column: 1 / -1; width: 100%; padding: 64px 24px; border: 1px dashed var(--line-strong); border-radius: 12px; text-align: center; }
.empty-state h2, .empty-state h3 { font-family: var(--serif); font-size: 24px; font-weight: 500; }
.empty-state p { max-width: 520px; margin-inline: auto; color: var(--muted); }
.empty-icon { display: block; margin-bottom: 20px; color: var(--gold); font-size: 56px; line-height: 1; }
.error-page { margin-block: 40px; border: 0; }
.error-code { display: block; color: var(--gold); font: 90px/1 var(--serif); }

/* Trang truyện */
.story-detail { display: grid; grid-template-columns: 220px minmax(0, 1fr); grid-template-areas: "cover info" "cover actions" "cover desc"; grid-template-rows: auto auto 1fr; gap: 0 40px; margin-bottom: 28px; padding: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.detail-cover { grid-area: cover; }
.detail-cover .typographic-cover { min-height: 294px; }
.detail-cover .cover-title { font-size: 30px; }
.detail-info { grid-area: info; min-width: 0; }
.detail-info h1 { margin: 10px 0 8px; font-size: 42px; }
.detail-author { margin: 0; color: var(--muted); font-size: 16px; }
.detail-author strong { color: var(--ink); }
.genre-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.genre-chips a { padding: 4px 12px; border-radius: 999px; background: var(--soft); color: var(--green); font-size: 13px; font-weight: 600; }
.genre-chips a:hover { background: var(--green); color: var(--on-accent); }
.story-stats { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin: 16px 0 0; padding: 0; color: var(--muted); font-size: 15px; list-style: none; }
.story-stats li { display: inline-flex; align-items: center; gap: 6px; }
.story-stats .icon { width: 17px; height: 17px; }
.detail-actions { grid-area: actions; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 24px 0 0; }
.detail-actions form { margin: 0; }
.latest-line { flex-basis: 100%; margin: 0; color: var(--muted); font-size: 15px; }
.latest-line a { color: var(--green); font-weight: 600; }
.detail-description { grid-area: desc; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.story-description { margin: 0; color: var(--ink-soft); font-size: 16px; line-height: 1.85; white-space: pre-line; }
.story-description.is-clamped { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 5; }
.chapter-list .section-heading { align-items: center; }
.chapter-list .section-heading h2 { margin: 0; }
.toc-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 36px; margin: 0; padding: 0; list-style: none; }
.toc-list a { display: flex; align-items: center; gap: 14px; min-height: 54px; padding: 10px 6px; border-top: 1px solid var(--line); color: var(--ink); }
.toc-list a:hover { color: var(--green); background: var(--soft); }
.toc-list a.is-reading { color: var(--green); font-weight: 600; }
.chapter-number { min-width: 34px; color: var(--gold); font: 18px var(--serif); font-variant-numeric: tabular-nums; }
.chapter-title { flex: 1; min-width: 0; font-size: 15.5px; overflow-wrap: anywhere; }
.chapter-date { color: var(--muted); font-size: 13px; white-space: nowrap; }
.toc-digits-4 .chapter-number { min-width: calc(4ch + 4px); }
.toc-digits-5 .chapter-number { min-width: calc(5ch + 4px); }
.toc-digits-6 .chapter-number { min-width: calc(6ch + 4px); }
.toc-digits-7 .chapter-number { min-width: calc(7ch + 4px); }
.toc-list li { scroll-margin-top: 112px; }
html:has(.toc-list li:target) { scroll-behavior: auto; }
.toc-list li:target a { background: var(--soft); box-shadow: inset 3px 0 0 var(--gold); }

/* Mục lục: tới vùng chương đang đọc, chọn vùng, nhảy tới chương */
.toc-tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 16px 24px; margin: 0 0 20px; padding: 16px 18px; background: var(--paper); border: 1px solid var(--line); border-radius: 10px; }
.toc-form { display: flex; flex: 1 1 250px; flex-direction: column; gap: 6px; min-width: 0; margin: 0; }
.toc-form label { color: var(--muted); font-size: 14px; }
.toc-form-row { display: flex; gap: 8px; }
.toc-form-row select, .toc-form-row input:not([type=hidden]) { flex: 1; min-width: 0; min-height: 44px; padding-block: 8px; }
.toc-form-row .button { flex: none; min-height: 44px; padding-inline: 18px; }
.toc-form .field-error { margin: 0; }
.toc-resume { display: inline-flex; flex: 0 1 auto; align-items: center; gap: 10px; min-height: 44px; padding: 8px 16px 8px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--green); font-size: 15px; line-height: 1.35; }
.toc-resume:hover { border-color: var(--green); background: var(--soft); }
.toc-resume strong { display: block; color: var(--ink); }
.toc-notice { margin: 8px 0 0; padding: 10px 14px; border-left: 3px solid var(--gold); border-radius: 6px; background: var(--soft); font-size: 15px; }

/* Trang đọc chương */
.reading-progress { position: fixed; top: 0; left: 0; right: 0; z-index: 70; height: 3px; pointer-events: none; }
.reading-progress span { display: block; height: 100%; background: var(--gold); transform: scaleX(0); transform-origin: 0 50%; }
.reading-panel { --measure: 760px; max-width: var(--measure); margin: 0 auto 32px; padding: 48px clamp(24px, 6vw, 72px); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.reading-panel[data-measure=narrow] { --measure: 640px; }
.reading-panel[data-measure=wide] { --measure: 940px; }
.reading-heading { margin-bottom: 8px; text-align: center; }
.reading-heading .eyebrow { display: inline-block; margin-bottom: 0; color: var(--muted); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
.reading-heading .eyebrow:hover { color: var(--green); }
.reading-heading h1 { margin: 18px 0 10px; font-size: 34px; line-height: 1.3; }
.chapter-label { display: block; margin-bottom: 8px; color: var(--gold); font: 600 13px/1.4 var(--sans); letter-spacing: .16em; text-transform: uppercase; }
.chapter-heading-title { display: block; }
.reading-meta { margin: 0 0 18px; color: var(--muted); font-size: 14px; }
.reading-settings-button { margin-bottom: 4px; }
.chapter-navigation { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin: 28px 0; }
.chapter-navigation > :first-child { justify-self: start; }
.chapter-navigation > :last-child { justify-self: end; }
.toc-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 10px; color: var(--muted); font-size: 15px; }
.toc-link .icon { width: 18px; height: 18px; }
.nav-end { color: var(--muted); font-size: 14px; text-align: right; }
.chapter-content { --reading-font: var(--serif); --reading-leading: 1.85; color: var(--ink); font-family: var(--reading-font); font-size: 20px; line-height: var(--reading-leading); overflow-wrap: anywhere; text-rendering: optimizeLegibility; }
.chapter-content p { margin: 0 0 1.15em; }
.reading-panel[data-font=sans] .chapter-content { --reading-font: var(--sans); }
.reading-panel[data-leading=compact] .chapter-content { --reading-leading: 1.6; }
.reading-panel[data-leading=relaxed] .chapter-content { --reading-leading: 2.1; }
.chapter-content[data-font-size="16"] { font-size: 16px; }
.chapter-content[data-font-size="18"] { font-size: 18px; }
.chapter-content[data-font-size="20"] { font-size: 20px; }
.chapter-content[data-font-size="22"] { font-size: 22px; }
.chapter-content[data-font-size="24"] { font-size: 24px; }
.chapter-content[data-font-size="26"] { font-size: 26px; }
.chapter-content[data-font-size="28"] { font-size: 28px; }
.chapter-end { margin: 40px 0 0; color: var(--gold); font: italic 17px var(--serif); text-align: center; }
.is-reading .comments-section { max-width: 760px; }

/* Bảng tùy chỉnh đọc */
.reader-settings { width: min(440px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 8px 22px 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 60px rgb(0 0 0 / 25%); }
.reader-settings::backdrop { background: rgb(0 0 0 / 30%); }
.settings-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; }
.settings-header h2 { margin: 0; font-size: 22px; }
.setting-group { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.setting-label { font-size: 15px; font-weight: 600; }
.segmented { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--soft); }
.segmented button { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 13px; border: 0; border-radius: 8px; background: none; color: var(--ink); font-size: 14.5px; }
.segmented button[aria-pressed=true] { background: var(--surface); color: var(--green); font-weight: 600; box-shadow: 0 1px 3px rgb(0 0 0 / 15%); }
.stepper { display: inline-flex; align-items: center; gap: 8px; }
.stepper button { width: 46px; height: 42px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--green); font: 600 16px var(--serif); }
.stepper button:hover { background: var(--soft); }
.stepper output { min-width: 34px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.swatch { width: 14px; height: 14px; border: 1px solid rgb(0 0 0 / 25%); border-radius: 50%; }
.swatch-light { background: #fffefa; }
.swatch-sepia { background: #f1e3c2; }
.swatch-dark { background: #1c2722; }
.settings-hint { margin: 4px 0 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }

/* Thanh đọc nhanh */
.reader-dock { position: fixed; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 60; display: flex; gap: 4px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 10px 30px rgb(0 0 0 / 16%); transform: translateX(-50%); transition: transform .25s ease, opacity .25s ease, visibility 0s; }
.reader-dock.is-hidden { opacity: 0; visibility: hidden; transform: translate(-50%, calc(100% + 40px)); transition: transform .25s ease, opacity .25s ease, visibility 0s linear .25s; }
.reader-dock a, .reader-dock button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 0; border-radius: 999px; background: none; color: var(--ink); font: 500 14.5px var(--sans); white-space: nowrap; }
.reader-dock a:hover, .reader-dock button:not(:disabled):hover { background: var(--soft); color: var(--green); }
.reader-dock .is-primary { background: var(--green); color: var(--on-accent); }
.reader-dock .is-primary:hover { background: var(--green-dark); color: var(--on-accent); }
.reader-dock button:disabled { opacity: .45; cursor: default; }
.reader-dock .icon { width: 20px; height: 20px; }
body.is-reading { padding-bottom: 96px; }

/* Bình luận */
.comments-section { max-width: 900px; margin-inline: auto; }
.comments-section .section-heading h2 .badge { margin-left: 6px; font-family: var(--sans); font-size: 13px; letter-spacing: 0; }
.comment-form { display: grid; gap: 8px; margin-bottom: 8px; }
.comment-form-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; }
.comment-form-footer p { margin: 0; font-size: 14px; }
.comment-form-footer .actions { margin-left: auto; }
.comment-form-footer .actions a { color: var(--green); font-size: 15px; }
.comment-login { margin-bottom: 8px; padding: 18px; background: var(--paper); border: 1px dashed var(--line-strong); border-radius: 10px; text-align: center; }
.comment-login p { margin: 0; }
.comment-login a { color: var(--green); font-weight: 600; text-decoration: underline; }
.comment { display: flex; gap: 14px; padding: 20px 0; border-top: 1px solid var(--line); }
.comments-list { margin-top: 12px; }
.comment-avatar { flex: 0 0 40px; display: flex; align-items: center; justify-content: center; height: 40px; border-radius: 50%; background: var(--soft); color: var(--green); font: 20px var(--serif); }
.comment-main { flex: 1; min-width: 0; }
.comment-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 6px; font-size: 15px; }
.comment-meta time { color: var(--muted); font-size: 13.5px; }
.comment-meta .muted { font-size: 13.5px; }
.comment-body { margin: 0; font-size: 16px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-manage { display: inline-block; margin-top: 8px; color: var(--muted); font-size: 14px; }
.empty-comment { padding: 28px 0 8px; color: var(--muted); font-size: 15px; text-align: center; }

/* Khu vực cá nhân */
.account-tabs { display: flex; gap: 4px; margin: 0 0 28px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.account-tabs::-webkit-scrollbar { display: none; }
.account-tabs a { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; margin-bottom: -1px; padding: 0 14px; border-bottom: 3px solid transparent; color: var(--muted); font-size: 15px; white-space: nowrap; }
.account-tabs a:hover { color: var(--green); }
.account-tabs a.active { border-bottom-color: var(--green); color: var(--green); font-weight: 600; }
.account-tabs .icon { width: 18px; height: 18px; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 16px; }
.library-card { display: flex; gap: 16px; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.library-card .story-thumb { width: 84px; height: 112px; }
.library-info { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.library-info h2 { margin: 0 0 2px; font: 600 19px/1.3 var(--serif); letter-spacing: 0; }
.library-info h2 a:hover { color: var(--green); }
.library-info p { margin: 0; }
.library-meta { display: grid; gap: 4px; margin: 8px 0 14px; padding: 0; font-size: 14.5px; list-style: none; }
.library-meta a { color: var(--green); }
.library-meta a:hover { text-decoration: underline; }
.library-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.library-actions form { margin: 0; }
.history-list { margin: 0; padding: 0; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.history-item { display: flex; align-items: flex-start; gap: 14px; padding: 16px; }
.history-item + .history-item { border-top: 1px solid var(--line); }
.history-item .story-thumb { width: 56px; height: 75px; }
.history-item h2 { margin-bottom: 4px; font-size: 18px; }
.history-item p { font-size: 15px; }
.history-item p a { color: var(--green); font-weight: 600; }
.history-time { margin-top: 2px !important; font-size: 13.5px !important; }
.history-remove { margin: 0 0 0 auto; }
.history-remove .icon-button { color: var(--muted); }
.history-remove .icon-button:hover { color: var(--danger); background: var(--danger-soft); }
.my-comment { margin-bottom: 0; padding: 20px 22px; }
.my-comment-header { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 6px; }
.my-comment-header h2 { margin: 0; font-size: 21px; }
.my-comment-header a.muted:hover { color: var(--green); }
.my-comment .comment-meta { margin: 0; }
.my-comment-body { margin: 10px 0 14px; font-size: 16px; white-space: pre-wrap; overflow-wrap: anywhere; }
.my-comment-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; }
.my-comment-actions form { margin: 0; }
.edit-details > summary { list-style: none; }
.edit-details > summary::-webkit-details-marker { display: none; }
.edit-details[open] { order: 2; flex-basis: 100%; }
.edit-details[open] > summary { margin-bottom: 12px; }
.settings-layout { display: grid; gap: 24px; max-width: 720px; }
.settings-card { margin: 0; }
.settings-card h2 { margin-bottom: 18px; font-size: 24px; }
.settings-fieldset { display: grid; gap: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 10px; }
.settings-fieldset legend { padding: 0 6px; font-weight: 600; }

/* Đăng nhập / đăng ký */
.auth-card { max-width: 460px; margin: 16px auto 24px; padding: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.auth-mark { display: block; width: fit-content; margin-bottom: 10px; color: var(--gold); font: 46px/1 var(--serif); transform: rotate(-18deg); }
.auth-card h1 { margin-bottom: 6px; font-size: 34px; }
.auth-card > .muted { margin-bottom: 24px; }
.auth-footer { margin: 22px 0 0; padding-top: 18px; border-top: 1px solid var(--line); text-align: center; }
.auth-footer a { color: var(--green); font-weight: 600; }
.form-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.recaptcha-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.recaptcha-note a { color: inherit; text-decoration: underline; }
.grecaptcha-badge { visibility: hidden; }
.legal-page { max-width: 760px; margin-inline: auto; line-height: 1.75; }
.legal-page h1 { margin-bottom: 16px; }
.legal-page h2 { margin: 28px 0 10px; font-size: 22px; }
.legal-page ul { margin: 0 0 1em; padding-left: 22px; }
.legal-page li + li { margin-top: 6px; }
.legal-draft { padding: 12px 16px; border-left: 4px solid var(--gold); border-radius: 6px; background: var(--warning-bg); color: var(--warning-ink); }

/* Footer */
.site-footer { padding: 36px 0; background: var(--surface); border-top: 1px solid var(--line); }
.footer-inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px; color: var(--muted); font-size: 14px; }
.footer-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--green); font: 25px var(--serif); }
.footer-mark { flex: none; width: 32px; height: 32px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.footer-links a { display: inline-flex; align-items: center; min-height: 40px; color: var(--ink); }
.footer-links a:hover { color: var(--green); }

/* Màn hình lớn */
@media (min-width: 1280px) {
    .icon-label { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
}
@media (min-width: 1500px) {
    .container { width: min(1320px, calc(100% - 100px)); }
    .hero { min-height: 470px; }
    .hero-copy { padding: 55px 65px; }
    .hero-art { margin-left: 25px; }
    .hero h1 { font-size: 74px; }
    .art-book { top: 100px; }
    .book-front { left: 90px; }
    .book-back { top: 145px; left: 235px; }
    .art-orbit { top: 40px; left: 45px; }
    .orbit-two { top: 70px; left: 75px; }
    .art-caption { bottom: 40px; left: 125px; }
}

/* Tablet */
@media (max-width: 1100px) {
    .header-inner { gap: 18px; }
    .main-nav a { padding: 0 10px; }
    .main-nav a.active::after { left: 10px; right: 10px; }
    .header-search { flex-basis: 220px; }
    .account-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .account-link { padding-right: 4px; }
    .story-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .hero-copy { padding: 40px 32px; }
    .hero h1 { font-size: 56px; }
    .hero-art { min-height: 400px; transform: scale(.88); transform-origin: center right; }
    .book-back { left: 170px; }
    .book-front { left: 35px; }
    .art-orbit { left: -10px; }
    .orbit-two { left: 20px; }
    .reading-values { gap: 28px; }
}

/* Mobile */
@media (max-width: 800px) {
    :root { --header-h: 58px; }
    .container { width: calc(100% - 32px); }
    .header-inner { gap: 8px; }
    .brand { font-size: 22px; }
    .brand-mark { width: 36px; height: 36px; }
    .main-nav, .header-search { display: none; }
    .account-nav { margin-left: auto; gap: 2px; }
    .icon-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
    .tab-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -4px 18px rgb(0 0 0 / 6%); }
    .tab-bar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 54px; border-radius: 12px; color: var(--muted); font-size: 12px; font-weight: 500; }
    .tab-bar a.active { color: var(--green); font-weight: 700; }
    .tab-bar a.active .icon { stroke-width: 2.2; }
    .tab-bar .icon { width: 22px; height: 22px; }
    body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
    body.is-reading { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
    .is-reading .tab-bar { display: none; }
    .page-content { padding-block: 20px 40px; }
    h1 { font-size: 30px; }
    h2 { font-size: 24px; }
    .panel { padding: 22px 18px; border-radius: 12px; }
    .page-header h1 { font-size: 28px; }
    .hero { grid-template-columns: 1fr; min-height: 0; }
    .hero-art { display: none; }
    .hero-copy { padding: 30px 24px 28px; }
    .hero h1 { font-size: 44px; }
    .hero-note { display: none; }
    .reading-values { display: none; }
    .catalog { padding-top: 28px; }
    .catalog-total { display: none; }
    .section-heading h2 { font-size: 25px; }
    .chip-group { flex-direction: column; align-items: stretch; gap: 6px; }
    .chip-row { flex-wrap: nowrap; margin-inline: -16px; padding: 2px 16px 4px; overflow-x: auto; scrollbar-width: none; }
    .chip-row::-webkit-scrollbar { display: none; }
    .story-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px 16px; }
    .shelf-callout { flex-wrap: wrap; gap: 14px; padding: 24px 20px; }
    .shelf-callout > span { font-size: 42px; }
    .shelf-callout > div { flex: 1 1 200px; }
    .shelf-callout .button { margin-left: 0; }
    .continue-list { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: minmax(260px, 82%); margin-inline: -16px; padding: 2px 16px 6px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
    .continue-list::-webkit-scrollbar { display: none; }
    .continue-card { scroll-snap-align: start; }
    .story-detail { grid-template-columns: 112px minmax(0, 1fr); grid-template-areas: "cover info" "actions actions" "desc desc"; gap: 0 16px; padding: 18px; }
    .detail-cover .typographic-cover { min-height: 0; padding: 10px 8px; }
    .detail-cover .cover-title { font-size: 15px; }
    .detail-cover .cover-ornament { margin-bottom: 6px; font-size: 18px; }
    .detail-cover .cover-imprint, .detail-cover .cover-author { display: none; }
    .detail-info h1 { margin: 8px 0 4px; font-size: 25px; }
    .detail-author { font-size: 15px; }
    .story-stats { gap: 6px 14px; margin-top: 10px; font-size: 14px; }
    .detail-actions { margin-top: 18px; }
    .detail-actions > .button, .detail-actions > form { flex: 1 1 160px; }
    .detail-actions form .button { width: 100%; }
    .detail-description { margin-top: 18px; padding-top: 16px; }
    .toc-list { grid-template-columns: minmax(0, 1fr); }
    .toc-tools { gap: 14px; margin-inline: -4px; padding: 14px; }
    .toc-resume, .toc-form { flex-basis: 100%; }
    .reading-panel { margin-bottom: 20px; padding: 4px 2px 0; background: transparent; border: 0; border-radius: 0; }
    .reading-heading h1 { font-size: 27px; }
    .chapter-navigation { display: flex; gap: 12px; margin-bottom: 8px; }
    .chapter-navigation > * { flex: 1 1 0; }
    .chapter-navigation .toc-link, .chapter-navigation > span:empty, .chapter-navigation.chapter-navigation-top { display: none; }
    .chapter-navigation .button { min-height: 50px; }
    .nav-end { align-self: center; text-align: center; }
    .reader-dock { left: 0; right: 0; bottom: 0; justify-content: space-around; gap: 2px; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-width: 1px 0 0; border-radius: 18px 18px 0 0; transform: none; }
    .reader-dock.is-hidden { transform: translateY(100%); }
    .reader-dock a, .reader-dock button { flex: 1; flex-direction: column; gap: 2px; min-height: 54px; padding: 4px 6px; border-radius: 12px; font-size: 12.5px; }
    .reader-dock .is-primary { flex-direction: column-reverse; }
    .reader-settings { width: 100%; max-width: none; max-height: 85vh; margin: auto 0 0; padding: 6px 18px calc(18px + env(safe-area-inset-bottom)); border-width: 1px 0 0; border-radius: 20px 20px 0 0; }
    .setting-desktop { display: none; }
    .comment { gap: 12px; }
    .comment-avatar { flex-basis: 34px; height: 34px; font-size: 17px; }
    .is-reading .comments-section { border-radius: 12px; }
    .page-header { align-items: flex-start; }
    .library-card { padding: 14px; }
    .library-card .story-thumb { width: 72px; height: 96px; }
    .auth-card { margin: 4px auto 8px; padding: 26px 20px; }
    .auth-card h1 { font-size: 30px; }
    .footer-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
    .site-footer { padding: 28px 0; }
}

@media (min-width: 641px) and (max-width: 800px) {
    .reading-panel { --measure: 640px; padding-inline: 8px; }
    .reader-settings { width: min(560px, 100%); margin: auto auto 0; border-width: 1px 1px 0; }
}

@media (max-width: 540px) {
    .story-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
    .cover-title { font-size: 20px; }
    .hero h1 { font-size: 40px; }
    .hero-copy > p:not(.eyebrow) { font-size: 15px; }
    .search-bar { padding-left: 14px; }
    .search-bar .button { padding-inline: 12px; }
    .catalog-toolbar { margin-top: 24px; }
    .error-code { font-size: 72px; }
}

@media (max-width: 380px) {
    .brand { font-size: 20px; }
    .avatar { width: 30px; height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
    .site-header, .site-footer, .tab-bar, .breadcrumb, .reading-heading .button, .chapter-navigation, .comments-section, .reader-dock, .reading-progress, .reader-settings { display: none !important; }
    .reading-panel { padding: 0; border: 0; }
    .container { width: 100%; }
    body { padding: 0 !important; background: #fff; color: #000; }
    .chapter-content { font-size: 12pt; }
}
