:root {
  --ink: #f2ebe0;
  --dim: rgba(242, 235, 224, .55);
  --cyan: #8ff4ef;
  --serif: "IM Fell English", Georgia, "Times New Roman", serif;
  --sc: "IM Fell English SC", "IM Fell English", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; color: var(--ink); overflow: hidden; overscroll-behavior: none; }
body { font-family: var(--serif); -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none; }
#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#world.point { cursor: pointer; }
#world.drag { cursor: grabbing; }

/* film: barely-there grain and a soft lens falloff */
#grain { position: fixed; inset: -50%; pointer-events: none; opacity: .045; mix-blend-mode: overlay; z-index: 2; }
#vignette { position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background: radial-gradient(ellipse at 50% 48%, transparent 55%, rgba(0,0,0,.55) 100%); }
#black { position: fixed; inset: 0; background: #000; pointer-events: none; z-index: 5; opacity: 1; transition: opacity .5s; }
#black.off { opacity: 0; }
#black.cut { transition: none; }

#caption { position: fixed; left: 0; right: 0; bottom: max(26px, env(safe-area-inset-bottom)); z-index: 3; text-align: center; pointer-events: none;
  opacity: 0; transform: translateY(6px); transition: opacity .35s, transform .35s; text-shadow: 0 0 12px #000, 0 0 3px #000; padding: 0 16px; }
#caption.on { opacity: 1; transform: none; }
#caption .t { display: block; font: 20px/1.2 var(--sc); letter-spacing: .14em; }
#caption .s { display: block; margin-top: 4px; font: italic 15px/1.3 var(--serif); color: var(--dim); }

button { font: inherit; color: var(--dim); background: rgba(0,0,0,.35); border: 1px solid rgba(242,235,224,.22); border-radius: 2px; cursor: pointer; }
button:hover { color: var(--ink); border-color: rgba(242,235,224,.5); }
#back { position: fixed; z-index: 4; left: max(14px, env(safe-area-inset-left)); top: max(14px, env(safe-area-inset-top)); width: 40px; height: 40px; font-size: 20px; }
#vr { position: fixed; z-index: 4; right: max(14px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); padding: 9px 14px; font: 14px/1 var(--sc); letter-spacing: .18em; }
#crouch { position: fixed; z-index: 4; left: max(14px, env(safe-area-inset-left)); bottom: max(14px, env(safe-area-inset-bottom)); padding: 8px 12px; font: italic 14px/1 var(--serif); opacity: .55; display: none; }
#crouch.on { opacity: 1; }
@media (pointer: coarse) { #crouch { display: block; } }
#sound { position: fixed; z-index: 4; right: max(14px, env(safe-area-inset-right)); top: max(14px, env(safe-area-inset-top)); padding: 8px 12px; font: italic 14px/1 var(--serif); }
#coins { position: fixed; z-index: 4; right: max(16px, env(safe-area-inset-right)); top: max(62px, calc(env(safe-area-inset-top) + 48px)); display: flex; align-items: center; gap: 8px;
  font: 17px/1 var(--sc); color: var(--cyan); text-shadow: 0 0 8px rgba(80, 255, 230, .5); }
#coins img { width: 30px; height: auto; }
#tapes { position: fixed; z-index: 4; right: max(16px, env(safe-area-inset-right)); top: max(100px, calc(env(safe-area-inset-top) + 86px)); display: flex; align-items: center; gap: 8px;
  font: 17px/1 var(--sc); color: #ffd9a0; text-shadow: 0 0 8px rgba(255, 190, 110, .5); }
#tapes i { width: 28px; height: 16px; border-radius: 2px; background: #111 linear-gradient(90deg, transparent 18%, #f0ead8 18% 82%, transparent 82%) no-repeat 0 3px / 100% 5px; box-shadow: inset 7px 9px 0 -4px #3a2a1a, inset -7px 9px 0 -4px #3a2a1a, 0 0 6px rgba(255, 190, 110, .4); }

#sheet { position: fixed; inset: 0; z-index: 6; background: rgba(0,0,0,.88); display: flex; flex-direction: column; align-items: center; }
#sheet .scroll { flex: 1; overflow: auto; width: 100%; display: flex; justify-content: center; padding: 24px 16px 0; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
#sheet img { width: min(860px, 100%); height: auto; align-self: flex-start; box-shadow: 0 0 60px rgba(0,0,0,.9); }
#sheet .close { margin: 10px 0 18px; font: italic 15px var(--serif); color: var(--dim); }

