.baseball-game {
    --game-suit-black: #202020;
    --game-suit-red: #9f1d1d;
    --game-suit-yellow: #f2cf4a;
    --game-suit-blue: #1c4eaa;
    max-width: 1100px;
    margin: 0 auto 4rem;
}

.baseball-game__intro {
    max-width: 850px;
    margin-bottom: 2.5rem;
}

.baseball-game__intro h1 {
    margin: 0.25rem 0 1rem;
}

.baseball-game__eyebrow {
    margin: 0;
    color: var(--color-deep-red);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.baseball-game__lead {
    margin-bottom: 0.75rem;
    color: var(--color-royal-blue);
    font-size: 1.3rem;
    font-weight: 500;
}

.baseball-game__note {
    margin: 0;
    font-size: 1rem;
}

.baseball-game__panel {
    border-top: 4px solid var(--color-gold);
}

.baseball-game__setup,
.baseball-game__widget {
    background: var(--color-white);
    border: 1px solid rgba(13, 13, 13, 0.25);
    box-shadow: 0 5px 18px rgba(13, 13, 13, 0.07);
}

.baseball-game__setup {
    padding: 1.75rem;
}

.baseball-game__setup h2 {
    margin: 0 0 1.25rem;
    color: var(--color-deep-red);
    font-size: 2rem;
}

.baseball-game__setup-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.8rem 1rem;
}

.baseball-game__setup-controls label {
    font-weight: 700;
}

.baseball-game__setup-controls select {
    min-height: 46px;
    padding: 0.6rem 2.25rem 0.6rem 0.8rem;
    border: 2px solid var(--color-black);
    border-radius: 0;
    background: var(--color-white);
    color: var(--color-black);
    font: inherit;
}

.baseball-game__play-area {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding-top: 1.5rem;
}

.baseball-game .is-hidden {
    display: none !important;
}

.baseball-game__status-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.baseball-game__widget {
    padding: 1.1rem;
}

.baseball-game__widget-title,
.baseball-game__hand-title {
    margin: 0 0 0.75rem;
    color: var(--color-royal-blue);
    font-size: 1.2rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.baseball-game__stat {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.2rem 0;
    font-size: 0.95rem;
}

.baseball-game__stat.is-active {
    color: var(--color-deep-red);
    font-weight: 700;
}

.baseball-game__diamond {
    display: grid;
    grid-template-areas:
        ". second ."
        "third . first"
        ". home .";
    grid-template-columns: repeat(3, 48px);
    justify-content: center;
    gap: 0.35rem 0.8rem;
}

.baseball-game__base {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border: 2px solid var(--color-black);
    background: #eee;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1;
    clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.baseball-game__base--second { grid-area: second; }
.baseball-game__base--third { grid-area: third; }
.baseball-game__base--first { grid-area: first; }
.baseball-game__base--home {
    grid-area: home;
    background: var(--color-black);
    color: var(--color-white);
    font-size: 0.58rem;
}

.baseball-game__base.is-occupied {
    border-color: var(--color-gold);
    background: var(--color-deep-red);
    color: var(--color-white);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.25);
}

.baseball-game__hands {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.baseball-game__cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
    gap: 0.55rem;
}

.baseball-game__card {
    display: flex;
    min-width: 0;
    min-height: 72px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.35rem;
    border: 2px solid var(--color-black);
    border-radius: 0;
    color: var(--color-white);
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    transition: transform 120ms ease, box-shadow 120ms ease;
}

.baseball-game__card:hover {
    transform: translateY(-2px);
}

.baseball-game__card--black { background: var(--game-suit-black); }
.baseball-game__card--red { background: var(--game-suit-red); }
.baseball-game__card--yellow {
    background: var(--game-suit-yellow);
    color: var(--color-black);
}
.baseball-game__card--blue { background: var(--game-suit-blue); }

.baseball-game__card.is-selected {
    border-color: var(--color-white);
    outline: 4px solid var(--color-gold);
    outline-offset: 2px;
    box-shadow: 0 5px 12px rgba(13, 13, 13, 0.25);
    transform: translateY(-3px);
}

.baseball-game__card-suit {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.baseball-game__card-value {
    font-family: 'Anton', sans-serif;
    font-size: 1.6rem;
    line-height: 1.15;
}

.baseball-game__outcome {
    display: flex;
    min-height: 66px;
    align-items: center;
    gap: 0.7rem;
    border-left: 5px solid var(--color-royal-blue);
    font-size: 0.95rem;
}

.baseball-game__outcome strong {
    flex: 0 0 auto;
    color: var(--color-deep-red);
}

.baseball-game__outcome.is-empty {
    color: #555;
    font-style: italic;
}

.baseball-game__warning {
    border: 2px solid var(--color-gold);
    background: rgba(212, 175, 55, 0.12);
}

.baseball-game__warning p {
    margin: 0 0 0.9rem;
    font-size: 1rem;
    font-weight: 600;
}

.baseball-game__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
}

.baseball-game__button {
    min-height: 46px;
    padding: 0.65rem 1.2rem;
    border: 2px solid;
    border-radius: 0;
    cursor: pointer;
    font-family: 'Anton', sans-serif;
    font-size: 1rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.baseball-game__button--primary {
    border-color: var(--color-deep-red);
    background: var(--color-deep-red);
    color: var(--color-white);
}

.baseball-game__button--secondary {
    border-color: var(--color-royal-blue);
    background: var(--color-royal-blue);
    color: var(--color-white);
}

.baseball-game__button--warning {
    border-color: var(--color-black);
    background: var(--color-gold);
    color: var(--color-black);
}

.baseball-game__button:hover:not(:disabled) {
    filter: brightness(1.15);
    transform: translateY(-1px);
}

.baseball-game__button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
}

.baseball-game button:focus-visible,
.baseball-game select:focus-visible,
.baseball-game summary:focus-visible {
    outline: 3px solid var(--color-hover-blue);
    outline-offset: 3px;
}

.baseball-game__game-over {
    text-align: center;
    border: 2px solid var(--color-gold);
    background: rgba(212, 175, 55, 0.12);
}

.baseball-game__game-over h2 {
    margin: 0 0 0.5rem;
    color: var(--color-deep-red);
}

.baseball-game__game-over p {
    margin: 0;
    font-size: 1rem;
}

.baseball-game__log summary {
    cursor: pointer;
    font-weight: 700;
}

.baseball-game__table-scroll {
    overflow-x: auto;
}

.baseball-game__log-table {
    width: 100%;
    min-width: 620px;
    margin-top: 0.8rem;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.baseball-game__log-table th,
.baseball-game__log-table td {
    padding: 0.45rem;
    border: 1px solid rgba(13, 13, 13, 0.25);
    text-align: left;
}

.baseball-game__shuffle-row td {
    color: #555;
    font-style: italic;
    text-align: center;
}

@media (max-width: 768px) {
    .baseball-game__status-grid,
    .baseball-game__hands {
        grid-template-columns: 1fr;
    }

    .baseball-game__intro h1 {
        font-size: 2.7rem;
    }

    .baseball-game__lead {
        font-size: 1.15rem;
    }
}

@media (max-width: 480px) {
    .baseball-game__setup-controls,
    .baseball-game__setup-controls select,
    .baseball-game__setup-controls .baseball-game__button {
        width: 100%;
    }

    .baseball-game__outcome {
        align-items: flex-start;
        flex-direction: column;
    }

    .baseball-game__actions .baseball-game__button {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .baseball-game__card,
    .baseball-game__button {
        transition: none;
    }
}
