/* ============================================
   Course Platform — Version B: "Playful Learning"
   Claymorphism + Vibrant Educational Design
   Target: women 35+, beginners, mobile-first
   course.aicreator.ru
   ============================================ */

/* --- Google Fonts: Soft Rounded Pairing --- */
@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,opsz,wght@0,6..12,300;0,6..12,400;0,6..12,500;0,6..12,600;0,6..12,700;1,6..12,400&family=Varela+Round&display=swap');

/* ============================================
   Custom Properties
   ============================================ */
:root {
    /* --- Core Palette --- */
    --primary: #4F46E5;
    --primary-hover: #4338CA;
    --primary-light: #EEF2FF;
    --primary-lighter: #E0E7FF;
    --on-primary: #FFFFFF;

    --secondary: #818CF8;
    --secondary-light: #C7D2FE;

    --accent: #EA580C;
    --accent-hover: #DC4C05;
    --accent-light: #FFF7ED;

    /* --- Surfaces --- */
    --bg: #EEF2FF;
    --surface: #FFFFFF;
    --surface-raised: #FFFFFF;

    /* --- Text --- */
    --text: #1E1B4B;
    --text-secondary: #6366F1;
    --text-muted: #94A3B8;

    /* --- Semantic --- */
    --success: #10B981;
    --success-light: #D1FAE5;
    --success-dark: #059669;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #DC2626;
    --danger-light: #FEE2E2;

    /* --- Prompt Block --- */
    --prompt-bg: #1E1E2E;
    --prompt-text: #E2E8F0;
    --prompt-placeholder: #818CF8;

    /* --- Sidebar --- */
    --sidebar-bg: #1E1B4B;
    --sidebar-text: #E0E7FF;
    --sidebar-width: 260px;

    /* --- Border & Muted --- */
    --border: #C7D2FE;
    --border-light: #E0E7FF;
    --muted: #EBEEF8;

    /* --- Layout --- */
    --radius: 20px;
    --radius-sm: 12px;
    --radius-btn: 16px;
    --radius-pill: 100px;

    /* --- Claymorphism Shadows --- */
    --clay-shadow:
        8px 8px 16px rgba(0, 0, 0, 0.08),
        -4px -4px 12px rgba(255, 255, 255, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    --clay-shadow-hover:
        10px 10px 20px rgba(0, 0, 0, 0.10),
        -5px -5px 15px rgba(255, 255, 255, 0.9),
        inset 0 2px 0 rgba(255, 255, 255, 0.7);
    --clay-shadow-pressed:
        4px 4px 8px rgba(0, 0, 0, 0.06),
        -2px -2px 6px rgba(255, 255, 255, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    --clay-shadow-inset:
        inset 4px 4px 8px rgba(0, 0, 0, 0.06),
        inset -2px -2px 6px rgba(255, 255, 255, 0.5);
    --clay-shadow-login:
        12px 12px 24px rgba(0, 0, 0, 0.10),
        -6px -6px 18px rgba(255, 255, 255, 0.9),
        inset 0 2px 0 rgba(255, 255, 255, 0.7);

    /* --- Transitions --- */
    --transition-fast: 0.15s ease;
    --transition: 0.25s ease;
    --transition-slow: 0.4s ease;
}


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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.7;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

img {
    max-width: 100%;
    height: auto;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Varela Round', 'Nunito Sans', sans-serif;
    line-height: 1.3;
    color: var(--text);
}


/* ============================================
   Claymorphism Utility Classes
   ============================================ */
.clay-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--clay-shadow);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.clay-card-hover {
    transition: transform var(--transition), box-shadow var(--transition);
}

.clay-card-hover:hover {
    transform: translateY(-4px);
    box-shadow: var(--clay-shadow-hover);
}

.clay-button {
    background: var(--primary);
    color: var(--on-primary);
    border: none;
    border-radius: var(--radius-btn);
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-tap-highlight-color: transparent;
    box-shadow:
        4px 4px 10px rgba(79, 70, 229, 0.25),
        -2px -2px 6px rgba(255, 255, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.clay-button:hover {
    background: var(--primary-hover);
    box-shadow:
        6px 6px 14px rgba(79, 70, 229, 0.30),
        -3px -3px 8px rgba(255, 255, 255, 0.4),
        inset 0 2px 0 rgba(255, 255, 255, 0.25);
}

.clay-button:active {
    transform: scale(0.97);
    box-shadow: var(--clay-shadow-pressed);
}


/* ============================================
   Sidebar
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    padding: 2rem 1rem;
    overflow-y: auto;
    z-index: 100;
    transition: transform 0.3s ease;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

/* Subtle inner glow on the sidebar */
.sidebar::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 1px;
    height: 100%;
    background: linear-gradient(
        to bottom,
        rgba(129, 140, 248, 0.3) 0%,
        rgba(129, 140, 248, 0.1) 50%,
        rgba(129, 140, 248, 0.3) 100%
    );
    pointer-events: none;
}

/* --- Sidebar logo --- */
.sidebar-logo {
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

.sidebar-logo a {
    font-family: 'Varela Round', sans-serif;
    font-size: 1.4rem;
    font-weight: 400; /* Varela Round only has 400 */
    color: #fff;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.sidebar-logo a:hover {
    text-decoration: none;
    opacity: 0.9;
    color: #fff;
}

/* --- Sidebar module list --- */
.sidebar-modules {
    list-style: none;
    flex: 1;
}

.sidebar-module {
    margin-bottom: 0.25rem;
}

.sidebar-module a {
    color: var(--sidebar-text);
    padding: 0.7rem 0.75rem;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    transition: background var(--transition-fast);
    font-size: 0.9rem;
    line-height: 1.4;
}

.sidebar-module a:hover {
    background: rgba(129, 140, 248, 0.15);
    text-decoration: none;
    color: #fff;
}

.sidebar-module.active a {
    background: rgba(129, 140, 248, 0.2);
    color: #fff;
}

.sidebar-module .module-num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    border: 2px solid rgba(129, 140, 248, 0.4);
    flex-shrink: 0;
    transition: all var(--transition);
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Varela Round', sans-serif;
}

.sidebar-module.active .module-num {
    background: var(--secondary);
    border-color: var(--secondary);
    color: #fff;
    box-shadow: 0 0 12px rgba(129, 140, 248, 0.4);
}

.sidebar-module.completed .module-num {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.3);
}

.sidebar-module .module-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-module .module-check {
    color: var(--success);
    font-size: 0.85rem;
    flex-shrink: 0;
}

/* --- Sidebar bottom --- */
.sidebar-bottom {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid rgba(129, 140, 248, 0.15);
}

.logout-link {
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    display: block;
    transition: color var(--transition-fast);
    border-radius: 8px;
}

.logout-link:hover {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    background: rgba(129, 140, 248, 0.1);
}

/* --- Sidebar overlay (mobile) --- */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(30, 27, 75, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 99;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

body.sidebar-open .sidebar-overlay {
    opacity: 1;
    pointer-events: auto;
}

/* --- Hamburger --- */
.hamburger {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 101;
    width: 48px;
    height: 48px;
    background: var(--sidebar-bg);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    box-shadow:
        4px 4px 10px rgba(30, 27, 75, 0.25),
        -2px -2px 6px rgba(255, 255, 255, 0.1);
}

.hamburger span {
    display: block;
    width: 20px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s;
}

body.sidebar-open .hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

body.sidebar-open .hamburger span:nth-child(2) {
    opacity: 0;
}

body.sidebar-open .hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}


/* ============================================
   Main Content Area
   ============================================ */
.content {
    padding: 2rem;
    max-width: 900px;
}

/* --- Mobile-first: sidebar hidden, content full width --- */
@media (max-width: 767px) {
    .sidebar {
        transform: translateX(-100%);
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .hamburger {
        display: flex;
    }

    body.has-sidebar .content {
        margin-left: 0;
        padding: 1.25rem;
        padding-top: 5rem; /* room for hamburger */
    }
}

/* --- Desktop: sidebar visible, content offset --- */
@media (min-width: 768px) {
    body {
        font-size: 18px;
    }

    body.has-sidebar .content {
        margin-left: var(--sidebar-width);
    }

    .content {
        padding: 2.5rem 3rem;
    }
}

/* --- No sidebar pages (login) --- */
body.no-sidebar .sidebar,
body.no-sidebar .hamburger,
body.no-sidebar .sidebar-overlay {
    display: none !important;
}

body.no-sidebar .content {
    margin-left: 0;
    padding: 0;
    max-width: none;
}


/* ============================================
   Login Page
   ============================================ */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--bg);
    /* Soft radial gradient for warmth */
    background:
        radial-gradient(ellipse at 30% 20%, rgba(129, 140, 248, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(234, 88, 12, 0.08) 0%, transparent 50%),
        var(--bg);
}

.login-card {
    background: var(--surface);
    padding: 2.5rem 2rem;
    border-radius: 24px;
    box-shadow: var(--clay-shadow-login);
    max-width: 440px;
    width: 100%;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.7);
    position: relative;
    overflow: hidden;
}

