:root {
  --bg: #000; --ink: #d9d4c7; --dim: #8a847a; --blood: #8b0e0e; --blood-hi: #c21d1d;
  --panel: rgba(12, 10, 10, 0.92); --line: rgba(217, 212, 199, 0.18);
  --serif: "Nanum Myeongjo", "Noto Serif KR", serif; --hand: "Nanum Pen Script", cursive;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); overflow: hidden; font-family: var(--serif);
  user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none; }
canvas#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button.primary { background: var(--blood); border: 1px solid var(--blood-hi); color: #f3e9e0; padding: 12px 28px; border-radius: 4px;
  letter-spacing: 0.15em; font-weight: 800; font-size: 16px; box-shadow: 0 0 24px rgba(139, 14, 14, 0.45); transition: filter .2s, opacity .2s; }
button.primary:disabled { opacity: 0.35; cursor: wait; }
button.primary:hover:not(:disabled) { filter: brightness(1.2); }
button.ghostbtn { background: transparent; border: 1px solid var(--line); padding: 12px 22px; border-radius: 4px; }

/* ---------- title */
#title { position: fixed; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: flex-start; transition: opacity 1.2s; }
#title.hidden { opacity: 0; pointer-events: none; }
#title .bg { position: absolute; inset: 0; background: #000 url(../assets/keyart_land.webp) center/cover no-repeat; filter: brightness(.8) contrast(1.1);
  animation: breathe 9s ease-in-out infinite alternate; }
#title .bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(0,0,0,.92) 0%, rgba(0,0,0,.55) 45%, rgba(0,0,0,.1) 100%); }
@keyframes breathe { from { transform: scale(1.02); } to { transform: scale(1.08); } }
#title .inner { position: relative; padding: 0 7vw; max-width: 560px; }
#title .room { font-family: var(--hand); font-size: 26px; color: var(--blood-hi); margin: 0; letter-spacing: .1em; }
#title h1 { font-size: clamp(64px, 12vw, 124px); margin: 0; font-weight: 800; letter-spacing: .08em; line-height: 1;
  text-shadow: 0 0 30px rgba(139,14,14,.5), 3px 0 0 rgba(160,0,0,.35), -3px 0 0 rgba(0,90,120,.25); animation: jitter 6s infinite; }
