/* ==========================================================================
   Small Mailbox Interactive, LLC — smallmailboxinteractive.com
   Plain and quiet. No external fonts, no external requests.
   ========================================================================== */

:root {
  --bg:         #0b0a14;      /* night, matches the top of the sky */
  --paper:      #15141c;      /* footer */
  --paper-2:    #1f1e28;      /* inventory tiles */
  --ink:        #d8d4e0;
  --ink-dim:    #8e8a9c;
  --ink-faint:  #625e70;
  --line:       #2a2934;
  --accent:     #9a2c30;      /* mailbox flag red */

  --sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
          Roboto, "Helvetica Neue", Arial, sans-serif;

  --topbar-h: 124px;
  --slot: 56px;               /* inventory tile size */
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* The home page is exactly one screen tall; the inventory scrolls inside itself. */
body.home {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

a { color: inherit; }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 999;
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
}
.skip:focus { left: 12px; top: 12px; }

/* ── Top bar ─────────────────────────────────────────────────────────────── */

.topbar {
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-inline: 22px;
  padding-top: env(safe-area-inset-top, 0px);
  background: transparent;
  position: relative;
  z-index: 2;
}

/* The lockup from /logo/: mark, wordmark, LLC underneath */
.topbar__name {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  color: #d8d4e0;
  text-decoration: none;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.6);
}
.topbar__mark { width: 160px; height: auto; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6)); }

/* The envelope on the lawn is the logo and the link home */
.fallen-mail { cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; }
.fallen-mail:focus { outline: none; }
/* keyboard focus only: a soft gold edge, nothing on mouse or touch */
.fallen-mail:focus-visible rect:first-of-type { stroke: #e6c07a; }

/* ── Scene ───────────────────────────────────────────────────────────────── */

.stage {
  flex: 1 1 auto;
  min-height: 200px;
  position: relative;
  overflow: hidden;
}

.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-select: none;
}

/* Mailbox is a button */
.mailbox { cursor: pointer; outline: none; }
.mailbox:focus-visible > path:first-of-type,
.mailbox:hover > path:first-of-type { filter: brightness(1.25); }

.mailbox__door {
  transform-box: fill-box;
  transform-origin: 100% 100%;
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.mailbox.is-open .mailbox__door { transform: rotate(-70deg) scaleX(0.35); }

.mailbox__flag {
  transform-box: fill-box;
  transform-origin: 3px 48px;
  transition: transform 0.4s ease;
}
.mailbox.is-open .mailbox__flag,
.mailbox.is-empty .mailbox__flag { transform: rotate(90deg); }

/* Hint */
.hint {
  font-size: 18px;
  font-weight: 500;
  fill: #efe6cc;
  color: #efe6cc;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.8));
  letter-spacing: 0.01em;
  animation: hint-bob 1.6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 0.6s ease;
  pointer-events: none;
}
.hint.is-hidden { opacity: 0; animation: none; }
@keyframes hint-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}

/* Chimney smoke: five puffs on the same loop, staggered */
.puff {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  animation: puff 5s linear infinite;
}
.puff--1 { animation-delay: 0s; }
.puff--2 { animation-delay: 1s; }
.puff--3 { animation-delay: 2s; }
.puff--4 { animation-delay: 3s; }
.puff--5 { animation-delay: 4s; }

@keyframes puff {
  0%   { opacity: 0;    transform: translate(0, 0)      scale(0.5); }
  10%  { opacity: 0.85; }
  50%  { opacity: 0.55; transform: translate(14px, -70px) scale(1.6); }
  100% { opacity: 0;    transform: translate(40px, -150px) scale(3); }
}

/* Clouds and fog drift */
.cloud { animation: drift linear infinite alternate; }
.cloud--a { animation-duration: 140s; }
.cloud--b { animation-duration: 180s; animation-delay: -60s; }
@keyframes drift {
  from { transform: translateX(-90px); }
  to   { transform: translateX(90px); }
}
.fog { animation: fogdrift ease-in-out infinite alternate; }
.fog--far  { animation-duration: 60s; }
.fog--near { animation-duration: 45s; animation-delay: -20s; }
@keyframes fogdrift {
  from { transform: translateX(-60px); }
  to   { transform: translateX(60px); }
}

/* Stars */
.stars circle { animation: twinkle 4s ease-in-out infinite; }
.stars circle:nth-child(3n)   { animation-delay: -1.3s; animation-duration: 5s; }
.stars circle:nth-child(3n+1) { animation-delay: -2.6s; animation-duration: 6.5s; }
.stars circle:nth-child(4n)   { animation-delay: -0.7s; }
@keyframes twinkle {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 1; }
}

/* Porch light: a slightly unreliable bulb */
.porchlight { animation: flicker 7s linear infinite; }
@keyframes flicker {
  0%, 100% { opacity: 1; }
  42%  { opacity: 1; }
  43%  { opacity: 0.55; }
  44%  { opacity: 1; }
  46%  { opacity: 0.7; }
  47%  { opacity: 1; }
  81%  { opacity: 1; }
  82%  { opacity: 0.6; }
  83%  { opacity: 1; }
}

/* After the house has gone: a way back */
.restart {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  z-index: 4;
  appearance: none;
  border: 1px solid rgba(239, 230, 204, 0.35);
  border-radius: 999px;
  background: rgba(11, 10, 20, 0.55);
  color: #efe6cc;
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.06em;
  padding: 9px 18px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.2s ease, border-color 0.2s ease;
}
.restart:hover, .restart:focus-visible { background: rgba(11, 10, 20, 0.8); border-color: rgba(239, 230, 204, 0.7); outline: none; }

/* Layer that items fly through on their way to the footer */
.fly-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}
.fly {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--slot);
  height: var(--slot);
  will-change: transform;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.25));
}
.fly svg { width: 100%; height: 100%; display: block; overflow: visible; transform-origin: center; }

/* The elf waves: arm is a group inside the symbol */
.elf-arm {
  transform-box: fill-box;
  transform-origin: 0% 100%;
}
.is-waving .elf-arm { animation: wave 0.45s ease-in-out 4 alternate; }
@keyframes wave {
  from { transform: rotate(-20deg); }
  to   { transform: rotate(30deg); }
}