/* Subtle top gradient accent line */
.login-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
    border-radius: 24px 24px 0 0;
}

@media (min-width: 768px) {
    .login-card {
        padding: 3.5rem 3rem;
    }
}

.login-title {
    font-family: 'Varela Round', sans-serif;
    font-size: 2rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    color: var(--text);
    letter-spacing: 0.01em;
}

.login-subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1rem;
    line-height: 1.5;
}

.login-input {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-btn);
    font-size: 1.05rem;
    font-family: 'Nunito Sans', sans-serif;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    background: #fff;
    color: var(--text);
    box-shadow: var(--clay-shadow-inset);
}

.login-input:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow:
        var(--clay-shadow-inset),
        0 0 0 3px rgba(79, 70, 229, 0.12);
}

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

.login-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary);
    color: var(--on-primary);
    border: none;
    border-radius: var(--radius-btn);
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Nunito Sans', sans-serif;
    cursor: pointer;
    margin-top: 1.25rem;
    transition: all var(--transition-fast);
    min-height: 52px;
    box-shadow:
        4px 4px 12px rgba(79, 70, 229, 0.3),
        -2px -2px 6px rgba(255, 255, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    letter-spacing: 0.02em;
}

.login-btn:hover {
    background: var(--primary-hover);
    box-shadow:
        6px 6px 16px rgba(79, 70, 229, 0.35),
        -3px -3px 8px rgba(255, 255, 255, 0.4),
        inset 0 2px 0 rgba(255, 255, 255, 0.25);
}

