/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: transparent;
    font-family: 'Arial', 'Helvetica', sans-serif;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* Outer container */
.outer-container {
    width: 1080px;
    height: 720px;
    background: transparent;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 20px;
}

/* Outer container when scoreboard is fullscreen */
.outer-container.fullscreen-mode {
    width: 100vw;
    height: 100vh;
    padding: 0;
    align-items: flex-start;
    justify-content: flex-start;
}

/* Main scoreboard container */
.scoreboard {
    display: flex;
    background: rgba(0, 0, 0, 0.85);
    border: 3px solid #ffffff;
    border-radius: 8px;
    padding: 8px 12px;
    gap: 12px;
    width: 350px;
    height: 125px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

/* Fullscreen mode - MLB style exact layout */
.scoreboard.fullscreen {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border: none;
    padding: 0;
    gap: 0;
    flex-direction: row;
    background: transparent;
}

/* Teams section in fullscreen - left side 60% width */
.scoreboard.fullscreen .teams-section {
    flex-direction: column;
    gap: 0;
    width: 60vw;
    height: 67vh;
}

.scoreboard.fullscreen .team {
    flex: 1;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0;
    padding-left: 3vw;
    gap: 0;
    height: 33.5vh;
}

/* Away team - top with glass effect blue background */
.scoreboard.fullscreen .away-team {
    background: rgba(15, 98, 219, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    order: 1;
}

/* Home team - bottom with glass effect yellow/gold background */
.scoreboard.fullscreen .home-team {
    background: rgba(220, 168, 2, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    order: 2;
}

.scoreboard.fullscreen .team-name {
    font-size: 12vh;
    font-weight: 800;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
    text-shadow: none;
    color: #fff;
    flex: 1;
    line-height: 1.2;
    margin-left: 2vw;
    display: flex;
    align-items: center;
}

.scoreboard.fullscreen .team-score {
    font-size: 18vh;
    font-weight: 700;
    min-width: 20vw;
    text-align: center;
    color: #fff;
    text-shadow: none;
    line-height: 1.2;
    padding-right: 3vw;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Right side container - 40% width for bases */
.scoreboard.fullscreen .game-info-section {
    flex-direction: column;
    width: 40vw;
    height: 100vh;
    background: transparent;
    padding: 0;
    gap: 0;
    align-items: stretch;
    justify-content: flex-start;
}

/* Bases area - top 67vh - glass effect */
.scoreboard.fullscreen .count-bases-row {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 67vh;
    background: rgba(51, 51, 51, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    align-items: center;
    justify-content: center;
    position: relative;
    order: 1;
}

/* Hide count display from bases area completely */
.scoreboard.fullscreen .count-bases-row > .count-display {
    display: none !important;
}

/* Bases display - diamond in center */
.scoreboard.fullscreen .bases-display {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scoreboard.fullscreen .base-diamond {
    position: relative;
    width: 25vw;
    height: 40vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding: 3vh 0;
}

.scoreboard.fullscreen .base {
    width: 7vw;
    height: 7vw;
    border-width: 4px;
    border-style: solid;
    border-color: #fff;
    background: rgba(51, 51, 51, 0.85);
    border-radius: 6px;
    transform: rotate(45deg);
}

/* Second base - top center */
.scoreboard.fullscreen .base.second-base {
    position: relative;
}

/* Show base-row and position it */
.scoreboard.fullscreen .base-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 3vw;
}

/* First base - bottom right */
.scoreboard.fullscreen .base.first-base {
    position: relative;
}

/* Third base - bottom left */
.scoreboard.fullscreen .base.third-base {
    position: relative;
}

.scoreboard.fullscreen .base.occupied {
    background: #ffcc00;
    box-shadow: none;
}

/* Bottom info bar - 33vh - glass effect */
.scoreboard.fullscreen .inning-display {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 33vh;
    width: 100vw;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 0 6vw;
    order: 2;
}

/* Inning section - left side with number and indicator */
.scoreboard.fullscreen .inning-label {
    display: none;
}

.scoreboard.fullscreen .inning-value {
    font-size: 10vw;
    color: #fff;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    gap: 1vw;
    flex: 0 0 auto;
    order: 1;
}

.scoreboard.fullscreen .inning-indicator {
    font-size: 7vw;
    color: #fff;
    line-height: 1;
}

/* BSO display - center */
.scoreboard.fullscreen .inning-display::before {
    content: 'B: ' attr(data-balls) ' S: ' attr(data-strikes) ' O: ' attr(data-outs);
    font-size: 7vw;
    color: #fff;
    font-weight: 700;
    line-height: 1;
    order: 2;
    white-space: nowrap;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* Hide the ::after since we combined everything in ::before */
.scoreboard.fullscreen .inning-display::after {
    content: '';
    display: none;
}

/* Teams section */
.teams-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.team {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.team-name {
    color: #ffffff;
    font-size: 21px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    flex: 1;
    min-width: 0;
}

.team-score {
    color: #ffcc00;
    font-size: 38px;
    font-weight: bold;
    min-width: 40px;
    text-align: right;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    transition: transform 0.3s ease, color 0.3s ease;
}

/* Score change animation */
@keyframes scoreChange {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
        color: #00ff00;
    }

    100% {
        transform: scale(1);
    }
}

.team-score.score-change {
    animation: scoreChange 0.3s ease;
}

/* Game info section */
.game-info-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 70px;
}

/* Inning display */
.inning-display {
    display: flex;
    align-items: center;
    gap: 4px;
}

.inning-label {
    color: #cccccc;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.3px;
}

.inning-value {
    display: flex;
    align-items: center;
    gap: 2px;
    color: #ffffff;
    font-size: 22px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.inning-indicator {
    font-size: 16px;
    color: #ffcc00;
}

/* Count and Bases Row */
.count-bases-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Count display (balls, strikes, outs) */
.count-display {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.count-row {
    display: flex;
    align-items: center;
    gap: 3px;
}

.count-label {
    color: #cccccc;
    font-size: 13px;
    font-weight: bold;
    letter-spacing: 0.3px;
    min-width: 8px;
}

.count-value {
    color: #ffffff;
    font-size: 19px;
    font-weight: bold;
    min-width: 12px;
    text-align: center;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Bases display */
.bases-display {
    display: flex;
    justify-content: center;
    align-items: center;
}

.base-diamond {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.base-row {
    display: flex;
    gap: 14px;
    align-items: center;
}

.base {
    width: 10px;
    height: 10px;
    background: transparent;
    border: 1.5px solid #ffffff;
    transform: rotate(45deg);
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
}

.base.occupied {
    background: #00ff00;
    box-shadow: 0 0 6px rgba(0, 255, 0, 0.6);
}

/* Responsive design */
@media (max-width: 768px) {
    .scoreboard {
        flex-direction: column;
        padding: 12px 16px;
        gap: 16px;
    }

    .team-name {
        font-size: 35px;
    }

    .team-score {
        font-size: 57px;
        min-width: 60px;
    }

    .game-info-section {
        flex-direction: row;
        justify-content: space-around;
        min-width: auto;
    }

    .inning-display {
        flex-direction: column;
        align-items: center;
        gap: 4px;
    }

    .count-display {
        gap: 6px;
    }
}

@media (max-width: 480px) {
    .scoreboard {
        padding: 8px 12px;
        gap: 12px;
    }

    .team-name {
        font-size: 28px;
    }

    .team-score {
        font-size: 44px;
        min-width: 50px;
    }

    .inning-value {
        font-size: 32px;
    }

    .count-indicator {
        width: 12px;
        height: 12px;
    }

    .count-label {
        font-size: 19px;
    }

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

    .base-row {
        gap: 24px;
    }
}

/* High contrast mode for better readability */
@media (prefers-contrast: high) {
    .scoreboard {
        border-width: 4px;
        background: rgba(0, 0, 0, 0.95);
    }

    .team-name,
    .inning-value {
        text-shadow: 3px 3px 6px rgba(0, 0, 0, 1);
    }

    .team-score {
        text-shadow: 4px 4px 8px rgba(0, 0, 0, 1);
    }
}