:root {
    --font-family-base: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --font-family-display: 'Poppins', 'Segoe UI', system-ui, sans-serif;

    --color-bg: linear-gradient(135deg, #cfd6ff 0%, #e9d5ff 100%);
    --color-surface: rgba(255, 255, 255, 0.9);
    --color-surface-strong: #ffffff;
    --color-border: rgba(15, 23, 42, 0.12);
    --color-text: #0f172a;
    --color-muted: rgba(15, 23, 42, 0.82);
    --color-muted-strong: rgba(15, 23, 42, 0.9);
    --color-overlay: rgba(15, 23, 42, 0.05);
    --color-accent: #10B981;
    --color-accent-dark: #059669;
    --color-gold: #FCD34D;
    --color-danger: #F87171;

    --radius-lg: 24px;

    --radius-md: 16px;
    --radius-sm: 10px;

    --shadow-soft: 0 20px 45px rgba(0, 0, 0, 0.25);
    --shadow-card: 0 10px 25px rgba(0, 0, 0, 0.18);

    --transition-base: 0.25s ease;
    --layout-max-width: 1200px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    max-width: 100%;
}

body {
    font-family: var(--font-family-base);
    background-image: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

.xp-readout {
    font-size: 12px;
    font-weight: 600;
    opacity: 0.85;
    text-align: right;
    letter-spacing: 0.04em;
    margin-top: 4px;
}

body.with-global-nav {
    padding-top: 110px;
}

.global-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 32px;
    background: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 16px 45px rgba(148, 163, 184, 0.45);
    z-index: 999;
    backdrop-filter: blur(12px);
    color: var(--color-text);
}

.nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.15);
    background: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    color: var(--color-text);
    transition: var(--transition-base);
}

.nav-toggle:hover,
.nav-toggle:focus-visible {
    border-color: var(--color-accent);
    outline: none;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.nav-toggle-bars {
    position: relative;
    display: block;
    width: 22px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 2px;
    background: currentColor;
    transition: transform 0.25s ease, top 0.25s ease;
}

.nav-toggle-bars::before {
    top: -6px;
}

.nav-toggle-bars::after {
    top: 6px;
}

.global-nav.nav-open .nav-toggle-bars {
    background: transparent;
}

.global-nav.nav-open .nav-toggle-bars::before {
    top: 0;
    transform: rotate(45deg);
}

.global-nav.nav-open .nav-toggle-bars::after {
    top: 0;
    transform: rotate(-45deg);
}

.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 998;
}

.nav-drawer {
    position: fixed;
    top: 0;
    right: -340px;
    width: min(340px, 80vw);
    height: 100vh;
    padding: 100px 28px 32px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: -12px 0 45px rgba(15, 23, 42, 0.25);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    gap: 28px;
    overflow-y: auto;
    transition: right 0.3s ease;
    z-index: 999;
}

.nav-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(15, 23, 42, 0.15);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--color-text);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: var(--transition-base);
}

.nav-close:hover,
.nav-close:focus-visible {
    border-color: var(--color-accent);
    color: var(--color-accent);
    outline: none;
}

.global-nav.nav-open .nav-drawer {
    right: 0;
}

.global-nav.nav-open .nav-overlay {
    opacity: 1;
    pointer-events: auto;
}