.login-btn:active {
    transform: scale(0.97);
    box-shadow:
        2px 2px 6px rgba(79, 70, 229, 0.2),
        -1px -1px 3px rgba(255, 255, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.login-error {
    color: var(--danger);
    background: var(--danger-light);
    padding: 0.85rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    line-height: 1.5;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.4),
        2px 2px 6px rgba(220, 38, 38, 0.1);
}


/* ============================================
   Dashboard
   ============================================ */
.dashboard {
    max-width: 820px;
}

.dashboard-greeting {
    font-family: 'Varela Round', sans-serif;
    font-size: 1.6rem;
    font-weight: 400;
    margin-bottom: 0.35rem;
    color: var(--text);
}

@media (min-width: 768px) {
    .dashboard-greeting {
        font-size: 2rem;
    }
}

/* --- Progress section --- */
.progress-section {
    margin-bottom: 2.5rem;
}

.progress-text {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}

.progress-bar-track {
    background: var(--border-light);
    height: 10px;
    border-radius: var(--radius-pill);
    overflow: hidden;
    box-shadow: var(--clay-shadow-inset);
}

.progress-bar-fill {
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    height: 100%;
    border-radius: var(--radius-pill);
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
    box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.3);
    position: relative;
}

/* Shimmer on progress fill */
.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(
        to bottom,
        rgba(255, 255, 255, 0.25),
        transparent
    );
    border-radius: var(--radius-pill) var(--radius-pill) 0 0;
}

