:root {
	--bg: #f3f7fc;
	--surface: #ffffff;
	--surface-2: #e9f0f8;
	--ink: #1e2a45;
	--ink-soft: #4b5a78;
	--ink-faint: #7a86a0;
	--line: #dbe4f0;
	--accent: #356bc0;
	--accent-soft: #e0ebfa;
	--on-accent: #ffffff;
	--ok: #24786a;
	--ok-soft: #d9f0ea;
	--sweet: #c26f16;
	--moon: #ffd36b;
	--shadow: 0 14px 32px -20px rgba(30, 55, 100, .45);

	--font-ui: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
	--font-serif: "Literata", Georgia, "Times New Roman", serif;
	--font-script: "Mali", "Comic Sans MS", cursive;
	--reader-size: 1.12rem;

	--container: 1120px;
	--radius: 18px;

	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--bg: #0e1424;
		--surface: #161e33;
		--surface-2: #1c2640;
		--ink: #e7ecf6;
		--ink-soft: #b2bdd4;
		--ink-faint: #8290ad;
		--line: #263252;
		--accent: #8db8f2;
		--accent-soft: #1d2c4c;
		--on-accent: #0e1424;
		--ok: #7fd1bb;
		--ok-soft: #173330;
		--sweet: #f3bd6a;
		--moon: #ffd36b;
		--shadow: 0 14px 32px -20px rgba(0, 0, 0, .85);
		color-scheme: dark;
	}
}

:root[data-theme="dark"] {
	--bg: #0e1424;
	--surface: #161e33;
	--surface-2: #1c2640;
	--ink: #e7ecf6;
	--ink-soft: #b2bdd4;
	--ink-faint: #8290ad;
	--line: #263252;
	--accent: #8db8f2;
	--accent-soft: #1d2c4c;
	--on-accent: #0e1424;
	--ok: #7fd1bb;
	--ok-soft: #173330;
	--sweet: #f3bd6a;
	--moon: #ffd36b;
	--shadow: 0 14px 32px -20px rgba(0, 0, 0, .85);
	color-scheme: dark;
}

/* ==========================================================================
   2. Nền tảng
   ========================================================================== */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: var(--font-ui);
	font-size: 1rem;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}

img {
	max-width: 100%;
	height: auto;
}

svg {
	display: block;
}

a {
	color: var(--accent);
	text-underline-offset: .2em;
}

h1,
h2,
h3,
h4 {
	margin: 0 0 .5em;
	font-family: var(--font-ui);
	font-weight: 800;
	line-height: 1.25;
	color: var(--ink);
	text-wrap: balance;
}

p {
	margin: 0 0 1em;
}

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
	border-radius: 6px;
}

::selection {
	background: var(--accent-soft);
	color: var(--ink);
}

.container {
	width: 100%;
	max-width: var(--container);
	margin-inline: auto;
	padding-left: max(16px, env(safe-area-inset-left, 0px));
	padding-right: max(16px, env(safe-area-inset-right, 0px));
}

@media (min-width: 700px) {
	.container {
		padding-left: max(28px, env(safe-area-inset-left, 0px));
		padding-right: max(28px, env(safe-area-inset-right, 0px));
	}
}

.container--read {
	max-width: 780px;
}

.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	width: 1px;
	word-wrap: normal !important;
}

.screen-reader-text:focus {
	background: var(--surface);
	clip: auto !important;
	clip-path: none;
	color: var(--ink);
	display: block;
	height: auto;
	left: 12px;
	top: 12px;
	padding: 10px 18px;
	width: auto;
	z-index: 100000;
	border-radius: 10px;
	box-shadow: var(--shadow);
}

/* ==========================================================================
   3. Nút, nhãn, chip
   ========================================================================== */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .4em;
	min-height: 42px;
	padding: 0 18px;
	border: 1px solid transparent;
	border-radius: 999px;
	font-family: var(--font-ui);
	font-size: .92rem;
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

.btn--primary {
	background: var(--accent);
	color: var(--on-accent);
}

.btn--primary:hover {
	color: var(--on-accent);
	filter: brightness(1.06);
}

.btn--ghost {
	background: var(--surface);
	border-color: var(--line);
	color: var(--ink);
}

.btn--ghost:hover {
	border-color: var(--accent);
	color: var(--ink);
}

.btn.is-disabled {
	opacity: .45;
	pointer-events: none;
}

.icon-btn {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid var(--line);
	border-radius: 50%;
	background: var(--surface);
	color: var(--ink);
	cursor: pointer;
}

.icon-btn:hover {
	border-color: var(--accent);
}

.icon-btn svg {
	width: 18px;
	height: 18px;
}

.badge {
	display: inline-block;
	padding: .15em .6em;
	border-radius: 6px;
	font-family: var(--font-ui);
	font-size: .72rem;
	font-weight: 600;
	letter-spacing: .02em;
	line-height: 1.6;
	vertical-align: middle;
	white-space: nowrap;
}

.badge--hoan {
	background: var(--ok-soft);
	color: var(--ok);
}

.badge--dang-ra {
	background: var(--accent-soft);
	color: var(--accent);
}

.badge--tam-ngung {
	background: var(--surface-2);
	color: var(--ink-soft);
}

.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.chip {
	display: inline-block;
	padding: .3em .9em;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--surface);
	color: var(--ink-soft);
	font-size: .85rem;
	text-decoration: none;
}

a.chip:hover {
	border-color: var(--accent);
	color: var(--accent);
}

/* ==========================================================================
   4. Đầu trang
   ========================================================================== */

.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: color-mix(in srgb, var(--bg) 90%, transparent);
	border-bottom: 1px solid var(--line);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
}

.admin-bar .site-header {
	top: 32px;
}

@media (max-width: 782px) {
	.admin-bar .site-header {
		top: 46px;
	}
}

@media (max-width: 600px) {
	.admin-bar .site-header {
		top: 0;
	}
}

.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 64px;
}

.site-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.brand-mark,
.custom-logo-link {
	display: block;
	flex: none;
	width: 38px;
	height: 38px;
}

