:root, [data-theme="light"] {
    --bg-gradient: radial-gradient(circle at 50% 0%, #f9fbfe 0%, #edf4fc 40%, #e2effa 100%);
    /* Realistic Liquid Glass - Light Theme (Translucent & Airy) */
    --liquid-bg: rgba(255, 255, 255, 0.45);
    --liquid-card-bg: rgba(255, 255, 255, 0.38);
    --liquid-header-bg: rgba(255, 255, 255, 0.48);
    --liquid-border: rgba(255, 255, 255, 0.65);
    --liquid-border-subtle: rgba(255, 255, 255, 0.35);
    --liquid-shadow: 0 16px 36px -6px rgba(15, 23, 42, 0.06), 0 2px 10px -2px rgba(15, 23, 42, 0.03), 0 0 0 1px rgba(255, 255, 255, 0.60);
    --liquid-hover-shadow: 0 24px 50px -8px rgba(2, 132, 199, 0.14), 0 4px 14px -2px rgba(2, 132, 199, 0.06), 0 0 0 1.5px rgba(2, 132, 199, 0.40);
    --kicker-bg: rgba(2, 132, 199, 0.07);
    --title-shadow: none;
    --text-main: #0f172a;
    --text-muted: #334155;
    --text-dim: #64748b;
    --accent: #0284c7;
    --accent-light: #0369a1;
    --accent-glow: rgba(2, 132, 199, 0.16);
    --pulse-color: #0284c7;
    --nav-height: 64px;
    --hud-bg: rgba(255, 255, 255, 0.48);
}

[data-theme="dark"] {
    --bg-gradient: radial-gradient(circle at 50% 10%, #0a0e17 0%, #05080e 50%, #020306 100%);
    /* Realistic Liquid Glass - Dark Theme (Translucent & Sleek) */
    --liquid-bg: rgba(14, 20, 32, 0.28);
    --liquid-card-bg: rgba(16, 23, 38, 0.22);
    --liquid-header-bg: rgba(14, 21, 35, 0.32);
    --liquid-border: rgba(255, 255, 255, 0.12);
    --liquid-border-subtle: rgba(255, 255, 255, 0.06);
    --liquid-shadow: 0 20px 48px -12px rgba(0, 0, 0, 0.65), 0 0 1px 1px rgba(255, 255, 255, 0.06);
    --liquid-hover-shadow: 0 28px 60px -12px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(56, 189, 248, 0.30);
    --kicker-bg: rgba(56, 189, 248, 0.09);
    --title-shadow: 0 2px 14px rgba(0, 0, 0, 0.85);
    --text-main: #f8fafc;
    --text-muted: #cbd5e1;
    --text-dim: #94a3b8;
    --accent: #38bdf8;
    --accent-light: #60a5fa;
    --accent-glow: rgba(56, 189, 248, 0.20);
    --pulse-color: #22d3ee;
    --hud-bg: rgba(12, 18, 30, 0.32);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

[lang="fa"] body, [lang="fa"] * {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

.fas, .fa-solid, .fab, .fa-brands, .far, .fa-regular {
    font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
}

#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    pointer-events: none;
}

.container, main, section, #hero {
    position: relative;
    z-index: 10;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 24px;
}

/* --- GLASSMORPHISM COMPONENTS --- */
.glass-nav {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: min(94%, 980px);
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 0 22px;
    z-index: 1000;
    border-radius: 999px;
    -webkit-border-radius: 999px;
    background: var(--liquid-bg);
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    border: 1px solid var(--liquid-border);
    box-shadow: var(--liquid-shadow);
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateX(-50%) translateZ(0);
    isolation: isolate;
}

.brand-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text-main);
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.02em;
}

.brand-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--pulse-color);
    box-shadow: 0 0 10px var(--pulse-color);
    animation: pulseGlow 2s infinite ease-in-out;
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 14px var(--pulse-color); }
}

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

.nav-link {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 600;
    position: relative;
    padding: 6px 2px;
}

.nav-link:hover, .nav-link.active {
    color: var(--accent);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
    transition: width 0.25s ease;
}

.nav-link:hover::after, .nav-link.active::after {
    width: 100%;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-icon {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-main);
    cursor: pointer;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.btn-icon:hover {
    background: var(--accent-glow);
    color: var(--accent);
    border-color: var(--liquid-border);
}

.btn-cv-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff !important;
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 700;
    box-shadow: 0 4px 12px var(--accent-glow);
    transition: all 0.25s ease;
}

.btn-cv-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--accent-glow);
    filter: brightness(1.1);
}

/* Glass Card (Realistic Liquid Glass with Fluid Refraction & Organic Meniscus) */
.glass-card {
    background: var(--liquid-card-bg);
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    border-radius: 24px;
    -webkit-border-radius: 24px;
    border: 1px solid var(--liquid-border);
    box-shadow: var(--liquid-shadow);
    position: relative;
    overflow: hidden;
    padding: 32px;
    z-index: 10;
    /* Safari Rounded Corner & Layer Clipping Fix */
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    isolation: isolate;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                border-color 0.3s ease;
}

