* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #000; color: #fff;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; overscroll-behavior: none; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#hud { position: fixed; inset: 0; pointer-events: none; }

.lb { position: absolute; left: 0; right: 0; height: 0; background: #000; transition: height 1.2s ease; z-index: 2; }
#lb-top { top: 0; } #lb-bot { bottom: 0; }
body.cine .lb { height: 11vh; }
body.cine #objective, body.cine #crosshair, body.cine #prompt { opacity: 0; }

#pov { position: absolute; top: max(10px, env(safe-area-inset-top)); left: 14px; transition: opacity .6s; }
#pov-name { font-size: 11px; letter-spacing: .25em; text-transform: uppercase; color: #e9c46a; opacity: .85; }
#crumbs { font-size: 11px; opacity: .55; margin-top: 2px; }
#objective { position: absolute; top: calc(max(10px, env(safe-area-inset-top)) + 36px); left: 14px; max-width: min(70vw, 460px);
  font-size: 15px; line-height: 1.3; padding: 4px 10px; border-left: 3px solid #e9c46a; background: linear-gradient(90deg, #0008, #0000);
  text-shadow: 0 1px 3px #000; transition: opacity .6s; }
#objective:empty { display: none; }
#killfeed { position: absolute; top: max(10px, env(safe-area-inset-top)); right: 14px; text-align: right;
  font-family: "Courier New", monospace; font-size: 14px; text-shadow: 1px 1px 0 #000; z-index: 3; }
#killfeed div { animation: kf 7s forwards; margin-bottom: 2px; }
#killfeed b { color: #ffd166; } #killfeed .r { color: #ff4d4d; }
@keyframes kf { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }
#crosshair { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: #fff9; transition: opacity .6s; }
#prompt { position: absolute; left: 50%; top: 57%; transform: translateX(-50%); font-size: 16px; background: #000b; padding: 7px 14px;
  border-radius: 8px; border: 1px solid #e9c46a88; display: none; white-space: nowrap; }
body.touch #prompt { display: none !important; }

#caption { position: absolute; left: 6vw; bottom: 18vh; opacity: 0; transition: opacity 1.5s; z-index: 3; text-shadow: 0 2px 8px #000; }
#caption.show { opacity: 1; }
#caption h3 { font-family: Georgia, "Times New Roman", serif; font-weight: normal; font-size: clamp(28px, 6vw, 56px); letter-spacing: .04em; }
#caption p { font-family: Georgia, serif; font-style: italic; font-size: clamp(14px, 2.4vw, 20px); opacity: .85; }

#subtitle { position: absolute; left: 50%; bottom: calc(13vh + env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(92vw, 820px); text-align: center; display: none; z-index: 3; text-shadow: 0 2px 4px #000, 0 0 3px #000;
  opacity: 0; transition: opacity .25s; }
#subtitle.in { opacity: 1; }
#subtitle .who { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; margin-bottom: 3px; }
#subtitle .line { font-size: clamp(18px, 2.6vw, 25px); line-height: 1.35; background: #000a; display: inline-block; padding: 6px 14px; border-radius: 8px; }

/* voices from outside the current scene: the phone, the bar, the cave, memories */
#voiceover { position: absolute; left: 50%; top: calc(max(12px, env(safe-area-inset-top)) + 15vh); transform: translate(-50%, -6px);
  width: min(90vw, 700px); text-align: center; display: none; z-index: 3; opacity: 0; transition: opacity .3s, transform .3s; }
#voiceover.in { opacity: 1; transform: translate(-50%, 0); }
#voiceover .box { display: inline-block; padding: 10px 18px 12px; border-radius: 16px; border: 1px solid #fff3; box-shadow: 0 8px 30px #000a;
  font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: clamp(17px, 2.4vw, 22px); line-height: 1.4; background: #000c; }
