* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  background-color: #0d0e10;
  color: #e0e0e0;
  font-family: 'VT323', monospace;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 40px 20px;
  flex-direction: column;
  gap: 24px;
}

/* Envoltorio principal para la antena y el Pulse-P */
.device-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 50px;
}

/* Antena Retráctil */
.antenna-container {
  position: absolute;
  top: -55px;
  left: 35px;
  width: 16px;
  height: 70px;
  cursor: pointer;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.antenna-tip {
  width: 14px;
  height: 14px;
  background: radial-gradient(circle at 30% 30%, #666, #222);
  border-radius: 50%;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.antenna-rod {
  width: 6px;
  height: 55px;
  background: linear-gradient(90deg, #888, #fff 50%, #444);
  transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  transform-origin: bottom center;
  transform: translateY(45px); /* Oculta en estado APAGADO */
  border-radius: 2px;
}

.antenna-container.extended .antenna-rod {
  transform: translateY(0px); /* Extendida en estado ENCENDIDO */
}

.antenna-label {
  position: absolute;
  top: -22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.85rem;
  color: #ffaa00;
  white-space: nowrap;
  pointer-events: none;
  letter-spacing: 1px;
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* Carcasa del Pulse-P (Aspecto de Hardware) */
.pager-casing {
  position: relative;
  z-index: 2;
  background: linear-gradient(145deg, #2e3238, #1c1e22);
  border: 3px solid #141618;
  border-radius: 20px;
  padding: 24px;
  width: 360px;
  box-shadow: 
    0 20px 40px rgba(0, 0, 0, 0.8),
    inset 0 2px 3px rgba(255, 255, 255, 0.15),
    inset 0 -3px 6px rgba(0, 0, 0, 0.6);
}

.pager-casing::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: 18px;
  background: repeating-linear-gradient(
    45deg,
    rgba(0,0,0,0.03),
    rgba(0,0,0,0.03) 2px,
    transparent 2px,
    transparent 4px
  );
  pointer-events: none;
}

/* Rejilla de altavoz lateral */
.speaker-grille {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  align-items: center;
}

.speaker-slot {
  height: 4px;
  flex: 1;
  background: #111;
  border-radius: 2px;
  box-shadow: inset 0 1px 1px rgba(0,0,0,0.8);
}

/* Botón PIP integrado en la carcasa */
.pip-btn {
  background: #15171a;
  color: #ffaa00;
  border: 1px solid #33373e;
  border-radius: 4px;
  font-family: 'VT323', monospace;
  font-size: 0.85rem;
  padding: 1px 6px;
  cursor: pointer;
  margin-left: 8px;
  box-shadow: 0 2px 0 #111;
  transition: all 0.1s ease;
}

.pip-btn:hover {
  background: #25282e;
  color: #fff;
}

.brand-title {
  font-size: 1.1rem;
  letter-spacing: 2px;
  color: #9aa0a6;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
}

.brand-title span {
  background: #15171a;
  color: #777;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.85rem;
  border: 1px solid #2a2d32;
}

/* Pantalla LCD Apagada vs Encendida */
.lcd-screen {
  background-color: #2b3327;
  color: #384233;
  border: 4px solid #141618;
  border-radius: 8px;
  padding: 10px 12px;
  height: 135px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: inset 0 0 15px rgba(0,0,0,0.7);
  font-size: 1.35rem;
  overflow: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
  cursor: pointer;
}

/* Estado Encendido de la pantalla */
.pager-casing.power-on .lcd-screen {
  background-color: #8b956d;
  color: #1b2e1b;
  box-shadow: inset 0 0 10px rgba(0,0,0,0.2), 0 0 12px rgba(139, 149, 109, 0.3);
}

.screen-header {
  display: flex;
  justify-content: space-between;
  font-size: 1rem;
  border-bottom: 1px dashed rgba(27, 46, 27, 0.3);
  padding-bottom: 2px;
}

.screen-body {
  flex: 1;
  display: flex;
  align-items: center;
  overflow: hidden;
  width: 100%;
  position: relative;
}

.marquee-track {
  display: flex;
  white-space: nowrap;
  width: max-content;
}

.screen-body.marquee .marquee-track {
  animation: marqueeContinuous 10s linear infinite;
}

.text-block {
  padding-right: 50px;
}

@keyframes marqueeContinuous {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.screen-footer {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  border-top: 1px dashed rgba(27, 46, 27, 0.3);
  padding-top: 2px;
}

/* Controles */
.controls {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: all 0.3s ease;
}

.input-group {
  display: flex;
  gap: 8px;
}

input[type="text"] {
  background: #141618;
  border: 1px solid #33373e;
  border-radius: 6px;
  color: #8b956d;
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  padding: 8px 12px;
  width: 100%;
  outline: none;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}

input[type="text"]:focus {
  border-color: #8b956d;
}

button {
  background: linear-gradient(180deg, #42464e, #2a2d33);
  color: #d0d0d0;
  border: 1px solid #181a1d;
  border-radius: 6px;
  font-family: 'VT323', monospace;
  font-size: 1.2rem;
  padding: 8px 16px;
  cursor: pointer;
  box-shadow: 0 4px 0 #121315, 0 5px 8px rgba(0,0,0,0.5);
  transition: all 0.05s ease;
  white-space: nowrap;
}

button.disconnect-state {
  background: linear-gradient(180deg, #8a3434, #571e1e);
  color: #ffcccc;
  border-color: #3b1111;
}

button:active:not(:disabled) {
  box-shadow: 0 1px 0 #121315, 0 2px 4px rgba(0,0,0,0.5);
  transform: translateY(3px);
}

button:disabled, input:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  filter: grayscale(1);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: #552222;
}

.pager-casing.power-on .status-dot {
  background: #ff4444;
}

.pager-casing.power-on .status-dot.connected {
  background: #44ff44;
  box-shadow: 0 0 6px #44ff44;
}

.pip-placeholder {
  color: #555;
  font-size: 1.5rem;
  text-align: center;
  padding: 20px;
  border: 2px dashed #333;
  border-radius: 12px;
}

/* ESTILOS ESPECÍFICOS PARA MODO FLOTANTE (PIP) */
body.is-pip-mode {
  padding: 0;
  margin: 0;
  background: #0d0e10;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

body.is-pip-mode .device-wrapper {
  margin-top: 0;
  width: 100%;
  padding: 8px;
}

body.is-pip-mode .antenna-container,
body.is-pip-mode .speaker-grille,
body.is-pip-mode .brand-title,
body.is-pip-mode .connect-group {
  display: none !important;
}

body.is-pip-mode .pager-casing {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  width: 100%;
}

body.is-pip-mode .pager-casing::before {
  display: none;
}

body.is-pip-mode .lcd-screen {
  height: 110px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.8);
}

/* Ocultar input por defecto en PIP */
body.is-pip-mode .controls {
  display: none;
  margin-top: 8px;
}

/* Desplegar input en PIP cuando está activo */
body.is-pip-mode .controls.pip-active {
  display: flex;
}

.click-hint {
  display: none;
  font-size: 0.75rem;
  opacity: 0.7;
}

body.is-pip-mode .click-hint {
  display: inline;
}

/* Footer horizontal con estética retro */
.app-footer {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-family: 'VT323', monospace;
  font-size: 1rem;
  color: #666e75;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.footer-separator {
  color: #384233;
}

/* Ocultar footer si la ventana pasa a modo PIP */
body.is-pip-mode .app-footer {
  display: none !important;
}
