/* ============ Tokens ============ */
:root {
  --bg: #0b0f1a;
  --bg-elev: rgba(23, 29, 46, 0.72);
  --bg-elev-2: rgba(30, 38, 60, 0.9);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef2ff;
  --text-dim: #9aa6c4;
  --brand: #6d8bff;
  --brand-2: #7c5cff;
  --accent: #35d6a4;
  --danger: #ff6b81;
  --shadow: 0 24px 60px rgba(4, 8, 20, 0.55);
  --radius: 20px;
  --radius-sm: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

:root:not([data-theme="dark"]) {
  @media (prefers-color-scheme: light) {
    /* mantiene look oscuro; el diseño está pensado en dark */
  }
}

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

html { height: 100%; }
/* body crece con el contenido (min-height) para permitir SCROLL cuando haga falta */

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 80% -10%, rgba(124, 92, 255, 0.18), transparent 60%),
    radial-gradient(1000px 700px at -10% 110%, rgba(53, 214, 164, 0.12), transparent 55%),
    var(--bg);
  min-height: 100dvh;
  display: flex;
  align-items: safe center;   /* centra, pero si el contenido es alto no lo recorta (permite scroll) */
  justify-content: center;
  padding: 24px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
}

/* ============ Orbes de fondo ============ */
.bg-orbs { position: fixed; inset: 0; z-index: 0; pointer-events: none; filter: blur(60px); }
.orb { position: absolute; border-radius: 50%; opacity: 0.5; animation: float 18s var(--ease) infinite alternate; }
.orb--1 { width: 340px; height: 340px; background: var(--brand-2); top: -80px; right: -60px; }
.orb--2 { width: 280px; height: 280px; background: var(--brand); bottom: -100px; left: -80px; animation-delay: -6s; }
.orb--3 { width: 220px; height: 220px; background: var(--accent); top: 40%; left: 60%; opacity: 0.25; animation-delay: -12s; }
@keyframes float { to { transform: translate3d(30px, -40px, 0) scale(1.12); } }

/* ============ Layout ============ */
.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.app__header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand__logo {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; box-shadow: 0 8px 20px rgba(109, 139, 255, 0.4);
}
.brand__name { font-size: 1.05rem; letter-spacing: -0.02em; }

/* ============ Switch de modo ============ */
.mode-switch {
  position: relative;
  display: inline-flex;
  padding: 4px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  backdrop-filter: blur(12px);
}
.mode-switch__btn {
  position: relative; z-index: 1;
  border: 0; background: transparent; cursor: pointer;
  color: var(--text-dim);
  font: inherit; font-weight: 600; font-size: 0.85rem;
  padding: 8px 16px; border-radius: 999px;
  transition: color 0.35s var(--ease);
}
.mode-switch__btn.is-active { color: #fff; }
.mode-switch__thumb {
  position: absolute; top: 4px; left: 4px; z-index: 0;
  height: calc(100% - 8px);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 6px 16px rgba(109, 139, 255, 0.45);
  transition: transform 0.45s var(--ease-back), width 0.45s var(--ease-back);
}

/* ============ Vistas ============ */
.view { display: none; }
.view.is-active { display: block; animation: viewIn 0.55s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }

/* ============ Card ============ */
.card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.card--wizard { min-height: 420px; display: flex; flex-direction: column; overflow: hidden; }
.card__title { font-size: 1.6rem; letter-spacing: -0.03em; margin-bottom: 6px; }
.card__subtitle { color: var(--text-dim); font-size: 0.95rem; line-height: 1.5; margin-bottom: 24px; }

/* ============ Form / Field ============ */
.query-form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field__label { font-size: 0.8rem; font-weight: 600; color: var(--text-dim); }
.field__control {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease), background 0.3s var(--ease);
}
.field__control:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(109, 139, 255, 0.18);
  background: rgba(0, 0, 0, 0.35);
}
.field__icon { color: var(--text-dim); flex-shrink: 0; }
.field__input {
  flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 16px; padding: 14px 0; outline: none;
}
.field__input::placeholder { color: rgba(154, 166, 196, 0.6); }

/* Botón "Pegar" dentro del campo de correo */
.field__paste {
  display: inline-flex; align-items: center; gap: 5px;
  flex-shrink: 0;
  border: 0; cursor: pointer;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.07);
  font: inherit; font-size: 0.78rem; font-weight: 600;
  padding: 7px 11px; margin: 6px -6px 6px 0;
  border-radius: 9px;
  transition: color 0.2s var(--ease), background 0.2s var(--ease), transform 0.15s var(--ease-back);
}
.field__paste:hover { color: var(--text); background: rgba(255, 255, 255, 0.13); }
.field__paste:active { transform: scale(0.94); }
.field.has-error .field__control { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(255, 107, 129, 0.15); }
.field__error { font-size: 0.78rem; color: var(--danger); min-height: 0; opacity: 0; transform: translateY(-4px); transition: 0.3s var(--ease); }
.field.has-error .field__error { opacity: 1; transform: none; min-height: 1em; }

