:root{--ink:#f2e8d7;--muted:#b8ad9c;--gold:#e6c883;--violet:#b9a8e3;--panel:rgba(10,11,20,.82);--line:rgba(230,200,131,.24)}
*{box-sizing:border-box;margin:0;padding:0}html,body,#game{width:100%;height:100%;overflow:hidden}body{background:#090a11;color:var(--ink);font-family:"Noto Sans TC","PingFang TC","Microsoft JhengHei",sans-serif;user-select:none;touch-action:none}button{font:inherit}button:focus-visible{outline:2px solid var(--gold);outline-offset:3px}canvas{display:block;width:100%;height:100%;touch-action:none}#game{position:relative}#ui{position:absolute;inset:0;z-index:10;pointer-events:none}
#vignette,#grain,#flash{position:absolute;inset:0;pointer-events:none;z-index:3}#vignette{background:radial-gradient(circle,transparent 35%,rgba(1,2,7,.23) 68%,rgba(1,2,6,.7) 118%)}#grain{opacity:.1;mix-blend-mode:soft-light;background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 150 150' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");animation:grain .7s steps(2) infinite}#flash{background:radial-gradient(circle,rgba(239,221,177,.25),transparent 60%);opacity:0;transition:.3s}#flash.show{opacity:1}@keyframes grain{0%{transform:translate(0)}50%{transform:translate(1.3%,-1%)}100%{transform:translate(-1%,1%)}}body.glitch canvas{filter:contrast(1.12) saturate(.72) hue-rotate(10deg)}body.glitch #grain{opacity:.3;animation-duration:.08s}
.screen{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;pointer-events:auto;z-index:30;background:radial-gradient(circle at 50% 38%,rgba(38,35,55,.76),rgba(5,6,12,.97) 72%);opacity:0;visibility:hidden;transition:.4s}.screen.show{opacity:1;visibility:visible}.card,.journal-card{width:min(92vw,690px);max-height:88dvh;overflow:auto;padding:clamp(1.35rem,4vw,2.3rem);border:1px solid var(--line);border-radius:22px;background:var(--panel);box-shadow:0 24px 80px rgba(0,0,0,.54);backdrop-filter:blur(18px);text-align:center}.card h2,.journal-card h2{font-weight:300;letter-spacing:.13em;font-size:clamp(1.55rem,5vw,2.25rem);margin:.3rem 0 .8rem}.card p{color:var(--muted);font-size:.92rem;line-height:1.8}.eyebrow{font-size:.66rem;letter-spacing:.25em;color:var(--gold);text-transform:uppercase}.actions{display:flex;gap:.75rem;justify-content:center;flex-wrap:wrap;margin-top:1.35rem}.btn,.tiny,.circle{pointer-events:auto;cursor:pointer;color:var(--ink);border:1px solid var(--line);background:rgba(28,27,41,.78)}.btn{padding:.72rem 1.25rem;border-radius:999px;min-width:145px}.btn.primary{color:#19150e;background:linear-gradient(135deg,#f0dfad,#cda962);font-weight:700;border:0}.tiny{padding:.48rem .78rem;border-radius:999px;font-size:.75rem}.circle{width:38px;height:38px;border-radius:50%}.btn:hover,.tiny:hover,.circle:hover,.settings button:hover,.choice-grid button:hover,.ending-grid button:hover{transform:translateY(-2px);border-color:rgba(230,200,131,.6)}
#title{z-index:50;background:radial-gradient(ellipse at 50% 38%,rgba(47,43,66,.84),rgba(5,6,12,.99) 72%)}.title-wrap{width:min(92vw,770px);padding:2rem;text-align:center}.title-seal{width:74px;height:74px;border:1px solid rgba(230,200,131,.48);border-radius:50%;display:grid;place-items:center;margin:0 auto 1rem;color:var(--gold);font-size:1.6rem;box-shadow:0 0 45px rgba(230,200,131,.12)}#title h1{font-weight:300;font-size:clamp(2.15rem,7vw,4.2rem);letter-spacing:.23em;text-indent:.23em;text-shadow:0 0 44px rgba(230,200,131,.2)}.subtitle{font-size:.72rem;letter-spacing:.26em;color:#b4a68e;margin-top:.5rem}.title-wrap>p{max-width:560px;margin:1.35rem auto 0;color:#bdb2a1;font-size:.9rem;line-height:1.85}.tags{display:flex;justify-content:center;flex-wrap:wrap;gap:.45rem;margin-top:1rem}.tags span{font-size:.68rem;color:#c8bdac;padding:.3rem .58rem;border-radius:999px;border:1px solid rgba(230,200,131,.15);background:rgba(8,9,16,.35)}.mini-actions{display:flex;justify-content:center;gap:.5rem;flex-wrap:wrap;margin-top:.85rem}.title-wrap small{display:block;color:#81786d;font-size:.68rem;line-height:1.6;margin-top:1rem}
#hud{position:absolute;inset:0;opacity:0;transition:.6s;z-index:12}#hud.visible{opacity:1}.hud-left,.hud-right{position:absolute;top:max(14px,env(safe-area-inset-top));display:flex;gap:8px;align-items:center;flex-wrap:wrap}.hud-left{left:max(14px,env(safe-area-inset-left))}.hud-right{right:max(14px,env(safe-area-inset-right));justify-content:flex-end}.chip{padding:.43rem .72rem;border:1px solid rgba(230,200,131,.2);border-radius:9px;background:rgba(9,10,18,.58);backdrop-filter:blur(12px);font-size:.76rem;color:#c8bdac;white-space:nowrap}.chip b{color:#f2dca6}.chip.muted{color:#9e96a3}#objective{position:absolute;top:max(14px,env(safe-area-inset-top));left:50%;transform:translateX(-50%);width:min(42vw,470px);padding:.54rem .85rem;border:1px solid rgba(185,168,227,.18);border-radius:11px;background:rgba(9,10,18,.66);backdrop-filter:blur(13px);text-align:center}#objective small{display:block;color:#a89bd0;font-size:.57rem;letter-spacing:.18em;margin-bottom:.15rem}#objectiveText{font-size:.76rem;line-height:1.35}#echoStatus,#saveToast{position:absolute;bottom:max(18px,env(safe-area-inset-bottom));padding:.42rem .7rem;border-radius:999px;background:rgba(9,10,18,.55);border:1px solid rgba(185,168,227,.18);font-size:.7rem;backdrop-filter:blur(10px)}#echoStatus{left:max(18px,env(safe-area-inset-left));color:#cec1e8}#saveToast{right:max(18px,env(safe-area-inset-right));color:#a99e8d;opacity:0;transition:.3s}#saveToast.show{opacity:1}.hidden{display:none!important}
#crosshair{position:absolute;left:50%;top:50%;width:18px;height:18px;transform:translate(-50%,-50%);opacity:0;transition:.2s;z-index:15}#crosshair.visible{opacity:.75}#crosshair:before,#crosshair:after{content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);background:rgba(244,229,195,.7)}#crosshair:before{width:13px;height:1px}#crosshair:after{width:1px;height:13px}#crosshair.active{transform:translate(-50%,-50%) scale(1.25)}#crosshair.active:before,#crosshair.active:after{background:#f1d087;box-shadow:0 0 11px #f1d087}#prompt{position:absolute;left:50%;top:calc(50% + 30px);transform:translateX(-50%) translateY(5px);padding:.3rem .65rem;border-radius:999px;border:1px solid rgba(230,200,131,.18);background:rgba(7,8,14,.67);font-size:.68rem;opacity:0;transition:.2s;white-space:nowrap;z-index:16}#prompt.show{opacity:1;transform:translateX(-50%)}
#message{position:absolute;left:50%;bottom:12%;transform:translate(-50%,12px);width:min(90vw,620px);padding:1rem 1.25rem;border:1px solid rgba(230,200,131,.24);border-radius:15px;background:rgba(9,10,19,.84);box-shadow:0 18px 65px rgba(0,0,0,.45);backdrop-filter:blur(16px);text-align:center;opacity:0;transition:.35s;z-index:18}#message.show{opacity:1;transform:translate(-50%)}#message small{color:var(--gold);font-size:.6rem;letter-spacing:.2em}#message h3{font-size:1.05rem;letter-spacing:.07em;margin:.25rem 0}#message p{color:#ddd3c4;font-size:.87rem;line-height:1.7;white-space:pre-line}#msgSigil{display:inline-block;margin-top:.5rem;padding:.24rem .55rem;border-radius:999px;border:1px solid rgba(185,168,227,.25);font-size:.68rem;color:#cfc2e8}#toastStack{position:absolute;top:16%;left:50%;transform:translateX(-50%);display:flex;flex-direction:column;gap:7px;align-items:center;z-index:22}.toast{max-width:min(88vw,520px);padding:.46rem .82rem;border-radius:999px;border:1px solid rgba(185,168,227,.23);background:rgba(17,15,28,.84);color:#e0d8ec;font-size:.73rem;opacity:0;transform:translateY(-7px);transition:.28s;backdrop-filter:blur(12px)}.toast.show{opacity:1;transform:none}#chapterCard{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%) scale(.96);text-align:center;opacity:0;transition:.7s;z-index:20;text-shadow:0 6px 28px #000}#chapterCard.show{opacity:1;transform:translate(-50%,-50%)}#chapterCard small{color:#d2bd83;letter-spacing:.35em;font-size:.62rem}#chapterCard h2{font-weight:300;font-size:clamp(1.7rem,5vw,3rem);letter-spacing:.3em;text-indent:.3em;margin:.45rem 0}#chapterCard p{color:#c5baaa;font-size:.78rem;letter-spacing:.07em}
.settings{display:grid;grid-template-columns:repeat(2,1fr);gap:.65rem;margin-top:1.2rem}.settings button,.choice-grid button,.ending-grid button{pointer-events:auto;cursor:pointer;text-align:left;color:var(--ink);padding:.8rem;border:1px solid rgba(230,200,131,.15);border-radius:13px;background:rgba(28,27,41,.65);transition:.2s}.settings b,.choice-grid b,.ending-grid b{display:block;font-size:.8rem;margin-bottom:.25rem;color:#f0e1c6}.settings span,.choice-grid span,.ending-grid span{display:block;color:#a89e91;font-size:.66rem;line-height:1.5}
#journal{padding:max(12px,env(safe-area-inset-top)) max(12px,env(safe-area-inset-right)) max(12px,env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));align-items:stretch}.journal-card{width:min(1100px,100%);height:min(88dvh,800px);margin:auto;display:grid;grid-template-rows:auto 1fr auto;gap:.9rem;text-align:left}.journal-card header{display:flex;justify-content:space-between;align-items:flex-start}.journal-card header h2{margin:.1rem 0}.journal-card header small{color:#9d9386}.journal-card main{min-height:0;display:grid;grid-template-columns:1.15fr .85fr;gap:.85rem}.journal-panel{min-height:0;overflow:auto;padding:.8rem;border-radius:13px;border:1px solid rgba(230,200,131,.12);background:rgba(12,13,22,.43)}.journal-panel h3{font-size:.68rem;letter-spacing:.18em;color:#cbb37c;margin-bottom:.6rem}#memoryList{display:grid;grid-template-columns:repeat(2,1fr);gap:.5rem}.memory-entry{min-height:65px;padding:.58rem .65rem;border:1px solid rgba(255,255,255,.055);border-radius:9px;background:rgba(255,255,255,.022)}.memory-entry.locked{opacity:.36}.memory-entry small{color:#81786c;font-size:.56rem}.memory-entry b{display:block;font-size:.75rem;margin-top:.18rem;color:#dfd5c6}.memory-entry span{font-size:.6rem;color:#9e93b5}.letter-entry{padding:.62rem;border-bottom:1px solid rgba(255,255,255,.06)}.letter-entry b{font-size:.76rem;color:#e2d7c5}.letter-entry p{font-size:.66rem!important;line-height:1.5!important;margin-top:.25rem}.sigil{display:inline-block;padding:.19rem .45rem;border-radius:999px;border:1px solid rgba(185,168,227,.24);color:#cbbde8;font-size:.65rem}.tip{margin-top:.7rem;padding:.7rem;border-radius:11px;border:1px solid rgba(230,200,131,.12);background:rgba(230,200,131,.055);color:#b4aa9a;font-size:.68rem;line-height:1.6}.journal-card footer{display:flex;justify-content:space-between;gap:.7rem;flex-wrap:wrap;color:#8d8478;font-size:.64rem}
.choice-grid{display:grid;grid-template-columns:repeat(2,1fr);gap:.7rem;margin-top:1.2rem}#puzzleSlots{display:flex;gap:.5rem;justify-content:center;margin:1rem 0}#puzzleSlots i{width:42px;height:42px;border-radius:50%;display:grid;place-items:center;border:1px solid rgba(185,168,227,.25);background:rgba(185,168,227,.05);font-style:normal;color:#d7c9ee}#sigilButtons{display:flex;justify-content:center;gap:.5rem;flex-wrap:wrap}#sigilButtons button{pointer-events:auto;cursor:pointer;width:50px;height:50px;border-radius:50%;border:1px solid rgba(230,200,131,.22);background:rgba(26,25,38,.75);color:#eadfce}#puzzleFeedback{min-height:1.2rem;margin-top:.75rem;color:#c7b7df;font-size:.68rem}#puzzleCard.shake{animation:shake .27s linear 2}@keyframes shake{25%{transform:translateX(-7px)}75%{transform:translateX(7px)}}.ending-card{width:min(92vw,760px)}.ending-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:.65rem;margin-top:1.2rem}
#touchUI{display:none;position:absolute;inset:0;z-index:25;pointer-events:none}#joystick{position:absolute;left:max(22px,env(safe-area-inset-left));bottom:max(24px,env(safe-area-inset-bottom));width:110px;height:110px;border-radius:50%;border:1px solid rgba(230,200,131,.17);background:rgba(7,8,14,.28);backdrop-filter:blur(8px);pointer-events:auto}#knob{position:absolute;left:31px;top:31px;width:48px;height:48px;border-radius:50%;border:1px solid rgba(230,200,131,.35);background:rgba(230,200,131,.2)}.touch-buttons{position:absolute;right:max(18px,env(safe-area-inset-right));bottom:max(22px,env(safe-area-inset-bottom));display:grid;grid-template-columns:repeat(2,62px);gap:10px;pointer-events:auto}.touch-buttons button{width:62px;height:62px;border-radius:50%;border:1px solid rgba(230,200,131,.22);background:rgba(8,9,16,.55);color:var(--ink);font-size:.66rem}.touch-buttons button:last-child{grid-column:2}
body.reduce-motion #grain{animation:none}body.reduce-motion .screen,body.reduce-motion #message,body.reduce-motion #chapterCard{transition-duration:.12s}
@media(max-width:850px){#objective{top:62px;width:calc(100% - 28px)}.hud-right .muted{display:none}.journal-card main{grid-template-columns:1fr}.journal-panel{max-height:38dvh}#memoryList{grid-template-columns:1fr}.ending-grid,.choice-grid{grid-template-columns:1fr}#message{bottom:20%}}@media(pointer:coarse){#touchUI.visible{display:block}#echoStatus,#saveToast{bottom:143px}#message{bottom:24%}}@media(max-height:650px){.title-seal{width:52px;height:52px;margin-bottom:.5rem}#title h1{font-size:2rem}.title-wrap>p{margin-top:.7rem;line-height:1.55}.tags{margin-top:.55rem}.actions{margin-top:.8rem}.title-wrap small{display:none}}


/* v2.1 boot state */
button:disabled{opacity:.58;cursor:wait;filter:saturate(.65);}

button:disabled{cursor:wait;opacity:.58;transform:none!important}

/* v2.2 · Luminous Archive visual pass */
:root{
  --panel:rgba(13,15,27,.74);
  --line:rgba(232,204,143,.31);
  --glass-violet:rgba(171,157,222,.13);
  --glass-gold:rgba(231,198,126,.11);
}
body{background:#111421}
canvas{filter:saturate(1.08) contrast(1.025);transition:filter .35s ease}
body[data-brightness="0"] canvas{filter:saturate(1.02) contrast(1.045)}
body[data-brightness="1"] canvas{filter:saturate(1.09) contrast(1.015)}
body[data-brightness="2"] canvas{filter:saturate(1.12) contrast(.99)}
/* Vignette, grain and the glitch tint moved into the render composite pass,
   where they can be luminance-weighted and applied before the 8-bit buffer.
   These DOM layers stay only as a faint edge falloff over the UI. */
#vignette{
  opacity:.3;
  background:radial-gradient(ellipse at 50% 48%,transparent 42%,rgba(5,7,15,.05) 72%,rgba(2,3,9,.34) 118%);
  transition:opacity .35s ease;
}
body[data-brightness="0"] #vignette{opacity:.44}
body[data-brightness="1"] #vignette{opacity:.3}
body[data-brightness="2"] #vignette{opacity:.16}
#grain{opacity:0;animation:none}
body.glitch canvas{filter:none}
body.glitch #grain{opacity:0}
#flash{background:radial-gradient(circle,rgba(255,230,176,.34),rgba(188,170,231,.08) 34%,transparent 67%)}

.screen{
  background:radial-gradient(circle at 50% 35%,rgba(43,43,66,.67),rgba(8,10,18,.92) 74%);
}
#title{
  background:
    radial-gradient(circle at 50% 30%,rgba(96,83,124,.24),transparent 29%),
    radial-gradient(ellipse at 50% 43%,rgba(42,43,67,.82),rgba(6,8,15,.98) 75%);
}
.title-seal{
  background:radial-gradient(circle,rgba(235,207,145,.13),rgba(185,168,227,.04) 55%,transparent 70%);
  box-shadow:0 0 18px rgba(236,207,142,.18),0 0 65px rgba(185,168,227,.16),inset 0 0 20px rgba(234,207,149,.08);
  animation:sealBreathe 4.8s ease-in-out infinite;
}
@keyframes sealBreathe{50%{box-shadow:0 0 24px rgba(236,207,142,.27),0 0 82px rgba(185,168,227,.22),inset 0 0 24px rgba(234,207,149,.12)}}

.card,.journal-card{
  background:
    linear-gradient(145deg,rgba(31,31,49,.72),rgba(10,12,23,.78)),
    radial-gradient(circle at 20% 0,var(--glass-violet),transparent 42%);
  border-color:rgba(235,207,145,.33);
  box-shadow:
    0 25px 90px rgba(0,0,0,.48),
    0 0 42px rgba(173,157,221,.07),
    inset 0 1px 0 rgba(255,255,255,.065),
    inset 0 0 50px rgba(185,168,227,.025);
  backdrop-filter:blur(24px) saturate(1.18);
  -webkit-backdrop-filter:blur(24px) saturate(1.18);
}
.btn,.tiny,.circle,.settings button,.choice-grid button,.ending-grid button{
  box-shadow:inset 0 1px 0 rgba(255,255,255,.045),0 7px 22px rgba(0,0,0,.13);
}
.btn.primary{
  box-shadow:0 9px 30px rgba(221,184,104,.19),inset 0 1px 0 rgba(255,255,255,.34);
}
.tags span,.tiny{
  background:linear-gradient(150deg,rgba(35,34,52,.67),rgba(13,15,27,.48));
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
}
.boot-status{
  min-height:1.5rem;
  margin:.82rem auto -.35rem;
  color:#aaa0b9;
  font-size:.68rem;
  line-height:1.55;
  letter-spacing:.045em;
  transition:.3s ease;
}
.boot-status.ready{color:#d7c9a8;text-shadow:0 0 16px rgba(235,204,135,.18)}
.boot-status.error{color:#e6b9b7}
.boot-reload{
  display:inline-block;
  margin-left:.55rem;
  padding:.28rem .65rem;
  cursor:pointer;
  color:#1a1713;
  border:0;
  border-radius:999px;
  background:linear-gradient(135deg,#f0dfad,#cda962);
  font-size:.67rem;
  font-weight:700;
}

.chip,#objective,#echoStatus,#saveToast,#prompt,#message,.toast{
  background:
    linear-gradient(145deg,rgba(25,26,43,.66),rgba(8,10,19,.65)),
    radial-gradient(circle at 15% 0,rgba(185,168,227,.105),transparent 48%);
  border-color:rgba(230,207,153,.25);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.05),0 8px 28px rgba(0,0,0,.2),0 0 24px rgba(185,168,227,.035);
  backdrop-filter:blur(18px) saturate(1.16);
  -webkit-backdrop-filter:blur(18px) saturate(1.16);
}
#objective{
  border-color:rgba(190,175,231,.28);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.055),0 9px 32px rgba(0,0,0,.24),0 0 28px rgba(177,159,225,.075);
}
#objective small{color:#bcaee2}
#message{
  border-color:rgba(235,205,139,.34);
  box-shadow:0 22px 75px rgba(0,0,0,.42),0 0 36px rgba(226,193,123,.07),inset 0 1px 0 rgba(255,255,255,.055);
}
#crosshair.active:before,#crosshair.active:after{box-shadow:0 0 7px #f1d087,0 0 18px rgba(241,208,135,.7)}
#chapterCard{text-shadow:0 5px 26px rgba(0,0,0,.85),0 0 35px rgba(214,191,138,.1)}

.settings{grid-template-columns:repeat(3,1fr)}
.settings button{
  background:linear-gradient(145deg,rgba(38,37,56,.66),rgba(17,19,31,.62));
  border-color:rgba(231,207,151,.2);
}
#restartBtn{border-color:rgba(205,159,154,.19)}
.journal-panel{
  background:linear-gradient(145deg,rgba(19,21,35,.52),rgba(9,11,20,.45));
  border-color:rgba(229,204,146,.17);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.032);
}
.memory-entry{
  background:linear-gradient(145deg,rgba(255,255,255,.035),rgba(185,168,227,.018));
  border-color:rgba(255,255,255,.07);
}
.tip{
  background:linear-gradient(145deg,rgba(230,200,131,.075),rgba(185,168,227,.035));
  border-color:rgba(230,200,131,.18);
}
#puzzleSlots i{
  box-shadow:inset 0 0 20px rgba(185,168,227,.045),0 0 18px rgba(185,168,227,.035);
}
#sigilButtons button:hover{
  border-color:rgba(239,207,137,.66);
  box-shadow:0 0 20px rgba(231,198,126,.14),inset 0 0 18px rgba(231,198,126,.06);
}
#joystick,.touch-buttons button{
  background:linear-gradient(145deg,rgba(24,26,42,.55),rgba(7,9,17,.45));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.04),0 8px 28px rgba(0,0,0,.17);
}