/* --- Module cards grid --- */
.modules-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

@media (min-width: 768px) {
    .modules-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
}

/* --- Module card (Claymorphism) --- */
.module-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--clay-shadow);
    text-decoration: none;
    color: var(--text);
    transition:
        transform var(--transition),
        box-shadow var(--transition);
    position: relative;
    overflow: hidden;
    display: block;
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.module-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--clay-shadow-hover);
    text-decoration: none;
    color: var(--text);
}

.module-card:active {
    transform: translateY(-1px) scale(0.99);
    box-shadow: var(--clay-shadow-pressed);
}

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

/* Completed check overlay */
.card-check-overlay {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 30px;
    height: 30px;
    background: var(--success);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

/* Card number circle — indigo with clay feel */
.card-number {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--primary), var(--primary-hover));
    color: var(--on-primary);
    font-family: 'Varela Round', sans-serif;
    font-weight: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    font-size: 1.15rem;
    flex-shrink: 0;
    box-shadow:
        3px 3px 8px rgba(79, 70, 229, 0.3),
        -2px -2px 5px rgba(255, 255, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.card-title {
    font-family: 'Varela Round', sans-serif;
    font-size: 1.1rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    color: var(--text);
}

.card-promise {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    line-height: 1.6;
}

/* --- Card meta (duration + difficulty) --- */
.card-meta {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.card-duration {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary);
    white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.card-duration:empty {
    display: none;
}

/* Difficulty badges */
.card-difficulty {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.card-difficulty:empty {
    display: none;
}

.card-difficulty--easy {
    background: var(--success-light);
    color: var(--success-dark);
}

.card-difficulty--medium {
    background: var(--warning-light);
    color: #B45309;
}

.card-difficulty--hard {
    background: var(--danger-light);
    color: var(--danger);
}


/* ============================================
   Module Page
   ============================================ */
.module-page {
    max-width: 820px;
}

/* --- Module header --- */
.module-header {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    margin-bottom: 2rem;
    padding-bottom: 1.75rem;
    border-bottom: 2px solid var(--border-light);
}

.module-header-num {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--primary), var(--primary-hover));
    color: var(--on-primary);
    font-family: 'Varela Round', sans-serif;
    font-weight: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
    box-shadow:
        4px 4px 10px rgba(79, 70, 229, 0.3),
        -2px -2px 6px rgba(255, 255, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.module-header-title {
    font-family: 'Varela Round', sans-serif;
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 0.3rem;
    line-height: 1.3;
    color: var(--text);
}

@media (min-width: 768px) {
    .module-header-title {
        font-size: 1.75rem;
    }
}

.module-header-promise {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0.6rem;
}

.badge-duration {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-pill);
    font-size: 0.82rem;
    font-weight: 600;
    background: var(--primary-light);
    color: var(--primary);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* --- Video section --- */
.module-video {
    margin-bottom: 2rem;
}

.module-video iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    border: none;
    background: #000;
    box-shadow: var(--clay-shadow);
}

.video-placeholder {
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--border-light) 100%);
    border-radius: var(--radius);
    padding: 3.5rem 2rem;
    text-align: center;
    color: var(--text-muted);
    box-shadow: var(--clay-shadow);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.video-placeholder-icon {
    font-size: 3.5rem;
    margin-bottom: 0.75rem;
    display: block;
    opacity: 0.7;
}

.video-placeholder p {
    font-family: 'Varela Round', sans-serif;
    font-size: 1.05rem;
    font-weight: 400;
}

/* --- Content HTML (rich text from markdown) --- */
.module-content-html {
    line-height: 1.8;
    margin-bottom: 2rem;
}

.module-content-html h2 {
    font-family: 'Varela Round', sans-serif;
    font-size: 1.35rem;
    margin: 2rem 0 0.85rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--border-light);
}

