/* Import Medieval Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700;900&family=Cinzel+Decorative:wght@700;900&family=MedievalSharp&display=swap');

/* CSS Variables - Cambria Medieval Theme */
:root {
    --primary-color: #d4af37;        /* Rich gold */
    --secondary-color: #2a2520;      /* Dark stone */
    --success-color: #4a8f3b;        /* Forest green */
    --warning-color: #f4a442;        /* Amber */
    --danger-color: #8b1e1e;         /* Dark red */
    --background-color: #0a0a0a;     /* Very dark */
    --surface-color: rgba(42, 37, 32, 0.85); /* Stone surface */
    --surface-elevated: rgba(60, 52, 45, 0.95); /* Elevated stone */
    --text-primary: #f5e6d3;         /* Parchment white */
    --text-secondary: #c9b896;       /* Aged parchment */
    --border-color: #6b5d4f;         /* Bronze/dark gold */
    --border-radius: 4px;            /* Sharper, more medieval */
    --shadow: 0 6px 16px rgba(0, 0, 0, 0.8);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.9);
    --gold-shine: linear-gradient(135deg, #d4af37 0%, #f4d03f 25%, #d4af37 50%, #c5a028 75%, #d4af37 100%);
    
    /* Skill category colors */
    --combat-color: #e74c3c;
    --gathering-color: #27ae60;
    --crafting-color: #3498db;
    --misc-color: #9b59b6;
}

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

body {
    font-family: 'Cinzel', serif;
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Video Background */
.video-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    object-fit: cover;
}

.video-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: -1;
}

/* Snow Effect ❄️ */
.snow-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.snowflake {
    position: absolute;
    top: -5%;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 5px rgba(255, 255, 255, 0.5);
    animation: snowfall linear infinite;
    will-change: transform;
}

@keyframes snowfall {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
    }
    25% {
        transform: translateY(25vh) translateX(var(--drift, 10px)) rotate(90deg);
    }
    50% {
        transform: translateY(50vh) translateX(calc(var(--drift, 10px) * -0.5)) rotate(180deg);
    }
    75% {
        transform: translateY(75vh) translateX(var(--drift, 10px)) rotate(270deg);
    }
    100% {
        transform: translateY(105vh) translateX(0) rotate(360deg);
    }
}

/* Christmas Lights Border 🎄 */
.christmas-lights {
    position: relative;
    overflow: visible !important;
    margin: 15px;
}

.lights-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 10;
    overflow: visible;
}

.xmas-light {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--light-color);
    box-shadow: 
        0 0 6px var(--light-color),
        0 0 12px var(--light-color),
        0 0 18px var(--light-color);
    animation: light-twinkle ease-in-out infinite;
    transform: translate(-50%, -50%);
}

@keyframes light-twinkle {
    0%, 100% {
        opacity: 0.4;
        transform: translate(-50%, -50%) scale(0.8);
        box-shadow: 
            0 0 3px var(--light-color),
            0 0 6px var(--light-color);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
        box-shadow: 
            0 0 8px var(--light-color),
            0 0 16px var(--light-color),
            0 0 24px var(--light-color);
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 35px;
    overflow: visible;
}

header {
    text-align: center;
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.header-logo {
    height: 100px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

header h1 {
    font-family: 'Cinzel Decorative', serif;
    font-size: 2.5rem;
    color: #d4af37;
    margin: 0;
    font-weight: 900;
    letter-spacing: 4px;
    text-shadow: 
        0 0 10px rgba(212, 175, 55, 0.9),
        0 0 30px rgba(212, 175, 55, 0.6),
        0 0 50px rgba(212, 175, 55, 0.3),
        3px 3px 0 #000,
        -1px -1px 0 #000,
        1px -1px 0 #000,
        -1px 1px 0 #000,
        2px 2px 8px rgba(0, 0, 0, 1);
}

/* Navigation */
.page-nav {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.nav-link {
    padding: 10px 20px;
    background: var(--surface-elevated);
    backdrop-filter: blur(10px);
    color: var(--text-secondary);
    text-decoration: none;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    position: relative;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-link::before {
    content: '⚔';
    margin-right: 6px;
    opacity: 0.7;
}

.nav-link:hover {
    background: linear-gradient(135deg, var(--primary-color), #c5a028);
    color: #1a1510;
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.6);
    transform: translateY(-2px);
}

.nav-link.active {
    background: var(--gold-shine);
    color: #1a1510;
    border-color: var(--primary-color);
    box-shadow: 0 0 25px rgba(212, 175, 55, 0.8), inset 0 2px 4px rgba(0, 0, 0, 0.3);
    font-weight: 700;
}

main {
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow: visible;
}

/* Skill Selector */
.skill-selector {
    background: var(--surface-elevated);
    background-image: 
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0,0,0,.1) 2px, rgba(0,0,0,.1) 4px),
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,.1) 2px, rgba(0,0,0,.1) 4px);
    backdrop-filter: blur(10px);
    border: 3px solid var(--border-color);
    border-style: double;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow), inset 0 2px 4px rgba(0, 0, 0, 0.5);
}


