/* ========================================
   HackersWar - Unique Design System
   A refined, editorial cybersecurity aesthetic
   No neon. No AI-looking glow. Pure craft.
   ======================================== */

:root {
    --bg-primary: #0c0c14;
    --bg-secondary: #12121c;
    --bg-tertiary: #181825;
    --bg-elevated: #1e1e2e;
    --bg-card: #161620;
    
    --text-primary: #e8e4dc;
    --text-secondary: #9a958c;
    --text-muted: #6b665e;
    --text-inverse: #0c0c14;
    
    --border-subtle: #1e1e2e;
    --border-medium: #2a2a3e;
    --border-strong: #3a3a52;
    
    --accent-sage: #7a9e7e;
    --accent-sage-dim: #5a7a5e;
    --accent-sage-glow: rgba(122, 158, 126, 0.08);
    
    --accent-sand: #c4a96b;
    --accent-sand-dim: #a08a4e;
    --accent-sand-glow: rgba(196, 169, 107, 0.08);
    
    --accent-rose: #b87a7a;
    --accent-rose-dim: #955a5a;
    
    --accent-sky: #7a9ab8;
    --accent-sky-dim: #5a7a98;
    
    --success: #7a9e7e;
    --warning: #c4a96b;
    --error: #b87a7a;
    --info: #7a9ab8;
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', monospace;
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    
    --transition-fast: 0.15s ease;
    --transition-base: 0.25s ease;
    --transition-slow: 0.4s ease;
    
    --nav-height: 64px;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 15px;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Subtle noise texture overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.015;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    z-index: 9999;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

img {
    max-width: 100%;
    height: auto;
}

/* Page Wrapper */
.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    padding-top: var(--nav-height);
}

/* ========================================
   Navigation
   ======================================== */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(12, 12, 20, 0.85);
    backdrop-filter: blur(20px) saturate(1.2);
    -webkit-backdrop-filter: blur(20px) saturate(1.2);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -0.5px;
}

.brand-icon {
    width: 32px;
    height: 32px;
    color: var(--accent-sage);
}

.brand-accent {
    color: var(--accent-sage);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: var(--transition-base);
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.nav-link.active {
    color: var(--accent-sage);
    background: var(--accent-sage-glow);
}

.nav-link.admin-link {
    color: var(--accent-sand);
}

.nav-link.admin-link:hover {
    background: var(--accent-sand-glow);
}

.nav-auth {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: 16px;
    padding-left: 16px;
    border-left: 1px solid var(--border-subtle);
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.user-toggle:hover {
    border-color: var(--border-strong);
    background: var(--bg-tertiary);
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-sage);
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 6px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.dropdown-item.danger {
    color: var(--accent-rose);
}

.dropdown-item.danger:hover {
    background: rgba(184, 122, 122, 0.08);
}

.dropdown-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 6px 0;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    outline: none;
    white-space: nowrap;
}

.btn:focus-visible {
    outline: 2px solid var(--accent-sage);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--accent-sage);
    color: var(--text-inverse);
}

.btn-primary:hover {
    background: var(--accent-sage-dim);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(122, 158, 126, 0.2);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-medium);
}

.btn-ghost:hover {
    border-color: var(--border-strong);
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.btn-danger {
    background: var(--accent-rose);
    color: var(--text-inverse);
}

.btn-danger:hover {
    background: var(--accent-rose-dim);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
}

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

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* ========================================
   Forms
   ======================================== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 15px;
    transition: all var(--transition-fast);
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent-sage);
    box-shadow: 0 0 0 3px var(--accent-sage-glow);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    min-height: 120px;
    resize: vertical;
}

.form-hint {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.form-error {
    margin-top: 6px;
    font-size: 13px;
    color: var(--accent-rose);
}

/* ========================================
   Flash Messages
   ======================================== */
.flash-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 24px 0;
}

.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    margin-bottom: 12px;
    animation: flashSlideIn 0.3s ease;
}

