/* Справочник Грань Заката — в стиле основного сайта */

html {
  background-color: #0c0b09;
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Roboto", sans-serif;
  background-color: transparent;
  color: #e0e0e0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.bg-video {
  position: fixed;
  inset: 0;
  z-index: -5;
  overflow: hidden;
  pointer-events: none;
  background: #0c0b09;
}

.bg-video__clip {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 72%;
  filter: brightness(0.82) saturate(1.05) contrast(1.02);
  transform: scale(1.02);
  opacity: 0;
  transition: opacity 1.4s ease-in-out;
}

.bg-video__clip.is-active {
  opacity: 1;
}

.bg-video::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(
      180deg,
      rgba(8, 7, 6, 0.78) 0%,
      rgba(8, 7, 6, 0.58) 18%,
      rgba(8, 7, 6, 0.28) 36%,
      rgba(8, 7, 6, 0.06) 52%,
      transparent 68%,
      rgba(5, 4, 3, 0.25) 100%
    );
}

.atmosphere-haze {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, transparent 28%, transparent 78%, rgba(0, 0, 0, 0.35) 100%);
}

@media (prefers-reduced-motion: reduce) {
  .bg-video__clip {
    display: none;
  }

  .bg-video {
    background:
      #0c0b09 url("../img/bg/woods-night.jpg") center 72% / cover no-repeat;
  }
}

p {
  margin-bottom: 15px;
  line-height: 1.6;
}

a {
  text-decoration: none;
  transition: 0.3s;
}

header {
  background: #1e1e1e;
  padding: 15px 40px;
  border-bottom: 2px solid #ff6b00;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

h1 {
  margin: 0;
  color: #ff6b00;
  text-transform: uppercase;
  font-size: 24px;
  letter-spacing: 2px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 15px;
  color: inherit;
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-badge {
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #aaa;
  font-weight: 400;
}

nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
}

nav a.link {
  color: #aaa;
  margin-left: 25px;
  font-weight: 500;
  font-size: 16px;
  text-transform: uppercase;
  white-space: nowrap;
}

nav a.link:hover,
nav a.link.active {
  color: #ff6b00;
}

nav a.link.external {
  color: #888;
  font-size: 14px;
}

.container {
  max-width: 1100px;
  margin: 40px auto;
  padding: 0 15px;
  background: transparent;
  flex-grow: 1;
  width: 100%;
  box-sizing: border-box;
}

.panel {
  background-color: rgba(18, 16, 14, 0.9);
  border-radius: 8px;
  border: 1px solid #3a342c;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45), 0 0 24px rgba(255, 100, 0, 0.08);
  backdrop-filter: blur(6px);
}

.panel-title {
  margin: 0;
  padding: 22px 30px 16px;
  color: #fff;
  border-bottom: 1px solid #333;
  font-size: 22px;
  font-weight: 700;
}

.panel-body {
  padding: 24px 30px 30px;
}

.lead {
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 500;
  color: rgba(255, 248, 240, 0.96);
  margin: 0 0 14px;
  text-align: center;
  letter-spacing: 0.02em;
  line-height: 1.35;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.8);
}

/* —— Главная: анимированный экран —— */
body[data-page="home"] {
  font-family: "Manrope", sans-serif;
}

body[data-page="home"] header.home-top {
  background: transparent;
  border-bottom: 1px solid rgba(255, 107, 0, 0.55);
  box-shadow: none;
  position: relative;
  padding: 18px 36px;
  backdrop-filter: none;
}

body[data-page="home"] .brand-text h1 {
  color: #fff;
  font-family: "Oswald", "Manrope", sans-serif;
  font-weight: 600;
  letter-spacing: 0.12em;
  font-size: clamp(18px, 2vw, 26px);
}

body[data-page="home"] .brand-badge {
  color: #ff8a3d;
  letter-spacing: 0.18em;
  font-weight: 600;
}

.home-ext {
  color: rgba(220, 210, 195, 0.88);
  font-family: "Oswald", "Manrope", sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}

.home-ext:hover {
  color: #ff8a3d;
}

.home-embers {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1.5px 1.5px at 12% 78%, rgba(255, 170, 60, 0.85), transparent),
    radial-gradient(1px 1px at 18% 62%, rgba(255, 140, 40, 0.7), transparent),
    radial-gradient(1.5px 1.5px at 8% 55%, rgba(255, 200, 100, 0.55), transparent),
    radial-gradient(1px 1px at 22% 70%, rgba(255, 120, 30, 0.65), transparent),
    radial-gradient(1px 1px at 15% 48%, rgba(255, 180, 80, 0.45), transparent);
  background-size: 100% 100%;
  animation: embers-drift 9s ease-in-out infinite alternate;
  opacity: 0.7;
  mix-blend-mode: screen;
}

@keyframes embers-drift {
  from {
    transform: translateY(0) translateX(0);
    opacity: 0.45;
  }
  to {
    transform: translateY(-28px) translateX(10px);
    opacity: 0.85;
  }
}

.home-landing {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(28px, 5vh, 56px);
  width: 100%;
  padding: 12px 20px 20px;
  box-sizing: border-box;
}

.home-intro {
  width: min(760px, 100%);
  text-align: center;
  margin-top: clamp(8px, 2vh, 24px);
}

.home-kicker {
  margin: 0 0 12px;
  color: #ff8a3d;
  font-family: "Oswald", "Manrope", sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.85);
  animation: home-fade-up 0.8s ease both;
}

.home-title {
  margin: 0 0 18px;
  color: rgba(255, 248, 240, 0.98);
  font-family: "Oswald", "Manrope", sans-serif;
  font-size: clamp(28px, 4.2vw, 46px);
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  text-shadow: 0 2px 28px rgba(0, 0, 0, 0.85);
  animation: home-fade-up 0.9s ease both;
}

.home-support {
  margin: 0 auto;
  max-width: 640px;
  color: rgba(228, 220, 208, 0.94);
  font-size: clamp(15px, 1.35vw, 17px);
  line-height: 1.7;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.75);
  animation: home-fade-up 1s ease 0.08s both;
}

