/* Mo's Night Shift: mural hero, the Quiet Lab and Mo's Arcade. Loaded only on /noise-reduction-windows after night.css.
   Prefixes: .mu- (mural hero), .lab- (Three.js lab), .ar- (arcade). All scoped under body.night. */

body.night {
  --mu-gold: #F5C342; --mu-pink: #FF5FA2; --mu-tang: #FF8A3D; --mu-teal: #2BD4C4;
  --mu-wall: #2E1813;
  --mx: 0; --my: 0; /* pointer parallax, -1..1, set by night-mural.js */
}

/* ---------- Hero v2: the bedroom, the loud street through the window, and the sash you pull shut (--shut 0..1) ---------- */
body.night .hw { position: relative; justify-self: end; width: min(100%, 400px); display: grid; gap: 12px; justify-items: center;
  transform: translate3d(calc(var(--mx) * 14px), calc(var(--my) * 8px), 0); will-change: transform; }
body.night .hw .hx-svg { width: 100%; height: auto; display: block; overflow: visible; }
body.night .hx #hx-sash { transform: translateY(calc(-200px * (1 - var(--shut)))); will-change: transform; }
body.night .hx #hx-in { opacity: calc(1 - var(--shut)); }
body.night .hx #hx-hit { opacity: var(--shut); }
body.night .hx .hx-zz { opacity: calc(max(0, var(--shut) - .8) * 5); }
body.night .hx #hx-awake { opacity: calc(1 - max(0, var(--shut) - .8) * 5); }
body.night .hx #hx-asleep { opacity: calc(max(0, var(--shut) - .8) * 5); }
body.night .hx .hx-ring { transform-box: fill-box; transform-origin: center; animation: hx-pulse 1.6s ease-out infinite; }
body.night .hx .hx-ring-1 { animation-delay: -.5s; } body.night .hx .hx-ring-2 { animation-delay: -1s; }
@keyframes hx-pulse { 0% { transform: scale(.7); opacity: .95; } 100% { transform: scale(1.45); opacity: 0; } }
body.night .hx #hx-truck { animation: hx-truck 9s linear infinite; }
@keyframes hx-truck { 0% { transform: translateX(-260px); } 100% { transform: translateX(300px); } }
body.night .hx #hx-sash, body.night .hx #hx-in, body.night .hx #hx-hit, body.night .hx .hx-zz, body.night .hx #hx-awake, body.night .hx #hx-asleep { transition: opacity .25s, transform .12s linear; }
body.night .hx .hx-hint { position: absolute; left: 50%; top: 56%; transform: translateX(-50%); z-index: 3; display: inline-flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 999px; background: var(--mu-gold); color: #2a1d02; font: 800 .74rem/1 var(--nt-head); letter-spacing: .08em; text-transform: uppercase; pointer-events: none; animation: hx-nudge 1.6s ease-in-out infinite; transition: opacity .3s; box-shadow: 0 6px 20px rgba(0, 0, 0, .4); }
body.night .hx.is-touched .hx-hint { opacity: 0; }
@keyframes hx-nudge { 0%, 100% { translate: 0 0; } 50% { translate: 0 10px; } }
body.night .hx .hx-ctl { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 999px; background: rgba(6, 18, 39, .78); border: 1px solid var(--nt-line-2); backdrop-filter: blur(8px); font: 700 .74rem/1 var(--nt-head); letter-spacing: .14px; letter-spacing: .14em; text-transform: uppercase; color: var(--nt-sky); }
body.night .hx .hx-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px; }
body.night .hx .hx-play { appearance: none; border: 1px solid var(--mu-teal); background: var(--mu-teal); color: #04202a; border-radius: 999px; padding: 11px 16px; font: 800 .82rem/1 var(--nt-head); letter-spacing: .06em; text-transform: uppercase; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
body.night .hx .hx-play[aria-pressed="true"] { background: var(--mu-pink); border-color: var(--mu-pink); color: #2a0414; }
body.night .hx .hx-play:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
body.night .hx .hx-range { -webkit-appearance: none; appearance: none; width: min(50vw, 180px); height: 8px; border-radius: 6px; background: linear-gradient(90deg, var(--mu-pink), var(--mu-gold) 50%, var(--mu-teal)); outline: none; cursor: grab; }
body.night .hx .hx-range:active { cursor: grabbing; }
body.night .hx .hx-range::-webkit-slider-thumb { -webkit-appearance: none; width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 4px solid var(--nt-navy); box-shadow: 0 2px 12px rgba(0, 0, 0, .5); }
body.night .hx .hx-range::-moz-range-thumb { width: 30px; height: 30px; border-radius: 50%; background: #fff; border: 4px solid var(--nt-navy); box-shadow: 0 2px 12px rgba(0, 0, 0, .5); }
body.night .hx .hx-range:focus-visible { box-shadow: 0 0 0 3px var(--mu-teal); }
body.night .hx .hx-read { margin: 0; justify-self: stretch; padding: 10px 14px; border-radius: 12px; background: rgba(6, 18, 39, .76); border: 1px solid var(--nt-line); backdrop-filter: blur(8px); color: var(--nt-glass); font-size: .92rem; line-height: 1.35; text-align: center; }
body.night .hx .hx-read b { color: #fff; font: 800 .95rem/1.2 var(--nt-head); margin-right: 6px; }
body.night .hx .mu-grid { grid-template-columns: minmax(0, 1.15fr) minmax(300px, .85fr); align-items: end; }
body.night .hx #hx-sash { cursor: ns-resize; }
@media (max-width: 760px) {
  body.night .hx .mu-grid { grid-template-columns: 1fr; }
  body.night .hw { justify-self: center; width: min(78vw, 320px); margin-top: 24px; transform: none; }
  body.night .hx .hx-read { font-size: .84rem; }
}
@media (prefers-reduced-motion: reduce) { body.night .hx .hx-ring, body.night .hx #hx-truck, body.night .hx .hx-hint { animation: none; } }

/* ---------- Mo keeps watch: shift report, frames light up, floats and the street behind ---------- */
body.night .mk { position: relative; isolation: isolate; overflow: hidden; }
body.night .mk-mural { position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .22; background: url("/assets/img/night/mural-street.svg") center 30% / cover no-repeat;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 20%, #000 80%, transparent); mask-image: linear-gradient(180deg, transparent, #000 20%, #000 80%, transparent); }
body.night .mk-float { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; perspective: 900px; }
body.night .mk-float .sg-obj { color: var(--nt-sky); opacity: .35; }
body.night .mk .wrap { position: relative; z-index: 1; }
body.night .mk .nt-mo-copy { position: relative; }
body.night .mk .nt-mo-copy::before { content: ""; position: absolute; inset: -40px -60px; z-index: -1; pointer-events: none; background: radial-gradient(60% 60% at 50% 45%, rgba(10, 31, 69, .9), rgba(10, 31, 69, 0) 72%); }
body.night .mk-frame { appearance: none; border: 0; background: transparent; padding: 0; margin: 0; cursor: pointer; text-align: center; font: inherit; color: inherit; }
body.night .mk-frame img { display: block; width: 100%; height: auto; transition: transform .3s, filter .3s; }
body.night .mk-frame .mk-cap { display: block; margin-top: 8px; font: 700 .72rem/1.2 var(--nt-head); letter-spacing: .18em; text-transform: uppercase; color: var(--nt-sky); }
body.night .mk-frame:hover img, body.night .mk-frame.is-hot img { transform: translateY(-4px); filter: drop-shadow(0 0 22px rgba(167, 211, 245, .7)); }
body.night .mk-frame:focus-visible { outline: 3px solid var(--mu-teal); outline-offset: 6px; border-radius: 12px; }
body.night .mk-report { margin: 22px 0 18px; padding: 16px 18px 14px; border-radius: 16px; background: rgba(6, 18, 39, .78); border: 1px solid var(--nt-line-2); backdrop-filter: blur(8px); }
body.night .mk-rh { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px dashed var(--nt-line-2); }
body.night .mk-rh b { font: 800 1rem/1.2 var(--nt-head); color: #fff; }
body.night .mk-rh span { font-size: .8rem; color: var(--nt-muted); }
body.night .mk-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
body.night .mk-lines li { display: grid; grid-template-columns: 74px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; font-size: .92rem; color: var(--nt-glass); opacity: 0; transform: translateY(6px); transition: opacity .35s, transform .35s, background .25s; padding: 3px 6px; margin: 0 -6px; border-radius: 8px; }
body.night .mk-lines li.is-in { opacity: 1; transform: none; }
body.night .mk-lines li.is-hot { background: rgba(43, 212, 196, .14); }
body.night .mk-at { font-variant-numeric: tabular-nums; color: var(--nt-sky); font-weight: 700; }
body.night .mk-res { font: 800 .72rem/1 var(--nt-head); letter-spacing: .1em; text-transform: uppercase; color: var(--mu-teal); white-space: nowrap; }
body.night .mk-sum { margin: 12px 0 0; padding-top: 10px; border-top: 1px dashed var(--nt-line-2); font: 800 1rem/1.3 var(--nt-head); color: #fff; opacity: 0; transition: opacity .4s; }
body.night .mk-report.is-done .mk-sum { opacity: 1; }
body.night .mk-fine { margin: 6px 0 0; font-size: .78rem; color: var(--nt-muted); }
@media (max-width: 760px) { body.night .mk-lines li { grid-template-columns: 64px minmax(0, 1fr); } body.night .mk-res { grid-column: 2; } }

/* ---------- Hero: the painted wall ---------- */
body.night .mu-hero {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: clamp(620px, calc(100svh - 80px), 900px); /* 80px = the stamped header, so the buttons sit above the fold */
  background: var(--mu-wall);
  display: grid; align-items: end;
}
body.night .mu-wall { position: absolute; inset: -4% -3%; z-index: 0; will-change: transform;
  transform: translate3d(calc(var(--mx) * -10px), calc(var(--my) * -6px + var(--sy, 0px)), 0); }
body.night .mu-wall svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
body.night .mu-wall .mu-tall { display: none; }
body.night .mu-lamp { position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(60% 50% at 8% -10%, rgba(245, 195, 66, .32), transparent 70%),
    radial-gradient(52% 60% at 16% 88%, rgba(4, 10, 24, .86), transparent 72%),
    linear-gradient(180deg, rgba(5, 12, 30, .18), transparent 30%, transparent 55%, rgba(4, 10, 24, .78) 100%); }

body.night .mu-grid { position: relative; z-index: 2; width: 100%; padding-top: 120px; padding-bottom: 48px;
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(240px, .8fr); gap: 32px; align-items: end; }
body.night .mu-copy { max-width: 600px; }

/* The neon sign is the page's H1: real text, lit tubes. One line on desktop, stacked on phones. */
body.night .mu-neon { margin: 0 0 18px; font-family: var(--nt-head); font-weight: 800; line-height: .95; letter-spacing: -.02em; color: #fff; white-space: nowrap; }
body.night .mu-neon-s { display: inline; margin-right: .18em; font-size: clamp(1.4rem, 2.6vw, 2.2rem); letter-spacing: .08em; color: var(--mu-gold); vertical-align: .9em;
  text-shadow: 0 0 6px rgba(245, 195, 66, .9), 0 0 18px rgba(245, 195, 66, .6), 0 0 42px rgba(245, 195, 66, .35); }
body.night .mu-neon-b { display: inline; font-size: clamp(2.8rem, 5.2vw, 4.8rem);
  text-shadow: 0 0 5px #fff, 0 0 12px var(--mu-pink), 0 0 28px var(--mu-pink), 0 0 60px rgba(255, 95, 162, .6), 0 0 110px rgba(255, 95, 162, .35); }
body.night .mu-neon.is-flicker .mu-neon-b { animation: mu-flicker 2.6s steps(1, end) 1; }
@keyframes mu-flicker {
  0%, 7%, 11%, 23%, 25%, 31%, 100% { opacity: 1; }
  8%, 10%, 24%, 30% { opacity: .35; text-shadow: none; }
  52% { opacity: 1; } 53% { opacity: .5; } 54% { opacity: 1; }
}
body.night .mu-hero .nt-lede { font: 700 clamp(1.25rem, 2.2vw, 1.6rem)/1.3 var(--nt-head); color: #fff; margin: 0 0 12px; }
body.night .mu-hero .nt-sub { color: var(--nt-glass); max-width: 48ch; margin: 0 0 24px; font-size: 1.05rem; }
body.night .mu-hero .nt-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* The real window Mo sits in (mid layer) */
body.night .mu-winwrap { position: relative; justify-self: end; width: min(100%, 310px);
  transform: translate3d(calc(var(--mx) * 16px), calc(var(--my) * 10px), 0); will-change: transform; }
body.night .mu-win { width: 100%; height: auto; display: block; filter: drop-shadow(0 30px 40px rgba(0, 0, 0, .55)); }
body.night .mu-sing { position: absolute; left: 24%; bottom: 14%; width: 44%; height: 40%; border: 0; background: transparent; cursor: pointer; border-radius: 12px; }
body.night .mu-sing:focus-visible { outline: 3px solid var(--mu-teal); }
body.night .mu-mo { transform-box: fill-box; transform-origin: 50% 100%; transition: transform .25s; }
body.night .mu-winwrap.is-singing .mu-mo { animation: mu-bob .34s ease-in-out 6; }
@keyframes mu-bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-4px) rotate(-6deg); } }
body.night .mu-winwrap .mu-float { position: absolute; left: 44%; bottom: 36%; width: 26px; height: 26px; pointer-events: none; opacity: 0; color: var(--mu-teal); filter: drop-shadow(0 0 8px currentColor); }
body.night .mu-winwrap.is-singing .mu-float { animation: mu-rise 1.4s ease-out forwards; }
body.night .mu-winwrap.is-singing .mu-float:nth-child(2) { animation-delay: .25s; color: var(--mu-pink); left: 50%; }
body.night .mu-winwrap.is-singing .mu-float:nth-child(3) { animation-delay: .5s; color: var(--mu-gold); left: 40%; }
body.night .mu-winwrap.is-singing .mu-float:nth-child(4) { animation-delay: .75s; left: 56%; }
@keyframes mu-rise { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 15% { opacity: 1; } 100% { opacity: 0; transform: translate(-30px, -170px) rotate(-20deg) scale(1.1); } }
body.night .mu-hint { position: absolute; left: 50%; bottom: -28px; transform: translateX(-50%); font: 700 .72rem/1 var(--nt-head); letter-spacing: .14em; text-transform: uppercase; color: var(--mu-gold); opacity: .9; white-space: nowrap; }

/* Painted pieces react */
body.night .mu-svg .mu-bear { cursor: pointer; transition: filter .3s; }
body.night .mu-svg .mu-bear:hover .gz-eye, body.night .mu-svg .mu-bear.is-growl .gz-eye { fill: #fff; filter: drop-shadow(0 0 8px var(--mu-gold)) drop-shadow(0 0 18px var(--mu-gold)); }
body.night .mu-svg .mu-bear.is-growl { animation: mu-shake .5s linear 1; }
@keyframes mu-shake { 0%, 100% { transform: translate(var(--tx), var(--ty)) scale(var(--sc)); } }
body.night .mu-svg .mu-note { transform-box: fill-box; transform-origin: center; animation: mu-drift 6s ease-in-out infinite; }
body.night .mu-svg .mu-note-1 { animation-duration: 7.5s; animation-delay: -2s; }
body.night .mu-svg .mu-note-2 { animation-duration: 9s; animation-delay: -4s; }
@keyframes mu-drift { 0%, 100% { translate: 0 0; } 50% { translate: 6px -14px; } }

body.night .mu-wall .mu-svg { pointer-events: none; }
body.night .mu-wall .mu-svg .mu-bear { pointer-events: auto; }

/* ---------- The night goes by behind the four windows: scroll drives --night from 0 (10 PM) to 1 (6 AM) ---------- */
body.night .nwx { position: relative; isolation: isolate; overflow: hidden; --night: 0; }
body.night .nwx-mural { position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .5;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 70%, transparent 100%); mask-image: linear-gradient(180deg, #000 0%, #000 70%, transparent 100%); }
body.night .nwx-mural svg { position: absolute; inset: 0; width: 100%; height: 100%; }
body.night .nwx-mural #ms-moon { transform: translate(calc(var(--night) * 1100px), calc(var(--night) * var(--night) * 220px - var(--night) * 120px)); }
body.night .nwx-mural #ms-dawn { opacity: calc(max(0, var(--night) - .62) * 2.6); }
body.night .nwx-mural #ms-truck { transform: translate(calc(1600px - clamp(0px, (var(--night) - .74) * 4000px, 1040px)), 560px); }
body.night .nwx-mural .ms-late { opacity: calc(1 - clamp(0, var(--night) * 2.2, .85)); }
body.night .nwx-mural .ms-porch { opacity: calc(1 - clamp(0, (var(--night) - .3) * 3, 1)); }
body.night .nwx-float { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; perspective: 900px; }
body.night .nwx-float .sg-obj { color: var(--nt-sky); filter: drop-shadow(0 0 6px rgba(167, 211, 245, .45)); opacity: .42; }
body.night .nwx-float .sg-obj:nth-child(3n) { color: var(--mu-gold); filter: drop-shadow(0 0 6px rgba(245, 195, 66, .45)); }
body.night .nwx-float .sg-obj:nth-child(4n) { color: var(--mu-teal); filter: drop-shadow(0 0 6px rgba(43, 212, 196, .45)); }
body.night .nwx .wrap { position: relative; z-index: 1; }
body.night .nwx .nt-head { position: relative; }
body.night .nwx .nt-head::before { content: ""; position: absolute; inset: -40px -80px -20px -80px; z-index: -1; pointer-events: none; background: radial-gradient(55% 60% at 40% 50%, rgba(10, 31, 69, .92), rgba(10, 31, 69, 0) 72%); }
body.night .nwx-clock { position: absolute; right: 24px; top: 24px; z-index: 2; display: grid; justify-items: end; gap: 3px; padding: 10px 14px; border-radius: 12px; background: rgba(6, 18, 39, .72); border: 1px solid var(--nt-line); backdrop-filter: blur(6px); pointer-events: none; }
body.night .nwx-time { font: 800 1.25rem/1 var(--nt-head); color: #fff; font-variant-numeric: tabular-nums; }
body.night .nwx-note { font: 700 .66rem/1 var(--nt-head); letter-spacing: .14em; text-transform: uppercase; color: var(--mu-gold); }
@media (max-width: 760px) { body.night .nwx-clock { right: 12px; top: 12px; padding: 8px 10px; } body.night .nwx-time { font-size: 1rem; } }
@media (prefers-reduced-motion: reduce) { body.night .nwx { --night: .35 !important; } }

/* ---------- Four windows that do their job on tap ---------- */
body.night .nw { display: block; width: 100%; padding: 0; margin: 0; border: 0; background: transparent; cursor: pointer; border-radius: 100px 100px 10px 10px; }
body.night .nw:focus-visible { outline: 3px solid var(--mu-teal); outline-offset: 6px; }
body.night .nw svg { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 0 26px rgba(167, 211, 245, .5)); transition: filter .4s; }
body.night .nw.is-on svg { filter: drop-shadow(0 0 34px rgba(167, 211, 245, .85)); }
body.night .nw .nw-chip { opacity: 0; transition: opacity .35s; }
body.night .nw.is-on .nw-chip { opacity: 1; }
body.night .nw-chip-in, body.night .nw-chip-still { transition-delay: .9s !important; }
/* quiet: rings come in from the left, hit the glass, a fainter echo goes back; Zz drifts up inside */
body.night .nw-rings { opacity: 0; transform: translateX(-20px); }
body.night .nw-quiet.is-on .nw-rings { animation: nw-in 1.3s ease-out forwards; }
body.night .nw-quiet.is-on .nw-back { animation: nw-echo 1s ease-out .55s forwards; }
body.night .nw-zz { opacity: 0; }
body.night .nw-quiet.is-on .nw-zz { animation: nw-zz 1.8s ease-out .5s forwards; }
@keyframes nw-in { 0% { opacity: 0; transform: translateX(-20px); } 20% { opacity: 1; } 60% { opacity: 1; transform: translateX(44px); } 100% { opacity: 0; transform: translateX(44px); } }
@keyframes nw-echo { 0% { opacity: 0; transform: translateX(0); } 20% { opacity: .9; } 100% { opacity: 0; transform: translateX(-70px); } }
@keyframes nw-zz { 0% { opacity: 0; transform: translateY(0); } 25% { opacity: 1; } 100% { opacity: 0; transform: translateY(-34px); } }
/* holds the room: frost on the outside of the glass, warm light inside */
body.night .nw-holds.is-on .nw-frost { animation: nw-fade 1.2s ease-out forwards; }
body.night .nw-holds.is-on .nw-warm { animation: nw-warm 1.6s ease-out .5s forwards; }
@keyframes nw-fade { to { opacity: 1; } }
@keyframes nw-warm { to { opacity: .28; } }
/* lock: the lower sash drops shut, then the cam throws */
body.night .nw-sash { transform: translateY(-16px); transition: transform .7s cubic-bezier(.3, .9, .3, 1); }
body.night .nw-lock.is-on .nw-sash { transform: translateY(0); }
body.night .nw-cam { transform-box: fill-box; transform-origin: 50% 50%; transform: rotate(-80deg); transition: transform .35s cubic-bezier(.5, 1.6, .5, 1) .75s; }
body.night .nw-lock.is-on .nw-cam { transform: rotate(0deg); }
body.night .nw-lock.is-on .nw-flash { animation: nw-flash .7s ease-out 1s forwards; }
@keyframes nw-flash { 0% { opacity: 0; transform: scale(.4); } 30% { opacity: 1; } 100% { opacity: 0; transform: scale(2); } }
body.night .nw-flash { transform-box: fill-box; transform-origin: 50% 50%; }
/* rattle: wind streaks and a leaf cross the glass; the frame does not move */
body.night .nw-wind { opacity: 0; }
body.night .nw-rattle.is-on .nw-wind { opacity: .9; animation: nw-wind 1.4s linear forwards; }
body.night .nw-rattle.is-on .nw-wind path:nth-child(2) { animation-delay: .12s; }
body.night .nw-rattle.is-on .nw-wind path:nth-child(3) { animation-delay: .22s; }
body.night .nw-rattle.is-on .nw-wind path:nth-child(4) { animation-delay: .08s; }
body.night .nw-rattle.is-on .nw-wind path { animation: nw-dash 1.4s linear forwards; }
@keyframes nw-wind { 0%, 80% { opacity: .9; } 100% { opacity: 0; } }
@keyframes nw-dash { from { stroke-dashoffset: 240; } to { stroke-dashoffset: -240; } }
body.night .nw-leaf { opacity: 0; transform: translate(-20px, 150px); }
body.night .nw-rattle.is-on .nw-leaf { animation: nw-leaf 1.5s ease-in-out forwards; }
@keyframes nw-leaf { 0% { opacity: 0; transform: translate(-20px, 150px) rotate(0); } 15% { opacity: 1; } 50% { transform: translate(100px, 120px) rotate(200deg); } 100% { opacity: 0; transform: translate(230px, 170px) rotate(420deg); } }
@media (prefers-reduced-motion: reduce) {
  body.night .nw.is-on .nw-rings, body.night .nw.is-on .nw-back, body.night .nw.is-on .nw-zz, body.night .nw.is-on .nw-wind, body.night .nw.is-on .nw-leaf, body.night .nw.is-on .nw-flash { animation: none; opacity: 0; }
  body.night .nw.is-on .nw-frost { animation: none; opacity: 1; } body.night .nw.is-on .nw-warm { animation: none; opacity: .28; }
  body.night .nw-sash, body.night .nw-cam { transition: none; }
}

/* ---------- Memphis sings: Beale Street mural behind, floating line art, Mo mimics what you play him ---------- */
body.night .sg { position: relative; isolation: isolate; }
body.night .sg-mural { position: absolute; inset: 0; z-index: 0; pointer-events: none; opacity: .34;
  background: url("/assets/img/night/mural-beale.svg") center / cover no-repeat;
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 16%, #000 84%, transparent); mask-image: linear-gradient(180deg, transparent, #000 16%, #000 84%, transparent);
  transform: translate3d(0, var(--sy2, 0px), 0); will-change: transform; }
body.night .sg-float { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; perspective: 900px; }
body.night .sg-obj { position: absolute; color: var(--mu-gold); opacity: .5; width: var(--w); height: var(--w); filter: drop-shadow(0 0 6px rgba(245, 195, 66, .45));
  transform-style: preserve-3d; animation: sg-tumble var(--d) linear infinite, sg-bob var(--b) ease-in-out infinite alternate; animation-delay: var(--o), calc(var(--o) / 2); }
body.night .sg-obj:nth-child(3n) { color: var(--mu-teal); filter: drop-shadow(0 0 6px rgba(43, 212, 196, .45)); }
body.night .sg-obj:nth-child(4n) { color: var(--mu-pink); filter: drop-shadow(0 0 6px rgba(255, 95, 162, .45)); }
body.night .sg-obj svg { width: 100%; height: 100%; display: block; }
@keyframes sg-tumble { from { transform: rotateX(0) rotateY(0) rotateZ(var(--r)); } to { transform: rotateX(360deg) rotateY(720deg) rotateZ(var(--r)); } }
@keyframes sg-bob { from { translate: 0 -18px; } to { translate: 0 18px; } }
body.night .sg .wrap { position: relative; z-index: 1; }
body.night .sg .nt-sing-copy { position: relative; }
body.night .sg .nt-sing-copy::before { content: ""; position: absolute; inset: -48px -70px; z-index: -1; pointer-events: none; background: radial-gradient(60% 62% at 50% 50%, rgba(10, 31, 69, .9), rgba(10, 31, 69, 0) 72%); }
body.night .sg-mo { display: block; width: 100%; padding: 0; margin: 0; border: 0; background: transparent; cursor: pointer; border-radius: 160px 160px 12px 12px; }
body.night .sg-mo:focus-visible { outline: 3px solid var(--mu-teal); outline-offset: 8px; }
body.night .sg-mo svg { display: block; width: 100%; height: auto; transform-origin: 50% 100%; transition: transform .2s; }
body.night .sg-art.is-singing .sg-mo svg { animation: mu-bob .3s ease-in-out 8; }
body.night .sg-art .mu-float { position: absolute; left: 52%; top: 28%; width: 30px; height: 30px; opacity: 0; color: var(--mu-teal); filter: drop-shadow(0 0 8px currentColor); pointer-events: none; }
body.night .sg-art.is-singing .mu-float { animation: mu-rise 1.5s ease-out forwards; }
body.night .sg-art.is-singing .mu-float:nth-of-type(2) { animation-delay: .3s; color: var(--mu-pink); left: 60%; }
body.night .sg-art.is-singing .mu-float:nth-of-type(3) { animation-delay: .6s; color: var(--mu-gold); left: 46%; }
body.night .sg-art.is-singing .mu-float:nth-of-type(4) { animation-delay: .9s; left: 66%; }
body.night .sg-lead { margin: 22px 0 12px; font: 700 1.05rem/1.4 var(--nt-head); color: #fff; }
body.night .sg-teach { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
body.night .sg-teach button { appearance: none; border: 1px solid var(--nt-line-2); background: rgba(15, 42, 92, .55); color: #fff; border-radius: 999px; padding: 11px 16px; font: 700 .92rem/1 var(--nt-head); cursor: pointer; transition: background .2s, border-color .2s; }
body.night .sg-teach button:hover { border-color: var(--nt-sky); }
body.night .sg-teach button[aria-pressed="true"] { background: var(--mu-gold); border-color: var(--mu-gold); color: #2a1d02; }
body.night .sg-teach button:disabled { opacity: .6; cursor: default; }
body.night .sg-status { margin: 14px 0 0; color: var(--nt-muted); font-size: .95rem; min-height: 1.4em; }
@media (min-width: 900px) { body.night .sg-teach { justify-content: flex-start; } }
@media (prefers-reduced-motion: reduce) { body.night .sg-obj { animation: none; } body.night .sg-mural { transform: none !important; } }

/* ---------- The Quiet Lab ---------- */
body.night .lab { padding: 84px 0 72px; background: linear-gradient(180deg, #071630, var(--nt-deep) 30%); border-top: 1px solid var(--nt-line); }
body.night .lab-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; align-items: end; margin-bottom: 28px; }
body.night .lab h2 { margin: 0 0 10px; font: 800 clamp(2rem, 4.4vw, 3.2rem)/1.02 var(--nt-head); color: #fff; letter-spacing: -.02em; }
body.night .lab .nt-intro { margin: 0; max-width: 60ch; color: var(--nt-glass); font-size: 1.08rem; }
body.night .lab-stage { position: relative; border-radius: 22px; overflow: hidden; background: radial-gradient(120% 90% at 50% 110%, #16397a, #061227 70%); border: 1px solid var(--nt-line-2); aspect-ratio: 16 / 9; min-height: 340px; }
body.night .lab-stage canvas { display: block; width: 100% !important; height: 100% !important; touch-action: none; }
body.night .lab-stage .lab-fallback { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--nt-glass); }
body.night .lab-stage .lab-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--nt-sky); font: 700 .85rem/1 var(--nt-head); letter-spacing: .18em; text-transform: uppercase; pointer-events: none; transition: opacity .4s; }
body.night .lab-stage.is-ready .lab-loading { opacity: 0; }
body.night .lab-hud { position: absolute; left: 16px; right: 16px; bottom: 14px; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; pointer-events: none; }
body.night .lab-where { position: absolute; left: 16px; top: 14px; pointer-events: none; display: grid; gap: 3px; padding: 10px 14px; border-radius: 12px; background: rgba(6, 18, 39, .72); border: 1px solid var(--nt-line); backdrop-filter: blur(6px); }
body.night .lab-where b { font: 800 1rem/1.1 var(--nt-head); color: #fff; }
body.night .lab-where span { font-size: .82rem; color: var(--nt-sky); }
body.night .lab-map { position: absolute; right: 14px; top: 14px; width: 120px; height: 120px; pointer-events: none; }
body.night .lab-bar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 16px; }
body.night .lab-now { margin: 0; flex: 1 1 260px; color: var(--nt-glass); font-size: .98rem; }
body.night .lab-now b { color: #fff; }
body.night .lab-views button[aria-pressed="true"] { background: var(--nt-royal); color: #fff; border-color: var(--nt-royal); }
body.night .lab-meter { display: grid; gap: 6px; min-width: 150px; }
body.night .lab-meter span { font: 700 .7rem/1 var(--nt-head); letter-spacing: .16em; text-transform: uppercase; color: var(--nt-sky); }
body.night .lab-bar { height: 10px; border-radius: 6px; background: rgba(167, 211, 245, .18); overflow: hidden; }
body.night .lab-bar i { display: block; height: 100%; width: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--mu-teal), var(--mu-gold) 55%, var(--mu-pink)); transform-origin: left; transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
body.night .lab-drag { font: 700 .7rem/1 var(--nt-head); letter-spacing: .16em; text-transform: uppercase; color: rgba(167, 211, 245, .7); }
body.night .lab-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 28px; margin-top: 20px; }
body.night .lab-group { display: grid; gap: 10px; }
body.night .lab-group > span { font: 700 .74rem/1 var(--nt-head); letter-spacing: .18em; text-transform: uppercase; color: var(--nt-sky); }
body.night .lab-seg { display: flex; flex-wrap: wrap; gap: 8px; }
body.night .lab-seg button, body.night .lab-play {
  appearance: none; border: 1px solid var(--nt-line-2); background: rgba(15, 42, 92, .55); color: #fff; border-radius: 999px;
  padding: 10px 16px; font: 700 .92rem/1 var(--nt-head); cursor: pointer; transition: background .2s, border-color .2s, transform .1s; }
body.night .lab-seg button:hover, body.night .lab-play:hover { border-color: var(--nt-sky); }
body.night .lab-seg button[aria-pressed="true"] { background: #fff; color: var(--nt-navy); border-color: #fff; }
body.night .lab-play { background: var(--mu-teal); color: #04202a; border-color: var(--mu-teal); padding: 12px 20px; display: inline-flex; align-items: center; gap: 10px; }
body.night .lab-play[aria-pressed="true"] { background: var(--mu-pink); border-color: var(--mu-pink); color: #2a0414; }
body.night .lab-play:active { transform: scale(.98); }
body.night .lab-note { margin: 18px 0 0; font-size: .92rem; color: var(--nt-muted); max-width: 70ch; }

/* The lab reads best at 80%: stage, play row and the glass/noise choices all fit one screen. Phones stay at 100%. */
@media (min-width: 761px) { body.night .lab .wrap { zoom: .85; } }

/* ---------- Mo's Arcade ---------- */
body.night .ar { padding: 84px 0; border-top: 1px solid var(--nt-line); position: relative; overflow: hidden; }
body.night .ar::before { content: ""; position: absolute; inset: 0; background: url("/assets/img/night/mural-wide.svg") center / cover no-repeat; opacity: .08; pointer-events: none; }
body.night .ar .wrap { position: relative; }
body.night .ar h2 { margin: 0 0 10px; font: 800 clamp(2rem, 4.4vw, 3.2rem)/1.02 var(--nt-head); color: #fff; letter-spacing: -.02em; }
body.night .ar .nt-intro { margin: 0 0 24px; max-width: 60ch; color: var(--nt-glass); font-size: 1.08rem; }
body.night .ar-tabs { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
body.night .ar-tabs button { appearance: none; border: 1px solid var(--nt-line-2); background: rgba(15, 42, 92, .55); color: #fff; border-radius: 14px; padding: 12px 16px; text-align: left; cursor: pointer; display: grid; gap: 4px; min-width: 200px; flex: 1 1 200px; }
body.night .ar-tabs button b { font: 800 1rem/1.1 var(--nt-head); }
body.night .ar-tabs button small { color: var(--nt-muted); font-size: .84rem; }
body.night .ar-tabs button[aria-selected="true"] { background: #fff; color: var(--nt-navy); border-color: #fff; }
body.night .ar-tabs button[aria-selected="true"] small { color: #4c5f7a; }
body.night .ar-stage { position: relative; border-radius: 22px; overflow: hidden; border: 1px solid var(--nt-line-2); background: #061227; }
body.night .ar-stage canvas { display: block; width: 100%; height: auto; touch-action: manipulation; user-select: none; -webkit-user-select: none; }
body.night .ar-panel { display: none; }
body.night .ar-panel.is-active { display: block; }
body.night .ar-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; background: rgba(15, 42, 92, .55); border-top: 1px solid var(--nt-line); }
body.night .ar-bar p { margin: 0; color: var(--nt-glass); font-size: .95rem; }
body.night .ar-bar b { color: #fff; }
body.night .ar-btn { appearance: none; border: 0; border-radius: 999px; padding: 12px 20px; background: var(--mu-gold); color: #2a1d02; font: 800 .95rem/1 var(--nt-head); cursor: pointer; }
body.night .ar-btn:hover { filter: brightness(1.06); }
body.night .ar-btn.alt { background: transparent; color: #fff; border: 1px solid var(--nt-line-2); }
body.night .ar-quiz { padding: 22px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; align-items: center; }
body.night .ar-quiz svg { width: 100%; height: auto; max-height: 320px; }
body.night .ar-choices { display: grid; gap: 10px; }
body.night .ar-choices button { appearance: none; border: 1px solid var(--nt-line-2); background: rgba(15, 42, 92, .55); color: #fff; border-radius: 12px; padding: 14px 16px; text-align: left; font: 700 1rem/1.2 var(--nt-head); cursor: pointer; }
body.night .ar-choices button:hover { border-color: var(--nt-sky); }
body.night .ar-choices button.is-right { background: var(--mu-teal); color: #04202a; border-color: var(--mu-teal); }
body.night .ar-choices button.is-wrong { background: rgba(255, 95, 162, .25); border-color: var(--mu-pink); }
body.night .ar-explain { margin: 0; color: var(--nt-glass); min-height: 3.2em; }
body.night .ar-explain a { color: var(--mu-gold); }
body.night .ar-found { position: absolute; left: 0; right: 0; top: 0; padding: 10px 16px; display: flex; gap: 8px; flex-wrap: wrap; pointer-events: none; }
body.night .ar-found span { font: 700 .72rem/1 var(--nt-head); letter-spacing: .1em; text-transform: uppercase; padding: 6px 10px; border-radius: 999px; background: rgba(6, 18, 39, .8); color: var(--nt-muted); border: 1px solid var(--nt-line); }
body.night .ar-found span.is-found { background: var(--mu-teal); color: #04202a; border-color: var(--mu-teal); }
body.night .ar-more { margin-top: 26px; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
body.night .ar-more div { border: 1px dashed var(--nt-line-2); border-radius: 12px; padding: 12px 14px; color: var(--nt-muted); font-size: .9rem; }
body.night .ar-more b { display: block; color: #fff; font: 800 .95rem/1.2 var(--nt-head); margin-bottom: 3px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  body.night .lab-controls { grid-template-columns: 1fr; }
  body.night .lab-head { grid-template-columns: 1fr; }
  body.night .ar-quiz { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body.night .mu-wall .mu-wide { display: none; }
  body.night .mu-wall .mu-tall { display: block; }
  body.night .mu-hero { min-height: clamp(720px, 100svh, 900px); }
  body.night .mu-grid { grid-template-columns: 1fr; padding-top: 104px; padding-bottom: 28px; gap: 8px; align-items: start; }
  body.night .mu-neon { white-space: normal; }
  body.night .mu-neon-s { display: block; margin: 0 0 2px; vertical-align: baseline; font-size: 1.6rem; }
  body.night .mu-neon-b { display: block; font-size: clamp(3.2rem, 13vw, 4.4rem); }
  body.night .mu-winwrap { justify-self: end; width: min(62vw, 250px); margin-top: 18vh; }
  body.night .lab-stage { aspect-ratio: 4 / 5; min-height: 0; }
  body.night .lab-hud { flex-direction: column; align-items: stretch; }
  body.night .lab-map { width: 84px; height: 84px; }
  body.night .lab-where { max-width: calc(100% - 120px); padding: 8px 10px; }
  body.night .lab-where b { font-size: .88rem; }
}
@media (prefers-reduced-motion: reduce) {
  body.night .mu-wall, body.night .mu-winwrap { transform: none !important; }
  body.night .mu-neon.is-flicker .mu-neon-b, body.night .mu-svg .mu-note, body.night .mu-winwrap.is-singing .mu-mo { animation: none; }
}
