.pelmennaya-recipe-book-scene {
  position: fixed;
  z-index: 12000;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
  padding:
    env(safe-area-inset-top, 0px)
    env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px)
    env(safe-area-inset-left, 0px);
  color: #4b260f;
  background: transparent;
  touch-action: none;
  opacity: 0;
  transition: opacity 180ms ease-out;
  isolation: isolate;
}

.pelmennaya-recipe-book-scene::before {
  display: none;
  content: none;
}

.pelmennaya-recipe-book-scene.is-open {
  opacity: 1;
}

.pelmennaya-recipe-book-scene[hidden] {
  display: none !important;
}

.pelmennaya-recipe-book-shell {
  position: relative;
  flex: 0 0 auto;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: auto;
  overflow: hidden;
  background: url("./recipe-book-bg.v1.png") center / 100% 100% no-repeat;
  transform: translateY(2%) scale(0.96);
  transition: transform 260ms cubic-bezier(0.2, 0.9, 0.25, 1.15);
}

.pelmennaya-recipe-book-scene.is-open .pelmennaya-recipe-book-shell {
  transform: translateY(0) scale(1);
}

.pelmennaya-recipe-book-page {
  position: absolute;
  z-index: 2;
  top: 17.6%;
  right: 10.7%;
  bottom: 22.2%;
  left: 10.7%;
  box-sizing: border-box;
  overflow: hidden;
}

.pelmennaya-recipe-book-scroll {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: min(100%, 960px);
  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 4.5% 4.2% 14%;
  color: #4b260f;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: clamp(14px, 1.72vh, 19px);
  line-height: 1.52;
  text-align: left;
  text-shadow: 0 1px 0 rgba(255, 244, 204, 0.7);
  scrollbar-color: #a86a29 rgba(101, 48, 14, 0.13);
  scrollbar-width: thin;
  overscroll-behavior: contain;
  touch-action: pan-y;
  user-select: text;
  -webkit-user-select: text;
  transform: translateX(-50%);
  -webkit-mask-image: linear-gradient(
    to bottom,
    transparent 0,
    #000 2.8%,
    #000 96.2%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to bottom,
    transparent 0,
    #000 2.8%,
    #000 96.2%,
    transparent 100%
  );
}

.pelmennaya-recipe-book-scroll::-webkit-scrollbar {
  width: 8px;
}

.pelmennaya-recipe-book-scroll::-webkit-scrollbar-track {
  border-radius: 999px;
  background: rgba(101, 48, 14, 0.1);
}

.pelmennaya-recipe-book-scroll::-webkit-scrollbar-thumb {
  border: 1px solid rgba(91, 42, 12, 0.28);
  border-radius: 999px;
  background: linear-gradient(#cc9145, #8e501e);
}

.pelmennaya-recipe-book-page.is-turning {
  animation: pelmennaya-recipe-page-turn 220ms ease-out;
}

.pelmennaya-recipe-kicker {
  margin: 0 0 0.35em;
  color: #a14920;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 0.82em;
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-align: center;
  text-transform: uppercase;
}

.pelmennaya-recipe-title {
  max-width: 94%;
  margin: 0 auto 0.34em;
  color: #682b13;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: clamp(25px, 3.55vh, 42px);
  font-weight: 800;
  line-height: 1.08;
  text-align: center;
  text-wrap: balance;
  text-shadow:
    0 2px 0 rgba(255, 232, 166, 0.75),
    0 3px 5px rgba(92, 40, 10, 0.16);
}

.pelmennaya-recipe-subtitle {
  max-width: 88%;
  margin: 0 auto 1em;
  color: #6e3d20;
  font-style: italic;
  text-align: center;
}

.pelmennaya-recipe-meta {
  display: flex;
  justify-content: center;
  gap: 0.7em;
  margin: 0 auto 1.15em;
}

.pelmennaya-recipe-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 1.8em;
  padding: 0.14em 0.75em;
  border: 1px solid rgba(118, 53, 16, 0.36);
  border-radius: 999px;
  color: #6c3216;
  background: rgba(229, 184, 98, 0.18);
  box-shadow: inset 0 1px rgba(255, 250, 224, 0.7);
  font-weight: 700;
}

.pelmennaya-recipe-nutrition {
  width: fit-content;
  margin: -0.48em auto 1em;
  padding: 0.12em 0.75em;
  border-bottom: 1px dotted rgba(103, 49, 18, 0.42);
  color: #704020;
  font-size: 0.88em;
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-align: center;
}

.pelmennaya-recipe-section-title {
  display: flex;
  align-items: center;
  gap: 0.55em;
  margin: 1.15em 0 0.55em;
  color: #7d3518;
  font-size: 1.18em;
  line-height: 1.2;
  text-transform: uppercase;
}

