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

html {
    overflow-x: hidden;
    overflow-y: auto;
    height: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #000000;
    min-height: 100vh;
    max-height: 100vh;
    height: 100vh;
    padding: 15px;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 30% 40%, rgba(255, 255, 255, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 70% 70%, rgba(255, 255, 255, 0.03) 0%, transparent 40%),
        radial-gradient(circle at 50% 10%, rgba(255, 255, 255, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Декоративные бабочки - хаотичное расположение */
.butterfly {
    position: fixed;
    background-image: url('butter_negate.png?v=2');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    pointer-events: none;
    filter: brightness(1.2) contrast(1.1);
}

/* Бабочка 1 - верхний левый угол */
.butterfly-1 {
    width: 180px;
    height: 180px;
    top: 5%;
    left: -2%;
    opacity: 0.15;
    transform: rotate(-25deg);
    z-index: 0;
    animation: float1 8s ease-in-out infinite;
}

/* Бабочка 2 - верхний правый угол, отзеркалена */
.butterfly-2 {
    width: 150px;
    height: 150px;
    top: 8%;
    right: 3%;
    opacity: 0.12;
    transform: rotate(35deg) scaleX(-1);
    z-index: 0;
    animation: float2 10s ease-in-out infinite;
}

/* Бабочка 3 - средняя левая сторона */
.butterfly-3 {
    width: 120px;
    height: 120px;
    top: 45%;
    left: 5%;
    opacity: 0.08;
    transform: rotate(15deg);
    z-index: 0;
    animation: float3 12s ease-in-out infinite;
}

/* Бабочка 4 - нижний правый угол */
.butterfly-4 {
    width: 200px;
    height: 200px;
    bottom: 2%;
    right: -3%;
    opacity: 0.18;
    transform: rotate(-45deg) scaleX(-1);
    z-index: 0;
    animation: float4 9s ease-in-out infinite;
}

/* Бабочка 5 - нижний левый угол */
.butterfly-5 {
    width: 140px;
    height: 140px;
    bottom: 10%;
    left: 8%;
    opacity: 0.1;
    transform: rotate(60deg);
    z-index: 0;
    animation: float5 11s ease-in-out infinite;
}

/* Бабочка 6 - центр справа */
.butterfly-6 {
    width: 110px;
    height: 110px;
    top: 55%;
    right: 7%;
    opacity: 0.09;
    transform: rotate(-15deg) scaleX(-1);
    z-index: 0;
    animation: float6 13s ease-in-out infinite;
}

/* Бабочка 7 - верхний центр */
.butterfly-7 {
    width: 90px;
    height: 90px;
    top: 15%;
    left: 50%;
    opacity: 0.07;
    transform: translateX(-50%) rotate(75deg);
    z-index: 0;
    animation: float7 10s ease-in-out infinite;
}

/* Бабочка 8 - нижний центр */
.butterfly-8 {
    width: 160px;
    height: 160px;
    bottom: 15%;
    right: 25%;
    opacity: 0.13;
    transform: rotate(-60deg);
    z-index: 0;
    animation: float8 14s ease-in-out infinite;
}

/* Анимации плавного движения */
@keyframes float1 {
    0%, 100% { transform: rotate(-25deg) translateY(0px); }
    50% { transform: rotate(-25deg) translateY(-15px); }
}

@keyframes float2 {
    0%, 100% { transform: rotate(35deg) scaleX(-1) translateY(0px); }
    50% { transform: rotate(35deg) scaleX(-1) translateY(20px); }
}

@keyframes float3 {
    0%, 100% { transform: rotate(15deg) translateX(0px); }
    50% { transform: rotate(15deg) translateX(-10px); }
}

@keyframes float4 {
    0%, 100% { transform: rotate(-45deg) scaleX(-1) translateY(0px); }
    50% { transform: rotate(-45deg) scaleX(-1) translateY(-25px); }
}

@keyframes float5 {
    0%, 100% { transform: rotate(60deg) translateY(0px); }
    50% { transform: rotate(60deg) translateY(18px); }
}

@keyframes float6 {
    0%, 100% { transform: rotate(-15deg) scaleX(-1) translateX(0px); }
    50% { transform: rotate(-15deg) scaleX(-1) translateX(12px); }
}

@keyframes float7 {
    0%, 100% { transform: translateX(-50%) rotate(75deg) translateY(0px); }
    50% { transform: translateX(-50%) rotate(75deg) translateY(-10px); }
}

@keyframes float8 {
    0%, 100% { transform: rotate(-60deg) translateY(0px); }
    50% { transform: rotate(-60deg) translateY(20px); }
}

.container {
    max-width: 500px;
    width: 100%;
    margin: 0 auto;
    position: relative;
    z-index: 10;
    isolation: isolate;
    max-height: 100vh;
    overflow-y: auto;
    padding: 10px 0;
}

.header {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 18px 35px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7),
                0 0 100px rgba(255, 255, 255, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    margin-bottom: 15px;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    isolation: isolate;
    contain: paint;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.6) 50%, transparent 100%);
}

.header::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    transform: translate(-50%, -50%);
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.03) 50%, transparent 70%);
    animation: shimmer 15s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes shimmer {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.logo {
    font-size: 15px;
    font-family: 'Zalando Sans Expanded';
    font-weight: 100;
    color: #000;
    margin-bottom: 15px;
    position: relative;
    z-index: 2;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #000;
    margin-bottom: 10px;
    letter-spacing: -0.6px;
    position: relative;
    z-index: 2;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.subtitle {
    font-size: 14px;
    color: #666;
    font-weight: 400;
    position: relative;
    z-index: 2;
    line-height: 1.4;
}

.form {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 30px 35px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7),
                0 0 100px rgba(255, 255, 255, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.15);
    position: relative;
    isolation: isolate;
    overflow: hidden;
    contain: paint;
}

.form::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    transform: translate(-50%, -50%);
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.03) 50%, transparent 70%);
    animation: shimmer 15s linear infinite;
    animation-delay: 5s;
    pointer-events: none;
    z-index: 0;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 8px;
    font-size: 14px;
    letter-spacing: 0.3px;
    position: relative;
    z-index: 2;
}

