/* ============================================================
   CodeNest Studios — Shared Design System v2
   Premium Glassmorphism Dark UI for all websites
   ============================================================ */

/* ─── Google Fonts ─── */

/* ─── Reset ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { 
    scroll-behavior: smooth;
    --font-scale: 1;
    font-size: calc(clamp(16px, 1.2vw + 14px, 20px) * var(--font-scale));
}

/* ─── CSS Custom Properties ─── */
:root {
    --primary:          #8b5cf6;
    --accent:           #f43f5e;
    --primary-dim:      rgba(139, 92, 246, 0.15);
    --accent-dim:       rgba(244, 63, 94, 0.12);
    --bg-dark:          #050b18;
    --bg-card:          rgba(255, 255, 255, 0.028);
    --bg-card-hover:    rgba(255, 255, 255, 0.055);
    --bg-glass:         rgba(15, 23, 42, 0.7);
    --border-subtle:    rgba(255, 255, 255, 0.065);
    --border-glow:      rgba(139, 92, 246, 0.45);
    --text-light:       #f8fafc;
    --text-muted:       #cbd5e1;
    --text-dim:         #64748b;
    --gradient-primary: linear-gradient(135deg, #8b5cf6 0%, #ec4899 50%, #f43f5e 100%);
    --gradient-dark:    linear-gradient(135deg, #0f172a 0%, #050b18 100%);
    --shadow-sm:        0 2px 8px rgba(0,0,0,0.2);
    --shadow-card:      0 8px 32px rgba(0,0,0,0.3), inset 0 1px 1px rgba(255, 255, 255, 0.08);
    --shadow-hover:     0 20px 40px rgba(139, 92, 246, 0.25), inset 0 1px 1px rgba(255, 255, 255, 0.15), 0 0 0 1px var(--border-glow);
    --shadow-btn:       0 8px 24px rgba(139,92,246,0.35), inset 0 1px 1px rgba(255, 255, 255, 0.2);
    --radius-sm:        10px;
    --radius-card:      20px;
    --radius-lg:        28px;
    --radius-btn:       50px;
    --radius-icon:      16px;
    --transition:       all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    --transition-fast:  all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
    --transition-slow:  all 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* ─── Base ─── */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    line-height: 1.65;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Animated background gradient & Noise */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% -10%, rgba(139,92,246,0.12) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 110%, rgba(244,63,94,0.1) 0%, transparent 55%),
        radial-gradient(ellipse 70% 60% at 50% 50%, rgba(6,182,212,0.05) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.02'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 0;
}

body > * { position: relative; z-index: 1; }

a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; }

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.3); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(139,92,246,0.55); }

/* ─── Selection ─── */
::selection { background: rgba(139,92,246,0.35); color: #fff; }

/* ─── Navbar ─── */
.navbar {
    padding: 0 2rem;
    height: 64px;
    background: rgba(5, 11, 24, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    position: sticky;
    top: 0;
    z-index: 200;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

/* Navbar gradient line accent */
.navbar::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0.35;
}

.navbar-brand {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #fff;
    letter-spacing: -0.03em;
    flex-shrink: 0;
}

.navbar-brand .brand-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--gradient-primary);
    box-shadow: 0 0 12px var(--primary);
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    gap: 0.25rem;
    font-weight: 500;
    font-size: 0.88rem;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--text-muted);
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    transition: var(--transition-fast);
    white-space: nowrap;
}
.nav-links a:hover {
    color: #fff;
    background: rgba(255,255,255,0.06);
}
.nav-links a.active {
    color: var(--primary);
    background: var(--primary-dim);
}

/* ─── Hero ─── */
.hero {
    position: relative;
    padding: 6rem 1.5rem 4rem;
    text-align: center;
    overflow: hidden;
}

/* Animated orbs */
.hero::before {
    content: '';
    position: absolute;
    top: -30%; left: -10%;
    width: 60%; height: 130%;
    background: var(--primary);
    filter: blur(150px);
    opacity: 0.15;
    z-index: 0;
    border-radius: 50%;
    animation: floatOrb 12s ease-in-out infinite alternate;
}
.hero::after {
    content: '';
    position: absolute;
    top: 0%; right: -10%;
    width: 50%; height: 110%;
    background: var(--accent);
    filter: blur(150px);
    opacity: 0.12;
    z-index: 0;
    border-radius: 50%;
    animation: floatOrb 15s ease-in-out infinite alternate-reverse;
}

@keyframes floatOrb {
    0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
    100% { transform: translate(5%, 8%) scale(1.15) rotate(5deg); }
}

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

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--primary-dim);
    border: 1px solid rgba(139,92,246,0.25);
    color: #a78bfa;
    padding: 0.45rem 1.1rem;
    border-radius: 99px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    margin-bottom: 1.8rem;
    text-transform: uppercase;
}

