/* Oz Castle — storybook watercolor, purple Gillikin country. */
@font-face { font-family: Schola; src: url(../fonts/texgyreschola-regular.otf) format('opentype'); font-display: swap; }
@font-face { font-family: Schola; font-style: italic; src: url(../fonts/texgyreschola-italic.otf) format('opentype'); font-display: swap; }
@font-face { font-family: Schola; font-weight: 700; src: url(../fonts/texgyreschola-bold.otf) format('opentype'); font-display: swap; }
:root { --plum: #4a2a63; --plum-d: #2a1838; --lilac: #c9b3e6; --gold: #f2d27a; --gold-d: #c99a2e; --cream: #fbf3e2; --ink: #2a2118; --green: #1f8a55;
  --ease: cubic-bezier(.22,.8,.25,1); --paper: radial-gradient(ellipse at 30% 10%, #fffaf0, #f2e4c4 75%, #e8d3a6); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--plum-d); color: var(--cream); font-family: Schola, 'Century Schoolbook', 'TeX Gyre Schola', Georgia, serif;
  font-kerning: normal; font-variant-ligatures: common-ligatures; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; border-radius: 6px; }
.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.skiplink { position: fixed; z-index: 100; left: 12px; top: -60px; padding: 10px 16px; border-radius: 8px; background: var(--cream); color: var(--ink); font-style: italic; text-decoration: none; transition: top .2s; }
.skiplink:focus { top: 12px; }

/* ---------- the painted world ---------- */
#world { position: fixed; inset: 0; overflow: clip; }
.scene { position: absolute; inset: 0; opacity: 0; pointer-events: none; transform: scale(1.06); transition: opacity 1.6s var(--ease), transform 2.2s var(--ease); }
.scene.on { opacity: 1; transform: scale(1); }
.scene.past { opacity: 0; transform: scale(1.18); transition: opacity 1.1s ease-in, transform 1.6s ease-in; }
/* walking on: the room you leave rushes past, toward its door */
.scene.past.walk { transform: scale(2.1); transition: opacity 1.2s cubic-bezier(.55,0,.8,.4) .1s, transform 1.5s cubic-bezier(.55,0,.75,.2); }
.scene.blank { background: radial-gradient(ellipse at 50% 35%, #6a4a8c, var(--plum-d) 70%); }
.par { position: absolute; inset: 0; transform: translate3d(calc(var(--px, 0) * -14px), calc(var(--py, 0) * -9px), 0); transition: transform 1s cubic-bezier(.2,.7,.2,1); }
.platebox { position: absolute; inset: -3%; width: 106%; height: 106%; animation: drift 50s ease-in-out infinite alternate; }
.platebox img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@keyframes drift { from { transform: scale(1) translate(0, 0); } to { transform: scale(1.06) translate(-1.5%, -1%); } }
/* the first painting develops like wet watercolor drying on the page */
.scene.first .platebox img { animation: develop 3.2s cubic-bezier(.3,.6,.3,1) both; }
@keyframes develop { from { filter: blur(14px) saturate(.15) sepia(.4) brightness(1.25) contrast(.85); } 55% { filter: blur(2px) saturate(.7) sepia(.12) brightness(1.08); } to { filter: none; } }
.wash { position: fixed; inset: 0; z-index: 2; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, rgba(251,243,226,.0), rgba(251,243,226,.85) 70%), #f6ead2; animation: wash 2.6s .15s ease-out forwards; }
@keyframes wash { to { opacity: 0; visibility: hidden; } }
.platebox video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 1.4s ease; pointer-events: none; }
.platebox video.live { opacity: 1; }
.scene[data-has-video] .platebox { inset: 0; width: 100%; height: 100%; animation: none; }
.veil { position: fixed; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse 110% 90% at 50% 40%, transparent 50%, rgba(20,8,30,.55)), linear-gradient(rgba(20,8,30,.35), transparent 22%, transparent 60%, rgba(20,8,30,.6)); }
/* watercolor paper: a whisper of grain over everything */
.paper { position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .14; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .45 0 0 0 0 .35 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
#petals { position: fixed; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; }

/* ---------- things to touch in the paintings ---------- */
.spot { position: absolute; border: 0; padding: 0; background: transparent; border-radius: 10px; cursor: pointer; transition: box-shadow .3s, background .3s; }
.scene.on .spot { pointer-events: auto; }
.spot:hover, .spot:focus-visible { outline: none; background: rgba(255,240,190,.10); box-shadow: 0 0 0 2px rgba(242,210,122,.85), 0 0 26px rgba(255,226,140,.7); }
.spot-curio::after { content: '✦'; position: absolute; left: 50%; top: 50%; translate: -50% -50%; color: #fff3c4; font-size: 16px; text-shadow: 0 0 8px #ffd76a, 0 0 2px #000; opacity: 0; pointer-events: none; }
.platebox.hint .spot-curio:not(.seen)::after { animation: twinkle 1.6s .4s ease-in-out 2; }
.platebox.hint .spot-banner:not(.seen) { animation: spothint 2.2s .4s ease-in-out 2; }
@keyframes twinkle { 0%, 100% { opacity: 0; scale: .4; rotate: 0deg; } 45% { opacity: 1; scale: 1.25; rotate: 45deg; } }
@keyframes spothint { 50% { box-shadow: 0 0 0 2px rgba(242,210,122,.75), 0 0 22px rgba(255,226,140,.6); } }
@media (pointer: coarse) { .spot-curio:not(.seen)::after { opacity: .55; font-size: 13px; animation: breathe 3.5s ease-in-out infinite; } }
@keyframes breathe { 50% { opacity: .15; } }
.spot-book { animation: bookglow 2.6s ease-in-out infinite; border-radius: 4px; }
@keyframes bookglow { 50% { box-shadow: 0 0 0 2px rgba(255,240,176,.9), 0 0 40px rgba(255,226,140,.85); } }

/* Mistress Plum's asides */
.note { position: fixed; z-index: 30; width: min(320px, calc(100vw - 20px)); padding: 14px 18px 12px; border-radius: 6px; color: var(--ink); background: var(--paper);
  box-shadow: 0 18px 40px rgba(20,8,30,.55), inset 0 0 0 1px rgba(120,80,40,.35); font-size: 16px; line-height: 1.5; animation: noteIn .45s var(--ease) both; }
.note::before { content: ''; position: absolute; inset: 5px; border: 1px solid rgba(120,80,40,.25); border-radius: 3px; pointer-events: none; }
.note p { margin: 0; font-style: italic; }
.note .found-tag { display: block; margin-top: 8px; font-size: 13px; letter-spacing: .06em; color: #8a5a10; }
.note.fresh { box-shadow: 0 18px 40px rgba(20,8,30,.55), inset 0 0 0 1px rgba(120,80,40,.35), 0 0 0 3px rgba(242,210,122,.55); }
@keyframes noteIn { from { opacity: 0; transform: translateY(8px) scale(.97); } }

/* ---------- header ---------- */
#top { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; padding: max(16px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) 16px max(24px, env(safe-area-inset-left)); }
.brand { color: var(--cream); text-decoration: none; font-size: 22px; font-style: italic; letter-spacing: .02em; text-shadow: 0 2px 10px #0008; }
.brand span { color: var(--gold); }
#top nav { display: flex; gap: 10px; align-items: center; }
#top nav a, #top nav button { color: var(--cream); text-decoration: none; background: rgba(30,12,44,.5); border: 1px solid rgba(255,240,210,.25); border-radius: 99px; padding: 6px 14px; font-size: 14px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); transition: background .25s, transform .25s; }
#top nav a:hover, #top nav button:hover { background: rgba(60,30,84,.7); }
#top nav button[aria-pressed=true] { background: var(--gold); color: var(--ink); }
#curios { color: var(--gold) !important; }
#curios .of { opacity: .7; }
#curios.bump { animation: bump .7s var(--ease); }
@keyframes bump { 30% { transform: scale(1.25); background: rgba(242,210,122,.45); } }

/* ---------- title ---------- */
.title { position: fixed; z-index: 10; left: 7vw; top: 14vh; max-width: 640px; text-shadow: 0 2px 4px rgba(20,8,30,.8), 0 3px 20px rgba(20,8,30,.75); }
.title::before { content: ''; position: absolute; z-index: -1; inset: -12% -18% -14% -30%; background: radial-gradient(ellipse at 42% 50%, rgba(30,12,44,.88), rgba(30,12,44,.72) 45%, rgba(30,12,44,.3) 64%, transparent 76%); filter: blur(8px); pointer-events: none; animation: fade 2s .6s both; }
.kicker { letter-spacing: .3em; text-transform: uppercase; font-size: 13px; opacity: .9; animation: rise 2s 1.2s var(--ease) both; }
.title h1 { margin: 10px 0 0; font-weight: 400; line-height: .95; }
.title .the { display: block; font-style: italic; font-size: clamp(26px, 3.4vw, 44px); animation: rise 2.2s 1.5s var(--ease) both; }
.title .big { display: block; font-size: clamp(64px, 10vw, 150px); letter-spacing: -.005em; background: linear-gradient(180deg, #fffdf3 8%, #ffe9a8 42%, #f5cc62 70%, #d9a43a); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; filter: drop-shadow(0 2px 1px rgba(30,10,40,.85)) drop-shadow(0 6px 18px rgba(20,8,30,.7)); animation: ink 2.6s 1.7s var(--ease) both; }
@keyframes ink { from { opacity: 0; letter-spacing: .08em; filter: blur(10px) drop-shadow(0 2px 1px rgba(30,10,40,.85)) drop-shadow(0 6px 18px rgba(20,8,30,.7)); } }
.title .sub { font-size: clamp(17px, 1.6vw, 22px); font-style: italic; max-width: 520px; animation: rise 2.2s 2.3s var(--ease) both; }
.cta { margin-top: 18px; border: 0; padding: 13px 28px; border-radius: 99px; font-size: 19px; font-style: italic; color: var(--ink); background: linear-gradient(#fff6dc, var(--gold)); box-shadow: 0 8px 30px rgba(20,8,30,.5), inset 0 -2px 0 rgba(150,100,20,.4); transition: transform .25s var(--ease), box-shadow .25s; animation: rise 2.2s 2.7s var(--ease) both, beckon 3.2s 5.5s ease-in-out infinite; }
.cta:hover { transform: translateY(-3px) scale(1.03); box-shadow: 0 14px 40px rgba(20,8,30,.6), 0 0 0 6px rgba(242,210,122,.25); }
.cta span { margin-left: 6px; }
@keyframes beckon { 50% { box-shadow: 0 8px 30px rgba(20,8,30,.5), 0 0 0 8px rgba(242,210,122,.18), inset 0 -2px 0 rgba(150,100,20,.4); } }
@keyframes rise { from { opacity: 0; transform: translateY(16px); filter: blur(4px); } }
@keyframes fade { from { opacity: 0; } }
body.night .title .big { background: linear-gradient(180deg, #fffbe8, #ffe39a 50%, #e0b450); -webkit-background-clip: text; background-clip: text; }

/* ---------- Mistress Plum's speech ---------- */
#speech { position: fixed; z-index: 12; left: 50%; bottom: 7vh; translate: -50% 0; width: min(760px, 92vw); padding: 22px 28px 18px; border-radius: 6px; color: var(--ink);
  background: var(--paper); box-shadow: 0 24px 60px rgba(20,8,30,.6), inset 0 0 0 1px rgba(120,80,40,.35), inset 0 0 60px rgba(170,120,60,.25); animation: rise .8s var(--ease) both; }
#speech::before { content: ''; position: absolute; inset: 7px; border: 1px solid rgba(120,80,40,.3); border-radius: 3px; pointer-events: none; }
.who { position: absolute; top: -18px; left: 24px; display: flex; align-items: center; gap: 8px; background: var(--plum); color: var(--gold); padding: 4px 16px 4px 4px; border-radius: 99px; font-style: italic; box-shadow: 0 4px 14px #0006; }
.who .face { width: 34px; height: 34px; border-radius: 50%; background: var(--lilac) 30% 18% / 420% no-repeat; border: 2px solid var(--gold); }
#speech .line { font-size: clamp(17px, 1.45vw, 21px); line-height: 1.6; margin: 10px 0 8px; min-height: 3.2em; hanging-punctuation: first; text-wrap: pretty; }
#speech .line .c { opacity: 0; transition: opacity .25s; } #speech .line .c.on { opacity: 1; }
.moves { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.moves button, #askname button { border: 1px solid rgba(90,60,30,.5); background: linear-gradient(#fffaf0, #efdfba); color: var(--ink); border-radius: 99px; padding: 9px 18px; font-size: 16px; min-height: 44px; transition: transform .2s var(--ease), box-shadow .2s; }
.moves button.go, #askname button[type=submit] { background: linear-gradient(#6a3d8c, var(--plum)); color: #fff4dc; border-color: var(--plum-d); }
.moves button:hover, #askname button:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(42,24,56,.25); }
#askname { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
#askname input { flex: 1; min-width: 180px; min-height: 44px; font: inherit; font-size: 18px; padding: 8px 16px; border-radius: 99px; border: 1px solid rgba(90,60,30,.5); background: #fffdf6; color: var(--ink); }
#askname .ghost { background: transparent; }

/* ---------- the Portrait Gallery ---------- */
.gallery { position: fixed; z-index: 11; top: 12vh; left: 50%; translate: -50% 0; display: flex; gap: 1.8vw; perspective: 900px; animation: rise 1s .5s var(--ease) both; }
.frame { width: clamp(110px, 12vw, 190px); aspect-ratio: 3/2; padding: 8px; border: 0; background: linear-gradient(135deg, #f6d98a, #b78a2c 45%, #f2d27a 55%, #8a6418); box-shadow: 0 12px 30px #0009, inset 0 0 0 2px #5a3e0e; transition: transform .35s var(--ease); }
.frame:nth-child(odd) { rotate: -1deg; } .frame:nth-child(even) { rotate: .8deg; }
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; box-shadow: inset 0 0 8px #000; }
.frame:hover, .frame:focus-visible { transform: translateY(-6px) rotateX(4deg) scale(1.06); }
#lightbox { position: fixed; inset: 0; z-index: 40; background: rgba(15,6,22,.93); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: zoom-out; padding: 16px; animation: fade .4s both; }
#lightbox img { max-width: 90vw; max-height: 72vh; border: 10px solid #d9b45a; box-shadow: 0 30px 80px #000; animation: noteIn .6s var(--ease) both; }
#lightbox p { max-width: 640px; text-align: center; font-style: italic; font-size: 19px; line-height: 1.5; margin: 14px 0 6px; }
.lb-close { border: 1px solid rgba(255,240,210,.35); background: rgba(30,12,44,.6); border-radius: 99px; padding: 8px 22px; font-style: italic; min-height: 44px; }

/* ---------- the green bookcase ---------- */
#shelf { position: fixed; z-index: 12; left: 50%; top: 50%; translate: -50% -56%; width: min(980px, 94vw); text-align: center; }
.case { padding: 26px 30px 16px; border-radius: 10px 10px 4px 4px; background: linear-gradient(180deg, #2fae6e, #13693e); box-shadow: 0 30px 80px rgba(10,30,15,.7), inset 0 0 0 6px #e7c35f, inset 0 0 0 9px #0c4a2a, inset 0 0 50px rgba(0,0,0,.4); }
.row { display: flex; align-items: flex-end; gap: 6px; min-height: 230px; padding: 0 10px 10px; border-bottom: 14px solid #0d4f2d; box-shadow: inset 0 -20px 30px rgba(0,0,0,.35); background: linear-gradient(#0b3d22, #0f5430); border-radius: 4px; }
.book { position: relative; border: 0; padding: 0; width: 64px; height: 210px; border-radius: 3px 3px 2px 2px; transform-origin: bottom center; transition: transform .45s var(--ease), box-shadow .45s; }
.book.live { width: 92px; height: 226px; background: linear-gradient(90deg, #0f5a33, #1c8a52 30%, #23a061 50%, #1c8a52 70%, #0f5a33); box-shadow: 0 0 0 2px #e7c35f inset, 0 0 30px rgba(242,210,122,.55), 0 10px 20px #0008; animation: glow 2.6s ease-in-out infinite; cursor: pointer; }
.book.live:hover { transform: translateY(-18px) rotate(-2deg); }
@keyframes glow { 50% { box-shadow: 0 0 0 2px #fff0b0 inset, 0 0 55px rgba(255,226,140,.9), 0 10px 20px #0008; } }
.spine { position: absolute; inset: 14px 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; writing-mode: vertical-rl; transform: rotate(180deg); color: #ffe9a6; font-size: 15px; letter-spacing: .04em; text-shadow: 0 1px 2px #0009; border-top: 2px solid #e7c35f; border-bottom: 2px solid #e7c35f; }
.spine em { font-size: 12px; } .spine small { font-size: 10px; opacity: .8; margin-top: 8px; }
.asleep { display: flex; gap: 6px; align-items: flex-end; flex: 1; }
.dream-head { display: none; }
.book.dream { background: linear-gradient(90deg, #3a2a4e, #5a4472 50%, #3a2a4e); opacity: .62; filter: saturate(.6) blur(.3px); cursor: help; color: #e6dcf4; }
.book.dream .spine { color: #e6dcf4; font-size: 12px; border-color: #b9a6d6; }
.book.dream:hover, .book.dream:focus-visible { opacity: .95; transform: translateY(-6px); }
.bookend { width: 34px; height: 120px; align-self: flex-end; background: linear-gradient(#e7c35f, #a8801f); clip-path: polygon(0 0, 70% 0, 100% 100%, 0 100%); }
.shelf-note { font-style: italic; font-size: 17px; text-shadow: 0 2px 10px #000a; margin-top: 16px; }
/* with the painted bookcase, the shelf steps back to a quiet list of the books still dreaming */
body.painted-bookcase #shelf { left: auto; right: 2.2vw; top: 17vh; translate: none; width: min(320px, 38vw); text-align: left; animation: rise 1s .8s var(--ease) both; }
body.painted-bookcase #shelf .case { background: rgba(30,12,44,.74); box-shadow: 0 20px 50px rgba(10,5,20,.6), inset 0 0 0 1px rgba(242,210,122,.45); padding: 12px 14px 10px; border-radius: 8px; backdrop-filter: blur(4px); }
body.painted-bookcase #shelf .row { min-height: 0; border: 0; box-shadow: none; background: none; flex-direction: column; align-items: stretch; padding: 0; }
body.painted-bookcase #shelf .book.live { display: none; }
body.painted-bookcase #shelf .asleep { flex-direction: column; gap: 3px; align-items: stretch; }
body.painted-bookcase .dream-head { display: block; margin: 0 0 6px; font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold); opacity: .85; }
body.painted-bookcase #shelf .book.dream { width: auto; height: auto !important; opacity: .82; filter: none; padding: 5px 8px; text-align: left; background: transparent; border-radius: 4px; }
body.painted-bookcase #shelf .book.dream:hover, body.painted-bookcase #shelf .book.dream:focus-visible { background: rgba(255,240,210,.08); transform: none; opacity: 1; }
body.painted-bookcase #shelf .book.dream .spine { position: static; writing-mode: horizontal-tb; transform: none; border: 0; flex-direction: row; justify-content: space-between; font-size: 14px; font-style: italic; }
body.painted-bookcase #shelf .book.dream .spine small { margin: 0 0 0 8px; font-style: normal; }
body.painted-bookcase #shelf .bookend { display: none; }
body.painted-bookcase #shelf .shelf-note { font-size: 14px; margin: 10px 4px 0; }

/* ---------- the open book ---------- */
#openbook { position: fixed; inset: 0; z-index: 25; display: grid; place-items: center; background: rgba(15,6,22,.6); backdrop-filter: blur(3px); animation: fade .6s both; }
#openbook.nook { background: linear-gradient(rgba(15,6,22,.5), rgba(15,6,22,.5)), var(--nook) center/cover; backdrop-filter: none; }
#openbook .nookloop { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .5; z-index: -1; }
.book3d { position: relative; display: grid; grid-template-columns: 1fr 1fr; width: min(1040px, 94vw); min-height: min(620px, 82vh); perspective: 2000px; filter: drop-shadow(0 40px 60px rgba(0,0,0,.6)); animation: bookIn .9s var(--ease) both; }
@keyframes bookIn { from { transform: translateY(40px) scale(.94); opacity: 0; } }
.page { padding: 42px 46px; color: var(--ink); background: radial-gradient(ellipse at 40% 20%, #fffaf0, #f3e4c2 70%, #e8d3a6); position: relative; }
.page.left { border-radius: 8px 0 0 8px; box-shadow: inset -30px 0 40px -20px rgba(120,80,30,.35); text-align: center; }
.page.right { border-radius: 0 8px 8px 0; box-shadow: inset 30px 0 40px -20px rgba(120,80,30,.35); }
.pk { letter-spacing: .25em; text-transform: uppercase; font-size: 12px; color: #7a5a2c; }
.page h2 { font-weight: 400; font-size: clamp(32px, 3.6vw, 50px); line-height: 1.05; margin: 10px 0; color: #1d5e3a; }
.by { font-style: italic; color: #6a5236; } .orn { font-size: 28px; color: #b8860b; margin: 10px 0; }
.blurb { font-size: 17px; line-height: 1.6; text-align: left; hyphens: auto; } .free { font-size: 14px; color: #7a5a2c; font-style: italic; margin-top: 18px; }
.first { font-size: 19px; line-height: 1.7; }
.dc { float: left; font-size: 74px; line-height: .8; padding: 6px 8px 0 0; color: #1d5e3a; }
.begin { display: inline-block; margin-top: 26px; text-decoration: none; padding: 14px 30px; border-radius: 99px; font-size: 21px; font-style: italic; color: #fff7e0; background: linear-gradient(#25a364, #12643a); box-shadow: 0 10px 26px rgba(10,60,30,.45), inset 0 0 0 2px #e7c35f; transition: transform .25s var(--ease), box-shadow .25s; animation: beckonG 3s 2.4s ease-in-out infinite; }
.begin:hover { transform: translateY(-2px) scale(1.03); }
@keyframes beckonG { 50% { box-shadow: 0 10px 26px rgba(10,60,30,.45), inset 0 0 0 2px #e7c35f, 0 0 0 8px rgba(37,163,100,.18); } }
.hint { font-size: 14px; font-style: italic; color: #6a5236; margin-top: 18px; }
.begin-float { display: none; }
.close-book { position: absolute; bottom: 18px; right: 22px; border: 0; background: none; color: #7a5a2c; font-style: italic; min-height: 44px; }
.cover { position: absolute; inset: 0 0 0 50%; transform-origin: left center; background: linear-gradient(90deg, #0f5a33, #1c8a52 40%, #12643a); border-radius: 0 8px 8px 0; box-shadow: inset 0 0 0 10px #0d4f2d, inset 0 0 0 13px #e7c35f; display: grid; place-items: center; animation: openCover 1.8s .35s var(--ease) forwards; backface-visibility: hidden; }
.cover span { color: #ffe9a6; font-size: 34px; font-style: italic; text-align: center; padding: 30px; }
@keyframes openCover { to { transform: rotateY(-178deg); } }
/* into the story */
.fadeout { position: fixed; inset: 0; z-index: 90; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at 50% 50%, #fffaf0, #f3e4c2 70%, #e8d3a6); transition: opacity .85s ease-in; }
body.leaving .fadeout { opacity: 1; pointer-events: auto; }

/* ---------- walk dots, footer link ---------- */
#dots { position: fixed; z-index: 20; bottom: max(14px, env(safe-area-inset-bottom)); left: 50%; translate: -50% 0; display: flex; gap: 4px; }
#dots button { width: 24px; height: 24px; border: 0; background: none; padding: 0; display: grid; place-items: center; }
#dots button::before { content: ''; width: 11px; height: 11px; border-radius: 50%; border: 1px solid var(--gold); opacity: .75; transition: background .3s, transform .3s; }
#dots button.on::before { background: var(--gold); opacity: 1; transform: scale(1.15); }
.grownups { position: fixed; z-index: 20; right: 16px; bottom: max(14px, env(safe-area-inset-bottom)); color: var(--cream); opacity: .8; font-size: 13px; font-style: italic; text-decoration: none; text-shadow: 0 1px 6px #000c; }
.grownups:hover { opacity: 1; text-decoration: underline; }
.noscript { position: fixed; z-index: 99; inset: auto 16px 16px; padding: 16px; border-radius: 8px; background: var(--cream); color: var(--ink); }
.noscript a { color: var(--plum); }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  #top { padding: max(10px, env(safe-area-inset-top)) 12px 10px; } .brand { font-size: 19px; }
  #top nav { gap: 6px; } #top nav a, #top nav button { padding: 6px 10px; font-size: 13px; } #sound .lbl { display: none; }
  .title { left: 6vw; right: 6vw; top: auto; bottom: 9vh; }
  .title::before { inset: -14% -10% -10% -10%; }
  .title .big { font-size: 19vw; } .title .sub { font-size: 16px; } .cta { font-size: 17px; padding: 12px 22px; }
  .platebox { inset: -2%; width: 104%; height: 104%; }
  .par { transform: none; }
  #speech { left: 8px; right: 8px; translate: none; width: auto; bottom: calc(10px + env(safe-area-inset-bottom)); padding: 20px 16px 14px; }
  #speech .line { font-size: 16.5px; min-height: 4.8em; }
  .moves button, #askname button { font-size: 15px; padding: 9px 14px; }
  #askname input { min-width: 0; width: 100%; font-size: 16px; }
  .gallery { top: 92px; left: 0; right: 0; translate: none; padding: 0 10px 12px; overflow-x: auto; gap: 12px; scroll-snap-type: x mandatory; } .frame { flex: none; width: 46vw; scroll-snap-align: center; }
  #shelf { top: 46%; width: 96vw; } .case { padding: 14px 10px 10px; } .row { min-height: 170px; overflow-x: auto; justify-content: flex-start; }
  .book { flex: none; width: 46px; height: 160px; } .book.live { width: 66px; height: 176px; } .spine { font-size: 12px; } .shelf-note { font-size: 14px; padding: 0 10px; }
  body.painted-bookcase #shelf { right: 8px; left: 8px; width: auto; top: 84px; } body.painted-bookcase #shelf .asleep { flex-direction: row; flex-wrap: wrap; gap: 2px 4px; }
  body.painted-bookcase #shelf .book.dream { padding: 3px 6px; } body.painted-bookcase #shelf .book.dream .spine { font-size: 12px; } body.painted-bookcase #shelf .shelf-note { display: none; } body.painted-bookcase .dream-head { margin-bottom: 2px; }
  #openbook { place-items: end center; } .book3d { grid-template-columns: 1fr; overflow: auto; max-height: 92vh; width: 100vw; min-height: 0; overscroll-behavior: contain; }
  .page { padding: 26px 22px; } .page.left, .page.right { border-radius: 0; } .page.left { border-radius: 14px 14px 0 0; } .cover { display: none; }
  .page h2 { font-size: 34px; } .first { font-size: 17px; } .dc { font-size: 58px; }
  .begin { display: block; text-align: center; }
  .begin-float { display: block; position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); margin: 0 18px 12px; text-align: center; text-decoration: none; padding: 14px; border-radius: 99px; font-size: 19px; font-style: italic; color: #fff7e0; background: linear-gradient(#25a364, #12643a); box-shadow: 0 10px 26px rgba(0,0,0,.5), inset 0 0 0 2px #e7c35f; z-index: 3; } .close-book { position: static; display: block; margin: 14px auto 0; }
  #dots { bottom: auto; top: calc(48px + env(safe-area-inset-top)); } .grownups { right: 12px; top: calc(76px + env(safe-area-inset-top)); bottom: auto; font-size: 12px; }
  body:not([data-scene="0"]):not([data-scene="6"]) .grownups { display: none; }
  #lightbox img { max-width: 96vw; border-width: 6px; } #lightbox p { font-size: 16px; padding: 0 14px; }
  .note { font-size: 15px; }
}
/* small phones and phones held sideways */
@media (max-height: 560px) {
  .title { top: 64px; bottom: auto; } .title .big { font-size: clamp(48px, 14vh, 96px); } .title .sub { margin: 6px 0; } .kicker { margin: 0; }
  #speech { bottom: 8px; padding: 16px 18px 10px; } #speech .line { min-height: 0; font-size: 15.5px; line-height: 1.45; margin: 8px 0 6px; }
  .moves button, #askname button { min-height: 38px; padding: 6px 14px; }
  .gallery { top: 58px; } .frame { width: clamp(90px, 14vw, 140px); }
  body.painted-bookcase #shelf { top: 58px; width: min(400px, 44vw); } body.painted-bookcase #shelf .asleep { display: grid; grid-template-columns: 1fr 1fr; gap: 0 6px; } body.painted-bookcase .dream-head { grid-column: 1 / -1; } body:not([data-scene="0"]) #dots, body:not([data-scene="0"]) .grownups { display: none; } body.painted-bookcase #shelf .book.dream { padding: 2px 5px; } body.painted-bookcase #shelf .book.dream .spine { font-size: 12px; } body.painted-bookcase #shelf .shelf-note { display: none; }
  .book3d { min-height: 0; max-height: 94vh; overflow: auto; overscroll-behavior: contain; } .page { padding: 20px 28px; } .page h2 { font-size: 30px; } .first { font-size: 16px; line-height: 1.55; } .blurb { font-size: 15px; } .dc { font-size: 52px; } .begin { margin-top: 14px; font-size: 18px; padding: 11px 24px; } .close-book { position: static; display: block; margin: 8px 0 0 auto; } .cover { display: none; }
}
@media (max-width: 760px) and (max-height: 700px) { .title .big { font-size: 17vw; } #speech { padding: 18px 14px 10px; } #speech .line { font-size: 15.5px; line-height: 1.5; min-height: 0; margin: 8px 0 6px; } .moves button, #askname button { min-height: 40px; padding: 7px 13px; } .note { font-size: 14.5px; padding: 12px 14px 10px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .platebox { animation: none !important; } .wash { display: none; }
}
