:root {
    --bg: #FCF9EC;
    --text: #102621;
    --cta: #FF3600;
    --accent: #E73F1E;
    --muted: #546D64;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.page {
    padding: 2rem;
    max-width: 1100px;
    margin: 0 auto;
}

.landing {
    display: grid;
    gap: 1.5rem;
}

.headline { margin: 0 0 0.5rem; font-size: 2rem; }
.subhead { margin: 0; font-size: 1.25rem; }
.lede { color: var(--muted); margin: 0 0 1rem; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; color: var(--muted); margin: 0 0 0.25rem; }
.status-chip { background: #fff; padding: 0.5rem 0.75rem; border-radius: 999px; border: 1px solid #ddd; height: fit-content; }

.card { background: #fff; border-radius: 16px; padding: 1.25rem; box-shadow: 0 10px 25px rgba(16, 38, 33, 0.08); margin-bottom: 1.5rem; }
.card-header { margin-bottom: 1rem; }
.card.muted { background: #f5f0dd; }

.hero-card { text-align: center; padding: 2rem; }
.hero-card .headline { margin-bottom: 1rem; }
.hero-card .cta { width: 100%; margin-top: 1rem; }
.hero-card img { height: 56px; width: 56px; }
.hero-card.narrow { max-width: 560px; margin: 0 auto; }

.landing .hero-card { margin-bottom: 0; }

.summary-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin: 1rem 0; }
.summary-label { margin: 0; color: var(--muted); font-size: 0.9rem; }
.summary-value { margin: 0; font-weight: 700; }

.hero-icon { display: inline-flex; align-items: center; justify-content: center; background: #fff6ec; border-radius: 999px; padding: 0.75rem; margin-bottom: 0.5rem; }

.start-panel { background: #fff6ec; padding: 1rem; border-radius: 12px; display: grid; gap: 0.5rem; text-align: left; }
.cta { background: linear-gradient(180deg, #ff4d00, #ff3600); border: none; color: #fff; font-weight: 800; border-radius: 14px; padding: 0.9rem; cursor: pointer; }
.cta:hover { filter: brightness(0.95); }

.generator { margin-top: 0; }
.generator-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.links-list { display: grid; gap: 0.5rem; margin-top: 1rem; }
.link-chip { background: #fff6ec; border: 1px solid #ffd7c2; padding: 0.75rem 1rem; border-radius: 12px; overflow-wrap: anywhere; }

.field-label { display: block; font-weight: 600; margin-bottom: 0.25rem; }
.input { width: 100%; padding: 0.75rem 1rem; border-radius: 12px; border: 1px solid #d5d5d5; font-size: 1rem; }
.hint { color: var(--muted); margin: 0.5rem 0 0; }

.actions { display: flex; gap: 0.75rem; align-items: center; margin-top: 1.5rem; flex-wrap: wrap; }
button, .primary, .secondary, .ghost { cursor: pointer; font-weight: 700; border-radius: 12px; border: none; padding: 1rem 1.5rem; font-size: 1rem; transition: all 0.2s ease; }
.primary { background: linear-gradient(90deg, var(--cta), var(--accent)); color: #fff; text-decoration: none; border: none; }
.primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(255, 54, 0, 0.3); }
.primary:disabled { opacity: 0.5; cursor: not-allowed; }
.secondary { background: #fff; border: 2px solid var(--accent); color: var(--accent); }
.secondary:hover { background: var(--accent); color: #fff; }
.ghost { background: transparent; color: var(--muted); border: 2px solid #d5d5d5; }
.ghost:hover:not(:disabled) { border-color: var(--text); color: var(--text); }
.ghost:disabled { opacity: 0.5; cursor: not-allowed; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1rem; }
.lesson-card { position: sticky; top: 1rem; align-self: start; }
.body-content p { margin-top: 0; line-height: 1.6; }
.body-content strong { font-weight: 700; color: var(--text); }
.module-card { max-width: 700px; margin: 0 auto 1.5rem; padding: 0; overflow: hidden; }
.module-card .body-content { padding: 1.5rem; }
.module-card .actions { padding: 0 1.5rem 1.5rem; margin-top: 0; }
.module-card .module-header { padding: 1.5rem; }
.module-card .options { padding: 0 1.5rem; }
.module-card .feedback { margin: 1rem 1.5rem; }

/* Lesson image header styles */
.lesson-image-header {
    position: relative;
    width: 100%;
    height: 300px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}
.lesson-image-header:hover {
    transform: scale(1.02);
}
.lesson-image-header img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--text);
}

.lesson-image-header-grid {
    position: relative;
    width: 100%;
    height: 300px;
    display: grid;
    gap: 2px;
}
.lesson-image-header-grid.two-images {
    grid-template-columns: 1fr 1fr;
}
.lesson-image-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}
.lesson-image-item:hover {
    transform: scale(1.02);
}
.lesson-image-item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--text);
}

.lesson-header-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.4) 70%, transparent 100%);
    color: #fff;
}
.lesson-number-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--cta);
    background: rgba(255,255,255,0.95);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    margin-bottom: 0.5rem;
}
.lesson-title {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.lesson-header-no-image {
    padding: 2rem 1.5rem;
    background: var(--text);
    color: #fff;
}
.module-header { display: flex; align-items: flex-start; gap: 1rem; justify-content: space-between; flex-wrap: wrap; margin-bottom: 1.5rem; }
.module-title { flex: 1; }
.module-title .eyebrow { font-size: 0.875rem; color: var(--muted); margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.module-title .subhead { font-size: 1.5rem; line-height: 1.4; margin: 0; font-weight: 700; color: var(--text); }
.pill { background: #fff0e6; color: var(--accent); padding: 0.5rem 1rem; border-radius: 999px; font-weight: 700; font-size: 0.875rem; white-space: nowrap; }

/* Quiz layout - title at top, question below */
.quiz-header { 
    padding: 1.5rem 1.5rem 1rem; 
    border-bottom: 1px solid #f0f0f0;
}

.question-container { 
    padding: 1.5rem; 
}

.question-number { 
    font-size: 0.875rem; 
    color: var(--muted); 
    margin: 0 0 0.75rem; 
    text-transform: uppercase; 
    letter-spacing: 0.05em; 
    font-weight: 600; 
}

.question-prompt { 
    font-size: 1.5rem; 
    line-height: 1.4; 
    margin: 0; 
    font-weight: 700; 
    color: var(--text); 
}
.review { color: var(--accent); font-weight: 700; text-decoration: none; font-size: 0.875rem; padding: 0.5rem 1rem; border: 2px solid var(--accent); border-radius: 8px; transition: all 0.2s ease; display: inline-block; }
.review:hover { background: var(--accent); color: #fff; text-decoration: none; }

.image-wrapper { position: relative; overflow: hidden; border-radius: 12px; margin-top: 1rem; cursor: pointer; }
.image-wrapper img { width: 100%; display: block; border-radius: 12px; }
.image-hint { position: absolute; bottom: 0.5rem; right: 0.5rem; background: rgba(16,38,33,0.75); color: #fff; padding: 0.25rem 0.5rem; border-radius: 8px; font-size: 0.75rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.5rem; margin-top: 0.5rem; }

.options { display: grid; gap: 1rem; margin-bottom: 1.5rem; }
.option { display: flex; gap: 1rem; padding: 1.25rem 1.5rem; border: 2px solid #e5e5e5; border-radius: 12px; align-items: center; cursor: pointer; transition: all 0.2s ease; background: #fff; }
.option:hover { border-color: var(--accent); background: #fff6ec; transform: translateX(2px); }
.option input[type="radio"] { width: 20px; height: 20px; margin: 0; cursor: pointer; accent-color: var(--accent); }
.option input[type="radio"]:checked + span { font-weight: 600; color: var(--text); }
.option span { flex: 1; font-size: 1rem; line-height: 1.5; color: var(--text); }
.feedback { padding: 1.25rem 1.5rem; border-radius: 12px; font-size: 1rem; line-height: 1.6; }
.feedback.success { background: #e5f7ec; color: #0f5132; border-left: 4px solid #0f5132; }
.feedback.error { background: #ffe8e8; color: #781313; border-left: 4px solid #781313; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; padding: 1rem; }
.modal-content { background: #fff; padding: 1rem; border-radius: 12px; max-width: 90%; max-height: 90%; overflow: auto; }
.modal-content img { max-width: 100%; max-height: 80vh; display: block; margin-bottom: 0.5rem; }
.lesson-overlay { width: min(900px, 100%); }

.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: 1rem; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.5rem; background: #fff; border-bottom: 1px solid #e5e5e5; max-width: 700px; margin: 0 auto 1rem; }
.topbar-left { display: flex; flex-direction: column; gap: 0.25rem; }
.topbar-right { display: flex; align-items: center; gap: 0.75rem; }
.lesson-number { font-size: 0.875rem; font-weight: 600; color: var(--text); }
.progress-text { font-size: 0.875rem; color: var(--muted); }
.progress-percent { font-size: 1rem; font-weight: 700; color: var(--text); }
.progress { background: #ffe0d2; border-radius: 999px; height: 8px; width: 120px; overflow: hidden; }
.progress-bar { background: linear-gradient(90deg, var(--cta), var(--accent)); height: 100%; transition: width 0.3s ease; }
.progress-label { font-size: 0.75rem; color: var(--muted); margin: 0; }
.description { margin: 0.25rem 0 0; color: var(--muted); }
.list { margin: 0.5rem 0 0; padding-left: 1.25rem; color: var(--muted); }
.error { color: #781313; }

/* Completion Card Styles */
.completion-card {
    max-width: 560px;
    margin: 2rem auto;
    padding: 3rem 2rem;
    text-align: center;
}

.completion-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    border: 3px solid var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
}

.completion-icon svg {
    width: 56px;
    height: 56px;
    color: var(--text);
}

.completion-title {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 0.75rem;
}

.completion-subtitle {
    font-size: 1.125rem;
    color: var(--muted);
    margin: 0 0 1.5rem;
}

.completion-email {
    font-size: 1rem;
    color: var(--text);
    margin: 0 0 2rem;
    line-height: 1.6;
}

.email-highlight {
    color: var(--cta);
    font-weight: 700;
}

.completion-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-box {
    background: #fff6ec;
    border: 2px solid #ffd7c2;
    border-radius: 16px;
    padding: 1.5rem 1rem;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--cta);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.completion-actions {
    margin-top: 2rem;
}

.restart-button {
    background: linear-gradient(180deg, #ff4d00, #ff3600);
    border: none;
    color: #fff;
    font-weight: 800;
    border-radius: 14px;
    padding: 1.25rem 3rem;
    font-size: 1.125rem;
    cursor: pointer;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 20px rgba(255, 54, 0, 0.25);
    transition: all 0.2s ease;
}

.restart-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(255, 54, 0, 0.35);
}

.restart-button:active {
    transform: translateY(0);
}

/* Login Page Styles */
.login-card {
    max-width: 480px;
    margin: 4rem auto 2rem;
    padding: 2.5rem 2rem;
}

.login-form {
    display: grid;
    gap: 1rem;
    margin-top: 1.5rem;
}

.login-form .actions {
    margin-top: 0.5rem;
}

.login-form .primary {
    width: 100%;
}

.header-with-logout {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.logout-btn {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0.75rem 1.25rem;
}

/* Step-by-step lesson layout - text on left, image on right */
.lesson-step-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: center;
    margin: 1.5rem 0;
    padding: 1.25rem;
    background: #fff6ec;
    border-radius: 12px;
    border: 1px solid #ffd7c2;
}

.lesson-step-text {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text);
}

.lesson-step-image {
    display: flex;
    justify-content: center;
    align-items: center;
}

.lesson-step-image img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
}

.lesson-step-image img:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Stack image below text on mobile */
@media (max-width: 768px) {
    .page { padding: 1.25rem; }
    .header { flex-direction: column; align-items: flex-start; }
    .lesson-card { position: static; }
    
    .lesson-step-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .lesson-step-image img {
        max-height: 300px;
    }
    
    .completion-card {
        padding: 2rem 1.5rem;
    }
    
    .completion-title {
        font-size: 2rem;
    }
    
    .completion-icon {
        width: 100px;
        height: 100px;
    }
    
    .completion-icon svg {
        width: 48px;
        height: 48px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .login-card {
        margin: 2rem auto;
        padding: 2rem 1.5rem;
    }
    
    .header-with-logout {
        flex-direction: column;
        align-items: stretch;
    }
    
    .logout-btn {
        width: 100%;
    }
}
