/* Civil labs inside the app: the prototype's stylesheet, scoped to .civil-embed and
   coloured with the app's own palette (base.html :root). Generated from static/civil/civil.css. */
.civil-embed {
  --bg: var(--bg-color); --panel: var(--surface-color); --panel-2: var(--surface-hover); --line: var(--border-color);
  --text: var(--text-primary); --text-2: var(--text-secondary); --text-3: var(--c-text-muted);
  --accent: var(--primary-color); --accent-ink: #ffffff; --series: var(--c-blue); --series-fill: rgba(var(--rgb-blue), 0.18);
  --grid: var(--c-grid); --good: var(--success); --warn: var(--c-amber-strong); --bad: var(--danger); --perm: var(--c-purple); --var: var(--c-orange);
  --shadow: 0 1px 2px rgba(0, 0, 0, calc(0.4 * var(--shadow-k))); --radius: 10px; --mono: 'JetBrains Mono', ui-monospace, monospace;
  color: var(--text); font-size: 15px; line-height: 1.5;
}
.civil-embed * { box-sizing: border-box; }
.civil-embed h1, .civil-embed h2, .civil-embed h3 { margin: 0; line-height: 1.2; }
.civil-embed button, .civil-embed select, .civil-embed input { font: inherit; color: inherit; }
.civil-embed a { color: var(--primary-hover); }
.civil-embed .civil-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.civil-embed .civil-head h1 { font-family: 'Bricolage Grotesque', sans-serif; font-size: 1.5rem; }
.civil-embed .civil-head .crumb { color: var(--text-2); font-size: 0.9375rem; }
.civil-embed .civil-head .spacer { flex: 1; }
.civil-embed .lab { height: calc(100vh - 190px); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.civil-embed .viewport { background: var(--c-inset); }
.civil-embed [hidden] { display: none !important; }
.civil-embed .btn {
  border: 1px solid var(--line); background: var(--panel); border-radius: 8px;
  padding: 6px 12px; cursor: pointer; white-space: nowrap; text-decoration: none; color: inherit;
}
.civil-embed .btn:hover { border-color: var(--text-3); }
.civil-embed .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.civil-embed .btn.danger { color: var(--bad); }
.civil-embed .btn.small { padding: 3px 9px; font-size: 14px; }
.civil-embed .btn[aria-pressed="true"] { background: var(--panel-2); border-color: var(--text-3); font-weight: 600; }
.civil-embed .btn:disabled { opacity: 0.45; cursor: not-allowed; }
.civil-embed .field { display: grid; gap: 4px; margin-bottom: 10px; }
.civil-embed .field label, .civil-embed .label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.civil-embed .field select, .civil-embed .field input[type="number"] {
  width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel);
}
.civil-embed .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.civil-embed .row > .field { flex: 1; min-width: 0; }
.civil-embed input[type="range"] { width: 100%; accent-color: var(--accent); }
.civil-embed .hint { font-size: 13px; color: var(--text-3); }
.civil-embed a.card:hover { border-color: var(--accent); }
.civil-embed .lab {
  display: grid; grid-template-columns: 290px minmax(0, 1fr) 320px;
  height: calc(100vh - 51px); min-height: 560px;
}
.civil-embed .side, .civil-embed .results { overflow-y: auto; padding: 14px; background: var(--panel); }
.civil-embed .side { border-right: 1px solid var(--line); }
.civil-embed .results { border-left: 1px solid var(--line); }
.civil-embed .centre { display: grid; grid-template-rows: minmax(260px, 1fr) auto; min-width: 0; min-height: 0; }
.civil-embed .section { padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.civil-embed .section:last-child { border-bottom: 0; }
.civil-embed .section h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2); margin-bottom: 10px; }
.civil-embed .viewport { position: relative; min-height: 0; overflow: hidden; background: #b9cfe0; }
.civil-embed .viewport canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.civil-embed .overlay {
  position: absolute; left: 12px; top: 12px; padding: 6px 10px; border-radius: 8px;
  background: rgba(15, 15, 15, 0.62); color: #fff; font-size: 13px; pointer-events: none;
}
.civil-embed .overlay.error { background: var(--bad); top: auto; bottom: 12px; pointer-events: auto; }
.civil-embed .legend-3d {
  position: absolute; right: 12px; top: 12px; background: rgba(15, 15, 15, 0.62); color: #fff;
  border-radius: 8px; padding: 6px 10px; font-size: 13px; display: grid; gap: 4px;
}
.civil-embed .ramp { width: 140px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #dbe8f8, #3b82f6 70%, #0d3f7d 99%, #ef4444 100%); }
.civil-embed .ramp-labels { display: flex; justify-content: space-between; }
.civil-embed .charts { background: var(--panel); border-top: 1px solid var(--line); padding: 8px 12px 4px; position: relative; }
.civil-embed .chart { position: relative; }
.civil-embed .chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.civil-embed .chart-title { font-size: 13px; font-weight: 600; color: var(--text-2); }
.civil-embed .chart-title .sub { font-weight: 400; color: var(--text-3); }
.civil-embed .tooltip {
  position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line);
  box-shadow: var(--shadow); border-radius: 8px; padding: 6px 9px; font-size: 13px; white-space: nowrap; z-index: 3;
}
.civil-embed .tooltip b { font-variant-numeric: tabular-nums; }
.civil-embed .add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.civil-embed .preset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.civil-embed .kind-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.civil-embed .kind-dot.G { background: var(--perm); }
.civil-embed .kind-dot.Q { background: var(--var); }
.civil-embed .inspector-empty { color: var(--text-3); font-size: 14px; }
.civil-embed .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.civil-embed .seg button { border: 0; background: transparent; padding: 5px 10px; cursor: pointer; }
.civil-embed .seg button[aria-pressed="true"] { background: var(--panel-2); font-weight: 600; }
.civil-embed .tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.civil-embed .tile { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; }
.civil-embed .tile .k { font-size: 13px; color: var(--text-2); }
.civil-embed .tile .v { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.civil-embed .tile .v small { font-size: 13px; font-weight: 500; color: var(--text-2); }
.civil-embed .verdict { display: flex; align-items: center; gap: 8px; font-weight: 650; padding: 8px 10px; border-radius: 8px; margin-bottom: 10px; }
.civil-embed .verdict.ok { background: color-mix(in srgb, var(--good) 14%, transparent); color: var(--good); }
.civil-embed .verdict.fail { background: color-mix(in srgb, var(--bad) 14%, transparent); color: var(--bad); }
.civil-embed .check { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.civil-embed .check:last-child { border-bottom: 0; }
.civil-embed .check-head { display: flex; justify-content: space-between; gap: 8px; }
.civil-embed .check-head .t { font-weight: 600; }
.civil-embed .check-head .u { font-variant-numeric: tabular-nums; font-weight: 650; }
.civil-embed .check .meta { font-size: 13px; color: var(--text-3); }
.civil-embed .bar { height: 6px; border-radius: 3px; background: var(--panel-2); margin: 5px 0 3px; overflow: hidden; }
.civil-embed .bar > i { display: block; height: 100%; border-radius: 3px; }
.civil-embed .status-ok { color: var(--good); }
.civil-embed .status-warn { color: var(--warn); }
.civil-embed .status-bad { color: var(--bad); }
.civil-embed table.reactions { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
.civil-embed table.reactions th { text-align: left; font-size: 13px; color: var(--text-2); font-weight: 600; padding: 3px 4px; }
.civil-embed table.reactions td { padding: 3px 4px; border-top: 1px solid var(--line); }
.civil-embed table.reactions td.n { text-align: right; }
.civil-embed details summary { cursor: pointer; color: var(--text-2); font-size: 14px; }
.civil-embed details ul { padding-left: 18px; margin: 6px 0 0; color: var(--text-2); font-size: 13px; }
.civil-embed .challenge { background: var(--panel-2); border-radius: 8px; padding: 10px; }
.civil-embed .challenge h4 { margin: 0 0 4px; font-size: 15px; }
.civil-embed .challenge p { margin: 0 0 8px; color: var(--text-2); font-size: 14px; }
.civil-embed .goals { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 4px; font-size: 14px; }
.civil-embed .goals li { display: flex; gap: 6px; }
.civil-embed .goals .detail { color: var(--text-3); margin-left: auto; white-space: nowrap; }
.civil-embed .solved-banner { margin-top: 8px; padding: 8px; border-radius: 8px; background: color-mix(in srgb, var(--good) 16%, transparent); color: var(--good); font-weight: 650; }
.civil-embed .locked { opacity: 0.5; pointer-events: none; }
@media (max-width: 1100px) { .civil-embed .lab { grid-template-columns: 260px minmax(0, 1fr); height: auto; } .civil-embed .results { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); } .civil-embed .centre { grid-template-rows: 460px auto; } }
@media (max-width: 720px) { .civil-embed .lab { grid-template-columns: 1fr; } .civil-embed .side { border-right: 0; border-bottom: 1px solid var(--line); } .civil-embed .centre { grid-template-rows: 340px auto; } .civil-embed .topbar .crumb { display: none; } }
.civil-embed .ramp.diverging { width: 180px; background: linear-gradient(90deg, #eb6834, #9a9890 50%, #3b82f6); }
.civil-embed .tools { display: flex; }
.civil-embed .tools button { flex: 1; }
.civil-embed .banner {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%);
  padding: 14px 22px; border-radius: 12px; font-size: 20px; font-weight: 700; color: #fff;
  background: rgba(15, 15, 15, 0.72); text-align: center; pointer-events: none;
}
.civil-embed .banner.fail { background: rgba(208, 59, 58, 0.9); }
.civil-embed .banner.ok { background: rgba(0, 131, 0, 0.88); }
.civil-embed .banner small { display: block; font-size: 14px; font-weight: 500; opacity: 0.9; margin-top: 4px; }
.civil-embed .member-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 14px; }
.civil-embed .member-list button {
  width: 100%; display: grid; grid-template-columns: 14px 1fr auto; gap: 6px; align-items: center;
  border: 0; background: transparent; padding: 4px 4px; border-radius: 6px; cursor: pointer; text-align: left;
}
.civil-embed .member-list button:hover { background: var(--panel-2); }
.civil-embed .member-list .sw { width: 10px; height: 10px; border-radius: 2px; }
.civil-embed .member-list .u { font-variant-numeric: tabular-nums; font-weight: 600; }
.civil-embed .kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 14px; margin-bottom: 10px; }
.civil-embed .kv dt { color: var(--text-2); }
.civil-embed .kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.civil-embed .charts-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.civil-embed .charts-row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.civil-embed .charts-row.one { grid-template-columns: 1fr; }
.civil-embed .layer-row { display: grid; grid-template-columns: 12px 1fr 70px 26px; gap: 6px; align-items: center; margin-bottom: 6px; }
.civil-embed .layer-row select, .civil-embed .layer-row input { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); min-width: 0; }
.civil-embed .layer-row .sw { width: 12px; height: 26px; border-radius: 3px; }
.civil-embed .layer-row button { border: 0; background: transparent; cursor: pointer; color: var(--text-3); font-size: 16px; }
.civil-embed .legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--text-2); margin: 2px 0 2px; }
.civil-embed .legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }
@media (max-width: 1100px) { .civil-embed .charts-row { grid-template-columns: 1fr; } }
.civil-embed .palette { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.civil-embed .palette button {
  display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel);
  border-radius: 7px; padding: 4px 6px; cursor: pointer; font-size: 13px; text-align: left;
}
.civil-embed .palette button[aria-pressed="true"] { border-color: var(--text); font-weight: 600; background: var(--panel-2); }
.civil-embed .palette button:disabled { opacity: 0.4; cursor: not-allowed; }
.civil-embed .palette .sw { width: 14px; height: 14px; border-radius: 3px; flex: none; border: 1px solid rgba(0, 0, 0, 0.15); }
.civil-embed .tools.wrap { flex-wrap: wrap; }
.civil-embed .tools.wrap button { flex: 1 0 30%; }
.civil-embed .lesson { background: color-mix(in srgb, var(--accent) 7%, var(--panel)); margin: -14px -14px 14px; padding: 14px; border-bottom: 1px solid var(--line); }
.civil-embed .lesson-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.civil-embed .lesson-title { font-size: 17px !important; text-transform: none !important; letter-spacing: 0 !important; color: var(--text) !important; margin-bottom: 8px !important; }
.civil-embed .dots { display: flex; gap: 5px; margin-bottom: 10px; }
.civil-embed .dots i { width: 22px; height: 5px; border-radius: 3px; background: var(--line); }
.civil-embed .dots i.done { background: var(--good); }
.civil-embed .dots i.now { background: var(--accent); }
.civil-embed .concept { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 10px; }
.civil-embed .concept summary { font-weight: 600; color: var(--text); }
.civil-embed .concept p { margin: 8px 0 0; font-size: 14px; color: var(--text-2); }
.civil-embed .task { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.civil-embed .task p { margin: 6px 0; font-size: 14px; }
.civil-embed .task-kind { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); font-weight: 700; }
.civil-embed .task input[type="text"] { width: 120px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); }
.civil-embed .task .row { margin: 6px 0; }
.civil-embed .choices { display: grid; gap: 4px; margin: 6px 0; font-size: 14px; }
.civil-embed .choices label { display: flex; gap: 6px; align-items: flex-start; padding: 5px 6px; border-radius: 6px; cursor: pointer; }
.civil-embed .choices label:hover { background: var(--panel-2); }
.civil-embed .hint-box { background: color-mix(in srgb, var(--warn) 12%, transparent); border-radius: 6px; padding: 6px 8px; }
.civil-embed .solution { background: var(--panel-2); border-radius: 6px; padding: 6px 8px; margin-top: 6px; }
.civil-embed .math { font-family: "Cambria Math", "Times New Roman", serif; font-size: 1.05em; white-space: nowrap; }
.civil-embed .math sub, .civil-embed .math sup { font-size: 0.72em; }
.civil-embed .frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; font-size: 0.9em; line-height: 1.1; }
.civil-embed .frac > span:first-child { border-bottom: 1px solid currentColor; padding: 0 2px; }
.civil-embed .why { margin-top: 4px; font-size: 13px; }
.civil-embed .why summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.civil-embed .why dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 8px; margin: 6px 0 0; }
.civil-embed .why dt { color: var(--text-3); }
.civil-embed .why dd { margin: 0; color: var(--text-2); }
.civil-embed .path { max-width: 1080px; margin: 0 auto; padding: 28px 16px 64px; }
.civil-embed .path h1 { font-size: 28px; margin-bottom: 6px; }
.civil-embed .unit { margin-top: 26px; }
.civil-embed .unit h2 { font-size: 18px; margin-bottom: 4px; }
.civil-embed .unit .hint { margin: 0 0 10px; }
.civil-embed .lessons { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.civil-embed .lesson-card { display: block; text-decoration: none; color: inherit; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; box-shadow: var(--shadow); }
.civil-embed .lesson-card:hover { border-color: var(--accent); }
.civil-embed .lesson-card .n { font-size: 13px; color: var(--text-3); font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; }
.civil-embed .lesson-card h3 { font-size: 15px; margin: 4px 0; }
.civil-embed .lesson-card .meta { font-size: 13px; color: var(--text-2); display: flex; justify-content: space-between; }
.civil-embed .lesson-card.done { border-color: color-mix(in srgb, var(--good) 50%, var(--line)); }
.civil-embed .lesson-card.next { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.civil-embed .progress-bar { height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; max-width: 420px; }
.civil-embed .progress-bar i { display: block; height: 100%; background: var(--good); }
.civil-embed .cta { display: inline-block; margin: 6px 0 22px; }
.civil-embed .footings select, .civil-embed .footings input { width: 100%; padding: 3px 4px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.civil-embed .footings td { padding: 3px 3px; }
.civil-embed .cbar { display: grid; grid-template-columns: 110px 1fr 90px; align-items: center; gap: 8px; font-size: 13px; margin: 4px 0; }
.civil-embed .cbar span { color: var(--text-2); }
.civil-embed .cbar i { display: block; height: 12px; border-radius: 3px; min-width: 2px; }
.civil-embed .cbar b { font-variant-numeric: tabular-nums; text-align: right; }
.civil-embed .scors { display: flex; gap: 2px; margin-top: 4px; }
.civil-embed .scors .band { flex: 1; text-align: center; font-size: 13px; font-weight: 600; padding: 4px 0; border-radius: 3px; color: #1d1d1d; }
.civil-embed .pbar { display: grid; grid-template-columns: 90px 1fr 70px; align-items: center; gap: 8px; font-size: 13px; margin: 3px 0; }
.civil-embed .pbar span { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.civil-embed .pbar div { position: relative; height: 14px; }
.civil-embed .pbar i { display: block; height: 6px; border-radius: 2px; margin-bottom: 1px; }
.civil-embed .pbar i.peak { background: var(--primary-color); }
.civil-embed .pbar i.fire { background: #eda100; }
.civil-embed .pbar i.bad { background: var(--danger); }
.civil-embed .pbar em { position: absolute; top: -1px; bottom: -1px; width: 0; border-left: 1.5px dashed var(--danger); }
.civil-embed .pbar b { font-variant-numeric: tabular-nums; text-align: right; font-weight: 600; }
