:root {
  --bg-panel: rgba(15, 19, 24, 0.84);
  --bg-panel-1945: rgba(24, 19, 14, 0.88);
  --border-2024: rgba(94, 198, 206, 0.42);
  --border-1945: rgba(226, 165, 76, 0.55);
  --accent-2024: #5ec6ce;
  --accent-1945: #e2a54c;
  --text-main: #edf2f4;
  --text-muted: #a9b4bd;
  --danger: #e06c58;
  --ok: #6cc88b;
}

* {
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0c0e;
  color: var(--text-main);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

#canvas-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Top HUD bar */
#hud-top {
  position: fixed;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  pointer-events: none;
  z-index: 20;
}

.hud-card {
  pointer-events: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border-2024);
  border-radius: 10px;
  padding: 10px 14px;
  backdrop-filter: blur(8px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  transition: border-color 0.35s ease, background 0.35s ease;
}

body.mode-1945 .hud-card {
  background: var(--bg-panel-1945);
  border-color: var(--border-1945);
}

#title-card h1 {
  margin: 0 0 2px 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

#title-card .subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

#mode-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  background: rgba(94, 198, 206, 0.16);
  color: var(--accent-2024);
  border: 1px solid var(--border-2024);
}

body.mode-1945 #mode-badge {
  background: rgba(226, 165, 76, 0.18);
  color: var(--accent-1945);
  border-color: var(--border-1945);
}

#controls-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.btn-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.hud-btn {
  pointer-events: auto;
  cursor: pointer;
  border: 1px solid var(--border-2024);
  background: rgba(21, 30, 38, 0.92);
  color: var(--text-main);
  padding: 9px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: transform 0.12s ease, background 0.25s ease, border-color 0.25s ease;
}

.hud-btn:hover {
  transform: translateY(-1px);
  background: rgba(34, 48, 60, 0.95);
}

.hud-btn.nav-jump {
  padding: 5px 9px;
  font-size: 11.5px;
  opacity: 0.9;
}

.hud-btn.primary-toggle {
  border-color: var(--accent-1945);
  background: linear-gradient(135deg, rgba(60, 42, 20, 0.94), rgba(32, 24, 16, 0.95));
  color: #ffe2b0;
  box-shadow: 0 0 16px rgba(226, 165, 76, 0.25);
}

body.mode-1945 .hud-btn.primary-toggle {
  background: linear-gradient(135deg, rgba(168, 102, 24, 0.95), rgba(92, 54, 14, 0.95));
  color: #fff6e6;
  box-shadow: 0 0 22px rgba(226, 165, 76, 0.45);
}

/* Status telemetry in 1945 mode */
#status-panel {
  display: flex;
  gap: 14px;
  font-size: 12px;
  align-items: center;
}

.stat-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 90px;
}

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.6px;
}

.progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 65%;
  background: var(--accent-1945);
  transition: width 0.25s ease, background 0.25s ease;
}

/* Crosshair & interaction prompt */
#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 10px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.22);
  pointer-events: none;
  z-index: 15;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

#crosshair.active {
  transform: translate(-50%, -50%) scale(1.45);
  border-color: var(--accent-1945);
  background: rgba(226, 165, 76, 0.35);
}

#interact-prompt {
  position: fixed;
  top: calc(50% + 24px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12, 16, 20, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
  z-index: 18;
  display: none;
  text-align: center;
  max-width: 360px;
}

#interact-prompt .key-pill {
  display: inline-block;
  padding: 1px 6px;
  margin-right: 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 11px;
}

/* Bottom controls help */
#hud-bottom {
  position: fixed;
  bottom: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
  z-index: 20;
}

#controls-hint {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

#controls-hint strong {
  color: var(--text-main);
}

/* Start / PointerLock overlay */
#start-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(16, 20, 25, 0.72), rgba(7, 9, 12, 0.92));
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 20px;
}

#start-overlay.hidden {
  display: none;
}