.home-library {
  width: min(1100px, 100%);
  animation: home-fade-up 1.1s ease 0.16s both;
}

.home-library__head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.home-library__line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 107, 0, 0.75), transparent);
  box-shadow: 0 0 10px rgba(255, 107, 0, 0.35);
}

.home-library__title {
  margin: 0;
  color: rgba(245, 238, 228, 0.95);
  font-family: "Oswald", "Manrope", sans-serif;
  font-size: clamp(14px, 1.5vw, 18px);
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.8);
}

.home-books {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: end;
  gap: clamp(20px, 3vw, 40px);
}

.home-book {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 0;
  text-decoration: none;
  position: relative;
  transition: transform 0.4s ease;
  -webkit-tap-highlight-color: transparent;
  flex: 0 1 220px;
  max-width: 240px;
  width: 100%;
}

.home-book:hover,
.home-book:focus-visible {
  transform: translateY(-10px) rotate(-1deg);
  outline: none;
  background: transparent;
}

.home-book:nth-child(2):hover,
.home-book:nth-child(2):focus-visible {
  transform: translateY(-10px) rotate(1deg);
}

.home-book:nth-child(3):hover,
.home-book:nth-child(3):focus-visible {
  transform: translateY(-10px) rotate(-0.8deg);
}

.home-book:nth-child(4):hover,
.home-book:nth-child(4):focus-visible {
  transform: translateY(-10px) rotate(1.2deg);
}

.home-book__glow {
  position: absolute;
  inset: 18% 18% auto;
  height: 48%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 120, 30, 0.28), transparent 72%);
  filter: blur(18px);
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
  z-index: 0;
}

.home-book:hover .home-book__glow,
.home-book:focus-visible .home-book__glow {
  opacity: 0.85;
}

.home-book__art {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 240px;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  object-position: center center;
  border-radius: 0;
  background: transparent !important;
  box-shadow: none !important;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.35));
  transition: filter 0.35s ease, transform 0.35s ease;
}

.home-book:hover .home-book__art,
.home-book:focus-visible .home-book__art {
  filter:
    drop-shadow(0 16px 22px rgba(0, 0, 0, 0.45))
    drop-shadow(0 0 14px rgba(255, 120, 40, 0.18));
  box-shadow: none !important;
}

.home-book__label {
  position: relative;
  z-index: 1;
  color: #ff8a3d;
  font-family: "Oswald", "Manrope", sans-serif;
  font-size: clamp(12px, 1.15vw, 15px);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.9);
  background: transparent;
  border: 0;
  padding: 0;
  box-shadow: none;
}

@keyframes home-fade-up {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.journal-modal[hidden] {
  display: none !important;
}

.journal-modal {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
  box-sizing: border-box;
}

.journal-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 3, 2, 0.82);
  backdrop-filter: blur(6px);
  cursor: pointer;
}

.journal-modal__panel {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  animation: journal-modal-in 0.4s ease both;
}

@keyframes journal-modal-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.journal-modal__top {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 0 4px;
}

.journal-modal__top--bare {
  grid-template-columns: 1fr;
  justify-items: end;
}

.journal-modal__top--bare .journal-modal__close {
  justify-self: end;
}

.journal-modal__top h2 {
  margin: 0;
  justify-self: start;
  color: #ff8a3d;
  font-family: "Manrope", "Roboto", sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
}

.journal-modal__caption {
  margin: 0;
  justify-self: center;
  color: rgba(235, 225, 210, 0.92);
  font-size: 15px;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
}

.journal-modal__close {
  justify-self: end;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255, 140, 60, 0.35);
  border-radius: 8px;
  background: rgba(20, 16, 12, 0.85);
  color: #ff8a3d;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.journal-modal__close:hover,
.journal-modal__close:focus-visible {
  background: rgba(255, 107, 0, 0.18);
  border-color: rgba(255, 140, 60, 0.7);
  outline: none;
}

.journal-book-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: min(68vh, 640px);
}

.journal-intro {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  animation: journal-cover-in 0.55s ease both;
}

.journal-intro[hidden] {
  display: none !important;
}

.journal-intro__open {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: min(360px, 70vw);
  transition: transform 0.35s ease;
}

.journal-intro__open:hover,
.journal-intro__open:focus-visible {
  transform: translateY(-8px) rotate(-1.5deg);
  outline: none;
}

.journal-intro__img {
  width: 100%;
  height: auto;
  display: block;
  background: transparent;
  filter: drop-shadow(0 22px 36px rgba(0, 0, 0, 0.65));
  pointer-events: none;
  user-select: none;
}

.journal-intro__hint {
  color: rgba(255, 170, 100, 0.92);
  font-family: "Oswald", "Manrope", sans-serif;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
}

@keyframes journal-cover-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.journal-book {
  margin: 0 auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  border-radius: 2px;
  background: transparent;
  animation: journal-pages-in 0.45s ease both;
  overflow: hidden;
}

.journal-book .stf__parent,
.journal-book .stf__wrapper,
.journal-book .stf__block {
  overflow: hidden !important;
}

.journal-book .stf__outerShadow,
.journal-book .stf__fixedShadow {
  max-width: 100%;
  overflow: hidden;
}

.journal-book[hidden] {
  display: none !important;
}

@keyframes journal-pages-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.journal-page {
  background: #1a1510;
  overflow: hidden;
  height: 100%;
}

.journal-page__face {
  width: 100%;
  height: 100%;
  background-color: #2a2218;
  background-repeat: no-repeat;
}

.journal-page__face--half {
  background-size: 200% 100%;
}

.journal-page__face--left {
  background-position: left center;
}

.journal-page__face--right {
  background-position: right center;
}

.journal-page__face--back {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(90, 50, 20, 0.35), transparent 55%),
    linear-gradient(145deg, #3a2a1c 0%, #1a120c 55%, #2c1e14 100%);
  color: #c4a574;
  font-family: "Manrope", sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
  padding: 24px;
  box-sizing: border-box;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.45);
}

