/* ── BUNJUMUN-MAZE-95 ── Global Styles ─────────────────────────────── */

:root {
  --primary-brand:   #000080;   /* Win95 navy */
  --accent:          #C0C0C0;   /* Win95 silver */
  --warn:            #FF0000;
  --text-light:      #FFFFFF;
  --text-dark:       #000000;
  --border-light:    #FFFFFF;
  --border-dark:     #808080;
  --win95-bg:        #C0C0C0;
  --fog-color:       #000000;
  
  /* Win95 3D borders */
  --border-inset: inset -1px -1px #fff, inset 1px 1px #0a0a0a, inset -2px -2px #dfdfdf, inset 2px 2px #808080;
  --border-outset: inset -1px -1px #0a0a0a, inset 1px 1px #fff, inset -2px -2px #808080, inset 2px 2px #dfdfdf;
  --border-window: inset -1px -1px #0a0a0a, inset 1px 1px #dfdfdf, inset -2px -2px #808080, inset 2px 2px #fff;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--fog-color);
  font-family: 'Courier New', Courier, monospace;
}

/* ── Win95 Form Controls & UI Components ─────────────────────────────── */
button, input[type="button"], input[type="submit"] {
  background: var(--win95-bg);
  color: var(--text-dark);
  font-family: inherit;
  font-size: 14px;
  padding: 4px 12px;
  border: none;
  box-shadow: var(--border-outset);
  cursor: pointer;
  outline: none;
}

button:active, button.active, input[type="button"]:active {
  box-shadow: var(--border-inset);
  padding: 5px 11px 3px 13px; /* shift text down-right slightly */
}

button:disabled {
  color: #808080;
  text-shadow: 1px 1px 0 #fff;
  cursor: not-allowed;
}

button:focus, input:focus, textarea:focus, select:focus {
  outline: 1px dotted #000;
  outline-offset: -4px;
}

input[type="text"], input[type="password"], textarea {
  background: #fff;
  color: var(--text-dark);
  border: none;
  box-shadow: var(--border-inset);
  padding: 4px 6px;
  font-family: inherit;
  font-size: 14px;
}

/* ── Win95 Window Frame ─────────────────────────────────────────────── */
.win95-window {
  background: var(--win95-bg);
  box-shadow: var(--border-window);
  padding: 2px;
  display: flex;
  flex-direction: column;
}

.win95-titlebar {
  background: var(--primary-brand);
  color: var(--text-light);
  padding: 2px 4px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Win95 Scrollbars ───────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 16px;
  height: 16px;
  background: var(--win95-bg);
}

::-webkit-scrollbar-track {
  background: #dfdfdf;
  background-image: linear-gradient(45deg, #c0c0c0 25%, transparent 25%, transparent 75%, #c0c0c0 75%, #c0c0c0), 
                    linear-gradient(45deg, #c0c0c0 25%, transparent 25%, transparent 75%, #c0c0c0 75%, #c0c0c0);
  background-size: 2px 2px;
  background-position: 0 0, 1px 1px;
}

::-webkit-scrollbar-thumb {
  background: var(--win95-bg);
  box-shadow: var(--border-outset);
}

::-webkit-scrollbar-thumb:active {
  background: var(--win95-bg);
  box-shadow: var(--border-inset);
}

::-webkit-scrollbar-button {
  background: var(--win95-bg);
  box-shadow: var(--border-outset);
  display: block;
  width: 16px;
  height: 16px;
}

::-webkit-scrollbar-button:active {
  box-shadow: var(--border-inset);
}

/* ── Game Container & Canvas Layers ─────────────────────────────────── */
#game-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

.canvas-layer {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  transition: opacity 0.5s ease-in-out;
}

.canvas-active {
  opacity: 1;
  pointer-events: auto;
}

.canvas-hidden {
  opacity: 0;
  pointer-events: none;
}

#maze-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  z-index: 10;
}

#doom-container {
  z-index: 20;
  background: black;
}

#doom-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

/* ── DOOM Loading Overlay ─────────────────────────────────────────────── */
#doom-loading {
  position: fixed;
  inset: 0;
  background: black;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  gap: 16px;
}

.doom-load-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.doom-load-text {
  color: hsl(0, 100%, 50%);
  font-size: 18px;
  letter-spacing: 3px;
  animation: blink 1s step-end infinite;
}

.doom-spinner {
  width: 32px; height: 32px;
  border-radius: 50%;
  border-top: 4px solid hsl(0, 100%, 50%);
  border-right: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 4px solid transparent;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

#doom-progress {
  width: 300px;
  height: 18px;
  accent-color: hsl(0, 100%, 50%);
}

/* ── DOOM Win95 HUD ───────────────────────────────────────────────────── */
#doom-hud {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 400;
  min-width: 300px;
  font-size: 11px;
}

#doom-hud.canvas-hidden {
  display: none;
}

.doom-status-panel {
  display: flex;
  gap: 8px;
  padding: 4px 8px;
  background: var(--win95-bg);
}

.doom-status-box {
  border: 1px inset #808080;
  padding: 2px 6px;
  font-size: 10px;
}

