* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --player1-color: #10b981;
    --player2-color: #ef4444;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --ground-color: #8b7355;
    --sky-color: #87ceeb;
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-gradient);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
    padding: 20px;
}

h1 {
    color: white;
    font-size: 2.5rem;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
    animation: fadeInDown 0.8s ease;
}

/* Экран выбора режима */
#mode-screen {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    animation: fadeIn 0.5s ease;
}

#mode-screen h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 2rem;
}

.mode-btn {
    display: block;
    width: 100%;
    padding: 20px 40px;
    margin: 15px 0;
    font-size: 1.5rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.mode-btn.single {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.mode-btn.multi {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.mode-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Начальный экран выбора сложности */
#difficulty-screen {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    animation: fadeIn 0.5s ease;
}

#difficulty-screen h2 {
    color: #333;
    margin-bottom: 30px;
    font-size: 2rem;
}

.difficulty-btn {
    display: block;
    width: 100%;
    padding: 15px 30px;
    margin: 10px 0;
    font-size: 1.3rem;
    font-weight: 600;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Poppins', sans-serif;
}

.difficulty-btn.easy {
    background: linear-gradient(135deg, #84fab0 0%, #8fd3f4 100%);
    color: #333;
}

.difficulty-btn.medium {
    background: linear-gradient(135deg, #ffd89b 0%, #19547b 100%);
    color: white;
}

.difficulty-btn.hard {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.difficulty-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

/* Игровой контейнер */
#game-container {
    width: 100%;
    max-width: 900px;
    height: 450px;
    position: relative;
    background: linear-gradient(to bottom, var(--sky-color) 65%, #90ee90 65%, var(--ground-color) 90%);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    margin-bottom: 20px;
}

/* Центральная линия */
#center-line {
    position: absolute;
    left: 50%;
    top: 0;
    width: 4px;
    height: 100%;
    background: repeating-linear-gradient(to bottom,
            #fff 0px,
            #fff 20px,
            transparent 20px,
            transparent 40px);
    transform: translateX(-50%);
    opacity: 0.6;
    z-index: 1;
}

/* Канат */
#rope {
    position: absolute;
    top: 280px;
    left: 50%;
    width: 600px;
    height: 15px;
    background: repeating-linear-gradient(90deg,
            #d2b48c 0px,
            #c19a6b 5px,
            #d2b48c 10px);
    transform: translateX(-50%);
    transition: left 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

/* Красная метка на канате */
#marker {
    position: absolute;
    left: 50%;
    top: -15px;
    width: 15px;
    height: 45px;
    background: linear-gradient(135deg, #ff0000, #cc0000);
    transform: translateX(-50%);
    border-radius: 3px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
    animation: markerPulse 1.5s ease-in-out infinite;
}

@keyframes markerPulse {

    0%,
    100% {
        transform: translateX(-50%) scale(1);
    }

    50% {
        transform: translateX(-50%) scale(1.1);
    }
}

/* Команды */
.team {
    position: absolute;
    bottom: 80px;
    font-size: 60px;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 3;
    filter: drop-shadow(3px 3px 5px rgba(0, 0, 0, 0.3));
}

#player-team {
    left: 15%;
}

#enemy-team {
    right: 15%;
}

.team.pull {
    animation: pullAnimation 0.3s ease;
}

.team.fall {
    animation: fallAnimation 0.8s ease forwards;
}

.team.celebrate {
    animation: celebrateAnimation 1s ease infinite;
}

@keyframes pullAnimation {

    0%,
    100% {
        transform: translateX(0) rotate(0deg);
    }

    50% {
        transform: translateX(-10px) rotate(-5deg);
    }
}

@keyframes fallAnimation {
    to {
        transform: translateY(100px) rotate(90deg);
        opacity: 0;
    }
}

@keyframes celebrateAnimation {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-20px) scale(1.2);
    }
}

/* Интерфейс управления */
#ui-single {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 400px;
    animation: fadeInUp 0.8s ease;
}

/* Split Screen для двух игроков */
.split-screen {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    min-width: 800px;
}

.player-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.8s ease;
}

.player-panel.player1 {
    border: 3px solid var(--player1-color);
}

.player-panel.player2 {
    border: 3px solid var(--player2-color);
}

.player-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 15px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

.player-panel.player1 .player-title {
    color: var(--player1-color);
}

.player-panel.player2 .player-title {
    color: var(--player2-color);
}

.stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 20px;
    font-size: 1.1rem;
    font-weight: 600;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 1.5rem;
    margin-top: 5px;
}

.stat-item.correct .stat-value {
    color: var(--player1-color);
}

.stat-item.wrong .stat-value {
    color: var(--player2-color);
}

.question {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #333;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    min-height: 60px;
}

.player-panel .question {
    font-size: 1.8rem;
}

.answer-input {
    font-size: 1.8rem;
    width: 120px;
    text-align: center;
    padding: 10px;
    border: 3px solid #ddd;
    border-radius: 12px;
    margin-right: 10px;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
}

#answer-input {
    font-size: 2rem;
    width: 150px;
}

.answer-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}

.player-panel.player1 .answer-input:focus {
    border-color: var(--player1-color);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.player-panel.player2 .answer-input:focus {
    border-color: var(--player2-color);
    box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.2);
}

.answer-input.correct {
    animation: correctShake 0.5s ease;
    border-color: var(--player1-color);
}

.answer-input.wrong {
    animation: wrongShake 0.5s ease;
    border-color: var(--player2-color);
}

@keyframes correctShake {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

@keyframes wrongShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-10px);
    }

    75% {
        transform: translateX(10px);
    }
}

button {
    font-size: 1.5rem;
    padding: 12px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.player-panel button {
    font-size: 1.3rem;
    padding: 10px 25px;
}

.player-panel.player1 button {
    background: linear-gradient(135deg, var(--player1-color) 0%, #059669 100%);
}

.player-panel.player2 button {
    background: linear-gradient(135deg, var(--player2-color) 0%, #dc2626 100%);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

button:active {
    transform: translateY(0);
}

.feedback {
    margin-top: 15px;
    font-size: 1rem;
    font-weight: 600;
    min-height: 30px;
}

.feedback.correct {
    color: var(--player1-color);
    animation: fadeIn 0.3s ease;
}

.feedback.wrong {
    color: var(--player2-color);
    animation: fadeIn 0.3s ease;
}

/* Экран результата */
#result-screen-single h2,
#result-screen-multi h2 {
    font-size: 3rem;
    margin-bottom: 20px;
}

.victory {
    color: var(--player1-color);
    animation: victoryPulse 1s ease infinite;
}

.defeat {
    color: var(--player2-color);
}

@keyframes victoryPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.final-stats {
    font-size: 1.3rem;
    margin: 20px 0;
    color: #555;
}

/* Конфетти */
.confetti {
    position: fixed;
    width: 10px;
    height: 10px;
    background: #f0f;
    position: absolute;
    animation: confettiFall 3s linear;
}

@keyframes confettiFall {
    to {
        transform: translateY(100vh) rotate(360deg);
        opacity: 0;
    }
}

/* Анимации появления */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hidden {
    display: none !important;
}

/* Прогресс-бар */
#progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 15px;
}

#progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--player2-color), #fbbf24, var(--player1-color));
    transition: width 0.6s ease;
    border-radius: 10px;
}

/* Адаптивность */
@media (max-width: 900px) {
    .split-screen {
        grid-template-columns: 1fr;
        min-width: 400px;
    }

    .player-panel {
        padding: 20px;
    }

    h1 {
        font-size: 2rem;
    }
}