.module-content-html h3 {
    font-family: 'Varela Round', sans-serif;
    font-size: 1.15rem;
    margin: 1.5rem 0 0.5rem;
}

.module-content-html p {
    margin-bottom: 1rem;
}

.module-content-html ul,
.module-content-html ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

.module-content-html li {
    margin-bottom: 0.45rem;
}

.module-content-html strong {
    font-weight: 700;
    color: var(--text);
}

.module-content-html table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.95rem;
    background: var(--surface);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--clay-shadow);
}

.module-content-html th,
.module-content-html td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
}

.module-content-html th {
    font-weight: 700;
    background: var(--primary-light);
    color: var(--text);
    font-family: 'Nunito Sans', sans-serif;
}

.module-content-html blockquote {
    border-left: 4px solid var(--secondary);
    padding: 1rem 1.25rem;
    margin: 1.25rem 0;
    color: var(--text-muted);
    font-style: italic;
    background: var(--primary-light);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

@media (max-width: 767px) {
    .module-content-html table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}


/* ============================================
   Prompt Blocks (CORE FEATURE)
   ============================================ */
.module-prompts {
    margin-bottom: 2.5rem;
}

.module-prompts > h2 {
    font-family: 'Varela Round', sans-serif;
    font-size: 1.35rem;
    margin-bottom: 1.25rem;
    padding-bottom: 0.6rem;
    border-bottom: 2px solid var(--border-light);
}

.prompt-block {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--clay-shadow);
    margin-bottom: 1rem;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.prompt-block.open {
    border-color: var(--secondary);
    box-shadow: var(--clay-shadow-hover);
}

.prompt-header {
    padding: 1.15rem 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background var(--transition-fast);
    gap: 1rem;
    min-height: 56px;
}

.prompt-header:hover {
    background: var(--primary-light);
}

.prompt-title {
    font-family: 'Nunito Sans', sans-serif;
    font-size: 0.98rem;
    font-weight: 700;
    flex: 1;
    color: var(--text);
}

.prompt-when {
    font-size: 0.82rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.prompt-chevron {
    transition: transform 0.3s ease;
    font-size: 0.75rem;
    color: var(--primary);
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary-light);
}

.prompt-block.open .prompt-chevron {
    transform: rotate(180deg);
    background: var(--secondary);
    color: var(--on-primary);
}

.prompt-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.prompt-block.open .prompt-body {
    max-height: 5000px;
}

/* Prompt code block — dark theme with contrast */
.prompt-body pre {
    background: var(--prompt-bg);
    color: var(--prompt-text);
    padding: 1.5rem 1.75rem;
    margin: 0 1.25rem;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-size: 0.87rem;
    line-height: 1.75;
    -webkit-overflow-scrolling: touch;
    box-shadow:
        inset 4px 4px 10px rgba(0, 0, 0, 0.3),
        inset -2px -2px 6px rgba(255, 255, 255, 0.02);
}

.prompt-body code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: inherit;
}

