/* =========================================
   CyberNok CTF — Elite Dark UI
   Brand color: #e8460a | Theme: Glassmorphism
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

/* ── Tokens ───────────────────────────────── */
:root {
    scroll-behavior: smooth;
    /* ... existing vars ... */
    --primary: #e8460a;
    --primary-dark: #c23a08;
    --primary-light: #ff5a1f;
    --primary-glow: rgba(232, 70, 10, 0.2);
    --primary-glow-strong: rgba(232, 70, 10, 0.35);

    --bg: #0d0d0f;
    --bg-alt: #141417;
    --bg-card: #1a1a1f;
    --bg-card-hover: #222229;
    --bg-glass: rgba(26, 26, 31, 0.8);

    --text-primary: #f0efed;
    --text-secondary: #9a9aaa;
    --text-muted: #6b7280;
    --text-dim: #a0a0b0;

    --border: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(232, 70, 10, 0.3);

    --red: #ef4444;
    --blue: #3b82f6;
    --purple: #a855f7;
    --green: #22c55e;
    --yellow: #f59e0b;

    --red-bg: rgba(239, 68, 68, 0.1);
    --blue-bg: rgba(59, 130, 246, 0.1);
    --purple-bg: rgba(168, 85, 247, 0.1);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --font: 'Inter', sans-serif;
    --mono: 'JetBrains Mono', monospace;
}

/* ── Reset ────────────────────────────────── */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    cursor: none;
    /* subtle grid bg */
    background-image:
        linear-gradient(rgba(232, 70, 10, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(232, 70, 10, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
}

/* --- Custom Cyber Cursor --- */
#cursor-dot {
    position: fixed;
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    transform: translate(-50%, -50%);
    transition: transform 0.1s ease, width 0.2s ease, height 0.2s ease;
    box-shadow: 0 0 8px var(--primary);
}

#cursor-ring {
    position: fixed;
    width: 32px;
    height: 32px;
    border: 1.5px solid var(--primary);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99998;
    transform: translate(-50%, -50%);
    transition: transform 0.12s ease, width 0.2s ease, height 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
    opacity: 0.6;
}

body.cursor-hover #cursor-dot {
    width: 12px;
    height: 12px;
    box-shadow: 0 0 16px var(--primary), 0 0 32px var(--primary-glow);
}

body.cursor-hover #cursor-ring {
    width: 44px;
    height: 44px;
    opacity: 1;
    box-shadow: 0 0 12px var(--primary-glow);
}

body.cursor-click #cursor-dot {
    transform: translate(-50%, -50%) scale(1.8);
    box-shadow: 0 0 20px var(--primary), 0 0 40px var(--primary-glow);
}

body.cursor-click #cursor-ring {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0.3;
}

/* ── Custom Scrollbar ─────────────────────── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #0d0f14;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

/* ── Typography ───────────────────────────── */
h1,
h2,
h3,
h4 {
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2.25rem);
}

h3 {
    font-size: 1.25rem;
}

p {
    color: var(--text-dim);
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: opacity var(--transition);
}

a:hover {
    opacity: 0.8;
}

code,
pre {
    font-family: var(--mono);
}

/* ── Layout ───────────────────────────────── */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.main-content {
    padding-top: 80px;
    padding-bottom: 60px;
    min-height: calc(100vh - 140px);
}

/* ── Navbar ───────────────────────────────── */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(10, 12, 15, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    height: 64px;
}

.nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text);
}

.nav-logo img {
    height: 32px;
    width: auto;
}

