/* ═══════════════════════════════════════════════════════════════════════
   Finablo — Duolingo-Inspired Design System
   Research-backed: Nunito font, trust-blue primary, light mode default
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── CSS Variables (Design Tokens) ─────────────────────────────────── */
:root {
    /* Primary: Trust-blue (Duolingo/Khan Academy proven) */
    --primary: #1865F2;
    --primary-dark: #0B4DC9;
    --primary-light: #E8F0FE;
    --primary-hover: #1457D6;

    /* Success / Correct */
    --success: #58CC02;
    --success-dark: #43C000;
    --success-light: #D7FFB8;

    /* Error / Incorrect */
    --error: #FF4B4B;
    --error-dark: #D33131;
    --error-light: #FFDFE0;

    /* Reward / Streaks */
    --gold: #FFC800;
    --orange: #FF9600;

    /* Accent (purple for special) */
    --accent: #8B5CF6;
    --accent-light: #EDE9FE;

    /* Neutrals (Light Mode) */
    --text-primary: #21242C;
    --text-secondary: #6F6F6F;
    --text-muted: #AFAFAF;
    --border: #E5E5E5;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F7F7F7;
    --bg-card: #FFFFFF;
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-button: 0 4px 0;

    /* Typography */
    --font-primary: 'Nunito', 'Source Sans Pro', system-ui, -apple-system, sans-serif;
    --text-xs: 0.8125rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;
    --text-md: 1.0625rem;
    --text-lg: 1.25rem;
    --text-xl: 1.5rem;
    --text-2xl: 1.75rem;
    --text-3xl: 2.25rem;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Border radius */
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-full: 9999px;

    /* Layout */
    --max-width: 480px;
    --max-width-lg: 720px;
    --nav-height: 64px;
}

/* ─── Dark Mode ─────────────────────────────────────────────────────── */
html.dark {
    --text-primary: #E8E8F0;
    --text-secondary: #A0A0B0;
    --text-muted: #6B6B80;
    --border: #2E2E40;
    --bg-primary: #1A1A2E;
    --bg-secondary: #16162A;
    --bg-card: #1E2A4A;
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

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

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

/* ─── App Container ─────────────────────────────────────────────────── */
#app {
    min-height: 100vh;
    min-height: 100dvh;
    padding-bottom: var(--nav-height);
}

/* ─── Screen System ─────────────────────────────────────────────────── */
.screen {
    display: none;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: var(--space-6) var(--space-4);
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

.screen.wide {
    max-width: var(--max-width-lg);
}

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

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

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* ─── Loading Screen ────────────────────────────────────────────────── */
#loading-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
}

.loading-content {
    text-align: center;
}

.loading-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
}

.logo-icon {
    font-size: 2.5rem;
}

.logo-text {
    font-size: var(--text-3xl);
    font-weight: 800;
    color: var(--primary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ─── Landing Page ──────────────────────────────────────────────────── */
.landing {
    text-align: center;
    padding-top: var(--space-10);
}

.landing.wide {
    max-width: 720px;
}

.landing-hero h1 {
    font-size: var(--text-3xl);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    line-height: 1.2;
}

.landing-hero .subtitle {
    font-size: var(--text-base);
    color: var(--text-secondary);
    margin-bottom: var(--space-6);
    line-height: 1.6;
}

.landing-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
}

.landing-login-link {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: var(--space-2);
}

.landing-login-link a {
    font-weight: 700;
    color: var(--primary);
}

/* ─── Landing Sections ─────────────────────────────────────────────── */
.landing-section {
    margin-top: var(--space-10);
    margin-bottom: var(--space-4);
}

.landing-section-title {
    font-size: var(--text-xl);
    font-weight: 800;
    text-align: center;
    margin-bottom: var(--space-6);
    color: var(--text-primary);
}

/* ─── Landing Path Cards Grid ──────────────────────────────────────── */
.landing-paths-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}

@media (min-width: 500px) {
    .landing-paths-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.landing-path-card {
    padding: var(--space-4);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    cursor: pointer;
    transition: transform 0.15s;
    text-align: left;
}

.landing-path-card:hover {
    transform: translateY(-2px);
}

.landing-path-card-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.landing-path-card-icon {
    font-size: 1.5rem;
}

.landing-path-card-name {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text-primary);
}

.landing-path-card-meta {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.landing-path-card-desc {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-2);
}

.landing-path-card-cta {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--primary);
}

/* ─── Landing Stats Row ────────────────────────────────────────────── */
.landing-stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
    text-align: center;
}

.landing-stat {
    padding: var(--space-4);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.landing-stat-value {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--primary);
}

.landing-stat-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: var(--space-1);
}

/* ─── Landing Sample Module ────────────────────────────────────────── */
.landing-sample-card {
    padding: var(--space-5);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    border-left: 4px solid var(--primary);
    text-align: left;
    cursor: pointer;
    transition: transform 0.15s;
}

.landing-sample-card:hover {
    transform: translateY(-2px);
}

