@font-face { font-family: "Fell"; src: url(assets/fonts/IMFeENrm28P.ttf); font-display: swap; }
@font-face { font-family: "FellI"; src: url(assets/fonts/IMFeENit28P.ttf); font-display: swap; }
@font-face { font-family: "Patrick"; src: url(assets/fonts/PatrickHand-Regular.ttf); font-display: swap; }
@font-face { font-family: "Hand"; src: url(assets/fonts/Caveat.ttf); font-display: swap; }
@font-face { font-family: "Typed"; src: url(assets/fonts/SpecialElite-Regular.ttf); font-display: swap; }

:root {
  --ink: #0b0910; --paper: #f1e6d0; --paper2: #e3d3b4; --candle: #ffb867; --rose: #e98a8f; --cold: #b9c3df; --amber: #e8b673; --moss: #a9c49a;
  --vw: 100vw; --vh: 100vh;
  --sw: min(var(--vw), calc(var(--vh) * 16 / 9)); --sh: min(var(--vh), calc(var(--vw) * 9 / 16));
  --u: calc(var(--sw) / 1600); --ts: 1;
}
@supports (height: 100dvh) { :root { --vh: 100dvh; --vw: 100dvw; } }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #000; color: var(--paper); overflow: hidden; font-family: "Patrick", sans-serif; user-select: none; -webkit-user-select: none; touch-action: none; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }
#game { position: fixed; inset: 0; }
#game canvas { display: block; }

/* the UI layer sits exactly on the 16:9 game rectangle */
#ui { position: fixed; left: calc((var(--vw) - var(--sw)) / 2); top: calc((var(--vh) - var(--sh)) / 2); width: var(--sw); height: var(--sh); pointer-events: none; z-index: 10; }
#ui > * { pointer-events: auto; }
#ui > #bars, #ui > #hud, #ui > #hot, #ui > #toast, #ui > #chap { pointer-events: none; }
#hud > * { pointer-events: auto; }

/* cinematic bars */
#bars i { position: absolute; left: 0; right: 0; height: 0; background: #000; transition: height .9s cubic-bezier(.6,0,.3,1); }
#bars i:first-child { top: 0; } #bars i:last-child { bottom: 0; }
body.cine #bars i { height: calc(var(--u) * 70); }
body.cine #hud, body.cine #btn-act, body.cine #joy { opacity: 0; pointer-events: none !important; }
body:not(.ingame) #hud, body:not(.ingame) #btn-act, body:not(.ingame) #joyzone { display: none; }

/* HUD */
#hud { position: absolute; inset: 0; transition: opacity .6s; }
.hbtn { position: absolute; top: calc(var(--u) * 26); width: max(44px, calc(var(--u) * 74)); height: max(44px, calc(var(--u) * 74)); border-radius: 50%; border: 2px solid rgba(241,230,208,.28); background: radial-gradient(circle at 35% 30%, rgba(60,48,58,.85), rgba(14,11,18,.9)); color: var(--paper); padding: calc(var(--u) * 15); box-shadow: 0 4px 18px rgba(0,0,0,.5); transition: transform .2s, border-color .3s, color .3s; }
.hbtn svg { width: 100%; height: 100%; }
.hbtn:active { transform: scale(.92); }
#btn-pause { right: calc(var(--u) * 26); }
#btn-inv { right: calc(var(--u) * 116); opacity: .45; }
#btn-inv.has { opacity: 1; }
#btn-inv.bump { animation: bump .6s; }
#btn-world { right: calc(var(--u) * 206); color: #f6e2a8; border-color: rgba(246,226,168,.5); }
#btn-world.pulse { animation: glowp 1.6s infinite; }
#btn-world.on { color: #ffb0b6; border-color: rgba(255,120,140,.8); background: radial-gradient(circle at 35% 30%, rgba(120,30,44,.9), rgba(30,6,12,.95)); }
#btn-world.locked { opacity: .35; }
@keyframes bump { 30% { transform: scale(1.25) rotate(-8deg); } 60% { transform: scale(.95) rotate(4deg); } }
@keyframes glowp { 50% { box-shadow: 0 0 calc(var(--u) * 40) rgba(246,226,168,.8); } }

#obj { position: absolute; left: calc(var(--u) * 26); top: calc(var(--u) * 26); max-width: calc(var(--u) * 640); padding: calc(var(--u) * 12) calc(var(--u) * 20); background: linear-gradient(90deg, rgba(10,8,14,.82), rgba(10,8,14,0)); border-left: 3px solid var(--candle); font-size: max(13px, calc(var(--u) * 24 * var(--ts))); line-height: 1.25; }
#obj b { display: block; font-family: "FellI"; font-weight: normal; color: var(--candle); font-size: .78em; letter-spacing: .08em; text-transform: lowercase; }
#obj.pop { animation: objpop .8s; }
@keyframes objpop { from { opacity: 0; transform: translateX(-20px); } }

