/* TIỆM ẢNH HỒNG PHÚC. --u = 1% chiều rộng khung hình (main.js tính) */
:root { --ink: #e9e4d8; --dim: #8d877b; --red: #b3241c; --blood: #6d0f0b; --night: #9dff9a; --paper: #d9d1bd; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; color: var(--ink); overflow: hidden; font-family: 'Noto Serif', Georgia, serif; user-select: none; -webkit-user-select: none; }
button { font: inherit; color: inherit; cursor: pointer; }
#app { position: fixed; inset: 0; display: grid; place-items: center; background: #000; }
#stage { position: relative; overflow: hidden; background: #050505; --u: 10px; font-size: calc(var(--u) * 1.5); touch-action: manipulation; }
#stage.fadeout #scene { opacity: 0; }
#scene { position: absolute; inset: 0; transition: opacity .4s; cursor: default; }

/* ---------- khung cảnh ---------- */
.view { position: absolute; inset: 0; }
.vis { position: absolute; inset: 0; }
.vis img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.vis.bg img { object-fit: cover; filter: contrast(1.05); }
.vis.bg.ph { background: radial-gradient(ellipse at 50% 45%, #2b2925 0%, #141311 55%, #050505 100%); overflow: hidden; }
.ph-name { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); font-family: 'Xanh Mono', monospace; font-size: calc(var(--u) * 6); color: rgba(233, 228, 216, .07); white-space: nowrap; letter-spacing: .1em; text-transform: uppercase; }
.ph-desc { position: absolute; left: 2%; bottom: 2%; right: 30%; font-size: calc(var(--u) * 1.05); color: rgba(233, 228, 216, .28); font-style: italic; line-height: 1.35; }
.ph-obj { position: absolute; border: 1px dashed rgba(233, 228, 216, .16); background: rgba(255, 255, 255, .025); border-radius: 3px; }
.ph-obj i { position: absolute; left: 4px; top: 3px; font-size: calc(var(--u) * 1); color: rgba(233, 228, 216, .38); font-style: normal; line-height: 1.2; }
.glint { position: absolute; width: calc(var(--u) * 1.4); height: calc(var(--u) * 1.4); margin: calc(var(--u) * -.7); pointer-events: none;
  background: radial-gradient(circle, #fff 0, rgba(255, 255, 255, .7) 18%, transparent 60%); animation: glint 2.6s infinite; }
@keyframes glint { 0%, 70%, 100% { opacity: 0; transform: scale(.4) rotate(0); } 80% { opacity: 1; transform: scale(1.2) rotate(45deg); } }
.lay-item, .lay-img { position: absolute; pointer-events: none; }
.lay-item .vis.ph { color: rgba(233, 228, 216, .55); display: grid; place-items: center; }
.lay-item .vis.ph svg { width: 70%; height: 70%; filter: drop-shadow(0 0 4px #000); }
.lay-text { position: absolute; pointer-events: none; line-height: 1.05; opacity: .85; mix-blend-mode: multiply; }
.lay-text.hand { font-family: 'Patrick Hand', cursive; text-shadow: 0 0 2px rgba(80, 0, 0, .6); }
.ghost { position: absolute; opacity: 0; transition: opacity .35s; pointer-events: none; }
.ghost .vis.ph svg { width: 100%; height: 100%; }
.ghost.live { animation: breathe 2.2s infinite; }
@keyframes breathe { 0%, 100% { transform: scale(1); filter: blur(0); } 50% { transform: scale(1.015) translateY(-0.5%); filter: blur(.4px); } 52% { opacity: .55; } 54% { opacity: .9; } }

/* ---------- điểm bấm ---------- */
.hs-wrap { position: absolute; inset: 0; }
/* Vùng bấm vô hình hoàn toàn: không viền, không đổi con trỏ, không nhãn. Người chơi phải tự dò. */
.hs { position: absolute; cursor: inherit; }
#stage { cursor: default; }

/* ---------- bóng tối, nhiễu hạt, viền tối ---------- */
#dark { position: absolute; inset: 0; pointer-events: none; transition: background .4s; --tx: 50%; --ty: 50%; }
#dark.black { background: rgba(0, 0, 0, .965); }
#dark.torch { background: radial-gradient(circle calc(var(--u) * 19) at var(--tx) var(--ty), rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, .2) 50%, rgba(0, 0, 0, .95) 100%); }
#stage.dark-lit #scene { filter: brightness(1.9) contrast(1.08); }
#grain { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; mix-blend-mode: screen; image-rendering: pixelated; opacity: .9; z-index: 30; }
#vignette { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, transparent 50%, rgba(0, 0, 0, .75) 100%); z-index: 29; }
#flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .5s; z-index: 80; }
#flash.on { opacity: .9; transition: none; }
#stage.shake { animation: shake .5s; }
@keyframes shake { 20% { transform: translate(-1.2%, .6%); } 40% { transform: translate(1%, -.8%); } 60% { transform: translate(-.6%, .4%); } 80% { transform: translate(.4%, -.2%); } }

/* ---------- tiêu đề, lời thoại, thông báo ---------- */
#title { position: absolute; left: 0; right: 0; top: 34%; text-align: center; opacity: 0; transition: opacity 1s; pointer-events: none; z-index: 40; text-shadow: 0 0 calc(var(--u) * 1) #000; }
#title.on { opacity: 1; }
#title small { display: block; font-size: calc(var(--u) * 1.4); letter-spacing: .3em; color: var(--dim); text-transform: uppercase; }
#title b { display: block; font-family: 'Xanh Mono', monospace; font-weight: 400; font-size: calc(var(--u) * 5.2); letter-spacing: .12em; }
#say { position: absolute; left: 12%; right: 12%; bottom: 13%; text-align: center; font-size: calc(var(--u) * 1.7); line-height: 1.4; opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 45; text-shadow: 0 0 6px #000, 0 0 12px #000, 0 0 2px #000; }
#say.on { opacity: 1; }
#toast { position: absolute; left: 50%; top: 4%; transform: translateX(-50%); padding: .4em 1em; background: rgba(0, 0, 0, .8); border: 1px solid rgba(233, 228, 216, .2); font-size: calc(var(--u) * 1.25); opacity: 0; transition: opacity .3s; pointer-events: none; z-index: 95; text-align: center; max-width: 80%; }
#toast.on { opacity: 1; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 50; }
#hud-top { position: absolute; right: 1.5%; top: 2.5%; display: flex; gap: calc(var(--u) * .8); align-items: center; pointer-events: auto; }
.tbtn { position: relative; width: calc(var(--u) * 4.4); height: calc(var(--u) * 4.4); border-radius: 50%; border: 1px solid rgba(233, 228, 216, .25); background: rgba(0, 0, 0, .55); padding: calc(var(--u) * .9); color: var(--ink); }
.tbtn:hover { background: rgba(40, 40, 40, .8); }
.tbtn svg { width: 100%; height: 100%; display: block; }
.bd { position: absolute; right: -10%; top: -10%; min-width: 1.4em; height: 1.4em; border-radius: .7em; background: var(--red); font-size: calc(var(--u) * 1); font-style: normal; display: grid; place-items: center; padding: 0 .3em; }
.bd:empty { display: none; }
#relic-n { font-size: calc(var(--u) * 1.15); color: var(--dim); margin-right: calc(var(--u) * 1); text-shadow: 0 0 4px #000; }
#relic-n b { color: var(--ink); }
#bat { position: relative; width: calc(var(--u) * 5.5); height: calc(var(--u) * 2.2); border: 1px solid rgba(233, 228, 216, .4); border-radius: 3px; overflow: hidden; background: rgba(0, 0, 0, .5); }
#bat i { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(233, 228, 216, .3); }
#bat span { position: relative; display: block; text-align: center; font-family: Cousine, monospace; font-size: calc(var(--u) * 1.05); line-height: calc(var(--u) * 2.1); }
#bat.low i { background: var(--red); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .3; } }
/* đáy màn hình: tên phòng bên trái, túi đồ bên phải */
#rooms { position: absolute; left: 2%; bottom: 3.6%; display: flex; gap: calc(var(--u) * 1.4); pointer-events: auto; }
#rooms button { background: none; border: 0; padding: 0; font-family: 'Noto Serif', serif; font-weight: 700; font-size: calc(var(--u) * 1.2); letter-spacing: .06em; text-transform: uppercase; text-shadow: 0 0 6px #000, 0 0 2px #000; }
#rooms .here { color: var(--ink); text-shadow: 0 0 10px rgba(233, 228, 216, .5), 0 0 3px #000; cursor: default; }
#rooms .seen { color: #8a857a; cursor: pointer; }
#rooms .seen:hover { color: #c9c3b5; }
#rooms .unseen { color: #67625a; cursor: default; }
#inv { position: absolute; right: 1.5%; bottom: 2.5%; display: flex; gap: calc(var(--u) * .5); pointer-events: auto; }
.slot.empty { cursor: default; background: rgba(0, 0, 0, .35); border-color: rgba(233, 228, 216, .12); }
.slot.dragging { opacity: .3; }
.drag-item { position: fixed; width: 64px; height: 64px; transform: translate(-50%, -50%); pointer-events: none; z-index: 1000; filter: drop-shadow(0 4px 10px #000); }
.drag-item .vis { position: absolute; inset: 0; }
#incense { display: flex; align-items: center; gap: .3em; font-family: Cousine, monospace; font-size: calc(var(--u) * 1.15); color: #e8b27a; text-shadow: 0 0 6px #000; }
#incense svg { width: calc(var(--u) * 1.8); height: calc(var(--u) * 1.8); }
/* khói hương */
.incense-smoke { position: absolute; pointer-events: none; }
.incense-smoke .puff { position: absolute; bottom: 5%; width: 130%; aspect-ratio: 1; margin-left: -65%; border-radius: 50%; background: radial-gradient(circle, rgba(245, 240, 230, .85), rgba(245, 240, 230, .25) 40%, rgba(245, 240, 230, 0) 70%); filter: blur(4px); mix-blend-mode: screen; opacity: 0; animation: puff 6.5s ease-out infinite; }
@keyframes puff { 0% { transform: translate(0, 0) scale(.3); opacity: 0; } 15% { opacity: 1; } 100% { transform: translate(25%, -180%) scale(1.8); opacity: 0; } }
.cam-modes button.hinted { box-shadow: 0 0 0 2px #e8b27a, 0 0 14px rgba(232, 178, 122, .7); }
.slot { position: relative; width: calc(var(--u) * 5); height: calc(var(--u) * 5); border: 1px solid rgba(233, 228, 216, .25); background: rgba(0, 0, 0, .6); cursor: pointer; border-radius: 4px; }
.slot.relic { border-color: rgba(179, 36, 28, .7); }
.slot:hover { background: rgba(40, 40, 40, .8); }
.slot .vis { inset: 10%; }
.ivis.ph { display: grid; place-items: center; color: var(--ink); }
.ivis.ph svg { width: 80%; height: 80%; }
#hunt { position: absolute; left: 50%; top: 12%; transform: translateX(-50%); font-family: 'Xanh Mono', monospace; font-size: calc(var(--u) * 3.4); color: var(--red); text-align: center; opacity: 0; transition: opacity .3s; text-shadow: 0 0 10px #000; letter-spacing: .2em; }
#hunt.on { opacity: 1; animation: blink 1s infinite; }
#hunt small { display: block; font-family: 'Noto Serif', serif; font-size: calc(var(--u) * 1.15); color: var(--ink); letter-spacing: 0; }
#stage.is-dark #hud-top, #stage.is-dark #inv, #stage.is-dark #rooms { opacity: .85; }

/* ---------- lớp phủ chung ---------- */
.ov { position: absolute; inset: 0; display: none; z-index: 60; }
.ov.on { display: block; }
.xbtn { position: absolute; right: 2%; top: 3%; width: calc(var(--u) * 4); height: calc(var(--u) * 4); border-radius: 50%; background: rgba(0, 0, 0, .7); border: 1px solid rgba(233, 228, 216, .3); display: grid; place-items: center; font-size: calc(var(--u) * 2.4); cursor: pointer; z-index: 5; }
.btns { display: flex; gap: calc(var(--u) * 1.2); justify-content: center; flex-wrap: wrap; }
.btns button, .menu-box button { padding: .55em 1.6em; background: transparent; border: 1px solid rgba(233, 228, 216, .45); letter-spacing: .12em; font-size: calc(var(--u) * 1.4); }
.btns button:hover, .menu-box button:hover { background: rgba(233, 228, 216, .1); }

#closeup { background: rgba(0, 0, 0, .88); }
.cu-frame { position: absolute; left: 8%; right: 8%; top: 8%; bottom: 8%; box-shadow: 0 0 0 1px rgba(233, 228, 216, .15), 0 0 40px #000; }
.cu-frame .vis.bg.ph { display: grid; place-items: center; }
.cu-frame .ph-desc { position: static; display: block; padding: 10%; font-size: calc(var(--u) * 1.6); text-align: center; color: rgba(233, 228, 216, .5); }

#inspect { background: rgba(0, 0, 0, .85); display: none; place-items: center; cursor: pointer; }
#inspect.on { display: grid; }
.insp { width: 46%; text-align: center; animation: rise .5s; }
.insp small { display: block; letter-spacing: .3em; color: var(--dim); font-size: calc(var(--u) * 1.1); }
.insp.relic small { color: var(--red); }
.insp .ibig { position: relative; height: calc(var(--u) * 16); margin: calc(var(--u) * 1.4) auto; animation: turn 6s ease-in-out infinite; }
.insp .ibig.ph { display: grid; place-items: center; }
.insp .ibig.ph svg { width: calc(var(--u) * 13); height: calc(var(--u) * 13); }
.insp b { display: block; font-family: 'Xanh Mono', monospace; font-weight: 400; font-size: calc(var(--u) * 2.6); }
.insp p { color: #bdb6a6; font-size: calc(var(--u) * 1.35); line-height: 1.4; margin: .4em 0 1em; }
.insp em { font-size: calc(var(--u) * 1); color: var(--dim); }
@keyframes rise { from { opacity: 0; transform: translateY(4%); } }
@keyframes turn { 0%, 100% { transform: rotate(-4deg) scale(1); } 50% { transform: rotate(4deg) scale(1.04); } }

/* ---------- chữ đánh máy ---------- */
#type { background: #000; z-index: 90; cursor: pointer; display: none; place-items: center; }
#type.on { display: grid; }
#typebox { width: 70%; font-family: 'Xanh Mono', monospace; font-size: calc(var(--u) * 2.1); line-height: 1.55; text-align: center; min-height: 3em; }
.caret { display: inline-block; width: .5em; height: 1em; margin-left: .2em; background: var(--ink); vertical-align: -.1em; animation: blink 1s infinite; }

/* ---------- máy ảnh ---------- */
#cam { background: #000; z-index: 70; }
.vf { position: absolute; inset: 0; overflow: hidden; }
.vf-scene { position: absolute; inset: 0; transition: filter .25s; }
#cam.m-night .vf::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .18) 0 2px, transparent 2px 4px); pointer-events: none; }
.cc { position: absolute; width: 5%; height: 7.5%; border: 2px solid rgba(255, 255, 255, .8); pointer-events: none; }
.cc.tl { left: 4%; top: 6%; border-right: 0; border-bottom: 0; } .cc.tr { right: 4%; top: 6%; border-left: 0; border-bottom: 0; }
.cc.bl { left: 4%; bottom: 6%; border-right: 0; border-top: 0; } .cc.br { right: 4%; bottom: 6%; border-left: 0; border-top: 0; }
.cam-ch { position: absolute; left: 50%; top: 50%; width: 3%; height: 4.5%; transform: translate(-50%, -50%); pointer-events: none;
  background: linear-gradient(#fff, #fff) center / 100% 1px no-repeat, linear-gradient(#fff, #fff) center / 1px 100% no-repeat; opacity: .6; }
.cam-top { position: absolute; left: 5%; right: 5%; top: 7.5%; display: flex; align-items: center; gap: calc(var(--u) * 2); font-family: Cousine, monospace; font-size: calc(var(--u) * 1.3); }
.cam-x { width: calc(var(--u) * 3.6); height: calc(var(--u) * 3.6); border-radius: 50%; border: 1px solid rgba(255, 255, 255, .5); background: rgba(0, 0, 0, .5); font-size: calc(var(--u) * 2.2); line-height: 1; }
#cam.final .cam-x, #cam.final .cam-modes, #cam.final .cam-ev { display: none; }
.cam-rec i { display: inline-block; width: .7em; height: .7em; border-radius: 50%; background: var(--red); margin-right: .4em; animation: blink 1.2s infinite; }
.cam-film { margin-left: auto; }
.cam-hint { position: absolute; left: 15%; right: 15%; top: 16%; text-align: center; font-size: calc(var(--u) * 1.45); line-height: 1.4; opacity: 0; transition: opacity .3s; text-shadow: 0 0 6px #000, 0 0 3px #000; pointer-events: none; }
.cam-hint.on { opacity: 1; }
.cam-modes { position: absolute; left: 5%; bottom: 8%; display: flex; flex-direction: column; gap: calc(var(--u) * .7); }
.cam-modes button { font-family: Cousine, monospace; font-size: calc(var(--u) * 1.25); padding: .45em 1em; background: rgba(0, 0, 0, .55); border: 1px solid rgba(255, 255, 255, .35); text-align: left; letter-spacing: .08em; }
.cam-modes button.on { background: rgba(255, 255, 255, .9); color: #000; }
.cam-ev { position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); display: flex; align-items: center; gap: calc(var(--u) * .8); font-family: Cousine, monospace; font-size: calc(var(--u) * 1.15); background: rgba(0, 0, 0, .5); padding: .5em 1em; border: 1px solid rgba(255, 255, 255, .2); }
.cam-ev input { width: calc(var(--u) * 16); accent-color: #fff; }
.cam-ev em { font-style: normal; min-width: 2em; text-align: right; font-weight: 700; }
.cam-shot { position: absolute; right: 5%; bottom: 7%; width: calc(var(--u) * 7.5); height: calc(var(--u) * 7.5); border-radius: 50%; border: calc(var(--u) * .45) solid #fff; background: rgba(255, 255, 255, .15); box-shadow: inset 0 0 0 calc(var(--u) * .5) rgba(0, 0, 0, .6); }
.cam-shot:active { background: rgba(255, 255, 255, .7); }
.cam-out { position: absolute; inset: 0; display: none; place-items: center; background: rgba(0, 0, 0, .55); cursor: pointer; z-index: 3; }
.cam-out.on { display: grid; }

/* ảnh lấy liền */
.polaroid { width: 40%; background: #e8e3d6; padding: 3% 3% 1% 3%; box-shadow: 0 1.5em 3em rgba(0, 0, 0, .8); transform: rotate(-2deg); color: #222; }
.polaroid p { font-family: 'Patrick Hand', cursive; font-size: calc(var(--u) * 1.45); margin: .5em 0 .3em; line-height: 1.25; color: #3a1010; }
.polaroid.dev { animation: eject .6s ease-out; }
.polaroid.dev .photo .view { animation: develop 2.4s ease-out; }
@keyframes eject { from { transform: translateY(40%) rotate(0); opacity: 0; } }
@keyframes develop { 0% { opacity: 0; } 30% { opacity: .2; } 100% { opacity: 1; } }
.photo { position: relative; width: 100%; aspect-ratio: 3 / 2; overflow: hidden; background: #0a0a0a; }
.photo .view { position: absolute; inset: 0; }
.photo .ph-desc, .photo .ph-name { display: none; }

/* ---------- điện thoại ---------- */
#phone { background: rgba(0, 0, 0, .7); z-index: 72; }
.phn { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); height: 92%; aspect-ratio: 9 / 18.5; border-radius: calc(var(--u) * 2.4); background: #0b0b0c; border: calc(var(--u) * .45) solid #222; box-shadow: 0 0 0 1px #444, 0 2em 4em #000; overflow: hidden; font-family: -apple-system, 'Segoe UI', Roboto, sans-serif; animation: rise .35s; }
.ph-scr { position: absolute; inset: 0; display: flex; flex-direction: column; background: linear-gradient(#1a1d22, #0b0c0e); }
.ph-bar { display: flex; justify-content: space-between; padding: 4% 7% 2%; font-size: calc(var(--u) * 1.05); color: #ccc; }
.ph-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; font-size: calc(var(--u) * 1.2); }
.ph-time { text-align: center; font-size: calc(var(--u) * 5); font-weight: 200; margin-top: 10%; }
.ph-date { text-align: center; color: #aaa; font-size: calc(var(--u) * 1.15); }
.ph-apps { margin-top: auto; padding: 6%; display: grid; gap: calc(var(--u) * .8); }
.ph-apps button { position: relative; display: flex; align-items: center; gap: .7em; padding: .75em 1em; border-radius: .8em; background: rgba(255, 255, 255, .08); border: 0; text-align: left; font-size: calc(var(--u) * 1.25); }
.ph-apps button.on { background: rgba(255, 240, 180, .25); }
.ph-apps .ico { width: 1.6em; text-align: center; }
.ph-apps .bd { position: static; margin-left: auto; }
.ph-head { display: flex; align-items: center; gap: .5em; padding: 2% 5%; border-bottom: 1px solid #222; }
.ph-head button { background: none; border: 0; font-size: calc(var(--u) * 2.2); line-height: 1; color: #4aa3ff; }
.ph-row { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: .7em; padding: .8em 5%; border-bottom: 1px solid #1c1c1c; cursor: pointer; }
.ph-row .av { grid-row: span 2; }
.ph-row span { color: #999; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .9em; }
.av { width: 2.4em; height: 2.4em; border-radius: 50%; background: #444; display: grid; place-items: center; font-style: normal; font-weight: 700; }
.ph-log { flex: 1; overflow-y: auto; padding: 4%; display: flex; flex-direction: column; gap: .5em; }
.bub { max-width: 82%; padding: .55em .8em; border-radius: 1em; background: #2a2c31; line-height: 1.3; font-size: calc(var(--u) * 1.15); }
.bub.me { align-self: flex-end; background: #2f6de0; }
.bub.me .photo { width: calc(var(--u) * 13); border-radius: .5em; }
.bub.eerie { background: #3a0e0c; color: #f0d0c8; font-family: 'Patrick Hand', cursive; font-size: calc(var(--u) * 1.4); }
.ph-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 2px; align-content: start; }
.ph-thumb { cursor: pointer; position: relative; }
.ph-thumb.sent::after { content: '✓'; position: absolute; right: 4px; bottom: 2px; font-size: .8em; }
.ph-empty { grid-column: 1 / -1; color: #888; text-align: center; padding: 2em 1em; }
.ph-big { padding: 4%; }
.ph-send { margin: 4% 6%; padding: .8em; text-align: center; border-radius: .8em; background: #2f6de0; cursor: pointer; }
.call-who { text-align: center; margin-top: 30%; display: grid; justify-items: center; gap: .4em; }
.call-who .av { width: 5em; height: 5em; font-size: calc(var(--u) * 1.6); }
.call-who b { font-size: calc(var(--u) * 2); font-weight: 400; }
.call-who span { color: #aaa; }
.call-btns { margin-top: auto; display: flex; justify-content: center; padding-bottom: 18%; }
.call-btns .ans { width: calc(var(--u) * 7); height: calc(var(--u) * 7); border-radius: 50%; background: #2fbf4f; border: 0; animation: blink 1s infinite; }
.phn.call small { text-align: center; color: #888; padding-bottom: 8%; }
.call-sub { margin: auto 8% 25%; text-align: center; font-family: 'Patrick Hand', cursive; font-size: calc(var(--u) * 1.8); color: #f0c8c0; line-height: 1.3; }
#phbanner { position: absolute; left: 50%; top: 3%; transform: translate(-50%, -160%); width: 40%; padding: .7em 1em; border-radius: 1em; background: rgba(30, 32, 36, .95); font-family: -apple-system, 'Segoe UI', sans-serif; font-size: calc(var(--u) * 1.15); z-index: 96; transition: transform .35s; cursor: pointer; box-shadow: 0 .5em 2em #000; }
#phbanner.on { transform: translate(-50%, 0); }
#phbanner b { display: block; margin-bottom: .2em; }
#phbanner span { color: #ccc; }

/* ---------- hồ sơ ---------- */
#dossier { background: rgba(0, 0, 0, .9); z-index: 72; }
.dos-tabs { position: absolute; left: 50%; top: 3%; transform: translateX(-50%); display: flex; gap: .5em; }
.dos-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: .3em .8em; font-size: calc(var(--u) * 1.3); color: var(--dim); letter-spacing: .1em; text-transform: uppercase; }
.dos-tabs button.on { color: var(--ink); border-color: var(--red); }
.paper { position: absolute; left: 50%; top: 11%; bottom: 11%; transform: translateX(-50%) rotate(-.6deg); width: 52%; overflow-y: auto; padding: 4% 5%; color: #1d1a14;
  background: linear-gradient(rgba(120, 90, 40, .12), rgba(60, 40, 10, .18)), var(--paper); box-shadow: 0 1em 3em #000, inset 0 0 4em rgba(90, 60, 20, .35); font-size: calc(var(--u) * 1.25); line-height: 1.55; }
.paper h3 { text-align: center; font-size: calc(var(--u) * 1.4); letter-spacing: .05em; margin: 0 0 1em; }
.paper p { margin: 0 0 .6em; }
.paper mark { background: none; color: var(--blood); border-bottom: 1px solid var(--blood); font-weight: 700; }
.redact { background: #111; color: #111; cursor: help; letter-spacing: -.05em; border-radius: 1px; }
.paper .note { font-family: 'Patrick Hand', cursive; color: var(--blood); font-size: 1.35em; transform: rotate(-2deg); margin-top: 1em; }
.paper-photo { position: relative; width: 60%; aspect-ratio: 3 / 2; margin: 1em auto; transform: rotate(2deg); box-shadow: 0 .3em 1em rgba(0, 0, 0, .5); border: .4em solid #eee; }
.dos-nav { position: absolute; left: 50%; bottom: 3%; transform: translateX(-50%); display: flex; align-items: center; gap: 1.2em; font-size: calc(var(--u) * 1.2); }
.dos-nav button { background: none; border: 1px solid rgba(233, 228, 216, .35); width: 2.2em; height: 2.2em; border-radius: 50%; font-size: 1.2em; }
.dos-nav button:disabled { opacity: .25; cursor: default; }
.relic-grid { position: absolute; left: 8%; right: 8%; top: 14%; display: grid; grid-template-columns: repeat(5, 1fr); gap: calc(var(--u) * 1.2); }
.relic-card { text-align: center; padding: 1em .6em; border: 1px solid rgba(179, 36, 28, .5); background: rgba(40, 10, 8, .35); font-size: calc(var(--u) * 1.05); line-height: 1.35; }
.relic-card .vis { position: relative; height: calc(var(--u) * 8); margin-bottom: .6em; }
.relic-card .vis.ph svg { width: 70%; height: 70%; }
.relic-card b { display: block; margin-bottom: .3em; font-size: 1.1em; }
.relic-card span { color: #aaa; }
.relic-card.missing { border-color: rgba(233, 228, 216, .12); background: none; color: var(--dim); }
.relic-card.missing .vis { display: grid; place-items: center; font-size: calc(var(--u) * 4); color: #333; }
.dos-foot { position: absolute; left: 0; right: 0; bottom: 8%; text-align: center; color: var(--dim); font-size: calc(var(--u) * 1.2); }
.dos-foot b { color: var(--ink); }

/* ---------- trốn trong tủ ---------- */
#hide { background: #000; z-index: 75; }
.slit { position: absolute; left: 47%; width: 6%; top: 0; bottom: 0; overflow: hidden; box-shadow: 0 0 3em 2em #000 inset; }
.slit .view { left: -783%; width: 1667%; filter: brightness(.5) grayscale(1) blur(1px); }
.hide-shadow { position: absolute; top: 5%; height: 95%; width: 400%; left: 150%; opacity: 0; transition: left 2.2s ease-in-out, opacity 1.5s; }
.hide-shadow.in { left: -150%; opacity: .95; }
.hide-shadow.out { left: -600%; opacity: 0; }
.hide-shadow svg { width: 100%; height: 100%; filter: brightness(.25); }
.hide-out, .breath-btn { position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); padding: .7em 2em; border: 1px solid rgba(233, 228, 216, .5); background: rgba(0, 0, 0, .7); cursor: pointer; font-size: calc(var(--u) * 1.4); letter-spacing: .15em; touch-action: none; }
.breath-btn.on { background: rgba(179, 36, 28, .6); }
.breath-bar { position: absolute; left: 35%; right: 35%; bottom: 20%; height: calc(var(--u) * .7); border: 1px solid rgba(233, 228, 216, .4); }
.breath-bar i { display: block; height: 100%; background: var(--ink); width: 100%; }
.breath-bar.low i { background: var(--red); }
.hide-tip { position: absolute; left: 20%; right: 20%; top: 8%; text-align: center; color: var(--dim); font-size: calc(var(--u) * 1.2); line-height: 1.4; }

/* ---------- hù ---------- */
#scare { z-index: 88; pointer-events: none; }
#scare.face { background: #000; }
#scare.face .vis { inset: 5% 25%; animation: lunge .5s ease-in; }
#scare.face .vis.ph svg { width: 100%; height: 100%; }
@keyframes lunge { from { transform: scale(.6); opacity: .3; } to { transform: scale(1.5); opacity: 1; } }
#scare.glide { background: none; }
.glider { position: absolute; top: 10%; height: 90%; width: 22%; left: -25%; animation: glide 1.1s cubic-bezier(.5, 0, .5, 1) forwards; filter: brightness(.08) blur(3px); }
.glider svg { width: 100%; height: 100%; }
@keyframes glide { to { left: 110%; } }

/* ---------- menu, chết, kết ---------- */
#menu { background: rgba(0, 0, 0, .85); z-index: 98; display: none; place-items: center; }
#menu.on { display: grid; }
.menu-box { display: grid; gap: calc(var(--u) * 1); min-width: 32%; text-align: center; }
.menu-box h3 { font-family: 'Xanh Mono', monospace; font-weight: 400; font-size: calc(var(--u) * 3); margin: 0 0 .4em; }
.menu-box label { display: grid; gap: .4em; font-size: calc(var(--u) * 1.2); color: var(--dim); }
#gameover, #endcard { background: #000; z-index: 97; display: none; place-content: center; text-align: center; gap: calc(var(--u) * 1.5); padding: 0 15%; }
#gameover.on, #endcard.on { display: grid; animation: rise 1.2s; }
#gameover h2, #endcard h2 { font-family: 'Xanh Mono', monospace; font-weight: 400; font-size: calc(var(--u) * 4); color: var(--red); letter-spacing: .1em; margin: 0; }
#endcard h2 { color: var(--ink); font-size: calc(var(--u) * 3); }
#gameover p { color: #aaa; font-size: calc(var(--u) * 1.5); }
.end-photo { display: flex; justify-content: center; }
.end-photo .polaroid { width: calc(var(--u) * 26); }
#endcard ul { list-style: none; padding: 0; margin: 0; display: flex; gap: 2em; justify-content: center; color: var(--dim); font-size: calc(var(--u) * 1.2); }
#endcard ul b { color: var(--ink); }
.cred { display: grid; gap: .2em; font-size: calc(var(--u) * 1.1); color: var(--dim); }
.cred b { font-family: 'Xanh Mono', monospace; font-weight: 400; color: var(--ink); font-size: 1.3em; letter-spacing: .15em; }

/* ---------- màn mở đầu ---------- */
#intro { background: radial-gradient(ellipse at 50% 40%, #1b1a17, #000 70%); z-index: 99; display: none; place-items: center; transition: opacity .9s; }
#intro.on { display: grid; }
#intro.out { opacity: 0; }
.intro-in { text-align: center; display: grid; gap: calc(var(--u) * 2); }
.intro-in h1 { margin: 0; font-weight: 400; font-family: 'Xanh Mono', monospace; line-height: 1; }
.intro-in h1 span { display: block; font-size: calc(var(--u) * 9); letter-spacing: .25em; animation: flick 6s infinite; }
.intro-in h1 b { display: block; font-weight: 400; font-size: calc(var(--u) * 3); letter-spacing: .6em; color: var(--red); margin-top: .3em; }
.intro-in .hp { color: var(--dim); font-size: calc(var(--u) * 1.2); margin: 0; }
.intro-in small { color: #555; letter-spacing: .3em; font-size: calc(var(--u) * 1); }
@keyframes flick { 0%, 92%, 100% { opacity: 1; } 93% { opacity: .2; } 94% { opacity: .9; } 96% { opacity: .1; } 97% { opacity: 1; } }

/* ---------- chế độ chỉnh điểm bấm (?edit=1) ---------- */
.ed-box { position: absolute; border: 2px solid #ff0; background: rgba(255, 255, 0, .08); cursor: move; z-index: 10; }
.ed-box.ed-ghost { border-color: #0ff; background: rgba(0, 255, 255, .08); }
.ed-box span { position: absolute; left: 0; top: 0; font: 11px/1.2 Cousine, monospace; background: rgba(0, 0, 0, .8); color: #ff0; padding: 1px 3px; pointer-events: none; }
.ed-ghost span { color: #0ff; }
.ed-rs { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: #ff0; cursor: nwse-resize; }
.ed-panel { position: absolute; left: 1%; top: 1%; z-index: 99; background: rgba(0, 0, 0, .9); padding: 6px; font: 12px Cousine, monospace; display: grid; gap: 4px; max-width: 40%; }
.ed-panel textarea { width: 100%; height: 90px; font: 11px Cousine, monospace; background: #111; color: #ff0; }
#stage.editing #grain, #stage.editing #vignette, #stage.editing #dark { display: none; }

/* ---------- xoay ngang ---------- */
#rotate { display: none; position: fixed; inset: 0; background: #000; color: var(--ink); place-items: center; font-family: 'Xanh Mono', monospace; font-size: 20px; z-index: 999; text-align: center; padding: 16px; }
@media (orientation: portrait) and (max-width: 820px) { #rotate { display: grid; } }
.vf .ph-desc { display: none; }
/* video nền: hiện mờ dần khi đã sẵn sàng, phủ đúng như ảnh tĩnh */
.vis .bgvid { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .6s; pointer-events: none; }
.vis .bgvid.on { opacity: 1; }
/* lớp che chỗ đồ vật đã nhặt (đồ có sẵn trong ảnh cảnh) */
.cover { position: absolute; pointer-events: none; background: radial-gradient(ellipse at center, rgba(12, 11, 10, 1) 45%, rgba(12, 11, 10, .85) 62%, transparent 76%); filter: blur(3px); }
/* vật phẩm màu đặt lên cảnh đen trắng: làm xám và tối cho hợp */
.lay-item img { filter: grayscale(.85) brightness(.6) contrast(1.1); }
/* hiệu ứng sống: mưa, bụi (canvas), quầng đèn chập chờn */
.fx-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.fx-light { position: absolute; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none; mix-blend-mode: screen; }
#glow { position: absolute; inset: 0; pointer-events: none; }
#glow .fx-light { mix-blend-mode: screen; }
/* màn hình cuộc gọi kiểu ứng dụng nhắn tin: nền xanh */
.phn.zalo .ph-scr { background: linear-gradient(170deg, #0b5ed7 0%, #0848a8 45%, #062f6e 100%); }
.phn.zalo .call-who .av { background: rgba(255, 255, 255, .25); }
.phn.zalo .call-who span { color: rgba(255, 255, 255, .8); }
