/* Art direction / Level 08 — INSTRUMENT / CRUSH ARCHIVE
   The physical press remains the hero. UI behaves like attached readouts,
   never a second flat game screen. CSS only: all game behavior is inherited. */
:root{--d08-void:#070d11;--d08-steel:#26363d;--d08-white:#f4f1e8;--d08-mist:#bacccf;--d08-gauge:#80aeb4;--d08-danger:#f16d61;--d08-amber:#e5be70}
#app{background:#05090c}
#sceneShade{background:linear-gradient(180deg,rgba(1,4,7,.14) 0%,transparent 19%,transparent 67%,rgba(0,4,7,.53) 100%),radial-gradient(ellipse 95% 72% at 50% 43%,transparent 24%,rgba(0,3,7,.28) 100%);box-shadow:inset 0 0 40px #0204076e}
#sceneShade::before{opacity:.10;mix-blend-mode:multiply}
#sceneShade::after{inset:9px;border-color:rgba(214,226,226,.09)}
#app::before{opacity:.40;background:repeating-linear-gradient(0deg,transparent 0 91px,#b9dadb08 92px,transparent 93px)}
.hud-number{min-width:105px;min-height:62px;top:calc(env(safe-area-inset-top,0px) + 10px);padding:8px 10px 6px;border:1px solid #92b2b64c;background:linear-gradient(180deg,#060c10e8,#0a171dc4);box-shadow:inset 0 1px #c6d7db1e,0 8px 16px #0104088c,0 0 0 3px #0b161b2e;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px)}
.hud-number:before{width:31px;height:2px;background:#91c6ce}
.hud-number.timer{background:linear-gradient(180deg,#180b0ce8,#100e14ca);border-color:#ea888445}
.hud-number.timer:before{background:#f08076}
.hud-number small{font:800 9px/1.2 var(--sans);color:#c2d1d3;letter-spacing:.08em}
.hud-number strong{font:900 clamp(23px,6.7vw,31px)/1.12 var(--sans);letter-spacing:-.03em}
.hud-number.timer strong{color:#ffa196}
.hud-top-center{top:calc(env(safe-area-inset-top,0px) + 78px);padding:3px 11px 3px 20px;min-width:max-content;background:#071116ab;border:1px solid #a95e5445;color:#f3c7b5;font:800 9px/1.3 var(--sans);letter-spacing:.16em}
.hud-top-center:before{top:3px;left:8px}
#dangerMessage{top:calc(env(safe-area-inset-top,0px) + 105px);max-width:calc(100% - 30px);padding:3px 11px;border:0;background:linear-gradient(90deg,transparent,#2b0709bc 16% 84%,transparent);font:900 clamp(17px,4.5vw,21px)/1.5 var(--serif);color:#ff8b7b;text-shadow:0 1px 8px #000,0 0 22px #5a0000b0}
#dangerMessage.dim{background:linear-gradient(90deg,transparent,#221508b3 16% 84%,transparent)}
#soliloquy{top:calc(env(safe-area-inset-top,0px) + 142px);left:7%;right:7%;max-width:86%;padding:9px 12px;background:linear-gradient(90deg,transparent,#020609e8 10% 90%,transparent);border-top:1px solid #f4f0db69;border-bottom:1px solid #f4f0db69;border-left:0;border-right:0;box-shadow:0 9px 24px #0007;line-height:1.6;letter-spacing:.02em}
/* Keypad / readout are one physical module; reserve 48px touch targets */
.stage-info{top:auto!important;bottom:calc(env(safe-area-inset-bottom,0px) + 317px)!important;left:calc(env(safe-area-inset-left,0px) + 11px);width:122px;min-width:0;max-width:122px;padding:7px 4px 8px;gap:2px;justify-content:center;align-items:center;flex-direction:column!important;height:auto!important;background:linear-gradient(180deg,#0d1e26ed,#0a141be6);border:1px solid #a7c9cc77;border-bottom:0;border-left:3px solid #8fd0d0;box-shadow:0 6px 20px #0009}
#stageText{font:900 11px/1.15 var(--sans);letter-spacing:.02em}
#inputText{font:800 10px/1.3 var(--sans);color:#c9e5e7;border-left:0;padding:0}
#keypad{left:calc(env(safe-area-inset-left,0px) + 11px);bottom:calc(env(safe-area-inset-bottom,0px) + 26px);width:122px;padding:8px;background:linear-gradient(160deg,#182932f0,#07151ddf);border:1px solid #91b2b7a1;box-shadow:0 0 0 4px #01060836,0 14px 30px #000d,inset 1px 1px #efffff26}
#keypad:before{content:'MEMORY  /  01–09';top:-17px;left:-1px;right:-1px;height:16px;color:#c6e0df;line-height:14px;letter-spacing:.06em;font-size:8px;display:block;text-align:center;background:#10232a}
#keys{gap:4px;grid-template-columns:repeat(2,48px)}
.key{border-radius:4px;border-color:#94acb5;box-shadow:inset 1px 2px #eefaff40,inset 0 -5px 7px #051019c4,0 2px 1px #01080b;transition:transform .07s,box-shadow .08s,background .08s}
.key:after{width:50%;height:28%;opacity:.54}
.key:focus-visible{outline-color:#ffe6a5;outline-offset:1px}
#joystick{bottom:calc(env(safe-area-inset-bottom,0px) + 32px);width:90px;height:90px;border:1px solid #b7d5d0ac;background:radial-gradient(circle at 50% 50%,#7ab2b318 0 31%,#1a3d467a 33% 53%,#031018d6 84%);box-shadow:0 8px 30px #000a,inset 0 0 12px #badbdd22}
#joystick span{font-size:10px;letter-spacing:.08em}
#gamePrompt{left:calc(env(safe-area-inset-left,0px) + 146px);right:calc(env(safe-area-inset-right,0px) + 12px);bottom:calc(env(safe-area-inset-bottom,0px) + 126px);min-height:48px;max-height:82px;display:flex;align-items:center;justify-content:center;padding:7px 9px;background:linear-gradient(90deg,#04111700,#051118e9 10%,#051118e9 90%,#04111700);border-left:0;border-right:0;border-top:1px solid #b2c6c66b;border-bottom:1px solid #b2c6c66b;color:#fff9e9;font:900 clamp(12px,3.65vw,16px)/1.5 var(--serif);text-align:center;text-shadow:0 2px 6px #000}
/* Four-page narrative: fixed physical-text dossier window, never resizes per line. */
#dialogue,#outroDialogue{background:linear-gradient(180deg,#01040648,transparent 40%,#010407b8 100%)}
.dialogue-ambient{top:calc(env(safe-area-inset-top,0px) + 100px);padding:7px 14px;border:1px solid #d7e6dd4a;border-left:0;border-right:0;background:#071219ac;color:#ebeee8d2;font:800 11px var(--sans);letter-spacing:.15em}
.dialogue-panel{height:190px;max-height:min(35dvh,190px);left:12px;right:12px;bottom:calc(env(safe-area-inset-bottom,0px) + 20px);padding:22px 19px 16px;background:linear-gradient(135deg,#09151aed,#0a0f12f5 55%,#142128f0);border:1px solid #c6d8d2a8;border-left:4px solid #d4e1da;box-shadow:0 6px 0 #01050899,0 20px 55px #000e}
.dialogue-panel:before{top:7px;left:10px;right:10px;border-top:1px solid #e5f2ed20}
.dialogue-panel:after{border-color:#c2dcd5}
.dialogue-text{font:900 clamp(20px,5.55vw,27px)/1.65 var(--serif);letter-spacing:.015em;color:#f5f3e9;text-shadow:0 2px 3px #000}
.dialogue-footer{padding-top:7px;border-top:1px solid #e1e9e33a;font:700 10px/1.2 var(--sans);color:#b5c6c3}
.dialogue-footer span:last-child{color:#efe5cf}
.quick-nav{top:calc(env(safe-area-inset-top,0px) + 10px)!important;bottom:auto!important;gap:6px}
.quick-nav button{min-width:54px;min-height:42px;padding:8px 9px;background:linear-gradient(180deg,#162a32e8,#071218dc);border:1px solid #9fc0c283;color:#e2f0ec;font:800 11px var(--sans);box-shadow:0 2px 7px #0009}
#countdown{background:radial-gradient(ellipse at center,#0610158f,#010609dc)}
#countdown .warning-line{width:min(calc(100% - 30px),360px);min-height:112px;padding:23px 20px;border:1px solid #d277696b;border-left:4px solid #ee796b;background:linear-gradient(140deg,#0b151ae0,#1c0b0ef5);box-shadow:0 20px 50px #000e;line-height:1.55}
#countdown .warning-line:before{top:-24px;left:0;color:#f9ae92}
#countdown small{letter-spacing:.12em;color:#ffbeb6}
/* End is a forensic cinema frame, with scarlet fail and frost-blue success. */
.result-screen{--endAccent:#ff796e;overflow:hidden!important;background:radial-gradient(ellipse 100% 55% at 50% 0%,#46181ad0,#150b0f 54%,#060b0f 100%)!important}
.result-screen.is-success{--endAccent:#89e4dc;background:radial-gradient(ellipse 100% 55% at 50% 0%,#124852,#0c242c 54%,#060d14 100%)!important}
.result-screen:before{background:repeating-linear-gradient(180deg,transparent 0px 4px,#05090b20 5px 6px),linear-gradient(90deg,#0009,transparent 7% 93%,#0009);pointer-events:none}
.result-content{padding:calc(env(safe-area-inset-top,0px) + 18px) 18px calc(env(safe-area-inset-bottom,0px) + 13px);gap:clamp(4px,1.15dvh,10px);height:100%;max-width:460px;justify-content:center}
.end-tag{font:900 12px/1.1 var(--sans);letter-spacing:.26em;padding:7px 20px 0;border-top:3px solid var(--endAccent);color:var(--endAccent)}
.result-content h1{font:900 clamp(22px,6vw,31px)/1.32 var(--serif);letter-spacing:.01em;color:#fffaf0;text-shadow:0 3px 10px #000}
.result-content #resultCopy{font:800 clamp(11px,3.1vw,14px)/1.45 var(--serif);color:#cddce0}
.end-illustration{width:min(100%,365px);height:clamp(124px,31dvh,266px);margin:5px auto 3px;border:2px solid var(--endAccent);outline:4px solid #b0cacc1c;box-shadow:0 18px 38px #000b;background:#02080c}
.end-illustration img{filter:contrast(1.07) saturate(1.03)}
.end-illustration:after{background:linear-gradient(transparent,#071016dc);letter-spacing:.13em;font-size:9px}
#resultStats{color:var(--endAccent);font:900 13px var(--sans);letter-spacing:.04em}
.result-content button{transition:filter .13s,transform .09s;touch-action:manipulation}
.result-content button:active{filter:brightness(1.19);transform:translateY(1px)}
.result-content .primary{color:#071116;background:linear-gradient(105deg,#f8f6e9,#c5d3d2);border:1px solid #eaf5ed;box-shadow:0 3px 0 #71888c}
.result-content .share{color:#03151a;background:linear-gradient(105deg,#a7eaef,#56bec8);border:1px solid #b8f9f7;box-shadow:0 3px 0 #257078}
.result-content .quiet{border-color:#9eb4b99c;color:#dcece9;background:#0a1c21bd;min-height:38px}
.result-links button{border-color:#9bb2b86b;background:#0b161bd4;color:#e6eeee}
/* Archive: a museum-like plate of the experiment, not two anonymous cards */
.panel-screen{background:radial-gradient(ellipse at 50% -18%,#263d45 0%,#0d1b22 49%,#071018 100%);padding:calc(env(safe-area-inset-top,0px) + 19px) 16px calc(env(safe-area-inset-bottom,0px) + 18px)}
.panel-screen:before{content:'';position:absolute;top:0;left:8px;right:8px;height:100%;border-inline:1px solid #bbd3d413;pointer-events:none}
.panel-head{position:relative;max-width:650px;margin-bottom:27px;padding-bottom:16px;border-bottom:1px solid #bfdbda5c;z-index:1}
.panel-head:after{bottom:1px;left:0;font:800 9px var(--sans);letter-spacing:.19em;color:#a0c2c4a8}
.panel-head h2{font:900 clamp(26px,7vw,33px)/1.2 var(--serif);letter-spacing:.06em;color:#fff9ec}
.panel-head button{min-width:75px;min-height:43px;background:#11242bd9;border:1px solid #afcace6e;border-radius:2px;font:800 12px var(--sans)}
.record-stats{gap:9px;margin:6px auto 18px}
.record-stats p{min-height:78px;padding:11px 12px 10px;border:1px solid #aac6c659;background:linear-gradient(135deg,#243841bf,#0f252ebf);color:#bcd0d1;font:800 11px/1.3 var(--sans)}
.record-stats strong{font:900 23px/1.1 var(--sans);color:#f5f3eb}
.record-cards{gap:10px}
.record-card{border-radius:1px;border:1px solid #a2bbc26d;background:linear-gradient(180deg,#1b3038,#0b1c24);box-shadow:0 12px 22px #0003}
.record-card:nth-child(1){border-bottom:3px solid #dc7d75}.record-card:nth-child(2){border-bottom:3px solid #80c7ca}
.record-card .thumb{aspect-ratio:4/5;max-height:30dvh;object-fit:cover}
.record-card .unknown{background:repeating-linear-gradient(135deg,#1b2b33 0 10px,#1e3139 10px 11px);color:#adbec2;font-size:clamp(28px,7vw,43px)}
.record-card .cardname{display:block;min-height:55px;padding:11px 10px;color:#f3f3ee;font:900 clamp(11px,3.15vw,14px)/1.45 var(--serif)}
.record-card:disabled{opacity:.85;box-shadow:none}
.panel-help{font:700 12px/1.65 var(--sans);color:#c0d3d3;margin-top:17px}
/* Settings: three purposeful physical switches with readable on/off states */
.settings-list{gap:12px;max-width:650px}
.settings-list label{min-height:76px;padding:15px 17px;border:1px solid #a9c4c46f;border-left:4px solid #8fbec0;background:linear-gradient(110deg,#22353ecf,#13282fdb);box-shadow:inset 0 1px #d4f4f51b,0 8px 18px #0003;font:900 clamp(17px,4.3vw,21px) var(--serif);gap:12px}
.settings-list input{appearance:none!important;inline-size:55px!important;block-size:31px!important;min-width:55px;min-height:31px;margin:0;border-radius:30px;border:2px solid #a1b3b7a8;background:#3c4b54;position:relative;box-shadow:inset 0 2px 4px #0007;transition:background .12s}
.settings-list input:after{content:"";position:absolute;top:3px;left:3px;width:21px;height:21px;transform:none;border-radius:50%;background:#f4f6ef;box-shadow:0 1px 4px #0009;transition:transform .13s}
.settings-list input:checked{background:#277c7c;border-color:#8fdcdb}
.settings-list input:checked:after{transform:translateX(23px)}
.settings-list label:has(input:checked){border-left-color:#8ce5dc}
.settings-list label:has(input:not(:checked)){border-left-color:#667c83}
/* Viewer: a genuine inspection light table */
.viewer{background:radial-gradient(ellipse at center,#19272e 0%,#020507 80%);z-index:75;gap:14px}
.viewer:before{content:'';position:absolute;inset:11px;border:1px solid #a8c6c52d;pointer-events:none}
.viewer-close{background:#1c3039e8;color:#fff4e8;border-color:#abc2c2a8;border-radius:1px}
#viewerStage{background:radial-gradient(ellipse at center,#24363d,#0b1317 76%);width:calc(100% - 16px);height:74%;max-width:580px;border:1px solid #79949c52;box-shadow:inset 0 0 20px #0009;overflow:hidden}
#viewerStage img{max-width:95%;max-height:94%;box-shadow:0 16px 36px #000b}
.viewer-controls{gap:8px}
.viewer-controls button{min-width:47px;min-height:47px;border-radius:1px;border:1px solid #96b0b7a3;background:#1c333dcc;color:#f5f8f7}
#zoomLabel{font:900 13px var(--sans);color:#eff8f5;min-width:50px;text-align:center}
/* Pause overlay: an unmistakable stopped process, not a generic modal */
#resume{background:linear-gradient(180deg,#041116c7,#02070ee8);backdrop-filter:blur(5px)}
.resume-box{max-width:390px;padding:28px 22px 24px;border:1px solid #c0d5d59b;border-left:5px solid #ddbd8c;background:linear-gradient(135deg,#162932f4,#0b151ced);box-shadow:0 22px 60px #000d}
.resume-box h2{font:900 24px/1.4 var(--serif);color:#f8f3e7}
.resume-box p{font:700 13px/1.8 var(--sans);color:#c5d3d3}
.resume-box .primary{min-height:52px;background:linear-gradient(90deg,#fff8dc,#bfcfc9)}
/* QA console looks intentionally administrative, with stronger navigation. */
.debug-screen{background:radial-gradient(ellipse at 50% 0%,#1f3540,#08131b 58%)}
.debug-screen header{padding:calc(env(safe-area-inset-top,0px) + 13px) 15px 12px;background:#10222ae3;border-bottom:2px solid #8ac8c9;gap:12px}
.debug-screen header strong{font:900 17px var(--sans);letter-spacing:.045em}
.debug-screen header small{color:#c6dce0;font-size:10px;line-height:1.5}
.debug-screen header button{flex-shrink:0;background:#27424ac9;border:1px solid #b0d3d2;min-width:46px;min-height:46px}
.debug-scroll{padding:6px 14px calc(env(safe-area-inset-bottom,0px) + 30px)}
.debug-scroll h2{margin:24px 0 12px;padding-bottom:8px;border-bottom:1px solid #95c2c45d;font:900 20px var(--serif);color:#f7f4e9}
.debug-btns{gap:8px}.debug-btns button{min-height:48px}
.debug-btns button,.debug-lines button,.debug-images button{border-radius:1px;border-color:#94b7be72;background:linear-gradient(120deg,#213b46,#132834);color:#edf6f4;box-shadow:inset 0 1px #ffffff13}
.debug-lines button{padding:10px 11px;min-height:43px;font:800 12px/1.6 var(--sans)}
.debug-images{gap:9px}.debug-images button{padding:6px}
.debug-images img{width:100%;height:auto;max-height:38dvh;aspect-ratio:4/5;object-fit:contain;background:#060c10}
.debug-info{padding:14px 10px;border:1px solid #96b8bc61;background:#07151d94;color:#c4d9d8}
/* Keep all primary destinations within 1 screen even on compact devices. */
@media(max-height:700px){
 .dialogue-ambient{top:calc(env(safe-area-inset-top,0px) + 57px)}
 .dialogue-panel{height:151px;max-height:34dvh;padding:15px 15px 12px}
 .dialogue-text{font-size:clamp(18px,5.2vw,22px);line-height:1.55}
 .end-illustration{height:clamp(107px,23dvh,168px)}
 .result-content{gap:4px;padding-top:calc(env(safe-area-inset-top,0px) + 8px);padding-bottom:calc(env(safe-area-inset-bottom,0px) + 6px)}
 .result-content h1{font-size:clamp(19px,6.2vw,24px)}
 .result-content .primary,.result-content .share{min-height:42px;font-size:15px}
 .result-links button{min-height:39px}
 .stage-info{bottom:calc(env(safe-area-inset-bottom,0px) + 307px)!important}
 #keypad{bottom:calc(env(safe-area-inset-bottom,0px) + 17px)}
 #gamePrompt{bottom:calc(env(safe-area-inset-bottom,0px) + 112px);left:133px;right:6px}
 #joystick{bottom:calc(env(safe-area-inset-bottom,0px) + 25px)}
 #soliloquy{top:calc(env(safe-area-inset-top,0px) + 129px)!important}
}
@media(max-width:340px){
 .hud-number{min-width:101px;min-height:61px;padding:7px}
 .hud-number strong{font-size:22px}
 #keypad,.stage-info{left:5px;width:122px}
 #gamePrompt{left:131px;right:4px;min-height:42px;padding:5px;font-size:12px}
 .dialogue-panel{left:8px;right:8px}
 .record-card .cardname{padding:8px 6px;font-size:11px}
}
@media(min-width:700px){
 .hud-number strong{font-size:28px}
 .stage-info{left:12px}
 #keypad{left:12px}
}
@media(prefers-reduced-motion:reduce){.key,.settings-list input,.settings-list input:after,.result-content button{transition:none!important}}

/* End themes and SE audition: debug only */
.debug-audio{border-top:1px solid #46616b;padding:12px 0 20px;margin:12px 0}.debug-audio h3{font:800 13px/1.6 sans-serif;color:#d6e2e4;margin:0 0 9px}.debug-audio .debug-actions{display:grid;grid-template-columns:1fr;gap:7px}.debug-audio button{display:block;min-height:44px;text-align:left;padding:9px 11px;background:#172e38;color:#f2f4ef;border:1px solid #527784;border-radius:4px;font:700 11px/1.45 sans-serif;overflow-wrap:anywhere}.debug-audio button:active{background:#315461}

/* Small-screen copy must wrap as whole phrases, not one stray character. */
#gamePrompt{text-wrap:balance}
/* In short landscape/split layouts the stage readout previously covered the
   ceiling-distance readout. Only separate those two fixed panels here. */
@media (max-height:480px) and (min-width:600px){
 .stage-info{top:calc(env(safe-area-inset-top,0px) + 9px)!important;bottom:auto!important;left:calc(env(safe-area-inset-left,0px) + 135px)!important;max-width:116px!important;width:116px!important}
}

/* v16: minimize tactile delay without changing keypad geometry or palette. */
.key{transition:transform .035s linear,box-shadow .045s linear,background .045s linear;-webkit-touch-callout:none}

/* Compact landscape: keep the existing monologue readable without covering
   the keypad. No change to portrait layouts, wording or interaction. */
@media (max-height:480px) and (min-width:600px){
 #soliloquy{
  left:calc(env(safe-area-inset-left,0px) + 139px)!important;
  right:calc(env(safe-area-inset-right,0px) + 10px)!important;
  max-width:calc(100% - 151px)!important;
  top:calc(env(safe-area-inset-top,0px) + 106px)!important;
  padding:5px 8px!important;
  font-size:clamp(14px,2.4vw,18px)!important;
  line-height:1.5!important;
 }
}