/* The crow leaves when the raccoon shows up on the roof */
.crow {
  transition: transform 1.6s cubic-bezier(0.3, 0, 0.7, 0.2), opacity 1.2s ease-in 0.2s;
}
.crow.is-flown { transform: translate(170px, -190px) rotate(-12deg); opacity: 0; }

/* ── The raccoon ─────────────────────────────────────────────────────────── */

.raccoon { cursor: pointer; outline: none; }

.raccoon__tail {
  transform-box: fill-box;
  transform-origin: 0% 100%;
  animation: tail-idle 5s ease-in-out infinite;
}
.raccoon:hover .raccoon__tail,
.raccoon:focus-visible .raccoon__tail,
.raccoon.is-petted .raccoon__tail { animation: tail-wag 0.5s ease-in-out infinite alternate; }
@keyframes tail-idle {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(-6deg); }
}
@keyframes tail-wag {
  from { transform: rotate(-14deg); }
  to   { transform: rotate(10deg); }
}

.raccoon__head {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: transform 0.25s ease;
}
.raccoon.is-petted .raccoon__head { transform: rotate(-9deg) translateY(2px); }

.raccoon__ear {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}
.raccoon.is-petted .raccoon__ear--l { animation: ear-twitch 0.35s ease-in-out 2; }
.raccoon.is-petted .raccoon__ear--r { animation: ear-twitch 0.35s ease-in-out 2 0.15s; }
@keyframes ear-twitch {
  0%, 100% { transform: rotate(0deg); }
  50%      { transform: rotate(-18deg); }
}

.raccoon .eye-happy { opacity: 0; }
.raccoon.is-petted .eye-open  { opacity: 0; }
.raccoon.is-petted .eye-happy { opacity: 1; }

