@font-face { font-family: "Great Vibes"; src: url("../fonts/great-vibes-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("../fonts/cormorant-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("../fonts/cormorant-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Cormorant"; src: url("../fonts/cormorant-400i.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

:root {
  --orange: #f08a3c;
  --peach: #ffb37a;
  --burnt: #a85a2a;
  --cream: #f3e6cf;
  --night: #0d0806;
  --wood: #2a1a10;
  --gold: #c9a45c;
  --dusty: #7d97a8;
  --serif: "Cormorant", Georgia, serif;
  --script: "Great Vibes", cursive;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--night);
  color: var(--cream);
  font-family: var(--serif);
  font-size: 18px;
  overflow: hidden;
}

#room { position: fixed; inset: 0; overflow: hidden; cursor: grab; touch-action: none; }
#room.drag { cursor: grabbing; }
#pano {
  position: absolute; top: 50%; left: 0; height: 112vh; aspect-ratio: 6336 / 2688;
  background: var(--wood) url("../img/library/room-1600.jpg") center / cover no-repeat;
  transform-origin: center; will-change: transform;
}
#pano-near {   /* twin of #pano for the nearest layers (room.js); above #room::after's shade */
  position: absolute; z-index: 1; top: 50%; left: 0; height: 112vh; aspect-ratio: 6336 / 2688;
  transform-origin: center; will-change: transform; pointer-events: none;
}
/* One plant at the lens (plants.js leans it from its base, which sits below the screen) */
.plant { position: absolute; background: center / 100% 100% no-repeat; transform-origin: 50% 100%; will-change: transform; }
.plant.hang { transform-origin: 50% 0; }   /* the ivy hangs from the top edge */
#pano::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at 50% 55%, transparent 40%, rgba(13, 8, 6, 0.65));
}

/* Parallax layers (room.js): far window, room, armchair + cushions. They only translate; alpha lives in the files. */
.layer {
  position: absolute; inset: 0; pointer-events: none; will-change: transform;
  background: center / 100% 100% no-repeat;
}
.layer[data-layer="mid"] { will-change: auto; }   /* it never moves */
/* Depth by focus: the back of the round room (window bay, far shelves, high gallery) is a soft,
   faintly hazy copy of the room, faded in from the middle; the sides and the furniture stay sharp. */
