/* ============================================================
   BASE RESET & BOX MODEL
   ============================================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   ROOT & TOKENS
   ============================================================ */
:root {
    --container-max: 720px;
    --spacing-xs: 8px;
    --spacing-sm: 14px;
    --spacing-md: 20px;
    --spacing-lg: 28px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --tap-target: 44px;
}

/* ============================================================
   HTML & BODY — dvh para móvil real
   ============================================================ */
html {
    height: 100%;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    background: #020202;
    color: #e8e8e8;
    font-family: 'DM Sans', sans-serif;
    min-height: 100dvh;        /* dvh = viewport dinámico en móvil */
    min-height: 100vh;         /* fallback */

    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;

    overflow-y: auto;
    overflow-x: hidden;

    letter-spacing: 0.01em;
    position: relative;
}

/* ============================================================
   BACKGROUNDS ANIMADOS (body::before / ::after)
   ============================================================ */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background-color: #020202;

    background:
        linear-gradient(135deg,
            transparent 0%, transparent 47%,
            #090909 47%, #111111 53%,
            transparent 53%, transparent 100%
        ) 0 0 / 2em 2em,

        linear-gradient(45deg,
            #101010 0%, #050505 47%,
            transparent 47%, transparent 53%,
            #101010 53%, #050505 100%
        ) 0 0 / 2em 2em,

        linear-gradient(-45deg,
            #0c0c0c 0%, #0c0c0c 47%,
            transparent 47%, transparent 53%,
            #0c0c0c 53%, #0c0c0c 100%
        ) 0 0 / 2em 2em,

        linear-gradient(45deg,
            transparent 0%, transparent 47%,
            #000000 47%, #111111 53%,
            transparent 53%, transparent 100%
        ) 1em 1em / 2em 2em;

    opacity: 0.9;
    animation: patternFloat 40s linear infinite;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;

    background:
        radial-gradient(circle at 25% 25%, rgba(255,255,255,0.015) 0.45em, transparent 0.45em) 0 0 / 4em 4em,
        radial-gradient(circle at 75% 75%, rgba(255,255,255,0.012) 0.25em, transparent 0.25em) 0 0 / 4em 4em,
        radial-gradient(circle at 75% 25%, rgba(255,255,255,0.01)  0.35em, transparent 0.35em) 2em 0 / 4em 4em,
        radial-gradient(circle at 25% 75%, rgba(0,0,0,0.15)        0.2em,  transparent 0.2em)  2em 2em / 4em 4em;
}

/* ============================================================
   KEYFRAMES
   ============================================================ */
@keyframes patternFloat {
    0%   { background-position: 0 0, 0 0, 0 0, 1em 1em; }
    100% { background-position: 2em 2em, 2em 2em, 2em 2em, 3em 3em; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes floatUp {
    0%   { transform: translateY(0);      opacity: 0; }
    10%  { opacity: 0.6; }
    100% { transform: translateY(-120vh); opacity: 0; }
}

@keyframes floatSymbolBig {
    0%   { transform: translateY(0);    opacity: 0.7; }
    50%  { transform: translateY(-10px); opacity: 1; }
    100% { transform: translateY(0);    opacity: 0.7; }
}

@keyframes bounceFadeIn {
    from { opacity: 0; transform: rotate(45deg) scale(0.5); }
    to   { opacity: 1; transform: rotate(45deg) scale(1); }
}

/* ============================================================
   REDUCCIÓN DE MOVIMIENTO — accesibilidad
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    body::before          { animation: none; }
    .particles span       { animation: none; }
    .floating-symbol-big  { animation: none; }
    .screen               { animation: none; }
    .result               { animation: none; }
}

/* ============================================================
   UTILIDADES
   ============================================================ */
.hidden { display: none !important; }

/* ============================================================
   SCREENS
   ============================================================ */
.screen {
    width: 100%;
    min-height: 100dvh;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.4s ease;
}

.active-screen { display: flex; }

/* ============================================================
   CONTAINER — padding táctil en móvil
   ============================================================ */
.container {
    width: 100%;
    max-width: var(--container-max);
    padding: var(--spacing-md) var(--spacing-md);
    text-align: center;
    z-index: 2;
    margin-top: 70px;       /* espacio para top-header */
    margin-bottom: 40px;
}

/* ============================================================
   TOP HEADER — fijo, seguro en notch/dynamic island
   ============================================================ */
.top-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 12px 16px;
    padding-top: max(12px, env(safe-area-inset-top));   /* notch */
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 50;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(5,5,5,0.35);
}

.left-title {
    font-size: clamp(0.7rem, 2.5vw, 0.85rem);
    letter-spacing: 0.15em;
    color: rgba(255,255,255,0.6);
}

.right-credit {
    font-size: clamp(0.65rem, 2vw, 0.78rem);
    color: rgba(255,255,255,0.35);
}

/* ============================================================
   EFECTOS DECORATIVOS
   ============================================================ */
.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    opacity: 0.02;
    background-image: radial-gradient(rgba(255,255,255,0.12) 1px, transparent 1px);
    background-size: 3px 3px;
}

