/* APEX PWA Shell Stylesheet - Cascarón visual */
:root {
  --bg-dark: #05070a;
  --bg-card: #0e1217;
  --bg-card-hover: #151b24;
  --border: #1e2530;
  --border-focus: #ff3b2f;
  --red: #ff3b2f;
  --red-glow: rgba(255, 59, 47, 0.25);
  --gold: #ead08e;
  --gold-glow: rgba(234, 208, 142, 0.25);
  --green: #00e676;
  --green-glow: rgba(0, 230, 118, 0.25);
  --amber: #ffab00;
  --text: #f4f5f6;
  --text-muted: #8e99a4;
  --text-dim: #55606e;
  --font-main:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Archivo, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --radius: 14px;
}

/* Reset */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

/* Base */
html,
body {
  font-family: var(--font-main);
  font-size: 15px;
  line-height: 1.45;
  height: 100%;
  width: 100%;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

/* Cascarón PWA */
#pwa-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  position: relative;
  background: radial-gradient(circle at 50% 0%, #151c27 0%, #05070a 65%);
}

/* Pantallas */
.pwa-screen {
  display: none;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 16px;
}
.pwa-screen.activa {
  display: block;
  animation: fadeIn 0.25s ease-out;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Título */
.pwa-title {
  font-family: "Archivo", system-ui, sans-serif;
  color: var(--text);
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-align: center;
  margin: 16px 0;
}

/* Emblema */
.pwa-emblema {
  width: 100%;
  max-width: 140px;
  height: 140px;
  background: #fff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.15);
}
.pwa-emblema svg,
.pwa-emblema canvas {
  width: 100%;
  height: 100%;
}

/* Título de sección */
.pwa-section-title {
  font-family: "Archivo", system-ui, sans-serif;
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 24px;
}

/* Instrucciones */
.pwa-instruction {
  font-family: "Archivo", system-ui, sans-serif;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.5;
  margin-bottom: 24px;
}

/* Input código */
.pwa-input-wrapper {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}
.pwa-input-wrapper input {
  width: 100%;
  padding: 16px 20px;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: #fff;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  appearance: none;
  -webkit-appearance: none;
}
.pwa-input-wrapper input:focus {
  outline: none;
  border-color: var(--border-focus);
}

/* Botones */
.btn-apex-red {
  min-height: 48px;
  padding: 0 24px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-apex-red:active {
  background: #d40500;
  transform: translateY(1px);
}
.btn-apex-red:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

#vincular-enviar {
  min-height: 48px;
  padding: 0 24px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  margin-left: 8px;
}
#vincular-enviar:active {
  background: #d40500;
  transform: translateY(1px);
}
#vincular-enviar:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

#reintentar {
  min-height: 48px;
  padding: 0 24px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

/* Sin señal */
.pwa-no-signal {
  font-family: "Archivo", system-ui, sans-serif;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
  margin: 24px 0;
}

/* Mensaje estado */
#vincular-msg {
  font-family: "Archivo", system-ui, sans-serif;
  color: var(--text-muted);
  font-size: 13px;
  min-height: 1.4em;
  margin-top: 8px;
  text-align: center;
}

/* Responsive mobile-first @ 375px */
@media (max-width: 375px) {
  .pwa-screen {
    padding: 12px;
  }
  .pwa-title {
    font-size: 28px;
  }
  .pwa-section-title {
    font-size: 20px;
  }
  .pwa-instruction {
    font-size: 14px;
  }
  .pwa-input-wrapper input {
    padding: 14px 16px;
    font-size: 20px;
  }
  .btn-apex-red,
  #vincular-enviar,
  #reintentar {
    min-height: 44px;
    padding: 0 16px;
    font-size: 13px;
  }
  .pwa-input-wrapper input {
    min-height: 44px;
  }
}

/* Tablets */
@media (min-width: 376px) and (max-width: 768px) {
  .pwa-title {
    font-size: 30px;
  }
  .pwa-section-title {
    font-size: 22px;
  }
  .btn-apex-red,
  #vincular-enviar,
  #reintentar {
    min-height: 48px;
    padding: 0 20px;
    font-size: 14px;
  }
}

/* Prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0s;
    transition-duration: 0s;
  }
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.16);
  border-radius: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* Oculto */
[hidden] {
  display: none;
}