@keyframes flashSlideIn {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.flash-success {
    background: rgba(122, 158, 126, 0.08);
    border: 1px solid rgba(122, 158, 126, 0.2);
    color: var(--accent-sage);
}

.flash-error {
    background: rgba(184, 122, 122, 0.08);
    border: 1px solid rgba(184, 122, 122, 0.2);
    color: var(--accent-rose);
}

.flash-warning {
    background: rgba(196, 169, 107, 0.08);
    border: 1px solid rgba(196, 169, 107, 0.2);
    color: var(--accent-sand);
}

.flash-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    opacity: 0.6;
    transition: opacity var(--transition-fast);
}

.flash-close:hover {
    opacity: 1;
}

/* ========================================
   Cards
   ======================================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-base);
}

.card:hover {
    border-color: var(--border-medium);
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.3px;
}

.card-body {
    color: var(--text-secondary);
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
    position: relative;
    padding: 100px 24px 80px;
    overflow: hidden;
}

.hero-container {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--accent-sage-glow);
    border: 1px solid rgba(122, 158, 126, 0.15);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-sage);
    margin-bottom: 24px;
    font-family: var(--font-mono);
}

.hero-title {
    font-size: clamp(36px, 5vw, 56px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -1.5px;
    margin-bottom: 20px;
}

.hero-title .accent {
    color: var(--accent-sage);
}

.hero-description {
    font-size: 18px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 32px;
    max-width: 520px;
}

.hero-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.hero-stats {
    display: flex;
    gap: 32px;
    margin-top: 40px;
    padding-top: 32px;
    border-top: 1px solid var(--border-subtle);
}

.hero-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hero-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent-sage);
    font-family: var(--font-mono);
    letter-spacing: -1px;
}

.hero-stat-label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Hero Visual */
.hero-visual {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero-terminal {
    width: 100%;
    max-width: 520px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.terminal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border-subtle);
}

.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.terminal-dot.red { background: var(--accent-rose); }
.terminal-dot.yellow { background: var(--accent-sand); }
.terminal-dot.green { background: var(--accent-sage); }

.terminal-title {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.terminal-body {
    padding: 20px;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.8;
}

.terminal-line {
    display: flex;
    gap: 8px;
    margin-bottom: 2px;
}

.terminal-prompt {
    color: var(--accent-sage);
    flex-shrink: 0;
}

.terminal-command {
    color: var(--text-primary);
}

.terminal-output {
    color: var(--text-muted);
    margin-bottom: 8px;
    padding-left: 0;
}

.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 16px;
    background: var(--accent-sage);
    animation: cursorBlink 1s step-end infinite;
    vertical-align: middle;
    margin-left: 2px;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ========================================
   Section Styles
   ======================================== */
.section {
    padding: 80px 24px;
}

.section-header {
    max-width: 1400px;
    margin: 0 auto 48px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}

.section-title {
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.8px;
}

.section-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.section-action {
    flex-shrink: 0;
}

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

/* ========================================
   Category Grid
   ======================================== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.category-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 28px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-accent, var(--accent-sage));
    opacity: 0;
    transition: opacity var(--transition-base);
}

.category-card:hover {
    border-color: var(--border-medium);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.category-card:hover::before {
    opacity: 1;
}

.category-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--card-accent-bg, var(--accent-sage-glow));
    color: var(--card-accent, var(--accent-sage));
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-icon svg {
    width: 24px;
    height: 24px;
}

.category-name {
    font-size: 18px;
    font-weight: 600;
}

.category-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.category-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
    font-size: 13px;
    color: var(--text-muted);
}

/* ========================================
   Challenge Grid
   ======================================== */
.challenge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.challenge-card {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-base);
}

.challenge-card:hover {
    border-color: var(--border-medium);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.challenge-card.solved {
    border-color: var(--accent-sage);
    background: rgba(122, 158, 126, 0.03);
}

.challenge-header {
    padding: 20px 20px 0;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.challenge-difficulty {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--diff-bg);
    color: var(--diff-color);
}

.challenge-points {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-sand);
}

.challenge-body {
    padding: 16px 20px;
    flex: 1;
}

.challenge-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    line-height: 1.4;
}

.challenge-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.challenge-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-secondary);
}

.challenge-solves {
    font-size: 13px;
    color: var(--text-muted);
}

.challenge-solves strong {
    color: var(--text-secondary);
}

.challenge-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
}

.challenge-status.solved {
    color: var(--accent-sage);
}