.nav-logo span {
    background: linear-gradient(135deg, #e8460a, #ff6b35);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-links a {
    color: var(--text-dim);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
}

.nav-links a:hover {
    color: var(--text);
    background: var(--bg-card);
}

.nav-links a.active {
    color: var(--primary);
}

/* ── Buttons ──────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: none;
    border: none;
    transition: all var(--transition);
    text-decoration: none;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 20px var(--primary-glow);
}

.btn-primary:hover {
    background: #ff5519;
    box-shadow: 0 0 30px rgba(232, 70, 10, 0.5);
    transform: translateY(-1px);
    opacity: 1;
    color: white;
}

.btn-ghost {
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-ghost:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
    color: var(--text);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.82rem;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    color: var(--red);
}

/* ── Glass Card ───────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    backdrop-filter: blur(10px);
    transition: all var(--transition);
}

.card:hover {
    border-color: var(--border-glow);
    background: var(--bg-card-hover);
}

.card-glow {
    box-shadow: 0 0 0 1px var(--primary-glow), 0 8px 32px rgba(232, 70, 10, 0.1);
}

/* ── Badges ───────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.badge-red {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-blue {
    background: var(--blue-bg);
    color: var(--blue);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-purple {
    background: var(--purple-bg);
    color: var(--purple);
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge-green {
    background: rgba(34, 197, 94, 0.12);
    color: var(--beginner);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge-yellow {
    background: rgba(245, 158, 11, 0.12);
    color: var(--intermediate);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-orange {
    background: rgba(239, 68, 68, 0.12);
    color: var(--advanced);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-elite {
    background: rgba(168, 85, 247, 0.12);
    color: var(--elite);
    border: 1px solid rgba(168, 85, 247, 0.4);
}

.badge-solved {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.badge-ghost {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-dim);
    border: 1px solid var(--border);
}

/* ── Challenge Grid ───────────────────────── */
.challenge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 20px;
}

.challenge-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.challenge-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.challenge-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-glow);
    background: var(--bg-card-hover);
    box-shadow: 0 8px 32px rgba(232, 70, 10, 0.1);
}

.challenge-card:hover::before {
    opacity: 1;
}

.challenge-card.solved {
    border-color: rgba(34, 197, 94, 0.3);
}

.challenge-card.solved::before {
    background: linear-gradient(90deg, transparent, #22c55e, transparent);
    opacity: 1;
}

.challenge-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.challenge-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.4;
}

.challenge-card-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.challenge-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.challenge-points {
    font-family: var(--mono);
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
}

.challenge-stats {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.challenge-stats span {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Like button */
.like-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 4px 12px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all var(--transition);
}

.like-btn:hover,
.like-btn.liked {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-dim);
}

.like-btn.liked {
    background: var(--primary-dim);
}

/* ── Top Filter Bar ───────────────────────── */
.challenges-container {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.top-filter-bar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-md);
}

.filter-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    flex-grow: 1;
}

.filter-select {
    background: var(--bg-alt);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    outline: none;
    cursor: pointer;
    transition: all var(--transition);
}

.filter-select:hover {
    border-color: var(--primary-glow);
    background: var(--bg-card-hover);
}

.filter-select:focus {
    border-color: var(--primary);
}

.search-box {
    position: relative;
    max-width: 300px;
    width: 100%;
}

.search-box .search-input {
    padding-left: 40px;
}

.search-box::before {
    content: '🔍';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    opacity: 0.5;
}

/* ── Premium Challenge Cards ──────────────── */
.challenge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

.premium-card {
    background: linear-gradient(145deg, var(--bg-card), var(--bg-alt));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.premium-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(600px circle at var(--mouse-x) var(--mouse-y), rgba(232, 70, 10, 0.06), transparent 40%);
    pointer-events: none;
}

.premium-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--primary-glow-strong);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 20px var(--primary-glow);
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.card-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 8px;
    line-height: 1.3;
}

.card-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.card-stats {
    display: flex;
    gap: 16px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.solve-count,
.points-display {
    display: flex;
    align-items: center;
    gap: 5px;
}

.points-display {
    color: var(--primary);
    font-weight: 700;
    font-family: var(--mono);
}

.card-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.btn-start {
    flex-grow: 1;
    justify-content: center;
}

.btn-like {
    width: 42px;
    padding: 0;
    justify-content: center;
}

/* ── Forms ────────────────────────────────── */
.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.form-control {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 11px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: var(--font);
    outline: none;
    transition: all var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-dim);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control option {
    background: #1a1d23;
}

/* --- Enhanced Forms & Registration --- */
.register-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 640px) {
    .register-grid {
        grid-template-columns: 1fr;
    }
}

.input-icon-wrap {
    position: relative;
}

.input-icon-wrap i,
.input-icon-wrap .icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 1.1rem;
    pointer-events: none;
}

