/* Еко-Патруль - Стилі */

/* Базові стилі */
body {
    font-family: 'Montserrat', sans-serif;
    background-image: url('../images/game-bg.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Ігрова область */
.game-area {
    position: relative;
    width: 360px;
    max-width: 100%;
    height: 500px;
    background: linear-gradient(180deg,
            #87CEEB 0%,
            /* Небо */
            #B0E2FF 40%,
            /* Світліше небо */
            #98D8AA 60%,
            /* Перехід до лісу */
            #4A7C4E 100%
            /* Ліс */
        );
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    margin: 0 auto;
    touch-action: none;
    user-select: none;
}

/* Хмаринки на фоні */
.game-area::before {
    content: '';
    position: absolute;
    top: 30px;
    left: 20px;
    width: 60px;
    height: 30px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    box-shadow:
        25px 5px 0 10px rgba(255, 255, 255, 0.6),
        50px 0 0 5px rgba(255, 255, 255, 0.5);
    animation: cloud-drift 20s linear infinite;
}

.game-area::after {
    content: '';
    position: absolute;
    top: 60px;
    right: 40px;
    width: 40px;
    height: 20px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    box-shadow:
        15px 3px 0 8px rgba(255, 255, 255, 0.5);
    animation: cloud-drift 25s linear infinite reverse;
}

@keyframes cloud-drift {
    0% {
        transform: translateX(0);
    }

    50% {
        transform: translateX(20px);
    }

    100% {
        transform: translateX(0);
    }
}

/* Земля */
.ground-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: linear-gradient(180deg, #3D5A3D 0%, #2D4A2D 100%);
    border-top: 3px solid #4A7C4E;
}

/* Трава на землі */
.ground-area::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 12px;
    background: repeating-linear-gradient(90deg,
            transparent 0px,
            transparent 5px,
            #4A7C4E 5px,
            #4A7C4E 7px,
            transparent 7px,
            transparent 12px);
}

/* Сміття на землі */
.ground-trash {
    position: absolute;
    bottom: 5px;
    opacity: 0.8;
    transform: scale(0.7);
    animation: appear 0.3s ease-out;
}

.ground-trash img {
    width: 36px;
    height: auto;
    filter: brightness(0.8) saturate(0.9);
}

/* Кошик */
.basket {
    position: absolute;
    bottom: 20px;
    width: 80px;
    height: 60px;
    transition: transform 0.05s ease-out;
    will-change: transform;
    z-index: 10;
}

.basket img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.3));
}

/* Падаючі об'єкти */
.falling-item {
    position: absolute;
    width: 40px;
    height: 48px;
    z-index: 5;
    transition: transform 0.1s ease-out;
    will-change: transform;
    transform: translate3d(var(--item-x, 0px), var(--item-y, 0px), 0);
}

.falling-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(1px 2px 3px rgba(0, 0, 0, 0.2));
}

.falling-item.fade-out {
    animation: fade-down 0.5s ease-out forwards;
}

@keyframes fade-down {
    from {
        opacity: 1;
        transform: translate3d(var(--item-x, 0px), var(--item-y, 0px), 0) scale(1);
    }

    to {
        opacity: 0;
        transform: translate3d(var(--item-x, 0px), calc(var(--item-y, 0px) + 20px), 0) scale(0.5);
    }
}

/* Ефект ловлі */
.catch-effect {
    position: absolute;
    font-size: 18px;
    font-weight: bold;
    pointer-events: none;
    animation: float-up 0.8s ease-out forwards;
    z-index: 20;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.catch-effect.positive {
    color: #22C55E;
}

.catch-effect.negative {
    color: #EF4444;
}

@keyframes float-up {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-40px) scale(1.2);
    }
}

@keyframes appear {
    from {
        opacity: 0;
        transform: scale(0.3);
    }

    to {
        opacity: 0.8;
        transform: scale(0.7);
    }
}

/* Індикатор вітру */
.wind-indicator {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.8);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 15;
    transition: opacity 0.3s;
}

.wind-indicator img {
    width: 40px;
    height: 32px;
}

.wind-indicator.wind-warning {
    animation: wind-blink 0.3s ease-in-out infinite;
}

.wind-indicator.wind-active {
    animation: wind-pulse 0.5s ease-in-out infinite;
}

@keyframes wind-blink {

    0%,
    100% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }

    50% {
        opacity: 0.3;
        transform: translateX(-50%) scale(1.1);
    }
}

@keyframes wind-pulse {

    0%,
    100% {
        transform: translateX(-50%) scale(1);
    }

    50% {
        transform: translateX(-50%) scale(1.1);
    }
}

/* Варіант 1: Двохрядкова компактна панель */
.settings-menu-v1 {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 12px;
    transition: all 0.3s ease;
}

.actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.restart-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #EAB308, #F59E0B);
    color: #1F2937;
    border: none;
    border-radius: 8px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(234, 179, 8, 0.3);
    flex: 1;
    min-height: 40px;
}

.restart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(234, 179, 8, 0.4);
}

.restart-btn:active {
    transform: translateY(0);
}