/* ========================================
   Challenge Detail Page
   ======================================== */
.challenge-detail {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 24px;
}

.challenge-detail-header {
    margin-bottom: 32px;
}

.challenge-detail-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.challenge-detail-title {
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 700;
    letter-spacing: -0.8px;
    margin-bottom: 16px;
}

.challenge-detail-description {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.7;
}

.challenge-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 28px;
    margin-bottom: 24px;
}

.challenge-box-title {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.challenge-box-content {
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.8;
    color: var(--text-secondary);
    white-space: pre-wrap;
}

.flag-form {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.flag-input {
    flex: 1;
    padding: 14px 18px;
    background: var(--bg-primary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 15px;
    outline: none;
    transition: all var(--transition-fast);
}

.flag-input:focus {
    border-color: var(--accent-sage);
    box-shadow: 0 0 0 3px var(--accent-sage-glow);
}

.flag-input::placeholder {
    color: var(--text-muted);
}

.flag-input.solved {
    border-color: var(--accent-sage);
    background: rgba(122, 158, 126, 0.05);
}

.flag-input.wrong {
    border-color: var(--accent-rose);
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-8px); }
    40% { transform: translateX(8px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ========================================
   Leaderboard
   ======================================== */
.leaderboard-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 24px;
}

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

.leaderboard-title {
    font-size: 36px;
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 12px;
}

.leaderboard-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
}

.podium {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 20px;
    margin-bottom: 48px;
}

.podium-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    transition: all var(--transition-base);
}

.podium-item:hover {
    border-color: var(--border-medium);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.podium-item.first {
    order: 2;
    padding: 32px;
    border-color: var(--accent-sand);
    background: linear-gradient(180deg, var(--bg-card) 0%, rgba(196, 169, 107, 0.05) 100%);
}

.podium-item.second {
    order: 1;
}

.podium-item.third {
    order: 3;
}

.podium-rank {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
}

.podium-item.first .podium-rank {
    background: var(--accent-sand);
    color: var(--text-inverse);
}

.podium-item.second .podium-rank {
    background: var(--accent-sky);
    color: var(--text-inverse);
}

.podium-item.third .podium-rank {
    background: var(--accent-rose);
    color: var(--text-inverse);
}

.podium-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
    font-family: var(--font-mono);
}

.podium-item.first .podium-avatar {
    width: 72px;
    height: 72px;
    font-size: 24px;
    border: 2px solid var(--accent-sand);
}

.podium-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.podium-points {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-sand);
}

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

.leaderboard-table th {
    text-align: left;
    padding: 14px 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-subtle);
}

.leaderboard-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 14px;
}

.leaderboard-table tr {
    transition: background var(--transition-fast);
}

.leaderboard-table tr:hover {
    background: var(--bg-secondary);
}

.leaderboard-table tr.current-user {
    background: var(--accent-sage-glow);
}

.leaderboard-rank {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 16px;
    color: var(--text-muted);
    width: 60px;
}

.leaderboard-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.leaderboard-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.leaderboard-username {
    font-weight: 600;
}

.leaderboard-points {
    font-family: var(--font-mono);
    font-weight: 700;
    color: var(--accent-sand);
}

.leaderboard-solves {
    color: var(--text-secondary);
}

.leaderboard-bloods {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-rose);
    font-size: 13px;
}

/* ========================================
   Auth Pages
   ======================================== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

.auth-container {
    width: 100%;
    max-width: 440px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 40px;
}

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

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
}

.auth-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
    font-size: 14px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--accent-sage);
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

/* ========================================
   Dashboard
   ======================================== */
.dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 24px;
}

.dashboard-header {
    margin-bottom: 40px;
}

.dashboard-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}

.dashboard-subtitle {
    color: var(--text-secondary);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
}

.stat-card:hover {
    border-color: var(--border-medium);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    font-family: var(--font-mono);
    letter-spacing: -1px;
}

.stat-value.points { color: var(--accent-sand); }
.stat-value.solves { color: var(--accent-sage); }
.stat-value.rank { color: var(--accent-sky); }
.stat-value.bloods { color: var(--accent-rose); }

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.recent-solves {
    list-style: none;
}