.input-icon-wrap .form-control {
    padding-left: 42px;
}

/* Phone Input Styles */
.phone-input-group {
    display: flex;
    gap: 8px;
}

.country-select {
    width: 100px;
    flex-shrink: 0;
}

/* Real-time Validation Hint */
.form-hint {
    font-size: 0.75rem;
    margin-top: 4px;
    color: var(--text-muted);
}

.form-group.error .form-control {
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-group.error .form-hint {
    color: var(--red);
}

.form-group.success .form-control {
    border-color: var(--green);
}

/* ── Alerts ───────────────────────────────── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    border: 1px solid transparent;
    margin-bottom: 20px;
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--red);
}

.alert-info {
    background: var(--primary-dim);
    border-color: var(--border-glow);
    color: var(--primary);
}

/* ── Hero Section ─────────────────────────── */
.hero {
    text-align: center;
    padding: 80px 0 60px;
    position: relative;
}

.hero-eyebrow {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 16px;
    display: block;
}

.hero h1 {
    margin-bottom: 20px;
}

.hero h1 span {
    background: linear-gradient(135deg, #e8460a, #ff6b35, #ff9a56);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.1rem;
    max-width: 560px;
    margin: 0 auto 36px;
}

.hero-cta {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Stats bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-top: 60px;
}

.stat-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    font-family: var(--mono);
    color: var(--primary);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

/* ── Progress Bar ─────────────────────────── */
.progress-wrap {
    background: rgba(255, 255, 255, 0.06);
    border-radius: 999px;
    height: 8px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #ff6b35);
    border-radius: 999px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Category Progress */
.category-progress-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.category-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.category-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Activity Heatmap */
.heatmap-container {
    padding: 20px;
    background: var(--bg-alt);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow-x: auto;
}

.heatmap-grid {
    display: grid;
    grid-auto-flow: column;
    grid-template-rows: repeat(7, 12px);
    grid-auto-columns: 12px;
    gap: 3px;
}

.heatmap-day {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    background: #1a1a1f;
}

.heatmap-day.level-1 {
    background: #4d1804;
}

.heatmap-day.level-2 {
    background: #912d06;
}

.heatmap-day.level-3 {
    background: #c23a08;
}

.heatmap-day.level-4 {
    background: #e8460a;
}

/* Achievement Card for Sharing */
.achievement-share-card {
    background: linear-gradient(135deg, #1a1a1f 0%, #0d0d0f 100%);
    border: 2px solid var(--primary);
    padding: 32px;
    border-radius: var(--radius-lg);
    text-align: center;
    position: relative;
    box-shadow: 0 0 40px rgba(232, 70, 10, 0.2);
}

.share-badge-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

/* ── Learning Paths ───────────────────────── */
.path-card {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.path-card-icon {
    font-size: 2rem;
}

.path-card-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.path-card-meta {
    display: flex;
    gap: 16px;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ── Leaderboard ─────────────────────────── */
.leaderboard-table th {
    text-align: left;
    padding: 14px 20px;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.leaderboard-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.rank-1 {
    background: rgba(232, 70, 10, 0.06);
}

.rank-2 {
    background: rgba(232, 70, 10, 0.04);
}

.rank-3 {
    background: rgba(232, 70, 10, 0.02);
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-weight: 800;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 32px 0 20px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-dim);
    border: 2px solid var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.profile-name {
    font-size: 1.6rem;
    font-weight: 800;
}

.profile-stats {
    display: flex;
    gap: 24px;
    margin-top: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ── Achievement Cards ────────────────────── */
.achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.achievement-card {
    text-align: center;
    padding: 28px 20px;
}

.achievement-card.locked {
    opacity: 0.35;
    filter: grayscale(1);
}

.achievement-icon {
    font-size: 2.8rem;
    margin-bottom: 12px;
}

.achievement-name {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.achievement-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.achievement-share-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 14px;
}

/* ── Leaderboard ──────────────────────────── */
.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table th {
    padding: 10px 16px;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.leaderboard-table td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.9rem;
    vertical-align: middle;
}

.leaderboard-table tr:hover td {
    background: var(--bg-card-hover);
}

.rank-1 td:first-child {
    color: #fbbf24;
    font-weight: 800;
}

.rank-2 td:first-child {
    color: #9ca3af;
    font-weight: 800;
}

.rank-3 td:first-child {
    color: #b45309;
    font-weight: 800;
}

.rank-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-family: var(--mono);
    font-weight: 700;
    font-size: 0.85rem;
}

/* ── Footer ───────────────────────────────── */
footer {
    border-top: 1px solid var(--border);
    padding: 28px 0;
    text-align: center;
    font-size: 0.82rem;
    color: var(--text-muted);
}

/* ── Auth Pages ───────────────────────────── */
.auth-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-header h2 {
    margin-bottom: 8px;
}

/* ── Challenge Detail Page ────────────────── */
.challenge-detail-grid {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 28px;
    align-items: start;
}

.scenario-box {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 18px;
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-dim);
    margin: 16px 0;
}

.tools-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.tool-tag {
    background: var(--primary-dim);
    border: 1px solid var(--border-glow);
    color: var(--primary);
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-family: var(--mono);
}

.hint-box {
    background: rgba(245, 158, 11, 0.06);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-sm);
    padding: 14px;
    font-size: 0.88rem;
    color: #f59e0b;
    margin-top: 12px;
}

/* ── Page sections ────────────────────────── */
.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    margin-bottom: 8px;
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* ── Grid utilities ───────────────────────── */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

.mt-8 {
    margin-top: 8px;
}

.mt-16 {
    margin-top: 16px;
}

.mt-24 {
    margin-top: 24px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-24 {
    margin-bottom: 24px;
}

.text-center {
    text-align: center;
}

.text-mono {
    font-family: var(--mono);
}

.text-primary {
    color: var(--primary);
}

.text-muted {
    color: var(--text-muted);
}

.w-full {
    width: 100%;
}

/* ── Shimmer / Loading ────────────────────── */
@keyframes shimmer {
    0% {
        background-position: -400px 0
    }

    100% {
        background-position: 400px 0
    }
}

.shimmer {
    background: linear-gradient(90deg, var(--bg-card) 25%, rgba(255, 255, 255, 0.06) 50%, var(--bg-card) 75%);
    background-size: 400px 100%;
    animation: shimmer 1.4s infinite;
    border-radius: var(--radius);
}

.shimmer-card {
    height: 200px;
}

/* ── Glow ring pulse ──────────────────────── */
@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 0 0 var(--primary-glow)
    }

    50% {
        box-shadow: 0 0 0 8px transparent
    }
}

.pulse {
    animation: pulse-glow 2s infinite;
}

/* ── Responsive ───────────────────────────── */
@media (max-width: 900px) {
    .challenges-layout {
        grid-template-columns: 1fr;
    }

    .filters-panel {
        position: static;
    }

    .challenge-detail-grid {
        grid-template-columns: 1fr;
    }

    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }

    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .nav-links a:not(.btn-primary) {
        display: none;
    }

    .stats-bar {
        grid-template-columns: 1fr 1fr;
    }

    .challenge-grid {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2rem;
    }
}

/* ── Profile & Avatar Enhancements ────────── */
.profile-avatar-container {
    position: relative;
    width: 120px;
    height: 120px;
}

.profile-avatar-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    box-shadow: 0 0 20px rgba(255, 71, 0, 0.2);
}

.profile-avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #ff8700);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    font-weight: 700;
    color: white;
}

.avatar-edit-btn {
    position: absolute;
    bottom: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.avatar-edit-btn:hover {
    background: var(--primary);
    transform: scale(1.1);
}

.avatar-sm {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.avatar-sm-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
}

/* ── Leaderboard Table Avatars ────────────── */
.player-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.table-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.table-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.table-avatar-placeholder {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
}

.player-name {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.player-name:hover {
    color: var(--primary);
}

.flex-align {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ── Live Search Suggestions ──────────────── */
.search-container {
    position: relative;
    width: 100%;
}

.suggestions-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1a1f;
    border: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    z-index: 1000;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    backdrop-filter: blur(10px);
}

.suggestion-item {
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: rgba(255, 71, 0, 0.1);
    padding-left: 20px;
}

.suggestion-title {
    font-weight: 600;
    color: var(--text-main);
}

.suggestion-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.solved-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.nav-profile-link {
    display: flex;
    align-items: center;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 30px;
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-primary) !important;
}

.nav-profile-link:hover {
    background: rgba(232, 70, 10, 0.1);
    border-color: var(--primary);
}

.avatar-xs {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--primary);
}

.avatar-xs-placeholder {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 800;
}

.ml-8 {
    margin-left: 8px;
}

.btn-xs {
    padding: 4px 8px;
    font-size: 0.75rem;
}

/* ── Profile Avatar Actions ───────────────── */
.avatar-actions {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 5;
}

.avatar-edit-btn,
.avatar-remove-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    text-decoration: none;
}