.raccoon__bubble {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 20% 100%;
  transform: translateY(6px) scale(0.6);
  transition: opacity 0.15s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
.raccoon.is-petted .raccoon__bubble { opacity: 1; transform: translateY(0) scale(1); }
.raccoon__word {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 600;
  fill: #2a2430;
  letter-spacing: 0.02em;
}

/* ── Digging ─────────────────────────────────────────────────────────────── */

/* (Shovel cursor kept for browsers without the dynamic one) */
.is-digging .lawn {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 64 64'><g transform='rotate(-30 32 32)'><path d='M26 4h12v6h-3v26h-6V10h-3z' fill='%238a5a2b'/><path d='M26 4h12a3 3 0 0 1 0 6H26a3 3 0 0 1 0-6z' fill='%23a06a35'/><path d='M22 36h20v10c0 8-4 13-10 16-6-3-10-8-10-16z' fill='%23c9d0d8' stroke='%23333a44' stroke-width='2' stroke-linejoin='round'/></g></svg>") 8 26, crosshair;
}

.is-pouring .lawn {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 64 64'><g transform='rotate(-110 32 32)'><rect x='26' y='4' width='12' height='10' rx='2' fill='%23b98a5a'/><path d='M24 14h16v10c8 5 12 12 12 20a20 20 0 0 1-40 0c0-8 4-15 12-20z' fill='%23e6f2fa' stroke='%237fa6c0' stroke-width='2'/><path d='M14.5 42a17.5 17.5 0 0 0 35 0c0-6-3-11-8-14h-19c-5 3-8 8-8 14z' fill='%23e0344a'/></g></svg>") 6 24, crosshair;
}

.hole__glint { transform-box: fill-box; transform-origin: center; }

/* Tool cursors are set on the scene by scene.js (a style element with id
   tool-cursor). The dagger's cut leaves a quick slash. */
.slash { pointer-events: none; }

/* ── Underground ─────────────────────────────────────────────────────────── */

.burrow { position: absolute; inset: 0; width: 100%; height: 100%; display: block; user-select: none; }
.burrow[hidden] { display: none; }
.stage.is-underground .scene { display: none; }
.stage.is-underground { background: #26190f; }
.burrow-door { cursor: default; }
.burrow-door .peek { transform-box: fill-box; transform-origin: 50% 100%; }
.burrow-door .ladder-up { cursor: pointer; }
.burrow-door .ladder-up:hover use { filter: brightness(1.3); }
.burrow-ladder, .burrow-tunnel, .burrow-hatch, .deep-up, .deep-manhole, .inside-door, .inside-manhole, .shaft-down, .shaft-hatch { cursor: pointer; outline: none; }
.shaft-hatch:hover .hatch__door rect:first-child, .inside-manhole:hover path:nth-of-type(2) { filter: brightness(1.25); }
.hatch__door { transform-box: fill-box; transform-origin: 0% 50%; transition: transform 0.7s ease; }
.hatch__door.is-rattling { animation: rattle 0.35s ease-in-out 2; }
.hatch__door.is-open { transform: rotate(-75deg) translateY(-6px); }
.stage.is-underground.is-shaft { background: #2a2522; }
.burrow-hatch:hover rect, .burrow-hatch:focus-visible rect { fill: #8a6a3e; }
.deep-up:hover path:first-of-type, .deep-manhole:hover .manhole__lid, .inside-manhole:hover ellipse:nth-of-type(2), .inside-door:hover rect:nth-of-type(2) { filter: brightness(1.3); }
.deep__drip circle { animation: drip 1.8s ease-in infinite; }
@keyframes drip { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(200px); opacity: 0; } }
.deep__shrooms { animation: glowpulse 3s ease-in-out infinite alternate; }
.deep__ripple { animation: glowpulse 2s ease-in-out infinite alternate; }
.stage.is-underground.is-deep { background: #0d0b10; }
.stage.is-underground.is-inside { background: #4e3a26; }
.stage.is-underground.is-lab { background: #3d4a44; }

/* ── The lab ─────────────────────────────────────────────────────────────── */
.burrow-lab, .lab-exit, .lab-tank, .lab-sink, .lab-burner, .lab-book, .lab-out, .lab-slot { cursor: pointer; outline: none; }
.burrow-lab:hover ellipse, .burrow-lab:focus-visible ellipse { opacity: 0.34; }
.lab-exit:hover path:nth-of-type(2), .lab-exit:focus-visible path:nth-of-type(2) { stroke: #7ef2c8; }
.lab-tank:hover rect:nth-of-type(2), .lab-tank:focus-visible rect:nth-of-type(2) { filter: brightness(1.25); }
.lab-sink:hover path, .lab-sink:focus-visible path { stroke: #dff0f6; }
.lab-book:hover, .lab-book:focus-visible { filter: brightness(1.12); }
.lab-out:hover, .lab-out:focus-visible { filter: brightness(1.15); }
.lab-slot:hover .lab-glass, .lab-slot:focus-visible .lab-glass { filter: brightness(1.3); }
.lab-slot.is-ready .lab-glass { stroke: #c9a24c; }
.lab-flame { transform-box: fill-box; transform-origin: 50% 100%; }
.lab-burner.is-lit .lab-flame { opacity: 1; animation: fire 0.5s ease-in-out infinite alternate; }
.lab-burner.is-lit .lab-burner__glow { opacity: 1; animation: glowpulse 2s ease-in-out infinite alternate; }
.lab-drip circle { animation: drip 2.6s ease-in 0.8s infinite; }
.lab-coil .lab-bead { fill: #fff; }
.lab-raccoon { cursor: pointer; }
.lab-raccoon.is-pleased { animation: rattle 0.4s ease-in-out 2; }

/* The recipe book, over the stage. */
.book {
  position: absolute; inset: 0; display: none; z-index: 4;
  background: rgba(10, 8, 12, 0.72); padding: 18px; overflow: auto;
}
.book.is-open { display: flex; }
.book__sheet {
  margin: auto;   /* centred when it fits; top-aligned and scrollable when it does not */
  background: #efe7d3; color: #2b2118; max-width: 560px; width: 100%;
  padding: 22px 24px 24px; border: 3px solid #b3a78c; box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  font-family: var(--sans);
}
.book__title { margin: 0 0 2px; font-size: 20px; letter-spacing: 0.01em; }
.book__note { margin: 0 0 16px; font-size: 13px; color: #6d5e49; }
.book__list { list-style: none; margin: 0; padding: 0; }
.book__item { border-top: 1px solid #cdbd9e; padding: 10px 0; }
.book__name { font-weight: 700; font-size: 15px; }
.book__made { color: #7a6a2a; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.book__how { font-size: 13.5px; color: #4a3f31; margin-top: 2px; }
.book__how b { color: #2b2118; }
.book__close {
  margin-top: 18px; font: inherit; font-size: 14px; cursor: pointer;
  background: #2b2118; color: #efe7d3; border: 0; padding: 8px 16px;
}
.book__close:focus-visible { outline: 2px solid #c9a24c; outline-offset: 2px; }

/* The bookcase that is really a door. */
.burrow-lab { cursor: pointer; outline: none; }
.burrow-lab__case { transform-box: fill-box; transform-origin: 0% 50%; transition: transform 0.9s cubic-bezier(0.3, 0.9, 0.3, 1); }
.burrow-lab.is-open .burrow-lab__case { transform: scaleX(0.16); }
.burrow-lab__book { opacity: 0; transition: opacity 0.35s ease; }
.burrow-lab.is-filled .burrow-lab__book { opacity: 1; }
.burrow-lab.is-filled .burrow-lab__gap { opacity: 0; }
.burrow-lab:hover .burrow-lab__gap rect, .burrow-lab:focus-visible .burrow-lab__gap rect { fill: #4a3116; }
.burrow-lab:not(.is-open):hover .burrow-lab__case, .burrow-lab:not(.is-open):focus-visible .burrow-lab__case { filter: brightness(1.12); }

/* What you can do with an item: a little row of pictures. */
.imenu {
  position: fixed; z-index: 30; display: flex; gap: 6px; padding: 6px;
  background: #1a1722; border: 1px solid #3a3550; border-radius: 10px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.55);
}
.imenu[hidden] { display: none; }
.imenu__b {
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: 7px; cursor: pointer;
  background: #2a2438; color: #e8dcc8; display: grid; place-items: center;
}
.imenu__b:hover, .imenu__b:focus-visible { background: #3d3456; color: #f3e6c4; outline: none; }
.imenu__b:focus-visible { box-shadow: 0 0 0 2px #c9a24c; }
.imenu__b svg { width: 23px; height: 23px; fill: currentColor; display: block; }
.imenu__knock { fill: #1a1722; }
.imenu__stroke { stroke: #1a1722; stroke-width: 1.6px; }

.ex__row { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.ex__art {
  flex: none; width: 58px; height: 58px; display: grid; place-items: center;
  background: #e0d4b8; border: 2px solid #b3a78c; border-radius: 8px;
}
.ex__art svg { width: 42px; height: 42px; }
.ex__row .book__title { margin: 0; }

/* Torn pages: a count on the tile, and the set laid out when you look. */
.inventory__item[data-pages]::before {
  content: attr(data-pages);
  position: absolute; bottom: -6px; right: -6px;
  padding: 0 5px; border-radius: 8px;
  background: #efe7d3; color: #2b2118; border: 1px solid #b3a78c;
  font-family: var(--sans); font-size: 10px; font-weight: 700; line-height: 15px;
}
.pg { border-top: 1px solid #cdbd9e; padding: 8px 0; }
.pg:first-child { border-top: 0; padding-top: 0; }
.pg--missing { opacity: 0.55; font-style: italic; }
.pg__n { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #7a6a2a; }
.pg__head { font-weight: 600; color: #2b2118; margin: 2px 0 4px; }
.pg__row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 3px 0; }
.pg__note { margin: 3px 0; }
.sw { display: inline-flex; align-items: center; gap: 5px; }
.sw i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.25); }
.pg__lead { color: #6d5e49; margin-bottom: 8px; }
.letter__body { font-style: italic; font-size: 15px; line-height: 1.55; color: #2b2118; }
.letter__from { margin-top: 10px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #7a6a2a; }

/* Two buttons at the end of the legal row, the first taking the slack. */
#inventory-drop:not([hidden]) + .inventory__clear { margin-left: 14px; }

/* A swallow of something coloured. */
.sip { position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 3; }
.sip.is-on { animation: sip 1.1s ease-out both; }
@keyframes sip { 0% { opacity: 0; } 22% { opacity: 0.42; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .sip.is-on { animation: none; } }



.inside__man, .inside__raccoon { display: none; }
#inside.has-man .inside__man { display: block; }
#inside.has-raccoon .inside__raccoon { display: block; }
.burrow-ladder:hover use, .burrow-ladder:focus-visible use { filter: brightness(1.3); }
.burrow-tunnel:hover path:first-child, .burrow-tunnel:focus-visible path:first-child { stroke: #c9a24c; }
.burrow__label { font-family: var(--sans); font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; fill: #c9b79a; opacity: 0.7; }
.burrow__fire { transform-box: fill-box; transform-origin: 50% 100%; animation: fire 0.7s ease-in-out infinite alternate; }
@keyframes fire { from { transform: scaleY(1); } to { transform: scaleY(1.12) scaleX(0.96); } }
.burrow__glow { animation: glowpulse 2.4s ease-in-out infinite alternate; }
@keyframes glowpulse { from { opacity: 0.7; } to { opacity: 1; } }
.burrow__steam { animation: steam 2.2s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes steam { 0% { opacity: 0; transform: translateY(6px) scale(0.6); } 40% { opacity: 0.6; } 100% { opacity: 0; transform: translateY(-18px) scale(1.2); } }
.stage.is-fading::after { content: ""; position: absolute; inset: 0; background: #000; animation: fade-through 1.1s ease-in-out both; pointer-events: none; z-index: 3; }
@keyframes fade-through { 0% { opacity: 0; } 45% { opacity: 1; } 55% { opacity: 1; } 100% { opacity: 0; } }

/* ── The front door ──────────────────────────────────────────────────────── */

.door { cursor: pointer; outline: none; }
.door:focus-visible .door__panel { filter: brightness(1.3); }

.door__panel {
  transform-box: fill-box;
  transform-origin: 0% 50%;
  transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.door.is-open .door__panel { transform: scaleX(0.22) skewY(-12deg); }
.door.is-shaking .door__panel { animation: rattle 0.45s ease-in-out; }
@keyframes rattle {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-2px) rotate(-0.6deg); }
  40%      { transform: translateX(2px)  rotate(0.6deg); }
  60%      { transform: translateX(-2px) rotate(-0.4deg); }
  80%      { transform: translateX(2px)  rotate(0.4deg); }
}

.door__light { opacity: 0; transition: opacity 0.6s ease; }
.door__spill { opacity: 0; transition: opacity 0.9s ease 0.2s; }
.door.is-open .door__light { opacity: 1; }
.door.is-open .door__spill { opacity: 0.85; }

.door__note {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transform: translateY(4px) scale(0.7);
  transition: opacity 0.15s ease, transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
.door.is-noting .door__note { opacity: 1; transform: translateY(0) scale(1); }
.door__word { font-family: var(--sans); font-size: 13px; font-weight: 600; fill: #2a2430; }

/* Envelopes out of the doorway. Text stays faint: it's a smudge until you look. */
.letter__text {
  font-family: var(--sans);
  font-size: 3.1px;
  font-weight: 600;
  letter-spacing: 0.02em;
  fill: #5c4d33;
  opacity: 0.42;
}
.letters { transition: opacity 0.8s ease; }
.letters.is-fading { opacity: 0; }

/* ── The quest: gems, garage, segway, machine, launch ───────────────────── */

.inventory__item[data-item="crystal"],
.inventory__item[data-item="mirror"],
.inventory__item[data-item="egg"],
.inventory__item[data-item="elf"] { cursor: grab; touch-action: none; }
.inventory__item[data-item="shovel"],
.inventory__item[data-item="potion"] { cursor: grab; touch-action: none; }
.inventory__item.is-dragging { opacity: 0.35; }
/* Something you could use right where you are standing. */
.inventory__item.is-handy { border-color: #c9a24c; box-shadow: 0 0 0 1px rgba(201, 162, 76, 0.35); }
.inventory, .inventory__item, .inventory__item * { user-select: none; -webkit-user-select: none; -webkit-user-drag: none; }
.fly.is-ghost { filter: drop-shadow(0 8px 10px rgba(0, 0, 0, 0.5)); }
.fly.is-held { filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.6)) drop-shadow(0 0 6px rgba(201, 162, 76, 0.5)); }
.fly.is-held svg { animation: held-bob 1.6s ease-in-out infinite; }
@keyframes held-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-5px); }
}
.is-elfing .chimney { cursor: pointer; }
.is-elfing .chimney:hover rect { filter: brightness(1.3); }

/* After the elves have been through, the lights are out */
.house.is-robbed .window-glass { fill: url(#window-dim); }
.house.is-robbed .window-glow { opacity: 0; }
.house.is-robbed .porchlight { opacity: 0.35; animation: none; }
.is-placing-gem .gemslot { cursor: pointer; }
.is-placing-gem .gemslot:hover { fill: #3a3350; }
.gemslot.is-target { fill: #4a4270; stroke: #e6c07a; stroke-width: 3; }
.is-placing-egg .eggslot { cursor: pointer; }
.is-mirroring .raccoon { cursor: pointer; }

/* Garage door rolls up */
.garage__door { transition: transform 2.4s cubic-bezier(0.4, 0, 0.2, 1); }
.garage.is-open .garage__door { transform: translateY(-91px); }
.garage.no-anim .garage__door { transition: none; }
.garage__bulb, .garage__bulbglow { opacity: 0; transition: opacity 0.6s ease 1.6s; }
.garage.is-open .garage__bulb { opacity: 1; }
.garage.is-open .garage__bulbglow { opacity: 0.8; }
.gem use { filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.5)); }

/* Things that show up later */
.segway, .raccoon-logo, .raccoon-evicted, .footprint {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.9s ease, visibility 0s linear 0.9s;
}
/* While hidden they must not take clicks either: pointer-events="all" on
   their hit boxes would otherwise catch clicks meant for what's behind. */
.segway:not(.is-here), .segway:not(.is-here) * { pointer-events: none; }
.segway.is-here, .raccoon-logo.is-here, .raccoon-evicted.is-here, .footprint.is-here {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.9s ease;
}
/* The machine sits in the garage; its socket only takes clicks once the
   raccoon has left (and the door is open, or nothing gets through anyway). */
.machine .eggslot, .machine .eggslot * { pointer-events: none; }
.machine.is-ready .eggslot, .machine.is-ready .eggslot * { pointer-events: all; }
.machine .eggslot__glow { transition: opacity 0.8s; }
.machine.is-ready .eggslot__glow { opacity: 0.35; }
.footprint.is-here { opacity: 0.75; }
.segway { cursor: pointer; outline: none; }
.segway__light { animation: blink 1.4s ease-in-out infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

.machine__body {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}
.machine__core { animation: corepulse 2.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes corepulse {
  0%, 100% { opacity: 0.55; transform: scale(0.92); }
  50%      { opacity: 0.9;  transform: scale(1.05); }
}
.machine__spark { animation: blink 0.9s ease-in-out infinite; }
.eggslot__glow { opacity: 0; transition: opacity 0.5s; }
.machine.is-charging .eggslot__glow, .machine.is-hot .eggslot__glow { opacity: 0.55; }
.machine.is-charging .machine__body { animation: shake 0.12s linear infinite; }
.machine.is-charging .machine__core { animation: corepulse 0.35s ease-in-out infinite; }
.machine.is-hot .machine__core { animation: corepulse 0.6s ease-in-out infinite; }
@keyframes shake {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-1.5px, 1px); }
  50%  { transform: translate(1.5px, -1px); }
  75%  { transform: translate(-1px, -1px); }
  100% { transform: translate(1px, 1px); }
}
.gauge__needle { transform-box: fill-box; transform-origin: 0% 100%; transition: transform 1.5s ease; }
.machine.is-charging .gauge__needle, .machine.is-hot .gauge__needle { transform: rotate(80deg); }

/* The sign the last raccoon holds */
.sign__text {
  font-family: var(--sans);
  font-size: 12.4px;
  font-weight: 600;
  letter-spacing: 0.25px;
  fill: #5c4d33;
  opacity: 0.62;
}

/* Raccoon dancing (the mirror) */
.raccoon__body {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}
.raccoon.is-dancing .raccoon__body { animation: dance-body 0.42s ease-in-out infinite alternate; }
.raccoon.is-dancing .raccoon__head { animation: dance-head 0.42s ease-in-out infinite alternate; }
.raccoon.is-dancing .raccoon__tail { animation: tail-wag 0.21s ease-in-out infinite alternate; }
.raccoon.is-dancing .raccoon__ear--l { animation: ear-twitch 0.42s ease-in-out infinite; }
.raccoon.is-dancing .raccoon__ear--r { animation: ear-twitch 0.42s ease-in-out infinite 0.21s; }
.raccoon.is-dancing .eye-open { opacity: 0; }
.raccoon.is-dancing .eye-happy { opacity: 1; }
@keyframes dance-body {
  from { transform: translateY(0) rotate(-5deg) scaleX(1); }
  to   { transform: translateY(-7px) rotate(5deg) scaleX(1.06); }
}
@keyframes dance-head {
  from { transform: translate(-3px, 0) rotate(-12deg); }
  to   { transform: translate(3px, -5px) rotate(12deg); }
}
.note {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 700;
  fill: #efe6cc;
}

/* Overgrowth: a blue potion does this; the dagger undoes it patch by patch */
.overgrowth { display: none; }
.overgrowth.is-on { display: block; }
.house.is-overgrown, .house.is-overgrown * { pointer-events: none !important; }
.vinepatch__body { transform-box: fill-box; transform-origin: 50% 50%; }
.vinepatch__body.is-growing { animation: vine-grow 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.vinepatch__body.is-cut { animation: vine-cut 0.6s ease-in both; }
@keyframes vine-grow {
  from { transform: scale(0) rotate(-30deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg); opacity: 1; }
}
@keyframes vine-cut {
  to { transform: scale(0.25) translateY(50px) rotate(25deg); opacity: 0; }
}
.inventory__item[data-item="dagger"],
.inventory__item[data-item="key"] { cursor: grab; touch-action: pan-x; }
.is-keying .door { cursor: pointer; }
.is-cutting .vinepatch { cursor: pointer; }
.is-cutting .vinepatch:hover .vinepatch__body { filter: brightness(1.25); }

/* Trees from green potions, elves hanging off them */
.tree { cursor: pointer; }
.tree__body { transform-box: fill-box; transform-origin: 50% 100%; }
.tree__body.is-growing { animation: tree-grow 1.5s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.tree__body.is-shaking { animation: tree-shake 0.6s ease-in-out; }
@keyframes tree-grow {
  from { transform: scale(0.05, 0); }
  to   { transform: scale(1, 1); }
}
@keyframes tree-shake {
  0%, 100% { transform: rotate(0deg); }
  20%      { transform: rotate(-4deg); }
  40%      { transform: rotate(4deg); }
  60%      { transform: rotate(-3deg); }
  80%      { transform: rotate(2deg); }
}
.tree__elf { transform-box: fill-box; transform-origin: 50% 0%; animation: elf-swing 2.2s ease-in-out infinite alternate; }
.tree__elf:nth-child(odd) { animation-duration: 2.7s; animation-delay: -1s; }
@keyframes elf-swing {
  from { transform: rotate(-9deg); }
  to   { transform: rotate(9deg); }
}

/* The red potion's illusion */
.illusion { pointer-events: none; }
.illusion__body { animation: illusion 1.5s ease-in-out both; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes illusion {
  0%   { opacity: 0;    transform: scale(0.6); }
  20%  { opacity: 0.85; transform: scale(1.02); }
  75%  { opacity: 0.85; transform: scale(1); }
  100% { opacity: 0;    transform: scale(1.15) translateY(-10px); }
}

/* The moon's smile (purple potion) */
.moon__face { opacity: 0; transition: opacity 0.6s ease; }
.moon.is-smiling .moon__face { opacity: 1; }
.moon__smile, .moon__eye { stroke-dasharray: 60; stroke-dashoffset: 60; transition: stroke-dashoffset 1.2s ease 0.3s; }
.moon.is-smiling .moon__smile, .moon.is-smiling .moon__eye { stroke-dashoffset: 0; }
/* Magenta: the moon sings. The face shows for the song whether or not it has smiled yet. */
.moon { transform-box: fill-box; transform-origin: 50% 50%; }
.moon.is-singing { animation: moon-sing 0.6s ease-in-out infinite alternate; }
.moon.is-singing .moon__face { opacity: 1; }
.moon.is-singing .moon__smile, .moon.is-singing .moon__eye { stroke-dashoffset: 0; transition-delay: 0s; }
@keyframes moon-sing { from { transform: scale(1) rotate(-2deg); } to { transform: scale(1.06) rotate(2deg); } }
.note, .zed { font-family: var(--sans); font-weight: 700; fill: #efe8cf; pointer-events: none; }
/* Amber: the saucer, and the empty window while he is away. */
.ufo__lights circle { animation: glowpulse 0.45s ease-in-out infinite alternate; }
.house.is-man-away .watcher--man { opacity: 0; }
/* Violet: a doze. */
.man.is-dozing .man__body { transform: rotate(7deg); transition: transform 0.7s ease; }
.raccoon.is-asleep .eye-open  { opacity: 0; }
.raccoon.is-asleep .eye-happy { opacity: 1; }
.is-pouring .moon { cursor: pointer; }

/* The crow, after an orange bath */
.crow.is-orange { fill: #e8842a; stroke: #e8842a; }
.crow.is-away { opacity: 0; }

/* The beaker on its stand */
.inventory__item[data-item="beaker"],
.inventory__item[data-item="soda"],
.inventory__item[data-item="vinegar"] { cursor: grab; touch-action: pan-x; }
.is-reagent .beaker { cursor: pointer; }
.beaker.is-erupting .beaker__glass { animation: beaker-shake 0.3s ease-in-out 8; }
.beaker { cursor: pointer; }
.beaker__liquid { transition: fill 0.9s ease; }
.beaker__glass { transform-box: fill-box; transform-origin: 50% 100%; }
.beaker.is-mixing .beaker__glass { animation: beaker-shake 0.45s ease-in-out 3; }
@keyframes beaker-shake {
  0%, 100% { transform: rotate(0deg); }
  25%      { transform: rotate(-7deg) translateY(-2px); }
  75%      { transform: rotate(7deg) translateY(-2px); }
}
.is-placing-beaker .lawn { cursor: copy; }
.is-pouring .beaker { cursor: pointer; }

/* Whoever was at the window has gone to see about the door */
.watcher { transition: opacity 1.6s ease 0.5s; }
.house.is-open .watcher--man, .house.is-man-out .watcher--man { opacity: 0; }
.watcher--raccoon { opacity: 0; }
.house.is-raccoon-inside .watcher--raccoon { opacity: 1; }
.house.is-raccoon-inside.is-open .watcher--raccoon { opacity: 0; }

/* The man, and what he becomes */
.man { opacity: 0; visibility: hidden; transition: opacity 0.6s ease, visibility 0s linear 0.6s; }
.man.is-here { opacity: 1; visibility: visible; transition: opacity 0.6s ease; }
.man:not(.is-here), .man:not(.is-here) * { pointer-events: none; }
.man__body { transform-box: fill-box; transform-origin: 50% 100%; }
.man.is-spinning .man__body { animation: man-spin 0.14s linear infinite; }
@keyframes man-spin {
  0%   { transform: scaleX(1); }
  50%  { transform: scaleX(-1); }
  100% { transform: scaleX(1); }
}
.man__twister { transition: opacity 0.4s ease; }
.man.is-spinning .man__twister { opacity: 1; }
.man.is-devil { cursor: pointer; }
.is-pouring .man { cursor: pointer; }

/* ── Footer ──────────────────────────────────────────────────────────────── */

.footer {
  position: relative;
  z-index: 3;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.inventory {
  padding: 8px 16px 6px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
}

.inventory__label {
  margin: 0;
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  line-height: 1;
}

.inventory__hint {
  flex: 0 1 300px;
  margin-left: auto;
  font-size: 12px;
  line-height: 1.35;
  color: var(--ink-dim);
  text-align: right;
}
.inventory__hint:empty { display: none; }

.inventory__item.is-equipped {
  border-color: #c9a24c;
  box-shadow: 0 0 0 1px #c9a24c, 0 0 14px rgba(201, 162, 76, 0.45);
}
.inventory__item[data-item="shovel"],
.inventory__item[data-item="potion"] { cursor: pointer; }

.inventory__clear {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  margin-left: auto;
  font: inherit;
  font-size: 11px;
  color: var(--ink-faint);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.inventory__clear:hover { color: var(--ink-dim); }

.inventory__list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: var(--slot);
  align-items: center;
  /* Three rows, then it scrolls: the footer never grows into the scene. */
  max-height: calc(3 * var(--slot) + 2 * 8px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #3a3945 transparent;
}

.inventory__empty {
  font-size: 13px;
  color: var(--ink-faint);
}

.inventory__item {
  width: var(--slot);
  height: var(--slot);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-2);
  display: grid;
  place-items: center;
  position: relative;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.inventory__item svg { width: 40px; height: 40px; display: block; overflow: visible; transform-origin: center; }
.inventory__item.is-pending { visibility: hidden; }
.inventory__item.is-landed { animation: land 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
.inventory__item:hover, .inventory__item:focus-within {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}
@keyframes land {
  from { transform: scale(0.6); }
  to   { transform: scale(1); }
}

/* Item names show in the hint line on hover; the old tooltip is kept off. */
.inventory__item .tip { display: none; }
.inventory__item .tip-off {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 6px);
  transform: translateX(-50%);
  background: #efe6cc;
  color: #15141c;
  font-size: 11px;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
.inventory__item:hover .tip, .inventory__item:focus-within .tip { opacity: 1; }

.footer__legal {
  padding: 12px 16px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 22px;
  font-size: 13px;
  color: var(--ink-dim);
}
.footer__meta { font-size: 15px; letter-spacing: 0.02em; color: var(--ink); }
.footer__links { display: flex; gap: 18px; }
.footer__links a { color: var(--ink-dim); text-decoration: none; }
.footer__links a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }


/* ── Legal pages (terms, privacy) ────────────────────────────────────────── */

.page {
  flex: 1 1 auto;
  width: 100%;
  max-width: 680px;
  margin-inline: auto;
  padding: 24px 16px 64px;
  font-size: 15px;
  line-height: 1.7;
}
.page h2 { font-size: 22px; font-weight: 600; margin: 0 0 4px; }
.page h3 { font-size: 17px; font-weight: 600; margin: 28px 0 8px; }
.page p { margin: 0 0 16px; }
.page ul { margin: 0 0 16px; padding-left: 22px; }
.page li { margin: 0 0 6px; }
.page em { color: var(--ink-dim); }
.page h3 { font-size: 16px; font-weight: 600; margin: 24px 0 6px; }
.page ul { margin: 0 0 16px; padding-left: 20px; }
.page li { margin-bottom: 4px; }
.page a { color: #c9a24c; text-decoration-color: rgba(201, 162, 76, 0.4); }
.page .back { display: inline-block; margin-bottom: 20px; font-size: 13px; color: var(--ink-dim); }

/* ── Phones ──────────────────────────────────────────────────────────────
   scene.js adds .is-mobile to <html> on phone-sized screens. The scene
   fills the screen; the inventory floats over the bottom of it. */

.is-mobile body.home { display: block; position: relative; }
.is-mobile .topbar {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  min-height: 0;
  padding: calc(env(safe-area-inset-top, 0px) + 6px) 12px 0;
  justify-content: flex-start;
  pointer-events: none;
}
.is-mobile .topbar__name { gap: 7px; opacity: 0.85; text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8); pointer-events: auto; }
.is-mobile .topbar__mark { width: 64px; }
.is-mobile .stage { position: absolute; inset: 0; margin: 0; min-height: 0; height: auto; }
/* The stage takes the touches itself: pinch and pan are ours, not the page's. */
.is-mobile .stage { touch-action: none; }
/* An SVG with a viewBox is a replaced element: height:auto means width times its ratio, not "stretch". */
.is-mobile.is-portrait .burrow { height: calc(100% - var(--tray-h, 0px)); }
.zoom-out {
  position: absolute; z-index: 5;
  top: calc(env(safe-area-inset-top, 0px) + 10px); left: 50%; transform: translateX(-50%);
  font: inherit; font-size: 12px; line-height: 1; padding: 8px 13px;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(11, 10, 20, 0.72); color: #efe6cc; cursor: pointer;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.zoom-out[hidden] { display: none; }
.zoom-out:focus-visible { outline: 2px solid #c9a24c; outline-offset: 2px; }
.is-mobile .restart {
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  left: auto; right: 12px; transform: none;
  font-size: 12px; padding: 7px 14px;
}

.is-mobile .footer {
  position: absolute; z-index: 6;
  background: rgba(11, 10, 20, 0.74);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.is-mobile .inventory { display: block; position: relative; border: 0; padding: 0; min-height: 0; }
.is-mobile .inventory__label { display: none; }
.is-mobile .inventory__list {
  max-height: none; min-height: 0; margin: 0;
  gap: 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.is-mobile .inventory__list::-webkit-scrollbar { display: none; }
.is-mobile .inventory__list.is-empty { display: block; }
.is-mobile .inventory__item { width: 46px; height: 46px; border-radius: 9px; }
.is-mobile .inventory__item svg { width: 34px; height: 34px; }
.is-mobile .inventory__item.is-stacked { display: none; }
.is-mobile .inventory__item[data-count]:not([data-count="1"])::after {
  content: attr(data-count);
  position: absolute; top: -7px; right: -7px;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px;
  background: #c9a24c; color: #15141c;
  font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
}
.is-mobile .inventory__empty { padding: 14px 6px; font-size: 12px; }
.is-mobile .inventory__hint {
  flex: none; margin: 0;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(11, 10, 20, 0.78);
  color: #efe6cc;
  font-size: 12px; line-height: 1.3;
  text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.is-mobile .footer__meta { display: none; }
.is-mobile .inventory__clear {
  font-size: 12px; padding: 11px 6px 13px; line-height: 1.1;
  display: inline-flex; align-items: center;
}

/* ── Portrait: a panel across the bottom ─────────────────────────────────
   Two rows that scroll sideways, so a full pocket is two swipes rather than
   ten, and a drag up out of the tray still reaches the scene. */

.is-mobile.is-portrait .footer {
  left: 0; right: 0; bottom: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.is-mobile.is-portrait .inventory { padding: 0 8px; }
.is-mobile.is-portrait .inventory__list {
  display: grid;
  grid-auto-flow: column;
  grid-template-rows: repeat(2, 46px);
  grid-auto-columns: 46px;
  justify-content: start;
  overflow-x: auto; overflow-y: hidden;
  padding: 10px 4px;
  mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
}
.is-mobile.is-portrait .inventory__item { touch-action: pan-x; }
.is-mobile.is-portrait .inventory__hint {
  position: absolute; left: 50%; bottom: calc(100% + 10px);
  transform: translateX(-50%); max-width: 92vw;
}
.is-mobile.is-portrait .footer__legal { padding: 0 12px 6px; font-size: 10px; gap: 12px; justify-content: flex-end; }
.is-mobile.is-portrait .footer__links a { padding: 11px 0 13px; display: inline-block; }

/* ── Landscape: a panel down the right ───────────────────────────────────
   There is height to spare and width to give up. The stage is inset from it
   rather than running underneath, so no room is ever half-covered. */

.is-mobile.is-landscape { --panel: 112px; }
.is-mobile.is-landscape .stage { right: calc(var(--panel) + env(safe-area-inset-right, 0px)); }
.is-mobile.is-landscape .footer {
  top: 0; bottom: 0; right: 0; left: auto;
  width: calc(var(--panel) + env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  padding: calc(env(safe-area-inset-top, 0px) + 6px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) 0;
}
.is-mobile.is-landscape .inventory {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  overflow: visible;          /* the hint pill hangs out to the left */
}
.is-mobile.is-landscape .inventory__list {
  display: grid;
  grid-auto-flow: row;
  grid-template-columns: repeat(2, 46px);
  justify-content: center;
  align-content: start;
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: 6px 0 12px;
  mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 14px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 12px, #000 calc(100% - 14px), transparent 100%);
}
.is-mobile.is-landscape .inventory__item { touch-action: pan-y; }
.is-mobile.is-landscape .inventory__hint {
  position: absolute; bottom: 6px;
  right: calc(100% + 10px); left: auto;
  width: max-content; max-width: 62vw;
}
.is-mobile.is-landscape .footer__legal {
  flex: none; flex-direction: column; align-items: center; gap: 0;
  padding: 4px 4px 2px; font-size: 9.5px; text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  background: rgba(11, 10, 20, 0.92);
}
.is-mobile.is-landscape .footer__links { flex-direction: column; gap: 0; align-items: center; }
.is-mobile.is-landscape .footer__links a { padding: 5px 2px; display: block; }
.is-mobile.is-landscape .inventory__clear { font-size: 10px; padding: 6px 2px 4px; }
.is-mobile.is-landscape .restart { right: calc(var(--panel) + 12px); }
.is-mobile.is-landscape .topbar { right: var(--panel); }
.is-mobile .deadtree { display: none; }

/* ── Motion preferences ──────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .cloud, .fog, .hint, .stars circle, .porchlight, .raccoon__tail, .raccoon__ear { animation: none; }
  .crow { transition: none; }
  .garage__door, .segway, .machine, .raccoon-logo, .footprint, .gauge__needle { transition: none; }
  .machine__core, .machine__spark, .segway__light,
  .machine.is-charging .machine__body { animation: none; }
  .vinepatch__body.is-growing, .tree__body.is-growing, .tree__elf, .burrow__fire, .burrow__glow, .burrow__steam, .deep__drip circle, .deep__shrooms, .deep__ripple { animation: none; }
  .door__panel, .door__light, .door__spill, .watcher { transition: none; }
  .puff { animation-duration: 10s; }
  .mailbox__door, .mailbox__flag, .inventory__item { transition: none; }
}

/* Portrait screens: the footer keeps its natural height and the scene takes
   exactly what's left, so house and inventory always share one screen. */
@media (max-aspect-ratio: 1/1) {
  .stage { min-height: 160px; }
  .footer { flex: 0 0 auto; }
  .inventory { align-items: flex-start; }
}

@media (max-width: 600px) {
  :root { --slot: 42px; --topbar-h: 52px; }
  .topbar { padding-top: calc(env(safe-area-inset-top, 0px) + 8px); }
  .topbar { padding-inline: 14px; }
  .topbar__mark { width: 96px; }
  .inventory { padding: 6px 12px 6px; gap: 10px; flex-wrap: wrap; }
  .inventory__list { gap: 6px; }
  .inventory__item svg { width: 32px; height: 32px; }
  .inventory__hint { flex: 1 1 100%; margin-left: 0; text-align: left; font-size: 11px; }
  .footer__legal { padding: 8px 12px 10px; font-size: 11px; gap: 4px 12px; }
  .footer__meta { font-size: 12px; }
  .footer__links { gap: 12px; }
  .page { font-size: 14px; }
}

/* ── Up the beanstalk ────────────────────────────────────────────────────── */
.stage.is-underground.is-climb { background: #0c0f2e; }
.stage.is-underground.is-top { background: #04061c; }
.climb-up, .climb-down, .top-down, .top-giant, .growth--stalk { cursor: pointer; outline: none; }
.climb-up:hover text, .climb-down:hover text, .top-down:hover text,
.climb-up:focus-visible text, .climb-down:focus-visible text, .top-down:focus-visible text { opacity: 1; fill: #efe6cc; }
.climb__stalk { transform-box: fill-box; transform-origin: 50% 100%; animation: stalk-sway 7s ease-in-out infinite alternate; }
@keyframes stalk-sway { from { transform: rotate(-0.7deg); } to { transform: rotate(0.7deg); } }
.climb__cloud { animation: cloud-drift 60s linear infinite; }
.climb__cloud--far { animation-duration: 90s; }
.climb__cloud--far2 { animation-duration: 75s; animation-direction: reverse; }
.climb__cloud--near { animation-duration: 45s; }
@keyframes cloud-drift { from { transform: translateX(-140px); } to { transform: translateX(140px); } }
.climb__smoke circle { animation: smoke-rise 3s ease-out infinite; }
.climb__smoke circle:nth-child(2) { animation-delay: 1s; }
.climb__smoke circle:nth-child(3) { animation-delay: 2s; }
@keyframes smoke-rise { 0% { transform: translateY(0); opacity: 0.5; } 100% { transform: translateY(-60px); opacity: 0; } }
.climb__geese { animation: geese 40s linear infinite; }
@keyframes geese { from { transform: translate(-320px, 60px); } to { transform: translate(900px, -80px); } }

.giant__belly { transform-box: fill-box; transform-origin: 50% 100%; animation: giant-breathe 3.6s ease-in-out infinite; }
@keyframes giant-breathe { 0%, 100% { transform: scale(1, 1); } 42% { transform: scale(1.01, 1.06); } 60% { transform: scale(1.01, 1.06); } }
.giant__mouth { transform-box: fill-box; transform-origin: center; animation: giant-mouth 3.6s ease-in-out infinite; }
@keyframes giant-mouth { 0%, 100% { transform: scale(1); } 42% { transform: scale(1.25); } 60% { transform: scale(1.25); } }
.giant__z { opacity: 0; animation: giant-z 3.6s ease-out infinite; }
.giant__z--2 { animation-delay: 1.2s; }
.giant__z--3 { animation-delay: 2.4s; }
@keyframes giant-z { 0% { transform: translate(0, 0); opacity: 0; } 15% { opacity: 0.95; } 100% { transform: translate(-70px, -120px); opacity: 0; } }
.top-giant:hover .giant__z, .top-giant:focus-visible .giant__z { fill: #fff; }
@media (prefers-reduced-motion: reduce) {
  .climb__stalk, .climb__cloud, .climb__smoke circle, .climb__geese, .giant__belly, .giant__mouth { animation: none; }
  .giant__z { animation-duration: 6s; }
}