/* ============ Botones ============ */
.btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 0.98rem;
  padding: 14px 22px; border-radius: var(--radius-sm);
  transition: transform 0.25s var(--ease-back), box-shadow 0.3s var(--ease), filter 0.3s var(--ease);
  overflow: hidden;
}
.btn:active { transform: scale(0.97); }
.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 24px rgba(109, 139, 255, 0.4);
}
.btn--primary:hover { filter: brightness(1.08); box-shadow: 0 14px 30px rgba(109, 139, 255, 0.5); }
.btn--ghost {
  color: var(--text-dim);
  background: transparent;
  border: 1px solid var(--border-strong);
}
.btn--ghost:hover { color: var(--text); border-color: var(--text-dim); }
.btn.is-loading { pointer-events: none; }
.btn.is-loading .btn__label { opacity: 0; }
.btn__spinner {
  position: absolute; width: 20px; height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff; border-radius: 50%;
  opacity: 0; transition: opacity 0.2s;
}
.btn.is-loading .btn__spinner { opacity: 1; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Resultado ============ */
.result {
  margin-top: 22px; padding: 18px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(53, 214, 164, 0.12), rgba(109, 139, 255, 0.1));
  border: 1px solid rgba(53, 214, 164, 0.35);
  animation: resultIn 0.5s var(--ease-back) both;
}
@keyframes resultIn { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
.result__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.result__badge {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent);
  padding: 4px 10px; border-radius: 999px;
  background: rgba(53, 214, 164, 0.14);
}
.result__copy {
  border: 0; background: transparent; color: var(--text-dim); cursor: pointer;
  padding: 6px; border-radius: 8px; transition: 0.2s var(--ease);
}
.result__copy:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.result__code {
  font-size: 2rem; font-weight: 800; letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(135deg, #fff, var(--accent));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.result__meta { margin-top: 6px; font-size: 0.82rem; color: var(--text-dim); }

/* Variantes de estado */
.result--warn { background: linear-gradient(135deg, rgba(255, 193, 64, 0.12), rgba(255, 138, 76, 0.08)); border-color: rgba(255, 193, 64, 0.4); }
.result--warn .result__badge { color: #ffc140; background: rgba(255, 193, 64, 0.16); }
.result--error { background: linear-gradient(135deg, rgba(255, 107, 129, 0.12), rgba(255, 76, 120, 0.08)); border-color: rgba(255, 107, 129, 0.4); }
.result--error .result__badge { color: var(--danger); background: rgba(255, 107, 129, 0.16); }

/* Enlace de acceso (caso ok) */
.result__link {
  display: block; word-break: break-all;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.78rem; line-height: 1.5; color: var(--text);
  background: rgba(0, 0, 0, 0.32); border: 1px solid var(--border);
  padding: 10px 12px; border-radius: 10px;
  max-height: 120px; overflow: auto;
  text-decoration: none;
}
.result__link:hover { border-color: var(--accent); }
.result__actions { margin-top: 12px; }
.btn--sm { padding: 10px 16px; font-size: 0.9rem; text-decoration: none; }

/* Bloques de aviso / error */
.result__msg { display: flex; gap: 12px; align-items: flex-start; }
.result__msg-icon { font-size: 1.5rem; line-height: 1; flex-shrink: 0; }
.result__msg-title { font-weight: 700; font-size: 0.98rem; margin-bottom: 3px; }
.result__msg-text { color: var(--text-dim); font-size: 0.9rem; line-height: 1.5; }

/* ============ Stepper ============ */
.stepper { margin-bottom: 8px; }
.stepper__track { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.stepper__progress {
  display: block; height: 100%; width: 25%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 999px;
  transition: width 0.55s var(--ease);
}
.stepper__dots { display: flex; justify-content: space-between; margin-top: 10px; }
.stepper__dot { font-size: 0.72rem; color: var(--text-dim); transition: color 0.35s var(--ease); }
.stepper__dot.is-done { color: var(--accent); }
.stepper__dot.is-active { color: var(--text); font-weight: 700; }

/* ============ Steps (wizard) ============ */
.step { display: none; flex-direction: column; gap: 14px; flex: 1; }
.step.is-active { display: flex; animation: stepIn 0.5s var(--ease) both; }
.step.is-leaving { animation: stepOut 0.35s var(--ease) both; }
@keyframes stepIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes stepOut { to { opacity: 0; transform: translateX(-24px); } }

.step__pill {
  align-self: flex-start;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.05em;
  color: var(--brand);
  padding: 5px 12px; border-radius: 999px;
  background: rgba(109, 139, 255, 0.14);
  border: 1px solid rgba(109, 139, 255, 0.3);
}
.step__title { font-size: 1.35rem; letter-spacing: -0.02em; }
.step__hint { color: var(--text-dim); font-size: 0.92rem; line-height: 1.5; }
.step .btn--primary { margin-top: auto; align-self: stretch; }

/* ============ Choices (paso 1) ============ */
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 6px; }
.choice {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 26px 16px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.3s var(--ease-back), border-color 0.3s var(--ease), background 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.choice:hover { transform: translateY(-4px); border-color: var(--brand); box-shadow: 0 14px 30px rgba(109, 139, 255, 0.25); }
.choice__icon { color: var(--brand); transition: transform 0.4s var(--ease-back), color 0.3s var(--ease); }
.choice:hover .choice__icon { transform: scale(1.12); }
.choice__label { font-weight: 600; font-size: 0.92rem; }
.choice.is-selected {
  border-color: var(--accent);
  background: rgba(53, 214, 164, 0.12);
  box-shadow: 0 0 0 4px rgba(53, 214, 164, 0.18);
}
.choice.is-selected .choice__icon { color: var(--accent); }

/* ============ Ilustración placeholder + puntero ============ */
.illus {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.02) 0 12px, transparent 12px 24px),
    linear-gradient(135deg, rgba(109,139,255,0.12), rgba(124,92,255,0.08));
  border: 1px dashed var(--border-strong);
  min-height: 210px;
  display: grid; place-items: center;
  animation: resultIn 0.5s var(--ease-back) both;
}
.illus__frame { width: 100%; height: 100%; display: block; }
/* El stage se ajusta al tamaño real de la imagen (inline-block) para que el
   anillo y el puntero se midan respecto a la imagen y no al contenedor. */
.illus__stage { position: relative; display: inline-block; line-height: 0; max-width: 100%; }
/* Imagen real: completa, centrada y con tope de altura. */
.illus__img {
  width: auto; max-width: 100%;
  height: auto; max-height: 460px;
  display: block;
  object-fit: contain;
}
.illus__caption {
  position: absolute; top: 12px; left: 12px;
  font-size: 0.72rem; color: var(--text-dim);
  padding: 4px 10px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(6px);
}

/* Puntero animado (dedo / flecha) */
.pointer {
  position: absolute;
  font-size: 2.2rem;
  filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.5));
  animation: point 1.3s var(--ease) infinite;
  pointer-events: none;
}
@keyframes point {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(6px, -8px); }
}
.pointer { z-index: 4; }
.pointer--pulse::after {
  content: ""; position: absolute; inset: -14px;
  border: 2px solid var(--accent); border-radius: 50%;
  animation: pulse 1.6s var(--ease) infinite;
}
@keyframes pulse {
  0% { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* ============ Resaltado suave tipo "pill" (marca la opción a pulsar) ============ */
.hl-ring {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 999px;      /* forma de píldora, encaja con los botones */
  pointer-events: none;
  z-index: 3;
}
/* Borde limpio con glow que "respira" suavemente */
.hl-ring__core {
  position: absolute; inset: 0;
  border-radius: inherit;
  border: 2.5px solid rgba(53, 214, 164, 0.95);
  box-shadow: 0 0 0 3px rgba(53, 214, 164, 0.12), 0 0 22px rgba(53, 214, 164, 0.4);
  animation: ringBreathe 2.2s ease-in-out infinite;
}
/* Halo que se expande con suavidad (guía la mirada sin molestar) */
.hl-ring::after {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 2px rgba(53, 214, 164, 0.5);
  animation: ringHalo 2.2s ease-out infinite;
}
@keyframes ringBreathe {
  0%, 100% { box-shadow: 0 0 0 3px rgba(53, 214, 164, 0.12), 0 0 16px rgba(53, 214, 164, 0.35); opacity: 0.9; }
  50%      { box-shadow: 0 0 0 5px rgba(53, 214, 164, 0.18), 0 0 30px rgba(53, 214, 164, 0.6);  opacity: 1; }
}
@keyframes ringHalo {
  0%   { transform: scale(1);    opacity: 0.5; }
  100% { transform: scale(1.14); opacity: 0; }
}

/* ============ Wizard nav ============ */
.wizard-nav { display: flex; justify-content: flex-start; }
.wizard-nav .btn { padding: 10px 18px; }

/* ============ Toast ============ */
.toast {
  position: fixed; left: 50%; bottom: 32px;
  transform: translate(-50%, 30px);
  padding: 14px 26px; border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #2bb98d);
  color: #04170f; font-weight: 700; font-size: 1rem;
  box-shadow: 0 16px 40px rgba(53, 214, 164, 0.45);
  opacity: 0; pointer-events: none;
  transition: transform 0.5s var(--ease-back), opacity 0.4s var(--ease);
  z-index: 50;
  display: flex; align-items: center; gap: 8px;
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ============ Responsive ============ */
@media (max-width: 420px) {
  .card { padding: 22px 18px; }
  .card__title { font-size: 1.4rem; }
  .choices { gap: 10px; }
  .choice { padding: 20px 10px; }
}
