/* 楷體字源：數位發展部 CNS11643 全字庫（https://data.gov.tw/dataset/5961）。 */
@font-face {
    font-family: "Siku Home Kai";
    src: url("/fonts/siku-home-kai-20261205.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
}
:root {
    color-scheme: light;
    --ground: #f6f1e7;
    --paper: #fcf9f1;
    --ink: #302a23;
    --muted: #685d50;
    --line: #ded3c0;
    --accent: #713e36;
    --accent-deep: #552a25;
    --gold: #b8945c;
    --search-accent: var(--accent);
    --search-paper: var(--paper);
    --search-heading: #ebe0ca;
    --serif: "SinogExt", "Noto Serif CJK TC", "Songti TC", "PMingLiU", serif;
    --sans: "SinogExt", system-ui, "Noto Sans CJK TC", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--ground); font: 1rem/1.65 var(--sans); }
h1, h2, p, ul, ol, figure { margin: 0; }
h1, h2, .brand, .collection { font-family: var(--serif); }
h1 { line-height: 1.22; font-size: clamp(2rem, 5vw, 3.25rem); font-weight: 650; }
a { color: var(--accent); text-underline-offset: .2em; }
button, input { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid #9e5548; outline-offset: 3px; }
.skip { position: fixed; top: .5rem; left: .5rem; z-index: 80; padding: .5rem 1rem; background: var(--paper); transform: translateY(-150%); }
.skip:focus { transform: none; }

.top { border-bottom: 1px solid var(--line); background: #f9f5eb; }
.top-inner { width: min(72rem, calc(100% - 3rem)); min-height: 4rem; margin-inline: auto; display: flex; align-items: center; gap: .8rem; }
.top a { text-decoration: none; }
.top a:hover { text-decoration: underline; }
.brand { color: var(--accent-deep); font-size: 1.19rem; font-weight: 650; letter-spacing: .06em; }
.top-rule { width: 1px; height: 1.1rem; background: #ccbaa4; }
.collection { color: var(--ink); font-size: 1rem; }
.site-home { margin-left: auto; color: var(--muted); font-size: .84rem; }
.site-home span { padding-left: .15rem; }
.shell { width: min(72rem, calc(100% - 3rem)); margin: 1.5rem auto 4rem; }

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
    min-height: 23rem;
    overflow: hidden;
    border: 1px solid #cfbfa3;
    border-radius: .35rem;
    background: #eee4d0;
}
.hero-copy { container-type: inline-size; align-self: center; padding: clamp(1.65rem, 6vw, 5.15rem); padding-right: 1.2rem; }
.hero h1 {
    color: #3b271f;
    margin: .2rem 0 .7rem;
    font-family: "Siku Home Kai", "KaiTi", "Kaiti TC", var(--serif);
    font-size: clamp(1.8rem, 3.8vw, 3.55rem);
    font-size: clamp(1.8rem, 14.5cqi, 3.55rem);
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: .045em;
}
.hero-copy .edition-credit {
    font: 400 .88rem/1.6 "Siku Home Kai", "KaiTi", "Kaiti TC", var(--serif);
    letter-spacing: .05em;
    color: #625448;
}
.primary {
    display: inline-flex;
    align-items: center;
    gap: 1.3rem;
    margin-top: 1.5rem;
    padding: .54rem .95rem;
    color: #fff6e4;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: .16rem;
    text-decoration: none;
}
.primary:hover { background: var(--accent-deep); }
.hero-entrances { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: 1rem; }
.hero-entrances .primary { margin-top: 0; padding: .44rem .68rem; white-space: nowrap; }
.hero-entrances .primary:not(:first-child) { background: #faf4e7; color: var(--accent-deep); }
.hero-entrances .primary:not(:first-child):hover { background: #e9d9c0; }
.character-note, .home-release-note { color: var(--muted); font-size: .81rem; line-height: 1.7; }
.character-note { margin-top: .38rem; }
.home-release-note { margin-top: .78rem; max-width: 31rem; }
.hero-folio {
    display: grid;
    place-items: center;
    position: relative;
    isolation: isolate;
    min-width: 0;
    background: radial-gradient(ellipse at 52% 27%, #73634b, #483e33 73%);
    overflow: hidden;
}
.hero-folio::before {
    content: "";
    z-index: -1;
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(100deg, transparent 0 2px, #e3ceb70c 2px 3px);
}
.folio-book {
    width: min(75%, 24rem);
    transform: rotate(-7deg);
    padding: .55rem .76rem .45rem .57rem;
    border: 1px solid #8c765b;
    border-left: .5rem double #9e855f;
    border-radius: .23rem .38rem .38rem .23rem;
    background: #74604a;
    box-shadow: .75rem 1rem 1.4rem #21170eb3, .22rem .65rem 0 -.2rem #b9a47d;
}
.folio-book img {
    display: block;
    width: 100%;
    height: auto;
    border: .25rem solid #e9ddba;
    border-right-width: .38rem;
    background: #efe1bf;
    filter: sepia(.42) brightness(.95) contrast(.88);
}
.hero-folio figcaption { position: absolute; bottom: .75rem; right: 1.1rem; color: #f5e6ca; font-size: .71rem; }
.library { margin-top: 2rem; }
.library h2 { font-size: 1.32rem; font-weight: 650; margin-bottom: .8rem; }
.divisions, .categories { padding: 0; list-style: none; display: grid; gap: .72rem; }
.divisions { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.division {
    position: relative;
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .8rem .62rem;
    min-height: 7.1rem;
    height: 100%;
    border: 1px solid var(--line);
    border-radius: .2rem;
    color: var(--ink);
    background: var(--paper);
    text-decoration: none;
}
.division.jing { --cloth: #793d35; --cloth-dark: #582c27; border-color: #b9917c; }
.division.shi { --cloth: #3d4c55; --cloth-dark: #2c3740; }
.division.zi { --cloth: #46594d; --cloth-dark: #344439; }
.division.ji { --cloth: #6a5542; --cloth-dark: #544032; }
.division.appendix { --cloth: #635262; --cloth-dark: #4c3b4a; }
.binding {
    flex: 0 0 2.6rem;
    min-height: 4.5rem;
    display: grid;
    place-items: center;
    gap: .25rem;
    padding: .32rem .26rem;
    border: 1px solid var(--cloth-dark);
    border-left-width: .24rem;
    border-radius: .1rem .17rem .17rem .1rem;
    background:
        repeating-linear-gradient(0deg, #fff1db11 0 1px, transparent 1px 3px),
        linear-gradient(100deg, var(--cloth), var(--cloth-dark));
    color: #2f251c;
    box-shadow: .12rem .17rem .23rem #31221935;
}
.binding > span { display: grid; place-items: center; border: 1px solid #c2a877; background: #e9d8ae; width: 1.35rem; min-height: 1.5rem; font: 600 .84rem var(--serif); }
.binding > i { width: 100%; height: 2px; border-block: 1px solid #efc98077; }
.division-text { display: flex; flex-direction: column; gap: .18rem; min-width: 0; }
.division strong, .categories strong { color: inherit; font: 650 1.18rem/1.35 var(--serif); }
.description { color: var(--muted); font-size: .72rem; }
.pending-label { color: #77644f; font-size: .7rem; white-space: nowrap; }
.division .pending-label { position: absolute; top: .35rem; right: .45rem; font-size: .64rem; }
.arrow { margin-left: auto; color: var(--accent); }
a.division:hover, .categories a:hover, .book-catalog a:hover { background: #f1e7d5; border-color: #b08b73; }
.pending { background: #f4eee2; }

.crumb { margin-bottom: 1.1rem; color: var(--muted); font-size: .85rem; }
.crumb ol { list-style: none; padding: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .59rem; }
.crumb li:not(:first-child)::before { content: "›"; color: #927f68; display: inline-block; padding-right: .59rem; }
.crumb a { color: var(--accent); }
.section-head { padding: clamp(1.35rem, 5vw, 2.65rem); background: #eee4d0; border: 1px solid #d6c6aa; border-left: .23rem solid var(--accent); border-radius: .2rem; }
.section-head h1 { font-size: clamp(1.375rem, 3vw, 1.75rem); }
.catalog .section-head h1 { font-size: clamp(1.25rem, 2.6vw, 1.5rem); }
.yi-catalog .section-head h1 { font-size: clamp(1.125rem, 2.4vw, 1.375rem); }
.section-head p { color: var(--muted); margin-top: .3rem; font-size: .94rem; }
.categories { grid-template-columns: repeat(5, minmax(0, 1fr)); margin-top: 1rem; }
.categories a, .categories .pending {
    display: grid;
    align-content: center;
    gap: .32rem;
    min-height: 6rem;
    height: 100%;
    padding: .75rem .85rem;
    border: 1px solid var(--line);
    border-radius: .2rem;
}
.categories a { position: relative; border-color: #b9917c; background: var(--paper); text-decoration: none; }
.categories a .arrow { position: absolute; right: .52rem; top: .35rem; }
.categories a span:not(.arrow) { color: var(--muted); font-size: .75rem; }

.prism-search .siku-book-lookup { border-top: 1px solid var(--line); }
.siku-book-lookup-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35rem; }
.siku-book-lookup-controls button { padding: .28rem .6rem; border: 1px solid var(--search-accent); border-radius: .13rem; color: var(--search-accent); background: var(--paper); }
.siku-book-lookup .book-lookup-status { margin-top: .32rem; color: var(--muted); font-size: .78rem; }
.siku-book-lookup .book-lookup-results { margin-top: .32rem; padding: 0 .12rem; max-height: 12rem; }
.catalog-state { color: var(--muted); margin-top: .7rem; font-size: .87rem; }
.book-catalog { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .65rem; margin-top: 1rem; }
.book-catalog li { min-width: 0; }
.book-catalog a, .catalog-pending { height: 100%; min-height: 4.65rem; padding: .6rem 2.15rem .6rem .8rem; display: flex; flex-direction: column; justify-content: center; gap: .16rem; position: relative; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: .18rem; text-decoration: none; }
.catalog-title { font: 650 1.05rem/1.32 var(--serif); overflow-wrap: anywhere; }
.catalog-pending {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
    align-content: center;
    column-gap: .45rem;
    padding-right: .8rem;
    background: #f3ede1;
}
.catalog-pending .catalog-author { grid-column: 1 / -1; }
.catalog-pending .pending-label, .book-lookup-results .pending-label { color: #765f45; }
.catalog-author { font-size: .76rem; color: var(--muted); overflow-wrap: anywhere; }
.book-catalog .arrow { position: absolute; right: .8rem; top: 50%; transform: translateY(-50%); font-size: 1.3rem; }

.reading .shell, .catalog .shell { width: min(92rem, calc(100% - 3rem)); }
.reading-layout { display: grid; grid-template-columns: minmax(14rem, 18rem) minmax(0, 1fr); align-items: start; gap: 1rem; }
.catalog-main { min-width: 0; }
.volume-menu .prism-search-embedded {
    position: static;
    width: auto;
    visibility: inherit;
    box-shadow: none;
    border: 0;
    border-bottom: 1px solid var(--line);
}
.prism-search-embedded .prism-search-heading { display: none; }
.catalog-toggle, .catalog-shade { display: none; }
.volume-menu { position: sticky; top: .85rem; max-height: calc(100vh - 1.7rem); overflow: auto; border: 1px solid var(--line); border-radius: .2rem; background: var(--paper); }
.volume-menu-head { display: flex; align-items: baseline; justify-content: space-between; gap: .35rem; border-bottom: 1px solid var(--line); padding: .6rem .75rem; background: #ebe0ca; }
.volume-menu-head h2 { font-size: 1.12rem; }
.volume-menu-head a { font-size: .75rem; white-space: nowrap; }
.volume-menu ol { list-style: none; padding: .34rem .4rem; max-height: 68vh; overflow: auto; }
.volume-menu ol a { display: block; padding: .35rem .45rem; border-left: 2px solid transparent; font-size: .87rem; text-decoration: none; }
.volume-menu ol a:hover, .volume-menu ol a[aria-current] { background: #eee4d0; border-left: 2px solid #9b6455; }
.reading-pane { min-width: 0; background: #fffaf0; border: 1px solid var(--line); border-radius: .2rem; }
.reading-masthead { padding: clamp(.82rem, 3vw, 1.5rem) clamp(.83rem, 4vw, 2.45rem); border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem 1rem; }
.reading-masthead h1 { font-size: clamp(1.375rem, 3.4vw, 1.875rem); overflow-wrap: anywhere; }
.reading-masthead p { margin-top: .4rem; font-size: .83rem; color: var(--muted); }
.reading-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .8rem; font-size: .81rem; }
.reading-actions { display: inline-flex; gap: .35rem; }
.reading-tools label { display: flex; align-items: center; gap: .25rem; min-height: 2.4rem; cursor: pointer; }
.reading-tools input { accent-color: var(--accent); }
.reading-tools button { min-height: 2.35rem; padding: .25rem .55rem; color: var(--accent); background: var(--paper); border: 1px solid #beab8e; border-radius: .18rem; }
#volume-title { font-size: 1.22rem; margin: 1rem clamp(.83rem, 4vw, 2.45rem) .3rem; }
#reading-state, .script-message { margin: .7rem clamp(.83rem, 4vw, 2.45rem); color: var(--muted); }
.prose { padding: .6rem clamp(.83rem, 4vw, 2.45rem) 1.1rem; font: 1.26rem/1.93 var(--serif); }
.prose p { margin: 0 0 .56em; white-space: pre-wrap; overflow-wrap: anywhere; }
.prose .search-highlight { background: #f2e4b7; }
.prose small { color: #715246; font-size: .79em; }
.prose.large { font-size: 1.5rem; }
.prose.no-notes small { display: none; }
.folio { margin: 0 0 .72rem; display: flex; align-items: center; gap: .52rem; color: #77654d; font: .72rem/1.5 var(--sans); scroll-margin-top: 1rem; }
.folio::after { content: ""; height: 1px; flex: 1; background: #e7decc; }
.inline-glyph { display: inline-block; height: 1em; max-width: 100%; object-fit: contain; vertical-align: -.09em; mix-blend-mode: multiply; }
.plate, .inline-plate { display: block; margin-bottom: .95rem; }
.plate img, .inline-plate img { display: block; width: auto; max-width: 100%; max-height: 32rem; height: auto; border: 1px solid #e3d7c4; mix-blend-mode: multiply; }
.adjacent { display: flex; gap: .4rem; border-top: 1px solid var(--line); padding: .7rem clamp(.83rem, 4vw, 2.45rem); }
.adjacent a { display: inline-block; padding: .22rem .44rem; }
.adjacent a#next { margin-left: auto; }

@media (max-width: 61rem) {
    .divisions { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .categories { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 47rem) {
    .top-inner, .shell { width: calc(100% - 1.5rem); }
    .top-inner { min-height: 3.2rem; gap: .45rem; }
    .brand { font-size: 1.07rem; }
    .site-home { font-size: .72rem; }
    .shell { margin-top: .8rem; }
    .hero { min-height: 0; grid-template-columns: 1fr; }
    .hero-copy { padding: 1.38rem 1.1rem; }
    .hero h1 { font-size: clamp(1.9rem, 8.4vw, 3.2rem); margin-bottom: .4rem; }
    .hero-copy .edition-credit { font-size: .8rem; }
    .hero-copy .home-release-note { font-size: .78rem; }
    .primary { margin-top: .8rem; font-size: .85rem; }
    .hero-folio { min-height: 10rem; height: 32vw; max-height: 14rem; place-items: start center; }
    .folio-book { width: min(75%, 22rem); margin-top: 1.7rem; }
    .hero-folio figcaption { right: .63rem; bottom: .39rem; padding: .12rem .35rem; border-radius: .15rem; background: #3b3128da; font-size: .67rem; }
    .library { margin-top: 1.12rem; }
    .divisions, .categories { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
    .division { min-height: 6.1rem; padding: .59rem .42rem; gap: .43rem; }
    .binding { flex-basis: 1.9rem; min-height: 3.8rem; }
    .binding > span { width: 1rem; font-size: .72rem; }
    .description { font-size: .67rem; }
    .book-catalog { grid-template-columns: minmax(0, 1fr); gap: .42rem; }
    .book-catalog a { min-height: 3.95rem; }

    .reading .shell, .catalog .shell { width: auto; margin-left: 2.15rem; margin-right: .75rem; }
    .reading-layout { grid-template-columns: minmax(0,1fr); }
    .catalog-toggle {
        position: fixed;
        display: flex;
        align-items: center;
        justify-content: center;
        left: 0;
        top: 44%;
        z-index: 55;
        width: 28px;
        min-height: 6.1rem;
        padding: .23rem .12rem;
        border: 1px solid var(--accent-deep);
        border-left: 0;
        border-radius: 0 .48rem .48rem 0;
        background: var(--accent);
        color: #fff9ec;
        font-size: .91rem;
        line-height: 1.3;
        writing-mode: vertical-rl;
        text-orientation: upright;
    }
    .catalog-shade { position: fixed; inset: 0; z-index: 50; background: #22181377; }
    .volume-menu {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        z-index: 52;
        width: min(85vw,21rem);
        max-height: none;
        visibility: hidden;
        overflow: auto;
        overscroll-behavior: contain;
        box-shadow: 3px 0 11px #2c221e44;
    }
    .volume-menu ol { max-height: none; }
    body.catalog-open { overflow: hidden; }
    body.catalog-open .volume-menu { visibility: visible; }
    body.catalog-open .catalog-shade { display: block; }
    body.catalog-open .catalog-toggle { left: min(85vw,21rem); }
    .prose { font-size: 1.1rem; }
    .prose.large { font-size: 1.35rem; }
}
