/* THE OFFICE 3D — page shell + DOM chrome (HUD, dialogue, boss UI).
   Layout adapted from the 2D original for a full-viewport WebGL canvas. */

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { width: 100%; height: 100%; }

body {
  background: #05050c;
  font-family: 'Courier New', monospace;
  overflow: hidden;
}

#game {
  position: relative;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#renderCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
  outline: none;
  touch-action: none;
}

/* crosshair */
#crosshair {
  position: absolute;
  top: 50%; left: 50%;
  width: 6px; height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: rgba(160, 200, 255, 0.55);
  box-shadow: 0 0 6px rgba(80, 150, 255, 0.6);
  pointer-events: none;
  z-index: 60;
}

#ui-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}

/* Interactive DOM screens that live inside the pointer-transparent overlay
   MUST opt back in, or real mouse clicks pass straight through them. */
#title-screen, #skip-btn, #credits, #modal, #puzzle-assembly, #pause-menu, #journal, #letter, #hunt-pause { pointer-events: auto; }

/* Dialogue box — doubles as the voice's caption track */
#dialogue-box {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 500px);     /* leave room for the minimap (bottom-right) */
  min-width: 340px;
  max-width: 900px;
  background: rgba(4, 8, 18, 0.92);
  border: 2px solid #6ecbff;
  border-radius: 8px;
  padding: 14px 20px;
  color: #eef4ff;
  font-size: 17px;
  line-height: 1.5;
  pointer-events: none;   /* pure caption — must never eat canvas drags */
  display: none;
  z-index: 430;           /* above puzzle modals so in-puzzle hints are readable */
  box-shadow: 0 0 24px rgba(30, 80, 140, 0.35);
}

#dialogue-box.visible {
  display: block;
  animation: fadeIn 0.3s ease;
}

#dialogue-box .speaker {
  color: #4a9eff;
  font-weight: bold;
  margin-bottom: 4px;
  font-size: 13px;
  letter-spacing: 2px;
}

#dialogue-box .text { white-space: pre-wrap; }

/* Interaction prompt (floats under the crosshair in first person) */
#interact-prompt {
  position: absolute;
  top: 56%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid #4a9eff;
  border-radius: 4px;
  padding: 8px 16px;
  color: #fff;
  font-size: 14px;
  pointer-events: none;
  display: none;
  z-index: 90;
  white-space: nowrap;
}

#interact-prompt.visible { display: block; }

/* HUD */
#hud {
  position: absolute;
  top: 16px;
  left: 16px;
  color: #fff;
  font-size: 14px;
  pointer-events: none;
  display: none;
  z-index: 80;
}

#hud.visible { display: block; }

#hud .floor-label {
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 12px;
  border-radius: 4px;
  margin-bottom: 8px;
}

#hud .puzzle-pieces {
  background: rgba(0, 0, 0, 0.6);
  padding: 4px 12px;
  border-radius: 4px;
  display: inline-block;
}

/* Pocket minimap */
#minimap {
  position: absolute;
  bottom: 14px;
  right: 14px;
  border: 2px solid #4a9eff;
  border-radius: 8px;
  background: rgba(5, 8, 18, 0.78);
  z-index: 85;
  pointer-events: none;
  box-shadow: 0 0 18px rgba(20, 50, 100, 0.4);
}

/* Player health bar (boss fight) */
#player-health {
  position: absolute;
  top: 16px;
  right: 232px;
  width: 160px;
  z-index: 110;
  display: none;
}

#player-health.visible { display: block; }

#player-health .bar-bg {
  width: 100%;
  height: 20px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #4a9eff;
}

#player-health .bar-fill {
  height: 100%;
  background: #4a9eff;
  border-radius: 4px;
  transition: width 0.3s;
}

#player-health .label { color: #9fd0ff; font-size: 12px; margin-bottom: 4px; }
#player-health .streak { color: #4aff9e; font-size: 11px; margin-top: 2px; min-height: 13px; }

/* Boss fight UI */
#boss-ui {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  width: 92%;
  pointer-events: auto;
  display: none;
  z-index: 110;
}

