/* ==========================================================================
   MedLearn Vibrant Light-Mode Scrollytelling Stylesheet
   ========================================================================== */

:root {
    /* Brand Colors */
    --brand-dark: #0b325e;
    --brand-primary: #1a6ce8;
    --brand-primary-light: #eff6ff;
    --brand-primary-hover: #1d4ed8;
    --light-blue: #e0f2fe;

    /* Step Accents */
    --accent-blue: #1a6ce8;
    --accent-blue-bg: #eff6ff;
    --accent-amber: #d97706;
    --accent-amber-bg: #fffbeb;
    --accent-green: #16a34a;
    --accent-green-bg: #f0fdf4;
    --accent-purple: #9333ea;
    --accent-purple-bg: #faf5ff;
    --accent-red: #dc2626;
    --accent-red-bg: #fef2f2;

    /* UI Surfaces (Light Mode Glassmorphism) */
    --bg-app: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-glass: rgba(255, 255, 255, 0.88);
    --bg-inner-card: rgba(241, 245, 249, 0.7);
    --border-color: #e2e8f0;
    --border-hover: #cbd5e1;
    --border-blue: rgba(26, 108, 232, 0.25);

    /* Typography */
    --text-main: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --text-inverse: #ffffff;
    --font-family: "Vazirmatn", system-ui, -apple-system, sans-serif;

    /* Shadows & Elevation */
    --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.04);
    --shadow-md: 0 10px 25px -5px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 45px -10px rgba(15, 23, 42, 0.12);
    --shadow-blue-glow: 0 10px 30px rgba(26, 108, 232, 0.18);
}

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-Light.woff2") format("woff2");
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-ExtraBold.woff2") format("woff2");
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

/* Reset & Global */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
}

html {
    scroll-behavior: smooth;
    background-color: var(--bg-app);
    overflow-x: clip;
    width: 100%;
    max-width: 100%;
}

body.light-theme {
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: clip;
    width: 100%;
    max-width: 100%;
    position: relative;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    font-family: inherit;
    border: none;
    background: none;
}

/* Canvas Background */
#scrolly-canvas-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
}

/* Ambient Background Glow Shapes */
.ambient-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.45;
    max-width: 100%;
    overflow: hidden;
}

.glow-blue {
    top: -120px;
    right: 8%;
    width: 550px;
    height: 550px;
    background: radial-gradient(circle, rgba(26, 108, 232, 0.16) 0%, rgba(224, 242, 254, 0) 70%);
}

.glow-indigo {
    top: 700px;
    left: 4%;
    width: 650px;
    height: 650px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.14) 0%, rgba(238, 242, 255, 0) 70%);
}

.glow-emerald {
    top: 1500px;
    right: 6%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.12) 0%, rgba(240, 253, 244, 0) 70%);
}

/* Top Scroll Progress Indicator Bar */
.scroll-progress-bar {
    position: fixed;
    top: 0;
    right: 0;
    height: 4px;
    width: 0%;
    background: linear-gradient(90deg, var(--brand-primary), #3b82f6, #06b6d4);
    z-index: 1000;
    box-shadow: 0 0 10px rgba(26, 108, 232, 0.3);
    transition: width 0.1s linear;
}

/* Main Page Container */
.home-page {
    max-width: 1240px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 24px 80px;
    display: flex;
    flex-direction: column;
    gap: 90px;
    position: relative;
    z-index: 1;
    overflow-x: clip;
}

/* Glassmorphism Light Utility Classes */
.light-glass {
    background: var(--bg-surface-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
}

.light-inner-card {
    background: var(--bg-inner-card);
    border: 1px solid rgba(226, 232, 240, 0.8);
    border-radius: 16px;
    padding: 16px;
}

.light-pill {
    background: var(--brand-primary-light);
    border: 1px solid var(--border-blue);
    border-radius: 100px;
    padding: 6px 16px;
}

.light-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--brand-primary-light);
    color: var(--brand-primary);
    border: 1px solid var(--border-blue);
    padding: 6px 18px;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 700;
}

.light-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

