:root {
      --leather-dark: #8c7355;
      --leather-base: #d4b896;
      --leather-light: #f5e6d3;
      --leather-highlight: #fff8ee;
      
      --gold-bright: #ffd700;
      --gold-mid: #e6a100;
      --gold-dark: #b37400;
      --gold-shadow: #664200;

      --parchment-base: #f7eed8;
      --parchment-dark: #e8d7b3;
      --parchment-shadow: #cbb487;
      --ink-dark: #2b1f17;
      --ink-accent: #c0392b;
    }

    html, body {
      height: 100%;
      overflow: hidden;
    }

    body {
      margin: 0;
      padding: 0;
      height: 100vh;
      height: 100svh;
      min-height: 0;
      background: #071711;
      background-image: 
        radial-gradient(circle at 50% 28%, rgba(34, 139, 101, 0.5) 0%, rgba(12, 42, 34, 0.92) 55%, #060d0a 100%),
        radial-gradient(circle at 12% 22%, rgba(255, 190, 92, 0.14) 0%, transparent 38%),
        radial-gradient(circle at 88% 76%, rgba(75, 180, 157, 0.17) 0%, transparent 44%);
      color: #3d2b1f;
      font-family: 'IM Fell English', serif;
      overflow: hidden;
      user-select: none;
    }

    #canvas-embers {
      position: fixed;
      inset: 0;
      pointer-events: none;
      z-index: 1;
    }

    .ambient-lighting {
      position: fixed;
      inset: 0;
      background: 
        radial-gradient(circle at 50% 50%, rgba(221, 255, 222, 0.08) 0%, rgba(5, 18, 13, 0.42) 80%),
        radial-gradient(circle at 50% 0%, rgba(255, 206, 112, 0.18) 0%, transparent 60%),
        radial-gradient(circle at 18% 85%, rgba(58, 174, 140, 0.12) 0%, transparent 42%);
      pointer-events: none;
      z-index: 2;
    }

    .ambient-lighting::before {
      content: "";
      position: absolute;
      inset: 0;
      background-image:
        radial-gradient(2px 2px at 12% 20%, rgba(255, 246, 207, 0.9) 45%, transparent 100%),
        radial-gradient(1.5px 1.5px at 28% 68%, rgba(180, 255, 219, 0.8) 45%, transparent 100%),
        radial-gradient(2px 2px at 43% 14%, rgba(255, 230, 166, 0.8) 45%, transparent 100%),
        radial-gradient(1.5px 1.5px at 70% 27%, rgba(180, 255, 219, 0.8) 45%, transparent 100%),
        radial-gradient(2px 2px at 84% 58%, rgba(255, 246, 207, 0.8) 45%, transparent 100%),
        radial-gradient(1.5px 1.5px at 92% 16%, rgba(255, 230, 166, 0.8) 45%, transparent 100%);
      opacity: 0.55;
      animation: starTwinkle 5s ease-in-out infinite;
    }

    @keyframes starTwinkle {
      0%, 100% { opacity: 0.35; }
      50% { opacity: 0.85; }
    }

    .scene-3d {
      perspective: 1800px;
      perspective-origin: 50% 50%;
      width: 100%;
      height: auto;
      min-height: 0;
      flex: 1;
      display: flex;
      align-items: center;
      justify-content: center;
      position: relative;
      z-index: 10;
    }

    .book-wrapper {
      width: 440px;
      height: 600px;
      position: relative;
      transform: translateY(50px) rotateX(12deg) rotateY(-8deg) scale(0.52);
      transform-style: preserve-3d;
      transition: transform 1.4s cubic-bezier(0.23, 1, 0.32, 1);
      cursor: pointer;
    }

    .book-wrapper.closed-hover {
      animation: bookFloat 4s ease-in-out infinite;
    }

    @keyframes bookFloat {
      0%, 100% { transform: translateY(50px) rotateX(12deg) rotateY(-8deg) scale(0.52); }
      50% { transform: translateY(38px) rotateX(15deg) rotateY(-4deg) scale(0.52); }
    }

    .book-wrapper.is-open {
      animation: none;
      transform: translateX(220px) rotateX(0deg) rotateY(0deg) scale(0.96);
      cursor: default;
    }

    @media (max-height: 760px) {
      .book-wrapper {
        transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(0.52);
      }
      .book-wrapper.closed-hover {
        animation-name: bookFloatCompact;
      }
    }

    @keyframes bookFloatCompact {
      0%, 100% { transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(0.52); }
      50% { transform: translateY(58px) rotateX(15deg) rotateY(-4deg) scale(0.52); }
    }

    @media (max-width: 900px) {
      .book-wrapper {
        width: 340px;
        height: 500px;
      }
      .book-wrapper.is-open {
        transform: translateX(170px) rotateX(0deg) scale(0.9);
      }
    }

    @media (max-width: 680px) {
      .book-wrapper {
        width: 280px;
        height: 420px;
      }
      .book-wrapper.is-open {
        transform: translateX(140px) rotateX(0deg) scale(0.82);
      }
    }

    .book-wrapper.is-closing {
      animation: none;
      transform: translateY(50px) rotateX(12deg) rotateY(-8deg) scale(0.52);
    }

    .book-wrapper.is-shrinking {
      transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
      transform: translateY(50px) rotateX(12deg) rotateY(-8deg) scale(0.52);
    }

    @media (max-height: 760px) {
      .book-wrapper.is-shrinking {
        transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(0.52);
      }
    }

    @media (max-width: 900px) {
      .book-wrapper.is-closing {
        transform: translateY(50px) rotateX(12deg) rotateY(-8deg) scale(0.76);
      }
    }

    @media (max-width: 680px) {
      .book-wrapper.is-closing {
        transform: translateY(10px) rotateX(12deg) rotateY(-8deg) scale(0.72);
      }
    }

    .enchanted-leather-surface {
      background-color: #155744;
      background-image: 
        radial-gradient(circle at 20% 20%, rgba(226, 255, 221, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(4, 37, 29, 0.52) 0%, transparent 60%),
        repeating-linear-gradient(45deg, rgba(220, 255, 230, 0.035) 0px, rgba(220, 255, 230, 0.035) 2px, transparent 2px, transparent 5px),
        repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.07) 0px, rgba(255, 255, 255, 0.07) 1px, transparent 1px, transparent 4px);
      box-shadow: 
        inset 0 0 30px rgba(4, 37, 29, 0.72),
        inset 0 0 15px rgba(228, 255, 226, 0.36),
        15px 25px 45px rgba(0, 0, 0, 0.8);
      border: 1px solid #d9b960;
    }

    .book-spine-depth {
      position: absolute;
      left: 0;
      top: 0;
      width: 50px;
      height: 100%;
      background: linear-gradient(90deg, #0b3b31 0%, #17624e 35%, #d9b960 65%, #0b3b31 100%);
      transform: rotateY(-90deg) translateZ(0px);
      transform-origin: left center;
      border-radius: 6px 0 0 6px;
      box-shadow: inset 0 0 12px rgba(0,0,0,0.4);
    }

    .book-spine-rib {
      position: absolute;
      width: 100%;
      height: 8px;
      background: linear-gradient(180deg, var(--gold-dark), var(--gold-bright), var(--gold-shadow));
      box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    }

    .page-block-left {
      position: absolute;
      left: 0;
      top: 6px;
      width: 36px;
      height: calc(100% - 12px);
      background: repeating-linear-gradient(90deg, #e8d7b3 0px, #cbb487 1px, #f7eed8 2px, #bd9b65 3px);
      transform: rotateY(-90deg) translateZ(0px);
      transform-origin: left center;
      border-radius: 2px;
      box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
    }

    .page-block-right {
      position: absolute;
      right: 0;
      top: 6px;
      width: 36px;
      height: calc(100% - 12px);
      background: repeating-linear-gradient(90deg, #e8d7b3 0px, #cbb487 1px, #f7eed8 2px, #bd9b65 3px);
      transform: rotateY(90deg) translateZ(0px);
      transform-origin: right center;
      border-radius: 2px;
      box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
    }

    .page-block-top {
      position: absolute;
      top: 0;
      left: 6px;
      width: calc(100% - 12px);
      height: 36px;
      background: repeating-linear-gradient(0deg, #e8d7b3 0px, #cbb487 1px, #f7eed8 2px, #bd9b65 3px);
      transform: rotateX(90deg) translateZ(0px);
      transform-origin: top center;
      box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
    }

    .page-block-bottom {
      position: absolute;
      bottom: 0;
      left: 6px;
      width: calc(100% - 12px);
      height: 36px;
      background: repeating-linear-gradient(0deg, #e8d7b3 0px, #cbb487 1px, #f7eed8 2px, #bd9b65 3px);
      transform: rotateX(-90deg) translateZ(0px);
      transform-origin: bottom center;
      box-shadow: inset 0 0 10px rgba(0,0,0,0.3);
    }

    .gold-filigree-border {
      position: absolute;
      inset: 18px;
      border: 2px solid var(--gold-mid);
      outline: 1px dashed var(--gold-bright);
      outline-offset: -7px;
      border-radius: 4px;
      box-shadow: 
        inset 0 0 10px rgba(160, 110, 20, 0.3),
        0 0 8px rgba(230, 161, 0, 0.5);
      pointer-events: none;
    }

    .gold-corner-guard {
      position: absolute;
      width: 32px;
      height: 32px;
      border: 3px solid var(--gold-bright);
      box-shadow: 0 2px 5px rgba(0,0,0,0.4);
    }
    .cg-tl { top: 8px; left: 8px; border-right: none; border-bottom: none; border-radius: 4px 0 0 0; }
    .cg-tr { top: 8px; right: 8px; border-left: none; border-bottom: none; border-radius: 0 4px 0 0; }
    .cg-bl { bottom: 8px; left: 8px; border-right: none; border-top: none; border-radius: 0 0 0 4px; }
    .cg-br { bottom: 8px; right: 8px; border-left: none; border-top: none; border-radius: 0 0 4px 0; }

    .book-clasp {
      position: absolute;
      right: -14px;
      top: 50%;
      transform: translateY(-50%);
      width: 28px;
      height: 60px;
      background: linear-gradient(135deg, var(--gold-bright), var(--gold-mid), var(--gold-dark));
      border: 1px solid var(--gold-bright);
      border-radius: 0 6px 6px 0;
      box-shadow: 4px 4px 10px rgba(0,0,0,0.5);
      z-index: 120;
      transition: transform 0.8s ease, opacity 0.8s ease;
    }

    .book-wrapper.is-open .book-clasp {
      transform: translateY(-50%) rotateY(-180deg) scale(0.8);
      opacity: 0;
    }

    .book-cover-front, .book-page-leaf {
      position: absolute;
      inset: 0;
      border-radius: 6px 14px 14px 6px;
      transform-style: preserve-3d;
      transform-origin: left center;
      transition: transform 1.3s cubic-bezier(0.35, 0, 0.25, 1);
    }

    .book-cover-front {
      z-index: 100;
      transition: transform 1.3s cubic-bezier(0.35, 0, 0.25, 1), z-index 0s linear 1.3s;
    }

    .book-wrapper.is-open .book-cover-front {
      transform: rotateY(-180deg);
      z-index: 1;
    }

    .cover-face-outer {
      position: absolute;
      inset: 0;
      backface-visibility: hidden;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 36px 24px;
      text-align: center;
    }

    .cover-face-inner {
      position: absolute;
      inset: 0;
      backface-visibility: hidden;
      transform: rotateY(180deg);
      border-radius: 12px 4px 4px 12px;
    }

    .parchment-sheet {
      background-color: var(--parchment-base);
      background-image: 
        radial-gradient(circle at 50% 50%, rgba(255,255,255,0.6) 0%, transparent 80%),
        repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(140,110,70,0.03) 4px),
        radial-gradient(circle at 0% 0%, rgba(180,140,80,0.25) 0%, transparent 55%),
        radial-gradient(circle at 100% 100%, rgba(180,140,80,0.25) 0%, transparent 55%);
      color: var(--ink-dark);
      box-shadow: inset 0 0 25px var(--parchment-shadow);
    }

    .spine-gutter-left {
      position: absolute;
      top: 0;
      right: 0;
      width: 35px;
      height: 100%;
      background: linear-gradient(90deg, transparent, rgba(80, 50, 20, 0.25));
      pointer-events: none;
    }

    .spine-gutter-right {
      position: absolute;
      top: 0;
      left: 0;
      width: 35px;
      height: 100%;
      background: linear-gradient(90deg, rgba(80, 50, 20, 0.25), transparent);
      pointer-events: none;
    }

    .book-page-leaf {
  position: absolute;
  inset: 0;
  border-radius: 6px 14px 14px 6px;
  transform-style: preserve-3d;
  transform-origin: left center;
  transition: transform 1.3s cubic-bezier(0.35, 0, 0.25, 1);
  z-index: 10;
}

    .page-side {
      position: absolute;
      inset: 0;
      backface-visibility: hidden;
      padding: 32px 28px;
      display: flex;
      flex-direction: column;
      box-sizing: border-box;
      overflow: hidden;
    }

    .page-side.side-back {
      transform: rotateY(180deg);
    }

    .book-page-leaf.is-flipped {
      transform: rotateY(-180deg);
    }

    .page-corner-hint {
      position: absolute;
      bottom: 0;
      right: 0;
      width: 45px;
      height: 45px;
      background: linear-gradient(135deg, transparent 50%, rgba(0,0,0,0.1) 51%, rgba(232,215,179,0.9) 100%);
      cursor: pointer;
      transition: width 0.3s ease, height 0.3s ease;
      z-index: 50;
    }
    .page-corner-hint:hover {
      width: 60px;
      height: 60px;
    }

    .page-corner-hint-left {
      position: absolute;
      bottom: 0;
      left: 0;
      width: 45px;
      height: 45px;
      background: linear-gradient(-135deg, transparent 50%, rgba(0,0,0,0.1) 51%, rgba(232,215,179,0.9) 100%);
      cursor: pointer;
      transition: width 0.3s ease, height 0.3s ease;
      z-index: 50;
    }
    .page-corner-hint-left:hover {
      width: 60px;
      height: 60px;
    }

    .base-page-left {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: 14px 4px 4px 14px;
  opacity: 0;
  transition: opacity 0.5s ease 0.4s;
  pointer-events: none;
}

    .book-wrapper.is-open .base-page-left {
      opacity: 1;
      pointer-events: auto;
    }

    .base-page-right {
      position: absolute;
      inset: 0;
      z-index: 0;
      border-radius: 4px 14px 14px 4px;
    }

    .gold-text-gradient {
      background: linear-gradient(135deg, #fff2bc 0%, #f6d26e 25%, #fff0b0 50%, #e8b948 75%, #fff1c5 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      text-shadow: 0 2px 8px rgba(0,0,0,0.72), 0 0 14px rgba(255,213,106,0.32);
    }

    .title-text-gradient {
      background: linear-gradient(135deg, #fff3d1 0%, #ffd075 40%, #ffaa33 70%, #ffc83b 100%);
      -webkit-background-clip: text;
      -webkit-text-fill-color: transparent;
      filter: drop-shadow(0 4px 12px rgba(0,0,0,0.8));
    }

    .fairytale-title {
      max-width: 16ch;
      margin: 0 auto;
      color: #ffe7a4;
      font-family: 'Cinzel Decorative', serif;
      font-size: 3.5rem;
      font-weight: 900;
      line-height: 1.08;
      text-shadow: 0 0 22px rgba(255, 210, 112, 0.35), 0 5px 18px rgba(0, 0, 0, 0.9);
      animation: titleGlow 5s ease-in-out infinite;
    }

    .fairytale-title::after {
      content: "";
      display: block;
      width: 104px;
      height: 2px;
      margin: 18px auto 0;
      background: linear-gradient(90deg, transparent, #ffdf91, transparent);
      box-shadow: 0 0 14px rgba(255, 219, 133, 0.8);
    }

    @keyframes titleGlow {
      0%, 100% { text-shadow: 0 0 18px rgba(255, 210, 112, 0.28), 0 5px 18px rgba(0, 0, 0, 0.9); }
      50% { text-shadow: 0 0 30px rgba(255, 225, 153, 0.58), 0 5px 18px rgba(0, 0, 0, 0.9); }
    }

    @media (max-width: 900px) {
      .fairytale-title { font-size: 2.7rem; }
    }

    @media (max-width: 680px) {
      .fairytale-title { font-size: 1.9rem; }
    }

    .dropcap-letter {
      float: left;
      font-family: 'Cinzel Decorative', serif;
      font-size: 3.2rem;
      line-height: 0.85;
      padding-top: 4px;
      padding-right: 8px;
      color: var(--ink-accent);
      font-weight: 700;
    }

    .page-shadow-right {
      box-shadow: 
        3px 3px 0px #e2d2ae,
        6px 6px 0px #d5c39d,
        9px 9px 0px #c5b088,
        14px 14px 25px rgba(0, 0, 0, 0.6);
    }

    .page-shadow-left {
      box-shadow: 
        -3px 3px 0px #e2d2ae,
        -6px 6px 0px #d5c39d,
        -9px 9px 0px #c5b088,
        -14px 14px 25px rgba(0, 0, 0, 0.6);
    }

    .story-scroll::-webkit-scrollbar {
      width: 4px;
    }
    .story-scroll::-webkit-scrollbar-track {
      background: rgba(0, 0, 0, 0.05);
    }
    .story-scroll::-webkit-scrollbar-thumb {
      background: var(--gold-mid);
      border-radius: 2px;
    }

    .page-illustration {
      width: 100%;
      height: 120px;
      margin: 8px 0;
      box-sizing: border-box;
      overflow: hidden;
      border: 1px solid var(--gold-mid);
      border-radius: 4px;
      background: #faf4e8;
      box-shadow: inset 0 0 10px rgba(0,0,0,0.05);
      padding: 4px;
    }

    .page-illustration svg,
    .page-illustration img {
      display: block;
      width: 100%;
      height: 100%;
      border-radius: 2px;
      object-fit: cover;
    }

    .relic-image {
      display: block;
      width: 100%;
      height: auto;
      max-width: 100%;
      margin: 0 0 16px;
      border: 1px solid var(--gold-mid);
      border-radius: 4px;
      background: #faf4e8;
      box-shadow: inset 0 0 10px rgba(0, 0, 0, .08);
    }

    #canvas-embers,
    .ambient-lighting,
    .ambient-lighting::before,
    .book-cover-front,
    .book-page-leaf,
    .cover-face-outer,
    .cover-face-inner,
    .base-page-left,
    .base-page-right,
    .page-side {
      top: 0;
      right: 0;
      bottom: 0;
      left: 0;
    }

    .gold-filigree-border {
      top: 18px;
      right: 18px;
      bottom: 18px;
      left: 18px;
    }

    .scene-3d {
      -webkit-perspective: 1800px;
      -webkit-perspective-origin: 50% 50%;
    }

    .book-wrapper {
      -webkit-transform: translateY(10px) rotateX(12deg) rotateY(-8deg) scale(0.52);
      -webkit-transform-style: preserve-3d;
      -webkit-transition: -webkit-transform 1.4s cubic-bezier(0.23, 1, 0.32, 1);
    }

    .book-wrapper.closed-hover {
      -webkit-animation: bookFloat 4s ease-in-out infinite;
    }

    .book-wrapper.is-open {
      -webkit-animation: none;
      -webkit-transform: translateX(220px) rotateX(0deg) rotateY(0deg) scale(0.96);
    }

    .book-spine-depth,
    .page-block-left,
    .page-block-right,
    .page-block-top,
    .page-block-bottom {
      -webkit-transform-style: preserve-3d;
    }

    .book-spine-depth,
    .page-block-left {
      -webkit-transform: rotateY(-90deg) translateZ(0);
    }

    .page-block-right {
      -webkit-transform: rotateY(90deg) translateZ(0);
    }

    .page-block-top {
      -webkit-transform: rotateX(90deg) translateZ(0);
    }

    .page-block-bottom {
      -webkit-transform: rotateX(-90deg) translateZ(0);
    }

    .book-clasp {
      -webkit-transform: translateY(-50%);
    }

    .book-clasp,
    .book-wrapper.is-open .book-clasp {
      -webkit-transition: -webkit-transform 0.8s ease, opacity 0.8s ease;
    }

    .book-wrapper.is-open .book-clasp {
      -webkit-transform: translateY(-50%) rotateY(-180deg) scale(0.8);
    }

    .book-cover-front,
    .book-page-leaf {
      -webkit-transform-style: preserve-3d;
      -webkit-transform-origin: left center;
      -webkit-transition: -webkit-transform 1.3s cubic-bezier(0.35, 0, 0.25, 1);
    }

    .book-wrapper.is-open .book-cover-front {
      -webkit-transform: rotateY(-180deg);
    }

    .cover-face-outer,
    .cover-face-inner,
    .page-side {
      -webkit-backface-visibility: hidden;
    }

    .cover-face-inner,
    .page-side.side-back {
      -webkit-transform: rotateY(180deg);
    }

    .book-page-leaf.is-flipped {
      -webkit-transform: rotateY(-180deg);
    }

    .book-wrapper.is-closing {
      -webkit-animation: none;
      -webkit-transform: translateY(50px) rotateX(12deg) rotateY(-8deg) scale(0.52);
    }

    .book-wrapper.is-shrinking {
      -webkit-transition: -webkit-transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
      -webkit-transform: translateY(50px) rotateX(12deg) rotateY(-8deg) scale(0.52);
    }

    .fairytale-title {
      -webkit-animation: titleGlow 5s ease-in-out infinite;
    }

    @-webkit-keyframes bookFloat {
      0%, 100% { -webkit-transform: translateY(10px) rotateX(12deg) rotateY(-8deg) scale(0.52); }
      50% { -webkit-transform: translateY(-2px) rotateX(15deg) rotateY(-4deg) scale(0.52); }
    }

    @-webkit-keyframes titleGlow {
      0%, 100% { text-shadow: 0 0 18px rgba(255, 210, 112, 0.28), 0 5px 18px rgba(0, 0, 0, 0.9); }
      50% { text-shadow: 0 0 30px rgba(255, 225, 153, 0.58), 0 5px 18px rgba(0, 0, 0, 0.9); }
    }

    @media (max-height: 760px) {
      .book-wrapper {
        -webkit-transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(0.52);
      }
      .book-wrapper.closed-hover {
        -webkit-animation-name: bookFloatCompact;
      }
      .book-wrapper.is-shrinking {
        -webkit-transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(0.52);
      }
    }

    @-webkit-keyframes bookFloatCompact {
      0%, 100% { -webkit-transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(0.52); }
      50% { -webkit-transform: translateY(58px) rotateX(15deg) rotateY(-4deg) scale(0.52); }
    }

    @media (max-width: 900px) and (min-height: 761px) {
      .book-wrapper {
        -webkit-transform: translateY(50px) rotateX(12deg) rotateY(-8deg) scale(0.76);
      }
      .book-wrapper.closed-hover {
        -webkit-animation-name: bookFloatTablet;
      }
      .book-wrapper.is-closing {
        -webkit-transform: translateY(10px) rotateX(12deg) rotateY(-8deg) scale(0.76);
      }
    }

    @media (max-width: 680px) and (min-height: 761px) {
      .book-wrapper {
        -webkit-transform: translateY(50px) rotateX(12deg) rotateY(-8deg) scale(0.72);
      }
      .book-wrapper.is-closing {
        -webkit-transform: translateY(10px) rotateX(12deg) rotateY(-8deg) scale(0.72);
      }
    }

    @media (max-width: 900px) and (max-height: 760px) {
      .book-wrapper {
        -webkit-transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(0.52);
      }
      .book-wrapper.closed-hover {
        -webkit-animation-name: bookFloatTabletCompact;
      }
      .book-wrapper.is-shrinking {
        -webkit-transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(0.52);
      }
      .book-wrapper.is-closing {
        -webkit-transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(0.52);
      }
    }

    @-webkit-keyframes bookFloatTablet {
      0%, 100% { -webkit-transform: translateY(50px) rotateX(12deg) rotateY(-8deg) scale(0.76); }
      50% { -webkit-transform: translateY(38px) rotateX(15deg) rotateY(-4deg) scale(0.76); }
    }

    @-webkit-keyframes bookFloatTabletCompact {
      0%, 100% { -webkit-transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(0.52); }
      50% { -webkit-transform: translateY(58px) rotateX(15deg) rotateY(-4deg) scale(0.52); }
    }

    @media (max-width: 900px) {
      .book-wrapper.is-open {
        -webkit-transform: translateX(170px) rotateX(0deg) scale(0.9);
      }
      .book-wrapper.is-closing {
        -webkit-transform: translateY(10px) rotateX(12deg) rotateY(-8deg) scale(0.76);
      }
    }

    @media (max-width: 680px) {
      .book-wrapper.is-open {
        -webkit-transform: translateX(140px) rotateX(0deg) scale(0.82);
      }
      .book-wrapper.is-closing {
        -webkit-transform: translateY(10px) rotateX(12deg) rotateY(-8deg) scale(0.72);
      }
    }

    #splash-container {
      opacity: 1;
      pointer-events: none;
      transition: opacity 1s ease;
    }

    #splash-container.opacity-0 { opacity: 0; }
    #splash-container.opacity-100 { opacity: 1; }
    #splash-container .pointer-events-auto { pointer-events: auto; }

    #splash-container > div:first-child > p:first-child { color: #f3d18a; }
    #splash-container > div:first-child > p:last-child { color: #f7ead2; }
    #splash-container > div:last-child > span { color: #e8d6aa; }
    #splash-container .group { color: #fff3d8; }
    #splash-container .group svg { color: #ffd16f; }

    #btn-audio-toggle,
    header a.header-home-icon {
      border: 1px solid rgba(245, 158, 11, .55);
      color: #fff2d5;
      background: rgba(28, 25, 23, .9);
      box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
      -webkit-backdrop-filter: blur(8px);
      backdrop-filter: blur(8px);
      transition: background-color .2s ease, border-color .2s ease, color .2s ease;
    }

    #btn-audio-toggle {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 14px;
      border-radius: 999px;
      color: #fff2d5;
      font: 700 12px/1.2 'Cinzel', Georgia, serif;
      cursor: pointer;
    }

    #btn-audio-toggle svg {
      width: 16px;
      height: 16px;
      flex: 0 0 16px;
      color: #fcd34d;
    }

    header a.header-home-icon {
      display: flex;
      width: 40px;
      height: 40px;
      align-items: center;
      justify-content: center;
      padding: 0;
      border-radius: 50%;
      color: #fff2d5;
    }

    header a.header-home-icon svg {
      width: 16px;
      height: 16px;
      color: #fcd34d;
    }

    #btn-audio-toggle:hover,
    header a.header-home-icon:hover {
      border-color: #fcd34d;
      background: rgba(41, 37, 36, .98);
      color: #fff;
    }

    @media (max-width: 900px) and (min-height: 761px) {
      .book-wrapper {
        transform: translateY(50px) rotateX(12deg) rotateY(-8deg) scale(0.76);
      }
      .book-wrapper.is-closing {
        transform: translateY(10px) rotateX(12deg) rotateY(-8deg) scale(0.76);
      }
      .book-wrapper.closed-hover {
        animation-name: bookFloatTablet;
      }
    }

    @media (max-width: 680px) and (min-height: 761px) {
      .book-wrapper {
        transform: translateY(50px) rotateX(12deg) rotateY(-8deg) scale(0.72);
      }
      .book-wrapper.is-closing {
        transform: translateY(50px) rotateX(12deg) rotateY(-8deg) scale(0.72);
      }
    }

    @media (max-width: 900px) and (max-height: 760px) {
      .book-wrapper {
        transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(0.52);
      }
      .book-wrapper.closed-hover {
        animation-name: bookFloatTabletCompact;
      }
      .book-wrapper.is-shrinking {
        transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(0.52);
      }
      .book-wrapper.is-closing {
        transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(0.52);
      }
    }

    @keyframes bookFloatTablet {
      0%, 100% { transform: translateY(50px) rotateX(12deg) rotateY(-8deg) scale(0.76); }
      50% { transform: translateY(38px) rotateX(15deg) rotateY(-4deg) scale(0.76); }
    }

    @keyframes bookFloatTabletCompact {
      0%, 100% { transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(0.52); }
      50% { transform: translateY(58px) rotateX(15deg) rotateY(-4deg) scale(0.52); }
    }

    #footer-controls {
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.7s ease;
    }

    #footer-controls.opacity-100 {
      opacity: 1;
      pointer-events: auto;
    }

    @supports not (color: oklch(0 0 0)) {
      body {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: space-between;
      }

      header {
        display: flex;
        width: 100%;
        max-width: 72rem;
        align-items: center;
        justify-content: space-between;
        box-sizing: border-box;
        margin: 0 auto;
        padding: 1.25rem 1.5rem;
        position: relative;
        z-index: 30;
      }

      header > div,
      header > a {
        display: flex;
        align-items: center;
      }

      header > div { gap: 1rem; }
      .hidden { display: none !important; }
      .flex { display: flex; }
      .flex-col { flex-direction: column; }
      .flex-1 { flex: 1 1 0%; }
      .items-center { align-items: center; }
      .justify-between { justify-content: space-between; }
      .justify-center { justify-content: center; }
      .text-center { text-align: center; }
      .text-justify { text-align: justify; }
      .mt-auto { margin-top: auto; }

      #splash-container {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 20;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: space-between;
        padding: 2rem 1rem 0;
        opacity: 1;
        pointer-events: none;
        transition: opacity 1s ease;
      }

      #splash-container.opacity-0 { opacity: 0; }
      #splash-container.opacity-100 { opacity: 1; }
      #splash-container .text-center { margin-top: 1rem; }
      #splash-container .pointer-events-auto {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-bottom: 1.5rem;
        pointer-events: auto;
      }

      #splash-container .group {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        padding: 1rem 2.25rem;
        border: 2px solid rgba(251, 191, 36, .8);
        border-radius: 9999px;
        color: #fff2d5;
        background: rgba(28, 25, 23, .88);
      }

      #splash-container .group .relative {
        position: relative;
        display: flex;
        align-items: center;
        gap: .75rem;
      }

      #footer-controls {
        width: 100%;
        max-width: 28rem;
        box-sizing: border-box;
        margin: 0 auto;
        padding: 1rem 1.5rem;
        position: relative;
        z-index: 30;
        opacity: 0;
        pointer-events: none;
        transition: opacity .7s ease;
      }

      #footer-controls.opacity-100 {
        opacity: 1;
        pointer-events: auto;
      }

      #footer-controls > div {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: .5rem;
        padding: .75rem 1.5rem;
        border: 1px solid rgba(245, 158, 11, .4);
        border-radius: 9999px;
        color: #fef3c7;
        background: rgba(28, 25, 23, .92);
      }

      #footer-controls button {
        display: flex;
        align-items: center;
        gap: .25rem;
        padding: .25rem;
        border: 0;
        color: #fde68a;
        background: transparent;
        cursor: pointer;
      }

      #footer-controls button:disabled { opacity: .3; }
    }

    @media (min-width: 1800px) and (min-height: 1000px) {
      header {
        max-width: 110rem;
        padding: 2rem 4rem;
      }

      header > a span {
        font-size: 30px;
      }

      #btn-audio-toggle {
        padding: .75rem 1rem;
        font-size: 16px;
      }

      #btn-audio-toggle svg {
        width: 20px;
        height: 20px;
      }

      #splash-container > div:first-child {
        margin-top: 2rem;
      }

      #splash-container > div:first-child > p:first-child {
        font-size: 17px;
      }

      .fairytale-title {
        font-size: 76px;
      }

      #splash-container > div:first-child > p:last-child {
        max-width: 52rem;
        margin-top: 1.25rem;
        font-size: 26px;
      }

      #splash-container .group {
        padding: 1.25rem 3rem;
        font-size: 24px;
      }
    }

    @media (min-width: 3200px) and (min-height: 1400px) {
      .book-wrapper {
        transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(1.15);
      }

      .book-wrapper.closed-hover {
        animation-name: bookFloatCinema;
      }

      .book-wrapper.is-closing,
      .book-wrapper.is-shrinking {
        transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(1.15);
      }

      .book-wrapper.is-open {
        transform: translateX(260px) rotateX(0deg) rotateY(0deg) scale(1.12);
      }

      .fairytale-title {
        font-size: 96px;
      }

      #splash-container > div:first-child > p:first-child {
        font-size: 20px;
      }

      #splash-container > div:first-child > p:last-child {
        font-size: 30px;
      }

      #splash-container .group {
        padding: 1.5rem 3.5rem;
        font-size: 28px;
      }
    }

    @keyframes bookFloatCinema {
      0%, 100% { transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(1.15); }
      50% { transform: translateY(58px) rotateX(15deg) rotateY(-4deg) scale(1.15); }
    }

    #splash-container .storybook-cta {
      appearance: none;
      -webkit-appearance: none;
      position: relative;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-height: 54px;
      padding: 0 24px;
      overflow: hidden;
      border: 1px solid rgba(236, 190, 91, .8);
      border-radius: 10px;
      color: #fff3d8;
      background: linear-gradient(180deg, #254b3d, #10271f);
      box-shadow: 0 8px 24px rgba(0, 0, 0, .35), inset 0 1px rgba(255, 239, 190, .18);
      font: 700 14px/1.2 'Cinzel', Georgia, serif;
      letter-spacing: 0;
      text-transform: uppercase;
      cursor: pointer;
      transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
      isolation: isolate;
    }

    #splash-container .storybook-cta__shine {
      position: absolute;
      inset: 0;
      z-index: -1;
      background: linear-gradient(110deg, transparent 12%, rgba(255, 222, 151, .2) 50%, transparent 88%);
      opacity: 0;
      transition: opacity .25s ease;
    }

    #splash-container .storybook-cta__content {
      display: inline-flex;
      align-items: center;
      gap: 12px;
    }

    #splash-container .storybook-cta__icon {
      width: 18px;
      height: 18px;
      flex: 0 0 18px;
      color: #f5cc72;
      transition: transform .2s ease;
    }

    #splash-container .storybook-cta:hover {
      border-color: #ffe3a0;
      box-shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 0 20px rgba(255, 215, 112, .18);
      transform: translateY(-1px);
    }

    #splash-container .storybook-cta:hover .storybook-cta__shine {
      opacity: 1;
    }

    #splash-container .storybook-cta:hover .storybook-cta__icon {
      transform: translateX(3px);
    }

    #splash-container .storybook-cta:focus-visible {
      outline: 3px solid #ffe3a0;
      outline-offset: 4px;
    }

    @media (max-width: 680px) {
      .book-wrapper {
        transform: translateY(0) rotateX(12deg) rotateY(-8deg) scale(.72);
        -webkit-transform: translateY(0) rotateX(12deg) rotateY(-8deg) scale(.72);
      }

      .book-wrapper.closed-hover {
        animation: bookFloatMobile 4s ease-in-out infinite;
        -webkit-animation: bookFloatMobile 4s ease-in-out infinite;
      }

      .book-wrapper.is-open {
        transform: translateX(89.6px) rotateX(0deg) rotateY(0deg) scale(.64);
        -webkit-transform: translateX(89.6px) rotateX(0deg) rotateY(0deg) scale(.64);
      }
    }

    @media (max-width: 900px) and (max-height: 760px) {
      .book-wrapper {
        transform: translateY(0) rotateX(12deg) rotateY(-8deg) scale(.52);
        -webkit-transform: translateY(0) rotateX(12deg) rotateY(-8deg) scale(.52);
      }

      .book-wrapper.closed-hover {
        animation-name: bookFloatMobileCompact;
        -webkit-animation-name: bookFloatMobileCompact;
      }

      .book-wrapper.is-closing {
        transform: translateY(0) rotateX(12deg) rotateY(-8deg) scale(.52);
        -webkit-transform: translateY(0) rotateX(12deg) rotateY(-8deg) scale(.52);
      }

      .book-wrapper.is-open {
        transform: translateX(144.5px) rotateX(0deg) rotateY(0deg) scale(.85);
        -webkit-transform: translateX(144.5px) rotateX(0deg) rotateY(0deg) scale(.85);
      }
    }

    @media (max-width: 360px) {
      .book-wrapper.is-open {
        transform: translateX(72.8px) rotateX(0deg) rotateY(0deg) scale(.52);
        -webkit-transform: translateX(72.8px) rotateX(0deg) rotateY(0deg) scale(.52);
      }
    }

    @media (min-width: 361px) and (max-width: 380px) {
      .book-wrapper.is-open {
        transform: translateX(84px) rotateX(0deg) rotateY(0deg) scale(.6);
        -webkit-transform: translateX(84px) rotateX(0deg) rotateY(0deg) scale(.6);
      }
    }

    @media (min-width: 381px) and (max-width: 420px) {
      .book-wrapper.is-open {
        transform: translateX(89.6px) rotateX(0deg) rotateY(0deg) scale(.64);
        -webkit-transform: translateX(89.6px) rotateX(0deg) rotateY(0deg) scale(.64);
      }
    }

    @media (min-width: 421px) and (max-width: 680px) {
      .book-wrapper.is-open {
        transform: translateX(98px) rotateX(0deg) rotateY(0deg) scale(.7);
        -webkit-transform: translateX(98px) rotateX(0deg) rotateY(0deg) scale(.7);
      }
    }

    @keyframes bookFloatMobile {
      0%, 100% { transform: translateY(-4px) rotateX(12deg) rotateY(-8deg) scale(.72); }
      50% { transform: translateY(4px) rotateX(15deg) rotateY(-4deg) scale(.72); }
    }

    @-webkit-keyframes bookFloatMobile {
      0%, 100% { -webkit-transform: translateY(-4px) rotateX(12deg) rotateY(-8deg) scale(.72); }
      50% { -webkit-transform: translateY(4px) rotateX(15deg) rotateY(-4deg) scale(.72); }
    }

    @keyframes bookFloatMobileCompact {
      0%, 100% { transform: translateY(-4px) rotateX(12deg) rotateY(-8deg) scale(.52); }
      50% { transform: translateY(4px) rotateX(15deg) rotateY(-4deg) scale(.52); }
    }

    @-webkit-keyframes bookFloatMobileCompact {
      0%, 100% { -webkit-transform: translateY(-4px) rotateX(12deg) rotateY(-8deg) scale(.52); }
      50% { -webkit-transform: translateY(4px) rotateX(15deg) rotateY(-4deg) scale(.52); }
    }

    @media (prefers-reduced-motion: reduce) {
      #splash-container .storybook-cta,
      #splash-container .storybook-cta__shine,
      #splash-container .storybook-cta__icon {
        transition: none;
      }
    }

    @-webkit-keyframes bookFloatCinema {
      0%, 100% { -webkit-transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(1.15); }
      50% { -webkit-transform: translateY(58px) rotateX(15deg) rotateY(-4deg) scale(1.15); }
    }

    @media (min-width: 3200px) and (min-height: 1400px) {
      .book-wrapper { -webkit-transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(1.15); }
      .book-wrapper.closed-hover { -webkit-animation-name: bookFloatCinema; }
      .book-wrapper.is-closing,
      .book-wrapper.is-shrinking { -webkit-transform: translateY(70px) rotateX(12deg) rotateY(-8deg) scale(1.15); }
      .book-wrapper.is-open { -webkit-transform: translateX(260px) rotateX(0deg) rotateY(0deg) scale(1.12); }
    }

    .chapter-heading-row {
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 6px;
    }

    .chapter-heading-row h3 {
      flex: 1 1 auto;
      margin-bottom: 0;
    }

    .chapter-audio-button {
      display: inline-flex;
      flex: 0 0 40px;
      width: 40px;
      height: 40px;
      align-items: center;
      justify-content: center;
      padding: 0;
      border: 1px solid rgba(125, 86, 37, .45);
      border-radius: 5px;
      color: #795a2f;
      background: rgba(255, 250, 235, .6);
      cursor: pointer;
      transition: background-color .18s ease, border-color .18s ease, color .18s ease;
    }

    .chapter-audio-button:hover,
    .chapter-audio-button[aria-pressed="true"] {
      border-color: #a66d20;
      color: #553610;
      background: rgba(248, 225, 177, .85);
    }

    .chapter-audio-button:focus-visible {
      outline: 2px solid #a66d20;
      outline-offset: 2px;
    }

    .chapter-audio-button svg {
      width: 20px;
      height: 20px;
    }

    .page-illustration img,
    .relic-image {
      cursor: zoom-in;
    }

    .page-illustration img:focus-visible,
    .relic-image:focus-visible {
      outline: 2px solid #a66d20;
      outline-offset: 3px;
    }

    .story-image-viewer {
      position: fixed;
      inset: 0;
      box-sizing: border-box;
      width: min(94vw, 1200px);
      max-width: none;
      max-height: 92vh;
      margin: auto;
      padding: 52px 12px 12px;
      overflow: auto;
      border: 1px solid rgba(236, 190, 91, .8);
      border-radius: 8px;
      color: #fff3d8;
      background: rgba(12, 20, 16, .97);
      box-shadow: 0 24px 80px rgba(0, 0, 0, .65);
    }

    .story-image-viewer::backdrop {
      background: rgba(0, 0, 0, .82);
      -webkit-backdrop-filter: blur(4px);
      backdrop-filter: blur(4px);
    }

    .story-image-viewer > img {
      display: block;
      width: auto;
      height: auto;
      max-width: 100%;
      max-height: calc(92vh - 76px);
      margin: 0 auto;
      object-fit: contain;
    }

    .story-image-viewer-close {
      position: absolute;
      top: 8px;
      right: 8px;
      display: flex;
      width: 40px;
      height: 40px;
      align-items: center;
      justify-content: center;
      padding: 0;
      border: 1px solid rgba(236, 190, 91, .5);
      border-radius: 4px;
      color: #fff3d8;
      background: rgba(28, 25, 23, .9);
      cursor: pointer;
    }

    .story-image-viewer-close:hover {
      border-color: #ffe3a0;
      color: #ffe3a0;
    }

    .story-image-viewer-close:focus-visible {
      outline: 2px solid #ffe3a0;
      outline-offset: 2px;
    }

    .story-image-viewer-close svg {
      width: 20px;
      height: 20px;
    }

    @media (prefers-reduced-motion: reduce) {
      .chapter-audio-button {
        transition: none;
      }
    }
