:root{font:16px/1.5 system-ui,sans-serif;color:#20274b;background:#f5f8ff}*{box-sizing:border-box}body{margin:0}header{background:#fff;box-shadow:0 2px 18px #3a438a17;padding:12px max(16px,calc((100vw - 1200px)/2));display:flex;align-items:center;justify-content:space-between;gap:18px;flex-wrap:wrap}header img{width:145px;max-height:70px;object-fit:contain}nav{display:flex;gap:6px;flex-wrap:wrap}button,a.button{border:0;border-radius:12px;background:#ecefff;color:#2e397e;padding:10px 15px;font:inherit;font-weight:650;cursor:pointer}button:hover,a.button:hover{background:#dce7ff}button.primary,a.primary{background:#23b9b8;color:#072e42}button.coral{background:#ffdfd7;color:#823d42}button:disabled{opacity:.55;cursor:not-allowed}main{max-width:1200px;min-height:75vh;margin:auto;padding:28px 18px}.hero{background:linear-gradient(120deg,#d9fcf7,#e6e9ff 60%,#ffe8df);border-radius:24px;padding:32px;margin-bottom:24px}.hero h1{font-size:clamp(2rem,4vw,3.8rem);margin:.1em 0}.eyebrow{color:#4f58ac;font-weight:800;text-transform:uppercase;letter-spacing:.08em}.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:18px}.card{background:white;border:1px solid #e1e7f6;border-radius:18px;padding:22px;box-shadow:0 5px 15px #1f33880c;margin-bottom:16px}h2,h3{margin-top:0}label{display:block;font-weight:650;margin:10px 0 4px}input,textarea,select{width:100%;border:1px solid #b9c3dd;border-radius:10px;padding:10px;font:inherit;background:#fff;color:#20274b}textarea{min-height:90px}form{margin:0}.row{display:flex;gap:10px;flex-wrap:wrap;align-items:center}.muted{color:#68718f}.status{border-radius:10px;padding:10px;background:#e8f7f5}.error{background:#ffe5e1;color:#823d42}.progress{height:12px;border-radius:20px;background:#e2e8fa;overflow:hidden}.progress span{display:block;height:100%;background:#21b9b7}.chatlog{height:360px;overflow:auto;background:#f7f9ff;border-radius:15px;padding:12px}.bubble{max-width:88%;padding:11px 14px;border-radius:14px;background:#e8efff;margin:8px 0}.bubble.student{margin-left:auto;background:#d8f6f1}.tasks{display:grid;gap:12px}.task{border-left:5px solid #606ccc}.task.done{border-color:#24b7a8}.task.review{border-color:#ef9c7d}footer{background:#e8edfa;padding:24px;text-align:center;display:flex;gap:20px;justify-content:center;flex-wrap:wrap}footer a{color:#2e397e}pre{white-space:pre-wrap;overflow-wrap:anywhere}table{border-collapse:collapse;width:100%}td,th{padding:9px;border-bottom:1px solid #e5e9f4;text-align:left}@media(max-width:650px){header{justify-content:center}nav{justify-content:center}main{padding:18px 12px}.hero{padding:24px}.chatlog{height:280px}}
.learning-head{padding:20px 24px}.learning-head h1{font-size:clamp(1.5rem,3vw,2.4rem)}.learning-layout{display:grid;grid-template-columns:minmax(0,1fr) 260px;gap:18px}.learning-main{min-width:0}.learning-main .chatlog{height:min(56vh,650px);overflow-y:auto;display:flex;flex-direction:column;gap:12px;padding:12px;background:#f7f9ff;border-radius:16px}.learning-main .bubble{max-width:85%;white-space:normal;overflow-wrap:anywhere;line-height:1.55}.learning-main .bubble.student{align-self:flex-end}.learning-main .bubble.tutor{align-self:flex-start}.learning-main .bubble small{display:block;font-weight:700;opacity:.7}.learning-main textarea{width:100%;min-height:110px;resize:vertical}.learning-side button{display:block;width:100%;margin:7px 0;text-align:left}.learning-side summary{font-weight:700;cursor:pointer}@media(max-width:750px){main{padding:12px}.learning-layout{display:block}.learning-side{margin-top:14px}.learning-main .chatlog{height:55vh}.learning-main .bubble{max-width:96%}.learning-head{margin-bottom:12px}}
.learning-layout{grid-template-columns:minmax(0,1fr) 220px 310px}.parent-chat{min-width:0}.parent-chat summary{font-weight:750;cursor:pointer;color:#2e397e}.parent-messages{max-height:42vh;overflow:auto;background:#f7f9ff;border-radius:12px;padding:10px;margin:12px 0}.parent-line{padding:10px;border-radius:12px;background:#fff;margin-bottom:8px;overflow-wrap:anywhere}.parent-line.student{background:#e2fbf8}.parent-line small{display:block;color:#546080;font-size:.75rem}.parent-chat textarea,#manageParentForm textarea{width:100%;resize:vertical}.parent-chat .check{display:flex;gap:8px;align-items:center}.parent-chat .check input{width:auto}@media(max-width:1050px){.learning-layout{grid-template-columns:minmax(0,1fr) 250px}.parent-chat{grid-column:1/-1}}@media(max-width:750px){.learning-layout{display:block}.parent-chat{margin-top:14px}.parent-chat:not(:has(details[open])){position:fixed;right:12px;bottom:12px;z-index:20;box-shadow:0 10px 28px #20274b44;padding:12px}.parent-chat:has(details[open]){position:fixed;inset:10px;z-index:30;overflow:auto;box-shadow:0 0 0 100vmax #20274b88}.parent-messages{max-height:52vh}}
/* Keep the composer at the bottom of the learning pane while only the transcript scrolls. */
.learning-main{display:flex;flex-direction:column;min-height:min(76vh,760px)}
.learning-main .chatlog{flex:1 1 auto;min-height:220px;max-height:min(58vh,660px)}
.learning-main #chatForm{position:sticky;bottom:0;background:#fff;padding:10px 0 2px;z-index:2}
@media(max-width:750px){.learning-main{min-height:70vh}.learning-main .chatlog{max-height:54vh}.learning-main #chatForm{bottom:env(safe-area-inset-bottom)}}
.help-choice{border:1px solid #aebfe5;background:#f3f6ff;padding:12px;border-radius:12px;margin:6px 0 10px}
.help-choice strong{display:block;margin-bottom:8px}
.active-task{border-left:4px solid #5965c4;background:#f5f7ff;border-radius:9px;padding:8px 11px;margin-bottom:8px;max-height:22vh;overflow:auto;overflow-wrap:anywhere}
.active-task small{display:block;color:#434f9c;font-weight:700}
.curriculum-grid{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:1rem}
.curriculum-topic,.curriculum-chosen{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;padding:.65rem;border:1px solid #d5dfeb;border-radius:.7rem;margin:.4rem 0;background:#f8fbff}
.curriculum-topic strong,.curriculum-chosen strong{flex:1 1 11rem}.curriculum-topic small{display:block;color:#526278;flex:1 1 10rem}
.curriculum-topic[hidden]{display:none}.curriculum-drop{border:2px dashed #9ab0c9;border-radius:.7rem;padding:.7rem;margin:.5rem 0;color:#526278}
.curriculum-chosen label{min-width:6rem;max-width:9rem}.curriculum-chosen input,.curriculum-chosen select{width:100%}
@media(max-width:760px){.curriculum-grid{grid-template-columns:1fr}.curriculum-topic{cursor:auto}}
.curriculum-heading{display:flex;justify-content:space-between;align-items:flex-start;gap:1rem;flex-wrap:wrap}.curriculum-heading h2{margin-bottom:.25rem}.curriculum-heading p{margin:.25rem 0}.curriculum-heading>strong{background:#e8f7f5;border-radius:20px;padding:.4rem .8rem;white-space:nowrap}
.curriculum-filters{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.75rem;margin:.75rem 0}.curriculum-filters label{min-width:0}.curriculum-selection-panel{min-width:0;background:#f7f9ff;border:1px solid #dfe6f2;border-radius:14px;padding:1rem;align-self:start}.curriculum-selection-panel h3{margin-bottom:.2rem}
.curriculum-area{border:1px solid #d5dfeb;border-radius:12px;margin:.6rem 0;background:#fff;overflow:hidden}.curriculum-area>summary{cursor:pointer;padding:.7rem;background:#eef3ff;display:flex;gap:.45rem;align-items:center;flex-wrap:wrap}.curriculum-area>summary strong{flex:1 1 11rem}.curriculum-area>summary span,.curriculum-area>summary em{font-size:.82rem;color:#526278;font-style:normal}.curriculum-children{padding:0 .6rem .5rem 1rem;border-left:3px solid #b6c8e8;margin-left:.7rem}
.curriculum-topic{min-width:0}.curriculum-topic .topic-check{display:flex;align-items:flex-start;gap:.6rem;flex:1 1 16rem;min-width:0;margin:0;cursor:pointer}.curriculum-topic .topic-check input{width:1.2rem;min-width:1.2rem;margin:.3rem 0 0}.curriculum-topic .topic-check span{min-width:0}.curriculum-topic .topic-check strong{display:block}.curriculum-topic .topic-check small{font-weight:400}.curriculum-chosen{cursor:grab}.curriculum-chosen small{flex:1 1 100%;color:#526278}.curriculum-reuse{margin-top:1.2rem}.curriculum-reuse label{min-width:14rem}.curriculum-week{margin-top:1rem}.curriculum-week summary{cursor:pointer;font-weight:700}
@media(max-width:900px){.curriculum-filters{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:600px){.curriculum-filters{grid-template-columns:1fr}.curriculum-topic button{width:100%}.curriculum-selection-panel{padding:.75rem}.curriculum-chosen label{flex:1 1 42%;max-width:none}.curriculum-reuse label{width:100%}}
/* Task review belongs to the single curriculum-driven planning workflow. */
#planWorkflow{scroll-margin-top:1rem}
#planWorkflow form{display:grid;gap:1rem}
#planWorkflow .task-preview{border:1px solid var(--border,#d8e2e8);border-radius:1rem;padding:1rem;margin:1rem 0;background:#f8fbfd;display:grid;gap:.75rem}
#planWorkflow .task-preview header{display:flex;justify-content:space-between;gap:1rem;flex-wrap:wrap}
#planWorkflow .task-preview-grid{display:grid;grid-template-columns:minmax(0,2fr) minmax(6rem,1fr);gap:.75rem}
#planWorkflow textarea,#planWorkflow input,#planWorkflow select{max-width:100%;box-sizing:border-box}
#planWorkflow .task-preview .row{flex-wrap:wrap}
@media(max-width:640px){#planWorkflow .task-preview-grid{grid-template-columns:1fr}#planWorkflow .task-preview{padding:.75rem}}

/* Student learning view: the chat owns the canvas; optional panels are progressive disclosure. */
main.learning-page{width:100%;max-width:none;min-width:0;margin:0;padding:clamp(12px,1.8vw,32px);overflow-x:clip}
.learning-page .learning-head{margin-bottom:clamp(12px,1.3vw,24px)}
.learning-page .learning-layout{display:grid;grid-template-columns:minmax(0,1fr);gap:clamp(12px,1.2vw,24px);align-items:stretch;min-width:0}
.learning-page .learning-layout[data-panel="history"],.learning-page .learning-layout[data-panel="parent"]{grid-template-columns:minmax(0,1fr) clamp(300px,22vw,380px)}
.learning-page .learning-side,.learning-page .parent-chat{display:none;min-width:0;grid-column:auto;margin:0;overflow:auto;max-height:clamp(650px,calc(100dvh - 220px),1200px)}
.learning-page .learning-layout[data-panel="history"] .learning-side,.learning-page .learning-layout[data-panel="parent"] .parent-chat{display:block}
.learning-page .learning-side summary,.learning-page .parent-chat summary{display:none}
.learning-page .learning-side h3,.learning-page .parent-chat h3{margin:0 0 12px}
.learning-page .panel-close{display:block;margin-left:auto;margin-bottom:12px;padding:7px 11px}
.learning-page .learning-main{height:clamp(650px,calc(100dvh - 220px),1200px);min-height:0;max-height:none;min-width:0;margin:0;display:flex;flex-direction:column}
.learning-page .chat-toolbar{display:flex;gap:12px;align-items:center;justify-content:space-between;flex-wrap:wrap;margin-bottom:12px}
.learning-page .chat-toolbar h2{margin:0}
.learning-page .chat-panel-actions{display:flex;flex-wrap:wrap;gap:8px}
.learning-page .chat-panel-actions button.is-active{background:#d8f6f1;box-shadow:inset 0 0 0 2px #23b9b8}
.learning-page .unread-badge:not(:empty){display:inline-block;background:#d1433b;color:white;border-radius:999px;padding:0 7px;margin-left:4px;font-size:.8rem}
.learning-page .learning-main .chatlog{height:auto;max-height:none;min-height:230px;flex:1 1 auto;overflow-y:auto;min-width:0}
.learning-page .learning-main .bubble{max-width:min(86%,78ch);min-width:0;overflow-wrap:anywhere;white-space:normal}
.learning-page .learning-main .bubble>div{white-space:pre-wrap;overflow-wrap:anywhere;word-break:normal}
.learning-page .learning-main #chatForm{flex:0 0 auto;min-width:0;max-width:100%;padding-top:12px}
.learning-page .learning-main .active-task{max-height:min(28vh,280px);overflow-y:auto;white-space:pre-wrap;overflow-wrap:anywhere}
.learning-page .learning-main textarea{max-height:26vh;min-height:90px}
@media(max-width:1150px){
 .learning-page .learning-layout[data-panel="history"],.learning-page .learning-layout[data-panel="parent"]{grid-template-columns:minmax(0,1fr)}
 .learning-page .learning-side,.learning-page .parent-chat,.learning-page .parent-chat:not(:has(details[open])),.learning-page .parent-chat:has(details[open]){position:fixed;inset:0 0 0 auto;width:min(460px,100vw);max-height:100dvh;height:100dvh;z-index:50;border-radius:18px 0 0 18px;overflow-y:auto;background:white;box-shadow:0 0 0 100vmax #20274b77;padding:20px;margin:0}
 .learning-page .learning-main{height:clamp(590px,calc(100dvh - 180px),1000px)}
}
@media(max-width:650px){
 .learning-page .learning-side,.learning-page .parent-chat,.learning-page .parent-chat:not(:has(details[open])),.learning-page .parent-chat:has(details[open]){width:100vw;border-radius:0;padding:16px 14px}
 .learning-page .learning-head{padding:16px}
 .learning-page .chat-toolbar{align-items:flex-start}
 .learning-page .chat-panel-actions{width:100%}
 .learning-page .chat-panel-actions button{flex:1 1 auto}
 .learning-page .learning-main{height:clamp(570px,calc(100dvh - 120px),850px);padding:14px}
 .learning-page .learning-main .chatlog{min-height:190px}
 .learning-page .learning-main .bubble{max-width:96%}
}
/* The transcript, not the whole composer, scrolls. A viewport-sticky composer overlaps messages on phones. */
.learning-page .learning-main #chatForm{position:static;bottom:auto;z-index:auto}
/* Let exceptionally long tasks grow the card instead of escaping over the footer. */
.learning-page .learning-main{height:auto;min-height:clamp(650px,calc(100dvh - 220px),1200px)}
.learning-page .learning-main .chatlog{height:clamp(260px,45vh,650px);flex:1 1 260px}
.learning-page .learning-main .active-task{max-height:min(20vh,180px)}
@media(max-width:650px){
 .learning-page .learning-main{height:auto;min-height:clamp(570px,calc(100dvh - 120px),850px)}
 .learning-page .learning-main .chatlog{height:clamp(190px,33vh,320px);flex:1 1 190px}
 .learning-page .learning-main .active-task{max-height:min(20vh,150px)}
}
