/* Tournament Info Bar - persistent header during active tournaments */
#tournament-info-bar { margin-bottom: 0.75rem; }
.tournament-info-bar-inner {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 0.6rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.tib-left { display: flex; align-items: center; gap: 0.6rem; min-width: 0; flex-wrap: wrap; }
.tib-icon { font-size: 1.8rem; line-height: 1; }
.tib-name { font-weight: 700; font-size: 0.95rem; word-break: break-word; }
.tib-meta { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; }
.tib-games { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; margin-left: auto; }
.tib-game { font-size: 0.75rem; color: var(--text-secondary); background: rgba(255,255,255,0.05); padding: 0.15rem 0.5rem; border-radius: 4px; white-space: nowrap; }

/* Tournament Page Styles */
.tournament-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tournament-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.tournament-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Eligibility Banner */
.eligibility-banner {
    background: rgba(220, 53, 69, 0.15);
    border: 1px solid var(--danger-color);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.eligibility-banner.eligible {
    background: transparent;
    border: none;
}

.eligibility-banner .rank-display {
    font-size: 1.2rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

/* Tournament Type Selector */
.tournament-types {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.tournament-type-card {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tournament-type-card:hover {
    transform: translateY(-4px);
}

.highest_average-card:hover {
    border-color: #f59e0b;
    box-shadow: 0 12px 40px rgba(245, 158, 11, 0.25);
}

.knockout-card:hover {
    border-color: #C0C0C0;
    box-shadow: 0 12px 40px rgba(192, 192, 192, 0.25);
}

.double_elimination-card:hover {
    border-color: #ef4444;
    box-shadow: 0 12px 40px rgba(239, 68, 68, 0.25);
}

.league-card:hover {
    border-color: #a855f7;
    box-shadow: 0 12px 40px rgba(168, 85, 247, 0.25);
}

.tournament-type-card.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(43, 135, 218, 0.3);
}

.highest_average-card.selected {
    border-color: #f59e0b;
    box-shadow: 0 12px 40px rgba(245, 158, 11, 0.25);
}

.knockout-card.selected {
    border-color: #C0C0C0;
    box-shadow: 0 12px 40px rgba(192, 192, 192, 0.25);
}

.double_elimination-card.selected {
    border-color: #ef4444;
    box-shadow: 0 12px 40px rgba(239, 68, 68, 0.25);
}

.league-card.selected {
    border-color: #a855f7;
    box-shadow: 0 12px 40px rgba(168, 85, 247, 0.25);
}

.tournament-type-card .type-icon {
    font-size: 3rem;
    margin-bottom: 0.75rem;
}

.tournament-type-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.tournament-type-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

.tournament-type-card .type-players {
    margin-top: 0.75rem;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Quick Join / Create Buttons */
.tournament-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.tournament-actions .btn {
    padding: 0.8rem 2rem;
    font-size: 1.1rem;
}

/* Available Tournaments */
.available-tournaments {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    margin-bottom: 2rem;
}

.available-tournaments h2 {
    font-size: 1.4rem;
    margin-bottom: 1rem;
}

.tournament-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.tournament-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    border: 1px solid var(--border-color);
    transition: border-color 0.2s ease;
}

.tournament-list-item:hover {
    border-color: var(--primary-color);
}

.tournament-list-item .t-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    overflow: hidden;
    min-width: 0;
    flex: 1;
}

.tournament-list-item .t-type-badge {
    padding: 0.25rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}

.t-type-badge.highest_average { background: rgba(245, 158, 11, 0.2); color: #f59e0b; }
.t-type-badge.knockout { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.t-type-badge.double_elimination { background: rgba(239, 68, 68, 0.2); color: #ef4444; }
.t-type-badge.league { background: rgba(34, 197, 94, 0.2); color: #22c55e; }

.t-ranked-badge {
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.t-ranked-badge.ranked { background: rgba(59, 130, 246, 0.2); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.3); }
.t-ranked-badge.unranked { background: rgba(107, 114, 128, 0.2); color: #9ca3af; border: 1px solid rgba(107, 114, 128, 0.3); }

.tournament-list-item .t-players {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Tournament Lobby (Waiting Room) */
.tournament-lobby {
    max-width: 800px;
    margin: 0 auto;
}

.tournament-lobby-header {
    text-align: center;
    margin-bottom: 2rem;
}

.tournament-lobby-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.tournament-players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-bottom: 2rem;
    max-height: 300px;
    overflow-y: auto;
}

.tournament-player-slot {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    text-align: center;
    font-size: 0.9rem;
}

.tournament-player-slot.empty {
    color: var(--text-secondary);
    opacity: 0.5;
    border-style: dashed;
}

.tournament-player-slot.is-you {
    border-color: var(--primary-color);
    background: rgba(43, 135, 218, 0.1);
}

/* Active Tournament View */
.tournament-active {
    max-width: 1000px;
    margin: 0 auto;
}

.tournament-active-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.round-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.round-indicator .current {
    color: var(--primary-color);
    font-weight: 700;
}

/* Game Container within Tournament */
.tournament-game-wrapper {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    min-height: 400px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

/* Compact layout for bracket tournaments (no separate header, less padding) */
.tournament-game-wrapper.bracket-compact {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.tournament-game-wrapper.bracket-compact .game-area {
    margin: 0;
    padding: 1rem;
    min-height: auto;
    border: none;
    background: none;
}

.tournament-game-wrapper.bracket-compact .aim-stats {
    margin: 0.5rem 0;
}

.tournament-game-wrapper.bracket-compact .aim-area {
    height: 400px;
}

.tournament-game-wrapper.bracket-compact .reaction-area {
    height: 350px;
}

.tournament-game-wrapper.bracket-compact .math-test-stats {
    margin: 0.5rem 0;
}

.tournament-game-wrapper.bracket-compact .typing-text {
    font-size: 1.3rem;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.tournament-game-wrapper.bracket-compact .click-speed-display {
    margin: 1rem 0;
}

.tournament-game-wrapper.bracket-compact .click-speed-click-btn {
    margin-top: 0.5rem;
}

.tournament-game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.tournament-game-header .game-name {
    font-size: 1.3rem;
    font-weight: 700;
}

.tournament-game-header .round-label {
    color: var(--text-secondary);
}

/* Live Leaderboard (Highest Average) */
.tournament-leaderboard {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    margin-bottom: 1.5rem;
}

.tournament-leaderboard h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
}

.tournament-leaderboard table {
    width: 100%;
    border-collapse: collapse;
}

.tournament-leaderboard th,
.tournament-leaderboard td {
    padding: 0.6rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.tournament-leaderboard th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.tournament-leaderboard tr.is-you {
    background: rgba(43, 135, 218, 0.1);
}

.tournament-leaderboard tr.is-you td {
    color: var(--primary-color);
    font-weight: 600;
}

/* Podium */
.podium {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 1rem;
    margin: 2rem 0;
    height: 250px;
}

.podium-place {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.podium-bar {
    width: 120px;
    border-radius: 8px 8px 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem 0.5rem;
}

.podium-place:nth-child(1) .podium-bar { /* 2nd place */
    height: 160px;
    background: linear-gradient(180deg, #C0C0C0 0%, rgba(192, 192, 192, 0.3) 100%);
}

.podium-place:nth-child(2) .podium-bar { /* 1st place */
    height: 200px;
    background: linear-gradient(180deg, #FFD700 0%, rgba(255, 215, 0, 0.3) 100%);
}

.podium-place:nth-child(3) .podium-bar { /* 3rd place */
    height: 120px;
    background: linear-gradient(180deg, #CD7F32 0%, rgba(205, 127, 50, 0.3) 100%);
}

.podium-username {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
}

.podium-points {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.podium-rank {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

/* Bracket (Knockout) */
.bracket-container {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
    position: relative;
}

.bracket-viewport {
    overflow: hidden;
    cursor: grab;
    position: relative;
    min-height: 400px;
}

.bracket-viewport:active {
    cursor: grabbing;
}

.bracket-viewport.dragging {
    cursor: grabbing;
    user-select: none;
}

.bracket-content {
    position: relative;
    transform-origin: top left;
    transition: transform 0.1s ease;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1rem;
    min-width: 200px;
}

.bracket-content .bracket-match {
    position: absolute;
}

.bracket-round-title {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    line-height: 1.3;
    pointer-events: none;
}

.bracket-match {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-width: 180px;
    height: 58px;
    box-sizing: border-box;
    overflow: hidden;
}

.bracket-match.third-place {
    border-color: #CD7F32;
    height: auto;
}

.bracket-player {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    font-size: 0.85rem;
    height: 28px;
    box-sizing: border-box;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.bracket-player:last-child {
    border-bottom: none;
}

.bracket-player.winner {
    background: rgba(40, 167, 69, 0.15);
    font-weight: 600;
}

.bracket-player.is-you {
    color: var(--primary-color);
}

.bracket-player .score {
    font-weight: 600;
    color: var(--text-secondary);
}

.bracket-player.winner .score {
    color: var(--success-color);
}

.match-elo {
    font-size: 0.65rem;
    font-weight: 700;
    margin-right: 4px;
    flex-shrink: 0;
}
.match-elo.elo-pos { color: var(--success-color, #22c55e); }
.match-elo.elo-neg { color: var(--danger-color, #ef4444); }

/* Bracket match tooltip */
.bracket-match.has-tooltip {
    cursor: pointer;
}

.bracket-match-tooltip {
    display: none;
}

#bracket-floating-tooltip {
    display: none;
    position: fixed;
    z-index: 9999;
    background: var(--card-bg, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    min-width: 160px;
    font-size: 0.82rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
    pointer-events: none;
}

/* Bracket zoom controls */
.bracket-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.bracket-controls button {
    padding: 0.4rem 0.8rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.bracket-controls button:hover {
    border-color: var(--primary-color);
    background: rgba(43, 135, 218, 0.1);
}

/* League Table */
.league-table {
    width: 100%;
    border-collapse: collapse;
}

.league-table th,
.league-table td {
    padding: 0.7rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.league-table th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
}

.league-table tr.is-you {
    background: rgba(43, 135, 218, 0.1);
}

.league-table .pos { width: 40px; text-align: center; }
.league-table .pts { font-weight: 700; color: var(--primary-color); }

/* Tournament list item improvements */
.tournament-list-item .t-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex-shrink: 1;
}

.t-games-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    cursor: default;
    white-space: nowrap;
}

.t-games-badge .game-tooltip {
    display: none;
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-secondary, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 10px;
    padding: 0.6rem 0.8rem;
    z-index: 1000;
    min-width: 160px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.t-games-badge .game-tooltip::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 10px;
    height: 10px;
    background: var(--bg-secondary, #1e293b);
    border-right: 1px solid var(--border-color, #334155);
    border-bottom: 1px solid var(--border-color, #334155);
}

.t-games-badge:hover .game-tooltip {
    display: block;
}

.game-tooltip-item {
    padding: 0.3rem 0.4rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary, #e2e8f0);
    white-space: nowrap;
    border-radius: 4px;
    transition: background 0.15s;
}

.game-tooltip-item:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.game-tooltip-item:hover {
    background: rgba(99, 102, 241, 0.1);
}

.tournament-list-item .t-rank-badges {
    display: inline-flex;
    align-items: center;
}

/* Filter Dropdowns */
.tournament-filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    position: relative;
}

.multi-select {
    position: relative;
}

.multi-select-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--dark-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.9rem;
    min-width: 160px;
    justify-content: space-between;
    transition: border-color 0.2s;
}

.multi-select-btn:hover {
    border-color: var(--primary-color);
}

.dropdown-arrow {
    font-size: 0.7rem;
    opacity: 0.5;
}

.multi-select-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    z-index: 100;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.multi-select-dropdown.open {
    display: block;
}

.multi-select-dropdown.dropdown-upward {
    top: auto;
    bottom: 100%;
    margin-top: 0;
    margin-bottom: 4px;
}

.dropdown-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.9rem;
}

.dropdown-option:hover {
    background: rgba(43, 135, 218, 0.1);
}

.dropdown-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

/* Pagination */
.tournament-pagination .pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

/* Modal Close Button Fix */
.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 1.3rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
}

.modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

/* Create Tournament Modal */
.create-tournament-modal {
    max-width: 400px;
    position: relative;
    padding: 1rem 1.1rem;
    font-size: 0.82rem;
}

.create-tournament-modal h2 {
    font-size: 1.05rem;
}

.create-form-group {
    margin-bottom: 0.6rem;
}

.create-form-group label {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
}

.create-form-group select,
.create-form-group input {
    width: 100%;
    padding: 0.4rem 0.5rem;
    background: var(--dark-bg);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.create-form-group select:focus,
.create-form-group input:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* Custom select dropdown for Create Tournament */
.ct-custom-select {
    position: relative;
}

.ct-custom-select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.6rem;
    background: var(--dark-bg);
    border: 2px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: border-color 0.2s;
    user-select: none;
}

.ct-custom-select-trigger:hover {
    border-color: var(--primary-color);
}

.ct-custom-select-trigger.open {
    border-color: var(--primary-color);
    border-radius: 6px 6px 0 0;
}

.ct-custom-select-trigger.open.dropup {
    border-radius: 0 0 6px 6px;
}

.ct-custom-select-trigger svg {
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.ct-custom-select-trigger.open svg {
    transform: rotate(180deg);
}

.ct-custom-select-dropdown {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 2px solid var(--primary-color);
    border-top: none;
    border-radius: 0 0 6px 6px;
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
}

.ct-custom-select-dropdown.dropup {
    bottom: 100%;
    top: auto;
    border-top: 2px solid var(--primary-color);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
}

.ct-custom-select-dropdown.show {
    display: block;
}

.ct-custom-select-option {
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: background 0.1s;
}

.ct-custom-select-option:hover {
    background: rgba(255, 255, 255, 0.08);
}

.ct-custom-select-option.selected {
    background: rgba(59, 130, 246, 0.15);
    color: var(--primary-color);
    font-weight: 600;
}

/* Fix browser autofill/autocomplete styling */
.create-form-group input:-webkit-autofill,
.create-form-group input:-webkit-autofill:hover,
.create-form-group input:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0px 1000px var(--dark-bg) inset;
    -webkit-text-fill-color: var(--text-primary);
    transition: background-color 5000s ease-in-out 0s;
}

.create-form-group input::selection {
    background: rgba(43, 135, 218, 0.3);
    color: var(--text-primary);
}

/* Multi-select dropdown for game selection */
.ct-multiselect {
    position: relative;
}

.ct-multiselect-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 10px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.83rem;
    cursor: pointer;
    transition: border-color 0.2s;
}

.ct-multiselect-trigger:hover {
    border-color: var(--primary-color);
}

.ct-multiselect-placeholder {
    color: var(--text-secondary);
}

.ct-multiselect-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 2px solid var(--primary-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    z-index: 1000;
    max-height: 220px;
    overflow-y: auto;
}

.ct-multiselect-dropdown.dropup {
    top: auto;
    bottom: 100%;
    border-top: 2px solid var(--primary-color);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
}

.ct-multiselect-trigger.dropup {
    border-radius: 0 0 8px 8px;
}

.ct-ms-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 0.83rem;
    color: var(--text-primary);
    transition: background 0.1s;
}

.ct-ms-option:hover {
    background: rgba(255, 255, 255, 0.08);
}

.ct-ms-option.selected {
    background: rgba(59, 130, 246, 0.15);
}

.ct-ms-option.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ct-ms-check {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 0.85rem;
}

.ct-selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 5px;
}

.ct-game-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-primary);
}

.ct-game-tag-x {
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    color: var(--text-secondary);
    transition: color 0.15s;
}

.ct-game-tag-x:hover {
    color: var(--danger-color);
}

/* Legacy - keep for compatibility */
.game-checkboxes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.4rem;
}

.game-checkbox {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.6rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 0.88rem;
}

.game-checkbox:hover {
    background: rgba(43, 135, 218, 0.1);
}

.game-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

/* Round countdown overlay */
.round-countdown-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.round-countdown-content {
    text-align: center;
}

.round-countdown-content h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.round-countdown-content .game-icon {
    margin: 1.5rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.round-countdown-content .countdown-number {
    font-size: 5rem;
    font-weight: 800;
    color: var(--primary-color);
}

/* Tournament Results */
.tournament-results {
    text-align: center;
    padding: 2rem;
}

.tournament-results h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.tournament-results .winner-name {
    font-size: 1.8rem;
    font-weight: 700;
    color: #FFD700;
    margin-bottom: 2rem;
}

/* Waiting screen between rounds */
.round-waiting {
    text-align: center;
    padding: 2rem;
}

.round-waiting h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.round-waiting .timer {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary-color);
}

/* Rank Badges (imported from ranked) */
.rank-badge {
    font-size: 0.75rem;
    font-weight: 900;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 2px solid;
    display: inline-block;
}

.rank-badge.bronze {
    background: linear-gradient(135deg, #cd7f32 0%, #8b4513 100%);
    border-color: #cd7f32;
    color: white;
}

.rank-badge.silver {
    background: linear-gradient(135deg, #c0c0c0 0%, #999999 100%);
    border-color: #c0c0c0;
    color: #1a1a1a;
}

.rank-badge.gold {
    background: linear-gradient(135deg, #ffd700 0%, #ffb700 100%);
    border-color: #ffd700;
    color: #1a1a1a;
}

.rank-badge.platinum {
    background: linear-gradient(135deg, #e5e4e2 0%, #b9f2ff 100%);
    border-color: #e5e4e2;
    color: #1a1a1a;
}

.rank-badge.diamond {
    background: linear-gradient(135deg, #b9f2ff 0%, #00bfff 100%);
    border-color: #00bfff;
    color: #1a1a1a;
}

.rank-badge.master {
    background: linear-gradient(135deg, #9D4EDD 0%, #7B2FBE 100%);
    border-color: #9D4EDD;
    color: white;
}

.rank-badge.grandmaster {
    background: linear-gradient(135deg, #FF6B6B 0%, #ee5a24 100%);
    border-color: #FF6B6B;
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .tournament-types {
        grid-template-columns: 1fr;
    }

    .tournament-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .podium-bar { width: 80px; }
    .bracket-round { min-width: 150px; }

    .tournament-header h1 {
        font-size: 1.8rem;
    }

    .tournament-header p {
        font-size: 0.95rem;
    }

    .available-tournaments {
        padding: 1rem 1.25rem;
    }

    .tournament-list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .tournament-list-item .t-info {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .tournament-filters {
        flex-direction: column;
    }

    .multi-select-btn {
        min-width: auto;
        width: 100%;
    }

    .tournament-lobby-header h2 {
        font-size: 1.4rem;
    }

    .tournament-players-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }

    .tournament-leaderboard {
        padding: 1rem;
    }

    .tournament-game-wrapper {
        padding: 1rem;
    }

    .create-tournament-modal {
        padding: 1.25rem;
        width: 95%;
    }

    .game-checkboxes {
        grid-template-columns: 1fr;
    }

    .bracket-container {
        padding: 0.75rem;
    }
}

@media (max-width: 480px) {
    .tournament-header h1 {
        font-size: 1.5rem;
    }

    .tournament-type-card {
        padding: 1.5rem 1rem;
    }

    .tournament-type-card .type-icon {
        font-size: 2.5rem;
    }

    .tournament-type-card h3 {
        font-size: 1.1rem;
    }

    .podium-bar {
        width: 60px;
    }

    .podium {
        gap: 0.5rem;
        height: 200px;
    }

    .podium-place:nth-child(1) .podium-bar { height: 120px; }
    .podium-place:nth-child(2) .podium-bar { height: 160px; }
    .podium-place:nth-child(3) .podium-bar { height: 90px; }
}

/* Standings profile links */
.standings-profile-link {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s;
}

.standings-profile-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Highest Average Standings Table */
.ha-standings-wrapper {
    overflow-x: auto;
    max-width: 100%;
}

.ha-standings-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.ha-standings-table th,
.ha-standings-table td {
    padding: 0.5rem 0.6rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
}

.ha-standings-table th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    line-height: 1.3;
}

.ha-standings-table th:nth-child(1),
.ha-standings-table td:nth-child(1) {
    width: 35px;
}

.ha-standings-table th:nth-child(2),
.ha-standings-table td:nth-child(2) {
    text-align: left;
    min-width: 100px;
}

.ha-standings-table tr.is-you {
    background: rgba(43, 135, 218, 0.1);
}

.ha-standings-table tr.is-you td {
    color: var(--primary-color);
    font-weight: 600;
}

.ha-game-col {
    min-width: 90px;
    max-width: 130px;
}

.ha-placement {
    font-weight: 600;
    color: var(--text-primary);
}

.ha-score {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.ha-pts {
    color: var(--success-color, #22c55e);
    font-size: 0.72rem;
    font-weight: 600;
}

/* Podium hover tooltips */
.podium-place {
    position: relative;
    cursor: pointer;
}

.podium-bar-hover {
    position: static;
}

.podium-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    z-index: 1000;
    min-width: 260px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    text-align: left;
    flex-direction: column;
}

.podium-place:hover .podium-tooltip {
    display: flex;
}

.podium-tooltip-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.25rem 0;
    font-size: 0.82rem;
    color: var(--text-primary, #e2e8f0);
    white-space: nowrap;
}

.podium-tooltip-row:not(:last-child) {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.podium-tooltip-row span:first-child {
    color: var(--text-secondary);
    font-weight: 500;
}

.podium-tooltip-row span:last-child {
    font-weight: 600;
}

/* Portrait orientation optimizations for tournament games */
@media (orientation: portrait) {
    .tournament-game-wrapper {
        padding: 0.75rem;
        min-height: auto;
    }

    .tournament-game-wrapper .game-area {
        padding: 1rem;
        margin: 0.5rem 0;
        min-height: auto;
    }

    .tournament-game-wrapper .reaction-area {
        height: 45vh;
    }

    .tournament-game-wrapper .aim-area {
        height: 45vh;
        max-height: 350px;
    }

    .tournament-game-wrapper .typing-text {
        font-size: 0.95rem;
        line-height: 1.7;
        padding: 0.75rem;
    }

    .tournament-game-wrapper .click-speed-click-btn {
        padding: 2rem;
        font-size: 1.3rem;
        width: 100%;
    }

    .tournament-game-header {
        flex-direction: column;
        gap: 0.25rem;
        align-items: center;
        text-align: center;
        padding-bottom: 0.5rem;
        margin-bottom: 0.5rem;
    }
}