.landing-sample-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.landing-sample-title {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.landing-sample-hook {
    font-size: var(--text-base);
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ─── Landing Bottom CTA ──────────────────────────────────────────── */
.landing-bottom-cta {
    text-align: center;
    padding: var(--space-8) var(--space-4);
    margin-top: var(--space-8);
    background: var(--primary-light);
    border-radius: var(--radius-md);
}

.landing-bottom-cta h2 {
    font-size: var(--text-2xl);
    font-weight: 800;
    margin-bottom: var(--space-2);
}

.landing-bottom-cta .subtitle {
    font-size: var(--text-base);
    color: var(--text-secondary);
    margin-bottom: var(--space-5);
}

/* ─── Guest Gate Banner (Path Detail) ────────────────────────────────── */
.guest-gate-banner {
    text-align: center;
    padding: var(--space-6) var(--space-4);
    background: linear-gradient(135deg, var(--primary-light), rgba(88, 204, 2, 0.06));
    border-radius: var(--radius-md);
    margin: var(--space-4) 0;
    border: 2px dashed var(--primary);
}

.guest-gate-banner h3 {
    font-size: var(--text-lg);
    font-weight: 800;
    margin-bottom: var(--space-2);
}

.guest-gate-banner p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.guest-gate-icon {
    font-size: 2rem;
    margin-bottom: var(--space-2);
}

.guest-path-hint {
    font-size: var(--text-sm);
    color: var(--primary);
    font-weight: 600;
    margin-bottom: var(--space-4);
    text-align: center;
}

/* ─── Guest Complete Prompt ──────────────────────────────────────────── */
.guest-complete-prompt {
    text-align: center;
    padding: var(--space-4);
    width: 100%;
}

.guest-complete-icon {
    font-size: 1.5rem;
    margin-bottom: var(--space-2);
}

.guest-complete-title {
    font-weight: 700;
    font-size: var(--text-base);
    margin-bottom: var(--space-1);
}

.guest-complete-text {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

/* ─── Guest Profile ────────────────────────────────────────────────── */
.guest-profile-card {
    max-width: 480px;
    margin: var(--space-6) auto;
    text-align: center;
}

.guest-profile-avatar {
    font-size: 3rem;
    margin-bottom: var(--space-3);
}

.guest-profile-card h2 {
    font-size: var(--text-xl);
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.guest-profile-subtitle {
    color: var(--text-secondary);
    font-size: var(--text-base);
    margin-bottom: var(--space-6);
}

.guest-profile-benefits {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    text-align: left;
}

.guest-profile-benefits h3 {
    font-size: var(--text-base);
    font-weight: 600;
    margin-bottom: var(--space-3);
}

.guest-profile-benefits ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.guest-profile-benefits li {
    font-size: var(--text-sm);
    line-height: 1.5;
}

.guest-profile-login {
    margin-top: var(--space-4);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.guest-profile-login a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

/* ─── Buttons ───────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-lg);
    font-weight: 700;
    font-size: var(--text-base);
    transition: all 0.15s ease;
    text-align: center;
    width: 100%;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-button) var(--primary-dark);
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-primary:active {
    box-shadow: none;
    transform: translateY(4px);
}

.btn-primary:disabled {
    background: var(--text-muted);
    box-shadow: var(--shadow-button) #999;
    cursor: not-allowed;
}

.btn-success {
    background: var(--success);
    color: #fff;
    box-shadow: var(--shadow-button) var(--success-dark);
}

.btn-success:hover {
    background: #4CB801;
}

.btn-success:active {
    box-shadow: none;
    transform: translateY(4px);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary-light);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.btn-sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
}

/* ─── Forms ─────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: var(--space-4);
}

.form-label {
    display: block;
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.form-input {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    font-size: var(--text-base);
    font-family: var(--font-primary);
    color: var(--text-primary);
    background: var(--bg-card);
    transition: border-color 0.15s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-error {
    color: var(--error);
    font-size: var(--text-sm);
    margin-top: var(--space-1);
}

/* ─── Auth Forms ────────────────────────────────────────────────────── */
.auth-screen {
    padding-top: var(--space-10);
}

.auth-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.auth-header h2 {
    font-size: var(--text-2xl);
    font-weight: 800;
}

.auth-header p {
    color: var(--text-secondary);
    margin-top: var(--space-2);
}

.auth-toggle {
    text-align: center;
    margin-top: var(--space-6);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.auth-toggle a {
    font-weight: 700;
}

.forgot-password {
    text-align: right;
    margin-top: var(--space-1);
    margin-bottom: var(--space-2);
}

.forgot-password a {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: 600;
}

.forgot-password a:hover {
    color: var(--primary);
}

.form-success {
    color: var(--success);
    font-size: var(--text-sm);
    margin-top: var(--space-1);
    font-weight: 600;
}

/* ─── Onboarding ────────────────────────────────────────────────────── */
.onboarding-progress {
    height: 6px;
    background: var(--border);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-8);
    overflow: hidden;
}

.onboarding-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

.onboarding-question {
    font-size: var(--text-xl);
    font-weight: 800;
    text-align: center;
    margin-bottom: var(--space-6);
    line-height: 1.3;
}

.onboarding-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
}

.onboarding-option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    font-size: var(--text-md);
    font-weight: 600;
    color: var(--text-primary);
    transition: all 0.15s;
    cursor: pointer;
    text-align: left;
    width: 100%;
}

.onboarding-option:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.onboarding-option.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 2px var(--primary);
}

.onboarding-option.multi-selected {
    border-color: var(--primary);
    background: var(--primary-light);
}

.onboarding-option .option-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.onboarding-option .option-text {
    flex: 1;
}

.onboarding-option .option-desc {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    font-weight: 400;
}

/* ─── Dashboard ─────────────────────────────────────────────────────── */
.dashboard-header {
    margin-bottom: var(--space-6);
}

.dashboard-greeting {
    font-size: var(--text-2xl);
    font-weight: 800;
}

.dashboard-subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-top: var(--space-1);
}

/* Stats cards */
.stats-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.stat-card {
    text-align: center;
    padding: var(--space-4) var(--space-3);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.stat-value {
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--text-primary);
}

.stat-value.streak {
    color: var(--orange);
}

.stat-value.accuracy {
    color: var(--success);
}

.stat-label {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-top: var(--space-1);
}

/* Today's module card */
.today-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: var(--space-5);
    margin-bottom: var(--space-6);
}

.today-card-label {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-2);
}

.today-card-path {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.today-card-path a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.today-card h3 {
    font-size: var(--text-lg);
    font-weight: 700;
    margin-bottom: var(--space-2);
}

.today-card p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

/* Section headers */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.section-title {
    font-size: var(--text-lg);
    font-weight: 800;
}

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

/* Learning path progress */
.path-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: var(--space-5);
    margin-bottom: var(--space-4);
    cursor: pointer;
    transition: transform 0.15s;
}