.sound-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    background: rgba(22, 163, 74, 0.3);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sound-btn:hover {
    background: rgba(22, 163, 74, 0.5);
}

.stats-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    flex-wrap: wrap;
    padding: 4px 0;
}

.lives-display {
    font-size: 22px;
    letter-spacing: 2px;
}

.lives-display.shake {
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

.separator {
    color: #D1D5DB;
    user-select: none;
    font-weight: 300;
}

.timer-display {
    color: #2563EB;
    letter-spacing: 1px;
    transition: opacity 0.3s ease;
}

.timer-display.hidden,
.timer-separator.hidden,
.lives-display.hidden,
.lives-separator.hidden {
    display: none;
}

.score-display-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
}

.score-label {
    font-size: 16px;
    color: #6B7280;
    font-weight: 500;
}

.score-value {
    font-size: 20px;
    color: #166534;
    font-weight: 700;
}

/* Адаптивність для мобільних пристроїв */
@media (max-width: 480px) {
    .restart-btn {
        font-size: 14px;
        padding: 8px 16px;
    }

    .stats-row {
        font-size: 16px;
        gap: 10px;
    }

    .lives-display {
        font-size: 20px;
        letter-spacing: 1px;
    }

    .score-label {
        font-size: 14px;
    }

    .score-value {
        font-size: 18px;
    }
}

@media (max-width: 375px) {
    .stats-row {
        font-size: 15px;
        gap: 8px;
    }

    .lives-display {
        font-size: 18px;
    }

    .separator {
        display: none;
    }
}

/* Дуже вузькі екрани */
@media (max-width: 320px) {
    .settings-menu-v1 {
        padding: 10px;
        gap: 8px;
    }

    .restart-btn {
        font-size: 13px;
        padding: 6px 12px;
    }

    .stats-row {
        flex-wrap: wrap;
        justify-content: space-around;
        gap: 6px 10px;
        font-size: 14px;
    }
}

/* Стартовий екран */
.start-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 20px;
}

.start-screen.hidden {
    display: none;
}

.start-content {
    background: white;
    padding: 32px;
    border-radius: 20px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modal-appear 0.3s ease-out;
}

/* Модальні вікна */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 20px;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    background: white;
    padding: 32px;
    border-radius: 20px;
    text-align: center;
    max-width: 450px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: modal-appear 0.3s ease-out;
}

@keyframes modal-appear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Інструкції гри */
.game-instructions {
    background: #F0FDF4;
    border: 2px solid #86EFAC;
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
    text-align: left;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #374151;
}

.instruction-item:last-child {
    margin-bottom: 0;
}

.instruction-icon {
    font-size: 20px;
    flex-shrink: 0;
}

/* Еко-факт */
.eco-fact-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 20px;
}

.eco-fact-emoji {
    font-size: 36px;
    flex-shrink: 0;
}

.eco-fact-bubble {
    position: relative;
    background: #FEF9C3;
    border: 2px solid #FCD34D;
    border-radius: 12px;
    padding: 16px;
    text-align: left;
    font-size: 14px;
    color: #374151;
    line-height: 1.5;
}

.eco-fact-bubble::before {
    content: '';
    position: absolute;
    left: -10px;
    top: 16px;
    width: 0;
    height: 0;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    border-right: 10px solid #FCD34D;
}

.eco-fact-bubble::after {
    content: '';
    position: absolute;
    left: -7px;
    top: 18px;
    width: 0;
    height: 0;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 8px solid #FEF9C3;
}

/* Кнопки */
.btn-primary {
    background: linear-gradient(135deg, #22C55E, #16A34A);
    color: white;
    font-size: 18px;
    font-weight: 600;
    padding: 14px 32px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(34, 197, 94, 0.5);
}

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

.btn-secondary {
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    color: white;
    font-size: 18px;
    font-weight: 600;
    padding: 14px 32px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

.btn-secondary:active {
    transform: translateY(0);
}

/* Timer Display */
.timer-display {
    font-size: 24px;
    font-weight: bold;
    color: #2563EB;
    letter-spacing: 2px;
}

/* Адаптивність */
@media (max-width: 640px) {
    .game-area {
        width: 100%;
        height: 450px;
    }

    .basket {
        width: 80px;
        height: 60px;
    }

    .falling-item {
        width: 36px;
        height: 44px;
    }

    .start-content,
    .modal-content {
        padding: 24px;
        margin: 10px;
    }
}

/* Темна тема для модальних вікон */
.modal-title {
    font-size: 28px;
    font-weight: 700;
    color: #166534;
    margin-bottom: 8px;
}

.modal-subtitle {
    font-size: 16px;
    color: #6B7280;
    margin-bottom: 20px;
}

.final-score {
    font-size: 48px;
    font-weight: 700;
    color: #22C55E;
    margin: 20px 0;
}

.final-score span {
    font-size: 16px;
    color: #6B7280;
    display: block;
    margin-top: 4px;
}

.final-message {
    font-size: 20px;
    color: #374151;
    margin-bottom: 24px;
}