/* Portal theme: white + light green, with small hints of red */
:root {
  --bg: #f3faf6;                 /* page background, a faint mint */
  --card: #ffffff;
  --line: #e2f0e7;               /* thin borders */
  --line-strong: #cfe6d8;        /* input and outline-button borders */
  --mint: #f0faf4;               /* hovers and soft panels */
  --green-soft: #e1f5e9;         /* badges, chips, soft fills */
  --green-light: #b4e9c9;        /* main buttons */
  --green-light-hover: #9ee0b8;
  --green: #5cc189;              /* accents: progress, borders, focus */
  --green-dark: #23744b;         /* green text, readable on white */
  --green-ink: #154a30;          /* text on light green buttons */
  --red: #d0453e;
  --red-ink: #b3362f;            /* red text on light red */
  --red-soft: #fdeeed;
  --red-line: #f6d0cd;
  --amber-soft: #fff6df;
  --amber-line: #f2dfaa;
  --amber-text: #7a5300;
  --text: #1c2b23;
  --muted: #64776d;
  --radius: 16px;
  --radius-sm: 10px;
  --ring: 0 0 0 3px rgba(92, 193, 137, .25);
  --shadow: 0 1px 2px rgba(24, 80, 50, .04), 0 2px 12px rgba(24, 80, 50, .04);
  --shadow-hover: 0 2px 4px rgba(24, 80, 50, .05), 0 10px 28px rgba(24, 80, 50, .09);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--green-dark); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0 0 12px; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 28px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 12px; }
input[type=checkbox], input[type=radio] { accent-color: var(--green); }

/* Top bar */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1040px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; color: var(--text); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 4px var(--red-soft); }
nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
nav a { color: var(--muted); font-size: 14px; padding: 6px 12px; border-radius: 8px; }
nav a:hover { color: var(--green-dark); background: var(--mint); text-decoration: none; }
nav .who { color: var(--muted); font-size: 13px; background: var(--mint); border: 1px solid var(--line); padding: 3px 12px; border-radius: 999px; margin-right: 8px; }