/* Liquid Surface Organic Meniscus Highlight */
.glass-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(120% 75% at 20% 0%, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.08) 35%, transparent 65%);
    pointer-events: none;
    z-index: 1;
}

[data-theme="dark"] .glass-card::before {
    background: radial-gradient(120% 75% at 20% 0%, rgba(255, 255, 255, 0.08) 0%, transparent 60%);
}

.glass-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--liquid-hover-shadow);
    border-color: var(--accent);
}

/* --- FULLSCREEN HERO SECTION --- */
#hero {
    width: 100%;
    height: 100vh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    padding-top: calc(var(--nav-height) + 24px);
    padding-bottom: 32px;
    position: relative;
    z-index: 10;
}

#svg-morph-wrapper {
    width: 100%;
    max-width: 450px;
    height: 120px;
    margin: 0 auto 10px auto;
    position: relative;
    z-index: 10;
}

#morph-svg {
    width: 100%;
    height: 100%;
}

.morph-node {
    fill: var(--accent);
    transition: fill 0.3s ease;
}

.morph-edge {
    stroke: var(--accent);
    stroke-width: 1.5;
    opacity: 0.2;
}

.hero-spacer {
    flex: 1;
    min-height: 220px;
    width: 100%;
    pointer-events: none;
}

.scroll-indicator {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent);
    background: var(--liquid-card-bg);
    backdrop-filter: blur(20px) saturate(190%);
    -webkit-backdrop-filter: blur(20px) saturate(190%);
    border: 1px solid var(--liquid-border);
    padding: 8px 18px;
    border-radius: 999px;
    text-decoration: none;
    box-shadow: var(--liquid-shadow);
    animation: floatScrollCue 2.2s infinite ease-in-out;
    pointer-events: auto;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.scroll-indicator:hover {
    border-color: var(--accent);
    box-shadow: var(--liquid-hover-shadow);
    transform: translateY(3px) scale(1.03);
}

@keyframes floatScrollCue {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(6px); }
}

/* --- FIXED FULL-VIEWPORT 3D SPATIAL BRAIN CANVAS (STRICTLY IN BACKGROUND) --- */
#brain-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

#brain-container canvas {
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

#brain-status {
    position: absolute;
    top: calc(var(--nav-height) + 24px);
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    background: var(--liquid-card-bg);
    border: 1px solid var(--liquid-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    padding: 6px 14px;
    border-radius: 999px;
    pointer-events: none;
    z-index: 10;
    transition: opacity 0.5s ease;
    text-align: center;
    white-space: nowrap;
    max-width: 90%;
    box-shadow: var(--liquid-shadow);
}

/* --- SECTION HEADINGS WITH LIQUID GLASS BACKDROP SHIELD --- */
.section-header {
    text-align: center;
    margin: 68px auto 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: fit-content;
    max-width: 92%;
    padding: 24px 44px;
    border-radius: 24px;
    -webkit-border-radius: 24px;
    background: var(--liquid-header-bg);
    backdrop-filter: blur(24px) saturate(190%);
    -webkit-backdrop-filter: blur(24px) saturate(190%);
    border: 1px solid var(--liquid-border);
    box-shadow: var(--liquid-shadow);
    position: relative;
    z-index: 12;
    overflow: hidden;
    /* Safari Rounded Corner & Layer Clipping Fix */
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    isolation: isolate;
}

.section-header::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(120% 75% at 20% 0%, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.08) 35%, transparent 65%);
    pointer-events: none;
    z-index: 1;
}

[data-theme="dark"] .section-header::before {
    background: radial-gradient(120% 75% at 20% 0%, rgba(255, 255, 255, 0.08) 0%, transparent 60%);
}

.section-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 16px;
    border-radius: 999px;
    background: var(--kicker-bg);
    border: 1px solid var(--accent-glow);
    font-size: 0.76rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    margin-bottom: 8px;
    box-shadow: 0 2px 8px var(--accent-glow);
}

.section-title {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-main);
    text-shadow: var(--title-shadow);
    margin: 2px 0 0;
    position: relative;
    z-index: 2;
}

.section-desc {
    max-width: 640px;
    margin: 10px auto 0;
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* --- PROFILE CARD --- */
.profile-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 32px;
    align-items: center;
    margin-top: 24px;
}

.profile-img-wrap {
    position: relative;
}

.profile-avatar {
    width: 140px;
    height: 140px;
    border-radius: 28px;
    object-fit: cover;
    border: 3px solid var(--accent);
    box-shadow: 0 10px 24px var(--accent-glow);
    display: block;
}

.profile-info h1 {
    font-size: 2.1rem;
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 8px;
}

.profile-tagline {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 12px;
}

.profile-bio {
    font-size: 0.92rem;
    color: var(--text-muted);
    margin-bottom: 20px;
    line-height: 1.65;
}

.contact-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
}

.contact-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.88rem;
    font-weight: 500;
    transition: color 0.2s;
}

.contact-item:hover {
    color: var(--accent);
}

.contact-item i {
    color: var(--accent);
}

/* --- STATS HIGHLIGHTS GRID --- */
.highlights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 28px 0;
}

.stat-card {
    padding: 22px;
    border-radius: 16px;
}

