html, body { margin: 0; height: 100%; overflow: hidden; background: #0b1018; }
#world { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: default; }
#ui { position: fixed; inset: 0; pointer-events: none; color: #f6efe2; font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif; -webkit-font-smoothing: antialiased; }
#ui [hidden] { display: none !important; }
#ui.bare > :not(#photo):not(#toast) { visibility: hidden; }

#loading { position: absolute; inset: 0; display: grid; place-items: center; background: #0b1018; letter-spacing: 0.24em; text-transform: uppercase; font-size: 12px; transition: opacity 1.2s ease; }
#loading.gone { opacity: 0; }
#loading p { opacity: 0.72; max-width: 88ch; text-align: center; white-space: pre-wrap; padding: 0 24px; }

#title { position: absolute; inset: 0; display: flex; align-items: center; padding: 0 8vw; background: linear-gradient(90deg, rgba(8, 14, 24, 0.55), rgba(8, 14, 24, 0.12) 52%, transparent 74%); transition: opacity 1.4s ease; }
#title.gone { opacity: 0; pointer-events: none; }
#title .words { pointer-events: auto; max-width: 560px; }
#title.gone .words { pointer-events: none; }
#title h1 { margin: 0; font-weight: 400; font-size: clamp(52px, 8.4vw, 124px); letter-spacing: 0.06em; line-height: 1; text-shadow: 0 2px 34px rgba(0, 0, 0, 0.35); }
#title .def { margin: 18px 0 40px; font-size: clamp(16px, 1.5vw, 21px); opacity: 0.9; text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6); }
#title button { font: inherit; font-size: 15px; letter-spacing: 0.3em; text-transform: uppercase; color: inherit; background: rgba(255, 244, 224, 0.08); border: 1px solid rgba(255, 244, 224, 0.62); padding: 16px 38px 16px 42px; cursor: pointer; backdrop-filter: blur(8px); transition: background 0.35s, color 0.35s; }
#title button:hover, #title button:focus-visible { background: #f6efe2; color: #172030; outline: none; }
#title .small { margin-top: 34px; font-size: 13px; opacity: 0.74; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8); }

#hud { position: absolute; inset: 0; transition: opacity 2s ease; }
#hud.quiet { opacity: 0.18; }
#compass { position: absolute; top: 18px; left: 50%; width: 560px; max-width: 80vw; transform: translateX(-50%); }
#gauge { position: absolute; left: 28px; bottom: 22px; display: flex; gap: 22px; font-size: 14px; font-variant-numeric: tabular-nums; opacity: 0.72; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.75); }
#clue { position: absolute; right: 28px; bottom: 22px; font-size: 13px; font-style: italic; opacity: 0; transition: opacity 1.6s; text-shadow: 0 1px 8px rgba(0, 0, 0, 0.75); }
#clue.show { opacity: 0.75; }

#region, #found, #chime, #toast { position: absolute; left: 50%; transform: translateX(-50%); text-align: center; opacity: 0; text-shadow: 0 1px 18px rgba(0, 0, 0, 0.65), 0 0 3px rgba(0, 0, 0, 0.35); width: max-content; max-width: 90vw; }
#region { top: 17vh; transition: opacity 1.8s ease; }
#region span { display: inline-block; font-size: clamp(26px, 3.3vw, 46px); font-style: italic; padding: 0 26px 12px; background: linear-gradient(90deg, transparent, rgba(255, 244, 224, 0.75), transparent) bottom / 100% 1px no-repeat; }
#region.show { opacity: 1; }
#found { bottom: 11vh; transition: opacity 1.4s ease; display: flex; flex-direction: column; gap: 6px; }
#found small { font-size: 11px; letter-spacing: 0.38em; text-transform: uppercase; opacity: 0.85; }
#found strong { font-weight: 400; font-size: clamp(30px, 4vw, 56px); letter-spacing: 0.02em; }
#found em { font-size: 16px; opacity: 0.92; }
#found.show { opacity: 1; }
#chime { bottom: 27vh; font-size: 13px; letter-spacing: 0.3em; text-transform: uppercase; transition: opacity 0.5s; color: #ffe2a8; }
#chime.show { opacity: 0.95; }
#toast { top: 90px; font-size: 14px; transition: opacity 0.5s; }
#toast.show { opacity: 0.95; }

#prompt, #warn, #wake, #witness { position: absolute; opacity: 0; text-shadow: 0 1px 10px rgba(0, 0, 0, 0.85), 0 0 3px rgba(0, 0, 0, 0.6); }
#prompt, #warn, #wake { left: 50%; transform: translateX(-50%); width: max-content; max-width: 90vw; text-align: center; }
#prompt { bottom: 54px; font-size: 13px; letter-spacing: 0.1em; transition: opacity 0.6s; }
#prompt.show { opacity: 0.85; }
#warn { top: 128px; font-size: 18px; font-style: italic; color: #ffc3ad; transition: opacity 0.5s; }
#warn.show { opacity: 1; }
#wake { top: 40vh; font-size: clamp(20px, 2.4vw, 32px); font-style: italic; transition: opacity 2s; }
#wake.show { opacity: 0.96; }
#witness { right: 28px; top: 92px; display: flex; flex-direction: column; gap: 4px; max-width: min(340px, 70vw); text-align: right; transition: opacity 1.4s; }
#witness small { font-size: 10px; letter-spacing: 0.34em; text-transform: uppercase; opacity: 0.72; }
#witness strong { font-weight: 400; font-size: 23px; font-style: italic; }
#witness em { font-style: normal; font-size: 13px; line-height: 1.5; opacity: 0.92; }
#witness.show { opacity: 1; }
#breath { position: absolute; left: 50%; bottom: 34px; width: 150px; height: 3px; transform: translateX(-50%); background: rgba(255, 244, 224, 0.18); opacity: 0; transition: opacity 0.5s; box-shadow: 0 0 8px rgba(0, 0, 0, 0.5); }
#breath i { display: block; height: 100%; margin: 0 auto; background: #ffe2a8; }
#breath.blown i { background: #ff9d86; }
#breath.show { opacity: 0.9; }

.sheet { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); box-sizing: border-box; width: min(940px, 92vw); max-height: 88vh; overflow: auto; padding: 34px 42px; background: rgba(13, 20, 33, 0.76); backdrop-filter: blur(22px) saturate(1.2); border: 1px solid rgba(255, 244, 224, 0.18); pointer-events: auto; }
.sheet h2 { margin: 0 0 16px; font-weight: 400; font-size: 30px; font-style: italic; }
.sheet p { font-size: 14px; line-height: 1.55; opacity: 0.82; }
#keys { width: min(680px, 92vw); }
#keys dl { display: grid; grid-template-columns: minmax(150px, 220px) 1fr; gap: 9px 22px; margin: 0 0 18px; font-size: 14px; }
#keys dt { opacity: 0.65; }
#keys dd { margin: 0; }
.spread { display: flex; gap: 28px; flex-wrap: wrap; align-items: flex-start; }
#chart { width: 360px; max-width: 100%; height: auto; aspect-ratio: 1; border-radius: 50%; background: rgba(255, 244, 224, 0.035); }
#journal ol { list-style: none; margin: 0; padding: 0; flex: 1 1 280px; max-height: 360px; overflow: auto; display: flex; flex-direction: column; gap: 16px; }
#journal li { display: flex; flex-direction: column; gap: 2px; }
#journal li strong { font-weight: 400; font-size: 20px; }
#journal li small { font-size: 10px; letter-spacing: 0.28em; text-transform: uppercase; opacity: 0.6; }
#journal li em { font-size: 13px; opacity: 0.82; }
#journal .small { font-size: 12px; opacity: 0.55; margin-bottom: 0; }
#journal .lower { margin-top: 18px; }
#journal section { flex: 1 1 320px; }
#journal h3 { margin: 0 0 10px; font-weight: 400; font-size: 12px; letter-spacing: 0.3em; text-transform: uppercase; opacity: 0.65; }
#journal section ol { max-height: 220px; }
#journal section li strong { font-size: 17px; font-style: italic; }
#journal section li em { font-style: normal; line-height: 1.5; }

#photo { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: max-content; max-width: 92vw; text-align: center; font-size: 12px; padding: 8px 18px; background: rgba(13, 20, 33, 0.55); border: 1px solid rgba(255, 244, 224, 0.16); }

@media (max-width: 700px) {
  #clue, #title .small { display: none; }
  .sheet { padding: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  #region, #found, #title, #loading, #hud { transition-duration: 0.2s; }
}
