:root {
  --primary: #760031;
  --primary-hover: #5f0028;
  --primary-soft: #f7edef;
  --secondary: #d51c39;
  --highlight: #ff5a63;
  --dark-base: #050203;
  --dark-accent: #2a000d;
  --white: #ffffff;
  --ivory: #fff8f8;
  --text-main: #21191b;
  --text-muted: #74666a;
  --border: #e8dadd;
  --border-strong: #d7c3c8;
  --surface-soft: #fbf6f7;
  --radius-small: 8px;
  --radius-medium: 12px;
  --radius-large: 18px;
  --shadow: 0 12px 35px rgba(42, 0, 13, 0.07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 90px; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: var(--ivory); color: var(--text-main); line-height: 1.5; }
img { max-width: 100%; }
.hidden { display: none !important; }
.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; }

.site-topbar { position: sticky; top: 0; z-index: 100; width: 100%; background: var(--dark-accent); border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.site-topbar-inner { width: min(94%, 980px); min-height: 70px; margin: 0 auto; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px; }
.site-logo { display: inline-flex; align-items: center; gap: 10px; min-width: 0; color: var(--white); text-decoration: none; }
.site-logo-image { display: block; width: 40px; height: 40px; flex: 0 0 auto; object-fit: contain; }
.site-logo-text { color: var(--ivory); font-size: 16px; font-weight: 800; white-space: nowrap; }
.site-nav { display: flex; justify-content: center; align-items: center; gap: 6px; }
.nav-link { padding: 9px 11px; border-radius: 7px; color: rgba(255, 248, 248, 0.78); font-size: 13px; font-weight: 700; text-decoration: none; transition: background 0.2s ease, color 0.2s ease; }
.nav-link:hover { background: rgba(255, 255, 255, 0.07); color: var(--white); }
.nav-link.active { background: rgba(255, 90, 99, 0.12); color: var(--white); }
.contact-button { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 10px 15px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: var(--radius-small); background: var(--secondary); color: var(--white); font-size: 12px; font-weight: 700; text-decoration: none; white-space: nowrap; transition: background 0.2s ease, transform 0.15s ease; }
.contact-button:hover { background: var(--highlight); transform: translateY(-1px); }

.book-container { width: min(94%, 980px); margin: 40px auto 60px; }
.book-hero { max-width: 760px; margin: 0 auto 32px; text-align: center; }
.eyebrow { margin: 0 0 7px; color: var(--secondary); font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.book-hero h1 { margin: 0; color: var(--dark-accent); font-size: clamp(30px, 5vw, 44px); line-height: 1.15; }
.hero-description { max-width: 620px; margin: 12px auto 0; color: var(--text-muted); font-size: 15px; }
.reference-note { max-width: 720px; margin: 14px auto 0; padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius-medium); background: var(--surface-soft); color: var(--text-muted); font-size: 12px; }

.section-heading { margin-bottom: 15px; }
.section-heading h2 { margin: 0; color: var(--dark-accent); font-size: 18px; }
.section-heading p { margin: 4px 0 0; color: var(--text-muted); font-size: 13px; }

.book-search-section { max-width: 680px; margin: 0 auto 28px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-large); background: var(--white); box-shadow: var(--shadow); }
.search-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.search-form input { width: 100%; min-width: 0; padding: 12px 13px; border: 1px solid var(--border-strong); border-radius: var(--radius-small); background: var(--white); color: var(--dark-base); font-size: 15px; }
.search-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(255, 90, 99, 0.18); }
.btn-search { padding: 11px 19px; border: none; border-radius: var(--radius-small); background: var(--primary); color: var(--white); font-size: 13px; font-weight: 700; cursor: pointer; }
.btn-search:hover { background: var(--primary-hover); }
.search-message { min-height: 19px; margin: 8px 0 0; color: var(--secondary); font-size: 12px; }

.number-directory { margin-bottom: 38px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-large); background: var(--white); }
.number-grid { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 7px; }
.number-link { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 7px 4px; border: 1px solid var(--border); border-radius: var(--radius-small); background: var(--surface-soft); color: var(--primary); font-size: 13px; font-weight: 800; text-decoration: none; transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease; }
.number-link:hover, .number-link:focus-visible { border-color: var(--primary); background: var(--primary); color: var(--white); transform: translateY(-1px); }