@keyframes jitter { 0%, 92%, 100% { transform: none; } 93% { transform: translate(3px, -1px) skewX(4deg); } 94% { transform: translate(-4px, 1px); } 95% { transform: none; opacity: .6; } }
#title .en { margin: 6px 0 22px; letter-spacing: .6em; color: var(--dim); font-size: 13px; }
#title .lead { line-height: 1.9; color: #bdb6a8; margin: 0 0 28px; font-size: 15px; }
#loadText { color: var(--dim); font-size: 13px; margin: 14px 0 0; }
.how { list-style: none; padding: 0; margin: 28px 0 0; color: var(--dim); font-size: 12.5px; line-height: 2; }
.how b { color: #b8b0a2; font-weight: 400; margin-right: 6px; }
@media (max-aspect-ratio: 1/1) {
  #title { align-items: flex-end; justify-content: center; text-align: center; }
  #title .bg { background-image: url(../assets/keyart_portrait.webp); }
  #title .bg::after { background: linear-gradient(0deg, rgba(0,0,0,.95) 0%, rgba(0,0,0,.6) 50%, rgba(0,0,0,.05) 100%); }
  #title .inner { padding: 0 20px calc(40px + var(--safe-b)); }
}

/* ---------- hud */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; opacity: 0; transition: opacity 1s; }
#hud.show { opacity: 1; }
#hud button { pointer-events: auto; }
.top { position: absolute; top: calc(10px + var(--safe-t)); left: 12px; right: 12px; display: flex; align-items: center; gap: 8px; }
.icon { background: rgba(0,0,0,.45); border: 1px solid var(--line); border-radius: 4px; height: 38px; min-width: 38px; padding: 0 10px; font-size: 14px; }
.icon.memo.new { border-color: var(--blood-hi); box-shadow: 0 0 12px rgba(194,29,29,.6); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 2px rgba(194,29,29,.2); } }
.icon.gyro { display: none; white-space: nowrap; }
.has-gyro .icon.gyro { display: inline-block; }
.icon.gyro.on { background: rgba(139,14,14,.55); border-color: var(--blood-hi); }
.gyrotip { display: none; }
.has-gyro .gyrotip { display: list-item; }
#objective { flex: 1; min-width: 0; font-size: 13px; color: #b3ab9d; opacity: 0; transition: opacity .8s; text-shadow: 0 1px 3px #000;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 4px; }
#objective.show { opacity: .9; }
.fearbox { display: flex; align-items: center; gap: 6px; color: var(--blood-hi); font-size: 14px; }
.fear { width: 70px; height: 4px; background: rgba(255,255,255,.1); border-radius: 2px; overflow: hidden; }
.fear i { display: block; height: 100%; background: linear-gradient(90deg, #5a0808, #d42222); transform-origin: left; transform: scaleX(0); }
#hud.fear .fearbox span { animation: beat .5s infinite; }
@keyframes beat { 50% { transform: scale(1.35); } }
#cross { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: rgba(230,225,215,.5); transition: all .2s; }
#cross.hot { width: 10px; height: 10px; margin: -5px; background: transparent; border: 1.5px solid rgba(230,225,215,.75); }
#revealRing { position: absolute; left: 50%; top: 50%; width: 64px; height: 64px; margin: -32px; opacity: 0; transition: opacity .3s; transform: rotate(-90deg); }
#revealRing.show { opacity: 1; }
#revealRing .bg { fill: none; stroke: rgba(255,255,255,.12); stroke-width: 2; }
#revealRing .fg { fill: none; stroke: #c21d1d; stroke-width: 2.5; stroke-dasharray: 113; stroke-dashoffset: 113; filter: drop-shadow(0 0 4px #f00); }
#revealRing.unlock .fg { stroke: #d8c79a; filter: drop-shadow(0 0 4px #fc6); }
#subtitle { position: absolute; left: 50%; bottom: calc(118px + var(--safe-b)); transform: translateX(-50%); width: min(92vw, 720px); text-align: center;
  font-size: clamp(15px, 2.2vw, 19px); line-height: 1.6; text-shadow: 0 0 6px #000, 0 2px 4px #000; opacity: 0; transition: opacity .5s; }
#subtitle.show { opacity: 1; }
#actionBtn { position: absolute; left: 50%; bottom: calc(52px + var(--safe-b)); transform: translateX(-50%) translateY(10px); opacity: 0; pointer-events: none !important;
  background: rgba(0,0,0,.55); border: 1px solid rgba(217,212,199,.35); border-radius: 30px; padding: 11px 22px; font-size: 14px; letter-spacing: .05em; transition: all .25s; white-space: nowrap; }
#actionBtn.show { opacity: 1; transform: translateX(-50%); pointer-events: auto !important; }
#zoomBtn { position: absolute; right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(40px + var(--safe-b)); width: 74px; height: 74px; border-radius: 50%;
  background: rgba(0,0,0,.45); border: 1px solid rgba(217,212,199,.3); font-size: 26px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  touch-action: none; }
