/* RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* BASE */
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial;
  background: #0f172a;
  color: white;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* CONTENEDOR GENERAL */
.container {
  width: 100%;
  max-width: 420px;
  padding: 24px;
  text-align: center;
}

/* TITULOS */
h1 {
  font-size: 28px;
  margin-bottom: 10px;
}

p {
  opacity: 0.7;
  margin-bottom: 30px;
}

/* BOTONES */
.btn {
  width: 100%;
  padding: 16px;
  margin: 10px 0;
  border-radius: 12px;
  border: none;
  font-size: 16px;
  cursor: pointer;
  transition: 0.2s;
}

.btn-primary {
  background: #3b82f6;
  color: white;
}

.btn-secondary {
  background: #1e293b;
  color: white;
}

.btn:hover {
  transform: scale(1.02);
  opacity: 0.9;
}

/* INPUT */
input {
  width: 50%;
  padding: 14px;
  border-radius: 10px;
  border: none;
  margin-bottom: 10px;
  font-size: 16px;
  text-align: center;
}

/* CODIGO */
.code {
  font-size: 32px;
  letter-spacing: 4px;
  margin: 20px 0;
}

/* LINK */
.link {
  margin-top: 10px;
  font-size: 14px;
  opacity: 0.7;
  word-break: break-all;
}

.semaforo {
  margin-top: 30px;
  background: #020617;
  padding: 20px;
  border-radius: 30px;
  width: 120px;
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
}

.light {
  width: 70px;
  height: 70px;
  margin: 12px auto;
  border-radius: 50%;
  transition: 0.3s;
  border: 2px solid rgba(255,255,255,0.05);
  /* border: 2px solid rgba(255,255,255); */
  opacity: 0.7;
}

/* COLORES BASE (apagados pero visibles) */
#red {
  background: #7f1d1d;
}

#orange {
  background: #78350f;
}

#green {
  background: #14532d;
}

/* ACTIVO = brillo */
#red.active {
  background: #ef4444;
  box-shadow: 0 0 25px #ef4444;
  opacity: 1;
}

#orange.active {
  background: #f59e0b;
  box-shadow: 0 0 25px #f59e0b;
  opacity: 1;
}

#green.active {
  background: #22c55e;
  box-shadow: 0 0 25px #22c55e;
  opacity: 1;
}

/* BOTONES SEMAFORO */
.controls {
  margin-top: 20px;
}

.controls button {
  font-size: 24px;
  margin: 0 8px;
  padding: 10px 14px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
}
.controls button.active {
  transform: scale(1.3);
  box-shadow: 0 0 10px rgba(255,255,255,0.3);
  border: 2px solid red;
}

/* INSTRUCCIÓN NARANJA - EMISOR */
.instruction-editor {
  margin-top: 28px;
}

.instruction-editor h2 {
  font-size: 20px;
  margin-bottom: 12px;
}

.instruction-editor textarea {
  width: 100%;
  min-height: 110px;
  padding: 14px;
  border-radius: 12px;
  border: none;
  resize: vertical;
  font-size: 16px;
  font-family: inherit;
  text-align: left;
}

.instruction-editor p {
  margin-top: 8px;
  margin-bottom: 0;
  font-size: 14px;
  opacity: 0.65;
}

/* INSTRUCCIÓN NARANJA - RECEPTOR */
.instruction-box {
  display: none;
  margin-top: 25px;
  padding: 20px;
  border-radius: 16px;
  background: #f59e0b;
  color: #111827;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.35);
}

.instruction-box.active {
  display: block;
}

.instruction-box h2 {
  margin-bottom: 10px;
  font-size: 22px;
}

.instruction-box p {
  margin: 0;
  opacity: 1;
  font-size: 18px;
  line-height: 1.4;
}

/* RESPONSIVE */
@media (max-width: 480px) {
  h1 {
    font-size: 22px;
  }

  .container {
    padding: 16px;
  }
}