.book-list { display: grid; gap: 24px; }
.book-item { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-large); background: var(--white); box-shadow: 0 7px 24px rgba(42, 0, 13, 0.05); }
.book-item.search-highlight { border-color: var(--highlight); box-shadow: 0 0 0 4px rgba(255, 90, 99, 0.13), 0 7px 24px rgba(42, 0, 13, 0.06); }
.book-item-header { display: flex; align-items: center; gap: 14px; margin-bottom: 20px; }
.book-number { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; flex: 0 0 auto; border-radius: 50%; background: var(--primary); color: var(--white); font-size: 18px; font-weight: 800; }
.book-label { margin: 0 0 2px; color: var(--secondary); font-size: 11px; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; }
.book-item-header h2 { margin: 0; color: var(--dark-accent); font-size: 23px; }
.book-item-content { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 26px; align-items: start; }

.book-figure { margin: 0; }
.book-figure img { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; border: 1px solid var(--border); border-radius: var(--radius-medium); background: var(--surface-soft); }
.image-fallback { display: flex; aspect-ratio: 4 / 3; align-items: center; justify-content: center; flex-direction: column; gap: 4px; border: 1px dashed var(--border-strong); border-radius: var(--radius-medium); background: var(--surface-soft); color: var(--text-muted); }
.image-fallback strong { color: var(--primary); font-size: 18px; }
.image-fallback span { font-size: 12px; }
.book-figure figcaption { margin-top: 7px; color: var(--text-muted); font-size: 11px; }

.book-information h3 { margin: 0 0 13px; color: var(--dark-accent); font-size: 16px; }
.book-details { margin: 0; }
.book-details > div { display: grid; grid-template-columns: 125px minmax(0, 1fr); gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.book-details > div:first-child { padding-top: 0; }
.book-details > div:last-child { border-bottom: none; }
.book-details dt { color: var(--text-muted); font-size: 12px; font-weight: 700; }
.book-details dd { margin: 0; color: var(--text-main); font-size: 13px; }

.back-to-top { position: fixed; right: 22px; bottom: 22px; z-index: 90; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: var(--primary); color: var(--white); font-size: 20px; font-weight: 800; text-decoration: none; box-shadow: 0 7px 20px rgba(118, 0, 49, 0.25); opacity: 0; visibility: hidden; transform: translateY(8px); transition: opacity 0.2s ease, visibility 0.2s ease, transform 0.2s ease, background 0.2s ease; }
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--secondary); }

.site-footer { padding: 28px 20px; background: var(--dark-accent); color: rgba(255, 248, 248, 0.76); }
.site-footer-inner { width: min(94%, 980px); margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.site-footer p { margin: 0; font-size: 12px; }
.site-footer strong { color: var(--ivory); }
.site-footer a { color: var(--highlight); font-weight: 700; text-decoration: none; }
.site-footer a:hover { color: var(--white); text-decoration: underline; }

@media (max-width: 800px) {
  .site-topbar-inner { grid-template-columns: auto 1fr auto; gap: 12px; }
  .site-logo-text { display: none; }
  .site-nav { justify-content: flex-start; }
  .number-grid { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .book-item-content { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .site-topbar-inner { width: calc(100% - 28px); min-height: 64px; }
  .site-logo-image { width: 34px; height: 34px; }
  .site-nav { gap: 2px; }
  .nav-link { padding: 8px 7px; font-size: 11px; }
  .contact-button { padding: 9px 10px; min-height: 36px; font-size: 10px; }
  .book-container { width: calc(100% - 28px); margin-top: 28px; }
  .hero-description { font-size: 13px; }
  .book-search-section, .number-directory, .book-item { padding: 16px; }
  .number-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .number-link { min-height: 38px; }
  .book-number { width: 46px; height: 46px; font-size: 16px; }
  .book-item-header h2 { font-size: 20px; }
  .book-details > div { grid-template-columns: 1fr; gap: 3px; }
  .site-footer-inner { flex-direction: column; gap: 8px; text-align: center; }
  .back-to-top { right: 14px; bottom: 14px; }
}

@media (max-width: 390px) {
  .nav-link { font-size: 10px; }
  .contact-button { padding: 8px; }
  .search-form { grid-template-columns: 1fr; }
  .btn-search { width: 100%; }
}