/* =====================================================
   FFPE RNA Extraction — Design System & Base Styles
   ===================================================== */

/* ----- Self-Hosted Inter Font ----- */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
    src: url('./fonts/inter-var-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 300 900;
    font-display: swap;
    src: url('./fonts/inter-var-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ----- CSS Custom Properties (Design Tokens) ----- */
:root {
    /* Backgrounds */
    --bg-primary: #060a13;
    --bg-secondary: #0c1221;
    --bg-tertiary: #111827;
    --bg-card: rgba(15, 23, 42, 0.75);
    --bg-card-border: rgba(255, 255, 255, 0.06);

    /* Text */
    --text-primary: #f0f4f8;
    --text-secondary: #94a3b8;
    --text-muted: #5a6a80;
    --text-accent: #00D4AA;

    /* Accents */
    --accent-primary: #00D4AA;
    --accent-secondary: #00B4D8;
    --accent-tertiary: #6366f1;
    --accent-gradient: linear-gradient(135deg, #00D4AA 0%, #00B4D8 100%);
    --accent-gradient-reverse: linear-gradient(135deg, #00B4D8 0%, #00D4AA 100%);
    --accent-glow: 0 0 25px rgba(0, 212, 170, 0.25);
    --accent-glow-strong: 0 0 40px rgba(0, 212, 170, 0.4);

    /* Phase Colors */
    --phase-1: #00D4AA;
    --phase-2: #f59e0b;
    --phase-3: #00B4D8;
    --phase-4: #a78bfa;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(0, 212, 170, 0.25);

    /* Glass */
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-bg-strong: rgba(255, 255, 255, 0.06);
    --glass-blur: 20px;

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(0, 212, 170, 0.15);

    /* Spacing */
    --nav-height: 72px;
    --header-height: 80px;
    --content-max-width: 900px;
    --content-padding: 24px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-size-xs: 0.7rem;
    --font-size-sm: 0.8rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.15rem;
    --font-size-xl: 1.4rem;
    --font-size-2xl: 1.85rem;
    --font-size-3xl: 2.5rem;
    --font-size-hero: 3.2rem;

    /* Transitions */
    --transition-fast: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
}


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

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
}

/* Subtle background gradient */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 50% -20%, rgba(0, 212, 170, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(0, 180, 216, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse 50% 50% at 10% 60%, rgba(99, 102, 241, 0.04) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.02em;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
}

button {
    font-family: var(--font-family);
    cursor: pointer;
    border: none;
    background: none;
    color: inherit;
    font-size: inherit;
}


/* ----- App Container ----- */
html, body {
    height: 100vh; /* Fallback for browsers that do not support Custom Properties */
    height: 100dvh;
    min-height: -webkit-fill-available;
}

#app {
    position: relative;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: -webkit-fill-available;
    display: flex;
    flex-direction: column;
    z-index: 1;
}


/* =====================================================
   PROGRESS HEADER
   ===================================================== */
.progress-header {
    position: relative;
    z-index: 100;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--content-padding);
    background: rgba(6, 10, 19, 0.85);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-bottom: 1px solid var(--border-subtle);
    transition: opacity var(--transition-base), transform var(--transition-base);
}

.progress-header.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

.progress-track {
    display: flex;
    align-items: center;
    gap: 0;
    max-width: 720px;
    width: 100%;
}

/* Phase Group */
.phase-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.phase-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    white-space: nowrap;
    transition: color var(--transition-base);
}

.phase-group.active .phase-label,
.phase-group.completed .phase-label {
    color: var(--text-secondary);
}

/* Step Dots */
.step-dots {
    display: flex;
    align-items: center;
    gap: 0;
}

.step-dot {
    width: 30px;
    height: 30px;
    border-radius: var(--radius-full);
    border: 2px solid var(--border-medium);
    background: transparent;
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-base);
    position: relative;
}

.step-dot:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: scale(1.1);
}

.step-dot.completed {
    border-color: var(--accent-primary);
    background: var(--accent-primary);
    color: var(--bg-primary);
    box-shadow: 0 0 12px rgba(0, 212, 170, 0.3);
}

.step-dot.active {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    box-shadow: 0 0 0 4px rgba(0, 212, 170, 0.15), var(--accent-glow);
    transform: scale(1.1);
}

/* Dot Connector (within a phase) */
.dot-connector {
    width: 20px;
    height: 2px;
    background: var(--border-medium);
    transition: background var(--transition-base);
}

.dot-connector.completed {
    background: var(--accent-primary);
    box-shadow: 0 0 8px rgba(0, 212, 170, 0.3);
}

/* Phase Connector (between phases) */
.phase-connector {
    width: 28px;
    height: 2px;
    background: var(--border-subtle);
    margin: 18px 4px 0;
    align-self: flex-end;
    transition: background var(--transition-base);
    border-radius: 1px;
}

.phase-connector.completed {
    background: var(--accent-primary);
    opacity: 0.5;
}


/* =====================================================
   STEP CONTAINER
   ===================================================== */
.step-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.step {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--content-padding);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition-slow), transform var(--transition-slow);
    transform: scale(0.97) translateY(10px);
    overflow-y: auto;
}

.step.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: scale(1) translateY(0);
}


/* =====================================================
   PLACEHOLDER CARDS (M0 only — will be replaced)
   ===================================================== */
.placeholder-card {
    max-width: var(--content-max-width);
    width: 100%;
    text-align: center;
    padding: 60px 40px;
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-xl);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.placeholder-icon {
    font-size: 3.5rem;
    margin-bottom: 24px;
    filter: grayscale(0.2);
}