.nav-drawer-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.nav-section-title {
    font-size: 13px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.nav-drawer-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-drawer .nav-link {
    width: 100%;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    text-decoration: none;
    transition: background var(--transition-base), color var(--transition-base), box-shadow var(--transition-base);
}

.nav-link:hover,
.nav-link:focus-visible {
    background: rgba(16, 185, 129, 0.1);
    outline: none;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.nav-link.is-active,
.nav-link.active-lesson {
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(16, 185, 129, 0.4);
    font-weight: 700;
}

.nav-link.is-locked {
    color: var(--color-muted);
    cursor: pointer;
}

.nav-note {
    margin-top: 10px;
    font-size: 0.95rem;
    color: #4b5563;
}

.nav-status-badge {
    margin-left: 8px;
    font-size: 13px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.nav-brand a {
    font-family: var(--font-family-display);
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
}

.nav-brand {
    min-width: auto;
}

.nav-group {
    display: inline-flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.nav-section-label {
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.lesson-links {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

.nav-link {
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-muted-strong);
    border: 1px solid rgba(15, 23, 42, 0.15);
    background: rgba(255, 255, 255, 0.8);
    transition: var(--transition-base);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.nav-link-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-link.is-completed {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.08);
}

.nav-link.is-in-progress {
    border-color: rgba(250, 204, 21, 0.4);
    background: rgba(250, 204, 21, 0.08);
}

.nav-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    padding: 0 6px;
    margin-left: 6px;
}

.nav-status-completed {
    background: var(--color-accent);
    color: #fff;
}

.nav-status-in-progress {
    background: rgba(250, 204, 21, 0.25);
    color: #92400e;
}

.nav-status-locked {
    background: rgba(15, 23, 42, 0.1);
    color: #475569;
}

.nav-coming-soon {
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.18);
    border: 1px dashed rgba(59, 130, 246, 0.45);
    color: #1d4ed8;
    font-weight: 600;
}

.nav-link.is-locked {
    opacity: 0.45;
    cursor: not-allowed;
    border-color: rgba(15, 23, 42, 0.12);
    pointer-events: none;
}

.nav-link:hover {
    color: var(--color-text);
    border-color: rgba(15, 23, 42, 0.25);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.12);
}

.nav-link.is-active,
.nav-link.active-lesson {
    color: #0f172a;
    background: var(--color-accent);
    border-color: transparent;
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.35);
}

.page-progress-wrapper {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.page-progress {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.35);
    overflow: hidden;
    position: relative;
    margin: 2px 0 0;
}

.page-progress-fill {
    height: 100%;
    width: 0;
    background: linear-gradient(135deg, #10B981, #059669);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.page-progress-label {
    font-size: 12px;
    color: var(--color-muted);
    margin-bottom: 2px;
    text-align: right;
}

.compact-progress {
    position: absolute;
    top: -6px;
    right: 0;
    width: 170px;
    padding-left: 8px;
    align-items: flex-end;
}

@media (max-width: 640px) {
    .compact-progress {
        position: static;
        width: 100%;
        margin-top: 4px;
        align-items: stretch;
    }
    .page-progress-label {
        text-align: left;
    }
}

/* Restore per-page progress text/CTAs for manual flows */
.progress-indicator {
    display: block;
}

.progress-nav {
    display: flex;
}

.step-pill:hover,
.step-pill:focus-visible,
.tone-btn:hover,
.tone-btn:focus-visible,
.tone-word:hover,
.tone-word:focus-visible,
.tone-drop-zone:hover,
.tone-drop-zone:focus-visible {
    border-color: var(--color-accent);
    box-shadow: 0 6px 12px rgba(16, 185, 129, 0.25);
    outline: none;
}

.lesson-card button:hover,
.lesson-card button:focus-visible,
.choice-card:hover,
.choice-card:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.15);
}

.correct {
    background: rgba(16, 185, 129, 0.12) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
    color: #065f46 !important;
}

.incorrect {
    background: rgba(248, 113, 113, 0.12) !important;
    border-color: rgba(248, 113, 113, 0.45) !important;
    color: #991b1b !important;
}

.answer-explanation {
    margin-top: 10px;
    font-size: 14px;
    color: var(--color-muted-strong);
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.05);
}

.nav-current-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.85);
    color: #065f46;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
}

.professional-mode .nav-status-badge,
.professional-mode .xp-readout,
.professional-mode .xp-bar,
.professional-mode .xp-label,
.professional-mode [data-gamified="true"] {
    display: none !important;
}

@media (max-width: 900px) {
    body.with-global-nav {
        padding-top: 100px;
    }
}

img {
    max-width: 100%;
    display: block;
}

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

.container {
    max-width: var(--layout-max-width);
    margin: 0 auto;
    padding: clamp(10px, 1.6vw, 16px) clamp(10px, 2vw, 18px) clamp(18px, 3vw, 28px);
}

.card,
.panel,
.section-block {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: 0 25px 45px rgba(148, 163, 184, 0.35);
    backdrop-filter: blur(8px);
}

.header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
    align-items: center;
    padding: 4px 0 8px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: none;
    background: transparent;
    position: relative;
}

.logo {
    font-family: var(--font-family-display);
    font-size: 20px;
    font-weight: 700;
}

.lesson-shell {
    display: flex;
    flex-direction: column;
    gap: clamp(10px, 1.4vw, 14px);
    max-width: var(--layout-max-width);
    margin: 0 auto;
    padding: clamp(8px, 1vw, 12px);
}