.soft-back {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.4;   /* a light touch: mostly the sharp room, just softened */
  background: url("../img/library/room-mid-soft-1600.webp") center / 100% 100% no-repeat;
  -webkit-mask-image: radial-gradient(ellipse 22% 44% at 50% 38%, #000 35%, transparent 100%);
          mask-image: radial-gradient(ellipse 22% 44% at 50% 38%, #000 35%, transparent 100%);
}
.layer[data-layer="far"] { filter: blur(0.8px); }   /* the view out of the window is furthest of all */
.layer .light { pointer-events: auto; }
.dust { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* Flickering flames over the painted candles and fire (drawn by fx.js) */
.flame { position: absolute; transform: translate(-50%, -50%); pointer-events: none; }
.flame.fire { transform: translate(-50%, -62%); mix-blend-mode: screen; }   /* one element: brightens the painted fire, never greys it */
.fire-glow {
  position: absolute; width: 34%; aspect-ratio: 1; transform: translate(-50%, -50%); pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 150, 60, 0.22), rgba(255, 120, 40, 0.08) 55%, transparent);
}

.light {
  position: absolute; z-index: 2; transform: translate(-50%, -50%);
  background: none; border: 0; padding: 8px; cursor: pointer;
  color: var(--cream); font-family: var(--serif); text-align: center;
}
/* Each stop is drawn like her Book Review posts: a twinkling gold star on the spot,
   and a short name with a hand-drawn arrow curling up to it, from a different side for each stop */
.light { padding: 6px; }
.light i {
  position: relative; display: block; width: 42px; height: 42px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M20 2.5C21.2 13 25.5 17.6 37 19.6 25.6 21.8 21.4 26.4 19.6 37.5 18.4 26.6 14 22 3 20.2 14.3 18.2 18.6 13.4 20 2.5Z' fill='%23f6c766' stroke='%23d98a2b' stroke-width='1.2' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 0 8px rgba(255, 190, 90, 0.85));
  animation: twinkle 3s ease-in-out infinite;
}
.light.main i { width: 58px; height: 58px; }
.light[data-stop="shelves"] i { animation-delay: -1s; }
.light[data-stop="authors"] i { animation-delay: -2s; }
/* Two tiny sparkles beside each star */
.light i::before, .light i::after {
  content: ""; position: absolute; width: 9px; height: 9px;
  background: inherit; background-size: contain; opacity: 0.85;
  animation: twinkle 2.2s ease-in-out infinite reverse;
}
.light i::before { left: -14px; top: -6px; }
.light i::after { right: -12px; bottom: -8px; width: 7px; height: 7px; animation-delay: -1.1s; }
@keyframes twinkle {
  0%, 100% { scale: 1; rotate: 0deg; opacity: 1; }
  50% { scale: 0.82; rotate: 12deg; opacity: 0.8; }
}
.light:hover i, .light:focus-visible i { animation-duration: 0.8s; filter: drop-shadow(0 0 14px rgba(255, 200, 100, 1)); }

.light span {
  position: absolute; white-space: nowrap;
  font: italic 500 22px/1 var(--serif); letter-spacing: 0.01em; color: #fffaf0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95), 0 0 14px rgba(0, 0, 0, 0.9), 0 0 4px rgba(0, 0, 0, 0.8);
  transition: color 0.3s ease;
}
.light span::before {
  content: ""; position: absolute; width: 44px; height: 40px; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 40' fill='none' stroke='%23fffaf0' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M38 34C31 33.5 24 30 17 22.5 13.5 18.5 10.5 13 8.6 6.5'/%3E%3Cpath d='M4.6 12.4 8.4 5.8 14 10.6'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.9));
}
.light.main span { font-size: 28px; }
.light:hover span, .light:focus-visible span { color: #ffd9a8; }
/* About Jenni: from below right */
.light[data-stop="about"] span { left: calc(50% + 32px); top: calc(100% + 28px); }
.light[data-stop="about"] span::before { left: -40px; top: -36px; }
/* Her Shelves: from below left (the arrow flipped sideways) */
.light[data-stop="shelves"] span { right: calc(50% + 36px); top: calc(100% + 30px); }
.light[data-stop="shelves"] span::before { right: -40px; top: -36px; scale: -1 1; }
/* For Authors: from above left (the arrow flipped both ways), so it does not copy Her Shelves */
.light[data-stop="authors"] span { right: calc(50% + 36px); bottom: calc(100% + 28px); }
.light[data-stop="authors"] span::before { right: -40px; bottom: -36px; scale: -1 -1; }
@media (max-width: 700px) {
  .light span { font-size: 19px; }
  .light.main span { font-size: 23px; }
  /* Phone: the bigger title sits where the For Authors name would be, so it goes below the star instead */
  .light[data-stop="authors"] span { bottom: auto; top: calc(100% + 28px); }
  .light[data-stop="authors"] span::before { bottom: auto; top: -36px; scale: -1 1; }
}

.turn {
  position: fixed; top: 50%; z-index: 6; transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 50%;
  border: 1px solid rgba(255, 179, 122, 0.8); background: rgba(13, 8, 6, 0.78);
  color: var(--peach); font: 30px/1 var(--serif); cursor: pointer;
  box-shadow: 0 0 18px rgba(240, 138, 60, 0.35);
}
/* hover only on a real pointer, so a tapped arrow on a phone does not stay orange */
@media (hover: hover) { .turn:hover { background: rgba(240, 138, 60, 0.9); color: var(--night); } }
.turn.l { left: 18px; }
.turn.r { right: 18px; }
@media (max-width: 700px) {
  .turn { top: auto; bottom: max(24px, env(safe-area-inset-bottom)); transform: none; }
  /* The arrow names the next stop: a pill, not a circle */
  .turn {
    width: auto; height: 46px; padding: 0 16px; border-radius: 99px; display: inline-flex; align-items: center; gap: 8px;
    font: 500 17px/1 var(--serif);
  }
  .turn b { font: 26px/1 var(--serif); }
  .turn[data-empty] { opacity: 0; pointer-events: none; }
}
body.open .crest-head, body.open .turn, body.open .to-woods, body.open .quick { opacity: 0; pointer-events: none; }
.crest-head, .turn, .to-woods, .quick, .light {
  transition: opacity 0.8s var(--ease) var(--d, 0s), translate 1s var(--ease) var(--d, 0s);
}
body.open .crest-head, body.open .turn, body.open .to-woods, body.open .quick { --d: 0s; transition-duration: 0.4s; }
/* Arrival chain: title, then the lights one by one, then the buttons — each starts before the last ends */
.crest-head { --d: 0.25s; }
.light[data-stop="about"] { --d: 0.55s; }
.light[data-stop="shelves"] { --d: 0.7s; }
.light[data-stop="authors"] { --d: 0.85s; }
.turn, .to-woods, .quick { --d: 1s; }
body.arriving .crest-head, body.arriving .turn, body.arriving .to-woods, body.arriving .quick, body.arriving .light { opacity: 0; translate: 0 14px; }
#veil {
  position: fixed; inset: 0; z-index: 25; background: var(--night); pointer-events: none;
  transition: opacity 1.2s ease;
}
body:not(.arriving) #veil { opacity: 0; }
#room { transition: filter 0.6s var(--ease); }
body.open #room { filter: brightness(0.7); }

/* Corner buttons: round dark-glass icons. On hover the icon fills with ember (like the hero's
   "Through the pages") and its name drops down below it with a small bounce. */
