/* Стили для Telegram WebView */

/* Базовые исправления для Telegram WebView */
.telegram-webview {
    /* Убираем проблемные CSS-свойства */
    --backdrop-filter: none;
    --webkit-backdrop-filter: none;
}

/* Исправления для модальных окон */
.telegram-webview .modal .modal__overlay {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(0, 0, 0, 0.8) !important;
}

.telegram-webview .modal.active {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999 !important;
}

.telegram-webview .modal__content {
    max-height: 90vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    transform: none !important;
    transition: none !important;
}

/* Исправления для уведомлений о cookies */
.telegram-webview .cookies-alert {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    border-radius: 0 !important;
    margin: 0 !important;
    z-index: 1000 !important;
}

/* Убираем сложные анимации и трансформации */
.telegram-webview .about-card {
    transform: none !important;
    animation: none !important;
    transition: none !important;
}

.telegram-webview .about-card:hover {
    transform: none !important;
}

.telegram-webview .prizes-card:hover {
    transform: none !important;
}

.telegram-webview .form__input:focus {
    transform: none !important;
}

.telegram-webview .form__submit:hover {
    transform: none !important;
}

.telegram-webview .form__submit:active {
    transform: none !important;
}

/* Упрощаем анимации */
.telegram-webview * {
    animation-duration: 0.1s !important;
    transition-duration: 0.1s !important;
}

.telegram-webview .about-card__front,
.telegram-webview .about-card__back {
    transition: none !important;
}

/* Исправления для прокрутки */
.telegram-webview body {
    -webkit-overflow-scrolling: touch !important;
    overflow-x: hidden !important;
    position: relative !important;
}

.telegram-webview html {
    overflow-x: hidden !important;
}

/* Исправления для карточек на мобильных устройствах */
.telegram-webview .about-cards {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
}

.telegram-webview .prizes-cards {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 16px !important;
}

@media (max-width: 768px) {
    .telegram-webview .about-cards {
        grid-template-columns: 1fr !important;
    }
    
    .telegram-webview .prizes-cards {
        grid-template-columns: 1fr !important;
    }
}

/* Исправления для viewport */
.telegram-webview {
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
}

/* Исправления для кнопок */
.telegram-webview button {
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    -khtml-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

/* Исправления для ссылок */
.telegram-webview a {
    -webkit-tap-highlight-color: transparent !important;
    -webkit-touch-callout: none !important;
}

/* Исправления для input полей */
.telegram-webview input,
.telegram-webview textarea {
    -webkit-appearance: none !important;
    border-radius: 0 !important;
}

.telegram-webview input:focus,
.telegram-webview textarea:focus {
    -webkit-appearance: none !important;
    outline: none !important;
}

/* Исправления для карточек-переворотов */
.telegram-webview [data-flip-card] {
    perspective: none !important;
    transform-style: flat !important;
}

.telegram-webview [data-flip-card] .about-card__front,
.telegram-webview [data-flip-card] .about-card__back {
    transform: none !important;
    backface-visibility: visible !important;
    -webkit-backface-visibility: visible !important;
}

.telegram-webview [data-flip-card][data-flipped="true"] .about-card__front {
    display: none !important;
}

.telegram-webview [data-flip-card][data-flipped="true"] .about-card__back {
    display: block !important;
}

.telegram-webview [data-flip-card][data-flipped="false"] .about-card__front {
    display: block !important;
}

.telegram-webview [data-flip-card][data-flipped="false"] .about-card__back {
    display: none !important;
}

/* Исправления для фоновых изображений */
.telegram-webview .bg-welcome-levels {
    background-attachment: scroll !important;
}

/* Исправления для flexbox и grid */
.telegram-webview .about-cards,
.telegram-webview .prizes-cards {
    display: block !important;
}

.telegram-webview .about-card,
.telegram-webview .prizes-card {
    display: block !important;
    width: 100% !important;
    margin-bottom: 16px !important;
}

@media (min-width: 769px) {
    .telegram-webview .prizes-cards {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
    }
    
    .telegram-webview .prizes-card {
        display: block !important;
        margin-bottom: 0 !important;
    }
}

/* Исправления для текста */
.telegram-webview .about-title__main,
.telegram-webview .prizes-title__main {
    font-size: 48px !important;
    line-height: 1.2 !important;
}

@media (max-width: 768px) {
    .telegram-webview .about-title__main,
    .telegram-webview .prizes-title__main {
        font-size: 36px !important;
        line-height: 1.2 !important;
    }
}

/* Исправления для кнопок форм */
.telegram-webview .form__submit {
    min-height: 48px !important;
    padding: 12px 24px !important;
    font-size: 16px !important;
}

/* Исправления для модальных окон на мобильных */
@media (max-width: 450px) {
    .telegram-webview .modal .modal__content {
        margin: 0 !important;
        border-radius: 0 !important;
        height: 100vh !important;
        max-height: 100vh !important;
    }
}

/* Убираем hover-эффекты на touch-устройствах */
@media (hover: none) {
    .telegram-webview .about-card:hover,
    .telegram-webview .prizes-card:hover,
    .telegram-webview .form__submit:hover {
        transform: none !important;
        box-shadow: inherit !important;
    }
}