.skill-selector h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 1.1rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.skill-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

.skill-tab {
    padding: 10px 16px;
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    color: var(--text-secondary);
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: capitalize;
    display: flex;
    align-items: center;
    gap: 6px;
}

.skill-tab:hover {
    background: var(--surface-elevated);
    border-color: var(--primary-color);
    color: var(--text-primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

.skill-tab.active {
    background: var(--gold-shine);
    color: #1a1510;
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(212, 175, 55, 0.6);
    font-weight: 700;
}

.skill-tab .skill-icon {
    font-size: 1.1rem;
}

/* Combat skills */
.skill-tab[data-category="combat"] { border-left: 3px solid var(--combat-color); }
.skill-tab[data-category="combat"].active { box-shadow: 0 0 20px rgba(231, 76, 60, 0.5); }

/* Gathering skills */
.skill-tab[data-category="gathering"] { border-left: 3px solid var(--gathering-color); }
.skill-tab[data-category="gathering"].active { box-shadow: 0 0 20px rgba(39, 174, 96, 0.5); }

/* Crafting skills */
.skill-tab[data-category="crafting"] { border-left: 3px solid var(--crafting-color); }
.skill-tab[data-category="crafting"].active { box-shadow: 0 0 20px rgba(52, 152, 219, 0.5); }

/* Misc skills */
.skill-tab[data-category="misc"] { border-left: 3px solid var(--misc-color); }
.skill-tab[data-category="misc"].active { box-shadow: 0 0 20px rgba(155, 89, 182, 0.5); }

/* Stats Bar */
.stats-bar {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: var(--surface-elevated);
    border-radius: var(--border-radius);
    border: 2px solid var(--border-color);
    min-width: 200px;
    gap: 15px;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    font-family: 'Courier New', monospace;
}

.stat-value.highlight {
    color: var(--success-color);
    font-family: 'Cinzel', serif;
    text-transform: capitalize;
}

/* Leaderboard */
.leaderboard-container {
    background: var(--surface-elevated);
    background-image: 
        repeating-linear-gradient(90deg, transparent, transparent 2px, rgba(0,0,0,.1) 2px, rgba(0,0,0,.1) 4px),
        repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,0,0,.1) 2px, rgba(0,0,0,.1) 4px);
    backdrop-filter: blur(10px);
    border: 3px solid var(--border-color);
    border-style: double;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow), inset 0 2px 4px rgba(0, 0, 0, 0.5);
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}


.leaderboard {
    width: 100%;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.leaderboard-header {
    display: grid;
    grid-template-columns: 80px 1fr 180px;
    gap: 15px;
    padding: 15px 20px;
    background: var(--background-color);
    border-radius: var(--border-radius);
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.rank-col { text-align: center; }
.name-col { text-align: left; }
.xp-col { text-align: right; }

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    padding-right: 5px;
    flex: 1;
    min-height: 0;
    max-height: 500px;
}

/* Custom scrollbar */
.leaderboard-list::-webkit-scrollbar {
    width: 8px;
}

.leaderboard-list::-webkit-scrollbar-track {
    background: var(--background-color);
    border-radius: 4px;
}

.leaderboard-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.leaderboard-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    opacity: 0.6;
}

.empty-text {
    font-size: 1.1rem;
    text-align: center;
}

/* Leader Item */
.leader-item {
    display: grid;
    grid-template-columns: 80px 1fr 180px;
    gap: 15px;
    padding: 12px 20px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    align-items: center;
    opacity: 0;
    transform: translateY(20px);
    animation: slideIn 0.4s ease forwards;
    transition: all 0.3s ease;
}

.leader-item:hover {
    background: var(--surface-elevated);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

@keyframes slideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Top 3 Special Styling */
.leader-item.rank-1 {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.35), rgba(244, 208, 63, 0.25));
    border: 3px double var(--primary-color);
    box-shadow: 0 0 30px rgba(212, 175, 55, 0.6);
    padding: 16px 22px;
    animation: slideIn 0.6s ease forwards, goldGlow 3s ease-in-out infinite;
}

.leader-item.rank-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.35), rgba(169, 169, 169, 0.25));
    border: 3px double #c0c0c0;
    box-shadow: 0 0 25px rgba(192, 192, 192, 0.5);
    padding: 14px 22px;
    animation: slideIn 0.5s ease forwards, silverGlow 3s ease-in-out infinite;
}