.hero h1 {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(2.2rem, 5.5vw, 4.5rem);
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -0.04em;
    margin-bottom: 1.2rem;
    background: linear-gradient(135deg, #ffffff 10%, #f8fafc 40%, #c4b5fd 90%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 30px rgba(139,92,246,0.15);
}

.hero p {
    font-size: clamp(1rem, 2vw, 1.15rem);
    color: var(--text-muted);
    max-width: 100%;
    margin: 0 auto 2.8rem;
    line-height: 1.7;
    font-weight: 400;
}

/* ─── Buttons ─── */
.cta-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-main {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gradient-primary);
    background-size: 200% 200%;
    color: #fff;
    padding: 0.9rem 2.2rem;
    border-radius: var(--radius-btn);
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.97rem;
    letter-spacing: 0.01em;
    box-shadow: var(--shadow-btn);
    transition: var(--transition);
    border: none;
    position: relative;
    overflow: hidden;
    animation: gradientShift 6s ease infinite;
}
@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}
.btn-main::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 50%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transform: skewX(-20deg);
    animation: shimmer 3s infinite;
}
@keyframes shimmer {
    100% { left: 200%; }
}
.btn-main:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 40px rgba(139,92,246,0.6);
}
.btn-main:active { transform: translateY(-1px); }

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text-light);
    padding: 0.9rem 2.2rem;
    border-radius: var(--radius-btn);
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.97rem;
    transition: var(--transition);
    cursor: pointer;
}
.btn-secondary:hover {
    background: rgba(255,255,255,0.09);
    border-color: rgba(139,92,246,0.5);
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.3);
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-subtle);
    color: var(--text-light);
    padding: 0.7rem 1.6rem;
    border-radius: var(--radius-btn);
    font-weight: 600;
    font-size: 0.88rem;
    transition: var(--transition);
    cursor: pointer;
}
.btn-outline:hover {
    border-color: rgba(139,92,246,0.45);
    background: var(--primary-dim);
    transform: translateY(-2px);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-btn);
    transition: var(--transition-fast);
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border-subtle);
    font-size: 0.88rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}
.btn-back:hover {
    color: #fff;
    background: rgba(255,255,255,0.07);
    transform: translateY(-2px);
    border-color: rgba(139,92,246,0.35);
}

/* ─── Section Layout ─── */
.section-container {
    max-width: 100%;
    margin: 0 auto;
    padding: 4rem 1.5rem;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-label {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--primary);
    margin-bottom: 0.8rem;
    padding: 0.3rem 0.9rem;
    background: var(--primary-dim);
    border-radius: 99px;
    border: 1px solid rgba(139,92,246,0.2);
}

.section-title {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 0.6rem;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 100%;
    margin: 0 auto;
    line-height: 1.65;
}

/* Section divider */
.section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(139,92,246,0.2), transparent);
    margin: 0 2rem;
}

/* ─── Stats Cards ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1.2rem;
    max-width: 100%;
    margin: 0 auto;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    padding: 1.6rem 1.4rem;
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s;
}
.stat-card:hover {
    border-color: rgba(139,92,246,0.25);
    transform: translateY(-5px);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-card);
}
.stat-card:hover::before { opacity: 1; }

.stat-val {
    font-family: 'Outfit', sans-serif;
    font-size: 2.4rem;
    font-weight: 900;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.3rem;
    line-height: 1;
    letter-spacing: -0.02em;
}
.stat-lbl {
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* ─── Feature Cards Grid ─── */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.4rem;
}

.feature-card {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-subtle);
    padding: 1.8rem;
    border-radius: var(--radius-card);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    cursor: pointer;
    color: inherit;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.03);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    animation: cardEntrance 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

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

/* Add stagger delay dynamically based on nth-child */
.cards-grid > :nth-child(1) { animation-delay: 0.05s; }
.cards-grid > :nth-child(2) { animation-delay: 0.1s; }
.cards-grid > :nth-child(3) { animation-delay: 0.15s; }
.cards-grid > :nth-child(4) { animation-delay: 0.2s; }
.cards-grid > :nth-child(5) { animation-delay: 0.25s; }
.cards-grid > :nth-child(6) { animation-delay: 0.3s; }
.cards-grid > :nth-child(7) { animation-delay: 0.35s; }
.cards-grid > :nth-child(8) { animation-delay: 0.4s; }
.cards-grid > :nth-child(9) { animation-delay: 0.45s; }
.cards-grid > :nth-child(10) { animation-delay: 0.5s; }

/* Card shimmer on hover */
.feature-card::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 60%; height: 100%;
    background: linear-gradient(105deg, transparent, rgba(255,255,255,0.035), transparent);
    transition: left 0.5s ease;
}
.feature-card:hover::before { left: 150%; }

/* Card top border accent */
.feature-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.4s;
    border-radius: var(--radius-card) var(--radius-card) 0 0;
    box-shadow: 0 2px 10px rgba(139,92,246,0.5);
}
.feature-card:hover::after { opacity: 1; }

.feature-card:hover {
    transform: translateY(-7px);
    border-color: rgba(139,92,246,0.3);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-hover);
}

.card-icon {
    font-size: 2rem;
    background: linear-gradient(135deg, rgba(139,92,246,0.12), rgba(244,63,94,0.08));
    border: 1px solid rgba(139,92,246,0.12);
    width: 58px; height: 58px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-icon);
    flex-shrink: 0;
    transition: var(--transition);
}
.feature-card:hover .card-icon {
    background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(244,63,94,0.12));
    border-color: rgba(139,92,246,0.25);
    transform: scale(1.05);
}

.card-title {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1.05rem, 2vw + 0.5rem, 1.25rem);
    font-weight: 700;
    margin: 0.3rem 0;
    color: #fff;
    letter-spacing: -0.01em;
}

.card-desc {
    color: var(--text-muted);
    font-size: clamp(0.85rem, 1vw + 0.5rem, 0.95rem);
    line-height: 1.6;
    flex-grow: 1;
}

