:root {
  --text: #eaf1ff;
  --muted: rgba(234, 241, 255, 0.72);
  --border: rgba(255, 255, 255, 0.12);
  --card-border: rgba(102, 192, 124, 0.24);
  --green: rgba(29, 143, 56, 0.98);
  --green-hi: rgba(41, 180, 90, 0.98);
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --text-dark: #0f172a;
  --muted-dark: #64748b;
  --line: #d9e2ec;
  --ok: #166534;
  --warn: #92400e;
  --bad: #991b1b;
  --shadow-lg: 0 25px 60px rgba(0, 0, 0, 0.38);
  --shadow-md: 0 16px 35px rgba(15, 23, 42, 0.12);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 14px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body.catalog-body {
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 10% 0%, rgba(60, 180, 90, 0.16) 0%, transparent 55%),
    radial-gradient(900px 600px at 90% 20%, rgba(0, 120, 60, 0.18) 0%, transparent 60%),
    linear-gradient(180deg, #071d13 0%, #04140d 100%);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 14px;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  text-decoration: none;
}

.site-shell {
  width: 100%;
  max-width: 1380px;
  margin: 0 auto;
}

.site-card {
  overflow: hidden;
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  background: var(--surface);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(102, 192, 124, 0.06);
}

.site-header {
  padding: 22px 24px 18px;
  background: linear-gradient(180deg, rgba(12, 45, 32, 0.96), rgba(8, 30, 21, 0.96));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.site-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo {
  width: 128px;
  height: 128px;
  object-fit: contain;
  border-radius: 16px;
  background: transparent;
  padding: 8px;
  box-shadow: none;
}

.brand-copy h1,
.brand-copy p,
.hero-copy h2,
.hero-copy p {
  margin: 0;
}

.brand-copy h1 {
  color: #ffffff;
  font-size: clamp(1.3rem, 2vw, 1.8rem);
  font-weight: 900;
  letter-spacing: 0.2px;
}

.brand-copy p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.95rem;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.site-nav a {
  color: rgba(255, 255, 255, 0.88);
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.92rem;
  font-weight: 700;
}

.site-nav a:hover,
.site-nav a.active {
  color: #ffffff;
  background: rgba(41, 180, 90, 0.18);
  border-color: rgba(134, 239, 172, 0.32);
}

.main-body {
  padding: 22px 24px 26px;
  color: var(--text-dark);
  background: linear-gradient(180deg, #f8fbf9 0%, #ffffff 100%);
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 18px;
  margin-bottom: 20px;
}

.hero-copy {
  border-radius: var(--radius-md);
  padding: 22px;
  background: linear-gradient(180deg, rgba(12, 45, 32, 0.94), rgba(8, 30, 21, 0.94));
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.hero-copy h2 {
  font-size: clamp(1.8rem, 3vw, 3rem);
  font-weight: 900;
  line-height: 1.05;
}

.hero-copy p {
  margin-top: 12px;
  color: var(--muted);
  max-width: 700px;
  font-size: 1rem;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hero-stat {
  min-width: 140px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
}

.hero-stat strong {
  display: block;
  color: #ffffff;
  font-size: 1.2rem;
  font-weight: 900;
}

.hero-stat span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.filters-card,
.panel-card,
.book-card,
.detail-card,
.modal-content {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.filters-card {
  padding: 18px;
}

.section-label {
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--green);
  margin-bottom: 8px;
}

.section-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 900;
  color: var(--text-dark);
}

.section-copy {
  margin: 6px 0 0;
  color: var(--muted-dark);
  font-size: 0.95rem;
}

.form-label {
  color: #334155;
  font-weight: 800;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.form-control,
.form-select,
textarea {
  min-height: 50px;
  border-radius: var(--radius-sm);
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--text-dark);
  font-size: 0.98rem;
}

.form-control::placeholder,
textarea::placeholder {
  color: #94a3b8;
}

.form-control:focus,
.form-select:focus,
textarea:focus {
  color: var(--text-dark);
  background: #ffffff;
  border-color: rgba(29, 143, 56, 0.7);
  box-shadow: 0 0 0 0.25rem rgba(29, 143, 56, 0.16);
}

.btn {
  border-radius: var(--radius-sm);
  min-height: 46px;
  padding: 10px 16px;
  font-size: 0.95rem;
  font-weight: 800;
}

.btn-green,
.btn-primary {
  border: 1px solid rgba(29, 143, 56, 0.26);
  background: linear-gradient(180deg, var(--green-hi), var(--green));
  color: #ffffff;
  box-shadow: 0 14px 22px rgba(29, 143, 56, 0.18);
}

.btn-green:hover,
.btn-primary:hover {
  color: #ffffff;
  filter: brightness(1.03);
}

.btn-ghost,
.btn-light,
.btn-outline-light,
.btn-outline-secondary,
.btn-open,
.btn-reserve {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: var(--text-dark);
}

.btn-ghost:hover,
.btn-light:hover,
.btn-outline-light:hover,
.btn-outline-secondary:hover,
.btn-open:hover,
.btn-reserve:hover {
  color: var(--text-dark);
  background: #f8fafc;
  border-color: #cbd5e1;
}

.btn-dl {
  border: 1px solid rgba(8, 71, 43, 0.18);
  background: linear-gradient(180deg, #123726, #0a2116);
  color: #ffffff;
}

.btn-dl:hover {
  color: #ffffff;
  filter: brightness(1.05);
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.results-meta {
  color: var(--muted-dark);
  font-size: 0.94rem;
}

.book-grid {
  row-gap: 18px;
}

.book-card {
  height: 100%;
  overflow: hidden;
}

.book-cover-wrap {
  position: relative;
  background: linear-gradient(180deg, #eef6f1, #dfece5);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 318px;
}

.book-cover {
  width: 100%;
  height: 290px;
  object-fit: contain;
  object-position: center center;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
}

.badge-cat {
  position: absolute;
  top: 24px;
  left: 24px;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(8, 30, 21, 0.92);
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.book-card-body {
  padding: 18px;
}

.book-title {
  font-size: 1.02rem;
  line-height: 1.28;
  font-weight: 900;
  color: var(--text-dark);
  min-height: 2.6em;
}

.book-meta {
  margin-top: 5px;
  color: var(--muted-dark);
  font-size: 0.92rem;
}

.info-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.info-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: #334155;
  font-size: 0.84rem;
  font-weight: 700;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #d1d5db;
}

.dot.ok {
  background: var(--ok);
}

.dot.warn {
  background: var(--warn);
}

.dot.bad {
  background: var(--bad);
}

.book-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.book-actions .btn {
  flex: 1 1 auto;
}

.empty-state,
.alert {
  border-radius: var(--radius-sm);
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 18px;
  min-height: calc(100vh - 210px);
}

.detail-sidebar,
.viewer-panel {
  overflow: hidden;
}

.detail-sidebar {
  padding: 18px;
}

.detail-cover {
  width: 100%;
  max-width: 280px;
  margin: 0 auto 18px;
  border-radius: 18px;
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.18);
}

.meta-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.meta-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid #e8eef4;
}

.meta-item:last-child {
  border-bottom: 0;
}

.meta-item strong {
  color: #334155;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.meta-item span {
  color: var(--text-dark);
  font-weight: 700;
  text-align: right;
}

.toc-card {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e8eef4;
}

.toc-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  color: var(--text-dark);
}

.toc-link:hover {
  background: #f8fafc;
  color: var(--text-dark);
}

.toc-page {
  min-width: 36px;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eff6f0;
  color: #14532d;
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
}

.viewer-panel {
  padding: 10px;
  min-height: 720px;
}

.viewer-frame {
  width: 100%;
  min-height: 700px;
  height: 100%;
  border: 0;
  border-radius: 12px;
  background: #edf2f7;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.88);
  font-weight: 700;
}

.back-link:hover {
  color: #ffffff;
}

.modal-content {
  overflow: hidden;
}

.modal-header {
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #f8fbf9, #ffffff);
}

.modal-footer {
  border-top: 1px solid #e2e8f0;
}

.muted {
  color: var(--muted-dark);
  font-size: 0.88rem;
}

@media (max-width: 991px) {
  .hero-panel,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .viewer-panel {
    min-height: 560px;
  }

  .viewer-frame {
    min-height: 540px;
  }
}

@media (max-width: 767px) {
  body.catalog-body {
    padding: 10px;
  }

  .site-header,
  .main-body {
    padding: 16px;
  }

  .site-header-row,
  .brand-lockup {
    align-items: flex-start;
  }

  .brand-logo {
    width: 54px;
    height: 54px;
  }

  .hero-copy,
  .filters-card,
  .detail-sidebar {
    padding: 16px;
  }

  .book-cover {
    height: 260px;
  }

  .book-cover-wrap {
    min-height: 288px;
  }

  .book-actions .btn,
  .site-nav a {
    width: 100%;
  }

  .site-nav {
    width: 100%;
  }

  .meta-item {
    flex-direction: column;
    gap: 6px;
  }

  .meta-item span {
    text-align: left;
  }
}
