/* --- Variables & Reset (New Golden Theme) --- */
:root {
    /* New Color Concept */
    --color-primary: #FFCE20;
    /* Main Gold */
    --color-primary-highlight: #FFF080;
    /* Light Gold */
    --color-primary-shadow: #D99516;
    /* Dark Gold */

    --color-dark-base: #2E1F0F;
    /* Dark Brown/Black Base */
    --color-dark-lighter: #4a3b2a;
    /* Lighter Brown for Cards */

    --color-text-main: #FDFBF7;
    /* Off-White Text */
    --color-text-muted: #94a3b8;
    /* Muted Text */
    --color-text-inverse: #2E1F0F;
    /* Text on Gold */

    --font-main: 'Outfit', sans-serif;
    /* Keeping Outfit for main UI */
    --font-headings: 'Inter', sans-serif;
    /* Inter for Landing Headings */

    --container-width: 1200px;
    --container-wide-width: 1600px;
    /* For Stats */
    --spacing-section: 6rem;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--color-dark-base);
    color: var(--color-text-main);
    font-family: var(--font-main);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Background Glow Effect */
.background-glow {
    position: fixed;
    top: -20%;
    left: -20%;
    width: 60%;
    height: 60%;
    background: radial-gradient(circle, rgba(255, 206, 32, 0.15) 0%, transparent 70%);
    opacity: 0.4;
    z-index: -1;
    filter: blur(100px);
    pointer-events: none;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
}

.container-wide {
    width: 100%;
    margin: 0 auto;
}

.container-wide .container {
    max-width: var(--container-wide-width);
    /* Allow wider for stats */
}

/* --- Common Typography (Missing Fixed) --- */
.page-title {
    font-family: var(--font-headings);
    font-size: 2.5rem;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
    text-align: center;
}

.page-subtitle {
    text-align: center;
    color: var(--color-text-muted);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

/* --- Header & Navigation --- */
header {
    background: rgba(46, 31, 15, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--color-primary-shadow);
    /* Changed to 2px for visual pop */
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-img {
    height: 40px;
    /* Adjust based on new logo aspect ratio */
    width: auto;
    display: block;
}

nav {
    display: flex;
    gap: 20px;
}

nav a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-weight: 700;
    transition: color 0.3s;
    font-size: 1rem;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

nav a.active,
nav a:hover {
    color: var(--color-primary);
}

/* --- SECTIONS (SPA Logic) --- */
main {
    width: 100%;
    flex: 1;
    /* Push footer down */
    display: flex;
    flex-direction: column;
}

main>section {
    display: none;
    /* Hide all by default */
    animation: fadeIn 0.4s ease;
    padding-bottom: 4rem;
    /* Bottom spacing for all sections */
    width: 100%;
}

main>section.active-section {
    display: block;
    /* Show active */
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- LANDING PAGE --- */

/* Hero Section */
.landing-hero {
    width: 100%;
    /* Full Width */
    height: 100vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    background-image: linear-gradient(to bottom, rgba(46, 31, 15, 0.0), rgba(0, 0, 0, 0.5)), url('./src/dungeons.webp');
	/* background-image: url('./src/dungeons.webp'); */
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    margin-bottom: 0;
    /* No margin, flows into features */
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);
    border-bottom: 4px solid var(--color-primary-shadow);
}

.hero-content {
    z-index: 2;
    padding: 0 1rem;
}

.hero-title-img {
    max-width: 600px;
    width: 100%;
    margin-bottom: 2rem;
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.6));
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }

    100% {
        transform: translateY(0);
    }
}

.hero-subtitle {
    font-size: 1.8rem;
    margin-bottom: 2.5rem;
    color: #fff;
    font-family: var(--font-headings);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    font-weight: 600;
}

.hero-actions {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.cta-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2.5rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    font-family: var(--font-main);
    cursor: pointer;
    border: none;
    font-size: 1rem;
}

.cta-button.primary {
    background: linear-gradient(180deg, var(--color-primary) 0%, var(--color-primary-shadow) 100%);
    color: var(--color-text-inverse);
    border: 2px solid var(--color-dark-base);
    border-bottom: 5px solid var(--color-dark-base);
    /* 3D Effect */
}

.cta-button.primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.cta-button.primary:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
}

.cta-button.secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.cta-button.secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: #fff;
}

.cta-button.small {
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
}

/* Feature Sections */
.features-wrapper {
    position: relative;
    /* Add subtle background pattern/image */
    background-image: linear-gradient(rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.75)), url('./src/hero-background.webp');
    background-size: cover;
    background-attachment: fixed;
    padding-bottom: 4rem;
}

.features-list {
    padding-top: 4rem;
}

.feature-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4rem;
    padding: var(--spacing-section) 0;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.feature-section.visible {
    opacity: 1;
    transform: translateY(0);
}

.feature-text {
    flex: 1;
}

.feature-text h2 {
    font-family: var(--font-headings);
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--color-primary);
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.feature-text p {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    line-height: 1.7;
}