.custom-logo {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.site-title-wrap {
	margin: 0;
	min-width: 0;
}

.site-title {
	font-family: var(--font-serif);
	font-size: 1.3rem;
	font-style: italic;
	font-weight: 500;
	color: var(--ink);
	text-decoration: none;
	white-space: nowrap;
}

.site-header__actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.site-nav {
	display: flex;
	align-items: center;
	gap: 12px;
}

.site-nav__list {
	display: flex;
	align-items: center;
	gap: 2px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-nav__list a {
	display: block;
	padding: .4em .85em;
	border-radius: 999px;
	color: var(--ink);
	font-size: .93rem;
	text-decoration: none;
}

.site-nav__list a:hover,
.site-nav__list .current-menu-item > a {
	background: var(--accent-soft);
}

.site-nav__list .sub-menu {
	display: none;
}

.site-nav .search-form {
	width: 200px;
}

.site-nav .search-field {
	min-height: 38px;
	font-size: .88rem;
}

.site-nav .search-form .btn {
	display: none;
}

.nav-toggle {
	display: none;
}

.theme-toggle .i-sun,
:root[data-theme="dark"] .theme-toggle .i-moon {
	display: none;
}

:root[data-theme="dark"] .theme-toggle .i-sun {
	display: block;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .theme-toggle .i-moon {
		display: none;
	}

	:root:not([data-theme="light"]) .theme-toggle .i-sun {
		display: block;
	}
}

@media (max-width: 860px) {
	.nav-toggle {
		display: grid;
	}

	.site-nav {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		flex-direction: column;
		align-items: stretch;
		padding: 12px max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px));
		background: var(--surface);
		border-bottom: 1px solid var(--line);
		box-shadow: var(--shadow);
	}

	.nav-open .site-nav {
		display: flex;
	}

	.site-nav__list {
		flex-direction: column;
		align-items: stretch;
	}

	.site-nav__list a {
		padding: .7em .9em;
		border-radius: 10px;
	}

	.site-nav .search-form {
		width: 100%;
	}
}

/* ==========================================================================
   5. Trang chủ
   ========================================================================== */

.intro {
	padding: 48px 0 40px;
	background: linear-gradient(180deg, var(--accent-soft) 0%, var(--bg) 100%);
	text-align: center;
}

.intro__mark {
	width: 60px;
	height: 60px;
	margin: 0 auto 12px;
}

.intro__title {
	margin: 0;
	font-size: clamp(2.2rem, 6vw, 3.2rem);
	font-style: italic;
	font-weight: 500;
}

.intro__text {
	max-width: 52ch;
	margin: .6rem auto 1.4rem;
	color: var(--ink-soft);
}

.intro .search-form {
	max-width: 460px;
	margin: 0 auto;
}

.intro .chips {
	justify-content: center;
	max-width: 720px;
	margin: 1.4rem auto 0;
}

.section {
	padding: 36px 0;
}

.section + .section {
	padding-top: 8px;
}

.section-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 16px;
}

.section-head h2 {
	margin: 0;
	font-size: 1.45rem;
}

.section-head a {
	font-size: .9rem;
	text-decoration: none;
	white-space: nowrap;
}

/* Danh sách truyện mới cập nhật */
.update-list {
	margin: 0;
	padding: 0;
	list-style: none;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
}

.update {
	display: grid;
	grid-template-columns: 52px minmax(0, 1fr) minmax(0, 15rem);
	align-items: center;
	gap: 6px 16px;
	padding: 12px 16px;
}

.update + .update {
	border-top: 1px solid var(--line);
}

.update__cover {
	grid-row: span 2;
	width: 52px;
}

.update__cover .cover {
	border-radius: 6px;
	box-shadow: none;
}

.update__cover .cover-gen__title,
.update__cover .cover-gen__mark {
	display: none;
}

.update__title {
	align-self: end;
	margin: 0;
	font-size: 1.05rem;
	line-height: 1.35;
}

.update__title a {
	color: var(--ink);
	text-decoration: none;
}

.update__title a:hover {
	color: var(--accent);
}

.update__meta {
	align-self: start;
	grid-column: 2;
	margin: 0;
	color: var(--ink-faint);
	font-size: .85rem;
}

.update__latest {
	grid-column: 3;
	grid-row: 1 / span 2;
	min-width: 0;
	text-align: right;
	font-size: .9rem;
	line-height: 1.4;
}

.update__latest a {
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	text-decoration: none;
}

.update__time {
	color: var(--ink-faint);
	font-size: .8rem;
}

@media (max-width: 640px) {
	.update {
		grid-template-columns: 44px minmax(0, 1fr);
		align-items: start;
	}

	.update__cover {
		grid-row: span 3;
		width: 44px;
	}

	.update__latest {
		grid-column: 2;
		grid-row: auto;
		text-align: left;
	}

	.update__latest a {
		display: inline;
		white-space: normal;
	}

	.update__time::before {
		content: " · ";
	}
}

/* Lưới truyện */
.story-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 24px 18px;
}

@media (max-width: 420px) {
	.story-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 20px 14px;
	}
}

.story-card {
	position: relative;
	min-width: 0;
}