.quick { position: fixed; z-index: 6; top: max(16px, env(safe-area-inset-top)); right: clamp(20px, 4vw, 64px); }
.quick-links { display: flex; align-items: center; gap: 12px; }
.to-woods { position: fixed; z-index: 6; top: max(16px, env(safe-area-inset-top)); left: clamp(16px, 4vw, 64px); }
.ib {
  position: relative; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%;
  border: 0; cursor: pointer; color: #fffaf0; text-decoration: none;
  background: radial-gradient(circle at 50% 35%, rgba(40, 22, 12, 0.55), rgba(13, 8, 6, 0.8));
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: 0 0 0 1px rgba(255, 200, 140, 0.35) inset, 0 4px 14px rgba(0, 0, 0, 0.5);
  /* opacity + translate keep the arrival fade-in (.to-woods uses .ib directly) */
  transition: background 0.3s ease, box-shadow 0.3s ease, opacity 0.8s var(--ease) var(--d, 0s), translate 1s var(--ease) var(--d, 0s);
}
.ib svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.ib:hover, .ib:focus-visible {
  outline: none;
  background: radial-gradient(circle at 50% 30%, #f2a45a, #d0682a 55%, #8a3a14 100%);
  box-shadow: 0 0 0 1px rgba(255, 210, 160, 0.6) inset, 0 0 22px rgba(230, 120, 40, 0.55), 0 6px 16px rgba(0, 0, 0, 0.5);
}
.ib .tip {
  position: absolute; top: calc(100% + 8px); left: 50%; translate: -50% -6px; scale: 0.9;
  padding: 7px 12px 8px; border-radius: 8px; white-space: nowrap; pointer-events: none;
  font: italic 600 16px/1 var(--serif); letter-spacing: 0.01em; color: #fff4e2;
  background: linear-gradient(180deg, #d97632, #a84c1c);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45); text-shadow: 0 1px 2px rgba(60, 20, 0, 0.6);
  opacity: 0; transition: opacity 0.25s ease, translate 0.35s cubic-bezier(0.68, -0.55, 0.265, 1.55), scale 0.35s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.ib .tip::before {
  content: ""; position: absolute; top: -4px; left: 50%; width: 9px; height: 9px; translate: -50% 0; rotate: 45deg;
  background: #d97632;
}
.ib:hover .tip, .ib:focus-visible .tip { opacity: 1; translate: -50% 0; scale: 1; }
.to-woods .tip, .bc-back .tip { left: 0; translate: 0 -6px; }   /* at the screen edge: drop down to the right, not off-screen */
.to-woods .tip::before, .bc-back .tip::before { left: 22px; }
.to-woods:hover .tip, .to-woods:focus-visible .tip, .bc-back:hover .tip, .bc-back:focus-visible .tip { translate: 0 0; }
.quick .sound .tip { left: auto; right: 0; translate: 0 -6px; }
.quick .sound .tip::before { left: auto; right: 13px; translate: 0 0; }
.quick .sound:hover .tip, .quick .sound:focus-visible .tip { translate: 0 0; }
/* Music on/off: a small speaker, sound waves when on, a cross when off */
.sound i {
  width: 22px; height: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 20' fill='none' stroke='%23fffaf0' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 7.2h3.6L11 3v14l-4.9-4.2H2.5z'/%3E%3Cpath d='M14.6 6.8c1.5 1.7 1.5 4.7 0 6.4'/%3E%3Cpath d='M17.6 4.2c3 3.2 3 8.4 0 11.6'/%3E%3C/svg%3E") center / contain no-repeat;
}
.sound.off i {
  opacity: 0.7;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 20' fill='none' stroke='%23fffaf0' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2.5 7.2h3.6L11 3v14l-4.9-4.2H2.5z'/%3E%3Cpath d='M15 7l6 6M21 7l-6 6'/%3E%3C/svg%3E");
}
/* Waiting for a first tap (the browser blocked sound): a soft slow glow round the button */
.sound.waiting { animation: sound-wait 2.4s ease-in-out infinite; }
@keyframes sound-wait { 50% { box-shadow: 0 0 0 1px rgba(255, 210, 160, 0.7) inset, 0 0 18px rgba(255, 190, 90, 0.85), 0 4px 14px rgba(0, 0, 0, 0.5); } }
@media (prefers-reduced-motion: reduce) {
  .sound.waiting { animation: none; box-shadow: 0 0 0 1px rgba(255, 210, 160, 0.7) inset, 0 0 14px rgba(255, 190, 90, 0.8); }
  .ib .tip { transition: opacity 0.2s ease; }
}
/* Touch screens have no hover: no names popping up after a tap */
/* icon labels switched off (Mark, 2026-10-26); aria-label still names each icon */
.ib .tip { display: none; }
/* Phone: a little smaller and higher, clear of the title */
@media (max-width: 700px) {
  .ib { width: 40px; height: 40px; }
  .ib svg { width: 18px; height: 18px; }
  .quick-links { gap: 8px; }
  .quick { top: max(8px, env(safe-area-inset-top)); right: 10px; }
  .to-woods { top: max(8px, env(safe-area-inset-top)); left: 10px; }
}
.night-fade { position: fixed; inset: 0; z-index: 999; background: var(--night); opacity: 0; pointer-events: none; transition: opacity 0.9s ease; }
.night-fade.on { opacity: 1; pointer-events: auto; }
/* About / For Authors: a card in the middle of the screen that grows out of the light you clicked
   (--px/--py: that light, in the card's own box) and shrinks back into it on close */
#panel {
  position: fixed; z-index: 30; left: 50%; top: 50%; translate: -50% -50%;
  width: min(680px, 100vw - 32px); max-height: min(86vh, 900px);
  padding: 48px 34px 50px; overflow-y: auto; line-height: 1.45;
  background: rgba(13, 8, 6, 0.95); border: 1px solid rgba(201, 164, 92, 0.45); border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.75);
  opacity: 0; transform: scale(0.12); transform-origin: var(--px, 50%) var(--py, 50%);
  transition: transform 0.45s cubic-bezier(0.55, 0, 0.75, 0.2), opacity 0.3s ease 0.15s;
}
/* No scrollbar strip: it would stop her photo short of the right edge. Wheel, trackpad and touch still scroll. */
#panel { scrollbar-width: none; }
#panel::-webkit-scrollbar { display: none; }
#panel.on {
  opacity: 1; transform: none;
  transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.35s ease;
}
/* The room blurs and dims behind the card */
body.panel-open #room { filter: brightness(0.45) blur(6px); }
#panel > * { opacity: 0; translate: 0 14px; transition: opacity 0.25s ease, translate 0.3s ease; }
#panel.on > * {
  opacity: 1; translate: 0 0;
  transition: opacity 0.5s ease calc(0.18s + var(--i, 0) * 0.05s), translate 0.6s var(--ease) calc(0.18s + var(--i, 0) * 0.05s);
}

#panel h2 { font-family: var(--script); font-weight: 400; font-size: 56px; margin: 0; color: var(--peach); }
/* Stays at the top right of the card while its text scrolls */
.x {
  position: sticky; top: -40px; z-index: 2; float: right; margin: -40px -20px 0 0;   /* top: the card padding counts as part of the sticky area */
  background: rgba(13, 8, 6, 0.55); border: 0; border-radius: 50%;   /* stays readable over her photo */
  color: var(--peach); font-size: 34px; line-height: 1; cursor: pointer;
}
/* Behind an open card or the bookcase the room rests: no light pulse */
body.open .light i, body.open .light i::before, body.open .light i::after { animation-play-state: paused; }

@media (prefers-reduced-motion: reduce) {
  .light i, .light i::before, .light i::after { animation: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; transition-delay: 0s !important; }
}

.crest-head {
  position: fixed; top: max(24px, env(safe-area-inset-top)); left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  pointer-events: none; z-index: 5;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.8);
}
/* Same lettering as the hero title, cascading down to the right like it:
   cream italic "The", glowing orange script "Zesty", cream serif "Library" */
