* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: #05070a;
  overflow: hidden;
  font-family: "Courier New", ui-monospace, monospace;
  color: #e9dfc4;
  -webkit-font-smoothing: antialiased;
}

#game-canvas {
  position: fixed;
  inset: 0;
  display: block;
  outline: none;
}

#hud,
#hud * {
  pointer-events: none;
}

#hud {
  position: fixed;
  inset: 0;
}

#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: rgba(233, 223, 196, 0.75);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.6);
}

#level-info {
  position: absolute;
  top: 22px;
  left: 26px;
  padding: 10px 16px;
  background: rgba(8, 10, 12, 0.55);
  border: 1px solid rgba(233, 223, 196, 0.25);
  border-left: 3px solid rgba(233, 223, 196, 0.6);
  letter-spacing: 0.06em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

#level-number {
  font-size: 12px;
  opacity: 0.7;
}

#level-name {
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 0.12em;
  margin: 2px 0;
}

#level-sub {
  font-size: 12px;
  opacity: 0.65;
}

#depth-bar {
  position: absolute;
  top: 50%;
  right: 22px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.depth-label {
  font-size: 11px;
  opacity: 0.55;
}

#depth-track {
  position: relative;
  width: 3px;
  height: 220px;
  background: rgba(233, 223, 196, 0.2);
}

#depth-marker {
  position: absolute;
  left: -4px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #ffb15a;
  box-shadow: 0 0 8px rgba(255, 177, 90, 0.9);
  transform: translateY(-50%);
}

#interact-prompt {
  position: absolute;
  bottom: 32%;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  background: rgba(8, 10, 12, 0.6);
  border: 1px solid rgba(233, 223, 196, 0.35);
  font-size: 13px;
  letter-spacing: 0.08em;
}

#lore-panel {
  position: absolute;
  bottom: 60px;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 78vw);
  padding: 18px 22px;
  background: rgba(6, 8, 10, 0.82);
  border: 1px solid rgba(233, 223, 196, 0.3);
  border-top: 2px solid #ffb15a;
}

#lore-title {
  font-size: 13px;
  letter-spacing: 0.1em;
  opacity: 0.75;
  margin-bottom: 8px;
  text-transform: uppercase;
}

#lore-body {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
}

.lore-hint {
  margin-top: 10px;
  font-size: 11px;
  opacity: 0.5;
  text-align: right;
}

#start-screen,
#pause-screen {
  position: fixed;
  inset: 0;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, rgba(30, 28, 24, 0.85) 0%, rgba(3, 4, 5, 0.96) 100%);
  cursor: pointer;
  z-index: 10;
}

/* `display` must only be set while the element is NOT [hidden] - an ID rule
   that always sets `display: flex` would out-specificity the browser's
   default `[hidden] { display: none }` and the overlay would never hide. */
#start-screen:not([hidden]),
#pause-screen:not([hidden]) {
  display: flex;
}

.panel {
  max-width: 520px;
  padding: 34px 40px;
  text-align: center;
  border: 1px solid rgba(233, 223, 196, 0.25);
  background: rgba(10, 11, 13, 0.55);
}

.panel h1 {
  font-size: 42px;
  letter-spacing: 0.35em;
  margin: 0 0 6px;
  color: #f2e6c8;
  text-shadow: 0 0 18px rgba(255, 177, 90, 0.35);
}

.panel h2 {
  font-size: 24px;
  letter-spacing: 0.2em;
  margin: 0 0 10px;
}

.tagline {
  font-size: 13px;
  opacity: 0.65;
  margin: 0 0 22px;
  line-height: 1.5;
}

.controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 22px;
  font-size: 13px;
  margin-bottom: 26px;
  text-align: left;
}

.controls div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px dashed rgba(233, 223, 196, 0.2);
  padding-bottom: 4px;
}

.controls b {
  color: #ffb15a;
  letter-spacing: 0.05em;
}

.controls span {
  opacity: 0.7;
}

.cta {
  font-size: 13px;
  letter-spacing: 0.15em;
  padding: 10px;
  border: 1px solid rgba(255, 177, 90, 0.5);
  animation: pulse 2.4s ease-in-out infinite;
}

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

@media (max-width: 560px) {
  .controls {
    grid-template-columns: 1fr;
  }
  .panel {
    padding: 24px 22px;
  }
  #depth-bar {
    display: none;
  }
}