/* Floating Navbar */
.home-topbar {
    position: sticky;
    top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 26px;
    z-index: 900;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.home-topbar.scrolled {
    box-shadow: var(--shadow-md);
    border-color: var(--border-hover);
}

.home-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon-wrapper {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--brand-primary-light);
    border: 1px solid var(--border-blue);
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-brand-icon {
    width: 24px;
    height: 24px;
    color: var(--brand-primary);
}

.brand-title-group {
    display: flex;
    flex-direction: column;
}

.home-brand-text {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--brand-dark), var(--brand-primary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.brand-subtitle {
    font-size: 0.68rem;
    color: var(--brand-primary);
    letter-spacing: 0.5px;
    font-weight: 700;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.home-user-tag {
    font-size: 0.88rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.home-user-tag.guest {
    background: var(--bg-app);
    border-color: var(--border-color);
}

.topbar-btn {
    padding: 9px 20px;
    border-radius: 100px;
    font-size: 0.88rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.25s ease;
}

.btn-nav-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-nav-outline:hover {
    background: var(--bg-app);
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.btn-nav-primary {
    background: var(--brand-primary);
    color: var(--text-inverse);
    box-shadow: 0 4px 14px rgba(26, 108, 232, 0.22);
}

.btn-nav-primary:hover {
    background: var(--brand-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(26, 108, 232, 0.32);
}

/* Hero Section */
.home-hero {
    text-align: center;
    max-width: 860px;
    margin: 30px auto 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 26px;
}

.hero-title {
    font-size: 3.2rem;
    font-weight: 800;
    line-height: 1.4;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.hero-title .word {
    display: inline-block;
    position: relative;
}

.word-learn { color: var(--accent-blue); }
.word-assess { color: var(--accent-amber); }
.word-review { color: var(--accent-purple); }

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    font-weight: 400;
    max-width: 700px;
    line-height: 1.75;
}

.hero-stats {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-top: 8px;
}

.stat-pill {
    padding: 10px 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.stat-pill:hover {
    transform: translateY(-3px);
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-md);
}

.stat-icon-box {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
}

.stat-icon-box.blue { background: var(--accent-blue-bg); color: var(--accent-blue); }
.stat-icon-box.amber { background: var(--accent-amber-bg); color: var(--accent-amber); }
.stat-icon-box.emerald { background: var(--accent-green-bg); color: var(--accent-green); }

.stat-info {
    display: flex;
    flex-direction: column;
    text-align: right;
}

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

.stat-lbl {
    font-size: 0.76rem;
    color: var(--text-muted);
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

.hero-cta-btn {
    padding: 15px 30px;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.25s ease;
}

.btn-primary-lg {
    background: linear-gradient(135deg, var(--brand-primary), #2563eb);
    color: var(--text-inverse);
    box-shadow: var(--shadow-blue-glow);
}

.btn-primary-lg:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 32px rgba(26, 108, 232, 0.32);
}

.btn-secondary-lg {
    background: var(--bg-surface);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary-lg:hover {
    background: var(--brand-primary-light);
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.arrow-float {
    animation: bounceDown 1.5s infinite;
}

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

/* Scrollytelling Section */
.home-scrollytelling {
    display: flex;
    flex-direction: column;
    gap: 45px;
}

.scrolly-header {
    text-align: center;
    max-width: 650px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.section-title {
    font-size: 1.95rem;
    font-weight: 800;
    color: var(--text-main);
}

.section-desc {
    font-size: 0.98rem;
    color: var(--text-secondary);
}

/* Scrolly Split Container - Spatial 3D Perspective */
.scrolly-container {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 44px;
    align-items: start;
    position: relative;
    perspective: 1600px;
    perspective-origin: 50% 30%;
    transform-style: preserve-3d;
}

.scrolly-visual-column {
    position: relative;
    height: 100%;
    transform-style: preserve-3d;
}

.sticky-visual-stage {
    position: sticky;
    top: 125px;
    width: 100%;
    z-index: 10;
    transform-style: preserve-3d;
}

.visual-stage-card.spatial-stage-3d {
    min-height: 470px;
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
    transition: border-color 0.4s ease, box-shadow 0.4s ease, transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 25px 60px -15px rgba(15, 23, 42, 0.12), 0 0 35px rgba(26, 108, 232, 0.08);
}

.visual-stage-card.spatial-stage-3d:hover {
    border-color: rgba(26, 108, 232, 0.4);
    box-shadow: 0 30px 70px -10px rgba(26, 108, 232, 0.2), 0 0 45px rgba(26, 108, 232, 0.15);
    transform: translateY(-4px);
}

/* Spatial Background Grid & Light Beam */
.spatial-bg-grid {
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(to right, rgba(26, 108, 232, 0.04) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(26, 108, 232, 0.04) 1px, transparent 1px);
    background-size: 24px 24px;
    pointer-events: none;
    z-index: 0;
    transform: translateZ(-20px) scale(1.1);
    opacity: 0.7;
}

.spatial-light-beam {
    position: absolute;
    top: -50%;
    left: -20%;
    width: 140%;
    height: 200%;
    background: radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, 0.4) 0%, rgba(255, 255, 255, 0) 70%);
    pointer-events: none;
    z-index: 0;
    transform: rotate(-15deg) translateZ(-10px);
}

.spatial-glow-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(45px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.35;
    animation: spatialFloat 8s infinite alternate ease-in-out;
}

.spatial-glow-orb.orb-1 {
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(26, 108, 232, 0.4), transparent 70%);
    top: -20px;
    right: -20px;
    transform: translateZ(-30px);
}

.spatial-glow-orb.orb-2 {
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, rgba(147, 51, 234, 0.35), transparent 70%);
    bottom: -40px;
    left: -40px;
    animation-delay: -4s;
    transform: translateZ(-40px);
}

@keyframes spatialFloat {
    0% { transform: translateY(0) scale(1) translateZ(-30px); }
    100% { transform: translateY(18px) scale(1.1) translateZ(-10px); }
}

/* Stage Panels - Z-Axis Spatial Tunnel Transitions */
.stage-panel {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateZ(-240px) rotateY(-18deg) rotateX(12deg) scale(0.84);
    transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1), transform 0.55s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.55s;
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    transform-style: preserve-3d;
    z-index: 1;
}

.stage-panel.active {
    opacity: 1;
    visibility: visible;
    transform: translateZ(12px) rotateY(0deg) rotateX(0deg) scale(1);
    position: relative;
    z-index: 2;
}

.panel-header.light-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 22px;
    background: rgba(241, 245, 249, 0.9);
    border-bottom: 1px solid var(--border-color);
    transform: translateZ(18px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.03);
}

.panel-dots {
    display: flex;
    gap: 6px;
    transform: translateZ(10px);
}

.panel-dots .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.dot.red { background: #ef4444; }
.dot.yellow { background: #f59e0b; }
.dot.green { background: #10b981; }

.panel-title-tag {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    transform: translateZ(14px);
}

.panel-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    transform-style: preserve-3d;
    transform: translateZ(24px);
}

/* Booklet Stage ACS Condition Tabs */
.condition-tabs-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.condition-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
}

.condition-tabs {
    display: flex;
    gap: 6px;
    background: #f1f5f9;
    padding: 3px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.condition-tab {
    padding: 6px 12px;
    border-radius: 9px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-secondary);
    background: transparent;
    transition: all 0.2s ease;
}

.condition-tab:hover {
    color: var(--brand-primary);
}

.condition-tab.active {
    background: #ffffff;
    color: var(--brand-primary);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

/* Condition Content Panels */
.condition-content {
    display: none;
    flex-direction: column;
    gap: 12px;
    animation: fadeInCondition 0.35s ease;
}

.condition-content.active {
    display: flex;
}

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

.demo-content-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.box-header-flex h4 {
    font-size: 1rem;
    color: var(--brand-dark);
}

.light-tag.blue {
    font-size: 0.72rem;
    color: var(--brand-primary);
    background: var(--brand-primary-light);
    border: 1px solid var(--border-blue);
    padding: 2px 10px;
    border-radius: 6px;
    font-weight: 700;
}

.demo-content-box p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.demo-text-target {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.84rem;
    line-height: 1.6;
    transition: all 0.3s ease;
}

.demo-text-target.highlight-master {
    background: #fef08a;
    color: #854d0e;
    border-right: 4px solid #eab308;
}

.demo-text-target.highlight-exam {
    background: #fed7aa;
    color: #9a3412;
    border-right: 4px solid #f97316;
}

.demo-text-target.highlight-key {
    background: #bbf7d0;
    color: #166534;
    border-right: 4px solid #22c55e;
}

.demo-note-sticky {
    background: #eff6ff;
    color: #1e40af;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Quiz Stage Demo */
.quiz-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.demo-quiz-badge {
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--accent-amber);
    background: var(--accent-amber-bg);
    border: 1px solid rgba(217, 119, 6, 0.2);
    padding: 4px 10px;
    border-radius: 6px;
}

.timer-badge {
    font-size: 0.76rem;
    color: var(--text-muted);
    background: var(--bg-app);
    padding: 4px 10px;
    border-radius: 6px;
}

.demo-quiz-question {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.6;
}

.demo-quiz-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.demo-quiz-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--bg-surface);
    font-size: 0.88rem;
    color: var(--text-main);
    text-align: right;
    transition: all 0.2s ease;
}

.opt-key {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--bg-app);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.demo-quiz-option:hover {
    border-color: var(--brand-primary);
    background: var(--brand-primary-light);
    transform: translateX(-4px);
}

.demo-quiz-option.correct {
    border-color: var(--accent-green);
    background: var(--accent-green-bg);
    color: var(--accent-green);
}

.demo-quiz-option.correct .opt-key {
    background: var(--accent-green);
    color: #ffffff;
}

.demo-quiz-option.incorrect {
    border-color: var(--accent-red);
    background: var(--accent-red-bg);
    color: var(--accent-red);
}

.demo-quiz-option.incorrect .opt-key {
    background: var(--accent-red);
    color: #ffffff;
}

.demo-quiz-feedback {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 0.82rem;
    background: var(--bg-app);
    color: var(--text-secondary);
    border: 1px dashed var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.demo-quiz-feedback.success {
    background: var(--accent-green-bg);
    color: var(--accent-green);
    border: 1px solid var(--accent-green);
}

.demo-quiz-feedback.error {
    background: var(--accent-red-bg);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

/* Flashcard Stage Demo */
.flashcard-demo {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.flashcard-deck-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.deck-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.deck-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 100px;
    overflow: hidden;
}

.deck-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #9333ea, #a855f7);
    border-radius: 100px;
    transition: width 0.3s ease;
}

/* Interactive 3D Flip Card */
.interactive-flashcard {
    perspective: 1000px;
    cursor: pointer;
    user-select: none;
    min-height: 240px;
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 240px;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.interactive-flashcard.flipped .flashcard-inner {
    transform: rotateY(180deg);
}

.flashcard-face {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.interactive-flashcard:hover .flashcard-face {
    border-color: var(--accent-purple);
    box-shadow: 0 8px 24px rgba(147, 51, 234, 0.15);
}

.flashcard-front {
    background: #faf5ff;
    border: 1px solid rgba(147, 51, 234, 0.2);
}

.flashcard-back {
    background: #ffffff;
    border: 1px solid rgba(16, 185, 129, 0.3);
    transform: rotateY(180deg);
}

.card-tag {
    font-size: 0.74rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    align-self: flex-start;
}

.card-tag.purple {
    background: #f3e8ff;
    color: #7e22ce;
}

.card-tag.green {
    background: #dcfce7;
    color: #15803d;
}

.card-question-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 4px 0;
}

.question-icon {
    font-size: 1.4rem;
    margin-top: 2px;
}

.card-question-box h5 {
    font-size: 0.96rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.6;
}

.card-hint {
    font-size: 0.78rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    background: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px dashed var(--border-color);
}

.card-answer-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.answer-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.84rem;
    color: var(--text-main);
}

.answer-list li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    line-height: 1.5;
}

.card-confidence-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.conf-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
}

.conf-btns {
    display: flex;
    gap: 6px;
}

.conf-btn {
    padding: 5px 10px;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.conf-btn.hard {
    background: #fef2f2;
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.3);
}

.conf-btn.good {
    background: #fffbeb;
    color: #d97706;
    border-color: rgba(217, 119, 6, 0.3);
}

.conf-btn.easy {
    background: #f0fdf4;
    color: #16a34a;
    border-color: rgba(22, 163, 74, 0.3);
}

.conf-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.flashcard-status-msg {
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: var(--bg-app);
    border: 1px dashed var(--border-color);
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.flashcard-status-msg.active {
    background: #faf5ff;
    color: #7e22ce;
    border-color: #c084fc;
}

/* Right Side Story Steps Column */
.scrolly-story-column {
    display: flex;
    flex-direction: column;
    gap: 160px;
    padding-right: 32px;
    position: relative;
}

/* Progress Rail */
.progress-rail {
    position: absolute;
    right: 0;
    top: 20px;
    bottom: 20px;
    width: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
}

.progress-line-bg {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
    z-index: 1;
}

.progress-fill-line {
    width: 100%;
    height: 0%;
    background: linear-gradient(180deg, var(--accent-blue), var(--accent-amber), var(--accent-green));
    transition: height 0.3s ease;
}

.progress-node {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--bg-surface);
    border: 2px solid var(--border-color);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    transition: all 0.3s ease;
}

.progress-node.active {
    border-color: var(--brand-primary);
    background: var(--brand-primary);
    color: var(--text-inverse);
    box-shadow: 0 0 12px rgba(26, 108, 232, 0.3);
    transform: scale(1.2);
}

/* Story Steps */
.story-step {
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    opacity: 0.5;
    transform: translateX(16px) scale(0.97);
    transition: all 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.story-step.active {
    opacity: 1;
    transform: translateX(0) scale(1);
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-lg);
}

.step-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 14px;
    border-radius: 100px;
    font-size: 0.78rem;
    font-weight: 700;
    align-self: flex-start;
}

.step-blue { background: var(--accent-blue-bg); color: var(--accent-blue); }
.step-amber { background: var(--accent-amber-bg); color: var(--accent-amber); }
.step-emerald { background: var(--accent-green-bg); color: var(--accent-green); }
.step-purple { background: var(--accent-purple-bg); color: var(--accent-purple); }

.step-title {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text-main);
}

.step-description {
    font-size: 0.96rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.step-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.step-feat-tag {
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: var(--bg-app);
    border: 1px solid var(--border-color);
    padding: 5px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Primary Action Cards Hub */
.home-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.action-card {
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: all 0.3s ease;
    transform-style: preserve-3d;
}

.action-card:hover {
    transform: translateY(-6px);
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-md);
}

.action-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--brand-primary-light);
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
}

