/* ── Sistema de tokens ─────────────────────────────
   Fondo metal:  #101318
   Panel:        #1A1F27
   Línea:        #2C333E
   Texto:        #D7DCE4
   Acento óxido: #B23A2E   (rojo Doom apagado)
   Datos ámbar:  #E5A33B   (dígitos de HUD)
─────────────────────────────────────────────────── */
:root {
  --bg: #101318;
  --panel: #1A1F27;
  --line: #2C333E;
  --text: #D7DCE4;
  --muted: #8A93A1;
  --rust: #B23A2E;
  --amber: #E5A33B;
  --display: "Big Shoulders Display", sans-serif;
  --body: "IBM Plex Sans", sans-serif;
  --mono: "IBM Plex Mono", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--text); font-family: var(--body); }
.hidden { display: none !important; }
button {
  font-family: var(--mono); font-size: 13px; letter-spacing: .04em;
  background: transparent; color: var(--amber);
  border: 1px solid var(--amber); padding: 8px 16px; cursor: pointer;
}
button:hover { background: var(--amber); color: var(--bg); }
button:focus-visible, input:focus-visible, li:focus-visible {
  outline: 2px solid var(--amber); outline-offset: 2px;
}

/* ── Viewport 3D ── */
#viewport { position: fixed; inset: 0; }
#viewport canvas { display: block; }

/* ── Automapa ── */
#automap {
  position: fixed; right: 16px; bottom: 16px;
  width: 340px; height: 260px;
  background: rgba(10,12,16,.85);
  border: 1px solid var(--line);
}

/* ── Landing ── */
#landing {
  position: fixed; inset: 0; display: flex;
  align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(178,58,46,.14), transparent 60%),
    var(--bg);
}
#dropzone {
  width: min(560px, 92vw); padding: 48px 40px;
  border: 1px dashed var(--line); background: var(--panel);
  text-align: center;
}
#dropzone.dragover { border-color: var(--amber); }
#dropzone h1 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(52px, 9vw, 84px); line-height: .9;
  letter-spacing: .01em; color: var(--text);
}
#dropzone h1 span { color: var(--rust); font-weight: 600; }
#dropzone h2 {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(48px, 7vw, 68px);
  line-height: .9;
  letter-spacing: .01em;
  color: var(--text);
}
#dropzone h2 span { color: var(--rust); font-weight: 600; }
#dropzone .tag { color: var(--muted); margin: 10px 0 28px; font-size: 14px; }
.dz-inner p { font-size: 14px; color: var(--muted); margin-bottom: 16px; line-height: 1.5; }
.dz-inner b { color: var(--text); }
#loadedFiles { list-style: none; margin-top: 20px; font-family: var(--mono); font-size: 13px; }
#loadedFiles li { padding: 6px 0; border-top: 1px solid var(--line); }
#loadedFiles .kind { color: var(--amber); margin-right: 10px; }
#continueBtn { margin-top: 20px; border-color: var(--rust); color: var(--text); }
#continueBtn:hover { background: var(--rust); }
.privacy { margin-top: 26px; font-size: 12px; color: var(--muted); }

/* ── Selector de mapas ── */
#mapPicker {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(8,10,13,.8); z-index: 20;
}
#mapPicker .panel {
  width: min(480px, 92vw); max-height: 80vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); padding: 28px;
}
#mapPicker h2 { font-family: var(--display); font-weight: 600; font-size: 30px; margin-bottom: 16px; }
#mapList { list-style: none; margin-bottom: 20px; }
#mapList li {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 14px; cursor: pointer;
}
#mapList li:hover { background: rgba(229,163,59,.08); }
#mapList .fmt { color: var(--muted); font-size: 12px; }
#mapList .src { color: var(--rust); font-size: 12px; }

/* ── HUD ── */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#hud > div { pointer-events: auto; }
#hudTopLeft {
  position: absolute; top: 14px; left: 16px;
  font-family: var(--mono); display: flex; gap: 16px; align-items: baseline;
}
#hudMapName { color: var(--amber); font-size: 18px; font-weight: 600; letter-spacing: .06em; }
#hudFps { color: var(--muted); font-size: 12px; }
#hudTopRight {
  position: absolute; top: 14px; right: 16px;
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  justify-content: flex-end; max-width: min(720px, 80vw);
  font-family: var(--mono); font-size: 12px;
  background: rgba(16,19,24,.7); padding: 8px 12px; border: 1px solid var(--line);
}
#hudTopRight label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
#hudTopRight select {
  font-family: var(--mono); font-size: 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); padding: 2px 4px;
}
#hudTopRight button { padding: 4px 10px; font-size: 12px; }
#hudHelp {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono); font-size: 12px; color: var(--muted);
  background: rgba(16,19,24,.7); padding: 6px 14px; border: 1px solid var(--line);
  white-space: nowrap;
}

/* ── Carga ── */
#loading {
  position: fixed; inset: 0; z-index: 30;
  display: flex; flex-direction: column; gap: 18px;
  align-items: center; justify-content: center;
  background: rgba(8,10,13,.85);
}
.spinner {
  width: 42px; height: 42px; border: 3px solid var(--line);
  border-top-color: var(--rust); border-radius: 50%;
  animation: spin 1s linear infinite;
}
#loadingText { font-family: var(--mono); font-size: 13px; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.5s; } }

@media (max-width: 640px) {
  #hudHelp { display: none; }
  #automap { width: 60vw; height: 40vh; }
}
