/* Mobile First Responsive Design */
@media (max-width: 1200px) {
    h1 {
        font-size: 4.5rem;
    }
    
    .tagline {
        font-size: 1.8rem;
    }
    
    .features {
        gap: 40px;
    }
    
    .feature {
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    /* Фиксированные стили для стабильности */
    * {
        -webkit-tap-highlight-color: transparent;
        -webkit-overflow-scrolling: touch;
    }
    
    body {
        overflow-x: hidden;
        position: relative;
        width: 100%;
    }
    
    .top-logo {
        font-size: 1.5rem;
        left: 20px;
        top: 15px;
        position: fixed;
        z-index: 1000;
    }
    
    .joystick-icon {
        font-size: 2rem;
    }
    
    header {
        padding: 80px 15px 40px;
        min-height: 100vh;
        position: relative;
    }
    
    h1 {
        font-size: 3rem;
        letter-spacing: 3px;
        line-height: 1.2;
        margin: 20px 0;
        word-break: break-word;
    }
    
    .tagline {
        font-size: 1.4rem;
        margin: 20px auto 40px;
        padding: 0 15px;
        line-height: 1.4;
    }
    
    .cta-button {
        padding: 20px 40px;
        font-size: 1.3rem;
        margin: 20px auto;
        display: block;
        width: 90%;
        max-width: 300px;
    }
    
    .section-title {
        font-size: 2.5rem;
        margin-bottom: 60px;
        padding: 0 15px;
        line-height: 1.2;
    }
    
    /* Навигация - исправляем дергание */
    nav {
        padding: 12px 0;
        text-align: left;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        position: fixed;
        top: 0;
        width: 100%;
        z-index: 999;
        backdrop-filter: blur(15px);
        background: rgba(10,10,10,0.95);
    }
    
    nav::-webkit-scrollbar {
        display: none;
    }
    
    nav a {
        margin: 0 15px;
        font-size: 1rem;
        display: inline-block;
        padding: 8px 0;
        white-space: nowrap;
    }
    
    /* Секции */
    section {
        padding: 100px 15px;
        width: 100%;
        overflow: hidden;
    }
    
    .events, .testimonials {
        margin: 30px 15px;
        padding: 60px 20px;
        width: calc(100% - 30px);
        border-radius: 20px;
    }
    
    .events ul {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 10px;
    }
    
    .events li, .testimonial {
        padding: 25px 20px;
        margin: 0;
        transform: none !important;
    }
    
    /* Features grid */
    .features {
        flex-direction: column;
        align-items: center;
        gap: 30px;
        padding: 0 15px;
    }
    
    .feature {
        width: 100%;
        max-width: 400px;
        padding: 30px 25px;
        margin: 0 auto;
    }
    
    .feature-icon {
        font-size: 4rem;
    }
    
    /* Галерея */
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 0 15px;
    }
    
    .gallery-img {
        height: 250px;
        border-radius: 15px;
    }
    
    .gallery-subtitle {
        font-size: 2rem;
        margin-bottom: 30px;
    }
    
    /* Карта */
    #map-container {
        height: 400px;
        margin: 0 15px;
        width: calc(100% - 30px);
        border-radius: 15px;
    }
    
    /* Модальное окно */
    .modal {
        padding: 10px;
        align-items: flex-start;
    }
    
    .modal-content {
        margin: 5% auto;
        padding: 30px 20px;
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
        border-radius: 20px;
    }
    
    .form-container {
        max-height: 70vh;
        overflow-y: auto;
        padding-right: 5px;
    }
    
    /* Форма */
    input, textarea, select {
        padding: 16px;
        font-size: 16px; /* Предотвращает зум в iOS */
    }
    
    .form-group {
        margin-bottom: 20px;
    }
    
    /* Плавающие кнопки */
    .floating-elements {
        bottom: 20px;
        right: 20px;
        position: fixed;
        z-index: 998;
    }
    
    .floating-btn {
        width: 60px;
        height: 60px;
        margin: 10px 0;
    }
    
    /* Изображения */
    .kinova-image-container {
        margin: 20px 0;
        padding: 0 15px;
    }
    
    .logo {
        width: 250px;
        max-width: 80%;
    }
    
    .scroll-indicator {
        font-size: 2rem;
        bottom: 20px;
    }
    
    /* Footer */
    footer {
        padding: 50px 20px;
    }
    
    footer p {
        margin-bottom: 15px;
        line-height: 1.5;
    }
    
    /* Анимации для мобильных */
    .feature:hover,
    .events li:hover,
    .gallery-img:hover {
        transform: none !important;
    }
}

@media (max-width: 480px) {
    .top-logo {
        font-size: 1.2rem;
        left: 15px;
        top: 12px;
    }
    
    .joystick-icon {
        font-size: 1.5rem;
    }
    
    h1 {
        font-size: 2.2rem;
        letter-spacing: 2px;
        padding: 0 10px;
    }
    
    .tagline {
        font-size: 1.1rem;
        padding: 0 10px;
    }
    
    .cta-button {
        padding: 18px 35px;
        font-size: 1.1rem;
        width: 95%;
    }
    
    .section-title {
        font-size: 2rem;
        margin-bottom: 40px;
    }
    
    .events, .testimonials {
        margin: 20px 10px;
        padding: 40px 15px;
        width: calc(100% - 20px);
    }
    
    .events li, .testimonial {
        padding: 20px 15px;
    }
    
    .feature {
        padding: 25px 20px;
    }
    
    nav a {
        margin: 0 12px;
        font-size: 0.9rem;
    }
    
    .scroll-indicator {
        font-size: 1.8rem;
        bottom: 15px;
    }
    
    .floating-elements {
        bottom: 15px;
        right: 15px;
    }
    
    .floating-btn {
        width: 55px;
        height: 55px;
    }
    
    .logo {
        width: 200px;
    }
    
    .feature-icon {
        font-size: 3.5rem;
    }
    
    .gallery-subtitle {
        font-size: 1.8rem;
    }
    
    #map-container {
        height: 350px;
    }
    
    .modal-content {
        padding: 25px 15px;
    }
    
    /* Улучшаем скролл на тач-устройствах */
    .form-container::-webkit-scrollbar {
        width: 4px;
    }
    
    .form-container::-webkit-scrollbar-thumb {
        background: var(--turquoise-bright);
        border-radius: 2px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .feature:hover,
    .events li:hover,
    .gallery-img:hover,
    .cta-button:hover {
        transform: none;
    }
    
    nav a:hover::after {
        width: 0;
    }
    
    /* Улучшаем тач-события */
    .cta-button:active,
    .floating-btn:active {
        transform: scale(0.95);
        transition: transform 0.1s;
    }
}

/* Высокопиксельные экраны */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* Портретная ориентация */
@media (max-width: 768px) and (orientation: portrait) {
    header {
        min-height: 100vh;
        padding-top: 100px;
    }
}

/* Ландшафтная ориентация */
@media (max-width: 900px) and (orientation: landscape) {
    header {
        min-height: 120vh;
        padding-top: 120px;
    }
    
    .modal-content {
        margin: 2% auto;
        max-height: 96vh;
    }
}

/* Print styles */
@media print {
    .floating-elements,
    .scroll-indicator,
    nav {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
}

/* Предотвращение лагов анимаций */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Улучшение производительности */
.kinova-main-image,
.gallery-img,
.logo {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000;
}

/* Фикс для iOS input zoom */
@media (max-width: 768px) {
    input[type="text"],
    input[type="tel"],
    input[type="email"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px !important;
    }
}