/* Основные стили для игры Swipeak */

/* Сброс стилей */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Шрифты */
@font-face {
    font-family: 'Nevduplenysh';
    src: url('/static/fonts/Nevduplenysh-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Nunito';
    src: url('/static/fonts/Nunito-Black.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
    font-display: swap;
}

/* Основные переменные */
:root {
    --primary-color: #2C3E50;
    --secondary-color: #E74C3C;
    --accent-color: #F39C12;
    --success-color: #27AE60;
    --warning-color: #F39C12;
    --error-color: #E74C3C;
    --text-color: #2C3E50;
    --text-light: #7F8C8D;
    --bg-color: #ECF0F1;
    --card-bg: #FFFFFF;
    --border-color: #BDC3C7;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 15px rgba(0, 0, 0, 0.2);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

/* Основные стили */
html, body {
    height: 100%;
    font-family: 'Nunito', sans-serif;
    background: var(--bg-color);
    color: var(--text-color);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Игровой контейнер */
#gameContainer {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

#gameContainer canvas {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Экран загрузки */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.loading-content {
    text-align: center;
    color: white;
    max-width: 320px;
    padding: 0 20px;
}

.logo {
    margin-bottom: 40px;
}

.logo img {
    width: 120px;
    height: 120px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.loading-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 20px;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #F39C12, #E74C3C);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

.loading-text {
    font-size: 16px;
    opacity: 0.9;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.9; }
    50% { opacity: 0.6; }
}

/* Мобильная адаптация */
@media (max-width: 768px) {
    /* Скрываем элементы интерфейса браузера на мобильных */
    body {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }
    
    /* Полноэкранный режим */
    #gameContainer {
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100);
    }
    
    .loading-content {
        max-width: 280px;
    }
    
    .logo img {
        width: 100px;
        height: 100px;
    }
    
    .loading-text {
        font-size: 14px;
    }
}

/* Адаптация для iPhone X и выше */
@media (max-width: 768px) and (orientation: portrait) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Ландшафтная ориентация */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }
}

/* Высокое разрешение */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Оптимизация для Retina дисплеев */
    .logo img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: optimize-contrast;
    }
}

/* Анимации */
@keyframes slideInFromTop {
    from {
        transform: translateY(-100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(100px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -30px, 0);
    }
    70% {
        transform: translate3d(0, -15px, 0);
    }
    90% {
        transform: translate3d(0, -4px, 0);
    }
}

/* Utility классы */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.hidden {
    display: none;
}

.invisible {
    visibility: hidden;
}

.no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Темная тема */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #34495E;
        --text-color: #ECF0F1;
        --text-light: #BDC3C7;
        --bg-color: #2C3E50;
        --card-bg: #34495E;
        --border-color: #7F8C8D;
    }
    
    .loading-screen {
        background: linear-gradient(135deg, #2C3E50 0%, #34495E 100%);
    }
    
    #gameContainer canvas {
        background: linear-gradient(135deg, #2C3E50 0%, #34495E 100%);
    }
}

/* Анимация для фокуса */
@keyframes focusRing {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.1);
        opacity: 0;
    }
}

/* Доступность */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Нотификации */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: var(--border-radius);
    color: white;
    font-weight: 600;
    z-index: 9999;
    animation: slideInFromRight 0.3s ease;
    max-width: 320px;
    box-shadow: var(--shadow-hover);
}

.notification.success {
    background: var(--success-color);
}

.notification.error {
    background: var(--error-color);
}

.notification.warning {
    background: var(--warning-color);
}

.notification.info {
    background: var(--primary-color);
}

@media (max-width: 768px) {
    .notification {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* Прелоадер ресурсов */
.preloader-progress {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
    z-index: 9999;
}

/* Модальные окна */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
}

.modal {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-hover);
    max-width: 90%;
    max-height: 90%;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

/* Скролл для модальных окон */
.modal::-webkit-scrollbar {
    width: 8px;
}

.modal::-webkit-scrollbar-track {
    background: var(--bg-color);
}

.modal::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.modal::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* PWA стили */
.pwa-install-prompt {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-hover);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    z-index: 9999;
    animation: slideInFromBottom 0.3s ease;
}

.pwa-install-prompt .icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--primary-color);
    flex-shrink: 0;
}

.pwa-install-prompt .content {
    flex: 1;
}

.pwa-install-prompt .title {
    font-weight: 600;
    margin-bottom: 5px;
}

.pwa-install-prompt .description {
    font-size: 14px;
    color: var(--text-light);
}

.pwa-install-prompt .actions {
    display: flex;
    gap: 10px;
}

.pwa-install-prompt button {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.pwa-install-prompt .install-btn {
    background: var(--primary-color);
    color: white;
}

.pwa-install-prompt .dismiss-btn {
    background: var(--bg-color);
    color: var(--text-color);
}

.pwa-install-prompt button:hover {
    opacity: 0.8;
}

/* Кастомные скроллбары */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-color);
}

/* Оптимизация для производительности */
.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
    perspective: 1000px;
}

/* Отключение выделения текста в игре */
.game-ui {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Оптимизация для touch событий */
.touch-optimized {
    touch-action: manipulation;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
}

/* Улучшения для WebGL */
canvas {
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Анимации для переходов между сценами */
.scene-transition {
    animation: fadeIn 0.5s ease-in-out;
}

.scene-transition.slide-left {
    animation: slideInFromLeft 0.5s ease-in-out;
}

.scene-transition.slide-right {
    animation: slideInFromRight 0.5s ease-in-out;
}

.scene-transition.slide-up {
    animation: slideInFromBottom 0.5s ease-in-out;
}

.scene-transition.slide-down {
    animation: slideInFromTop 0.5s ease-in-out;
}

/* Дополнительные стили для игровых элементов */
.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

.game-overlay > * {
    pointer-events: auto;
}

/* Стили для отладки (только в development режиме) */
.debug-info {
    position: fixed;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 12px;
    z-index: 9999;
    display: none;
}

.debug-mode .debug-info {
    display: block;
}

/* Поддержка для старых браузеров */
.no-webgl {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    z-index: 10000;
}

.no-webgl h1 {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--error-color);
}

.no-webgl p {
    font-size: 16px;
    color: var(--text-light);
    max-width: 400px;
    line-height: 1.5;
}

/* Адаптация для очень маленьких экранов */
@media (max-width: 320px) {
    .loading-content {
        max-width: 240px;
    }
    
    .logo img {
        width: 80px;
        height: 80px;
    }
    
    .loading-text {
        font-size: 12px;
    }
    
    .notification {
        font-size: 14px;
        padding: 12px 16px;
    }
}

/* Адаптация для очень больших экранов */
@media (min-width: 1200px) {
    .notification {
        max-width: 400px;
    }
    
    .modal {
        max-width: 600px;
    }
} 