.lib-title { margin: 0; font-weight: 400; line-height: 0.9; text-shadow: 0 2px 30px rgba(0, 0, 0, 0.55);
  display: grid; justify-items: start; }
.lib-title span { display: block; }
.lib-title .t-the { font-style: italic; font-size: clamp(33px, 3.8vw, 51px); color: var(--cream); opacity: 0.9; translate: -1.6em 0; }
.lib-title .t-zesty { font-family: var(--script); font-size: clamp(96px, 10.9vw, 157px); line-height: 0.82; color: #ff9a3c;
  margin: -0.08em 0 0.26em; translate: -0.2em 0; }
/* "Zesty" writes itself in like ink from a quill (same as the hero), once the room has faded up,
   then keeps a soft candle glow. Padding gives the glow room inside the mask. */
.lib-title .zesty-word { display: inline-block; position: relative; }
/* extra bottom padding: the mask only covers the padding box, and the "y" tail hangs well below the line */
.lib-title .zesty-ink { display: inline-block; padding: 0.12em 0.2em 0.5em; margin: -0.12em -0.2em -0.5em;
  text-shadow: 0 0 32px rgba(255, 140, 50, 0.45), 0 2px 18px rgba(0, 0, 0, 0.5); }
body:not(.arriving) .lib-title .zesty-ink { will-change: mask-position;
  animation: zesty-write 2.4s cubic-bezier(0.4, 0, 0.25, 1) 0.6s backwards, zesty-glow 5.5s ease-in-out 3s infinite; }
@keyframes zesty-write {
  from, to { -webkit-mask-image: linear-gradient(100deg, #000 45%, transparent 55%); mask-image: linear-gradient(100deg, #000 45%, transparent 55%);
             -webkit-mask-size: 200% 100%; mask-size: 200% 100%; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
  from { -webkit-mask-position: 100% 0; mask-position: 100% 0; }
  to   { -webkit-mask-position: 0 0; mask-position: 0 0; }
}
.lib-title .zesty-nib { position: absolute; left: 0; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: #fff3e0; box-shadow: 0 0 10px 4px rgba(255, 196, 120, 0.9), 0 0 28px 10px rgba(255, 140, 50, 0.6);
  opacity: 0; pointer-events: none; }
body:not(.arriving) .lib-title .zesty-nib {
  animation: zesty-nib 2.4s cubic-bezier(0.4, 0, 0.25, 1) 0.6s, zesty-nib-wave 0.6s ease-in-out 0.6s 4 alternate; }
@keyframes zesty-nib { 0% { left: 2%; opacity: 0; } 6% { opacity: 1; } 90% { opacity: 1; } 100% { left: 98%; opacity: 0; } }
@keyframes zesty-nib-wave { from { translate: 0 0.12em; } to { translate: 0 -0.12em; } }
@keyframes zesty-glow {
  0%, 100% { text-shadow: 0 0 32px rgba(255, 140, 50, 0.45), 0 2px 18px rgba(0, 0, 0, 0.5); }
  18%      { text-shadow: 0 0 40px rgba(255, 150, 60, 0.62), 0 2px 18px rgba(0, 0, 0, 0.5); }
  31%      { text-shadow: 0 0 30px rgba(255, 135, 45, 0.4),  0 2px 18px rgba(0, 0, 0, 0.5); }
  52%      { text-shadow: 0 0 46px rgba(255, 160, 70, 0.7),  0 2px 18px rgba(0, 0, 0, 0.5); }
  70%      { text-shadow: 0 0 34px rgba(255, 140, 50, 0.5),  0 2px 18px rgba(0, 0, 0, 0.5); }
}
/* fireflies that now and then drift up off the letters (added by main.js) */
.zesty-ember { position: absolute; width: 4px; height: 4px; margin: -2px; border-radius: 50%; pointer-events: none;
  background: #ffe2b8; box-shadow: 0 0 6px 2px rgba(255, 170, 80, 0.85), 0 0 16px 5px rgba(255, 130, 40, 0.4);
  animation: zesty-ember var(--t, 3.4s) ease-out forwards; }
@keyframes zesty-ember {
  0%   { opacity: 0; transform: translate(0, 0) scale(0.6); }
  15%  { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx, 20px), var(--dy, -70px)) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  body:not(.arriving) .lib-title .zesty-ink, body:not(.arriving) .lib-title .zesty-nib { animation: none; }
  .zesty-ember { display: none; }
}
.lib-title .t-lib { font-size: clamp(48px, 5.45vw, 78px); letter-spacing: -0.01em; color: var(--cream); translate: 1.4em 0; }

#sparks { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }

/* Arriving from the film (js/library/arrival.js): its last frame where the film left it, on the film's
   dark bars; .go grows it to where the room shows the same picture while the bars and then the frame fade. */
#arrival {
  position: fixed; inset: 0; z-index: 20; pointer-events: none;
  background-color: var(--night);
  transition: background-color 1s ease;
}
#arrival.go { background-color: transparent; }
.arrival-frame {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  background: center / 100% 100% no-repeat;
  transition: transform 1.4s cubic-bezier(0.45, 0, 0.2, 1), opacity 0.9s ease 0.6s;
}
#arrival.go .arrival-frame { opacity: 0; }

/* The film's page change crossfades (index.html opts in only for the film's end; js/flight.js) */
@view-transition { navigation: auto; }
::view-transition-group(root) { animation-duration: 0.35s; }

/* Thin gold sword-hilt divider for panel sections */
.hilt {
  position: relative; height: 1px; margin: 28px auto; width: min(320px, 80%);
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}
.hilt::before {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 9px; height: 9px; transform: translate(-50%, -50%) rotate(45deg);
  border: 1px solid var(--gold); background: var(--night);
}

[hidden] { display: none !important; }