.placeholder-card h1 {
    font-size: var(--font-size-2xl);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.placeholder-card h2 {
    font-size: var(--font-size-xl);
    color: var(--text-primary);
    margin-bottom: 8px;
}

.placeholder-subtitle {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.placeholder-phase-tag {
    display: inline-block;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 5px 14px;
    border-radius: var(--radius-full);
    background: rgba(0, 212, 170, 0.1);
    color: var(--accent-primary);
    border: 1px solid rgba(0, 212, 170, 0.2);
    margin-bottom: 20px;
}

.placeholder-note {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    font-style: italic;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}


/* =====================================================
   LANDING PAGE (M1)
   ===================================================== */

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(24px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 6px rgba(0, 212, 170, 0.6);
    }
    50% {
        box-shadow: 0 0 14px rgba(0, 212, 170, 0.9);
    }
}

@keyframes subtleFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
}

/* Landing Wrapper */
.landing-wrapper {
    max-width: 1000px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 44px;
    padding: 20px 0;
}

/* ----- Hero Section ----- */
.landing-hero {
    text-align: center;
    max-width: 680px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 7px 20px;
    border-radius: var(--radius-full);
    background: rgba(0, 212, 170, 0.07);
    border: 1px solid rgba(0, 212, 170, 0.18);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent-primary);
    margin-bottom: 28px;
    animation: fadeInUp 0.6s ease-out both;
    animation-delay: 0.1s;
}

.hero-badge-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-primary);
    animation: pulseGlow 2s ease-in-out infinite;
    flex-shrink: 0;
}

.hero-title {
    font-size: var(--font-size-3xl);
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.15;
    margin-bottom: 18px;
    letter-spacing: -0.03em;
    animation: fadeInUp 0.7s ease-out both;
    animation-delay: 0.25s;
}

.hero-title-accent {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 10px;
    animation: fadeInUp 0.6s ease-out both;
    animation-delay: 0.4s;
}

.hero-description {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 500px;
    margin: 0 auto;
    animation: fadeInUp 0.6s ease-out both;
    animation-delay: 0.5s;
}

/* ----- Blueprint Section ----- */
.landing-blueprint {
    width: 100%;
    animation: fadeInUp 0.7s ease-out both;
    animation-delay: 0.6s;
}

.blueprint-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 24px;
    justify-content: center;
}

.blueprint-line {
    height: 1px;
    width: 60px;
    background: linear-gradient(90deg, transparent, var(--border-medium), transparent);
}

.blueprint-title {
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Blueprint Flow (horizontal layout) */
.blueprint-flow {
    display: flex;
    align-items: stretch;
    gap: 0;
    width: 100%;
}

/* Phase Card */
.bp-phase {
    flex: 1;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    overflow: hidden;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.bp-phase:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.35);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Phase accent top bar */
.bp-phase-accent {
    height: 3px;
    background: var(--phase-color, var(--accent-primary));
    opacity: 0.9;
}

.bp-phase[data-phase="1"] { --phase-color: var(--phase-1); }
.bp-phase[data-phase="2"] { --phase-color: var(--phase-2); }
.bp-phase[data-phase="3"] { --phase-color: var(--phase-3); }
.bp-phase[data-phase="4"] { --phase-color: var(--phase-4); }

.bp-phase-body {
    padding: 16px 14px 18px;
}

.bp-phase-label {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--phase-color, var(--accent-primary));
    opacity: 0.85;
}

.bp-phase-name {
    font-size: var(--font-size-base);
    font-weight: 700;
    color: var(--text-primary);
    margin: 4px 0 14px;
    letter-spacing: -0.01em;
}

.bp-step-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.bp-step-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.bp-step-num {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid var(--phase-color, var(--accent-primary));
    color: var(--phase-color, var(--accent-primary));
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Arrow Connector between phases */
.bp-arrow-connector {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
    color: var(--text-muted);
    flex-shrink: 0;
    opacity: 0.4;
    animation: subtleFloat 3s ease-in-out infinite;
}

/* ----- Begin CTA Button ----- */
.begin-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 40px;
    border-radius: var(--radius-full);
    background: var(--accent-gradient);
    color: var(--bg-primary);
    font-size: var(--font-size-base);
    font-weight: 700;
    letter-spacing: 0.02em;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-glow);
    animation: fadeInUp 0.6s ease-out both;
    animation-delay: 0.85s;
}

.begin-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--accent-glow-strong), var(--shadow-md);
}

.begin-btn:active {
    transform: translateY(0) scale(1);
}


/* =====================================================
   STEP CONTENT (M2+)
   ===================================================== */

/* Step Content Layout */
.step-content {
    max-width: var(--content-max-width);
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
}

/* ----- Step Header ----- */
.step-header {
    text-align: center;
}

.step-phase-tag {
    display: inline-block;
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 5px 14px;
    border-radius: var(--radius-full);
    margin-bottom: 12px;
}

.step-phase-tag[data-phase="1"] {
    color: var(--phase-1);
    background: rgba(0, 212, 170, 0.08);
    border: 1px solid rgba(0, 212, 170, 0.18);
}
.step-phase-tag[data-phase="2"] {
    color: var(--phase-2);
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.18);
}
.step-phase-tag[data-phase="3"] {
    color: var(--phase-3);
    background: rgba(0, 180, 216, 0.08);
    border: 1px solid rgba(0, 180, 216, 0.18);
}
.step-phase-tag[data-phase="4"] {
    color: var(--phase-4);
    background: rgba(167, 139, 250, 0.08);
    border: 1px solid rgba(167, 139, 250, 0.18);
}

