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

:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --success-color: #10b981;
    --error-color: #ef4444;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --bg-light: #f8fafc;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 50%, #06b6d4 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

.background-pattern {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: 
        radial-gradient(circle, rgba(255,255,255,0.1) 1px, transparent 1px);
    background-size: 50px 50px;
    animation: movePattern 30s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes movePattern {
    0% { transform: translate(0, 0); }
    100% { transform: translate(50px, 50px); }
}

.container {
    background: white;
    border-radius: 24px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.3);
    max-width: 480px;
    width: 100%;
    padding: 48px 40px;
    position: relative;
    z-index: 1;
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.logo {
    text-align: center;
    margin-bottom: 32px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo img {
    height: 56px !important;
    width: auto !important;
    max-width: 100% !important;
    display: block !important;
}

.step {
    display: none;
}

.step.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

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

.step-content h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
    text-align: center;
}

.subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 8px;
    line-height: 1.6;
}

.highlight {
    color: var(--primary-color);
    font-weight: 600;
}

.notice {
    font-size: 13px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
    font-style: italic;
}

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

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    transition: all 0.2s;
    font-family: inherit;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input:disabled {
    background: var(--bg-light);
    cursor: not-allowed;
    opacity: 0.6;
}

.form-group input.error {
    border-color: var(--error-color);
}

.error-message {
    color: var(--error-color);
    font-size: 13px;
    margin-top: 6px;
    min-height: 20px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.primary-btn {
    width: 100%;
    padding: 14px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.primary-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.primary-btn:active:not(:disabled) {
    transform: translateY(0);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.back-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 0;
    transition: color 0.2s;
}

.back-btn:hover {
    color: var(--text-primary);
}

.resend-btn {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 16px;
    cursor: pointer;
    padding: 8px;
    transition: color 0.2s;
}

.resend-btn:hover {
    color: var(--primary-color);
}

.resend-btn span {
    text-decoration: underline;
}

.resend-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.success {
    text-align: center;
}

.success-icon {
    margin: 20px 0 24px;
    animation: scaleIn 0.5s ease-out;
}

@keyframes scaleIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success h3 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.success p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.feedback-message {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.6;
    text-align: center;
}

.modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.6) !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 99999 !important;
    animation: fadeIn 0.3s ease-out;
    padding: 20px !important;
    pointer-events: none !important;
}

.modal-content {
    pointer-events: auto !important;
    position: relative !important;
    z-index: 1 !important;
}

.modal-close,
.understood-btn {
    pointer-events: auto !important;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background: white !important;
    border-radius: 20px !important;
    padding: 32px !important;
    max-width: 400px !important;
    width: 90% !important;
    position: relative !important;
    animation: slideUp 0.3s ease-out;
    margin: 0 auto !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3) !important;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-content h3 {
    font-size: 22px;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.modal-content p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 24px;
}

.understood-btn {
    width: 100%;
    padding: 12px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.understood-btn:hover {
    background: var(--primary-dark);
}

.help-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 56px;
    height: 56px;
    background: white;
    border: none;
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s;
    z-index: 100;
}

.help-button:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.language-switcher {
    position: fixed !important;
    top: 24px !important;
    left: 24px !important;
    display: flex !important;
    gap: 0 !important;
    background: rgba(255, 255, 255, 0.25) !important;
    padding: 5px !important;
    border-radius: 14px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3) !important;
    z-index: 999999 !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    pointer-events: auto !important;
}

.language-switcher button {
    padding: 10px 22px !important;
    border: none !important;
    background: transparent !important;
    color: rgba(255, 255, 255, 0.95) !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    border-radius: 10px !important;
    transition: all 0.3s ease !important;
    font-family: 'Inter', sans-serif !important;
    min-width: 85px !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    position: relative !important;
    flex-direction: row !important;
    pointer-events: auto !important;
    z-index: 1000000 !important;
}

.language-switcher .flag-icon {
    font-size: 20px !important;
    line-height: 1 !important;
    display: none !important;
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', sans-serif !important;
    vertical-align: middle !important;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1)) !important;
}

.language-switcher .flag-svg {
    display: inline-block !important;
    width: 20px !important;
    height: 15px !important;
    flex-shrink: 0 !important;
    border-radius: 2px !important;
    overflow: visible !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
    margin-right: 6px !important;
    vertical-align: middle !important;
    position: relative !important;
    z-index: 1 !important;
}

.language-switcher .flag-svg svg {
    width: 100% !important;
    height: 100% !important;
    display: block !important;
    position: relative !important;
}

@supports not (font-variation-settings: normal) {
    .language-switcher .flag-icon {
        display: none !important;
    }
    .language-switcher .flag-svg {
        display: inline-block !important;
    }
}

@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    .language-switcher .flag-icon {
        display: none !important;
    }
    .language-switcher .flag-svg {
        display: inline-block !important;
    }
}

.language-switcher button:hover {
    background: rgba(255, 255, 255, 0.25) !important;
    color: white !important;
    transform: translateY(-1px) !important;
}

.language-switcher button.active,
button.language-switcher.active,
.language-switcher .active,
.language-switcher button[data-lang].active {
    background: #6366f1 !important;
    background-color: #6366f1 !important;
    color: white !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25) !important;
    transform: scale(1.05) !important;
    text-shadow: none !important;
}

.language-switcher button.active .flag-icon {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15)) !important;
}

.language-switcher button.active .flag-svg {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15) !important;
}

@media (max-width: 600px) {
    .container {
        padding: 32px 24px;
    }

    .step-content h2 {
        font-size: 24px;
    }

    .subtitle {
        font-size: 15px;
    }

    .help-button {
        bottom: 20px;
        right: 20px;
        width: 52px;
        height: 52px;
    }

    .language-switcher {
        top: 16px !important;
        left: 16px !important;
        padding: 4px !important;
    }

    .language-switcher button {
        padding: 8px 18px !important;
        font-size: 14px !important;
        min-width: 75px !important;
    }

    .language-switcher .flag-icon {
        font-size: 18px !important;
    }

    .language-switcher .flag-svg {
        width: 18px !important;
        height: 13px !important;
    }

    .modal-content {
        padding: 24px !important;
        max-width: 340px !important;
    }
}

#codeInput {
    text-align: center;
    font-size: 24px;
    letter-spacing: 8px;
    font-weight: 600;
    font-family: 'Courier New', monospace;
}