@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600&display=swap');
@import 'responsive.css';

/* Loading Screen */
.loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-hero);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader-wrapper.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-logo {
    width: 120px;
    height: 120px;
    animation: logoSpin 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

@keyframes logoSpin {
    0% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(180deg) scale(1.1);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

:root {
    /* Premium Cinematic Palette - Blue, Purple, Pink */
    --primary: #6366f1;
    /* Indigo/Blue */
    --primary-dark: #4f46e5;
    --secondary: #a855f7;
    /* Purple */
    --accent: #ec4899;
    /* Pink */
    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;

    /* Cinematic Dark Theme (Default) */
    --bg-dark: #020617;
    --bg-cosmic: #0f172a;
    --bg-surface: #1e293b;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);

    /* Crystal Glassmorphism */
    --glass: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 10px 50px rgba(0, 0, 0, 0.5);

    /* Deep Space Gradients */
    --gradient-cosmic: linear-gradient(135deg, #020617 0%, #0f172a 100%);
    --gradient-glow: linear-gradient(135deg, #6366f1, #a855f7, #ec4899);
    --gradient-tri-tone: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    --gradient-text: linear-gradient(135deg, #f8fafc 0%, #94a3b8 100%);

    /* Global Glow Values */
    --glow-primary: 0 0 25px rgba(99, 102, 241, 0.5);
    --glow-secondary: 0 0 25px rgba(168, 85, 247, 0.5);
    --glow-accent: 0 0 25px rgba(236, 72, 153, 0.5);
}

[data-theme="dark"],
body {
    background: var(--bg-dark) !important;
    color: var(--text) !important;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.1), transparent),
        radial-gradient(circle at bottom left, rgba(236, 72, 153, 0.08), transparent),
        radial-gradient(circle at center, rgba(168, 85, 247, 0.05), transparent);
    z-index: -2;
    /* Behind the canvas */
    pointer-events: none;
}

/* Global Gradient Typography */
.section-tag {
    display: inline-block;
    padding: 10px 24px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 100px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    margin-bottom: 24px;
    backdrop-filter: blur(15px);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

h1,
h2,
h3 {
    background: var(--gradient-tri-tone);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
    filter: drop-shadow(0 0 30px rgba(99, 102, 241, 0.3));
    font-weight: 900;
}

#brain-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: all;
    /* Enable drag & throw interaction */
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    isolation: isolate;
    /* Creates stacking context for z-index: -1 canvas */
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-20px);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
    }

    50% {
        box-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
    }
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

main {
    flex: 1;
}

/* Navigation */
nav {
    position: fixed;
    /* Fixed nav for better UX */
    top: 0;
    width: 100%;
    z-index: 1000;
    padding: 15px 0;
    background: rgba(2, 6, 23, 0.3);
    backdrop-filter: blur(20px) saturate(200%);
    -webkit-backdrop-filter: blur(20px) saturate(200%);
    border-bottom: 2px solid;
    border-image: var(--gradient-tri-tone) 1;
    transition: all 0.4s ease;
}

nav.scrolled {
    padding: 14px 0;
    background: rgba(2, 6, 23, 0.7);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] nav {
    background: rgba(15, 23, 42, 0.5);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    background: var(--gradient-tri-tone);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
    letter-spacing: -0.02em;
    position: relative;
    transition: all 0.3s ease;
}

.logo::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-tri-tone);
    transition: width 0.3s ease;
}

.logo:hover::after {
    width: 40%;
}

.logo:hover {
    transform: translateY(-1px);
}

.logo img {
    width: 48px !important;
    height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    object-fit: contain;
    transition: transform 0.3s ease;
}

.logo:hover img {
    transform: rotate(180deg) scale(1.1);
}

.nav-links {
    display: flex;
    gap: 32px;
    align-items: center;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    position: relative;
    transition: color 0.3s ease;
}

.nav-links a:hover {
    background: var(--gradient-tri-tone);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transform: translateY(-2px);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
}

/* Hero Section Refined */
.hero {
    position: relative;
    padding: 180px 0 140px;
    text-align: center;
    background: transparent;
    overflow: visible;
}