#zoomBtn small { font-size: 11px; margin-top: 4px; color: var(--dim); }
#zoomBtn.on { background: rgba(139,14,14,.55); border-color: var(--blood-hi); }
@media (pointer: fine) { #zoomBtn { width: 58px; height: 58px; font-size: 20px; opacity: .7; } }
@media (max-aspect-ratio: 1/1) { #subtitle { bottom: calc(150px + var(--safe-b)); } #actionBtn { bottom: calc(66px + var(--safe-b)); max-width: 60vw; } .fear { width: 50px; } }

/* ---------- modal */
#modal { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.55);
  opacity: 0; pointer-events: none; transition: opacity .25s; padding: 16px; }
#modal.show { opacity: 1; pointer-events: auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 22px 22px 18px; width: min(420px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.8), inset 0 0 40px rgba(139,14,14,.08); text-align: center; }
.card h2 { margin: 0 0 16px; font-size: 18px; letter-spacing: .2em; color: #e3dccd; }
.card .row { display: flex; gap: 10px; justify-content: center; margin-top: 18px; }
.card .hint { color: var(--dim); font-size: 13px; line-height: 1.7; }
.card .hint.warn { color: var(--blood-hi); }
.card.shake { animation: shake .4s; }
@keyframes shake { 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(4px); } }
.dial { display: flex; align-items: center; justify-content: center; gap: 16px; }
.dial button { width: 56px; height: 56px; border-radius: 50%; background: #1a1614; border: 1px solid var(--line); font-size: 18px; }
.dial .num { font-family: monospace; font-size: 54px; color: #7f7; text-shadow: 0 0 12px rgba(80,255,80,.5); background: #030803; border: 1px solid #1a2a1a;
  padding: 4px 18px; border-radius: 6px; min-width: 120px; }
.kpdisp { display: flex; gap: 10px; justify-content: center; margin-bottom: 16px; }
.kpdisp span { width: 48px; height: 58px; display: grid; place-items: center; font-family: monospace; font-size: 32px; background: #0b0908; border: 1px solid #3a302a; border-radius: 4px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 260px; margin: 0 auto; }
.keypad button { height: 54px; background: #1a1614; border: 1px solid var(--line); border-radius: 4px; font-size: 20px; font-family: monospace; }
.keypad button:active, .dial button:active, .clockctl button:active { background: #3a1010; }
.items { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; align-items: start; }
.items figure { margin: 0; }
.items img { width: 100%; border-radius: 3px; box-shadow: 0 6px 20px #000; }
.items figcaption { font-size: 12.5px; color: #b9b1a3; margin-top: 8px; line-height: 1.6; }
.itemCard { width: min(520px, 100%); }
#clkPrev { width: 180px; height: 180px; border-radius: 50%; border: 6px solid #3b2b1c; box-shadow: 0 0 30px #000; }
.clockctl { display: flex; justify-content: center; gap: 22px; margin-top: 12px; }
.clockctl div { display: flex; align-items: center; gap: 8px; }
.clockctl span { color: var(--dim); font-size: 13px; }
.clockctl b { font-family: monospace; font-size: 24px; min-width: 34px; }
.clockctl button { width: 42px; height: 42px; border-radius: 50%; background: #1a1614; border: 1px solid var(--line); font-size: 20px; }
.memo { list-style: none; padding: 0; margin: 0; text-align: left; }
.memo li { padding: 10px 2px; border-bottom: 1px dashed var(--line); font-size: 14px; line-height: 1.6; color: #c9c1b3; }
.memo b { color: #e6dfd0; font-weight: 800; }
.memo .dots { letter-spacing: .15em; color: var(--blood-hi); }
.memo .big { font-family: var(--hand); font-size: 30px; color: var(--blood-hi); margin-left: 6px; }
.memo .tally { font-family: var(--hand); font-size: 24px; letter-spacing: .15em; }
.memo canvas.mini { display: block; width: 90px; height: 90px; margin-top: 6px; background: #1c1916; border-radius: 4px; }

/* ---------- scare / fade / ending */
#scare { position: fixed; inset: 0; z-index: 25; pointer-events: none; display: grid; place-items: center; opacity: 0; }
#scare img { width: min(120vw, 120vh); height: auto; filter: contrast(1.3) brightness(.9); }
#scare.go { animation: scare 1.25s ease-out forwards; }
@keyframes scare {
  0% { opacity: 0; transform: scale(.6); } 6% { opacity: 1; transform: scale(1.25); } 12% { transform: scale(1.15) translate(-2%, 1%); }
  18% { transform: scale(1.3) translate(2%, -1%); } 40% { opacity: 1; } 100% { opacity: 0; transform: scale(1.6); } }
#halluc { position: fixed; z-index: 24; pointer-events: none; font-family: var(--hand); color: #b01515; font-size: clamp(34px, 7vw, 64px);
  text-shadow: 0 0 12px rgba(255,0,0,.45), 3px 0 rgba(0,160,200,.25); opacity: 0; white-space: nowrap; transform: translate(-50%, -50%); }
#halluc.go { animation: halluc 1.1s steps(9) forwards; }
@keyframes halluc { 0% { opacity: 0; } 10% { opacity: .9; } 30% { opacity: .2; } 45% { opacity: .85; transform: translate(-50%, -50%) skewX(12deg) scale(1.1); }
  70% { opacity: .5; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.3); } }
#scare.sub { animation: subflash .12s steps(1) forwards; }
@keyframes subflash { 0% { opacity: .22; } 100% { opacity: 0; } }
#fade { position: fixed; inset: 0; z-index: 22; background: #fff; opacity: 0; pointer-events: none; transition: opacity 3s; }
#fade.white { opacity: 1; }
#ending { position: fixed; inset: 0; z-index: 40; background: #000; display: none; align-items: center; justify-content: center; text-align: center; padding: 24px; }
#ending.show { display: flex; animation: fadein 3s; }
@keyframes fadein { from { opacity: 0; } }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }
.endtext p { opacity: 0; animation: appear 2s forwards; line-height: 1.9; color: #bdb6a8; margin: 6px 0; }
.endtext p:nth-child(1) { animation-delay: .5s; } .endtext p:nth-child(2) { animation-delay: 2.5s; }
.endtext .truth { color: #d8cdb8; animation-delay: 4.5s !important; max-width: 560px; margin: 10px auto !important; }
.endtext .ch { font-family: monospace; color: #7f7; font-size: 28px; text-shadow: 0 0 10px #3f3; animation-delay: 6.2s !important; margin: 18px 0 !important; }
.endtext .whisper { font-family: var(--hand); font-size: 34px; color: var(--blood-hi); animation-delay: 7.2s !important; }
.endtext h1 { font-size: 64px; letter-spacing: .15em; margin: 30px 0 4px; opacity: 0; animation: appear 2s 9s forwards; }
.endtext .stat { font-size: 13px; color: var(--dim); animation-delay: 10s !important; }
.endtext button { margin-top: 20px; opacity: 0; animation: appear 1s 10.5s forwards; }
.endtext p, .endtext h1, .endtext button { animation-fill-mode: forwards; }
#nogpu { position: fixed; inset: 0; z-index: 50; background: #000; display: none; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; }
#nogpu.show { display: flex; }
#nogpu p { color: var(--dim); }
.newgame { margin-left: 10px; }
.vols { display: grid; gap: 10px; margin: 14px auto 0; max-width: 300px; text-align: left; }
.vols label { display: grid; grid-template-columns: 56px 1fr; align-items: center; gap: 10px; font-size: 13px; color: #b9b1a3; }
.vols input { accent-color: #8b0e0e; width: 100%; }
.docCard { width: min(560px, 100%); }
.docimg { display: block; max-width: 100%; max-height: 58vh; margin: 0 auto; border-radius: 2px; box-shadow: 0 8px 30px #000; transform: rotate(-0.6deg); }
.docimg.wide { max-height: 50vh; }
.hint.doc { color: #c2b9a9; margin-top: 14px; }
.memo b.rec { color: #d9a441; }

/* ---------- v2: warmth, tray, inspect, remote */
.meters { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.warmbox { display: flex; align-items: center; gap: 6px; color: #9fd0ff; font-size: 14px; }
.warm { width: 90px; height: 5px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; }
.warm i { display: block; height: 100%; background: linear-gradient(90deg, #5aa0ff, #e8f4ff); transform-origin: left; transition: transform .3s; }
#hud.cold .warmbox span { animation: beat .7s infinite; color: #fff; }
#hint { position: absolute; left: 50%; top: calc(50% + 46px); transform: translateX(-50%); font-size: 13px; color: #cfe6ff; text-shadow: 0 0 6px #000, 0 1px 3px #000;
  opacity: 0; transition: opacity .25s; white-space: nowrap; pointer-events: none; }
#hint.show { opacity: .95; }
#hint.use { color: #ffd98a; }
#revealRing.fetch .fg { stroke: #a9dcff; filter: drop-shadow(0 0 5px #6cf); }
#tray { position: absolute; left: 12px; bottom: calc(14px + var(--safe-b)); display: flex; gap: 8px; max-width: calc(100vw - 120px); overflow-x: auto; padding: 4px; }
#tray button { pointer-events: auto; min-width: 58px; height: 58px; border-radius: 8px; background: rgba(10,8,8,.72); border: 1px solid rgba(217,212,199,.28);
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 22px; line-height: 1.05; padding: 3px 6px; flex: none; }
#tray button small { font-size: 10px; color: #bfb6a6; margin-top: 3px; white-space: nowrap; }
#tray button.sel { border-color: #ffcf70; box-shadow: 0 0 12px rgba(255,200,90,.6); }
#tray button.new { animation: pulse 1.2s 3; border-color: #9fd0ff; }
#inspect { position: fixed; inset: 0; z-index: 15; display: none; touch-action: none; }
#inspect.show { display: block; }
#inspect .ihead { position: absolute; top: calc(64px + var(--safe-t)); left: 50%; transform: translateX(-50%); text-align: center; width: min(92vw, 640px); pointer-events: none;
  text-shadow: 0 0 6px #000, 0 2px 4px #000; }
#inspect .ihead b { display: block; font-size: 18px; letter-spacing: .15em; margin-bottom: 6px; }
#inspect .ihead span { font-size: 14px; color: #d2c9b8; line-height: 1.6; }
#inspect .ibar { position: absolute; bottom: calc(24px + var(--safe-b)); left: 50%; transform: translateX(-50%); display: flex; gap: 10px; }
#hotspots button { position: absolute; transform: translate(-50%, -50%); width: 34px; height: 34px; border-radius: 50%; border: 2px solid #ffd98a; background: rgba(40,30,10,.55);
  color: #ffe4a8; font-size: 13px; box-shadow: 0 0 14px rgba(255,200,100,.5); animation: pulse 1.6s infinite; }
#hotspots button span { position: absolute; top: 38px; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 12px; text-shadow: 0 1px 3px #000; }
#pad { position: fixed; right: 12px; top: calc(70px + var(--safe-t)); z-index: 16; display: none; width: 196px; background: rgba(14,12,12,.92); border: 1px solid var(--line);
  border-radius: 14px; padding: 10px; box-shadow: 0 10px 40px #000; }
#pad.show { display: block; }
.padtop { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: #bdb4a4; margin-bottom: 8px; }
.padtop b { font-family: monospace; color: #7f7; font-size: 18px; }
.padtop button { background: none; border: none; font-size: 16px; color: #aaa; }
.padgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.padgrid button { height: 40px; border-radius: 8px; background: #221d1b; border: 1px solid #3a3230; font-family: monospace; font-size: 15px; }
.padgrid button:active { background: #3a1010; }
.padgrid .pw { color: #ff6a5a; }
.dials { display: flex; gap: 10px; justify-content: center; margin: 8px 0 4px; }
.dials div { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.dials b { font-family: monospace; font-size: 34px; width: 52px; height: 58px; display: grid; place-items: center; background: linear-gradient(#1a1410, #3b2f22, #1a1410); border: 1px solid #5a4630;
  border-radius: 6px; color: #f2d9a4; }
.dials button { width: 52px; height: 34px; background: #1f1a17; border: 1px solid var(--line); border-radius: 6px; }
@media (max-aspect-ratio: 1/1) { #pad { top: auto; bottom: calc(96px + var(--safe-b)); right: 8px; } #tray button { min-width: 52px; height: 52px; } }

/* ---------- v3: hide & seek */
#turnBtn { position: absolute; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); width: 84px; height: 84px; border-radius: 50%;
  background: rgba(0,0,0,.5); border: 1px solid rgba(217,212,199,.35); font-size: 30px; display: none; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
#turnBtn small { font-size: 11px; color: #cfc6b6; margin-top: 4px; }
#hud.hs #turnBtn { display: flex; }
#turnBtn.pulse { border-color: #ff5a4a; box-shadow: 0 0 24px rgba(255,60,40,.7); animation: pulse .8s infinite; }
#hud.hs .meters, #hud.hs #tray:empty, #hud.hs #zoomBtn, #hud.hs #memoBtn, #hud.hs #objective { display: none; }
#hud.hs #turnBtn { opacity: .35; }
#hud.hs #turnBtn.pulse, #hud.hs.turnon #turnBtn { opacity: 1; }
#cctvOsd { position: fixed; inset: 0; z-index: 9; pointer-events: none; display: none; font-family: monospace; color: #e8e8e8; text-shadow: 0 0 4px #000; }
#cctvOsd.show { display: block; }
#cctvOsd .rec { position: absolute; top: calc(64px + var(--safe-t)); left: 22px; font-size: 18px; }
#cctvOsd .rec i { color: #f33; font-style: normal; animation: pulse 1s infinite; }
#cctvOsd .cam { position: absolute; top: calc(64px + var(--safe-t)); right: 22px; font-size: 16px; }
#cctvOsd .back { position: absolute; bottom: calc(120px + var(--safe-b)); left: 50%; transform: translateX(-50%); font-family: var(--serif); font-size: 15px; }
#hud.hs #subtitle { bottom: calc(118px + var(--safe-b)); }
#hsTip { position: absolute; top: calc(58px + var(--safe-t)); left: 50%; transform: translateX(-50%); font-size: 17px; letter-spacing: .06em; color: #f2eadb;
  text-shadow: 0 0 8px #000, 0 2px 4px #000; opacity: 0; transition: opacity .4s; pointer-events: none; white-space: nowrap; }
#hsTip.show { opacity: 1; }
#hsTip b { color: #ffb44a; }

#choice { position: absolute; left: 50%; bottom: calc(26px + var(--safe-b)); transform: translateX(-50%); display: none; gap: 12px; }
#choice.show { display: flex; }
#choice button { pointer-events: auto; min-width: 150px; min-height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 17px; }
#choice button small { font-size: 12px; font-weight: 400; opacity: .8; margin-top: 4px; letter-spacing: 0; }
#choice #chStay { background: rgba(0,0,0,.6); }
#choice #chStay.confirm { border-color: #ff5a4a; color: #ffb0a6; }
#hud.choosing #turnBtn { display: none !important; }
.endtext .again { opacity: 1 !important; animation: none !important; margin-top: 26px; font-size: 18px; padding: 14px 34px; }
#choice button { white-space: nowrap; }
@media (max-width: 480px) { #choice { flex-direction: column; width: min(86vw, 320px); } #choice button { min-width: 0; width: 100%; } }
#hud.choosing #tray { display: none; }

/* ---- anomaly night: three slots and how many are fixed */
#anHud { position: absolute; top: calc(92px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px;
  padding: 5px 12px; border-radius: 16px; background: rgba(8,8,10,.45); color: #d8d0c2; font-size: 13px; letter-spacing: .08em;
  opacity: 0; transition: opacity .4s; pointer-events: none; }
#anHud.show { opacity: 1; }
#anHud .pips { display: flex; gap: 6px; }
#anHud .pips i { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid rgba(230,220,200,.6); transition: background .2s, border-color .2s; }
#anHud .pips i.on { background: #e6a23c; border-color: #e6a23c; box-shadow: 0 0 8px rgba(230,160,60,.7); }
#anHud.danger .pips i.on { background: #ff3a2a; border-color: #ff3a2a; box-shadow: 0 0 12px rgba(255,50,30,.9); animation: pulse .6s infinite; }
#anHud b { font-weight: 600; min-width: 42px; text-align: right; }
#anHud .fails { color: #ff5a4a; letter-spacing: .15em; margin-left: 4px; }

/* hint for an anomaly nobody has found: ring on it, or an arrow at the edge towards it */
#anMark { position: absolute; left: 0; top: 0; width: 0; height: 0; pointer-events: none; display: none; }
#anMark.ring, #anMark.arrow { display: block; }
#anMark i { position: absolute; left: -38px; top: -38px; width: 76px; height: 76px; border-radius: 50%; border: 2px solid rgba(255,190,90,.85);
  box-shadow: 0 0 14px rgba(255,160,60,.6); animation: markPulse 1.1s ease-in-out infinite; }
#anMark.arrow i { left: -20px; top: -14px; width: 0; height: 0; border-radius: 0; border: none; box-shadow: none;
  border-left: 30px solid rgba(255,180,80,.9); border-top: 14px solid transparent; border-bottom: 14px solid transparent;
  transform: rotate(var(--rot)); filter: drop-shadow(0 0 8px rgba(255,150,50,.8)); animation: markNudge .9s ease-in-out infinite; }
#anMark span { position: absolute; left: 50%; top: 44px; transform: translateX(-50%); white-space: nowrap; font-size: 13px; color: #ffcf8a; text-shadow: 0 1px 3px #000; }
#anMark.arrow span { top: 22px; }
/* right / wrong answer at the tap point */
#tapFx { position: fixed; left: 0; top: 0; pointer-events: none; z-index: 30; display: none; transform: translate(-50%, -50%); text-align: center; }
#tapFx.show { display: block; animation: tapFx 1.3s ease-out forwards; }
#tapFx b { display: block; margin: 0 auto; width: 84px; height: 84px; line-height: 80px; border-radius: 50%; font-size: 54px; font-weight: 900; }
#tapFx span { display: block; margin-top: 6px; white-space: nowrap; font-size: 16px; font-weight: 700; text-shadow: 0 1px 4px #000, 0 0 10px #000; }
#tapFx.ok b { color: #eafff0; border: 3px solid #7dffb0; background: rgba(40,160,90,.35); box-shadow: 0 0 22px rgba(90,255,150,.7); }
#tapFx.ok span { color: #b9ffd2; }
#tapFx.no b { color: #ffd6d6; border: 3px solid #ff4a4a; background: rgba(170,10,10,.45); box-shadow: 0 0 26px rgba(255,40,40,.8); }
#tapFx.no span { color: #ff9a9a; }
#tapFx.no.show { animation: tapFxNo 1.3s ease-out forwards; }
@keyframes tapFx { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.5); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); }
  22% { transform: translate(-50%, -50%) scale(1); } 75% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -62%) scale(1); } }
@keyframes tapFxNo { 0% { opacity: 0; transform: translate(-50%, -50%) scale(1.4); } 10% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  16% { transform: translate(-58%, -50%); } 24% { transform: translate(-42%, -50%); } 32% { transform: translate(-54%, -50%); } 40% { transform: translate(-50%, -50%); }
  75% { opacity: 1; } 100% { opacity: 0; } }
@keyframes markPulse { 50% { transform: scale(1.18); opacity: .55; } }
@keyframes markNudge { 50% { opacity: .5; } }

/* graphics preset buttons in the pause menu */
.gfx { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 10px 0 4px; }
.gfx > span { width: 100%; font-size: 13px; color: #bdb3a2; }
.gfx button { flex: 1; min-width: 56px; padding: 8px 6px; border-radius: 8px; border: 1px solid rgba(220,210,190,.25); background: rgba(255,255,255,.04); color: #e9e1d2; font: inherit; font-size: 14px; }
.gfx button.on { border-color: #e6a23c; background: rgba(230,162,60,.18); color: #ffd79a; }
.gfx small { width: 100%; font-size: 11px; color: #8f877a; }

#torchBtn.on { border-color: #ffd48a; color: #ffe2a8; box-shadow: 0 0 12px rgba(255,210,140,.45); }
#torchBtn.nudge { animation: pulse .9s infinite; }

/* eyelids: the game opens with the eyes shut, a flutter, then the room */
#lids { position: fixed; inset: 0; pointer-events: none; z-index: 30; display: none; }
#lids.show { display: block; }
#lids i { position: absolute; left: -10%; width: 120%; height: 52%; background: #000; transition: transform var(--lid-t, 1.2s) cubic-bezier(.6,0,.3,1);
  box-shadow: 0 0 60px 40px #000; }
#lids .top { top: 0; border-radius: 0 0 50% 50% / 0 0 30% 30%; transform: translateY(0); }
#lids .bot { bottom: 0; border-radius: 50% 50% 0 0 / 30% 30% 0 0; transform: translateY(0); }
#lids.open .top { transform: translateY(-105%); }
#lids.open .bot { transform: translateY(105%); }
#lids.half .top { transform: translateY(-55%); }
#lids.half .bot { transform: translateY(55%); }

/* hotbar: flashlight and remote, either side of the turn-around button at the bottom centre */
#hotbar { position: absolute; left: 50%; bottom: calc(22px + var(--safe-b)); transform: translateX(-50%); display: flex; align-items: center; gap: 10px; z-index: 5; }
#hotbar .gap { width: 92px; }
#hotbar .slot { width: 64px; height: 64px; border-radius: 14px; border: 1px solid rgba(230,220,200,.28); background: rgba(10,10,12,.55); color: #e9e1d2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: inherit; backdrop-filter: blur(4px); }
#hotbar .slot b { font-size: 24px; line-height: 1; }
#hotbar .slot small { font-size: 11px; color: #cfc6b6; }
#hotbar .slot.on { border-color: #ffd48a; box-shadow: 0 0 14px rgba(255,210,140,.5); }
#hotbar .slot.on small { color: #ffe2a8; }
#hud.choosing #hotbar { display: none; }

/* during the anomaly nights the warmth meter is back: wrong taps cost warmth */
#hud.hs.annight .meters { display: flex; }
#hud.hs.annight .fearbox { display: none; }
#hud.hurt .warmbox { animation: hurtShake .35s 2; }
#hud.hurt .warm i { background: #ff4a3a !important; }
@keyframes hurtShake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

/* puzzles: your knock on the armrest, the night's puzzle in the counter, the rolling dial */
/* the knock track: beats as marks, a playhead, your knocks as dots */
#knockTrack { position: fixed; left: 50%; bottom: 24%; width: min(78vw, 520px); height: 46px; transform: translateX(-50%); display: none; z-index: 25;
  pointer-events: none; border-radius: 23px; background: rgba(10,6,6,.55); border: 1px solid rgba(255,220,180,.18); }
#knockTrack.show { display: block; }
#knockTrack::before { content: ''; position: absolute; left: 14px; right: 14px; top: 50%; height: 2px; background: rgba(255,220,180,.18); }
#knockTrack .head { position: absolute; top: 5px; bottom: 5px; width: 3px; margin-left: -1.5px; background: #ffd79a; box-shadow: 0 0 10px #ffb85a; border-radius: 2px; }
#knockTrack b { position: absolute; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; border-radius: 50%; background: rgba(255,120,90,.9); box-shadow: 0 0 12px rgba(255,80,60,.7); transition: opacity .2s, transform .15s; }
#knockTrack b.wait { opacity: .12; transform: scale(.6); }
#knockTrack b.lit { animation: knockLit .35s ease-out; }
#knockTrack.dim b:not(.you):not(.got) { opacity: .28; }
#knockTrack.hidden b:not(.you):not(.got) { opacity: 0; }
#knockTrack b.got { background: #7dffb0; box-shadow: 0 0 14px rgba(90,255,150,.8); opacity: 1; }
#knockTrack b.you { width: 10px; height: 10px; margin: -5px 0 0 -5px; top: 80%; box-shadow: none; }
#knockTrack b.you.hit { background: #7dffb0; } #knockTrack b.you.miss { background: #ff4a4a; }
@keyframes knockLit { 0% { transform: scale(1.9); } 100% { transform: scale(1); } }
#anCount .pz { margin-left: 8px; padding: 1px 7px; border-radius: 9px; background: rgba(255,255,255,.08); color: #ffd79a; font-size: .9em; white-space: nowrap; }
#anCount .pz.ok { color: #9dffbe; }
.dials.wheel b { height: 108px; flex-direction: column; overflow: hidden; touch-action: none; cursor: ns-resize; display: flex; justify-content: center; line-height: 1.05; }
.dials.wheel b i { font-style: normal; font-size: 20px; opacity: .35; }
.dials.wheel b em { font-style: normal; font-size: 38px; color: #ffe2b0; text-shadow: 0 0 8px rgba(255,190,110,.5); }

/* ---- language: selector (title + pause menu) and English typography */
.langsel { margin: 20px 0 0; max-width: 260px; }
@media (max-aspect-ratio: 1/1) { #title .langsel { margin-left: auto; margin-right: auto; } }
html[lang=en] { --serif: "Crimson Pro", "Nanum Myeongjo", Georgia, "Times New Roman", serif; }
html[lang=en] #title h1 { font-size: clamp(44px, 7vw, 92px); letter-spacing: .04em; white-space: nowrap; }
html[lang=en] #title .lead, html[lang=en] #subtitle { font-size: clamp(16px, 2.3vw, 20px); }
html[lang=en] #title .lead { font-size: 17px; }
html[lang=en] #hsTip, html[lang=en] #hint { white-space: normal; width: max-content; max-width: min(92vw, 640px); text-align: center; line-height: 1.45; }
html[lang=en] .card .hint, html[lang=en] .memo li { font-size: 15px; }
html[lang=en] #hotbar .slot small, html[lang=en] #turnBtn small { letter-spacing: -.01em; }
html[lang=en] .endtext h1 { font-size: clamp(40px, 11vw, 64px); letter-spacing: .06em; }