.stat-number {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--accent);
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}

.stat-detail {
    font-size: 0.78rem;
    color: var(--text-dim);
}

/* --- RESEARCH INTERESTS CLOUD --- */
.research-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.research-pillar {
    padding: 24px;
    border-radius: 16px;
}

.pillar-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent-glow);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 14px;
}

.pillar-title {
    font-size: 1.05rem;
    font-weight: 800;
    margin-bottom: 6px;
    color: var(--text-main);
}

.pillar-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* --- TIMELINES & CARDS --- */
.timeline-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.timeline-item {
    padding: 26px 28px;
    border-radius: 18px;
}

.card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.card-institution {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--accent);
}

.card-meta {
    font-size: 0.82rem;
    color: var(--text-dim);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.meta-separator {
    opacity: 0.4;
}

.card-description {
    margin-top: 12px;
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.card-bullets {
    margin-top: 10px;
    padding-left: 20px;
    font-size: 0.88rem;
    color: var(--text-muted);
}

[dir="rtl"] .card-bullets {
    padding-left: 0;
    padding-right: 20px;
}

.card-bullets li {
    margin-bottom: 6px;
}

/* Filter Bar for Projects & Experience */
.filter-bar {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.filter-btn {
    background: var(--liquid-card-bg);
    border: 1px solid var(--liquid-border);
    color: var(--text-muted);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: var(--liquid-shadow);
    transition: all 0.2s ease;
}

.filter-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.filter-btn.active {
    background: var(--accent);
    color: #fff !important;
    border-color: var(--accent);
    box-shadow: 0 4px 14px var(--accent-glow);
}

/* Grid layout for cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
}

/* Skill Arsenal */
.skills-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.skill-category-card {
    padding: 24px;
    border-radius: 16px;
}

.category-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.category-header i {
    color: var(--accent);
    font-size: 1.1rem;
}

.category-name {
    font-size: 0.98rem;
    font-weight: 800;
    color: var(--text-main);
}

.skill-items-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skill-tag {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
    background: rgba(2, 132, 199, 0.08);
    border: 1px solid var(--liquid-border-subtle);
    padding: 5px 12px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

[data-theme="dark"] .skill-tag {
    background: rgba(56, 189, 248, 0.10);
    color: var(--text-muted);
}

/* Publication Spotlight */
.pub-spotlight {
    border-left: 4px solid var(--accent);
}

[dir="rtl"] .pub-spotlight {
    border-left: 1px solid var(--liquid-border);
    border-right: 4px solid var(--accent);
}

/* References Section */
.ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.ref-card {
    padding: 24px;
    border-radius: 16px;
}

.ref-name {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-main);
}

.ref-role {
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 8px;
}

.ref-contact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-dim);
    text-decoration: none;
}

.ref-contact:hover {
    color: var(--accent);
}

/* --- FOOTER --- */
footer {
    margin-top: 80px;
    padding: 40px 0;
    border-top: 1px solid var(--liquid-border-subtle);
    text-align: center;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

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

.footer-copy {
    font-size: 0.82rem;
    color: var(--text-dim);
}

/* ==========================================================================
   PROGRESSIVE WEB APP (PWA) & MOBILE NAVIGATION SYSTEM
   ========================================================================== */

/* PWA Nav Button */
.pwa-install-btn {
    position: relative;
    color: var(--accent);
}

.pwa-badge-pulse {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
    animation: pwaPulseDot 2s infinite ease-in-out;
}

@keyframes pwaPulseDot {
    0%, 100% { transform: scale(0.9); opacity: 0.8; }
    50% { transform: scale(1.3); opacity: 1; }
}

.mobile-menu-btn {
    display: none;
}

@media (min-width: 861px) {
    .mobile-nav-drawer,
    #mobile-nav-drawer,
    .mobile-menu-btn,
    #mobile-menu-btn {
        display: none !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }
}

/* Glassmorphic Mobile Navigation Drawer */
.mobile-nav-drawer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2500;
    pointer-events: none;
    visibility: hidden;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s;
}

.mobile-nav-drawer.open {
    display: block !important;
    pointer-events: auto;
    visibility: visible;
    opacity: 1;
}

.mobile-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.mobile-drawer-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(85vw, 340px);
    height: 100%;
    background: var(--liquid-bg);
    backdrop-filter: blur(28px) saturate(190%);
    -webkit-backdrop-filter: blur(28px) saturate(190%);
    border-left: 1px solid var(--liquid-border);
    padding: calc(20px + env(safe-area-inset-top, 0px)) 20px calc(24px + env(safe-area-inset-bottom, 0px)) 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    transform: translate3d(100%, 0, 0);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: -10px 0 35px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
}

[dir="rtl"] .mobile-drawer-panel {
    right: auto;
    left: 0;
    border-left: none;
    border-right: 1px solid var(--liquid-border);
    transform: translate3d(-100%, 0, 0);
    box-shadow: 10px 0 35px rgba(0, 0, 0, 0.2);
}

.mobile-nav-drawer.open .mobile-drawer-panel {
    transform: translate3d(0, 0, 0);
}

.mobile-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--liquid-border-subtle);
}