.light-beam {
    position: fixed;
    top: -20%;
    left: 10%;
    width: 300px;
    height: 140vh;
    background: linear-gradient(120deg, transparent, rgba(255,255,255,0.04), transparent);
    filter: blur(60px);
    transform: rotate(12deg);
    opacity: 0.5;
    pointer-events: none;
}

/* ============================================================
   PARTÍCULAS
   ============================================================ */
.particles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 0;
}

.particles span {
    position: absolute;
    bottom: -20px;
    width: 2px;
    height: 2px;
    background: rgba(255,255,255,0.5);
    border-radius: 50%;
    animation: floatUp linear infinite;
}

.particles span:nth-child(1)  { left: 10%; animation-duration: 14s; }
.particles span:nth-child(2)  { left: 20%; animation-duration: 18s; }
.particles span:nth-child(3)  { left: 35%; animation-duration: 12s; }
.particles span:nth-child(4)  { left: 50%; animation-duration: 16s; }
.particles span:nth-child(5)  { left: 65%; animation-duration: 20s; }
.particles span:nth-child(6)  { left: 75%; animation-duration: 15s; }
.particles span:nth-child(7)  { left: 85%; animation-duration: 22s; }
.particles span:nth-child(8)  { left: 95%; animation-duration: 17s; }
.particles span:nth-child(9)  { left: 30%; animation-duration: 19s; }
.particles span:nth-child(10) { left: 60%; animation-duration: 13s; }

/* ============================================================
   TITLE WRAPPER
   ============================================================ */
.title-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-md);
}

.floating-symbol-big {
    font-size: clamp(3.5rem, 10vw, 5rem);
    color: rgba(255,255,255,0.65);
    margin-bottom: 2px;
    animation: floatSymbolBig 4s ease-in-out infinite;
    text-shadow: 0 0 20px rgba(255,255,255,0.1);
}

.title-wrapper h1 {
    font-family: 'Cinzel', serif;
    font-size: clamp(2rem, 8vw, 4rem);
    letter-spacing: clamp(3px, 1.5vw, 6px);
    font-weight: 400;
    word-break: break-word;        /* evita overflow en pantallas estrechas */
}

/* ============================================================
   TIPOGRAFÍA GENERAL
   ============================================================ */
h2 {
    margin-bottom: 14px;
    font-weight: 500;
    font-size: clamp(1rem, 4vw, 1.25rem);
}

p {
    color: rgba(255,255,255,0.6);
    line-height: 1.7;
    font-size: clamp(0.85rem, 3vw, 1rem);
}

/* ============================================================
   CHECKBOX DE VERIFICACIÓN
   ============================================================ */
.verify-checkbox {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: var(--spacing-md);
    cursor: pointer;
    user-select: none;
    min-height: var(--tap-target);   /* tap target */
    padding: var(--spacing-xs) 0;
}

.verify-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.verify-checkbox-box {
    position: relative;
    width: 1.4em;
    height: 1.4em;
    min-width: 1.4em;              /* no colapsa */
    background: #343434;
    border-radius: 5px;
    transition: all 0.5s ease;
    flex-shrink: 0;
}

.verify-checkbox input:checked ~ .verify-checkbox-box {
    background: #f0f0f0;
    border: 2px solid #343434;
}

