/* ---------------------------------------------------- */
/* ESTILOS DE LA CONSOLA Y FORMULARIOS */
/* ---------------------------------------------------- */
:root {
  --bg: #000;
  --text: #39ff14;
  --muted: #0b3b0b;
  --accent: #2ecc71;
  --error: #ff5f56;
  --mono: 'Courier New', Courier, monospace;
}

@keyframes lua-blink {
  0%, 100% { opacity: 1 }
  50% { opacity: 0 }
}

@keyframes lua-spin {
  to { transform: rotate(360deg) }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0 }

html, body {
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px;
}

/* HUD Container */
.lua-hud {
  width: min(80vw, 1500px);
  height: 90vh;
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.01));
  border: 1px solid rgba(57,255,20,.08);
  box-shadow: 0 8px 40px rgba(0,0,0,.7);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: var(--mono);
  color: var(--text);
}

.lua-view { display: none; width: 100%; height: 100%; flex-direction: column }
.lua-view.active { display: flex }

/* Login View */
.lua-login-view {
  justify-content: center;
  align-items: center;
  padding: 50px;
  text-align: center;
  background: var(--bg);
  /* 🌟 CLAVE: Asegura que los hijos se apilen verticalmente */
  flex-direction: column; 
}

.lua-login-view h2 {
  font-size: 30px;
  margin-bottom: 20px;
  text-shadow: 0 0 8px rgba(57,255,20,.7);
  text-transform: uppercase;
  color: var(--text);
}

.lua-login-view input {
  width: 100%;
  max-width: 300px;
  padding: 10px;
  /* 🌟 Espacio debajo de cada input */
  margin: 0 0 10px 0; 
  background: rgba(0,0,0,.5);
  border: 1px solid var(--text);
  color: var(--text);
  font-family: var(--mono);
  font-size: 20px;
  outline: none;
  box-shadow: 0 0 5px var(--muted);
  border-radius: 4px;
}

.lua-login-view button {
  max-width: 300px;
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  background: var(--text);
  border: none;
  color: var(--bg);
  font-family: var(--mono);
  font-weight: bold;
  font-size: 18px;
  cursor: pointer;
  transition: background .2s, box-shadow .2s;
  border-radius: 4px;
}

.lua-login-view button:hover:not(:disabled) {
  background: #0f0;
  box-shadow: 0 0 15px var(--text);
}

.lua-login-view button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.lua-login-message { color: var(--error); margin-top: 10px; min-height: 20px; font-size: 16px;}
.lua-login-message.success { color: var(--text) }

.lua-guest-link { color: rgba(57,255,20,.5); text-decoration: none; margin-top: 20px; font-size: 16px; display: block; cursor: pointer;}
.lua-guest-link:hover { color: var(--text) }


/* Tabs */
.lua-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.lua-tab {
  padding: 8px 20px;
  background: transparent;
  border: 1px solid var(--muted);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 14px;
  cursor: pointer;
  transition: all .2s;
  border-radius: 4px;
}

.lua-tab.active {
  border-color: var(--text);
  color: var(--text);
  box-shadow: 0 0 10px rgba(57,255,20,.3);
}

/* Form sections */
.lua-form-section { 
  display: none; 
  width: 100%; 
  align-items: center; 
  justify-content: center; 
  /* 🌟 CLAVE: Apila los inputs dentro del form */
  flex-direction: column; 
  max-width: 300px; 
}

.lua-form-section.active { display: flex }

/* Console Header and Logout button */
.lua-console-header {
  background: #020202;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(57,255,20,.1);
}

.lua-session-title {
  flex-grow: 1;
  font-weight: 700;
  letter-spacing: 1px;
  font-size: 18px;
  color: var(--text);
}

.lua-btn-logout {
  padding: 4px 8px;
  background: #c00;
  border: none;
  color: #fff;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: bold;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: 3px;
  transition: background .2s;
  box-shadow: 0 0 5px rgba(255,0,0,.5);
}

.lua-btn-logout:hover { background: #f00; box-shadow: 0 0 8px var(--error) }

/* Console Area */
.lua-console-area {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  font-size: 20px;
  line-height: 1.5;
  white-space: pre-wrap;
  background: var(--bg);
}

.lua-console-area div { word-break: break-all }

/* Command Prompt */
.lua-cmd {
  outline: none;
  border: none;
  display: block;
  width: 100%;
  min-height: 1.5em;
  caret-color: transparent;
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 20px;
}

.lua-cmd:focus::after {
  content: '_';
  animation: lua-blink 1s step-end infinite;
}

.lua-output { color: rgba(57,255,20,.7) }
.lua-error-msg { color: var(--error) }
.lua-console-footer { padding: 10px 16px; font-size: 16px; color: rgba(57,255,20,.7); background: #020202 }

/* Loading Spinner */
.lua-loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--muted);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: lua-spin .8s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}

@media (max-width: 600px) {
  .lua-hud { width: 95vw; height: 95vh; border-radius: 6px }
  .lua-console-area { padding: 14px; font-size: 16px }
  .lua-login-view { padding: 20px }
}