.step-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--text-primary);
}

.step-title-sub {
    color: var(--text-secondary);
    font-weight: 400;
}

/* ----- Step Visual Container ----- */
.step-visual {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 8px 0;
}

/* ----- Info Cards (Action + Function) ----- */
.step-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    width: 100%;
}

.info-card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    padding: 22px;
    border-left: 3px solid transparent;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.info-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}

.action-card {
    border-left-color: var(--accent-secondary);
}

.function-card {
    border-left-color: var(--accent-primary);
}

.info-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.info-card-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.action-icon {
    background: rgba(0, 180, 216, 0.1);
    border: 1px solid rgba(0, 180, 216, 0.2);
    color: var(--accent-secondary);
}

.function-icon {
    background: rgba(0, 212, 170, 0.1);
    border: 1px solid rgba(0, 212, 170, 0.2);
    color: var(--accent-primary);
}

.info-card-label {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.info-card-subtitle {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 500;
}

.info-card-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.7;
}

.info-card-text strong {
    color: var(--text-primary);
    font-weight: 600;
}


/* ----- Step 1: Deparaffinization Visual ----- */
.deparaf-illustration {
    position: relative;
    width: 240px;
    height: 120px;
}

.deparaf-block {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid var(--border-subtle);
}

.deparaf-wax {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 55%;
    background: linear-gradient(135deg, #c9922e, #d4a853, #e6c066);
    display: flex;
    align-items: center;
    justify-content: center;
    transform-origin: top center;
    animation: waxDissolve 5s ease-in-out infinite;
}

.deparaf-wax span,
.deparaf-tissue span {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.deparaf-wax span { color: rgba(0, 0, 0, 0.45); }
.deparaf-tissue span { color: rgba(255, 255, 255, 0.6); }

.deparaf-tissue {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 45%;
    background: linear-gradient(135deg, #e57373, #ef5350);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: tissueReveal 5s ease-in-out infinite;
}

@keyframes waxDissolve {
    0%, 10% { transform: scaleY(1); opacity: 0.85; }
    45%, 60% { transform: scaleY(0.15); opacity: 0.15; }
    85%, 100% { transform: scaleY(1); opacity: 0.85; }
}

@keyframes tissueReveal {
    0%, 10% { height: 45%; opacity: 0.5; }
    45%, 60% { height: 85%; opacity: 1; }
    85%, 100% { height: 45%; opacity: 0.5; }
}

/* Wax particles */
.deparaf-drops {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.wax-drop {
    position: absolute;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #d4a853;
    opacity: 0;
    animation: dropFloat 5s ease-out infinite;
}

.wax-drop:nth-child(1) { animation-delay: 0.6s; }
.wax-drop:nth-child(2) { animation-delay: 0.9s; }
.wax-drop:nth-child(3) { animation-delay: 1.2s; }
.wax-drop:nth-child(4) { animation-delay: 1.5s; }
.wax-drop:nth-child(5) { animation-delay: 1.0s; }

@keyframes dropFloat {
    0% { top: 35%; opacity: 0; transform: scale(1); }
    10% { opacity: 0.8; }
    50% { top: -15%; opacity: 0; transform: scale(0.4); }
    100% { top: -15%; opacity: 0; }
}


/* ----- Step 2: Mechanism Trio Visual ----- */
.landing-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
}

.begin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--accent-primary);
    color: var(--bg-primary);
    border: none;
    padding: 16px 32px;
    font-size: var(--font-size-lg);
    font-weight: 700;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 10px 20px rgba(0, 212, 170, 0.2);
    text-decoration: none;
}

.begin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(0, 212, 170, 0.3);
    background: #00e5b8;
}

.begin-btn.btn-pdf {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    box-shadow: none;
}

.begin-btn.btn-pdf:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-secondary);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.creator-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 24px;
    margin-top: 40px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(0, 212, 170, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    animation: badgeGlow 3s infinite alternate ease-in-out;
}

@keyframes badgeGlow {
    0% {
        box-shadow: 0 0 10px rgba(0, 212, 170, 0.1), inset 0 0 5px rgba(0, 212, 170, 0.05);
        border-color: rgba(0, 212, 170, 0.3);
    }
    100% {
        box-shadow: 0 0 25px rgba(0, 212, 170, 0.6), inset 0 0 15px rgba(0, 212, 170, 0.2);
        border-color: rgba(0, 212, 170, 0.8);
    }
}

.creator-badge:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(239, 71, 111, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(239, 71, 111, 0.2);
}

.creator-text {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.03em;
}

.creator-text svg {
    color: #ef476f;
    animation: heartbeat 1.5s ease-in-out infinite;
}

.creator-text strong {
    color: var(--text-primary);
    font-weight: 700;
    background: linear-gradient(90deg, #00d4aa, #00aaff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes heartbeat {
    0%, 100% { transform: scale(1); }
    14% { transform: scale(1.3); }
    28% { transform: scale(1); }
    42% { transform: scale(1.3); }
    70% { transform: scale(1); }
}

.mechanism-trio {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    padding: 8px 12px;
}

.mechanism-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 22px;
    gap: 8px;
}

.mechanism-divider {
    width: 1px;
    height: 56px;
    background: var(--border-subtle);
    flex-shrink: 0;
}

.mechanism-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
}

/* Enzyme icon (green) */
.mechanism-item[data-mech="enzyme"] .mechanism-icon {
    background: rgba(0, 212, 170, 0.1);
    border-color: rgba(0, 212, 170, 0.2);
    color: var(--accent-primary);
}