.card-action {
    margin-top: 0.4rem;
    color: var(--primary);
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    transition: var(--transition-fast);
}
.feature-card:hover .card-action {
    gap: 0.65rem;
    color: #a78bfa;
}

/* Card meta tags */
.card-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.card-tag {
    font-size: 0.73rem;
    font-weight: 600;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

/* ─── Banner Card ─── */
.banner-card {
    background:
        linear-gradient(135deg, rgba(139,92,246,0.08) 0%, rgba(244,63,94,0.06) 100%),
        var(--bg-card);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: var(--radius-lg);
    padding: 3.5rem 2.5rem;
    text-align: center;
    margin: 1.5rem 0;
    display: block;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.banner-card::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: calc(var(--radius-lg) + 2px);
    background: var(--gradient-primary);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s;
}
.banner-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}
.banner-card:hover::before { opacity: 0.15; }

.banner-card h3 {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1.6rem, 3vw, 2.1rem);
    font-weight: 800;
    margin-bottom: 0.9rem;
    color: #fff;
    letter-spacing: -0.04em;
}
.banner-card p {
    color: var(--text-muted);
    max-width: 100%;
    margin: 0 auto 2rem;
    font-size: clamp(0.95rem, 1.5vw + 0.5rem, 1.1rem);
    line-height: 1.65;
}

/* Streak badge inside banner */
.streak-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, rgba(251,146,60,0.15), rgba(239,68,68,0.1));
    border: 1px solid rgba(251,146,60,0.25);
    color: #fb923c;
    padding: 0.35rem 1rem;
    border-radius: 99px;
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ─── Notes Body ─── */
.notes-body {
    background: linear-gradient(145deg, rgba(15,23,42,0.9), rgba(17,24,39,0.95));
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: var(--radius-card);
    padding: clamp(1rem, 3vw, 2.5rem);
    color: #d4dce9;
    font-family: 'Noto Sans Devanagari', 'Inter', sans-serif;
    font-size: clamp(1.15rem, 2vw + 0.5rem, 1.4rem);
    line-height: 2;
    box-shadow: 0 8px 40px rgba(0,0,0,0.4), 0 1px 0 rgba(255,255,255,0.05);
    width: 100%;
}

/* ─── Section Headings ─── */
.notes-body h2 {
    font-family: 'Outfit', 'Noto Sans Devanagari', sans-serif;
    font-size: clamp(1.25rem, 2.5vw, 1.6rem);
    font-weight: 800;
    color: #fff;
    margin: 3rem 0 1.2rem;
    padding: 1rem 1.4rem;
    background: linear-gradient(135deg, rgba(139,92,246,0.12), rgba(59,130,246,0.08));
    border-left: 4px solid;
    border-image: var(--gradient-primary) 1;
    border-radius: 0 12px 12px 0;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}
.notes-body h2::before {
    content: '';
    display: inline-block;
    width: 5px; height: 1.2em;
    background: var(--gradient-primary);
    border-radius: 3px;
    flex-shrink: 0;
    display: none;
}
.notes-body h2:first-child { margin-top: 0; }

.notes-body h3 {
    font-family: 'Outfit', 'Noto Sans Devanagari', sans-serif;
    font-size: clamp(1.05rem, 1.8vw, 1.2rem);
    font-weight: 700;
    color: #a78bfa;
    margin: 2rem 0 0.8rem;
    padding-left: 0.9rem;
    border-left: 3px solid rgba(167,139,250,0.5);
    letter-spacing: -0.01em;
    line-height: 1.5;
}

