:root {
  --blue: #0056b3;
  --blue-dark: #003f85;
  --blue-soft: #e8f1fb;
  --ink: #1f2a36;
  --muted: #5b6876;
  --line: #d6dee8;
  --bg: #f4f7fa;
  --card: #ffffff;
  --good: #1e7b45;
  --good-soft: #e5f4ea;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --warn-soft: #fff6dd;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.6; }
a { color: var(--blue); }
img { max-width: 100%; height: auto; }

.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 880px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--ink); font-weight: 700; }
.brand img { width: 28px; height: 28px; }
.topbar .spacer { flex: 1; }
.save-status { font-size: 0.85em; color: var(--muted); white-space: nowrap; }
.save-status.error { color: var(--bad); }

.wrap { max-width: 880px; margin: 0 auto; padding: 24px 16px 64px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 20px; }
.hero { text-align: center; padding: 8px 0 16px; }
.hero h1 { color: var(--blue); margin: 8px 0 4px; font-size: 2em; }
.hero p { color: var(--muted); margin: 0; }
.tagline { font-style: italic; color: var(--muted); }

h1, h2, h3, h4 { line-height: 1.25; }
h2 { color: var(--blue); margin-top: 1.8em; }
h3 { margin-top: 1.5em; }
.module-title { color: var(--ink); margin: 0 0 4px; font-size: 1.7em; }
.module-num { color: var(--blue); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.85em; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .grid-2 { grid-template-columns: 1fr; } }