#scope { position: fixed; inset: 0; z-index: 6; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px; text-align: center; }
#scope .eye { width: min(72vh, 86vw); aspect-ratio: 1; border-radius: 50%; overflow: hidden; position: relative; opacity: 0; transform: scale(.96); transition: opacity .9s, transform 1.4s; box-shadow: 0 0 0 2px #111, 0 0 90px rgba(120,150,255,.08); }
#scope .eye::after { content: ''; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 60px 30px #000; }
#scope img { width: 100%; height: 100%; object-fit: cover; }
#scope.in .eye { opacity: 1; transform: none; }
#scope .title { margin: 18px 0 4px; font: 22px var(--serif); letter-spacing: .12em; color: #e8e4dc; font-variant: small-caps; }
#scope .text { max-width: 640px; margin: 0; font: italic 15px/1.45 var(--serif); color: #b8b4ac; }
#scope .credit { margin: 8px 0 0; font: 11px var(--serif); letter-spacing: .08em; color: #6a6660; }
#scope .more { margin: 14px 0 0; font: italic 13px var(--serif); color: var(--dim); }

#found { position: fixed; inset: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; justify-content: center; background: rgba(0,0,0,.7); }
#found .disc { width: min(300px, 64vw); aspect-ratio: 1; border-radius: 50%; overflow: hidden; box-shadow: 0 0 70px rgba(70, 255, 225, .25); }
#found video { width: 100%; height: 100%; object-fit: cover; }
#found .t { margin: 22px 0 0; font: 24px/1 var(--sc); letter-spacing: .2em; color: var(--cyan); text-shadow: 0 0 14px rgba(80,255,230,.5); }
#found .s { margin: 10px 0 0; font: italic 16px var(--serif); color: var(--dim); }

#wake, #loading { position: fixed; inset: 0; z-index: 7; display: flex; align-items: center; justify-content: center; background: #000; cursor: pointer; }
#wake p, #loading p { font: 22px var(--sc); letter-spacing: .3em; color: var(--cyan); text-shadow: 0 0 14px rgba(80,255,230,.55); }
#loading p { animation: breathe 3s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .35; } }
[hidden] { display: none !important; }

@media (max-width: 600px) {
  #caption .t { font-size: 17px; }
  #caption .s { font-size: 14px; }
}

/* ---------- tarot counter, spider sense, the help menu (js/hud.js) ---------- */
#tarot { position: fixed; z-index: 4; right: max(16px, env(safe-area-inset-right)); top: max(138px, calc(env(safe-area-inset-top) + 124px)); display: flex; align-items: center; gap: 8px;
  font: 17px/1 var(--sc); color: #e8c878; background: none; border: 0; padding: 0; cursor: pointer;
  text-shadow: 0 0 calc(8px + var(--s, 0) * 18px) rgba(232, 200, 120, calc(.5 + var(--s, 0) * .5)); }
#tarot i { width: 17px; height: 27px; border: 1.5px solid #c8a050; border-radius: 2px; background: #1a0a14 radial-gradient(circle at 50% 48%, #e8c878 0 2.5px, transparent 3px), #1a0a14;
  box-shadow: 0 0 calc(5px + var(--s, 0) * 16px) rgba(232, 200, 120, calc(.35 + var(--s, 0) * .6)); transform: rotate(-6deg); }