.notes-body h4 {
    font-family: 'Outfit', 'Noto Sans Devanagari', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: #64748b;
    margin: 1.5rem 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ─── Body Text ─── */
.notes-body p {
    margin-bottom: 1.3rem;
    color: #cbd5e1;
    line-height: clamp(1.85, 2vw + 1.4, 2.1);
}

/* ─── Lists ─── */
.notes-body ul, .notes-body ol {
    padding-left: 0;
    margin: 0.8rem 0 1.6rem;
    list-style: none;
}
.notes-body ul li {
    padding: 0.55rem 0 0.55rem 2rem;
    position: relative;
    line-height: 1.9;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    color: #cbd5e1;
}
.notes-body ul li::before {
    content: '▸';
    position: absolute;
    left: 0.4rem;
    top: 0.55rem;
    color: var(--primary, #22c55e);
    font-size: 0.8rem;
    line-height: 1.9;
}
.notes-body ol {
    counter-reset: notes-counter;
}
.notes-body ol li {
    counter-increment: notes-counter;
    padding: 0.7rem 0 0.7rem 2.8rem;
    position: relative;
    line-height: 1.9;
    margin-bottom: 0.3rem;
    color: #cbd5e1;
    background: rgba(255,255,255,0.015);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}
.notes-body ol li::before {
    content: counter(notes-counter);
    position: absolute;
    left: 0.7rem;
    top: 0.65rem;
    width: 1.5rem; height: 1.5rem;
    background: var(--gradient-primary, linear-gradient(135deg, #22c55e, #3b82f6));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.5rem;
    text-align: center;
}
.notes-body li:last-child { border-bottom: none; }

/* ─── Key Terms (strong) ─── */
.notes-body strong {
    color: #f1f5f9;
    font-weight: 700;
    background: rgba(167,139,250,0.12);
    padding: 0.05em 0.35em;
    border-radius: 5px;
    border: 1px solid rgba(167,139,250,0.18);
    white-space: nowrap;
}

/* ─── Inline Code ─── */
.notes-body code {
    background: rgba(0,0,0,0.5);
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    color: #f472b6;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.86em;
    border: 1px solid rgba(244,114,182,0.15);
}

/* ─── Code Blocks ─── */
.notes-body pre {
    background: rgba(0,0,0,0.6);
    border-radius: 14px;
    padding: 1.5rem 1.8rem;
    overflow-x: auto;
    border: 1px solid rgba(255,255,255,0.06);
    margin: 1.6rem 0;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.88rem;
    line-height: 1.75;
}

/* ─── Blockquote (key notes / tips) ─── */
.notes-body blockquote {
    margin: 1.8rem 0;
    padding: 1.2rem 1.6rem;
    background: linear-gradient(135deg, rgba(34,197,94,0.06), rgba(59,130,246,0.04));
    border-left: 4px solid var(--primary, #22c55e);
    border-radius: 0 14px 14px 0;
    color: #86efac;
    font-style: normal;
    font-size: 1rem;
    line-height: 1.9;
    position: relative;
}
.notes-body blockquote::before {
    content: '💡';
    font-style: normal;
    margin-right: 0.5rem;
    font-size: 1rem;
}

/* ─── Tables ─── */
.notes-body table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    border-collapse: collapse;
    margin: 2rem 0;
    font-size: 0.95rem;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3), 0 1px 0 rgba(255, 255, 255, 0.05) inset;
    backdrop-filter: blur(10px);
}
.notes-body th, .notes-body td {
    padding: 1.2rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    line-height: 1.7;
}

.notes-body th {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.25), rgba(244, 63, 94, 0.15));
    color: #fff;
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 2px solid rgba(139, 92, 246, 0.3);
}
.notes-body td { color: #e2e8f0; font-weight: 500; }
.notes-body tr:nth-child(even) td { background: rgba(255, 255, 255, 0.02); }
.notes-body tr:hover td { 
    background: rgba(139, 92, 246, 0.1); 
    color: #fff;
    transition: all 0.2s; 
}

/* ─── Responsive Diagrams (Mermaid & SVG) ─── */
.mermaid, pre > code.language-mermaid {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    display: block;
    text-align: center;
    background: linear-gradient(145deg, rgba(15, 23, 42, 0.6), rgba(5, 11, 24, 0.8));
    padding: 1.5rem;
    border-radius: 16px;
    border: 1px solid rgba(139, 92, 246, 0.2);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(139, 92, 246, 0.1) inset;
    margin: 2rem 0;
    -webkit-overflow-scrolling: touch;
}

.mermaid svg {
    max-width: none !important;
    min-width: 600px !important;
    height: auto !important;
    overflow: visible !important;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
    margin: 0 auto;
}

/* Make parent div scrollable for raw SVGs so they don't overflow screen horizontally */
.notes-body div:has(> svg:not(.mermaid svg):not([focusable="false"])) {
    overflow-x: auto;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 15px;
}

.notes-body svg:not(.mermaid svg):not([focusable="false"]) {
    min-width: 600px !important;
    max-width: none !important; /* Prevent text shrinking to unreadable sizes on mobile */
    height: auto !important;
    border-radius: 12px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    background: #ffffff; /* Force white background for SVGs */
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: block;
    margin: 1rem auto;
}

/* Force unstyled SVG text to be dark so it's readable against the white background */
.notes-body svg text:not([fill]) {
    fill: #0f172a;
}

/* Fix text cutoff in mermaid nodes */
.mermaid .node rect, .mermaid .node circle, .mermaid .node ellipse, .mermaid .node polygon, .mermaid .node path {
    rx: 12px;
    ry: 12px;
    stroke: rgba(167, 139, 250, 0.9) !important;
    stroke-width: 2px !important;
    fill: rgba(15, 23, 42, 0.9) !important;
    transition: all 0.3s ease;
}
.mermaid .node:hover rect, .mermaid .node:hover circle, .mermaid .node:hover ellipse, .mermaid .node:hover polygon, .mermaid .node:hover path {
    fill: rgba(139, 92, 246, 0.2) !important;
    stroke: #d946ef !important;
}
.mermaid text, .mermaid .nodeLabel, .mermaid .edgeLabel {
    font-family: 'Outfit', 'Noto Sans Devanagari', sans-serif !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    line-height: 1.3 !important;
    overflow: visible !important;
    fill: #e2e8f0 !important;
}
.mermaid .edgePath path {
    stroke: rgba(244, 63, 94, 0.9) !important;
    stroke-width: 2px !important;
    transition: stroke 0.3s ease;
}
.mermaid .edgePath:hover path {
    stroke: #d946ef !important;
}
.mermaid .edgeLabel {
    background-color: rgba(5, 11, 24, 0.95) !important;
    color: #f8fafc !important;
    font-size: clamp(9px, 1.2vw, 11px) !important;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 6px;
    padding: 3px 8px;
    backdrop-filter: blur(4px);
}

/* ─── Formula / Math box ─── */
.formula-box {
    background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(59,130,246,0.08));
    border: 1px solid rgba(139,92,246,0.25);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    margin: 1.8rem 0;
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    color: #c4b5fd;
    box-shadow: 0 0 20px rgba(139,92,246,0.08);
}

/* ─── MathJax display equations ─── */
.notes-body .MathJax_Display,
.notes-body mjx-container[display="true"] {
    background: linear-gradient(135deg, rgba(59,130,246,0.06), rgba(139,92,246,0.06));
    border: 1px solid rgba(139,92,246,0.18);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin: 1.4rem 0 !important;
    overflow-x: auto;
}

/* Key point callout */
.key-point {
    background: rgba(34,197,94,0.06);
    border: 1px solid rgba(34,197,94,0.15);
    border-left: 4px solid #22c55e;
    border-radius: 0 14px 14px 0;
    padding: 1rem 1.4rem;
    margin: 1.4rem 0;
    color: #86efac;
    font-size: 0.95rem;
}

/* ─── Quiz Engine ─── */
#quiz-app { max-width: 100%; margin: 0 auto; padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 3rem; }

.question-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    padding: 2.5rem;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-card);
    transition: var(--transition-slow);
    animation: fadeIn 0.35s ease;
}

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

