:root {
  --teal-color: #129eaa;
  --bg-white: #ffffff;
  --text-black: #000000;
  --bg-light-gray: #f4f7f6;
  --card-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, sans-serif; }

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
  background-color: var(--bg-light-gray);
  overflow: hidden;
}

/* CABECERA CON STATUS BADGE */
.app-header {
  background-color: var(--teal-color);
  padding: 12px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}
.app-header h1 {
  color: var(--text-black);
  font-size: 1.4rem;
  font-style: italic;
}

.server-status {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.25);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: bold;
  color: #000;
}
.status-dot {
  width: 8px;
  height: 8px;
  background-color: #00ff66;
  border-radius: 50%;
  margin-right: 6px;
  box-shadow: 0 0 8px #00ff66;
}

/* ESTRUCTURA */
.body-wrapper {
  display: flex;
  flex-direction: column-reverse;
  flex: 1;
  overflow: hidden;
}

/* BARRA DE NAVEGACIÓN */
.app-nav {
  background-color: var(--teal-color);
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  align-items: center;
  padding: 8px 0;
  z-index: 10;
}
.nav-item {
  color: var(--bg-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  padding: 6px 12px;
  transition: 0.2s;
  border-radius: 12px;
  font-size: 1.2rem;
}
.nav-item span {
  font-size: 0.7rem;
  margin-top: 3px;
  font-weight: 600;
}
.nav-item:hover, .nav-item.active {
  color: var(--text-black);
  background-color: rgba(255,255,255,0.25);
}

/* ÁREA DE CONTENIDO Y TARJETA TARJETA CARD */
.app-content {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  overflow-y: auto;
}

.screen { display: none; width: 100%; justify-content: center; }
.screen.active { display: flex; }

.main-card {
  background: var(--bg-white);
  width: 100%;
  max-width: 420px;
  padding: 30px 25px;
  border-radius: 25px;
  box-shadow: var(--card-shadow);
  text-align: center;
  border: 1px solid rgba(0,0,0,0.05);
}

.card-header {
  margin-bottom: 25px;
  color: var(--teal-color);
}
.tv-icon-main {
  font-size: 2.5rem;
  margin-bottom: 8px;
}
.card-header h3 {
  color: var(--text-black);
  font-size: 1.2rem;
}

/* INPUTS */
.input-section { margin-bottom: 20px; width: 100%; }
.input-section h2 { font-size: 1.8rem; font-style: italic; margin-bottom: 6px; color: var(--text-black); }
.input-section input { width: 100%; background-color: var(--teal-color); color: var(--text-black); border: none; border-radius: 30px; padding: 12px 20px; font-size: 1.05rem; font-style: italic; font-weight: bold; text-align: center; outline: none; transition: 0.2s; }
.input-section input:focus { box-shadow: 0 0 0 3px rgba(18, 158, 170, 0.4); }
.input-section input::placeholder { color: rgba(0,0,0,0.5); }

/* BOTONES */
.btn-connect { background-color: var(--text-black); color: white; width: 100%; padding: 14px; border-radius: 30px; font-size: 1.1rem; border: none; cursor: pointer; font-weight: bold; margin-top: 10px; transition: 0.2s; }
.btn-connect:hover { background-color: #222; transform: translateY(-2px); }
.btn-connect:active { transform: scale(0.98); }

/* CONEXIÓN RÁPIDA */
.recent-connection {
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px dashed #ddd;
  font-size: 0.85rem;
  color: #666;
  cursor: pointer;
  transition: 0.2s;
}
.recent-connection:hover { color: var(--teal-color); }

/* MANDO Y CONTROLES */
.loader { border: 4px solid #f3f3f3; border-top: 4px solid var(--teal-color); border-radius: 50%; width: 50px; height: 50px; animation: spin 1s linear infinite; margin: 20px auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.option-card { width: 100%; background: var(--teal-color); padding: 18px; margin: 10px 0; border-radius: 18px; cursor: pointer; font-weight: bold; color: black; display: flex; align-items: center; justify-content: center; gap: 10px; }
.option-card.secondary { background: #e0f2f1; }

.dpad { position: relative; width: 200px; height: 200px; background: #f0f0f0; border-radius: 50%; margin: 15px auto; }
.dpad-btn { position: absolute; background: var(--teal-color); border: none; border-radius: 50%; width: 50px; height: 50px; font-size: 1.1rem; cursor: pointer; font-weight: bold; display: flex; justify-content: center; align-items: center; }
.btn-up { top: 8px; left: 75px; } .btn-down { bottom: 8px; left: 75px; } .btn-left { left: 8px; top: 75px; } .btn-right { right: 8px; top: 75px; }
.btn-ok { width: 60px; height: 60px; background: black; color: white; top: 70px; left: 70px; z-index: 10; }

.control-row { display: flex; justify-content: space-around; width: 100%; margin-top: 15px; }
.btn-action { width: 45%; padding: 12px; background: var(--teal-color); border: none; font-weight: bold; border-radius: 12px; cursor: pointer; }

/* PC MEDIA QUERY (PANTALLAS GRANDES) */
@media (min-width: 768px) {
  .body-wrapper { flex-direction: row; }
  .app-nav { flex-direction: column; justify-content: flex-start; width: 90px; padding-top: 25px; }
  .nav-item { margin-bottom: 20px; }
}

/* ========================================================
   ESTILOS PARA LA VENTANA EMERGENTE (MODAL SCREENKEY TV)
   ======================================================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px); /* Efecto borroso elegante al fondo */
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  padding: 20px;
  animation: fadeIn 0.3s ease-out;
}

.modal-card {
  background: var(--bg-white);
  max-width: 400px;
  width: 100%;
  padding: 30px 25px;
  border-radius: 25px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  animation: slideUp 0.3s ease-out;
}

.modal-icon-wrapper {
  background-color: var(--teal-color);
  width: 70px;
  height: 70px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 15px auto;
}

.modal-icon { font-size: 2.2rem; color: #000; }
.modal-card h2 { color: #000; margin-bottom: 10px; font-size: 1.5rem; }
.modal-card p { color: #444; font-size: 0.95rem; line-height: 1.4; margin-bottom: 22px; }

.modal-actions { display: flex; flex-direction: column; gap: 10px; }

.btn-download {
  background-color: var(--teal-color);
  color: #000;
  font-weight: bold;
  padding: 14px;
  border-radius: 20px;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: 0.2s;
}
.btn-download:hover { background-color: #0d838d; }

.btn-close-modal {
  background-color: #f0f0f0;
  color: #333;
  border: none;
  padding: 12px;
  border-radius: 20px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
}
.btn-close-modal:hover { background-color: #e0e0e0; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(30px); } to { transform: translateY(0); } }