#tarot.tingle i { animation: tingle calc(1.3s - var(--s, 0) * .9s) ease-in-out infinite; }
#tarot.bump { animation: bump .9s ease-out; }
@keyframes tingle { 0%, 100% { transform: rotate(-6deg) scale(1); } 50% { transform: rotate(4deg) scale(1.16); } }
@keyframes bump { 0% { transform: scale(1.7); color: #fff; } 100% { transform: none; } }
#sense { position: fixed; inset: 0; z-index: 2; pointer-events: none; opacity: calc(var(--s, 0) * (.55 + var(--beat, 0) * .45)); transition: opacity .12s;
  background: radial-gradient(ellipse at 50% 50%, transparent 52%, rgba(200, 150, 60, .3) 74%, rgba(130, 40, 150, .55) 100%); }
#tarot { position: fixed; } #tarot em { position: absolute; right: 0; top: 34px; font: italic 13px var(--serif); color: #e8c878; white-space: nowrap; opacity: calc(.4 + var(--s, 0) * .6); letter-spacing: .02em; }
#help { position: fixed; z-index: 4; left: max(62px, calc(env(safe-area-inset-left) + 48px)); top: max(14px, env(safe-area-inset-top)); width: auto; min-width: 40px; height: 40px; padding: 0 13px 0 11px; display: flex; align-items: center; gap: 7px; font: 20px/1 var(--sc); }
#help span { font: 13px/1 var(--sc); letter-spacing: .18em; text-transform: uppercase; opacity: .85; }
body:has(#back[hidden]) #help { left: max(14px, env(safe-area-inset-left)); }
#helpPanel { position: fixed; inset: 0; z-index: 8; background: rgba(4, 3, 6, .82); display: flex; align-items: center; justify-content: center; padding: 18px; user-select: text; -webkit-user-select: text; }
#helpPanel[hidden] { display: none; }
#helpPanel .box { width: min(860px, 100%); max-height: 100%; display: flex; flex-direction: column; background: #0d0b10 linear-gradient(#141018, #0b090d); border: 1px solid rgba(200, 160, 80, .45); box-shadow: 0 0 0 4px #0d0b10, 0 0 0 5px rgba(200, 160, 80, .25), 0 20px 80px #000; }
#helpPanel header { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid rgba(200, 160, 80, .25); }
#helpPanel header > b { font: 19px var(--sc); letter-spacing: .2em; color: #e8c878; }
#helpPanel nav { display: flex; gap: 6px; flex: 1; }
#helpPanel nav button { padding: 5px 10px; font: italic 15px var(--serif); }
#helpPanel nav button.on { color: #e8c878; border-color: #c8a050; }
#helpPanel .x { width: 34px; height: 34px; font-size: 22px; }
#helpPanel .body { overflow: auto; padding: 6px 22px 18px; font: 15.5px/1.5 var(--serif); color: #ddd5c8; -webkit-overflow-scrolling: touch; }
#helpPanel footer { padding: 8px 16px; border-top: 1px solid rgba(200, 160, 80, .18); font: italic 13px var(--serif); color: var(--dim); }
#helpPanel h1 { font: 22px var(--sc); color: #e8c878; letter-spacing: .1em; }
#helpPanel h2, #helpPanel summary { font: 18px var(--sc); color: #e8c878; letter-spacing: .08em; margin: 18px 0 6px; }
#helpPanel summary { cursor: pointer; margin: 10px 0 4px; }
#helpPanel details { border-bottom: 1px solid rgba(200, 160, 80, .12); padding-bottom: 4px; }
#helpPanel b { color: #f2ebe0; }
#helpPanel ul { margin: 4px 0; padding-left: 20px; }
#helpPanel li { margin: 3px 0; }
#helpPanel table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 14px; }
#helpPanel th, #helpPanel td { border: 1px solid rgba(200, 160, 80, .2); padding: 5px 8px; text-align: left; vertical-align: top; }
#helpPanel th { color: #e8c878; font-weight: normal; font-family: var(--sc); }
#helpPanel hr { border: 0; border-top: 1px solid rgba(200, 160, 80, .2); }
#helpPanel .spoil { filter: blur(5px); cursor: pointer; transition: filter .3s; }
#helpPanel .spoil.shown { filter: none; }
#helpPanel .prog { font: 15px var(--sc); letter-spacing: .06em; margin: 10px 0; }
#helpPanel .prog .tp { color: #ffd9a0; } #helpPanel .prog .cn { color: var(--cyan); } #helpPanel .prog .tr { color: #e8c878; }
#helpPanel .lead { font-style: italic; color: #b8ae9e; }
#helpPanel .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-top: 10px; }
#helpPanel .card { aspect-ratio: .62; border: 1.5px solid rgba(200, 160, 80, .35); border-radius: 3px; padding: 8px 7px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; background: #120a12; }
#helpPanel .card b { font: 18px var(--sc); color: rgba(232, 200, 120, .5); }
#helpPanel .card span { font: 14px var(--sc); color: rgba(232, 200, 120, .45); margin-top: auto; }
#helpPanel .card em { font-size: 11.5px; line-height: 1.3; color: #9a8f80; margin-bottom: auto; }
#helpPanel .card.got { border-color: #c8a050; background: radial-gradient(ellipse at 50% 30%, #2a1a2e, #0e0a10); box-shadow: 0 0 14px rgba(232, 200, 120, .2); }
#helpPanel .card.got b, #helpPanel .card.got span { color: #e8c878; }