.lesson-shell .header {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.challenge-section {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.progress-indicator {
    text-align: center;
    color: var(--color-text);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.01em;
    margin-bottom: 16px;
}

.progress-nav {
    margin-top: clamp(12px, 2vw, 20px);
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.activity-progress {
    color: var(--color-text);
    font-weight: 600;
}

.btn-next {
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    background: linear-gradient(135deg, #10B981, #059669);
    color: #fff;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-next:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(16, 185, 129, 0.3);
}

.btn-next:disabled,
.btn-next.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.btn.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.breadcrumb {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 15px;
    color: var(--color-muted);
}

.breadcrumb a {
    opacity: 0.9;
}

.stats-bar,
.stats {
    display: flex;
    gap: 18px;
    align-items: center;
}

.stat-label {
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-muted);
}

.xp-bar {
    width: 260px;
    height: 26px;
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.08);
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.12);
    position: relative;
}

.xp-fill {
    height: 100%;
    background: linear-gradient(90deg, #FDCB6E, #F59E0B);
    transition: width 0.4s ease;
    position: absolute;
    top: 0;
    left: 0;
}

.xp-label {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: #1F2937;
    pointer-events: none;
}

.mode-selector,
.mode-toggle {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 999px;
    padding: 4px;
    gap: 6px;
    margin-bottom: 24px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.04);
}

.mode-btn {
    position: relative;
    border: 1px solid transparent;
    background: transparent;
    color: var(--color-muted);
    font-weight: 600;
    padding: 10px 22px;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition-base);
    min-width: 140px;
    text-align: center;
}

.mode-btn:hover {
    color: var(--color-muted-strong);
}

.mode-btn:focus-visible {
    outline: 3px solid rgba(16, 185, 129, 0.35);
    outline-offset: 2px;
}

.mode-btn.active,
.mode-btn[aria-pressed="true"] {
    background: var(--color-surface-strong);
    color: var(--color-text);
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: inset 0 0 0 1px rgba(16, 185, 129, 0.45), 0 6px 18px rgba(15, 23, 42, 0.12);
}

.mode-btn[aria-pressed="false"] {
    opacity: 0.8;
}

.btn,
.btn-primary,
.btn-secondary,
.btn-link {
    border: none;
    border-radius: 12px;
    padding: 16px 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
    text-align: center;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-accent), var(--color-accent-dark));
    color: white;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.35);
}

.btn:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-link:focus-visible,
.btn-next:focus-visible,
.nav-toggle:focus-visible,
.nav-close:focus-visible {
    outline: 3px solid rgba(16, 185, 129, 0.35);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(16, 185, 129, 0.45);
}

.btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-link:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.btn-secondary {
    background: transparent;
    color: var(--color-text);
    border: 1px solid rgba(15, 23, 42, 0.2);
}

.btn-secondary:hover {
    background: rgba(15, 23, 42, 0.05);
}

.btn-link {
    background: none;
    color: var(--color-text);
    padding: 0;
}

.tool-grid,
.card-grid {
    display: grid;
    gap: 18px;
}

.tool-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* Drag-and-drop activities */
.dd-wrapper {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px;
    border: 1px dashed rgba(15, 23, 42, 0.18);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.75);
    box-shadow: 0 12px 28px rgba(148, 163, 184, 0.18);
}

.dd-header h3 {
    margin-bottom: 4px;
    font-size: 20px;
}

.dd-hint {
    color: var(--color-muted);
    font-size: 14px;
}

.dd-bank {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.02);
}

.dd-chip {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.2);
    border-radius: 999px;
    padding: 10px 14px;
    min-height: 44px;
    cursor: grab;
    font-weight: 600;
    transition: var(--transition-base);
}

.dd-chip:hover,
.dd-chip:focus-visible {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
    outline: none;
}

.dd-chip.dd-chip-placed {
    opacity: 0.75;
}