/* Copy button — full-width indigo with clay feel */
.copy-btn {
    display: block;
    width: calc(100% - 2.5rem);
    margin: 1rem 1.25rem 1.25rem;
    padding: 0.85rem;
    background: var(--primary);
    color: var(--on-primary);
    border: none;
    border-radius: var(--radius-btn);
    font-size: 0.98rem;
    font-weight: 700;
    font-family: 'Nunito Sans', sans-serif;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-height: 48px;
    -webkit-tap-highlight-color: transparent;
    box-shadow:
        4px 4px 10px rgba(79, 70, 229, 0.25),
        -2px -2px 6px rgba(255, 255, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    letter-spacing: 0.02em;
}

.copy-btn:hover {
    background: var(--primary-hover);
    box-shadow:
        6px 6px 14px rgba(79, 70, 229, 0.3),
        -3px -3px 8px rgba(255, 255, 255, 0.2),
        inset 0 2px 0 rgba(255, 255, 255, 0.25);
}

.copy-btn:active {
    transform: scale(0.97);
    box-shadow:
        2px 2px 5px rgba(79, 70, 229, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.copy-btn.copied {
    background: var(--success);
    box-shadow:
        4px 4px 10px rgba(16, 185, 129, 0.25),
        -2px -2px 6px rgba(255, 255, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}


/* ============================================
   Assignment Section
   ============================================ */
.assignment {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--clay-shadow);
    margin-top: 2.5rem;
    border-left: 4px solid var(--primary);
    border-top: 1px solid rgba(255, 255, 255, 0.6);
}

@media (min-width: 768px) {
    .assignment {
        padding: 2.25rem;
    }
}

.assignment h2 {
    font-family: 'Varela Round', sans-serif;
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text);
}

.assignment-item {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    min-height: 48px;
    transition: background var(--transition-fast);
    border-radius: 8px;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.assignment-item:hover {
    background: var(--primary-light);
}

.assignment-item:last-of-type {
    border-bottom: none;
}

.assignment-check {
    width: 24px;
    height: 24px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Expand touch target on mobile */
@media (max-width: 767px) {
    .assignment-check {
        width: 26px;
        height: 26px;
    }
}

.assignment-text {
    font-size: 0.98rem;
    line-height: 1.6;
    cursor: pointer;
    transition: all var(--transition);
}

.assignment-text.checked {
    text-decoration: line-through;
    color: var(--text-muted);
}

.assignment-punchline {
    color: var(--primary);
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-light);
    line-height: 1.7;
    font-size: 0.98rem;
    font-weight: 600;
}


/* ============================================
   Module Bottom Navigation
   ============================================ */
.module-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 3rem;
    gap: 1rem;
    padding-top: 2rem;
    border-top: 2px solid var(--border-light);
}

.module-nav-btn {
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-btn);
    font-size: 0.98rem;
    font-weight: 600;
    font-family: 'Nunito Sans', sans-serif;
    text-decoration: none;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 52px;
}

.module-nav-btn:hover {
    transform: translateY(-2px);
    text-decoration: none;
}

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

.module-nav-btn.prev {
    background: var(--surface);
    color: var(--text);
    border: 2px solid var(--border);
    box-shadow:
        4px 4px 10px rgba(0, 0, 0, 0.06),
        -2px -2px 6px rgba(255, 255, 255, 0.6),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.module-nav-btn.prev:hover {
    background: var(--primary-light);
    border-color: var(--secondary-light);
    color: var(--primary);
    box-shadow:
        6px 6px 14px rgba(0, 0, 0, 0.08),
        -3px -3px 8px rgba(255, 255, 255, 0.7),
        inset 0 2px 0 rgba(255, 255, 255, 0.6);
}

.module-nav-btn.next {
    background: var(--primary);
    color: var(--on-primary);
    border: 2px solid transparent;
    box-shadow:
        4px 4px 12px rgba(79, 70, 229, 0.3),
        -2px -2px 6px rgba(255, 255, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.module-nav-btn.next:hover {
    background: var(--primary-hover);
    box-shadow:
        6px 6px 16px rgba(79, 70, 229, 0.35),
        -3px -3px 8px rgba(255, 255, 255, 0.3),
        inset 0 2px 0 rgba(255, 255, 255, 0.25);
}


/* ============================================
   Glossary Tooltips
   ============================================ */
.glossary-term {
    border-bottom: 2px dashed var(--secondary);
    cursor: help;
    position: relative;
    display: inline;
    transition: color var(--transition-fast);
}

.glossary-term:hover {
    color: var(--primary);
}

.glossary-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--sidebar-bg);
    color: #fff;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--transition-fast), transform var(--transition-fast);
    z-index: 50;
    margin-bottom: 6px;
    max-width: 300px;
    white-space: normal;
    text-align: center;
    line-height: 1.5;
    box-shadow: 0 8px 24px rgba(30, 27, 75, 0.3);
}

.glossary-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--sidebar-bg);
}

.glossary-term:hover .glossary-tooltip,
.glossary-term:focus .glossary-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}


/* ============================================
   Utility Classes
   ============================================ */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

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

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }


