/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(180deg, #87CEEB 0%, #B0E0E6 100%);
    min-height: 100vh;
    overflow: hidden;
}

#gameContainer {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* Menu Styles */
.menu-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: linear-gradient(180deg, #87CEEB 0%, #98FB98 100%);
    z-index: 100;
}

.hidden {
    display: none !important;
}

.game-title {
    font-family: 'Fredoka One', cursive;
    font-size: 5rem;
    color: #2E8B57;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.3);
    margin-bottom: 1rem;
    animation: titleBounce 2s ease-in-out infinite;
}

.subtitle {
    font-size: 1.3rem;
    color: #666;
    margin: 0 0 1.5rem 0;
    font-style: italic;
    font-family: 'Nunito', sans-serif;
}

@keyframes titleBounce {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

@keyframes cloudsMove {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(0%); }
}

/* Removed dinosaur animation - now using simple cloud movement */

.menu-buttons, .player-buttons {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.menu-btn, .player-btn, .back-btn {
    background: linear-gradient(45deg, #FF6B6B, #FFE66D);
    border: none;
    border-radius: 25px;
    padding: 1.5rem 3rem;
    font-family: 'Nunito', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    min-width: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.menu-btn:hover, .player-btn:hover, .back-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 12px 24px rgba(0,0,0,0.4);
}

.btn-icon, .player-icon {
    font-size: 2.5rem;
}

.back-btn {
    background: linear-gradient(45deg, #6C757D, #ADB5BD);
    margin-top: 2rem;
    min-width: 150px;
}

/* Settings Styles */
.settings-panel {
    background: rgba(255,255,255,0.9);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    margin-bottom: 2rem;
}

.setting-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    min-width: 300px;
    gap: 1rem;
}

.setting-group .setting-label {
    flex: 1;
}

.setting-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: #2E8B57;
}

.setting-icon {
    font-size: 1.5rem;
}

input[type="checkbox"] {
    transform: scale(1.5);
    cursor: pointer;
}

select {
    padding: 0.5rem;
    border-radius: 10px;
    border: 2px solid #2E8B57;
    font-size: 1rem;
    cursor: pointer;
}

.clear-score-btn {
    background: linear-gradient(45deg, #FF6B6B, #FF8E8E);
    color: white;
    border: none;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 3px 6px rgba(255, 107, 107, 0.3);
}

.clear-score-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 10px rgba(255, 107, 107, 0.4);
}

.clear-score-btn:active {
    transform: translateY(0px);
    box-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
}

.setting-group-center {
    display: flex;
    justify-content: center;
    margin: 1rem 0;
}

/* Instructions Styles */
.instructions-content {
    background: rgba(255,255,255,0.9);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    margin-bottom: 2rem;
    max-width: 500px;
}

.instruction-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
    color: #2E8B57;
    font-weight: 600;
}

.instruction-icon {
    font-size: 2rem;
    background: linear-gradient(45deg, #FFE66D, #FF6B6B);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

/* Game Screen Styles */
#gameScreen {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #87CEEB 0%, #B0E0E6 50%, #98FB98 100%);
    position: relative;
}

#gameHeader {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 50;
}

#scoreDisplay {
    background: rgba(255,255,255,0.9);
    border-radius: 15px;
    padding: 0.5rem 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: #2E8B57;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    white-space: nowrap;
}

/* High Score Celebration Styles */
.high-score-celebration {
    background: linear-gradient(45deg, #FFD700, #FFA500);
    border-radius: 15px;
    padding: 1rem;
    margin: 1rem 0;
    border: 3px solid #FF6B6B;
    animation: celebrationPulse 2s ease-in-out infinite;
}

.new-record {
    color: #8B0000;
    font-weight: 800;
    font-size: 1.2rem;
}

@keyframes celebrationPulse {
    0%, 100% { 
        transform: scale(1);
        box-shadow: 0 4px 8px rgba(255, 107, 107, 0.3);
    }
    50% { 
        transform: scale(1.02);
        box-shadow: 0 8px 16px rgba(255, 107, 107, 0.5);
    }
}

#gameControls {
    display: flex;
    gap: 0.5rem;
}

#pauseBtn, #menuBtn {
    background: rgba(255,255,255,0.9);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

#pauseBtn:hover, #menuBtn:hover {
    transform: scale(1.1);
}

/* Players Container */
#playersContainer {
    position: absolute;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    gap: 4px;
}

/* Dynamic grid layouts for different player counts */
.players-1 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
}

.players-2 {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
}

.players-3 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.players-4 {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
}

