/* BO Sports Baseball - Styles */
/* BOSsports Dark Theme: #1a1a2e bg, #4ecca3 accent, #16213e cards */

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #1a1a2e;
    color: #ffffff;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

#game-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Screens */
.screen {
    display: none;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

/* Menu Screen */
#menu-screen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
}

.menu-content {
    text-align: center;
    padding: 20px;
}

.game-title {
    font-size: clamp(2rem, 8vw, 4rem);
    font-weight: 900;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 40px;
    text-shadow: 0 0 20px rgba(78, 204, 163, 0.5);
}

.game-title span {
    display: block;
    color: #4ecca3;
    font-size: 1.2em;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.menu-btn {
    background: linear-gradient(135deg, #4ecca3 0%, #38b88a 100%);
    border: none;
    color: #1a1a2e;
    font-size: clamp(1rem, 4vw, 1.25rem);
    font-weight: 700;
    padding: 15px 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.menu-btn:hover, .menu-btn:active {
    transform: scale(1.05);
    box-shadow: 0 0 20px rgba(78, 204, 163, 0.6);
}

.menu-btn.secondary {
    background: #16213e;
    color: #4ecca3;
    border: 2px solid #4ecca3;
}

.menu-btn.secondary:hover {
    background: #4ecca3;
    color: #1a1a2e;
}

.menu-instructions {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.brand-link {
    color: #4ecca3;
    text-decoration: none;
    font-size: 0.9rem;
}

.brand-link:hover {
    text-decoration: underline;
}

/* Game Screen */
#game-screen, #derby-screen, #pitching-screen {
    background: #1a1a2e;
}

/* Scoreboard */
#scoreboard, #derby-scoreboard, #pitching-scoreboard {
    background: #16213e;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    z-index: 10;
    border-bottom: 2px solid #4ecca3;
}

.score-section {
    display: flex;
    gap: 20px;
}

.team-score {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.team-name {
    font-size: 0.7rem;
    color: #888;
    text-transform: uppercase;
}

.runs {
    font-size: 1.5rem;
    font-weight: 700;
    color: #4ecca3;
}

.game-info {
    display: flex;
    gap: 15px;
    align-items: center;
}

.inning-display {
    font-size: 1rem;
    font-weight: 600;
}

.count-display {
    font-size: 1rem;
    color: #ccc;
}

.outs-display {
    margin-left: 10px;
    color: #ff6b6b;
    font-weight: 600;
}

/* Base Diamond Display */
.base-display {
    display: flex;
    align-items: center;
}

.diamond {
    position: relative;
    width: 45px;
    height: 45px;
}

.base {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #333;
    transform: rotate(45deg);
    border: 1px solid #555;
}

.base.active {
    background: #4ecca3;
    border-color: #4ecca3;
    box-shadow: 0 0 8px #4ecca3;
}

.base.first {
    right: 0;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

.base.second {
    top: 0;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
}

.base.third {
    left: 0;
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

.base.home {
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    background: #fff;
}

/* Canvas */
canvas {
    flex: 1;
    width: 100%;
    display: block;
    cursor: pointer;
}

/* Game Message */
#game-message, #derby-message, #pitching-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: clamp(1.5rem, 6vw, 3rem);
    font-weight: 900;
    color: #4ecca3;
    text-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 20;
}

#game-message.show, #derby-message.show, #pitching-message.show {
    opacity: 1;
}

/* Swing Indicator */
#swing-indicator {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1rem;
    color: #4ecca3;
    opacity: 0;
    pointer-events: none;
    animation: pulse 0.3s ease-out;
}

#swing-indicator.show {
    opacity: 1;
}

@keyframes pulse {
    0% { transform: translateX(-50%) scale(1); opacity: 1; }
    100% { transform: translateX(-50%) scale(1.5); opacity: 0; }
}

/* Back Button */
.back-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(22, 33, 62, 0.9);
    border: 1px solid #4ecca3;
    color: #4ecca3;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8rem;
    z-index: 100;
    transition: background 0.2s;
}

.back-button:hover {
    background: #4ecca3;
    color: #1a1a2e;
}

/* Derby Scoreboard */
#derby-scoreboard {
    justify-content: center;
}

.derby-info {
    display: flex;
    gap: 30px;
    font-size: 1.2rem;
    font-weight: 600;
}

.derby-info span span {
    color: #4ecca3;
}

/* Pitching Controls */
.pitch-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.pitch-type-btn {
    background: #1a1a2e;
    border: 2px solid #4ecca3;
    color: #4ecca3;
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.2s;
}

.pitch-type-btn:hover, .pitch-type-btn.active {
    background: #4ecca3;
    color: #1a1a2e;
}

.pitch-type-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Pitch Target */
#pitch-target {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #4ecca3;
    border-radius: 50%;
    pointer-events: none;
    display: none;
    z-index: 15;
}

#pitch-target.show {
    display: block;
}

/* Game Over Screen */
#gameover-screen {
    background: rgba(26, 26, 46, 0.95);
    justify-content: center;
    align-items: center;
}

.gameover-content {
    text-align: center;
    padding: 30px;
}

#gameover-title {
    font-size: clamp(2rem, 8vw, 3rem);
    color: #4ecca3;
    margin-bottom: 30px;
}

.final-score {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 20px;
}

.final-team {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.final-team span:first-child {
    font-size: 1rem;
    color: #888;
}

.final-team span:last-child {
    font-size: 3rem;
    font-weight: 900;
    color: #4ecca3;
}

#game-stats {
    color: #aaa;
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.gameover-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

/* Footer */
.game-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #16213e;
    padding: 8px;
    text-align: center;
    font-size: 0.75rem;
    z-index: 1000;
    border-top: 1px solid #333;
}

.game-footer a {
    color: #4ecca3;
    text-decoration: none;
}

.game-footer a:hover {
    text-decoration: underline;
}

.game-footer span {
    color: #555;
    margin: 0 10px;
}

/* Responsive */
@media (max-width: 600px) {
    #scoreboard, #pitching-scoreboard {
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    .score-section {
        gap: 15px;
    }

    .runs {
        font-size: 1.25rem;
    }

    .game-info {
        gap: 10px;
    }

    .diamond {
        width: 35px;
        height: 35px;
    }

    .base {
        width: 10px;
        height: 10px;
    }

    .pitch-controls {
        gap: 5px;
    }

    .pitch-type-btn {
        padding: 6px 10px;
        font-size: 0.7rem;
    }

    .back-button {
        padding: 6px 10px;
        font-size: 0.7rem;
    }
}

@media (max-height: 500px) {
    #scoreboard, #derby-scoreboard, #pitching-scoreboard {
        padding: 5px 10px;
    }

    .runs {
        font-size: 1.1rem;
    }

    .diamond {
        width: 30px;
        height: 30px;
    }

    .game-footer {
        padding: 5px;
        font-size: 0.65rem;
    }
}

/* Landscape mobile */
@media (max-height: 450px) and (orientation: landscape) {
    .game-footer {
        display: none;
    }
}

/* Bottom Left Ad Banner */
#ad-banner-left {
    position: fixed;
    bottom: 35px;
    left: 10px;
    z-index: 999;
    background: rgba(22, 33, 62, 0.8);
    border-radius: 5px;
    overflow: hidden;
}

@media (max-width: 500px) {
    #ad-banner-left {
        display: none;
    }
}

@media (max-height: 450px) {
    #ad-banner-left {
        display: none;
    }
}