.recent-solve {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.recent-solve:last-child {
    border-bottom: none;
}

.recent-solve-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.recent-solve-title {
    font-weight: 500;
    font-size: 14px;
}

.recent-solve-category {
    font-size: 12px;
    color: var(--text-muted);
}

.recent-solve-points {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent-sage);
}

/* ========================================
   Profile
   ======================================== */
.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 40px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-sage);
    color: var(--text-inverse);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 700;
    font-family: var(--font-mono);
    flex-shrink: 0;
}

.profile-info {
    flex: 1;
}

.profile-name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.profile-role {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-role.admin {
    background: var(--accent-sand-glow);
    color: var(--accent-sand);
}

.profile-role.user {
    background: var(--accent-sage-glow);
    color: var(--accent-sage);
}

.profile-stats {
    display: flex;
    gap: 24px;
    margin-top: 16px;
}

.profile-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.profile-stat-value {
    font-size: 20px;
    font-weight: 700;
    font-family: var(--font-mono);
}

.profile-stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

/* ========================================
   Admin Panel
   ======================================== */
.admin-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: calc(100vh - var(--nav-height));
}

.admin-sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    padding: 24px;
}

.admin-nav-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
    padding-left: 12px;
}

.admin-nav-list {
    list-style: none;
}

.admin-nav-item {
    margin-bottom: 2px;
}

.admin-nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.admin-nav-link:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.admin-nav-link.active {
    background: var(--accent-sage-glow);
    color: var(--accent-sage);
}

.admin-content {
    padding: 32px;
    overflow-y: auto;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 32px;
}

.admin-title {
    font-size: 24px;
    font-weight: 700;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 14px 18px;
    text-align: left;
    font-size: 14px;
    border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
    background: var(--bg-secondary);
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table tr:hover td {
    background: var(--bg-secondary);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: rgba(122, 158, 126, 0.1);
    color: var(--accent-sage);
}

.badge-warning {
    background: rgba(196, 169, 107, 0.1);
    color: var(--accent-sand);
}

.badge-danger {
    background: rgba(184, 122, 122, 0.1);
    color: var(--accent-rose);
}

/* ========================================
   Footer
   ======================================== */
.main-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
    padding: 60px 24px 24px;
    margin-top: auto;
}

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

.footer-grid {
    display: grid;
    grid-template-columns: 2fr repeat(3, 1fr);
    gap: 40px;
    margin-bottom: 48px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.footer-logo .brand-icon {
    width: 24px;
    height: 24px;
}

.footer-tagline {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 300px;
}

.footer-section h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 10px;
}