.leader-item.rank-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.35), rgba(184, 115, 51, 0.25));
    border: 3px double #cd7f32;
    box-shadow: 0 0 20px rgba(205, 127, 50, 0.4);
    padding: 13px 22px;
    animation: slideIn 0.45s ease forwards, bronzeGlow 3s ease-in-out infinite;
}

/* Top 4-10 styling */
.leader-item.rank-top10 {
    border: 2px solid var(--border-color);
    background: linear-gradient(135deg, rgba(107, 93, 79, 0.2), rgba(107, 93, 79, 0.1));
}

@keyframes goldGlow {
    0%, 100% { box-shadow: 0 0 30px rgba(212, 175, 55, 0.6); }
    50% { box-shadow: 0 0 45px rgba(212, 175, 55, 0.9), 0 0 60px rgba(244, 208, 63, 0.4); }
}

@keyframes silverGlow {
    0%, 100% { box-shadow: 0 0 25px rgba(192, 192, 192, 0.5); }
    50% { box-shadow: 0 0 40px rgba(192, 192, 192, 0.8); }
}

@keyframes bronzeGlow {
    0%, 100% { box-shadow: 0 0 20px rgba(205, 127, 50, 0.4); }
    50% { box-shadow: 0 0 35px rgba(205, 127, 50, 0.7); }
}

.leader-rank {
    font-size: 1.3rem;
    font-weight: 700;
    text-align: center;
    font-family: 'Cinzel', serif;
    color: var(--text-secondary);
}

.rank-1 .leader-rank {
    color: var(--primary-color);
    font-size: 2rem;
    text-shadow: 0 0 15px rgba(212, 175, 55, 0.8);
}

.rank-1 .leader-rank::before {
    content: '🏆 ';
    font-size: 1.8rem;
}

.rank-2 .leader-rank {
    color: #e8e8e8;
    font-size: 1.7rem;
    text-shadow: 0 0 12px rgba(192, 192, 192, 0.7);
}

.rank-2 .leader-rank::before {
    content: '🥈 ';
    font-size: 1.5rem;
}

.rank-3 .leader-rank {
    color: #e89b5a;
    font-size: 1.5rem;
    text-shadow: 0 0 10px rgba(205, 127, 50, 0.6);
}

.rank-3 .leader-rank::before {
    content: '🥉 ';
    font-size: 1.3rem;
}

.leader-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-1 .leader-name {
    font-size: 1.25rem;
    font-weight: 700;
    text-shadow: 0 0 8px rgba(212, 175, 55, 0.4);
}

.rank-2 .leader-name {
    font-size: 1.15rem;
    font-weight: 700;
}

.rank-3 .leader-name {
    font-size: 1.1rem;
    font-weight: 700;
}

.leader-xp {
    font-size: 1rem;
    font-weight: 700;
    color: var(--success-color);
    font-family: 'Courier New', monospace;
    text-align: right;
}

.rank-1 .leader-xp,
.rank-2 .leader-xp,
.rank-3 .leader-xp {
    font-size: 1.2rem;
    font-weight: 800;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 20px;
    font-size: 1.2rem;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Audio Controls */
.audio-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 12px;
    border-radius: 25px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

.audio-controls:hover {
    background: rgba(0, 0, 0, 0.85);
    border-color: var(--primary-color);
}

.audio-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.4rem;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.audio-toggle:hover {
    transform: scale(1.1);
}

.volume-slider-container {
    width: 0;
    overflow: hidden;
    transition: width 0.3s ease;
}

.audio-controls:hover .volume-slider-container,
.audio-controls.expanded .volume-slider-container {
    width: 80px;
}

.volume-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 80px;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.volume-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--primary-color);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Responsive Design */
@media (max-width: 768px) {
    .skill-tabs {
        gap: 6px;
    }
    
    .skill-tab {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
    
    .leaderboard-header,
    .leader-item {
        grid-template-columns: 60px 1fr 120px;
        gap: 10px;
        padding: 10px 15px;
        font-size: 0.85rem;
    }
    
    .leader-rank {
        font-size: 1.1rem;
    }
    
    .rank-1 .leader-rank { font-size: 1.5rem; }
    .rank-2 .leader-rank { font-size: 1.3rem; }
    .rank-3 .leader-rank { font-size: 1.2rem; }
    
    .stats-bar {
        flex-direction: column;
    }
    
    .stat-item {
        min-width: 100%;
    }
    
    .page-nav {
        gap: 8px;
    }
    
    .nav-link {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
}