.verify-checkbox-box::after {
    content: "";
    position: absolute;
    display: none;
    left: 0.3em;
    top: 0.05em;
    width: 0.3em;
    height: 0.65em;
    border: solid #343434;
    border-width: 0 0.2em 0.2em 0;
    border-radius: 4px;
    transform: rotate(45deg);
    filter: drop-shadow(0 0 10px #888);
    animation: bounceFadeIn 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.verify-checkbox input:checked ~ .verify-checkbox-box::after {
    display: block;
}

.verify-text {
    color: rgba(255,255,255,0.75);
    font-size: clamp(0.8rem, 3vw, 0.95rem);
}

/* ============================================================
   CAJAS PRINCIPALES
   ============================================================ */
.welcome-box,
.verify-box,
.token-box {
    padding: clamp(16px, 4vw, 28px);
    border-radius: var(--radius-xl);
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    width: 100%;
}

/* ============================================================
   BOTONES — tap target ≥ 44px
   ============================================================ */
button {
    padding: 12px 18px;
    min-height: var(--tap-target);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.15);
    background: transparent;
    color: #e8e8e8;
    cursor: pointer;
    transition: 0.25s ease;
    font-size: clamp(0.8rem, 2.5vw, 0.85rem);
    letter-spacing: 0.05em;
    touch-action: manipulation;    /* elimina delay de 300ms en móvil */
    -webkit-touch-callout: none;
    width: 100%;                   /* full-width por defecto en móvil */
}

button:hover,
button:focus-visible {
    background: rgba(255,255,255,0.06);
    border-color: rgba(255,255,255,0.3);
    outline: none;
}

button:active { opacity: 0.8; transform: scale(0.98); }

.main-btn { margin-top: var(--spacing-md); }

.small-btn {
    padding: 10px 14px;
    min-height: var(--tap-target);
    font-size: 0.75rem;
    width: auto;                   /* small-btn puede ser inline */
}

/* ============================================================
   INPUTS
   ============================================================ */
.input-column {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.input-box {
    display: flex;
    flex-direction: column;        /* columna en móvil por defecto */
    gap: 10px;
    margin-bottom: var(--spacing-md);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]) {
    flex: 1;
    width: 100%;
    padding: 14px 16px;
    min-height: var(--tap-target);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.02);
    color: #e8e8e8;
    outline: none;
    font-size: clamp(0.85rem, 3vw, 0.9rem);
    -webkit-appearance: none;      /* iOS no modifica el estilo */
    appearance: none;
}

input:focus {
    border-color: rgba(255,255,255,0.18);
    box-shadow: 0 0 0 2px rgba(255,255,255,0.04);
}

/* ============================================================
   SETTINGS ROW
   ============================================================ */
.settings-row {
    display: flex;
    flex-direction: column;        /* columna en móvil */
    gap: 10px;
    margin-bottom: var(--spacing-md);
}

/* ============================================================
   CATEGORÍAS
   ============================================================ */
.categories {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: var(--spacing-md);
}

.cat {
    padding: 10px 14px;
    min-height: var(--tap-target);
    display: flex;
    align-items: center;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.08);
    background: transparent;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    transition: 0.2s ease;
    font-size: clamp(0.75rem, 2.5vw, 0.8rem);
    user-select: none;
    touch-action: manipulation;
    -webkit-touch-callout: none;
}

.cat:hover,
.cat:focus-visible {
    border-color: rgba(255,255,255,0.2);
    color: #fff;
    outline: none;
}

.cat.active {
    border-color: rgba(255,255,255,0.35);
    color: #fff;
    background: rgba(255,255,255,0.04);
}

/* ============================================================
   RESULTADO
   ============================================================ */
.result {
    margin-top: var(--spacing-md);
    text-align: left;
    padding: clamp(14px, 4vw, 22px);
    border-radius: var(--radius-lg);
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.07);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    min-height: 280px;
    max-height: 60vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;  /* scroll suave en iOS */
    animation: fadeIn 0.4s ease;
}

/* ============================================================
   STEPS
   ============================================================ */
.step {
    margin-bottom: 12px;
    padding: clamp(10px, 3vw, 14px);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.02);
    border: 1px solid rgba(255,255,255,0.07);
    transition: 0.25s ease;
}

.step:hover { background: rgba(255,255,255,0.04); }
/* En móvil el translateX se elimina para evitar scroll horizontal */

.step b { color: rgba(255,255,255,0.9); }

.step.important {
    border-left: 2px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.05);
}

.step-title {
    font-size: clamp(0.78rem, 2.5vw, 0.85rem);
    color: #fff;
    margin-bottom: 6px;
    letter-spacing: 0.05em;
}

/* ============================================================
   SAFE AREA — iPhone X en adelante
   ============================================================ */
body {
    padding-left:   env(safe-area-inset-left);
    padding-right:  env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
}

/* ============================================================
   BREAKPOINT — TABLET (481px – 768px)
   ============================================================ */
@media (min-width: 481px) {
    .container {
        padding: 30px 24px;
        margin-top: 80px;
        margin-bottom: 60px;
    }

    .input-box {
        flex-direction: row;       /* fila en tablet */
    }

    .settings-row {
        flex-direction: row;
        justify-content: center;
    }

    button { width: auto; }        /* botones inline en tablet+ */
    .main-btn { width: 100%; }     /* excepto el principal */

    .step:hover { transform: translateX(3px); }
}

@media (min-width: 769px) {
    .container {
        padding: 40px 20px;
        margin-top: 90px;
        margin-bottom: 80px;
    }
}


img, video, svg, canvas { max-width: 100%; height: auto; }