/* =================================================================
   EXPEDIENTE AO-001 — styles.css
   Terminal premium. Azul claro / cian / negro. Expediente confidencial.
   ================================================================= */

:root {
  --black:      #060a10;
  --black-2:    #0c1219;
  --panel:      rgba(8, 22, 36, 0.62);
  --panel-line: rgba(0, 200, 232, 0.22);
  --accent:     #00c8e8;
  --accent-deep:#0a6e8a;
  --accent-glow:rgba(0, 200, 232, 0.35);
  --wash-bg:    #061018;
  --bone:       #e8f4f8;
  --bone-dim:   #8aa4b4;
  --bone-faint: rgba(232, 244, 248, 0.45);

  --font-head: 'Orbitron', 'Exo 2', system-ui, sans-serif;
  --font-body: 'Exo 2', system-ui, -apple-system, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --maxw: 32rem;

  --pad-x: max(1.25rem, env(safe-area-inset-left), env(safe-area-inset-right));
  --pad-top: calc(env(safe-area-inset-top, 0px) + 4.25rem);
  --pad-bottom: calc(env(safe-area-inset-bottom, 0px) + 1.75rem);
  --touch: 52px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { height: 100%; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--black);
  color: var(--bone);
  line-height: 1.55;
  min-height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
  overscroll-behavior: none;
}

button { font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* Capas de ambiente */
.fx-noise, .fx-scanlines, .fx-vignette, .fx-flash, .fx-wash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.fx-noise {
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: screen;
}

.fx-scanlines {
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px, rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.22) 3px, rgba(0, 0, 0, 0) 4px
  );
  opacity: 0.35;
}

.fx-vignette {
  background: radial-gradient(120% 110% at 50% 40%, transparent 55%, rgba(0, 0, 0, 0.85) 100%);
  z-index: 3;
}

.fx-flash {
  background: radial-gradient(120% 120% at 50% 50%, rgba(0, 200, 232, 0.45), rgba(0, 80, 120, 0.2));
  opacity: 0;
  z-index: 9;
  mix-blend-mode: screen;
}

.fx-wash {
  background: radial-gradient(120% 120% at 50% 0%, var(--wash-bg) 0%, #040810 60%, #020508 100%);
  opacity: 0;
  z-index: 1;
}

/* HUD */
.hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 6;
  padding: calc(env(safe-area-inset-top, 0px) + 0.75rem) 1rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
}
.hud.is-visible { opacity: 1; }

.hud__label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-head);
  font-size: 0.58rem;
  letter-spacing: 0.14em;
  color: var(--bone-dim);
  text-transform: uppercase;
}
#hudText {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.hud__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.6s infinite;
}

.hud__bar {
  height: 2px;
  width: 100%;
  background: rgba(232, 244, 248, 0.12);
  overflow: hidden;
}

.hud__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  box-shadow: 0 0 10px var(--accent);
  transition: width 0.8s var(--ease-out);
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.35; transform: scale(0.8); }
}

/* Audio toggle */
.sound-toggle {
  position: fixed;
  top: calc(env(safe-area-inset-top, 0px) + 0.55rem);
  right: max(0.85rem, env(safe-area-inset-right));
  z-index: 7;
  background: rgba(6, 10, 16, 0.72);
  border: 1px solid var(--panel-line);
  color: var(--bone-dim);
  font-family: var(--font-head);
  font-size: 0.52rem;
  letter-spacing: 0.12em;
  padding: 0.5rem 0.65rem;
  border-radius: 3px;
  min-height: var(--touch);
  min-width: var(--touch);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sound-toggle .sound-toggle__off { display: none; }
.sound-toggle.is-muted .sound-toggle__on  { display: none; }
.sound-toggle.is-muted .sound-toggle__off { display: inline; }

@media (max-width: 767px) {
  .sound-toggle { display: none !important; }
}

/* Pantallas */
.app { position: relative; height: 100%; min-height: 100dvh; }

.screen {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: none;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding: var(--pad-top) var(--pad-x) var(--pad-bottom);
}
.screen.is-active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.screen__inner {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.35rem;
}

/* Tipografia */
.kicker {
  font-family: var(--font-head);
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.9;
}
.kicker--ok { color: var(--bone); }

.title {
  font-family: var(--font-head);
  font-weight: 900;
  font-size: clamp(1.5rem, 7.5vw, 2.8rem);
  letter-spacing: 0.04em;
  line-height: 1.1;
  color: var(--bone);
  text-shadow: 0 0 22px var(--accent-glow);
}

.lead {
  font-size: clamp(1rem, 4.2vw, 1.05rem);
  color: var(--bone);
  max-width: 22rem;
  line-height: 1.45;
}

/* Intro — pantalla 1 */
.screen__inner--intro {
  gap: 1.1rem;
}

.intro-divider {
  width: 100%;
  max-width: 18rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--panel-line), transparent);
  opacity: 0.85;
}

.intro-reveal {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}
.intro-reveal[hidden] { display: none !important; }

.intro-body {
  width: 100%;
  max-width: 22rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}
.intro-body .ending__line,
.intro-body p {
  font-size: clamp(0.92rem, 3.8vw, 1rem);
  color: var(--bone);
  line-height: 1.5;
  text-align: center;
  width: 100%;
}

#introContinue[hidden] { display: none !important; }

.status-block {
  width: 100%;
  max-width: 20rem;
  text-align: center;
  padding: 0.85rem 1rem;
  border: 1px solid var(--panel-line);
  border-radius: 4px;
  background: rgba(0, 200, 232, 0.03);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.status-block__title {
  font-family: var(--font-head);
  font-size: 0.55rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bone-dim);
  margin-bottom: 0.65rem;
  text-align: center;
  width: 100%;
}
.status-line,
.status-block .ending__line {
  font-size: 0.88rem;
  color: var(--bone-dim);
  line-height: 1.6;
  letter-spacing: 0.02em;
  text-align: center;
  width: 100%;
}
.status-line--locked {
  color: var(--accent);
  font-weight: 600;
}