#inv { position: absolute; right: calc(var(--u) * 26); top: calc(var(--u) * 116); width: calc(var(--u) * 520); min-width: 260px; padding: calc(var(--u) * 18); border-radius: 14px; background: rgba(14,11,18,.93); border: 1px solid rgba(241,230,208,.18); transform: translateY(-10px); opacity: 0; pointer-events: none !important; transition: .25s; box-shadow: 0 10px 40px rgba(0,0,0,.6); }
#inv.open { opacity: 1; transform: none; pointer-events: auto !important; }
.inv-title { font-family: "Fell"; font-size: max(16px, calc(var(--u) * 30)); margin-bottom: 8px; }
.inv-title small { display: block; font-family: "Patrick"; font-size: .55em; opacity: .6; }
#inv-items { display: flex; flex-wrap: wrap; gap: 10px; }
#inv-items:empty::after { content: "vazia… por enquanto."; opacity: .5; }
.item { width: max(64px, calc(var(--u) * 106)); padding: 8px 4px 6px; border-radius: 12px; background: rgba(241,230,208,.06); border: 1px solid rgba(241,230,208,.14); display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: max(11px, calc(var(--u) * 17)); color: var(--paper2); }
.item svg { width: 60%; height: auto; color: var(--paper); }
.item.sel { border-color: var(--candle); background: rgba(255,184,103,.15); box-shadow: 0 0 16px rgba(255,184,103,.35); }

/* hotspot label */
#hot { position: fixed; transform: translate(-50%, -100%); padding: 6px 14px 6px 10px; border-radius: 999px; background: rgba(10,8,14,.78); border: 1px solid rgba(241,230,208,.25); font-size: max(13px, calc(var(--u) * 22 * var(--ts))); white-space: nowrap; display: flex; gap: 8px; align-items: center; animation: hot .35s; z-index: 11; }
#hot .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--candle); box-shadow: 0 0 10px var(--candle); animation: blink 1.4s infinite; }
@keyframes hot { from { opacity: 0; transform: translate(-50%, -80%); } }
@keyframes blink { 50% { opacity: .35; } }

/* action button + joystick */
#btn-act { position: absolute; right: calc(var(--u) * 46); bottom: calc(var(--u) * 46); width: max(64px, calc(var(--u) * 128)); height: max(64px, calc(var(--u) * 128)); border-radius: 50%; border: 2px solid rgba(241,230,208,.25); background: radial-gradient(circle at 35% 30%, rgba(60,48,58,.75), rgba(14,11,18,.85)); padding: calc(var(--u) * 26); color: rgba(241,230,208,.55); display: none; transition: .25s; }
#btn-act svg { width: 100%; height: 100%; }
#btn-act.live { color: var(--candle); border-color: var(--candle); box-shadow: 0 0 calc(var(--u) * 40) rgba(255,184,103,.45); }
body.touch #btn-act { display: block; }
#joyzone { position: fixed; left: 0; top: 18%; bottom: 0; width: 35%; display: none; z-index: 9; }
body.touch.ingame #joyzone { display: block; }
#joy { position: fixed; width: 128px; height: 128px; margin: -64px 0 0 -64px; border-radius: 50%; border: 2px solid rgba(241,230,208,.3); background: rgba(10,8,14,.35); opacity: 0; transition: opacity .2s; pointer-events: none !important; z-index: 12; }
#joy.on { opacity: 1; }
#joy .knob { position: absolute; left: 34px; top: 34px; width: 60px; height: 60px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f1e6d0, #b9a888); box-shadow: 0 4px 14px rgba(0,0,0,.5); }

