:root {
    --headerColor: #E07A02;
    --footerColor: #034068;
    --accentColor: #1A7D5E;
    --accentColorDark: #145F47;
}

body {
    font-family: sans-serif;
    background-color: #f4f4f4;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

.status-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: baseline;
    gap: 4px 18px;
    color: var(--footerColor);
    padding: 10px 16px 6px;
    font-family: 'Racing Sans One', sans-serif;
}

.status-stat {
    font-size: 1rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.status-stat strong {
    font-size: 1.2rem;
}

.courts-preview {
    display: flex;
    gap: 16px;
    padding: 0 16px;
    flex-wrap: wrap;
}

.court-column {
    flex: 1;
    min-width: 260px;
    background: white;
    border-radius: 8px;
    padding: 10px 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.court-header {
    font-family: 'Racing Sans One', sans-serif;
    color: var(--footerColor);
    text-align: center;
    margin: 4px 0 8px;
}

.vs-divider {
    font-family: 'Racing Sans One', sans-serif;
    color: #999;
    text-align: center;
    margin: 2px 0;
}

/* Hybrid mode only: points from Court 1 toward Court 2. */
.hybrid-flow-arrow {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 0 0 auto;
    padding: 0 2px;
}

.hybrid-flow-arrow-icon {
    font-size: 2rem;
    line-height: 1;
    color: var(--headerColor);
}

.hybrid-flow-arrow-label {
    font-size: 0.65rem;
    font-weight: bold;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    color: var(--footerColor);
}

/* Courts stay side by side even on a phone — each one just gets tighter,
   not stacked — so a hybrid court's flow arrow also stays pointing right,
   never needs to rotate to point down. */
@media (max-width: 480px) {
    .courts-preview {
        gap: 6px;
        padding: 0 6px;
    }

    .court-column {
        min-width: 0;
        padding: 6px 6px;
    }

    .court-header {
        font-size: 0.85rem;
        margin: 2px 0 6px;
    }

    .hybrid-flow-arrow {
        padding: 0;
    }

    .hybrid-flow-arrow-icon {
        font-size: 1.2rem;
    }

    .hybrid-flow-arrow-label {
        font-size: 0.55rem;
    }

    .team-card {
        padding: 6px;
        gap: 4px;
    }

    /* Lets the win-streak badge drop to its own line instead of squeezing
       next to a team name that's already wrapping at this width. */
    .team-card-top {
        flex-wrap: wrap;
    }

    .team-card-header {
        font-size: 0.85rem;
    }

    .win-streak {
        font-size: 0.7rem;
    }

    .expand-btn {
        font-size: 1.1rem;
    }

    .player-names-list {
        font-size: 0.9rem;
    }

    .player-circle {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.85rem;
    }

    .team-score {
        font-size: 0.8rem;
        padding: 1px 5px;
    }

    .team-button, .end-game-btn {
        font-size: 0.75rem;
        padding: 3px 5px;
    }
}

.player-section {
    max-width: 640px;
    margin: 16px auto;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Holds the Court 1 queue (.queue-section) and, in hybrid mode, the Court 2
   queue (.court2-pending) as siblings so they can sit side by side, each
   positioned under the court it actually feeds. With only one visible
   (hybrid mode off), the lone child still centers the same as a standalone
   block did before this existed. */
.queue-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    max-width: 1320px;
    margin: 16px auto 0;
    padding: 0 16px;
}

.queue-section {
    flex: 1 1 460px;
    max-width: 640px;
    padding: 12px 16px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Hybrid mode only: a Court 1 winner waiting for a Court 2 slot. */
.court2-pending {
    flex: 1 1 460px;
    max-width: 640px;
    padding: 10px 16px;
    background: #fff8ef;
    border: 1px dashed var(--headerColor);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pending-header {
    font-family: 'Racing Sans One', sans-serif;
    color: var(--headerColor);
    margin: 0 0 4px;
    text-align: center;
}

.queue-hdr {
    font-family: 'Racing Sans One', sans-serif;
    color: var(--footerColor);
    margin: 0 0 8px;
}

.section-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 6px 4px;
    user-select: none;
    font-family: 'Racing Sans One', sans-serif;
    color: var(--footerColor);
}

.section-toggle:hover {
    opacity: 0.75;
}

.toggle-icon {
    font-size: 16px;
    padding-right: 0.5em;
}

.team-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.team-card {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    font-family: 'Covered By Your Grace', cursive;
}

.team-card-top {
    flex-basis: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
}

.team-card-header {
    flex: 1;
    font-size: 1.3rem;
}

.win-streak {
    flex-shrink: 0;
    white-space: nowrap;
    font-family: 'Racing Sans One', sans-serif;
    font-size: 0.9rem;
    color: var(--headerColor);
}

.expand-btn {
    flex-shrink: 0;
    font-family: sans-serif;
    font-size: 1.3rem;
    padding: 0 2px;
    border: none;
    background: none;
    cursor: pointer;
    color: inherit;
    line-height: 1;
    opacity: 0.7;
}

.expand-btn:hover {
    opacity: 1;
}

.player-names-list {
    padding: 4px 8px;
    align-self: center;
    font-family: 'Covered By Your Grace', cursive;
    font-size: 1.1rem;
}

.player-name-row {
    margin-bottom: 2px;
}

.players-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.player-circle {
    font-family: 'Covered By Your Grace', cursive;
    font-size: 1.3rem;
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 50%;
    /* background-color/color are set inline per circle — the team's own
       dark color, from render.gym.js's buildPlayerCircles(). */
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.player-circle.empty-slot {
    opacity: 0.4;
}

/* Must come after the base .players-container rule above — equal
   specificity, so whichever is later in the file wins once this query
   matches. Flex-wrap breaks a 6-circle roster wherever it runs out of
   row width (4-then-2 at this card size) — but that only happens when
   a card is squeezed to half-width next to a sibling column (the
   court preview's two courts, or the queue sitting beside the Court 2
   pending list in hybrid mode). The single, full-width queue column
   has room for all 6 in one row and should keep it that way, so the
   grid is scoped to those two-column contexts instead of every
   .players-container. */
@media (max-width: 480px) {
    .court-column .players-container,
    .queue-row--two-col .players-container {
        display: grid;
        grid-template-columns: repeat(3, auto);
        justify-content: center;
    }

    /* The 460px flex-basis on .queue-section/.court2-pending (below) is
       sized for desktop — on a phone it's wider than half the screen,
       so .queue-row's flex-wrap drops the pending column to its own
       line instead of sitting beside the queue. Shrinking the basis to
       0 here lets both share the row's width evenly, same as the
       court preview's two columns already do. */
    .queue-row--two-col {
        gap: 6px;
        padding: 0 6px;
    }

    .queue-row--two-col .queue-section,
    .queue-row--two-col .court2-pending {
        flex: 1 1 0;
        min-width: 0;
        padding: 6px 6px;
    }
}

.team-button {
    font-family: 'Covered By Your Grace', cursive;
}

.team-score {
    font-family: 'Wallpoet', sans-serif;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 2px 8px;
}

.end-game-btn {
    background-color: var(--cancelColor);
}

.end-game-btn:hover {
    background-color: var(--cancelColorDark);
}

.player-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.player-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    background-color: #eee;
    color: black;
    padding: 6px 12px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-family: 'Covered By Your Grace', cursive;
}

.me-player-card {
    border: 2px solid var(--accentColor);
    background-color: #d0ede5;
}

.organizer-player-card {
    border: 3px solid var(--headerColor);
}

.player-name-group {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 1.2rem;
}

.organizer-badge {
    font-family: 'Racing Sans One', sans-serif;
    font-size: 0.6rem;
    background-color: var(--headerColor);
    color: white;
    border-radius: 9px;
    padding: 2px 8px;
    white-space: nowrap;
}

.wait-stat-badge {
    font-family: sans-serif;
    font-size: 0.65rem;
    color: #666;
    background-color: rgba(0, 0, 0, 0.06);
    border-radius: 9px;
    padding: 2px 8px;
    white-space: nowrap;
}

.player-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

#errorStatus {
    color: #FF6201;
    text-align: center;
    min-height: 1.5em;
}

button {
    padding: 4px 8px;
    margin: 4px;
    border: none;
    border-radius: 4px;
    background-color: var(--accentColor);
    color: white;
    cursor: pointer;
}

button:hover {
    background-color: var(--accentColorDark);
}

button:disabled {
    opacity: 0.5;
    cursor: default;
}