.path-card:hover {
    transform: translateY(-2px);
}

.path-card.relevant {
    border-left: 4px solid var(--primary);
}

.path-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.path-icon {
    font-size: 1.5rem;
}

.path-info {
    flex: 1;
}

.path-name {
    font-size: var(--text-base);
    font-weight: 700;
}

.path-meta {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.progress-bar {
    height: 14px;
    background: var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-2);
}

.progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: var(--radius-full);
    transition: width 0.6s ease;
    min-width: 0;
}

.progress-text {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    text-align: right;
}

/* ─── Curriculum Browser ────────────────────────────────────────────── */
.curriculum-filters {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-2);
}

.filter-chip {
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
    white-space: nowrap;
    border: 2px solid var(--border);
    color: var(--text-secondary);
    background: var(--bg-card);
    transition: all 0.15s;
}

.filter-chip.active {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
}

.module-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.module-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.module-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.module-card.completed {
    border-left: 4px solid var(--success);
}

.module-card.next-up {
    border-left: 4px solid var(--primary);
    background: rgba(24, 101, 242, 0.04);
}

.module-card.locked {
    opacity: 0.6;
    cursor: pointer;
}

.module-prereq-hint {
    font-size: var(--text-xs);
    color: var(--text-muted);
    margin-top: var(--space-1);
    font-style: italic;
}

.badge-next-up {
    background: rgba(24, 101, 242, 0.12);
    color: var(--primary);
    font-weight: 700;
    font-size: var(--text-xs);
    padding: 2px 8px;
    border-radius: 99px;
}

.module-status.next {
    background: var(--primary);
    color: white;
    font-weight: 700;
}

.module-status {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.module-status.done {
    background: var(--success-light);
    color: var(--success-dark);
}

.module-status.current {
    background: var(--primary-light);
    color: var(--primary);
    animation: pulse 2s ease infinite;
}

.module-status.locked-icon {
    background: var(--bg-secondary);
    color: var(--text-muted);
}

.module-info {
    flex: 1;
    min-width: 0;
}

.module-title {
    font-size: var(--text-base);
    font-weight: 700;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.35;
}

.module-meta {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    display: flex;
    gap: var(--space-2);
    align-items: center;
    flex-wrap: wrap;
    margin-top: var(--space-1);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 700;
}

.badge-beginner {
    background: var(--success-light);
    color: var(--success-dark);
}

.badge-intermediate {
    background: #FEF3C7;
    color: #92400E;
}

.badge-advanced {
    background: var(--accent-light);
    color: var(--accent);
}

/* ─── Module View ───────────────────────────────────────────────────── */
.module-view {
    max-width: var(--max-width-lg);
}

.module-view-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.back-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    box-shadow: var(--shadow-card);
    font-size: 1.2rem;
    color: var(--text-primary);
}

.module-view-title {
    flex: 1;
    font-size: var(--text-lg);
    font-weight: 800;
}

.module-progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: var(--radius-full);
    margin-bottom: var(--space-6);
    overflow: hidden;
}

.module-progress-fill {
    height: 100%;
    background: var(--success);
    border-radius: var(--radius-full);
    transition: width 0.4s ease;
}

/* Hook */
.module-hook {
    font-size: var(--text-xl);
    font-weight: 800;
    text-align: center;
    color: var(--primary);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    background: var(--primary-light);
    border-radius: var(--radius-md);
    line-height: 1.3;
}

/* Sections */
.module-section {
    margin-bottom: var(--space-6);
}

.module-section-title {
    font-size: var(--text-lg);
    font-weight: 800;
    margin-bottom: var(--space-3);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Explanation bullets */
.module-bullets {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.module-bullets li {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    font-size: var(--text-base);
    line-height: 1.5;
    border-left: 4px solid var(--primary);
}

/* Key takeaway */
.module-takeaway {
    padding: var(--space-5);
    background: var(--gold);
    color: #1a1a2e;
    border-radius: var(--radius-md);
    margin-bottom: var(--space-6);
}

.module-takeaway-label {
    font-size: var(--text-sm);
    font-weight: 800;
    margin-bottom: var(--space-2);
}

.module-takeaway p {
    font-size: var(--text-md);
    font-weight: 700;
}

/* Visualizations */
.viz-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}

@media (min-width: 500px) {
    .viz-grid.multi {
        grid-template-columns: 1fr 1fr;
    }
}

.viz-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: var(--space-4);
    overflow: hidden;
}

.viz-title {
    font-size: var(--text-sm);
    font-weight: 700;
    margin-bottom: var(--space-3);
    text-align: center;
}

.viz-annotation {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    text-align: center;
    margin-top: var(--space-2);
    font-style: italic;
}

/* Bar chart */
.bar-chart { display: flex; flex-direction: column; gap: var(--space-2); }
.bar-row { display: flex; align-items: center; gap: var(--space-2); }
.bar-label { font-size: var(--text-xs); min-width: 80px; max-width: 140px; width: auto; text-align: right; flex-shrink: 0; font-weight: 600; line-height: 1.3; }
.bar-track { flex: 1; height: 24px; background: var(--bg-secondary); border-radius: var(--radius-full); overflow: hidden; }
.bar-fill { height: 100%; border-radius: var(--radius-full); transition: width 0.6s ease; min-width: 4px; }
.bar-value { font-size: var(--text-xs); font-weight: 700; width: 50px; flex-shrink: 0; }

/* Comparison */
.comparison { display: flex; align-items: center; justify-content: center; gap: var(--space-4); flex-wrap: wrap; }
.comparison-item { text-align: center; flex: 1; min-width: 100px; padding: var(--space-4); border-radius: var(--radius-md); border: 3px solid; }
.comparison-value { font-size: var(--text-2xl); font-weight: 800; }
.comparison-label { font-size: var(--text-xs); margin-top: var(--space-1); font-weight: 600; }
.comparison-vs { font-size: var(--text-lg); font-weight: 800; color: var(--text-muted); }