@media(max-width:850px){
  .settings{grid-template-columns:repeat(2,1fr)}
}
@media(max-width:520px){
  .settings{grid-template-columns:1fr}
  .title-wrap{padding:1.25rem}
  .boot-status{margin-top:.6rem}
}
@media(max-height:700px){
  .boot-status{display:none}
  .mini-actions{margin-top:.55rem}
}
body.reduce-motion .title-seal{animation:none}

body.photo-mode #hud,body.photo-mode #crosshair,body.photo-mode #prompt,body.photo-mode #message,body.photo-mode #toastStack,body.photo-mode #chapterCard,body.photo-mode #touchUI{opacity:0!important;visibility:hidden!important;pointer-events:none!important}
body.photo-mode canvas{filter:saturate(1.16) contrast(1.03)!important}
body.photo-mode #vignette{opacity:.46!important}


/* v2.4 · Radiant Seal cinematic pass */
:root{
  --glass-edge:rgba(247,222,164,.34);
  --glass-cold:rgba(185,168,227,.16);
  --glass-hot:rgba(238,204,132,.15);
}
body::before,body::after{
  content:"";
  position:fixed;
  left:0;
  width:100%;
  height:0;
  z-index:80;
  pointer-events:none;
  opacity:0;
  background:linear-gradient(180deg,rgba(3,4,9,.96),rgba(7,8,15,.82));
  transition:height .42s cubic-bezier(.22,.8,.2,1),opacity .32s ease;
}
body::before{top:0}
body::after{bottom:0;transform:rotate(180deg)}
body.cinematic::before,body.cinematic::after{height:3.2vh;opacity:.92}
body.cinematic canvas{filter:saturate(1.16) contrast(1.025) brightness(1.025)}
body.cinematic #hud{filter:brightness(.86) saturate(.82);opacity:.78}

.card,.journal-card,#objective,.chip,#echoStatus,#saveToast,#prompt,#message,.toast,.settings button,.choice-grid button,.ending-grid button{
  position:relative;
  isolation:isolate;
}
.card::before,.journal-card::before,#objective::before,#message::before{
  content:"";
  position:absolute;
  inset:-2px;
  z-index:-1;
  pointer-events:none;
  border-radius:inherit;
  background:
    linear-gradient(115deg,transparent 8%,rgba(255,255,255,.09) 24%,transparent 40%) 140% 0/48% 100% no-repeat,
    radial-gradient(circle at 12% 0,rgba(188,171,230,.13),transparent 38%),
    radial-gradient(circle at 88% 100%,rgba(235,201,128,.09),transparent 36%);
  opacity:.8;
}
body:not(.reduce-motion) .card::before,
body:not(.reduce-motion) .journal-card::before,
body:not(.reduce-motion) #objective::before,
body:not(.reduce-motion) #message::before{animation:glassSweep 9s ease-in-out infinite}
@keyframes glassSweep{0%,64%{background-position:140% 0,0 0,0 0}82%,100%{background-position:-80% 0,0 0,0 0}}

.card,.journal-card{
  border-color:rgba(240,214,157,.38);
  box-shadow:
    0 28px 100px rgba(0,0,0,.5),
    0 0 54px rgba(174,157,222,.085),
    inset 0 1px 0 rgba(255,255,255,.085),
    inset 0 0 70px rgba(185,168,227,.035);
}
#objective{
  border-color:rgba(199,182,239,.36);
  box-shadow:
    0 10px 36px rgba(0,0,0,.26),
    0 0 36px rgba(177,159,225,.11),
    inset 0 1px 0 rgba(255,255,255,.075),
    inset 0 -1px 0 rgba(238,205,136,.055);
}
#objective::after{
  content:"";
  position:absolute;
  left:12%;right:12%;bottom:-1px;height:1px;
  background:linear-gradient(90deg,transparent,rgba(198,181,240,.55),rgba(239,207,139,.6),transparent);
  filter:blur(.15px);
  opacity:.75;
}
.chip,#echoStatus,#saveToast{
  border-color:rgba(236,211,155,.31);
  box-shadow:0 8px 30px rgba(0,0,0,.22),0 0 24px rgba(185,168,227,.055),inset 0 1px 0 rgba(255,255,255,.07);
}
#message{
  border-color:rgba(244,215,149,.43);
  background:
    linear-gradient(145deg,rgba(27,28,47,.78),rgba(8,10,19,.82)),
    radial-gradient(circle at 50% -20%,rgba(235,202,131,.18),transparent 48%);
  box-shadow:0 25px 90px rgba(0,0,0,.48),0 0 55px rgba(229,195,122,.105),0 0 28px rgba(183,164,229,.07),inset 0 1px 0 rgba(255,255,255,.075);
}
#message.show{animation:messageRadiance .82s cubic-bezier(.18,.8,.22,1)}
@keyframes messageRadiance{0%{filter:brightness(1.55);box-shadow:0 20px 90px rgba(0,0,0,.45),0 0 95px rgba(244,211,139,.28)}100%{filter:brightness(1);}}
.toast{border-color:rgba(199,181,238,.31)}