/* Page layout */
main { margin: 36px auto; padding: 0 20px; }
main.wide { max-width: 1040px; }
main.narrow { max-width: 440px; }
.page-head { margin-bottom: 24px; }
.page-head p { color: var(--muted); }
.grid { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.grid .card { margin-bottom: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head h2 { margin: 0; }
.sub { color: var(--muted); font-size: 13px; }

/* Stats row */
.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 26px; line-height: 1.3; letter-spacing: -.02em; color: var(--text); }
.stat span { color: var(--muted); font-size: 13px; }

/* Forms */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.row { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
input[type=text], input[type=password], input[type=number], input[type=search], input[type=date], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); font: inherit; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green); box-shadow: var(--ring); }
::placeholder { color: #9aaba2; }
textarea { min-height: 160px; resize: vertical; }
.hint { color: var(--muted); font-size: 12px; margin-top: 6px; }

/* Buttons: light green for the main action, white with a border for the rest */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: var(--radius-sm); padding: 10px 18px;
  background: var(--green-light); color: var(--green-ink); font-family: inherit; font-size: 15px; font-weight: 600; line-height: 1.2; cursor: pointer;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
button:hover, .btn:hover { background: var(--green-light-hover); text-decoration: none; }
button:focus-visible, .btn:focus-visible { outline: none; box-shadow: var(--ring); }
button.full { width: 100%; }
button:disabled { opacity: .45; cursor: default; }
.btn-soft, button.btn-soft, button.icon-btn { background: #fff; color: var(--green-dark); border-color: var(--line-strong); }
.btn-soft:hover, button.btn-soft:hover, button.icon-btn:hover { background: var(--mint); border-color: var(--green); }
button.icon-btn { padding: 6px 11px; font-size: 14px; }
button.btn-danger { background: var(--red-soft); color: var(--red-ink); border-color: var(--red-line); }
button.btn-danger:hover { background: #fbdedc; }
button.link-danger { background: none; border: 0; color: var(--red-ink); padding: 4px 8px; font-size: 13px; }
button.link-danger:hover { background: var(--red-soft); }

/* Student / Teacher switch */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--mint); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; }
.seg input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg label { text-align: center; padding: 8px; border-radius: 8px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg input:checked + label { background: #fff; color: var(--green-dark); box-shadow: 0 1px 3px rgba(24, 80, 50, .12); }
.seg input:focus-visible + label { box-shadow: var(--ring); }
form:has(#role-teacher:checked) .for-student,
form:not(:has(#role-teacher:checked)) .for-teacher { display: none; }

/* Messages */
.msg { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 14px; }
.msg.err { background: var(--red-soft); color: var(--red-ink); border: 1px solid var(--red-line); }
.msg.ok { background: var(--green-soft); color: var(--green-dark); border: 1px solid #cdebd9; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 700; background: var(--green-soft); color: var(--green-ink); padding: 2px 8px; border-radius: 6px; }

/* Badges */
.badge { display: inline-block; font-size: 12px; font-weight: 600; line-height: 1.4; padding: 3px 10px; border-radius: 999px; }
.badge.green { background: var(--green-soft); color: var(--green-dark); }
.badge.red { background: var(--red-soft); color: var(--red-ink); }
.badge.grey { background: #eef3f0; color: var(--muted); }

/* Lists of items (assignments, modules, submissions) */
.item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item .sub { display: block; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* Module page */
.passage { background: var(--mint); border-left: 4px solid var(--green); border-radius: var(--radius-sm); padding: 16px 18px; line-height: 1.7; margin-bottom: 16px; }
.task { font-weight: 600; margin-bottom: 12px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--green-dark); margin-bottom: 6px; }

/* Submissions */
.answer { background: #fbfdfc; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin: 10px 0; white-space: pre-wrap; }
details { margin-top: 8px; }
summary { cursor: pointer; font-weight: 600; color: var(--green-dark); }
.report { white-space: pre-wrap; background: var(--mint); border-radius: var(--radius-sm); padding: 14px; margin-top: 10px; font-size: 14px; }

.center { text-align: center; }
.mt { margin-top: 16px; }

.page-head .eyebrow { color: var(--green-dark); }

@media (max-width: 600px) {
  .row { grid-template-columns: 1fr; }
  .card { padding: 18px; }
  h1 { font-size: 23px; }
  main { margin: 24px auto; }
  .topbar-in { padding: 10px 16px; gap: 8px; }
  nav { gap: 0; }
  nav a { padding: 6px 8px; font-size: 13px; }
  nav .who { display: none; }
}
.actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* Module builder */
textarea.short { min-height: 90px; }
.block { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow); }
.passage-block { border-left: 4px solid var(--green); }
.question-block { border-left: 4px solid var(--red); }
.block-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.block-tools { display: flex; align-items: center; gap: 6px; }
.block textarea { min-height: 90px; }
.passage-block textarea { min-height: 200px; }
.q-meta { display: grid; grid-template-columns: 1fr 160px; gap: 12px; margin-top: 12px; }
.q-meta .field { margin-bottom: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 24px; }
.danger-zone { border-color: var(--red-line); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.check input { width: auto; margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Questions on the student page and in reports */
.q-label { font-weight: 700; margin: 22px 0 6px; }
.q-label:first-child { margin-top: 0; }
.marks { color: var(--muted); font-weight: 400; }

@media (max-width: 600px) {
  .q-meta { grid-template-columns: 1fr; }
}

/* Narrative builder */
.choices { display: grid; gap: 10px; }
.choice { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 12px; background: #fff; cursor: pointer; line-height: 1.5; transition: border-color .15s, background .15s; }
.choice:hover { border-color: var(--green); }
.choice input { margin: 4px 0 0; flex-shrink: 0; }
.choice:has(input:checked) { border-color: var(--green); background: var(--mint); box-shadow: var(--ring); }
.steps-bar { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin-top: 4px; }
.steps-bar span { height: 6px; border-radius: 3px; background: #e3efe8; }
.steps-bar span.done { background: var(--green); }
.steps-bar span.now { background: var(--red); }
textarea.story-box { min-height: 420px; line-height: 1.7; }
.type-tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 2px 8px; border-radius: 999px; background: var(--red-soft); color: var(--red-ink); margin-left: 6px; vertical-align: middle; }

/* IGCSE button and its (i) rules */
.pill-wrap { position: relative; display: inline-block; margin-top: 2px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 8px 18px; border: 1px solid var(--line-strong); border-radius: 999px; font-weight: 700; cursor: pointer; background: #fff; }
.pill input { width: auto; margin: 0; accent-color: var(--red); }
.pill:has(input:checked) { background: var(--red-soft); border-color: var(--red); color: var(--red-ink); }
.info { position: absolute; top: -8px; right: -8px; width: 18px; height: 18px; border-radius: 50%; background: var(--red); color: #fff; font: italic 700 12px/18px Georgia, serif; text-align: center; cursor: help; z-index: 5; }
.info:focus { outline: 2px solid var(--green); outline-offset: 2px; }
.info .tip { display: none; position: absolute; top: 24px; left: -8px; width: min(340px, 80vw); background: #fff; color: var(--text); border: 1px solid var(--line); border-top: 3px solid var(--red); border-radius: var(--radius-sm); box-shadow: var(--shadow-hover); padding: 12px 14px; font: 13px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; text-align: left; text-transform: none; letter-spacing: 0; cursor: default; }
.info:hover .tip, .info:focus .tip, .info:focus-within .tip { display: block; }
.info .tip ul { margin: 6px 0; padding-left: 18px; }
.info .tip li { margin-bottom: 4px; }
.info .tip em { color: var(--muted); font-size: 12px; }
.igcse-badge { position: relative; margin-left: 8px; vertical-align: middle; padding-right: 14px; }

/* Story pictures */
.cover-pic { display: block; width: 100%; max-width: 520px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); margin: 12px 0 4px; background: var(--green-soft); }
.plot-step { display: flex; align-items: flex-start; justify-content: flex-start; gap: 14px; }
.step-pic { width: 110px; height: 82px; object-fit: cover; border-radius: var(--radius-sm); flex-shrink: 0; background: var(--green-soft); }
img.thumb { width: 72px; height: 54px; object-fit: cover; border-radius: 6px; display: block; background: var(--green-soft); }
.pic-strip { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

/* Writing analyser feedback */
.answer.marked { white-space: normal; line-height: 1.8; }
mark.mistake { background: var(--red-soft); color: inherit; border-bottom: 2px solid var(--red); padding: 0 2px; border-radius: 3px; }
mark.mistake sup { color: var(--red-ink); font-weight: 700; margin-left: 2px; }
.fix-list li, .good-list li { margin-bottom: 8px; }
.fix-list .quote { color: var(--red-ink); font-weight: 600; }
.good-list .quote { color: var(--green-dark); font-weight: 600; }
.fix-list .fix { display: block; color: var(--green-dark); font-size: 14px; }
.focus-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }

/* Assign a module: class / student lists with search */
[hidden] { display: none !important; }
form:has(#to-student:checked) .list-class, form:has(#to-class:checked) .list-student { display: none; }
input[type=search] { margin-bottom: 8px; }
.pick-list { max-height: 230px; overflow-y: auto; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 14px; }
.pick { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.pick:hover { background: var(--mint); }
.pick:has(input:checked) { background: var(--green-soft); box-shadow: inset 3px 0 0 var(--green); }
.pick input { width: auto; margin: 0; }
.pick .sub { display: block; }
.pick-list .empty { padding: 8px 10px; margin: 0; }

/* Student tools */
.tools { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.tool { display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); color: var(--text); font-weight: 400; transition: border-color .15s, box-shadow .15s, transform .15s; }
.tool:hover { text-decoration: none; border-color: var(--green); box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.tool strong { font-size: 17px; }
.tool-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--green-soft); color: var(--green-dark); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.tool-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tool-go { margin-top: auto; padding-top: 10px; color: var(--green-dark); font-weight: 700; }
.tool .badge { align-self: flex-start; }

/* Heroic Story Builder */
.badge.amber, .chip.amber { background: var(--amber-soft); color: var(--amber-text); }
.hero-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.hero-side { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.arc-list { list-style: none; padding: 0; margin: 0; }
.arc-list li { padding: 8px 0 8px 12px; border-left: 3px solid var(--line); margin-bottom: 4px; }
.arc-list li.done { border-left-color: var(--green); }
.arc-list li.now { border-left-color: var(--red); background: var(--red-soft); border-radius: 0 8px 8px 0; }
.arc-list li.todo { color: var(--muted); }
.arc-name { display: block; font-weight: 700; font-size: 13px; }
.arc-text { display: block; font-size: 13px; color: var(--muted); }
.steps-bar.nine { grid-template-columns: repeat(9, 1fr); }
.purpose { background: var(--mint); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.purpose p { margin: 0 0 6px; }
.think { margin: 0; padding-left: 20px; color: var(--muted); font-size: 14px; }
.example { margin-top: 12px; }
.example p, .arc-row details p { background: #fbfdfc; border-left: 3px solid var(--green); padding: 10px 12px; border-radius: 0 8px 8px 0; margin-top: 8px; }
.choice.static { cursor: default; }
.choice.right { border-color: var(--green); background: var(--green-soft); }
.choice.wrong { border-color: var(--red-line); background: var(--red-soft); }
.choice.own { border-style: dashed; }
.why { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }
.check-block { padding: 16px 0; border-bottom: 1px solid var(--line); }
.check-block:last-child { border-bottom: 0; }
.arc-teach { display: grid; gap: 10px; margin: 16px 0; }
.arc-row { display: flex; gap: 14px; align-items: flex-start; }
.arc-num { flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%; background: var(--green-soft); color: var(--green-ink); border: 1px solid #cdebd9; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.arc-row p { margin: 2px 0 4px; }
.key-rule { background: var(--red-soft); border-left: 4px solid var(--red); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 12px 16px; }
.journey { padding-left: 20px; }
.journey li { margin-bottom: 4px; }
.review-box { background: var(--amber-soft); border: 1px solid var(--amber-line); border-left: 4px solid #e9b949; border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 14px; }
.review-box.small { padding: 8px 12px; font-size: 14px; }
.revise-q { margin: 0; }
.idea-form:has(input[value=own]:checked) .if-option, .idea-form:not(:has(input[value=own]:checked)) .if-own { display: none; }
.reveal-box.hidden .choices { display: none; }
.reveal-btn { margin-bottom: 10px; }
.demo-mode { font-size: 17px; }
.demo-mode h1 { font-size: 32px; }
.demo-banner { background: var(--amber-soft); color: var(--amber-text); border: 1px solid var(--amber-line); padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; }
.vis-banner { background: var(--green-soft); color: var(--green-dark); font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; display: inline-block; margin-bottom: 14px; }
.outline-stage .card-head h3 { margin: 0; }
.row-form { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 12px; }
.row-form .field { flex: 1; min-width: 220px; margin-bottom: 0; }
.scale { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.scale label { display: flex; align-items: center; gap: 4px; }
.scale input { width: auto; }

/* Class view and student detail */
.class-grid td, .class-grid th { text-align: center; padding: 8px 4px; }
.class-grid td:first-child, .class-grid th:first-child, .class-grid td:nth-child(2), .class-grid th:nth-child(2) { text-align: left; padding: 8px 10px; }
.chip { display: inline-flex; width: 24px; height: 24px; border-radius: 7px; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; background: #eef3f0; color: var(--muted); }
.chip.green { background: var(--green-soft); color: var(--green-dark); }
.chip.red { background: var(--red-soft); color: var(--red-ink); }
.chip.now { background: #fff; border: 2px solid var(--red); color: var(--red-ink); }
.chip.empty { background: #f3f7f5; }
.stuck { display: block; color: var(--amber-text); font-size: 12px; font-weight: 600; }
.live-snippet { display: block; color: var(--muted); font-size: 12px; font-style: italic; }
.live-card { border-left: 4px solid var(--red); }
.review-item { border-left: 3px solid var(--line); padding: 6px 12px; margin: 8px 0; }
.chosen { font-weight: 600; }
.teacher-note { background: var(--mint); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 8px; }
.mini { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; }
.report-table td { vertical-align: top; font-size: 14px; }
.outline-print li { margin-bottom: 6px; }

/* Teacher dashboard: folding sections */
details.section { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; scroll-margin-top: 16px; }
details.section > summary { display: flex; align-items: center; gap: 10px; padding: 18px 24px; cursor: pointer; list-style: none; color: var(--text); }
details.section > summary::-webkit-details-marker { display: none; }
details.section > summary::before { content: "›"; display: inline-block; width: 14px; font-size: 22px; line-height: 1; color: var(--green-dark); transition: transform .15s; }
details.section[open] > summary::before { transform: rotate(90deg); }
details.section > summary h2 { margin: 0; font-size: 18px; }
details.section > summary:hover h2 { color: var(--green-dark); }
.section-body { padding: 0 24px 22px; }
.section-body .card { box-shadow: none; }
.section-body h3 { margin-top: 6px; }
.scroll-list { max-height: 320px; overflow-y: auto; }

/* Assessments, uploads and hand-ins */
.file-list { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0; }
.file-pic img { display: block; width: 120px; height: 150px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--mint); }
.file-pic:hover img { border-color: var(--green); }
.file-chip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: #fff; color: var(--text); font-weight: 600; }
.file-chip:hover { border-color: var(--green); text-decoration: none; }
.file-kind { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--green-ink); background: var(--green-soft); padding: 2px 8px; border-radius: 999px; }
.upload-form input[type=file] { display: block; width: 100%; padding: 14px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); background: var(--mint); font: inherit; }
.feedback { background: var(--green-soft); border: 1px solid #cdebd9; border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 12px; }
.feedback .mark { font-size: 26px; font-weight: 700; color: var(--green-ink); margin: 0 0 6px; }
.upload-item { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 14px; }
.upload-item:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }
.upload-item h3 { margin: 0; }
.handin { margin-bottom: 12px; }
details.handin > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; cursor: pointer; list-style: none; }
details.handin > summary::-webkit-details-marker { display: none; }
details.handin > summary .badge:last-child { margin-left: auto; }
details.handin[open] > summary { margin-bottom: 10px; }
.handin.missing { display: flex; align-items: center; gap: 10px; padding: 10px 24px; color: var(--muted); }
.handin.missing .badge { margin-left: auto; }
.handin-title { font-weight: 600; }
.ai-box { background: #fbfdfc; border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: var(--radius-sm); padding: 14px 16px; margin: 12px 0; font-size: 14px; }
.ai-box ul { margin: 4px 0 10px; padding-left: 20px; }
.feedback-form { margin-top: 12px; }

/* Story Builder */
.prompt-bar { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--green); border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 16px; box-shadow: var(--shadow); }
.prompt-bar .eyebrow { margin-bottom: 2px; }
.prompt-bar strong { display: block; font-size: 16px; }
.arc-line { color: var(--muted); }
.stage-brief { margin: 14px 0 12px; }
.tip { background: var(--mint); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px; margin: 0; }
.part-steps { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 14px; }
.part-steps span { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #eef3f0; color: var(--muted); }
.part-steps span.done { background: var(--green-soft); color: var(--green-dark); }
.part-steps span.now { background: var(--red-soft); color: var(--red-ink); }
.arc-part { display: block; font-size: 13px; color: var(--muted); }
.gap-item { background: var(--amber-soft); border: 1px solid var(--amber-line); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 12px; }
.gap-item p { margin: 0 0 6px; }
.gap-item .btn { margin-top: 4px; }
.src-tag { font-size: 11px; font-weight: 600; color: var(--muted); background: #eef3f0; padding: 1px 8px; border-radius: 999px; margin-left: 4px; white-space: nowrap; }
/* The story mountain: tension rises to the climax, then falls */
.mountain { display: block; width: 100%; max-width: 640px; height: auto; margin: 12px auto 6px; }
.mountain .mt-fill { fill: var(--green-soft); opacity: .75; }
.mountain .mt-line { fill: none; stroke: var(--green); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.mountain .mt-dot circle { fill: #fff; stroke: #cfe0d6; stroke-width: 2; }
.mountain .mt-dot text { font: 700 12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; text-anchor: middle; fill: var(--muted); }
.mountain .mt-dot.done circle { fill: var(--green); stroke: var(--green); }
.mountain .mt-dot.done text, .mountain .mt-dot.now text { fill: #fff; }
.mountain .mt-dot.now circle { fill: var(--red); stroke: var(--red-soft); stroke-width: 6; }
.mountain .mt-dot.flag circle { fill: #f6c445; stroke: var(--amber-line); stroke-width: 6; }
.mountain .mt-dot.flag text { fill: #4d3500; }
.mountain .mt-name { font: 700 12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; text-anchor: middle; fill: var(--green-dark); }
@media (max-width: 600px) {   /* bigger dots and labels when the picture is small */
  .mountain .mt-dot circle { r: 21px; }
  .mountain .mt-dot text { font-size: 22px; }
  .mountain .mt-name { font-size: 22px; }
}
.all-stages { margin: 6px 0 14px; }
.all-stages ol { margin: 10px 0 0; padding-left: 20px; }
.all-stages li { margin-bottom: 6px; }

/* Help under each stage: "Words to know" and an example */
.helpers { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0 0 12px; }
.helpers details { margin: 0; }
.helpers details[open] { flex-basis: 100%; }
details.terms ul { margin: 8px 0 0; padding-left: 18px; font-size: 14px; }
details.terms li { margin-bottom: 4px; }
details.example p { background: #fbfdfc; border-left: 3px solid var(--green); padding: 10px 12px; border-radius: 0 8px 8px 0; margin: 8px 0 4px; }
.ask { font-size: 18px; margin: 18px 0 2px; }
.link-box { position: relative; background: #fff; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 10px 14px; margin: 16px 0 26px; }
.link-box .eyebrow { margin-bottom: 2px; color: var(--muted); }
.link-box p { margin: 0; }
.link-box::after { content: "↓"; position: absolute; left: 50%; bottom: -24px; transform: translateX(-50%); color: var(--green); font-weight: 700; font-size: 18px; }
.link-box + .ask { margin-top: 4px; }
.text-stage { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 6px; }
.text-stage h3 { margin-bottom: 8px; }
.reflect { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--mint); padding: 14px 16px 4px; margin: 18px 0 14px; }
.reflect legend { font-weight: 700; padding: 0 6px; }
.reflection-box { background: var(--mint); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; margin-top: 18px; }
.reflection-box p { margin: 0 0 6px; }
.why-line { display: block; font-size: 13px; color: var(--muted); font-style: italic; }
details.offered { margin: 2px 0 4px; font-size: 13px; }
details.offered summary { font-size: 13px; }
details.offered ol { margin: 6px 0 0; padding-left: 18px; }
.chip.done { background: var(--green-soft); color: var(--green-dark); }

.plot-row { padding: 16px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 16px; }
.plot-row:last-child { border-bottom: 0; padding-bottom: 0; }
.plot-row-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.plot-row-head .edit-link { margin-left: auto; font-size: 14px; }
.plot-row .sub { margin: 2px 0 0; }
.plot-text { margin: 6px 0 0; }
.expo-list { margin: 6px 0 0; padding-left: 18px; }
.expo-list li { margin-bottom: 4px; }
.plot-list > li { margin-bottom: 8px; }
.story-text { line-height: 1.75; }

@media (max-width: 860px) {
  .hero-layout { grid-template-columns: 1fr; }
  .hero-side { position: static; max-height: none; }
}
@media print {
  .topbar, .no-print, .vis-banner, .demo-banner, form, button, .btn, .edit-link, .helpers { display: none !important; }
  body { background: #fff; }
  main { margin: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}

/* ---- The Story Builder's teaching pages: one idea per screen ---- */
.step-card { max-width: 760px; margin: 0 auto; }
.step-card.wide { max-width: 940px; }
.step-card.center-card { text-align: center; }
h1.big { font-size: 32px; line-height: 1.2; letter-spacing: -.02em; margin: 2px 0 10px; }
.lead { font-size: 17px; line-height: 1.6; color: var(--text); max-width: 60ch; }
.step-card.center-card .lead { margin-left: auto; margin-right: auto; }
.step-dots { display: flex; justify-content: center; gap: 7px; margin: 0 0 16px; }
.step-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); }
.step-dots span.done { background: var(--green); }
.step-dots span.now { background: var(--red); transform: scale(1.35); }
.step-nav { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 26px; }
.step-nav .btn, .step-nav button { margin-left: auto; }
/* "Let us build a story": one big thing to click. */
.type-pick { display: block; max-width: 420px; margin: 22px auto 0; padding: 22px; border: 2px solid var(--green); border-radius: var(--radius); background: var(--mint); color: var(--text); text-align: center; box-shadow: var(--shadow); }
.type-pick:hover { background: var(--green-soft); box-shadow: var(--shadow-hover); text-decoration: none; }
.type-pick strong { display: block; font-size: 22px; color: var(--green-ink); margin-bottom: 4px; }
.big-journey { font-size: 17px; line-height: 1.7; }
.big-journey li { margin-bottom: 10px; }
.author-note { background: var(--green-soft); border-radius: var(--radius-sm); padding: 12px 16px; margin-top: 20px; }
/* Choosing a prompt: the only thing on its page. */
.prompt-choices .choice { font-size: 16px; padding: 16px 18px; }
.prompt-pick.chosen { font-size: 18px; font-weight: 700; color: var(--green-ink); background: var(--green-soft); border-left: 4px solid var(--green); border-radius: var(--radius-sm); padding: 16px 18px; }

/* ---- The arc with all nine stages named, each in its own colour ---- */
.mountain-big { max-width: 760px; }
.mountain .mt-label { font: 700 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; text-anchor: middle; }
.mountain-big .mt-dot circle { fill: var(--dot); stroke: #fff; stroke-width: 2.5; }
.mountain-big .mt-dot text { fill: #fff; }
.stage-key { list-style: none; padding: 0; margin: 14px 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 16px; }
.stage-key li { display: flex; align-items: center; gap: 9px; font-size: 14px; }
.key-dot { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.example-key { grid-template-columns: 1fr; margin-top: 10px; }
.example-key li { align-items: flex-start; color: var(--muted); }

/* ---- A stage question: big heading, short text, the stage's own colour ---- */
.stage-card { border-top: 5px solid var(--stage, var(--green)); }
.stage-head .eyebrow { color: var(--stage, var(--green-dark)); }
.stage-card .ask { font-size: 20px; font-weight: 700; margin: 16px 0 4px; }
.prompt-bar .prompt-text { color: var(--green-ink); font-size: 17px; font-weight: 700; }
/* The three ideas, each a different kind of move (Tension / Action / Fear). */
.opt-tag { display: inline-block; font-size: 11px; font-weight: 700; font-style: normal; text-transform: uppercase; letter-spacing: .05em; color: var(--green-ink); background: var(--green-soft); padding: 2px 8px; border-radius: 999px; margin-right: 8px; vertical-align: 1px; }
.choice.tagged:has(input:checked) .opt-tag { background: var(--green-light); }
/* Tucked away so the page stays clear: saying why, and asking for different ideas. */
.why-box, .redo-box { margin-top: 14px; font-size: 14px; }
.why-box summary, .redo-box summary { color: var(--muted); cursor: pointer; }
.why-box[open] summary, .redo-box[open] summary { margin-bottom: 8px; }
.redo-box .field { max-width: 460px; }
/* The plot beside the question: easier to see at a glance. */
.hero-side { border: 1px solid var(--line-strong); box-shadow: var(--shadow); }
.hero-side h3 { margin-top: 0; }
.arc-list li.done { background: var(--mint); border-radius: 0 8px 8px 0; }
.arc-part { display: block; font-size: 13px; color: var(--text); margin-top: 2px; }
.arc-list li.now { box-shadow: inset 0 0 0 1px var(--red-line); }

@media (max-width: 780px) {
  h1.big { font-size: 26px; }
  .stage-key { grid-template-columns: 1fr; }
}

/* ---- After the plot: how the hero changes, and a quick check on the arc ---- */
.hero-why { border-left: 4px solid var(--green); }
.hero-why .lead { margin-bottom: 10px; }
.why-heroic { background: var(--green-soft); border-radius: var(--radius-sm); padding: 12px 16px; margin: 0; }
.quiz-q { padding: 14px 0; border-top: 1px solid var(--line); }
.quiz-q:first-of-type { border-top: 0; }
.quiz-ask { margin: 0 0 10px; font-size: 15px; }
.quiz-ask .badge { margin-left: 8px; vertical-align: 1px; }
.quiz-q .choices { gap: 8px; }
.quiz-q .choice { padding: 10px 14px; font-size: 14px; }

/* ---- A question must fit on one screen: all three ideas and Next, without scrolling ---- */
.stage-card .mountain { max-width: 380px; margin: 4px auto 0; }
.stage-card h1.big { margin: 0 0 2px; }
.stage-card .part-steps { margin: 2px 0 10px; }
.stage-card .ask { margin: 12px 0 6px; }
.stage-card .link-box { margin: 10px 0 22px; }
.stage-card .example { margin: 2px 0; }
.stage-card .choices { gap: 8px; }
.vis-banner { padding: 6px 14px; font-size: 13px; }
/* The prompt in a colour that actually reads as different from the text around it. */
.prompt-bar .prompt-text { color: var(--green-dark); }
.stage-card .mountain { max-width: 340px; }
.stage-card .actions.mt { margin-top: 10px; }
.stage-card .example { margin: 0; }
.stage-card .eyebrow { margin-bottom: 0; }
/* What the new ideas follow on from: it has to read as the thing to look at. */
.stage-card .link-box { background: var(--mint); border: 1px solid var(--green); border-left: 4px solid var(--green); }
.stage-card .link-box .eyebrow { color: var(--green-dark); font-weight: 700; }
.stage-card .link-box p { font-weight: 600; }

/* ---- Moving from one stage to the next, made unmistakable ---- */
.stage-band { display: flex; align-items: center; gap: 14px; margin: -4px -24px 0; padding: 14px 24px 12px;
  background: color-mix(in srgb, var(--stage) 9%, #fff); border-bottom: 1px solid color-mix(in srgb, var(--stage) 22%, #fff);
  animation: stage-in .32s ease-out; }
.stage-num { flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%; background: var(--stage); color: #fff;
  font-size: 19px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.stage-band-text { min-width: 0; }
.stage-of { margin: 0; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--stage); }
.stage-band h1.big { margin: 0; }
@keyframes stage-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
/* Nine segments: which stage you are on, and how far there is to go. */
.stage-strip { display: flex; gap: 3px; margin: 0 -24px 12px; padding: 0 24px; }
.stage-strip span { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.stage-strip span.done { background: var(--seg); opacity: .55; }
.stage-strip span.now { background: var(--seg); box-shadow: 0 0 0 2px color-mix(in srgb, var(--seg) 25%, #fff); }
@media (prefers-reduced-motion: reduce) { .stage-band { animation: none; } }
.stage-card .link-box { margin: 10px 0 18px; }
.stage-card .link-box::after { bottom: -20px; }

/* ---- Non-adaptive modules: set questions, set answers, no AI ---- */
.fx-head .fx-intro { background: var(--mint); border-radius: var(--radius-sm); padding: 14px 16px; margin-top: 14px; }
.fx-head .fx-intro p { margin: 4px 0; }
.fx-section { scroll-margin-top: 16px; }
.fx-section h2 { margin-top: 2px; }
.fx-item { padding: 16px 0 4px; border-top: 1px solid var(--line); margin-top: 14px; }
.fx-item:first-of-type { border-top: 0; margin-top: 6px; }
.fx-stem { font-weight: 700; margin: 0 0 10px; }
.fx-stem .badge { margin-left: 8px; vertical-align: 1px; }
.fx-select { max-width: 420px; }
.fx-item textarea { width: 100%; padding: 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: inherit; box-sizing: border-box; }
.fx-check { margin-top: 10px; }
.fx-feedback { display: none; border-radius: var(--radius-sm); padding: 10px 14px; margin-top: 10px; font-size: 14px; }
.fx-feedback.right { display: block; background: var(--green-soft); border: 1px solid #cdebd9; color: var(--green-ink); }
.fx-feedback.wrong { display: block; background: var(--red-soft); border: 1px solid var(--red-line); color: var(--red-ink); }
.fx-note { background: var(--amber-soft); border: 1px solid var(--amber-line); color: var(--amber-text); border-radius: var(--radius-sm); padding: 12px 14px; margin-top: 16px; font-size: 14px; }
.fx-score { font-size: 38px; font-weight: 700; color: var(--green-ink); margin: 4px 0; }
.fx-score span { font-size: 16px; font-weight: 600; color: var(--muted); }
.fx-edit { border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 16px; margin: 14px 0; background: var(--mint); }
.fx-edit h3 { margin: 0; }
.fx-edit .field { background: #fff; border-radius: var(--radius-sm); }
.fx-part { border-left: 3px solid var(--green); padding-left: 12px; margin: 10px 0; }
/* Feedback on a non-adaptive module, written for the student as soon as they send it in. */
.fx-ai { border-left: 4px solid var(--green); }
.fx-ai h3 { font-size: 15px; margin: 18px 0 6px; }
.fx-ai ul { margin: 4px 0; padding-left: 20px; }
.fx-fix { background: var(--mint); border-radius: var(--radius-sm); padding: 12px 14px; margin: 8px 0; }
.fx-fix p { margin: 2px 0; }
