:root {
  --bg: #FAF7F5;
  --bg-soft: #F1E8E8;
  --surface: #fffdfc;
  --ink: #3C3437;
  --ink-strong: #2E2529;
  --muted: #786B70;
  --primary: #8C5A6B;
  --primary-soft: #C8A7AE;
  --accent: #A96572;
  --line: rgba(92, 69, 77, .16);
  --shadow: 0 18px 50px rgba(65, 45, 52, .10);
  --radius-sm: 12px;
  --radius: 22px;
  --radius-lg: 34px;
  --max: 1180px;
  --reading: 760px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: ui-serif, Georgia, "Noto Serif CJK SC", "Songti SC", serif; line-height: 1.8; text-rendering: optimizeLegibility; }
img { display: block; max-width: 100%; height: auto; border-radius: var(--radius); object-fit: cover; }
a { color: var(--primary); text-decoration-thickness: .08em; text-underline-offset: .16em; }
a:hover { color: var(--accent); }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid rgba(169,101,114,.42); outline-offset: 4px; border-radius: 6px; }
.skip-link { position: fixed; left: 16px; top: 12px; z-index: 100; transform: translateY(-150%); background: var(--ink-strong); color: #fff; padding: 8px 14px; border-radius: 10px; }
.skip-link:focus { transform: translateY(0); }
.reading-progress { position: fixed; left: 0; right: 0; top: 0; height: 3px; z-index: 90; transform-origin: 0 50%; transform: scaleX(0); background: var(--accent); }
.site-header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--line); background: rgba(250,247,245,.92); backdrop-filter: blur(16px); }
.header-inner { width: min(calc(100% - 40px), var(--max)); margin: 0 auto; min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink-strong); }
.brand img { width: 48px; height: 48px; border-radius: 50%; background: var(--bg-soft); }
.brand span { display: grid; line-height: 1.25; }
.brand strong { font-size: 1.16rem; letter-spacing: .08em; }
.brand small { margin-top: 4px; font-size: .75rem; color: var(--muted); }
.primary-nav { display: flex; align-items: center; gap: 28px; }
.primary-nav a { color: var(--ink); text-decoration: none; font-size: .96rem; }
.primary-nav a:hover { color: var(--primary); }
.menu-toggle { display: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink-strong); border-radius: 999px; padding: 8px 16px; font: inherit; }
.site-main { width: min(calc(100% - 40px), var(--max)); margin: 0 auto; padding: 56px 0 90px; }
.site-main.narrow { max-width: 900px; }
.eyebrow { margin: 0 0 10px; color: var(--accent); font: 700 .78rem/1.4 ui-sans-serif, system-ui, sans-serif; letter-spacing: .14em; text-transform: uppercase; }
h1,h2,h3 { color: var(--ink-strong); line-height: 1.25; letter-spacing: -.02em; }
h1 { margin: 0; font-size: clamp(2.3rem, 5vw, 4.8rem); }
h2 { margin: 0 0 14px; font-size: clamp(1.55rem, 3vw, 2.45rem); }
h3 { margin: 0 0 10px; font-size: 1.12rem; }
p { margin: 0 0 1em; }
.lead { max-width: 760px; margin-top: 22px; color: var(--muted); font-size: clamp(1.03rem, 1.8vw, 1.22rem); }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 10px 20px; border-radius: 999px; text-decoration: none; font-family: ui-sans-serif, system-ui, sans-serif; font-weight: 700; }
.button.primary { background: var(--primary); color: #fff; box-shadow: 0 8px 20px rgba(140,90,107,.24); }
.button.primary:hover { background: var(--accent); color: #fff; }
.button.secondary { border: 1px solid rgba(140,90,107,.32); background: var(--surface); color: var(--primary); }
.text-link { display: inline-flex; margin-top: 18px; font-family: ui-sans-serif, system-ui, sans-serif; font-weight: 700; }
.home-intro { min-height: 640px; display: grid; grid-template-columns: 1.05fr .8fr; align-items: center; gap: clamp(34px, 6vw, 86px); padding: 26px 0 72px; }
.intro-copy { padding: 20px 0; }
.intro-visual { margin: 0; position: relative; }
.intro-visual img { width: 100%; aspect-ratio: .84; box-shadow: var(--shadow); }
.intro-visual figcaption { margin: 12px 10px 0; color: var(--muted); font-size: .84rem; }
.content-band { margin: 0 calc((100vw - min(100vw, var(--max))) / -2); padding: 72px max(20px, calc((100vw - var(--max)) / 2)); background: var(--bg-soft); }
.section-heading { max-width: 760px; margin-bottom: 30px; }
.section-heading > p:last-child { color: var(--muted); }
.split-heading { max-width: none; display: grid; grid-template-columns: 1fr .75fr; gap: 40px; align-items: end; }
.chapter-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px 24px; }
.chapter-item { padding: 19px 0 18px; border-bottom: 1px solid var(--line); }
.chapter-link { display: flex; align-items: center; justify-content: space-between; gap: 18px; color: var(--ink-strong); text-decoration: none; font-weight: 700; }
.chapter-link:hover { color: var(--primary); }
.chapter-arrow { color: var(--primary-soft); }
.chapter-item p { margin: 7px 36px 0 0; color: var(--muted); font-size: .91rem; line-height: 1.65; }
.comic-preview { padding: 86px 0 40px; }
.comic-grid { display: grid; gap: 24px; }
.comic-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.comic-card { overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 36px rgba(75,52,60,.06); }
.comic-card img { width: 100%; aspect-ratio: 1.36; border-radius: 0; }
.comic-card > div { padding: 22px; }
.comic-card p { color: var(--muted); }
.comic-card a { font-family: ui-sans-serif, system-ui, sans-serif; font-weight: 700; }
.home-secondary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 70px 0; border: 1px solid var(--line); background: var(--line); border-radius: var(--radius); overflow: hidden; }
.home-secondary article { background: var(--surface); padding: 34px 30px; }
.home-secondary p { color: var(--muted); }
.quiet-feature { margin-top: 70px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 0; align-items: stretch; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.quiet-feature img { width: 100%; height: 100%; border-radius: 0; min-height: 340px; }
.quiet-feature > div { padding: clamp(34px, 5vw, 66px); display: flex; flex-direction: column; justify-content: center; }
.quiet-feature.text-only { grid-template-columns: 1fr; }
.breadcrumb { margin-bottom: 42px; font-family: ui-sans-serif, system-ui, sans-serif; font-size: .86rem; }
.breadcrumb ol { display: flex; gap: 9px; flex-wrap: wrap; list-style: none; padding: 0; margin: 0; }
.breadcrumb li:not(:last-child)::after { content: ' / '; margin-left: 9px; color: var(--primary-soft); }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb span { color: var(--ink-strong); }
.reading-hero, .comic-hero, .audio-hero { display: grid; grid-template-columns: 1fr .8fr; gap: 48px; align-items: center; margin-bottom: 68px; }
.reading-hero img, .comic-hero img, .audio-hero img { width: 100%; aspect-ratio: 1.25; box-shadow: var(--shadow); }
.reading-index { max-width: 950px; margin: 0 auto; }
.prose-panel { margin: 64px 0 0; padding: clamp(28px, 5vw, 50px); border-radius: var(--radius); background: var(--bg-soft); }
.prose-panel p { max-width: 760px; }
.chapter-reading { max-width: var(--reading); margin: 0 auto; }
.chapter-reading header { padding-bottom: 34px; border-bottom: 1px solid var(--line); }
.reading-body { font-size: 1.08rem; line-height: 2; padding: 32px 0 18px; }
.reading-body p { margin-bottom: 1.35em; }
.chapter-nav { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; margin-top: 38px; padding-top: 28px; border-top: 1px solid var(--line); font-family: ui-sans-serif, system-ui, sans-serif; }
.chapter-nav a { text-decoration: none; font-weight: 700; }
.chapter-nav a:last-child { text-align: right; }
.reading-aside { max-width: var(--reading); margin: 50px auto 0; padding: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.comic-layout { max-width: 1280px; }
.comic-grid.wide { gap: 34px; }
.comic-card.large { display: grid; grid-template-columns: 1.1fr .9fr; align-items: stretch; }
.comic-card.large img { height: 100%; aspect-ratio: 1.35; }
.comic-card.large > div { padding: clamp(28px, 4vw, 52px); display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.comic-detail { max-width: 1050px; margin: 0 auto; }
.comic-detail-image img { width: 100%; max-height: 640px; object-fit: cover; box-shadow: var(--shadow); }
.comic-detail-copy { max-width: 760px; margin: -50px auto 0; position: relative; z-index: 2; padding: clamp(28px, 5vw, 54px); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.comic-nav { max-width: 760px; margin-left: auto; margin-right: auto; }
.page-heading { padding: 10px 0 54px; }
.version-notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.note-card { padding: 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.note-card p { color: var(--muted); margin: 0; }
.comparison-table-wrap { margin-top: 64px; }
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; min-width: 620px; border-collapse: collapse; background: var(--surface); }
th, td { padding: 18px 20px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--bg-soft); color: var(--ink-strong); font-family: ui-sans-serif, system-ui, sans-serif; font-size: .9rem; }
tr:last-child td { border-bottom: 0; }
.audio-list { display: grid; gap: 22px; }
.audio-list article { padding: 28px 30px; border-left: 4px solid var(--primary-soft); background: var(--surface); border-radius: 0 var(--radius) var(--radius) 0; }
.empty-state { min-height: 60vh; display: flex; flex-direction: column; justify-content: center; align-items: flex-start; }
.site-footer { border-top: 1px solid var(--line); background: #f6efed; padding: 54px max(20px, calc((100vw - var(--max)) / 2)) 28px; }
.footer-grid { display: grid; grid-template-columns: 1fr auto; gap: 50px; align-items: start; }
.footer-grid > div { max-width: 520px; }
.footer-grid p { color: var(--muted); }
.footer-grid nav { display: grid; grid-template-columns: repeat(2, auto); gap: 10px 26px; font-family: ui-sans-serif, system-ui, sans-serif; }
.footer-grid nav a { color: var(--ink); text-decoration: none; }
.copyright { margin: 42px 0 0; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }

/* Reading density helpers */
.reading-layout .chapter-item:nth-child(odd) { padding-right: 8px; }
.reading-layout .chapter-item:nth-child(even) { padding-left: 8px; }
.comic-card h2, .comic-card h3 { text-wrap: balance; }
.page-heading h1, .reading-hero h1, .comic-hero h1, .audio-hero h1 { max-width: 850px; }
.muted { color: var(--muted); }

@media (max-width: 920px) {
  .header-inner { min-height: 72px; }
  .menu-toggle { display: inline-flex; }
  .primary-nav { position: absolute; top: calc(100% + 8px); right: 20px; min-width: 220px; padding: 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); display: none; flex-direction: column; align-items: stretch; gap: 2px; }
  .primary-nav.is-open { display: flex; }
  .primary-nav a { padding: 10px 12px; border-radius: 10px; }
  .primary-nav a:hover { background: var(--bg-soft); }
  .home-intro, .reading-hero, .comic-hero, .audio-hero { grid-template-columns: 1fr; }
  .intro-visual img { aspect-ratio: 1.2; max-height: 560px; }
  .comic-grid.compact { grid-template-columns: 1fr 1fr; }
  .home-secondary { grid-template-columns: 1fr; }
  .quiet-feature { grid-template-columns: 1fr; }
  .quiet-feature img { max-height: 420px; }
  .split-heading { grid-template-columns: 1fr; gap: 12px; }
  .comic-card.large { grid-template-columns: 1fr; }
  .comic-card.large img { max-height: 430px; }
}

@media (max-width: 680px) {
  .site-main { width: min(calc(100% - 28px), var(--max)); padding-top: 34px; }
  .brand img { width: 42px; height: 42px; }
  .brand small { display: none; }
  h1 { font-size: clamp(2rem, 11vw, 3.2rem); }
  h2 { font-size: 1.55rem; }
  .lead { font-size: 1rem; }
  .home-intro { min-height: auto; padding-bottom: 48px; }
  .content-band { margin-left: -14px; margin-right: -14px; padding: 50px 14px; }
  .chapter-list { grid-template-columns: 1fr; }
  .reading-layout .chapter-item:nth-child(odd), .reading-layout .chapter-item:nth-child(even) { padding-left: 0; padding-right: 0; }
  .comic-grid.compact { grid-template-columns: 1fr; }
  .home-secondary { margin: 48px 0; }
  .version-notes { grid-template-columns: 1fr; }
  .reading-body { font-size: 1.02rem; line-height: 1.95; }
  .chapter-nav { grid-template-columns: 1fr 1fr; }
  .chapter-nav a:nth-child(2) { order: 3; grid-column: 1 / -1; text-align: center; }
  .chapter-nav a:last-child { text-align: right; }
  .comic-detail-copy { margin-top: -18px; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-grid nav { grid-template-columns: 1fr 1fr; }
}

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

/* Extended utility and state rules to keep the interface consistent across content lengths and devices. */
@media (min-width: 1180px) {
  .novel-band .chapter-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .novel-band .chapter-item { padding-right: 18px; }
}
@media (hover: hover) {
  .comic-card { transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease; }
  .comic-card:hover { transform: translateY(-3px); box-shadow: 0 18px 46px rgba(75,52,60,.10); border-color: rgba(140,90,107,.25); }
  .button { transition: transform .2s ease, background .2s ease, color .2s ease; }
  .button:hover { transform: translateY(-1px); }
}

/* Typography calibration for Chinese long-form reading */
.reading-body p:first-child::first-letter { font-size: 1.35em; color: var(--primary); }
.reading-body, .prose-panel, .note-card, .audio-list article { text-wrap: pretty; }
.chapter-item, .comic-card, .note-card { break-inside: avoid; }

/* Safe defaults for very long unbroken text and narrow screens */
body, p, h1, h2, h3, a, td, th { overflow-wrap: anywhere; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* Visual breathing room for content-rich pages */
.reading-index + .prose-panel { margin-top: 72px; }
.comparison-table-wrap + .quiet-feature { margin-top: 64px; }
.audio-list + .prose-panel { margin-top: 56px; }

/* Print keeps only content and removes navigation chrome */
@media print {
  .site-header, .site-footer, .menu-toggle, .reading-progress, .button-row, .chapter-nav { display: none !important; }
  body { background: #fff; color: #000; }
  .site-main { width: 100%; max-width: none; padding: 0; }
  a { color: #000; text-decoration: none; }
  .reading-body { font-size: 11pt; line-height: 1.7; }
}

/* Additional robust layout states for tablets, landscape phones and very wide monitors. */
@media (min-width: 1440px) {
  .site-main { width: min(calc(100% - 72px), 1280px); }
  .home-intro { gap: 96px; }
  .comic-grid.wide { gap: 42px; }
  .comic-card.large > div { padding-left: 64px; padding-right: 64px; }
}
@media (min-width: 681px) and (max-width: 840px) {
  .chapter-list { grid-template-columns: 1fr; }
  .version-notes { grid-template-columns: 1fr; }
  .comic-card.large > div { padding: 32px; }
}
@media (max-width: 420px) {
  .header-inner { width: calc(100% - 22px); }
  .site-main { width: calc(100% - 22px); }
  .button-row { align-items: stretch; }
  .button-row .button { width: 100%; }
  .home-secondary article { padding: 26px 22px; }
  .prose-panel, .note-card, .audio-list article { padding-left: 22px; padding-right: 22px; }
  .footer-grid nav { grid-template-columns: 1fr; }
}

/* Component state consistency */
.primary-nav a[aria-current="page"] { color: var(--primary); font-weight: 700; }
.chapter-link:focus-visible, .text-link:focus-visible { outline-offset: 6px; }
.chapter-item:last-child { border-bottom-color: transparent; }
.comic-card .button { margin-top: 8px; }
.note-card h3 + p { margin-top: 6px; }
.audio-list article h2 { font-size: 1.35rem; }
.table-scroll:focus-within { box-shadow: 0 0 0 3px rgba(169,101,114,.12); }

/* Fine-grained reading rhythm */
.chapter-reading header .lead { max-width: 680px; }
.chapter-reading .reading-body { letter-spacing: .01em; }
.reading-body p + p { margin-top: .2em; }
.comic-detail-copy > p:last-of-type { margin-bottom: 0; }
.page-heading .lead { max-width: 800px; }
.version-notes + .comparison-table-wrap { padding-top: 8px; }

/* Graceful rendering when image files are not yet deployed. */
img { background: linear-gradient(135deg, #f1e8e8, #faf7f5); }
.intro-visual, .comic-card, .quiet-feature { isolation: isolate; }

/* Selection and form-control defaults keep the palette coherent. */
::selection { background: rgba(200,167,174,.55); color: var(--ink-strong); }
input, button, textarea, select { font: inherit; color: inherit; }

/* Reduced-transparency preference for environments that request simpler surfaces. */
@media (prefers-reduced-transparency: reduce) {
  .site-header { background: var(--bg); backdrop-filter: none; }
}
