/* Challenge Academy — lesson pages, hub and printable assignments. */

/* ── Figures ─────────────────────────────────────────────────────────── */
.ca-fig { max-width: 100%; height: auto; vertical-align: middle; }
.ca-figrow { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; justify-content: center; margin: 12px 0; }
.ca-figcap { margin: 0; text-align: center; }
.ca-figcap figcaption { font-size: 0.85em; color: #4a5568; margin-top: 4px; }

/* ── Hub ─────────────────────────────────────────────────────────────── */
.ca-book { margin: 34px 0 14px; color: #5a67d8; font-size: 1.6em; border-bottom: 3px solid #e2e8f0; padding-bottom: 8px; }
.ca-lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 20px; }
.ca-card { background: linear-gradient(135deg, #f6f8fb 0%, #ffffff 100%); border: 3px solid #e2e8f0; border-radius: 15px; padding: 20px; display: flex; flex-direction: column; transition: all 0.3s ease; }
.ca-card:hover { transform: translateY(-4px); box-shadow: 0 10px 25px rgba(90, 103, 216, 0.25); border-color: #5a67d8; }
.ca-card.soon { opacity: 0.6; }
.ca-card.soon:hover { transform: none; box-shadow: none; border-color: #e2e8f0; }
.ca-soon { font-weight: bold; color: #718096; padding: 9px 0; }
.ca-card-top { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.ca-card-icon { font-size: 2.2em; line-height: 1; }
.ca-card-num { font-size: 0.85em; font-weight: bold; color: #5a67d8; text-transform: uppercase; letter-spacing: 0.05em; }
.ca-card h3 { color: #2d3748; font-size: 1.15em; line-height: 1.3; }
.ca-card p { color: #718096; line-height: 1.5; margin: 6px 0 16px; flex: 1; }
.ca-card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ca-btn { display: inline-block; padding: 9px 16px; border-radius: 22px; font: inherit; font-weight: bold; font-size: 0.95em; text-decoration: none; cursor: pointer; border: 2px solid #667eea; background: #667eea; color: white; transition: all 0.2s; }
.ca-btn:hover { background: #556cd6; border-color: #556cd6; }
.ca-btn.ghost { background: white; color: #5a67d8; }
.ca-btn.ghost:hover { background: #f5f7ff; }
.ca-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Lesson page ─────────────────────────────────────────────────────── */
.ca-nav { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0 0 6px; }
.ca-nav a { color: #5a67d8; text-decoration: none; font-weight: bold; font-size: 0.95em; }
.ca-nav a:hover { text-decoration: underline; }
.ca-tabs { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin: 20px 0; }
.ca-tab { padding: 10px 20px; border: 2px solid #ddd; border-radius: 25px; background: white; cursor: pointer; transition: all 0.3s; font: inherit; font-size: 0.95em; }
.ca-tab:hover { border-color: #667eea; background: #f5f7ff; }
.ca-tab.active { background: #667eea; color: white; border-color: #667eea; }
.ca-panel { max-width: 900px; margin: 0 auto; }
.ca-section { background: white; border-radius: 12px; padding: 22px 26px; margin: 18px 0; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); line-height: 1.75; }
.ca-section h2 { color: #5a67d8; margin-bottom: 10px; font-size: 1.4em; }
.ca-section h3 { color: #2d3748; margin: 16px 0 6px; font-size: 1.1em; }
.ca-section p { margin: 8px 0; }
.ca-section ul, .ca-section ol { margin: 8px 0 8px 26px; }
.ca-section li { margin: 4px 0; }
.ca-section table { border-collapse: collapse; margin: 12px auto; }
.ca-section th, .ca-section td { border: 1px solid #cbd5e0; padding: 6px 14px; text-align: center; }
.ca-section th { background: #f5f7ff; color: #434190; }
.ca-key, .ca-tip, .ca-warn, .ca-formula { border-radius: 8px; padding: 12px 18px; margin: 14px 0; }
.ca-key { background: #ebf4ff; border-left: 5px solid #667eea; }
.ca-tip { background: #f0fff4; border-left: 5px solid #38a169; }
.ca-warn { background: #fff5f5; border-left: 5px solid #e53e3e; }
.ca-formula { background: #fffaf0; border: 2px dashed #ed8936; text-align: center; font-size: 1.15em; }

/* Lesson summary: a mind map, topic on the left, key points on the right */
.ca-map { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.ca-map-row { display: grid; grid-template-columns: minmax(150px, 230px) 1fr; gap: 14px; align-items: center; border-left: 5px solid var(--c); padding-left: 12px; }
.ca-map-row.c0 { --c: #d9a400; --bg: #fff3bf; --soft: #fffbea; }
.ca-map-row.c1 { --c: #e8890c; --bg: #ffe0b2; --soft: #fff6e9; }
.ca-map-row.c2 { --c: #d9480f; --bg: #ffd0bd; --soft: #fff1ec; }
.ca-map-row.c3 { --c: #5a67d8; --bg: #d6dcff; --soft: #f3f5ff; }
.ca-map-topic { background: var(--bg); border-radius: 10px; padding: 12px 14px; font-weight: bold; text-align: center; color: #2d3748; line-height: 1.35; }
.ca-section ul.ca-map-points { list-style: none; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.ca-map-points li { background: var(--soft); border: 2px solid var(--bg); border-radius: 10px; padding: 6px 12px; margin: 0; line-height: 1.5; }
@media (max-width: 640px) { .ca-map-row { grid-template-columns: 1fr; gap: 8px; } }

.ca-example .ca-q { font-weight: bold; color: #2d3748; }
.ca-steps { background: #fff8e1; border-left: 4px solid #ffb300; padding: 12px 18px; margin: 12px 0; border-radius: 6px; }
.ca-steps > div { margin: 6px 0; }
.ca-steps .ca-answer { font-weight: bold; color: #2e7d32; }
.ca-hidden { display: none; }

.ca-practice-bar { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.ca-practice-bar select { font: inherit; padding: 8px 10px; border: 2px solid #ddd; border-radius: 8px; max-width: 100%; }
.ca-score { font-weight: bold; color: #5a67d8; }
.ca-level { display: inline-block; font-size: 0.8em; font-weight: bold; padding: 2px 10px; border-radius: 12px; background: #edf2f7; color: #4a5568; margin-bottom: 8px; }
.ca-problem { font-size: 1.1em; }
.ca-problem .ca-figrow, .ca-problem > .ca-fig { margin: 12px auto; }
.ca-problem > .ca-fig { display: block; }
.ca-answer-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin: 18px 0 10px; font-size: 1.15em; }
.ca-answer-row input { font: inherit; width: 150px; padding: 9px; border: 2px solid #ddd; border-radius: 6px; text-align: center; }
.ca-answer-row input.small { width: 80px; }
.ca-answer-row input:focus { outline: none; border-color: #667eea; }
.ca-choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 16px 0; }
.ca-choice { font: inherit; padding: 10px; border: 2px solid #ddd; border-radius: 10px; background: white; cursor: pointer; text-align: center; }
.ca-choice:hover { border-color: #667eea; }
.ca-choice.selected { border-color: #667eea; background: #f5f7ff; box-shadow: 0 0 0 2px #667eea inset; }
.ca-choice.right { border-color: #2e7d32; background: #e8f5e9; }
.ca-choice.wrong { border-color: #c62828; background: #ffebee; }
.ca-choice b { color: #5a67d8; margin-right: 6px; }
.ca-actions { text-align: center; }
.ca-actions .ca-btn { margin: 4px; border-radius: 8px; }
.ca-feedback { text-align: center; font-weight: bold; min-height: 1.6em; margin: 12px 0; }
.ca-feedback.good { color: #2e7d32; }
.ca-feedback.bad { color: #c62828; }
.ca-hint { text-align: center; color: #718096; font-size: 0.85em; }

@media (max-width: 768px) {
    .ca-section { padding: 16px; }
}

/* ── Printable assignment ────────────────────────────────────────────── */
body.ca-sheet-page { background: #edf2f7; padding: 20px; font-family: Georgia, 'Times New Roman', serif; color: #111; }
.ca-sheet-bar { max-width: 8.5in; margin: 0 auto 14px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-family: Helvetica, Arial, sans-serif; }
.ca-sheet { max-width: 8.5in; margin: 0 auto; background: white; padding: 0.6in; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); font-size: 11pt; line-height: 1.45; }
.ca-sheet-head { border-bottom: 3px solid #333; padding-bottom: 8px; margin-bottom: 10px; }
.ca-sheet-head .series { font-family: Helvetica, Arial, sans-serif; font-size: 9.5pt; letter-spacing: 0.12em; text-transform: uppercase; color: #555; }
.ca-sheet-head h1 { font-size: 19pt; color: #111; text-shadow: none; margin: 2px 0 0; }
.ca-sheet-meta { display: flex; gap: 24px; margin: 12px 0 6px; font-family: Helvetica, Arial, sans-serif; font-size: 10pt; }
.ca-sheet-meta span { flex: 1; border-bottom: 1px solid #555; padding-bottom: 2px; }
.ca-sheet-meta span.narrow { flex: 0 0 1.5in; }
.ca-sheet-note { font-size: 9.5pt; color: #333; margin: 8px 0 4px; font-style: italic; }
.ca-part { font-family: Helvetica, Arial, sans-serif; font-size: 11.5pt; margin: 16px 0 8px; padding: 4px 10px; background: #e8e8e8; border-left: 5px solid #333; color: #111; break-after: avoid; }
.ca-problems { display: grid; grid-template-columns: 1fr 1fr; column-gap: 0.35in; }
.ca-problems.one-col { grid-template-columns: 1fr; }
/* Compact sheets (quick facts, mental maths): three columns and a small answer space. */
.ca-problems.compact { grid-template-columns: 1fr 1fr 1fr; column-gap: 0.25in; }
.ca-problems.compact .ca-p { min-height: 0.55in; }
.ca-problems.compact .ca-p .body { padding-bottom: 0.18in; }
.ca-p { display: flex; gap: 6px; break-inside: avoid; page-break-inside: avoid; padding: 6px 0 0; min-height: 1.25in; border-top: 1px solid #ddd; }
.ca-p .n { font-family: Helvetica, Arial, sans-serif; font-weight: bold; flex: 0 0 1.9em; }
.ca-p .body { flex: 1; min-width: 0; padding-bottom: 0.5in; }
.ca-p .ca-figrow { gap: 10px; margin: 6px 0; justify-content: flex-start; }
.ca-p .body > .ca-fig { display: block; margin: 6px 0; }
.ca-p ol.opts { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: flex-end; }
.ca-p ol.opts li { display: flex; align-items: baseline; gap: 4px; }
.ca-p.has-opts .body { padding-bottom: 0.2in; }
.ca-key-page { break-before: page; page-break-before: always; margin-top: 30px; }
.ca-key-page h2 { font-family: Helvetica, Arial, sans-serif; font-size: 15pt; border-bottom: 3px solid #333; padding-bottom: 6px; margin-bottom: 10px; color: #111; }
.ca-key-list { columns: 2; column-gap: 0.35in; font-size: 9.5pt; line-height: 1.4; }
.ca-key-list .k { break-inside: avoid; margin: 0 0 7px; display: flex; gap: 6px; }
.ca-key-list .k .n { font-family: Helvetica, Arial, sans-serif; font-weight: bold; flex: 0 0 1.9em; }
.ca-key-list .k .a { font-weight: bold; }
.ca-key-list .k .s { color: #333; display: block; }
.ca-key-list .ca-fig { max-height: 60px; width: auto; }

@page { size: letter; margin: 0.6in 0.6in 0.7in; @bottom-center { content: counter(page) " / " counter(pages); font-family: Helvetica, Arial, sans-serif; font-size: 8.5pt; color: #555; } }
@media print {
    body.ca-sheet-page { background: white; padding: 0; }
    .ca-sheet-bar { display: none; }
    .ca-sheet { box-shadow: none; padding: 0; max-width: none; }
    .ca-key-page { margin-top: 0; }
}