#voiceover .who { font-family: system-ui, sans-serif; font-style: normal; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 4px; }
#voiceover.phone .box { border-color: #7cfc0080; background: linear-gradient(180deg, #0c2414e6, #040c07e6); border-radius: 22px 22px 22px 4px; }
#voiceover.bar .box { border-color: #ffb70380; background: linear-gradient(180deg, #2e1a08e6, #120a04e6); }
#voiceover.cave .box { border-color: #c9b37e80; background: radial-gradient(ellipse at 50% 0%, #3a2c12e6, #0a0806e6); color: #f3e6c4; }
#voiceover.memory .box { border-color: #ff3b3b; background: #1a0000e6; color: #ffb3b3; letter-spacing: .05em; animation: echo .5s infinite alternate; }
@keyframes echo { from { text-shadow: 2px 0 #f00, -2px 0 #0ff; } to { text-shadow: -2px 0 #f00, 2px 0 #0ff; } }
#medal { position: absolute; left: 50%; top: 28%; transform: translate(-50%, -50%) scale(.3); opacity: 0; z-index: 4;
  font-family: Impact, "Arial Black", sans-serif; font-size: clamp(40px, 10vw, 110px); color: #ff3b1f; letter-spacing: .05em;
  text-shadow: 0 0 20px #ff0000, 4px 4px 0 #000; transition: transform .25s cubic-bezier(.2, 2, .4, 1), opacity .25s; }
#medal.show { transform: translate(-50%, -50%) scale(1); opacity: 1; }
#flash { position: absolute; inset: 0; background: #f20; opacity: 0; z-index: 4; }
#fade { position: absolute; inset: 0; background: #000; opacity: 1; z-index: 5; }
#card { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; opacity: 0; transition: opacity .8s; z-index: 6; padding: 20px; }
#card.show { opacity: 1; }
#card .layer { font-size: 12px; letter-spacing: .4em; text-transform: uppercase; color: #e9c46a; margin-bottom: 14px; }
#card h2 { font-family: Georgia, "Times New Roman", serif; font-weight: normal; font-size: clamp(32px, 7vw, 64px); }
#card p { font-family: Georgia, serif; font-style: italic; opacity: .8; margin-top: 10px; font-size: clamp(15px, 2.4vw, 20px); }
#hint { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); background: #000a; padding: 8px 14px; border-radius: 8px; font-size: 15px; display: none; z-index: 3; }
#err { position: absolute; left: 8px; bottom: 8px; right: 8px; color: #f88; font: 12px monospace; background: #000c; padding: 6px; display: none; z-index: 20; pointer-events: auto; }

#touch { position: fixed; inset: 0; display: none; pointer-events: none; z-index: 7; }
body.touch #touch { display: block; }
#stick { position: absolute; width: 120px; height: 120px; border-radius: 50%; border: 2px solid #fff6; background: #ffffff14; display: none; transform: translate(-50%, -50%); }
#nub { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; border-radius: 50%; background: #fffa; transform: translate(-50%, -50%); }
#act { position: absolute; right: max(18px, env(safe-area-inset-right)); bottom: calc(26vh + env(safe-area-inset-bottom)); min-width: 92px; height: 92px; border-radius: 46px;
  pointer-events: auto; display: none; border: 2px solid #e9c46a; background: #000a; color: #fff; padding: 0 16px; font-size: 14px;
  flex-direction: column; align-items: center; justify-content: center; animation: pulse 1.2s infinite; }
#act .hand { font-size: 30px; line-height: 1; }
#act-label { display: block; max-width: 150px; font-size: 13px; margin-top: 2px; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px #e9c46a33; } }

#title, #credits { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 24px; z-index: 10; background: radial-gradient(ellipse at 50% 35%, #1f2a3a 0%, #07090d 70%); }
#credits { display: none; background: #000; }
#title h1, #credits h1 { font-family: Georgia, "Times New Roman", serif; font-weight: normal; font-size: clamp(40px, 9vw, 84px); line-height: 1.02; margin: 10px 0 12px; }
.tt-small { letter-spacing: .35em; text-transform: uppercase; font-size: 12px; color: #e9c46a; }
.tt-sub { font-family: Georgia, serif; font-style: italic; opacity: .75; margin-bottom: 26px; }
#title button, #credits button { font-size: 20px; padding: 14px 30px; border-radius: 40px; border: 1px solid #e9c46a; background: #e9c46a; color: #111; cursor: pointer; font-weight: 600; }
#credits p { font-family: Georgia, serif; font-style: italic; opacity: .85; max-width: 640px; margin-bottom: 18px; line-height: 1.5; }
#credits .small { font-size: 13px; opacity: .6; }
.opt { margin-top: 18px; font-size: 14px; opacity: .8; display: flex; gap: 8px; align-items: center; }
.controls { margin-top: 18px; font-size: 13px; opacity: .6; }
.controls .mob { display: none; } body.touch .controls .mob { display: block; } body.touch .controls .desk { display: none; }
#chapters-wrap { margin-top: 16px; font-size: 13px; opacity: .7; }
#chapters { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 600px; margin-top: 8px; }
#chapters button { font-size: 12px; padding: 5px 10px; background: transparent; color: #e9c46a; border-radius: 14px; }
