/* Переплёт: a storybook landscape, parchment pages, and a living book. */
/* Design polish: unslop by Damir Sokolovsky (@heydamir), CC BY 4.0 — https://heydamir.design/unslop */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/Manrope-Variable.ttf") format("truetype");
}
@font-face {
  font-family: "Lora";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("fonts/Lora-Variable.ttf") format("truetype");
}
:root {
  color-scheme: light;
  --paper: #f6e9d2;
  --surface: #fff5e4;
  --raised: #ead9bc;
  --ink: #34261e;
  --secondary: #625041;
  --muted: #79644f;
  --line: #d4bc95;
  --accent: #6b1f2b;
  --accent-hover: #4d1520;
  --sans: "Manrope", system-ui, sans-serif;
  --serif: "Lora", Georgia, serif;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 24px; }
body { margin: 0; min-height: 100vh; background: #342a22; color: var(--ink); font: 16px/1.6 var(--sans); }
.site-frame { display: flex; flex-direction: column; width: min(1280px, calc(100% - 48px)); min-height: calc(100svh - 48px); margin: 24px auto; overflow: hidden; background: var(--paper); border: 1px solid #b69d76; border-radius: 20px; box-shadow: 0 16px 48px rgb(0 0 0 / 16%); }
a { color: var(--accent); text-underline-offset: 4px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
input, select { min-width: 0; }
h1, h2, h3, p, figure, blockquote, dl { margin: 0; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.2; }
h1 { font-size: clamp(36px, 4.2vw, 56px); letter-spacing: -.025em; overflow-wrap: anywhere; }
h2 { font-size: 32px; }
h3 { font-size: 24px; }
a, button { transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
::selection { color: #fff5e4; background: var(--accent); }
.shell { width: min(1184px, calc(100% - 64px)); margin-inline: auto; }
.main-content { flex: 1; padding-top: 40px; padding-bottom: 64px; }
.main-content.login-content { width: 100%; padding: 0 48px 64px; }
.main-content:focus { outline: none; }
.skip-link { position: absolute; z-index: 10; top: 8px; left: 8px; padding: 12px 20px; transform: translateY(-200%); background: var(--ink); color: var(--paper); }
.skip-link:focus { transform: none; color: var(--paper); }
.site-header { background: var(--paper); border-bottom: 1px solid var(--line); }
.header-inner { min-height: 88px; display: flex; align-items: center; gap: 32px; }
.brand { display: grid; grid-template-columns: 40px auto; align-items: center; column-gap: 12px; color: var(--ink); font: 500 28px/1.2 var(--serif); text-decoration: none; flex-shrink: 0; }
.brand-caption { grid-column: 2; margin-top: 8px; font: 12px/1.2 var(--sans); color: var(--muted); }
.brand-crest { grid-row: span 2; width: 40px; height: 48px; object-fit: contain; }
.main-nav { display: flex; align-items: center; gap: 24px; margin-inline: auto; }
.main-nav a, .login-link { position: relative; padding-block: 12px; color: var(--secondary); text-decoration: none; font-size: 14px; white-space: nowrap; }
.main-nav a:hover, .main-nav a[aria-current], .login-link:hover { color: var(--accent); }
.main-nav a[aria-current]::after { content: ""; position: absolute; inset: auto 0 4px; height: 2px; background: var(--accent); }
.session-nav { display: flex; align-items: center; gap: 16px; }
.session-nav form { margin: 0; }
.identity { display: flex; gap: 8px; align-items: center; color: var(--ink); font-size: 14px; text-decoration: none; max-width: 184px; }
.identity > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-button { color: var(--secondary); background: none; border: 0; padding: 12px 0; font-size: 14px; }
.text-button:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }
.reader-crest { display: inline-block; width: 56px; height: 68px; flex-shrink: 0; object-fit: contain; vertical-align: middle; }
.crest-small { width: 28px; height: 34px; }
.crest-large { width: 64px; height: 78px; }
.eyebrow { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.intro { color: var(--secondary); font-size: 18px; line-height: 1.6; max-width: 620px; margin-top: 20px; }
.muted { color: var(--muted); font-size: 14px; }
.folio { color: var(--muted); font: 12px/1.5 var(--sans); font-variant-numeric: tabular-nums; }
.understated-link { display: inline-flex; align-items: baseline; gap: 12px; font-size: 14px; text-decoration: none; }
.understated-link:hover { text-decoration: underline; }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 12px; padding: 12px 24px; border: 1px solid transparent; border-radius: 24px; font: 500 14px/1.5 var(--sans); text-decoration: none; text-align: center; }
.button-primary { background: var(--accent); color: #fff5e4; border-color: var(--accent); }
.button-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff5e4; }
.button-secondary { background: transparent; border-color: #9e796a; color: var(--accent); }
.button-secondary:hover { background: var(--raised); border-color: var(--accent); color: var(--accent); }
.full-width { width: 100%; }
.login-layout { display: grid; grid-template-columns: minmax(320px, .9fr) minmax(0, 1.1fr); grid-template-areas: "intro intro" "form preview"; gap: 48px 64px; }
.reading-room { grid-area: intro; position: relative; margin-inline: -48px; min-height: 520px; padding: 56px 64px 64px; background: var(--paper) url("illustrations/hogwarts-reading-room.webp") center 42% / cover no-repeat; }
.reading-room::after { content: ""; position: absolute; inset: auto 0 0; height: 72px; background: linear-gradient(to bottom, rgb(246 233 210 / 0), var(--paper)); pointer-events: none; }
.reading-preview { grid-area: preview; align-self: center; max-width: 560px; padding-block: 24px; }
.login-layout > .login-panel { grid-area: form; align-self: center; }
.reading-room h1 { max-width: 52%; font-size: clamp(48px, 5.5vw, 76px); line-height: 1.08; }
.reading-room .eyebrow, .reading-room .intro { max-width: 40%; }
.reading-room .intro { font-size: 16px; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin-top: 28px; max-width: 48%; }
.motion-toggle { width: 16px; height: 16px; margin: 0 8px 12px 0; vertical-align: middle; accent-color: var(--accent); }
.motion-control { font-size: 12px; color: var(--secondary); cursor: pointer; vertical-align: middle; }
.motion-preference { display: none; margin-bottom: 12px; color: var(--muted); font-size: 12px; }
.enchanted-scene { display: grid; grid-template-columns: 200px minmax(0, 1fr); align-items: center; gap: 28px; padding: 16px 0 20px; margin-bottom: 16px; color: var(--ink); }
.seal-gallery { position: relative; min-height: 260px; border: 8px solid #fff8ec; border-radius: 6px; background: #25352b; box-shadow: 0 8px 20px rgb(52 38 30 / 16%); transform: rotate(-3deg); }
.seal-gallery::before { content: ""; position: absolute; inset: 0 12px; border: 1px solid #788264; border-radius: 96px 96px 4px 4px; }
.school-seal { position: absolute; width: 64px; height: 78px; top: 12px; left: calc(50% - 32px); }
.enchanted-book { position: absolute; width: 148px; height: 88px; left: calc(50% - 74px); bottom: 28px; perspective: 600px; transform-style: preserve-3d; animation: levitating-book 3s ease-in-out infinite alternate; }
.enchanted-book::before, .enchanted-book::after { content: ""; position: absolute; width: 50%; height: 100%; top: 0; background: #3b5341; border: 2px solid #a8925e; }
.enchanted-book::before { left: -2px; border-radius: 6px 0 0 6px; transform: skewY(-8deg); }
.enchanted-book::after { right: -2px; border-radius: 0 6px 6px 0; transform: skewY(8deg); }
.spell-page { position: absolute; z-index: 1; top: 6px; width: 66px; height: 74px; border-bottom: 3px solid #bba576; border-radius: 2px; background: #e8d8b5; }
.spell-page::after { content: ""; position: absolute; left: 10px; right: 10px; top: 18px; height: 1px; color: #a39470; background: currentColor; box-shadow: 0 8px currentColor, 0 16px currentColor, 0 24px currentColor, 0 32px currentColor; }
.page-left { left: 7px; transform: skewY(-8deg); }
.page-right { left: 50%; transform: skewY(8deg); }
.page-turn { left: 50%; z-index: 2; transform-origin: left center; animation: turning-page 4s ease-in-out infinite; }
.scene-note .folio { color: var(--muted); }
.scene-note blockquote { margin-top: 12px; font: 500 22px/1.5 var(--serif); }
.scene-note figcaption { margin-top: 16px; font-size: 12px; line-height: 1.6; color: var(--secondary); }
.candle { position: absolute; z-index: 1; width: 10px; height: 32px; background: #eee1c2; border-bottom: 3px solid #beaa7d; animation: enchanted-candle 2.8s ease-in-out infinite alternate; }
.candle::after { content: ""; position: absolute; width: 6px; height: 12px; left: 2px; top: -14px; border-radius: 70% 40% 50% 50%; background: #e4bb6c; transform-origin: center bottom; animation: candle-flame 1.6s ease-in-out infinite alternate; }
.candle-one { left: 4px; top: 112px; }
.candle-two { right: 6px; top: 88px; height: 40px; animation-duration: 3.2s; animation-delay: -1.5s; }
.candle-three { left: 28px; top: 36px; height: 24px; animation-duration: 3.6s; animation-delay: -2s; }
.motion-toggle:checked ~ .enchanted-scene .candle, .motion-toggle:checked ~ .enchanted-scene .candle::after, .motion-toggle:checked ~ .enchanted-scene .enchanted-book, .motion-toggle:checked ~ .enchanted-scene .page-turn { animation-play-state: paused; }
@keyframes enchanted-candle {
  from { transform: translateY(0); }
  to { transform: translateY(-14px); }
}
@keyframes candle-flame {
  from { opacity: .68; transform: rotate(-4deg) scaleY(.9); }
  to { opacity: 1; transform: rotate(4deg) scaleY(1.06); }
}
@keyframes levitating-book {
  from { transform: translateY(4px) rotate(-5deg); }
  to { transform: translateY(-14px) rotate(3deg); }
}
@keyframes turning-page {
  0%, 12% { transform: rotateY(0deg); opacity: 0; }
  18% { opacity: 1; }
  72% { transform: rotateY(-180deg); opacity: 1; }
  84%, 100% { transform: rotateY(-180deg); opacity: 0; }
}
.login-panel { padding: 32px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid #b6975e; border-radius: 4px 4px 12px 12px; box-shadow: 0 4px 16px rgb(52 38 30 / 5%); }
.login-panel h2 { font-size: 32px; }
.form-intro { margin-top: 12px; margin-bottom: 24px; font-size: 14px; color: var(--secondary); }
.stack-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 14px; color: var(--ink); }
.field input, .field select { width: 100%; min-height: 48px; border: 1px solid #a58e70; border-radius: 8px; padding: 12px; background: #fff9ed; color: var(--ink); line-height: 1.5; }
.field input::placeholder { color: var(--muted); opacity: 1; }
.field input:hover, .field select:hover { border-color: var(--accent); }
.field-help { font-size: 12px; color: var(--muted); }
.form-divider { display: flex; align-items: center; gap: 12px; margin-block: 20px; color: var(--muted); font-size: 12px; }
.form-divider::before, .form-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.recovery-link { display: block; margin-top: 20px; color: var(--secondary); font-size: 14px; text-align: center; }
.form-error { padding: 12px 16px; margin-bottom: 24px; border: 1px solid #c99784; border-left: 3px solid #8f3c32; border-radius: 4px; background: #f4dfcf; color: #6c2723; font-size: 14px; }
.page-heading { margin-bottom: 36px; }
.catalog-heading { display: flex; gap: 40px; justify-content: space-between; align-items: flex-end; }
.catalog-heading .intro { max-width: 620px; }
.collection-count { flex-shrink: 0; margin-bottom: 4px; color: var(--muted); font-size: 14px; text-align: right; }
.collection-count > span { display: block; color: var(--accent); font: 500 40px/1.2 var(--serif); margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.catalog-search { display: flex; gap: 16px; align-items: flex-end; padding: 24px; background: var(--raised); border: 1px solid var(--line); border-radius: 8px; margin-bottom: 40px; }
.search-field { flex: 1; }
.genre-field { width: 240px; }
.section-heading { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; margin-bottom: 24px; }
.section-heading h2 { font-size: 24px; }
.section-heading > .muted { flex-shrink: 0; }
.catalog-results h2 { font-size: 24px; }
.book-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 32px; row-gap: 48px; }
.book-card { position: relative; display: grid; grid-template-rows: auto auto 1fr; align-content: start; min-width: 0; }
.cover-stage { padding: 24px 40px; background: #e6d7bd; border: 6px solid #fff6e7; border-radius: 8px; transition: background-color 160ms ease; }
.book-card:hover .cover-stage { background: #dfcba9; }
.book-cover { display: flex; flex-direction: column; position: relative; min-width: 0; min-height: 336px; padding: 24px 24px 24px 28px; border-radius: 2px 6px 6px 2px; color: #f6e8c6; box-shadow: 3px 4px 0 #baab90; }
.book-cover::before { content: ""; position: absolute; inset: 0 auto 0 8px; width: 1px; background: currentColor; opacity: .24; }
.book-cover::after { content: ""; position: absolute; inset: 12px 12px 12px 16px; border: 1px solid currentColor; opacity: .2; pointer-events: none; }
.cover-seal { width: 28px; height: 34px; object-fit: contain; align-self: center; }
.book-card .cover-title { font-size: 24px; margin-top: 16px; }
.book-card .cover-number { margin-bottom: 16px; }
.cover-moss { background: #2e4d39; }
.cover-rust { background: #733b3c; }
.cover-ink { background: #2d4357; }
.cover-ochre { background: #cbb479; color: #352e20; }
.cover-plum { background: #584554; }
.cover-slate { background: #46554c; }
.cover-number { font: 12px/1.5 var(--sans); font-variant-numeric: tabular-nums; margin-bottom: 32px; }
.cover-author { font-size: 14px; line-height: 1.5; padding-bottom: 16px; border-bottom: 1px solid currentColor; }
.cover-title { font: 500 28px/1.25 var(--serif); overflow-wrap: anywhere; margin-top: 20px; margin-bottom: 24px; }
.book-card .cover-author { margin-top: auto; border-bottom: 0; padding-bottom: 0; }
.cover-bottom { display: flex; flex-wrap: wrap; gap: 8px 12px; justify-content: space-between; font-size: 12px; margin-top: auto; }
.book-card-copy { padding-top: 20px; }
.book-byline { color: var(--secondary); font-size: 14px; margin-bottom: 8px; }
.book-metadata { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; margin-top: 12px; }
.book-card-link { color: var(--ink); text-decoration: none; }
.book-card-link::after { content: ""; position: absolute; inset: 0; border-radius: 12px; }
.book-card:hover .book-card-link { color: var(--accent); text-decoration: underline; }
.book-card-link:focus-visible { outline: none; }
.book-card-link:focus-visible::after { outline: 3px solid var(--accent); outline-offset: 8px; }
.book-description { color: var(--secondary); font-size: 16px; margin-top: 12px; }
.empty-state { padding: 64px 24px; text-align: center; border-block: 1px solid var(--line); }
.empty-state p:not(.eyebrow) { margin: 16px auto 24px; color: var(--secondary); max-width: 440px; }
.empty-note { color: var(--secondary); padding-block: 24px; }
.breadcrumbs { display: flex; flex-wrap: wrap; gap: 8px 12px; color: var(--muted); font-size: 14px; margin-bottom: 40px; }
.breadcrumbs a { color: var(--secondary); }
.book-detail { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 64px; align-items: center; padding-bottom: 48px; border-bottom: 1px solid var(--line); }
.detail-cover { min-height: 364px; }
.detail-cover .cover-title { font-size: 32px; }
.book-author { font: 24px/1.4 var(--serif); color: var(--secondary); margin-top: 16px; }
.book-summary-footer { display: flex; gap: 24px; flex-wrap: wrap; align-items: center; margin-top: 28px; }
.reading-layout { display: grid; grid-template-columns: 216px minmax(0, 760px); gap: 64px; padding-block: 48px; }
.reading-margin p { font-size: 14px; line-height: 1.7; color: var(--muted); margin-top: 12px; max-width: 168px; }
.excerpt h2 { margin-bottom: 24px; }
.excerpt p { font: 20px/1.8 var(--serif); margin-bottom: 20px; white-space: pre-line; }
.excerpt p:last-child { margin-bottom: 0; }
.reviews-section { margin-left: 280px; max-width: 760px; padding-top: 32px; }
.review-list { border-top: 1px solid var(--line); }
.review { padding-block: 28px; border-bottom: 1px solid var(--line); }
.review-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.review-reader { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); font-size: 14px; text-decoration: none; }
.review-reader:hover { text-decoration: underline; }
.review-meta { display: flex; align-items: center; gap: 20px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rating { font-size: 14px; color: var(--accent); }
.rating span { color: var(--muted); }
.review-text { color: var(--secondary); font-size: 16px; line-height: 1.8; white-space: pre-line; }
.review-book { margin-bottom: 16px; font-size: 24px; }
.review-book a { color: var(--ink); text-decoration: none; }
.review-book a:hover { text-decoration: underline; }
.review-book > span { display: block; margin-top: 8px; color: var(--muted); font: 12px/1.5 var(--sans); }
.reader-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.reader-card { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 28px; background: var(--surface); }
.reader-card-top { display: flex; align-items: center; gap: 12px; justify-content: space-between; margin-bottom: 24px; }
.reader-card h2 { font-size: 24px; }
.reader-card h2 a { color: var(--ink); text-decoration: none; }
.reader-card h2 a:hover { color: var(--accent); text-decoration: underline; }
.reader-subtitle { font-size: 14px; color: var(--muted); margin-top: 8px; }
.reader-bio { font-size: 14px; color: var(--secondary); margin-top: 20px; margin-bottom: 24px; }
.reader-details { padding-top: 20px; margin-top: auto; border-top: 1px solid var(--line); font-size: 14px; }
.reader-details > div { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 12px; }
dt { color: var(--muted); }
dd { margin: 0; }
.reader-card > .understated-link { margin-top: 12px; }
.profile-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 64px; align-items: start; }
.profile-card { padding: 32px; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid #a28a55; border-radius: 4px 4px 8px 8px; }
.profile-card-top { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; }
.profile-card h1 { font-size: 40px; }
.profile-role { margin-top: 12px; font-size: 14px; color: var(--accent); }
.profile-bio { font-size: 14px; color: var(--secondary); margin-block: 24px; }
.profile-details { border-top: 1px solid var(--line); padding-top: 20px; }
.profile-details > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; margin-bottom: 16px; font-size: 14px; }
.profile-details dd { overflow-wrap: anywhere; }
.profile-details dd.folio { color: var(--ink); }
.export-link { width: 100%; margin-top: 12px; padding-inline: 12px; font-size: 14px; }
.profile-content { min-width: 0; }
.private-panel { padding: 28px; margin-bottom: 40px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; background: var(--surface); }
.private-panel > p:not(.eyebrow) { margin-top: 16px; color: var(--secondary); font-size: 14px; }
.private-code { display: block; padding: 16px; margin-top: 20px; background: var(--raised); color: var(--ink); border: 1px solid var(--line); border-radius: 4px; font-size: 14px; overflow-wrap: anywhere; user-select: text; }
.recovery-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); gap: 96px; align-items: center; padding-block: 56px; }
.recovery-intro h1 { font-size: clamp(40px, 4.6vw, 56px); }
.recovery-intro .intro { max-width: 480px; }
.recovery-panel h2 { font-size: 32px; }
.error-page { max-width: 720px; padding: 32px 0; }
.error-number { display: block; color: var(--muted); font: 500 112px/1 var(--serif); margin-bottom: 28px; }
.error-page h1 { font-size: 48px; }
.error-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.site-footer { background: #ecddc2; border-top: 1px solid var(--line); }
.footer-inner { display: flex; gap: 24px; align-items: center; padding-block: 28px; color: var(--muted); font-size: 12px; }
.footer-brand { color: var(--ink); font: 500 24px/1.2 var(--serif); }
.footer-inner > a { margin-left: auto; color: var(--secondary); }
.house-register { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 20px 32px; padding-top: 28px; padding-bottom: 24px; border-bottom: 1px solid var(--line); color: var(--secondary); font-size: 12px; }
.house-register > span { display: inline-flex; align-items: center; gap: 12px; }
.house-register img { object-fit: contain; }
@media (max-width: 1100px) {
  .header-inner { flex-wrap: wrap; gap: 16px 32px; padding-block: 20px; }
  .main-nav { order: 3; width: 100%; margin: 0; border-top: 1px solid var(--line); padding-top: 8px; }
  .session-nav { margin-left: auto; }
  .login-layout { gap: 32px 40px; }
  .login-panel { padding: 28px; }
  .cover-stage { padding: 24px; }
  .book-cover { min-height: 280px; padding-right: 20px; padding-left: 24px; }
  .book-card .cover-title { font-size: 24px; }
  .reader-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-layout { grid-template-columns: 320px minmax(0, 1fr); gap: 40px; }
  .profile-card { padding: 24px; }
  .recovery-layout { gap: 48px; }
}
@media (max-width: 800px) {
  .shell { width: calc(100% - 48px); }
  .main-content { padding-top: 36px; padding-bottom: 56px; }
  .login-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
  .reading-room { min-height: 480px; padding: 48px 40px; }
  .reading-room h1 { font-size: 48px; }
  .enchanted-scene { grid-template-columns: 1fr; gap: 24px; }
  .seal-gallery { width: 200px; justify-self: center; }
  .reading-room .intro { font-size: 16px; }
  .login-panel { padding: 24px; }
  .catalog-heading { gap: 24px; }
  .catalog-heading .intro { font-size: 16px; }
  .collection-count { max-width: 104px; }
  .catalog-search { flex-wrap: wrap; padding: 20px; }
  .search-field { flex-basis: 100%; }
  .genre-field { flex: 1; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 24px; }
  .book-detail { grid-template-columns: 220px minmax(0, 1fr); gap: 36px; }
  .detail-cover { min-height: 328px; }
  .detail-cover .cover-title { font-size: 32px; }
  .book-summary h1 { font-size: 40px; }
  .book-author { font-size: 24px; }
  .book-summary .intro { font-size: 16px; }
  .reading-layout { grid-template-columns: 1fr; gap: 20px; padding-block: 36px; }
  .reading-margin p { max-width: none; }
  .reviews-section { margin-left: 0; padding-top: 20px; }
  .profile-layout { grid-template-columns: 280px minmax(0, 1fr); gap: 28px; }
  .profile-card-top { flex-wrap: wrap; gap: 16px; }
  .profile-card h1 { font-size: 32px; }
  .profile-details > div { grid-template-columns: 1fr; gap: 4px; }
  .profile-content .section-heading { flex-direction: column; gap: 8px; }
  .profile-content .section-heading h2 { font-size: 24px; }
  .recovery-layout { gap: 32px; grid-template-columns: minmax(0, 1fr) minmax(280px, 1fr); padding-block: 24px; }
  .recovery-intro h1 { font-size: 40px; }
  .recovery-intro .intro { font-size: 16px; }
}
@media (max-width: 620px) {
  .shell { width: calc(100% - 40px); }
  .site-frame { width: calc(100% - 24px); margin: 12px auto; border-radius: 12px; min-height: calc(100svh - 24px); }
  .main-content.login-content { padding-inline: 20px; padding-bottom: 48px; }
  .header-inner { gap: 16px; padding-block: 20px 8px; }
  .brand { font-size: 24px; column-gap: 8px; grid-template-columns: 32px auto; }
  .brand-crest { width: 32px; height: 40px; }
  .brand-caption { font-size: 12px; margin-top: 4px; }
  .main-nav { justify-content: space-between; gap: 12px; padding-top: 4px; }
  .main-nav a { font-size: 12px; padding-block: 12px; }
  .session-nav { gap: 12px; max-width: 144px; }
  .identity { max-width: 88px; }
  .identity .reader-crest { display: none; }
  .identity > span:last-child { font-size: 12px; }
  .text-button { font-size: 12px; }
  .main-content { padding-top: 32px; padding-bottom: 48px; }
  .login-layout { display: flex; flex-direction: column; gap: 24px; min-height: 0; padding-block: 0; }
  .reading-preview { width: 100%; padding-top: 8px; }
  .reading-room { width: calc(100% + 40px); margin-inline: -20px; min-height: 680px; padding: 32px 24px 320px; background-size: auto 440px; background-position: 70% bottom; }
  .reading-room::before { content: ""; position: absolute; inset: auto 0 360px; height: 80px; background: linear-gradient(to bottom, var(--paper), rgb(246 233 210 / 0)); pointer-events: none; }
  .reading-room h1 { max-width: 100%; font-size: 44px; }
  .reading-room .eyebrow, .reading-room .intro { max-width: 100%; }
  .reading-room .intro { font-size: 16px; margin-top: 16px; }
  .hero-actions { max-width: 100%; gap: 16px; margin-top: 24px; }
  .hero-actions .button { padding-inline: 20px; }
  .enchanted-scene { grid-template-columns: 128px minmax(0, 1fr); gap: 20px; padding: 16px 4px; }
  .seal-gallery { width: 128px; min-height: 232px; border-width: 6px; }
  .seal-gallery::before { inset-inline: 4px; }
  .school-seal { width: 56px; height: 68px; left: calc(50% - 28px); }
  .enchanted-book { width: 112px; height: 72px; left: calc(50% - 56px); bottom: 20px; }
  .spell-page { width: 50px; height: 58px; }
  .page-left { left: 5px; }
  .spell-page::after { left: 8px; right: 8px; top: 12px; box-shadow: 0 8px currentColor, 0 16px currentColor, 0 24px currentColor; }
  .scene-note blockquote { font-size: 18px; }
  .scene-note figcaption { font-size: 12px; }
  .candle-one { left: 0; }
  .candle-two { right: 0; }
  .login-panel { width: 100%; padding: 24px; }
  .login-panel h2 { font-size: 28px; }
  .page-heading { margin-bottom: 28px; }
  .catalog-heading { display: block; }
  .catalog-heading h1 { font-size: 40px; }
  .collection-count { max-width: none; text-align: left; margin-top: 20px; }
  .collection-count > span { display: inline; font: inherit; color: var(--secondary); margin-right: 4px; }
  .catalog-search { gap: 16px; padding: 20px; margin-bottom: 32px; }
  .genre-field { flex-basis: 100%; width: 100%; }
  .catalog-search > .button { width: 100%; }
  .section-heading { gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
  .section-heading h2 { font-size: 24px; }
  .section-heading > .muted { font-size: 12px; }
  .book-grid { grid-template-columns: 1fr; gap: 32px; }
  .book-card { grid-template-columns: 128px minmax(0, 1fr); grid-template-rows: auto auto; gap: 16px 20px; padding-bottom: 32px; border-bottom: 1px solid var(--line); }
  .cover-stage { padding: 0; background: none; border: 0; border-radius: 0; }
  .book-card:hover .cover-stage { background: none; }
  .book-card .book-cover { min-height: 192px; padding: 16px 12px 16px 16px; }
  .book-card .cover-number { margin-bottom: 12px; }
  .book-card .cover-seal { width: 48px; height: 58px; margin-block: 8px 16px; }
  .book-card .cover-title { display: none; }
  .book-card .cover-author { font-size: 12px; }
  .book-card-copy { padding-top: 0; align-self: center; }
  .book-description { grid-column: 1 / -1; margin-top: 0; }
  .breadcrumbs { margin-bottom: 28px; font-size: 12px; }
  .book-detail { grid-template-columns: 1fr; gap: 32px; padding-bottom: 32px; }
  .detail-cover { width: 240px; max-width: 100%; min-height: 320px; margin-inline: auto; }
  .detail-cover .cover-title { font-size: 32px; }
  .book-summary h1 { font-size: 40px; }
  .book-summary .intro { font-size: 16px; }
  .book-summary-footer { margin-top: 24px; gap: 16px; }
  .reading-layout { padding-block: 32px; }
  .reading-margin p { margin-top: 8px; }
  .reviews-section { padding-top: 12px; }
  .review { padding-block: 24px; }
  .review-meta { gap: 16px; }
  .reader-grid { grid-template-columns: 1fr; gap: 20px; }
  .reader-card { padding: 24px; }
  .reader-card-top { margin-bottom: 20px; }
  .reader-card h2 { font-size: 24px; }
  .profile-layout { grid-template-columns: 1fr; gap: 36px; }
  .profile-card { padding: 28px 24px; }
  .profile-card-top { flex-wrap: nowrap; }
  .profile-card h1 { font-size: 40px; }
  .profile-details > div { grid-template-columns: 1fr 1fr; gap: 12px; }
  .profile-content .section-heading { flex-direction: row; gap: 12px; }
  .private-panel { padding: 24px; margin-bottom: 32px; }
  .private-panel h2 { font-size: 32px; }
  .recovery-layout { grid-template-columns: 1fr; gap: 36px; padding-block: 8px; }
  .recovery-intro h1 { font-size: 40px; }
  .recovery-panel h2 { font-size: 28px; }
  .error-page { padding-block: 12px; }
  .error-number { font-size: 88px; margin-bottom: 24px; }
  .error-page h1 { font-size: 40px; }
  .error-page .intro { font-size: 16px; }
  .error-actions { flex-direction: column; align-items: stretch; }
  .footer-inner { flex-wrap: wrap; gap: 12px 20px; padding-block: 24px; }
  .footer-inner > span:nth-child(2) { width: 100%; order: 3; }
  .house-register { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 16px; }
  .house-register > span { gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .motion-toggle, .motion-control { display: none; }
  .motion-preference { display: block; }
}