.story-card__title {
	display: -webkit-box;
	margin: 10px 0 2px;
	overflow: hidden;
	font-size: 1rem;
	line-height: 1.35;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.story-card__title a {
	color: var(--ink);
	text-decoration: none;
}

.story-card__title a::after {
	content: "";
	position: absolute;
	inset: 0;
}

.story-card:hover .story-card__title a {
	color: var(--accent);
}

.story-card__meta {
	margin: 0;
	color: var(--ink-faint);
	font-size: .82rem;
}

/* Bìa truyện */
.cover {
	position: relative;
	display: block;
	aspect-ratio: 2 / 3;
	max-width: 100%;
	overflow: hidden;
	border-radius: 10px;
	background: var(--surface-2);
	box-shadow: var(--shadow);
	container-type: inline-size;
}

.cover img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.cover-gen {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8%;
	padding: 14%;
	color: #233050;
	text-align: center;
}

.cover-gen::before {
	content: "";
	position: absolute;
	inset: 6%;
	border: 1px solid rgba(255, 255, 255, .75);
	border-radius: 6px;
	pointer-events: none;
}

.cover-gen__title {
	font-family: var(--font-serif);
	font-size: 1rem;
	font-size: 11cqi;
	font-style: italic;
	font-weight: 500;
	line-height: 1.25;
	overflow-wrap: anywhere;
}

.cover-gen__mark {
	width: 18%;
	min-width: 18px;
}

.cover-gen--0 { background: linear-gradient(170deg, #d7e8fa, #9cc3ec); }
.cover-gen--1 { background: linear-gradient(170deg, #fde9cf, #f4b98a); }
.cover-gen--2 { background: linear-gradient(170deg, #2b3d6e, #121b38); color: #eef3ff; }
.cover-gen--3 { background: linear-gradient(170deg, #daf2ec, #9fd4c6); }
.cover-gen--4 { background: linear-gradient(170deg, #fff3cf, #f2d27d); }
.cover-gen--5 { background: linear-gradient(170deg, #e3e8f2, #aebbd3); }

.empty-note {
	display: grid;
	justify-items: center;
	gap: 14px;
	padding: 40px 20px;
	border: 1px dashed var(--line);
	border-radius: var(--radius);
	color: var(--ink-soft);
	text-align: center;
}

.empty-note p {
	max-width: 42ch;
	margin: 0;
}

/* ==========================================================================
   6. Trang truyện
   ========================================================================== */

.crumbs {
	margin: 20px 0 0;
	color: var(--ink-faint);
	font-size: .85rem;
}

.crumbs a {
	color: var(--ink-soft);
	text-decoration: none;
}

.crumbs a:hover {
	color: var(--accent);
}

.story-head {
	display: grid;
	grid-template-columns: 220px minmax(0, 1fr);
	gap: 32px;
	margin: 20px 0 8px;
	padding: 24px;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: var(--radius);
}

.story-head__title {
	margin-bottom: .4em;
	font-size: clamp(1.6rem, 4vw, 2.2rem);
}

.story-facts {
	display: grid;
	grid-template-columns: max-content minmax(0, 1fr);
	gap: 6px 18px;
	margin: 0 0 16px;
	font-size: .95rem;
}

.story-facts dt {
	color: var(--ink-faint);
}

.story-facts dd {
	margin: 0;
}

.story-head .chips {
	margin-bottom: 20px;
}

.story-head__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

@media (max-width: 640px) {
	.story-head {
		grid-template-columns: 1fr;
		gap: 20px;
		padding: 20px 16px;
	}

	.story-head__cover {
		width: 160px;
		margin: 0 auto;
	}

	.story-head__title {
		text-align: center;
	}
}

.story-section {
	margin: 32px 0;
}

.story-section > h2 {
	font-size: 1.3rem;
}

.story-section > h2 span {
	color: var(--ink-faint);
	font-family: var(--font-ui);
	font-size: .95rem;
	font-weight: 400;
}

.chapter-list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 28px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.chapter-list li {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 2px;
	border-bottom: 1px dashed var(--line);
}

.chapter-list a {
	min-width: 0;
	color: var(--ink);
	text-decoration: none;
}

.chapter-list a:hover {
	color: var(--accent);
}

.chapter-list time {
	flex: none;
	color: var(--ink-faint);
	font-size: .8rem;
	font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
	.chapter-list {
		grid-template-columns: 1fr;
	}
}

/* ==========================================================================
   7. Trang đọc chương
   ========================================================================== */

.reader__head {
	margin: 30px 0 22px;
	text-align: center;
}

.reader__story {
	margin: 0 0 .2em;
	font-family: var(--font-script);
	font-size: 1.05rem;
}

.reader__story a {
	color: var(--sweet);
	text-decoration: none;
}

.reader__title {
	margin: 0 0 .35em;
	font-size: clamp(1.6rem, 4.4vw, 2.2rem);
	font-weight: 900;
	letter-spacing: -.02em;
}

.reader__meta {
	display: inline-block;
	margin: 0;
	padding: 3px 12px;
	border-radius: 999px;
	background: var(--surface-2);
	color: var(--ink-faint);
	font-size: .82rem;
}

/* Thanh tiến độ đọc trên cùng */
.read-progress {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 60;
	height: 3px;
	pointer-events: none;
}

.read-progress span {
	display: block;
	width: 0;
	height: 100%;
	border-radius: 0 3px 3px 0;
	background: linear-gradient(90deg, var(--accent), var(--sweet));
}

.reader-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 6px 0;
}

/* Chuyển chương: một khối ba ô liền nhau */
.chapter-nav {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	flex: 1 1 420px;
	max-width: 560px;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: 14px;
	background: var(--surface);
	box-shadow: var(--shadow);
}

.pager {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: .35em;
	min-height: 46px;
	padding: 0 12px;
	color: var(--ink);
	font-size: .9rem;
	font-weight: 700;
	text-decoration: none;
	white-space: nowrap;
}

.pager span {
	font-size: 1.3em;
	line-height: 1;
}

.pager + .pager {
	border-left: 1px solid var(--line);
}

.pager--next {
	color: var(--accent);
}

.pager--toc {
	width: 52px;
	color: var(--ink-soft);
}

.pager--toc svg {
	width: 20px;
	height: 20px;
}

a.pager:hover {
	background: var(--accent-soft);
	color: var(--accent);
}

.pager.is-disabled {
	color: var(--ink-faint);
	opacity: .45;
}

.reader-tools {
	display: inline-flex;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: 14px;
	background: var(--surface);
}

.reader-tools button {
	min-width: 46px;
	min-height: 46px;
	padding: 0 10px;
	border: 0;
	background: none;
	color: var(--ink-soft);
	font: 800 1rem var(--font-ui);
	cursor: pointer;
}

.reader-tools button + button {
	border-left: 1px solid var(--line);
}

.reader-tools button:hover {
	background: var(--accent-soft);
	color: var(--accent);
}

.reader-tools small {
	font-size: .75em;
}

.reader-bar--end {
	padding-top: 18px;
}

.reader__content {
	padding: 28px 0 12px;
	font-family: var(--font-serif);
	font-size: var(--reader-size);
	line-height: 1.9;
	overflow-wrap: break-word;
}

.reader__content p {
	margin: 0 0 1.1em;
}

.reader__content hr {
	width: 80px;
	margin: 2em auto;
	border: 0;
	border-top: 1px solid var(--line);
}

[hidden] {
	display: none !important;
}

@media (max-width: 560px) {
	.chapter-nav {
		flex-basis: 100%;
	}

	.pager {
		padding: 0 8px;
		font-size: .85rem;
	}
}

/* ==========================================================================
   8. Bài viết, trang, danh sách
   ========================================================================== */

.page-title {
	padding: 40px 0 28px;
	background: linear-gradient(180deg, var(--accent-soft) 0%, var(--bg) 100%);
}

.page-title h1 {
	margin: 0;
	font-size: clamp(1.7rem, 4.5vw, 2.4rem);
}

.page-title p {
	margin: .4em 0 0;
	color: var(--ink-soft);
}

.page-title .kicker {
	margin: 0 0 .2em;
	color: var(--accent);
	font-size: .85rem;
	font-weight: 500;
}

.page-body {
	padding-top: 8px;
	padding-bottom: 56px;
}

.entry-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.entry-row {
	padding: 20px 0;
	border-bottom: 1px solid var(--line);
}

.entry-row__meta {
	margin: 0 0 .2em;
	color: var(--ink-faint);
	font-size: .82rem;
}

.entry-row h2 {
	margin: 0 0 .3em;
	font-size: 1.25rem;
}

.entry-row h2 a {
	color: var(--ink);
	text-decoration: none;
}

.entry-row h2 a:hover {
	color: var(--accent);
}

.entry-row__excerpt p {
	margin: 0;
	color: var(--ink-soft);
	font-size: .95rem;
}

.prose {
	line-height: 1.8;
}

.prose > *:first-child {
	margin-top: 0;
}

.prose h2 {
	margin-top: 1.6em;
	font-size: 1.5rem;
}

.prose h3 {
	margin-top: 1.4em;
	font-size: 1.25rem;
}

.prose blockquote {
	margin: 1.6em 0;
	padding: .2em 0 .2em 1.2em;
	border-left: 3px solid var(--accent-soft);
	font-family: var(--font-serif);
	font-style: italic;
	color: var(--ink-soft);
}

.prose img {
	border-radius: 10px;
}

.prose hr {
	width: 80px;
	margin: 2.4em auto;
	border: 0;
	border-top: 1px solid var(--line);
}

.prose table {
	width: 100%;
	border-collapse: collapse;
}

.prose th,
.prose td {
	padding: .5em .7em;
	border-bottom: 1px solid var(--line);
	text-align: left;
}

.prose pre {
	padding: 1em;
	overflow-x: auto;
	border-radius: 10px;
	background: var(--surface-2);
}

.alignleft {
	float: left;
	margin: .3em 1.4em 1em 0;
}

.alignright {
	float: right;
	margin: .3em 0 1em 1.4em;
}

.aligncenter {
	display: block;
	margin-inline: auto;
}

.wp-caption-text,
.wp-element-caption,
.gallery-caption {
	color: var(--ink-faint);
	font-size: .85rem;
	text-align: center;
}

.sticky .entry-row__meta::after {
	content: " · ghim";
}

.bypostauthor > .comment-body .fn::after {
	content: " ✿";
	color: var(--accent);
}

.post-navigation .nav-links {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	margin-top: 32px;
	padding-top: 20px;
	border-top: 1px solid var(--line);
}

.post-navigation .nav-next {
	margin-left: auto;
	text-align: right;
}

.post-navigation a {
	text-decoration: none;
}

.pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px;
	margin-top: 32px;
}

.pagination .page-numbers {
	display: grid;
	place-items: center;
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--surface);
	color: var(--ink);
	text-decoration: none;
}

.pagination .page-numbers.current,
.pagination a.page-numbers:hover {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--on-accent);
}

.page-links {
	margin-top: 1.5em;
	font-weight: 500;
}

/* Ô tìm kiếm */
.search-form {
	display: flex;
	gap: 8px;
}

.search-form label {
	flex: 1;
	min-width: 0;
}

.search-field {
	width: 100%;
	min-height: 44px;
	padding: 0 16px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--surface);
	color: var(--ink);
	font: inherit;
}

.search-field:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-soft);
}

.not-found {
	padding: 24px 0 64px;
	text-align: center;
}

.not-found .search-form {
	max-width: 460px;
	margin: 24px auto 0;
}

/* Bình luận */
.comments-area {
	margin-top: 40px;
	padding-top: 28px;
	border-top: 1px solid var(--line);
}

.comments-title,
.comment-reply-title {
	font-size: 1.3rem;
}

.comment-list,
.comment-list .children {
	margin: 0;
	padding: 0;
	list-style: none;
}

.comment-list .children {
	padding-left: clamp(12px, 4vw, 32px);
}

.comment-body {
	margin-bottom: 14px;
	padding: 16px 18px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: var(--surface);
}

.comment-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 4px 12px;
	margin-bottom: 8px;
	font-size: .88rem;
}

.comment-author {
	display: flex;
	align-items: center;
	gap: 8px;
}

.comment-author .avatar {
	border-radius: 50%;
}

.comment-author .says {
	display: none;
}

.comment-metadata a {
	color: var(--ink-faint);
	text-decoration: none;
}

.comment-content p:last-child {
	margin: 0;
}

.reply a {
	font-size: .85rem;
	text-decoration: none;
}

.comment-form {
	display: grid;
	gap: 12px;
}

.comment-form p {
	margin: 0;
}

.comment-form label {
	display: block;
	margin-bottom: 4px;
	color: var(--ink-soft);
	font-size: .88rem;
}

.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--surface);
	color: var(--ink);
	font: inherit;
}

.comment-form textarea {
	min-height: 120px;
	resize: vertical;
}

.comment-form input:focus,
.comment-form textarea:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-soft);
}

.comment-form-cookies-consent {
	display: flex;
	align-items: flex-start;
	gap: 8px;
}

.comment-form-cookies-consent label {
	margin: 0;
}

.form-submit .submit {
	min-height: 42px;
	padding: 0 22px;
	border: 0;
	border-radius: 999px;
	background: var(--accent);
	color: var(--on-accent);
	font: inherit;
	font-weight: 500;
	cursor: pointer;
}

/* ==========================================================================
   9. Chân trang
   ========================================================================== */

.site-footer {
	margin-top: 40px;
	padding: 36px 0 24px;
	background: var(--surface-2);
	color: var(--ink-soft);
	font-size: .92rem;
}

.site-footer__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 20px 40px;
}