/* Premium Header for Category Pages */
.premium-header {
    padding: 100px 0 60px;
    text-align: center;
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.1), transparent);
    border-bottom: 1px solid var(--border);
    margin-bottom: 40px;
}

.premium-header h1 {
    font-size: 3.5rem;
    font-weight: 900;
    background: var(--gradient-tri-tone);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 16px;
    filter: drop-shadow(0 2px 15px rgba(0, 0, 0, 0.4));
}

.hero h1 {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 24px;
    background: var(--gradient-tri-tone);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
    animation: fadeInUp 0.8s ease-out;
    display: block !important;
}

.hero p {
    font-size: clamp(1.1rem, 2vw, 1.3rem);
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto 40px;
    line-height: 1.7;
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 36px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.8s ease-out 0.4s both;
    position: relative;
    overflow: hidden;
    user-select: none;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 28px rgba(99, 102, 241, 0.6);
    filter: brightness(110%);
}

.btn-primary:active {
    transform: translateY(-1px) scale(1.02);
    transition: all 0.1s ease;
}

.btn-secondary {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
}

/* Glass Cards */
.glass-card {
    background: var(--glass);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 32px;
    box-shadow: var(--glass-shadow);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    color: var(--text);
    position: relative;
    overflow: hidden;
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.6s ease;
}

.glass-card:hover::before {
    left: 100%;
}

.glass-card h3,
.glass-card h4 {
    color: #0f172a;
}

.glass-card p {
    color: #4a5568;
}

.glass-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
}

/* Glow-Active Logic (THE KEY) */
.glow-active,
.element-active {
    box-shadow: var(--shadow-glow) !important;
    border-color: var(--primary) !important;
    transform: scale(1.05) translateY(-5px);
    z-index: 10;
    transition: all 0.3s ease;
}

.glow-success {
    box-shadow: var(--shadow-success) !important;
    border-color: var(--success) !important;
}

.glow-error {
    box-shadow: var(--shadow-error) !important;
    border-color: var(--error) !important;
}

/* Visualizer Specific Styles */
.gantt-bar-premium {
    border-radius: 8px;
    background: var(--gradient-primary);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.table-premium {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 8px;
}

.table-premium tr {
    background: var(--glass);
    transition: all 0.3s ease;
}

.table-premium td {
    padding: 16px;
    border-top: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
}

.table-premium td:first-child {
    border-left: 1px solid var(--glass-border);
    border-radius: 12px 0 0 12px;
}

.table-premium td:last-child {
    border-right: 1px solid var(--glass-border);
    border-radius: 0 12px 12px 0;
}

/* Category Cards */
.category-card {
    text-align: center;
}

.category-icon {
    font-size: 3.5rem;
    margin-bottom: 20px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    transition: transform 0.3s ease;
}

.glass-card:hover .category-icon {
    transform: scale(1.1);
}

.category-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text);
}

.category-card p {
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.6;
}

/* Grids */
.grid {
    display: grid;
    gap: 28px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.status-pill {
    display: inline-block;
    font-size: 0.75rem;
    padding: 6px 16px;
    border-radius: 100px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
}

.status-pill.status-done {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border-color: rgba(34, 197, 94, 0.2);
}

.status-pill.status-planned {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.2);
}

.category-grid {
    margin-top: 60px;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mb-4 {
    margin-bottom: 1.5rem;
}

.section-tag {
    display: inline-block;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
}

/* Inputs */
input,
select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    background: var(--glass);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Code Cards */
.code-card {
    background: var(--glass);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    margin-top: 30px;
    transition: all 0.3s ease;
    position: relative;
}

.code-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary);
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.02);
    border-bottom: 1px solid var(--border);
}

.code-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.code-tabs {
    display: flex;
    gap: 8px;
}

.code-tab {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.code-tab:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.code-tab.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.code-viewer {
    padding: 24px;
    background: linear-gradient(135deg, #1e1e1e 0%, #252526 100%);
    color: #d4d4d4;
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.7;
    overflow-x: auto;
    position: relative;
}

.code-viewer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.5), transparent);
}

