:root {
    --color-black: #000000;
    --color-dark: #0a0a0a;
    --color-matrix: #00ff9c;
    --color-matrix-bright: #00ff41;
    --color-matrix-dim: rgba(0, 255, 156, 0.1);
    --color-white: #ffffff;
    --color-gray: #333333;
    --font-mono: 'Courier', 'Courier New', monospace;
    --transition-fast: 150ms ease-out;
    --transition-medium: 300ms ease-out;
}

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

html, body {
    height: 100%;
    height: 100dvh; /* Use dynamic viewport height for mobile */
    width: 100%;
    font-family: var(--font-mono);
    background-color: var(--color-black);
    color: var(--color-matrix);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    margin: 0;
    padding: 0;
    /* Add safe area support for mobile */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.hidden {
    display: none !important;
}

/* Video Intro Phase */
.video-intro {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Use dynamic viewport height for mobile */
    background: var(--color-black);
    z-index: 10000;
    overflow: hidden;
}

.video-intro video,
.video-intro iframe {
    position: absolute;
    display: block;
    border: none;
    /* Dimensions and positioning will be handled by JavaScript */
}

/* Hero Phase - Terminal arriba izquierda */
.hero-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Use dynamic viewport height for mobile */
    background: var(--color-black);
    overflow: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.matrix-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.15;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 10;
    padding: 2rem;
    width: 100%;
    max-width: 800px;
    transition: opacity 0.5s ease-out;
    min-height: 100%;
}

/* Terminal Typewriter */
.terminal-container {
    font-family: var(--font-mono);
    padding-bottom: 100px; /* Espacio para scroll en móvil */
}

.terminal-text {
    font-size: 1.2rem;
    line-height: 1.6;
    color: var(--color-matrix);
    white-space: pre-wrap;
    word-wrap: break-word;
    text-shadow: 0 0 10px rgba(0, 255, 156, 0.8), 0 0 20px rgba(0, 0, 0, 0.9); /* Strong glow for readability over matrix */
    font-family: var(--font-mono);
}

.terminal-cursor {
    color: var(--color-matrix);
    font-weight: bold;
}

.terminal-cursor.blink {
    animation: blink 1s infinite;
}

/* Confirmation terminal text - desktop styling */
#confirmation-terminal-text {
    font-size: 1.2rem;
    line-height: 1.6;
    margin-top: 0;
    /* Inherits all other properties from .terminal-text */
}

.glitch-letter {
    display: inline;
    position: relative;
    cursor: pointer;
    transition: var(--transition-fast);
}

.glitch-letter:hover {
    animation: microGlitch 0.3s;
    color: var(--color-matrix-bright);
}

/* Hover glitch en Matrix rain */
.matrix-canvas:hover {
    opacity: 0.3;
    transition: opacity 0.3s;
}

/* Form Overlay - Minimalista estilo Apple/Tesla */
.form-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Use dynamic viewport height for mobile */
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeIn var(--transition-medium);
    overflow: hidden;
}

.form-modal {
    background: linear-gradient(135deg, rgba(10, 10, 10, 0.95), rgba(0, 0, 0, 0.95));
    border: 1px solid rgba(0, 255, 156, 0.3);
    border-radius: 0;
    padding: 3rem;
    max-width: 400px;
    width: 100%;
    position: relative;
    box-shadow: 0 0 50px rgba(0, 255, 156, 0.1);
    backdrop-filter: blur(10px);
}

/* Privacy Checkbox */
.privacy-group {
    margin-bottom: 0;
    margin-top: 0.5rem;
}

.privacy-checkbox {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.6rem;
    color: rgba(0, 255, 156, 0.8);
    font-family: var(--font-mono);
    white-space: nowrap;
    flex-wrap: nowrap;
}

.privacy-checkbox input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 16px;
    height: 16px;
    border: 1px solid rgba(0, 255, 156, 0.3);
    border-radius: 0;
    margin-right: 8px;
    position: relative;
    transition: all var(--transition-fast);
}

.privacy-checkbox input[type="checkbox"]:checked + .checkmark {
    background: var(--color-matrix);
    border-color: var(--color-matrix);
}


.privacy-link {
    color: var(--color-matrix);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition-fast);
    margin: 0 0.25rem; /* Add spacing around the link */
    padding: 0.1rem 0.2rem; /* Add subtle padding for better click area */
}

.privacy-link:hover {
    border-bottom-color: var(--color-matrix);
}

/* Phone Input Container */
.phone-input-container {
    display: flex;
    gap: 0.25rem;
    width: 100%;
}

.country-select {
    flex: 0 0 110px;
    padding: 1rem 0.8rem;
    background: rgba(0, 255, 156, 0.05);
    border: 1px solid rgba(0, 255, 156, 0.2);
    border-radius: 0;
    color: var(--color-matrix);
    font-size: 0.9rem;
    font-family: var(--font-mono);
    transition: all var(--transition-fast);
    cursor: pointer;
}

.country-select:focus {
    outline: none;
    border-color: var(--color-matrix);
    background: rgba(0, 255, 156, 0.08);
    box-shadow: 0 0 0 2px rgba(0, 255, 156, 0.2);
}

.country-select option {
    background: var(--color-black);
    color: var(--color-matrix);
}