/* Pie chart */
.pie-container { display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.pie { width: 140px; height: 140px; border-radius: 50%; }
.pie-legend { display: flex; flex-direction: column; gap: var(--space-1); }
.pie-legend-item { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); }
.legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

/* Timeline */
.timeline { display: flex; flex-direction: column; gap: 0; position: relative; padding-left: var(--space-6); }
.timeline::before { content: ''; position: absolute; left: 10px; top: 0; bottom: 0; width: 3px; background: var(--border); border-radius: 2px; }
.timeline-item { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) 0; position: relative; }
.timeline-dot { width: 20px; height: 20px; border-radius: 50%; position: absolute; left: calc(-1 * var(--space-6) + 1px); z-index: 1; }
.timeline-value { font-size: var(--text-base); font-weight: 800; }
.timeline-label { font-size: var(--text-xs); color: var(--text-secondary); }

/* ─── Quiz & Scenario (Duolingo 3D buttons) ─────────────────────────── */
.quiz-container, .scenario-container {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: var(--space-5);
}

.quiz-question, .scenario-question {
    font-size: var(--text-md);
    font-weight: 700;
    margin-bottom: var(--space-4);
    line-height: 1.4;
}

.scenario-setup {
    font-size: var(--text-base);
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
    line-height: 1.5;
}

.quiz-options, .scenario-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.quiz-option {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--border);
    border-radius: var(--radius-lg);
    font-weight: 700;
    font-size: var(--text-md);
    box-shadow: 0 4px 0 var(--border);
    cursor: pointer;
    transition: all 0.1s;
    background: var(--bg-card);
    text-align: left;
    width: 100%;
    color: var(--text-primary);
}

.quiz-option:hover:not(.answered) {
    border-color: var(--primary);
    background: var(--primary-light);
}

.quiz-option.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 4px 0 #BBE7FC;
}

.quiz-option.correct {
    border-color: var(--success);
    background: var(--success-light);
    box-shadow: 0 4px 0 var(--success-dark);
    color: var(--success-dark);
}

.quiz-option.incorrect {
    border-color: var(--error);
    background: var(--error-light);
    box-shadow: 0 4px 0 var(--error-dark);
    color: var(--error-dark);
}

.quiz-option.answered {
    pointer-events: none;
    opacity: 0.6;
}

.quiz-option.correct, .quiz-option.incorrect {
    opacity: 1;
}

.quiz-option-label {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-sm);
    font-weight: 800;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.quiz-option.correct .quiz-option-label {
    background: var(--success);
    color: white;
}

.quiz-option.incorrect .quiz-option-label {
    background: var(--error);
    color: white;
}

.quiz-explanation, .scenario-feedback {
    margin-top: var(--space-4);
    padding: var(--space-4);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    line-height: 1.5;
    animation: slideUp 0.3s ease;
}

.quiz-explanation {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.feedback-correct {
    color: var(--success-dark);
}

.feedback-incorrect {
    color: var(--error-dark);
}

/* ─── Further Reading ───────────────────────────────────────────────── */
.further-reading {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.fr-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.15s;
    text-decoration: none;
    color: var(--text-primary);
}

.fr-link:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.fr-icon {
    font-size: 1.2rem;
}

.fr-title {
    flex: 1;
    font-size: var(--text-sm);
    font-weight: 600;
}

.fr-type {
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-transform: uppercase;
}

/* ─── Module Feedback ───────────────────────────────────────────────── */
.module-feedback {
    text-align: center;
    padding: var(--space-5);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    margin-bottom: var(--space-6);
}

.module-feedback p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-3);
}

.feedback-buttons {
    display: flex;
    gap: var(--space-4);
    justify-content: center;
}

.feedback-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 2px solid var(--border);
    background: var(--bg-card);
    transition: all 0.15s;
}

.feedback-btn:hover {
    transform: scale(1.1);
}

.feedback-btn.up:hover, .feedback-btn.up.active {
    border-color: var(--success);
    background: var(--success-light);
}

.feedback-btn.down:hover, .feedback-btn.down.active {
    border-color: var(--error);
    background: var(--error-light);
}

/* ─── Profile ───────────────────────────────────────────────────────── */
.profile-header {
    text-align: center;
    padding: var(--space-6) 0;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    margin: 0 auto var(--space-3);
}

.profile-name {
    font-size: var(--text-xl);
    font-weight: 800;
}

.profile-email {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
    margin-bottom: var(--space-6);
}

.profile-stat {
    text-align: center;
    padding: var(--space-4);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.profile-section {
    margin-bottom: var(--space-6);
}

.profile-section h3 {
    font-size: var(--text-base);
    font-weight: 800;
    margin-bottom: var(--space-3);
}

.profile-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
}

.profile-item-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.profile-item-value {
    font-size: var(--text-sm);
    font-weight: 700;
}

/* ─── Bottom Navigation ─────────────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom);
}

.bottom-nav.hidden {
    display: none;
}

.nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-2) var(--space-4);
    color: var(--text-muted);
    transition: color 0.15s;
    min-width: 60px;
}

.nav-tab.active {
    color: var(--primary);
}

.nav-icon {
    font-size: 1.3rem;
}

.nav-label {
    font-size: var(--text-xs);
    font-weight: 700;
}

/* ─── Utilities ─────────────────────────────────────────────────────── */
.hidden {
    display: none !important;
}

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

.mt-4 {
    margin-top: var(--space-4);
}

.mt-6 {
    margin-top: var(--space-6);
}

.mb-4 {
    margin-bottom: var(--space-4);
}

.mb-6 {
    margin-bottom: var(--space-6);
}

.separator {
    height: 1px;
    background: var(--border);
    margin: var(--space-6) 0;
}