.question-number {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.9rem;
}

.question-text {
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 2rem;
    line-height: 1.5;
    letter-spacing: -0.01em;
}

.options-grid { display: grid; gap: 0.8rem; }

.option-btn {
    background: rgba(255,255,255,0.032);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    padding: 1.05rem 1.4rem;
    text-align: left;
    cursor: pointer;
    color: #e2e8f0;
    font-size: 0.97rem;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.9rem;
    font-family: 'Inter', sans-serif;
    line-height: 1.5;
}
.option-btn .opt-label {
    min-width: 28px; height: 28px;
    border-radius: 8px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    flex-shrink: 0;
    font-family: 'Outfit', sans-serif;
    transition: var(--transition-fast);
}

.option-btn:hover:not(.locked) {
    border-color: rgba(139,92,246,0.45);
    background: rgba(139,92,246,0.08);
    transform: translateX(5px);
    box-shadow: 0 0 0 1px rgba(139,92,246,0.15) inset;
}
.option-btn:hover:not(.locked) .opt-label {
    background: var(--primary-dim);
    border-color: rgba(139,92,246,0.4);
    color: #a78bfa;
}

.option-btn.correct {
    background: rgba(34,197,94,0.1);
    border-color: rgba(34,197,94,0.5);
    color: #86efac;
    box-shadow: 0 0 0 1px rgba(34,197,94,0.1) inset;
}
.option-btn.correct .opt-label {
    background: rgba(34,197,94,0.2);
    border-color: #22c55e;
    color: #22c55e;
}

.option-btn.wrong {
    background: rgba(239,68,68,0.1);
    border-color: rgba(239,68,68,0.5);
    color: #fca5a5;
    box-shadow: 0 0 0 1px rgba(239,68,68,0.1) inset;
}
.option-btn.wrong .opt-label {
    background: rgba(239,68,68,0.2);
    border-color: #ef4444;
    color: #ef4444;
}
.option-btn.locked { cursor: default; transform: none; }

/* Explanation box */
.explanation-box {
    margin-top: 1.2rem;
    padding: 1rem 1.3rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.6;
    border-left: 3px solid;
    animation: fadeIn 0.3s ease;
}
.explanation-box.correct-ex {
    background: rgba(34,197,94,0.07);
    border-color: #22c55e;
    color: #86efac;
}
.explanation-box.wrong-ex {
    background: rgba(239,68,68,0.07);
    border-color: #ef4444;
    color: #fca5a5;
}

/* Progress bar */
.progress-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1.5rem 0;
}
.progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.05);
    border-radius: 99px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 99px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(139,92,246,0.5);
}
.progress-text {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
    font-family: 'Outfit', sans-serif;
}

/* Timer */
#timer-display {
    font-family: 'Outfit', sans-serif;
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--accent);
    text-align: center;
    padding: 1rem 1.5rem;
    background: rgba(244,63,94,0.05);
    border: 1px solid rgba(244,63,94,0.15);
    border-radius: 16px;
    margin: 1.5rem 0;
    letter-spacing: 4px;
}

/* Score overlay */
.score-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5,11,24,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(20px);
    animation: fadeIn 0.3s ease;
}
.score-card {
    background: rgba(15,23,42,0.95);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-lg);
    padding: 3.5rem 3rem;
    text-align: center;
    max-width: 460px;
    width: 92%;
    box-shadow: 0 32px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(139,92,246,0.15) inset;
    animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.85); }
    to   { opacity: 1; transform: scale(1); }
}

.score-circle {
    width: 150px; height: 150px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 1.5rem auto;
    font-family: 'Outfit', sans-serif;
    font-size: 2.6rem;
    font-weight: 900;
    color: #fff;
    background: rgba(139,92,246,0.08);
    border: 3px solid transparent;
    background-clip: padding-box;
    box-shadow: 0 0 0 3px rgba(139,92,246,0.4), 0 0 50px rgba(139,92,246,0.2);
    letter-spacing: -0.02em;
}

/* Mode selector */
.mode-selector {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1.2rem;
    margin: 2rem 0;
}
.mode-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.mode-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s;
}
.mode-card:hover {
    border-color: rgba(139,92,246,0.3);
    transform: translateY(-6px);
    background: var(--bg-card-hover);
    box-shadow: var(--shadow-hover);
}
.mode-card:hover::after { opacity: 1; }

