.glassmorphism {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}
.hover-scale {
    transition: transform 0.3s ease;
}
.hover-scale:hover {
    transform: scale(1.02);
}
.animate-pulse {
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}
.slide {
    display: none;
    animation: slideIn 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.slide.active {
    display: block;
}
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Адаптивная типографика */
@media (max-width: 640px) {
    .responsive-title {
        font-size: 1.5rem !important;
        line-height: 1.4 !important;
    }
    .responsive-subtitle {
        font-size: 1.125rem !important;
        line-height: 1.5 !important;
    }
    .responsive-text {
        font-size: 0.875rem !important;
    }
}

@media (max-width: 768px) {
    .responsive-title {
        font-size: 2rem !important;
        line-height: 1.3 !important;
    }
    .responsive-subtitle {
        font-size: 1.25rem !important;
    }
}

/* Оглавление */
#table-of-contents {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 10px 20px;
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    z-index: 1000;
    max-width: 95vw;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

#table-of-contents::-webkit-scrollbar {
    display: none;
}

.toc-button {
    background: transparent;
    border: none;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.toc-button:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
}

.toc-button.active {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

@media (max-width: 768px) {
    #table-of-contents {
        position: fixed;
        top: 80px;
        left: 50%;
        transform: translateX(-50%);
        width: 95%;
        max-width: 95%;
        padding: 12px 16px;
        border-radius: 20px;
        gap: 4px;
    }

    .toc-button {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
}

/* Более компактное оглавление на очень маленьких экранах */
.mobile-toc .toc-button {
    font-size: 0.65rem !important;
    padding: 3px 6px !important;
}

/* Отступ для контента чтобы не залезал на меню */
.slide {
    margin-top: 80px;
}

@media (max-width: 768px) {
    .slide {
        margin-top: 120px;
    }
}

/* Адаптивные контейнеры */
.mobile-container {
    max-width: 100vw;
    overflow-x: hidden;
}

/* Поддержка безопасных зон (iOS safe-area) */
@supports(padding: max(0px)) {
    body.mobile-container {
        padding-top: max(env(safe-area-inset-top), 0px);
        padding-bottom: max(env(safe-area-inset-bottom), 0px);
        padding-left: max(env(safe-area-inset-left), 0px);
        padding-right: max(env(safe-area-inset-right), 0px);
    }
}

.mobile-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .mobile-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .mobile-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
}

/* Адаптивные карточки */
.mobile-card {
    padding: 1rem;
    margin: 0.5rem 0;
}

@media (min-width: 768px) {
    .mobile-card {
        padding: 1.5rem;
        margin: 0.75rem 0;
    }
}

@media (min-width: 1024px) {
    .mobile-card {
        padding: 2rem;
        margin: 1rem 0;
    }
}

/* Скролл для таблиц */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.table-container table {
    min-width: 600px;
}

@media (max-width: 640px) {
    .table-container table {
        min-width: 520px;
        font-size: 0.85rem;
    }
    .table-container th, .table-container td {
        padding: 0.5rem 0.5rem !important;
    }
}

/* Адаптивные отступы */
.responsive-padding {
    padding: 0.75rem;
}

@media (min-width: 768px) {
    .responsive-padding {
        padding: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .responsive-padding {
        padding: 2.5rem;
    }
}

/* Обработка переполнения на мобильных */
@media (max-height: 800px) and (max-width: 768px) {
    .min-h-screen {
        min-height: auto !important;
        padding-top: 1rem;
        padding-bottom: 3rem;
    }

    .slide.active {
        overflow-y: auto;
        max-height: calc(100vh - 4rem);
    }
}

/* Дополнительное уменьшение для высоких слайдов */
@media (max-height: 900px) {
    .min-h-screen {
        min-height: auto !important;
        padding-top: 1rem;
        padding-bottom: 3rem;
    }
}

/* Дополнительная адаптация для очень маленьких экранов */
@media (max-width: 480px) {
    .responsive-padding {
        padding: 0.75rem;
    }

    .mobile-card {
        padding: 0.75rem;
        margin: 0.25rem 0;
    }

    .rounded-3xl {
        border-radius: 1rem !important;
    }

    /* Прогресс-точки и навигация ниже, чтобы не перекрывать контент */
    #progress-dots {
        bottom: 8px !important;
    }
    #nav-controls {
        bottom: 56px !important;
    }
}

/* Убираем overflow hidden на мобильных для возможности скролла */
@media (max-width: 768px) {
    body {
        overflow-x: hidden;
        overflow-y: auto;
    }

    /* Прячем кнопку печати и zoom на мобилках, если JS не сработал */
    #print-button {
        display: none;
    }
    #zoom-control {
        display: none;
    }
}

/* Стили для слайдера масштаба */
#zoom-slider {
    -webkit-appearance: none;
    appearance: none;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    outline: none;
    transition: all 0.3s ease;
}

#zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#zoom-slider::-moz-range-thumb {
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

#zoom-slider:hover {
    background: rgba(255, 255, 255, 0.3);
}