#start-box {
  max-width: 580px;
  width: 100%;
  background: rgba(17, 22, 28, 0.95);
  border: 1px solid var(--border-2024);
  border-radius: 14px;
  padding: 26px 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
}

#start-box h2 {
  margin: 0 0 8px 0;
  font-size: 22px;
}

#start-box p {
  margin: 0 0 14px 0;
  font-size: 14px;
  line-height: 1.55;
  color: #cfd8df;
}

.start-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 12.5px;
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
  border-radius: 8px;
}

.start-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-enter {
  cursor: pointer;
  padding: 11px 20px;
  border-radius: 8px;
  border: none;
  background: var(--accent-2024);
  color: #081316;
  font-size: 14px;
  font-weight: 700;
}

.btn-enter.alt-1945 {
  background: var(--accent-1945);
  color: #1c1205;
}

/* Inspection Modal */
#inspect-modal {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 10, 0.72);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}

#inspect-modal.open {
  display: flex;
}

#inspect-card {
  max-width: 560px;
  width: 100%;
  max-height: 82vh;
  overflow-y: auto;
  background: #14181e;
  border: 1px solid var(--border-1945);
  border-radius: 12px;
  padding: 22px 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.75);
}

#inspect-card h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
  color: var(--accent-1945);
}

#inspect-body {
  font-size: 14px;
  line-height: 1.6;
  color: #dde3e8;
  white-space: pre-line;
}

#inspect-actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Binoculars / Observation Slit Overlay */
#binoculars-overlay {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 14;
  display: none;
}

#binoculars-overlay.active {
  display: block;
}

#binoculars-mask {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse 34% 46% at 50% 50%,
    transparent 62%,
    rgba(0, 0, 0, 0.72) 72%,
    rgba(0, 0, 0, 0.96) 86%
  );
}

#binoculars-reticle {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 240px;
  height: 140px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(226, 165, 76, 0.45);
  border-radius: 50%;
}

#binoculars-reticle::before,
#binoculars-reticle::after {
  content: "";
  position: absolute;
  background: rgba(226, 165, 76, 0.42);
}

#binoculars-reticle::before {
  left: 50%;
  top: 8px;
  bottom: 8px;
  width: 1px;
}

#binoculars-reticle::after {
  top: 50%;
  left: 12px;
  right: 12px;
  height: 1px;
}

#binoculars-info {
  position: absolute;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(12, 16, 20, 0.88);
  border: 1px solid var(--border-1945);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  text-align: center;
  color: #ffe3b3;
}

/* Mobile touch controls */
#touch-controls {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  display: none;
}

#touch-controls.visible {
  display: block;
}

#joystick-zone {
  position: absolute;
  bottom: 26px;
  left: 26px;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.24);
  pointer-events: auto;
  touch-action: none;
}

#joystick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 46px;
  height: 46px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(94, 198, 206, 0.55);
  border: 2px solid #ffffff;
}

#touch-actions {
  position: absolute;
  bottom: 28px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: auto;
}

.touch-btn {
  padding: 12px 16px;
  border-radius: 10px;
  background: rgba(15, 20, 26, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

/* Toast notification */
#toast {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 24, 30, 0.94);
  border: 1px solid var(--accent-1945);
  color: #fff1d6;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  z-index: 60;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

#toast.visible {
  opacity: 1;
}

@media (max-width: 720px) {
  .start-grid {
    grid-template-columns: 1fr;
  }
  #hud-top {
    flex-direction: column;
    align-items: stretch;
  }
  #controls-right {
    align-items: flex-start;
  }
  .btn-row {
    justify-content: flex-start;
  }
}

/* Lens vignette over the 3D view (desktop / mobile only; not rendered inside the VR headset) */
#vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 52%, rgba(0, 0, 0, 0.42) 100%);
}

#loading-note {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.btn-enter:disabled {
  opacity: 0.45;
  cursor: progress;
}
