* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --tier-s: #ff6b6b;
    --tier-a: #ffa94d;
    --tier-b: #ffd93d;
    --tier-c: #6bcf7f;
    --tier-d: #4d79a4;
    --bg-dark: #1a1a2e;
    --bg-card: #16213e;
    --text-primary: #eaeaea;
    --text-secondary: #b8b8b8;
    --border-color: #2a2a3e;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

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

header h1 {
    font-size: 3em;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1em;
}

.controls {
    margin-bottom: 30px;
}

.auth-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px 15px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 8px;
    border: 1px solid rgba(102, 126, 234, 0.3);
}

#usernameDisplay {
    color: var(--text-primary);
    font-weight: 600;
}

.btn-logout {
    padding: 8px 16px;
    background: #d32f2f;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: #f44336;
    transform: translateY(-1px);
}

.login-prompt {
    text-align: center;
    padding: 30px;
    margin-top: 50px;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.login-prompt p {
    color: var(--text-secondary);
    margin-bottom: 15px;
    font-size: 0.95em;
}

.login-prompt .btn {
    display: inline-block;
    text-decoration: none;
}

.add-player-section {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

#playerSearch {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    transition: border-color 0.3s;
}

#playerSearch:focus {
    outline: none;
    border-color: #667eea;
}

#leaderboardSelect {
    padding: 12px 16px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-discord {
    background: #5865F2;
    color: white;
}

.btn-discord:hover {
    background: #4752C4;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(88, 101, 242, 0.4);
}

.search-results {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 10px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: var(--border-color);
}

.member-search-section {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.search-member-container {
    display: flex;
    gap: 10px;
    max-width: 600px;
    margin: 0 auto;
}

.member-search-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    transition: all 0.3s;
}

.member-search-input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 0.08);
}

.member-search-result {
    margin-top: 20px;
    display: none;
}

.member-found-card {
    background: rgba(102, 126, 234, 0.1);
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
}

.member-found-card h3 {
    color: #667eea;
    margin-bottom: 15px;
}

.member-info {
    text-align: left;
    margin: 20px 0;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
}

.member-info p {
    margin: 10px 0;
    color: var(--text-primary);
}

.member-not-found {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
}

.player-item.highlighted {
    background: rgba(102, 126, 234, 0.2) !important;
    border-left-width: 6px;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 0 30px rgba(102, 126, 234, 0.6);
    }
}

.tier-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.tier-tab-btn {
    padding: 12px 30px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
}

.tier-tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #667eea;
    color: var(--text-primary);
}

.tier-tab-btn.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.tier-tab-content {
    display: none;
}

.tier-tab-content.active {
    display: block;
}

.tier-list-container {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.tier-list-linear {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border-left: 4px solid;
    transition: all 0.3s;
    flex-wrap: wrap;
}

.player-item:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(5px);
}

.tier-badge {
    font-weight: bold;
    font-size: 1.1em;
    min-width: 45px;
    text-align: center;
    padding: 4px 8px;
    border-radius: 4px;
}

.player-item.tier-s {
    border-left-color: var(--tier-s);
}

.player-item.tier-s .tier-badge {
    background: var(--tier-s);
    color: white;
}

.player-item.tier-a {
    border-left-color: var(--tier-a);
}

.player-item.tier-a .tier-badge {
    background: var(--tier-a);
    color: white;
}

.player-item.tier-b {
    border-left-color: var(--tier-b);
}

.player-item.tier-b .tier-badge {
    background: var(--tier-b);
    color: #333;
}

.player-item.tier-c {
    border-left-color: var(--tier-c);
}

.player-item.tier-c .tier-badge {
    background: var(--tier-c);
    color: white;
}

.player-item.tier-d {
    border-left-color: var(--tier-d);
}

.player-item.tier-d .tier-badge {
    background: var(--tier-d);
    color: white;
}

.player-name {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
    min-width: 150px;
}

.player-separator {
    color: var(--text-secondary);
    opacity: 0.5;
}

.player-rating {
    font-size: 1.3em;
    font-weight: bold;
    color: var(--text-primary);
    min-width: 80px;
}

.player-rank {
    font-size: 0.9em;
    color: var(--text-secondary);
    opacity: 0.8;
}

.player-leaderboard {
    font-size: 0.85em;
    color: var(--text-secondary);
    opacity: 0.7;
    margin-left: 15px;
}

.player-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
    flex-shrink: 0;
}

.btn-small {
    padding: 5px 10px;
    font-size: 0.85em;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-update,
.btn-edit {
    background: #4d79a4;
    color: white;
}

.btn-update:hover,
.btn-edit:hover {
    background: #5a8ab8;
}

.btn-delete {
    background: #d32f2f;
    color: white;
}

.btn-delete:hover {
    background: #f44336;
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
}

.message.success {
    background: #4caf50;
    color: white;
}

.message.error {
    background: #f44336;
    color: white;
}

.hidden {
    display: none !important;
}

.message.hidden {
    display: none;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.empty-message {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    opacity: 0.7;
    font-size: 1.1em;
}

@media (max-width: 768px) {
    header h1 {
        font-size: 2em;
    }
    
    .add-player-section {
        flex-direction: column;
    }
    
    #playerSearch,
    #leaderboardSelect,
    .btn {
        width: 100%;
    }
    
    .player-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .player-actions {
        margin-left: 0;
        margin-top: 10px;
        width: 100%;
    }
    
    .player-leaderboard {
        margin-left: 0;
    }
}

