/* Кнопка блокнота в шапке острова */
.habitat--immersive .habitat-scene .habitat-stats { gap: clamp(5px,3vw,20px); }
.habitat .notebook-button { pointer-events: auto; width: 40px; flex: 0 0 40px; padding: 4px; border: 0; background: transparent; box-shadow: none; cursor: pointer; }
.notebook-button svg { width: 30px; height: 38px; image-rendering: pixelated; }

/* Раскрытая старинная книга рецептов в кожаном переплёте */
.survival-notebook {
  position: fixed; inset: 0; margin: auto; z-index: 1000;
  width: min(760px, calc(100% - 16px)); max-height: 94dvh;
  padding: 16px 18px;
  background: radial-gradient(circle at 50% 50%, #683522 0%, #4a2114 80%, #38170c 100%);
  border: 12px solid #3c190d; border-radius: 14px;
  box-shadow: inset 0 0 0 2px #733c23, inset 0 0 0 4px #260e06, inset 0 0 0 6px #aa743c, 0 16px 36px rgba(0,0,0,0.75);
  box-sizing: border-box; overflow-y: auto; overflow-x: hidden;
  color: #3b2818;
}
.survival-notebook::backdrop { background: rgba(14, 28, 25, 0.75); backdrop-filter: blur(2px); }
.habitat--immersive > .survival-notebook[open] { display: block; }

/* Уголки книги: латунные накладки с заклепками */
.book-corner { position: absolute; width: 34px; height: 34px; z-index: 10; pointer-events: none; filter: drop-shadow(1px 1px 2px rgba(0,0,0,0.5)); }
.book-corner--tl { top: -2px; left: -2px; }
.book-corner--tr { top: -2px; right: -2px; transform: scaleX(-1); }
.book-corner--bl { bottom: -2px; left: -2px; transform: scaleY(-1); }
.book-corner--br { bottom: -2px; right: -2px; transform: scale(-1,-1); }

/* Кнопка закрытия книги в виде античной печати */
.notebook-close {
  position: absolute; right: 10px; top: 10px; width: 28px; height: 28px;
  border-radius: 50%; background: #9c3b24; border: 2px solid #2e1008;
  color: #faeacc; font: bold 16px/22px monospace; cursor: pointer; z-index: 25;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center;
  transition: transform .15s, background .15s;
}
.notebook-close:hover { background: #ba482e; transform: scale(1.08); }

/* Разворот книги: левая страница, корешок с кольцами, правая страница */
.notebook-spread {
  display: grid; grid-template-columns: minmax(0, 1fr) 36px minmax(0, 1fr);
  min-height: 450px; background: #fbf3dd; border-radius: 6px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35); position: relative;
}

/* Страницы пергамента */
.notebook-page {
  background: #fbf3dd;
  padding: 12px 14px 14px;
  display: flex; flex-direction: column; position: relative;
  box-sizing: border-box;
}
.notebook-page--left {
  padding-right: 12px; gap: 10px;
  box-shadow: inset -16px 0 20px -8px rgba(50, 24, 10, 0.4);
  border-radius: 5px 0 0 5px;
}
.notebook-page--right {
  padding-left: 12px; gap: 10px;
  box-shadow: inset 16px 0 20px -8px rgba(50, 24, 10, 0.4);
  border-radius: 0 5px 5px 0;
}

/* Орнамент сверху страницы */
.page-ornament-top {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 6px;
}
.ornament-line { height: 1px; width: 48px; border-top: 1.5px dashed #a07d4c; }
.ornament-diamond { color: #7a582c; font-size: 11px; }

/* Корешок книги с 4 массивными золотыми кольцами */
.notebook-spine {
  width: 36px; position: relative;
  background: linear-gradient(90deg, #261108 0%, #462215 15%, #6a3822 50%, #462215 85%, #261108 100%);
  box-shadow: inset 0 0 6px rgba(0,0,0,0.6); z-index: 5;
}
.spine-ring {
  position: absolute; width: 42px; height: 18px; left: -3px; border-radius: 4px;
  background: linear-gradient(180deg, #ffdf85 0%, #d89e34 35%, #754c14 75%, #ffe694 100%);
  border: 1.5px solid #2e1406; box-shadow: 0 3px 5px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.7);
}
.spine-ring--1 { top: 9%; }
.spine-ring--2 { top: 35%; }
.spine-ring--3 { top: 61%; }
.spine-ring--4 { top: 87%; }

/* Карточка рецепта */
.recipe-card {
  position: relative; border: 2px dashed #9d784a; border-radius: 8px;
  background: rgba(254, 250, 241, 0.45); padding: 8px 10px 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  overflow: hidden; box-sizing: border-box;
}

/* Листья в уголках карточки */
.card-leaf { position: absolute; width: 22px; height: 22px; z-index: 2; pointer-events: none; }
.card-leaf--tl { top: 2px; left: 2px; }
.card-leaf--tr { top: 2px; right: 2px; transform: scaleX(-1); }
.card-leaf--bl { bottom: 2px; left: 2px; transform: scaleY(-1); }
.card-leaf--br { bottom: 2px; right: 2px; transform: scale(-1, -1); }

/* Фоновые горы и деревья в карточке */
.card-watermark {
  position: absolute; bottom: 0; left: 0; right: 0; height: 36px;
  pointer-events: none; z-index: 1;
}
.card-watermark svg { width: 100%; height: 100%; }

/* Уравнение крафта: ингредиенты + количество -> результат */
.recipe-equation {
  position: relative; z-index: 3; display: flex; align-items: center; justify-content: center;
  gap: 7px; width: 100%; margin: 2px 0 6px;
}
.recipe-icon--sticks { width: 42px; height: 30px; flex: 0 0 42px; filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.15)); }
.recipe-icon--stone { width: 34px; height: 26px; flex: 0 0 34px; filter: drop-shadow(1px 1px 0 rgba(0,0,0,0.15)); }
.recipe-mult { font: bold 22px/1 'Georgia', monospace; color: #28190e; margin: 0 2px; }
.recipe-plus { font: bold 22px/1 'Georgia', monospace; color: #5a391e; margin: 0 2px; }
.recipe-arrow { font: bold 24px/1 'Georgia', monospace; color: #5a391e; margin: 0 4px; }

/* Рамка результата крафта */
.recipe-result-box {
  width: 52px; height: 52px; flex: 0 0 52px; position: relative;
  border: 2.5px solid #4a2e16; border-radius: 8px; background: #faf0d6;
  box-shadow: inset 0 0 0 2px #d4b886; display: flex; align-items: center; justify-content: center;
}
.recipe-result-box svg { width: 40px; height: 40px; }

/* Зелёная галочка выполненного крафта */
.recipe-check {
  position: absolute; right: -6px; top: -6px; width: 18px; height: 18px;
  border-radius: 3px; background: #3b774a; border: 1.5px solid #1a3c24;
  color: #fdfae8; font: bold 13px/16px monospace; display: none; align-items: center; justify-content: center;
  box-shadow: 1px 1px 2px rgba(0,0,0,0.35); z-index: 5;
}
.recipe-card.is-crafted .recipe-check { display: flex; }

/* Табличка-ленточка названия */
.recipe-banner {
  position: relative; z-index: 3; display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 2px 14px; margin: 0 auto 5px;
  border: 1.5px solid #8e6239; border-radius: 12px; background: #faf0d8;
  box-shadow: 0 2px 0 #734824;
}
.banner-title { font: bold italic 15px Georgia, serif; color: #28180e; letter-spacing: 0.2px; }
.banner-wing-left, .banner-wing-right { color: #7d542a; font-size: 10px; font-weight: bold; }

/* Текстовое описание */
.recipe-desc {
  position: relative; z-index: 3; font: 12px/1.4 'Georgia', 'Times New Roman', serif;
  color: #3b2818; text-align: center; margin: 0;
}

/* Кнопка поверх карточки для создания предмета */
.recipe-card > button {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 6;
  border: 0; background: transparent; cursor: pointer;
}
.recipe-card > button:hover:not(:disabled) { background: rgba(242, 200, 106, 0.15); }
.recipe-card > button:active:not(:disabled) { background: rgba(126, 182, 138, 0.25); }
.recipe-card > button:focus-visible { outline: 2px solid #3b774a; outline-offset: -2px; }
.recipe-card > button:disabled { cursor: default; }

/* Разделитель с елью на правой странице */
.tree-divider { margin: 16px auto 8px; width: 85%; display: flex; justify-content: center; }
.tree-divider svg { width: 100%; max-width: 220px; height: 24px; }

/* Подвал правой страницы: пунктир, рукописный текст и водяной знак */
.notebook-footer { margin-top: auto; padding-top: 10px; width: 100%; }
.footer-dashed-line { border-top: 1.5px dashed #9d7b4e; width: 100%; margin-bottom: 12px; }
.footer-bottom-row { display: flex; align-items: flex-end; justify-content: space-between; }
.footer-note-text { font: italic 12px/1.45 'Georgia', cursive, serif; color: #43301f; margin: 0; }
.footer-mountain-watermark { width: 90px; height: 45px; }
.footer-mountain-watermark svg { width: 100%; height: 100%; }

/* Адаптивность для узких экранов */
@media (max-width: 620px) {
  .survival-notebook { padding: 12px; }
  .notebook-spread { grid-template-columns: 1fr; min-height: auto; }
  .notebook-spine { display: none; }
  .notebook-page--left, .notebook-page--right { box-shadow: none; border-radius: 4px; padding: 10px; }
  .recipe-equation { gap: 4px; }
  .recipe-icon--sticks { width: 36px; height: 26px; }
  .recipe-mult, .recipe-plus { font-size: 18px; }
  .recipe-arrow { font-size: 20px; }
  .recipe-result-box { width: 46px; height: 46px; flex-basis: 46px; }
  .recipe-result-box svg { width: 34px; height: 34px; }
  .banner-title { font-size: 13px; }
  .recipe-desc { font-size: 11px; }
}