/* Breadcrumbs */
.breadcrumb-container {
    margin-top: 24px;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.breadcrumb-container a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.breadcrumb-container a:hover {
    color: var(--primary-dark);
}

.breadcrumb-container span {
    margin: 0 8px;
    opacity: 0.5;
}

/* Toggles */
.view-controls {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-bottom: 24px;
}

.toggle-btn {
    padding: 10px 16px;
    border-radius: 10px;
    border: 2px solid var(--border);
    background: transparent;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.toggle-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.toggle-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Footer */
footer {
    background: var(--glass);
    backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding: 60px 0 40px;
    margin-top: 100px;
}

/* Global Stat Box for Visualizers */
.stat-box {
    background: rgba(255, 255, 255, 0.03);
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
}

.stat-box:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-2px);
    border-color: var(--primary);
    box-shadow: var(--glow-primary);
}

.stat-box h3 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-box span {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Category Cards Refined */
.category-card {
    text-align: center;
    padding: 64px 40px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.category-card:hover {
    transform: translateY(-12px) scale(1.02);
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--primary);
    box-shadow: 0 20px 80px -20px rgba(0, 0, 0, 0.6), var(--glow-primary);
}

.category-card:hover::before {
    opacity: 1;
}

.category-icon {
    font-size: 5rem;
    margin-bottom: 24px;
    filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.3));
    transition: transform 0.5s ease;
}

.category-card:hover .category-icon {
    transform: scale(1.1) rotate(5deg);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h4 {
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text);
}

.footer-section ul {
    list-style: none;
}

.footer-section li {
    margin-bottom: 12px;
}

.footer-section a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-section a:hover {
    color: var(--primary);
}

.footer-bottom {
    padding-top: 32px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Helper Classes */
.hide {
    display: none !important;
}

.list-view {
    grid-template-columns: 1fr !important;
}

.fade-in {
    animation: fadeInUp 0.6s ease-out;
}

@import 'responsive.css';


.slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

.slide-in-right {
    animation: slideInRight 0.6s ease-out;
}

.scale-in {
    animation: scaleIn 0.4s ease-out;
}

.glow {
    animation: glow 2s ease-in-out infinite;
}

.shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* Utility Classes */
.text-gradient {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.border-gradient {
    border: 2px solid transparent;
    background: linear-gradient(white, white) padding-box, var(--gradient-border) border-box;
}

.shadow-glow {
    box-shadow: var(--shadow-glow);
}

.backdrop-blur {
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
}

/* Enhanced Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 10px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--secondary));
    background-clip: content-box;
}

::-webkit-scrollbar-corner {
    background: transparent;
}

/* Algorithm Layout Styles */
.algo-header {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.05));
    padding: 60px 0 40px;
    text-align: center;
}

.algo-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 16px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.algo-intro {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
}

.algo-content {
    padding: 40px 0 80px;
}

.info-section .glass-card h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.complexity-table {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.complexity-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.complexity-label {
    font-weight: 500;
    color: var(--text-muted);
}

.complexity-value {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.9rem;
}

.visualizer-section,
.log-section {
    margin: 40px 0;
}

.log-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.log-counter {
    font-weight: 600;
    color: var(--text-muted);
}

.log-history {
    max-height: 300px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 8px;
    padding: 16px;
}

.log-entry {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 0.9rem;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-time {
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    min-width: 80px;
}

.log-message {
    color: var(--text);
}

.log-info .log-message {
    color: var(--primary);
}

.log-success .log-message {
    color: var(--success);
}

.log-warning .log-message {
    color: var(--warning);
}

.log-error .log-message {
    color: #ef4444;
}

.algo-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid var(--border);
}

.copy-btn {
    background: var(--success);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: #059669;
    transform: translateY(-1px);
}

/* Dark theme adjustments */
[data-theme="dark"] .log-history {
    background: rgba(255, 255, 255, 0.02);
}

[data-theme="dark"] .log-entry {
    border-bottom-color: rgba(255, 255, 255, 0.05);
}

/* Advanced Micro-interactions */
.interactive-element {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.interactive-element:hover {
    transform: translateY(-2px);
}

.interactive-element:active {
    transform: translateY(0);
    transition: all 0.1s ease;
}

/* Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
    animation: shimmer 2s infinite;
}

/* Focus States */
.btn:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: rgba(99, 102, 241, 0.2);
    color: var(--text);
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Performance Optimizations */
.glass-card,
.btn,
.code-card {
    will-change: transform;
}

/* Responsive */
@media (max-width: 768px) {
    .hero {
        padding: 100px 0 60px;
    }

    .hero h1 {
        font-size: 2.5rem;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .nav-links {
        display: none;
    }

    .category-grid {
        margin-top: 40px;
    }

    .btn {
        padding: 14px 28px;
        font-size: 0.95rem;
    }

    .glass-card {
        padding: 24px;
        border-radius: 20px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .hero {
        padding: 80px 0 40px;
    }

    .glass-card {
        padding: 20px;
    }

    .btn {
        padding: 12px 24px;
        font-size: 0.9rem;
    }
}

/* Dark mode specific */
[data-theme="dark"] .code-header {
    background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] input,
[data-theme="dark"] select {
    background: rgba(15, 23, 42, 0.6);
    border-color: var(--border);
}

[data-theme="dark"] .glass-card {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.8));
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .glass-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-xl), 0 0 30px rgba(99, 102, 241, 0.2);
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --border: #000;
        --text-muted: #333;
    }

    .glass-card {
        border-width: 2px;
    }
}

