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

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(to bottom, #1a4d2e 0%, #2d5016 50%, #4a7c59 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 900px;
    height: 600px;
    background: linear-gradient(to bottom, #87CEEB 0%, #98D8E8 50%, #8B7355 50%, #654321 100%);
    border: 8px solid #8B4513;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.8),
                inset 0 0 20px rgba(0, 0, 0, 0.3);
    border-radius: 10px;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

#ui {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
    z-index: 10;
}

#score, #highScore, #pitchSpeed {
    background: rgba(0, 0, 0, 0.7);
    color: #FFD700;
    padding: 12px 20px;
    font-size: 20px;
    font-weight: bold;
    border: 3px solid #FFD700;
    border-radius: 8px;
    text-shadow: 2px 2px 4px #000;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(0, 0, 0, 0.85);
    z-index: 100;
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
}

.screen.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.95);
    visibility: hidden;
}

.retro-title {
    font-size: 64px;
    color: #FFD700;
    text-shadow: 
        4px 4px 0 #FF4500,
        8px 8px 0 #000,
        0 0 20px #FFD700;
    letter-spacing: 8px;
    margin-bottom: 10px;
    animation: titlePulse 2s ease-in-out infinite;
}

@keyframes titlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.subtitle {
    font-size: 20px;
    color: #87CEEB;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px #000;
}

.menu-box {
    background: rgba(139, 69, 19, 0.9);
    padding: 40px;
    border-radius: 15px;
    border: 4px solid #FFD700;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

.retro-btn {
    background: linear-gradient(to bottom, #FFD700 0%, #FFA500 100%);
    border: 4px solid #8B4513;
    color: #000;
    font-size: 24px;
    font-weight: bold;
    padding: 15px 40px;
    margin: 10px;
    cursor: pointer;
    border-radius: 10px;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.5);
    box-shadow: 0 6px 0 #8B4513, 0 8px 15px rgba(0, 0, 0, 0.5);
    transition: all 0.1s;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
}

.retro-btn:hover {
    background: linear-gradient(to bottom, #FFA500 0%, #FFD700 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #8B4513, 0 10px 20px rgba(0, 0, 0, 0.6);
}

.retro-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #8B4513, 0 3px 5px rgba(0, 0, 0, 0.5);
}

.retro-btn.secondary {
    background: linear-gradient(to bottom, #87CEEB 0%, #4682B4 100%);
    color: #fff;
}

.retro-btn.secondary:hover {
    background: linear-gradient(to bottom, #4682B4 0%, #87CEEB 100%);
}

.instructions {
    margin-top: 30px;
    text-align: left;
    color: #FFD700;
}

.instructions h3 {
    font-size: 22px;
    margin-bottom: 15px;
    text-align: center;
    text-decoration: underline;
}

.instructions p {
    font-size: 16px;
    margin: 8px 0;
    line-height: 1.6;
}

.game-over-title {
    font-size: 56px;
    color: #FF4500;
    text-shadow: 
        3px 3px 0 #FFD700,
        6px 6px 0 #000;
    margin-bottom: 20px;
    animation: gameOverShake 0.5s;
}

@keyframes gameOverShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px) rotate(-2deg); }
    75% { transform: translateX(10px) rotate(2deg); }
}

.final-score {
    font-size: 36px;
    color: #FFD700;
    text-shadow: 2px 2px 4px #000;
    margin-bottom: 30px;
}

.celebration {
    font-size: 32px;
    color: #FFD700;
    text-shadow: 2px 2px 4px #000;
    animation: celebration 0.6s ease-in-out infinite;
    margin-bottom: 20px;
}

@keyframes celebration {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(-5deg) scale(1.1); }
    75% { transform: rotate(5deg) scale(1.1); }
}

.name-entry {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.name-entry label {
    font-size: 20px;
    color: #FFD700;
    text-shadow: 2px 2px 4px #000;
}

#nameInput {
    font-family: 'Courier New', monospace;
    font-size: 24px;
    padding: 10px 20px;
    border: 4px solid #FFD700;
    border-radius: 8px;
    background: #000;
    color: #FFD700;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 4px;
    width: 250px;
}

#nameInput:focus {
    outline: none;
    box-shadow: 0 0 20px #FFD700;
}

.button-group {
    display: flex;
    gap: 20px;
    margin-top: 20px;
}

.scores-container {
    background: rgba(0, 0, 0, 0.8);
    padding: 20px;
    border-radius: 10px;
    border: 4px solid #FFD700;
    max-height: 400px;
    overflow-y: auto;
    width: 600px;
    margin: 20px 0;
}

.scores-table {
    width: 100%;
    border-collapse: collapse;
    color: #FFD700;
}

.scores-table thead {
    background: rgba(255, 215, 0, 0.2);
    position: sticky;
    top: 0;
}

.scores-table th {
    padding: 12px;
    text-align: left;
    font-size: 18px;
    border-bottom: 3px solid #FFD700;
}

.scores-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
    font-size: 16px;
}

.scores-table tr:hover {
    background: rgba(255, 215, 0, 0.1);
}

.rank-1 {
    color: #FFD700;
    font-weight: bold;
    font-size: 18px;
}

.rank-2 {
    color: #C0C0C0;
    font-weight: bold;
}

.rank-3 {
    color: #CD7F32;
    font-weight: bold;
}

.no-scores {
    color: #87CEEB;
    font-size: 20px;
    text-align: center;
    padding: 40px;
}

#swingFeedback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 64px;
    font-weight: bold;
    color: #FFD700;
    text-shadow: 
        4px 4px 0 #FF4500,
        8px 8px 0 #000;
    pointer-events: none;
    z-index: 50;
    animation: feedbackPop 0.8s ease-out;
}

@keyframes feedbackPop {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(0.5);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -100%) scale(1);
    }
}

.hidden {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

/* For elements that need to be completely removed from layout */
.completely-hidden {
    display: none !important;
}

/* Scrollbar styling for scores list */
.scores-container::-webkit-scrollbar {
    width: 12px;
}

.scores-container::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
}

.scores-container::-webkit-scrollbar-thumb {
    background: #FFD700;
    border-radius: 10px;
}

.scores-container::-webkit-scrollbar-thumb:hover {
    background: #FFA500;
}

@media (max-width: 950px) {
    #game-container {
        width: 100vw;
        height: 100vh;
        border: none;
        border-radius: 0;
    }
    
    .retro-title {
        font-size: 48px;
    }
    
    .menu-box {
        padding: 20px;
    }
    
    .scores-container {
        width: 90%;
    }
}