/* ---------- Bookcase ---------- */
#bookcase {
  position: fixed; inset: 0; z-index: 30;
  display: flex; flex-direction: column;
  /* Clear at first: the miniature bookcase grows over the room itself, then the blurred room fades in behind it.
     The bookcase grows out of the shelves light (.bc-body, animated in bookcase.js). */
}
#bookcase:not(.on) .bc-body { opacity: 0; }   /* nothing shows until the grow-in starts */
#bookcase .bc-wall { opacity: 0; transition: opacity 0.35s ease 0.1s; }
#bookcase.on .bc-wall { opacity: 1; transition: opacity 0.6s ease 0.15s; }
/* Crown + case: grows from a miniature at the light (animated in bookcase.js) */
.bc-body { transform-origin: 0 0; }
/* The search and shelf buttons arrive once the bookcase is nearly open */
#bookcase .bc-top { opacity: 0; transition: opacity 0.2s ease; }
#bookcase.on .bc-top { opacity: 1; transition: opacity 0.5s ease 0.55s; }
.bc-top {
  /* Floats over the scene; the bookcase scrolls up underneath it to the top of the screen */
  position: absolute; top: 0; left: 0; right: 0; z-index: 3; text-align: center;
  padding: 16px 20px 26px; pointer-events: none;
  background: linear-gradient(rgba(10, 6, 4, 0.6), rgba(10, 6, 4, 0.25) 65%, rgba(10, 6, 4, 0));
}
.bc-top > * { pointer-events: auto; }
/* The bookcase pops out over the room, which stays still behind it, blurred and dark (pre-blurred picture, no filter) */
.bc-wall {
  position: absolute; inset: 0; z-index: 0;
  background: url("../img/library/room-blur.jpg") center / cover no-repeat;
}
#bookcase { timeline-scope: --bcscroll; }
@supports (animation-timeline: scroll()) {
  .bc-scroll { scroll-timeline: --bcscroll y; }
  /* The title fades as it slides up under the floating shelf buttons */
  .bc-crown h2 { animation: title-out linear both; animation-timeline: --bcscroll; animation-range: 40px 200px; }
}
@keyframes title-out { to { opacity: 0; } }
.bc-top h2 { font-family: var(--script); font-weight: 400; font-size: clamp(38px, 5vw, 56px); margin: 0 0 8px; line-height: 1; color: var(--peach); }
/* Back link top left, the same corner as the room's */
.bc-corners {
  position: absolute; top: 16px; left: clamp(16px, 4vw, 64px); right: clamp(20px, 4vw, 64px); z-index: 2;
  display: flex; align-items: center; pointer-events: none;
}
.bc-corners > * { pointer-events: auto; }
/* Below 1100px the link would touch the search line, so it gets its own row */
@media (max-width: 1100px) {
  .bc-corners { position: relative; top: auto; left: auto; right: auto; margin-bottom: 8px; }
}
#bc-search {
  /* written on a ruled line: no box, just a thin line under the words */
  width: min(560px, 100%); padding: 10px 4px 10px 32px; border-radius: 0;
  border: 0; border-bottom: 1px solid rgba(255, 196, 143, 0.6); outline: none;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%23f08a3c' stroke-width='2'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='M13 13l4 4'/%3E%3C/svg%3E") 4px center no-repeat;
  color: var(--cream); font: italic 20px var(--serif);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9);
}
/* Focus thickens the line instead of drawing a box */
#bc-search:focus, #bc-search:focus-visible { outline: none; box-shadow: none; border-bottom: 1.5px solid var(--orange); }
#bc-search::placeholder { color: rgba(255, 250, 240, 0.55); }
#bc-count { font-size: 15px; opacity: 0.8; margin-top: 6px; min-height: 20px; }
/* Shelf names in plain italic with small gold stars between them, like the stars in the room */
.bc-jump { display: flex; gap: 4px 0; justify-content: center; flex-wrap: wrap; margin-top: 10px; }
.bc-jump button {
  padding: 0 14px; cursor: pointer; border: 0; background: none;
  font: italic 500 19px/1 var(--serif); letter-spacing: 0.01em; color: #fffaf0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.95), 0 0 14px rgba(0, 0, 0, 0.9);
  transition: color 0.3s ease;
}
.bc-jump button + button::before {
  content: ""; width: 11px; height: 11px; margin: 0 22px 0 -21px; flex: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cpath d='M20 2.5C21.2 13 25.5 17.6 37 19.6 25.6 21.8 21.4 26.4 19.6 37.5 18.4 26.6 14 22 3 20.2 14.3 18.2 18.6 13.4 20 2.5Z' fill='%23f6c766' stroke='%23d98a2b' stroke-width='1.2' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
  filter: drop-shadow(0 0 4px rgba(255, 190, 90, 0.7));
}
.bc-jump button.on, .bc-jump button:hover { color: #ffd9a8; }
/* Once you scroll, a dark blurred band fades in behind the header so it stays readable over the books */
.bc-top::before {
  content: ""; position: absolute; inset: 0 0 -28px; z-index: -1; pointer-events: none;
  background: linear-gradient(rgba(10, 6, 4, 0.94), rgba(10, 6, 4, 0.86) 72%, rgba(10, 6, 4, 0));
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  -webkit-mask-image: linear-gradient(#000 72%, transparent); mask-image: linear-gradient(#000 72%, transparent);
  opacity: 0; transition: opacity 0.4s ease;
}
#bookcase.compact .bc-top::before { opacity: 1; }
.bc-scroll {
  position: absolute; inset: 0; z-index: 1; overflow-y: auto; overflow-x: hidden;
  padding-top: var(--bc-top-h, 150px);
}
.bc-crown {
  --cw: min(1100px, 70vw, 100% - 120px);
  position: relative; width: var(--cw); margin: calc(var(--cw) * 0.055) auto -1px;   /* top margin: room for the branch over the arch */
  aspect-ratio: 1840 / 703;   /* trimmed so its carved posts sit exactly on the bookcase posts */
  background: url("../img/library/crown.webp?v=4") 0 0 / 100% 100% no-repeat;
  z-index: 8;   /* above the case posts, so the roots can hang down over them */
}
/* Old tree branches growing over the carved top; the roots hang down past the first shelf */
.bc-crown::after {
  content: ""; position: absolute; pointer-events: none;
  left: -4.946%; top: -13.94%; width: 110.217%; aspect-ratio: 2028 / 1477;
  background: url("../img/library/crown-wood.webp?v=2") 0 0 / 100% 100% no-repeat;
}
.bc-crown h2 {
  position: absolute; left: 50%; top: 73%; translate: -50% -50%; margin: 0; white-space: nowrap;
  font-family: var(--script); font-weight: 400; font-size: clamp(26px, 4.4vw, 58px); line-height: 1;
  color: var(--peach); text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9), 0 0 22px rgba(240, 138, 60, 0.45);
}
.bc-case {
  position: relative; width: min(1100px, 70vw, 100% - 120px); margin: 0 auto 60px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(0, 0, 0, 0.6);
  padding: 0 var(--post-w, 0);
  background: #120b07;
}
/* One carved post down each side of the whole bookcase */
.bc-case::before, .bc-case::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: var(--post-w, 0); z-index: 7;
  background: url("../img/library/post.jpg") 0 0 / 100% var(--post-tile, 100%) repeat-y;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.7);
}
.bc-case::before { left: 0; }
.bc-case::after { right: 0; transform: scaleX(-1); }