.mode-card .mode-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}
.mode-card h3 {
    color: #fff;
    font-family: 'Outfit', sans-serif;
    margin-bottom: 0.5rem;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.mode-card p {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Topic grid */
.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
}
.topic-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    padding: 1.4rem 1.1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.9rem;
    line-height: 1.4;
}
.topic-btn:hover {
    border-color: rgba(139,92,246,0.35);
    background: var(--primary-dim);
    transform: translateY(-4px);
    box-shadow: var(--shadow-card);
}
.topic-btn .topic-icon {
    font-size: 1.9rem;
    margin-bottom: 0.7rem;
    display: block;
}

/* Stats panel (quiz page) */
#stats-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    padding: 2rem;
    margin: 2rem 0;
    box-shadow: var(--shadow-sm);
}
#stats-panel h3 {
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1.2rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.stats-grid-quiz {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 1rem;
}
.stat-card-quiz {
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 1.1rem;
    text-align: center;
}
.stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.9rem;
    font-weight: 900;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.3rem;
    line-height: 1;
}
.stat-label {
    color: var(--text-muted);
    font-size: 0.73rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Notes panel (inside quiz) */
#notes-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-card);
    padding: 2.5rem;
    margin: 1.5rem 0;
    color: #cbd5e1;
    line-height: 1.8;
    box-shadow: var(--shadow-sm);
    font-size: 0.97rem;
}
#notes-panel h3 {
    color: var(--primary);
    font-family: 'Outfit', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    margin: 1.5rem 0 0.8rem;
}

/* ─── Header Card (notes / practice pages) ─── */
.header-card {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: var(--radius-lg);
    padding: 2.8rem 2.5rem;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}
.header-card::before {
    content: '';
    position: absolute;
    top: -50%; left: -20%;
    width: 60%; height: 150%;
    background: var(--primary);
    filter: blur(100px);
    opacity: 0.06;
    border-radius: 50%;
}

.topic-badge {
    font-size: 2.6rem;
    background: linear-gradient(135deg, rgba(139,92,246,0.12), rgba(244,63,94,0.08));
    border: 1px solid rgba(139,92,246,0.15);
    width: 80px; height: 80px;
    border-radius: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.2rem;
}

.header-card h1 {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 900;
    margin-bottom: 0.7rem;
    color: #fff;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.header-card p {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 100%;
    margin: 0 auto 1.8rem;
    line-height: 1.65;
}
.cta-row {
    display: flex;
    gap: 0.9rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ─── AdSense Slot ─── */
.adsense-slot {
    background: rgba(255,255,255,0.01);
    border: 1px dashed rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 1rem;
    text-align: center;
    margin: 2rem auto;
    max-width: 100%;
    min-height: 90px;
    color: var(--text-dim);
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.03em;
}

/* ─── Container ─── */
.container { max-width: 100%; margin: 1rem auto; padding: 0 clamp(0.5rem, 2vw, 1.5rem); }

/* ─── Footer ─── */
.footer {
    background: rgba(0,0,0,0.35);
    padding: 2.5rem 2rem;
    text-align: center;
    color: var(--text-dim);
    margin-top: 5rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    font-size: 0.85rem;
    position: relative;
}
.footer::before {
    content: '';
    position: absolute;
    top: 0; left: 50%; transform: translateX(-50%);
    width: 200px; height: 1px;
    background: var(--gradient-primary);
    opacity: 0.3;
}
.footer a {
    color: var(--primary);
    font-weight: 600;
    transition: color 0.2s;
}
.footer a:hover { color: #a78bfa; }

/* ─── Utility ─── */
.text-primary { color: var(--primary); }
.text-muted   { color: var(--text-muted); }
.text-center  { text-align: center; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .navbar { padding: 0 1rem; height: 58px; }
    .nav-links { gap: 0; font-size: 0.82rem; }
    .nav-links a { padding: 0.35rem 0.65rem; }
    .hero { padding: 4rem 1rem 2.5rem; }
    .section-container { padding: 2.5rem 1rem; }
    .feature-card { padding: 1.5rem; }
    .score-card { padding: 2.5rem 1.5rem; }
    .notes-body { padding: 1.2rem; border-radius: 0; border-left: none; border-right: none; margin: 0 calc(-1 * clamp(0.5rem, 2vw, 1.5rem)); width: auto; }
    .notes-body h2 { font-size: clamp(1.15rem, 5vw, 1.35rem); padding: 0.8rem 1rem; }
    .notes-body h3 { font-size: clamp(1rem, 4vw, 1.1rem); }
    .header-card { padding: 2rem 1.2rem; }
    .banner-card { padding: 2.5rem 1.5rem; }
    .question-card { padding: 1.8rem 1.5rem; }
}

@media (max-width: 480px) {
    .navbar-brand { font-size: 1.05rem; }
    .nav-links a { padding: 0.3rem 0.5rem; font-size: 0.78rem; }
    .btn-main, .btn-secondary { padding: 0.8rem 1.6rem; font-size: 0.92rem; }
    .cards-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .section-title { font-size: 1.65rem; }
    .hero h1 { letter-spacing: -0.02em; }
    .score-card { padding: 2rem 1.2rem; }
    .score-circle { width: 120px; height: 120px; font-size: 2rem; }
    .notes-body { padding: 1.4rem 1rem; line-height: 1.9; }
    .notes-body ul li, .notes-body ol li { padding-left: 2rem; }
}


/* ─── Images ─── */
.notes-body img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 2rem auto;
    display: block;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* ─── Study Features (PWA) ─── */

/* Reading Progress Bar */
#reading-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 9999;
}
#reading-progress-bar {
    height: 4px;
    background: var(--gradient-primary);
    width: 0%;
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 10px var(--primary);
    transition: width 0.1s ease;
}

