:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gold-gradient: linear-gradient(135deg, #f5c542 0%, #ffdd88 100%);
    --silver-gradient: linear-gradient(135deg, #cfd8dc 0%, #ffffff 100%);
    --bronze-gradient: linear-gradient(135deg, #cd7f32 0%, #e0a96d 100%);
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.15);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.85);
    --accent-color: #f5c542;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%), url('/static/background.jpg');
    background-size: 120% auto;
    background-position: center 45%;
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-blend-mode: overlay;
    color: var(--text-primary);
    overflow-x: hidden;
    position: relative;
    font-size: 16px;
    line-height: 1.6;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: -2;
    pointer-events: none;
}

.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 119, 198, 0.15) 0%, transparent 50%);
    animation: backgroundShift 20s ease-in-out infinite;
    z-index: -1;
    pointer-events: none;
}

@keyframes backgroundShift {
    0%, 100% {
        transform: scale(1) rotate(0deg);
    }
    50% {
        transform: scale(1.1) rotate(3deg);
    }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.header {
    text-align: center;
    margin-bottom: 50px;
}

.title {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #fff 0%, #f5c542 50%, #fff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleGlow 4s ease-in-out infinite;
    letter-spacing: 2px;
    text-shadow: 0 0 40px rgba(245, 197, 66, 0.3);
}

@keyframes titleGlow {
    0%, 100% {
        filter: drop-shadow(0 0 20px rgba(245, 197, 66, 0.4));
    }
    50% {
        filter: drop-shadow(0 0 35px rgba(245, 197, 66, 0.7));
    }
}

.tabs-container {
    margin-bottom: 40px;
}

.tabs {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px;
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.tab-btn {
    padding: 14px 28px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
}

.tab-btn::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transition: left 0.6s ease;
}

.tab-btn:hover::before {
    left: 100%;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.tab-btn.active {
    color: var(--text-primary);
    background: var(--primary-gradient);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
    transform: translateY(-2px);
}

.table-wrapper {
    margin-top: 30px;
}

.glass-card {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(25px);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
}

.table-header {
    padding: 30px 35px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
}

.table-header h2 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 1px;
    background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.8) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.table-scroll {
    max-height: 600px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    position: sticky;
    top: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(15px);
    z-index: 10;
}

th {
    padding: 20px 25px;
    text-align: left;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
    border-bottom: 2px solid var(--glass-border);
    letter-spacing: 1px;
    text-transform: uppercase;
}

td {
    padding: 18px 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s ease;
    font-size: 1rem;
}

tbody tr {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: scale(1.01);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

tbody tr:nth-child(1) td {
    background: rgba(245, 197, 66, 0.15);
    font-weight: 600;
}

tbody tr:nth-child(2) td {
    background: rgba(207, 216, 220, 0.15);
}

tbody tr:nth-child(3) td {
    background: rgba(205, 127, 50, 0.15);
}

.rank-badge {
    display: inline-block;
    min-width: 45px;
    height: 45px;
    line-height: 45px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 800;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

tbody tr:hover .rank-badge {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

tbody tr:nth-child(1) .rank-badge {
    background: linear-gradient(135deg, #ffd700 0%, #ffed4a 100%);
    color: #000;
    border-color: #ffd700;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.5);
}

tbody tr:nth-child(2) .rank-badge {
    background: linear-gradient(135deg, #c0c0c0 0%, #e8e8e8 100%);
    color: #000;
    border-color: #c0c0c0;
    box-shadow: 0 4px 20px rgba(192, 192, 192, 0.5);
}

tbody tr:nth-child(3) .rank-badge {
    background: linear-gradient(135deg, #cd7f32 0%, #e0a96d 100%);
    color: #000;
    border-color: #cd7f32;
    box-shadow: 0 4px 20px rgba(205, 127, 50, 0.5);
}

tbody tr td:nth-child(2) {
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

tbody tr td:nth-child(3) {
    font-weight: 700;
    font-size: 1.15rem;
    font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Mono", "Droid Sans Mono", "Source Code Pro", monospace;
    color: var(--accent-color);
    text-shadow: 0 0 10px rgba(245, 197, 66, 0.3);
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-gradient);
    border-radius: 5px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    border-color: rgba(255, 255, 255, 0.2);
}

@media (max-width: 768px) {
    .title {
        font-size: 2.2rem;
        letter-spacing: 1px;
    }
    
    .tabs {
        gap: 8px;
        padding: 6px;
    }
    
    .tab-btn {
        padding: 10px 18px;
        font-size: 0.9rem;
        border-radius: 10px;
    }
    
    .table-header {
        padding: 20px 25px;
    }
    
    .table-header h2 {
        font-size: 1.4rem;
    }
    
    th, td {
        padding: 14px 18px;
        font-size: 0.95rem;
    }
    
    .rank-badge {
        min-width: 40px;
        height: 40px;
        line-height: 40px;
        font-size: 1.1rem;
    }
    
    tbody tr td:nth-child(2) {
        font-size: 1rem;
    }
    
    tbody tr td:nth-child(3) {
        font-size: 1.05rem;
    }
}

@media (max-width: 480px) {
    .title {
        font-size: 1.8rem;
    }
    
    .tab-btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    th, td {
        padding: 12px 15px;
        font-size: 0.9rem;
    }
}

.bracket-container {
    margin: 40px 0;
    padding: 30px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.3);
}

.bracket {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 60px;
    overflow-x: auto;
    position: relative;
    padding: 20px 0;
}

.bracket::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 1;
}

.bracket-round {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 200px;
    position: relative;
    justify-content: center;
    height: 100%;
}

.bracket-round:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 50%;
    right: -60px;
    width: 60px;
    height: 2px;
    background: linear-gradient(to right, rgba(245, 197, 66, 0.6), rgba(245, 197, 66, 0.3));
    transform: translateY(-50%);
}

.bracket-round:not(:last-child)::before {
    content: '';
    position: absolute;
    top: 50%;
    right: -60px;
    width: 0;
    height: 0;
    border-left: 10px solid rgba(245, 197, 66, 0.8);
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    transform: translateY(-50%);
}

.bracket-round-title {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent-color);
    margin-bottom: 10px;
    padding: 12px;
    background: rgba(245, 197, 66, 0.1);
    border-radius: 12px;
    border: 2px solid rgba(245, 197, 66, 0.3);
    letter-spacing: 1px;
}

.bracket-match {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    position: relative;
}

.bracket-match:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
}

.bracket-player {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}

.bracket-player:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.02);
}