.journal-page__face--back-left {
  background:
    radial-gradient(ellipse at 70% 30%, rgba(90, 50, 20, 0.28), transparent 55%),
    linear-gradient(215deg, #3a2a1c 0%, #14100c 55%, #2c1e14 100%);
}

.journal-page__face--back span {
  font-size: clamp(16px, 2.2vw, 22px);
  font-weight: 700;
  color: #e0c090;
}

.journal-page__face--back small {
  font-size: 11px;
  letter-spacing: 0.2em;
  color: rgba(180, 150, 110, 0.75);
}

.journal-nav {
  flex-shrink: 0;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 140, 60, 0.4);
  background: rgba(18, 14, 10, 0.88);
  color: #ff8a3d;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.journal-nav:hover:not(:disabled),
.journal-nav:focus-visible:not(:disabled) {
  background: rgba(255, 107, 0, 0.2);
  transform: scale(1.06);
  outline: none;
}

.journal-nav:disabled {
  opacity: 0.35;
  cursor: default;
}

.journal-modal__hint {
  margin: 4px 0 0;
  color: rgba(180, 170, 155, 0.7);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-align: center;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}

body.journal-open {
  overflow: hidden;
}

@media (max-width: 720px) {
  .journal-modal__top {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "title close"
      "caption caption";
  }

  .journal-modal__top h2 {
    grid-area: title;
    font-size: 12px;
  }

  .journal-modal__caption {
    grid-area: caption;
    white-space: normal;
    font-size: 13px;
  }

  .journal-modal__close {
    grid-area: close;
  }

  .journal-nav {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }

  .journal-modal__hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-kicker,
  .home-title,
  .home-support,
  .home-library,
  .home-embers,
  .journal-modal__panel {
    animation: none;
  }

  .home-book:hover,
  .home-book:focus-visible {
    transform: none;
  }
}

.home-page {
  display: none;
}

.feature-kicker {
  display: inline-block;
  color: #ff6b00;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.muted {
  color: #aaa;
}

.note {
  font-size: 13px;
  color: #888;
  font-style: italic;
}

.btn {
  background: #ff6b00;
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  text-transform: uppercase;
  font-weight: bold;
  transition: 0.3s;
  font-family: inherit;
  display: inline-block;
}

.btn:hover {
  filter: brightness(1.08);
}

.header-logo {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid #ff6b00;
  object-fit: cover;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.header-logo:hover {
  transform: rotate(360deg) scale(1.1);
  box-shadow: 0 0 15px rgba(255, 107, 0, 0.6);
}

.mobile-compact-header {
  display: none;
}

.full-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.menu-toggle {
  background: none;
  border: 1px solid #ff6b00;
  color: #ff6b00;
  width: 42px;
  height: 36px;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  padding: 0;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: #ff6b00;
}

.campfire-glow {
  display: none;
}

.campfire-glow::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 300px;
  background:
    radial-gradient(ellipse 60% 100% at 15% 100%, rgba(255, 180, 50, 0.7) 0%, transparent 40%),
    radial-gradient(ellipse 60% 100% at 50% 100%, rgba(255, 200, 80, 0.9) 0%, transparent 50%),
    radial-gradient(ellipse 60% 100% at 85% 100%, rgba(255, 180, 50, 0.7) 0%, transparent 40%);
  animation: fireFlickerBright 2.5s infinite ease-in-out;
}

.campfire-glow::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 200px;
  background:
    radial-gradient(ellipse 40% 100% at 25% 100%, rgba(255, 220, 100, 1) 0%, transparent 30%),
    radial-gradient(ellipse 40% 100% at 50% 100%, rgba(255, 240, 120, 1) 0%, transparent 35%),
    radial-gradient(ellipse 40% 100% at 75% 100%, rgba(255, 220, 100, 1) 0%, transparent 30%);
  animation: firePulse 1.8s infinite ease-in-out;
}

@keyframes fireFlickerWide {
  0% { opacity: 0.8; transform: scaleX(1) scaleY(1); filter: blur(40px) brightness(1); }
  12% { opacity: 0.95; transform: scaleX(1.05) scaleY(0.95); filter: blur(45px) brightness(1.1); }
  25% { opacity: 0.7; transform: scaleX(0.98) scaleY(1.08); filter: blur(35px) brightness(0.9); }
  38% { opacity: 1; transform: scaleX(1.08) scaleY(0.92); filter: blur(50px) brightness(1.2); }
  50% { opacity: 0.85; transform: scaleX(0.95) scaleY(1.05); filter: blur(38px) brightness(1); }
  63% { opacity: 0.9; transform: scaleX(1.03) scaleY(0.98); filter: blur(42px) brightness(1.05); }
  75% { opacity: 0.75; transform: scaleX(1.02) scaleY(1.03); filter: blur(37px) brightness(0.95); }
  88% { opacity: 0.95; transform: scaleX(1.06) scaleY(0.96); filter: blur(48px) brightness(1.15); }
  100% { opacity: 0.8; transform: scaleX(1) scaleY(1); filter: blur(40px) brightness(1); }
}

@keyframes fireFlickerBright {
  0%, 100% { opacity: 0.85; transform: scaleX(1) scaleY(1); filter: blur(30px); }
  20% { opacity: 1; transform: scaleX(1.1) scaleY(0.9); filter: blur(35px); }
  40% { opacity: 0.7; transform: scaleX(0.95) scaleY(1.1); filter: blur(25px); }
  60% { opacity: 0.95; transform: scaleX(1.05) scaleY(0.95); filter: blur(32px); }
  80% { opacity: 0.8; transform: scaleX(1.02) scaleY(1.05); filter: blur(28px); }
}

@keyframes firePulse {
  0%, 100% { opacity: 0.7; transform: scaleX(1) scaleY(1); filter: blur(20px); }
  33% { opacity: 1; transform: scaleX(1.15) scaleY(0.85); filter: blur(25px); }
  66% { opacity: 0.8; transform: scaleX(0.9) scaleY(1.1); filter: blur(18px); }
}

.sparks-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}

.spark {
  position: absolute;
  bottom: 38%;
  border-radius: 50%;
  animation-timing-function: linear;
  animation-iteration-count: 1;
  animation-fill-mode: forwards;
}

