/* ══════════════════════════════════════════════════════════════════════
   MINESHAFT — twilight text-adventure. REX wordmark = lime #9DFF20 + Poppins.
   The drawing sits behind the prose; the searchlight reveals it; the text
   stays legible in the dark.
   ══════════════════════════════════════════════════════════════════════ */

/* SELF-HOSTED POPPINS (REQ-THRESHOLD-0003) — the wordmark/UI specify Poppins;
   we embed it rather than relying on a system fallback. Enclosed-app safe: the
   fonts are LOCAL, subsetted woff2 files under media/fonts/, referenced by a
   RELATIVE path (no external font URL). Built by build_poppins_fonts.py from the
   installed Poppins TTFs. The 700 face covers weights 700–900 so the wordmark's
   font-weight:800 resolves to real Poppins Bold (no faux-bold synthesis). */
@font-face{font-family:'Poppins';font-style:normal;font-weight:300;font-display:swap;
  src:url("media/fonts/poppins-300.woff2") format("woff2")}
@font-face{font-family:'Poppins';font-style:normal;font-weight:400;font-display:swap;
  src:url("media/fonts/poppins-400.woff2") format("woff2")}
@font-face{font-family:'Poppins';font-style:normal;font-weight:600 900;font-display:swap;
  src:url("media/fonts/poppins-700.woff2") format("woff2")}
:root{
  --lime:#9DFF20; --ink:#e8e4d8; --dim:#6b6659; --blood:#c0261f; --bg:#05060a;
  --light-r:190px; --lx:50%; --ly:50%;
}
*{box-sizing:border-box}
html,body{margin:0;height:100%;background:var(--bg);color:var(--ink);
  font-family:Georgia,'Times New Roman',serif;overflow:hidden;
  -webkit-font-smoothing:antialiased;-webkit-tap-highlight-color:transparent}
.screen{position:fixed;inset:0}
/* the [hidden] attribute must win over #threshold{display:grid} etc. */
[hidden]{display:none!important}
button{font-family:inherit;cursor:pointer}