.site-footer__note {
	max-width: 46ch;
	margin: 10px 0 0;
}

.footer-menu {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.footer-menu a {
	color: var(--ink);
	text-decoration: none;
}

.footer-menu a:hover {
	color: var(--accent);
}

.site-footer__bottom {
	margin-top: 24px;
	padding-top: 16px;
	border-top: 1px solid var(--line);
	color: var(--ink-faint);
	font-size: .82rem;
}

.site-footer__bottom p {
	margin: 0;
}

@media (prefers-reduced-motion: reduce) {
	* {
		transition: none !important;
	}
}

/* ==========================================================================
   10. Bầu trời: trăng, mây, sao
   ========================================================================== */

:root {
	--sky-1: #bcd8f4;
	--sky-2: #e4effb;
	--cloud: #ffffff;
	--cloud-1: rgba(255, 255, 255, .55);
	--cloud-2: rgba(255, 255, 255, .8);
	--moon-glow: rgba(255, 214, 120, .55);
	--star: #ffffff;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--sky-1: #0a1330;
		--sky-2: #16234b;
		--cloud: #2b3a68;
		--cloud-1: rgba(80, 105, 170, .2);
		--cloud-2: rgba(55, 75, 135, .42);
		--moon-glow: rgba(255, 214, 120, .35);
		--star: #fff6d8;
	}
}

:root[data-theme="dark"] {
	--sky-1: #0a1330;
	--sky-2: #16234b;
	--cloud: #2b3a68;
	--cloud-1: rgba(80, 105, 170, .2);
	--cloud-2: rgba(55, 75, 135, .42);
	--moon-glow: rgba(255, 214, 120, .35);
	--star: #fff6d8;
}