.avatar-edit-btn {
    background: var(--bg-card);
    color: var(--primary);
}

.avatar-edit-btn:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 15px var(--primary-glow);
}

.avatar-remove-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.avatar-remove-btn:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

/* ── Ecosystem Highlight Section ──────────────── */
.ecosystem-highlight {
    margin-top: 32px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    animation: fadeInUp 0.8s ease-out 0.4s both;
}

.highlight-badge {
    background: var(--primary-glow);
    border: 1.5px solid var(--primary);
    padding: 12px 28px;
    border-radius: var(--radius-xl);
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 0 30px var(--primary-glow);
    transition: transform var(--transition);
}

.highlight-badge:hover {
    transform: scale(1.02);
}

.highlight-count {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    font-family: var(--mono);
}

.highlight-text {
    text-align: left;
}

.highlight-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.highlight-subtitle {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-top: 2px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ═══════════════════════════════════════════════
   CYBERNOK UPGRADE — Fonts, Animations & Design
   ═══════════════════════════════════════════════ */

/* ── Font Variables (Orbitron + Rajdhani) ─── */
:root {
    --font-display: 'Orbitron', 'Inter', sans-serif;
    --font-sub: 'Rajdhani', 'Inter', sans-serif;
}

/* ── Apply Display Fonts ─────────────────── */
h1,
.hero h1,
.page-header h1,
.auth-header h2 {
    font-family: var(--font-display);
    letter-spacing: -0.01em;
}

h2 {
    font-family: var(--font-sub);
    font-weight: 700;
    letter-spacing: 0.01em;
}

h3 {
    font-family: var(--font-sub);
    font-weight: 700;
}

.nav-logo span {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, #e8460a, #ff6b35);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-number {
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--primary);
    text-shadow: 0 0 16px rgba(232, 70, 10, 0.4);
}