.player-area {
    position: relative;
    background: linear-gradient(180deg, #87CEEB 0%, #B0E0E6 50%, #90EE90 100%);
    border: 4px solid #2E8B57;
    border-radius: 20px;
    overflow: hidden;
}

/* Add moving clouds for atmosphere */
.player-area::before {
    content: '☁️ ☁️ ☁️ ☁️ ☁️';
    position: absolute;
    top: 10%;
    left: 0;
    width: 200%;
    height: 20%;
    font-size: 1.5rem;
    opacity: 0.6;
    animation: cloudsMove 20s linear infinite;
    pointer-events: none;
    z-index: 1;
}

.player-info {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(255,255,255,0.9);
    border-radius: 10px;
    padding: 0.5rem;
    font-weight: 700;
    color: #2E8B57;
    z-index: 10;
}

.game-ground {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(180deg, #90EE90 0%, #228B22 100%);
    background-image: 
        repeating-linear-gradient(
            90deg,
            transparent 0px,
            transparent 60px,
            rgba(0,0,0,0.1) 61px,
            rgba(0,0,0,0.1) 62px
        );
}

/* Character Sprites */
.dino {
    position: absolute;
    bottom: 120px;
    left: 60px;
    width: 80px;
    height: 80px;
    background: #4ECDC4;
    border-radius: 50% 50% 40% 40%;
    transition: bottom 0.4s ease;
    z-index: 20;
}

.dino::before {
    content: '';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 30px;
    background: #4ECDC4;
    border-radius: 50% 50% 0 0;
}

.dino::after {
    content: '👁️👁️';
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
    z-index: 1;
}

/* Different colors for each player */
.dino.player-1 {
    background: #FF4444;
}

.dino.player-1::before {
    background: #FF4444;
}

.dino.player-2 {
    background: #4488FF;
}

.dino.player-2::before {
    background: #4488FF;
}

.dino.player-3 {
    background: #FFD700;
}

.dino.player-3::before {
    background: #FFD700;
}

.dino.player-4 {
    background: #44AA44;
}

.dino.player-4::before {
    background: #44AA44;
}

.dino.jumping {
    bottom: 280px;
    animation: jump 0.8s ease-in-out;
}

@keyframes jump {
    0% { bottom: 120px; }
    50% { bottom: 300px; }
    100% { bottom: 120px; }
}

.dino.running {
    animation: run 0.3s infinite alternate;
}

@keyframes run {
    0% { transform: scaleX(1) rotate(-2deg); }
    100% { transform: scaleX(1.1) rotate(2deg); }
}

/* Different colored dinos for each player */
.dino.player-1 { background: #FF4444; }
.dino.player-1::before { background: #FF4444; }

.dino.player-2 { background: #4488FF; }
.dino.player-2::before { background: #4488FF; }

.dino.player-3 { background: #FFD700; }
.dino.player-3::before { background: #FFD700; }

.dino.player-4 { background: #44AA44; }
.dino.player-4::before { background: #44AA44; }

/* Obstacles */
.obstacle {
    position: absolute;
    bottom: 120px;
    right: -120px;
    z-index: 15;
    animation: moveLeft linear;
}

.tree {
    width: 40px;
    height: 100px;
    position: relative;
}

.tree::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 40px;
    background: #8B4513;
    border-radius: 5px;
}

.tree::after {
    content: attr(data-tree-type);
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    font-size: 50px;
    z-index: 1;
}

/* Fallback if data attribute not set */
.tree:not([data-tree-type])::after {
    content: '🌳';
}

@keyframes moveLeft {
    0% { right: -120px; }
    100% { right: 100%; }
}

/* Per-Player Jump Hint System */
.player-hint-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,0,0.15);
    z-index: 90;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.hint-players {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    justify-items: center;
    margin-top: 0.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.hint-player-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.hint-warning {
    font-size: 8rem;
    animation: warningPulse 1s ease-in-out infinite;
    margin-bottom: 2rem;
}

.hint-jump {
    font-size: 10rem;
    animation: jumpPulse 0.8s ease-in-out infinite;
}

@keyframes warningPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.1); opacity: 1; }
}

@keyframes jumpPulse {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.1); opacity: 1; }
}

/* Clouds */
.cloud {
    position: absolute;
    background: white;
    border-radius: 50px;
    opacity: 0.9;
    animation: cloudMove 25s linear infinite;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.cloud::before {
    content: '';
    position: absolute;
    background: white;
    border-radius: 50px;
}

.cloud::after {
    content: '';
    position: absolute;
    background: white;
    border-radius: 50px;
}

.cloud-1 {
    width: 120px;
    height: 50px;
    top: 8%;
    right: -150px;
}

.cloud-1::before {
    width: 80px;
    height: 60px;
    top: -30px;
    left: 15px;
}

.cloud-1::after {
    width: 60px;
    height: 50px;
    top: -25px;
    right: 20px;
}

.cloud-2 {
    width: 100px;
    height: 40px;
    top: 20%;
    right: -120px;
    animation-delay: -8s;
    animation-duration: 30s;
}

.cloud-2::before {
    width: 60px;
    height: 50px;
    top: -25px;
    left: 20px;
}

.cloud-2::after {
    width: 50px;
    height: 40px;
    top: -20px;
    right: 25px;
}

.cloud-3 {
    width: 90px;
    height: 35px;
    top: 5%;
    right: -110px;
    animation-delay: -15s;
    animation-duration: 35s;
}

.cloud-3::before {
    width: 55px;
    height: 45px;
    top: -22px;
    left: 18px;
}

.cloud-3::after {
    width: 45px;
    height: 38px;
    top: -18px;
    right: 22px;
}

@keyframes cloudMove {
    0% { right: -150px; }
    100% { right: 100%; }
}

/* Game Over Screen */
#finalScores {
    background: rgba(255,255,255,0.9);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    text-align: center;
}

.score-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #2E8B57;
}

.player-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .game-title {
        font-size: 2.5rem;
    }
    
    .menu-btn, .player-btn {
        font-size: 1.2rem;
        min-width: 180px;
    }
    
    .dino {
        width: 40px;
        height: 40px;
    }
    
    .hint-warning {
        font-size: 2rem;
    }
    
    .hint-jump {
        font-size: 2.5rem;
    }
}