.spark.small {
  width: 3px;
  height: 3px;
  background-color: rgba(255, 210, 120, 1);
  box-shadow: 0 0 6px rgba(255, 220, 150, 1), 0 0 12px rgba(255, 140, 40, 0.7);
  animation-name: sparkFly;
}

.spark.medium {
  width: 5px;
  height: 5px;
  background-color: rgba(255, 180, 60, 1);
  box-shadow: 0 0 8px rgba(255, 200, 100, 1), 0 0 16px rgba(255, 120, 30, 0.7);
  animation-name: sparkFly;
}

.spark.large {
  width: 6px;
  height: 6px;
  background-color: rgba(255, 160, 40, 1);
  box-shadow: 0 0 8px rgba(255, 180, 80, 1), 0 0 16px rgba(255, 140, 40, 0.8);
  animation-name: sparkFly;
}

.spark.ember {
  width: 8px;
  height: 8px;
  background: radial-gradient(circle, rgba(255, 100, 0, 1) 0%, rgba(200, 50, 0, 0.8) 100%);
  box-shadow: 0 0 10px rgba(255, 120, 40, 1), 0 0 20px rgba(255, 80, 20, 0.6);
  animation-name: sparkFly;
}

@keyframes sparkFly {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  20% { transform: translate(var(--wind-x-20), var(--wind-y-20)) rotate(var(--rotate-20)) scale(var(--scale-20)); opacity: 0.9; }
  40% { transform: translate(var(--wind-x-40), var(--wind-y-40)) rotate(var(--rotate-40)) scale(var(--scale-40)); opacity: 0.8; }
  60% { transform: translate(var(--wind-x-60), var(--wind-y-60)) rotate(var(--rotate-60)) scale(var(--scale-60)); opacity: 0.6; }
  80% { transform: translate(var(--wind-x-80), var(--wind-y-80)) rotate(var(--rotate-80)) scale(var(--scale-80)); opacity: 0.3; }
  100% { transform: translate(var(--wind-x-100), var(--wind-y-100)) rotate(var(--rotate-100)) scale(0); opacity: 0; }
}

.search-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.search-row input {
  width: 100%;
  padding: 12px;
  background: #2b2b2b;
  border: 1px solid #444;
  color: white;
  border-radius: 4px;
  box-sizing: border-box;
  font-family: inherit;
}

.craft-toolbar {
  position: sticky;
  top: 72px;
  z-index: 30;
  margin: 0 0 16px;
  padding: 12px 0 10px;
  background: linear-gradient(180deg, rgba(18, 16, 14, 0.96) 70%, rgba(18, 16, 14, 0.72) 100%);
  backdrop-filter: blur(10px);
}

.craft-toolbar .search-row {
  margin-bottom: 10px;
}

.craft-chips {
  flex-wrap: nowrap;
  overflow-x: auto;
  margin: 0;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.craft-chips .chip {
  flex: 0 0 auto;
  white-space: nowrap;
}

.craft-grid {
  margin-bottom: 18px;
}

/* —— Книга крафта (блокнот со спиралью) —— */
body[data-page="craft"] {
  font-family: "Manrope", sans-serif;
}

body[data-page="craft"] header {
  background: rgba(14, 12, 10, 0.72);
  backdrop-filter: blur(8px);
}

.craft-book-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 36px;
  box-sizing: border-box;
}

.craft-book {
  position: relative;
  width: min(1180px, 100%);
  animation: craft-book-in 0.7s ease both;
}

@keyframes craft-book-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.craft-book__close {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 5;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 140, 60, 0.45);
  border-radius: 8px;
  background: rgba(20, 16, 12, 0.92);
  color: #ff8a3d;
  font-size: 28px;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.craft-book__close:hover,
.craft-book__close:focus-visible {
  background: rgba(255, 107, 0, 0.22);
  border-color: rgba(255, 140, 60, 0.85);
  transform: scale(1.05);
  outline: none;
}

.craft-book__shell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) 1.2fr;
  gap: 0;
  min-height: min(72vh, 760px);
  border-radius: 6px 14px 14px 6px;
  overflow: hidden;
  background: #1c1712;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.65),
    inset 0 0 0 1px rgba(120, 90, 50, 0.28);
}

.craft-book__rings {
  position: absolute;
  left: 42.5%;
  top: 8%;
  bottom: 8%;
  width: 28px;
  margin-left: -14px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
}