#doom-exit-btn {
  background: var(--win95-bg);
  border: none;
  box-shadow: var(--border-outset);
  font-family: inherit;
  font-size: 10px;
  padding: 0 5px;
  cursor: pointer;
  line-height: 14px;
}

/* ── Mode Selector Screen ─────────────────────────────────────────────── */
#mode-selector {
  position: fixed;
  inset: 0;
  background: black;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  font-family: 'Courier New', Courier, monospace;
}

#mode-selector.hidden { display: none; }

.mode-window {
  background: var(--win95-bg);
  box-shadow: var(--border-window);
  width: min(92vw, 480px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.mode-titlebar {
  background: var(--primary-brand);
  color: #fff;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 1px;
}

.mode-body {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.mode-title {
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 4px;
  color: var(--primary-brand);
}

.mode-subtitle {
  font-size: 11px;
  color: #444;
  text-align: center;
}

.mode-buttons {
  display: flex;
  gap: 16px;
  width: 100%;
}

.mode-btn {
  flex: 1;
  padding: 20px 12px;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: 2px;
  background: var(--win95-bg);
  box-shadow: var(--border-outset);
  border: none;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.mode-btn:active { box-shadow: var(--border-inset); }

.mode-btn .mode-icon { font-size: 28px; }
.mode-btn .mode-label { font-size: 11px; color: #444; font-weight: normal; }

.mode-remember {
  font-size: 10px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ── Loading Screen ──────────────────────────────────────────────────── */
#loading {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  color: #C0C0C0;
}

.loading-text {
  font-size: 14px;
  letter-spacing: 3px;
  animation: blink 1s step-end infinite;
}

.loading-bar-wrap {
  margin-top: 20px;
  width: 300px;
  height: 16px;
  border: 2px inset #808080;
  background: #000;
}

.loading-bar {
  height: 100%;
  background: #000080;
  width: 0%;
  transition: width 0.3s;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ── HUD ─────────────────────────────────────────────────────────────── */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

#crosshair {
  color: rgba(255,255,255,0.6);
  font-size: 20px;
  line-height: 1;
  text-shadow: 0 0 4px #000;
  user-select: none;
}

/* FPS mode active — red crosshair */
body.fps-active #crosshair {
  color: rgba(255, 60, 60, 0.9);
  text-shadow: 0 0 6px #f00;
}

/* ── Settings Button ──────────────────────────────────────────────────── */
#settings-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  padding: 0;
  background: var(--win95-bg);
  color: var(--text-dark);
  border: none;
  box-shadow: var(--border-outset);
  font-size: 18px;
  font-family: inherit;
  cursor: pointer;
  pointer-events: all;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

#settings-btn:hover {
  background: #DFDFDF;
}

#settings-btn:active {
  box-shadow: var(--border-inset);
}

#settings-btn:focus {
  outline: 1px dotted #000;
  outline-offset: -4px;
}

#interact-hint {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.75);
  color: #C0C0C0;
  padding: 4px 12px;
  font-size: 11px;
  letter-spacing: 2px;
  border: 1px solid #808080;
}

/* ── Controls Hint ────────────────────────────────────────────────────── */
#controls-hint {
  position: fixed;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(192,192,192,0.45);
  font-size: 10px;
  letter-spacing: 1px;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

/* ── Minimap ──────────────────────────────────────────────────────────── */
#minimap {
  position: fixed;
  top: 12px;
  right: 12px;
  border: 2px solid #808080;
  image-rendering: pixelated;
  display: none;
  z-index: 200;
}

/* ── Pointer lock overlay ─────────────────────────────────────────────── */
#lock-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 500;
  color: #C0C0C0;
  gap: 16px;
  cursor: pointer;
}

#lock-overlay .title {
  font-size: 22px;
  letter-spacing: 4px;
  color: #fff;
}

#lock-overlay .sub {
  font-size: 11px;
  letter-spacing: 2px;
  opacity: 0.7;
}

#lock-overlay .hint {
  font-size: 10px;
  opacity: 0.5;
}

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

/* ── Exhibit Discovery Guide ──────────────────────────────────────────── */
#exhibit-guide {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  padding: 1rem;
  background: rgba(0, 0, 0, 0.85);
  border: 2px outset #ffffff;
  box-shadow: 2px 2px 0 #808080;
  font-family: 'MS Sans Serif', 'Courier New', Courier, monospace;
  color: #f7f7f7;
  z-index: 1000;
  width: 240px;
  font-size: 11px;
}

#exhibit-guide header {
  font-weight: bold;
  letter-spacing: 1px;
  margin-bottom: 8px;
  color: #ffff99;
}

#exhibit-guide.hidden {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.guide-button {
  display: block;
  width: 100%;
  margin-top: 0.75rem;
  background: #00aaff;
  border: 2px outset #0055aa;
  padding: 0.35rem 0.85rem;
  color: #fff;
  font-family: inherit;
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 1px;
  cursor: pointer;
  text-align: center;
}

.guide-button:active {
  border-style: inset;
}