.form-group input {
    width: 100%;
    padding: 13px 18px;
    border: 2px solid #f0f0f0;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    background: #fafafa;
    position: relative;
    z-index: 2;
}

.form-group input:focus {
    outline: none;
    border-color: #000;
    background: white;
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.05),
                0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.form-group input::placeholder {
    color: #aaa;
}

.submit-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #000 0%, #1a1a1a 100%);
    color: white;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 10px;
    letter-spacing: 0.5px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4),
                0 0 40px rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.submit-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.4s;
}

.submit-btn:hover::before {
    left: 100%;
}

.submit-btn:hover::after {
    opacity: 1;
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6),
                0 0 60px rgba(255, 255, 255, 0.1);
    background: linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
}

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

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.success-message {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 60px 40px;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7),
                0 0 100px rgba(255, 255, 255, 0.08),
                inset 0 1px 0 rgba(255, 255, 255, 0.8);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.15);
    isolation: isolate;
    contain: paint;
}

.success-message::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.6) 50%, transparent 100%);
}

.success-message::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    transform: translate(-50%, -50%);
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.03) 50%, transparent 70%);
    animation: shimmer 15s linear infinite;
    pointer-events: none;
    z-index: 0;
}

.success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 25px;
    background: linear-gradient(135deg, #000 0%, #1a1a1a 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4),
                0 0 50px rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    animation: successPulse 2s ease-in-out infinite;
}

.success-icon::after {
    content: '✓';
    color: white;
    font-size: 40px;
    font-weight: bold;
}

@keyframes successPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4), 0 0 50px rgba(255, 255, 255, 0.05); }
    50% { transform: scale(1.05); box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5), 0 0 70px rgba(255, 255, 255, 0.08); }
}

.success-content h2 {
    font-size: 28px;
    font-weight: 600;
    color: #000;
    margin-bottom: 15px;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 2;
}

.success-content p {
    font-size: 16px;
    color: #666;
    line-height: 1.7;
    position: relative;
    z-index: 2;
}

.footer {
    text-align: center;
    margin-top: 15px;
    padding: 10px;
}