/* Scroll To Top Button */
#scrollToTopBtn {
    display: none;
    position: fixed;
    bottom: calc(2rem + 75px); /* Stacked above font-adjust widget with gap */
    right: 2rem;
    z-index: 9998;
    border: none;
    outline: none;
    background: var(--primary);
    color: white;
    cursor: pointer;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    box-shadow: var(--shadow-btn);
    transition: var(--transition-fast);
    backdrop-filter: blur(10px);
}
@media (max-width: 768px) {
    #scrollToTopBtn {
        bottom: calc(1rem + 65px);
        right: 1rem;
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
}
#scrollToTopBtn:hover {
    background: var(--accent);
    transform: translateY(-3px) scale(1.1);
    box-shadow: 0 10px 30px rgba(244, 63, 94, 0.6);
}

/* ─── Floating Background Icons ─── */
.floating-icons-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.floating-icon {
    position: absolute;
    opacity: 0.08; /* Slightly more visible */
    color: #e2e8f0;
    filter: drop-shadow(0 0 12px rgba(255,255,255,0.6)) blur(1px);
    animation: float-icon 20s infinite ease-in-out alternate;
    pointer-events: none;
}

.floating-icon:nth-child(1) { top: 15%; left: 10%; animation-duration: 25s; animation-delay: -5s; font-size: 4rem; }
.floating-icon:nth-child(2) { top: 60%; left: 85%; animation-duration: 22s; animation-delay: -2s; font-size: 5rem; }
.floating-icon:nth-child(3) { top: 75%; left: 15%; animation-duration: 28s; animation-delay: -10s; font-size: 3.5rem; }
.floating-icon:nth-child(4) { top: 25%; left: 75%; animation-duration: 20s; animation-delay: 0s; font-size: 4.5rem; }
.floating-icon:nth-child(5) { top: 45%; left: 45%; animation-duration: 35s; animation-delay: -15s; font-size: 6rem; opacity: 0.03; }

@keyframes float-icon {
    0% { transform: translateY(0) rotate(0deg) scale(1); }
    50% { transform: translateY(-40px) rotate(10deg) scale(1.05); }
    100% { transform: translateY(20px) rotate(-10deg) scale(0.95); }
}

/* ─── Global Search ─── */
.search-container {
    position: relative;
    max-width: 800px;
    width: 90%;
    margin: 2.5rem auto;
    z-index: 100;
}
.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    border-radius: 99px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.4), rgba(244, 63, 94, 0.4));
    padding: 2px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.search-wrapper:hover, .search-wrapper:focus-within {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    box-shadow: 0 12px 40px color-mix(in srgb, var(--primary) 40%, transparent);
    transform: translateY(-2px);
}
.search-icon {
    position: absolute;
    left: 1.5rem;
    font-size: 1.3rem;
    pointer-events: none;
    z-index: 2;
    transition: all 0.3s ease;
}
.search-wrapper:focus-within .search-icon {
    transform: scale(1.1);
}
#global-search {
    width: 100%;
    padding: 1.25rem 1.5rem 1.25rem 3.5rem;
    font-size: 1.15rem;
    font-family: 'Inter', sans-serif;
    color: #fff;
    background: rgba(15, 23, 42, 0.9);
    border: none;
    border-radius: 99px;
    outline: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(16px);
}
#global-search:focus {
    background: rgba(15, 23, 42, 1);
}
.search-results {
    position: absolute;
    top: calc(100% + 1rem);
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(139, 92, 246, 0.4);
    border-radius: 20px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.6);
    max-height: 450px;
    overflow-y: auto;
    z-index: 1000;
    backdrop-filter: blur(20px);
    display: none;
    padding: 0.75rem;
}
.search-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.1rem 1.2rem;
    color: #e2e8f0;
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s ease;
    margin-bottom: 0.3rem;
    border: 1px solid transparent;
}
.search-result-item:hover, .search-result-item.active {
    background: var(--primary-dim);
    color: #fff;
    border-color: rgba(139, 92, 246, 0.4);
    transform: translateX(4px);
}
.search-result-title {
    font-weight: 600;
    font-size: 1rem;
}
.search-result-type {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 99px;
    background: rgba(255,255,255,0.1);
    color: #a78bfa;
}