.page-title {
	position: relative;
	overflow: hidden;
	isolation: isolate;
	padding-bottom: 80px;
	background: linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 70%, var(--bg) 100%);
}

.sky {
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
}

/* Trăng khuyết nhỏ góc phải */
.sky__moon {
	position: absolute;
	top: 16%;
	right: 10%;
	width: clamp(40px, 6vw, 70px);
	aspect-ratio: 1;
	border-radius: 50%;
	box-shadow: inset clamp(9px, 1.3vw, 15px) calc(clamp(9px, 1.3vw, 15px) * -.55) 0 0 var(--moon);
	filter: drop-shadow(0 0 16px var(--moon-glow));
	transform: rotate(-12deg);
}

@media (max-width: 640px) {
	.page-title .sky__moon {
		top: 10px;
		right: 22px;
		width: 30px;
		box-shadow: inset 7px -4px 0 0 var(--moon);
	}
}

.sky__cloud {
	position: absolute;
	width: clamp(90px, 13vw, 190px);
	color: var(--cloud);
	opacity: .8;
}

.sky__cloud--1 { top: 10%; left: -46px; }
.sky__cloud--2 { top: 34%; right: -36px; width: clamp(70px, 9vw, 130px); opacity: .6; }

/* Biển mây ở đáy */
.sky__clouds {
	position: absolute;
	left: 0;
	right: 0;
	bottom: -1px;
	width: 100%;
	height: clamp(64px, 11vw, 150px);
}

.sky__clouds .c1 { fill: var(--cloud-1); }
.sky__clouds .c2 { fill: var(--cloud-2); }
.sky__clouds .c3 { fill: var(--bg); }

/* Sao lấp lánh (app.js thêm vào) */
.sparkles {
	position: absolute;
	inset: 0 0 30% 0;
	overflow: hidden;
}

.sparkle {
	position: absolute;
	left: var(--x);
	top: var(--y);
	width: var(--s);
	height: var(--s);
	background: var(--c, var(--star));
	clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
	animation: sdd-twinkle var(--d) ease-in-out var(--delay) infinite alternate;
}

@keyframes sdd-twinkle {
	from { opacity: .15; transform: scale(.55) rotate(0deg); }
	to { opacity: 1; transform: scale(1) rotate(25deg); }
}

.page-title .container {
	position: relative;
}

.ornament {
	width: 140px;
	height: 18px;
	margin: .6rem auto;
	color: var(--sweet);
}

.moon-art {
	width: 100%;
	height: auto;
}

.empty-note .moon-art,
.not-found .moon-art {
	width: 190px;
	margin-inline: auto;
}

@media (prefers-reduced-motion: reduce) {
	.sparkles { display: none; }
}

.reader__content blockquote {
	margin: 1.6em 0;
	padding: .2em 0 .2em 1.2em;
	border-left: 3px solid var(--accent-soft);
	font-style: italic;
	color: var(--ink-soft);
}

/* ==========================================================================
   11. Trang chủ
   ========================================================================== */

.hero {
	position: relative;
	overflow: hidden;
	isolation: isolate;
	padding: clamp(28px, 5vw, 56px) 0 clamp(110px, 14vw, 180px);
	background: linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 65%, var(--bg) 100%);
}

.hero__inner {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
}

.hero__art {
	width: clamp(170px, 24vw, 250px);
	margin-bottom: 6px;
}

.hero__svg {
	width: 100%;
	height: auto;
	overflow: visible;
	filter: drop-shadow(0 18px 30px rgba(40, 70, 130, .2));
}

.hero__glow {
	animation: sdd-glow 5s ease-in-out infinite alternate;
}

.hero__svg .tw {
	transform-box: fill-box;
	transform-origin: center;
	animation: sdd-twinkle 2.8s ease-in-out infinite alternate;
}

.hero__svg .tw--2 { animation-duration: 3.6s; animation-delay: -1.2s; }
.hero__svg .tw--3 { animation-duration: 4.4s; animation-delay: -2s; }

@keyframes sdd-glow {
	from { opacity: .6; }
	to { opacity: 1; }
}

.hero__kicker {
	margin: 0;
	text-wrap: balance;
	font-family: var(--font-script);
	font-size: clamp(1.05rem, 2.2vw, 1.3rem);
	font-weight: 500;
	color: var(--sweet);
}

.hero__title {
	margin: .1em 0 0;
	font-family: var(--font-ui);
	font-size: clamp(2.9rem, 8.5vw, 5.4rem);
	font-weight: 900;
	line-height: 1.02;
	letter-spacing: -.035em;
	text-wrap: initial;
}