.bracket-player.winner {
    background: linear-gradient(135deg, rgba(245, 197, 66, 0.2) 0%, rgba(255, 215, 0, 0.1) 100%);
    border-color: rgba(245, 197, 66, 0.5);
    box-shadow: 0 4px 15px rgba(245, 197, 66, 0.3);
}

.winner-icon {
    display: inline-block;
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1.2rem;
    margin-left: 8px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.6;
        transform: translateX(0);
    }
    50% {
        opacity: 1;
        transform: translateX(3px);
    }
}

.player-rank {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent-color);
    min-width: 35px;
}

.player-id {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    text-align: center;
    letter-spacing: 0.5px;
}

.player-score {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent-color);
    min-width: 70px;
    text-align: right;
    font-family: "SF Mono", "Monaco", "Inconsolata", "Fira Mono", "Droid Sans Mono", "Source Code Pro", monospace;
}

.player-empty {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-style: italic;
    opacity: 0.6;
}

@media (max-width: 768px) {
    .bracket-container {
        padding: 15px;
        margin: 20px 0;
    }
    
    .bracket {
        gap: 25px;
        padding: 10px;
        align-items: flex-start;
        overflow-x: auto;
        justify-content: flex-start;
    }
    
    .bracket-round {
        min-width: 150px;
        justify-content: flex-start;
        height: auto;
        flex-shrink: 0;
    }
    
    .bracket-round-title {
        font-size: 1rem;
        padding: 8px;
        margin-bottom: 10px;
    }
    
    .bracket-match {
        padding: 10px;
        gap: 8px;
    }
    
    .bracket-player {
        padding: 8px 10px;
    }
    
    .player-rank {
        font-size: 0.8rem;
        min-width: 25px;
    }
    
    .player-id {
        font-size: 0.85rem;
    }
    
    .player-score {
        font-size: 0.8rem;
        min-width: 55px;
    }
}

@media (max-width: 480px) {
    .bracket-container {
        padding: 10px;
        margin: 15px 0;
    }
    
    .bracket {
        gap: 20px;
        padding: 5px;
        align-items: flex-start;
        overflow-x: auto;
        justify-content: flex-start;
    }
    
    .bracket-round {
        min-width: 130px;
        justify-content: flex-start;
        height: auto;
        flex-shrink: 0;
    }
    
    .bracket-round-title {
        font-size: 0.9rem;
        padding: 6px;
        margin-bottom: 8px;
    }
    
    .bracket-match {
        padding: 8px;
        gap: 6px;
    }
    
    .bracket-player {
        padding: 6px 8px;
    }
    
    .player-rank {
        font-size: 0.75rem;
        min-width: 20px;
    }
    
    .player-id {
        font-size: 0.8rem;
    }
    
    .player-score {
        font-size: 0.75rem;
        min-width: 45px;
    }
}