.lvl { overflow: visible; }
.plank {
  position: relative; width: 100%;
  background: url("../img/library/shelf-inner.jpg?v=3") 0 0 / 100% 100% no-repeat;
}
.plank::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 5;
  background: linear-gradient(90deg, rgba(5, 3, 2, 0.45), rgba(5, 3, 2, 0.08) 18%, transparent 50%, rgba(5, 3, 2, 0.08) 82%, rgba(5, 3, 2, 0.45));
}
.lvl-plaque {
  /* Engraved brass plate (photo) screwed to the front edge of the shelf above. The plate's
     two ends keep their shape (border-image); only the plain middle stretches to fit the name. */
  --ph: calc(var(--plank-h, 270px) * 0.085);
  position: absolute; left: 50%; top: calc(var(--plank-h, 270px) * -0.0925); z-index: 6; translate: -50% 0;
  display: flex; align-items: center; box-sizing: border-box; height: var(--ph);
  border-style: solid; border-width: 0 calc(var(--ph) * 0.35) 0 calc(var(--ph) * 1.13);
  border-image-slice: 0 70 0 225 fill; border-image-repeat: stretch;
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.55);
  border-radius: calc(var(--ph) * 0.2);
}
/* The top shelf's plate sits on the carved top's lower edge: lift it above the crown (z-index 8) */
.lvl:first-of-type .lvl-plaque { z-index: 9; }
.lvl-plaque span {
  padding: 0 0.3em 0 0.1em; white-space: nowrap;
  font: 600 calc(var(--plank-h, 270px) * 0.036)/1 var(--serif); letter-spacing: 0.08em; text-transform: uppercase;
  color: #3b2410; text-shadow: 0 1px 0 rgba(255, 232, 180, 0.45);
}

