

:root {
  --cream: #f3e9d2;
  --dim: #b9ad92;
  --bg: #14110d;
  --parch: #e6d6ae;
  --parch-dark: #cbb685;
  --ink: #2b1d12;
  --oxblood: #7d2019;
  --gold: #e0ab45;
  --line: rgba(43, 29, 18, 0.28);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--cream); font-family: Georgia, 'Times New Roman', serif; }
body { min-height: 100vh; }
button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }

.studio-bar { display: flex; align-items: center; gap: 16px; padding: 8px 16px 12px; }
.studio-home { display: flex; gap: 10px; align-items: center; color: var(--dim); text-decoration: none; font-family: system-ui, sans-serif; font-size: 14px; }
.mb { padding: 0 16px 24px; max-width: 1280px; margin: 0 auto; }


.mb-page { background: linear-gradient(160deg, var(--parch), var(--parch-dark)); color: var(--ink);
  clip-path: polygon(0 6px, 9% 2px, 21% 7px, 34% 1px, 47% 5px, 61% 0, 74% 6px, 88% 2px, 100% 7px, calc(100% - 3px) 22%, 100% 41%,
    calc(100% - 5px) 63%, 100% 82%, calc(100% - 2px) calc(100% - 5px), 86% 100%, 70% calc(100% - 6px), 55% 100%, 38% calc(100% - 5px),
    22% 100%, 8% calc(100% - 6px), 0 100%, 4px 78%, 0 56%, 5px 35%, 1px 17%); }
.mb-page h1, .mb-page h2 { margin: 0; color: var(--oxblood); line-height: 1.1; }


.mb-btn, .mb-verb, .mb-tool, .mb-go, .mb-mute { display: inline-flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 16px 8px 12px;
  border: none; border-bottom: 2px solid var(--line); border-radius: 3px; background: var(--parch); color: var(--ink); font-size: 18px;
  line-height: 1.2; text-align: left; transition: transform 0.12s ease, background 0.12s ease; }