.mobile-drawer-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    min-height: 48px;
}

.mobile-nav-link i {
    width: 20px;
    color: var(--accent);
    font-size: 1.05rem;
    text-align: center;
}

.mobile-nav-link:hover, .mobile-nav-link.active {
    background: var(--accent-glow);
    color: var(--accent);
    transform: translateX(4px);
}

[dir="rtl"] .mobile-nav-link:hover, [dir="rtl"] .mobile-nav-link.active {
    transform: translateX(-4px);
}

.mobile-nav-contact {
    margin-top: 6px;
    background: var(--accent);
    color: #fff !important;
}

.mobile-nav-contact i {
    color: #fff !important;
}

.mobile-drawer-pwa {
    padding-top: 14px;
    border-top: 1px solid var(--liquid-border-subtle);
}

.mobile-pwa-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 14px var(--accent-glow);
    min-height: 48px;
}

/* Floating Mobile PWA Install Pill Banner */
.pwa-banner {
    position: fixed;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    width: min(92%, 420px);
    background: var(--liquid-card-bg);
    backdrop-filter: blur(28px) saturate(190%);
    -webkit-backdrop-filter: blur(28px) saturate(190%);
    border: 1px solid var(--liquid-border);
    border-radius: 20px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    z-index: 10002;
    animation: pwaSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pwaSlideUp {
    from { transform: translate(-50%, 40px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.pwa-banner-icon-wrap {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.pwa-banner-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.pwa-banner-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.pwa-banner-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.2;
}

.pwa-banner-sub {
    font-size: 0.74rem;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-banner-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.pwa-banner-btn-install {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 7px 14px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 10px var(--accent-glow);
    transition: transform 0.2s;
    min-height: 36px;
}

.pwa-banner-btn-install:hover {
    transform: scale(1.04);
}

.pwa-banner-btn-close {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
}

/* iOS Safari PWA Installation Guidance Modal */
.pwa-ios-modal {
    position: fixed;
    inset: 0;
    z-index: 10003;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
}

.pwa-ios-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.pwa-ios-sheet {
    position: relative;
    width: min(100%, 460px);
    padding: 24px;
    border-radius: 24px;
    background: var(--liquid-card-bg);
    backdrop-filter: blur(28px) saturate(190%);
    -webkit-backdrop-filter: blur(28px) saturate(190%);
    border: 1px solid var(--liquid-border);
    box-shadow: var(--liquid-shadow);
    display: flex;
    flex-direction: column;
    gap: 18px;
    animation: iosModalUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 2;
}

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

.pwa-ios-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pwa-ios-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.pwa-ios-apple-icon {
    font-size: 1.4rem;
    color: var(--accent);
}

.pwa-ios-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
}

.pwa-ios-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pwa-ios-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(2, 132, 199, 0.06);
    border: 1px solid var(--liquid-border-subtle);
    font-size: 0.88rem;
    color: var(--text-main);
}

.pwa-ios-step-num {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pwa-ios-icon-highlight {
    color: var(--accent);
    margin: 0 4px;
}

.pwa-ios-done-btn {
    width: 100%;
    padding: 12px;
    border-radius: 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    min-height: 48px;
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS: TABLETS & SMARTPHONES OPTIMIZATION
   ========================================================================== */

/* Tablets & Small Laptops (<= 860px) */
@media (max-width: 860px) {
    .glass-nav {
        width: min(95%, 980px);
        padding: 0 14px;
    }

    .nav-links {
        display: none;
    }

    .mobile-menu-btn {
        display: inline-flex;
    }

    .profile-card {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 22px;
    }
    
    .profile-avatar {
        margin: 0 auto;
        width: 130px;
        height: 130px;
    }
    
    .contact-row {
        justify-content: center;
    }

    .highlights-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
    }

    .cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
        gap: 16px;
    }

    .skills-category-grid,
    .ref-grid,
    .research-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
        gap: 16px;
    }
}

/* Smartphones (<= 600px) */
@media (max-width: 600px) {
    .container {
        padding: 0 16px;
    }

    .glass-nav {
        height: 56px;
        padding: 0 10px 0 14px;
        top: calc(10px + env(safe-area-inset-top, 0px));
        width: 96%;
    }

    .brand-badge {
        font-size: 0.92rem;
        gap: 6px;
    }

    .brand-dot {
        width: 6px;
        height: 6px;
    }

    .nav-controls {
        gap: 3px;
    }

    .btn-icon {
        width: 35px;
        height: 35px;
        font-size: 0.88rem;
    }

    .btn-cv-pill span {
        display: none;
    }

    .btn-cv-pill {
        width: 35px;
        height: 35px;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
    }

    #hero {
        min-height: 85vh;
        padding-top: calc(var(--nav-height) + 24px);
        padding-bottom: 24px;
    }

    #svg-morph-wrapper {
        max-width: 320px;
        height: 80px;
    }

    .scroll-indicator {
        font-size: 0.76rem;
        padding: 6px 14px;
    }

    .glass-card {
        padding: 20px 16px;
        border-radius: 18px;
    }

    .section-header {
        margin: 40px auto 18px;
        padding: 18px 20px;
        border-radius: 18px;
        width: 96%;
    }

    .section-title {
        font-size: clamp(1.35rem, 5.5vw, 1.7rem);
    }

    .section-desc {
        font-size: 0.84rem;
    }

    .profile-info h1 {
        font-size: clamp(1.5rem, 6vw, 1.95rem);
    }

    .profile-tagline {
        font-size: 0.92rem;
    }

    .profile-bio {
        font-size: 0.86rem;
        line-height: 1.6;
    }

    .contact-item {
        font-size: 0.82rem;
        word-break: break-all;
    }

    .highlights-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-card {
        padding: 14px 12px;
        border-radius: 14px;
    }

    .stat-number {
        font-size: 1.4rem;
    }

    .stat-label {
        font-size: 0.78rem;
    }

    .stat-detail {
        font-size: 0.70rem;
    }

    .cards-grid,
    .skills-category-grid,
    .ref-grid,
    .research-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .filter-bar {
        gap: 6px;
    }

    .filter-btn {
        padding: 6px 12px;
        font-size: 0.76rem;
    }

    .scroll-top-btn {
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        left: calc(16px + env(safe-area-inset-left, 0px));
        right: auto;
        width: 44px;
        height: 44px;
    }

    .thanos-floating-btn {
        bottom: calc(16px + env(safe-area-inset-bottom, 0px));
        right: calc(16px + env(safe-area-inset-right, 0px));
        width: 52px;
        height: 52px;
    }
}

