:root {
  color-scheme: light;
  --night: #291c30;
  --wall: #372539;
  --light: #ffe3b4;
  --peach: #ffaf7a;
  --paper: #fff3e1;
  --ink: #3c2635;
  --quiet: #664857;
  --pink: #e8bec0;
  --red: #7d354e;
  --line: #604159;
  --display: "Bricolage Grotesque", Manrope, system-ui, sans-serif;
  --serif: Fraunces, Georgia, serif;
  --sans: Manrope, system-ui, sans-serif;
  --side: clamp(18px, 5vw, 76px);
  --ease: cubic-bezier(.16, 1, .32, 1);
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--night); scrollbar-color: #b77382 var(--night); }
body { margin: 0; color: var(--light); background: var(--night); font: 1rem/1.5 var(--sans); }
[hidden], .symbol-bank { display: none !important; }
::selection { color: var(--night); background: var(--peach); }
:focus-visible { outline: 2px solid currentColor; outline-offset: 5px; }
h1, h2, p { margin: 0; }
button { color: inherit; cursor: pointer; font: inherit; }
button:disabled { cursor: default; }
svg { inline-size: 1.25rem; block-size: 1.25rem; flex: none; vertical-align: middle; }
.frame { width: min(100% - var(--side) * 2, 1340px); margin-inline: auto; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip:focus { position: fixed; z-index: 20; left: 1rem; top: 1rem; background: var(--paper); color: var(--ink); padding: .6rem 1rem; }
.site-header { min-height: 83px; display: flex; position: relative; z-index: 3; align-items: center; justify-content: space-between; gap: .75rem; border-bottom: 1px solid var(--line); }
.home-button, .navigation button, .text-button, .icon-button { min-height: 44px; padding: 0; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: .9rem; font-weight: 800; }
.home-button { font-family: var(--display); white-space: nowrap; font-size: 1.05rem; }
.home-button svg { width: 31px; height: 31px; color: var(--peach); }
.navigation { display: flex; align-items: center; gap: clamp(12px, 2.7vw, 39px); }
.text-button:hover, .home-button:hover { color: var(--peach); }
.navigation .language { text-decoration: underline; text-underline-offset: 4px; min-width: 29px; }
.navigation .wallet-trigger { padding-inline: 8px; color: var(--peach); gap: 6px; white-space: nowrap; }
.navigation .wallet-trigger:hover { color: var(--light); }
.wallet-trigger svg { width: 16px; height: 16px; }
#wallet-count { font-size: .86rem; font-variant-numeric: tabular-nums; min-width: 27px; text-align: center; color: var(--night); background: var(--peach); border-radius: 6px; padding: 2px 6px; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 49px; padding: .55rem 1.26rem; border-radius: 8px; border: 1px solid transparent; font-size: 1rem; font-weight: 800; transition: background .2s, color .2s, transform .2s var(--ease); }
.button:hover { transform: translateY(-2px); }
.button:active { transform: translateY(1px); }
.primary { background: var(--peach); color: var(--night); }
.primary:hover { background: var(--light); }
.secondary { background: transparent; border-color: #a6758d; }

.cover { display: grid; grid-template-columns: minmax(0, .87fr) minmax(0, 1.13fr); min-height: min(780px, calc(100svh - 83px)); gap: clamp(20px, 5vw, 80px); position: relative; align-items: center; padding-block: 35px 56px; isolation: isolate; }
.cover::before { content: ''; position: absolute; inset: auto calc(-1 * var(--side)) 0; height: 13%; z-index: -2; background: #312235; border-top: 1px solid #402a42; }
.cover-copy { position: relative; z-index: 2; padding-block: 25px; }
.cover h1 { font: 800 clamp(4.5rem, 8.25vw, 8rem)/.82 var(--display); letter-spacing: -.04em; font-optical-sizing: auto; outline-offset: 12px; }
.cover-word { display: block; }
.cover-word + .cover-word { color: var(--peach); margin-top: .11em; }
.cover h1 em { font: italic 400 clamp(1.47rem, 3.2vw, 2.6rem)/1.07 var(--serif); color: var(--pink); letter-spacing: -.017em; display: block; max-width: 15ch; margin-top: .82em; }
.cover-copy .button { margin-top: clamp(22px, 4vw, 38px); min-width: 123px; min-height: 55px; border-radius: 7px; }
.portal { position: relative; width: min(100%, 592px); height: clamp(475px, 48.5vw, 650px); justify-self: center; isolation: isolate; }
.room-view, .portal-frame { position: absolute; inset: 0; border-radius: 49% 49% 7px 7px / 34% 34% 7px 7px; }
.room-view { background: #b98385; overflow: hidden; box-shadow: 0 25px 56px #120b1a99; }
.room-view img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center 54%; }
.portal-frame { z-index: 2; pointer-events: none; border: 7px solid #8e545e; box-shadow: inset 0 0 0 1px #351e3385, 0 0 0 1px #b1757e; }
.portal-light { position: absolute; bottom: -78px; height: 82px; width: 125%; right: 0; z-index: -1; clip-path: polygon(25% 0, 100% 0, 91% 100%, 0 100%); background: linear-gradient(168deg, #f8b67940 5%, #db8b5530 50%, #db8b5500 92%); pointer-events: none; }
.door { position: absolute; z-index: 3; inset: 6px; display: block; border: 0; padding: 0; background: none; border-radius: 49% 49% 6px 6px / 34% 34% 6px 6px; }
.door-leaf { display: block; position: absolute; inset: 0; transform-origin: right center; transform: perspective(1300px) rotateY(-85deg); border-radius: inherit; overflow: hidden; transition: transform 650ms var(--ease), opacity 380ms ease; pointer-events: none; }
.door-panel { position: absolute; inset: 0; background: linear-gradient(90deg, #95505e, #71394f 83%); border: 3px solid #b67579; border-radius: inherit; }
.door-panel i, .door-panel b { position: absolute; left: 14%; right: 14%; display: block; border: 2px solid #c0807f; box-shadow: inset 0 0 20px #572e47; }
.door-panel i { top: 12%; height: 46%; border-radius: 51% 51% 8px 8px / 40% 40% 8px 8px; }
.door-panel b { top: 66%; bottom: 8%; border-radius: 8px; }
.door-handle { position: absolute; z-index: 2; top: 60%; left: 10%; width: 66px; height: 27px; border-radius: 40%; box-shadow: 2px 4px 5px #512739; background: #ffd297; }
@media (hover: hover) {
  .door:hover .door-leaf, .cover:has(#start:hover) .door-leaf { transform: perspective(1300px) rotateY(-88deg); }
}
.door:focus-visible { outline: 3px solid var(--light); outline-offset: 3px; }
.door:focus-visible .door-leaf { transform: perspective(1300px) rotateY(-88deg); }
.cover.entering { pointer-events: none; }
.cover.entering .door-leaf {
  transform: perspective(1300px) rotateY(-123deg);
  opacity: .14;
  transition: transform .48s cubic-bezier(.39, .03, .14, 1), opacity .36s .08s ease;
}
.cover.entering .cover-copy { animation: leave-hall .74s ease both; }
.portal-light { transition: opacity .55s, transform .7s var(--ease); }
.cover.entering .portal-light { opacity: 1; transform: scaleX(1.34); }
@keyframes leave-hall { 28% { opacity: 1; } to { opacity: .16; transform: translateX(-8px); } }

.entry-shot { position: fixed; inset: 0; z-index: 8; overflow: hidden; pointer-events: none; }
.entry-room { position: absolute; isolation: isolate; overflow: hidden; will-change: top, left, width, height; animation: move-through-door .68s cubic-bezier(.54, .12, .16, 1) both; }
.entry-room img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center 54%; }
.entry-room::after { position: absolute; content: ''; inset: 0; pointer-events: none; background: #ffe1ad; mix-blend-mode: soft-light; animation: entry-light .68s ease both; }
.entry-shot.arrived { animation: clear-doorway .34s cubic-bezier(.3, .64, .45, 1) both; }
@keyframes move-through-door {
  from { top: var(--portal-y); left: var(--portal-x); width: var(--portal-w); height: var(--portal-h); border-radius: 49% 49% 7px 7px / 34% 34% 7px 7px; }
  to { top: -5dvh; left: -5dvw; width: 110dvw; height: 110dvh; border-radius: 0; }
}
@keyframes entry-light { from { opacity: 0; } 58% { opacity: .28; } to { opacity: .08; } }
@keyframes clear-doorway { from { opacity: 1; } to { opacity: 0; } }

.reader { position: relative; isolation: isolate; min-height: calc(100svh - 83px); }
.room-scene { position: fixed; top: 83px; bottom: 0; left: 0; width: 51%; z-index: -1; background: #946e7e; overflow: hidden; }
.room-scene::after { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0%, transparent 62%, #291c30da 95%, var(--night)); }
.room-scene img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: 45% 56%; }
.reader.just-entered .room-scene img { animation: settle-room .95s var(--ease) both; }
@keyframes settle-room { from { transform: scale(1.10); filter: brightness(1.15); } to { transform: scale(1); filter: brightness(1); } }
.reading-layout { min-width: 0; min-height: inherit; display: grid; grid-template-columns: minmax(0, .77fr) minmax(0, 1fr); align-items: start; padding-block: 39px calc(45px + env(safe-area-inset-bottom)); }
.reading-window { min-width: 0; grid-column: 2; color: var(--ink); background: var(--paper); border-radius: 19px 19px 6px 6px; padding: 20px clamp(23px, 4vw, 60px) 25px; box-shadow: 0 19px 56px #150e213b; }
.reader.just-entered .reading-window { animation: arrive-paper .70s .10s var(--ease) both; }
@keyframes arrive-paper { from { opacity: .35; translate: 16px 14px; } to { opacity: 1; translate: none; } }
.paper-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--quiet); font-size: .84rem; font-weight: 800; }
.paper-top .text-button:hover, .reader-navigation .text-button:hover { color: var(--red); }
.paper-top svg, .reader-navigation svg { width: 16px; height: 16px; }
.story-page { padding-block: 24px 13px; }
.story-page.turn { animation: turn-page .56s var(--ease) both; }
@keyframes turn-page { from { opacity: .39; translate: 0 7px; filter: blur(1px); } to { opacity: 1; translate: none; filter: none; } }
.story-heading { position: relative; display: grid; align-items: start; grid-template-columns: minmax(0, 1fr) clamp(47px, 6.5vw, 75px); gap: 8px; }
.story-mascot { width: 100%; height: auto; margin: -5px 0 0; opacity: .80; pointer-events: none; }
.mascot-leaves { transform-box: view-box; transform-origin: 50% 70%; }
.story-mascot.greet .mascot-leaves { animation: mascot-sway .91s .12s var(--ease) both; }
@keyframes mascot-sway {
  0%, 100% { transform: none; }
  31% { transform: rotate(12deg) scale(1.02, .97); }
  58% { transform: rotate(-8deg) scale(.99, 1.03); }
  79% { transform: rotate(3deg); }
}
.story-page h1, .ending h1 { font: 800 clamp(2.4rem, 5.3vw, 4.65rem)/.98 var(--display); letter-spacing: -.038em; overflow-wrap: anywhere; }
#story-body { margin-top: 24px; max-width: 63ch; }
#story-body p { font: 400 clamp(1.06rem, 1.62vw, 1.23rem)/1.62 var(--serif); }
#story-body p + p { margin-top: .86em; }
.story-question { margin-top: 23px; padding: 15px 19px; background: #f7dbc5; color: #5b354c; border-radius: 9px; font: italic 400 clamp(1.09rem, 1.75vw, 1.29rem)/1.46 var(--serif); }
.feedback { color: var(--ink); }
.reactions { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(4px, .7vw, 9px); }
.reaction { --reaction: #f4d0bd; position: relative; display: grid; justify-items: center; place-content: center; gap: 3px; min-width: 0; min-height: 73px; border: 1px solid #ead2c2; border-radius: 10px; padding: 5px 2px; background: #fff8ea; font-size: clamp(.66rem, 1.3vw, .81rem); font-weight: 800; transition: background .2s, border-color .2s; }
.reaction::before, .reaction::after { position: absolute; content: ''; pointer-events: none; opacity: 0; }
.reaction::before { width: 31px; height: 31px; left: calc(50% - 15.5px); top: 10px; border: 2px solid #94536c; border-radius: 50%; }
.reaction::after { width: 4px; height: 4px; left: calc(50% - 2px); top: 21px; border-radius: 50%; background: #a65766; box-shadow: -16px -16px #a65766, 17px -14px #c08544, -15px 11px #758754, 19px 8px #ae708b; }
.reaction.reacted::before { animation: reaction-ring .50s var(--ease) both; }
.reaction.reacted::after { animation: reaction-flecks .58s var(--ease) both; }
@keyframes reaction-ring { 12% { opacity: .63; scale: .80; } to { opacity: 0; scale: 1.85; } }
@keyframes reaction-flecks { 16% { opacity: .82; scale: .85; } to { opacity: 0; scale: 1.7; translate: 0 -7px; } }
.story-question.answer-beat { animation: question-after-answer .57s ease both; }
@keyframes question-after-answer { 38% { background-color: #f3c9b9; } }
.reaction[data-reaction=laugh] { --reaction: #f9d49e; }
.reaction[data-reaction=heart] { --reaction: #f5cad5; }
.reaction[data-reaction=smile] { --reaction: #dce8ca; }
.reaction[data-reaction=flat] { --reaction: #e7d8f1; }
.reaction[data-reaction=sad] { --reaction: #d4e4eb; }
.reaction:enabled:hover, .reaction[aria-pressed=true] { background: var(--reaction); }
.reaction[aria-pressed=true] { border-color: #734d67; }
.reaction svg { width: 32px; height: 32px; transform-origin: 50% 70%; }
.reaction.reacted svg { animation: react .55s var(--ease) both; }
.reaction[data-reaction=heart].reacted svg { animation-name: heart-beat; }
.reaction[data-reaction=flat].reacted svg, .reaction[data-reaction=sad].reacted svg { animation-name: gentle-nod; }
@keyframes react { 25% { transform: translateY(-9px) rotate(-13deg) scale(1.13); } 62% { transform: translateY(1px) rotate(9deg) scale(.94); } to { transform: none; } }
@keyframes heart-beat { 24% { transform: scale(1.25); } 51% { transform: scale(.96); } 72% { transform: scale(1.14); } to { transform: none; } }
@keyframes gentle-nod { 25% { transform: translateY(3px) rotate(-14deg); } 60% { transform: translateY(-2px) rotate(8deg); } to { transform: none; } }
.super { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 51px; padding: 5px 13px; border: 1px solid #b67a46; border-radius: 9px; background: #ffdb9c; color: #6a354b; white-space: nowrap; font-size: .82rem; font-weight: 800; overflow: visible; }
.super > svg { width: 19px; height: 19px; }
.super:enabled:hover, .super[aria-pressed=true] { background: #ffbd6d; border-color: #89533b; }
.super[aria-pressed=true] { color: #502233; }
.super.stamped > svg { animation: gold-star .54s var(--ease) both; }
.super-spark { position: absolute; inset: 5px; pointer-events: none; }
.super-spark i { position: absolute; left: 50%; top: 35%; width: 6px; height: 6px; background: #ffd191; border-radius: 50%; opacity: 0; }
.super-spark i:nth-child(1) { --x: -37px; --y: -32px; }
.super-spark i:nth-child(2) { --x: 25px; --y: -40px; }
.super-spark i:nth-child(3) { --x: 44px; --y: -9px; }
.super-spark i:nth-child(4) { --x: -39px; --y: 15px; }
.super.stamped i { animation: ember .52s var(--ease) both; }
@keyframes gold-star { 25% { transform: translateY(-8px) scale(1.27) rotate(28deg); } 64% { transform: rotate(-9deg); } to { transform: none; } }
@keyframes ember { 15% { opacity: 1; } to { opacity: 0; translate: var(--x) var(--y); scale: .58; } }
.feedback-error { margin-top: 8px; color: #712b47; font-size: .87rem; }
.reader-navigation { margin-top: 14px; display: grid; grid-template-columns: auto auto minmax(0, 1fr); align-items: center; gap: clamp(8px, 1.3vw, 14px); }
.reader-navigation .primary { min-height: 56px; padding-inline: 9px; color: var(--paper); background: var(--red); }
.reader-navigation .primary:hover { background: #62263e; }
.reader-navigation .text-button:disabled { visibility: hidden; }

.ending { min-height: calc(81svh - 83px); padding-block: 38px; display: grid; justify-items: center; align-content: center; gap: 25px; text-align: center; }
.ending > svg { width: 74px; height: 74px; color: var(--peach); }
.ending > div { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
dialog { background: var(--paper); color: var(--ink); border: 0; width: min(100%, 420px); max-width: 100%; height: 100%; height: 100dvh; max-height: 100%; margin: 0 0 0 auto; padding: 22px 24px 32px; overflow-y: auto; }
dialog[open] { animation: open-drawer .35s var(--ease) both; }
dialog::backdrop { background: #211426b8; }
body:has(dialog[open]) { overflow: hidden; }
@keyframes open-drawer { from { translate: 25px; opacity: .65; } to { translate: none; opacity: 1; } }
.drawer-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.drawer-header h2 { font: 800 clamp(1.72rem, 5vw, 2.3rem)/1.04 var(--display); letter-spacing: -.03em; }
.icon-button { border: 1px solid #d5b8b9; border-radius: 50%; min-width: 44px; }
.icon-button:hover { background: #f5d9c4; }
#drawer-caption { color: var(--quiet); margin: 15px 0; font-size: .9rem; }
.story-list { list-style: none; padding: 0; margin: 18px 0 0; border-top: 1px solid #d6bcc1; }
.story-list li + li { border-top: 1px solid #d6bcc1; }
.story-link { width: 100%; min-height: 52px; border: 0; background: none; display: grid; grid-template-columns: 2rem 1fr auto; align-items: center; gap: 8px; text-align: left; padding: 7px 6px; }
.story-link:hover, .story-link[aria-current=true] { background: #f7ddcb; }
.story-link .number { color: var(--red); font-size: .81rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.story-link .story-name { font: 400 1.13rem/1.24 var(--serif); }
.story-link svg { width: 17px; height: 17px; color: var(--red); }

@media (max-width: 1050px) {
  .portal { height: clamp(420px, 59vw, 605px); }
  .reading-layout { grid-template-columns: minmax(0, .52fr) minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .site-header { min-height: 64px; }
  .home-button { font-size: .91rem; gap: 4px; }
  .home-button svg { width: 25px; height: 25px; }
  .navigation { gap: clamp(6px, 2.6vw, 14px); }
  .navigation button { font-size: .82rem; }
  .navigation .wallet-trigger { padding-inline: 0; }
  .wallet-trigger > span { display: none; }
  .wallet-trigger svg { width: 14px; height: 14px; }
  #wallet-count { padding: 1px 5px; }
  .cover { display: flex; flex-direction: column; align-items: stretch; gap: 21px; padding-block: 25px 36px; min-height: calc(100svh - 64px); }
  .cover-copy { padding: 1px 0 0; }
  .cover h1 { font-size: clamp(3.5rem, 12.2vw, 5.8rem); line-height: .96; }
  .cover-word { display: inline; }
  .cover-word + .cover-word { margin-top: 0; }
  .cover h1 em { font-size: clamp(1.35rem, 5.3vw, 2rem); margin-top: 9px; max-width: 20ch; }
  .cover-copy .button { margin-top: 18px; min-height: 48px; min-width: 106px; }
  .portal { width: min(100%, 445px); height: auto; aspect-ratio: 1 / 1.07; align-self: center; }
  .portal-frame { border-width: 5px; }
  .door { inset: 4px; }
  .portal-light { bottom: -36px; height: 38px; }
  .room-scene { top: 64px; bottom: auto; width: 100%; height: 230px; }
  .room-scene img { object-position: center 83%; }
  .room-scene::after { background: linear-gradient(180deg, #291c3000 37%, #291c3040 62%, var(--night) 100%); }
  .reading-layout { display: block; padding-block: clamp(120px, 33vw, 160px) calc(31px + env(safe-area-inset-bottom)); }
  .reading-window { padding: 10px clamp(15px, 5vw, 28px) 15px; }
  .story-page { padding-block: 13px 15px; }
  #story-body { margin-top: 16px; }
  .story-question { padding: 12px 14px; }
  .story-heading { gap: 5px; }
  .story-mascot { margin-top: -3px; }
  .reaction { min-height: 65px; padding-inline: 1px; }
  .reaction svg { width: 28px; height: 28px; }
  .reader-navigation { grid-template-columns: auto minmax(0, 1fr); }
  .reader-navigation .text-button { grid-column: 1 / -1; grid-row: 2; justify-self: start; }
  .reader-navigation .text-button:disabled { display: none; }
  .super { min-height: 55px; padding-inline: 8px; gap: 5px; }
  .super > svg { width: 17px; height: 17px; }
}
@media (max-width: 355px) {
  .home-button > span { font-size: .81rem; }
  .navigation { gap: 5px; }
  .cover h1 { font-size: 3.08rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