.btn,.tiny,.circle,.settings button,.choice-grid button,.ending-grid button{
  overflow:hidden;
  transition:transform .2s ease,border-color .2s ease,box-shadow .25s ease,filter .25s ease;
}
.btn::after,.tiny::after,.settings button::after,.choice-grid button::after,.ending-grid button::after{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;
  background:linear-gradient(115deg,transparent 25%,rgba(255,255,255,.12) 48%,transparent 70%);
  transform:translateX(-140%);
  transition:transform .55s ease;
}
.btn:hover::after,.tiny:hover::after,.settings button:hover::after,.choice-grid button:hover::after,.ending-grid button:hover::after{transform:translateX(140%)}
.btn.primary:hover{filter:brightness(1.075);box-shadow:0 12px 38px rgba(226,190,111,.3),0 0 26px rgba(239,211,150,.15),inset 0 1px 0 rgba(255,255,255,.38)}

#crosshair.active{filter:drop-shadow(0 0 8px rgba(242,209,137,.75))}
#chapterCard.show h2{animation:chapterGlow 2.6s ease-out}
@keyframes chapterGlow{0%{text-shadow:0 0 34px rgba(240,210,143,.75),0 0 80px rgba(184,167,229,.4)}100%{text-shadow:0 5px 26px rgba(0,0,0,.85),0 0 35px rgba(214,191,138,.1)}}

body.photo-mode::before,body.photo-mode::after{display:none}
body.reduce-motion::before,body.reduce-motion::after{transition-duration:.1s}
body.reduce-motion .card::before,body.reduce-motion .journal-card::before,body.reduce-motion #objective::before,body.reduce-motion #message::before{animation:none}

/* v2.5 · generated archive key art + music surface */
#title{isolation:isolate;overflow:hidden}
#title::before{content:"";position:absolute;inset:-2%;z-index:-2;background:
  linear-gradient(180deg,rgba(8,9,20,.2) 0%,rgba(10,11,23,.36) 44%,rgba(5,7,15,.94) 100%),
  linear-gradient(90deg,rgba(5,7,15,.72),transparent 28%,transparent 72%,rgba(5,7,15,.72)),
  url("assets/corridor-key-art.png") center/cover no-repeat;filter:saturate(1.08) contrast(1.04);transform:scale(1.035);animation:keyArtDrift 22s ease-in-out infinite alternate}
#title::after{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;background:radial-gradient(ellipse at 50% 34%,transparent 15%,rgba(6,7,16,.12) 48%,rgba(3,4,10,.74) 100%)}
#title .title-wrap{position:relative;z-index:1}
@keyframes keyArtDrift{from{transform:scale(1.035) translate3d(-.25%,0,0)}to{transform:scale(1.08) translate3d(.25%,-.35%,0)}}
body.reduce-motion #title::before{animation:none}
#musicStatus{position:absolute;left:50%;bottom:max(18px,env(safe-area-inset-bottom));transform:translateX(-50%);max-width:min(42vw,360px);padding:.4rem .72rem;border:1px solid rgba(185,168,227,.2);border-radius:999px;background:rgba(8,9,17,.56);backdrop-filter:blur(12px);color:#cfc3e5;font-size:.68rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;opacity:.92;box-shadow:0 8px 28px rgba(0,0,0,.2),inset 0 1px 0 rgba(255,255,255,.05)}
@media(pointer:coarse){#musicStatus{bottom:143px;max-width:44vw;font-size:.62rem}}
@media(max-width:520px){#musicStatus{max-width:41vw}.title-wrap>p{background:rgba(6,7,15,.2);border-radius:12px;padding:.2rem .35rem}}

/* v2.5.1 · compact objective dock and <=6% gameplay HUD footprint */
#hud .hud-left,#hud .hud-right{top:max(9px,env(safe-area-inset-top));gap:5px}
#hud .hud-left{left:max(10px,env(safe-area-inset-left))}
#hud .hud-right{right:max(10px,env(safe-area-inset-right))}
#hud .chip{padding:.29rem .52rem;border-radius:8px;font-size:.66rem;line-height:1.1}
#hud .circle{width:34px;height:34px;font-size:.8rem}

#objective.objective-dock{
  position:absolute;
  top:calc(max(9px,env(safe-area-inset-top)) + 47px);
  right:max(10px,env(safe-area-inset-right));
  left:auto;
  width:auto;
  max-width:min(30vw,270px);
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  box-shadow:none;
  backdrop-filter:none;
  text-align:left;
  transform:none;
  pointer-events:none;
}
#objective.objective-dock::before,#objective.objective-dock::after{display:none}
#objectiveToggle{
  display:flex;
  align-items:center;
  gap:.34rem;
  min-height:30px;
  padding:.28rem .56rem;
  border:1px solid rgba(236,211,155,.28);
  border-radius:999px;
  color:#e6dccd;
  background:linear-gradient(145deg,rgba(31,31,49,.78),rgba(8,10,19,.72));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.06),0 7px 22px rgba(0,0,0,.2);
  backdrop-filter:blur(14px) saturate(1.16);
  -webkit-backdrop-filter:blur(14px) saturate(1.16);
  font-size:.64rem;
  letter-spacing:.08em;
  cursor:pointer;
  pointer-events:auto;
}
#objectiveToggle span:first-child{color:var(--gold);font-size:.88rem;line-height:1}
#objectiveToggle:hover{border-color:rgba(236,211,155,.62);transform:translateY(-1px)}
#objectiveToggle:focus-visible{outline:2px solid var(--gold);outline-offset:3px}
#objective.expanded #objectiveToggle{border-radius:10px 10px 6px 6px}
.objective-panel{
  display:none;
  width:min(30vw,270px);
  margin-top:5px;
  padding:.55rem .68rem;
  border:1px solid rgba(199,182,239,.3);
  border-radius:11px;
  background:linear-gradient(145deg,rgba(25,26,43,.82),rgba(8,10,19,.78));
  box-shadow:0 12px 34px rgba(0,0,0,.28),inset 0 1px 0 rgba(255,255,255,.055);
  backdrop-filter:blur(16px) saturate(1.12);
  -webkit-backdrop-filter:blur(16px) saturate(1.12);
  pointer-events:auto;
}
#objective.expanded .objective-panel{display:block}
.objective-panel small{display:block;margin-bottom:.18rem;color:#bcaee2;font-size:.56rem;letter-spacing:.16em}
.objective-panel #objectiveText{font-size:.68rem;line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
#echoStatus,#musicStatus,#saveToast{padding:.28rem .54rem;font-size:.61rem}
#musicStatus{bottom:max(10px,env(safe-area-inset-bottom));max-width:min(32vw,260px);opacity:.84}

@media(pointer:coarse){
  #objective.objective-dock{top:calc(max(10px,env(safe-area-inset-top)) + 49px);right:max(10px,env(safe-area-inset-right));max-width:min(44vw,240px)}
  .objective-panel{width:min(44vw,240px)}
  #objectiveToggle{min-height:29px;padding:.25rem .5rem;font-size:.62rem}
  #musicStatus{bottom:max(82px,calc(env(safe-area-inset-bottom) + 68px));max-width:42vw}
}
@media(max-width:520px){
  #hud .hud-left,#hud .hud-right{top:max(7px,env(safe-area-inset-top));gap:4px}
  #hud .hud-left{left:max(8px,env(safe-area-inset-left))}
  #hud .hud-right{right:max(8px,env(safe-area-inset-right))}
  #hud .chip{padding:.25rem .42rem;font-size:.6rem}
  #hud .circle{width:32px;height:32px}
  #objective.objective-dock{top:calc(max(8px,env(safe-area-inset-top)) + 45px);right:max(8px,env(safe-area-inset-right))}
}
@media(orientation:landscape) and (max-height:520px){
  #objective.objective-dock{top:calc(max(7px,env(safe-area-inset-top)) + 40px)}
  #objectiveToggle{min-height:27px;padding:.22rem .48rem}
  #musicStatus{bottom:max(7px,env(safe-area-inset-bottom))}
}

/* v3.0 · full-bleed mobile HUD, quieter archive UI, tactile controls */
:root{
  --hud-bg:rgba(12,16,26,.78);
  --hud-line:rgba(221,194,137,.32);
  --hud-cold:rgba(166,177,212,.2);
  --safe-top:max(8px,env(safe-area-inset-top));
  --safe-right:max(10px,env(safe-area-inset-right));
  --safe-bottom:max(10px,env(safe-area-inset-bottom));
  --safe-left:max(10px,env(safe-area-inset-left));
}

html,body,#game{width:100%;height:100%;min-height:100%;background:#171b27}
@supports(height:100dvh){html,body,#game{height:100dvh}}
body{
  -webkit-text-size-adjust:100%;
  overscroll-behavior:none;
}
canvas{position:absolute;inset:0;width:100%!important;height:100%!important}

/* The old cinematic letterbox and glass sweep caused the visible black strip
   and pushed absolute HUD elements back into document flow. */
body::before,body::after,
body.cinematic::before,body.cinematic::after{display:none!important}
body.cinematic #hud{filter:none;opacity:1}
.card::before,.journal-card::before,#objective::before,#message::before{display:none!important;animation:none!important}

.card,.journal-card{
  border-radius:16px;
  border-color:rgba(217,190,133,.3);
  background:
    linear-gradient(155deg,rgba(24,29,42,.94),rgba(9,13,22,.94)),
    radial-gradient(circle at 16% 0,rgba(148,160,203,.09),transparent 42%);
  box-shadow:0 24px 70px rgba(0,0,0,.48),inset 0 1px 0 rgba(255,255,255,.055);
  backdrop-filter:blur(16px);
  -webkit-backdrop-filter:blur(16px);
}
.btn,.tiny,.settings button,.choice-grid button,.ending-grid button{
  border-radius:10px;
}
.btn{min-width:132px}
.circle{border-radius:10px}
#restartBtn{grid-column:span 2}

#hud{position:absolute;inset:0;pointer-events:none}
#hud .hud-left,#hud .hud-right{
  top:var(--safe-top);
  gap:6px;
  flex-wrap:nowrap;
}
#hud .hud-left{left:var(--safe-left)}
#hud .hud-right{right:var(--safe-right)}
#hud .chip{
  position:relative;
  padding:.38rem .62rem;
  border:1px solid var(--hud-line);
  border-radius:8px;
  background:linear-gradient(150deg,rgba(21,25,37,.84),rgba(8,12,20,.77));
  box-shadow:0 5px 16px rgba(0,0,0,.22),inset 0 1px 0 rgba(255,255,255,.045);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
  color:#c9c2b7;
  font-size:.69rem;
  line-height:1;
}
#hud .chip b{font-size:.76rem}
#hud .circle{
  position:relative;
  width:35px;
  height:35px;
  border-color:var(--hud-line);
  background:linear-gradient(150deg,rgba(25,28,41,.88),rgba(8,11,19,.8));
  box-shadow:0 5px 16px rgba(0,0,0,.24);
  pointer-events:auto;
}

#objective.objective-dock{
  position:absolute;
  top:calc(var(--safe-top) + 44px);
  right:var(--safe-right);
  left:auto;
  width:auto;
  max-width:min(34vw,270px);
  padding:0;
  pointer-events:none;
}
#objectiveToggle{
  min-height:31px;
  padding:.34rem .62rem;
  border-radius:9px;
  border-color:var(--hud-line);
  background:linear-gradient(150deg,rgba(22,27,39,.9),rgba(8,12,20,.84));
  box-shadow:0 5px 18px rgba(0,0,0,.24),inset 0 1px 0 rgba(255,255,255,.045);
  letter-spacing:.04em;
}
#objective.expanded #objectiveToggle{border-radius:9px}
.objective-panel{
  width:min(34vw,270px);
  margin-top:5px;
  padding:.58rem .68rem;
  border-radius:9px;
  background:linear-gradient(150deg,rgba(23,28,42,.94),rgba(8,12,20,.92));
  border-color:rgba(181,190,221,.28);
  box-shadow:0 10px 26px rgba(0,0,0,.32);
}
.objective-panel #objectiveText{-webkit-line-clamp:3;font-size:.7rem;line-height:1.42}

#crosshair{width:16px;height:16px}
#crosshair.visible{opacity:.66}
#crosshair.active{filter:drop-shadow(0 0 6px rgba(242,209,137,.64))}

#prompt{
  position:absolute!important;
  left:50%;
  top:calc(50% + 26px);
  width:auto;
  max-width:min(70vw,300px);
  padding:.42rem .72rem;
  border:1px solid rgba(226,198,137,.35);
  border-radius:8px;
  background:rgba(11,15,24,.86);
  box-shadow:0 8px 20px rgba(0,0,0,.28);
  color:#eee4d2;
  font-size:.69rem;
  font-weight:600;
  text-align:center;
  white-space:nowrap;
  pointer-events:none;
}

#message{
  position:absolute!important;
  left:var(--safe-left);
  top:calc(var(--safe-top) + 49px);
  bottom:auto;
  width:min(38vw,360px);
  min-width:260px;
  padding:.72rem .82rem .68rem;
  border-radius:11px;
  border:1px solid rgba(222,193,132,.34);
  background:linear-gradient(150deg,rgba(22,27,40,.94),rgba(8,12,20,.93));
  box-shadow:0 14px 34px rgba(0,0,0,.36),inset 3px 0 0 rgba(219,189,125,.48);
  text-align:left;
  transform:translateX(-10px);
  pointer-events:none;
}
#message.show{transform:none;animation:none}
#message::before{display:none}
#message small{
  color:#cdb274;
  font-size:.55rem;
  letter-spacing:.13em;
}
#message h3{
  margin:.16rem 0 .22rem;
  font-size:.88rem;
  letter-spacing:.035em;
}
#message p{
  display:-webkit-box;
  overflow:hidden;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  color:#d8d1c5;
  font-size:.72rem;
  line-height:1.48;
  white-space:pre-line;
}
#msgSigil{
  margin:.36rem .4rem 0 0;
  padding:.18rem .42rem;
  border-radius:6px;
  font-size:.58rem;
}
.message-tip{
  display:inline-block;
  margin-top:.4rem;
  color:#8f97a8;
  font-size:.55rem;
}