.dd-chip.dd-chip-selected {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.dd-slots {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.dd-slot {
    border: 1px dashed rgba(15, 23, 42, 0.28);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.8);
    min-height: 70px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dd-slot-label {
    font-size: 13px;
    color: var(--color-muted);
}

.dd-slot-target {
    min-height: 40px;
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    background: rgba(15, 23, 42, 0.03);
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.dd-slot-correct .dd-slot-target {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.08);
}

.dd-slot-incorrect .dd-slot-target {
    border-color: rgba(248, 113, 113, 0.6);
    background: rgba(248, 113, 113, 0.08);
}

.dd-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.dd-status {
    font-size: 14px;
    color: var(--color-muted-strong);
}

@media (max-width: 768px) {
    :root {
        --layout-max-width: 100%;
    }

    body.with-global-nav {
        padding-top: 86px;
    }

    .global-nav {
        padding: 14px 16px;
    }

    .nav-drawer {
        width: min(360px, 90vw);
        padding: 88px 20px 24px;
    }

    .container,
    .lesson-shell {
        padding: 16px 14px 48px;
    }

    .card,
    .panel,
    .section-block {
        padding: 20px;
        box-shadow: 0 12px 28px rgba(148, 163, 184, 0.25);
    }

    .breadcrumb {
        flex-wrap: wrap;
        row-gap: 6px;
    }

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

    .footer-nav {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .btn,
    .btn-primary,
    .btn-secondary,
    .btn-link,
    .btn-next {
        width: 100%;
        min-height: 48px;
        justify-content: center;
    }

    .page-progress-wrapper {
        margin: 4px 0 12px;
    }
}

@media (max-width: 520px) {
    body.with-global-nav {
        padding-top: 78px;
    }

    .global-nav {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px;
    }

    .nav-brand a {
        font-size: 18px;
        max-width: none;
    }

    .nav-toggle {
        width: 44px;
        height: 44px;
    }

    .card,
    .panel,
    .section-block {
        padding: 16px;
    }

    .logo {
        font-size: 20px;
    }

    .section-title {
        font-size: 22px;
    }

    .nav-drawer {
        width: min(400px, 92vw);
    }
}

.card-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.tool-card,
.info-card {
    background: rgba(255, 255, 255, 0.85);
    border-radius: var(--radius-md);
    padding: 20px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    min-height: 180px;
    box-shadow: 0 18px 35px rgba(148, 163, 184, 0.25);
}

.key-takeaways {
    margin-top: 32px;
    padding: 28px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.9);
}

.takeaway-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.takeaway-card {
    border-radius: var(--radius-md);
    border: 1px solid rgba(15, 23, 42, 0.08);
    padding: 18px;
    background: rgba(255, 255, 255, 0.85);
}

.takeaway-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.15);
    margin-bottom: 10px;
    font-weight: 600;
}

.self-checklist {
    margin-top: 22px;
    padding: 18px 20px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(248, 250, 252, 0.85);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
}

.self-checklist.attention {
    box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.35);
}

.self-checklist h4 {
    font-size: 16px;
    margin-bottom: 4px;
}

.self-checklist p {
    font-size: 13px;
    color: var(--color-muted);
    margin-bottom: 12px;
}

.self-checklist-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.self-checklist-item label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 14px;
    cursor: pointer;
}

.self-checklist-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
}

.self-checklist-status {
    margin-top: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--color-muted);
}

.self-checklist-status.complete {
    color: var(--color-accent-dark);
}

.ethics-warning {
    border-left: 4px solid var(--color-danger);
    padding: 24px;
    background: rgba(248, 113, 113, 0.12);
    border-radius: var(--radius-md);
    color: var(--color-text);
}

.prompt-input,
textarea {
    width: 100%;
    min-height: 140px;
    border-radius: var(--radius-md);
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: rgba(255, 255, 255, 0.95);
    color: var(--color-text);
    padding: 18px;
    font-size: 15px;
    box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
}

.tip-chip {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 999px;
    padding: 8px 18px;
    margin: 6px 6px 0 0;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition-base);
    background: rgba(255, 255, 255, 0.85);
}

.tip-chip:hover {
    background: rgba(15, 23, 42, 0.05);
}

.hidden { display: none !important; }