.craft-book__rings span {
  width: 28px;
  height: 14px;
  border: 2px solid #6a5a48;
  border-radius: 8px;
  background: linear-gradient(180deg, #8a7864, #4a4034);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}

.craft-book__sheet {
  position: relative;
  padding: 28px 26px 24px;
  overflow: auto;
  max-height: min(72vh, 760px);
}

.craft-book__sheet--index {
  background:
    radial-gradient(ellipse at 30% 20%, rgba(180, 200, 160, 0.12), transparent 46%),
    linear-gradient(160deg, #c5c0a8 0%, #b0ab90 50%, #9e987c 100%);
  color: #1e2218;
  box-shadow: inset -16px 0 28px rgba(40, 35, 20, 0.14);
  padding-right: 36px;
}

.craft-book__sheet--work {
  background:
    radial-gradient(ellipse at 70% 10%, rgba(255, 230, 180, 0.14), transparent 40%),
    linear-gradient(170deg, #d2c6a8 0%, #c2b48e 55%, #b3a47c 100%);
  color: #2a1f14;
  box-shadow: inset 16px 0 28px rgba(40, 30, 15, 0.12);
  padding-left: 36px;
}

.craft-book__sheet::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.22;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 28px,
    rgba(50, 55, 35, 0.1) 29px
  );
  mix-blend-mode: multiply;
}

.craft-book__title,
.craft-book__search,
.craft-book__sheet .book-toc,
.craft-book__sheet .item-grid,
.craft-book__sheet .tree-wrap,
.craft-book__sheet .empty-state {
  position: relative;
  z-index: 1;
}

.craft-book__title {
  margin: 0 0 20px;
  color: #1a2014;
  font-family: "Oswald", "Manrope", sans-serif;
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.craft-book__search {
  margin-bottom: 16px;
}

body[data-page="craft"] .craft-book__search input {
  background: rgba(245, 248, 230, 0.72);
  border: 1px solid rgba(70, 80, 45, 0.28);
  color: #1e2218;
  border-radius: 2px;
}

body[data-page="craft"] .craft-book__search input::placeholder {
  color: rgba(50, 60, 35, 0.55);
}

body[data-page="craft"] .craft-toc .book-toc__row {
  border-bottom-color: rgba(60, 70, 40, 0.16);
  color: #1e2218;
}

body[data-page="craft"] .craft-toc .book-toc__row:hover,
body[data-page="craft"] .craft-toc .book-toc__row:focus-visible,
body[data-page="craft"] .craft-toc .book-toc__row.is-active {
  color: #4a6a18;
  background: rgba(120, 150, 60, 0.12);
}

body[data-page="craft"] .craft-toc .book-toc__dots {
  border-bottom-color: rgba(60, 70, 40, 0.4);
}

body[data-page="craft"] .craft-grid {
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 12px;
  margin-bottom: 0;
}

body[data-page="craft"] .item-tile {
  background: rgba(255, 250, 235, 0.48);
  border: 1px solid rgba(70, 60, 35, 0.22);
  border-radius: 2px;
  box-shadow: 0 4px 10px rgba(30, 25, 10, 0.1);
}

body[data-page="craft"] .item-tile:hover,
body[data-page="craft"] .item-tile.active {
  border-color: #8a6a20;
  background: rgba(255, 252, 240, 0.8);
  box-shadow: 0 10px 18px rgba(30, 25, 10, 0.16);
}

body[data-page="craft"] .item-tile .img-box {
  background: rgba(28, 30, 22, 0.9);
}

body[data-page="craft"] .item-tile img {
  background: transparent;
}

body[data-page="craft"] .item-tile .label {
  border-top: 0;
  color: #1e2218;
  font-family: "Oswald", "Manrope", sans-serif;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

body[data-page="craft"] .item-tile .badge {
  top: 5px;
  left: 5px;
  right: auto;
  border-radius: 2px;
  background: #6a7a30;
  color: #f4f6e8;
}

body[data-page="craft"] .craft-expand .tree-wrap,
body[data-page="craft"] .craft-tree {
  position: static;
  max-height: none;
  margin-top: 10px;
  background: rgba(255, 248, 230, 0.55);
  border: 1px solid rgba(70, 60, 35, 0.2);
  border-radius: 4px;
  padding: 12px;
  color: #1e2218;
}

body[data-page="craft"] .tree-hint,
body[data-page="craft"] .muted {
  color: rgba(40, 45, 30, 0.72);
}

body[data-page="craft"] .tree-result h3 {
  color: #1a2014;
}

body[data-page="craft"] .tree-result {
  border-bottom-color: rgba(70, 60, 35, 0.22);
  color: #1e2218;
}

body[data-page="craft"] .tree-row {
  background: rgba(255, 252, 245, 0.95);
  border-color: rgba(70, 60, 35, 0.28);
  color: #1a2014;
}

body[data-page="craft"] .tree-row:hover,
body[data-page="craft"] .tree-row.selected {
  background: #fffdf8;
  border-color: #c45a12;
}

body[data-page="craft"] .tree-name {
  color: #141810;
}

body[data-page="craft"] .tree-sub {
  color: rgba(28, 32, 22, 0.78);
}

body[data-page="craft"] .tree-qty {
  color: #c04500;
}

body[data-page="craft"] .tree-toggle {
  background: #f3efe4;
  border-color: rgba(70, 60, 35, 0.4);
  color: #c04500;
}

body[data-page="craft"] .tree-children {
  border-left-color: rgba(70, 60, 35, 0.28);
}

body[data-page="craft"] .tree-row img {
  border-color: rgba(70, 60, 35, 0.3);
  background: #1a1814;
}

@media (max-width: 900px) {
  .craft-book__shell {
    grid-template-columns: 1fr;
  }

  .craft-book__rings {
    display: none;
  }

  .craft-book__sheet--index,
  .craft-book__sheet--work {
    box-shadow: none;
    padding: 20px 16px;
    max-height: none;
  }

  .craft-book__sheet--work {
    border-top: 1px solid rgba(60, 50, 30, 0.2);
  }

  .craft-book__title br {
    display: none;
  }
}

.craft-expand {
  grid-column: 1 / -1;
  animation: craft-expand-in 0.28s ease both;
}

@keyframes craft-expand-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.item-tile.active {
  border-color: #ff6b00;
  box-shadow: 0 0 0 1px rgba(255, 107, 0, 0.45), 0 8px 24px rgba(255, 107, 0, 0.22);
}

@media (prefers-reduced-motion: reduce) {
  .craft-expand {
    animation: none;
  }
}

.craft-expand .tree-wrap {
  margin-top: 2px;
}

.craft-tree {
  position: sticky;
  top: 168px;
  max-height: calc(100vh - 200px);
  overflow: auto;
  scrollbar-width: thin;
}

.craft-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  align-items: start;
}

.craft-catalog-col {
  position: sticky;
  top: 168px;
}

.catalog-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
}

.catalog-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(37, 37, 37, 0.9);
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  color: inherit;
  text-align: left;
  width: 100%;
  font-family: inherit;
  transition: 0.3s;
}

.catalog-item img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
  background: #111;
  border: 1px solid #444;
}

.catalog-item strong {
  display: block;
  font-size: 14px;
  color: #fff;
}

.catalog-item span {
  display: block;
  font-size: 12px;
  color: #aaa;
  margin-top: 3px;
}

.catalog-item:hover,
.catalog-item.active {
  border-color: #ff6b00;
  box-shadow: 0 5px 15px rgba(255, 107, 0, 0.2);
}

.tree-wrap {
  background: rgba(28, 26, 23, 0.82);
  border: 1px solid #3a342c;
  border-radius: 8px;
  padding: 16px;
  min-height: 280px;
  box-shadow: inset 0 1px 0 rgba(255, 140, 60, 0.05);
}

