* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    background: #000;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    user-select: none;
    -webkit-user-select: none;
}

#game-container {
    width: 100vw;
    height: 100vh;
    position: relative;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* HUD */
#hud {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    pointer-events: none;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px 20px;
    z-index: 10;
}

#scoreboard {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #444;
    border-radius: 8px;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: #fff;
}

.score-team {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.team-name {
    font-size: 10px;
    letter-spacing: 2px;
    color: #aaa;
    font-weight: bold;
}

.team-score {
    font-size: 32px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.score-divider {
    font-size: 24px;
    color: #666;
}

.inning-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-left: 10px;
    padding-left: 15px;
    border-left: 1px solid #444;
}

.inning-display span:first-child {
    font-size: 9px;
    letter-spacing: 2px;
    color: #aaa;
    text-transform: uppercase;
}

.inning-display #inning-num {
    font-size: 28px;
    font-weight: bold;
}

.inning-display #inning-half {
    font-size: 12px;
    color: #ffcc00;
}

/* Count Display */
#count-display {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #444;
    border-radius: 8px;
    padding: 8px 15px;
}

.count-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 3px 0;
}

.count-label {
    color: #aaa;
    font-weight: bold;
    font-size: 14px;
    width: 15px;
}

.count-dots {
    display: flex;
    gap: 4px;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #333;
    border: 1px solid #555;
    display: inline-block;
}

.dot.active-ball {
    background: #4CAF50;
    box-shadow: 0 0 6px #4CAF50;
}

.dot.active-strike {
    background: #f44336;
    box-shadow: 0 0 6px #f44336;
}

.dot.active-out {
    background: #ff9800;
    box-shadow: 0 0 6px #ff9800;
}

/* Bases Display */
#bases-display {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #444;
    border-radius: 8px;
    padding: 5px 10px;
}

.base-diamond {
    fill: #333;
    stroke: #888;
    stroke-width: 2;
}

.base-diamond.occupied {
    fill: #ffcc00;
    stroke: #ffaa00;
    filter: drop-shadow(0 0 4px #ffcc00);
}

/* Batter Info */
#batter-info {
    background: rgba(0, 0, 0, 0.8);
    border: 2px solid #444;
    border-radius: 8px;
    padding: 8px 15px;
    color: #fff;
    text-align: center;
}

#batter-name {
    font-size: 14px;
    font-weight: bold;
}

#batter-avg {
    font-size: 11px;
    color: #aaa;
}

/* Power Meter */
#power-meter {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 300px;
    height: 16px;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #555;
    border-radius: 8px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

#power-meter.active {
    opacity: 1;
}

#power-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4CAF50, #ffcc00, #f44336);
    transition: width 0.05s;
    border-radius: 6px;
}

#power-marker {
    position: absolute;
    top: -3px;
    left: 70%;
    width: 3px;
    height: 22px;
    background: #fff;
    border-radius: 2px;
}

/* Message Display */
#message-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: bold;
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 200, 0, 0.8), 2px 2px 4px rgba(0, 0, 0, 0.8);
    z-index: 20;
    animation: messagePopIn 0.3s ease-out;
    pointer-events: none;
    text-align: center;
    white-space: nowrap;
}

@keyframes messagePopIn {
    0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

.hidden {
    display: none !important;
}

/* Start / Game Over Screens */
#start-screen, #gameover-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.start-content {
    text-align: center;
    color: #fff;
    max-width: 500px;
}

.start-content h1 {
    font-size: 56px;
    margin-bottom: 15px;
    text-shadow: 0 0 30px rgba(255, 200, 0, 0.6);
    letter-spacing: 3px;
}

.start-content p {
    font-size: 16px;
    color: #ccc;
    margin-bottom: 10px;
    line-height: 1.5;
}

.controls-info {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px 25px;
    margin: 20px 0 30px;
    text-align: left;
}

.controls-info h3 {
    font-size: 16px;
    margin-bottom: 10px;
    color: #ffcc00;
}

.controls-info p {
    font-size: 14px;
    margin: 6px 0;
}

.controls-info strong {
    color: #ffcc00;
    display: inline-block;
    min-width: 120px;
}

#start-btn, #restart-btn {
    background: linear-gradient(135deg, #e53935, #c62828);
    color: white;
    border: none;
    padding: 15px 50px;
    font-size: 22px;
    font-weight: bold;
    letter-spacing: 3px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    pointer-events: all;
    text-transform: uppercase;
}

#start-btn:hover, #restart-btn:hover {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(244, 67, 54, 0.5);
}

#final-score {
    font-size: 60px;
    font-weight: bold;
    margin: 20px 0 30px;
    text-shadow: 0 0 20px rgba(255, 200, 0, 0.5);
}

/* Swing direction indicator */
#swing-indicator {
    position: absolute;
    bottom: 110px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    background: rgba(0,0,0,0.5);
    padding: 5px 15px;
    border-radius: 20px;
    pointer-events: none;
    z-index: 10;
}

/* Responsive */
@media (max-width: 768px) {
    #hud {
        flex-wrap: wrap;
        gap: 5px;
        padding: 8px;
    }

    #scoreboard {
        padding: 6px 12px;
    }

    .team-score {
        font-size: 24px;
    }

    .start-content h1 {
        font-size: 36px;
    }

    #power-meter {
        width: 200px;
    }
}

/* Game Toolbar */
#game-toolbar {
    position: absolute;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    z-index: 20;
}

#game-toolbar button {
    width: 44px;
    height: 44px;
    border: 2px solid #555;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.2s;
    pointer-events: all;
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-toolbar button:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #ffcc00;
}

/* Role Indicator */
#role-indicator {
    position: absolute;
    top: 75px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: #ffcc00;
    font-size: 15px;
    font-weight: bold;
    letter-spacing: 2px;
    padding: 6px 22px;
    border-radius: 20px;
    border: 1px solid rgba(255, 204, 0, 0.5);
    z-index: 15;
    pointer-events: none;
    transition: opacity 0.5s;
}

/* Pause Screen */
#pause-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

#resume-btn {
    background: linear-gradient(135deg, #e53935, #c62828);
    color: white;
    border: none;
    padding: 15px 50px;
    font-size: 22px;
    font-weight: bold;
    letter-spacing: 3px;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s;
    pointer-events: all;
    margin-top: 20px;
}

#resume-btn:hover {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(244, 67, 54, 0.5);
}

/* Pitch Aim Indicator */
#pitch-aim-hud {
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 16px;
    border-radius: 15px;
    pointer-events: none;
    z-index: 15;
    white-space: nowrap;
}