#toastStack{
  top:calc(var(--safe-top) + 48px);
  width:min(72vw,360px);
  gap:6px;
  pointer-events:none;
}
.toast{
  max-width:100%;
  padding:.5rem .72rem;
  border-radius:8px;
  border-color:rgba(175,185,219,.28);
  background:rgba(13,17,28,.9);
  box-shadow:0 8px 24px rgba(0,0,0,.3),inset 3px 0 0 rgba(173,161,220,.52);
  color:#ded9e7;
  font-size:.68rem;
  line-height:1.35;
  text-align:center;
}

#echoStatus,#saveToast,#musicStatus{
  position:absolute;
  border-radius:8px;
  background:rgba(11,15,24,.78);
  border-color:rgba(184,193,224,.23);
  box-shadow:0 5px 18px rgba(0,0,0,.22);
}
#echoStatus{left:var(--safe-left);bottom:var(--safe-bottom)}
#saveToast{
  right:var(--safe-right);
  bottom:var(--safe-bottom);
  transform:translateY(6px);
}
#saveToast.show{transform:none}
#musicStatus{
  left:50%;
  bottom:var(--safe-bottom);
  max-width:min(36vw,250px);
  opacity:0;
  transform:translate(-50%,6px);
  transition:opacity .25s ease,transform .25s ease;
  pointer-events:none;
}
#musicStatus.show{opacity:.88;transform:translate(-50%,0)}

#touchUI{position:absolute;inset:0}
#joystick{
  left:calc(var(--safe-left) + 4px);
  bottom:calc(var(--safe-bottom) + 4px);
  width:98px;
  height:98px;
  border:1px solid rgba(218,193,139,.28);
  background:
    radial-gradient(circle at 50% 50%,rgba(229,202,145,.07) 0 34%,transparent 35%),
    rgba(8,12,20,.4);
  box-shadow:0 9px 28px rgba(0,0,0,.2),inset 0 0 0 9px rgba(255,255,255,.018);
  backdrop-filter:blur(7px);
  -webkit-backdrop-filter:blur(7px);
}
#knob{
  left:26px;
  top:26px;
  width:46px;
  height:46px;
  border-color:rgba(232,205,148,.46);
  background:radial-gradient(circle at 38% 30%,rgba(250,228,179,.28),rgba(170,143,92,.13));
  box-shadow:0 5px 18px rgba(0,0,0,.24),inset 0 1px 0 rgba(255,255,255,.14);
}
.joystick-mark{
  position:absolute;
  color:rgba(226,202,150,.34);
  font-size:.55rem;
  line-height:1;
}
.joystick-mark.north{left:50%;top:5px;transform:translateX(-50%)}
.joystick-mark.east{right:6px;top:50%;transform:translateY(-50%)}
.joystick-mark.south{left:50%;bottom:5px;transform:translateX(-50%)}
.joystick-mark.west{left:6px;top:50%;transform:translateY(-50%)}

.touch-buttons{
  right:calc(var(--safe-right) + 4px);
  bottom:calc(var(--safe-bottom) + 4px);
  width:148px;
  height:132px;
  display:grid;
  grid-template-columns:62px 78px;
  grid-template-rows:46px 78px;
  gap:8px;
  align-items:end;
  pointer-events:auto;
}
.touch-buttons .touch-action{
  position:relative;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:1px;
  margin:0;
  padding:0;
  border:1px solid rgba(213,190,141,.3);
  border-radius:50%;
  background:linear-gradient(150deg,rgba(23,28,41,.72),rgba(8,12,20,.62));
  box-shadow:0 8px 24px rgba(0,0,0,.22),inset 0 1px 0 rgba(255,255,255,.05);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
  color:#e8dfd1;
}
.touch-action span{font-size:.92rem;line-height:1;color:#d8bd7d}
.touch-action b{font-size:.61rem;font-weight:600;letter-spacing:.08em}
.touch-action small{min-height:.58rem;color:#aaa2b9;font-size:.47rem;line-height:1}
#touchInteract{
  grid-column:2;
  grid-row:2;
  width:76px;
  height:76px;
  border-color:rgba(226,198,137,.4);
}
#touchInteract.ready{
  border-color:rgba(244,213,145,.82);
  background:radial-gradient(circle,rgba(196,160,90,.32),rgba(16,20,31,.74) 70%);
  box-shadow:0 0 0 4px rgba(229,197,129,.08),0 0 24px rgba(229,193,115,.2),inset 0 1px 0 rgba(255,255,255,.1);
}
#touchEcho{
  grid-column:1;
  grid-row:2;
  width:60px;
  height:60px;
}
#touchEcho.cooldown{opacity:.62}
#touchJournal{
  grid-column:2;
  grid-row:1;
  justify-self:end;
  width:62px;
  height:42px;
  border-radius:11px;
}
#touchJournal span{font-size:.76rem}

@media(pointer:coarse){
  #echoStatus,#musicStatus{display:none}
  #saveToast{
    right:50%;
    bottom:var(--safe-bottom);
    transform:translate(50%,6px);
  }
  #saveToast.show{transform:translate(50%,0)}
  #message{width:min(42vw,350px)}
  #weatherChip{display:none}
}

@media(max-width:850px){
  #hud .chip{padding:.34rem .52rem;font-size:.64rem}
  #objective.objective-dock{max-width:min(38vw,240px)}
  .objective-panel{width:min(38vw,240px)}
  #message{min-width:0;width:min(43vw,340px)}
}

@media(max-width:540px) and (orientation:portrait){
  #restartBtn{grid-column:1}
  #hud .hud-right #chapterChip{display:none}
  #objective.objective-dock{top:calc(var(--safe-top) + 43px);max-width:54vw}
  .objective-panel{width:54vw}
  #message{
    left:50%;
    top:auto;
    bottom:calc(var(--safe-bottom) + 126px);
    width:calc(100vw - 28px);
    transform:translate(-50%,10px);
  }
  #message.show{transform:translate(-50%,0)}
  #toastStack{top:calc(var(--safe-top) + 48px);width:calc(100vw - 28px)}
  .journal-card main{grid-template-columns:1fr}
}

@media(orientation:landscape) and (max-height:520px){
  #hud .hud-left,#hud .hud-right{top:var(--safe-top)}
  #hud .chip{padding:.31rem .48rem;font-size:.61rem}
  #hud .circle{width:32px;height:32px}
  #objective.objective-dock{top:calc(var(--safe-top) + 39px)}
  #objectiveToggle{min-height:28px;padding:.28rem .5rem}
  #message{top:calc(var(--safe-top) + 43px);padding:.58rem .7rem}
  #message h3{font-size:.8rem}
  #message p{font-size:.66rem}
  #joystick{width:92px;height:92px}
  #knob{left:24px;top:24px;width:44px;height:44px}
  .touch-buttons{width:140px;height:122px;grid-template-columns:58px 74px;grid-template-rows:42px 72px}
  #touchInteract{width:70px;height:70px}
  #touchEcho{width:56px;height:56px}
  #touchJournal{width:58px;height:38px}

  .title-wrap{
    width:min(94vw,760px);
    max-height:100dvh;
    overflow:auto;
    padding:.62rem 1rem;
  }
  .title-seal{display:none}
  #title h1{font-size:1.9rem;letter-spacing:.2em}
  .subtitle{margin-top:.15rem;font-size:.56rem}
  .title-wrap>p{max-width:650px;margin:.42rem auto 0;font-size:.72rem;line-height:1.5}
  .tags{margin-top:.38rem;gap:.3rem}
  .tags span{padding:.22rem .42rem;font-size:.56rem;border-radius:7px}
  .boot-status{display:block;min-height:1rem;margin:.35rem auto -.1rem;font-size:.58rem}
  .actions{margin-top:.45rem}
  .btn{padding:.55rem .95rem;min-width:126px;font-size:.76rem}
  .mini-actions{margin-top:.4rem;gap:.35rem}
  .tiny{padding:.34rem .54rem;font-size:.6rem}
  .title-wrap small{margin-top:.38rem;font-size:.55rem;line-height:1.4}

  .card{max-height:calc(100dvh - 18px);padding:1rem}
  .card h2{font-size:1.35rem;margin:.18rem 0 .45rem}
  .card p{font-size:.76rem;line-height:1.5}
  .settings{grid-template-columns:repeat(3,1fr);gap:.45rem;margin-top:.7rem}
  .settings button{padding:.58rem}
  .choice-grid,.ending-grid{grid-template-columns:repeat(2,1fr);margin-top:.7rem}
  .ending-grid{grid-template-columns:repeat(3,1fr)}
  #journal{padding:var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left)}
  .journal-card{height:calc(100dvh - 16px);padding:.8rem;gap:.55rem}
  .journal-card main{grid-template-columns:1.08fr .92fr}
  .journal-panel{max-height:none}
  #memoryList{grid-template-columns:repeat(2,1fr)}
}