/* ============================================
   Animations
   ============================================ */

/* Fade-in for page load */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard {
    animation: fadeInUp 0.4s ease-out;
}

.module-page {
    animation: fadeInUp 0.4s ease-out;
}

.login-card {
    animation: fadeInUp 0.5s ease-out;
}

/* Staggered card entrance */
.module-card {
    animation: fadeInUp 0.4s ease-out both;
}

.module-card:nth-child(1) { animation-delay: 0.05s; }
.module-card:nth-child(2) { animation-delay: 0.1s; }
.module-card:nth-child(3) { animation-delay: 0.15s; }
.module-card:nth-child(4) { animation-delay: 0.2s; }
.module-card:nth-child(5) { animation-delay: 0.25s; }
.module-card:nth-child(6) { animation-delay: 0.3s; }
.module-card:nth-child(7) { animation-delay: 0.35s; }
.module-card:nth-child(8) { animation-delay: 0.4s; }

/* Prompt blocks subtle entrance */
.prompt-block {
    animation: fadeInUp 0.3s ease-out both;
}

.prompt-block:nth-child(1) { animation-delay: 0.05s; }
.prompt-block:nth-child(2) { animation-delay: 0.1s; }
.prompt-block:nth-child(3) { animation-delay: 0.15s; }
.prompt-block:nth-child(4) { animation-delay: 0.2s; }
.prompt-block:nth-child(5) { animation-delay: 0.25s; }
.prompt-block:nth-child(6) { animation-delay: 0.3s; }
.prompt-block:nth-child(7) { animation-delay: 0.35s; }

/* Smooth checkbox animation */
.assignment-check {
    transition: transform var(--transition-fast);
}

.assignment-check:checked {
    transform: scale(1.15);
}

/* Copy button success pulse */
@keyframes copiedPulse {
    0% { transform: scale(0.97); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.copy-btn.copied {
    animation: copiedPulse 0.3s ease;
}

/* Sidebar link hover shimmer */
.sidebar-module a {
    position: relative;
    overflow: hidden;
}

.sidebar-module a::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(129, 140, 248, 0.06),
        transparent
    );
    transition: left 0.4s ease;
    pointer-events: none;
}

.sidebar-module a:hover::after {
    left: 100%;
}


/* ============================================
   Lesson Blocks (modules with lessons array)
   ============================================ */

/* --- Lesson block container --- */
.lesson-block {
    margin-bottom: 0;
}

/* --- Lesson header --- */
.lesson-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.lesson-num {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(145deg, var(--secondary), var(--primary));
    color: var(--on-primary);
    font-family: 'Varela Round', sans-serif;
    font-weight: 400;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    box-shadow:
        3px 3px 8px rgba(79, 70, 229, 0.25),
        -2px -2px 5px rgba(255, 255, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.lesson-header-text {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.lesson-title {
    font-family: 'Varela Round', sans-serif;
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text);
    line-height: 1.3;
    margin: 0;
}

@media (min-width: 768px) {
    .lesson-title {
        font-size: 1.4rem;
    }
}

/* --- Lesson prompts heading (h3 instead of h2) --- */
.lesson-block .module-prompts > h3 {
    font-family: 'Varela Round', sans-serif;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-light);
    color: var(--text);
}

/* --- Divider between lessons --- */
.lesson-divider {
    border: none;
    border-top: 2px solid var(--border-light);
    margin: 2.5rem 0;
    position: relative;
}

.lesson-divider::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--secondary), transparent);
}

/* --- Sidebar lessons list --- */
.sidebar-lessons {
    list-style: none;
    padding: 0.25rem 0 0.5rem 2.75rem;
    margin: 0;
}

.sidebar-lesson {
    margin-bottom: 0.15rem;
}

.sidebar-lesson-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.6rem;
    border-radius: 8px;
    font-size: 0.82rem;
    color: rgba(224, 231, 255, 0.75);
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.sidebar-lesson-link:hover {
    background: rgba(129, 140, 248, 0.12);
    color: #fff;
    text-decoration: none;
}