.hero__title em {
	font-style: normal;
	background: linear-gradient(100deg, var(--accent) 10%, #7fa9e8 55%, var(--sweet) 100%);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.hero .ornament {
	margin: .9rem auto;
}

.hero__intro {
	max-width: 46ch;
	margin-inline: auto;
	color: var(--ink-soft);
	font-size: 1.05rem;
}

.hero .search-form {
	width: 100%;
	max-width: 460px;
	margin-inline: auto;
}

.hero__flavors {
	margin-top: 1.4rem;
}

.hero__flavors-label {
	margin: 0 0 .55rem;
	font-family: var(--font-script);
	font-size: 1rem;
	color: var(--ink-faint);
}

.hero .chips {
	justify-content: center;
	max-width: 720px;
}

@media (prefers-reduced-motion: reduce) {
	.hero__glow,
	.hero__svg .tw {
		animation: none;
	}
}

/* Tiêu đề mục: dòng viết tay phía trên */
.section-head__kicker {
	margin: 0 0 2px;
	font-family: var(--font-script);
	font-size: 1rem;
	font-weight: 500;
	line-height: 1.3;
	color: var(--sweet);
}

.section-head {
	align-items: flex-end;
}

/* Khung truyện nổi bật */
.spotlight {
	position: relative;
	display: grid;
	grid-template-columns: 200px minmax(0, 1fr);
	gap: clamp(20px, 4vw, 36px);
	padding: clamp(18px, 3vw, 28px);
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: 26px;
	background:
		radial-gradient(70% 90% at 100% 0%, var(--accent-soft), transparent 70%),
		var(--surface);
	box-shadow: var(--shadow);
	isolation: isolate;
}

.spotlight__cover .cover {
	transition: transform .5s ease;
}

.spotlight__cover:hover .cover {
	transform: translateY(-4px);
}

.spotlight__title {
	margin: 0 0 .25em;
	font-size: clamp(1.7rem, 3.6vw, 2.3rem);
}

.spotlight__title a {
	color: var(--ink);
	text-decoration: none;
}

.spotlight__meta {
	margin: 0 0 .9rem;
	color: var(--ink-faint);
	font-size: .9rem;
}

.spotlight__hook {
	margin: 1.1rem 0;
	padding: .8em 1.1em;
	border-radius: 14px;
	background: var(--surface-2);
	font-family: var(--font-serif);
	font-style: italic;
	font-size: 1rem;
	line-height: 1.75;
	color: var(--ink-soft);
}

.spotlight__latest {
	margin: 0 0 1rem;
	color: var(--ink-faint);
	font-size: .9rem;
}

.spotlight__latest a {
	text-decoration: none;
}

.spotlight__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.spotlight__moon {
	position: absolute;
	top: -18px;
	right: -14px;
	z-index: -1;
	width: 130px;
	color: var(--moon);
	opacity: .22;
	transform: rotate(-20deg);
	pointer-events: none;
}

@media (max-width: 640px) {
	.spotlight {
		grid-template-columns: 1fr;
		text-align: center;
	}

	.spotlight__cover {
		width: 170px;
		margin: 0 auto;
	}

	.spotlight .chips,
	.spotlight__actions {
		justify-content: center;
	}
}

/* Bìa tự tạo: mỗi truyện một bầu trời */
.cover-gen__art {
	width: 72%;
	height: auto;
}

.update__cover .cover-gen__art {
	display: none;
}

/* Chân trang: trời đêm */
.site-footer {
	position: relative;
	margin-top: 56px;
	padding-top: clamp(70px, 9vw, 110px);
	overflow: hidden;
	isolation: isolate;
	background: linear-gradient(180deg, #1d2d55 0%, #0f1832 100%);
	color: #c3cde3;
}

.site-footer__wave {
	position: absolute;
	top: -1px;
	left: 0;
	width: 100%;
	height: clamp(36px, 5vw, 64px);
	fill: var(--bg);
}

.site-footer__stars {
	position: absolute;
	inset: 0;
	z-index: -1;
	background-image:
		radial-gradient(1.5px 1.5px at 7% 46%, #fff 50%, transparent 51%),
		radial-gradient(1px 1px at 16% 72%, #fff 50%, transparent 51%),
		radial-gradient(2px 2px at 27% 40%, #fff3c9 50%, transparent 51%),
		radial-gradient(1px 1px at 39% 80%, #fff 50%, transparent 51%),
		radial-gradient(1.5px 1.5px at 52% 36%, #fff 50%, transparent 51%),
		radial-gradient(1px 1px at 61% 64%, #fff 50%, transparent 51%),
		radial-gradient(2px 2px at 72% 48%, #fff3c9 50%, transparent 51%),
		radial-gradient(1px 1px at 84% 76%, #fff 50%, transparent 51%),
		radial-gradient(1.5px 1.5px at 94% 40%, #fff 50%, transparent 51%);
	animation: sdd-stars 5s ease-in-out infinite alternate;
}

@keyframes sdd-stars {
	from { opacity: .45; }
	to { opacity: 1; }
}

.site-footer .site-title,
.site-footer .footer-menu a {
	color: #f2f5fb;
}

.site-footer .footer-menu a:hover {
	color: var(--moon);
}

.site-footer__note {
	color: #c3cde3;
}

.site-footer__bottom {
	border-top-color: rgba(255, 255, 255, .12);
	color: #93a0bf;
}

@media (prefers-reduced-motion: reduce) {
	.site-footer__stars {
		animation: none;
	}
}

/* ==========================================================================
   12. Tên trang, số liệu, nhãn
   ========================================================================== */

.site-title {
	font-family: var(--font-ui);
	font-size: 1.15rem;
	font-style: normal;
	font-weight: 800;
	letter-spacing: -.01em;
}

/* Bảng số liệu nằm đè lên biển mây */
.stats-wrap {
	position: relative;
	z-index: 2;
	margin-top: clamp(-84px, -7vw, -50px);
}

.stats {
	display: grid;
	grid-auto-columns: minmax(0, 1fr);
	grid-auto-flow: column;
	margin: 0;
	padding: 0;
	list-style: none;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: 22px;
	background: var(--surface);
	box-shadow: var(--shadow);
}

.stats li {
	display: grid;
	gap: 2px;
	justify-items: center;
	padding: 18px 12px;
	text-align: center;
}

.stats li + li {
	border-left: 1px solid var(--line);
}

.stats strong {
	font-size: clamp(1.5rem, 3.2vw, 2.1rem);
	font-weight: 900;
	line-height: 1.15;
	color: var(--accent);
	font-variant-numeric: tabular-nums;
}

.stats .stats__time {
	font-size: clamp(1rem, 2.2vw, 1.25rem);
	font-weight: 800;
	line-height: 1.85;
}

.stats span {
	color: var(--ink-faint);
	font-size: .85rem;
}

@media (max-width: 640px) {
	.stats li {
		padding: 14px 6px;
	}

	.stats span {
		font-size: .75rem;
		line-height: 1.3;
	}
}

/* Nhãn "Mới lên" trên bìa truyện nổi bật */
.spotlight__cover {
	position: relative;
	display: block;
	text-decoration: none;
}

.sticker {
	position: absolute;
	top: 12px;
	left: -8px;
	padding: 5px 13px;
	border-radius: 999px;
	background: var(--moon);
	box-shadow: 0 6px 14px -6px rgba(120, 80, 10, .55);
	color: #3b2d06;
	font-size: .78rem;
	font-weight: 800;
	transform: rotate(-6deg);
}

/* Thẻ truyện nhấc lên khi rê chuột */
.story-card {
	transition: transform .35s ease;
}

.story-card:hover {
	transform: translateY(-4px);
}

/* Ảnh minh hoạ và chú thích trong chương */
.story-figure {
	margin: 1.6em auto;
	max-width: 520px;
	text-align: center;
}

.story-figure img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 12px;
	box-shadow: var(--shadow);
}

.story-figure figcaption {
	margin-top: .6em;
	font-family: var(--font-ui);
	font-size: .82rem;
	font-style: normal;
	line-height: 1.5;
	color: var(--ink-faint);
}

.fn-mark {
	margin-left: 1px;
	font-family: var(--font-ui);
	font-size: .7em;
	font-weight: 700;
	color: var(--accent);
}

.reader__content blockquote {
	font-family: var(--font-ui);
	font-size: .9em;
	line-height: 1.75;
}

/* ==========================================================================
   13. Tài khoản & bình luận
   ========================================================================== */

.auth-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 40px;
	padding: 0 14px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: var(--surface);
	color: var(--ink);
	font: 500 .88rem var(--font-ui);
	white-space: nowrap;
	cursor: pointer;
}

.auth-btn:hover {
	border-color: var(--accent);
}

.auth-btn.is-in {
	width: 40px;
	padding: 0;
}

.auth-btn[hidden] {
	display: none;
}

.cm-avatar {
	display: inline-grid;
	flex: none;
	place-items: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: hsl(var(--h, 330) 60% 86%);
	color: hsl(var(--h, 330) 40% 28%);
	font: 700 .85rem var(--font-ui);
	font-style: normal;
}

/* Hộp đăng nhập */
.auth-dialog {
	width: min(420px, calc(100vw - 32px));
	padding: 0;
	border: 0;
	border-radius: 20px;
	background: var(--surface);
	color: var(--ink);
	box-shadow: 0 30px 80px -30px rgba(40, 20, 40, .6);
}

.auth-dialog::backdrop {
	background: rgba(30, 24, 40, .45);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
}

.auth-box {
	position: relative;
	padding: 28px 24px 22px;
}

.auth-title {
	margin: 0;
	font-size: 1.5rem;
}

.auth-sub {
	margin: .2em 0 1.2em;
	color: var(--ink-soft);
	font-size: .92rem;
}

.auth-form {
	display: grid;
	gap: 12px;
}

.auth-field {
	display: grid;
	gap: 4px;
	color: var(--ink-soft);
	font-size: .85rem;
}

.auth-field input,
.cm-input {
	width: 100%;
	padding: 10px 14px;
	border: 1px solid var(--line);
	border-radius: 12px;
	background: var(--bg);
	color: var(--ink);
	font: 1rem var(--font-ui);
}

.auth-field input:focus,
.cm-input:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-hint {
	margin: 0;
	color: var(--ink-faint);
	font-size: .8rem;
}

.auth-error {
	margin: 0;
	color: #c0453f;
	font-size: .85rem;
}

.auth-error:empty {
	display: none;
}

.auth-full {
	width: 100%;
}

.auth-switch {
	margin: 14px 0 0;
	color: var(--ink-soft);
	font-size: .9rem;
	text-align: center;
}

.link-btn {
	padding: 0;
	border: 0;
	background: none;
	color: var(--accent);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.cm-close {
	position: absolute;
	top: 12px;
	right: 12px;
	width: 36px;
	height: 36px;
	border: 0;
	border-radius: 50%;
	background: var(--surface-2);
	color: var(--ink);
	font-size: 1.4rem;
	line-height: 1;
	cursor: pointer;
}

.auth-me {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 18px;
}

.auth-me .cm-avatar {
	width: 48px;
	height: 48px;
	font-size: 1.2rem;
}

.auth-me__name {
	margin: 0;
	font-weight: 600;
}

.auth-me__user {
	margin: 0;
	color: var(--ink-faint);
	font-size: .85rem;
}

/* Nút bình luận cuối mỗi đoạn */
.pc-btn {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	margin-left: 2px;
	padding: 1px 7px;
	border: 1px solid transparent;
	border-radius: 999px;
	background: transparent;
	color: var(--ink-faint);
	font: 600 .72rem var(--font-ui);
	vertical-align: middle;
	opacity: 0;
	cursor: pointer;
	transition: opacity .2s ease, background-color .2s ease;
}

.pc-btn svg {
	width: 15px;
	height: 15px;
}

.reader__content p:hover .pc-btn,
.reader__content p.pc-show .pc-btn,
.pc-btn:focus-visible,
.pc-btn.has-count {
	opacity: 1;
}

.pc-btn.has-count {
	border-color: color-mix(in srgb, var(--accent) 30%, transparent);
	background: var(--accent-soft);
	color: var(--accent);
}

.pc-btn:hover {
	color: var(--accent);
}

@media (hover: none) {
	.reader__content p.pc-show {
		border-radius: 6px;
		background: color-mix(in srgb, var(--accent-soft) 55%, transparent);
	}
}

/* Khung bình luận đoạn văn */
.cm-shade {
	position: fixed;
	inset: 0;
	z-index: 80;
	background: rgba(30, 24, 40, .35);
	opacity: 0;
	pointer-events: none;
	transition: opacity .25s ease;
}

.cm-panel {
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	z-index: 90;
	display: flex;
	flex-direction: column;
	width: min(420px, 100vw);
	padding: 18px 20px max(20px, env(safe-area-inset-bottom, 0px));
	overflow-y: auto;
	background: var(--surface);
	box-shadow: -20px 0 60px -30px rgba(40, 20, 40, .6);
	transform: translateX(100%);
	transition: transform .3s ease;
}

.cm-open .cm-shade {
	opacity: 1;
	pointer-events: auto;
}

.cm-open .cm-panel {
	transform: none;
}

.cm-panel__head {
	position: relative;
	min-height: 40px;
}

.cm-panel__head .cm-close {
	top: 0;
	right: 0;
}

.cm-panel__title {
	margin: 4px 0 0;
	font-size: 1.15rem;
}

.cm-quote {
	margin: 12px 0 16px;
	padding: .2em 0 .2em .9em;
	border-left: 3px solid var(--accent-soft);
	color: var(--ink-soft);
	font-family: var(--font-serif);
	font-size: .95rem;
	font-style: italic;
	line-height: 1.6;
}

@media (max-width: 640px) {
	.cm-panel {
		top: auto;
		left: 0;
		width: 100vw;
		max-height: 80vh;
		border-radius: 20px 20px 0 0;
		transform: translateY(100%);
	}
}

/* Danh sách bình luận */
.cm-list {
	display: grid;
	gap: 14px;
	margin: 0 0 16px;
	padding: 0;
	list-style: none;
}

.cm-item {
	display: flex;
	gap: 10px;
}

.cm-main {
	min-width: 0;
	flex: 1;
}

.cm-head {
	margin: 0;
	font-size: .88rem;
}

.cm-time {
	color: var(--ink-faint);
	font-size: .8rem;
}

.cm-body {
	margin: 2px 0 0;
	font-size: .95rem;
	line-height: 1.6;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.cm-del {
	margin-top: 2px;
	color: var(--ink-faint);
	font-size: .8rem;
	font-weight: 500;
}

.cm-del:hover {
	color: #c0453f;
}

.cm-empty {
	margin: 0 0 14px;
	color: var(--ink-faint);
	font-size: .9rem;
}

.cm-form {
	display: grid;
	gap: 8px;
	padding-top: 14px;
	border-top: 1px dashed var(--line);
}

.cm-as {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	font-size: .88rem;
	font-weight: 600;
}

.cm-as .cm-avatar {
	width: 26px;
	height: 26px;
	font-size: .75rem;
}

.cm-input {
	min-height: 84px;
	resize: vertical;
	font-size: .95rem;
	line-height: 1.5;
}

.cm-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.cm-counter {
	color: var(--ink-faint);
	font-size: .78rem;
	font-variant-numeric: tabular-nums;
}

.cm-login {
	display: grid;
	gap: 10px;
	justify-items: center;
	padding: 18px;
	border: 1px dashed var(--line);
	border-radius: 14px;
	text-align: center;
}

.cm-login p {
	margin: 0;
	color: var(--ink-soft);
	font-size: .92rem;
}

/* Bình luận cả chương */
.chapter-comments {
	margin-top: 36px;
	padding: 24px;
	border: 1px solid var(--line);
	border-radius: 18px;
	background: var(--surface);
	font-family: var(--font-ui);
}

.chapter-comments h2 {
	margin: 0 0 16px;
	font-size: 1.25rem;
}

.chapter-comments__count {
	color: var(--ink-faint);
	font: 400 .95rem var(--font-ui);
}

@media (max-width: 640px) {
	.chapter-comments {
		padding: 18px 16px;
	}
}

.auth-btn {
	gap: 6px;
}

.auth-btn svg {
	width: 18px;
	height: 18px;
}

@media (max-width: 560px) {
	.auth-btn {
		width: 40px;
		padding: 0;
	}

	.auth-btn__text {
		display: none;
	}
}

/* ==========================================================================
   14. Lượt xem
   ========================================================================== */

.views {
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.views__icon {
	display: inline-block;
	width: 1.05em;
	height: 1.05em;
	margin-right: .25em;
	vertical-align: -.16em;
	opacity: .8;
}

.chapter-list .views {
	margin-left: auto;
	color: var(--ink-faint);
	font-size: .8rem;
}

.story-card__meta .views {
	display: block;
	margin-top: 2px;
}

/* ==========================================================================
   15. Chi tiết trang trí
   ========================================================================== */

/* Vân giấy rất nhẹ trên nền */
body {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .55 0 0 0 0 .7 0 0 0 .055 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Đường kẻ mảnh hai màu dưới đầu trang */
.site-header::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -1px;
	height: 1px;
	background: linear-gradient(90deg, transparent 5%, color-mix(in srgb, var(--accent) 45%, transparent) 35%, color-mix(in srgb, var(--sweet) 45%, transparent) 65%, transparent 95%);
}

/* Chòm sao */
.constellation {
	position: absolute;
	width: clamp(120px, 16vw, 210px);
	height: auto;
	color: var(--accent);
	opacity: .3;
}

.sky .constellation--a { top: 12%; left: 5%; }
.sky .constellation--b { top: 40%; right: 4%; }

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .constellation { color: var(--star); opacity: .4; }
}

:root[data-theme="dark"] .constellation { color: var(--star); opacity: .4; }

@media (max-width: 640px) {
	.sky .constellation--a { top: 4%; left: -10px; width: 110px; opacity: .22; }
	.sky .constellation--b { display: none; }
}

/* Tiêu đề mục: trăng khuyết nhỏ trước dòng viết tay, đường chấm kéo dài */
.section-head__kicker::before {
	content: "";
	display: inline-block;
	width: .72em;
	height: .72em;
	margin-right: .45em;
	border-radius: 50%;
	box-shadow: inset .2em -.11em 0 0 currentColor;
	vertical-align: -.04em;
	transform: rotate(-15deg);
}

.section-head::after {
	content: "";
	flex: 1;
	order: 1;
	align-self: flex-end;
	min-width: 24px;
	margin-bottom: .62em;
	border-top: 2px dotted var(--line);
}

.section-head > a {
	order: 2;
}

/* Bìa như một cuốn sách: gáy bên trái, ánh bóng nhẹ */
.cover {
	border-radius: 4px 10px 10px 4px;
}

.cover::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background:
		linear-gradient(90deg, rgba(0, 0, 0, .18) 0, rgba(255, 255, 255, .22) 2.5%, rgba(0, 0, 0, .04) 5%, transparent 9%),
		linear-gradient(155deg, rgba(255, 255, 255, .2), transparent 38%);
	pointer-events: none;
}

.story-card .cover,
.spotlight__cover .cover {
	transition: transform .35s ease, box-shadow .35s ease;
}

.story-card:hover .cover,
.spotlight__cover:hover .cover {
	box-shadow: 0 18px 34px -18px color-mix(in srgb, var(--accent) 60%, transparent);
}

/* Danh sách cập nhật: dòng sáng lên khi rê chuột */
.update-list {
	overflow: hidden;
}

.update {
	transition: background-color .2s ease;
}

.update:hover {
	background: color-mix(in srgb, var(--accent-soft) 50%, transparent);
}

a.chip {
	transition: transform .2s ease, border-color .2s ease, color .2s ease;
}

a.chip:hover {
	transform: translateY(-1px);
}

/* Trang truyện: khung đầu có chút trời */
.story-head {
	position: relative;
	overflow: hidden;
	isolation: isolate;
	background: linear-gradient(180deg, color-mix(in srgb, var(--sky-1) 45%, var(--surface)) 0, var(--surface) 200px);
}

.story-head__sky {
	position: absolute;
	top: 10px;
	right: 14px;
	z-index: -1;
	width: 170px;
	pointer-events: none;
}

.story-head__sky .constellation {
	position: static;
	width: 100%;
}

.chapter-list li {
	transition: background-color .2s ease;
}

.chapter-list li:hover {
	background: color-mix(in srgb, var(--accent-soft) 45%, transparent);
}

/* Trang đọc: chữ cái đầu chương thật to, hoa văn cuối chương */
.reader__content .dropcap::first-letter {
	float: left;
	margin: .06em .12em 0 0;
	font-family: var(--font-serif);
	font-size: 3.2em;
	font-weight: 600;
	line-height: .82;
	color: var(--accent);
}

.chapter-end {
	margin: 10px 0 6px;
}

.chapter-end .ornament {
	width: 120px;
}

/* Chân trang: một chòm sao mờ góc phải */
.site-footer__sky {
	position: absolute;
	top: 34%;
	right: 4%;
	z-index: -1;
	width: clamp(140px, 18vw, 240px);
	pointer-events: none;
}

.site-footer__sky .constellation {
	position: static;
	width: 100%;
	color: #e6ecfb;
	opacity: .32;
}

@media (max-width: 640px) {
	.site-footer__sky {
		top: auto;
		bottom: 70px;
		width: 120px;
	}
}