/* ─── Floating Icons Background ─── */
.floating-icons-container {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.floating-icon {
    position: absolute;
    font-size: 2.5rem;
    opacity: 0.15;
    filter: drop-shadow(0 0 10px rgba(255,255,255,0.2));
    animation: floatIcon 20s linear infinite;
}
.floating-icon:nth-child(1) { top: 10%; left: 5%; animation-duration: 25s; animation-delay: 0s; font-size: 3rem; }
.floating-icon:nth-child(2) { top: 70%; left: 15%; animation-duration: 22s; animation-delay: -5s; font-size: 2rem; }
.floating-icon:nth-child(3) { top: 40%; left: 80%; animation-duration: 28s; animation-delay: -10s; font-size: 3.5rem; }
.floating-icon:nth-child(4) { top: 80%; left: 75%; animation-duration: 20s; animation-delay: -2s; font-size: 2.2rem; }
.floating-icon:nth-child(5) { top: 20%; left: 60%; animation-duration: 24s; animation-delay: -8s; font-size: 2.8rem; }

@keyframes floatIcon {
    0%   { transform: translateY(0) rotate(0deg) translateX(0); }
    33%  { transform: translateY(-30px) rotate(15deg) translateX(20px); }
    66%  { transform: translateY(20px) rotate(-15deg) translateX(-20px); }
    100% { transform: translateY(0) rotate(0deg) translateX(0); }
}

/* ─── Dynamic Table of Contents ─── */
#dynamic-toc-wrapper {
    background: linear-gradient(145deg, rgba(15,23,42,0.8), rgba(17,24,39,0.9));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-card);
    margin: 1.5rem 0 2.5rem 0;
    padding: 1.5rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
    transition: var(--transition-medium);
}
#dynamic-toc-wrapper .toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}
#dynamic-toc-wrapper .toc-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    font-family: 'Outfit', sans-serif;
    display: flex;
    align-items: center;
    gap: 10px;
}
#dynamic-toc-wrapper #toc-toggle {
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    transition: transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}
#dynamic-toc-wrapper.collapsed #toc-toggle {
    transform: rotate(-180deg);
}
#dynamic-toc-wrapper .toc-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0 0 0;
    max-height: 50vh;
    overflow-y: auto;
    border-top: 1px solid rgba(255,255,255,0.05);
    padding-top: 1rem;
}
#dynamic-toc-wrapper.collapsed .toc-list {
    display: none;
}
.toc-item {
    margin-bottom: 0.5rem;
}
.toc-item a {
    color: #d4dce9;
    text-decoration: none;
    font-size: 1.05rem;
    transition: color 0.2s, padding-left 0.2s;
    display: block;
    padding: 0.2rem 0;
}
.toc-item a:hover {
    color: var(--primary);
    padding-left: 5px;
}
.toc-h2 {
    font-weight: 600;
    margin-top: 0.8rem;
}
.toc-h3 {
    padding-left: 1.5rem;
    font-size: 0.95rem;
    opacity: 0.85;
}
.toc-h3 a:before {
    content: '└ ';
    opacity: 0.5;
}

/* ─── Print Protection ─── */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    .notes-body, .search-container, .hero, .navbar, .footer, .floating-icons-container, .floating-icons {
        display: none !important;
    }
    body::before {
        content: 'Printing this document is disabled to protect intellectual property. Please read the notes online at CodeNest Studios.';
        display: block;
        text-align: center;
        padding: 50px;
        font-size: 20px;
        font-weight: bold;
        color: black;
    }
}

/* ─── Copy Code Button ─── */
.copy-code-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(15, 23, 42, 0.8);
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
    z-index: 10;
}
.copy-code-btn:hover {
    background: rgba(139, 92, 246, 0.8);
    color: white;
    border-color: rgba(139, 92, 246, 1);
}
.copy-code-btn.copied {
    background: rgba(16, 185, 129, 0.8);
    color: white;
    border-color: rgba(16, 185, 129, 1);
}

/* ─── Global Search Modal ─── */
#global-search-modal {
    position: fixed;
    inset: 0;
    background: rgba(5, 11, 24, 0.95);
    backdrop-filter: blur(10px);
    z-index: 100000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 10vh;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
#global-search-modal.active {
    opacity: 1;
    pointer-events: auto;
}
.search-modal-content {
    width: 90%;
    max-width: 800px;
    background: linear-gradient(145deg, rgba(15,23,42,0.9), rgba(17,24,39,1));
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: var(--radius-card);
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    position: relative;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}
#global-search-modal.active .search-modal-content {
    transform: translateY(0);
}
.close-search-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.2s;
}
.close-search-modal:hover {
    color: white;
}
#floating-search-btn {
    position: fixed;
    bottom: calc(2rem + 150px);
    right: 2rem;
    z-index: 9998;
    border: none;
    outline: none;
    background: var(--accent);
    color: white;
    cursor: pointer;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    box-shadow: var(--shadow-btn);
    transition: var(--transition-fast);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
}
#floating-search-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(244, 63, 94, 0.5);
}
@media (max-width: 768px) {
    #floating-search-btn {
        bottom: calc(1rem + 130px);
        right: 1rem;
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    .search-modal-content {
        padding: 1.5rem 1rem;
    }
}
/* Pagefind overrides */
.pagefind-ui {
    --pagefind-ui-scale: 1;
    --pagefind-ui-primary: var(--primary);
    --pagefind-ui-text: #e2e8f0;
    --pagefind-ui-background: transparent;
    --pagefind-ui-border: rgba(255,255,255,0.1);
    --pagefind-ui-tag: rgba(139, 92, 246, 0.2);
    --pagefind-ui-border-width: 1px;
    --pagefind-ui-border-radius: 8px;
    --pagefind-ui-font: 'Outfit', sans-serif;
}
.pagefind-ui__search-input {
    background: rgba(0,0,0,0.3) !important;
    color: white !important;
}
.pagefind-ui__result-link {
    color: var(--primary) !important;
}
.pagefind-ui__result-excerpt {
    color: #94a3b8 !important;
}

/* ─── Heading Anchors ─── */
.heading-anchor {
    opacity: 0;
    margin-left: 10px;
    font-size: 0.8em;
    text-decoration: none;
    transition: opacity 0.2s;
    cursor: pointer;
}
h2:hover .heading-anchor, h3:hover .heading-anchor {
    opacity: 1;
}
@media (max-width: 768px) {
    .heading-anchor {
        opacity: 1;
    }
}
