/* Base styles */
.round {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
}

.round-match-header {
    margin-bottom: 20px;
}

.match {
    background-color: var(--sidebar-background);
    border-radius: 5px;
    border: 1px solid var(--sidebar-border-color);
    width: calc(100% - 10px);
    text-align: center;
}

.score-container {
    display: grid;
    grid-template-rows: auto auto;
    gap: 0px;
}

/* Match Header */
.match-header {
    background-color: var(--sidebar-border-color);
    display: flex;
    padding: 5px;
    justify-content: center;
}

.match-header .timezone {
    flex: 1;
    text-align: start;
}

.match-header .round-toggle,
.match-header .no-rounds {
    flex: 1;
    text-align: end;
}

.match-header .round-toggle {
    cursor: pointer;
}

.match-header .no-rounds {
    font-style: italic;
}

.match-header .date {
    min-width: auto;
    text-align: left;
}

/* Match Results */
.match-results {
    padding: 5px;
    display: flex;
    justify-content: center;
}

.match-results .score-toggle-details {
    height: 10px;
    font-size: 12px;
    font-style: italic;
}

/* Team */
.match-results .team-match,
.match-details .round-details .team-match {
    flex: 1;
    display: flex;
    align-items: center;
}

.match-details .round-details .team-match {
    flex-direction: column;
}

.match-results .team-name {
    vertical-align: center;
    font-size: 12px;
    margin: 0 10px;
}

.match-results .team-tag {
    vertical-align: center;
    box-align: center;
    font-size: 24px;
    margin: 0 10px;
}

.match-results .team-logo {
    height: 100px;
    width: auto;
    margin: 0 10px;
}

.match-results .team1 {
    justify-content: end;
}

.match-results .team1 .team-name,
.match-results .team1 .team-logo {
    order: 1;
}

.match-results .team1 .team-logo {
    order: 2;
}

/* Score styles - shared properties */
.score {
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Score - Match Results */
.match-results .score {
    background-color: var(--sidebar-background);
    height: 40px;
    min-width: 100px;
    margin: auto 30px;
    padding: 0 15px;
}

.match-results .score .score-team {
    font-size: 35px;
}

.winner {
    color: #ffbd00;
    font-weight: bold;
}

.score .divider {
    margin: 0 15px;
    font-size: 16px;
}

/* Match Details */
.match-details {
    padding: 15px 10px;
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
}

.match-details.active {
    margin-top: -20px;
    display: flex;
}

.match-details .rounds-title {
    font-size: 16px;
}

.match-details .round {
    display: flex;
    justify-content: center;
    align-items: center;
}

.match-details .round .round-number {
    flex: 1;
    text-align: right;
    font-weight: bold;
}

.match-details .round .player-toggle {
    flex: 1;
    text-align: left;
    font-style: italic;
    cursor: pointer;
}

/* Round Score */
.match-details .round .score {
    min-width: 120px;
    margin: 0 30px;
    font-size: 20px;
    border: 1px solid var(--sidebar-border-color);
    background-color: var(--sidebar-border-color);
    border-radius: 5px;
    padding: 0 5px;
}

.match-details .round .score .score-team {
    font-size: 15px;
    flex: 1;
}

.match-details .round .score .divider {
    margin: 0 5px;
}

/* Round Details */
.match-details .round-details {
    display: none;
    justify-content: center;
    align-items: start;
}

.match-details .round-details.active {
    display: flex;
}

.match-details .round-details .rounds-details-middle {
    min-width: 100px;
}

.match-details .round-details .team-match .player-stats {
    padding: 0 5px;
    width: 100%;
    display: flex;
    align-items: center;
    margin: 2px 0;
}

.match-details .round-details .team-match .player-stats .score {
    font-size: 14px;
    min-width: 30px;
}

.match-details .round-details .team1 .score {
    text-align: end;
}

.match-details .round-details .team2 .score {
    text-align: start;
}

.match-details .round-details .team-match .player {
    width: 100%;
    display: flex;
    margin-bottom: 0 !important;
    align-items: center;
    background-color: var(--base-background-color);
}

.match-details .round-details .team1 .player {
    justify-content: end;
    margin-right: 5px;
}

.match-details .round-details .team2 .player {
    margin-left: 5px;
}

.match-details .round-details .player .captain {
    color: #ffbd00;
}

.match-details .round-details .team-match .player .position {
    height: 20px;
    width: 20px;
    margin-top: 7px;
    margin-bottom: 7px;
    margin-left: 5px;
    margin-right: 5px;
}

.match-details .team1 {
    padding-left: 15px;
}

.match-details .team1 .player {
    justify-self: end;
    order: 1;
}

.match-details .team1 .score {
    order: 2;
}

.match-details .team1 .player .position {
    order: 2;
}

.match-details .team1 .player .name {
    order: 1;
}

.match-details .team2 {
    padding-right: 15px;
}

/* Player medals styling */
.player .name.has-medals {
    position: relative;
    cursor: pointer;
}

.medals-tooltip {
    display: none;
    position: absolute;
    background-color: #ffbd00;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 0.9em;
    z-index: 100;
    width: max-content;
    max-width: 250px;
    left: 0;
    top: 100%;
    margin-top: 5px;
}

.player .name.has-medals:hover .medals-tooltip {
    display: block;
}

.medals-tooltip ul {
    list-style-type: none;
    padding-left: 0;
    margin: 0;
}

.medals-tooltip li {
    color: var(--base-background-color);
    margin-bottom: 2px;
    line-height: 1.2;
    text-align: left;
}

/* Tooltip arrow */
.medals-tooltip:before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 20px;
    border-width: 6px;
    border-style: solid;
    border-color: transparent transparent rgba(0, 0, 0, 0.85) transparent;
}

/* ── Bracket (rendered from our own results, replacing the Challonge embeds) ── */
.bracket-section {
    margin-bottom: 24px;
}

.bracket-section-title {
    font-weight: 700;
    font-size: 15px;
    margin-bottom: 10px;
    opacity: 0.75;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Rounds sit side by side and scroll horizontally on narrow screens rather than
   squashing the match cards. */
.bracket-rounds {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 6px;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    flex: 0 0 auto;
    min-width: 170px;
}

.bracket-round-title {
    font-size: 12px;
    text-align: center;
    opacity: 0.6;
    margin-bottom: 2px;
    white-space: nowrap;
}

.bracket-match {
    background-color: var(--sidebar-background);
    border: 1px solid var(--sidebar-border-color);
    border-radius: 5px;
    overflow: hidden;
}

.bracket-team {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 9px;
    font-size: 13px;
    opacity: 0.55;
}

.bracket-team + .bracket-team {
    border-top: 1px solid var(--sidebar-border-color);
}

.bracket-team.winner {
    opacity: 1;
    font-weight: 700;
}

.bracket-team-color {
    width: 4px;
    height: 16px;
    border-radius: 2px;
    flex: 0 0 auto;
}

.bracket-team-tag {
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.bracket-team-score {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}
