@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --glass-bg: rgba(255, 255, 255, 0.06);
    --glass-bg-hover: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-shadow: rgba(0, 0, 0, 0.4);
    --glass-blur: 30px;
    --accent: #7c3aed;
    --accent-light: #a78bfa;
    --accent-glow: rgba(124, 58, 237, 0.35);
    --danger: #ef4444;
    --success: #22c55e;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.65);
    --gradient-1: #7c3aed;
    --gradient-2: #2563eb;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    background: #050508;
    color: var(--text-primary);
    overflow: hidden;
    position: relative;
}

/* =============================================
   FULL-SCREEN VIDEO/IMAGE BACKGROUND
   — video/image fills entire screen
   — starts crisp, after 5s blurs + darkens
   — keeps looping forever as background
   ============================================= */
.video-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 0;
    overflow: hidden;
    background: #050508;
}

/* Common styles for all background media elements */
.video-bg video,
.splash-webp,
.splash-poster {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    opacity: 0;
    transition: filter 1.5s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.6s ease;
}

.video-bg video.playing,
.splash-webp.playing,
.splash-poster.playing {
    opacity: 1;
}

/* After splash — background blurs + dims */
.video-bg video.blurred,
.splash-webp.blurred,
.splash-poster.blurred {
    filter: blur(14px) saturate(0.5) brightness(0.3);
}

/* Canvas for particle animation (poster fallback) */
.splash-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s ease;
}
.splash-canvas.active {
    opacity: 1;
}

/* Dark overlay on top of video — invisible during splash, fades in after */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(5,5,8,0.55) 0%, rgba(15,5,30,0.45) 50%, rgba(5,5,8,0.65) 100%);
    opacity: 0;
    transition: opacity 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
    pointer-events: none;
}

.video-overlay.visible {
    opacity: 1;
}

/* Loading spinner before video starts */
.splash-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #050508;
    transition: opacity 0.5s ease;
}

.splash-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    box-shadow: 0 0 20px var(--accent-glow);
}

/* ===== Main App — sits on top of video ===== */
#app {
    position: relative;
    z-index: 10;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* ===== Screens ===== */
.screen {
    display: none !important;
    width: 100%;
    max-width: 380px;
    opacity: 0;
    transform: translateY(40px) scale(0.92);
    filter: blur(8px);
}

.screen.active {
    display: block !important;
}

/* First screen after splash — special elegant entrance */
.screen.animate-in-first {
    animation: screenInFirst 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* All other screen transitions */
.screen.animate-in {
    animation: screenIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes screenInFirst {
    0% {
        opacity: 0;
        transform: translateY(50px) scale(0.88);
        filter: blur(12px);
    }
    40% {
        opacity: 0.3;
        filter: blur(6px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes screenIn {
    from {
        opacity: 0;
        transform: translateY(40px) scale(0.92);
        filter: blur(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

/* ===== Glass Card ===== */
.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    padding: 44px 28px 36px;
    backdrop-filter: blur(var(--glass-blur)) saturate(1.2);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(1.2);
    box-shadow: 
        0 8px 40px var(--glass-shadow),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 1px 0 rgba(255, 255, 255, 0.08) inset;
    text-align: center;
    position: relative;
    overflow: hidden;
}

/* Top shine */
.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}

/* Bottom glow */
.glass-card::after {
    content: '';
    position: absolute;
    bottom: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 70%;
    height: 50%;
    background: radial-gradient(ellipse, var(--accent-glow), transparent 70%);
    z-index: -1;
    opacity: 0.6;
    filter: blur(30px);
    pointer-events: none;
}

/* ===== Emoji ===== */
.emoji-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    perspective: 500px;
}

.animated-emoji {
    font-size: 60px;
    line-height: 1;
    display: inline-block;
    filter: drop-shadow(0 6px 24px rgba(0,0,0,0.4));
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
}

/* 🔥 Fire */
.emoji-fire {
    animation: fireWiggle 0.8s ease-in-out infinite alternate;
}
.emoji-fire:first-child { animation-delay: 0s; }
.emoji-fire:last-child { animation-delay: 0.15s; }

@keyframes fireWiggle {
    0% { transform: translateY(0) scale(1) rotate(-3deg); }
    100% { transform: translateY(-8px) scale(1.08) rotate(3deg); }
}

/* 🔞 18+ */
.emoji-18 {
    font-size: 76px;
    animation: pulse18 2s ease-in-out infinite;
    filter: drop-shadow(0 6px 30px rgba(239, 68, 68, 0.4));
}

@keyframes pulse18 {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 6px 30px rgba(239, 68, 68, 0.3)); }
    50% { transform: scale(1.12); filter: drop-shadow(0 6px 40px rgba(239, 68, 68, 0.6)); }
}

/* 📱 Phone */
.emoji-phone {
    font-size: 64px;
    animation: phoneRing 1.5s ease-in-out infinite;
}

@keyframes phoneRing {
    0%, 100% { transform: rotate(0deg); }
    10% { transform: rotate(-15deg); }
    20% { transform: rotate(15deg); }
    30% { transform: rotate(-12deg); }
    40% { transform: rotate(12deg); }
    50% { transform: rotate(-8deg); }
    60% { transform: rotate(8deg); }
    70%, 100% { transform: rotate(0deg); }
}

/* 🔐 Lock */
.emoji-lock {
    font-size: 64px;
    animation: lockPulse 2.5s ease-in-out infinite;
}

@keyframes lockPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 6px 20px rgba(124, 58, 237, 0.3)); }
    50% { transform: scale(1.12); filter: drop-shadow(0 6px 35px rgba(124, 58, 237, 0.6)); }
}

/* 🚀 Rocket */
.emoji-rocket {
    font-size: 64px;
    animation: rocketFly 2s ease-in-out infinite;
}