.lesson-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(129, 140, 248, 0.5);
    flex-shrink: 0;
}

.sidebar-lesson-dur {
    margin-left: auto;
    font-size: 0.75rem;
    color: rgba(224, 231, 255, 0.4);
    white-space: nowrap;
}

/* --- Dashboard card lessons list --- */
.module-card-wrap {
    display: flex;
    flex-direction: column;
}

.module-card-wrap .module-card {
    /* keep all existing card styles */
    flex: 1;
}

.card-lessons {
    list-style: none;
    background: var(--surface);
    border-radius: 0 0 var(--radius) var(--radius);
    border: 1px solid var(--border-light);
    border-top: none;
    padding: 0.75rem 1rem;
    margin: 0;
    box-shadow:
        4px 8px 16px rgba(0, 0, 0, 0.06),
        -2px 0 4px rgba(255, 255, 255, 0.5);
}

.card-lesson-item {
    margin-bottom: 0.1rem;
}

.card-lesson-item:last-child {
    margin-bottom: 0;
}

.card-lesson-item a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.5rem;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.card-lesson-item a:hover {
    background: var(--primary-light);
    color: var(--primary);
    text-decoration: none;
}

.card-lesson-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--secondary-light);
    flex-shrink: 0;
}

.card-lesson-title {
    flex: 1;
    min-width: 0;
}

.card-lesson-dur {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    margin-left: auto;
}

/* Module card wrap animation (replaces direct .module-card for stagger) */
.module-card-wrap {
    animation: fadeInUp 0.4s ease-out both;
}

.module-card-wrap:nth-child(1) { animation-delay: 0.05s; }
.module-card-wrap:nth-child(2) { animation-delay: 0.1s; }
.module-card-wrap:nth-child(3) { animation-delay: 0.15s; }
.module-card-wrap:nth-child(4) { animation-delay: 0.2s; }
.module-card-wrap:nth-child(5) { animation-delay: 0.25s; }
.module-card-wrap:nth-child(6) { animation-delay: 0.3s; }
.module-card-wrap:nth-child(7) { animation-delay: 0.35s; }
.module-card-wrap:nth-child(8) { animation-delay: 0.4s; }


/* ============================================
   Print Styles (just in case)
   ============================================ */
@media print {
    .sidebar,
    .hamburger,
    .sidebar-overlay,
    .module-nav,
    .copy-btn,
    .logout-link {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
        font-size: 12pt;
    }

    .content {
        margin-left: 0 !important;
        padding: 0;
        max-width: none;
    }

    .module-card,
    .prompt-block,
    .assignment {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }

    .prompt-body {
        max-height: none !important;
        overflow: visible !important;
    }
}

/* ============================================================
   Lesson CTA banner — крупный CTA сразу под видео.
   Используется для партнёрских ссылок, регистрации в сервисах и т.п.
   ============================================================ */
.lesson-cta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 20px 0 28px;
    padding: 22px 26px;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    color: #fff;
    border-radius: 14px;
    text-decoration: none;
    box-shadow: 0 6px 20px rgba(234, 88, 12, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.lesson-cta:hover,
.lesson-cta:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(234, 88, 12, 0.35);
    color: #fff;
    text-decoration: none;
}

.lesson-cta-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.lesson-cta-text strong {
    font-size: 1.15rem;
    line-height: 1.3;
    font-weight: 700;
}

.lesson-cta-text span {
    font-size: 0.95rem;
    opacity: 0.92;
    line-height: 1.4;
}

.lesson-cta-button {
    flex-shrink: 0;
    padding: 12px 20px;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.98rem;
    white-space: nowrap;
    backdrop-filter: blur(4px);
}

.lesson-cta:hover .lesson-cta-button {
    background: rgba(255, 255, 255, 0.28);
}

@media (max-width: 640px) {
    .lesson-cta {
        flex-direction: column;
        align-items: stretch;
        text-align: left;
        padding: 18px 20px;
    }
    .lesson-cta-button {
        text-align: center;
    }
}
