:root {
  color-scheme: light;
  --paper: #f8f7f2;
  --white: #fffefa;
  --ink: #282c23;
  --muted: #666b5d;
  --line: #e4e3da;
  --green: #254337;
  --green-dark: #1e372c;
  --green-light: #e9eee3;
  --serif: "Songti SC", "Noto Serif CJK SC", "STSong", "SimSun", serif;
  --sans: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 14px/1.6 var(--sans); }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #59784f; outline-offset: 4px; }
.visually-hidden, .icon-library { position: absolute; width: 0; height: 0; overflow: hidden; }
.visually-hidden { clip-path: inset(50%); white-space: nowrap; }
.icon { width: 20px; height: 20px; display: inline-block; vertical-align: middle; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.shell { width: min(1240px, calc(100% - 96px)); margin-inline: auto; }

.site-header { background: var(--white); border-bottom: 1px solid var(--line); }
.header-inner { min-height: 74px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 30px; }
.brand { width: fit-content; display: inline-flex; align-items: center; gap: 11px; }
.brand-mark { width: 37px; height: 37px; border-radius: 10px; background: var(--green); color: #f6f6e7; display: grid; place-items: center; }
.brand-mark .icon { width: 22px; height: 22px; }
.brand-name { color: var(--green-dark); font: 800 21px/1.1 var(--serif); letter-spacing: .06em; white-space: nowrap; }
.navigation { display: flex; align-items: stretch; gap: 31px; align-self: stretch; }
.nav-link { border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: #636757; white-space: nowrap; }
.nav-link:hover, .nav-link[aria-current] { color: var(--green); }
.nav-link[aria-current] { border-color: var(--green); font-weight: 650; }
.nav-link .icon { width: 16px; height: 16px; }
.search { justify-self: end; width: min(100%, 275px); min-width: 0; display: flex; align-items: center; gap: 8px; padding: 0 11px 0 7px; height: 39px; border: 1px solid #e7e6dc; border-radius: 8px; background: #f8f7f0; }
.search:focus-within { border-color: #8a9d7d; }
.search-submit { border: 0; border-radius: 4px; padding: 3px; background: transparent; color: var(--muted); line-height: 1; }
.search-submit .icon { width: 17px; height: 17px; }
.search input { appearance: none; width: 100%; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 12px; }
.search input::placeholder { color: #6f7366; }
.search kbd { white-space: nowrap; border-radius: 4px; border: 1px solid #e2e2d7; padding: 0 4px; color: #6a6d61; font: 11px/1.6 var(--sans); }

.hero { position: relative; isolation: isolate; display: flex; align-items: center; min-height: 376px; margin-top: 30px; overflow: hidden; border-radius: 16px; background: #223a2d; color: #fcf8ec; }
.hero-photo { position: absolute; inset: 0 0 0 37%; z-index: -2; background: #3e3b29 url("assets/reading-room.jpg") center 60% / cover no-repeat; }
.hero::before { content: ""; position: absolute; z-index: -1; inset: 0; background: linear-gradient(90deg, #223a2d 0%, #223a2d 34%, rgba(34,58,45,.68) 49%, transparent 68%); }
.hero-content { padding: 43px clamp(35px, 5vw, 70px) 45px; }
.hero-label { display: flex; align-items: center; gap: 10px; color: #d1dabb; letter-spacing: .17em; font-size: 12px; font-weight: 600; }
.hero-label span { width: 23px; height: 1px; background: #b6c6a2; }
.hero h1 { margin-block: 13px 14px; color: #fcf6e5; font: 800 clamp(44px, 5.1vw, 68px)/1.11 var(--serif); letter-spacing: -.045em; }
.hero-description { max-width: 29em; color: #e1e6d6; font-size: 14px; line-height: 1.75; }
.hero-button { display: inline-flex; align-items: center; gap: 20px; height: 43px; padding-inline: 16px; margin-top: 25px; border-radius: 7px; background: #e1e7ce; color: #223a2d; font-weight: 700; font-size: 13px; }
.hero-button .icon { width: 17px; height: 17px; }
.hero-button:hover { background: #f1f1db; }
.hero-button:focus-visible { outline-color: #eff2de; }

.catalog { padding-top: 24px; padding-bottom: 70px; scroll-margin-top: 12px; }
.category-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.category-option { min-height: 68px; display: flex; align-items: center; justify-content: flex-start; gap: 11px; padding: 10px 14px; white-space: nowrap; text-align: left; background: var(--white); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; }
.category-option:hover { border-color: #a6b29d; }
.category-option[aria-pressed="true"] { border-color: #a4b49a; background: #edf1e7; color: var(--green-dark); }
.category-icon { width: 35px; height: 35px; border-radius: 8px; display: grid; place-items: center; flex: none; background: #e7eae0; color: #3f5a45; }
.category-icon .icon { width: 18px; height: 18px; }
.category-option[aria-pressed="true"] .category-icon { background: var(--green); color: #f7f8ec; }
.category-magazine .category-icon { background: #f2e8dd; color: #8a583d; }
.category-book .category-icon { background: #e9ede0; color: #4b6347; }
.category-novel .category-icon { background: #ece8f0; color: #62506d; }
.category-collection .category-icon { background: #f2ecdc; color: #746338; }
.category-copy { display: flex; flex: 1; align-items: center; justify-content: space-between; gap: 5px; min-width: 0; }
.category-label { font-size: 13px; font-weight: 650; }
.category-count { font-size: 11px; color: #666e5c; font-variant-numeric: tabular-nums; }

.section-head { margin-top: 36px; margin-bottom: 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.section-title { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 12px; }
.section-title h2 { font: 800 32px/1.25 var(--serif); color: var(--ink); overflow-wrap: anywhere; }
.result-count { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.sample-notice { margin-top: 3px; color: var(--muted); font-size: 12px; }
.sort { display: grid; align-items: center; position: relative; }
.sort select { appearance: none; cursor: pointer; min-height: 37px; padding: 0 30px 0 11px; border-radius: 7px; border: 1px solid var(--line); background: var(--white); color: #4a4f42; font-size: 12px; }
.sort .icon { position: absolute; pointer-events: none; right: 8px; width: 15px; height: 15px; color: #515647; }

.book-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.book-card { position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 11px; background: var(--white); transition: box-shadow .18s, border-color .18s; }
.book-card:hover, .book-card:focus-within { border-color: #aab5a3; box-shadow: 0 5px 18px #223a2d10; }
.cover-stage { display: grid; place-items: center; min-height: 187px; padding: 19px 22px; overflow: hidden; background: var(--stage, #e5eadd); }
.theme-forest { --stage: #e6ebe0; --cover: #153527; --cover-text: #faf0cf; --art-x: 0%; --art-y: 0%; }
.theme-clay { --stage: #f4e5da; --cover: #e4ad7b; --cover-text: #522b1d; --art-x: 100%; --art-y: 0%; }
.theme-botanical { --stage: #efeadd; --cover: #e6d3a8; --cover-text: #263c26; --art-x: 0%; --art-y: 100%; }
.theme-moon { --stage: #e5e8ec; --cover: #111b2e; --cover-text: #f7edd3; --art-x: 100%; --art-y: 100%; }
.theme-ochre { --stage: #eee8d5; --cover: #8d682f; --cover-text: #fff4d5; --art-x: 100%; --art-y: 0%; --cover-filter: sepia(.35) saturate(.7) brightness(.62); }
.theme-russet { --stage: #f0e3dd; --cover: #472b27; --cover-text: #fff3dd; --art-x: 0%; --art-y: 0%; --cover-filter: sepia(.8) saturate(.8) hue-rotate(325deg) brightness(.8); }
.theme-sage { --stage: #e1e9e4; --cover: #30504d; --cover-text: #fff4d5; --art-x: 100%; --art-y: 100%; --cover-filter: sepia(.7) hue-rotate(103deg) saturate(.7) brightness(1.35); }
.theme-linen { --stage: #ede9e2; --cover: #e4dcca; --cover-text: #493432; --art-x: 0%; --art-y: 100%; --cover-filter: saturate(.35) hue-rotate(321deg) brightness(1.05); }
.book-cover { width: 102px; aspect-ratio: 2/3; position: relative; isolation: isolate; display: flex; flex-direction: column; align-items: center; gap: 5px; overflow: hidden; border-radius: 2px 4px 4px 2px; background: var(--cover); color: var(--cover-text); box-shadow: 6px 9px 12px #22281f34, 1px 2px 2px #20271e38; text-align: center; padding: 14px 8px 0; }
.book-cover::before { position: absolute; content: ""; z-index: -1; inset: 0; background: url("assets/cover-art.jpg") var(--art-x) var(--art-y) / 200% 200% no-repeat; filter: var(--cover-filter, none); }
.book-cover::after { position: absolute; content: ""; inset: 0; pointer-events: none; background: linear-gradient(90deg, #1e241d42, #fff4 2%, #28291d3d 4%, transparent 8%, transparent 98%, #fff2); }
.book-cover span { font: 800 12px/1.35 var(--serif); letter-spacing: .045em; overflow-wrap: anywhere; }
.book-cover small { max-width: 95%; font: 6px/1.15 Georgia, serif; letter-spacing: .09em; overflow-wrap: anywhere; opacity: .93; }
.book-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--cover); }
.book-card:hover .book-cover { transform: translateY(-2px); }
.book-cover { transition: transform .18s; }
.bookmark { position: absolute; top: 10px; right: 10px; z-index: 2; width: 42px; height: 42px; display: grid; place-items: center; padding: 0; background: #fffef6e8; border: 1px solid #272f2114; border-radius: 50%; color: #4b594a; }
.bookmark:hover { background: white; color: var(--green); }
.bookmark .icon { width: 17px; height: 17px; }
.bookmark[aria-pressed="true"] .icon { fill: #587453; }
.card-content { padding: 14px 15px 0; display: flex; flex: 1; flex-direction: column; }
.card-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 11px; }
.tag { display: inline-block; padding: 1px 6px; border-radius: 4px; background: #edf0e7; color: #415541; font-size: 11px; font-weight: 600; }
.tag.magazine { background: #f3ece2; color: #805436; }
.tag.novel { background: #eeebf2; color: #60516f; }
.tag.collection { background: #f4eddb; color: #6e5a30; }
.card-title { margin-top: 6px; color: #282c23; font: 800 21px/1.27 var(--serif); overflow-wrap: anywhere; }
.card-byline { margin-top: 4px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.card-summary { margin-top: 7px; margin-bottom: 12px; color: #575d51; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.card-link { display: flex; align-items: center; justify-content: space-between; gap: 5px; min-height: 42px; margin-top: auto; border-top: 1px solid #edede4; color: var(--green); font-size: 12px; font-weight: 650; }
.card-link::after { content: ""; position: absolute; inset: 0; }
.card-link:focus-visible { outline: none; }
.book-card:has(.card-link:focus-visible) { outline: 2px solid #59784f; outline-offset: 3px; }
.card-link .icon { width: 17px; height: 17px; }

.empty { display: grid; justify-items: center; gap: 8px; padding: 38px 18px; border: 1px dashed #d9dfd0; border-radius: 11px; background: var(--white); text-align: center; }
.empty-icon, .link-icon { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 9px; background: var(--green-light); color: var(--green); }
.empty h3 { font: 800 21px/1.3 var(--serif); }
.empty p { color: var(--muted); }
.secondary-button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 5px 10px; border: 1px solid #dbe2d4; border-radius: 6px; background: var(--white); color: var(--green); font-size: 12px; font-weight: 650; }
.secondary-button:hover { background: var(--green-light); }
.secondary-button .icon { width: 15px; height: 15px; }

.site-footer { border-top: 1px solid var(--line); background: #f3f2eb; }
.footer-inner { min-height: 78px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.footer-brand .brand-mark { width: 28px; height: 28px; border-radius: 7px; }
.footer-brand .icon { width: 16px; height: 16px; }
.footer-brand .brand-name { font-size: 16px; }
.footer-inner small, .to-top { color: var(--muted); font-size: 12px; }
.to-top .icon { width: 15px; height: 15px; }

dialog { width: min(570px, calc(100% - 26px)); max-height: calc(100dvh - 26px); margin: auto; padding: 0; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: var(--white); box-shadow: 0 22px 70px #1e2d2460; overscroll-behavior: contain; }
dialog::backdrop { background: #15231f91; backdrop-filter: blur(3px); }
body:has(dialog[open]) { overflow: hidden; }
.dialog-close { display: grid; place-items: center; position: absolute; z-index: 2; top: 13px; right: 13px; width: 40px; height: 40px; border: 1px solid var(--line); border-radius: 50%; background: var(--white); color: var(--green); padding: 0; }
.dialog-close:hover { background: var(--green-light); }
.detail-intro { display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 21px; padding: 26px 56px 24px 24px; background: var(--stage, #edf0e5); }
.detail-intro .book-cover { width: 100px; }
.detail-copy { min-width: 0; }
.detail-copy h2 { margin-top: 8px; font: 800 clamp(22px, 5vw, 30px)/1.25 var(--serif); overflow-wrap: anywhere; }
.detail-byline { margin-top: 5px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.detail-summary { margin-top: 10px; color: #444b3f; font-size: 13px; overflow-wrap: anywhere; }
.detail-links { padding: 22px 24px 25px; }
.detail-links h3 { margin-bottom: 10px; font: 800 20px/1.3 var(--serif); }
.detail-placeholder { color: var(--muted); border-radius: 7px; background: #f4f3eb; padding: 11px 13px; }
.link-list { display: grid; gap: 9px; }
.link-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; }
.link-icon { width: 36px; height: 36px; }
.link-icon .icon { width: 17px; height: 17px; }
.link-provider { display: block; font-weight: 700; overflow-wrap: anywhere; }
.link-code { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.link-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.open-link { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 36px; padding: 5px 10px; border-radius: 6px; background: var(--green); color: #fffdf3; font-size: 12px; font-weight: 650; }
.open-link .icon { width: 15px; height: 15px; }
.open-link:hover { background: #355746; }
.toast { position: fixed; z-index: 10; inset: auto 16px 20px auto; max-width: calc(100% - 32px); border-radius: 8px; background: var(--green-dark); color: var(--white); padding: 9px 14px; font-size: 13px; }

@media (max-width: 1050px) {
  .shell { width: calc(100% - 56px); }
  .header-inner { gap: 18px; }
  .navigation { gap: 20px; }
  .category-option { padding-inline: 10px; gap: 8px; }
  .hero h1 { font-size: clamp(42px, 5.9vw, 62px); }
}

@media (max-width: 800px) {
  .shell { width: calc(100% - 40px); }
  .header-inner { grid-template-columns: auto 1fr minmax(160px, 240px); gap: 14px; min-height: 65px; }
  .navigation { justify-content: center; gap: 15px; }
  .nav-favorites .icon, .search kbd { display: none; }
  .hero { min-height: 330px; margin-top: 20px; }
  .hero-photo { left: 34%; }
  .hero::before { background: linear-gradient(90deg, #223a2d 0%, #223a2d 28%, #223a2de9 38%, #223a2d3d 75%, transparent); }
  .category-list { gap: 7px; }
  .category-option { gap: 5px; }
  .category-icon { width: 29px; height: 29px; }
  .category-icon .icon { width: 16px; height: 16px; }
  .category-copy { flex-wrap: wrap; gap: 0 5px; }
  .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .shell { width: calc(100% - 32px); }
  .header-inner { grid-template-columns: auto 1fr; gap: 7px 12px; padding-block: 10px; }
  .brand-name { font-size: 18px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 8px; }
  .brand-mark .icon { width: 19px; height: 19px; }
  .navigation { justify-content: end; align-self: center; }
  .nav-link { min-height: 32px; margin: 0; font-size: 12px; }
  .search { grid-column: 1 / -1; width: 100%; justify-self: stretch; }
  .hero { display: block; min-height: 0; border-radius: 12px; margin-top: 15px; }
  .hero-photo { inset: 0; background-position: 57% 57%; }
  .hero::before { background: linear-gradient(90deg, #20382bf7 0%, #223a2de5 32%, #223a2d9f 64%, #223a2d36 100%); }
  .hero-content { padding: 25px 20px 26px; }
  .hero h1 { font-size: clamp(37px, 8.4vw, 51px); margin-block: 10px; }
  .hero-description { max-width: 20em; font-size: 12px; }
  .hero-label { font-size: 11px; }
  .hero-button { margin-top: 16px; }
  .catalog { padding-top: 16px; padding-bottom: 44px; }
  .category-list { display: flex; gap: 6px; overflow: auto; padding: 4px; margin: -4px; scrollbar-width: thin; }
  .category-option { min-height: 42px; padding: 5px 7px; border-radius: 7px; gap: 4px; }
  .category-copy { flex-wrap: nowrap; gap: 4px; }
  .category-label { font-size: 12px; }
  .category-count { font-size: 10px; }
  .category-icon { width: 24px; height: 24px; border-radius: 5px; }
  .category-icon .icon { width: 14px; height: 14px; }
  .section-head { margin-top: 25px; margin-bottom: 12px; }
  .section-title h2 { font-size: 25px; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cover-stage { min-height: 153px; padding-block: 12px; }
  .book-cover { width: 84px; }
  .bookmark { top: 6px; right: 6px; width: 42px; height: 42px; }
  .card-content { padding: 10px 10px 0; }
  .card-title { font-size: 18px; }
  .card-summary { margin-bottom: 8px; }
  .footer-inner { padding-block: 14px; }
  .footer-inner small { order: 3; width: 100%; }
  .detail-intro { gap: 13px; padding: 18px 43px 18px 15px; }
  .detail-intro .book-cover { width: 76px; }
  .detail-links { padding: 15px; }
  .dialog-close { width: 34px; height: 34px; top: 7px; right: 7px; }
  .link-row { grid-template-columns: auto 1fr; }
  .link-actions { grid-column: 2; justify-content: flex-start; }
}

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

.copy-status { margin-top: 8px; color: var(--green); font-size: 12px; }