/* dialogue */
.dlg { position: absolute; left: 50%; bottom: calc(var(--u) * 34); transform: translateX(-50%); width: min(calc(var(--u) * 1300), 96%); min-height: calc(var(--u) * 190); display: flex; align-items: center; gap: calc(var(--u) * 26); padding: calc(var(--u) * 20) calc(var(--u) * 40) calc(var(--u) * 20) calc(var(--u) * 20); border-radius: calc(var(--u) * 26); background: linear-gradient(180deg, rgba(20,16,24,.93), rgba(10,8,14,.96)); border: 1px solid rgba(241,230,208,.16); box-shadow: 0 16px 50px rgba(0,0,0,.65), inset 0 1px 0 rgba(255,255,255,.05); animation: dlgin .28s cubic-bezier(.2,.9,.3,1.2); z-index: 20; --acc: var(--rose); }
body.cine .dlg { bottom: calc(var(--u) * 86); }
@keyframes dlgin { from { opacity: 0; transform: translate(-50%, 16px) scale(.98); } }
#dlg-portrait { flex: none; width: calc(var(--u) * 170); height: calc(var(--u) * 170); min-width: 72px; min-height: 72px; border-radius: 50%; overflow: hidden; border: 3px solid var(--acc); background: radial-gradient(circle at 50% 40%, #3a3040, #0e0b12); box-shadow: 0 0 calc(var(--u) * 24) color-mix(in srgb, var(--acc) 40%, transparent); }
#dlg-portrait canvas { width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.dlg-body { flex: 1; min-width: 0; }
#dlg-name { font-family: "FellI"; color: var(--acc); font-size: max(15px, calc(var(--u) * 28 * var(--ts))); letter-spacing: .03em; margin-bottom: calc(var(--u) * 4); }
#dlg-text { font-size: max(16px, calc(var(--u) * 34 * var(--ts))); line-height: 1.32; min-height: 2.6em; color: var(--paper); text-shadow: 0 1px 0 rgba(0,0,0,.6); }
#dlg-next { position: absolute; right: calc(var(--u) * 22); bottom: calc(var(--u) * 14); width: max(20px, calc(var(--u) * 34)); color: var(--acc); animation: nxt 1s infinite; }
#dlg-next svg { width: 100%; }
@keyframes nxt { 50% { transform: translateY(5px); opacity: .6; } }
.dlg.ste { --acc: #f0a1a0; } .dlg.dad { --acc: var(--amber); } .dlg.caio { --acc: var(--cold); } .dlg.npc { --acc: var(--moss); }
.dlg.caio #dlg-text { color: #dfe3f0; letter-spacing: .02em; }
.dlg.narr { background: radial-gradient(ellipse at center, rgba(0,0,0,.6), rgba(0,0,0,0) 70%); border: none; box-shadow: none; justify-content: center; text-align: center; }
.dlg.narr #dlg-text { font-family: "FellI"; color: #f3e7c9; font-size: max(17px, calc(var(--u) * 38 * var(--ts))); text-shadow: 0 0 18px rgba(0,0,0,.95), 0 2px 2px #000; }
.dlg.narr #dlg-next { right: 50%; }
.dlg.shout #dlg-text { font-size: max(20px, calc(var(--u) * 48 * var(--ts))); font-weight: bold; animation: shout .35s 2; }
.dlg.scream { background: linear-gradient(180deg, rgba(60,0,8,.95), rgba(10,0,2,.97)); border-color: #c0283a; }
.dlg.scream #dlg-text { color: #ff6070; font-family: "Typed"; letter-spacing: .06em; animation: shout .12s infinite; }
.dlg.whisper #dlg-text { font-family: "FellI"; opacity: .8; }
@keyframes shout { 25% { transform: translate(-2px, 1px); } 75% { transform: translate(2px, -1px); } }

#choices { position: absolute; left: 50%; bottom: calc(var(--u) * 60); transform: translateX(-50%); display: flex; flex-direction: column; gap: calc(var(--u) * 12); width: min(calc(var(--u) * 900), 94%); z-index: 21; }
#choices button { text-align: left; padding: calc(var(--u) * 16) calc(var(--u) * 26); border-radius: 14px; border: 1px solid rgba(241,230,208,.22); background: rgba(14,11,18,.92); font-size: max(15px, calc(var(--u) * 30 * var(--ts))); transition: .18s; animation: dlgin .3s backwards; display: flex; gap: 14px; align-items: baseline; }
#choices button:nth-child(2) { animation-delay: .06s; } #choices button:nth-child(3) { animation-delay: .12s; } #choices button:nth-child(4) { animation-delay: .18s; } #choices button:nth-child(5) { animation-delay: .24s; }
#choices button span { font-family: "Fell"; color: var(--candle); opacity: .8; }
#choices button:hover, #choices button:active { border-color: var(--candle); background: rgba(40,30,24,.95); transform: translateX(6px); }

#toast { position: absolute; left: 50%; top: calc(var(--u) * 120); transform: translateX(-50%); padding: 10px 22px; border-radius: 999px; background: rgba(14,11,18,.88); border: 1px solid rgba(255,184,103,.35); font-size: max(13px, calc(var(--u) * 24)); opacity: 0; white-space: nowrap; }
#toast.show { animation: toast 2.8s; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -10px); } 10%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }

/* chapter card */
#chap { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; animation: chap 4.2s forwards; z-index: 25; background: radial-gradient(ellipse at center, rgba(0,0,0,.55), rgba(0,0,0,0) 65%); }
#chap .n { font-family: "FellI"; color: var(--candle); font-size: max(16px, calc(var(--u) * 34)); letter-spacing: .25em; text-transform: uppercase; }
#chap .t { font-family: "Fell"; font-size: max(34px, calc(var(--u) * 100)); text-shadow: 0 4px 30px #000; }
#chap .s { font-family: "Hand"; font-size: max(18px, calc(var(--u) * 40)); opacity: .8; }
@keyframes chap { 0% { opacity: 0; letter-spacing: .2em; } 18%, 78% { opacity: 1; letter-spacing: 0; } 100% { opacity: 0; } }

/* overlays */
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(4,3,7,.72); backdrop-filter: blur(3px); z-index: 30; animation: fadein .3s; }
@keyframes fadein { from { opacity: 0; } }
#doc .card { position: relative; width: min(calc(var(--u) * 760), 92%); height: min(calc(var(--u) * 640), 74%); perspective: 1400px; transform-style: preserve-3d; transition: transform .7s cubic-bezier(.5,0,.3,1); }
#doc .card.flipped { transform: rotateY(180deg); }
#doc .front, #doc .back { position: absolute; inset: 0; padding: calc(var(--u) * 54) calc(var(--u) * 60); backface-visibility: hidden; -webkit-backface-visibility: hidden; border-radius: 6px; color: #2a1d14; font-family: "Hand"; font-size: max(18px, calc(var(--u) * 40 * var(--ts))); line-height: 1.3; overflow: auto;
  background: radial-gradient(ellipse at 30% 20%, rgba(255,255,255,.4), rgba(255,255,255,0) 60%), radial-gradient(ellipse at 80% 90%, rgba(120,80,40,.25), rgba(0,0,0,0) 55%), linear-gradient(180deg, #f4e9d2, #e4d2ae); box-shadow: 0 20px 60px rgba(0,0,0,.7), inset 0 0 60px rgba(120,80,40,.25); }
#doc .back { transform: rotateY(180deg); }
#doc h3 { font-family: "Fell"; font-weight: normal; margin: 0 0 .5em; font-size: 1.15em; }
#doc .small { font-size: .7em; opacity: .7; }
#doc .hand { font-family: "Hand"; font-size: 1.2em; }
#doc.typed .front, #doc.typed .back { font-family: "Typed"; font-size: max(14px, calc(var(--u) * 28 * var(--ts))); }
#doc.letter .front, #doc.letter .back { background: repeating-linear-gradient(180deg, transparent 0 calc(var(--u) * 51), rgba(90,110,160,.25) calc(var(--u) * 51) calc(var(--u) * 53)), linear-gradient(180deg, #f6eedc, #e8dcc0); }
.doc-btns { display: flex; gap: 14px; margin-top: calc(var(--u) * 26); }
.doc-btns button, .panel button, #ending button { padding: calc(var(--u) * 12) calc(var(--u) * 34); min-height: 44px; border-radius: 999px; border: 1px solid rgba(241,230,208,.35); background: rgba(20,16,24,.9); font-size: max(15px, calc(var(--u) * 28)); transition: .2s; }
.doc-btns button:hover, .panel button:hover, #ending button:hover { border-color: var(--candle); color: var(--candle); }
#pic .frame { background: #f3ead6; padding: calc(var(--u) * 26) calc(var(--u) * 26) calc(var(--u) * 70); transform: rotate(-1.6deg); box-shadow: 0 20px 60px rgba(0,0,0,.75); max-width: 90%; animation: picin .6s cubic-bezier(.2,.9,.3,1.1); }
@keyframes picin { from { transform: rotate(-8deg) scale(.8); opacity: 0; } }
#pic canvas { display: block; width: min(calc(var(--u) * 900), 80vw); height: auto; max-height: 62vh; object-fit: contain; }
#pic .cap { font-family: "Hand"; color: #3a2a1c; font-size: max(17px, calc(var(--u) * 34)); text-align: center; margin-top: calc(var(--u) * 14); }
#pic .tap { margin-top: 16px; opacity: .6; font-size: max(13px, calc(var(--u) * 22)); }
.kp { padding: calc(var(--u) * 30); border-radius: 18px; background: linear-gradient(180deg, #2a2420, #17120f); border: 2px solid #4a3c30; box-shadow: 0 20px 60px #000; }
.kp .disp { font-family: "Typed"; font-size: max(30px, calc(var(--u) * 64)); letter-spacing: .4em; text-align: center; padding: 10px 0 10px .4em; margin-bottom: 18px; border-radius: 8px; background: #0b1410; color: #8fe6a6; text-shadow: 0 0 12px #3f8; }
.kp .disp.ok { color: #fff; background: #1c5a30; } .kp .disp.bad { color: #ff8090; background: #3a0a10; animation: shout .1s 4; }
.kp .keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kp .keys button { width: max(56px, calc(var(--u) * 96)); height: max(52px, calc(var(--u) * 80)); border-radius: 10px; border: 1px solid #5a4a3c; background: linear-gradient(180deg, #4a3e36, #2c241f); font-family: "Typed"; font-size: max(22px, calc(var(--u) * 40)); box-shadow: 0 4px 0 #120e0c; }
.kp .keys button:active { transform: translateY(3px); box-shadow: 0 1px 0 #120e0c; }
#hold { background: rgba(4,3,7,.25); backdrop-filter: none; justify-content: flex-end; padding-bottom: calc(var(--u) * 80); }
.hold-box { text-align: center; }
.hold-box .lbl { font-family: "FellI"; font-size: max(18px, calc(var(--u) * 38)); text-shadow: 0 2px 10px #000; margin-bottom: 14px; }
.hold-box button { position: relative; overflow: hidden; width: min(calc(var(--u) * 520), 80vw); height: max(60px, calc(var(--u) * 96)); border-radius: 999px; border: 2px solid var(--candle); background: rgba(14,11,18,.85); font-size: max(18px, calc(var(--u) * 34)); touch-action: none; }
.hold-box .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, rgba(255,184,103,.35), rgba(255,230,180,.75)); }
.hold-box .txt { position: relative; }
.hold-box small { display: block; margin-top: 10px; opacity: .6; }

/* title */
#title { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 40; background: radial-gradient(ellipse at 50% 45%, rgba(0,0,0,0), rgba(0,0,0,.55) 75%); }
.logo { text-align: center; margin-top: calc(var(--u) * -90); animation: logo 2.6s cubic-bezier(.2,.8,.2,1); }
.logo .num { font-family: "Fell"; font-size: max(80px, calc(var(--u) * 240)); line-height: .8; color: #f6e8c8; text-shadow: 0 0 calc(var(--u) * 60) rgba(255,184,103,.55), 0 6px 0 rgba(0,0,0,.5); }
.logo .word { font-family: "FellI"; font-size: max(40px, calc(var(--u) * 110)); line-height: 1; margin-top: calc(var(--u) * -10); color: var(--paper); letter-spacing: .04em; }
.logo .sub { font-family: "Hand"; font-size: max(18px, calc(var(--u) * 40)); color: var(--candle); margin-top: calc(var(--u) * 8); }
@keyframes logo { from { opacity: 0; filter: blur(12px); transform: translateY(20px); } }
#title nav { display: flex; flex-direction: column; gap: calc(var(--u) * 10); margin-top: calc(var(--u) * 46); align-items: center; animation: fadein 1.4s .8s backwards; }
#title nav button { background: none; border: none; font-family: "Fell"; font-size: max(20px, calc(var(--u) * 44)); color: var(--paper2); padding: 4px 24px; position: relative; transition: .25s; min-height: 40px; }
#title nav button::before { content: ""; position: absolute; left: 50%; bottom: 4px; width: 0; height: 2px; background: var(--candle); transition: .3s; transform: translateX(-50%); box-shadow: 0 0 10px var(--candle); }
#title nav button:hover, #title nav button:focus-visible { color: #fff; letter-spacing: .04em; outline: none; }
#title nav button:hover::before, #title nav button:focus-visible::before { width: 70%; }
#t-play { color: #fff !important; font-size: max(26px, calc(var(--u) * 58)) !important; }
#title .hint { position: absolute; bottom: calc(var(--u) * 26); font-size: max(12px, calc(var(--u) * 21)); opacity: .55; text-align: center; padding: 0 20px; }
#title .mob { display: none; } body.touch #title .mob { display: inline; } body.touch #title .pc { display: none; }

.panel { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(4,3,7,.8); backdrop-filter: blur(4px); z-index: 60; animation: fadein .25s; }
.panel .box { width: min(calc(var(--u) * 760), 92%); max-height: 92%; overflow: auto; padding: calc(var(--u) * 40) calc(var(--u) * 50); border-radius: 20px; background: linear-gradient(180deg, #1a1520, #0e0b12); border: 1px solid rgba(241,230,208,.18); box-shadow: 0 20px 70px #000; display: flex; flex-direction: column; gap: calc(var(--u) * 14); font-size: max(15px, calc(var(--u) * 27)); }
.panel h2 { font-family: "Fell"; font-weight: normal; margin: 0 0 6px; font-size: 1.6em; color: var(--candle); }
.panel label { display: flex; justify-content: space-between; align-items: center; gap: 20px; }
.panel label.chk { justify-content: flex-start; }
.panel input[type=range] { width: 50%; accent-color: var(--candle); }
.panel input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--candle); }
.panel select { font: inherit; background: #221c28; color: var(--paper); border: 1px solid #4a3c50; border-radius: 8px; padding: 4px 10px; }
.panel p { margin: 0; line-height: 1.4; } .panel .small { opacity: .55; font-size: .8em; }
.panel .list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.panel .list button { border-radius: 12px; text-align: left; padding: 10px 16px; } .panel .list small { display: block; color: var(--candle); font-family: "FellI"; font-size: .75em; }

/* ending */
#ending { position: absolute; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 0 8%; background: linear-gradient(180deg, rgba(8,14,30,.25), rgba(4,6,14,.55)); }
#ending .e { opacity: 0; transform: translateY(14px); transition: opacity 2s, transform 2s, filter 2s; filter: blur(6px); }
#ending .e.show { opacity: 1; transform: none; filter: none; }
.e-big { font-family: "FellI"; font-size: max(34px, calc(var(--u) * 96)); text-shadow: 0 4px 30px rgba(0,0,0,.8); }
.e-name { font-family: "Fell"; font-size: max(44px, calc(var(--u) * 140)); color: #fff6dc; line-height: 1; text-shadow: 0 0 calc(var(--u) * 60) rgba(255,220,150,.6), 0 6px 20px rgba(0,0,0,.7); }
.e-text { font-family: "Patrick"; font-size: max(15px, calc(var(--u) * 31)); max-width: calc(var(--u) * 1050); margin-top: calc(var(--u) * 26); line-height: 1.45; text-shadow: 0 2px 10px #000; }
.e-mem { font-family: "FellI"; font-size: max(15px, calc(var(--u) * 30)); color: #ffe2a8; margin-top: calc(var(--u) * 22); text-shadow: 0 2px 10px #000; }
.e-sig { font-family: "Hand"; font-size: max(16px, calc(var(--u) * 34)); margin-top: calc(var(--u) * 12); opacity: .85; text-shadow: 0 2px 10px #000; }
.e-btns { display: flex; gap: 16px; margin-top: calc(var(--u) * 40); }
#e-again { border-color: var(--candle) !important; color: #fff; }

/* fade / loading / rotate */
#fade { position: fixed; inset: 0; background: #000; opacity: 1; pointer-events: none; z-index: 70; }
#loading { position: fixed; inset: 0; z-index: 90; background: #07060b; display: flex; align-items: center; justify-content: center; transition: opacity 1s; }
#loading.gone { opacity: 0; pointer-events: none; }
.l-in { text-align: center; }
.flame { width: 26px; height: 40px; margin: 0 auto 4px; border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%; background: radial-gradient(circle at 50% 70%, #fff6d0, #ffb867 45%, rgba(255,120,40,0) 72%); animation: flame 0.18s infinite alternate; filter: blur(.5px); }
.flame::after { content: ""; display: block; width: 14px; height: 54px; margin: 40px auto 0; border-radius: 3px; background: linear-gradient(180deg, #f2e8d4, #c9b896); }
@keyframes flame { to { transform: scale(1.06, .94) translateX(1px); } }
.l-t { font-family: "FellI"; font-size: 22px; margin-top: 60px; opacity: .8; }
.bar { width: 220px; height: 3px; margin: 14px auto 0; background: rgba(241,230,208,.15); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--candle); transition: width .5s; }
#rotate { position: fixed; inset: 0; z-index: 95; background: #07060b; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-family: "FellI"; font-size: 22px; }
#rotate div { width: 90px; color: var(--candle); animation: rot 2.4s infinite; }
@keyframes rot { 40%, 70% { transform: rotate(-90deg); } }
body.portrait #rotate { display: flex; }

/* Camadas atmosféricas do menu e do encerramento */
#title {
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(18,13,18,.05), rgba(0,0,0,.58) 74%),
    linear-gradient(180deg, rgba(5,5,10,.18), rgba(5,4,8,.42));
}
#title::before, #title::after {
  content: "";
  position: absolute;
  inset: -12%;
  z-index: 0;
  pointer-events: none;
}
#title::before {
  opacity: .72;
  background:
    radial-gradient(ellipse at 50% 34%, rgba(255,190,113,.18), transparent 20%),
    radial-gradient(ellipse at 18% 61%, rgba(129,105,158,.15), transparent 29%),
    radial-gradient(ellipse at 82% 58%, rgba(109,130,161,.12), transparent 30%),
    radial-gradient(circle at 12% 24%, rgba(255,229,184,.65) 0 1px, transparent 2px),
    radial-gradient(circle at 78% 18%, rgba(255,229,184,.5) 0 1px, transparent 2px),
    radial-gradient(circle at 87% 75%, rgba(255,229,184,.52) 0 1px, transparent 2px),
    radial-gradient(circle at 24% 82%, rgba(255,229,184,.45) 0 1px, transparent 2px);
  background-size: auto, auto, auto, 100% 100%, 100% 100%, 100% 100%, 100% 100%;
  animation: title-breath 12s ease-in-out infinite alternate;
}
#title::after {
  inset: 12px;
  border: 1px solid rgba(241,230,208,.10);
  box-shadow: inset 0 0 90px rgba(0,0,0,.3), 0 0 55px rgba(0,0,0,.18);
  mask-image: linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
}
#title > .logo, #title > nav, #title > .hint { z-index: 1; }
.logo { position: relative; }
.logo::after {
  content: "";
  display: block;
  width: min(72%, 300px);
  height: 1px;
  margin: calc(var(--u) * 15) auto 0;
  background: linear-gradient(90deg, transparent, rgba(255,205,145,.78), transparent);
  box-shadow: 0 0 18px rgba(255,184,103,.42);
  transform-origin: center;
  animation: title-rule 4s ease-in-out infinite;
}
.logo .num { animation: title-glow 5s ease-in-out infinite; }
#title nav { gap: calc(var(--u) * 8); }
#title nav button {
  min-width: min(300px, 72vw);
  border-radius: 999px;
  transition: color .25s, letter-spacing .25s, background .25s, transform .25s;
}
#title nav button:hover, #title nav button:focus-visible {
  background: linear-gradient(90deg, transparent, rgba(255,184,103,.08), transparent);
  transform: translateY(-1px);
}
#title nav button::before { height: 1px; }
#t-play {
  text-shadow: 0 0 22px rgba(255,220,170,.28);
  animation: play-breathe 3.8s ease-in-out infinite;
}
#title .hint { text-shadow: 0 2px 10px #000; }

#ending {
  isolation: isolate;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(8,14,30,.16), rgba(4,6,14,.42));
}
#ending::before {
  content: "";
  position: absolute;
  inset: -20%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 46%, rgba(255,226,167,.18), transparent 24%),
    radial-gradient(ellipse at 50% 100%, rgba(132,173,218,.11), transparent 50%);
  animation: ending-glow 8s ease-in-out infinite alternate;
}
.e-big { color: #fff4d9; }
.e-name { animation: name-glow 6s ease-in-out infinite; }

@keyframes title-breath {
  from { transform: translate3d(-.6%, .4%, 0) scale(1); filter: brightness(.88); }
  to { transform: translate3d(.6%, -.5%, 0) scale(1.04); filter: brightness(1.12); }
}
@keyframes title-rule { 50% { opacity: .55; transform: scaleX(.8); } }
@keyframes title-glow { 50% { text-shadow: 0 0 calc(var(--u) * 76) rgba(255,184,103,.72), 0 6px 0 rgba(0,0,0,.5); } }
@keyframes play-breathe { 50% { color: #fff4dc; text-shadow: 0 0 30px rgba(255,205,145,.5); } }
@keyframes ending-glow { to { transform: scale(1.08); opacity: .7; } }
@keyframes name-glow { 50% { text-shadow: 0 0 calc(var(--u) * 78) rgba(255,220,150,.78), 0 6px 20px rgba(0,0,0,.7); } }

@media (max-width: 700px) {
  #title::after { inset: 7px; }
  #title .hint { max-width: 94%; line-height: 1.35; }
  .e-text { max-height: 28vh; overflow: auto; }
}
@media (prefers-reduced-motion: reduce) {
  #title::before, .logo::after, .logo .num, #t-play, #ending::before, .e-name { animation: none !important; }
  #title nav button, #ending .e { transition-duration: .01ms; }
}

/* Retrato vivo da Sombra durante a transformação */
body.shadow-manifesting .dlg.caio #dlg-portrait {
  background-color: #110b13;
  background-image:
    url("assets/sombra-manifestacao.gif"),
    radial-gradient(circle at 50% 45%, #342133, #100b13 72%);
  background-position: center 43%, center;
  background-size: cover, cover;
  border-color: #c66b7b;
  box-shadow: 0 0 0 2px rgba(192,74,96,.18), 0 0 34px rgba(190,55,79,.42);
}
body.shadow-manifesting .dlg.caio #dlg-portrait canvas {
  opacity: 0;
  transition: opacity .2s ease;
}
.dlg.caio #dlg-portrait canvas { transition: opacity .32s ease; }

/* Cartões de capítulo com moldura e luz em movimento */
#chap { isolation: isolate; overflow: hidden; }
#chap::before, #chap::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
#chap::before {
  inset: 12% 13%;
  z-index: 0;
  border-top: 1px solid rgba(255,211,160,.26);
  border-bottom: 1px solid rgba(255,211,160,.2);
  background:
    linear-gradient(90deg, transparent, rgba(255,204,143,.12), transparent) top / 100% 1px no-repeat,
    linear-gradient(90deg, transparent, rgba(255,204,143,.1), transparent) bottom / 100% 1px no-repeat;
  box-shadow: 0 0 60px rgba(255,180,103,.08), inset 0 0 70px rgba(0,0,0,.18);
  animation: chapter-frame 4.2s ease both;
}
#chap::after {
  inset: -20%;
  z-index: 0;
  background:
    radial-gradient(ellipse at 50% 48%, rgba(255,206,150,.13), transparent 24%),
    radial-gradient(circle at 23% 35%, rgba(255,225,182,.5) 0 1px, transparent 2px),
    radial-gradient(circle at 76% 62%, rgba(255,225,182,.4) 0 1px, transparent 2px);
  animation: chapter-light 4.2s ease both;
}
#chap .n, #chap .t, #chap .s { position: relative; z-index: 1; }
@keyframes chapter-frame {
  0% { opacity: 0; transform: scale(.96); }
  18%, 78% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.02); }
}
@keyframes chapter-light {
  0% { opacity: 0; transform: scale(.9); }
  24%, 70% { opacity: 1; transform: scale(1.04); }
  100% { opacity: 0; transform: scale(1.12); }
}
@media (max-width: 700px) {
  #chap::before { inset: 10% 6%; }
}
@media (prefers-reduced-motion: reduce) {
  #chap::before, #chap::after { animation: none !important; }
}

/* ---- controles no menu de configurações e na pausa ---- */
.controls { margin-top: calc(var(--u) * 6); padding-top: calc(var(--u) * 16); border-top: 1px solid rgba(241,230,208,.14); }
.controls h3 { margin: 0 0 calc(var(--u) * 10); font-family: inherit; font-weight: normal; color: var(--candle, #ffb867); font-size: 1em; letter-spacing: .04em; }
.controls dl { display: grid; grid-template-columns: max-content 1fr; gap: calc(var(--u) * 8) calc(var(--u) * 22); margin: 0; font-size: .86em; }
.controls dt { color: #f1e6d0; white-space: nowrap; }
.controls dd { margin: 0; color: rgba(241,230,208,.66); }
.controls .mob, .pause-keys .mob { display: none; }
body.touch .controls .mob { display: grid; } body.touch .controls .pc { display: none; }
body.touch .pause-keys .mob { display: inline; } body.touch .pause-keys .pc { display: none; }
.pause-keys { opacity: .75; line-height: 1.5; }


/* ---- aviso de interação: um só, fixo embaixo no centro (antes flutuava pelo cenário) ---- */
#hot { left: 50% !important; top: auto !important; bottom: calc(var(--u) * 46 + env(safe-area-inset-bottom)); transform: translateX(-50%) !important;
  padding: 8px 18px 8px 8px; gap: 10px; pointer-events: auto; cursor: pointer; background: rgba(12,9,16,.86); border-color: rgba(255,214,150,.35);
  box-shadow: 0 8px 30px rgba(0,0,0,.45); animation: hotin .25s ease-out; }
#ui > #hot { pointer-events: auto; }
#hot .dot { display: none; }
#hot::before { content: "E"; display: grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 7px; background: #f4e3c4; color: #1a1210;
  font-weight: 700; font-size: .8em; box-shadow: inset 0 -2px 0 rgba(0,0,0,.25); }
body.touch #hot::before { content: "toque"; width: auto; padding: 0 .5em; font-weight: 600; }
@keyframes hotin { from { opacity: 0; transform: translate(-50%, 8px); } }
body.cine #hot { display: none; }