/* Extra-Narrow Phones (<= 380px) */
@media (max-width: 380px) {
    .glass-nav {
        padding: 0 8px 0 10px;
    }

    .brand-badge span {
        font-size: 0.85rem;
    }

    .btn-icon {
        width: 32px;
        height: 32px;
        font-size: 0.82rem;
    }

    .highlights-grid {
        grid-template-columns: 1fr;
    }
}

/* --- SECTION DIVIDERS --- */
.section-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    max-width: 680px;
    margin: 54px auto 16px;
    padding: 0 20px;
    position: relative;
    z-index: 10;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.15) 30%, rgba(56, 189, 248, 0.4) 100%);
    opacity: 0.7;
}

.section-divider .divider-line:last-child {
    background: linear-gradient(90deg, rgba(56, 189, 248, 0.4) 0%, rgba(56, 189, 248, 0.15) 70%, transparent 100%);
}

.divider-gem {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    -webkit-border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--liquid-card-bg);
    backdrop-filter: blur(20px) saturate(190%);
    -webkit-backdrop-filter: blur(20px) saturate(190%);
    border: 1px solid var(--liquid-border);
    box-shadow: var(--liquid-shadow);
    color: var(--accent);
    font-size: 0.65rem;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
    isolation: isolate;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.section-divider:hover .divider-gem {
    transform: scale(1.2);
    color: var(--pulse-color);
    border-color: var(--accent);
    box-shadow: var(--liquid-hover-shadow);
}

/* --- FUTURISTIC RESUME-SPECIFIC SCROLL ELEMENTS --- */

/* 1. Top Neural Signal Progress Bar */
.scroll-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(15, 23, 42, 0.08);
    z-index: 10001;
    pointer-events: none;
}

[data-theme="dark"] .scroll-progress-container {
    background: rgba(10, 16, 28, 0.35);
}

.scroll-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0284c7 0%, var(--accent) 50%, var(--pulse-color) 100%);
    box-shadow: 0 0 10px var(--accent-glow);
    transition: width 0.08s ease-out;
    position: relative;
}

/* Leading Synaptic Energy Spark */
.scroll-spark-head {
    position: absolute;
    right: -2px;
    top: -3px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 8px var(--accent), 0 0 16px var(--pulse-color);
    animation: sparkPulse 1.2s infinite alternate ease-in-out;
}

@keyframes sparkPulse {
    0% { transform: scale(0.85); opacity: 0.9; }
    100% { transform: scale(1.3); opacity: 1; box-shadow: 0 0 12px var(--accent), 0 0 20px var(--pulse-color); }
}

/* 2. Futuristic Liquid Back-to-Top Button */
.scroll-top-btn {
    position: fixed;
    bottom: 24px;
    left: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    -webkit-border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--liquid-card-bg);
    backdrop-filter: blur(28px) saturate(210%);
    -webkit-backdrop-filter: blur(28px) saturate(210%);
    border: 1px solid var(--liquid-border);
    box-shadow: var(--liquid-shadow);
    color: var(--text-main);
    z-index: 998;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(0.9);
    transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), 
                background 0.25s ease, 
                border-color 0.25s ease,
                box-shadow 0.25s ease;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
    isolation: isolate;
    padding: 0;
}

[dir="rtl"] .scroll-top-btn {
    left: 24px;
    right: auto;
}

.scroll-top-btn.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.scroll-ring-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
    pointer-events: none;
}

.scroll-ring-bg {
    fill: none;
    stroke: var(--liquid-border-subtle);
    stroke-width: 2.5;
}