.tree-result {
  display: flex;
  gap: 16px;
  align-items: center;
  padding-bottom: 16px;
  margin-bottom: 12px;
  border-bottom: 1px solid #444;
}

.tree-result img {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #ff6b00;
  background: #111;
}

.tree-result h3 {
  margin: 0 0 6px;
  color: #fff;
  font-size: 18px;
}

.tree-hint {
  font-size: 13px;
  color: #888;
  margin: 0 0 14px;
}

.tree-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tree-node {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tree-children {
  margin-left: 28px;
  padding-left: 14px;
  border-left: 2px solid #3a3a3a;
  display: none;
  flex-direction: column;
  gap: 8px;
}

.tree-node.open > .tree-children {
  display: flex;
}

.tree-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #252525;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  transition: 0.3s;
}

.tree-row:hover,
.tree-row.selected {
  border-color: #ff6b00;
  background: #2c2c2c;
}

.tree-toggle {
  width: 22px;
  height: 22px;
  border: 1px solid #555;
  background: #1a1a1a;
  color: #ff6b00;
  border-radius: 4px;
  font-size: 16px;
  line-height: 18px;
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
}

.tree-row img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #444;
  background: #111;
  flex-shrink: 0;
}

.tree-meta {
  min-width: 0;
  flex: 1;
}

.tree-name {
  color: #fff;
  font-weight: 700;
  font-size: 14px;
}

.tree-sub {
  color: #888;
  font-size: 12px;
  margin-top: 2px;
}

.tree-qty {
  color: #ff6b00;
  font-weight: 700;
  font-size: 16px;
  white-space: nowrap;
}

.tool-tag {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #27ae60;
  border: 1px solid #27ae60;
  border-radius: 3px;
  padding: 1px 5px;
  vertical-align: middle;
}

.info-wrap img {
  width: 100%;
  height: 160px;
  object-fit: contain;
  background: #111;
  border: 1px solid #444;
  border-radius: 6px;
  margin-bottom: 12px;
}

.info-wrap h3 {
  margin: 0 0 8px;
  color: #fff;
}

.info-label {
  color: #ff6b00;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 14px 0 6px;
}

.totals {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid #444;
}

.totals ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.totals li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid #2a2a2a;
  font-size: 13px;
}

.totals li span:last-child {
  color: #ff6b00;
  font-weight: 700;
}

.tooltip {
  position: fixed;
  z-index: 2000;
  max-width: 320px;
  background: #1a1a1a;
  border: 1px solid #ff6b00;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 0 30px rgba(255, 107, 0, 0.2);
  pointer-events: none;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.tooltip.tooltip--rich {
  max-width: min(360px, calc(100vw - 24px));
}

.tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.tooltip strong {
  display: block;
  color: #ff6b00;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: none;
  margin-bottom: 6px;
}

.tooltip p {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.45;
  color: #e0e0e0;
}

.tooltip p:last-child {
  margin-bottom: 0;
}

.tooltip p b {
  color: #ff8a3d;
  font-weight: 600;
}

.tooltip-meta {
  color: #aaa !important;
  font-size: 12px !important;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
}

.empty-state h3 {
  color: #fff;
  margin: 0 0 10px;
}

.price-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(37, 37, 37, 0.9);
}

.price-table th,
.price-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #333;
  text-align: left;
}

.price-table th {
  color: #ff6b00;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.status-bar {
  margin: 0 0 14px;
  padding: 12px 16px;
  border: 1px solid #3a342c;
  border-radius: 8px;
  background: rgba(18, 16, 14, 0.88);
  color: #c8c2b8;
  font-size: 13px;
}

.status-bar.is-ready {
  border-color: rgba(255, 107, 0, 0.45);
  color: #f0e6da;
}

.status-bar code {
  color: #ff6b00;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.chip {
  background: #1a1a1a;
  border: 1px solid #444;
  color: #ddd;
  border-radius: 999px;
  padding: 6px 12px;
  font-family: inherit;
  cursor: pointer;
}

.chip.active,
.chip:hover {
  border-color: #ff6b00;
  color: #ff6b00;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}

/* —— Каталог как разворот открытой книги —— */
body[data-page="items"] {
  font-family: "Manrope", sans-serif;
}

body[data-page="items"] header {
  background: rgba(14, 12, 10, 0.72);
  backdrop-filter: blur(8px);
}

.open-book-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 36px;
  box-sizing: border-box;
}

.open-book {
  width: min(1180px, 100%);
  perspective: 1600px;
  animation: open-book-in 0.7s ease both;
  position: relative;
}

.open-book__close {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 5;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 140, 60, 0.45);
  border-radius: 8px;
  background: rgba(20, 16, 12, 0.92);
  color: #ff8a3d;
  font-size: 28px;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.open-book__close:hover,
.open-book__close:focus-visible {
  background: rgba(255, 107, 0, 0.22);
  border-color: rgba(255, 140, 60, 0.85);
  transform: scale(1.05);
  outline: none;
}

@keyframes open-book-in {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.open-book__cover {
  background:
    linear-gradient(90deg, #1a100a 0%, #2c1a10 8%, #3a2416 50%, #2c1a10 92%, #1a100a 100%);
  border-radius: 10px 14px 14px 10px;
  padding: 14px 16px 18px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.65),
    inset 0 0 0 1px rgba(90, 60, 30, 0.35),
    inset 0 1px 0 rgba(255, 200, 120, 0.08);
}

.open-book__spread {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 18px 1.15fr;
  min-height: min(72vh, 760px);
  border-radius: 2px;
  overflow: hidden;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.18);
}

.open-book__page {
  position: relative;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255, 230, 180, 0.28), transparent 42%),
    radial-gradient(ellipse at 80% 90%, rgba(90, 50, 20, 0.14), transparent 40%),
    linear-gradient(165deg, #e4d2b0 0%, #d4be96 55%, #c6ab7e 100%);
  color: #2a1f14;
  padding: 28px 24px 24px;
}