.feature-image {
    flex: 1;
    position: relative;
}

.feature-image img {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.6);
    border: 2px solid var(--color-primary-shadow);
    transition: transform 0.3s ease;
}

.feature-image img:hover {
    transform: scale(1.02);
}

.feature-section:nth-child(even) {
    flex-direction: row-reverse;
}

/* --- GUIDE SECTION --- */
.guide-container {
    display: grid;
    gap: 2rem;
    margin-top: 2rem;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    /* Better responsiveness */
}

.guide-step {
    background: var(--color-dark-lighter);
    border: 1px solid var(--color-primary-shadow);
    border-radius: 12px;
    padding: 2rem;
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.step-number {
    font-size: 3rem;
    font-weight: 900;
    color: var(--color-dark-base);
    min-width: 60px;
    height: 60px;
    background: var(--color-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 5px 15px rgba(255, 206, 32, 0.3);
}

.step-content h3 {
    font-size: 1.5rem;
    color: #fff;
    margin-bottom: 0.5rem;
}

.step-content p {
    color: var(--color-text-muted);
    margin-bottom: 0.5rem;
}

.code-block {
    background: #000;
    padding: 1rem;
    border-radius: 6px;
    font-family: monospace;
    font-size: 1.2rem;
    color: #4ade80;
    /* code green */
    border: 1px solid #333;
}

.small-note {
    font-size: 0.9rem;
    font-style: italic;
    opacity: 0.7;
}

/* --- STATS TABLES (Restored) --- */
#leaderboard {
    padding-top: 2rem;
}

.categories {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.category-btn {
    background: transparent;
    border: 1px solid var(--color-text-muted);
    color: var(--color-text-muted);
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.category-btn:hover,
.category-btn.active {
    background: var(--color-primary);
    color: var(--color-text-inverse);
    border-color: var(--color-primary);
    font-weight: 700;
}

.stats-container {
    background: var(--color-dark-lighter);
    border: 1px solid var(--color-primary-shadow);
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 60px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.table-controls {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    justify-content: flex-end;
}

.search-box {
    position: relative;
}

.search-box input {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.8rem 1rem 0.8rem 2.5rem;
    border-radius: 8px;
    font-family: var(--font-main);
    width: 250px;
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
}

thead {
    background: rgba(0, 0, 0, 0.2);
}

th,
td {
    padding: 1.2rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

th {
    color: var(--color-text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    cursor: pointer;
}

th:hover {
    color: var(--color-primary);
}

td {
    color: var(--color-text-main);
}

.player-cell {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.player-avatar {
    width: 32px;
    height: 32px;
    border-radius: 4px;
}

.player-name {
    font-weight: 600;
}

.pagination {
    padding: 1.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.1);
}

.pagination button {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text-main);
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* --- REWARDS (Missing Fixed) --- */
.rewards-hero {
    text-align: center;
    padding: 2rem 0;
}

.rewards-placeholder {
    background: var(--color-dark-lighter);
    border: 1px solid var(--color-primary-shadow);
    border-radius: 16px;
    padding: 4rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.rewards-placeholder i {
    font-size: 4rem;
    color: var(--color-primary);
    animation: bounce 2s infinite;
}

.rewards-placeholder h2 {
    font-size: 2rem;
    font-family: var(--font-headings);
    color: #fff;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-20px);
    }

    60% {
        transform: translateY(-10px);
    }
}


/* --- LIVEMAP FULL WIDTH --- */
.full-width-section {
    width: 100%;
    padding: 0;
}

.livemap-header {
    text-align: center;
    padding: 2rem 0;
}

.livemap-container-full {
    width: 100%;
    height: 85vh;
    border-top: 4px solid var(--color-primary-shadow);
    border-bottom: 4px solid var(--color-primary-shadow);
}

.livemap-container-full iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* --- FOOTER --- */
footer {
    margin-top: auto;
    border-top: 1px solid var(--color-primary-shadow);
    padding: 30px 0;
    text-align: center;
    background-color: #000;
    color: var(--color-text-muted);
}

footer .socials a {
    color: var(--color-text-muted);
    margin: 0 10px;
    font-size: 1.5rem;
    transition: color 0.3s;
}

footer .socials a:hover {
    color: var(--color-primary);
}


/* --- RESPONSIVE OPTIMIZATION --- */
@media (max-width: 900px) {

    /* Nav stack or hamburger? For 4 items maybe scrollable or stacked */
    .header-container {
        flex-direction: column;
        gap: 15px;
    }

    nav {
        gap: 10px;
        flex-wrap: wrap;
        /* allow wrapping on very small screens */
        justify-content: center;
    }

    .hero-title-img {
        max-width: 90%;
    }

    .hero-subtitle {
        font-size: 1.2rem;
    }

    /* Stack features */
    .feature-section {
        flex-direction: column !important;
        text-align: center;
        gap: 2rem;
        padding: 3rem 0;
    }

    /* Guide Stack */
    .guide-step {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1rem;
    }

    /* Livemap */
    .livemap-container-full {
        height: 60vh;
    }
}