.scroll-ring-progress {
    fill: none;
    stroke: url(#ringGradient);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 144.5;
    stroke-dashoffset: 144.5;
    transition: stroke-dashoffset 0.1s ease-out;
}

.scroll-btn-inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.scroll-btn-inner i {
    font-size: 0.82rem;
    color: var(--accent);
    transition: transform 0.25s ease, color 0.25s ease;
}

.scroll-pct-label {
    font-family: 'SF Mono', 'Roboto Mono', monospace;
    font-size: 0.55rem;
    font-weight: 800;
    color: var(--text-dim);
    margin-top: 2px;
}

.scroll-top-btn:hover {
    transform: translateY(-3px) scale(1.06);
    background: var(--liquid-bg);
    border-color: var(--accent);
    box-shadow: var(--liquid-hover-shadow);
}

.scroll-top-btn:hover .scroll-btn-inner i {
    transform: translateY(-2px);
    color: var(--pulse-color);
}

.scroll-top-btn:hover .scroll-pct-label {
    color: var(--text-main);
}

/* 3. Futuristic Liquid Side Scroll Rail */
.scroll-nav-rail {
    position: fixed;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 16px 8px;
    border-radius: 999px;
    -webkit-border-radius: 999px;
    background: var(--liquid-card-bg);
    backdrop-filter: blur(28px) saturate(210%);
    -webkit-backdrop-filter: blur(28px) saturate(210%);
    border: 1px solid var(--liquid-border);
    box-shadow: var(--liquid-shadow);
    z-index: 997;
    -webkit-mask-image: -webkit-radial-gradient(white, black);
    mask-image: radial-gradient(white, black);
    isolation: isolate;
    transition: opacity 0.3s ease, border-color 0.3s ease;
}

[dir="rtl"] .scroll-nav-rail {
    right: auto;
    left: 20px;
}

/* Conductive Neural Capillary Line */
.rail-neural-bus {
    position: absolute;
    top: 16px;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    width: 1.5px;
    background: linear-gradient(180deg, 
        transparent 0%, 
        var(--accent-glow) 30%, 
        var(--accent-glow) 70%, 
        transparent 100%
    );
    pointer-events: none;
    z-index: 0;
}

.scroll-rail-dot {
    position: relative;
    z-index: 1;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.rail-dot-indicator {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--text-dim);
    opacity: 0.55;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.rail-dot-core {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: transparent;
    transition: all 0.25s ease;
}

.scroll-rail-dot:hover .rail-dot-indicator {
    transform: scale(1.35);
    background: var(--accent);
    opacity: 0.9;
    box-shadow: 0 0 10px var(--accent-glow);
}

.scroll-rail-dot:hover .rail-dot-core {
    background: #ffffff;
}

/* Active State */
.scroll-rail-dot.active .rail-dot-indicator {
    background: var(--accent);
    opacity: 1;
    box-shadow: 0 0 12px var(--accent);
    transform: scale(1.4);
}

.scroll-rail-dot.active .rail-dot-core {
    width: 3px;
    height: 3px;
    background: #ffffff;
    box-shadow: 0 0 4px #ffffff;
}

/* Futuristic Liquid Tooltip */
.rail-tooltip {
    position: absolute;
    right: calc(100% + 12px);
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    background: var(--liquid-card-bg);
    backdrop-filter: blur(24px) saturate(210%);
    -webkit-backdrop-filter: blur(24px) saturate(210%);
    border: 1px solid var(--liquid-border);
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), 
                transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--liquid-shadow);
}

[dir="rtl"] .rail-tooltip {
    right: auto;
    left: calc(100% + 12px);
    transform: translateY(-50%) translateX(-6px);
}

.scroll-rail-dot:hover .rail-tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

@media (max-width: 1140px) {
    .scroll-nav-rail {
        display: none;
    }
}

/* ==========================================================================
   THANOS DISINTEGRATION & TIME STONE REASSEMBLY ANIMATIONS
   Realistic Ash, Cosmic Embers, Temporal Shockwaves, and Smooth Physics
   ========================================================================== */

/* 1. Dedicated Thanos Infinity Gauntlet Floating Action Button (Down Right) */
.thanos-floating-btn {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    right: calc(24px + env(safe-area-inset-right, 0px));
    width: 64px;
    height: 64px;
    border-radius: 50%;
    -webkit-border-radius: 50%;
    background: linear-gradient(135deg, rgba(20, 18, 45, 0.45) 0%, rgba(15, 23, 42, 0.55) 100%);
    backdrop-filter: blur(28px) saturate(220%);
    -webkit-backdrop-filter: blur(28px) saturate(220%);
    border: 1.5px solid rgba(245, 158, 11, 0.45);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35),
                0 0 20px rgba(245, 158, 11, 0.25),
                inset 0 1px 2px rgba(254, 240, 138, 0.35);
    z-index: 1000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    outline: none;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.3s ease,
                background 0.3s ease;
    -webkit-tap-highlight-color: transparent;
}

[data-theme="light"] .thanos-floating-btn {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.52) 0%, rgba(254, 243, 199, 0.42) 100%);
    border-color: rgba(217, 119, 6, 0.45);
    box-shadow: 0 10px 24px rgba(217, 119, 6, 0.18),
                0 0 18px rgba(245, 158, 11, 0.20),
                inset 0 1px 2px rgba(255, 255, 255, 0.75);
}