.telegram-link {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
    padding: 12px 20px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.telegram-link:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.telegram-icon {
    width: 38px;
    height: 38px;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.3s ease;
    filter: drop-shadow(0 4px 12px rgba(255, 255, 255, 0.1));
}

.telegram-link:hover .telegram-icon {
    color: #ffffff;
    transform: scale(1.1) rotate(-5deg);
    filter: drop-shadow(0 6px 20px rgba(255, 255, 255, 0.25));
}

.footer p {
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    font-weight: 400;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    margin: 0;
    transition: color 0.3s ease;
}

.telegram-link:hover p {
    color: rgba(255, 255, 255, 0.8);
}

/* Анимация появления */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header,
.form,
.success-message {
    animation: fadeInUp 0.6s ease-out;
}

/* Оптимизация для десктопа - убедимся что всё влезает */
@media (min-width: 769px) {
    .container {
        max-height: 95vh;
    }
    
    body {
        padding: 10px;
    }
}

/* Для очень маленьких экранов по высоте (например нетбуки) */
@media (min-width: 769px) and (max-height: 800px) {
    .header {
        padding: 15px 30px;
        margin-bottom: 12px;
    }
    
    .logo {
        font-size: 14px;
        margin-bottom: 12px;
    }
    
    .header h1 {
        font-size: 24px;
        margin-bottom: 8px;
    }
    
    .subtitle {
        font-size: 13px;
    }
    
    .form {
        padding: 25px 30px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group input {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .submit-btn {
        padding: 13px;
        font-size: 15px;
        margin-top: 8px;
    }
    
    .footer {
        margin-top: 12px;
        padding: 8px;
    }
    
    .telegram-icon {
        width: 34px;
        height: 34px;
    }
    
    .footer p {
        font-size: 13px;
    }
}

/* Адаптивность для мобилок */
@media (max-width: 768px) {
    html {
        height: auto;
    }
    
    body {
        padding: 10px;
        min-height: 100vh;
        max-height: none;
        height: auto;
        display: flex;
        align-items: center;
    }
    
    .container {
        width: 100%;
        margin: auto 0;
        max-height: none;
        padding: 5px 0;
    }
    
    /* Адаптация бабочек для мобильных */
    .butterfly-1 {
        width: 100px;
        height: 100px;
        top: 2%;
        left: -8%;
        opacity: 0.1;
    }
    
    .butterfly-2 {
        width: 80px;
        height: 80px;
        top: 3%;
        right: -5%;
        opacity: 0.08;
    }
    
    .butterfly-3 {
        width: 60px;
        height: 60px;
        opacity: 0.05;
    }
    
    .butterfly-4 {
        width: 120px;
        height: 120px;
        bottom: 0%;
        right: -8%;
        opacity: 0.12;
    }
    
    .butterfly-5 {
        width: 70px;
        height: 70px;
        bottom: 5%;
        left: 3%;
        opacity: 0.07;
    }
    
    .butterfly-6 {
        width: 50px;
        height: 50px;
        opacity: 0.05;
    }
    
    .butterfly-7 {
        width: 45px;
        height: 45px;
        opacity: 0.04;
    }
    
    .butterfly-8 {
        width: 90px;
        height: 90px;
        bottom: 8%;
        left: 53%;
        right: auto;
        opacity: 0.06;
        z-index: -1;
    }

    .header {
        padding: 20px 20px;
        border-radius: 18px;
        margin-bottom: 12px;
    }
    
    .logo {
        font-size: 14px;
        margin-bottom: 12px;
    }

    .header h1 {
        font-size: 22px;
        margin-bottom: 8px;
        letter-spacing: -0.5px;
    }
    
    .subtitle {
        font-size: 13px;
        line-height: 1.4;
    }

    .form {
        padding: 20px 20px;
        border-radius: 18px;
    }
    
    .form-group {
        margin-bottom: 12px;
    }
    
    .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }
    
    .form-group input {
        padding: 12px 14px;
        font-size: 15px;
    }
    
    .submit-btn {
        padding: 14px;
        font-size: 15px;
        margin-top: 8px;
    }
    
    .footer {
        margin-top: 15px;
        padding: 10px;
    }
    
    .telegram-link {
        padding: 12px 20px;
        gap: 8px;
    }
    
    .telegram-icon {
        width: 36px;
        height: 36px;
    }
    
    .footer p {
        font-size: 12px;
    }
    
    .success-message {
        padding: 40px 25px;
        border-radius: 18px;
    }
    
    .success-icon {
        width: 60px;
        height: 60px;
    }
    
    .success-content h2 {
        font-size: 22px;
    }
    
    .success-content p {
        font-size: 14px;
    }
}

/* Дополнительная оптимизация для очень маленьких экранов */
@media (max-width: 400px) {
    body {
        padding: 8px;
    }
    
    .header {
        padding: 16px 16px;
        margin-bottom: 10px;
    }
    
    .logo {
        font-size: 13px;
        margin-bottom: 10px;
    }
    
    .header h1 {
        font-size: 20px;
        margin-bottom: 6px;
    }
    
    .subtitle {
        font-size: 12px;
    }
    
    .form {
        padding: 18px 16px;
    }
    
    .form-group {
        margin-bottom: 10px;
    }
    
    .form-group input {
        padding: 11px 12px;
        font-size: 14px;
    }
    
    .submit-btn {
        padding: 12px;
        font-size: 14px;
    }
    
    .telegram-icon {
        width: 32px;
        height: 32px;
    }
    
    .footer p {
        font-size: 11px;
    }
}

/* Оптимизация для коротких экранов (landscape мобилки) */
@media (max-height: 700px) and (max-width: 768px) {
    body {
        padding: 8px;
        display: block;
        min-height: auto;
    }
    
    .header {
        padding: 15px 18px;
        margin-bottom: 10px;
    }
    
    .logo {
        font-size: 13px;
        margin-bottom: 8px;
    }
    
    .header h1 {
        font-size: 20px;
        margin-bottom: 6px;
    }
    
    .subtitle {
        font-size: 12px;
    }
    
    .form {
        padding: 16px 18px;
    }
    
    .form-group {
        margin-bottom: 10px;
    }
    
    .form-group input {
        padding: 10px 12px;
    }
    
    .submit-btn {
        padding: 12px;
        margin-top: 6px;
    }
    
    .footer {
        margin-top: 10px;
        padding: 8px;
    }
    
    .telegram-link {
        padding: 10px 16px;
        gap: 6px;
    }
    
    .telegram-icon {
        width: 30px;
        height: 30px;
    }
}

/* Анимация появления */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header,
.form,
.success-message {
    animation: fadeIn 0.5s ease;
}

@font-face {
    font-family: 'Zalando Sans Expanded';
    src: url('static/ZalandoSansExpanded-ExtraLight.ttf') format('truetype');
    font-weight: 200;
    font-style: normal;
    font-display: swap;
}