/* Heat icon (amber) */
.mechanism-item[data-mech="heat"] .mechanism-icon {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--phase-2);
}

/* Shield icon (purple) */
.mechanism-item[data-mech="shield"] .mechanism-icon {
    background: rgba(167, 139, 250, 0.1);
    border-color: rgba(167, 139, 250, 0.2);
    color: var(--phase-4);
}

.mechanism-name {
    font-size: var(--font-size-sm);
    font-weight: 700;
    color: var(--text-primary);
}

.mechanism-desc {
    font-size: 0.65rem;
    color: var(--text-muted);
    line-height: 1.4;
    max-width: 140px;
}


/* ----- Step 3: DNase Digestion Visual ----- */
.dnase-illustration {
    position: relative;
    width: 260px;
    height: 120px;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.dna-strand {
    position: absolute;
    color: var(--phase-2);
    opacity: 0.8;
    animation: dnaFade 6s infinite;
}

@keyframes dnaFade {
    0%, 40% { opacity: 0.8; transform: scale(1); }
    45%, 90% { opacity: 0; transform: scale(0.95); }
    95%, 100% { opacity: 0.8; transform: scale(1); }
}

.enzyme-scissors {
    position: absolute;
    color: var(--accent-secondary);
    opacity: 0;
}

.enzyme-1 {
    top: -20px;
    left: 80px;
    animation: scissorChop1 6s infinite;
}

.enzyme-2 {
    bottom: -20px;
    right: 80px;
    animation: scissorChop2 6s infinite;
}

@keyframes scissorChop1 {
    0%, 20% { opacity: 0; top: -20px; transform: rotate(0deg) scale(1); }
    25% { opacity: 1; top: 35px; transform: rotate(-15deg) scale(1.2); }
    30% { opacity: 1; top: 35px; transform: rotate(15deg) scale(0.9); }
    35% { opacity: 0; top: 35px; transform: rotate(0deg) scale(1); }
    100% { opacity: 0; }
}

@keyframes scissorChop2 {
    0%, 25% { opacity: 0; bottom: -20px; transform: rotate(0deg) scale(1); }
    30% { opacity: 1; bottom: 35px; transform: rotate(15deg) scale(1.2); }
    35% { opacity: 1; bottom: 35px; transform: rotate(-15deg) scale(0.9); }
    40% { opacity: 0; bottom: 35px; transform: rotate(0deg) scale(1); }
    100% { opacity: 0; }
}

.dna-fragments {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.frag {
    position: absolute;
    width: 12px;
    height: 4px;
    background: var(--phase-2);
    border-radius: 2px;
    opacity: 0;
}

.frag:nth-child(1) { top: 40px; left: 60px; animation: fragScatter 6s infinite 2.2s; }
.frag:nth-child(2) { top: 45px; left: 100px; animation: fragScatter 6s infinite 2.3s; }
.frag:nth-child(3) { top: 50px; left: 140px; animation: fragScatter 6s infinite 2.4s; }
.frag:nth-child(4) { top: 55px; left: 80px; animation: fragScatter 6s infinite 2.35s; }
.frag:nth-child(5) { top: 60px; left: 120px; animation: fragScatter 6s infinite 2.45s; }
.frag:nth-child(6) { top: 45px; left: 160px; animation: fragScatter 6s infinite 2.5s; }

@keyframes fragScatter {
    0% { opacity: 0; transform: translate(0, 0) rotate(0deg); }
    10% { opacity: 1; transform: translate(0, 0) rotate(0deg); }
    40% { opacity: 0; transform: translate(var(--tx, 20px), var(--ty, 30px)) rotate(var(--rot, 45deg)); }
    100% { opacity: 0; }
}

.frag:nth-child(odd) { --tx: -30px; --ty: 40px; --rot: -60deg; }
.frag:nth-child(even) { --tx: 40px; --ty: 50px; --rot: 90deg; }


/* ----- Step 4: RNA Binding Visual ----- */
.binding-illustration {
    position: relative;
    width: 260px;
    height: 120px;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.silica-membrane {
    position: absolute;
    bottom: 10px;
    width: 80%;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 5px;
}

.silica-membrane span {
    position: absolute;
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
}

.pore {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
}

.rna-strands {
    position: absolute;
    top: 15px;
    color: var(--phase-3);
}

.rna-s1 {
    position: absolute;
    left: -40px;
    animation: rnaBind1 4s ease-in-out forwards infinite;
}

.rna-s2 {
    position: absolute;
    left: 10px;
    top: -10px;
    animation: rnaBind2 4s ease-in-out forwards infinite;
}

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

@keyframes rnaBind2 {
    0% { transform: translateY(0); }
    60%, 100% { transform: translateY(45px); }
}

.salt-ions {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.ion {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--phase-1);
    color: var(--bg-primary);
    font-size: 10px;
    font-weight: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    opacity: 0;
}

.ion-1 { left: 30%; animation: ionBind 4s forwards infinite 0.2s; }
.ion-2 { left: 50%; animation: ionBind 4s forwards infinite 0.4s; }
.ion-3 { left: 70%; animation: ionBind 4s forwards infinite 0.6s; }

@keyframes ionBind {
    0% { top: 0; opacity: 0; }
    20% { opacity: 1; }
    50%, 100% { top: 55px; opacity: 1; }
}


/* ----- Steps 5 & 6: Wash Visuals ----- */
.wash-illustration {
    position: relative;
    width: 220px;
    height: 140px;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 15px;
    overflow: hidden;
}

.spin-column-outline {
    position: relative;
    width: 60px;
    height: 80px;
    border: 2px solid var(--border-medium);
    border-top: none;
    border-radius: 0 0 30px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.column-membrane {
    width: 100%;
    height: 12px;
    background: var(--phase-3);
    margin-top: 40px;
    box-shadow: 0 0 10px var(--phase-3);
}

.column-membrane.clean {
    box-shadow: 0 0 15px var(--phase-3), inset 0 0 5px rgba(255,255,255,0.8);
}

.column-drip {
    position: absolute;
    bottom: -15px;
    width: 6px;
    height: 12px;
    border-radius: 3px;
    opacity: 0;
}

.drip-dirty {
    background: #d4a853; /* Dirty/Contaminant color */
    animation: dripFall 2s ease-in infinite;
}

.drip-clean {
    background: rgba(255, 255, 255, 0.7); /* Clean ethanol color */
    animation: dripFall 2s ease-in infinite;
}

.d2 { animation-delay: 1s; }

@keyframes dripFall {
    0% { bottom: -5px; opacity: 1; height: 6px; }
    80% { bottom: -45px; opacity: 1; height: 16px; }
    100% { bottom: -50px; opacity: 0; height: 6px; }
}

.contaminant-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.c-part {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #e57373; /* Protein color */
    border-radius: 50%;
    opacity: 0;
}

.c1 { left: 45%; animation: particleWash 2s infinite 0.3s; }
.c2 { left: 50%; background: #d4a853; animation: particleWash 2s infinite 0.7s; }
.c3 { left: 55%; animation: particleWash 2s infinite 1.1s; }

@keyframes particleWash {
    0% { top: 40px; opacity: 0; }
    20% { opacity: 1; }
    100% { top: 120px; opacity: 0; }
}


/* ----- Step 7: Dry Spin Visual ----- */
.centrifuge-illustration {
    position: relative;
    width: 220px;
    height: 140px;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.rotor {
    position: relative;
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border-medium);
    border-radius: 50%;
    animation: rotorSpin 1s linear infinite;
}

@keyframes rotorSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.rotor-center {
    position: absolute;
    width: 16px;
    height: 16px;
    background: var(--border-strong);
    border-radius: 50%;
    z-index: 2;
}

.tube-slot {
    position: absolute;
    width: 14px;
    height: 30px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
}

.s1 { top: -15px; left: 31px; transform: rotate(0deg); }
.s2 { bottom: -15px; left: 31px; transform: rotate(180deg); }
.s3 { top: 23px; left: -15px; transform: rotate(-90deg); }
.s4 { top: 23px; right: -15px; transform: rotate(90deg); }

.tube {
    width: 100%;
    height: 100%;
    background: rgba(0, 180, 216, 0.2);
    border-radius: 2px;
}

.spin-lines {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.spin-ring {
    color: var(--accent-secondary);
    animation: pulseRing 1s ease-out infinite;
}

@keyframes pulseRing {
    0% { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(1.3); opacity: 0; }
}


/* ----- Step 8: Elution Visual ----- */
.elution-illustration {
    position: relative;
    width: 220px;
    height: 140px;
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding-bottom: 15px;
    overflow: hidden;
}

.elution-tube {
    position: relative;
    width: 60px;
    height: 100px;
    border: 2px solid var(--border-medium);
    border-top: none;
    border-radius: 0 0 30px 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.column-insert {
    position: absolute;
    top: -20px;
    width: 50px;
    height: 60px;
    border: 2px solid var(--border-strong);
    border-top: none;
    border-radius: 0 0 20px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.silica-eluting {
    width: 100%;
    height: 10px;
    background: rgba(255, 255, 255, 0.4);
    margin-top: 30px;
}

.water-drop {
    position: absolute;
    top: -15px;
    width: 8px;
    height: 12px;
    background: var(--phase-3);
    border-radius: 50%;
    opacity: 0;
    animation: waterHydrate 3s infinite;
}

@keyframes waterHydrate {
    0% { top: -20px; opacity: 1; transform: scale(1); }
    30% { top: 25px; opacity: 1; transform: scale(1); }
    40% { top: 25px; opacity: 0; transform: scale(3, 0.5); }
    100% { top: 25px; opacity: 0; }
}

.rna-drip {
    position: absolute;
    bottom: -15px;
    color: var(--phase-4);
    opacity: 0;
    animation: rnaFall 3s infinite 1s;
}

@keyframes rnaFall {
    0% { bottom: -5px; opacity: 1; }
    40% { bottom: -35px; opacity: 1; }
    50% { bottom: -40px; opacity: 0; }
    100% { bottom: -40px; opacity: 0; }
}

.pure-rna-pool {
    position: absolute;
    bottom: 5px;
    color: var(--phase-4);
    opacity: 0.8;
    animation: poolSwell 3s infinite 1s;
}

@keyframes poolSwell {
    0%, 40% { transform: scale(0.8); opacity: 0.5; }
    50%, 100% { transform: scale(1); opacity: 0.9; }
}


/* ----- Final Synthesis (Step 9) ----- */
.final-synthesis-card {
    background: var(--bg-card);
    border: 1px solid var(--bg-card-border);
    border-radius: var(--radius-lg);
    padding: 60px 40px;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.success-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(0, 212, 170, 0.15);
    border: 2px solid rgba(0, 212, 170, 0.3);
    color: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    animation: successPop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes successPop {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.step-header {
    text-align: left;
    margin-bottom: 40px;
    position: relative;
}

.step-phase-tag {
    display: inline-block;
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Phase Colors */
.step-phase-tag[data-phase="1"] { color: var(--phase-1); border-color: rgba(239, 71, 111, 0.3); }
.step-phase-tag[data-phase="2"] { color: var(--phase-2); border-color: rgba(255, 209, 102, 0.3); }
.step-phase-tag[data-phase="3"] { color: var(--phase-3); border-color: rgba(6, 214, 160, 0.3); }
.step-phase-tag[data-phase="4"] { color: var(--phase-4); border-color: rgba(17, 138, 178, 0.3); }

.step-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.step-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-primary);
}

.step-title-sub {
    font-weight: 400;
    color: var(--text-secondary);
    font-size: var(--font-size-xl);
}

.btn-watch-video {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-medium);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.btn-watch-video:hover {
    background: rgba(239, 71, 111, 0.15);
    border-color: var(--phase-1);
    color: var(--phase-1);
}

.btn-watch-video svg {
    fill: currentColor;
}

.final-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.final-desc {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 480px;
}

.final-actions {
    display: flex;
    gap: 16px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 12px;
}

.restart-btn {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: var(--font-size-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all var(--transition-normal);
}

.restart-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-secondary);
    transform: translateY(-2px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: var(--font-size-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all var(--transition-normal);
    text-decoration: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-secondary);
    transform: translateY(-2px);
}


/* =====================================================
   NAVIGATION
   ===================================================== */
.step-nav {
    position: relative;
    z-index: 100;
    height: var(--nav-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--content-padding);
    background: rgba(6, 10, 19, 0.9);
    backdrop-filter: blur(var(--glass-blur));
    -webkit-backdrop-filter: blur(var(--glass-blur));
    border-top: 1px solid var(--border-subtle);
}

.step-indicator {
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.04em;
}

/* Nav Buttons */
.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: all var(--transition-fast);
    min-width: 130px;
    justify-content: center;
}

/* Back Button (ghost) */
.btn-back {
    background: var(--glass-bg-strong);
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: var(--border-accent);
}

.btn-back.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateX(-10px);
}

/* Next Button (primary) */
.btn-next {
    background: var(--accent-gradient);
    color: var(--bg-primary);
    border: none;
    box-shadow: var(--shadow-glow);
}

.btn-next:hover {
    box-shadow: var(--accent-glow-strong), var(--shadow-md);
    transform: translateY(-1px);
}

.btn-next:active {
    transform: translateY(0);
}


/* =====================================================
   SCROLLBAR
   ===================================================== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}


/* =====================================================
   VIDEO MODAL
   ===================================================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(7, 11, 25, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 420px; /* Perfect width for vertical shorts */
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    z-index: 10000;
    animation: modalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

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

.close-modal {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    transition: all 0.2s;
}

.close-modal:hover {
    background: var(--phase-1);
    border-color: var(--phase-1);
    color: #fff;
    transform: rotate(90deg);
}

.video-container {
    position: relative;
    width: 100%;
    aspect-ratio: 9 / 16; /* Changed to 9:16 for YouTube Shorts / vertical videos */
    max-height: 85vh; /* Ensure it doesn't overflow the screen height */
    background: #000;
    display: flex;
    justify-content: center;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}


/* =====================================================
   RESPONSIVE (MOBILE OPTIMIZATION)
   ===================================================== */

/* ---- Tablet & Small Laptops (max-width: 900px) ---- */
@media (max-width: 900px) {
    :root {
        --content-max-width: 100%;
        --content-padding: 20px;
    }
}

/* ---- Mobile Devices (max-width: 768px) ---- */
@media (max-width: 768px) {
    :root {
        --content-padding: 16px;
        --header-height: 64px;
        --nav-height: 64px;
        --font-size-hero: 2rem;
        --font-size-3xl: 1.75rem;
        --font-size-2xl: 1.35rem;
        --font-size-xl: 1.1rem;
        --font-size-lg: 1rem;
        --font-size-base: 0.925rem;
        --font-size-sm: 0.8rem;
        --font-size-xs: 0.68rem;
    }

    /* ----- Progress Header (Compact Mobile) ----- */
    .progress-header {
        height: var(--header-height);
        padding: 0 12px;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .progress-header::-webkit-scrollbar {
        display: none;
    }

    .progress-track {
        min-width: max-content;
        gap: 0;
        padding: 0 8px;
    }

    .phase-label {
        font-size: 0.55rem;
        letter-spacing: 0.04em;
    }

    .step-dot {
        width: 26px;
        height: 26px;
        font-size: 0.6rem;
    }

    .dot-connector {
        width: 12px;
    }

    .phase-connector {
        width: 16px;
        margin: 14px 2px 0;
    }

    /* ----- Step Container ----- */
    .step {
        padding: var(--content-padding);
        align-items: flex-start;
        justify-content: flex-start;
        padding-top: 20px;
    }

    .step-content {
        gap: 20px;
    }

    .landing-wrapper {
        padding-top: 10px;
    }

    /* ----- Landing Page ----- */
    .landing-wrapper {
        gap: 28px;
        padding: 10px 0;
    }

    .landing-hero {
        max-width: 100%;
    }

    .hero-badge {
        padding: 6px 14px;
        font-size: 0.6rem;
        margin-bottom: 20px;
    }

    .hero-title {
        font-size: var(--font-size-2xl);
        margin-bottom: 12px;
    }

    .hero-title br {
        display: none;
    }

    .hero-subtitle {
        font-size: var(--font-size-sm);
        margin-bottom: 8px;
    }

    .hero-description {
        font-size: var(--font-size-xs);
        max-width: 100%;
    }

    .creator-badge {
        padding: 8px 16px;
        margin-top: 20px;
    }

    .creator-text {
        font-size: var(--font-size-xs);
    }

    /* Blueprint Flow → Stack Vertically */
    .blueprint-flow {
        flex-direction: column;
        gap: 10px;
    }

    .bp-arrow-connector {
        transform: rotate(90deg);
        padding: 2px 0;
    }

    .bp-phase {
        width: 100%;
    }

    .bp-phase-body {
        padding: 12px 14px 14px;
    }

    .bp-phase-name {
        font-size: var(--font-size-sm);
        margin: 4px 0 10px;
    }

    .bp-step-list {
        gap: 6px;
    }

    .bp-step-item {
        font-size: 0.7rem;
    }

    .bp-step-num {
        width: 18px;
        height: 18px;
        font-size: 0.55rem;
    }

    /* Landing CTA */
    .landing-actions {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    .begin-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 24px;
        font-size: var(--font-size-base);
    }

    .begin-btn.btn-pdf {
        width: 100%;
        justify-content: center;
    }

    /* ----- Step Header ----- */
    .step-header {
        text-align: left;
        margin-bottom: 20px;
    }

    .step-phase-tag {
        font-size: 0.65rem;
        padding: 5px 10px;
        margin-bottom: 10px;
    }

    .step-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .step-title {
        font-size: var(--font-size-xl);
        line-height: 1.3;
    }

    .step-title-sub {
        font-size: var(--font-size-base);
        display: block;
        margin-top: 4px;
    }

    .btn-watch-video {
        width: 100%;
        justify-content: center;
        padding: 10px 16px;
        font-size: var(--font-size-xs);
    }

    /* ----- Info Cards → Single Column ----- */
    .step-cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .info-card {
        padding: 16px;
    }

    .info-card-header {
        gap: 10px;
        margin-bottom: 10px;
    }

    .info-card-icon {
        width: 34px;
        height: 34px;
    }

    .info-card-icon svg {
        width: 16px;
        height: 16px;
    }

    .info-card-label {
        font-size: var(--font-size-xs);
    }

    .info-card-subtitle {
        font-size: 0.6rem;
    }

    .info-card-text {
        font-size: var(--font-size-xs);
        line-height: 1.6;
    }

    /* ----- Step Visuals — Scale Down ----- */
    .step-visual {
        padding: 4px 0;
    }

    .deparaf-illustration {
        width: 200px;
        height: 100px;
    }

    .dnase-illustration {
        width: 220px;
        height: 100px;
    }

    .binding-illustration {
        width: 220px;
        height: 100px;
    }

    .wash-illustration {
        width: 180px;
        height: 120px;
    }

    .centrifuge-illustration {
        width: 180px;
        height: 120px;
    }

    .elution-illustration {
        width: 180px;
        height: 120px;
    }

    /* Mechanism Trio → Column Layout */
    .mechanism-trio {
        flex-direction: column;
        width: 100%;
        padding: 6px 10px;
    }

    .mechanism-item {
        padding: 10px 16px;
        flex-direction: row;
        text-align: left;
        gap: 12px;
    }

    .mechanism-icon {
        width: 40px;
        height: 40px;
        border-radius: 10px;
        flex-shrink: 0;
    }

    .mechanism-icon svg {
        width: 20px;
        height: 20px;
    }

    .mechanism-name {
        font-size: var(--font-size-xs);
    }

    .mechanism-desc {
        font-size: 0.6rem;
        max-width: none;
    }

    .mechanism-divider {
        width: 100%;
        height: 1px;
    }

    /* ----- Final Synthesis ----- */
    .final-synthesis-card {
        padding: 40px 20px;
        gap: 18px;
    }

    .success-icon {
        width: 60px;
        height: 60px;
    }

    .success-icon svg {
        width: 32px;
        height: 32px;
    }

    .final-title {
        font-size: var(--font-size-xl);
    }

    .final-desc {
        font-size: var(--font-size-sm);
        max-width: 100%;
    }

    .final-actions {
        flex-direction: column;
        width: 100%;
    }

    .restart-btn,
    .btn-secondary {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
    }

    /* ----- Bottom Navigation ----- */
    .step-nav {
        height: var(--nav-height);
        padding: 0 12px;
        gap: 8px;
    }

    .step-indicator {
        font-size: var(--font-size-xs);
    }

    .nav-btn {
        min-width: auto;
        padding: 10px 16px;
        font-size: var(--font-size-xs);
        gap: 6px;
    }

    .nav-btn svg {
        width: 14px;
        height: 14px;
    }

    /* ----- Video Modal (Full-Screen on Mobile) ----- */
    .modal {
        padding: 0;
    }

    .modal-overlay {
        background: rgba(0, 0, 0, 0.97);
    }

    .modal-content {
        max-width: 100%;
        width: 100%;
        height: 100%;
        border-radius: 0;
        border: none;
        background: #000;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        overflow: hidden;
    }

    .close-modal {
        position: fixed;
        top: env(safe-area-inset-top, 12px);
        right: 12px;
        width: 44px;
        height: 44px;
        z-index: 10001;
        background: rgba(0, 0, 0, 0.7);
        border: 1px solid rgba(255, 255, 255, 0.3);
    }

    .close-modal svg {
        width: 20px;
        height: 20px;
    }

    .video-container {
        width: 100%;
        aspect-ratio: 9 / 16;
        max-height: 85vh;
        max-height: 85dvh;
        height: auto;
    }

    .video-container iframe {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
    }
}


/* ---- Small Phones (max-width: 480px) ---- */
@media (max-width: 480px) {
    :root {
        --content-padding: 14px;
        --header-height: 56px;
        --nav-height: 58px;
        --font-size-3xl: 1.45rem;
        --font-size-2xl: 1.2rem;
        --font-size-xl: 1rem;
        --font-size-lg: 0.9rem;
        --font-size-base: 0.85rem;
        --font-size-sm: 0.75rem;
        --font-size-xs: 0.65rem;
    }

    /* Tighter progress header */
    .progress-header {
        padding: 0 8px;
    }

    .phase-label {
        font-size: 0.5rem;
    }

    .step-dot {
        width: 22px;
        height: 22px;
        font-size: 0.55rem;
    }

    .dot-connector {
        width: 8px;
    }

    .phase-connector {
        width: 10px;
    }

    /* Landing refinements */
    .hero-badge {
        padding: 5px 12px;
        font-size: 0.55rem;
        margin-bottom: 16px;
    }

    .hero-title {
        font-size: 1.3rem;
    }

    .hero-badge-dot {
        width: 6px;
        height: 6px;
    }

    .blueprint-header {
        gap: 10px;
        margin-bottom: 16px;
    }

    .blueprint-line {
        width: 30px;
    }

    .blueprint-title {
        font-size: 0.55rem;
    }

    .bp-phase-body {
        padding: 10px 12px 12px;
    }

    /* Step visuals — smaller */
    .deparaf-illustration {
        width: 180px;
        height: 85px;
    }

    .dnase-illustration,
    .binding-illustration {
        width: 200px;
        height: 85px;
    }

    .wash-illustration,
    .centrifuge-illustration,
    .elution-illustration {
        width: 160px;
        height: 105px;
    }

    .mechanism-item {
        padding: 8px 12px;
    }

    /* Info cards tighter */
    .info-card {
        padding: 14px;
    }

    /* Final synthesis tighter */
    .final-synthesis-card {
        padding: 28px 16px;
        gap: 14px;
    }

    .success-icon {
        width: 50px;
        height: 50px;
    }

    .success-icon svg {
        width: 26px;
        height: 26px;
    }

    /* Nav buttons tighter */
    .nav-btn {
        padding: 8px 12px;
        font-size: 0.6rem;
    }

    .step-indicator {
        font-size: 0.6rem;
    }

    /* Creator badge */
    .creator-badge {
        padding: 6px 12px;
        margin-top: 16px;
    }
}


/* ---- Very Small Phones (max-width: 360px) ---- */
@media (max-width: 360px) {
    :root {
        --content-padding: 12px;
        --font-size-2xl: 1.1rem;
        --font-size-xl: 0.95rem;
    }

    .hero-title {
        font-size: 1.15rem;
    }

    .hero-badge {
        font-size: 0.5rem;
        padding: 4px 10px;
    }

    .step-dot {
        width: 20px;
        height: 20px;
        font-size: 0.5rem;
        border-width: 1.5px;
    }

    .dot-connector {
        width: 6px;
    }

    .phase-connector {
        width: 8px;
    }

    .phase-label {
        font-size: 0.45rem;
    }

    .deparaf-illustration {
        width: 160px;
        height: 75px;
    }

    .dnase-illustration,
    .binding-illustration {
        width: 170px;
        height: 75px;
    }

    .wash-illustration,
    .centrifuge-illustration,
    .elution-illustration {
        width: 140px;
        height: 95px;
    }

    .begin-btn {
        padding: 12px 18px;
        font-size: var(--font-size-sm);
    }

    .nav-btn {
        padding: 8px 10px;
        font-size: 0.55rem;
    }
}


/* ---- Landscape Mobile Fix ---- */
@media (max-height: 500px) and (orientation: landscape) {
    .progress-header {
        height: 50px;
    }

    .step-nav {
        height: 50px;
    }

    .step-dot {
        width: 22px;
        height: 22px;
    }

    .landing-wrapper {
        gap: 16px;
    }

    .hero-title {
        font-size: 1.3rem;
        margin-bottom: 8px;
    }

    .hero-subtitle,
    .hero-description {
        display: none;
    }

    .blueprint-flow {
        flex-direction: row;
    }

    .bp-arrow-connector {
        display: flex;
    }

    .step-content {
        gap: 12px;
    }

    .step-cards {
        grid-template-columns: 1fr 1fr;
    }

    .info-card {
        padding: 12px;
    }

    .final-synthesis-card {
        padding: 20px;
    }
}


/* ---- Safe Area Insets (Notched Phones) ---- */
@supports (padding: max(0px)) {
    .progress-header {
        padding-top: max(0px, env(safe-area-inset-top));
    }

    .step-nav {
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }

    .step {
        padding-left: max(var(--content-padding), env(safe-area-inset-left));
        padding-right: max(var(--content-padding), env(safe-area-inset-right));
    }
}


/* ---- Touch Optimization ---- */
@media (hover: none) and (pointer: coarse) {
    .step-dot {
        min-width: 36px;
        min-height: 36px;
    }

    .nav-btn {
        min-height: 44px;
    }

    .begin-btn {
        min-height: 48px;
    }

    .btn-watch-video {
        min-height: 44px;
    }

    /* Disable hover transforms on touch devices */
    .info-card:hover {
        transform: none;
    }

    .bp-phase:hover {
        transform: none;
    }

    /* Add active state for touch feedback */
    .nav-btn:active {
        transform: scale(0.97);
        opacity: 0.9;
    }

    .step-dot:active {
        transform: scale(0.93);
    }

    .begin-btn:active {
        transform: scale(0.97);
    }

    .info-card:active {
        transform: scale(0.99);
        transition-duration: 100ms;
    }
}