.footer-section a {
    font-size: 14px;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.footer-section a:hover {
    color: var(--text-primary);
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 24px;
    border-top: 1px solid var(--border-subtle);
    font-size: 13px;
    color: var(--text-muted);
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a:hover {
    color: var(--text-secondary);
}

/* ========================================
   Filter Tabs
   ======================================== */
.filter-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    width: fit-content;
}

.filter-tab {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

.filter-tab:hover {
    color: var(--text-primary);
    background: var(--bg-elevated);
}

.filter-tab.active {
    background: var(--bg-elevated);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    text-align: center;
    padding: 80px 24px;
}

.empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    color: var(--text-muted);
}

.empty-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-description {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }
    
    .nav-menu {
        position: absolute;
        top: var(--nav-height);
        left: 0;
        right: 0;
        background: rgba(12, 12, 20, 0.98);
        backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 20px;
        border-bottom: 1px solid var(--border-subtle);
        opacity: 0;
        visibility: hidden;
        transform: translateY(-10px);
        transition: all var(--transition-fast);
    }
    
    .nav-menu.show {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    
    .nav-links {
        flex-direction: column;
        width: 100%;
    }
    
    .nav-link {
        width: 100%;
        padding: 12px 16px;
    }
    
    .nav-auth {
        margin-left: 0;
        padding-left: 0;
        border-left: none;
        border-top: 1px solid var(--border-subtle);
        padding-top: 16px;
        width: 100%;
        justify-content: center;
    }
    
    .hero-container {
        grid-template-columns: 1fr;
    }
    
    .hero-visual {
        order: -1;
    }
    
    .hero-stats {
        gap: 24px;
    }
    
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .footer-brand {
        grid-column: 1 / -1;
    }
    
    .admin-layout {
        grid-template-columns: 1fr;
    }
    
    .admin-sidebar {
        display: none;
    }
    
    .podium {
        flex-direction: column;
        align-items: center;
    }
    
    .podium-item.first {
        order: 1;
    }
    
    .leaderboard-table {
        font-size: 13px;
    }
    
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 12px 14px;
    }
    
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-stats {
        justify-content: center;
    }
    
    .flag-form {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .hero {
        padding: 60px 16px 40px;
    }
    
    .section {
        padding: 60px 16px;
    }
    
    .auth-card {
        padding: 28px 20px;
    }
    
    .challenge-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .footer-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-bottom {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}

/* ========================================
   Utilities
   ======================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--accent-sage); }
.text-warning { color: var(--accent-sand); }
.text-error { color: var(--accent-rose); }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-5 { margin-top: 24px; }
.mt-6 { margin-top: 32px; }

.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 24px; }
.mb-6 { margin-bottom: 32px; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   Light Mode
   ======================================== */

:root[data-theme="light"] {
    --bg-primary: #faf8f5;
    --bg-secondary: #f5f3f0;
    --bg-tertiary: #eeede9;
    --bg-elevated: #e8e6e2;
    --bg-card: #ffffff;
    
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a5e;
    --text-muted: #8a8a9e;
    --text-inverse: #faf8f5;
    
    --border-subtle: #e0ddd8;
    --border-medium: #d0ccc5;
    --border-strong: #b0aaa0;
    
    --accent-sage-glow: rgba(122, 158, 126, 0.12);
    --accent-sand-glow: rgba(196, 169, 107, 0.12);
    
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
}

[data-theme="light"] .main-nav {
    background: rgba(250, 248, 245, 0.9);
    border-bottom-color: var(--border-subtle);
}

[data-theme="light"] body::before {
    opacity: 0.025;
}

[data-theme="light"] .flash-success {
    background: rgba(122, 158, 126, 0.12);
    border-color: rgba(122, 158, 126, 0.25);
}

[data-theme="light"] .flash-error {
    background: rgba(184, 122, 122, 0.12);
    border-color: rgba(184, 122, 122, 0.25);
}

[data-theme="light"] .flash-warning {
    background: rgba(196, 169, 107, 0.12);
    border-color: rgba(196, 169, 107, 0.25);
}

[data-theme="light"] .hero-badge {
    background: rgba(122, 158, 126, 0.15);
    border-color: rgba(122, 158, 126, 0.2);
}

[data-theme="light"] .challenge-card.solved {
    background: rgba(122, 158, 126, 0.05);
}

[data-theme="light"] .podium-item.first {
    background: linear-gradient(180deg, var(--bg-card) 0%, rgba(196, 169, 107, 0.08) 100%);
}

[data-theme="light"] .leaderboard-table tr.current-user {
    background: rgba(122, 158, 126, 0.06);
}

[data-theme="light"] .data-table th {
    background: var(--bg-secondary);
}

[data-theme="light"] .form-input,
[data-theme="light"] .form-select,
[data-theme="light"] .form-textarea {
    background: var(--bg-primary);
}

[data-theme="light"] .flag-input {
    background: var(--bg-primary);
}

[data-theme="light"] .auth-page {
    background: linear-gradient(135deg, #f5f3f0 0%, #faf8f5 100%);
}

[data-theme="light"] .hero-terminal {
    box-shadow: var(--shadow-lg);
}

[data-theme="light"] .category-card::before {
    opacity: 0;
}

[data-theme="light"] .category-card:hover::before {
    opacity: 0.8;
}

[data-theme="light"] .main-footer {
    background: var(--bg-secondary);
}

/* ========================================
   Theme Toggle
   ======================================== */

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: transparent;
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    padding: 0;
}

.theme-toggle:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

.theme-toggle .moon-icon,
[data-theme="light"] .theme-toggle .sun-icon {
    display: none;
}

.theme-toggle .sun-icon,
[data-theme="light"] .theme-toggle .moon-icon {
    display: block;
}

/* Minimal footer for logged-in users */
.main-footer.minimal {
    padding-top: 24px;
}

.main-footer.minimal .footer-bottom {
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}
