/* Máquina Enigma — estilo baquelita y lámparas ámbar */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --fondo: #15130f;
  --panel: #221e17;
  --panel-borde: #3d362a;
  --texto: #e8e0cf;
  --tenue: #a89e88;
  --ambar: #ffb642;
  --ambar-suave: #7a5a1e;
  --tecla: #2e2a22;
  --tecla-borde: #57503f;
}

body {
  background: var(--fondo);
  color: var(--texto);
  font-family: Georgia, 'Times New Roman', serif;
  line-height: 1.5;
  min-height: 100vh;
}

.cabecera {
  text-align: center;
  padding: 1.6rem 1rem 0.8rem;
  border-bottom: 2px solid var(--ambar-suave);
}
.cabecera h1 {
  font-size: 2rem;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--ambar);
  text-shadow: 0 0 18px rgba(255, 182, 66, 0.35);
}
.subtitulo { color: var(--tenue); margin-top: 0.4rem; }

.contenedor {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-borde);
  border-radius: 10px;
  padding: 1.1rem;
}
.panel h2 {
  font-size: 1.05rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ambar);
  margin-bottom: 0.8rem;
}
.nota-h2 { color: var(--tenue); text-transform: none; letter-spacing: normal; font-size: 0.85rem; }

/* Ventanas de los rotores */
.maquina { text-align: center; padding: 0.8rem 0 0.2rem; }
.ventanas { display: flex; justify-content: center; gap: 1rem; }
.ventana {
  width: 72px; height: 92px;
  background: #0c0b09;
  border: 3px solid var(--panel-borde);
  border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  box-shadow: inset 0 3px 8px rgba(0,0,0,0.8);
}
.ventana span {
  font-family: 'Courier New', monospace;
  font-size: 2.2rem; font-weight: bold;
  color: var(--ambar);
}
.ventana small { color: var(--tenue); margin-top: 0.2rem; font-size: 0.75rem; }
.pie-ventanas, .pie-teclado { color: var(--tenue); font-size: 0.8rem; margin-top: 0.5rem; text-align: center; }

/* Campos */
.etiqueta { display: block; color: var(--tenue); font-size: 0.9rem; margin: 0.7rem 0 0.25rem; }
textarea, input[type="text"], select {
  width: 100%;
  background: #181510;
  color: var(--texto);
  border: 1px solid var(--panel-borde);
  border-radius: 6px;
  padding: 0.6rem;
  font-family: 'Courier New', monospace;
  font-size: 1rem;
}
textarea { resize: vertical; letter-spacing: 0.08em; }
#salida { color: var(--ambar); }
textarea:focus, input:focus, select:focus { outline: 1px solid var(--ambar-suave); }

/* Botones */
.botonera { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.9rem; }
.boton {
  border: none; border-radius: 6px;
  padding: 0.65rem 1.1rem;
  font-size: 0.95rem; font-weight: bold;
  cursor: pointer; color: #141210;
  transition: filter 0.15s;
}
.boton:active { transform: translateY(1px); }
.boton:hover { filter: brightness(1.12); }
.verde  { background: #57b25e; }
.rojo   { background: #c9564c; color: #fff; }
.morado { background: #9a6fd0; color: #fff; }
.azul   { background: #5a8fd6; color: #fff; }
.gris   { background: #8d8677; }

/* Selector de modo */
.modo { display: flex; gap: 0.6rem; }
.modo .boton {
  flex: 1;
  background: var(--tecla);
  color: var(--tenue);
  border: 1px solid var(--tecla-borde);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.modo .boton.activo {
  background: var(--ambar);
  color: #141210;
  border-color: var(--ambar);
}

/* Teclado y lámparas */
.teclado, .lamparas { margin-top: 1rem; display: flex; flex-direction: column; gap: 0.4rem; align-items: center; }
.fila { display: flex; gap: 0.35rem; justify-content: center; }
.tecla {
  width: 34px; height: 40px;
  background: var(--tecla);
  color: var(--texto);
  border: 1px solid var(--tecla-borde);
  border-bottom-width: 3px;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-size: 1rem; font-weight: bold;
  cursor: pointer;
}
.tecla:active { background: var(--ambar-suave); transform: translateY(2px); border-bottom-width: 1px; }
.lampara {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--tecla-borde);
  background: #1c1913;
  color: #6e6653;
  font-family: 'Courier New', monospace;
  font-size: 0.95rem; font-weight: bold;
  transition: all 0.12s;
}
.lampara.encendida {
  background: radial-gradient(circle, #ffe6b0 0%, var(--ambar) 70%);
  color: #141210;
  box-shadow: 0 0 18px 4px rgba(255, 182, 66, 0.55);
  border-color: var(--ambar);
}

/* Ajustes */
.rejilla {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.8rem;
}
fieldset {
  border: 1px solid var(--panel-borde);
  border-radius: 8px;
  padding: 0.7rem;
}
legend { color: var(--ambar); font-size: 0.9rem; padding: 0 0.4rem; }
fieldset label { display: block; font-size: 0.85rem; color: var(--tenue); margin-top: 0.45rem; }
fieldset input[type="text"] { text-transform: uppercase; text-align: center; margin-top: 0.2rem; }
label.radio { display: inline-block; margin-right: 1rem; color: var(--texto); }
label.radio input { margin-right: 0.3rem; }
.clavijas { margin-top: 0.8rem; }
.aviso { color: #e08a80; font-size: 0.8rem; margin-top: 0.4rem; min-height: 1em; }

.clave-actual {
  margin-top: 0.9rem;
  padding: 0.6rem;
  background: #181510;
  border: 1px dashed var(--ambar-suave);
  border-radius: 6px;
}
.clave-actual code { display: block; margin-top: 0.3rem; color: var(--ambar); word-break: break-word; }

/* Explicación */
.explicacion ol { margin-left: 1.3rem; }
.explicacion li { margin-bottom: 0.5rem; }
.explicacion p { color: var(--tenue); font-size: 0.9rem; margin-top: 0.6rem; }

.pie { text-align: center; color: var(--tenue); font-size: 0.8rem; padding: 1.2rem 1rem 2rem; }

/* Toast */
.toast {
  position: fixed;
  left: 50%; bottom: 24px;
  transform: translateX(-50%) translateY(80px);
  background: var(--ambar);
  color: #141210;
  font-weight: bold;
  padding: 0.6rem 1.2rem;
  border-radius: 24px;
  opacity: 0;
  transition: all 0.25s;
  pointer-events: none;
}
.toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 420px) {
  .cabecera h1 { font-size: 1.5rem; }
  .tecla, .lampara { width: 30px; }
  .tecla { height: 38px; }
  .ventana { width: 62px; height: 82px; }
}