.open-book__page::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 29px,
    rgba(90, 55, 25, 0.1) 30px
  );
  mix-blend-mode: multiply;
}

.open-book__page--left {
  box-shadow: inset -18px 0 28px rgba(60, 35, 15, 0.12);
  display: flex;
  flex-direction: column;
  overflow: auto;
  max-height: min(72vh, 760px);
}

.open-book__page--right {
  box-shadow: inset 18px 0 28px rgba(60, 35, 15, 0.14);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
  max-height: min(72vh, 760px);
}

.open-book__gutter {
  position: relative;
  z-index: 2;
  background:
    linear-gradient(
      90deg,
      rgba(40, 25, 12, 0.35) 0%,
      rgba(20, 12, 6, 0.55) 45%,
      rgba(20, 12, 6, 0.55) 55%,
      rgba(40, 25, 12, 0.35) 100%
    );
  box-shadow:
    -6px 0 16px rgba(0, 0, 0, 0.18),
    6px 0 16px rgba(0, 0, 0, 0.18);
}

.open-book__gutter::before,
.open-book__gutter::after {
  content: "";
  position: absolute;
  left: 50%;
  width: 3px;
  height: 14px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: #5a4030;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.open-book__gutter::before {
  top: 18%;
}

.open-book__gutter::after {
  bottom: 18%;
}

.open-book__kicker,
.open-book__title,
.open-book__lede,
.open-book__tools,
.open-book__aside,
.open-book__toc-heading,
.open-book__search,
.open-book__page .book-toc,
.open-book__page .item-grid,
.open-book__page .items-more,
.open-book__page .empty-state {
  position: relative;
  z-index: 1;
}