.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-4);
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
}

.empty-state p {
    font-size: var(--text-base);
}

/* Toast / Alert */
.toast {
    position: fixed;
    top: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 700;
    z-index: 1000;
    animation: slideDown 0.3s ease, fadeOut 0.3s ease 2.5s forwards;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast.success {
    background: var(--success);
    color: white;
}

.toast.error {
    background: var(--error);
    color: white;
}

.toast.info {
    background: var(--primary);
    color: white;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes fadeOut {
    to { opacity: 0; }
}

/* ─── Desktop / Tablet ──────────────────────────────────────────────── */
@media (min-width: 768px) {
    #app {
        padding-bottom: 0;
    }

    .bottom-nav {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        right: auto;
        width: 220px;
        height: 100vh;
        flex-direction: column;
        justify-content: flex-start;
        padding: var(--space-8) 0;
        border-top: none;
        border-right: 1px solid var(--border);
    }

    .bottom-nav::before {
        content: '📊 Finablo';
        font-size: var(--text-lg);
        font-weight: 800;
        color: var(--primary);
        padding: 0 var(--space-6);
        margin-bottom: var(--space-8);
    }

    .nav-tab {
        flex-direction: row;
        gap: var(--space-3);
        padding: var(--space-3) var(--space-6);
        width: 100%;
        justify-content: flex-start;
        border-radius: 0;
    }

    .nav-tab.active {
        background: var(--primary-light);
        border-right: 3px solid var(--primary);
    }

    .nav-label {
        font-size: var(--text-base);
    }

    .screen {
        margin-left: 220px;
        padding: var(--space-8) var(--space-6);
    }

}

/* ═══════════════════════════════════════════════════════════════════════
   LESSON MODAL OVERLAY
   ═══════════════════════════════════════════════════════════════════════ */

.lesson-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lesson-modal.hidden {
    display: none;
}

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

.lesson-card {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-primary);
    border-radius: 1rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    animation: modalSlideUp 0.3s ease;
    width: 95%;
    height: 90dvh;
    max-height: 90vh;
}

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

/* Tablet */
@media (min-width: 768px) {
    .lesson-card {
        width: 90%;
        max-width: 600px;
        height: 88vh;
    }
}

/* Laptop */
@media (min-width: 1024px) {
    .lesson-card {
        max-width: 720px;
        height: 90vh;
    }
}

/* Large desktop */
@media (min-width: 1440px) {
    .lesson-card {
        max-width: 780px;
        height: 90vh;
    }
}

/* ═══════════════════════════════════════════════════════════════════════
   STEP-BY-STEP LESSON FLOW
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── Step Header (progress bar + counter) ──────────────────────────── */
.step-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    border-radius: 1rem 1rem 0 0;
}

.step-header .back-btn {
    font-size: 1.1rem;
    padding: var(--space-1) var(--space-2);
    min-width: auto;
    border: none;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
}

.step-progress-bar {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 99px;
    overflow: hidden;
}

.step-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 99px;
    transition: width 0.4s ease;
}

.step-counter {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ─── Step Viewport (slide area) ─────────────────────────────────────── */
.step-viewport {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

.step-card {
    padding: var(--space-5) var(--space-4);
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
    animation-fill-mode: forwards;
}

/* ─── Slide Animations ───────────────────────────────────────────────── */
@keyframes slideInLeft {
    from { transform: translateX(100%); opacity: 0.5; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideInRight {
    from { transform: translateX(-100%); opacity: 0.5; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideOutLeft {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(-100%); opacity: 0; }
}
@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

.step-card.slide-in-left { animation: slideInLeft 0.3s ease; }
.step-card.slide-in-right { animation: slideInRight 0.3s ease; }
.step-card.slide-out-left { animation: slideOutLeft 0.28s ease; }
.step-card.slide-out-right { animation: slideOutRight 0.28s ease; }

/* ─── Step Footer (prev/next) ────────────────────────────────────────── */
.step-footer {
    display: flex;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border);
    background: var(--bg-primary);
    flex-shrink: 0;
    padding-bottom: max(var(--space-3), env(safe-area-inset-bottom));
    border-radius: 0 0 1rem 1rem;
}

.step-nav-btn {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    font-weight: 700;
}

.step-nav-btn:disabled {
    opacity: 0.3;
    pointer-events: none;
}

/* ─── Step Content ───────────────────────────────────────────────────── */
.step-content {
    min-height: 200px;
}

.step-section-label {
    font-size: var(--text-sm);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: var(--space-4);
}

/* ─── Intro Step ─────────────────────────────────────────────────────── */
.step-intro {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: var(--space-8);
}

.step-intro-title {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: var(--space-3);
    color: var(--text);
}

.step-intro-subtitle {
    font-size: var(--text-sm);
    color: var(--text-muted);
    margin-bottom: var(--space-5);
}

.step-intro-hook {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    line-height: 1.5;
    margin-bottom: var(--space-4);
}

.step-intro-prereqs {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    padding: var(--space-2) var(--space-4);
    background: rgba(245, 158, 11, 0.08);
    border-radius: var(--radius-md);
}

/* ─── Famous Example Step ────────────────────────────────────────────── */
.step-famous {
    padding-top: var(--space-4);
}

.step-famous-name {
    font-size: 1.3rem;
    font-weight: 800;
    color: #f59e0b;
    margin-bottom: var(--space-3);
}

.step-famous-story {
    font-size: var(--text-base);
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.step-famous-wow {
    font-weight: 700;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border-left: 3px solid #f59e0b;
    font-size: var(--text-sm);
}

/* ─── Explain Step ───────────────────────────────────────────────────── */
.step-explain {
    padding-top: var(--space-4);
}

.step-bullets {
    list-style: none;
    padding: 0;
    margin: 0;
}

.step-bullets li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--text-primary);
    border-bottom: none;
    background: var(--surface);
    border-left: 3px solid var(--primary);
    border-radius: 0 8px 8px 0;
    margin-bottom: var(--space-2);
    animation: fadeSlideIn 0.4s ease both;
}
.step-bullets li:nth-child(even) { border-left-color: #16a34a; }
.step-bullets li:nth-child(1) { animation-delay: 0s; }
.step-bullets li:nth-child(2) { animation-delay: 0.1s; }
.step-bullets li:nth-child(3) { animation-delay: 0.15s; }
.step-bullets li:nth-child(4) { animation-delay: 0.2s; }
.step-bullets li:nth-child(5) { animation-delay: 0.25s; }

.step-bullets li:last-child {
    margin-bottom: 0;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateX(-12px); }
    to   { opacity: 1; transform: translateX(0); }
}

.bullet-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    font-size: var(--text-sm);
    font-weight: 800;
    flex-shrink: 0;
}

/* ─── Takeaway Step ──────────────────────────────────────────────────── */
.step-takeaway {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-top: var(--space-8);
}

.step-takeaway-icon {
    font-size: 3rem;
    margin-bottom: var(--space-3);
}

.step-takeaway-label {
    font-size: var(--text-sm);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--success);
    margin-bottom: var(--space-3);
}

.step-takeaway-text {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.5;
    color: var(--text);
    background: rgba(88, 204, 2, 0.06);
    border: 2px solid var(--success);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}

/* ─── Chart Step ─────────────────────────────────────────────────────── */
.step-chart {
    padding-top: var(--space-2);
}

.step-chart-title {
    font-size: var(--text-lg);
    font-weight: 800;
    text-align: center;
    margin-bottom: var(--space-4);
    color: var(--text-primary);
    line-height: 1.3;
}

.step-chart .viz-card {
    margin: 0;
    box-shadow: none;
    background: transparent;
}

/* Hide viz-title inside step-chart to avoid duplication with step-chart-title */
.step-chart .viz-title {
    display: none;
}

/* ─── Scenario Step ──────────────────────────────────────────────────── */
.step-scenario {
    padding-top: var(--space-2);
}

.step-scenario-badge {
    display: inline-block;
    font-size: var(--text-xs);
    font-weight: 700;
    padding: var(--space-1) var(--space-3);
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 99px;
    margin-bottom: var(--space-3);
}

.step-scenario-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: var(--space-3);
}