#boss-ui.visible {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

#boss-word-input {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

#boss-word-input .letter-slot {
  width: 48px;
  height: 48px;
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid #4a9eff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: #fff;
  cursor: pointer;
  transition: all 0.15s;
}

#boss-word-input .letter-slot:hover {
  background: rgba(74, 158, 255, 0.3);
  border-color: #6ab4ff;
}

#boss-word-input .letter-slot.used {
  opacity: 0.3;
  pointer-events: none;
  background: rgba(74, 158, 255, 0.5);
}

#boss-word-input .letter-slot.pressed {
  background: rgba(74, 255, 158, 0.5);
  border-color: #4aff9e;
  transform: scale(1.1);
}

#boss-word-input .letter-slot.stolen {
  border-color: #ff4444;
  background: rgba(255, 68, 68, 0.2);
}

#boss-formed-word {
  min-height: 48px;
  background: rgba(0, 0, 0, 0.8);
  border: 2px solid #4a9eff;
  border-radius: 6px;
  padding: 8px 16px;
  color: #fff;
  font-size: 20px;
  text-align: center;
  min-width: 200px;
  max-width: 90vw;
}

#boss-timer {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
}

#boss-timer .bar {
  height: 100%;
  background: #4a9eff;
  border-radius: 3px;
  transition: width 0.1s linear;
}

#boss-health {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 200px;
  z-index: 110;
  display: none;
}

#boss-health.visible { display: block; }

#boss-health .bar-bg {
  position: relative;
  width: 100%;
  height: 20px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #ff4444;
}

#boss-health .bar-fill {
  height: 100%;
  background: #ff4444;
  border-radius: 4px;
  transition: width 0.3s;
}

#boss-health .label { color: #ff4444; font-size: 12px; margin-bottom: 4px; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ---------------------------------------------------------------- 3D edition additions */

#loading {
  position: absolute; inset: 0; z-index: 900;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #101a2e 0%, #05050c 70%);
  color: #8fb8ff; font-size: 14px; letter-spacing: 3px;
}
#loading .bar { width: 220px; height: 3px; margin-top: 14px; background: #1a2238; overflow: hidden; border-radius: 2px; }
#loading .bar i { display: block; height: 100%; width: 40%; background: #4a9eff; animation: loadslide 1.2s ease-in-out infinite; }
@keyframes loadslide { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

#title-screen {
  position: absolute; inset: 0; z-index: 500;
  background: radial-gradient(ellipse at 50% 45%, rgba(4,8,20,0.72) 0%, rgba(4,6,14,0.55) 45%, rgba(2,2,8,0.9) 100%);
  display: flex; align-items: center; justify-content: center;
  color: #d8d8e8; text-align: center; padding: 16px; overflow-y: auto;
}
#title-screen .t-panel { max-width: 760px; display: flex; flex-direction: column; align-items: center; }
#title-screen .t-kicker { font-size: 14px; letter-spacing: 6px; color: #ffd75e; margin-bottom: 10px; }
#title-screen .t-logo { font-size: clamp(46px, 9vw, 96px); font-weight: bold; color: #eaf2ff; letter-spacing: 8px; line-height: 1; text-shadow: 0 0 30px #1a5aaf, 0 4px 0 #0c1a33; animation: titleflick 6s infinite; position: relative; }
#title-screen .t-3d { display: inline-block; margin-left: 14px; font-size: 0.42em; vertical-align: top; padding: 4px 12px; border: 3px solid #c9a0ff; color: #c9a0ff; border-radius: 8px; letter-spacing: 3px; text-shadow: 0 0 16px #7a40c0; transform: rotate(-6deg) translateY(6px); }
#title-screen .t-blurb { max-width: 600px; line-height: 1.6; color: #c4cce4; font-size: clamp(15px, 1.7vw, 18px); margin-top: 22px; }
#title-screen .t-hook { margin-top: 10px; font-size: clamp(16px, 1.9vw, 20px); color: #ffffff; font-weight: bold; }
#title-screen .t-start { margin-top: 26px; padding: 16px 46px; font-size: 22px; font-family: 'Courier New', monospace; font-weight: bold; letter-spacing: 2px; color: #08111f; background: linear-gradient(#8fc3ff, #4a9eff); border: none; border-radius: 12px; cursor: pointer; box-shadow: 0 0 0 3px rgba(74,158,255,0.35), 0 10px 30px rgba(30,90,200,0.45); animation: startpulse 2.2s ease-in-out infinite; }
#title-screen .t-start:hover { transform: translateY(-2px) scale(1.03); }
@keyframes startpulse { 0%,100% { box-shadow: 0 0 0 3px rgba(74,158,255,0.35), 0 10px 30px rgba(30,90,200,0.45); } 50% { box-shadow: 0 0 0 9px rgba(74,158,255,0.12), 0 10px 40px rgba(30,90,200,0.7); } }
#title-screen .t-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 26px; }
#title-screen .t-pills span { font-size: 15px; padding: 8px 14px; border-radius: 999px; background: rgba(20,30,56,0.85); border: 1px solid rgba(143,184,255,0.45); color: #eef3ff; }
#title-screen .t-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; margin-top: 18px; font-size: 14px; color: #aab4d0; }
#title-screen kbd { display: inline-block; min-width: 22px; padding: 3px 7px; margin-right: 3px; border-radius: 5px; background: #1c2740; border: 1px solid #4a5d86; border-bottom-width: 3px; color: #eaf2ff; font-family: 'Courier New', monospace; font-size: 13px; }
#title-screen .t-build { position: absolute; right: 14px; bottom: 10px; font-size: 12px; color: #6a7490; }