.open-book__toc-heading {
  margin: 0 0 18px;
  color: #1c140c;
  font-family: "Oswald", "Manrope", sans-serif;
  font-size: clamp(28px, 3.4vw, 40px);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.open-book__search {
  margin: 0 0 18px;
}

.book-toc {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.book-toc__row {
  appearance: none;
  border: 0;
  background: transparent;
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 8px;
  padding: 9px 2px;
  cursor: pointer;
  color: #2a1f14;
  font-family: "Manrope", sans-serif;
  text-align: left;
  border-bottom: 1px solid rgba(80, 50, 25, 0.12);
  transition: color 0.2s ease, background 0.2s ease;
}

.book-toc__row:hover,
.book-toc__row:focus-visible {
  color: #8a3a08;
  background: rgba(196, 90, 18, 0.08);
  outline: none;
}

.book-toc__row.is-active {
  color: #8a3a08;
}

.book-toc__row.is-active .book-toc__name {
  font-weight: 700;
}

.book-toc__name {
  font-family: "Oswald", "Manrope", sans-serif;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.book-toc__dots {
  border-bottom: 1px dotted rgba(80, 50, 25, 0.45);
  min-width: 16px;
  height: 0.85em;
  align-self: end;
  margin-bottom: 3px;
}

.book-toc__num {
  font-family: "Oswald", "Manrope", sans-serif;
  font-size: 14px;
  letter-spacing: 0.08em;
  color: rgba(70, 48, 28, 0.75);
  min-width: 2.2em;
  text-align: right;
}

.open-book__kicker {
  margin: 0 0 10px;
  color: #8a4a18;
  font-family: "Oswald", "Manrope", sans-serif;
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.open-book__title {
  margin: 0 0 14px;
  color: #1c140c;
  font-family: "Oswald", "Manrope", sans-serif;
  font-size: clamp(34px, 4.2vw, 52px);
  font-weight: 600;
  line-height: 0.98;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.open-book__lede {
  margin: 0 0 26px;
  max-width: 320px;
  color: rgba(50, 36, 22, 0.82);
  font-size: 15px;
  line-height: 1.6;
}

.open-book__tools .search-row {
  margin-bottom: 12px;
}

.open-book__aside {
  margin: 28px 0 0;
  padding-top: 16px;
  border-top: 1px solid rgba(80, 50, 25, 0.25);
  color: rgba(70, 48, 28, 0.75);
  font-family: "Oswald", "Manrope", sans-serif;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

body[data-page="items"] .search-row input {
  background: rgba(255, 248, 235, 0.78);
  border: 1px solid rgba(90, 55, 25, 0.28);
  color: #2a1f14;
  border-radius: 2px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

body[data-page="items"] .search-row input::placeholder {
  color: rgba(70, 50, 30, 0.55);
}

body[data-page="items"] .search-row input:focus {
  outline: none;
  border-color: rgba(180, 90, 30, 0.7);
}

body[data-page="items"] .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body[data-page="items"] .chip {
  background: rgba(255, 248, 235, 0.55);
  border: 1px solid rgba(90, 55, 25, 0.22);
  border-radius: 2px;
  color: #4a3420;
}

body[data-page="items"] .chip.active,
body[data-page="items"] .chip:hover {
  background: rgba(196, 90, 18, 0.16);
  border-color: #c45a12;
  color: #8a3a08;
}

body[data-page="items"] .item-grid {
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 12px;
}

body[data-page="items"] .item-tile {
  background: rgba(255, 250, 240, 0.42);
  border: 1px solid rgba(90, 55, 25, 0.2);
  border-radius: 2px;
  box-shadow: 0 4px 10px rgba(40, 25, 10, 0.1);
  transform: none;
  animation: catalog-tile-in 0.45s ease both;
}

body[data-page="items"] .item-tile:nth-child(2n),
body[data-page="items"] .item-tile:nth-child(3n) {
  transform: none;
}

body[data-page="items"] .item-tile:hover {
  border-color: #c45a12;
  transform: translateY(-3px);
  box-shadow: 0 10px 18px rgba(40, 25, 10, 0.16);
  background: rgba(255, 252, 245, 0.78);
}

body[data-page="items"] .item-tile .img-box {
  background: rgba(32, 26, 20, 0.9);
  border-bottom: 1px solid rgba(90, 55, 25, 0.14);
}

body[data-page="items"] .item-tile img {
  background: transparent;
}

body[data-page="items"] .item-tile .label {
  border-top: 0;
  color: #2a1f14;
  font-family: "Oswald", "Manrope", sans-serif;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 8px 6px 10px;
}

body[data-page="items"] .item-tile .badge {
  top: 5px;
  left: 5px;
  right: auto;
  border-radius: 2px;
  background: #c45a12;
  color: #fff8ee;
}

body[data-page="items"] .items-more {
  align-self: center;
  background: #2a1f14;
  color: #f0e2c8;
  border: 1px solid rgba(90, 55, 25, 0.4);
  border-radius: 2px;
}

body[data-page="items"] .items-more:hover {
  background: #c45a12;
  color: #fff;
}

body[data-page="items"] .empty-state h3 {
  color: #2a1f14;
}

body[data-page="items"] .empty-state .muted {
  color: rgba(50, 36, 22, 0.7);
}

@keyframes catalog-tile-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@media (max-width: 900px) {
  .open-book__spread {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .open-book__gutter {
    display: none;
  }

  .open-book__page--left,
  .open-book__page--right {
    box-shadow: none;
  }

  .open-book__page--right {
    max-height: none;
    border-top: 1px solid rgba(80, 50, 25, 0.2);
  }

  .open-book__title {
    font-size: 32px;
  }

  .open-book__title br {
    display: none;
  }
}

.item-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  background: rgba(37, 37, 37, 0.9);
  border: 1px solid #333;
  border-radius: 10px;
  overflow: hidden;
  color: inherit;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
  text-align: center;
  transition: 0.2s;
}

.item-tile:hover {
  border-color: #ff6b00;
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(255, 107, 0, 0.22);
}

.item-tile .img-box {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #111;
}

.item-tile img,
.modal-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #111;
}

.item-tile .label {
  padding: 10px;
  font-size: 12px;
  border-top: 1px solid #333;
}

.item-tile .badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #ff6b00;
  color: #111;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
}

.items-count {
  color: #888;
  white-space: nowrap;
  align-self: center;
}

.items-more {
  display: block;
  margin: 22px auto 0;
}

.items-more[hidden] {
  display: none !important;
}

.img-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  background: #111;
  color: #ff6b00;
  font-weight: 700;
  border-radius: 4px;
  border: 1px solid #444;
}

.tree-result .img-fallback {
  width: 96px;
  height: 96px;
}

.itemdb-modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(5px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.itemdb-modal.open {
  display: flex;
}

.itemdb-modal-inner {
  background: #252525;
  border: 1px solid #ff6b00;
  border-radius: 10px;
  max-width: 720px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
}

.itemdb-modal-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid #444;
}

.modal-media,
.modal-media img,
.modal-media .img-fallback {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
}

.modal-media img,
.modal-media .img-fallback {
  border: 1px solid #444;
  border-radius: 8px;
}

.itemdb-modal-head h2 {
  color: #ff6b00;
  font-size: 20px;
  margin: 0;
}

.itemdb-modal-head .sub {
  font-size: 12px;
  color: #888;
}

.itemdb-modal-head .close {
  margin-left: auto;
  background: transparent;
  border: 1px solid #444;
  color: #aaa;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
}

.itemdb-modal-head .close:hover {
  color: #ff6b00;
  border-color: #ff6b00;
}

.itemdb-modal-body {
  padding: 20px 22px;
}

.itemdb-info-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed #333;
  font-size: 14px;
}

.itemdb-info-row .key {
  color: #888;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 1px;
}

.itemdb-tag {
  display: inline-block;
  background: #1a1a1a;
  border: 1px solid #444;
  color: #ff6b00;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  margin: 2px 4px 2px 0;
}

footer {
  margin-top: auto;
  padding: 16px 20px 22px;
  text-align: center;
  color: rgba(210, 200, 185, 0.7);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.85);
  position: relative;
  z-index: 2;
}

body[data-page="home"] footer {
  background: transparent;
}

@media (max-width: 980px) {
  .craft-layout {
    grid-template-columns: 1fr;
  }

  .craft-toolbar {
    top: 58px;
  }

  .craft-tree {
    position: static;
    max-height: none;
  }

  .craft-catalog-col,
  .tree-wrap {
    position: static;
    max-height: none;
  }

  .catalog-list {
    max-height: 42vh;
  }

  .itemdb-info-row {
    grid-template-columns: 1fr;
  }

  .home-landing {
    padding-top: 8px;
    gap: 24px;
    justify-content: flex-start;
  }

  .home-intro {
    margin-top: 4px;
  }

  .home-support {
    font-size: 15px;
  }

  .home-title {
    font-size: clamp(24px, 7vw, 32px);
  }

  .home-books {
    gap: 18px 16px;
  }

  .home-book {
    flex: 0 1 140px;
    max-width: 160px;
  }

  .home-book__label {
    font-size: 12px;
    letter-spacing: 0.1em;
  }

  body[data-page="home"] header.home-top {
    padding: 12px 16px;
    flex-wrap: nowrap;
    gap: 12px;
  }

  body[data-page="home"] .brand-text h1 {
    font-size: 16px;
  }

  body[data-page="home"] .brand-badge {
    font-size: 9px;
  }

  .home-ext {
    font-size: 11px;
    letter-spacing: 0.1em;
  }

  .lead {
    font-size: 20px;
    margin-bottom: 12px;
  }

  header {
    padding: 12px 16px;
    flex-wrap: wrap;
  }

  .mobile-compact-header {
    display: flex !important;
    align-items: center;
    width: 100%;
    gap: 10px;
  }

  .mobile-title {
    color: #ff6b00;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    flex: 1;
  }

  .full-header {
    display: none !important;
    width: 100%;
    flex-wrap: wrap;
    padding-top: 15px;
    border-top: 1px solid #333;
    margin-top: 10px;
  }

  .full-header.expanded {
    display: flex !important;
  }

  .full-header .brand {
    display: none;
  }

  .full-header nav {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin-top: 10px;
  }

  nav a.link {
    margin-left: 0;
  }

  .tree-children {
    margin-left: 12px;
  }

  .featured-hero {
    flex-direction: column;
  }
}