.thanos-floating-btn:hover {
    transform: translateY(-5px) scale(1.08);
    border-color: #f59e0b;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45),
                0 0 35px rgba(245, 158, 11, 0.60),
                0 0 55px rgba(168, 85, 247, 0.30);
}

.thanos-floating-btn:active {
    transform: translateY(-1px) scale(0.96);
}

.thanos-btn-inner {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Infinity Gauntlet Armored SVG */
.gauntlet-svg {
    display: block;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), filter 0.3s ease;
}

.thanos-floating-btn:hover .gauntlet-svg {
    transform: scale(1.07) rotate(-2deg);
    filter: drop-shadow(0 6px 16px rgba(245, 158, 11, 0.55));
}

/* Gauntlet Digits Articulation */
.thumb-digit, .index-digit, .middle-digit, .ring-digit, .pinky-digit {
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: 50px 80px;
}

.thanos-floating-btn:hover .thumb-digit {
    transform: rotate(-3deg);
}

.thanos-floating-btn:hover .pinky-digit {
    transform: rotate(2.5deg);
}

/* Animated Synaptic Energy Conduit Lines */
.conduit-vein {
    stroke-dasharray: 6 3;
    animation: conduitFlow 2s linear infinite;
    transition: filter 0.3s ease, opacity 0.3s ease, stroke-width 0.3s ease;
}

@keyframes conduitFlow {
    from { stroke-dashoffset: 18; }
    to { stroke-dashoffset: 0; }
}

.thanos-floating-btn:hover .conduit-vein {
    animation-duration: 0.8s;
    stroke-width: 1.4;
    opacity: 1;
    filter: drop-shadow(0 0 3px currentColor);
}

/* Infinity Stones Radiance & Breathing Animations */
.stone-glow {
    filter: drop-shadow(0 0 3px currentColor);
    animation: gemCosmicBreathe 2.4s infinite alternate ease-in-out;
}

.gem-mind    { color: #facc15; animation-delay: 0.0s; }
.gem-space   { color: #38bdf8; animation-delay: 0.4s; }
.gem-power   { color: #c084fc; animation-delay: 0.8s; }
.gem-reality { color: #f87171; animation-delay: 1.2s; }
.gem-time    { color: #34d399; animation-delay: 1.6s; }
.gem-soul    { color: #fb923c; animation-delay: 2.0s; }

@keyframes gemCosmicBreathe {
    0% {
        opacity: 0.85;
        transform-origin: center;
        filter: drop-shadow(0 0 2px currentColor);
    }
    100% {
        opacity: 1;
        filter: drop-shadow(0 0 6px currentColor) drop-shadow(0 0 12px currentColor);
    }
}

.thanos-floating-btn:hover .stone-glow {
    animation-duration: 1.1s;
    filter: drop-shadow(0 0 8px currentColor) drop-shadow(0 0 16px currentColor);
}

/* Ambient Cosmic Pulsing Ring behind the Gauntlet */
.thanos-fab-glow {
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245, 158, 11, 0.25) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
    animation: fabAuraPulse 3s infinite alternate ease-in-out;
}

@keyframes fabAuraPulse {
    0% { transform: scale(0.9); opacity: 0.5; }
    100% { transform: scale(1.25); opacity: 0.9; }
}

/* Tooltip on Hover */
.thanos-fab-tooltip {
    position: absolute;
    right: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%) scale(0.92);
    background: var(--liquid-card-bg);
    backdrop-filter: blur(24px) saturate(200%);
    -webkit-backdrop-filter: blur(24px) saturate(200%);
    border: 1px solid rgba(245, 158, 11, 0.45);
    color: var(--text-main);
    padding: 7px 14px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    z-index: 1001;
}

[dir="rtl"] .thanos-fab-tooltip {
    right: auto;
    left: calc(100% + 14px);
}

.thanos-floating-btn:hover .thanos-fab-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) scale(1);
}

/* Time Stone Active State on Floating Button (When Universe is Snapped) */
.thanos-floating-btn.snapped {
    border-color: #10b981;
    background: linear-gradient(135deg, rgba(6, 78, 59, 0.92) 0%, rgba(15, 23, 42, 0.95) 100%);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5),
                0 0 28px rgba(16, 185, 129, 0.6),
                0 0 50px rgba(52, 211, 153, 0.35);
}

.time-stone-fab-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.time-stone-mandala-svg {
    display: block;
    filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.85));
}

.time-ring-outer {
    animation: timeRuneSpin 10s infinite linear;
    transform-origin: 50px 50px;
}

.time-mandala-1 {
    animation: timeRuneSpin 6s infinite linear reverse;
    transform-origin: 50px 50px;
}

.time-mandala-2 {
    animation: timeRuneSpin 4s infinite linear;
    transform-origin: 50px 50px;
}

.time-core-gem {
    animation: timeGemPulse 1.6s infinite alternate ease-in-out;
}