.section-title {
    font-family: var(--font-sub);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--primary);
    margin-bottom: 16px;
}

.badge {
    font-family: var(--font-sub);
    font-weight: 600;
}

/* ── Hero Canvas Overlay ─────────────────── */
#cyber-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
}

.hero {
    position: relative;
    overflow: hidden;
    padding: 100px 0 80px;
}

.hero>*:not(#cyber-canvas) {
    position: relative;
    z-index: 1;
}

/* ── Terminal Typing Text ────────────────── */
#cyber-typing {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--primary);
    letter-spacing: 0.12em;
    opacity: 0.85;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 22px;
    text-transform: uppercase;
}

#cyber-typing::after {
    content: '█';
    animation: terminalBlink 0.8s step-end infinite;
}

/* ── Cyber Shield Visual ─────────────────── */
.hero-shield-wrap {
    margin: 0 auto 32px;
    display: flex;
    justify-content: center;
}

.cyber-shield-svg {
    width: 120px;
    height: 120px;
    filter: drop-shadow(0 0 20px rgba(232, 70, 10, 0.5));
    animation: floatY 4s ease-in-out infinite;
}

.cyber-shield-svg .shield-ring {
    animation: orbitPulse 3s linear infinite;
    transform-origin: 60px 60px;
}

/* ── Leaderboard Top-3 Glow ──────────────── */
.rank-1 {
    background: rgba(232, 70, 10, 0.08) !important;
    animation: rankGlow 2.5s ease-in-out infinite;
}

.rank-2 {
    background: rgba(156, 163, 175, 0.06) !important;
}