.row { position: absolute; bottom: 11.4%; height: 80%; display: flex; align-items: flex-end; gap: 2px; }
.bk {
  position: relative; flex: 0 0 auto; padding: 0; border: 0; cursor: pointer;
  background: transparent no-repeat 0 0 / 100% 100%;
  /* box-shadow, not filter: ~150 filtered books could not be redrawn fast enough on a quick scroll */
  box-shadow: -5px 0 6px rgba(0, 0, 0, 0.6), 0 3px 3px rgba(0, 0, 0, 0.5);
  transform-origin: bottom center;
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.35s, opacity 0.35s;
}
.bk::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.45), transparent 22%, rgba(255, 220, 170, 0.1) 55%, transparent 70%, rgba(0, 0, 0, 0.4));
}
.bk .t {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%; rotate: 90deg;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-family: var(--serif); font-weight: 500; text-transform: uppercase;
  background: linear-gradient(180deg, #fff1c8, #e0bb6e 45%, #b08840 60%, #f6dc9c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.bk:hover, .bk:focus-visible {
  transform: translateY(-4%); outline: none;
  box-shadow: -5px 0 6px rgba(0, 0, 0, 0.6), 0 0 14px rgba(240, 138, 60, 0.6);
}
.bk.pulled { z-index: 4; box-shadow: -5px 0 6px rgba(0, 0, 0, 0.6), 0 0 16px rgba(240, 138, 60, 0.7); }
.bk.lean { transform: rotate(-8deg); transform-origin: bottom left; margin-left: 1.2%; }
.searching .bk { opacity: 0.2; }
.searching .bk.hit {
  opacity: 1; transform: translateY(-9%);
  filter: brightness(1.4) drop-shadow(0 0 6px #ffb37a) drop-shadow(0 0 22px #f08a3c) drop-shadow(0 0 44px rgba(240, 138, 60, 0.85));
}

/* ---------- Book card ---------- */
#bookcard {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(0, 0, 0, 0.6);
}
.openbook {
  position: relative; display: flex; width: min(780px, 100%); max-height: calc(100dvh - 32px); will-change: transform;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7);
}
.bc-cover {
  position: relative; z-index: 1; flex: 0 0 38%; min-height: 380px; box-shadow: 6px 0 18px rgba(0, 0, 0, 0.45);
  border-radius: 8px 0 0 8px; border: 2px solid rgba(201, 164, 92, 0.6);
  background: #1b120c center / cover no-repeat;
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 24px;
}
.bc-cover.has-img { background-size: contain; background-color: #1b120c; }
.bc-cover::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: 6px 0 0 6px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.4), transparent 18%);
}
.bc-gold {
  position: relative; z-index: 1;
  font: 500 30px/1.05 var(--serif); text-transform: uppercase; letter-spacing: 0.06em;
  background: linear-gradient(180deg, #fff1c8, #e0bb6e 45%, #b08840 60%, #f6dc9c);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.8));
}
.bc-by { position: relative; z-index: 1; margin-top: 10px; color: var(--gold); font-style: italic; }
.bc-board {
  /* The inside of the back cover: same leather as the book, darker, with a gold tooling line */
  position: absolute; top: 0; bottom: 0; right: 0; left: 38%; z-index: 0;
  border-radius: 0 8px 8px 0; border: 2px solid rgba(201, 164, 92, 0.6);
  background: #1b120c center / cover no-repeat;
  box-shadow: inset 0 0 0 10px rgba(13, 8, 6, 0.55), inset 0 0 0 11px rgba(201, 164, 92, 0.45), inset 0 0 60px rgba(0, 0, 0, 0.75);
  filter: brightness(0.8);
}
.bc-page {
  position: relative; z-index: 1; flex: 1; overflow-y: auto;
  background: var(--cream) url("../img/library/paper.jpg") center / cover;
  transform-origin: left center; backface-visibility: hidden;
  padding: 28px 30px; border-radius: 0 8px 8px 0;
  color: var(--wood);
}
.bc-close { position: absolute; top: 6px; right: 12px; background: none; border: 0; font-size: 30px; cursor: pointer; color: var(--burnt); }
.bc-shelf { font: 600 13px var(--serif); letter-spacing: 0.16em; text-transform: uppercase; color: var(--burnt); }
.bc-arc {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 10px;
  background: var(--orange); color: var(--night); letter-spacing: 0.1em;
}
.bc-page h3 { font: 500 34px/1.05 var(--serif); margin: 8px 0 2px; }
.bc-author { font-style: italic; opacity: 0.8; margin-bottom: 10px; }
.bc-stars { font-size: 20px; letter-spacing: 2px; }
.bc-spice { font-size: 18px; margin-top: 2px; }
.bc-review { display: block; margin: 14px 0; font-style: italic; font-size: 22px; line-height: 1.25; }
/* Tropes read like a book's index: italic words with a dot between, no chips */
.bc-tropes { margin: 10px 0 4px; font-style: italic; font-size: 17px; line-height: 1.5; opacity: 0.85; }
.bc-tropes span { white-space: nowrap; }
/* A series kept as one book: its books, in reading order */
.bc-series { margin: 10px 0 4px; }
.bc-series span { font: 600 13px var(--serif); letter-spacing: 0.16em; text-transform: uppercase; color: var(--burnt); }
.bc-series ol { margin: 4px 0 0; padding-left: 1.4em; font-style: italic; font-size: 17px; line-height: 1.45; }
.bc-tropes span + span::before { content: "·"; margin: 0 0.5em; font-style: normal; color: var(--orange); }
.bc-post {
  display: inline-block; margin-top: 16px; padding: 12px 20px; border-radius: 4px;
  background: var(--orange); color: var(--night); text-decoration: none;
  font: 600 13px/1 var(--serif); letter-spacing: 0.18em; text-transform: uppercase;
}
.bc-post:hover { background: var(--peach); }
@media (max-width: 640px) {
  .openbook { flex-direction: column; }
  .bc-cover { flex: 0 0 auto; min-height: 0; height: 34vh; border-radius: 8px 8px 0 0; }
  .bc-board { left: 0; top: 34vh; border-radius: 0 0 8px 8px; }
  .bc-page { transform-origin: center top; }
  .bc-page { border-radius: 0 0 8px 8px; padding: 22px 20px; }
  .bc-review { font-size: 19px; }
}


/* ---------- Panels ---------- */
/* Her photo fills the top of the card, edge to edge, and fades into the dark */
.card-hero { position: relative; margin: -48px -34px 6px; height: 380px; }
/* Absolute, so the floated close button cannot push the photo down */
.card-hero img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; border-radius: 13px 13px 0 0; }
.card-hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(13, 8, 6, 0) 35%, rgba(13, 8, 6, 0.6) 70%, rgb(13, 8, 6) 100%);
}
#panel .card-hero h2 { position: absolute; z-index: 1; left: 32px; right: 24px; bottom: 0; margin: 0; font-size: 68px; line-height: 0.95; text-shadow: 0 2px 20px rgba(0, 0, 0, 0.6); }
#panel p { margin: 0 0 12px; }
#panel a { color: var(--peach); }
#panel .big { font-size: 22px; line-height: 1.45; }
#panel .num { color: var(--orange); font-weight: 500; }
#panel .dear { font: 40px/1 var(--script); color: var(--orange); margin: 4px 0 10px; }
/* The script J curls far out to the left: indent it so the card edge never cuts it */
#panel .signoff { font: 54px/1 var(--script); color: var(--peach); margin: 14px 0 0; padding-left: 0.45em; }
.strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 22px 0; }
.strip img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; filter: saturate(0.9) sepia(0.12); }
.ps { border-top: 1px dashed rgba(255, 179, 122, 0.35); margin-top: 22px; padding-top: 14px; }
.ps > b { font: 400 32px/1 var(--script); color: var(--orange); margin-right: 6px; }
.rate-key { list-style: none; padding: 0; margin: 6px 0 0; }
.rate-key li { display: flex; gap: 12px; align-items: baseline; margin: 6px 0; }
.rate-key span { flex: 0 0 28px; font-size: 20px; }
/* ARC covers in a row, each one links to her post */
.arc-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; margin-top: 10px; }
.arc-list a { display: block; transition: transform 0.3s var(--ease); }
.arc-list a:hover { transform: translateY(-4px); }
.arc-list img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 3px; box-shadow: 0 6px 14px rgba(0, 0, 0, 0.55); }
.contact { display: flex; flex-wrap: wrap; gap: 10px; margin: 6px 0 18px; }
/* Same shape as "See her post": small caps, slightly rounded corners */
.btn {
  display: inline-block; padding: 12px 20px; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--orange); background: var(--orange); color: var(--night) !important;
  font: 600 13px/1 var(--serif); letter-spacing: 0.18em; text-transform: uppercase; text-decoration: none;
}
.btn.email { background: none; color: var(--peach) !important; }
.btn:hover { background: var(--peach); border-color: var(--peach); color: var(--night) !important; }
@media (max-width: 700px) {
  #panel { padding: 56px 20px 50px; width: calc(100vw - 24px); max-height: calc(100dvh - 24px); }
  .card-hero { margin: -56px -20px 6px; height: 300px; }
  #panel .card-hero h2 { left: 20px; font-size: 54px; }
  #panel .big { font-size: 20px; }
}