.mb-btn::before, .mb-verb::before, .mb-tool::before, .mb-go::before { content: ''; flex: none; width: 18px; height: 18px; border-radius: 46% 54% 58% 42% / 55% 44% 56% 45%;
  background: radial-gradient(circle at 36% 30%, #c4574b, var(--oxblood) 58%, #541210);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.45), inset 0 0 0 2px rgba(84, 18, 16, 0.5); transition: transform 0.12s ease, box-shadow 0.12s ease; }
.mb-btn:hover, .mb-verb:hover, .mb-tool:hover, .mb-go:hover, .mb-mute:hover,
.mb-btn:focus-visible, .mb-verb:focus-visible, .mb-tool:focus-visible, .mb-go:focus-visible, .mb-mute:focus-visible { transform: translateY(-2px); background: #f0e3c2; }
.mb-btn:active, .mb-verb:active, .mb-tool:active, .mb-go:active, .mb-mute:active { transform: translateY(2px); }
.mb-btn:active::before, .mb-verb:active::before, .mb-tool:active::before, .mb-go:active::before { transform: scale(0.86);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6); }
.mb-btn:disabled { opacity: 0.5; cursor: default; transform: none; background: none; }
.mb-btn:disabled::before { background: #8d8a84; }
button:focus-visible, .mb-keys button:focus { outline: 3px solid var(--gold); outline-offset: 2px; box-shadow: 0 0 0 6px rgba(43, 29, 18, 0.85); }
.mb-go { min-height: 72px; padding: 12px 28px 12px 16px; font-size: 28px; }
.mb-go::before { width: 40px; height: 40px; }
.mb-mute { margin-left: auto; padding: 8px 16px; background: #2a2117; color: var(--cream); font-size: 17px; }
.mb-mute:hover, .mb-mute:focus-visible { background: #3a2e1f; }
.mb-mute[aria-pressed='true'] { color: #a9adb5; }


.mb-title, .mb-end { display: grid; gap: 20px; }
.mb-picture { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 4px; filter: saturate(calc(1 - var(--hush, 0))); }
.mb-picture-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mb-title-page, .mb-end-page { padding: 24px 20px; display: flex; flex-direction: column; gap: 16px; align-items: flex-start; }
.mb-title h1 { font-size: clamp(40px, 5vw, 60px); }
.mb-end h2 { font-size: clamp(30px, 4vw, 48px); }
.mb-title p, .mb-end p { margin: 0; font-size: 19px; line-height: 1.4; }
.mb-pitch { font-style: italic; }
.mb-end .mb-credits { font-size: 17px; }
.mb-menu { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.mb-glow { position: absolute; border-radius: 50%; mix-blend-mode: screen; pointer-events: none; transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(255, 190, 90, 0.55), rgba(255, 150, 50, 0.18) 45%, transparent 70%); animation: mb-breathe 5s ease-in-out infinite; }
.mb-glow-window { left: 74.5%; top: 43%; width: 24%; aspect-ratio: 1; }
.mb-glow-candle { left: 46%; top: 45%; width: 13%; aspect-ratio: 1; animation-delay: -2s; }
@keyframes mb-breathe { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }
.mb-motes { position: absolute; inset: 0; pointer-events: none; }
.mb-mote { position: absolute; width: 5px; height: 5px; border-radius: 50%; background: #ffe9a0; box-shadow: 0 0 8px 3px rgba(255, 214, 110, 0.55);
  animation: mb-drift 11s ease-in-out infinite; }
@keyframes mb-drift { 0%, 100% { transform: translate(0, 0); opacity: 0.1; } 30% { opacity: 0.9; } 50% { transform: translate(26px, -34px); opacity: 0.35; } 75% { opacity: 0.8; } }


.mb-sweep-grey { filter: grayscale(1) brightness(0.8); }
#end-colour { position: absolute; inset: 0; }

@media (min-width: 900px) {
  .mb-title, .mb-end { max-width: calc((100vh - 110px) * 16 / 9); margin: 0 auto; }
  .mb-title > *, .mb-end > * { grid-area: 1 / 1; }
  .mb-title-page, .mb-end-page { align-self: center; justify-self: start; margin-left: 32px; width: 420px; padding: 32px; z-index: 1; } 
}


.mb-play { position: relative; display: flex; flex-direction: column; gap: 12px; }
.mb-stage { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: calc(100vh - 150px); margin: 0 auto;
  overflow: hidden; border-radius: 4px; background: radial-gradient(ellipse at 50% 35%, color-mix(in srgb, var(--tint, #333) 80%, white 8%), #0b0a08 90%);
  filter: saturate(calc(1 - var(--hush, 0))); transition: filter 2.5s ease; touch-action: manipulation; user-select: none; }

@media (orientation: portrait) and (max-width: 700px) {
  .mb-view { overflow-x: auto; overflow-y: hidden; scrollbar-width: none; overscroll-behavior-x: contain; border-radius: 4px; }
  .mb-view::-webkit-scrollbar { display: none; }
  

  .mb-stage { width: auto; height: min(max(66vh, calc(100svh - 250px)), 640px); max-height: none; margin: 0; overflow: clip; }
  .mb-stage .mb-roomname { position: sticky; width: max-content; padding-top: 12px; }
  .mb-tools .mb-tool { padding: 8px 11px; }
  .mb-tools .mb-tool::before { display: none; }
}
.mb-paint { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.mb-life { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.mb-npcs { position: absolute; inset: 0; pointer-events: none; } 
.mb-stage { isolation: isolate; }
.mb-stage .mb-roomname, .mb-stage .mb-spots, .mb-stage .mb-dev { z-index: 700; }
.mb-npc { position: absolute; filter: brightness(0.86) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.55)); }

.mb-flier { position: absolute; background-repeat: no-repeat; will-change: transform; filter: brightness(0.8); }
.mb-flier-jackdaw { filter: brightness(0.75) contrast(0.75); }
.mb-flier-lamp_moth { filter: brightness(0.95) sepia(0.2); }
.mb-npc-still { position: absolute; }

.mb-npc-fade { filter: brightness(0.86); -webkit-mask-image: linear-gradient(to bottom, #000 var(--fade0), transparent var(--fade1)); mask-image: linear-gradient(to bottom, #000 var(--fade0), transparent var(--fade1)); }
.mb-roomname { position: absolute; left: 16px; top: 12px; margin: 0; font-size: 17px; color: var(--cream); opacity: 0.85;
  text-shadow: 0 1px 6px #000; pointer-events: none; }
.mb-spots { position: absolute; inset: 0; pointer-events: none; }
.mb-spot { position: absolute; padding: 0; border: none; background: none; pointer-events: none; border-radius: 6px; }
.mb-spot:focus-visible, .mb-keys .mb-spot:focus { outline-offset: -4px; box-shadow: inset 0 0 0 6px rgba(20, 17, 13, 0.7); z-index: 2; }
.mb-spot:focus-visible::after, .mb-keys .mb-spot:focus::after { content: attr(data-name); position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  padding: 6px 12px; border-radius: 3px; background: var(--parch); color: var(--ink); font-size: 17px; white-space: nowrap; }


.mb-helpnote { position: absolute; z-index: 3; top: 56px; left: 16px; right: 16px; width: fit-content; margin: 0 auto; padding: 8px 16px; border-radius: 3px; background: rgba(20, 17, 13, 0.78); text-align: center; font-size: 17px; color: var(--cream); pointer-events: none; animation: mb-fade 1.2s both; }
.mb-play:has(> .mb-say:not([hidden])) > .mb-helpnote { display: none; }
.mb-tool-lit { animation: mb-lit 3.2s ease-in-out infinite alternate; }
.mb-spots-lit .mb-spot::before { content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle 17px, rgba(255, 236, 180, 0.95), rgba(255, 205, 120, 0.4) 45%, transparent); animation: mb-breathe 3.6s ease-in-out infinite; }
@keyframes mb-lit { from { box-shadow: 0 0 2px rgba(255, 205, 120, 0.3); } to { box-shadow: 0 0 16px 5px rgba(255, 205, 120, 0.8); } }
.mb-still .mb-tool-lit, .mb-still .mb-spots-lit .mb-spot::before, .mb-still .mb-helpnote { animation: none; }
.mb-still .mb-tool-lit { box-shadow: 0 0 12px 4px rgba(255, 205, 120, 0.7); }


.mb-prop { position: absolute; filter: sepia(0.5) saturate(1.25) brightness(0.8) drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5)); }
.mb-prop-asleep { filter: brightness(0.8) saturate(0.12) drop-shadow(0 3px 4px rgba(0, 0, 0, 0.5)); }
.mb-prop-woken { filter: brightness(1.05) saturate(1.2) drop-shadow(0 0 7px rgba(255, 170, 50, 0.55)); }
.mb-prop-shines { filter: brightness(1.05) drop-shadow(0 0 8px rgba(255, 205, 120, 0.5)); }
.mb-prop-green { filter: brightness(1.5) sepia(1) hue-rotate(52deg) saturate(2.2) brightness(0.7); }
.mb-prop-lit { filter: brightness(1.05); }
.mb-prop-root { -webkit-mask-image: linear-gradient(to bottom, #000 92%, transparent); mask-image: linear-gradient(to bottom, #000 92%, transparent); }
.mb-prop-flat { transform: perspective(220px) rotateX(52deg) rotateZ(-14deg); }
.mb-prop-glow { position: absolute; border-radius: 50%; background: radial-gradient(closest-side, rgba(130, 235, 130, 0.5), transparent); mix-blend-mode: screen; animation: mb-prop-glow 4.6s ease-in-out infinite alternate; }
.mb-prop-hang { transform-origin: 50% 0; animation: mb-prop-hang 5.2s ease-in-out infinite alternate; }
.mb-prop-float { animation: mb-prop-float 6.4s ease-in-out infinite alternate; }
.mb-prop-thin { filter: none; opacity: 0.92; }
@keyframes mb-prop-float { from { transform: translateY(0) rotate(-0.6deg); } to { transform: translateY(3%) rotate(0.8deg); } }
@keyframes mb-prop-glow { from { opacity: 0.45; } to { opacity: 0.9; } }
@keyframes mb-prop-hang { from { transform: rotate(-1.6deg); } to { transform: rotate(1.6deg); } }
.mb-still .mb-prop-glow, .mb-still .mb-prop-hang, .mb-still .mb-prop-float { animation: none; }


.mb-prop-candle { filter: sepia(0.3) brightness(0.95) drop-shadow(0 0 5px rgba(255, 180, 80, 0.6)); }
.mb-prop-candle-dark { filter: sepia(0.4) brightness(0.72) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.6)); }
.mb-prop-flame { position: absolute; border-radius: 50%; pointer-events: none; mix-blend-mode: screen;
  background: radial-gradient(closest-side, rgba(255, 200, 110, 0.75), rgba(255, 150, 50, 0.25) 55%, transparent);
  animation: mb-prop-flicker 2.4s ease-in-out infinite; }
@keyframes mb-prop-flicker { 0% { opacity: 0.8; } 20% { opacity: 0.62; } 35% { opacity: 0.92; } 55% { opacity: 0.7; } 75% { opacity: 1; } 90% { opacity: 0.74; } 100% { opacity: 0.8; } }
.mb-still .mb-prop-flame { animation: none; }


.mb-hero { position: absolute; pointer-events: none; filter: brightness(0.88) drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45)); }

.mb-hero::before { content: ''; position: absolute; left: 22%; width: 68%; top: 94.5%; height: 6%; }
.mb-hero::before, .mb-shade { border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.6), transparent); }
.mb-shade { position: absolute; }
.mb-hero-clip { position: absolute; inset: 0; background-repeat: no-repeat; }

.mb-ring { position: fixed; display: flex; flex-direction: column; gap: 12px; padding: 16px; z-index: 15; border-radius: 4px;
  background: linear-gradient(160deg, var(--parch), var(--parch-dark)); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6); }
.mb-verb { min-width: 120px; background: none; }

.mb-tools { display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap; }
.mb-held { font-style: italic; background: #f0e3c2; box-shadow: 0 0 0 2px var(--gold); }

.mb-say { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); width: min(760px, calc(100% - 32px));
  background: linear-gradient(160deg, var(--parch), var(--parch-dark)); color: var(--ink); border-radius: 4px; padding: 16px 20px; z-index: 10;
  cursor: pointer; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.6); }

.mb-play:has(> .mb-say:not([hidden])) > .mb-tools { visibility: hidden; }
.mb-who { margin: 0 0 6px; font-size: 17px; color: var(--oxblood); font-style: italic; }
.mb-who[data-who='hush'] { color: #55585c; }
.mb-words { margin: 0; font-size: 20px; line-height: 1.4; }

.mb-panel { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 20; }
.mb-panel-body { padding: 24px 20px; width: min(560px, 100%); max-height: 86vh; overflow: auto; scrollbar-width: thin; scrollbar-color: rgba(43, 29, 18, 0.45) transparent; display: flex; flex-direction: column;
  align-items: flex-start; gap: 16px; }
#panel-list { width: 100%; }
.mb-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.mb-row .mb-btn { background: none; }
.mb-row .mb-btn:hover, .mb-row .mb-btn:focus-visible { background: #f0e3c2; }
.mb-item-pic { flex: 0 0 64px; width: 64px; height: 64px; border-radius: 4px; border: 1px solid var(--line); }
.mb-row .mb-item-pic + p { flex-basis: 120px; }

@media (max-width: 600px) {
  .mb-row:has(.mb-item-pic) { display: grid; grid-template-columns: auto auto 1fr; justify-items: start; gap: 8px 12px; }
  .mb-row .mb-item-pic { grid-row: 1 / span 2; align-self: start; }
  .mb-row .mb-item-pic + p { grid-column: 2 / -1; }
  .mb-row:has(.mb-item-pic) .mb-btn { padding: 8px 12px 8px 8px; gap: 8px; white-space: nowrap; font-size: 17px; }
  .mb-memory .mb-item-pic + p { grid-row: 1 / span 2; align-self: center; }
  .mb-memory:has(.mb-btn) .mb-item-pic + p { grid-row: 1; }
}

.mb-memory .mb-item-pic { flex-basis: 112px; width: 112px; height: 112px; transition: filter 0.6s; }
.mb-memory.mb-spent .mb-item-pic { filter: grayscale(1) contrast(0.8) brightness(0.9); }
.mb-row p { flex: 1 1 200px; margin: 0; font-size: 18px; line-height: 1.4; }
.mb-row.mb-spent p { color: #6a665e; text-decoration: line-through; }



.mb-panel-body { background: radial-gradient(60% 50% at 50% 50%, rgba(255, 206, 120, 0.5), transparent) 0 0 / 220% 180%,
  linear-gradient(160deg, var(--parch), var(--parch-dark)); animation: mb-enter 0.22s ease-out, mb-candle 13s ease-in-out infinite; }
@keyframes mb-candle { 0%, 100% { background-position: 10% 25%, 0 0; } 35% { background-position: 46% 60%, 0 0; } 60% { background-position: 85% 40%, 0 0; } 80% { background-position: 55% 12%, 0 0; } }
.mb-panel-wrap { position: relative; width: min(560px, 100%); display: flex; }
.mb-panel-wrap::after { content: ''; position: absolute; right: 9px; top: 4%; width: 3px; height: 3px; border-radius: 50%; background: rgba(90, 60, 20, 0.75);
  pointer-events: none; opacity: 0; animation: mb-dust 11s linear 2s infinite; }
@keyframes mb-dust { 0% { transform: translate(0, 0); opacity: 0; } 8% { opacity: 1; } 25% { transform: translate(-5px, 16vh); } 50% { transform: translate(3px, 32vh); opacity: 0.9; }
  68%, 100% { transform: translate(-3px, 46vh); opacity: 0; } }


@keyframes mb-enter { from { opacity: 0; transform: translateY(12px); } }
@keyframes mb-fade { from { opacity: 0; } }
@keyframes mb-out { to { opacity: 0; } }
.mb-title-page, .mb-end-page, .mb-panel-body, .mb-ring { animation: mb-enter 0.22s ease-out; }
.mb-play { animation: mb-fade 0.22s ease-out; }
.mb-panel { animation: mb-fade 0.22s ease-out; }
.mb-panel .mb-row, .mb-menu > * { animation: mb-enter 0.22s ease-out calc(var(--i, 0) * 40ms) backwards; }
.mb-panel.mb-leaving { animation: mb-out 0.16s ease-in both; pointer-events: none; }


.mb-still .mb-panel-wrap::after { animation: none; }
.mb-still .mb-mote { animation: none; opacity: 0.5; }
.mb-still .mb-glow { animation: none; opacity: 0.7; }
.mb-still .mb-row, .mb-still .mb-menu > * { animation: none; }
.mb-still .mb-title-page, .mb-still .mb-end-page, .mb-still .mb-panel-body, .mb-still .mb-ring, .mb-still .mb-play, .mb-still .mb-panel {
  animation: mb-fade 0.12s linear; }
.mb-still .mb-panel.mb-leaving { animation: mb-out 0.12s linear both; }
.mb-still button, .mb-still button::before, .mb-still .mb-stage { transition: none; }
.mb-still button:hover, .mb-still button:focus, .mb-still button:active { transform: none; }


.mb-dev { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.mb-dev-hot { fill: rgba(217, 164, 65, 0.18); stroke: #d9a441; stroke-width: 2; }
.mb-dev-exit { fill: rgba(111, 143, 74, 0.25); stroke: #8fc05a; stroke-width: 2; stroke-dasharray: 8 6; }
.mb-dev-walk { stroke: #59c3ff; stroke-width: 2; stroke-dasharray: 4 4; }
.mb-dev text { fill: #fff; font: 18px system-ui, sans-serif; text-anchor: middle; dominant-baseline: middle; paint-order: stroke; stroke: #000; stroke-width: 3px; }

@media (max-width: 600px) {
  .mb-words { font-size: 18px; }
  .mb-tool { font-size: 17px; padding: 8px 12px 8px 8px; gap: 8px; }
}
