/* The Old House — Made by Shoeb */
* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html, body { width:100%; height:100%; overflow:hidden; background:#05070c; font-family:'Segoe UI', system-ui, sans-serif; color:#cfd6e4; touch-action:none; overscroll-behavior:none; }
#app, .toh-root { position:fixed; inset:0; overflow:hidden; background:#05070c; }
.toh-canvas { position:absolute; inset:0; width:100%; height:100%; display:block; }

/* ---------- shared overlay ---------- */
.toh-overlay { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; z-index:40; background:rgba(3,5,10,.88); backdrop-filter:blur(2px); padding:24px; }
.toh-overlay.clear { background:rgba(3,5,10,.55); }
.toh-title { font-family:Georgia,'Times New Roman',serif; font-size:clamp(34px,9vw,64px); letter-spacing:.12em; color:#e8e2d0; text-shadow:0 0 24px rgba(120,160,255,.35),0 2px 6px #000; font-weight:700; }
.toh-sub { margin-top:10px; font-size:14px; letter-spacing:.35em; color:#8fa3c8; text-transform:uppercase; }
.toh-credit { position:absolute; bottom:calc(14px + env(safe-area-inset-bottom)); left:0; right:0; text-align:center; font-family:Georgia,serif; font-style:italic; font-size:14px; color:#9b8f6a; text-shadow:0 1px 3px #000; z-index:41; }
.toh-btn { display:block; width:min(300px,80vw); margin:9px auto; padding:14px 18px; background:rgba(16,22,36,.85); border:1px solid #3a4663; border-radius:6px; color:#dfe6f2; font-size:16px; letter-spacing:.22em; text-transform:uppercase; cursor:pointer; transition:all .15s; font-family:Georgia,serif; }
.toh-btn:active, .toh-btn:hover { background:#26314d; border-color:#7c8db5; transform:scale(1.02); }
.toh-btn:disabled { opacity:.35; cursor:default; transform:none; }
.toh-btn.small { width:auto; display:inline-block; padding:10px 22px; font-size:13px; margin:6px; }
.toh-text { max-width:520px; font-size:16px; line-height:1.65; color:#c6cede; }
.toh-hint { margin-top:14px; font-size:12px; color:#6d7a96; letter-spacing:.08em; }

/* ---------- menu ---------- */
.toh-menu-bg { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; filter:brightness(.62) saturate(.85); }
.toh-menu-flash { position:absolute; inset:0; background:#bcd2ff; opacity:0; pointer-events:none; mix-blend-mode:screen; }
.toh-menu-rain { position:absolute; inset:0; pointer-events:none; }

/* ---------- intro ---------- */
.toh-intro-img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; opacity:0; transition:opacity 1.2s ease; }
.toh-intro-text { position:absolute; left:0; right:0; bottom:18%; text-align:center; padding:0 28px; font-family:Georgia,serif; font-size:clamp(18px,4.6vw,26px); line-height:1.6; color:#e6e0cf; text-shadow:0 2px 10px #000, 0 0 30px rgba(0,0,0,.9); opacity:0; transition:opacity .9s ease; z-index:5; }

/* ---------- HUD ---------- */
.toh-hud { position:absolute; inset:0; pointer-events:none; z-index:20; }
.toh-topbar { position:absolute; top:calc(8px + env(safe-area-inset-top)); left:10px; right:10px; display:flex; align-items:flex-start; justify-content:space-between; }
.toh-day { font-family:Georgia,serif; font-size:15px; letter-spacing:.18em; color:#d8d2be; text-shadow:0 1px 4px #000; background:rgba(10,14,24,.55); padding:6px 12px; border-radius:4px; border:1px solid rgba(90,105,140,.35); }
.toh-endings { font-size:11px; color:#8fa3c8; margin-top:3px; letter-spacing:.1em; }
.toh-topright { display:flex; flex-direction:column; align-items:flex-end; gap:6px; }
.toh-iconbtn { pointer-events:auto; width:44px; height:44px; border-radius:50%; border:1px solid rgba(120,135,170,.5); background:rgba(10,14,24,.6); color:#dfe6f2; font-size:19px; display:flex; align-items:center; justify-content:center; cursor:pointer; }
.toh-iconbtn.on { background:rgba(210,180,90,.25); border-color:#d2b45a; }
.toh-battery { width:110px; height:10px; border:1px solid rgba(140,155,190,.6); border-radius:3px; background:rgba(5,8,14,.7); overflow:hidden; }
.toh-battery > div { height:100%; background:linear-gradient(90deg,#c8a44a,#e8d28a); transition:width .3s linear; }
.toh-battery.low > div { background:#c0392b; animation:toh-blink .7s infinite alternate; }
@keyframes toh-blink { from{opacity:1} to{opacity:.4} }
.toh-noise { display:flex; align-items:center; gap:6px; font-size:13px; color:#9fb0cf; background:rgba(10,14,24,.55); padding:4px 10px; border-radius:4px; border:1px solid rgba(90,105,140,.3); }
.toh-noise .bar { width:60px; height:7px; background:rgba(5,8,14,.8); border-radius:3px; overflow:hidden; border:1px solid rgba(120,135,170,.4); }
.toh-noise .bar > div { height:100%; background:#7c8db5; transition:width .2s; }
.toh-noise.hot { color:#e0705a; } .toh-noise.hot .bar > div { background:#e0705a; }
.toh-eye { font-size:15px; }

/* joystick */
.toh-joy { position:absolute; left:calc(18px + env(safe-area-inset-left)); bottom:calc(20px + env(safe-area-inset-bottom)); width:120px; height:120px; border-radius:50%; border:2px solid rgba(130,145,180,.35); background:rgba(12,17,28,.35); pointer-events:auto; touch-action:none; }
.toh-joy-knob { position:absolute; left:50%; top:50%; width:52px; height:52px; border-radius:50%; background:rgba(150,165,200,.35); border:2px solid rgba(190,200,225,.5); transform:translate(-50%,-50%); }
.toh-run { position:absolute; left:calc(152px + env(safe-area-inset-left)); bottom:calc(34px + env(safe-area-inset-bottom)); width:58px; height:58px; border-radius:50%; border:1px solid rgba(130,145,180,.4); background:rgba(12,17,28,.5); color:#aeb9d2; font-size:11px; letter-spacing:.08em; pointer-events:auto; }
.toh-run.on { background:rgba(180,90,60,.35); color:#f0c0a8; }

/* interact */
.toh-interact { position:absolute; right:calc(22px + env(safe-area-inset-right)); bottom:calc(26px + env(safe-area-inset-bottom)); width:86px; height:86px; border-radius:50%; border:2px solid rgba(210,180,90,.55); background:rgba(30,26,14,.55); color:#e8d28a; font-size:13px; letter-spacing:.06em; pointer-events:auto; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:2px; text-transform:uppercase; }
.toh-interact:disabled { opacity:.28; border-color:rgba(120,130,150,.4); color:#8a93a8; }
.toh-interact .ic { font-size:24px; }
.toh-hotlabel { position:absolute; left:0; right:0; bottom:calc(126px + env(safe-area-inset-bottom)); text-align:center; font-size:14px; color:#e8dfc2; text-shadow:0 1px 4px #000; letter-spacing:.05em; }

/* inventory */
.toh-inv { position:absolute; bottom:calc(8px + env(safe-area-inset-bottom)); left:50%; transform:translateX(-50%); display:flex; gap:6px; background:rgba(8,11,20,.55); border:1px solid rgba(90,105,140,.3); border-radius:6px; padding:5px 8px; max-width:60vw; overflow:hidden; }
.toh-inv .slot { width:34px; height:34px; border-radius:4px; background:rgba(20,26,42,.7); border:1px solid rgba(110,125,160,.35); display:flex; align-items:center; justify-content:center; font-size:18px; position:relative; }
.toh-inv .slot .n { position:absolute; right:1px; bottom:0; font-size:9px; color:#c8b060; }

/* toast + banner */
.toh-toast { position:absolute; top:16%; left:50%; transform:translateX(-50%); max-width:82vw; background:rgba(8,11,20,.85); border:1px solid rgba(140,120,70,.5); color:#e8dfc2; padding:10px 18px; border-radius:6px; font-size:15px; text-align:center; opacity:0; transition:opacity .35s; z-index:35; pointer-events:none; line-height:1.5; }
.toh-daycard { position:absolute; inset:0; background:#020306; display:flex; flex-direction:column; align-items:center; justify-content:center; z-index:60; opacity:0; transition:opacity .8s; }
.toh-daycard .d { font-family:Georgia,serif; font-size:clamp(40px,11vw,80px); letter-spacing:.25em; color:#cfc8b0; text-shadow:0 0 30px rgba(150,120,60,.4); }

/* hidden view */
.toh-hiddenview { position:absolute; inset:0; z-index:30; background:repeating-linear-gradient(90deg,#020304 0 26px, rgba(60,75,105,.28) 26px 34px); display:flex; flex-direction:column; align-items:center; justify-content:flex-end; padding-bottom:14%; }
.toh-hiddenview .msg { position:absolute; top:20%; left:0; right:0; text-align:center; font-family:Georgia,serif; font-style:italic; color:#97a5c2; font-size:15px; text-shadow:0 1px 4px #000; }
.toh-shadow { position:absolute; top:0; bottom:0; width:40%; background:radial-gradient(ellipse at center, rgba(0,0,0,.92), transparent 70%); opacity:0; }
.toh-exithide { pointer-events:auto; }

/* keypad */
.toh-pad { display:grid; grid-template-columns:repeat(3,64px); gap:10px; margin-top:18px; }
.toh-pad button { width:64px; height:56px; font-size:22px; background:rgba(18,24,40,.9); color:#dfe6f2; border:1px solid #3a4663; border-radius:6px; }
.toh-pad button:active { background:#2c3a5e; }
.toh-codebox { font-family:monospace; font-size:30px; letter-spacing:.5em; color:#e8d28a; background:rgba(5,8,14,.8); border:1px solid #4a4230; padding:8px 8px 8px 18px; border-radius:6px; min-width:150px; text-align:center; }

/* note reading */
.toh-note { background:linear-gradient(160deg,#2a2416,#1c1810); border:1px solid #6a5c38; color:#e5d9b8; font-family:Georgia,serif; font-style:italic; padding:26px 30px; border-radius:3px; max-width:82vw; font-size:17px; line-height:1.7; box-shadow:0 10px 40px rgba(0,0,0,.8); }

/* jumpscare */
.toh-scare { position:absolute; inset:0; z-index:70; background:#000; display:flex; align-items:center; justify-content:center; opacity:0; }
.toh-scare img { width:100%; height:100%; object-fit:contain; filter:contrast(1.2) brightness(1.15); }
.toh-scare.boom { animation:toh-boom .9s ease-in; }
@keyframes toh-boom { 0%{opacity:0; transform:scale(.6)} 12%{opacity:1; transform:scale(1.06)} 30%{transform:scale(1)} 100%{opacity:1; transform:scale(1.25)} }
.toh-shake { animation:toh-shake .45s; }
@keyframes toh-shake { 0%,100%{transform:translate(0,0)} 20%{transform:translate(-10px,6px)} 40%{transform:translate(9px,-7px)} 60%{transform:translate(-7px,-5px)} 80%{transform:translate(8px,6px)} }

/* room name */
.toh-roomname { position:absolute; top:calc(64px + env(safe-area-inset-top)); left:0; right:0; text-align:center; font-family:Georgia,serif; font-size:17px; letter-spacing:.3em; text-transform:uppercase; color:#b9c2d8; text-shadow:0 1px 6px #000; opacity:0; transition:opacity .6s; pointer-events:none; }

/* damage vignette / danger pulse */
.toh-danger { position:absolute; inset:0; pointer-events:none; z-index:15; box-shadow:inset 0 0 120px rgba(160,20,10,.0); transition:box-shadow .4s; }
.toh-danger.on { box-shadow:inset 0 0 140px rgba(190,25,10,.55); animation:toh-blink .5s infinite alternate; }

.toh-loading { position:absolute; inset:0; background:#05070c; z-index:80; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:18px; }
.toh-loadbar { width:200px; height:3px; background:#141a28; border-radius:2px; overflow:hidden; }
.toh-loadbar > div { height:100%; width:0%; background:#8fa3c8; transition:width .3s; }