.terminal-card {
  width: 100%;
  max-width: 22rem;
  border: 1px solid var(--panel-line);
  border-left: 3px solid var(--accent);
  background: var(--panel);
  backdrop-filter: blur(4px);
  padding: 1.25rem 1.1rem;
  border-radius: 6px;
  text-align: center;
}

.ending__line--term {
  color: var(--bone-dim);
  font-size: 0.95rem;
}
.ending__line--code {
  font-family: var(--font-head);
  font-size: clamp(1.1rem, 5vw, 1.35rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.1em;
}
.ending__line--status {
  color: var(--accent);
  font-weight: 600;
}

.fineprint, .hint {
  font-size: 0.82rem;
  color: var(--bone-dim);
  max-width: 24rem;
}
.hint--muted { color: var(--bone-faint); font-style: italic; }
.fineprint { font-size: 0.7rem; letter-spacing: 0.06em; opacity: 0.7; }

/* Botones */
.btn {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--bone);
  background: transparent;
  border: 1px solid var(--accent-deep);
  padding: 1rem 1.4rem;
  border-radius: 4px;
  width: 100%;
  max-width: 20rem;
  min-height: var(--touch);
  transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.btn--primary {
  border-color: var(--accent);
  background: rgba(0, 200, 232, 0.08);
}
.btn--primary:hover,
.btn--primary:focus-visible,
.btn--primary:active {
  background: rgba(0, 200, 232, 0.18);
  box-shadow: 0 0 26px var(--accent-glow);
  outline: none;
}

@media (hover: none) {
  .btn--primary:active { transform: scale(0.97); }
}

.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Tarjeta de validación */
.report-card {
  width: 100%;
  max-width: 22rem;
  border: 1px solid var(--panel-line);
  border-left: 3px solid var(--accent);
  background: var(--panel);
  backdrop-filter: blur(4px);
  padding: 1.25rem 1.1rem;
  border-radius: 6px;
  text-align: center;
}

.ending {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  text-align: center;
  width: 100%;
}

.ending__line {
  font-size: clamp(1rem, 4.1vw, 1.08rem);
  color: var(--bone);
  opacity: 0;
  line-height: 1.55;
  text-align: center;
  width: 100%;
}
.ending__line--check {
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.ending__line--ask {
  margin-top: 0.5rem;
  color: var(--bone);
  font-weight: 600;
  border-top: 1px solid var(--panel-line);
  padding-top: 1rem;
}
.ending__line--title {
  font-family: var(--font-head);
  font-size: clamp(1.2rem, 5.5vw, 1.5rem);
  font-weight: 900;
  color: var(--accent);
  letter-spacing: 0.06em;
  text-shadow: 0 0 18px var(--accent-glow);
}

.caret {
  display: inline-block;
  width: 0.6ch;
  color: var(--accent);
  animation: blink 0.9s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* Pantalla final — momento culminante */
.screen--final .screen__inner {
  gap: 1.5rem;
}

/* Bloque frase WhatsApp (elemento visual principal) */
.phrase-reveal {
  width: 100%;
  max-width: 24rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}
.phrase-reveal[hidden] { display: none !important; }

.phrase-divider {
  width: 100%;
  max-width: 18rem;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.55;
}

.phrase-hero {
  width: 100%;
  padding: 1.6rem 1.35rem;
  border: 1px solid rgba(0, 200, 232, 0.55);
  border-radius: 8px;
  background: linear-gradient(
    160deg,
    rgba(0, 200, 232, 0.12) 0%,
    rgba(0, 200, 232, 0.04) 50%,
    rgba(6, 10, 16, 0.6) 100%
  );
  box-shadow:
    0 0 40px rgba(0, 200, 232, 0.22),
    inset 0 0 24px rgba(0, 200, 232, 0.06);
  animation: phrase-glow 3.5s ease-in-out infinite;
  position: relative;
}
.phrase-hero::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 8px;
  padding: 1px;
  background: linear-gradient(135deg, rgba(0, 200, 232, 0.5), transparent, rgba(0, 200, 232, 0.25));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

@keyframes phrase-glow {
  0%, 100% { box-shadow: 0 0 32px rgba(0, 200, 232, 0.2), inset 0 0 20px rgba(0, 200, 232, 0.05); }
  50%      { box-shadow: 0 0 56px rgba(0, 200, 232, 0.38), inset 0 0 28px rgba(0, 200, 232, 0.1); }
}

.phrase-text {
  font-family: var(--font-head);
  font-size: clamp(1.2rem, 6vw, 1.55rem);
  font-weight: 600;
  font-style: italic;
  color: var(--bone);
  line-height: 1.45;
  text-align: center;
  letter-spacing: 0.02em;
  text-shadow: 0 0 24px var(--accent-glow);
  position: relative;
  z-index: 1;
}

.btn--copy {
  margin-top: 0.25rem;
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(0, 200, 232, 0.2);
}

.copy-feedback {
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.06em;
}
.copy-feedback[hidden] { display: none !important; }

#finalHint[hidden] { display: none !important; }

.kicker, .title, .hint, .fineprint {
  width: 100%;
  text-align: center;
}

@media (min-width: 768px) {
  :root { --pad-x: 2rem; --pad-top: 5rem; --touch: 48px; }
  .btn { width: auto; min-width: 12rem; }
  .ending__line { font-size: 1.12rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .fx-scanlines, .fx-noise { display: none; }
}