.step-scenario-narrative {
    font-size: var(--text-base);
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.step-scenario-insight {
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary);
    margin-bottom: var(--space-4);
}

.step-scenario-chart {
    margin-bottom: var(--space-4);
}

/* ─── Step Questions (shared quiz/scenario MCQ) ──────────────────────── */
.step-question {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
}

.step-question-prompt {
    font-size: var(--text-base);
    margin-bottom: var(--space-3);
    color: var(--text);
}

.step-question-options {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.step-question-feedback {
    margin-top: var(--space-3);
    font-size: var(--text-sm);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

.feedback-correct { color: var(--success); }
.feedback-incorrect { color: var(--error); }

.step-question-explanation {
    margin-top: var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--primary);
}

/* ─── Quiz Step ──────────────────────────────────────────────────────── */
.step-quiz {
    padding-top: var(--space-4);
}

/* ─── Outro Step ─────────────────────────────────────────────────────── */
.step-outro {
    padding-top: var(--space-2);
}

.step-outro-unlocks {
    font-size: var(--text-base);
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
    text-align: center;
}

.step-outro-section {
    margin-bottom: var(--space-5);
}

.step-outro-links {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.source-featured {
    background: rgba(24, 101, 242, 0.05);
    border-color: rgba(24, 101, 242, 0.2);
}

.source-featured:hover {
    border-color: var(--primary);
    background: rgba(24, 101, 242, 0.1);
}

.step-outro-disclaimer {
    font-size: var(--text-xs);
    color: var(--text-muted);
    padding: var(--space-2) var(--space-3);
    background: rgba(245, 158, 11, 0.05);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-4);
}

.step-outro-complete {
    text-align: center;
    padding: var(--space-5) 0;
    color: var(--text-secondary);
}

.step-outro-emoji {
    font-size: 3rem;
    margin-bottom: var(--space-2);
}

/* ─── Soft Gate Pulse ────────────────────────────────────────────────── */
@keyframes pulseGate {
    0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

.step-question.pulse {
    animation: pulseGate 0.6s ease;
    border-radius: var(--radius-md);
}

/* ─── Calculator Step ────────────────────────────────────────────────── */
.step-calculator { padding-top: var(--space-2); }
.calc-title { font-size: 1.1rem; font-weight: 800; margin-bottom: var(--space-2); }
.calc-description { font-size: var(--text-sm); color: var(--text-secondary); margin-bottom: var(--space-4); }

.calc-input-group { margin-bottom: var(--space-4); }
.calc-label {
    display: flex; justify-content: space-between; align-items: center;
    font-size: var(--text-sm); font-weight: 700; margin-bottom: var(--space-2);
}
.calc-value-display {
    font-size: var(--text-sm); font-weight: 800; color: var(--primary);
    background: var(--primary-light); padding: 2px 10px;
    border-radius: 99px; min-width: 50px; text-align: center;
}

.calc-slider {
    -webkit-appearance: none; width: 100%; height: 6px;
    border-radius: 99px; background: var(--bg-secondary); outline: none;
    cursor: pointer;
}
.calc-slider::-webkit-slider-thumb {
    -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%;
    background: var(--primary); cursor: pointer;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.calc-slider::-moz-range-thumb {
    width: 24px; height: 24px; border-radius: 50%;
    background: var(--primary); cursor: pointer; border: none;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.calc-range-labels {
    display: flex; justify-content: space-between;
    font-size: var(--text-xs); color: var(--text-muted); margin-top: 4px;
}

.calc-result-card {
    background: var(--bg-card); border: 2px solid var(--success);
    border-radius: var(--radius-lg); padding: var(--space-4);
    text-align: center; margin: var(--space-4) 0;
}
.calc-result-label { font-size: var(--text-sm); font-weight: 700; color: var(--text-secondary); margin-bottom: var(--space-1); }
.calc-result-value {
    font-size: 1.8rem; font-weight: 800; color: var(--success);
    transition: all 0.3s ease;
}
.calc-secondary {
    display: flex; justify-content: space-between; padding: var(--space-2) 0;
    border-top: 1px solid var(--border); font-size: var(--text-sm); margin-top: var(--space-2);
}
.calc-secondary-label { color: var(--text-secondary); }
.calc-secondary-value { font-weight: 700; }

.calc-insight {
    font-size: var(--text-sm); color: var(--primary); background: var(--primary-light);
    padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
    border-left: 3px solid var(--primary); line-height: 1.5;
}

/* ─── Predict-First Step ─────────────────────────────────────────────── */
.step-predict-first { padding-top: var(--space-2); }
.predict-prompt {
    font-size: var(--text-sm); color: var(--text-muted);
    text-align: center; margin-bottom: var(--space-2);
}
.predict-question {
    font-size: var(--text-base); text-align: center;
    margin-bottom: var(--space-4); line-height: 1.4;
}

.predict-reveal {
    margin-top: var(--space-4); padding-top: var(--space-4);
    border-top: 2px solid var(--primary);
}
.predict-reveal-animate {
    animation: revealSlideUp 0.4s ease;
}
@keyframes revealSlideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
.predict-answer {
    font-size: 1.05rem; font-weight: 800; color: var(--primary);
    margin-bottom: var(--space-3); text-align: center;
}
.predict-aha {
    font-size: var(--text-sm); color: var(--text-secondary);
    background: var(--primary-light); padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md); margin-bottom: var(--space-3); line-height: 1.6;
}
.predict-source {
    font-size: var(--text-xs); color: var(--text-muted);
    text-align: right; margin-bottom: var(--space-3);
}
.predict-chart { margin-top: var(--space-3); }

/* ─── Chart Reveal Steps ─────────────────────────────────────────────── */
.step-chart-reveal { position: relative; }
.reveal-annotation {
    font-size: var(--text-sm); color: var(--text-primary);
    text-align: center; font-style: italic; font-weight: 500;
    margin: var(--space-3) 0;
    min-height: 20px; transition: opacity 0.3s ease;
}
.reveal-controls {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: var(--space-2); padding-top: var(--space-2);
    border-top: 1px solid var(--border);
}
.reveal-counter { font-size: var(--text-xs); color: var(--text-muted); font-weight: 600; }
.reveal-next-btn {
    font-size: var(--text-xs); padding: 6px 16px;
    background: #f59e0b; color: #fff; border: none;
    border-radius: 20px; cursor: pointer; font-weight: 600;
    transition: background 0.2s;
}
.reveal-next-btn:hover { background: #d97706; }
.reveal-next-btn:disabled { opacity: 0.5; cursor: default; }
.btn-sm { padding: var(--space-1) var(--space-3); font-size: var(--text-sm); }

/* ─── Guest Signup Banner (non-blocking) ─────────────────────────────── */
.guest-signup-banner {
    padding: var(--space-2) var(--space-4);
    background: var(--primary-light);
    border-bottom: 1px solid rgba(24, 101, 242, 0.15);
    flex-shrink: 0;
}

.guest-signup-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    font-size: var(--text-sm);
    color: var(--primary-dark);
}

.guest-signup-banner-content a {
    font-weight: 700;
    text-decoration: underline;
}

.guest-signup-dismiss {
    font-size: 1.2rem;
    color: var(--primary);
    background: none;
    border: none;
    cursor: pointer;
    padding: var(--space-1);
    line-height: 1;
    flex-shrink: 0;
}

/* ─── Path Celebration Modal ─────────────────────────────────────────── */
.path-celebration {
    position: relative;
    z-index: 1;
    background: var(--bg-primary);
    border-radius: 1.5rem;
    padding: var(--space-8) var(--space-6);
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: celebrationPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow: hidden;
}

@keyframes celebrationPop {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.celebration-confetti {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 15% 20%, var(--primary) 2px, transparent 2px),
        radial-gradient(circle at 85% 15%, var(--success) 2px, transparent 2px),
        radial-gradient(circle at 50% 10%, #f59e0b 2px, transparent 2px),
        radial-gradient(circle at 25% 8%, var(--error) 2px, transparent 2px),
        radial-gradient(circle at 75% 25%, var(--primary-dark) 2px, transparent 2px),
        radial-gradient(circle at 40% 18%, var(--success) 1.5px, transparent 1.5px),
        radial-gradient(circle at 60% 5%, #8b5cf6 2px, transparent 2px),
        radial-gradient(circle at 90% 30%, #f59e0b 1.5px, transparent 1.5px),
        radial-gradient(circle at 10% 35%, var(--primary) 1.5px, transparent 1.5px);
    animation: confettiFade 3s ease-out forwards;
}

@keyframes confettiFade {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(20px); }
}

.celebration-content {
    position: relative;
    z-index: 1;
}

.path-celebration h2 {
    font-size: var(--text-2xl);
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.celebration-path-name {
    font-size: var(--text-lg);
    color: var(--primary);
    font-weight: 700;
    margin-bottom: var(--space-6);
}

.celebration-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-6);
}

.celebration-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
}

.celebration-stat-value {
    font-size: var(--text-xl);
    font-weight: 800;
    color: var(--text-primary);
}

.celebration-stat-label {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ─── Stacked Bar Chart ──────────────────────────────────────────────── */
.stacked-chart {
    padding: var(--space-3) 0;
}

.stacked-bar-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.stacked-track {
    display: flex;
    overflow: hidden;
}

.stacked-segment {
    height: 28px;
    transition: width 0.3s ease;
}

/* ─── Grouped Bar Chart ──────────────────────────────────────────────── */
.grouped-chart {
    padding: var(--space-3) 0;
}

.grouped-bar-group {
    margin-bottom: var(--space-4);
}

.grouped-bar-label {
    font-size: var(--text-sm);
    font-weight: 700;
    margin-bottom: var(--space-2);
    display: block;
}

.grouped-bar-bars {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.grouped-bar-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.grouped-bar-value {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ─── Chart Legend ────────────────────────────────────────────────────── */
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-3);
    padding-top: var(--space-2);
    border-top: 1px solid var(--border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

.legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ─── Teachify Badge ─────────────────────────────────────────────────── */
.badge-teachify {
    background: rgba(88, 204, 2, 0.12);
    color: var(--success);
    font-weight: 700;
    font-size: var(--text-xs);
    padding: 2px 8px;
    border-radius: 99px;
}

.badge-coming-soon {
    background: rgba(255, 165, 0, 0.15);
    color: #d97706;
    font-weight: 700;
    font-size: var(--text-xs);
    padding: 2px 8px;
    border-radius: 99px;
    vertical-align: middle;
}

.path-card.coming-soon {
    opacity: 0.7;
    cursor: default;
}

.module-card.has-lesson .module-status.ready {
    color: #f59e0b;
}

.today-card.has-lesson {
    border-left: 3px solid var(--success);
}

/* ═══════════════════════════════════════════════════════════════════════
   TEXT-ONLY MODULE VIEW (Structured Concept Rendering)
   ═══════════════════════════════════════════════════════════════════════ */

.text-module-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.text-module-category {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-transform: capitalize;
}

.text-module-hook {
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-md);
    line-height: 1.5;
    margin-bottom: var(--space-5);
}

.text-module-body {
    font-size: var(--text-base);
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: var(--space-5);
}

.text-module-section {
    margin-bottom: var(--space-5);
}

.text-module-section-title {
    font-size: var(--text-sm);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
}

.text-module-points {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.text-module-point {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    font-size: var(--text-base);
    line-height: 1.6;
    border-left: 4px solid var(--primary);
}

.text-module-point-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    font-size: var(--text-sm);
    font-weight: 800;
    flex-shrink: 0;
}

.text-module-takeaway {
    padding: var(--space-4) var(--space-5);
    background: rgba(88, 204, 2, 0.06);
    border: 2px solid var(--success);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
}

.text-module-takeaway-label {
    font-size: var(--text-sm);
    font-weight: 800;
    color: var(--success);
    margin-bottom: var(--space-2);
}

.text-module-takeaway p {
    font-size: var(--text-base);
    font-weight: 600;
    line-height: 1.5;
    color: var(--text-primary);
}

.text-module-source {
    margin-bottom: var(--space-4);
}

.text-module-source-label {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-style: italic;
}

/* ─── Module Footer Actions ──────────────────────────────────────────── */
.module-footer-actions {
    margin-top: var(--space-6);
}

/* ─── What's Next Card (in-module footer) ────────────────────────────── */
.whats-next-card {
    padding: var(--space-4);
    background: var(--primary-light);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform 0.15s;
    border: 1px solid rgba(24, 101, 242, 0.15);
}

.whats-next-card:hover {
    transform: translateY(-2px);
}

.whats-next-label {
    font-size: var(--text-xs);
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--space-1);
}

.whats-next-title {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--text-primary);
}

.whats-next-path {
    font-size: var(--text-xs);
    color: var(--text-secondary);
    margin-top: var(--space-1);
}

/* ─── What's Next Toast (post-completion) ────────────────────────────── */
.toast-whats-next {
    position: fixed;
    top: var(--space-4);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-width: 400px;
    width: 90%;
    animation: slideDown 0.3s ease;
    border: 1px solid var(--border);
}

.toast-wn-check {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.toast-wn-content {
    flex: 1;
    min-width: 0;
}

.toast-wn-title {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.toast-wn-next {
    font-size: var(--text-sm);
    color: var(--primary);
    cursor: pointer;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.toast-wn-next:hover {
    text-decoration: underline;
}

.toast-wn-dismiss {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    line-height: 1;
}

/* ─── Active Path Progress (Dashboard) ───────────────────────────────── */
.active-path-progress {
    padding: var(--space-4) var(--space-5);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    margin-bottom: var(--space-4);
    cursor: pointer;
    transition: transform 0.15s;
    border-left: 4px solid var(--primary);
}

.active-path-progress:hover {
    transform: translateY(-2px);
}

.active-path-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.active-path-icon {
    font-size: 1.5rem;
}

.active-path-info {
    flex: 1;
}

.active-path-name {
    font-size: var(--text-base);
    font-weight: 700;
}

.active-path-stats {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

/* ─── Profile Path Progress ──────────────────────────────────────────── */
.profile-path-card {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-2);
    cursor: pointer;
    transition: transform 0.15s;
    box-shadow: var(--shadow-card);
}

.profile-path-card:hover {
    transform: translateY(-1px);
}

.profile-path-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-2);
}

.profile-path-icon {
    font-size: 1.2rem;
}

.profile-path-info {
    flex: 1;
}

.profile-path-name {
    font-size: var(--text-sm);
    font-weight: 700;
}

.profile-path-stats {
    font-size: var(--text-xs);
    color: var(--text-secondary);
}

/* ─── Curriculum Progress Summary ────────────────────────────────────── */
.curriculum-progress-summary {
    padding: var(--space-3) var(--space-4);
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    margin-bottom: var(--space-4);
}

.curriculum-progress-text {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
}

.curriculum-progress-pct {
    font-weight: 700;
    color: var(--success);
}

/* ─── Filter Chip Progress Counter ───────────────────────────────────── */
.filter-chip-progress {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--success);
    margin-left: var(--space-1);
}