/* ── THRESHOLD ─────────────────────────────────────────────────────── */
#threshold{display:grid;place-items:center;text-align:center;padding:6vh 6vw;z-index:20;
  background:radial-gradient(120% 90% at 50% -10%, #17100c 0%, #05060a 55%)}
.bulb{position:absolute;top:0;left:50%;width:2px;height:15vh;background:linear-gradient(#3a2a12,#0000);transform:translateX(-50%)}
.bulb::after{content:"";position:absolute;bottom:-9px;left:50%;width:15px;height:15px;margin-left:-7px;border-radius:50%;
  background:var(--blood);box-shadow:0 0 26px 10px rgba(192,38,31,.55),0 0 90px 40px rgba(192,38,31,.16);animation:flick 5s infinite}
@keyframes flick{0%,97%,100%{opacity:1}98%{opacity:.6}99%{opacity:.9}}
.thresh-inner{max-width:620px}
.wordmark{font-family:'Poppins',system-ui,sans-serif;color:var(--lime);font-weight:800;letter-spacing:.14em;font-size:clamp(34px,7vw,64px);margin:0 0 -.1em}
.thresh-title{font-family:'Poppins',system-ui,sans-serif;font-weight:300;letter-spacing:.6em;font-size:clamp(15px,3.4vw,26px);margin:.4em 0 0;padding-left:.6em}
.thresh-sub{color:var(--dim);font-style:italic;margin:1.4em 0 2.2em}
.gate-warn{color:#b7ada0;font-size:15px;line-height:1.6;max-width:46ch;margin:0 auto 1.6em}
.gate-btns{display:flex;gap:14px;justify-content:center;flex-wrap:wrap}
.btn-enter{background:transparent;color:var(--lime);border:1px solid var(--lime);padding:14px 30px;font-size:15px;letter-spacing:.06em;border-radius:2px;font-family:'Poppins',system-ui,sans-serif;transition:.25s}
.btn-enter:hover{background:var(--lime);color:#05130a;box-shadow:0 0 30px rgba(157,255,32,.5)}
.btn-leave{color:var(--dim);text-decoration:none;padding:14px 18px;font-size:14px;align-self:center;border-bottom:1px solid transparent}
.btn-leave:hover{color:var(--ink);border-bottom-color:var(--dim)}
.gate-hint{color:#4f4a40;font-size:12.5px;font-style:italic;margin-top:2em}

/* ── THREE-OPTION FIRST SCREEN (REQ-THRESHOLD-0009) ─────────────────── */
#choose{margin-top:.5em}
.choose-lead{color:#b7ada0;font-size:15px;line-height:1.6;margin:0 auto 1.6em;max-width:40ch}
.choose-btns{display:flex;gap:16px;justify-content:center;flex-wrap:wrap}
.btn-choose{display:flex;flex-direction:column;align-items:center;gap:4px;background:transparent;color:var(--lime);border:1px solid var(--lime);padding:16px 26px;min-width:150px;font-size:16px;letter-spacing:.06em;border-radius:2px;font-family:'Poppins',system-ui,sans-serif;cursor:pointer;transition:.25s}
.btn-choose:hover{background:var(--lime);color:#05130a;box-shadow:0 0 30px rgba(157,255,32,.5)}
.btn-choose .btn-sub{font-size:11.5px;letter-spacing:.02em;opacity:.7;font-style:italic;font-family:system-ui,sans-serif}
.btn-choose.btn-play{border-width:2px}
#help-panel{max-width:52ch;margin:1.8em auto 0;text-align:left;color:#b7ada0;font-family:system-ui,sans-serif;font-size:14px;line-height:1.6}
#help-panel h3{color:var(--lime);font-family:'Poppins',system-ui,sans-serif;font-weight:600;margin:0 0 .5em;text-align:center}
#help-panel b{color:var(--ink)}
#help-panel .btn-choose{min-width:0;flex-direction:row;padding:8px 18px;font-size:13px;margin:1em auto 0}
.disclosure{position:fixed;bottom:12px;left:0;right:0;max-width:660px;margin:0 auto;color:#6b6659;font-family:system-ui,sans-serif;font-size:12px;padding:0 16px}
.disclosure summary{cursor:pointer;color:#8a8474;text-align:center}
.disclosure ul{text-align:left;line-height:1.55;margin:.8em 0 0;padding-left:1.1em}
.disclosure b{color:#b7ada0}.disclosure code{color:#9a9384}

/* ── STAGE ─────────────────────────────────────────────────────────── */
#stage{background:#000;overflow:hidden;z-index:10;cursor:crosshair}
#art{position:absolute;inset:0;background-position:center;background-repeat:no-repeat;background-size:contain;
  opacity:0;transition:opacity 1.2s ease;filter:contrast(1.05) brightness(.62) saturate(.9)}
/* ARRIVAL: the incoming room's drawing COMES INTO VIEW through a dark iris that
   opens, blur→sharp — a door/focus resolve, never a snap (REQ-RENDER-0008).
   Uses #art's own clip-path + filter (distinct from the reveal cycle's --light-r
   and body.reveal-art opacity), so the two never fight. */
#art.arriving{animation:artArrive 1.15s cubic-bezier(.22,.61,.36,1) both}
@keyframes artArrive{
  0%  {clip-path:circle(3% at 50% 46%);filter:contrast(1.05) brightness(.30) saturate(.7) blur(9px)}
  60% {clip-path:circle(85% at 50% 46%);filter:contrast(1.05) brightness(.55) saturate(.85) blur(2px)}
  100%{clip-path:circle(150% at 50% 46%);filter:contrast(1.05) brightness(.62) saturate(.9) blur(0)}}
#shroud{position:absolute;inset:0;pointer-events:none;background:#000;
  -webkit-mask-image:radial-gradient(circle var(--light-r) at var(--lx) var(--ly),transparent 0%,transparent 34%,rgba(0,0,0,.86) 72%,#000 100%);
          mask-image:radial-gradient(circle var(--light-r) at var(--lx) var(--ly),transparent 0%,transparent 34%,rgba(0,0,0,.86) 72%,#000 100%)}
#stage::after{content:"";position:absolute;inset:0;pointer-events:none;mix-blend-mode:overlay;z-index:1;
  background:radial-gradient(circle calc(var(--light-r)*.9) at var(--lx) var(--ly),rgba(255,214,140,.15) 0%,rgba(255,180,90,.05) 55%,transparent 72%)}
body.steady #shroud{-webkit-mask-image:none;mask-image:none;background:radial-gradient(120% 120% at 50% 45%,transparent 62%,rgba(0,0,0,.5))}
body.steady #stage::after{display:none}body.steady #stage{cursor:default}
#grain{position:absolute;inset:0;pointer-events:none;opacity:.045;mix-blend-mode:overlay;z-index:2;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");animation:grain .5s steps(2) infinite}
@keyframes grain{0%{transform:translate(0,0)}50%{transform:translate(-4%,3%)}100%{transform:translate(3%,-2%)}}

/* a man's face, flashed in a corner under a brief red spotlight */
.face{position:absolute;width:clamp(84px,13vw,150px);aspect-ratio:3/4;z-index:6;
  opacity:0;overflow:hidden;border-radius:2px;pointer-events:none;background:#0a0708}
#face-tl{top:16px;left:16px}                 /* upper-left */
#face-tr{bottom:92px;right:16px}             /* lower-right — clear of the top-right menu + the prompt row */
.face.spot{aspect-ratio:1;border-radius:50%;background-repeat:no-repeat;background-color:#000}
.face.spot img{display:none}
/* DEF-0047: an animated side-image (the moving webp) plays LIVE inside a red
   CIRCULAR peep-hole. The <img> stays visible (unlike .spot); .face's overflow
   clips it to the circle, the red ::after tints it, and an inset ring sells the
   bored hole. Square box + 50% radius = circle. */
.face.anim{aspect-ratio:1;border-radius:50%;box-shadow:inset 0 0 0 2px rgba(0,0,0,.55),inset 0 0 14px 4px rgba(0,0,0,.6)}
/* one flat colour of light (red): a uniform red multiply over the photo — no gradient, no yellow */
.face img,.face video{width:100%;height:100%;object-fit:cover;filter:brightness(1.08) contrast(1.06)}
.face::after{content:"";position:absolute;inset:0;pointer-events:none;background:#c0261f;mix-blend-mode:multiply}
.face.lit{animation:faceReveal 5s ease forwards}
/* authored room side-images (DEF-0020/0043) stay visible — no flash-and-fade */
.face.persist{opacity:1}
/* REQ-ARTREVEAL-0011 / DEF-0045: authored side-images rest VERTICALLY CENTERED on
   their side (keep left/right), and float UP into that centered position. ID+class
   specificity is needed to beat #face-tl/#face-tr's corner top/bottom. */
#face-tl.persist,#face-tr.persist{top:50%;bottom:auto}
/* REQ-ARTREVEAL-0011 / DEF-0056: the side image starts in the CORNER of its side and
   glides to the VERTICAL CENTER over ~10s (slow enough to see); the image DOUBLES in
   size (1x -> 2x) as it travels in, and — on the circular (red peep-hole) faces — the
   mask DILATES from a small aperture to full over the same move. */
/* --drift-dur (default 10s) is set live by the debug red-circle-delay control (REQ-DEMO-0017) */
.face.persist.from-top{animation:floatCenterTop var(--drift-dur,10s) ease forwards}
.face.persist.from-bottom{animation:floatCenterBottom var(--drift-dur,10s) ease forwards}
/* circular faces (animated webp / spotlit ellipse) also dilate their aperture as they come in */
.face.persist.anim.from-top,.face.persist.spot.from-top{animation:floatCenterTop var(--drift-dur,10s) ease forwards,maskDilate var(--drift-dur,10s) ease forwards}
.face.persist.anim.from-bottom,.face.persist.spot.from-bottom{animation:floatCenterBottom var(--drift-dur,10s) ease forwards,maskDilate var(--drift-dur,10s) ease forwards}
.face.persist.anim,.face.persist.spot{box-shadow:none}   /* the fixed inset ring would mismatch the dilating aperture */
/* DEF-0057: as the circle doubles (scale 2), pull it INWARD toward center so the
   enlarged circle stays on-screen and is never cropped at the edge. from-top is the
   LEFT image (shift right), from-bottom is the RIGHT image (shift left). translateX
   is applied outside scale, so the ~78px inward shift is in real (unscaled) pixels —
   enough to clear the widest face's half-width at 2x. */
@keyframes floatCenterTop{from{opacity:.4;transform:translateY(calc(-50% - 42vh)) translateX(0) scale(1)}to{opacity:1;transform:translateY(-50%) translateX(78px) scale(2)}}
@keyframes floatCenterBottom{from{opacity:.4;transform:translateY(calc(-50% + 38vh)) translateX(0) scale(1)}to{opacity:1;transform:translateY(-50%) translateX(-78px) scale(2)}}
@keyframes maskDilate{from{clip-path:circle(24% at 50% 50%)}to{clip-path:circle(50% at 50% 50%)}}
/* REQ-ARTREVEAL-0012: outgoing side image glides off its own edge (a floating ghost
   clone; the real slot is free to paint the next room). left→left, right→right. */
/* z-index 11 keeps the gliding ghost ABOVE the #transition fade (z9) so the slide-off
   is actually visible instead of hidden behind the black room-change fade (DEF-0058). */
.face-ghost{position:fixed;overflow:hidden;border-radius:50%;pointer-events:none;z-index:11;
  background:#0a0708;background-repeat:no-repeat}
.face-ghost img,.face-ghost video{width:100%;height:100%;object-fit:cover;filter:brightness(1.08) contrast(1.06)}
.face-ghost::after{content:"";position:absolute;inset:0;background:#c0261f;mix-blend-mode:multiply}
.face-ghost.exit-left{animation:faceExitLeft .55s ease forwards}
.face-ghost.exit-right{animation:faceExitRight .55s ease forwards}
@keyframes faceExitLeft{from{transform:translateX(0);opacity:1}to{transform:translateX(-135vw);opacity:.1}}
@keyframes faceExitRight{from{transform:translateX(0);opacity:1}to{transform:translateX(135vw);opacity:.1}}
@media (prefers-reduced-motion:reduce){.face-ghost{display:none}}
/* REQ-DEMO-0019: red countdown clock — appears while the image-hold timer runs (debug only) */
#dbg-clock{position:fixed;top:14px;left:50%;transform:translateX(-50%);z-index:11;width:46px;height:46px;pointer-events:none}
#dbg-clock[hidden]{display:none}
#dbg-clock svg{width:100%;height:100%;transform:rotate(-90deg)}
.dbg-ring-bg{fill:none;stroke:rgba(192,38,31,.25);stroke-width:4}
.dbg-ring-fg{fill:none;stroke:#e0261f;stroke-width:4;stroke-linecap:round;filter:drop-shadow(0 0 4px rgba(224,38,31,.6))}
#dbg-num{position:absolute;inset:0;display:grid;place-items:center;font:700 14px/1 Poppins,system-ui;color:#ff5a4d}
@media (prefers-reduced-motion:reduce){
  .face.persist.from-top{animation:none;opacity:1;transform:translateY(-50%) translateX(78px) scale(2)}
  .face.persist.from-bottom{animation:none;opacity:1;transform:translateY(-50%) translateX(-78px) scale(2)}
  .face.persist.anim.from-top,.face.persist.anim.from-bottom,.face.persist.spot.from-top,.face.persist.spot.from-bottom{clip-path:circle(50% at 50% 50%)}
}
@keyframes faceReveal{
  0%{opacity:0;box-shadow:none}
  8%{opacity:1;box-shadow:0 0 46px 10px rgba(192,38,31,.9)}
  30%{opacity:1;box-shadow:0 0 22px 5px rgba(192,38,31,.45)}
  80%{opacity:.9;box-shadow:0 0 10px 2px rgba(192,38,31,.18)}
  100%{opacity:0;box-shadow:none}}
@media (prefers-reduced-motion:reduce){.face.lit{animation:faceReveal 5s linear forwards}}

/* room-to-room transition effects (keyed to how you move) */
#transition{position:absolute;inset:0;z-index:9;pointer-events:none;opacity:0;background:#000}
#transition.move{animation:trFade .5s ease}
#transition.down{animation:trDown .6s ease}
#transition.up{animation:trUp .6s ease}
#transition.tele{animation:trTele .75s ease}
@keyframes trFade{0%{opacity:0}45%{opacity:.7}100%{opacity:0}}
@keyframes trDown{0%{opacity:0;transform:translateY(-100%)}45%{opacity:1;transform:translateY(0)}100%{opacity:0;transform:translateY(100%)}}
@keyframes trUp{0%{opacity:0;transform:translateY(100%)}45%{opacity:1;transform:translateY(0)}100%{opacity:0;transform:translateY(-100%)}}
@keyframes trTele{0%{opacity:0;background:#c0261f}25%{opacity:.9;background:#c0261f}55%{opacity:.5;background:#2a0806}100%{opacity:0;background:#000}}
@media (prefers-reduced-motion:reduce){#transition{animation:none!important}
  /* reduced motion: no iris/blur — the drawing simply appears (REQ-RENDER-0003) */
  #art.arriving{animation:none!important;clip-path:none!important}}

/* the reveal cycle: spotlight opens to bare the whole drawing while the text fades out */
@property --light-r{syntax:"<length>";inherits:true;initial-value:190px}
html{transition:--light-r 1.3s ease}
#scroll,#exits,#hud,#art-cap{transition:opacity .8s ease}
body.reveal-art #scroll,body.reveal-art #exits,body.reveal-art #hud,body.reveal-art #art-cap{opacity:0}
/* REQ-DEMO-0031: in debug mode the typed-command scroll stays visible through reveals/audit */
body.debug.reveal-art #scroll{opacity:1}

/* HUD */
#hud{position:absolute;top:0;left:0;right:0;padding:18px 22px;z-index:5;pointer-events:none;
  font-family:'Poppins',system-ui,sans-serif;letter-spacing:.26em;font-size:12.5px;color:#9a9384;text-transform:uppercase;text-shadow:0 2px 10px #000}
#turns{color:#4f4a40;margin-left:14px;font-size:11px;letter-spacing:.1em}
#art-cap{position:absolute;top:44px;left:22px;z-index:5;font-style:italic;color:#e6dfce;font-size:12.5px;text-shadow:0 2px 10px #000,0 0 4px #000;pointer-events:none}
/* REQ-ARCH-0007: other players present ("X is in the room with you") — a warm,
   atmospheric line under the caption; stays legible even during the art reveal. */
#mp-presence{position:absolute;top:66px;left:22px;z-index:6;font-family:'Poppins',system-ui,sans-serif;
  font-size:12.5px;font-style:italic;letter-spacing:.02em;color:#e0a94a;
  text-shadow:0 2px 12px #000,0 0 6px #000;pointer-events:none}
#mp-presence[hidden]{display:none}

/* full-reveal info card (REQ-COMMERCE-0001): upper-left, below the face slot,
   only visible while body.reveal-art bares the drawing AND a print is parsed */
#art-card{position:absolute;top:clamp(140px,24vh,240px);left:22px;z-index:7;max-width:min(250px,62vw);
  background:rgba(12,13,18,.84);border:1px solid #2c2a24;border-radius:4px;padding:12px 14px;
  font-family:'Poppins',system-ui,sans-serif;backdrop-filter:blur(3px);
  opacity:0;pointer-events:none;transition:opacity .55s ease}
body.reveal-art #art-card.show{opacity:1;pointer-events:auto}
#art-card-name{color:var(--ink);font-size:13.5px;font-weight:600;letter-spacing:.04em;
  display:flex;align-items:center;gap:7px;line-height:1.35}
#art-card-dot{width:9px;height:9px;border-radius:50%;background:var(--blood);flex:none;
  box-shadow:0 0 8px rgba(192,38,31,.85)}
#art-card-meta{color:#cfc8b6;font-size:11.5px;letter-spacing:.03em;margin-top:4px}
/* per-drawing commentary note (REQ-COMMENTARY) — readable italic, high-contrast */
#art-card-note{color:#e6dfce;font-size:12px;line-height:1.45;font-style:italic;margin-top:8px;
  padding-top:8px;border-top:1px solid #34302a}
#art-card-note[hidden]{display:none}
/* debug: the drawing's keyword list, below the image info (REQ-DEMO) */
#art-card-keywords{color:var(--dbg,#4da6ff);font:600 11px/1.5 Poppins,system-ui;
  letter-spacing:.03em;margin-top:8px;padding-top:8px;border-top:1px solid #27435f}
#art-card-keywords[hidden]{display:none}
#art-card-room{color:var(--dbg,#4da6ff);font:700 12px/1.4 Poppins,system-ui;
  letter-spacing:.04em;margin-top:8px}
#art-card-room[hidden]{display:none}
#art-card-likes{color:#e0a94a;font:600 11.5px/1.4 Poppins,system-ui;letter-spacing:.03em;margin-top:6px}
#art-card-likes[hidden]{display:none}
#art-card-btn{margin-top:10px;background:transparent;border:1px solid var(--lime);color:var(--lime);
  font-family:'Poppins',system-ui,sans-serif;font-size:11.5px;letter-spacing:.05em;
  padding:6px 12px;border-radius:2px;transition:.2s}
#art-card-btn:hover{background:var(--lime);color:#05130a}
#art-card-btn.on{border-color:#6a6454;color:#9a9384}

/* narration scrollback */
#scroll{position:absolute;left:0;right:0;bottom:118px;max-height:52vh;overflow-y:auto;z-index:4;
  padding:0 clamp(18px,6vw,90px);display:flex;flex-direction:column;gap:.5em;
  -webkit-mask-image:linear-gradient(#0000,#000 42px);mask-image:linear-gradient(#0000,#000 42px)}
#scroll .line{max-width:70ch;line-height:1.6;text-shadow:0 2px 16px #000,0 0 30px #000}
#scroll .room{color:#e8e4d8;font-size:clamp(15px,2.1vw,18px)}
#scroll .obj{color:#cbb88a;font-style:italic}
#scroll .cast{color:#c9d98a}#scroll .cast::first-word{color:var(--lime)}
#scroll .sys{color:#b7ada0;font-size:14px}
#scroll .dark{color:#7a4b46}
#scroll .echo{color:var(--lime);font-family:'Poppins',system-ui,sans-serif;font-size:13px;letter-spacing:.02em;opacity:.85}
#scroll .hint,#scroll .line.hint{color:#5d5849;font-size:12.5px;font-style:italic}

/* exits */
#exits{position:absolute;left:0;right:0;bottom:64px;z-index:6;display:flex;gap:9px;justify-content:center;flex-wrap:wrap;padding:0 16px}
.exit{background:transparent;border:1px solid #2c2a24;color:#8a8474;padding:7px 14px;font-size:12.5px;
  font-family:'Poppins',system-ui,sans-serif;letter-spacing:.03em;border-radius:2px;transition:.22s}
.exit:hover{border-color:#6a6454;color:var(--ink);box-shadow:0 0 16px rgba(255,214,140,.15)}

/* command prompt */
#prompt-row{position:absolute;left:0;right:0;bottom:0;z-index:7;display:flex;align-items:center;gap:10px;
  padding:14px clamp(18px,6vw,90px);background:linear-gradient(#0000,#000c 60%)}
.caret{color:var(--lime);font-family:'Poppins',sans-serif;font-size:18px}
#cmd{flex:1;background:rgba(12,13,18,.5);border:1px solid #2c2a24;border-radius:3px;color:var(--ink);
  font-family:'Poppins',system-ui,sans-serif;font-size:15px;padding:11px 14px;outline:none;backdrop-filter:blur(3px)}
#cmd:focus{border-color:#5a6a30;box-shadow:0 0 20px rgba(157,255,32,.12)}
#cmd::placeholder{color:#4f4a40}

/* controls */
#controls{position:absolute;top:14px;right:16px;z-index:8;display:flex;gap:6px}
#controls button{width:34px;height:34px;border-radius:50%;font-size:14px;background:rgba(20,20,26,.5);
  border:1px solid #2c2a24;color:#9a9384;display:grid;place-items:center;transition:.2s;backdrop-filter:blur(3px)}
#controls button:hover{color:var(--ink);border-color:#6a6454}
#controls button.off{color:#5d3a37;border-color:#3a1f1c}
/* master-volume slider (REQ-AUDIO-0007) — sits inline with the round buttons */
#c-vol{-webkit-appearance:none;appearance:none;width:70px;height:4px;align-self:center;
  background:#2c2a24;border-radius:3px;outline:none;cursor:pointer}
#c-vol::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:12px;height:12px;
  border-radius:50%;background:var(--lime);box-shadow:0 0 8px rgba(157,255,32,.5);cursor:pointer}
#c-vol::-moz-range-thumb{width:12px;height:12px;border:none;border-radius:50%;
  background:var(--lime);box-shadow:0 0 8px rgba(157,255,32,.5);cursor:pointer}
#c-vol::-moz-range-track{height:4px;background:#2c2a24;border-radius:3px}
/* REQ-DEMO-0015/0017: image-hold + red-circle-drift circle controls, each with a
   vertical slider that pops below it. REQ-DEMO-0018: debug controls are BLUE. */
:root{--dbg:#4da6ff}
#c-dur-wrap,#c-drift-wrap{position:relative;display:inline-grid;place-items:center}
/* blue debug controls (toggle + image-hold + drift), distinct from the play controls */
#controls button.dbg{color:var(--dbg);border-color:#27435f}
#controls button.dbg:hover{color:#8fc9ff;border-color:var(--dbg)}
#controls button.dbg.on{color:var(--dbg);border-color:var(--dbg);box-shadow:0 0 9px rgba(77,166,255,.45)}
.ctl-pop{position:absolute;top:40px;left:50%;transform:translateX(-50%);z-index:9;
  display:flex;flex-direction:column;align-items:center;gap:8px;padding:12px 10px 10px;
  background:rgba(16,16,22,.94);border:1px solid #27435f;border-radius:10px;backdrop-filter:blur(4px);
  box-shadow:0 6px 20px rgba(0,0,0,.5)}
.ctl-pop[hidden]{display:none}
#c-dur,#c-driftv{-webkit-appearance:none;appearance:none;width:6px;height:120px;background:#2c2a24;
  border-radius:3px;outline:none;cursor:pointer;writing-mode:vertical-lr;direction:rtl}
#c-dur::-webkit-slider-thumb,#c-driftv::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;
  width:15px;height:15px;border-radius:50%;background:var(--dbg);box-shadow:0 0 8px rgba(77,166,255,.5);cursor:pointer}
#c-dur::-moz-range-thumb,#c-driftv::-moz-range-thumb{width:15px;height:15px;border:none;border-radius:50%;
  background:var(--dbg);box-shadow:0 0 8px rgba(77,166,255,.5);cursor:pointer}
#c-dur::-moz-range-track,#c-driftv::-moz-range-track{width:6px;background:#2c2a24;border-radius:3px}
#dur-val,#drift-val{font:600 12px/1 Poppins,system-ui;color:var(--dbg);min-width:3ch;text-align:center}
/* REQ-DEMO-0016/0017: debug log lines in the message list, blue and high-contrast */
.line.debug{color:var(--dbg);font:600 12px/1.5 ui-monospace,monospace;opacity:.95}

/* info panel */
#info-panel{position:absolute;inset:0;margin:auto;width:min(90vw,520px);height:max-content;z-index:30;
  background:#0c0d12;border:1px solid #2c2a24;border-radius:6px;padding:24px 26px;color:#b7ada0;
  font-family:system-ui,sans-serif;font-size:14px;line-height:1.6;box-shadow:0 30px 90px #000}
#info-panel h3{font-family:'Poppins',sans-serif;color:var(--lime);margin:0 0 12px;letter-spacing:.1em}
#info-panel .mini{font-size:12.5px;color:#8a8474}
#info-panel .disc{border-top:1px solid #23211b;padding-top:12px;margin-top:14px}
#info-close{margin-top:14px;background:transparent;border:1px solid #3a382f;color:#9a9384;padding:8px 18px;border-radius:2px}
#info-close:hover{border-color:#6a6454;color:var(--ink)}

@media (prefers-reduced-motion:reduce){.bulb::after,#grain{animation:none}#art{transition-duration:.2s}}

/* ══ 8mm peep-hole room ══════════════════════════════════════════════════
   Your eye to a hole bored in the plywood: a circular aperture of silent
   film in a field of black, the rest of the world shut out. */
#peep{position:fixed;inset:0;z-index:60;background:#000;
  display:flex;align-items:center;justify-content:center;
  opacity:0;transition:opacity .22s ease;pointer-events:none}   /* black field snaps in; the circle then dilates */
#peep.open,#peep.closing{opacity:1}
#peep.open{pointer-events:auto}
#peep-vid{width:74vmin;height:74vmin;object-fit:cover;border-radius:50%;
  /* feather the circle's edge into the dark — an eye pressed to a hole */
  -webkit-mask:radial-gradient(circle at 50% 50%,#000 60%,rgba(0,0,0,.5) 78%,transparent 92%);
          mask:radial-gradient(circle at 50% 50%,#000 60%,rgba(0,0,0,.5) 78%,transparent 92%);
  filter:contrast(1.12) brightness(.92) sepia(.28) saturate(.8);   /* aged film cast */
  transform:scale(1.01);
  /* REQ-FILM-0007: the peepshow aperture dilates open over the running video */
  clip-path:circle(0% at 50% 50%)}
#peep.open #peep-vid{animation:peepDilate 1s cubic-bezier(.18,.7,.15,1) forwards}
#peep.closing #peep-vid{animation:peepIris .5s ease forwards}
@keyframes peepDilate{0%{clip-path:circle(0% at 50% 50%)}100%{clip-path:circle(75% at 50% 50%)}}
@keyframes peepIris{0%{clip-path:circle(75% at 50% 50%)}100%{clip-path:circle(0% at 50% 50%)}}
/* projector flicker + a breathing vignette ring around the aperture */
#peep-flicker{position:absolute;width:78vmin;height:78vmin;border-radius:50%;
  box-shadow:0 0 22vmin 10vmin #000 inset, 0 0 0 100vmax #000;
  pointer-events:none;animation:peepFlick .09s steps(2) infinite}
@keyframes peepFlick{0%{opacity:.34}50%{opacity:.44}100%{opacity:.38}}
#peep-close{position:absolute;top:18px;right:18px;z-index:2;
  background:transparent;border:1px solid #3a382f;color:#9a9384;
  width:38px;height:38px;border-radius:50%;font-size:15px;cursor:pointer}
#peep-close:hover{border-color:#c0261f;color:#e7e2d6}
/* reward film: fullscreen payoff at the winning walk's victory */
#reward{position:fixed;inset:0;z-index:70;background:#000;
  display:flex;align-items:center;justify-content:center;
  opacity:0;transition:opacity .6s ease;pointer-events:none}
#reward.open{opacity:1;pointer-events:auto}
#reward-vid{max-width:100vw;max-height:100vh;width:auto;height:auto;object-fit:contain;
  filter:contrast(1.05) saturate(.96)}
#reward-close{position:absolute;top:18px;right:18px;z-index:2;
  background:transparent;border:1px solid #3a382f;color:#9a9384;
  width:38px;height:38px;border-radius:50%;font-size:15px;cursor:pointer}
#reward-close:hover{border-color:#c0261f;color:#e7e2d6}
/* the hint that a hole is here, shown only in the film room */
#peep-hint,#resume-hint{color:#c9a24b;cursor:pointer;text-decoration:underline dotted;
  text-underline-offset:3px}
#peep-hint:hover,#resume-hint:hover{color:#e7c777}
/* the running score can grow long — let the HUD wrap gracefully on narrow screens */
#turns{white-space:normal}
@media (prefers-reduced-motion:reduce){#peep-flicker{animation:none;opacity:.4}
  #peep.open #peep-vid,#peep.closing #peep-vid{animation:none;clip-path:circle(75% at 50% 50%)}}

/* ══ VISUAL-EFFECTS LAYER (REQ-FX-0001) ════════════════════════════════════
   Shared full-screen layer above everything (reward is z70; we sit at z80). The
   layer itself is inert; each effect overlay inside it turns on with `.run`. All
   display-only, non-interactive (pointer-events:none) so the turn loop underneath
   is never blocked. */
#fx-layer{position:fixed;inset:0;z-index:80;pointer-events:none}
.fx-overlay{position:absolute;inset:0;opacity:0;pointer-events:none;overflow:hidden}
.fx-overlay.run{opacity:1}
/* DEF-0059: placeholder-effect stub card — transparent (game shows through), high-contrast */
#fx-placeholder{display:grid;place-items:center;transition:opacity .3s ease}
#fx-placeholder .fxph-card{text-align:center;padding:24px 34px;border-radius:14px;
  background:rgba(10,8,10,.62);backdrop-filter:blur(3px);
  border:1px solid hsl(var(--fxph-hue,300) 80% 55% / .8);
  box-shadow:0 0 40px hsl(var(--fxph-hue,300) 85% 55% / .45)}
#fx-placeholder.run .fxph-card{animation:fxphPulse .5s ease}
#fx-placeholder .fxph-name{font:800 34px/1 Poppins,system-ui;letter-spacing:.02em;
  color:hsl(var(--fxph-hue,300) 90% 72%);text-shadow:0 2px 14px rgba(0,0,0,.7)}
#fx-placeholder .fxph-sub{margin-top:8px;font:600 13px/1.3 Poppins,system-ui;
  letter-spacing:.06em;text-transform:uppercase;color:#e6dfce}
@keyframes fxphPulse{from{transform:scale(.82);opacity:.2}to{transform:scale(1);opacity:1}}
@media (prefers-reduced-motion:reduce){#fx-placeholder.run .fxph-card{animation:none}}

/* ── POPPERS! (REQ-SURPRISE-0002) ─────────────────────────────────────────
   1) white strobe, 2) fading multicolour off-centre rotating circles,
   3) gigantic gradient "Poppers!" worm travelling lower-right → upper-left.
   The per-fire total duration comes in as --pop-ms (default 15s). */
/* ITC Candice Pro — self-hosted subset for the Poppers word (build_candice_font.py).
   LICENSING: ITC commercial font; enclosed personal build only — a public/shipped
   release needs a proper web-font licence. */
@font-face{font-family:'Candice Pro';font-style:normal;font-weight:400;font-display:swap;
  src:url("media/fonts/candice-pro.woff2") format("woff2")}

/* DEF-0060: transparent so the game shows THROUGH the effect (the opaque backdrop,
   when an effect is configured transparent:false, is painted on #fx-layer by the
   registry's _setBackdrop — NOT baked into the effect div). */
#fx-poppers{background:transparent;--pop-ms:15000ms}
#fx-poppers.run{animation:popShell var(--pop-ms) ease forwards}
@keyframes popShell{0%{opacity:0}5%{opacity:1}88%{opacity:1}100%{opacity:0}}

/* (1) white strobe over the first ~1.2s */
#fx-poppers .pop-strobe{position:absolute;inset:0;background:#fff;opacity:0}
#fx-poppers.run .pop-strobe{animation:popStrobe 1.2s steps(1) forwards}
@keyframes popStrobe{
  0%,20%,40%{opacity:1}10%,30%,55%{opacity:0}100%{opacity:0}}

/* (2) the orbiting translucent circle-groups bloom AND (3) the 20-step diagonal
   Candice-Pro "Poppers!" word extrusion are BOTH drawn on this canvas — see
   engine/effects/poppers.js (exact reference: docs/reference/poppers-circles-reference.html).
   Params: 6 circles/6 colours/6 groups, nest 77%, offset 11%, radius 87 fit,
   hard-light blend; groups fade outermost->innermost over ~15s. */
#fx-poppers .pop-canvas{position:absolute;inset:0;width:100%;height:100%}

/* ── MOLLY ROLL (REQ-SURPRISE-0003) ───────────────────────────────────────
   The screen fades to a drifting canvas point-network; fades out after ~15s. */
#fx-molly{background:transparent;--molly-ms:15000ms}   /* DEF-0060: game shows through (backdrop via #fx-layer) */
#fx-molly.run{animation:mollyShell var(--molly-ms) ease forwards}
@keyframes mollyShell{0%{opacity:0}12%{opacity:1}86%{opacity:1}100%{opacity:0}}
#fx-molly .molly-canvas{position:absolute;inset:0;width:100%;height:100%}

/* honour reduced-motion: keep the overlays but drop the churning animations */
@media (prefers-reduced-motion:reduce){
  /* the Poppers/Molly interstitials are brief and canvas-drawn; nothing to disable here. */
}