@media (max-width: 900px) {
    .header,
    .stats,
    .stats-bar {
        flex-direction: column;
        align-items: flex-start;
    }

    .xp-bar {
        width: 100%;
    }

    .footer-nav {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 768px) {
    body.with-global-nav {
        padding-top: 90px;
    }

    .container {
        padding: 28px 18px 70px;
    }

    .card,
    .panel,
    .section-block,
    .activity-card,
    .learning-card {
        padding: 22px;
    }

    .header {
        flex-direction: column;
        gap: 16px;
        align-items: flex-start;
    }

    .stats {
        width: 100%;
        justify-content: space-between;
    }

    .mode-selector,
    .mode-toggle {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
    }

    .mode-btn {
        flex: 1 1 48%;
        min-width: 140px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 24px 16px 48px;
    }

    .global-nav {
        padding: 14px 16px;
        gap: 8px;
    }

    .nav-toggle {
        width: 40px;
        height: 40px;
    }

    h1 {
        font-size: 28px !important;
    }

    .btn, .btn-primary, .btn-secondary {
        padding: 14px 20px;
        font-size: 15px;
        white-space: normal;
    }
}

@media (max-width: 400px) {
    .global-nav {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 10px 12px;
    }

    .nav-brand a {
        font-size: 18px;
    }

    .nav-group,
    .lesson-links {
        width: 100%;
        justify-content: flex-start;
    }

    .nav-link {
        width: 100%;
        justify-content: space-between;
    }
}

/* Chatbox component enhancements */
.chatbox-card {
    border: 1px solid #e3e8ef;
    border-radius: 10px;
    padding: 14px;
    background: linear-gradient(180deg, #ffffff, #fdfefe);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
}

.chatbox-prompt {
    font-weight: 600;
    margin-bottom: 12px;
    color: #0f172a;
}

.chatbox-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chatbox-input {
    width: 100%;
    min-height: 96px;
    padding: 10px 12px;
}

.chatbox-submit {
    align-self: flex-start;
    min-width: 160px;
}

.chatbox-meta {
    font-size: 0.9rem;
    color: #4b5563;
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.chatbox-feedback {
    margin-top: 8px;
    padding: 10px 12px;
    background: #eef2ff;
    border: 1px solid #e0e7ff;
    border-radius: 8px;
    color: #1e3a8a;
    font-size: 0.95rem;
    display: none;
}

.chatbox-feedback:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

.chatbox-feedback.is-visible {
    display: block;
}

.chatbox-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.95rem;
}

.chatbox-status.pass {
    background: #ecfdf3;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.chatbox-status.fail {
    background: #fff7ed;
    color: #9a3412;
    border: 1px solid #fed7aa;
}

.chatbox-hint {
    margin-top: 8px;
    padding: 10px 12px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: #334155;
    font-size: 0.95rem;
}

.chatbox-hint summary {
    cursor: pointer;
    font-weight: 600;
    color: #0f172a;
}

.chatbox-hint ul {
    margin: 8px 0 0 18px;
    padding: 0;
    list-style: disc;
}

.chatbox-hint li {
    margin: 2px 0;
}

.ui-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1200;
}

.ui-modal.is-visible {
    display: flex;
}

.ui-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
}

.ui-modal__card {
    position: relative;
    width: min(520px, 92vw);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 55px rgba(15, 23, 42, 0.28);
    padding: 24px;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ui-modal__title {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
}

.ui-modal__body {
    color: rgba(15, 23, 42, 0.82);
    line-height: 1.6;
    margin: 0;
}

.ui-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 8px;
}

.ui-modal__action,
.ui-modal__default {
    min-width: 120px;
    justify-content: center;
    text-align: center;
}

.ui-modal__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #fff;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.ui-modal__close:hover,
.ui-modal__close:focus-visible {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
}

.ui-toast-stack {
    position: fixed;
    bottom: 18px;
    right: 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1300;
    pointer-events: none;
}

.ui-toast {
    background: #0f172a;
    color: #f8fafc;
    padding: 12px 16px;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.35);
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: auto;
    font-weight: 600;
    max-width: 320px;
}

.ui-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 640px) {
    .chatbox-section {
        padding: 12px;
    }

    .chatbox-card {
        padding: 12px;
    }

    .chatbox-submit {
        width: 100%;
    }
}
@media (max-width: 768px) {
    .header,
    .hero {
        padding: 18px;
        text-align: left;
    }

    .logo {
        font-size: 20px;
        line-height: 1.3;
    }

    .progress-pills {
        flex-direction: column;
        align-items: stretch;
    }

    .mode-selector,
    .mode-toggle,
    .stats,
    .stats-bar {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .card,
    .panel,
    .section-block,
    .activity-card,
    .learning-card {
        padding: 18px;
    }

    .xp-bar {
        width: 100%;
    }

    .breadcrumb {
        flex-wrap: wrap;
    }

    .footer-nav {
        flex-direction: column;
        align-items: stretch;
    }

    .takeaway-card,
    .tool-card,
    .info-card {
        padding: 16px;
    }
}
