:root {
  --bg: #0b1020; --card: rgba(15, 20, 38, .92); --line: rgba(255,255,255,.12);
  --txt: #e8ecf5; --mute: #94a3b8; --accent: #3b82f6; --danger: #ef4444; --ok: #22c55e;
  --term: #39ff88; --term-bg: #031208;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--txt);
  font-family: Inter, system-ui, sans-serif; }
#app canvas { display: block; }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }

/* ---------- pantallas ---------- */
.screen, .modal { position: fixed; inset: 0; display: grid; place-items: center; z-index: 50; }
#login { background: radial-gradient(ellipse at 30% 20%, #1e3a8a 0%, #0b1020 55%, #020409 100%); }
#pause, .modal { background: rgba(2, 4, 10, .55); backdrop-filter: blur(6px); }
.modal { z-index: 60; }
.card { width: min(380px, calc(100vw - 32px)); background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 12px;
  max-height: calc(100vh - 32px); overflow: auto; }
.card.wide { width: min(640px, calc(100vw - 32px)); }
.card h1 { margin: 0; font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.card h1 span { color: var(--accent); }
.card h2 { margin: 0; font-size: 22px; }
.sub { margin: 0; color: var(--mute); font-size: 14px; }
#loginLogo { width: 100%; max-height: 120px; object-fit: contain; border-radius: 10px; background: #fff; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--mute); }
input, select { font: inherit; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255,255,255,.06); color: var(--txt); outline: none; }
input:focus, select:focus { border-color: var(--accent); }
.primary { background: var(--accent); color: #fff; border: 0; padding: 12px; border-radius: 10px; font-weight: 600; }
.primary:hover { filter: brightness(1.1); }
.ghost { background: transparent; color: var(--txt); border: 1px solid var(--line); padding: 10px 12px; border-radius: 10px; }
.ghost:hover { background: rgba(255,255,255,.06); }
.ghost.danger { color: #fca5a5; }
.row { display: flex; gap: 10px; } .row > * { flex: 1; }
.error { color: #fca5a5; font-size: 13px; min-height: 18px; }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.grid.one { grid-template-columns: 1fr; }
.grid .full { grid-column: 1 / -1; }
.grid label.chk { flex-direction: row; align-items: center; gap: 8px; color: var(--txt); }
input[type=range] { padding: 0; accent-color: var(--accent); }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); }
.keys { border-collapse: collapse; font-size: 14px; }
.keys td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.keys td:first-child { color: var(--accent); white-space: nowrap; font-weight: 600; }

#loading { position: absolute; bottom: 12vh; text-align: center; color: var(--mute); }
#loading .bar { width: 280px; height: 6px; background: rgba(255,255,255,.1); border-radius: 3px; overflow: hidden; }
#loading .bar i { display: block; height: 100%; width: 30%; background: var(--accent); animation: load 1.2s infinite ease-in-out; }
@keyframes load { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%;
  background: rgba(255,255,255,.85); box-shadow: 0 0 0 1.5px rgba(0,0,0,.4); }
#prompt { position: absolute; left: 50%; top: calc(50% + 28px); transform: translateX(-50%); background: rgba(0,0,0,.6);
  padding: 6px 12px; border-radius: 8px; font-size: 14px; white-space: nowrap; border: 1px solid var(--line); }
#prompt b { background: #fff; color: #000; border-radius: 4px; padding: 0 6px; margin-right: 6px; }
#zoneLabel { position: absolute; top: 16px; left: 16px; font-weight: 600; font-size: 14px; text-shadow: 0 1px 3px #000;
  background: rgba(0,0,0,.35); padding: 6px 10px; border-radius: 8px; }
#stats { position: absolute; top: 16px; right: 16px; font-size: 12px; color: #cbd5e1; background: rgba(0,0,0,.35); padding: 6px 10px; border-radius: 8px; }
#hint { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); font-size: 12px; color: rgba(255,255,255,.65); text-shadow: 0 1px 2px #000; }
#toasts { position: absolute; top: 60px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toast { background: rgba(10,14,28,.9); border: 1px solid var(--line); padding: 8px 14px; border-radius: 10px; font-size: 14px;
  animation: tin .25s ease-out; }