/* Buttons */
.btn, .btn-secondary, button.btn { display: inline-block; border: 0; border-radius: 8px; padding: 11px 18px; font-size: 1em; font-family: inherit; cursor: pointer; text-decoration: none; text-align: center; }
.btn { background: var(--blue); color: #fff; }
.btn:hover { background: var(--blue-dark); }
.btn-secondary { background: var(--blue-soft); color: var(--blue-dark); }
.btn-secondary:hover { background: #d6e6f8; }
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-link { background: none; border: 0; color: var(--blue); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; }
:focus-visible { outline: 3px solid #7fb2ec; outline-offset: 2px; }

/* Forms */
.field { margin: 12px 0 16px; }
label.q, .form-row label { display: block; font-weight: 600; margin-bottom: 6px; }
label.q p { margin: 0; }
input[type=text], input[type=email], input[type=date], textarea, select {
  width: 100%; font: inherit; color: inherit; background: #fff; border: 1px solid #b9c5d3; border-radius: 6px; padding: 9px 11px;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, textarea:focus, select:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(0,86,179,0.15); }
.form-row { margin-bottom: 14px; }
.form-row .opt { font-weight: 400; color: var(--muted); }
.error-msg { color: var(--bad); margin: 8px 0 0; min-height: 1.2em; }
.note { color: var(--muted); font-size: 0.92em; }

/* Ratings 0-5 */
.ratings { border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 16px; margin: 12px 0 20px; background: #fbfdff; }
.rating { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #edf1f5; }
.rating:last-child { border-bottom: 0; }
.rating-label { flex: 1; }
.scale { display: flex; gap: 4px; flex-shrink: 0; }
.scale label, .opts label { position: relative; cursor: pointer; }
.scale input, .opts input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.scale span { display: inline-flex; width: 36px; height: 36px; align-items: center; justify-content: center; border: 1px solid #b9c5d3; border-radius: 50%; background: #fff; font-weight: 700; }
.scale input:checked + span { background: var(--blue); color: #fff; border-color: var(--blue); }
.scale input:focus-visible + span, .opts input:focus-visible + span { outline: 3px solid #7fb2ec; outline-offset: 2px; }
@media (max-width: 600px) { .rating { flex-direction: column; align-items: flex-start; } .scale span { width: 40px; height: 40px; } }
.lead { font-weight: 700; margin: 10px 0 0; }

/* Choices (Activity/Output, Good/Poor, Yes/No) */
.exercise { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 16px 14px; margin: 12px 0 20px; background: #fbfdff; }
.choice, .match { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #edf1f5; }
.choice-label { flex: 1; }
.choice-label p { margin: 0; }
.opts { display: flex; gap: 6px; flex-shrink: 0; }
.opts span { display: inline-block; min-width: 76px; padding: 6px 12px; border: 1px solid #b9c5d3; border-radius: 999px; background: #fff; text-align: center; font-weight: 600; font-size: 0.92em; }
.opts input:checked + span { background: var(--blue); color: #fff; border-color: var(--blue); }
.choice.correct, .match.correct { background: var(--good-soft); }
.choice.wrong, .match.wrong { background: var(--bad-soft); }
.choice .verdict, .match .verdict { font-size: 0.85em; font-weight: 700; margin-left: 6px; }
.correct .verdict { color: var(--good); }
.wrong .verdict { color: var(--bad); }
.exercise-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.score { font-weight: 700; }
.match-term { font-weight: 700; min-width: 110px; }
.match select { max-width: 60%; }
.yesno { border-bottom: 0; padding: 6px 0; }
@media (max-width: 600px) { .choice, .match { flex-direction: column; align-items: flex-start; } .match select { max-width: 100%; } }

/* Checkboxes */
label.check { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
label.check input { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.input-grid { width: 100%; border-collapse: collapse; margin: 10px 0 18px; }
table.input-grid th { text-align: left; background: var(--blue-soft); padding: 8px; }
table.input-grid td { padding: 6px 4px; }

/* Module 10 checklist */
.check-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; background: #fbfdff; }
.check-item .field { margin: 6px 0 4px; }
.hint { color: var(--muted); font-size: 0.9em; }
h3.stage { color: var(--blue); }

/* Module 11 */
fieldset.sail-group { border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 16px 4px; margin: 16px 0; background: #fbfdff; }
fieldset.sail-group legend { font-weight: 700; color: var(--blue); padding: 0 6px; }
details.example { border: 1px dashed #b9c5d3; border-radius: var(--radius); padding: 10px 14px; margin: 12px 0; background: var(--warn-soft); }
details.example summary { cursor: pointer; font-weight: 700; }
.roadmap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.roadmap > div { background: #fff; border-radius: 8px; padding: 8px 12px; border: 1px solid var(--line); }
.roadmap h4 { margin: 4px 0; }
@media (max-width: 700px) { .roadmap { grid-template-columns: 1fr; } }

figure { margin: 20px auto; text-align: center; }
figure img { border-radius: 8px; max-height: 720px; width: auto; }
blockquote { margin: 12px 0; padding: 4px 14px; border-left: 4px solid var(--blue-soft); }

/* Course home */
.code-box { font-family: "Courier New", monospace; font-size: 1.6em; font-weight: 700; letter-spacing: 0.06em; background: var(--blue-soft); color: var(--blue-dark);
  border-radius: 8px; padding: 14px; text-align: center; word-break: break-all; margin: 12px 0; }
.progress { height: 12px; background: #e3e9f0; border-radius: 999px; overflow: hidden; margin: 8px 0 4px; }
.progress > div { height: 100%; background: var(--blue); width: 0; transition: width 0.3s; }
.module-list { list-style: none; padding: 0; margin: 0; }
.module-list li { border-bottom: 1px solid #edf1f5; }
.module-list a { display: flex; align-items: center; gap: 12px; padding: 12px 4px; text-decoration: none; color: var(--ink); }
.module-list a:hover { background: #f7faff; }
.module-list .num { width: 32px; height: 32px; border-radius: 50%; background: var(--blue-soft); color: var(--blue-dark); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.module-list .done .num { background: var(--good); color: #fff; }
.module-list .title { flex: 1; }
.module-list .state { font-size: 0.85em; color: var(--muted); white-space: nowrap; }
.module-list .done .state { color: var(--good); font-weight: 700; }
.banner { background: var(--good-soft); border: 1px solid #b7dfc5; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px; }
.hidden { display: none !important; }

/* Module footer */
.module-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 18px; margin-top: 28px; }
.module-actions .grow { flex: 1; }
.completed-tag { color: var(--good); font-weight: 700; }

.print-only { display: none; }
@media print {
  body { background: #fff; }
  .topbar, .module-actions, .no-print, .exercise-actions, .btn, .btn-secondary { display: none !important; }
  .print-only { display: block; }
  .card { border: 0; padding: 0; }
  .wrap { padding: 0; max-width: none; }
  textarea { border: 1px solid #999; min-height: 0; }
  .scale span, .opts span { border-color: #666; }
  details.example { display: none; }
  figure img { max-height: 420px; }
}
