/* SkiFree - Classic Skiing Game */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

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

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(180deg, #87ceeb 0%, #e0f4ff 50%, #fff 100%);
    min-height: 100vh;
    color: #333;
    overflow: hidden;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.game-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 10px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.back-btn {
    display: inline-block;
    color: #2980b9;
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 10px;
    transition: color 0.3s;
}

.back-btn:hover {
    color: #1a5276;
}

/* Header */
.game-header {
    text-align: center;
    margin-bottom: 10px;
}

.game-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: #2980b9;
    text-shadow: 2px 2px 0 #fff, 3px 3px 0 rgba(0,0,0,0.1);
    letter-spacing: 4px;
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.stat-item {
    background: rgba(255, 255, 255, 0.8);
    padding: 8px 18px;
    border-radius: 20px;
    border: 2px solid #2980b9;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.stat-label {
    color: #666;
    font-size: 0.7rem;
    margin-right: 5px;
}

.stat-item span:last-child {
    font-weight: 700;
    font-size: 1rem;
    color: #2980b9;
}

/* Screens */
.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

.screen.hidden {
    display: none;
}

/* Start Screen */
.ski-art {
    margin-bottom: 20px;
}

.skier {
    font-size: 4rem;
    animation: ski-wobble 1s ease-in-out infinite;
}

@keyframes ski-wobble {
    0%, 100% { transform: rotate(-5deg); }
    50% { transform: rotate(5deg); }
}

.trees {
    font-size: 2rem;
    margin-top: 10px;
    letter-spacing: 15px;
}

#startScreen h2 {
    font-size: 1.3rem;
    color: #2980b9;
    margin-bottom: 10px;
}

.instructions {
    color: #666;
    margin-bottom: 20px;
    font-size: 0.95rem;
    max-width: 350px;
}

/* High Scores Panel */
.high-scores-panel {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #2980b9;
    border-radius: 15px;
    padding: 15px 25px;
    margin-bottom: 20px;
    min-width: 280px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.high-scores-panel h3 {
    color: #2980b9;
    font-size: 1rem;
    margin-bottom: 10px;
}

.high-scores-panel ol {
    list-style: none;
    text-align: left;
}

.high-scores-panel li {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(41, 128, 185, 0.2);
    font-size: 0.9rem;
}

.high-scores-panel li:last-child {
    border-bottom: none;
}

.high-scores-panel .score-name {
    color: #333;
}

.high-scores-panel .score-value {
    color: #27ae60;
    font-weight: 700;
}

/* Buttons */
.play-btn {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: #fff;
    border: none;
    padding: 15px 40px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 30px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
}

.play-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.5);
}

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

.menu-btn {
    display: inline-block;
    background: transparent;
    color: #2980b9;
    border: 2px solid #2980b9;
    padding: 12px 25px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 25px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    margin-left: 15px;
}

.menu-btn:hover {
    background: #2980b9;
    color: #fff;
}

/* Game Screen */
#gameScreen {
    padding: 0;
    background: #fff;
}

#gameCanvas {
    display: block;
    margin: 0 auto;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    cursor: pointer;
    max-width: 100%;
    touch-action: none;
}

/* Game Over Screen */
#gameOverTitle {
    font-size: 2rem;
    font-weight: 800;
    color: #e74c3c;
    margin-bottom: 10px;
}

.game-over-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.final-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.final-stat {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #2980b9;
    border-radius: 15px;
    padding: 15px 25px;
    min-width: 120px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.final-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
    color: #2980b9;
}

.final-label {
    display: block;
    font-size: 0.8rem;
    color: #666;
    margin-top: 5px;
}

/* New High Score */
.new-high-score {
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.1) 0%, rgba(46, 204, 113, 0.1) 100%);
    border: 2px solid #27ae60;
    border-radius: 15px;
    padding: 20px 30px;
    margin-bottom: 25px;
    animation: glow-green 1s ease-in-out infinite;
}

@keyframes glow-green {
    0%, 100% { box-shadow: 0 0 15px rgba(39, 174, 96, 0.3); }
    50% { box-shadow: 0 0 30px rgba(39, 174, 96, 0.5); }
}

.new-high-score p {
    font-size: 1.3rem;
    font-weight: 800;
    color: #27ae60;
    margin-bottom: 15px;
}

.new-high-score input {
    background: #fff;
    border: 2px solid #27ae60;
    border-radius: 10px;
    padding: 12px 18px;
    color: #333;
    font-size: 1rem;
    width: 180px;
    text-align: center;
    margin-right: 10px;
}

.new-high-score input::placeholder {
    color: #999;
}

.save-btn {
    background: #27ae60;
    color: #fff;
    border: none;
    padding: 12px 22px;
    font-size: 0.95rem;
    font-weight: 700;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.save-btn:hover {
    background: #219a52;
    transform: translateY(-2px);
}

.game-over-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

/* Responsive */
@media (max-width: 600px) {
    .game-header h1 {
        font-size: 1.7rem;
    }

    .stats-bar {
        gap: 10px;
    }

    .stat-item {
        padding: 6px 12px;
    }

    .skier {
        font-size: 3rem;
    }

    .game-over-buttons {
        flex-direction: column;
    }

    .menu-btn {
        margin-left: 0;
    }
}