[hidden] { display: none !important; }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse, transparent 48%, rgba(9, 12, 10, .35)); }
#start-screen, #pause-screen { cursor: default; background: linear-gradient(90deg, rgba(13, 18, 16, .97), rgba(13, 18, 16, .86) 48%, rgba(13, 18, 16, .5)); }
#start-screen:not([hidden]) { justify-content: flex-start; padding: 5vw 9vw; }
.panel { text-align: left; border: 0; background: none; box-shadow: none; max-width: 540px; padding: 0; }
.eyebrow { color: #aea48a; font-size: 10px; letter-spacing: .22em; margin-bottom: 25px; }
h1 { font-family: Georgia, serif; font-weight: normal; font-size: clamp(80px, 12vw, 160px); letter-spacing: .17em; line-height: .9; margin: 0 0 20px; color: #ded9c7; }
.chapter { letter-spacing: .65em; font-size: 12px; margin: 0 0 34px 5px; color: #b8aa88; }
.tagline { font-family: Georgia, serif; font-size: 23px; line-height: 1.35; opacity: 1; margin-bottom: 15px; }
.intro { color: #9c9f92; font: 14px/1.7 system-ui, sans-serif; max-width: 370px; margin-bottom: 26px; }
.controls { font-size: 11px; gap: 12px 22px; margin-bottom: 25px; }
.controls b { color: #cec3a3; }
.controls div { border-bottom: 1px solid #aaaa8825; padding-bottom: 8px; gap: 8px; }
button.cta { width: 100%; cursor: pointer; color: #1c241e; background: #c8bc98; border: 1px solid #ddd0aa; font: 12px ui-monospace, monospace; letter-spacing: .16em; padding: 18px; text-align: left; animation: none; transition: background .2s; }
button.cta:hover { background: #e2d6b4; }
button.cta:disabled { opacity: .45; cursor: wait; }
button:focus-visible { outline: 2px solid #faf0cd; outline-offset: 5px; }
#status, #pause-status { font-size: 10px; line-height: 1.6; color: #acae9e; min-height: 17px; }
.credit { font: 10px/1.6 system-ui, sans-serif; color: #717d70; }
.menu-footer { position: absolute; bottom: 25px; left: 9vw; right: 5vw; display: flex; justify-content: space-between; font-size: 9px; letter-spacing: .17em; color: #8a907d; }
.silo-emblem { position: absolute; right: 4vw; width: 35vw; height: 65vh; overflow: hidden; opacity: .18; pointer-events: none; border-left: 1px solid #b5ac8d; border-right: 1px solid #b5ac8d; transform: skewY(-12deg); }
.silo-emblem i { display: block; height: 16.666%; border: 1px solid #b5ac8d; border-radius: 50%; }
#level-info { top: auto; bottom: 28px; left: 30px; border: 0; border-left: 2px solid #a99d7a; background: linear-gradient(90deg, #101812bc, transparent); padding: 8px 20px; }
#level-name { font-size: 19px; letter-spacing: .13em; margin: 6px 0; }
#level-number { font-size: 10px; color: #c8bc98; }
#depth-marker { background: #d4c7a2; box-shadow: 0 0 6px #d4c7a244; border-radius: 0; height: 3px; }
#crosshair { width: 3px; height: 3px; margin: -1.5px; opacity: .7; }
#lore-panel { bottom: 20%; max-height: 60vh; overflow-y: auto; border-top-color: #bcad83; background: #111a15f2; padding: 28px; }
#lore-body p { font: 16px/1.7 Georgia, serif; margin: 12px 0; }
@media (max-height: 720px) { h1 { font-size: 80px; } .chapter { margin-bottom: 15px; } .eyebrow { margin-bottom: 15px; } .intro { margin-bottom: 15px; } #start-screen { overflow-y: auto; } .menu-footer { display: none; } }
@media (max-width: 650px) { #start-screen:not([hidden]) { padding: 25px; } .silo-emblem { display: none; } .menu-footer { display: none; } .controls { grid-template-columns: 1fr 1fr; } .panel { max-width: 100%; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.panel h1 { font-family: Georgia, serif; font-weight: normal; font-size: clamp(80px, 12vw, 150px); letter-spacing: .17em; line-height: .9; margin: 0 0 20px; }
@media (max-height: 720px) { .panel h1 { font-size: 80px; } }

#mission-panel { position:absolute;top:24px;left:30px;width:min(340px,calc(100vw - 70px));padding:16px 18px;background:#101812e8;border-left:2px solid #bcae86; }
#mission-panel .eyebrow { margin-bottom:10px;font-size:9px; }
#mission-summary { font-size:13px;line-height:1.5;color:#ece3c7; }
#mission-steps { list-style:none;padding:0;margin:12px 0;font-size:11px;line-height:1.8;color:#a7aa9a; }
#mission-steps .current { color:#eed29a; }
#mission-steps .done { color:#a8c1a1; }
#mission-hint { font:12px/1.5 system-ui,sans-serif;color:#c8c9b9;margin:0; }
#save-notice { position:absolute;right:30px;bottom:28px;font-size:10px;max-width:260px;line-height:1.5;background:#101812dd;padding:8px 12px; }
button.secondary { margin-top:12px;background:transparent;color:#d8caac; }
button.secondary:hover { color:#1c241e; }
@media(max-height:600px) { #mission-panel { top:12px;padding:10px 14px; } #mission-steps { margin:5px 0; } #mission-panel .eyebrow { display:none; } }
@media(max-width:650px) { #mission-panel { left:15px; } #save-notice { right:15px;bottom:10px;max-width:170px; } #level-info { left:15px;bottom:52px; } #pause-screen .panel { padding:24px; } }

/* While a headset session runs the canvas shows both eyes side by side; the flat HUD has its own version inside the scene (js/xr/hud.js). */
body.in-headset #hud, body.in-headset #vignette { visibility: hidden; }
#vr-hint { margin-top: 12px; }

/* Travel to a department already visited, on the pause panel. */
.travel { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 14px 0 4px; align-items: center; }
.travel label { grid-column: 1 / -1; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: rgba(215, 205, 176, .7); }
.travel select { font: inherit; font-size: 13px; padding: 9px 10px; background: rgba(13, 15, 17, .9); color: #d7cdb0; border: 1px solid rgba(255, 177, 90, .35); }
.travel .cta { margin: 0; animation: none; }