.variant-indigo .action-icon { background: #e0e7ff; color: #4338ca; }
.variant-emerald .action-icon { background: var(--accent-green-bg); color: var(--accent-green); }
.variant-red .action-icon { background: var(--accent-red-bg); color: var(--accent-red); }

.action-card h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
}

.action-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.home-btn {
    padding: 12px 22px;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    transition: all 0.25s ease;
}

.btn-blue { background: var(--brand-primary); color: #ffffff; }
.btn-indigo { background: #4338ca; color: #ffffff; }
.btn-emerald { background: var(--accent-green); color: #ffffff; }
.btn-red { background: var(--accent-red); color: #ffffff; width: 100%; border: none; }

.home-btn:hover {
    transform: translateX(-4px);
    opacity: 0.92;
}

/* Product Modules Showcase */
.home-modules {
    display: flex;
    flex-direction: column;
    gap: 36px;
}

.modules-header {
    text-align: center;
}

.section-subtitle {
    font-size: 0.96rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.module-card {
    padding: 26px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    transition: all 0.3s ease;
    transform-style: preserve-3d;
}

.module-card:hover {
    transform: translateY(-5px);
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-md);
}

.module-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--brand-primary-light);
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.tint-amber .module-icon { background: var(--accent-amber-bg); color: var(--accent-amber); }
.tint-emerald .module-icon { background: var(--accent-green-bg); color: var(--accent-green); }
.tint-purple .module-icon { background: var(--accent-purple-bg); color: var(--accent-purple); }

.module-card h4 {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
}

.module-card p {
    font-size: 0.86rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.module-link-arrow {
    font-size: 0.84rem;
    font-weight: 700;
    color: var(--brand-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    transition: transform 0.2s ease;
}

.module-card:hover .module-link-arrow {
    transform: translateX(-6px);
}

.module-soon {
    position: absolute;
    top: 18px;
    left: 18px;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--bg-app);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 2px 8px;
    border-radius: 100px;
}

/* Footer */
.home-footer {
    padding: 28px 36px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-brand p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.footer-links {
    display: flex;
    gap: 20px;
    font-size: 0.86rem;
    color: var(--text-secondary);
}

.footer-links a:hover {
    color: var(--brand-primary);
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
}

/* Floating Back To Top Button */
.back-to-top {
    position: fixed;
    bottom: 28px;
    left: 28px;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--bg-surface-glass);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(12px);
    color: var(--brand-primary);
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 990;
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--brand-primary);
    color: #ffffff;
    transform: translateY(-3px);
}

/* Text Utility Colors */
.text-blue { color: var(--accent-blue); }
.text-amber { color: var(--accent-amber); }
.text-emerald { color: var(--accent-green); }
.text-red { color: var(--accent-red); }
.text-muted { color: var(--text-muted); }

/* Responsive & Mobile Tall-Screen Optimizations */
@media (max-width: 992px) {
    .scrolly-container {
        display: block;
        position: relative;
        perspective: none;
        transform-style: flat;
    }

    .scrolly-visual-column {
        position: sticky;
        top: 90px;
        z-index: 100;
        margin-bottom: 28px;
        transform-style: flat;
        pointer-events: auto;
    }

    .scrolly-visual-column::after {
        content: '';
        display: block;
        height: 20px;
        background: var(--bg-app);
        pointer-events: none;
        border-radius: 0 0 16px 16px;
    }

    .sticky-visual-stage {
        position: relative;
        top: 0;
        width: 100%;
        transform-style: flat;
    }

    .visual-stage-card.spatial-stage-3d {
        min-height: auto;
        height: clamp(245px, 33vh, 280px);
        overflow: hidden;
        border-radius: 20px;
        box-shadow: 0 12px 32px -8px rgba(15, 23, 42, 0.14), 0 0 20px rgba(26, 108, 232, 0.1);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    /* Mobile Visual Stage High-Density UI Scaling */
    .panel-header.light-header {
        padding: 7px 12px;
    }

    .panel-dots {
        gap: 4px;
    }

    .panel-dots .dot {
        width: 8px;
        height: 8px;
    }

    .panel-title-tag {
        font-size: 0.72rem;
        gap: 6px;
    }

    .panel-body {
        padding: 10px;
        gap: 6px;
        overflow-y: auto;
    }

    .condition-tabs-wrapper {
        gap: 4px;
    }

    .condition-label {
        font-size: 0.68rem;
    }

    .condition-tabs {
        padding: 2px;
        border-radius: 8px;
    }

    .condition-tab {
        padding: 2px 7px;
        font-size: 0.68rem;
        border-radius: 5px;
    }

    .demo-content-box.light-inner-card {
        padding: 8px 10px;
        gap: 5px;
        border-radius: 12px;
    }

    .box-header-flex h4 {
        font-size: 0.84rem;
    }

    .light-tag.blue {
        font-size: 0.64rem;
        padding: 1px 5px;
        border-radius: 4px;
    }

    .demo-content-box p {
        font-size: 0.76rem;
        line-height: 1.4;
    }

    .demo-text-target {
        padding: 5px 8px;
        font-size: 0.72rem;
        line-height: 1.38;
        border-radius: 6px;
    }

    .demo-note-sticky {
        padding: 5px 8px;
        font-size: 0.7rem;
        gap: 6px;
        border-radius: 6px;
    }

    .quiz-status-row {
        margin-bottom: 2px;
    }

    .demo-quiz-badge, .timer-badge {
        font-size: 0.68rem;
        padding: 2px 6px;
        border-radius: 5px;
    }

    .demo-quiz-question {
        font-size: 0.8rem;
        line-height: 1.38;
    }

    .demo-quiz-options {
        gap: 5px;
    }

    .demo-quiz-option {
        padding: 5px 8px;
        font-size: 0.74rem;
        border-radius: 8px;
        gap: 6px;
    }

    .opt-key {
        width: 18px;
        height: 18px;
        font-size: 0.65rem;
    }

    .demo-quiz-feedback {
        padding: 5px 8px;
        font-size: 0.72rem;
        border-radius: 6px;
    }

    .flashcard-demo {
        gap: 6px;
    }

    .deck-info {
        font-size: 0.7rem;
    }

    .interactive-flashcard, .flashcard-inner {
        min-height: 150px;
    }

    .flashcard-face {
        padding: 8px 10px;
        gap: 5px;
        border-radius: 12px;
    }

    .card-tag {
        font-size: 0.66rem;
        padding: 2px 5px;
        border-radius: 4px;
    }

    .card-question-box {
        gap: 6px;
        padding: 0;
    }

    .question-icon {
        font-size: 1rem;
    }

    .card-question-box h5 {
        font-size: 0.8rem;
        line-height: 1.35;
    }

    .card-hint {
        font-size: 0.7rem;
        padding: 3px 6px;
        border-radius: 5px;
    }

    .answer-list {
        font-size: 0.73rem;
        gap: 3px;
    }

    .answer-list li {
        gap: 5px;
    }

    .card-confidence-actions {
        padding-top: 4px;
        gap: 4px;
    }

    .conf-title {
        font-size: 0.66rem;
    }

    .conf-btns {
        gap: 4px;
    }

    .conf-btn {
        padding: 2px 5px;
        font-size: 0.64rem;
        border-radius: 5px;
    }

    .flashcard-status-msg {
        padding: 5px 8px;
        font-size: 0.7rem;
        border-radius: 6px;
    }

    .scrolly-story-column {
        position: relative;
        z-index: 10;
        padding-right: 0;
        display: flex;
        flex-direction: column;
        gap: 40vh;
        padding-top: 2vh;
        padding-bottom: 25vh;
    }

    .progress-rail {
        display: none;
    }

    .story-step {
        padding: 18px 16px;
        gap: 10px;
        border-radius: 18px;
        opacity: 0.55;
        transform: translateY(12px) scale(0.98);
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(12px);
        box-shadow: var(--shadow-md);
        scroll-margin-top: 360px;
    }

    .story-step.active {
        opacity: 1;
        transform: translateY(0) scale(1);
        border-color: var(--brand-primary);
        box-shadow: 0 12px 30px -5px rgba(26, 108, 232, 0.2);
    }

    .step-title {
        font-size: 1.4rem;
    }

    .step-description {
        font-size: 0.9rem;
        line-height: 1.65;
    }

    .step-features {
        gap: 6px;
    }

    .step-feat-tag {
        padding: 4px 10px;
        font-size: 0.74rem;
        border-radius: 6px;
    }
}

@media (max-width: 640px) {
    .home-page {
        gap: 44px;
        padding-inline: 14px;
        padding-top: max(12px, env(safe-area-inset-top));
        padding-bottom: max(50px, env(safe-area-inset-bottom));
    }

    .home-topbar {
        top: 8px;
        padding: 8px 14px;
        border-radius: 18px;
    }

    .home-brand {
        gap: 8px;
    }

    .brand-icon-wrapper {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .home-brand-icon {
        width: 20px;
        height: 20px;
    }

    .home-brand-text {
        font-size: 1.15rem;
    }

    .brand-subtitle {
        font-size: 0.6rem;
    }

    .topbar-actions {
        gap: 6px;
    }

    .topbar-btn {
        padding: 6px 12px;
        font-size: 0.78rem;
        border-radius: 100px;
    }

    .topbar-btn i {
        font-size: 0.8rem;
    }

    .home-user-tag {
        display: none;
    }

    .glow-blue {
        width: 280px;
        height: 280px;
        right: 0;
        top: -60px;
    }

    .glow-indigo {
        width: 280px;
        height: 280px;
        left: 0;
        top: 400px;
    }

    .glow-emerald {
        width: 280px;
        height: 280px;
        right: 0;
        top: 1000px;
    }

    .stat-pill {
        min-width: 0;
    }

    .home-hero {
        margin-top: 10px;
        gap: 16px;
    }

    .hero-badge {
        font-size: 0.78rem;
        padding: 4px 14px;
    }

    .hero-title {
        font-size: clamp(1.65rem, 6.5vw, 2.2rem);
        line-height: 1.35;
    }

    .hero-subtitle {
        font-size: 0.9rem;
        line-height: 1.6;
        max-width: 100%;
    }

    .hero-stats {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 6px;
        width: 100%;
    }

    .stat-pill {
        padding: 8px 4px;
        flex-direction: column;
        text-align: center;
        gap: 4px;
        border-radius: 12px;
    }

    .stat-icon-box {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
        border-radius: 8px;
    }

    .stat-info {
        text-align: center;
    }

    .stat-num {
        font-size: 0.88rem;
    }

    .stat-lbl {
        font-size: 0.65rem;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
        gap: 10px;
    }

    .hero-cta-btn {
        width: 100%;
        justify-content: center;
        padding: 12px 18px;
        font-size: 0.92rem;
        min-height: 48px;
        border-radius: 14px;
    }

    .scroll-cue-wrapper {
        margin-top: 4px;
    }

    .scroll-cue-pill {
        padding: 6px 14px;
        font-size: 0.78rem;
    }

    .scrolly-header {
        gap: 8px;
    }

    .section-title {
        font-size: 1.45rem;
    }

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

    .home-actions {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .action-card {
        padding: 20px 16px;
        gap: 10px;
        border-radius: 18px;
    }

    .action-icon {
        width: 40px;
        height: 40px;
        font-size: 1.15rem;
        border-radius: 10px;
    }

    .action-card h3 {
        font-size: 1.1rem;
    }

    .action-card p {
        font-size: 0.85rem;
    }

    .home-btn {
        padding: 10px 16px;
        font-size: 0.84rem;
        min-height: 44px;
    }

    .home-modules {
        gap: 24px;
    }

    .modules-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .module-card {
        padding: 20px 16px;
        gap: 10px;
        border-radius: 18px;
    }

    .module-icon {
        width: 38px;
        height: 38px;
        font-size: 1.1rem;
        border-radius: 10px;
    }

    .module-card h4 {
        font-size: 1rem;
    }

    .module-card p {
        font-size: 0.82rem;
    }

    .home-footer {
        padding: 20px 16px;
        gap: 14px;
        border-radius: 18px;
    }

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

    .footer-links {
        gap: 14px;
        font-size: 0.8rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .back-to-top {
        bottom: 18px;
        left: 18px;
        width: 42px;
        height: 42px;
        font-size: 1rem;
    }
}

/* Extra Tight Mobile Viewports (< 400px width) */
@media (max-width: 400px) {
    .home-topbar {
        padding: 8px 10px;
    }

    .brand-subtitle {
        display: none;
    }

    .home-brand-text {
        font-size: 1.05rem;
    }

    .topbar-btn span {
        display: none;
    }

    .topbar-btn {
        padding: 8px 10px;
        min-width: 36px;
        justify-content: center;
    }

    .stat-lbl {
        font-size: 0.6rem;
    }

    .stat-num {
        font-size: 0.82rem;
    }

    .stat-pill {
        padding: 6px 2px;
    }
}

/* Modern Tall Smartphone Screens (19.5:9 & 20:9 Aspect Ratios) */
@media (max-width: 640px) and (min-aspect-ratio: 1/2) {
    .scrolly-visual-column {
        top: 90px;
    }

    .visual-stage-card.spatial-stage-3d {
        height: clamp(265px, 35vh, 305px);
    }
}