.pelmennaya-recipe-section-title::before,
.pelmennaya-recipe-section-title::after {
  height: 1px;
  flex: 1 1 auto;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(126, 57, 22, 0.52));
}

.pelmennaya-recipe-section-title::after {
  transform: scaleX(-1);
}

.pelmennaya-recipe-ingredients {
  margin: 0;
  padding: 0;
  list-style: none;
}

.pelmennaya-recipe-ingredients li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1em;
  padding: 0.34em 0.2em;
  border-bottom: 1px dotted rgba(103, 49, 18, 0.33);
}

.pelmennaya-recipe-ingredients strong {
  color: #6b3216;
  white-space: nowrap;
}

.pelmennaya-recipe-copy {
  margin: 0.75em 0;
}

.pelmennaya-recipe-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: recipe-step;
}

.pelmennaya-recipe-step {
  position: relative;
  min-height: 2.4em;
  margin: 0 0 0.9em;
  padding: 0.55em 0.62em 0.55em 2.95em;
  border: 1px solid rgba(112, 52, 19, 0.18);
  border-radius: 0.6em;
  background: rgba(255, 244, 204, 0.26);
  box-shadow: inset 0 1px rgba(255, 253, 235, 0.72);
  counter-increment: recipe-step;
}

.pelmennaya-recipe-step::before {
  position: absolute;
  top: 0.48em;
  left: 0.52em;
  display: grid;
  width: 1.78em;
  height: 1.78em;
  place-items: center;
  border: 2px solid #8e4c20;
  border-radius: 50%;
  color: #fff2cb;
  background: linear-gradient(#b66b2c, #7d3517);
  box-shadow:
    0 2px 3px rgba(68, 28, 8, 0.25),
    inset 0 1px rgba(255, 222, 137, 0.6);
  content: counter(recipe-step);
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 1px #4d1f09;
}

.pelmennaya-recipe-finale {
  margin: 1.2em auto 0;
  color: #7c3518;
  font-size: 1.28em;
  font-style: italic;
  font-weight: 700;
  text-align: center;
}

.pelmennaya-recipe-locked {
  display: flex;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 8% 9% 18%;
  color: #5b2c15;
  font-family: Georgia, "Times New Roman", Times, serif;
  text-align: center;
}

.pelmennaya-recipe-seal {
  position: relative;
  display: block;
  width: min(48%, 260px);
  aspect-ratio: 1;
  margin: 0 auto 1.15em;
  padding: 0;
  border: 0;
  outline: 0;
  cursor: default;
  background: transparent;
  filter: drop-shadow(0 8px 7px rgba(64, 25, 8, 0.26));
  touch-action: manipulation;
}

.pelmennaya-recipe-seal.has-key {
  cursor: pointer;
  animation: pelmennaya-recipe-lock-breathe 2.2s ease-in-out infinite;
}

.pelmennaya-recipe-seal.has-key:hover,
.pelmennaya-recipe-seal.has-key:focus-visible {
  filter:
    brightness(1.08)
    drop-shadow(0 10px 10px rgba(84, 36, 7, 0.36));
}

.pelmennaya-recipe-seal:disabled {
  opacity: 0.72;
}

.pelmennaya-recipe-seal-piece {
  position: absolute;
  inset: 0;
  display: block;
  transform-origin: center;
  pointer-events: none;
}

.pelmennaya-recipe-seal-piece img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.pelmennaya-recipe-seal-piece--left {
  clip-path: polygon(0 0, 53% 0, 47% 16%, 54% 30%, 46% 43%, 54% 58%, 45% 72%, 51% 100%, 0 100%);
}

.pelmennaya-recipe-seal-piece--right {
  clip-path: polygon(53% 0, 100% 0, 100% 100%, 51% 100%, 45% 72%, 54% 58%, 46% 43%, 54% 30%, 47% 16%);
}

.pelmennaya-recipe-seal-flash {
  position: absolute;
  z-index: -1;
  inset: 26%;
  border-radius: 50%;
  opacity: 0;
  background: radial-gradient(circle, #fff8bf 0 12%, #ffce50 34%, rgba(255, 136, 18, 0) 72%);
  pointer-events: none;
}

.pelmennaya-recipe-seal.is-cracking {
  animation: pelmennaya-recipe-seal-impact 430ms ease-in both;
}

.pelmennaya-recipe-seal.is-cracking .pelmennaya-recipe-seal-flash {
  animation: pelmennaya-recipe-seal-flash 720ms ease-out both;
}

.pelmennaya-recipe-seal.is-broken .pelmennaya-recipe-seal-piece--left {
  animation: pelmennaya-recipe-seal-left 520ms cubic-bezier(0.3, 0.75, 0.2, 1) both;
}

.pelmennaya-recipe-seal.is-broken .pelmennaya-recipe-seal-piece--right {
  animation: pelmennaya-recipe-seal-right 520ms cubic-bezier(0.3, 0.75, 0.2, 1) both;
}

.pelmennaya-recipe-key-wallet {
  position: absolute;
  z-index: 7;
  top: 2.4%;
  left: 2.6%;
  display: flex;
  min-width: clamp(70px, 12vmin, 132px);
  height: clamp(48px, 7.5vmin, 82px);
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 0.12em 0.65em 0.12em 0.25em;
  border: 3px solid #6f3210;
  border-radius: 999px;
  color: #f9e6ac;
  background: linear-gradient(#a75f25, #66300f);
  box-shadow:
    0 5px 8px rgba(43, 16, 4, 0.38),
    inset 0 2px rgba(255, 213, 112, 0.5);
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: clamp(20px, 3.1vmin, 34px);
  font-weight: 900;
  line-height: 1;
  opacity: 0.62;
  pointer-events: none;
  transition: filter 180ms ease, opacity 180ms ease, transform 180ms ease;
}

.pelmennaya-recipe-key-wallet.has-key {
  opacity: 1;
  filter: drop-shadow(0 0 10px rgba(255, 198, 48, 0.7));
  transform: scale(1.04);
}

.pelmennaya-recipe-key-wallet img {
  width: clamp(45px, 7vmin, 76px);
  height: clamp(45px, 7vmin, 76px);
  margin: -0.2em -0.12em -0.2em -0.16em;
  object-fit: contain;
  transform: rotate(-18deg);
}

.pelmennaya-recipe-key-count {
  min-width: 1.15em;
  text-align: center;
  text-shadow: 0 2px 2px #3c1705;
}

.pelmennaya-recipe-key-hud {
  position: fixed;
  z-index: 2147483643;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  display: flex;
  min-width: 92px;
  height: clamp(58px, 8.5vmin, 82px);
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  padding: 2px 15px 2px 6px;
  border: 4px solid #63290b;
  border-radius: 999px;
  color: #fff0bd;
  background: linear-gradient(180deg, #b66b28 0%, #72340f 64%, #512306 100%);
  box-shadow:
    0 5px 0 #3e1905,
    0 10px 22px rgba(37, 13, 2, 0.42),
    inset 0 3px rgba(255, 224, 132, 0.52);
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: clamp(25px, 4vmin, 38px);
  font-weight: 900;
  line-height: 1;
  opacity: 0.76;
  pointer-events: none;
  user-select: none;
}

.pelmennaya-recipe-key-hud[hidden],
.pelmennaya-recipe-key-reward[hidden] {
  display: none !important;
}

.pelmennaya-recipe-key-hud.has-key {
  opacity: 1;
  filter: drop-shadow(0 0 10px rgba(255, 200, 52, 0.62));
}

.pelmennaya-recipe-key-hud img {
  width: clamp(54px, 8vmin, 76px);
  height: clamp(54px, 8vmin, 76px);
  margin: -6px -3px -6px -8px;
  object-fit: contain;
  transform: rotate(-18deg);
}

.pelmennaya-recipe-key-hud-count {
  min-width: 1.05em;
  text-align: center;
  text-shadow: 0 3px 2px #391304;
}

.pelmennaya-recipe-key-reward {
  position: fixed;
  z-index: 2147483645;
  top: 46%;
  left: 50%;
  width: min(94vw, 820px);
  pointer-events: none;
  transform: translate(-50%, -50%);
  user-select: none;
}

.pelmennaya-recipe-key-reward-image {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  transform: scale(0.62) rotate(-2deg);
  transform-origin: center;
}

.pelmennaya-recipe-key-reward.is-visible .pelmennaya-recipe-key-reward-image {
  animation: pelmennaya-recipe-key-reward-in 560ms cubic-bezier(0.2, 0.9, 0.25, 1.18) both;
}

.pelmennaya-recipe-locked h2 {
  margin: 0 0 0.45em;
  color: #6c2f17;
  font-size: clamp(26px, 3.5vh, 42px);
  line-height: 1.08;
}

.pelmennaya-recipe-locked p {
  max-width: 84%;
  margin: 0;
  font-size: clamp(15px, 1.9vh, 21px);
  line-height: 1.45;
}

.pelmennaya-recipe-nav {
  position: absolute;
  z-index: 5;
  bottom: 3.2%;
  display: grid;
  width: clamp(66px, 15.8%, 112px);
  aspect-ratio: 1.348 / 1;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  cursor: pointer;
  background: transparent;
  filter: drop-shadow(0 5px 5px rgba(49, 18, 4, 0.36));
  transition: filter 100ms ease, transform 100ms ease;
  touch-action: manipulation;
}

.pelmennaya-recipe-nav[hidden] {
  display: none !important;
}

.pelmennaya-recipe-nav img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.pelmennaya-recipe-nav:hover,
.pelmennaya-recipe-nav:focus-visible {
  filter:
    brightness(1.1)
    drop-shadow(0 7px 7px rgba(49, 18, 4, 0.42));
  transform: scale(1.08);
}

.pelmennaya-recipe-nav:active {
  filter: brightness(0.88) drop-shadow(0 2px 2px rgba(49, 18, 4, 0.35));
  transform: scale(0.9);
}

.pelmennaya-recipe-nav--back {
  left: 5.2%;
}

.pelmennaya-recipe-nav--next {
  right: 5.2%;
}

.pelmennaya-recipe-book-close {
  position: absolute;
  z-index: 8;
  top: 2.2%;
  right: 2.2%;
  display: grid;
  width: clamp(54px, 8.5vmin, 104px);
  aspect-ratio: 1;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  cursor: pointer;
  background: transparent;
  filter: drop-shadow(0 5px 5px rgba(49, 18, 4, 0.42));
  transition: filter 100ms ease, transform 100ms ease;
  touch-action: manipulation;
}

.pelmennaya-recipe-book-close img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.pelmennaya-recipe-book-close:hover,
.pelmennaya-recipe-book-close:focus-visible {
  filter: brightness(1.1) drop-shadow(0 7px 7px rgba(49, 18, 4, 0.48));
  transform: scale(1.08);
}

.pelmennaya-recipe-book-close:active {
  filter: brightness(0.88) drop-shadow(0 2px 2px rgba(49, 18, 4, 0.36));
  transform: scale(0.9);
}

.pelmennaya-recipe-page-number {
  position: absolute;
  z-index: 4;
  right: 25%;
  bottom: 4.4%;
  left: 25%;
  color: #f6d88c;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: clamp(13px, 1.65vh, 18px);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  text-shadow: 0 2px 2px #4a1f08;
  pointer-events: none;
}

@keyframes pelmennaya-recipe-page-turn {
  0% { opacity: 0.25; transform: translateX(4%) rotateY(-5deg); }
  100% { opacity: 1; transform: translateX(0) rotateY(0); }
}

@keyframes pelmennaya-recipe-lock-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}

@keyframes pelmennaya-recipe-seal-impact {
  0% { transform: scale(1) rotate(0); }
  18% { transform: scale(1.08) rotate(-4deg); }
  36% { transform: scale(0.96) rotate(4deg); }
  55% { transform: scale(1.04) rotate(-3deg); }
  72% { transform: scale(0.98) rotate(2deg); }
  100% { transform: scale(1) rotate(0); }
}

@keyframes pelmennaya-recipe-seal-flash {
  0% { opacity: 0; transform: scale(0.2); }
  30% { opacity: 1; transform: scale(1.7); }
  100% { opacity: 0; transform: scale(3.1); }
}

@keyframes pelmennaya-recipe-seal-left {
  0% { opacity: 1; transform: translate(0, 0) rotate(0) scale(1); }
  100% { opacity: 0; transform: translate(-54%, 24%) rotate(-28deg) scale(0.78); }
}

@keyframes pelmennaya-recipe-seal-right {
  0% { opacity: 1; transform: translate(0, 0) rotate(0) scale(1); }
  100% { opacity: 0; transform: translate(54%, 24%) rotate(28deg) scale(0.78); }
}

@keyframes pelmennaya-recipe-key-reward-in {
  0% { opacity: 0; transform: scale(0.62) rotate(-2deg); }
  72% { opacity: 1; transform: scale(1.055) rotate(1deg); }
  100% { opacity: 1; transform: scale(1) rotate(0); }
}

@media (orientation: landscape) {
  .pelmennaya-recipe-book-page {
    top: 17.4%;
    bottom: 22%;
  }

  .pelmennaya-recipe-book-scroll {
    font-size: clamp(12px, 2.5vh, 17px);
  }

  .pelmennaya-recipe-title {
    font-size: clamp(22px, 4.6vh, 36px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pelmennaya-recipe-book-scene,
  .pelmennaya-recipe-book-shell,
  .pelmennaya-recipe-nav,
  .pelmennaya-recipe-book-close {
    transition: none;
  }

  .pelmennaya-recipe-book-page.is-turning,
  .pelmennaya-recipe-seal,
  .pelmennaya-recipe-seal-piece,
  .pelmennaya-recipe-seal-flash,
  .pelmennaya-recipe-key-reward-image {
    animation: none;
  }

  .pelmennaya-recipe-key-reward.is-visible .pelmennaya-recipe-key-reward-image {
    opacity: 1;
    transform: none;
  }
}