.phone-input {
    flex: 1;
    min-width: 0;
    padding: 1rem;
    background: rgba(0, 255, 156, 0.05);
    border: 1px solid rgba(0, 255, 156, 0.2);
    border-radius: 0;
    color: var(--color-matrix);
    font-size: 1rem;
    font-family: var(--font-mono);
    transition: all var(--transition-fast);
}

.phone-input:focus {
    outline: none;
    border-color: var(--color-matrix);
    background: rgba(0, 255, 156, 0.08);
    box-shadow: 0 0 0 2px rgba(0, 255, 156, 0.2);
}

.phone-input::placeholder {
    color: rgba(0, 255, 156, 0.4);
}

.form-step {
    animation: fadeIn var(--transition-medium);
}

.form-step.hidden {
    display: none;
}

.form-title {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--color-matrix);
    font-family: var(--font-mono);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 400;
    color: rgba(0, 255, 156, 0.8);
    font-family: var(--font-mono);
}

.form-input {
    width: 100%;
    padding: 1rem;
    background: rgba(0, 255, 156, 0.05);
    border: 1px solid rgba(0, 255, 156, 0.2);
    border-radius: 0;
    color: var(--color-matrix);
    font-size: 1rem;
    font-family: var(--font-mono);
    transition: all var(--transition-fast);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-matrix);
    background: rgba(0, 255, 156, 0.08);
    box-shadow: 0 0 0 2px rgba(0, 255, 156, 0.2);
}

.form-input::placeholder {
    color: rgba(0, 255, 156, 0.4);
}

.error-message {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: #ff4444;
    font-family: var(--font-mono);
    min-height: 20px;
}

.form-button {
    width: 100%;
    padding: 1rem;
    background: var(--color-matrix);
    color: var(--color-black);
    border: none;
    border-radius: 0;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-medium);
    margin-top: 0.5rem;
    font-family: var(--font-mono);
}

.form-button:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(0, 255, 156, 0.2);
}

.form-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.glitch-button:hover:not(:disabled) {
    animation: microGlitch 0.5s;
}

/* Confirmation Phase */
.confirmation-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh; /* Use dynamic viewport height for mobile */
    background: transparent; /* Make transparent so matrix shows through */
    overflow-y: auto;
    z-index: 1000;
    padding-top: 2rem;
    padding-top: max(2rem, env(safe-area-inset-top)); /* Ensure content isn't hidden behind notch */
    -webkit-overflow-scrolling: touch;
}

.confirmation-content {
    position: relative;
    z-index: 1010;
    padding: 0 2rem 2rem 2rem;
    width: 100%;
    max-width: 800px;
    min-height: 100%;
    /* Remove background to let matrix show through */
}

.cta-secondary {
    background: transparent;
    color: var(--color-matrix);
    border: 1px solid rgba(0, 255, 156, 0.3);
    padding: 0.8rem 2rem;
    border-radius: 0;
    font-size: 0.9rem;
    font-weight: 400;
    cursor: pointer;
    transition: all var(--transition-medium);
    font-family: var(--font-mono);
}

.cta-secondary:hover {
    background: rgba(0, 255, 156, 0.1);
    border-color: var(--color-matrix);
    transform: translateY(-1px);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes microGlitch {
    0%, 100% {
        transform: translate(0);
        filter: none;
    }
    20% {
        transform: translate(-2px, 1px);
        filter: hue-rotate(90deg);
    }
    40% {
        transform: translate(2px, -1px);
        filter: hue-rotate(-90deg);
    }
    60% {
        transform: translate(-1px, 2px);
        filter: hue-rotate(180deg);
    }
    80% {
        transform: translate(1px, -2px);
        filter: hue-rotate(270deg);
    }
}


/* Mobile Enter Button */
.mobile-enter-btn {
    display: none;
    margin-top: 2rem;
    padding: 1rem 2rem;
    background: var(--color-matrix);
    color: var(--color-black);
    border: none;
    border-radius: 0;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-medium);
    font-family: var(--font-mono);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mobile-enter-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(0, 255, 156, 0.2);
}

.mobile-enter-btn:active {
    transform: translateY(0);
}

/* Responsive */
@media (max-width: 768px) {
    .form-modal {
        padding: 2rem 1.5rem;
        margin: 1rem;
        max-height: 90vh;
        max-height: 90dvh; /* Use dynamic viewport for mobile */
        overflow: hidden;
    }
    
    .form-overlay {
        overflow: hidden;
        touch-action: none;
        padding: max(2rem, env(safe-area-inset-top)) 1rem max(2rem, env(safe-area-inset-bottom)) 1rem;
    }
    
    .hero-content {
        padding: 1rem;
        overflow-y: auto;
        height: 100vh;
        height: 100dvh; /* Use dynamic viewport for mobile */
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
    
    .terminal-text {
        font-size: 0.9rem;
        line-height: 1.5;
    }
    
    .mobile-enter-btn {
        display: block;
        margin-bottom: 2rem;
        margin-bottom: max(2rem, env(safe-area-inset-bottom));
    }
    
    .hero-container {
        overflow-y: auto;
    }
    
    .confirmation-container {
        padding-top: 1rem;
        padding-top: max(1rem, env(safe-area-inset-top));
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
    
    .confirmation-content {
        padding: 0 1rem 2rem 1rem;
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }
    
    #confirmation-terminal-text {
        font-size: 0.85rem;
        line-height: 1.4;
        margin-top: 0.5rem; /* Add small margin to prevent cropping */
        /* Inherits text-shadow from .terminal-text */
    }
}

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