/* captions: cinematic subtitles — prominent, readable on any background */
.scene-caption { position: absolute; left: 50%; bottom: 92px; transform: translate(-50%, 10px); z-index: 450; max-width: min(82%, 920px); width: max-content;
  padding: 14px 28px; border-radius: 10px; background: rgba(6,10,24,0.84); border: 1px solid rgba(143,184,255,0.5); border-left: 5px solid #4a9eff;
  box-shadow: 0 10px 34px rgba(0,0,0,0.55); color: #f4f6ff; font-family: 'Courier New', monospace; font-size: clamp(19px, 2.2vw, 27px); line-height: 1.45;
  text-align: center; white-space: pre-line; text-shadow: 0 2px 4px #000; opacity: 0; transition: opacity 0.45s ease, transform 0.45s ease; pointer-events: none; }
.scene-caption.show { opacity: 1; transform: translate(-50%, 0); }
.scene-caption.top { bottom: auto; top: 30%; }
.scene-caption.voice { color: #e6dbff; border-left-color: #b48cff; font-style: italic; }

/* click-to-look nudge */
#look-hint { position: absolute; left: 50%; top: 60%; max-width: min(560px, 70%); transform: translate(-50%, -50%); z-index: 96; pointer-events: none; text-align: center;
  background: rgba(6,10,24,0.86); border: 2px solid #ffd75e; color: #fff; padding: 14px 24px; border-radius: 12px; font-size: 19px; box-shadow: 0 0 30px rgba(255,215,94,0.25);
  animation: lookpulse 1.8s ease-in-out infinite; transition: opacity 0.45s; }
#look-hint small { display: block; font-size: 12px; color: #aab; margin-top: 6px; }
#look-hint.out { opacity: 0; }
@keyframes lookpulse { 0%,100% { box-shadow: 0 0 18px rgba(255,215,94,0.2); } 50% { box-shadow: 0 0 34px rgba(255,215,94,0.5); } }

@keyframes titleflick { 0%, 92%, 100% { opacity: 1; } 93% { opacity: 0.4; } 94% { opacity: 1; } 96% { opacity: 0.6; } }

.modal-box {
  background: #12121e; border: 2px solid #4a9eff; border-radius: 12px; padding: 24px;
  max-width: 94vw; max-height: 92%; overflow-y: auto; pointer-events: auto;
  box-shadow: 0 0 40px rgba(30, 80, 160, 0.35);
}

#hud .hud-words { margin-top: 6px; background: rgba(0,0,0,0.6); padding: 4px 12px; border-radius: 4px; display: inline-block; letter-spacing: 1px; font-weight: bold; }
#hud .hud-words .dim, .dim { color: #556; }

/* puzzles */
.pz-fb { text-align: center; color: #ff8866; margin-top: 8px; min-height: 20px; }
.pz-mono { font-family: 'Courier New', monospace; color: #9fe0b0; }
.pz-clues { background: #1a1a2a; border: 1px solid #333; border-radius: 8px; padding: 10px 12px 10px 32px; margin: 10px 0; font-size: 13px; }
.pz-clues li { margin: 3px 0; }
.pz-clues .pz-missing { color: #556; font-style: italic; }
.pz-tag { font-size: 10px; color: #ffd75e; border: 1px solid #ffd75e; border-radius: 3px; padding: 0 4px; margin-left: 4px; }
.pz-grid { margin: 8px auto 12px; border-collapse: collapse; }
.pz-grid th { color: #8fb8ff; font-size: 12px; font-weight: normal; padding: 2px 8px; }
.pz-grid td { padding: 3px 8px; }
.pz-cyc { min-width: 84px; padding: 7px 10px; background: #1a2238; border: 1px solid #4a9eff; color: #dfeaff; border-radius: 6px; cursor: pointer; font-family: 'Courier New', monospace; font-size: 14px; }
.pz-cyc.wide { min-width: 110px; }
.pz-cyc:hover { background: #24345a; }
.pz-notes { background: #161a10; border: 1px dashed #ffd75e; border-radius: 8px; padding: 8px 12px; margin: 10px 0; font-size: 12px; color: #e8e0b0; }
.pz-notes.empty { color: #776; border-color: #554; }
.pz-notes-h { font-size: 10px; letter-spacing: 2px; color: #ffd75e; margin-bottom: 4px; }
.pz-sticky { background: #f3e27a; color: #3a3210; font-family: 'Courier New', monospace; font-size: 13px; padding: 12px 14px; border-radius: 3px; transform: rotate(-1deg); box-shadow: 3px 3px 0 rgba(0,0,0,0.4); margin: 4px auto 10px; max-width: 420px; line-height: 1.55; }
.pz-code { width: 160px; margin: 14px auto; text-align: center; font-size: 28px; letter-spacing: 8px; background: #1a1a2a; border: 2px solid #4a9eff; border-radius: 8px; padding: 6px; color: #8fe0ff; }

.mm-hist { max-height: 210px; overflow-y: auto; margin: 8px auto; width: fit-content; }
.mm-row { display: flex; align-items: center; gap: 8px; justify-content: center; margin: 4px 0; }
.mm-cur { margin: 12px 0; }
.mm-peg { display: inline-block; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #334; }
.mm-peg.slot { width: 36px; height: 36px; border: 2px dashed #4a9eff; cursor: pointer; }
.mm-fbk { min-width: 70px; color: #ffd84a; letter-spacing: 3px; font-size: 16px; }
.mm-pal { display: flex; gap: 10px; justify-content: center; margin-bottom: 10px; }
.mm-pal-b { width: 42px; height: 42px; border-radius: 50%; border: 2px solid #fff3; color: #0008; font-weight: bold; cursor: pointer; font-family: 'Courier New'; }
.mm-pal-b:hover { transform: scale(1.1); border-color: #fff; }

/* whiteboard */
#puzzle-assembly { position: absolute; inset: 0; background: rgba(0,0,0,0.75); z-index: 420; display: flex; align-items: center; justify-content: center; }
.wb-box { background: #f0f2f4; border: 10px solid #9aa3b0; border-radius: 10px; padding: 24px; max-width: 680px; width: 92vw; text-align: center; color: #223; box-shadow: 0 0 60px rgba(120,160,255,0.3); }
.wb-box h2 { color: #2a5aa0; margin: 0 0 6px; }
.wb-sub { font-size: 13px; margin-bottom: 16px; color: #445; }
.wb-tray, .wb-slots { display: flex; gap: 12px; justify-content: center; min-height: 64px; margin-bottom: 14px; flex-wrap: wrap; }
.wb-frag { padding: 14px 16px; background: #12121e; border: 3px solid; border-radius: 10px; font-weight: bold; cursor: pointer; letter-spacing: 2px; box-shadow: 0 4px 0 rgba(0,0,0,0.25); }
.wb-frag:hover { transform: translateY(-2px); }
.wb-slot { min-width: 110px; height: 56px; border: 2px dashed #9aa3b0; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #9aa3b0; font-weight: bold; letter-spacing: 2px; cursor: pointer; }
.wb-slot.full { border-style: solid; border-color: #223; color: #0a0a12; }
.wb-reveal { margin: 8px auto; background: #0a0015; border: 2px solid #9040c0; border-radius: 12px; padding: 14px; color: #e8d8ff; font-size: 13px; line-height: 1.6; }
.wb-sentence { font-size: 20px; color: #ffd84a; letter-spacing: 3px; font-weight: bold; margin-bottom: 8px; }
.shake { animation: shake 0.5s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-10px); } 40%,80% { transform: translateX(10px); } }

/* journal */
#journal { position: absolute; inset: 0; background: rgba(0,0,0,0.55); z-index: 380; display: flex; align-items: center; justify-content: center; }
.j-page { background: #efe9d8; color: #2a2a33; width: 600px; max-width: 94vw; max-height: 86vh; overflow-y: auto; padding: 22px 26px; border-radius: 4px; box-shadow: 8px 8px 0 rgba(0,0,0,0.35); background-image: repeating-linear-gradient(#efe9d8 0 23px, #d8d0bc 23px 24px); font-size: 13px; line-height: 24px; }
.j-h { font-size: 18px; font-weight: bold; letter-spacing: 3px; color: #2a5aa0; display: flex; justify-content: space-between; }
.j-h span { font-size: 11px; color: #887; letter-spacing: 0; font-weight: normal; }
.j-sec { margin-top: 10px; font-weight: bold; color: #a0402a; text-transform: uppercase; font-size: 12px; letter-spacing: 2px; }
.j-line { padding-left: 8px; }
.j-words { display: flex; gap: 8px; }
.j-words span { border: 2px solid #aaa; padding: 0 8px; border-radius: 6px; background: #12121e; font-weight: bold; }
.j-words span.dim { color: #556; border-color: #889; background: transparent; }

/* pause */
#pause-menu { position: absolute; inset: 0; background: rgba(2,3,10,0.7); z-index: 480; display: flex; align-items: center; justify-content: center; }
.p-box { background: #12121e; border: 2px solid #4a9eff; border-radius: 12px; padding: 24px 28px; width: 360px; max-width: 92vw; color: #d8d8e8; display: flex; flex-direction: column; gap: 12px; font-size: 14px; }
.p-title { font-size: 26px; color: #4a9eff; letter-spacing: 6px; text-align: center; margin-bottom: 4px; }
.p-box label { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.p-box input[type=range] { width: 150px; accent-color: #4a9eff; }
.p-box select { background: #1a2238; color: #dfeaff; border: 1px solid #4a9eff; border-radius: 4px; padding: 3px; font-family: 'Courier New'; }
.p-keys { font-size: 11px; color: #667; text-align: center; }

/* boss extras */
#boss-health .bar-tick { position: absolute; top: 0; bottom: 0; width: 2px; background: rgba(255,255,255,0.45); }
#boss-health .label span { color: #c9a0ff; }
#boss-health { width: 250px; }
#boss-health .label { white-space: nowrap; }
#player-health { right: 282px; }
#boss-word-input .letter-slot.ai { border-color: #c9a0ff; background: rgba(160, 80, 255, 0.45); opacity: 0.8; }
.boss-help { color: #888; font-size: 12px; margin-top: 2px; text-align: center; }
.dmg-pop { position: absolute; left: 50%; top: 30%; transform: translateX(-50%); font-size: 46px; font-weight: bold; text-shadow: 0 0 14px #000; z-index: 120; pointer-events: none; animation: dmgfloat 1.2s ease-out forwards; }
@keyframes dmgfloat { from { opacity: 1; transform: translate(-50%, 0) scale(1.3); } to { opacity: 0; transform: translate(-50%, -70px) scale(1); } }

#ui-overlay.has-modal #dialogue-box { top: 12px; bottom: auto; }
/* while a puzzle is open the dialogue sits on top; push the window below it */
#ui-overlay.has-modal #modal { padding-top: 96px; box-sizing: border-box; }
#ui-overlay.has-modal #modal .modal-box { max-height: calc(100% - 20px); }

/* intro: eyelids + chrome fade-in */
.eyelid { position: absolute; left: 0; width: 100%; height: 0%; background: #000; z-index: 560; pointer-events: none; }
.eyelid.top { top: 0; border-radius: 0 0 50% 50% / 0 0 18% 18%; }
.eyelid.bottom { bottom: 0; border-radius: 50% 50% 0 0 / 18% 18% 0 0; }
.fade-in { animation: chromein 1.6s ease-out both; }
@keyframes chromein { from { opacity: 0; } to { opacity: 1; } }

/* ---------------------------------------------------------------- server floor (token hunt) */
#hunt-hud { position: absolute; top: 14px; left: 14px; z-index: 90; color: #e8dcff; font-size: 14px; background: rgba(8,4,16,0.7); border: 1px solid #5a3a8a; border-radius: 8px; padding: 10px 14px; min-width: 250px; }
#hunt-hud .hh-row { display: flex; justify-content: space-between; gap: 18px; font-size: 18px; }
#hh-hearts { color: #ff3a6a; letter-spacing: 3px; }
#hh-tokens b { color: #ffc94a; }
.hh-stam { height: 5px; background: #221833; border-radius: 3px; margin: 8px 0; overflow: hidden; }
.hh-stam i { display: block; height: 100%; background: #6ad0ff; }
.hh-words { font-weight: bold; letter-spacing: 1px; }
.hh-eaten { font-size: 11px; color: #a08ac0; margin-top: 4px; }
.hh-keys { font-size: 10px; color: #776; margin-top: 6px; }
#hunt-prompt { display: none; position: absolute; left: 50%; top: 62%; transform: translateX(-50%); z-index: 90; background: rgba(8,4,16,0.85); border: 1px solid #c070ff; color: #f0e0ff; padding: 8px 16px; border-radius: 6px; font-size: 14px; text-align: center; }
#hunt-prompt .hp-bar { height: 6px; background: #2a1a3a; margin-top: 6px; border-radius: 3px; overflow: hidden; }
#hunt-prompt .hp-bar i { display: block; height: 100%; background: #c070ff; }
#hunt-map { position: absolute; right: 14px; bottom: 14px; z-index: 85; background: rgba(8,4,16,0.6); border: 1px solid #5a3a8a; border-radius: 8px; }
#hunt-danger { position: absolute; inset: 0; z-index: 80; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, transparent 45%, rgba(170,0,40,0.55) 100%); transition: opacity 0.25s; }
#hunt-pause { position: absolute; inset: 0; z-index: 470; display: none; flex-direction: column; align-items: center; justify-content: center; background: rgba(2,0,8,0.7); color: #c9a0ff; font-size: 28px; letter-spacing: 6px; cursor: pointer; pointer-events: auto; }
#hunt-pause small { font-size: 13px; letter-spacing: 1px; color: #887; margin-top: 8px; }

/* ending: letter + credits roll */
#letter { position: absolute; inset: 0; z-index: 470; display: flex; align-items: center; justify-content: center; background: rgba(40,28,10,0.25); pointer-events: auto; }
.letter-paper { width: 520px; max-width: 90vw; background: #fbf6e8; color: #2a2a3a; padding: 30px 36px; border-radius: 3px; font-size: 20px; line-height: 1.5;
  box-shadow: 0 18px 50px rgba(0,0,0,0.45); transform: perspective(900px) rotateX(70deg) scaleY(0.2); opacity: 0; transition: transform 0.9s cubic-bezier(.2,.8,.2,1), opacity 0.6s;
  background-image: repeating-linear-gradient(#fbf6e8 0 29px, #e4dcc6 29px 30px); }
#letter.open .letter-paper { transform: none; opacity: 1; }
.letter-line { margin: 0 0 6px; animation: inkin 0.9s ease-out both; }
.letter-key { display: inline-block; margin: 4px 0; padding: 2px 10px; border: 2px dashed #a0402a; color: #a0402a; letter-spacing: 2px; font-family: 'Courier New', monospace; }
.letter-hint { opacity: 0; transition: opacity 0.6s; text-align: right; font-size: 12px; color: #998; font-family: 'Courier New', monospace; }
@keyframes inkin { from { opacity: 0; filter: blur(3px); clip-path: inset(0 100% 0 0); } to { opacity: 1; filter: none; clip-path: inset(0 0 0 0); } }
#credits-roll { position: absolute; inset: 0; z-index: 440; overflow: hidden; pointer-events: none; }
#credits-roll .cr-inner { position: absolute; left: 50%; transform: translateX(-50%); width: 520px; text-align: center; color: #fff; text-shadow: 0 2px 6px rgba(0,0,0,0.7); top: 100%; animation: roll 21s linear forwards; }
#credits-roll h1 { font-size: 40px; letter-spacing: 6px; margin-bottom: 4px; }
#credits-roll h3 { margin-top: 38px; color: #ffe0a0; letter-spacing: 3px; font-size: 14px; text-transform: uppercase; }
#credits-roll p { margin: 6px 0; }
#credits-roll .cr-last { margin-top: 60px; font-size: 22px; }
@keyframes roll { to { transform: translate(-50%, calc(-100% - 100vh)); } }
#credits { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); background: rgba(0,0,0,0.85); border: 2px solid #4a9eff; border-radius: 12px; padding: 30px 40px; color: #d8d8e8; text-align: center; z-index: 450; pointer-events: auto; font-family: 'Courier New', monospace; }

/* field guide (how to play) */
#field-guide { position: absolute; top: 120px; left: 14px; width: 380px; max-width: calc(100% - 28px); z-index: 95; background: rgba(6,10,22,0.88); border: 1px solid #4a9eff; border-radius: 10px; padding: 12px 14px; color: #d8e2f4; font-size: 13px; line-height: 1.45; animation: chromein 0.8s ease-out both; transition: opacity 0.6s; box-shadow: 0 0 22px rgba(30,80,160,0.3); }
#field-guide.out { opacity: 0; }
#field-guide .fg-h { color: #8fb8ff; font-size: 12px; letter-spacing: 1px; margin-bottom: 8px; display: flex; flex-direction: column; }
#field-guide .fg-h span { color: #667; font-size: 10px; letter-spacing: 0; margin-top: 2px; }
#field-guide .fg-row { display: flex; gap: 10px; margin: 5px 0; }
#field-guide .fg-i { color: #ffd75e; width: 14px; flex: none; }
#field-guide .fg-keys { margin-top: 8px; font-size: 10px; color: #778; }
.j-guide { margin-top: 6px; } .j-guide summary { cursor: pointer; color: #2a5aa0; font-weight: bold; }

#credits-roll .cr-disclaimer { margin-top: 46px; font-size: 13px; color: #ffe8c0; font-style: italic; }
#credits-roll .cr-last small { font-size: 14px; color: #ffe0a0; }
#credits-roll h3 { color: #ffd060; text-shadow: 0 0 6px #000, 0 2px 4px #000; }
#credits-roll p { text-shadow: 0 0 6px rgba(0,0,0,0.9), 0 2px 4px #000; }

/* credits roll: readable on the bright morning sky — dimmed backdrop + glass panel */
#credits-roll { background: linear-gradient(90deg, transparent 0%, rgba(4,6,16,0.45) 28%, rgba(4,6,16,0.55) 50%, rgba(4,6,16,0.45) 72%, transparent 100%); }
#credits-roll .cr-inner { width: 560px; max-width: 88vw; padding: 34px 38px 44px; border-radius: 16px;
  background: rgba(6,10,24,0.78); border: 1px solid rgba(255,208,96,0.35); box-shadow: 0 20px 60px rgba(0,0,0,0.55);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
#credits-roll h1 { color: #ffffff; }
#credits-roll h3 { margin-top: 30px; }
#credits-roll p { color: #eef2ff; }

/* boss briefing (over the frozen arena) */
#hunt-brief { position: absolute; inset: 0; z-index: 465; pointer-events: auto; background: radial-gradient(ellipse at 55% 50%, rgba(0,0,0,0.05) 0%, rgba(2,0,8,0.55) 75%); }
#hunt-brief .hb-panel { position: absolute; left: 14px; top: 160px; bottom: 14px; width: 430px; max-width: calc(100% - 28px); overflow-y: auto;
  background: rgba(8,4,18,0.92); border: 1px solid #c070ff; border-radius: 12px; padding: 18px 20px; color: #ece4ff; font-size: 14px; line-height: 1.45; box-shadow: 0 0 40px rgba(150,60,255,0.25); }
.hb-kicker { font-size: 12px; letter-spacing: 4px; color: #ffc94a; }
.hb-goal { font-size: 18px; margin: 8px 0 14px; color: #fff; }
.hb-step { display: flex; gap: 12px; margin: 10px 0; align-items: flex-start; }
.hb-ico { flex: none; width: 30px; height: 30px; border-radius: 6px; position: relative; }
.hb-ico.tok { background: #ffc94a; clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); box-shadow: 0 0 12px #ffc94a; }
.hb-ico.feed { background: #2a2238; border: 2px solid #c070ff; box-shadow: inset 0 6px 0 #c070ff; }
.hb-ico.think { border-radius: 50%; border: 3px solid #9fd0ff; box-shadow: 0 0 0 5px rgba(159,208,255,0.25); }
.hb-ico.heart { color: #ff3a6a; font-size: 26px; line-height: 30px; text-align: center; }
.hb-ico.heart::before { content: '\2665'; }
.hb-tip { margin-top: 12px; font-size: 13px; color: #b8a8d8; border-top: 1px solid #3a2a5a; padding-top: 10px; }
#hunt-brief kbd { display: inline-block; padding: 1px 6px; border-radius: 4px; background: #241a38; border: 1px solid #6a4a9a; border-bottom-width: 3px; font-family: 'Courier New', monospace; font-size: 12px; color: #fff; }
.hb-go { margin-top: 14px; width: 100%; padding: 12px; font-size: 18px; font-weight: bold; font-family: 'Courier New', monospace; color: #12061f; background: linear-gradient(#e0b8ff, #b07aff); border: none; border-radius: 10px; cursor: pointer; display: flex; justify-content: space-between; }
.hb-go span { font-size: 13px; opacity: 0.75; align-self: center; }
.hb-again { margin-top: 8px; font-size: 12px; color: #887; text-align: center; }
.hb-call { position: absolute; display: flex; align-items: center; gap: 8px; pointer-events: none; animation: chromein 0.5s ease-out both; }
.hb-call.left { transform: translateX(-100%); flex-direction: row-reverse; }
.hb-num { width: 26px; height: 26px; flex: none; border-radius: 50%; background: #ffc94a; color: #1a1000; font-weight: bold; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 12px rgba(255,201,74,0.7); }
.hb-lbl { background: rgba(8,4,18,0.9); border: 1px solid #ffc94a; color: #fff; padding: 4px 10px; border-radius: 6px; font-size: 13px; white-space: nowrap; }

.hb-intro { margin: 8px 0 4px; font-size: 13.5px; color: #d8ccf4; }
.hb-intro b { color: #fff; }
.hb-goal { font-size: 17px; margin: 10px 0 10px; }
#hunt-brief .hb-panel { top: 140px; width: 520px; font-size: 13px; line-height: 1.4; padding: 14px 18px 0; display: flex; flex-direction: column; }
#hunt-brief .hb-step { margin: 7px 0; }
#hunt-brief .hb-intro { font-size: 13px; }
#hunt-brief .hb-go { position: sticky; bottom: 0; margin-top: 10px; box-shadow: 0 -10px 18px rgba(8,4,18,0.95); }
#hunt-brief .hb-again { padding-bottom: 12px; }
