/* 与原型使用同款站酷快乐体；完整字库避免动态漫画标题回退成另一种字体。 */
@font-face {
    font-family: "Yangtuo Display";
    src: url("../fonts/ZCOOLKuaiLe-Regular.ttf") format("truetype");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
:root {
    --primary: oklch(.51 .204 275);
    --ink: oklch(.235 .017 275);
    --muted: oklch(.50 .017 275);
    --line: oklch(.926 .005 275);
    --surface: oklch(.977 .002 275);
    --lavender: oklch(.959 .018 280);
    --comic-outline: oklch(.27 .035 280);
    --comic-yellow: oklch(.93 .105 94);
    font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    font-synthesis: none;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    color: var(--ink); background: white;
}
* { box-sizing: border-box; }
body { margin: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 5px; }
.site-width { width: min(1320px, calc(100% - 96px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 40px; min-height: 85px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 25px; font-weight: 800; }
.brand img { display: block; object-fit: contain; }
.brand span { font-family: "Yangtuo Display", "YouYuan", "Yuanti SC", sans-serif; font-weight: 400; letter-spacing: 1px; }
.header-inner nav { display: flex; gap: 23px; align-items: center; }
.brand { flex-shrink: 0; }
.header-shelf { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 12px; border-radius: 8px; font-size: 13px; white-space: nowrap; }
.header-shelf:hover, .header-shelf[aria-current="page"] { color: var(--primary); background: var(--lavender); }
.header-inner nav { min-width: 0; }
.header-inner nav a { white-space: nowrap; flex-shrink: 0; }
.header-inner nav a { display: grid; place-items: center; min-width: 44px; min-height: 48px; color: var(--ink); font-size: 15px; font-weight: 500; }
.header-inner nav a:hover { color: var(--primary); }
.header-inner nav a[aria-current="page"] { position: relative; color: var(--primary); font-weight: 700; }
.header-inner nav a[aria-current="page"]::after { content: ""; position: absolute; bottom: -3px; width: 20px; height: 3px; background: var(--primary); border-radius: 3px; }
.home-main { min-height: calc(100svh - 170px); padding-bottom: 48px; }
.home-welcome { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 30px 0 23px; }
.home-welcome h1 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: .5px; line-height: 1.8; }
.home-welcome h1 span { color: var(--muted); font-weight: 400; }
.home-welcome p { margin: 0; color: var(--muted); font-size: 12px; }
.site-footer { border-top: 1px solid var(--line); padding-block: 26px; color: var(--muted); font-size: 12px; }
/* 首页保留精选题材入口，窄屏自动换行；完整题材在分类页查看，不使用滚动条。 */
.genre-bar { display: flex; align-items: center; gap: 24px; border: 1px solid var(--line); border-radius: 9px; padding: 12px 22px; margin: 24px 0 35px; }
.genre-label { display: flex; gap: 8px; align-items: center; min-height: 44px; font-size: 12px; font-weight: 600; white-space: nowrap; padding-right: 24px; border-right: 1px solid var(--line); }
.genre-links { min-width: 0; flex: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px; }
.genre-links a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; max-width: 100%; padding: 6px 12px; font-size: 12px; overflow-wrap: anywhere; border-radius: 5px; }
.genre-links a:hover, .genre-label:hover, .genre-more:hover { color: var(--primary); }
.genre-links a:hover { background: var(--surface); }
.genre-links a.selected { background: var(--lavender); color: var(--primary); font-weight: 600; }
.genre-more { display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0; min-height: 44px; color: var(--muted); font-size: 12px; }
.carousel-empty { min-height: 372px; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 32px; border-radius: 12px; background: var(--surface); text-align: center; }
.carousel-empty h2 { margin: 16px 0 8px; font-size: 23px; }
.carousel-empty p { margin: 0; color: var(--muted); font-size: 13px; }
.feature-layout { display: grid; grid-template-columns: minmax(0, 2.52fr) minmax(270px, 1fr); align-items: stretch; gap: 20px; }
.feature-layout > * { min-width: 0; }
.home-carousel { position: relative; isolation: isolate; overflow: hidden; border-radius: 12px; background: oklch(.19 .04 270); color: white; touch-action: pan-y pinch-zoom; }
.carousel-slides { height: 100%; }
.carousel-slide { position: relative; min-height: 372px; height: 100%; }
/* 横幅按原型比例等比铺满，竖版封面由 JS 识别后完整显示，不把人像放大裁掉。 */
.carousel-art { position: absolute; inset: 0 0 0 auto; width: 80%; height: 100%; object-fit: cover; object-position: 55% 40%; }
.carousel-art.is-portrait { width: 48%; object-fit: contain; object-position: right center; }
.carousel-shade { position: absolute; inset: 0; background: linear-gradient(90deg, oklch(.18 .035 273) 2%, oklch(.18 .035 273 / .97) 23%, oklch(.18 .035 273 / .70) 42%, oklch(.18 .035 273 / .05) 70%), linear-gradient(0deg, oklch(.12 .02 270 / .55), transparent 35%); }
.carousel-copy { position: relative; padding: 48px 38px 88px; max-width: 68%; overflow-wrap: anywhere; }
.carousel-copy h2 { margin: 0 0 13px; font-family: "Yangtuo Display", "YouYuan", "Yuanti SC", sans-serif; font-weight: 400; font-size: 35px; letter-spacing: .02em; line-height: 1.4; white-space: pre-line; text-wrap: balance; }
.carousel-copy p { max-width: 34ch; margin: 0; font-size: 12px; letter-spacing: .5px; line-height: 1.85; white-space: pre-line; color: oklch(.90 .018 275); }
.carousel-link { display: inline-flex; gap: 9px; align-items: center; min-height: 44px; margin-top: 17px; padding: 10px 19px; border-radius: 8px; background: white; color: oklch(.25 .055 274); font-weight: 600; font-size: 12px; }
.carousel-link:hover { background: oklch(.94 .02 275); }
.carousel-controls { position: absolute; bottom: 18px; right: 24px; left: 24px; display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.carousel-controls button { flex-shrink: 0; display: grid; place-items: center; min-width: 44px; height: 44px; padding: 0; border: 1px solid oklch(1 0 0 / .45); border-radius: 7px; background: transparent; color: white; }
.carousel-controls button:hover { background: white; color: var(--primary); }
.home-carousel :focus-visible { outline-color: white; outline-offset: 3px; }
.carousel-dots { display: flex; min-width: 0; overflow-x: auto; padding: 4px; }
.carousel-controls .carousel-dot { min-width: 28px; border: 0; border-radius: 4px; background: transparent; }
.carousel-dot span { width: 16px; height: 12px; border: 1.5px solid white; border-radius: 3px; background: transparent; transform: skew(-8deg); transition: background .18s; }
.carousel-dot[aria-pressed="true"] span { width: 20px; background: var(--comic-yellow); border-color: var(--comic-yellow); }
.carousel-counter { flex-shrink: 0; font-size: 12px; font-variant-numeric: tabular-nums; }
/* 右侧沿用原型粉色横图卡 + 淡紫叠放封面卡，整卡仅有一个漫画详情链接。 */
.feature-side { display: grid; grid-template-rows: 1fr 1fr; gap: 16px; min-width: 0; }
.feature-tile { position: relative; isolation: isolate; min-width: 0; min-height: 178px; border-radius: 12px; border: 1.5px solid var(--comic-outline); box-shadow: 3px 3px 0 var(--comic-outline); background: oklch(.94 .023 350); transition: transform .2s ease-out, box-shadow .2s ease-out; }
.feature-tile:not(.is-unconfigured):is(:hover, :focus-within) { transform: translateY(-2px); box-shadow: 3px 5px 0 var(--comic-outline); }
.tile-mascot { position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; background: url("../images/logo.svg") center / contain no-repeat; transform: rotate(9deg); z-index: 2; pointer-events: none; }
.tile-art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 55% 35%; border-radius: 10px; }
.tile-shade { position: absolute; inset: 0; border-radius: 10px; background: linear-gradient(90deg, oklch(.94 .023 350) 4%, oklch(.94 .023 350 / .90) 25%, oklch(.94 .023 350 / .05) 82%); }
.tile-copy { padding: 20px 22px; position: relative; z-index: 1; }
.tile-copy > span { display: flex; align-items: center; gap: 8px; font-size: 10px; font-weight: 500; color: oklch(.40 .025 335); }
.tile-copy h2 { max-width: 11ch; margin: 9px 0; font-size: 21px; line-height: 1.45; font-weight: 750; letter-spacing: .3px; white-space: pre-line; overflow-wrap: anywhere; text-wrap: balance; }
.tile-copy p { max-width: 170px; margin: 8px 0 0; color: oklch(.40 .025 335); font-size: 11px; line-height: 1.6; overflow-wrap: anywhere; white-space: pre-line; }
.tile-link { position: absolute; inset: 0; z-index: 3; border-radius: 12px; }
.tile-link:focus-visible { outline: none; }
.feature-tile:focus-within { outline: 3px solid var(--primary); outline-offset: 6px; }
.finished-tile { background: oklch(.95 .025 272); }
.finished-tile .tile-copy > span { color: oklch(.41 .07 273); }
.finished-tile .tile-copy p { color: oklch(.40 .04 273); }
.mini-cover { position: absolute; width: 73px; height: 104px; border: 3px solid white; border-radius: 4px; object-fit: cover; background: white; box-shadow: 0 3px 7px oklch(.3 .05 275 / .16); }
.mini-cover.front { right: 49px; bottom: 13px; transform: rotate(-12deg); }
.mini-cover.back { right: 19px; bottom: 44px; transform: rotate(15deg); }
.skip-link { position: fixed; top: -100px; left: 16px; z-index: 10; padding: 12px 18px; color: white; background: var(--primary); }
.skip-link:focus { top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (min-width: 1600px) {
    .carousel-slide, .carousel-empty { min-height: 402px; }
    .carousel-copy { padding-top: 54px; }
    .carousel-copy h2 { font-size: 39px; }
}
@media (min-width: 761px) and (max-width: 1200px) {
    .feature-layout { grid-template-columns: minmax(0, 2.3fr) minmax(245px, 1fr); gap: 16px; }
    .carousel-copy { padding-left: 28px; padding-right: 20px; max-width: 76%; }
    .carousel-copy h2 { font-size: 32px; }
    .mini-cover { width: 62px; height: 89px; }
    .mini-cover.front { right: 22px; bottom: 8px; }
    .mini-cover.back { right: 6px; }
}
@media (min-width: 761px) and (max-width: 1000px) {
    .feature-layout { grid-template-columns: minmax(0, 2fr) minmax(225px, 1fr); }
    .carousel-slide, .carousel-empty { min-height: 355px; }
    .carousel-copy { padding: 34px 24px 88px; max-width: 84%; }
    .carousel-copy h2 { font-size: 29px; }
    .carousel-art { width: 100%; }
    .tile-copy { padding: 18px; }
    .tile-copy h2 { font-size: 18px; }
}
@media (max-width: 760px) {
    .site-width { width: calc(100% - 40px); }
    .header-inner { min-height: 72px; gap: 28px; }
    .header-inner { flex-wrap: wrap; gap: 0; padding-top: 10px; }
    .header-inner nav { width: 100%; justify-content: space-between; gap: 8px; padding: 4px 0 8px; }
    .header-inner nav { order: 2; }
    .header-inner nav a { font-size: 14px; }
    .header-shelf { order: 1; margin-left: 4px; padding-inline: 8px; }
    .genre-bar { flex-wrap: wrap; gap: 0; margin: 20px 0 27px; padding: 6px 10px; }
    .genre-label { flex-basis: 100%; border: 0; padding-right: 0; }
    .genre-links { gap: 6px; }
    .genre-links a { padding-inline: 12px; }
    .home-welcome { padding: 24px 0 18px; }
    .home-welcome p { display: none; }
    .home-welcome h1 { font-size: 13px; letter-spacing: 0; }
    .feature-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .carousel-slide, .carousel-empty { min-height: 376px; }
    .carousel-copy { padding: 38px 26px 88px; max-width: 90%; }
    .carousel-copy h2 { font-size: 32px; line-height: 1.42; }
    .carousel-copy p { font-size: 13px; }
    .carousel-art { width: 87%; }
    .carousel-shade { background: linear-gradient(90deg, oklch(.18 .035 273 / .97), oklch(.18 .035 273 / .82) 35%, oklch(.18 .035 273 / .12) 100%); }
    .carousel-controls { left: 12px; right: 12px; gap: 4px; }
    .carousel-counter { display: none; }
    .carousel-dots { flex: 1; }
    .carousel-controls .carousel-dot { min-width: 32px; }
    .feature-side { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto; gap: 12px; }
    .feature-tile { min-height: 174px; }
    .tile-copy { padding: 16px 14px; }
    .tile-copy h2 { font-size: 18px; }
    .tile-copy p { max-width: none; font-size: 11px; }
    .tile-mascot { width: 23px; height: 23px; top: 7px; right: 7px; }
    .mini-cover { display: none; }
}
@media (max-width: 380px) {
    .carousel-copy { padding-inline: 21px; }
    .carousel-copy h2 { font-size: 29px; }
    .tile-copy { padding-inline: 12px; }
    .tile-copy h2 { font-size: 16px; }
}
@media (max-width: 359px) {
    .feature-side { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
    .carousel-dot span, .feature-tile { transition: none; }
    .feature-tile:not(.is-unconfigured):is(:hover, :focus-within) { transform: none; }
}

/* Shared error page: no dependency on database or third-party resources. */
.error-page { max-width: 680px; margin: 0 auto; padding: 60px 0; text-align: center; }
.error-mascot { display: block; margin: 0 auto 16px; }
.error-code { margin: 0 0 12px; color: var(--primary); font-size: 18px; font-weight: 700; }
.error-page h1 { margin: 0 0 16px; font-size: 30px; line-height: 1.5; text-wrap: balance; }
.error-description { margin: 0 auto; max-width: 44ch; color: var(--muted); font-size: 15px; line-height: 1.9; }
.error-home { display: inline-flex; gap: 16px; align-items: center; justify-content: center; min-height: 48px; margin-top: 28px; padding: 10px 22px; background: var(--primary); color: white; border-radius: 8px; font-weight: 600; }
.error-home:hover { background: oklch(.44 .2 275); }
.error-reference { margin: 32px auto 0; max-width: 100%; color: var(--muted); font-size: 12px; }
.error-reference summary { width: fit-content; min-height: 44px; margin: auto; padding: 12px; cursor: pointer; }
.error-reference code { display: block; overflow-wrap: anywhere; font-size: 12px; }
@media (max-width: 760px) {
    .error-page { padding: 40px 0; }
    .error-page h1 { font-size: 24px; }
}