@keyframes rocketFly {
    0% { transform: translateY(10px) rotate(-10deg) scale(0.95); opacity: 0.8; }
    50% { transform: translateY(-20px) rotate(0deg) scale(1.1); opacity: 1; }
    100% { transform: translateY(10px) rotate(-10deg) scale(0.95); opacity: 0.8; }
}

/* 🎉 Party */
.emoji-party {
    animation: partyPop 1.5s ease-in-out infinite;
}
.emoji-party:first-child { animation-delay: 0s; }
.emoji-party:last-child { animation-delay: 0.2s; }

@keyframes partyPop {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.2) rotate(-10deg); }
    50% { transform: scale(1) rotate(5deg); }
    75% { transform: scale(1.15) rotate(-5deg); }
}

/* ✅ Check */
.emoji-check {
    font-size: 68px;
    animation: checkBounce 1.5s ease-in-out infinite;
}

@keyframes checkBounce {
    0%, 100% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.1) translateY(-6px); }
}

/* ❌ Error */
.emoji-error {
    font-size: 64px;
    animation: errorShake 0.6s ease-in-out;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-12px) rotate(-5deg); }
    30% { transform: translateX(12px) rotate(5deg); }
    45% { transform: translateX(-8px) rotate(-3deg); }
    60% { transform: translateX(8px) rotate(3deg); }
    75% { transform: translateX(-4px); }
}

/* ===== Title ===== */
.title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #ffffff 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
    line-height: 1.3;
}

.subtitle {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 28px;
    line-height: 1.6;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== Glass Buttons ===== */
.glass-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 16px 24px;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    font-size: 16px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
    color: var(--text-primary);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    text-decoration: none;
    -webkit-user-select: none;
    user-select: none;
}

.glass-btn:active {
    transform: scale(0.97);
}

.primary-btn {
    background: linear-gradient(135deg, var(--gradient-1), var(--gradient-2));
    border-color: rgba(124, 58, 237, 0.25);
    box-shadow: 
        0 4px 20px var(--accent-glow),
        inset 0 1px 0 rgba(255, 255, 255, 0.12),
        inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

.primary-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
    transition: left 0.5s ease;
}

.primary-btn:active::before {
    left: 100%;
}

.btn-emoji {
    font-size: 20px;
}

.channel-btn {
    margin-top: 8px;
}

/* ===== Phone Input ===== */
.phone-input-wrapper {
    display: flex;
    align-items: center;
    background: var(--glass-bg);
    border: 1.5px solid var(--glass-border);
    border-radius: 16px;
    margin-bottom: 8px;
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.phone-input-wrapper:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px var(--accent-glow);
    background: rgba(124, 58, 237, 0.08);
}

.phone-prefix {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    min-width: 44px;
    height: 56px;
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-light);
    background: rgba(124, 58, 237, 0.08);
    border-right: 1px solid var(--glass-border);
    user-select: none;
    -webkit-user-select: none;
}

.phone-input {
    flex: 1;
    height: 56px;
    padding: 0 16px;
    font-size: 20px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    letter-spacing: 0.5px;
    caret-color: var(--accent-light);
}

.phone-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
    letter-spacing: 1px;
}

.phone-error {
    font-size: 12px;
    font-weight: 500;
    color: var(--danger);
    min-height: 18px;
    margin-bottom: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.phone-error:not(:empty) {
    opacity: 1;
}

/* ===== Loading Dots ===== */
.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-light);
    box-shadow: 0 0 10px var(--accent-glow);
    animation: dotPulse 1.4s ease-in-out infinite;
}

.dot:nth-child(2) { animation-delay: 0.2s; }
.dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotPulse {
    0%, 80%, 100% { transform: scale(0.5); opacity: 0.3; }
    40% { transform: scale(1.1); opacity: 1; }
}

/* ===== Loading Spinner ===== */
.loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255,255,255,0.08);
    border-top-color: var(--accent-light);
    border-radius: 50%;
    margin: 24px auto 0;
    animation: spin 0.7s linear infinite;
    box-shadow: 0 0 15px var(--accent-glow);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Code Input ===== */
.code-input-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.code-input {
    width: 48px;
    height: 58px;
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    font-family: 'Inter', sans-serif;
    background: var(--glass-bg);
    border: 1.5px solid var(--glass-border);
    border-radius: 16px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    caret-color: var(--accent-light);
}

.code-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 0 20px var(--accent-glow);
    transform: scale(1.06);
    background: rgba(124, 58, 237, 0.08);
}

.code-input::placeholder {
    color: rgba(255,255,255,0.15);
}

/* ===== Responsive ===== */
@media (max-width: 360px) {
    .glass-card { padding: 32px 20px 28px; border-radius: 24px; }
    .animated-emoji { font-size: 48px; }
    .emoji-18 { font-size: 60px; }
    .emoji-phone, .emoji-lock, .emoji-rocket { font-size: 52px; }
    .emoji-check { font-size: 56px; }
    .title { font-size: 20px; }
    .subtitle { font-size: 13px; }
    .code-input { width: 42px; height: 50px; font-size: 18px; }
    .code-input-container { gap: 6px; }
    .phone-input { font-size: 18px; }
    .phone-prefix { width: 38px; min-width: 38px; font-size: 18px; }
}

@media (max-height: 600px) {
    .glass-card { padding: 24px 20px 20px; }
    .emoji-container { margin-bottom: 16px; gap: 8px; }
    .animated-emoji { font-size: 44px; }
    .emoji-18 { font-size: 56px; }
    .subtitle { margin-bottom: 16px; }
}

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }

:root {
    --tg-theme-bg-color: transparent;
    --tg-theme-secondary-bg-color: transparent;
}

::selection {
    background: var(--accent-glow);
    color: white;
}