.toast.err { border-color: rgba(239,68,68,.6); }
.toast.ok { border-color: rgba(34,197,94,.6); }
@keyframes tin { from { opacity: 0; transform: translateY(-8px); } }

/* ---------- pantallas de terminal superpuestas ---------- */
#screenOverlay { position: fixed; z-index: 20; overflow: hidden; border-radius: 6px; }
#screenInner { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#screenExit { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 21; font-size: 13px;
  background: rgba(0,0,0,.6); padding: 6px 12px; border-radius: 8px; color: #cbd5e1; }

.term { width: 100%; height: 100%; background: var(--term-bg); color: var(--term); font-family: VT323, monospace; font-size: 26px;
  padding: 22px 26px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.term::after { content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.25) 0 2px, transparent 2px 4px); }
.term h3 { margin: 0; font-weight: 400; font-size: 34px; border-bottom: 2px solid var(--term); padding-bottom: 6px; }
.term .muted { opacity: .65; }
.term input, .term select { background: transparent; border: 2px solid var(--term); color: var(--term); font-family: inherit;
  font-size: 24px; border-radius: 0; padding: 4px 10px; }
.term button { background: transparent; border: 2px solid var(--term); color: var(--term); font-family: inherit; font-size: 24px;
  padding: 6px 14px; }
.term button:hover, .term button:focus { background: var(--term); color: var(--term-bg); outline: none; }
.term button.big { font-size: 30px; padding: 12px; }
.term .err { color: #ff6b6b; } .term .ok { color: #9dffbf; }
.term .scroll { overflow: auto; flex: 1; min-height: 0; }
.term table { width: 100%; border-collapse: collapse; }
.term td, .term th { text-align: left; padding: 2px 6px; border-bottom: 1px dashed rgba(57,255,136,.3); font-weight: 400; }
.term .blink { animation: blink 1s steps(1) infinite; } @keyframes blink { 50% { opacity: 0; } }
.term .tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.term .tabs button { font-size: 20px; padding: 2px 10px; }
.term .tabs button.on { background: var(--term); color: var(--term-bg); }
.term .form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; }
.term .form label { color: var(--term); font-size: 20px; gap: 2px; }
.term .form label.chk { flex-direction: row; align-items: center; gap: 8px; }
.term input[type=color] { padding: 0; height: 34px; width: 100%; }
.term input[type=range] { accent-color: var(--term); }

/* reproductor de música (pantalla digital) */
.jukebox { width: 100%; height: 100%; background: linear-gradient(160deg, #1b1035, #07040f); color: #fff; padding: 22px;
  display: flex; flex-direction: column; gap: 14px; font-family: Inter, sans-serif; }
.jukebox h3 { margin: 0; font-size: 28px; }
.jukebox .now { display: flex; gap: 14px; align-items: center; background: rgba(255,255,255,.06); border-radius: 12px; padding: 10px; }
.jukebox .now img { width: 70px; height: 70px; border-radius: 8px; object-fit: cover; background: #333; }
.jukebox .albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; overflow: auto; flex: 1; min-height: 0; }
.jukebox .album { background: rgba(255,255,255,.05); border: 0; color: #fff; border-radius: 12px; padding: 8px; text-align: left; }
.jukebox .album:hover { background: rgba(255,255,255,.14); }
.jukebox .album img, .jukebox .album .ph { width: 100%; aspect-ratio: 1; border-radius: 8px; object-fit: cover; display: block;
  background: linear-gradient(135deg, #7c3aed, #db2777); }
.jukebox .album b { display: block; font-size: 14px; margin-top: 6px; } .jukebox .album small { opacity: .7; font-size: 12px; }
.jukebox .tracks { overflow: auto; flex: 1; min-height: 0; }
.jukebox .tracks button { display: block; width: 100%; text-align: left; background: none; border: 0; color: #fff; padding: 8px 10px; border-radius: 8px; font-size: 16px; }
.jukebox .tracks button:hover, .jukebox .tracks button.on { background: rgba(255,255,255,.12); }
.jukebox .ctrl { display: flex; gap: 8px; }
.jukebox .ctrl button { background: #fff; color: #111; border: 0; border-radius: 99px; padding: 8px 16px; font-weight: 600; }
.jukebox .rooms { font-size: 12px; opacity: .7; }
