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

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #ec4899;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --border-color: #475569;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --gradient-primary: linear-gradient(135deg, #6366f1, #ec4899);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    font-weight: 400;
}

body.light-theme {
    --background: #ffffff;
    --surface: #f5f5f5;
    --text-primary: #000000;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
}

/* Menu Button */
.menu-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    height: 56px;
    width: 56px;
    border-radius: 12px;
    background: var(--gradient-primary);
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.2);
}

.menu-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(99, 102, 241, 0.4);
}

/* Menu Sidebar */
.menu {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100vh;
    background: linear-gradient(180deg, var(--surface) 0%, #1a2332 100%);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.3);
    z-index: 999;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu:not(.hidden) {
    transform: translateX(0);
}

.menu.hidden {
    display: none;
}

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

.menu-header h2 {
    font-size: 24px;
}

.close-menu {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-menu:hover {
    color: var(--primary-color);
}

.menu-list {
    list-style: none;
    padding: 10px 0;
}

.menu-list li {
    display: flex;
    flex-direction: column;
}

.menu-list li.menu-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 10px 0;
}

.menu-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 14px 20px;
    display: block;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-weight: 500;
    font-size: 15px;
}

.menu-link:hover {
    background: var(--gradient-primary);
    color: white;
    border-left-color: var(--secondary-color);
    padding-left: 24px;
}

.menu-link.discord-link {
    color: var(--primary-color);
}

.menu-link.logout-link {
    color: var(--error-color);
}

.menu-link.admin-link {
    color: var(--warning-color);
}

.user-display {
    display: block;
    padding: 12px 20px;
    font-weight: 500;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 5px;
}

/* Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    display: none;
}

.overlay:not(.hidden) {
    display: block;
}

/* Content */
.content {
    margin-left: 0;
    transition: margin 0.3s ease;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.container h1 {
    font-size: 56px;
    margin-bottom: 12px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 18px;
    margin-bottom: 40px;
}

/* Leaderboard */
.leaderboard {
    margin-top: 40px;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.leaderboard-header h2 {
    font-size: 28px;
}

.levels-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.level-card {
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.level-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary-color);
    box-shadow: 0 20px 40px rgba(99, 102, 241, 0.15);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05), rgba(236, 72, 153, 0.05));
}

.level-rank {
    font-size: 32px;
    font-weight: 800;
    min-width: 50px;
    text-align: center;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.level-rank.rank-2 {
    background: linear-gradient(135deg, #a8aecf, #e2e8f0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.level-rank.rank-3 {
    background: linear-gradient(135deg, #d97706, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.level-thumbnail {
    width: 160px;
    height: 90px;
    border-radius: 6px;
    background-color: var(--background);
    overflow: hidden;
    flex-shrink: 0;
}

.level-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.level-info {
    flex: 1;
}

.level-name {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 5px;
}

.level-id {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Back Button */
.back-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 16px;
    cursor: pointer;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.back-btn:hover {
    transform: translateX(-5px);
}

/* Forms */
.form {
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 40px;
    max-width: 500px;
    margin: 20px 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--background);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: rgba(99, 102, 241, 0.05);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Buttons */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    width: 100%;
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.3);
}

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

.btn-tertiary {
    background-color: var(--surface-light);
    color: var(--text-primary);
}

/* Rules */
.rule-card {
    background-color: var(--surface);
    border-left: 4px solid var(--primary-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.rule-card:hover {
    transform: translateX(8px);
    box-shadow: 0 12px 24px rgba(99, 102, 241, 0.1);
    border-left-color: var(--secondary-color);
}

.rule-card h3 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 18px;
}

/* Settings */
.settings-container {
    display: grid;
    gap: 30px;
    margin-top: 20px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 50px;
    height: 28px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: .4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(22px);
}

/* Admin Panel */
.admin-card {
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.btn-danger {
    background-color: var(--error-color);
    color: white;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: var(--surface);
    border-radius: 16px;
    padding: 30px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Responsive */
@media (max-width: 768px) {
    .container h1 {
        font-size: 36px;
    }
    
    .level-card {
        flex-direction: column;
        text-align: center;
    }

    .level-thumbnail {
        width: 100%;
        height: 180px;
    }

    .menu {
        width: 100%;
    }
}