@keyframes timeRuneSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes timeGemPulse {
    0% { transform: scale(0.9); opacity: 0.85; filter: drop-shadow(0 0 4px #10b981); }
    100% { transform: scale(1.15); opacity: 1; filter: drop-shadow(0 0 12px #34d399); }
}

/* 2. Fullscreen Cosmic Shockwave Flash */
.thanos-shockwave-ring {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 3px solid rgba(245, 158, 11, 0.85);
    box-shadow: 0 0 40px rgba(245, 158, 11, 0.8), inset 0 0 40px rgba(168, 85, 247, 0.6);
    pointer-events: none;
    z-index: 10006;
    animation: cosmicShockwave 1.1s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes cosmicShockwave {
    0% {
        width: 10px;
        height: 10px;
        opacity: 1;
        border-width: 6px;
    }
    100% {
        width: 280vmax;
        height: 280vmax;
        opacity: 0;
        border-width: 1px;
    }
}

/* Time Stone Temporal Green Wave */
.time-stone-wave-ring {
    position: fixed;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 3px solid rgba(16, 185, 129, 0.9);
    box-shadow: 0 0 50px rgba(16, 185, 129, 0.85), inset 0 0 30px rgba(52, 211, 153, 0.7);
    pointer-events: none;
    z-index: 10006;
    animation: timeStoneRipple 1.25s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes timeStoneRipple {
    0% {
        width: 10px;
        height: 10px;
        opacity: 1;
        border-width: 6px;
    }
    100% {
        width: 280vmax;
        height: 280vmax;
        opacity: 0;
        border-width: 1px;
    }
}

/* 3. Floating Liquid Thanos HUD Toast */
.thanos-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(40px) scale(0.94);
    opacity: 0;
    visibility: hidden;
    z-index: 10003;
    display: inline-flex;
    align-items: center;
    gap: 14px;
    padding: 10px 18px;
    border-radius: 999px;
    background: var(--liquid-card-bg);
    backdrop-filter: blur(28px) saturate(210%);
    -webkit-backdrop-filter: blur(28px) saturate(210%);
    border: 1px solid var(--liquid-border);
    box-shadow: var(--liquid-hover-shadow), 0 8px 30px rgba(0, 0, 0, 0.3);
    color: var(--text-main);
    font-size: 0.84rem;
    font-weight: 600;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
    max-width: 92vw;
}

.thanos-toast.visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0) scale(1);
}

.thanos-toast.type-snap {
    border-color: rgba(245, 158, 11, 0.45);
}

.thanos-toast.type-restore {
    border-color: rgba(16, 185, 129, 0.55);
}

.toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast-icon {
    font-size: 1.05rem;
    display: flex;
    align-items: center;
}

.toast-action-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: none;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    transition: all 0.25s ease;
    white-space: nowrap;
}

.toast-action-btn:hover {
    transform: scale(1.04);
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.55);
    filter: brightness(1.1);
}

.toast-close-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 1.2rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 4px;
    transition: color 0.2s ease;
}

.toast-close-btn:hover {
    color: var(--text-main);
}

/* 4. Per-Card Mini Disintegrate Trigger */
.card-snap-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--liquid-card-bg);
    border: 1px solid var(--liquid-border-subtle);
    color: var(--text-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    cursor: pointer;
    opacity: 0.28;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 5;
}

[dir="rtl"] .card-snap-btn {
    right: auto;
    left: 14px;
}

.glass-card:hover .card-snap-btn {
    opacity: 0.75;
}

.card-snap-btn:hover {
    opacity: 1;
    background: var(--accent-glow);
    color: #f59e0b;
    border-color: #f59e0b;
    transform: scale(1.18) rotate(15deg);
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

/* Disintegrated State */
.glass-card.thanos-vanished {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* ==========================================================================
   SMOOTH & REALISTIC GENERAL ANIMATIONS
   Hardware-accelerated Scroll Entrance, 3D Perspective Tilt, Fluid Physics
   ========================================================================== */

/* Smooth Thanos Cosmic Materialization Observer (Ultra-light, GPU-accelerated) */
.thanos-appear-target {
    opacity: 0;
    transform: translate3d(0, 18px, 0);
    transition: opacity 0.48s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.48s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: opacity, transform;
}

.thanos-appear-target.thanos-crystallizing {
    outline: 1px solid rgba(56, 189, 248, 0.45);
}

.thanos-appear-target.thanos-materialized {
    opacity: 1;
    transform: translate3d(0, 0, 0);
}

/* Realistic 3D Tilt Card Perspective */
.glass-card {
    transform-style: preserve-3d;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: transform, box-shadow;
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1), 
                box-shadow 0.45s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.35s ease;
}

/* Dynamic Cursor Specular Sheen on 3D Hover */
.glass-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(
        circle 320px at var(--cursor-sheen-x, 50%) var(--cursor-sheen-y, 0%),
        rgba(255, 255, 255, 0.16) 0%,
        transparent 70%
    );
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 2;
}

.glass-card:hover::after {
    opacity: 1;
}

[data-theme="dark"] .glass-card::after {
    background: radial-gradient(
        circle 320px at var(--cursor-sheen-x, 50%) var(--cursor-sheen-y, 0%),
        rgba(56, 189, 248, 0.14) 0%,
        transparent 70%
    );
}