/* Print Styles */
@media print {

    .hero,
    nav,
    footer {
        display: none;
    }

    .glass-card {
        background: white;
        border: 1px solid #ccc;
        box-shadow: none;
    }
}

/* --- Roadmap & Timeline --- */
.roadmap-timeline {
    position: relative;
    padding: 60px 0;
    margin-top: 40px;
}

.roadmap-timeline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    width: 2px;
    height: 100%;
    background: var(--gradient-tri-tone);
    opacity: 0.3;
    transform: translateX(-50%);
}

.milestone-card {
    position: relative;
    width: 90%;
    /* Much wider for grids */
    margin: 0 auto 80px;
    padding: 45px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    backdrop-filter: blur(25px);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: var(--glass-shadow);
}

.milestone-card:nth-child(even) {
    margin-right: auto;
}

.milestone-card::after {
    content: '';
    position: absolute;
    top: 35px;
    width: 24px;
    height: 24px;
    background: var(--gradient-tri-tone);
    border-radius: 50%;
    box-shadow: var(--glow-primary);
    z-index: 2;
}

.milestone-card:nth-child(odd)::after {
    right: -11.5%;
    transform: translateX(50%);
}

.milestone-card:nth-child(even)::after {
    left: -11.5%;
    transform: translateX(-50%);
}

.milestone-card:hover {
    transform: scale(1.03) translateY(-10px);
    border-color: var(--primary);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), var(--glow-primary);
}

.milestone-icon {
    font-size: 2.5rem;
    margin-bottom: 20px;
    background: var(--gradient-tri-tone);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.progress-banner-premium {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 40px;
    padding: 80px 40px;
    text-align: center;
    margin-bottom: 100px;
    box-shadow: var(--glass-shadow);
    position: relative;
    overflow: hidden;
}

.progress-banner-premium::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1), transparent 70%);
    pointer-events: none;
}

.premium-bar-container {
    background: rgba(255, 255, 255, 0.05);
    height: 18px;
    border-radius: 100px;
    margin: 40px auto;
    max-width: 700px;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.premium-bar-fill {
    background: var(--gradient-tri-tone);
    height: 100%;
    border-radius: 100px;
    width: 0;
    transition: width 2s cubic-bezier(0.65, 0, 0.35, 1);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.6);
}

/* --- Roadmap Inner Grids --- */
.roadmap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.roadmap-skill-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 15px 25px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
}

.roadmap-skill-item:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary);
    transform: translateX(5px);
}

.status-pill {
    font-size: 0.75rem;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 800;
    text-transform: uppercase;
}

.status-done {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.status-wip {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.status-planned {
    background: rgba(148, 163, 184, 0.2);
    color: #94a3b8;
}

.status-soon {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
}

/* Hero Transparency Override */
.hero {
    background: transparent !important;
    z-index: 1;
}

@media (max-width: 768px) {
    .milestone-card {
        width: 100%;
        margin-left: 0 !important;
        margin-bottom: 40px;
    }

    .roadmap-timeline::before {
        left: 0;
    }

    .milestone-card::after {
        display: none;
    }
}