.rank-3 {
    background: rgba(180, 83, 9, 0.04) !important;
}

.rank-1 .rank-badge {
    animation: trophyPulse 1.5s ease-in-out infinite;
    display: inline-block;
}

/* ── Animated Progress Bars ──────────────── */
.progress-bar {
    width: 0;
    transition: none;
}

.progress-bar.animated {
    animation: progressFill 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ── Scroll Reveal ───────────────────────── */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.revealed {
    opacity: 1;
    transform: translateY(0);
}

.reveal-delay-1 {
    transition-delay: 0.1s;
}

.reveal-delay-2 {
    transition-delay: 0.2s;
}

.reveal-delay-3 {
    transition-delay: 0.3s;
}

/* ── Flag Submission Feedback ────────────── */
.flag-success-glow {
    animation: flagSuccess 0.6s ease-out forwards;
    border-color: #22c55e !important;
}

.flag-error-pulse {
    animation: flagError 0.6s ease-out;
    border-color: var(--red) !important;
}

/* ── Footer Upgrade ──────────────────────── */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 36px 0 28px;
    margin-top: 60px;
    background: linear-gradient(180deg, transparent, rgba(232, 70, 10, 0.02));
    position: relative;
}

.site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
}

.footer-inner {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 4px;
}

.footer-name {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    background: linear-gradient(135deg, #e8460a, #ff6b35);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.footer-tagline {
    font-family: var(--font-sub);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
}

.footer-copy {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ── Avatar Upload Button ────────────────── */
.avatar-edit-btn {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    border-radius: var(--radius-md);
    padding: 8px 16px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 0 16px var(--primary-glow);
}

.avatar-edit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 24px rgba(232, 70, 10, 0.5);
}

.avatar-edit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ── Counter Animation ───────────────────── */
.counter-anim {
    display: inline-block;
}

/* ── Nav Active Link ─────────────────────── */
.nav-links a.active {
    color: var(--primary);
    background: rgba(232, 70, 10, 0.08);
    border-radius: var(--radius-sm);
}

/* ── Card Hover Enhancement ──────────────── */
.card {
    border-radius: var(--radius-lg);
}

.card:hover {
    box-shadow: 0 4px 24px rgba(232, 70, 10, 0.08);
}

/* ═══════════════════════════════════════════
   KEYFRAME ANIMATIONS
   ═══════════════════════════════════════════ */

@keyframes terminalBlink {
    50% {
        opacity: 0;
    }
}

@keyframes cyberGlow {

    0%,
    100% {
        box-shadow: 0 0 8px rgba(232, 70, 10, 0.3);
    }

    50% {
        box-shadow: 0 0 24px rgba(232, 70, 10, 0.7), 0 0 48px rgba(232, 70, 10, 0.3);
    }
}

@keyframes rankGlow {

    0%,
    100% {
        box-shadow: inset 0 0 0 0 transparent;
    }

    50% {
        box-shadow: inset 0 0 20px rgba(232, 70, 10, 0.1);
    }
}

@keyframes trophyPulse {

    0%,
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 4px rgba(251, 191, 36, 0.5));
    }

    50% {
        transform: scale(1.15);
        filter: drop-shadow(0 0 12px rgba(251, 191, 36, 0.9));
    }
}

@keyframes progressFill {
    from {
        width: 0;
    }

    to {
        width: var(--target-width, 100%);
    }
}

@keyframes revealUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes flagSuccess {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
    }

    50% {
        box-shadow: 0 0 0 16px rgba(34, 197, 94, 0.2);
        background: rgba(34, 197, 94, 0.05);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

@keyframes flagError {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-8px);
        box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.3);
    }

    40% {
        transform: translateX(8px);
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.15);
    }

    60% {
        transform: translateX(-6px);
    }

    80% {
        transform: translateX(6px);
    }
}

@keyframes floatY {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-12px);
    }
}

@keyframes orbitPulse {
    0% {
        transform: rotate(0deg);
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        transform: rotate(360deg);
        opacity: 1;
    }
}

@keyframes scanLine {
    0% {
        top: 0;
        opacity: 0.6;
    }

    100% {
        top: 100%;
        opacity: 0;
    }
}

@keyframes counterUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}