/* v3.1 · collectible time-seal cards */
.seal-index-heading{
  display:flex;
  align-items:end;
  justify-content:space-between;
  gap:.7rem;
  margin:1rem 0 .55rem;
  padding-top:.8rem;
  border-top:1px solid rgba(255,255,255,.06);
}
.seal-index-heading h3{margin:0}
.seal-index-heading small{
  color:#817f89;
  font-size:.56rem;
  text-align:right;
}
.seal-card-list{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:.48rem;
}
.seal-mini{
  position:relative;
  min-height:66px;
  overflow:hidden;
  padding:.58rem .62rem;
  cursor:pointer;
  color:#eee5d7;
  border:1px solid rgba(218,191,133,.2);
  border-radius:9px;
  background:
    linear-gradient(135deg,rgba(38,41,58,.92),rgba(11,15,24,.96)),
    #111722;
  text-align:left;
  transition:transform .18s ease,border-color .18s ease;
}
.seal-mini::after{
  content:"";
  position:absolute;
  right:-15px;
  bottom:-22px;
  width:68px;
  height:68px;
  border:1px solid rgba(224,198,140,.18);
  border-radius:50%;
  box-shadow:0 0 0 9px rgba(185,168,227,.035),0 0 0 18px rgba(224,198,140,.025);
}
.seal-mini:not(:disabled):hover{
  transform:translateY(-2px);
  border-color:rgba(226,199,140,.48);
}
.seal-mini:disabled{
  cursor:default;
  opacity:.34;
  filter:saturate(.4);
}
.seal-mini span,.seal-mini b,.seal-mini small{position:relative;z-index:1;display:block}
.seal-mini span{color:#bba56f;font-size:.5rem;letter-spacing:.16em}
.seal-mini b{margin:.18rem 0 .08rem;font-size:.7rem}
.seal-mini small{color:#96919a;font-size:.54rem}
.seal-mini[data-zone="1"]{background:linear-gradient(135deg,rgba(61,54,39,.94),rgba(14,15,20,.97))}
.seal-mini[data-zone="2"]{background:linear-gradient(135deg,rgba(40,38,67,.94),rgba(11,14,25,.97))}
.seal-mini[data-zone="3"]{background:linear-gradient(135deg,rgba(69,48,62,.94),rgba(17,13,23,.97))}

.seal-screen{
  z-index:48;
  padding:max(10px,env(safe-area-inset-top)) max(10px,env(safe-area-inset-right)) max(10px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));
  background:radial-gradient(circle at 50% 43%,rgba(37,39,57,.88),rgba(6,8,14,.98) 76%);
}
.seal-modal{
  display:flex;
  flex-direction:column;
  align-items:center;
  width:100%;
  max-height:100%;
}
.seal-preview{
  --seal-accent:#e4c47e;
  --seal-rgb:228,196,126;
  --seal-soft:#8e7f66;
  position:relative;
  width:min(92vw,900px);
  aspect-ratio:16/9;
  overflow:hidden;
  padding:clamp(16px,3.6vw,42px);
  border:1px solid rgba(var(--seal-rgb),.44);
  border-radius:13px;
  background:
    radial-gradient(circle at 79% 42%,rgba(var(--seal-rgb),.18),transparent 27%),
    linear-gradient(126deg,#202638 0%,#151a28 47%,#090d16 100%);
  box-shadow:0 26px 90px rgba(0,0,0,.6),inset 0 0 70px rgba(255,255,255,.025);
  isolation:isolate;
}
.seal-preview::before{
  content:"";
  position:absolute;
  inset:0;
  z-index:-1;
  opacity:.2;
  background:
    linear-gradient(105deg,transparent 0 18%,rgba(255,255,255,.05) 18.2% 18.4%,transparent 18.6% 100%),
    repeating-linear-gradient(0deg,transparent 0 22px,rgba(255,255,255,.018) 23px);
}
.seal-preview[data-zone="1"]{
  --seal-accent:#d5ad76;
  --seal-rgb:213,173,118;
  --seal-soft:#9b8064;
  background:
    radial-gradient(circle at 79% 42%,rgba(213,173,118,.18),transparent 27%),
    linear-gradient(126deg,#353126 0%,#211f1d 49%,#0d0e13 100%);
}
.seal-preview[data-zone="2"]{
  --seal-accent:#b4a5eb;
  --seal-rgb:180,165,235;
  --seal-soft:#746d9a;
  background:
    radial-gradient(circle at 79% 42%,rgba(169,155,224,.22),transparent 27%),
    linear-gradient(126deg,#24283e 0%,#19192e 49%,#090c17 100%);
}
.seal-preview[data-zone="3"]{
  --seal-accent:#e1bea0;
  --seal-rgb:225,190,160;
  --seal-soft:#9e758d;
  background:
    radial-gradient(circle at 79% 42%,rgba(225,190,160,.2),transparent 27%),
    linear-gradient(126deg,#382e3c 0%,#231c2b 49%,#0f0b14 100%);
}
.seal-preview header{
  position:relative;
  z-index:2;
  display:flex;
  justify-content:space-between;
  gap:1rem;
  color:var(--seal-accent);
  font-size:clamp(.48rem,1.25vw,.68rem);
  letter-spacing:.2em;
}
.seal-copy{
  position:relative;
  z-index:2;
  width:62%;
  margin-top:clamp(16px,5.8%,48px);
}
.seal-copy .eyebrow{color:var(--seal-accent)}
.seal-copy h2{
  margin:.24em 0 .18em;
  color:#f5ecdf;
  font-weight:450;
  font-size:clamp(1.3rem,4.7vw,3.25rem);
  letter-spacing:.08em;
  line-height:1.12;
  text-shadow:0 5px 24px rgba(0,0,0,.38);
}
.seal-copy p{
  display:-webkit-box;
  max-width:580px;
  overflow:hidden;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  color:#c8c0b6;
  font-size:clamp(.58rem,1.45vw,.9rem);
  line-height:1.65;
}
.seal-stats{
  position:absolute;
  left:clamp(16px,3.6vw,42px);
  bottom:clamp(38px,10.5%,70px);
  z-index:2;
  display:grid;
  grid-template-columns:repeat(3,minmax(68px,126px));
  gap:clamp(8px,1.8vw,18px);
}
.seal-stats div{
  padding-left:clamp(7px,1vw,12px);
  border-left:2px solid rgba(var(--seal-rgb),.55);
}
.seal-stats small,.seal-stats b{display:block}
.seal-stats small{
  color:#8f929c;
  font-size:clamp(.45rem,1vw,.58rem);
  letter-spacing:.08em;
}
.seal-stats b{
  margin-top:.18rem;
  color:#eee4d6;
  font-size:clamp(.65rem,1.55vw,.92rem);
}
.seal-notes{
  position:absolute;
  right:clamp(16px,4.2vw,46px);
  bottom:clamp(38px,10.5%,70px);
  z-index:2;
  width:31%;
  padding-left:clamp(8px,1.4vw,16px);
  border-left:1px solid rgba(255,255,255,.1);
}
.seal-notes p{
  overflow:hidden;
  color:#aaa7ad;
  font-size:clamp(.45rem,1.08vw,.62rem);
  line-height:1.5;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.seal-notes p+p{margin-top:.35rem;color:var(--seal-accent)}
.seal-preview>footer{
  position:absolute;
  right:clamp(16px,3.6vw,42px);
  bottom:clamp(12px,3.8%,28px);
  left:clamp(16px,3.6vw,42px);
  z-index:2;
  display:flex;
  justify-content:space-between;
  color:#777b86;
  font-size:clamp(.42rem,.9vw,.56rem);
  letter-spacing:.18em;
}
.seal-orbit{
  position:absolute;
  top:50%;
  right:-3%;
  width:41%;
  aspect-ratio:1;
  transform:translateY(-50%);
  opacity:.72;
}
.seal-orbit::before,.seal-orbit::after,.seal-orbit i{
  content:"";
  position:absolute;
  inset:8%;
  border:1px solid rgba(var(--seal-rgb),.25);
  border-radius:50%;
}
.seal-orbit::after{inset:24%;border-color:rgba(var(--seal-rgb),.48)}
.seal-orbit i:nth-child(1){inset:38%;border-color:rgba(var(--seal-rgb),.72);box-shadow:0 0 28px rgba(var(--seal-rgb),.16)}
.seal-orbit i:nth-child(2){inset:49%;background:var(--seal-accent);border:0;box-shadow:0 0 30px rgba(var(--seal-rgb),.56)}
.seal-orbit i:nth-child(3){inset:2%;border-style:dashed;opacity:.5;transform:rotate(18deg)}
.seal-actions{
  display:flex;
  justify-content:center;
  gap:.65rem;
  margin-top:.7rem;
}
.seal-actions .btn{margin:0}
.seal-share-status{
  min-height:1rem;
  margin-top:.35rem;
  color:#a9a3ae;
  font-size:.6rem;
}
#sealShareCanvas[hidden]{display:none!important}

@media(max-width:520px) and (orientation:portrait){
  .seal-preview{width:calc(100vw - 28px);padding:14px}
  .seal-copy{width:70%;margin-top:11px}
  .seal-stats{left:14px;bottom:34px;grid-template-columns:repeat(3,minmax(55px,1fr));gap:5px}
  .seal-notes{right:14px;bottom:34px;width:31%;padding-left:7px}
  .seal-preview>footer{right:14px;bottom:10px;left:14px}
  .seal-actions{width:100%;gap:.45rem}
  .seal-actions .btn{min-width:0;flex:1;padding:.6rem .5rem;font-size:.7rem}
}

@media(orientation:landscape) and (max-height:520px){
  .seal-preview{width:min(92vw,calc((100dvh - 83px) * 1.7778));padding:15px}
  .seal-copy{width:64%;margin-top:12px}
  .seal-copy h2{font-size:clamp(1.2rem,5.8vh,1.75rem)}
  .seal-copy p{font-size:.56rem}
  .seal-stats{left:15px;bottom:34px;grid-template-columns:repeat(3,76px);gap:6px}
  .seal-notes{right:15px;bottom:34px;width:31%;padding-left:8px}
  .seal-preview>footer{right:15px;bottom:10px;left:15px}
  .seal-actions{margin-top:.45rem}
  .seal-actions .btn{padding:.5rem .8rem;font-size:.68rem}
  .seal-share-status{margin-top:.18rem;font-size:.52rem}
}

/* v3.2 · Opaque Archive Board
   One material system replaces the stacked glass cards and pill controls. */
:root{
  --archive-ink:#11151d;
  --archive-ink-2:#1a202a;
  --archive-ink-3:#252b36;
  --archive-paper:#d2c29f;
  --archive-paper-2:#c3b38f;
  --archive-paper-ink:#29251e;
  --archive-brass:#c39a52;
  --archive-brass-dark:#745a32;
  --archive-rule:#4b4650;
  --archive-cold:#98a3b8;
  --archive-red:#8c5148;
}

.screen:not(#title){
  background:linear-gradient(135deg,#090c12 0%,#131923 56%,#080b10 100%);
}

.card,.journal-card,
#objectiveToggle,.objective-panel,
#message,.toast,#prompt,
#echoStatus,#musicStatus,#saveToast,
.btn,.tiny,.circle,
.settings button,.choice-grid button,.ending-grid button,
#sigilButtons button,#puzzleSlots i,
.seal-mini,#joystick,#knob,.touch-buttons .touch-action{
  -webkit-backdrop-filter:none!important;
  backdrop-filter:none!important;
}

.card,.journal-card{
  border:0;
  border-radius:0;
  background:linear-gradient(145deg,#1c222d 0%,#11161f 72%,#0d1118 100%);
  box-shadow:0 26px 72px rgba(0,0,0,.62);
  clip-path:polygon(0 0,calc(100% - 22px) 0,100% 22px,100% 100%,22px 100%,0 calc(100% - 22px));
}
.card{
  width:min(92vw,720px);
  padding:clamp(1.6rem,4vw,2.45rem) clamp(1.5rem,4.5vw,2.8rem);
  text-align:left;
}
.card::before{
  content:"";
  position:absolute;
  inset:0 auto 0 0;
  z-index:2;
  display:block!important;
  width:9px;
  border-radius:0;
  background:var(--archive-brass);
  opacity:1;
  animation:none!important;
}
.card::after{
  position:absolute;
  top:15px;
  right:24px;
  color:#7f8999;
  font-size:.52rem;
  letter-spacing:.18em;
}
#pause .card::after{content:"PAUSE / FILE 00"}
#choice .card::after{content:"DECISION / FILE 17"}
#puzzle .card::after{content:"LETTER SEAL / 03"}
#ending .card::after{content:"FINAL RECORD / 21"}
.card h2,.journal-card h2{
  color:#f0e4cf;
  font-family:"Iowan Old Style","Songti TC","Noto Serif TC",serif;
  font-weight:600;
  letter-spacing:.1em;
}
.card p{color:#aeb5c0}
.eyebrow{
  color:var(--archive-brass);
  font-weight:700;
  letter-spacing:.22em;
}
.actions{justify-content:flex-start}

.btn,.tiny,.circle,
.settings button,.choice-grid button,.ending-grid button,
#sigilButtons button{
  overflow:hidden;
  border:1px solid var(--archive-rule);
  border-radius:0;
  color:#ece3d4;
  background:#252b36;
  box-shadow:none;
  clip-path:polygon(0 0,calc(100% - 8px) 0,100% 8px,100% 100%,8px 100%,0 calc(100% - 8px));
}
.btn::after,.tiny::after,
.settings button::after,.choice-grid button::after,.ending-grid button::after{
  display:none!important;
}
.btn:hover,.tiny:hover,.circle:hover,
.settings button:hover,.choice-grid button:hover,.ending-grid button:hover,
#sigilButtons button:hover{
  transform:translateY(-1px);
  border-color:var(--archive-brass);
  background:#303744;
  box-shadow:none;
}
.btn.primary{
  border:1px solid #e2c27f;
  color:#211c13;
  background:var(--archive-brass);
  box-shadow:none;
}
.btn.primary:hover{background:#d8b46b;box-shadow:none;filter:none}
.btn{min-width:142px;padding:.72rem 1.2rem}
.tiny{padding:.47rem .72rem}
.circle{
  width:36px;
  height:36px;
  color:#18140e;
  border-color:#ddbd78;
  background:var(--archive-brass);
}
button:focus-visible{
  outline:2px solid #efd18d;
  outline-offset:3px;
}

/* Title: editorial cover, not another floating panel. */
#title{
  justify-content:flex-start;
  background:#090c12;
}
#title::before{
  background:
    linear-gradient(90deg,#060910 0%,rgba(6,9,16,.94) 20%,rgba(6,9,16,.52) 58%,rgba(6,9,16,.12) 100%),
    linear-gradient(180deg,rgba(5,7,12,.14),rgba(5,7,12,.9)),
    url("assets/corridor-key-art.png") center/cover no-repeat;
  filter:saturate(.88) contrast(1.08);
}
#title::after{
  background:linear-gradient(180deg,rgba(7,10,16,.08),rgba(7,10,16,.74));
}
.title-wrap{
  width:min(78vw,800px);
  max-height:calc(100dvh - 24px);
  margin-left:clamp(28px,7vw,110px);
  padding:clamp(1.3rem,4vw,2.5rem) clamp(1rem,3vw,2rem) clamp(1.3rem,4vw,2.5rem) clamp(1.8rem,4vw,3.1rem);
  overflow:auto;
  text-align:left;
}
.title-wrap::before{
  content:"";
  position:absolute;
  top:5%;
  bottom:5%;
  left:0;
  width:6px;
  background:linear-gradient(#6f5632 0 16%,var(--archive-brass) 16% 78%,#6f5632 78%);
}
.title-seal{
  width:54px;
  height:54px;
  margin:0 0 1rem 2px;
  border:2px solid #e0bd72;
  border-radius:0;
  color:#211b12;
  background:var(--archive-brass);
  box-shadow:0 0 0 5px #161b24;
  transform:rotate(45deg);
  animation:none;
}
#title h1{
  color:#f1e5d1;
  font-family:"Iowan Old Style","Songti TC","Noto Serif TC",serif;
  font-weight:600;
  letter-spacing:.16em;
  text-indent:0;
  text-shadow:0 5px 22px #000;
}
.subtitle{
  color:var(--archive-brass);
  font-weight:700;
  letter-spacing:.18em;
}
.title-wrap>p{
  max-width:610px;
  margin:1.1rem 0 0;
  padding:0;
  border-radius:0;
  background:none!important;
  color:#c5bdaf;
  line-height:1.75;
}
.tags{
  justify-content:flex-start;
  gap:0;
  margin-top:.9rem;
}
.tags span{
  padding:.12rem .66rem;
  border:0;
  border-left:1px solid #75623e;
  border-radius:0;
  background:none;
  color:#b7af9f;
  letter-spacing:.05em;
}
.tags span:first-child{padding-left:0;border-left:0}
.boot-status{
  margin:.78rem 0 -.25rem;
  color:#9da6b4;
  text-align:left;
}
.boot-status.ready{color:#d2bd8e;text-shadow:none}
.title-wrap>.actions{justify-content:flex-start}
.mini-actions{
  width:fit-content;
  justify-content:flex-start;
  gap:0;
  padding:3px;
  background:var(--archive-ink);
  clip-path:polygon(0 0,calc(100% - 8px) 0,100% 8px,100% 100%,8px 100%,0 calc(100% - 8px));
}
.mini-actions .tiny{
  border:0;
  border-left:1px solid #3e4653;
  clip-path:none;
  background:#1b212b;
}
.mini-actions .tiny:first-child{border-left:0}
.title-wrap small{color:#858d99}

/* HUD: one solid instrument strip per side. */
#hud .hud-left,#hud .hud-right{
  min-height:34px;
  gap:0;
  padding:3px 4px;
  background:var(--archive-ink);
  box-shadow:0 5px 18px rgba(0,0,0,.38);
  clip-path:polygon(0 0,calc(100% - 8px) 0,100% 8px,100% 100%,8px 100%,0 calc(100% - 8px));
}
#hud .chip{
  padding:.34rem .58rem;
  border:0;
  border-left:1px solid #3e4653;
  border-radius:0;
  background:none;
  box-shadow:none;
  color:#b7bec9;
}
#hud .chip:first-child{border-left:0}
#hud .chip b{color:#e2be75}
#hud .hud-right .circle{
  width:31px;
  height:28px;
  margin-left:3px;
  border:0;
  border-radius:0;
  background:var(--archive-brass);
  box-shadow:none;
  clip-path:polygon(0 0,calc(100% - 7px) 0,100% 7px,100% 100%,0 100%);
}
#objective.objective-dock{
  max-width:min(34vw,270px);
}
#objectiveToggle{
  min-height:29px;
  padding:.3rem .62rem;
  border:0;
  border-radius:0!important;
  color:#211c14;
  background:var(--archive-brass);
  box-shadow:0 5px 16px rgba(0,0,0,.34);
  clip-path:polygon(0 0,calc(100% - 8px) 0,100% 8px,100% 100%,0 100%);
}
#objectiveToggle span:first-child{color:#3e3322}
#objectiveToggle:hover{border:0;background:#d4ad63}
.objective-panel{
  width:min(34vw,270px);
  margin-top:4px;
  padding:.68rem .75rem .7rem;
  border:0;
  border-top:4px solid var(--archive-brass);
  border-radius:0;
  color:#d8dde4;
  background:#171d27;
  box-shadow:0 12px 28px rgba(0,0,0,.5);
  clip-path:polygon(0 0,100% 0,100% calc(100% - 9px),calc(100% - 9px) 100%,0 100%);
}
.objective-panel small{color:#b49050}
#echoStatus,#musicStatus,#saveToast{
  border:0;
  border-left:3px solid var(--archive-brass);
  border-radius:0;
  color:#b9c0cb;
  background:var(--archive-ink);
  box-shadow:0 5px 16px rgba(0,0,0,.32);
}
#saveToast{color:#d9c494}
#prompt{
  padding:.37rem .66rem;
  border:0;
  border-left:3px solid var(--archive-brass);
  border-radius:0;
  color:#eee3cf;
  background:var(--archive-ink);
  box-shadow:0 7px 20px rgba(0,0,0,.42);
}

/* Discovery feedback becomes a physical archive slip. */
#message{
  min-width:260px;
  padding:.78rem 1rem .72rem 1.15rem;
  border:0;
  border-left:8px solid var(--archive-brass-dark);
  border-radius:0;
  color:var(--archive-paper-ink);
  background:var(--archive-paper);
  box-shadow:0 15px 34px rgba(0,0,0,.48);
  clip-path:polygon(0 0,calc(100% - 15px) 0,100% 15px,100% 100%,0 100%);
}
#message::before{
  content:"";
  position:absolute;
  top:0;
  right:0;
  z-index:2;
  display:block!important;
  width:34px;
  height:4px;
  border-radius:0;
  background:var(--archive-red);
  opacity:1;
  animation:none!important;
}
#message small{color:#704439;font-weight:800}
#message h3{
  color:#29251e;
  font-family:"Iowan Old Style","Songti TC","Noto Serif TC",serif;
  font-weight:700;
}
#message p{color:#413a30}
#msgSigil{
  border:1px solid #887651;
  border-radius:0;
  color:#59472d;
  background:#c5b48e;
}
.message-tip{color:#685f51}
.toast{
  border:0;
  border-left:5px solid #8e7aa8;
  border-radius:0;
  color:#e5e0e9;
  background:#202531;
  box-shadow:0 8px 22px rgba(0,0,0,.42);
  clip-path:polygon(0 0,calc(100% - 8px) 0,100% 8px,100% 100%,0 100%);
}

#chapterCard{
  padding:1rem 1.8rem;
  border-bottom:3px solid var(--archive-brass);
  text-shadow:0 5px 24px #000;
}
#chapterCard small{color:var(--archive-brass)}
#chapterCard h2{
  color:#f1e5d0;
  font-family:"Iowan Old Style","Songti TC","Noto Serif TC",serif;
  font-weight:600;
}