/* ---------- UX pass (2026-10-20) ---------- */
/* Visible keyboard focus everywhere: an orange glow ring like the lights */
:where(a, button, input):focus-visible {
  outline: 2px solid var(--peach); outline-offset: 3px;
  box-shadow: 0 0 0 5px rgba(240, 138, 60, 0.3);
}

/* Finger-sized targets (44 px) */
.bc-jump button, .bc-clear { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
.x, .bc-close { min-width: 44px; min-height: 44px; }
#panel .links a { display: inline-block; padding: 11px 4px; }

/* Room hint */
#room-hint {
  position: fixed; z-index: 6; left: 50%; bottom: max(28px, env(safe-area-inset-bottom)); translate: -50% 10px;
  margin: 0; padding: 4px 2px; white-space: nowrap; pointer-events: none;
  font: 500 13px/1.4 var(--serif); letter-spacing: 0.2em; text-transform: uppercase; color: var(--cream);
  border-bottom: 1px solid rgba(255, 196, 143, 0.6);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 0 14px rgba(0, 0, 0, 0.8);
  opacity: 0; transition: opacity 0.6s ease, translate 0.8s var(--ease);
}
#room-hint.on { opacity: 1; translate: -50% 0; }
body.open #room-hint { opacity: 0; }
/* Phone: wrap above the stop arrows instead of running into them */
@media (max-width: 700px) { #room-hint { bottom: 90px; white-space: normal; text-align: center; width: max-content; max-width: 80vw; } }

/* Empty search */
.bc-empty {
  position: absolute; left: 50%; top: 58%; translate: -50% -50%; z-index: 8; text-align: center;
  padding: 26px 34px; border-radius: 16px;
  background: rgba(13, 8, 6, 0.88); border: 1px solid rgba(201, 164, 92, 0.5);
}
.bc-empty p { margin: 0 0 14px; font: 400 34px/1.1 var(--script); color: var(--peach); }
.bc-clear {
  padding: 0 20px; border-radius: 24px; cursor: pointer;
  border: 1px solid var(--orange); background: var(--orange); color: var(--night); font: 500 17px var(--serif);
}

/* Compact header once scrolled */


@media (max-width: 700px) {
  .crest-head { gap: 6px; top: calc(max(16px, env(safe-area-inset-top)) + 40px); }
  #room-hint { font-size: 11px; white-space: normal; border-bottom: 0; width: calc(100% - 140px); text-align: center; }
  .bc-top { padding: 10px 12px 8px; }
  .bc-crown, .bc-case { width: 100%; }
  .bc-crown { --cw: 100vw; }
  #bc-search { padding-top: 10px; padding-bottom: 10px; }
  /* one row that fades out on the right, so you can tell there is more */
  .bc-jump { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; scrollbar-width: none; margin: 8px -12px 0; padding: 0 40px 0 12px;
    -webkit-mask-image: linear-gradient(90deg, #000 80%, transparent); mask-image: linear-gradient(90deg, #000 80%, transparent); }
  .bc-jump::-webkit-scrollbar { display: none; }
  .bc-jump button { flex: 0 0 auto; font-size: 17px; padding: 0 12px; }
  .bc-jump button:first-child { padding-left: 0; }
  .bc-corners { margin-bottom: 2px; }
  #bc-search { font-size: 18px; }
  .bc-top::before { inset: 0 0 -44px; -webkit-mask-image: linear-gradient(#000 80%, transparent); mask-image: linear-gradient(#000 80%, transparent); }
}

/* ---------- Cursor: the hero's ring, grows over anything you can click (mouse only) ---------- */
html.ring-cursor, html.ring-cursor body, html.ring-cursor a, html.ring-cursor button, html.ring-cursor #room, html.ring-cursor #room.drag { cursor: none; }
.cursor {
  position: fixed; z-index: 1000; left: 0; top: 0; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%;
  border: 1.5px solid #fff; mix-blend-mode: difference; pointer-events: none; opacity: 0;
  transition: width 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), height 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), margin 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s;
}
.cursor.on { opacity: 1; }
.cursor.big { width: 50px; height: 50px; margin: -25px 0 0 -25px; }

/* Depth: the far wall sits back, the ceiling and edges fall into shadow, a haze lifts the title. */
/* 3. Back wall: darker and cooler round the window. On the room layer, under its stars and in front
   of the far window layer, so the window light itself stays bright. */
.layer[data-layer="mid"]::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 13% 34% at 50% 50%, rgba(16, 18, 30, 0.42), rgba(16, 18, 30, 0.2) 55%, transparent);
}
/* 2. Ceiling and edges: candlelit rooms go dark up high. Fixed to the screen, over the room. */
#room::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(8, 5, 4, 0.62), rgba(8, 5, 4, 0.25) 22%, transparent 42%),
    linear-gradient(to right, rgba(8, 5, 4, 0.45), transparent 16%, transparent 84%, rgba(8, 5, 4, 0.45));
}
/* 1. Haze behind the title: a soft shadow, no edge */
.crest-head::before {
  content: ""; position: absolute; z-index: -1; left: 50%; top: 50%; width: min(620px, 92vw); height: 135%;
  translate: -50% -50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(8, 5, 4, 0.55), rgba(8, 5, 4, 0.3) 55%, transparent);
}