/* Pause/settings and decision panels use rails, not nested cards. */
.settings{
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:0;
  border-top:1px solid #444b57;
  border-bottom:1px solid #444b57;
}
.settings button{
  min-height:58px;
  padding:.72rem .85rem .72rem 1.05rem;
  border:0;
  border-right:1px solid #444b57;
  border-bottom:1px solid #444b57;
  background:#1b212b;
  clip-path:none;
}
.settings button:nth-child(2n){border-right:0}
.settings button:nth-child(4){border-bottom:0}
.settings button::before{
  content:"";
  position:absolute;
  top:12px;
  bottom:12px;
  left:0;
  width:3px;
  background:#6c7586;
}
.settings button b{color:#e6dac7}
.settings button span{color:#8f99aa}
#restartBtn{
  grid-column:1/-1;
  min-height:46px;
  border-top:1px solid #444b57;
  border-right:0;
  border-bottom:0;
  color:#d6b7b0;
  background:#241d20;
}
#restartBtn::before{background:var(--archive-red)}

.choice-grid,.ending-grid{counter-reset:archive-choice}
.choice-grid button,.ending-grid button{
  counter-increment:archive-choice;
  min-height:86px;
  padding:.85rem .85rem .85rem 3.25rem;
  border:0;
  border-left:4px solid var(--archive-brass-dark);
  color:#e9dfcf;
  background:#222934;
}
.choice-grid button::before,.ending-grid button::before{
  content:"0" counter(archive-choice);
  position:absolute;
  top:50%;
  left:.78rem;
  width:1.8rem;
  color:var(--archive-brass);
  font-family:"Iowan Old Style",serif;
  font-size:.8rem;
  letter-spacing:.08em;
  transform:translateY(-50%);
}
.choice-grid b,.ending-grid b{color:#eee2ce}
.choice-grid span,.ending-grid span{color:#9ca5b3}

#puzzleSlots i{
  width:44px;
  height:44px;
  border:0;
  border-radius:0;
  color:#211b13;
  background:var(--archive-paper);
  box-shadow:inset 0 -4px 0 #a38b5f;
  clip-path:polygon(0 0,calc(100% - 8px) 0,100% 8px,100% 100%,0 100%);
}
#sigilButtons button{
  width:50px;
  height:50px;
  color:#e7dac4;
  background:#252b36;
}
#puzzleFeedback{color:#b7a4d1}

/* The journal is an opaque ledger; its contents are index rows. */
.journal-card{
  width:min(1120px,100%);
  height:min(calc(100dvh - 28px),810px);
  padding:clamp(1rem,2.6vw,1.8rem);
  color:var(--archive-paper-ink);
  background:linear-gradient(90deg,#d3c5a5 0 49.6%,#bbaa86 49.8% 50.2%,#c9ba99 50.4% 100%);
}
.journal-card::before{
  content:"";
  position:absolute;
  inset:0 0 auto;
  z-index:2;
  display:block!important;
  width:100%;
  height:8px;
  border-radius:0;
  background:linear-gradient(90deg,var(--archive-brass-dark),var(--archive-brass) 42%,#83643a 72%,var(--archive-brass-dark));
  opacity:1;
  animation:none!important;
}
.journal-card header{
  padding:0 .15rem .7rem;
  border-bottom:2px solid #665d4d;
}
.journal-card header h2{color:#27231d}
.journal-card header small{color:#6d6658}
.journal-card .eyebrow{color:#7e4a42}
.journal-card main{
  gap:0;
}
.journal-panel{
  padding:.8rem 1rem .8rem .35rem;
  border:0;
  border-radius:0;
  background:none;
  box-shadow:none;
}
.journal-panel+ .journal-panel{
  padding-right:.35rem;
  padding-left:1rem;
  border-left:1px solid #817660;
}
.journal-panel h3{color:#6f4f2d}
#memoryList{gap:0 .65rem}
.memory-entry{
  min-height:67px;
  padding:.58rem .25rem .55rem .62rem;
  border:0;
  border-bottom:1px solid #8f846d;
  border-radius:0;
  background:none;
  box-shadow:inset 3px 0 0 #80745f;
}
.memory-entry.locked{opacity:.45}
.memory-entry small{color:#736b5b}
.memory-entry b{color:#302b23}
.memory-entry span{color:#705b75}
.letter-entry{
  padding:.62rem .2rem;
  border-bottom:1px solid #8f846d;
}
.letter-entry b{color:#312b23}
.letter-entry p{color:#645b4d!important}
.sigil{
  border:1px solid #7d6a82;
  border-radius:0;
  color:#5d4966;
  background:#c1b28f;
}
.journal-card .tip{
  border:0;
  border-left:5px solid var(--archive-brass);
  border-radius:0;
  color:#d9cfbd;
  background:#302d2a;
}
.seal-index-heading{border-color:#8f846d}
.seal-index-heading small{color:#746d5e}
.journal-card footer{
  padding-top:.55rem;
  border-top:1px solid #817660;
  color:#6c6558;
}
.seal-card-list{gap:.4rem}
.seal-mini{
  border:0;
  border-left:4px solid var(--archive-brass-dark);
  border-radius:0;
  background:linear-gradient(135deg,#343946,#151a23);
  clip-path:polygon(0 0,calc(100% - 9px) 0,100% 9px,100% 100%,0 100%);
}
.seal-mini::after{
  border-color:#766e5f;
  box-shadow:0 0 0 9px #292e39,0 0 0 18px #1f242e;
}
.seal-mini[data-zone="1"]{background:linear-gradient(135deg,#49402f,#191817)}
.seal-mini[data-zone="2"]{background:linear-gradient(135deg,#383651,#171825)}
.seal-mini[data-zone="3"]{background:linear-gradient(135deg,#4a343e,#1b151c)}

/* Touch targets stay round where the gesture benefits, but become opaque and tactile. */
#joystick{
  border:2px solid #665a45;
  background:#111721;
  box-shadow:0 9px 28px rgba(0,0,0,.46),inset 0 0 0 9px #1b212c;
}
#knob{
  border:2px solid #d6b46d;
  background:var(--archive-brass);
  box-shadow:0 5px 15px rgba(0,0,0,.42);
}
.joystick-mark{color:#8d7b59}
.touch-buttons .touch-action{
  border:2px solid #5b554b;
  background:#171d27;
  box-shadow:0 8px 22px rgba(0,0,0,.44);
}
#touchInteract{
  border-color:#d3ae64;
  color:#241e15;
  background:var(--archive-brass);
}
#touchInteract .touch-action span,#touchInteract span{color:#44351f}
#touchInteract.ready{
  border-color:#f0cd82;
  background:#d6ad60;
  box-shadow:0 0 0 4px #31291b,0 8px 24px rgba(0,0,0,.44);
}
#touchJournal{
  border-radius:0;
  clip-path:polygon(0 0,calc(100% - 8px) 0,100% 8px,100% 100%,0 100%);
}

.seal-screen{background:linear-gradient(135deg,#0a0d13,#151a24 58%,#080b10)}
.seal-preview{
  border:0;
  border-left:7px solid var(--seal-accent);
  border-radius:0;
  clip-path:polygon(0 0,calc(100% - 15px) 0,100% 15px,100% 100%,15px 100%,0 calc(100% - 15px));
}

@media(max-width:850px){
  .title-wrap{width:min(88vw,720px);margin-left:clamp(20px,5vw,48px)}
  #objective.objective-dock{max-width:min(42vw,250px)}
  .objective-panel{width:min(42vw,250px)}
}

@media(max-width:540px) and (orientation:portrait){
  #title{align-items:center}
  .title-wrap{
    width:calc(100vw - 28px);
    max-height:calc(100dvh - 20px);
    margin-left:14px;
    padding:1.5rem .8rem 1.5rem 1.5rem;
  }
  .title-wrap::before{width:5px}
  .title-seal{width:46px;height:46px;margin:0 0 1rem 4px}
  #title h1{font-size:clamp(2rem,10vw,2.75rem)}
  .subtitle{font-size:.58rem;line-height:1.5}
  .title-wrap>p{font-size:.82rem;line-height:1.65}
  .tags span{padding:.14rem .45rem;font-size:.62rem}
  .title-wrap>.actions{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    width:100%;
  }
  .title-wrap>.actions .btn{min-width:0}
  .mini-actions{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    width:100%;
  }
  .mini-actions .tiny{
    border-left:0;
    border-right:1px solid #3e4653;
    border-bottom:1px solid #3e4653;
  }
  .mini-actions .tiny:nth-child(2n){border-right:0}
  .mini-actions .tiny:nth-last-child(-n+2){border-bottom:0}

  .card::after{display:none}
  .card{width:calc(100vw - 28px);padding:1.55rem 1.25rem 1.45rem 1.55rem}
  .settings{grid-template-columns:1fr}
  .settings button,.settings button:nth-child(2n){
    min-height:51px;
    border-right:0;
    border-bottom:1px solid #444b57;
  }
  .settings button:nth-child(4){border-bottom:1px solid #444b57}
  #restartBtn{border-bottom:0}
  .choice-grid,.ending-grid{grid-template-columns:1fr}

  .journal-card{
    height:calc(100dvh - 20px);
    background:#cfc19f;
  }
  .journal-card main{
    display:block;
    overflow:auto;
  }
  .journal-panel{
    max-height:none;
    overflow:visible;
    padding:.7rem .2rem;
  }
  .journal-panel+ .journal-panel{
    padding:.9rem .2rem .7rem;
    border-top:1px solid #817660;
    border-left:0;
  }
  #memoryList{grid-template-columns:1fr}
}

@media(orientation:landscape) and (max-height:520px){
  .title-wrap{
    width:min(76vw,670px);
    margin-left:clamp(24px,5vw,54px);
    padding:.55rem .75rem .55rem 1.55rem;
  }
  .title-wrap::before{top:2%;bottom:2%;width:4px}
  .title-seal{display:none}
  #title h1{font-size:1.85rem;letter-spacing:.16em}
  .subtitle{font-size:.52rem}
  .title-wrap>p{max-width:610px;margin-top:.38rem;font-size:.68rem;line-height:1.45}
  .tags{margin-top:.32rem}
  .tags span{padding:.08rem .42rem;font-size:.53rem}
  .boot-status{margin:.28rem 0 -.1rem;font-size:.54rem}
  .title-wrap>.actions{margin-top:.4rem}
  .title-wrap>.actions .btn{padding:.48rem .84rem;min-width:124px}
  .mini-actions{margin-top:.35rem}
  .mini-actions .tiny{padding:.3rem .48rem;font-size:.55rem}

  .card{
    max-height:calc(100dvh - 16px);
    padding:1.25rem 1.35rem 1rem 1.7rem;
  }
  .card::after{top:10px;right:18px}
  .card h2{font-size:1.32rem}
  .card p{font-size:.74rem}
  .actions{margin-top:.65rem}
  .settings{margin-top:.65rem}
  .settings button{min-height:46px;padding:.5rem .65rem .5rem .9rem}
  .settings button::before{top:9px;bottom:9px}
  #restartBtn{min-height:39px}

  #hud .hud-left,#hud .hud-right{min-height:31px}
  #hud .chip{padding:.3rem .48rem}
  #objective.objective-dock{top:calc(var(--safe-top) + 37px)}
  #objectiveToggle{min-height:27px;padding:.24rem .5rem}
  #message{top:calc(var(--safe-top) + 40px);padding:.62rem .78rem .6rem .95rem}

  .journal-card{
    height:calc(100dvh - 14px);
    padding:.8rem .85rem;
    gap:.45rem;
  }
  .journal-card main{grid-template-columns:1.08fr .92fr}
  .journal-panel{padding:.55rem .7rem .55rem .1rem}
  .journal-panel+ .journal-panel{padding:.55rem .1rem .55rem .7rem}
  .memory-entry{min-height:58px;padding:.42rem .18rem .38rem .55rem}
  .seal-mini{min-height:58px;padding:.45rem .52rem}
}


/* ===========================================================================
   v1.0 · trilingual type, onboarding, settings
   The archive-board material system from v3.2 is unchanged; everything here
   either wires the locale-aware font stacks into it, or dresses the screens
   that did not exist before: the opening tutorial, the settings sheet, the
   how-to-play sheet, the confirm sheet and the debug type lab.
   =========================================================================== */

/* i18n.js writes --font-ui / --font-display onto :root per locale. Nothing
   below hard-codes a family, so a Japanese session is set in a Japanese face
   including the serif display cuts, and mixed strings fall through the stack
   instead of tofu-ing. The values here are only the pre-script fallback. */
:root{
  --font-ui:"PingFang TC","Noto Sans TC","Hiragino Sans","Noto Sans JP",system-ui,sans-serif;
  --font-display:"Iowan Old Style","Songti TC","Noto Serif TC",Georgia,serif;
  --safe-top:env(safe-area-inset-top);
}
body{font-family:var(--font-ui)}
.card h2,.journal-card h2,#title h1,#chapterCard h2,
.seal-copy h2,.seal-preview h2,#endingTitle,#sealTitle,
.choice-grid button::before,.ending-grid button::before{
  font-family:var(--font-display);
}
/* Japanese and English set at slightly different optical sizes than the
   Chinese original: kana need a touch more leading, Latin a touch less
   tracking or the display line drifts apart. */
html[lang="ja"] #title h1{letter-spacing:.14em;text-indent:.14em}
html[lang="ja"] #chapterCard h2{letter-spacing:.2em;text-indent:.2em}
html[lang="ja"] .card p,html[lang="ja"] .title-wrap>p{line-height:1.9}
html[lang="en"] #title h1{letter-spacing:.05em;text-indent:.05em;font-size:clamp(1.9rem,6vw,3.5rem)}
html[lang="en"] #chapterCard h2{letter-spacing:.12em;text-indent:.12em}
html[lang="en"] .subtitle,html[lang="en"] .eyebrow{letter-spacing:.16em}
/* Latin has no soft break points inside a word; CJK breaks anywhere. Give
   each the wrapping rule it needs so no long string overflows a panel. */
html[lang="en"] p,html[lang="en"] .card p,html[lang="en"] span,html[lang="en"] b{overflow-wrap:break-word}
html[lang="ja"] p,html[lang="zh-Hant"] p{line-break:strict;word-break:normal}

/* ---- language switch ---------------------------------------------------- */
.lang-switch{
  display:inline-flex;
  padding:3px;
  background:var(--archive-ink);
  clip-path:polygon(0 0,calc(100% - 8px) 0,100% 8px,100% 100%,8px 100%,0 calc(100% - 8px));
}
.lang-switch .lang-opt{
  pointer-events:auto;
  cursor:pointer;
  min-height:34px;
  padding:.4rem .72rem;
  border:0;
  border-left:1px solid #3e4653;
  color:#a9b1bd;
  background:#1b212b;
  font-size:.72rem;
  letter-spacing:.06em;
}
.lang-switch .lang-opt:first-child{border-left:0}
.lang-switch .lang-opt:hover{color:#ede2cd;background:#262d39}
.lang-switch .lang-opt.on{
  color:#221c12;
  background:var(--archive-brass);
  font-weight:700;
}
.lang-switch.wide .lang-opt{min-width:96px;padding:.5rem .6rem}
.mini-actions{align-items:stretch}

/* ---- opening tutorial --------------------------------------------------- */
.tutorial-card{width:min(92vw,600px)}
#tutorial .card::after{content:"ONBOARDING / 00"}
.tutorial-step{
  margin:.35rem 0 .1rem;
  color:#7f8999;
  font-size:.62rem;
  letter-spacing:.2em;
}
.tutorial-card h2{margin:.2rem 0 .7rem}
.tutorial-card p{min-height:4.6em;color:#b3bac5;font-size:.9rem;line-height:1.85}
/* Each step gets a small diagram built from gradients rather than an image,
   so it ships at zero bytes and re-colours with the palette. */
.tutorial-figure{
  height:96px;
  margin:.85rem 0 .2rem;
  border:1px solid #333b47;
  background:#0e131b;
  position:relative;
  overflow:hidden;
}
.tutorial-figure::before,.tutorial-figure::after{content:"";position:absolute}
.tutorial-figure[data-figure="goal"]::before{
  inset:0;
  background:
    repeating-linear-gradient(90deg,transparent 0 46px,rgba(195,154,82,.16) 46px 47px),
    linear-gradient(180deg,#141b26,#0b0f16);
}
.tutorial-figure[data-figure="goal"]::after{
  left:8%;right:8%;top:50%;height:2px;
  background:linear-gradient(90deg,var(--archive-brass),rgba(185,168,227,.75) 62%,#e4c8a3);
  box-shadow:0 0 18px rgba(228,196,126,.5);
  transform:translateY(-50%);
}
.tutorial-figure[data-figure="move"]::before{
  left:14%;top:50%;width:52px;height:52px;border-radius:50%;
  border:2px solid #665a45;background:#141a24;
  box-shadow:inset 0 0 0 12px #1b212c;
  transform:translateY(-50%);
}
.tutorial-figure[data-figure="move"]::after{
  right:14%;top:50%;width:78px;height:44px;
  border:2px dashed rgba(185,168,227,.5);
  transform:translateY(-50%);
}
.tutorial-figure[data-figure="crate"]::before{
  left:50%;top:50%;width:74px;height:56px;
  border:2px solid #7a6a4f;background:linear-gradient(180deg,#2c2519,#1a160f);
  transform:translate(-50%,-50%);
}
.tutorial-figure[data-figure="crate"]::after{
  left:50%;top:50%;width:150px;height:150px;border-radius:50%;
  background:radial-gradient(circle,rgba(228,196,126,.32),transparent 62%);
  transform:translate(-50%,-50%);
}
.tutorial-figure[data-figure="echo"]::before{
  left:50%;top:50%;width:26px;height:26px;border-radius:50%;
  background:rgba(185,168,227,.85);
  box-shadow:0 0 0 18px rgba(185,168,227,.16),0 0 0 36px rgba(185,168,227,.09),0 0 0 54px rgba(185,168,227,.045);
  transform:translate(-50%,-50%);
}
.tutorial-figure[data-figure="echo"]::after{
  left:50%;bottom:16px;width:60%;height:4px;
  background:repeating-linear-gradient(90deg,rgba(228,196,126,.85) 0 5px,transparent 5px 22px);
  transform:translateX(-50%);
}
.tutorial-dots{display:flex;gap:6px;margin:.85rem 0 0}
.tutorial-dots i{width:22px;height:3px;background:#3b434f}
.tutorial-dots i.on{background:var(--archive-brass)}
body.reduce-motion .tutorial-figure::before,
body.reduce-motion .tutorial-figure::after{animation:none!important}

/* ---- settings sheet ----------------------------------------------------- */
.settings-card,.howto-card{width:min(92vw,660px)}
#settings .card::after{content:"SETTINGS / FILE 01"}
#howto .card::after{content:"MANUAL / FILE 02"}
#confirm .card::after{content:"CONFIRM / FILE 99"}
.set-group{margin-top:1.15rem}
.set-group h3{
  padding-bottom:.32rem;
  border-bottom:1px solid #3d4552;
  color:var(--archive-brass);
  font-size:.63rem;
  font-weight:700;
  letter-spacing:.22em;
}
.set-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1.05fr);
  gap:.75rem;
  align-items:center;
  padding:.7rem 0;
  border-bottom:1px solid #262d38;
}
.set-row:last-child{border-bottom:0}
.set-row label b{display:block;color:#e6dac7;font-size:.82rem}
.set-row label span{display:block;margin-top:.2rem;color:#8f99aa;font-size:.66rem;line-height:1.5}
.set-control{display:flex;align-items:center;gap:.7rem}
.set-control output{
  min-width:3.4rem;
  color:#efdfba;
  font-size:.78rem;
  font-variant-numeric:tabular-nums;
  text-align:right;
}
/* A 44px-tall hit area with a 6px visible track: the thumb stays easy to grab
   on a phone without the control looking like a chunky form widget. */
.set-control input[type=range]{
  pointer-events:auto;
  flex:1;
  height:44px;
  margin:0;
  background:transparent;
  -webkit-appearance:none;
  appearance:none;
  cursor:pointer;
}
.set-control input[type=range]::-webkit-slider-runnable-track{
  height:6px;
  border:1px solid #444b57;
  background:#171d27;
}
.set-control input[type=range]::-moz-range-track{
  height:6px;
  border:1px solid #444b57;
  background:#171d27;
}
.set-control input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;
  appearance:none;
  width:16px;
  height:26px;
  margin-top:-11px;
  border:1px solid #e2c27f;
  background:var(--archive-brass);
}
.set-control input[type=range]::-moz-range-thumb{
  width:16px;
  height:26px;
  border:1px solid #e2c27f;
  border-radius:0;
  background:var(--archive-brass);
}
.set-control input[type=range]:focus-visible{outline:2px solid #efd18d;outline-offset:4px}
.set-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:0;
  margin-top:.55rem;
  border-bottom:1px solid #444b57;
}
.set-grid button{
  position:relative;
  pointer-events:auto;
  cursor:pointer;
  min-height:62px;
  padding:.7rem 2.6rem .7rem 1.05rem;
  border:0;
  border-right:1px solid #444b57;
  border-top:1px solid #444b57;
  color:var(--ink);
  background:#1b212b;
  text-align:left;
}
.set-grid button:nth-child(2n){border-right:0}
.set-grid button:hover{background:#262d39}
.set-grid button::before{
  content:"";
  position:absolute;
  top:12px;
  bottom:12px;
  left:0;
  width:3px;
  background:#6c7586;
}
.set-grid button b{display:block;color:#e6dac7;font-size:.8rem}
.set-grid button span{display:block;margin-top:.2rem;color:#8f99aa;font-size:.64rem;line-height:1.45}
.set-grid button em{
  position:absolute;
  top:50%;
  right:.85rem;
  max-width:6.5rem;
  color:var(--archive-brass);
  font-size:.72rem;
  font-style:normal;
  text-align:right;
  transform:translateY(-50%);
}
.set-grid button.danger{color:#d6b7b0;background:#241d20}
.set-grid button.danger::before{background:var(--archive-red)}
.set-grid button.danger em{color:#c98d82}
.set-note{
  margin-top:.6rem;
  color:#8b95a5;
  font-size:.66rem;
  letter-spacing:.04em;
}
/* Pause now carries two rails, not five. */
#pause .settings button:nth-child(-n+2){border-bottom:0}

/* ---- how to play -------------------------------------------------------- */
.howto-card{max-height:86dvh;overflow:auto}
.howto-block{margin-top:1.1rem}
.howto-block h3{
  margin-bottom:.4rem;
  color:var(--archive-brass);
  font-size:.63rem;
  font-weight:700;
  letter-spacing:.22em;
}
.howto-block p{color:#aeb5c0;font-size:.84rem;line-height:1.85}
.howto-keys{
  display:grid;
  grid-template-columns:minmax(0,auto) minmax(0,1fr);
  gap:0 1rem;
}
.howto-keys dt{
  padding:.42rem 0;
  border-bottom:1px solid #262d38;
  color:#c9d0da;
  font-size:.8rem;
}
.howto-keys dd{
  padding:.42rem 0;
  border-bottom:1px solid #262d38;
  color:#8f99aa;
  font-size:.78rem;
}
.howto-keys kbd{
  display:inline-block;
  min-width:2rem;
  padding:.14rem .42rem;
  border:1px solid #5c6472;
  background:#232a35;
  color:#efdfba;
  font-family:var(--font-ui);
  font-size:.72rem;
  text-align:center;
}
.confirm-card{width:min(92vw,520px)}

/* ---- puzzle seals get names --------------------------------------------- */
#sigilButtons{gap:.45rem}
#sigilButtons button{
  display:grid;
  place-content:center;
  gap:2px;
  width:auto;
  min-width:58px;
  height:58px;
  padding:0 .5rem;
}
#sigilButtons button b{font-size:1.15rem;line-height:1}
#sigilButtons button small{color:#9aa3b2;font-size:.54rem;letter-spacing:.05em}
#sigilButtons button:hover small{color:#d8c9a8}
#puzzleSlots i.filled{background:#e3d3ad;box-shadow:inset 0 -4px 0 var(--archive-brass)}
.letter-entry.locked{opacity:.38}

/* ---- debug-only type lab ------------------------------------------------ */
.font-lab{
  position:fixed;
  inset:0;
  z-index:900;
  overflow:auto;
  padding:24px 16px 64px;
  background:#0b0e14;
  color:#e7e2d8;
  -webkit-overflow-scrolling:touch;
}
.font-lab-inner{max-width:900px;margin:0 auto}
.font-lab header{padding-bottom:14px;border-bottom:1px solid #333b47}
.font-lab h1{font-family:var(--font-display);font-size:1.5rem;font-weight:600}
.font-lab header p{margin-top:.5rem;color:#98a1af;font-size:.78rem;line-height:1.6}
.font-lab-meta{font-family:ui-monospace,Menlo,monospace;font-size:.7rem!important}
.font-lab article{margin-top:26px;padding:16px;border:1px solid #2a3140;background:#101620}
.font-lab article h2{
  margin-bottom:10px;
  color:var(--archive-brass);
  font-size:.72rem;
  font-weight:700;
  letter-spacing:.2em;
}
.font-lab article h2 small{color:#6d7684;font-weight:400;letter-spacing:.1em}
.font-lab .fl-display{margin-bottom:12px;font-family:var(--font-display);font-size:1.75rem;line-height:1.4}
.font-lab article p{margin:8px 0;font-size:.95rem;line-height:1.85}
.font-lab .fl-narrow{max-width:230px;margin-top:12px;padding:10px;border:1px dashed #3d4552}
.font-lab .fl-narrow p{font-size:.8rem}
.font-lab .fl-scale div{padding:3px 0;line-height:1.5}
/* Left glyph uses the real stack, right glyph a face that has no CJK at all.
   A box on the left means the shipping stack is broken; a box on the right is
   the control and is expected. */
.font-lab .fl-pair{display:inline-block;margin:6px 10px 0 0;text-align:center}
.font-lab .fl-pair b{display:block;font-size:1.6rem}
.font-lab .fl-pair i{display:block;font-family:"Courier New",monospace;font-size:1.6rem;font-style:normal;color:#6d7684}

@media(max-width:540px) and (orientation:portrait){
  .set-row{grid-template-columns:1fr;gap:.35rem}
  .set-grid{grid-template-columns:1fr}
  .set-grid button{border-right:0}
  .lang-switch.wide{width:100%}
  .lang-switch.wide .lang-opt{flex:1;min-width:0}
  .howto-keys{grid-template-columns:1fr;gap:0}
  .howto-keys dt{border-bottom:0;padding-bottom:0}
  .howto-keys dd{padding-top:.1rem}
  .tutorial-figure{height:76px}
  .tutorial-card p{min-height:6em}
  .mini-actions{grid-template-columns:1fr}
  .mini-actions .lang-switch{width:100%}
  .mini-actions .lang-switch .lang-opt{flex:1}
}
@media(orientation:landscape) and (max-height:520px){
  .tutorial-figure{display:none}
  .tutorial-card p{min-height:3.2em;font-size:.78rem;line-height:1.6}
  .settings-card,.howto-card{max-height:calc(100dvh - 16px)}
  .set-group{margin-top:.6rem}
  .set-row{padding:.4rem 0}
  .set-grid button{min-height:52px}
  .howto-block{margin-top:.6rem}
  .howto-block p{font-size:.74rem;line-height:1.6}
}

/* Sheets that can be raised while the title cover is still on screen have to
   clear its z-index, or they open behind it. */
#settings,#howto,#confirm,#tutorial{z-index:60}
#confirm{z-index:62}

/* ---- touch target floor --------------------------------------------------
   Measured with scripts/layout-check.mjs across 320–1024px: the archive-board
   controls were drawn at 27–37px tall, which is fine for a cursor and wrong for
   a thumb. On coarse pointers every control clears 44px. The visual box stays
   the size it was — the extra height is centred padding, so nothing in the
   layout grows a heavier outline. */
@media(pointer:coarse){
  .btn,.tiny{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:44px;
  }
  .lang-switch .lang-opt{min-height:44px}
  .circle{width:44px;height:44px}
  #objectiveToggle{min-height:44px;padding-top:.4rem;padding-bottom:.4rem}
  .seal-mini{min-height:52px}
  /* The landscape pass trims padding to fit; keep the height it cannot trim. */
  .title-wrap>.actions .btn,.mini-actions .tiny{min-height:44px}
}
/* Very short viewports can push the cover past the fold; let it scroll rather
   than hiding the start button. The decorative key-art layer overscans by
   design and is not part of this. */
.title-wrap{overflow-y:auto;overscroll-behavior:contain}
@media(orientation:landscape) and (max-height:520px){
  .title-wrap>.actions .btn{padding-left:.9rem;padding-right:.9rem}
  .mini-actions .tiny{padding-left:.55rem;padding-right:.55rem}
}

/* ---- seal card on a narrow phone -----------------------------------------
   The 16:9 collectible works down to a tablet; on a 375px portrait phone it
   collapses to 347×195 and the decision/missing lines — the only part of the
   card that is actually about this player's run — truncate to a stub. The
   shared PNG is drawn on its own 1200×675 canvas and is unaffected, so the
   on-screen preview is free to become a portrait card and lay its content out
   in flow. */
@media(max-width:520px) and (orientation:portrait){
  .seal-preview{
    aspect-ratio:auto;
    display:flex;
    flex-direction:column;
    gap:.55rem;
    padding:16px 16px 14px;
  }
  .seal-orbit{top:16%;right:-16%;width:58%;opacity:.4}
  .seal-copy{width:100%;margin-top:.15rem}
  .seal-copy h2{font-size:1.55rem}
  .seal-copy p{-webkit-line-clamp:4;font-size:.76rem}
  .seal-stats{
    position:static;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:.55rem;
    margin-top:.2rem;
  }
  .seal-stats b{font-size:.95rem}
  .seal-stats small{font-size:.55rem}
  .seal-notes{
    position:static;
    width:100%;
    padding:.6rem 0 0;
    border-top:1px solid rgba(255,255,255,.12);
    border-left:0;
  }
  .seal-notes p{
    font-size:.68rem;
    line-height:1.6;
    white-space:normal;
    overflow:visible;
    text-overflow:clip;
  }
  .seal-preview>footer{position:static;margin-top:.2rem;font-size:.5rem}
}

/* ---- v2: breaker panel, archive objects, fourth ending ------------------- */
#breakerCard{width:min(94vw,720px)}
.breaker-row{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:.5rem;margin-top:1rem}
.breaker-switch{pointer-events:auto;cursor:pointer;display:flex;flex-direction:column;align-items:center;gap:.35rem;padding:.7rem .3rem .6rem;border-radius:10px;border:1px solid rgba(217,190,133,.18);background:linear-gradient(180deg,rgba(32,34,40,.92),rgba(16,17,22,.92));color:var(--ink);transition:border-color .2s,background .2s}
.breaker-switch:hover{border-color:rgba(230,200,131,.5)}
.breaker-switch .b-icon svg{width:22px;height:22px;fill:none;stroke:#b6ab98;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
.breaker-switch.on .b-icon svg{stroke:#f3d48f}
.breaker-switch b{font-size:.7rem;font-weight:500;line-height:1.3;min-height:2.6em;display:flex;align-items:center;text-align:center}
.b-lever{position:relative;width:22px;height:40px;border-radius:5px;background:#0b0c10;border:1px solid rgba(255,255,255,.09);box-shadow:inset 0 2px 5px rgba(0,0,0,.7)}
.b-lever i{position:absolute;left:3px;right:3px;height:16px;bottom:3px;border-radius:3px;background:linear-gradient(180deg,#5d5f66,#33353b);transition:bottom .18s}
.breaker-switch.on .b-lever i{bottom:19px;background:linear-gradient(180deg,#e8cd8e,#a98648)}
.b-pips{display:flex;gap:3px}.b-pips i{width:8px;height:8px;border-radius:2px;background:#c9a35d;opacity:.85}
.breaker-switch small{font-size:.56rem;letter-spacing:.12em;color:#8f877a}
.breaker-switch.on small{color:#e6c883}
.breaker-load{display:flex;align-items:center;justify-content:center;gap:.7rem;margin-top:1rem;flex-wrap:wrap}
.breaker-load small{font-size:.66rem;color:#a89e91;letter-spacing:.1em}
#breakerLoad{display:flex;align-items:center;gap:4px}
#breakerLoad i{width:22px;height:10px;border-radius:2px;border:1px solid rgba(230,200,131,.3);background:rgba(255,255,255,.03)}
#breakerLoad i.used{background:#c9a35d;border-color:#c9a35d}
#breakerLoad i.over{background:#d0563f;border-color:#e0705a}
#breakerLoad i.extra{border-style:dashed}
#breakerLoad span{margin-left:.4rem;font-size:.7rem;color:#d8ccb7;font-variant-numeric:tabular-nums}
.breaker-note{margin-top:.9rem;padding:.65rem .8rem;border-radius:4px;background:#e9e0c6;color:#3b3226!important;font-size:.72rem!important;line-height:1.6!important;transform:rotate(-.6deg);box-shadow:0 6px 16px rgba(0,0,0,.35);text-align:left}
#breakerFeedback{min-height:1.3rem;margin-top:.7rem;color:#e2c98e;font-size:.72rem}
#breakerMain.live{background:linear-gradient(135deg,#7d8790,#4b535c);color:#f2ede4}
.inspect-card{width:min(92vw,560px);text-align:left;background:linear-gradient(170deg,rgba(233,224,201,.97),rgba(214,202,174,.97))!important;border-color:rgba(90,70,40,.35)!important;color:#2e271d}
.inspect-card .eyebrow{color:#7a6237}
.inspect-card h2{color:#2a2219;letter-spacing:.06em;font-weight:500}
.inspect-card p{color:#43392b!important;font-size:.9rem!important;line-height:1.9!important;white-space:pre-line}
.inspect-card .btn{background:rgba(46,39,29,.88);color:#f1e7d2;border-color:transparent}
.object-heading{display:flex;justify-content:space-between;align-items:baseline;gap:.5rem;margin-top:1rem}
.object-heading small{font-size:.58rem;color:#8b8274}
.object-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:.4rem;margin-top:.5rem}
.object-entry{pointer-events:auto;cursor:pointer;text-align:left;padding:.5rem .6rem;border-radius:8px;border:1px solid rgba(230,200,131,.14);background:rgba(230,200,131,.045);color:var(--ink)}
.object-entry:hover{border-color:rgba(230,200,131,.45)}
.object-entry small{display:block;font-size:.54rem;color:#8a8173}
.object-entry b{display:block;font-size:.7rem;font-weight:500;color:#e5d9c4;margin-top:.15rem}
.object-entry.locked{cursor:default;opacity:.38}
.ending-grid{grid-template-columns:repeat(2,1fr)}
.ending-grid button.locked{opacity:.45;cursor:not-allowed}
.ending-grid button.locked:hover{transform:none}
@media(max-width:640px){.breaker-row{grid-template-columns:repeat(5,minmax(0,1fr));gap:.3rem}.breaker-switch b{font-size:.6rem}.object-list{grid-template-columns:1fr}}
@media(max-width:850px){.ending-grid{grid-template-columns:1fr}}
/* the journal is paper: object entries follow the memory entries' ink */
#journal .object-heading h3{color:#6f4f2d}
#journal .object-heading small{color:#736b5b}
#journal .object-entry{border:0;border-bottom:1px solid #8f846d;border-radius:0;background:none;box-shadow:inset 3px 0 0 #80745f;padding:.45rem .25rem .42rem .62rem}
#journal .object-entry:hover{background:rgba(111,79,45,.08)}
#journal .object-entry small{color:#736b5b}
#journal .object-entry b{color:#302b23}
#journal .object-entry.locked{opacity:.45}
/* touch floor: object entries and the journal close stay at 44px even when the longer v2 progress line squeezes the header */
.object-entry,#journal .object-entry{min-height:44px}
#journalClose{flex:0 0 auto;min-width:44px;min-height:44px}
/* a panel that is fading out stops taking input at once: visibility only flips at the end of the
   0.4 s fade, and buttons carry their own pointer-events:auto, so without this a tap right after
   closing the tutorial or journal landed on the dying panel instead of the joystick or action button */
.screen:not(.show),.screen:not(.show) *{pointer-events:none!important}
/* v2: the title sits over the live 3D warehouse (game.js attract) instead of the v1 painting,
   so the first thing a player sees is the place itself; the left scrim keeps the copy legible */
#title{background:transparent}
#title::before{background:
  linear-gradient(90deg,rgba(5,7,12,.93) 0%,rgba(5,7,12,.8) 26%,rgba(5,7,12,.36) 60%,rgba(5,7,12,.08) 100%),
  linear-gradient(180deg,rgba(5,7,12,.12),rgba(5,7,12,.62));filter:none;animation:none;transform:none}
