/* ==========================================================================
   Tasker — design system
   Cool "chalk & ink" study surface, one teal signal accent, semaphore colours
   that carry meaning. Sections: tokens · base · layout · components · forms ·
   auth · join · workspace (chat + IDE) · teacher pages · code tokens · print ·
   broadcast.
   ========================================================================== */

:root {
  --ink: #1c2541;
  --ink-soft: #3a4668;
  --ink-2: #4b5675;
  --muted: #6b748f;
  --faint: #98a1b8;
  --surface: #f5f7fb;
  --surface-2: #eef1f7;
  --card: #ffffff;
  --line: #e3e8f2;
  --line-strong: #cfd6e4;

  --signal: #0b8a8a;
  --signal-press: #08706f;
  --signal-soft: #e7f6f5;
  --signal-line: #b6e0de;
  --signal-ink: #075e5d;
  --mint: #7fe3e3;

  --green: #2e9e5b;
  --green-soft: #e8f6ee;
  --green-ink: #1c5e36;
  --amber: #d99100;
  --amber-soft: #fdf4e1;
  --amber-ink: #7a5300;
  --grey: #9aa3b7;
  --red: #d1453b;
  --red-soft: #fcecea;
  --red-ink: #8a2a22;
  --blue-soft: #e9f1fb;
  --blue-ink: #234a7a;
  --violet: #6d5bd0;
  --violet-soft: #f0eefc;

  --ide-bg: #0d1426;
  --ide-panel: #121a31;
  --ide-line: #222c4a;
  --ide-text: #e6ecff;
  --ide-muted: #8291bb;

  --r-xs: 6px;
  --r-sm: 8px;
  --radius: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --shadow-sm: 0 1px 2px rgba(28, 37, 65, .06);
  --shadow: 0 1px 2px rgba(28, 37, 65, .05), 0 4px 16px rgba(28, 37, 65, .06);
  --shadow-lg: 0 2px 6px rgba(28, 37, 65, .06), 0 18px 48px rgba(28, 37, 65, .12);
  --ring: 0 0 0 3px rgba(11, 138, 138, .18);

  --display: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --topbar-h: 58px;
}

/* ── Base ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--body); color: var(--ink); background: var(--surface);
  line-height: 1.5; font-size: 15px; -webkit-font-smoothing: antialiased;
}
a { color: var(--signal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--display); letter-spacing: -.015em; line-height: 1.2; color: var(--ink); }
h1 { font-size: 1.75rem; margin: 0 0 .25rem; font-weight: 750; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; font-weight: 700; }
h3 { font-size: 1rem; margin: 0 0 .5rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
p:last-child { margin-bottom: 0; }
img { max-width: 100%; }
hr { border: none; border-top: 1px solid var(--line); margin: 1.25rem 0; }
kbd {
  font: 600 .72rem var(--mono); padding: .08rem .38rem; border-radius: 5px;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; background: #fff; color: var(--ink-soft);
}
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
::selection { background: rgba(11, 138, 138, .18); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.text-red { color: var(--red-ink); }
.ico { vertical-align: -0.15em; flex: 0 0 auto; }
.small { font-size: .85rem; }
.xsmall { font-size: .76rem; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.spacer { flex: 1; }
[hidden] { display: none !important; }

/* ── Layout ───────────────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 40; background: var(--ink); color: #fff;
  box-shadow: 0 1px 0 rgba(255,255,255,.04), 0 2px 12px rgba(15,21,40,.18);
}
.topbar .inner {
  max-width: 1180px; margin: 0 auto; padding: 0 1.25rem; height: var(--topbar-h);
  display: flex; align-items: center; gap: 1.5rem;
}
.brand { display: inline-flex; align-items: center; gap: .5rem; font-family: var(--display); font-weight: 700; color: #fff; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand img { display: block; }
.brand-name { font-size: 1.2rem; font-weight: 800; letter-spacing: -.03em; }
.brand-name span { color: var(--mint); }
.brand-acorn { display: block; margin-left: -.2rem; }
.nav { display: flex; gap: .2rem; align-items: center; height: 100%; }
.nav a {
  color: #c3cbe0; font-size: .9rem; font-weight: 550; padding: .45rem .75rem; border-radius: 8px;
  display: inline-flex; align-items: center; gap: .4rem;
}
.nav a:hover { color: #fff; background: rgba(255,255,255,.06); text-decoration: none; }
.nav a.active { color: #fff; background: rgba(127,227,227,.12); box-shadow: inset 0 -2px 0 var(--mint); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .75rem; }
.usermenu { display: inline-flex; align-items: center; gap: .55rem; color: #cdd4e6; font-size: .86rem; }
.avatar-chip {
  width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center;
  background: linear-gradient(135deg, #2a7f86, #0b8a8a); color: #fff; font-weight: 700; font-size: .8rem;
  text-transform: uppercase; flex: 0 0 auto;
}
.topbar .btn-logout {
  background: transparent; color: #c3cbe0; border: 1px solid #3a4668; border-radius: 8px;
  padding: .32rem .7rem; font: 550 .82rem var(--body); cursor: pointer;
}
.topbar .btn-logout:hover { color: #fff; border-color: #5a6890; }
.lang-switch select {
  width: auto; padding: .3rem 1.6rem .3rem .55rem; font-size: .82rem;
  color: #cdd4e6; background-color: transparent; border: 1px solid #3a4668;
  border-radius: 8px; cursor: pointer; -webkit-appearance: none; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23cdd4e6' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .5rem center;
}
.lang-switch select:hover { color: #fff; border-color: #5a6890; }
.lang-switch select:focus { box-shadow: none; border-color: var(--mint); }
.lang-switch option { color: var(--ink); background: #fff; }
.nav-toggle { display: none; }
@media (max-width: 860px) {
  .topbar .inner { gap: .75rem; }
  .nav-toggle {
    display: inline-grid; place-items: center; margin-left: auto; width: 38px; height: 38px;
    background: transparent; border: 1px solid #3a4668; border-radius: 9px; color: #fff; cursor: pointer;
  }
  .topbar-collapse {
    display: none; position: absolute; top: var(--topbar-h); left: 0; right: 0; background: var(--ink);
    padding: .5rem 1rem 1rem; flex-direction: column; align-items: stretch; gap: .5rem;
    border-top: 1px solid #2a3556;
  }
  .topbar.open .topbar-collapse { display: flex; }
  .nav { flex-direction: column; align-items: stretch; height: auto; }
  .nav a.active { box-shadow: inset 2px 0 0 var(--mint); }
  .topbar-right { margin-left: 0; justify-content: space-between; }
}
@media (min-width: 861px) { .topbar-collapse { display: contents; } }

.wrap { max-width: 1180px; margin: 0 auto; padding: 1.75rem 1.25rem 4rem; }
.wrap.narrow { max-width: 760px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.page-head h1 { margin: .2rem 0 0; }
.page-head .lede { color: var(--muted); margin: .35rem 0 0; max-width: 62ch; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: .82rem; color: var(--muted); display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--signal); }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin: 2rem 0 .8rem; }
.section-title h2 { margin: 0; }

.grid { display: grid; gap: 1rem; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
@media (max-width: 960px) { .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.side { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; } }

/* ── Components ───────────────────────────────────────────────────────── */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 1.25rem;
}
.card.flush { padding: 0; overflow: hidden; }
.card.raised { box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .9rem; }
.card-head h2, .card-head h3 { margin: 0; }
.card-foot { border-top: 1px solid var(--line); margin: 1rem -1.25rem -1.25rem; padding: .8rem 1.25rem; background: #fafbfd; border-radius: 0 0 var(--radius) var(--radius); }
.card.link-card { transition: border-color .15s, box-shadow .15s, transform .15s; color: inherit; display: block; }
.card.link-card:hover { border-color: var(--signal-line); box-shadow: var(--shadow); text-decoration: none; transform: translateY(-1px); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  background: var(--signal); color: #fff; border: 1px solid transparent; border-radius: 9px;
  padding: .58rem 1rem; font: 600 .9rem/1.2 var(--body); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, box-shadow .15s, color .15s;
  text-decoration: none;
}
.btn:hover { background: var(--signal-press); text-decoration: none; }
.btn:focus-visible { box-shadow: var(--ring); outline: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.btn.secondary:hover { border-color: var(--signal-line); color: var(--signal-ink); background: #fbfefe; }
.btn.ghost { background: transparent; color: var(--ink-soft); border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn.outline { background: transparent; color: var(--signal); border-color: var(--signal-line); }
.btn.outline:hover { background: var(--signal-soft); }
.btn.danger { background: #fff; color: var(--red-ink); border-color: #efc7c2; }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { padding: .38rem .7rem; font-size: .82rem; border-radius: 8px; }
.btn.lg { padding: .78rem 1.35rem; font-size: 1rem; border-radius: 11px; }
.btn.block { width: 100%; }
.btn svg { flex: 0 0 auto; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: transparent; border: 1px solid transparent; color: var(--ink-soft); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn[aria-pressed="true"] { background: var(--signal-soft); color: var(--signal-ink); }

.badge {
  display: inline-flex; align-items: center; gap: .3rem; font: 600 .72rem/1 var(--body);
  padding: .3rem .55rem; border-radius: 999px; background: var(--surface-2); color: var(--ink-soft);
  white-space: nowrap; letter-spacing: .01em;
}
.badge.teal { background: var(--signal-soft); color: var(--signal-ink); }
.badge.green { background: var(--green-soft); color: var(--green-ink); }
.badge.amber { background: var(--amber-soft); color: var(--amber-ink); }
.badge.red { background: var(--red-soft); color: var(--red-ink); }
.badge.blue { background: var(--blue-soft); color: var(--blue-ink); }
.badge.violet { background: var(--violet-soft); color: #4c3cad; }
.badge.outline { background: transparent; border: 1px solid var(--line-strong); }
.badge .light { width: 7px; height: 7px; box-shadow: none; }
.tag {
  font-family: var(--mono); font-size: .72rem; background: var(--surface-2);
  color: var(--ink-soft); padding: .15rem .45rem; border-radius: 5px;
}
.eyebrow {
  font: 650 .72rem var(--body); text-transform: uppercase; letter-spacing: .09em; color: var(--muted); margin: 0;
}
.eyebrow.teal { color: var(--signal); }

.flash {
  display: flex; gap: .6rem; align-items: flex-start; padding: .75rem 1rem; border-radius: 10px;
  margin-bottom: 1rem; font-size: .9rem; border: 1px solid transparent;
}
.flash.success { background: var(--green-soft); color: var(--green-ink); border-color: #c8e8d4; }
.flash.error { background: var(--red-soft); color: var(--red-ink); border-color: #f3cfc9; }
.flash.info, .flash.warning { background: var(--blue-soft); color: var(--blue-ink); border-color: #cddff3; }
.flash-close { margin-left: auto; background: none; border: none; color: inherit; opacity: .6; cursor: pointer; font-size: 1.1rem; line-height: 1; }

/* KPI tiles */
.kpi { display: flex; flex-direction: column; gap: .2rem; }
.kpi .kpi-label { font-size: .8rem; color: var(--muted); font-weight: 550; display: flex; align-items: center; gap: .45rem; }
.kpi .kpi-value { font: 750 1.75rem/1.1 var(--display); letter-spacing: -.02em; }
.kpi .kpi-value small { font-size: .9rem; color: var(--muted); font-weight: 600; }
.kpi .kpi-sub { font-size: .78rem; color: var(--muted); }

/* Progress */
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--signal); border-radius: inherit; transition: width .5s ease; }
.progress.green > span { background: var(--green); }
.progress.thin { height: 5px; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .7rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 650; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; background: #fafbfd; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #fbfcfe; }
.table-wrap { overflow-x: auto; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-title { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: .78rem; color: var(--muted); }

/* Semaphore dots */
.light { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; flex: 0 0 auto; }
.light.green { background: var(--green); box-shadow: 0 0 0 3px rgba(46,158,91,.18); }
.light.amber { background: var(--amber); box-shadow: 0 0 0 3px rgba(217,145,0,.18); }
.light.grey  { background: var(--grey);  box-shadow: 0 0 0 3px rgba(154,163,183,.18); }
.light.red   { background: var(--red);   box-shadow: 0 0 0 3px rgba(209,69,59,.18); }
.light.pulse { animation: pulse-dot 2s ease-in-out infinite; }
@keyframes pulse-dot { 50% { box-shadow: 0 0 0 6px rgba(46,158,91,0); } }
.semaphores { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.sema { display: flex; align-items: center; gap: .5rem; }
.sema .lbl { font-size: .8rem; color: var(--muted); }

.bar { background: var(--surface-2); border-radius: 6px; height: 10px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--signal); border-radius: inherit; }
.barrow { display: grid; grid-template-columns: minmax(90px, 180px) 1fr 64px; gap: .75rem; align-items: center; margin: .55rem 0; }

/* Empty states */
.empty { text-align: center; padding: 2.5rem 1.5rem; color: var(--muted); }
.empty .empty-icon {
  width: 56px; height: 56px; margin: 0 auto .9rem; border-radius: 16px; display: grid; place-items: center;
  background: var(--signal-soft); color: var(--signal);
}
.empty h3 { color: var(--ink); margin-bottom: .3rem; }
.empty p { max-width: 46ch; margin: 0 auto 1rem; }

/* Tabs */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs a, .tabs button {
  padding: .65rem .9rem; font: 600 .9rem var(--body); color: var(--muted); border: none; background: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap;
  display: inline-flex; align-items: center; gap: .4rem;
}
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }
.tabs .active, .tabs [aria-selected="true"] { color: var(--signal-ink); border-bottom-color: var(--signal); }
.tabs .count { font-size: .72rem; background: var(--surface-2); color: var(--ink-soft); padding: .1rem .45rem; border-radius: 999px; }

/* Copy field */
.copyfield {
  display: flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: 10px;
  overflow: hidden; background: #fafbfd;
}
.copyfield input {
  flex: 1; border: none; background: transparent; font: 500 .88rem var(--mono); color: var(--ink);
  padding: .65rem .8rem; min-width: 0; box-shadow: none !important;
}
.copyfield .btn { border-radius: 0; border: none; border-left: 1px solid var(--line-strong); }
.joincode {
  font: 750 2rem/1 var(--mono); letter-spacing: .14em; color: var(--ink); background: var(--surface);
  border: 1px dashed var(--line-strong); border-radius: 12px; padding: .8rem 1rem; text-align: center;
}

/* Dialog */
dialog.modal {
  border: none; border-radius: var(--r-lg); padding: 0; box-shadow: var(--shadow-lg);
  width: min(520px, calc(100vw - 2rem)); color: var(--ink);
}
dialog.modal::backdrop { background: rgba(15, 21, 40, .45); backdrop-filter: blur(2px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 1.05rem; }
.modal-body { padding: 1.1rem 1.25rem 1.3rem; }
.shortcut-list { display: grid; grid-template-columns: 1fr auto; gap: .55rem 1rem; align-items: center; font-size: .9rem; }
.shortcut-list .keys { display: inline-flex; gap: .25rem; justify-content: flex-end; }

/* Avatars & people */
.person { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.person .avatar-chip { width: 32px; height: 32px; }
.person-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-sub { font-size: .78rem; color: var(--muted); }

/* ── Forms ────────────────────────────────────────────────────────────── */
label { font-weight: 600; font-size: .88rem; display: block; margin: 1rem 0 .35rem; color: var(--ink); }
input[type=text], input[type=password], input[type=number], input[type=email],
input[type=datetime-local], input[type=search], input[type=url], select, textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--line-strong);
  border-radius: 9px; font: inherit; font-size: .92rem; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--signal); box-shadow: var(--ring); }
input[type=file] { font-size: .88rem; padding: .5rem; border: 1px dashed var(--line-strong); border-radius: 9px; width: 100%; background: #fafbfd; }
.help { color: var(--muted); font-size: .8rem; margin-top: .3rem; }
.errorlist { list-style: none; padding: 0; margin: .35rem 0 0; color: var(--red-ink); font-size: .82rem; }
.field-error input, .field-error select, .field-error textarea { border-color: var(--red); }
.checkrow { display: flex; align-items: center; gap: .5rem; margin: .5rem 0; }
.checkrow input { width: auto; }
.checkrow label { margin: 0; }
.form-section { margin-bottom: 1.25rem; }
.form-section > .card-head { margin-bottom: .25rem; }
.form-section .section-desc { color: var(--muted); font-size: .86rem; margin: 0 0 .5rem; }
.form-actions {
  position: sticky; bottom: 0; z-index: 5; display: flex; gap: .6rem; justify-content: flex-end; align-items: center;
  padding: .9rem 0; margin-top: 1rem; background: linear-gradient(to top, var(--surface) 70%, rgba(245,247,251,0));
}
.field-row { display: grid; gap: 0 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

/* Toggle switches (checkbox rows with a description) */
.switch-row {
  display: flex; gap: .9rem; align-items: flex-start; padding: .85rem 0; border-top: 1px solid var(--line);
}
.switch-row:first-of-type { border-top: none; }
.switch-row .switch-text { flex: 1; }
.switch-row .switch-text label { margin: 0 0 .15rem; cursor: pointer; }
.switch-row .switch-text .help { margin: 0; }
.switch { position: relative; flex: 0 0 auto; width: 40px; height: 23px; margin-top: 1px; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; width: 100%; height: 100%; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px; background: var(--line-strong); transition: background .15s;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(15,21,40,.25); transition: transform .18s ease;
}
.switch input:checked + .track { background: var(--signal); }
.switch input:checked + .track::after { transform: translateX(17px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }

/* Radio cards (e.g. delivery: live vs homework) */
.radio-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
@media (max-width: 640px) { .radio-cards { grid-template-columns: 1fr; } }
.radio-card {
  position: relative; display: flex; gap: .8rem; align-items: flex-start; margin: 0; padding: 1rem;
  border: 1.5px solid var(--line-strong); border-radius: 12px; cursor: pointer; background: #fff;
  font-weight: 400; transition: border-color .15s, box-shadow .15s, background .15s;
}
.radio-card:hover { border-color: var(--signal-line); }
.radio-card input { position: absolute; opacity: 0; pointer-events: none; }
.radio-card .rc-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-soft); flex: 0 0 auto; }
.radio-card .rc-title { font-weight: 650; display: block; color: var(--ink); }
.radio-card .rc-desc { font-size: .82rem; color: var(--muted); display: block; margin-top: .15rem; }
.radio-card:has(input:checked) { border-color: var(--signal); background: var(--signal-soft); box-shadow: var(--ring); }
.radio-card:has(input:checked) .rc-icon { background: var(--signal); color: #fff; }
.radio-card:has(input:focus-visible) { outline: 2px solid var(--signal); outline-offset: 2px; }

/* Checklist (assign students) */
.checklist { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .4rem; max-height: 260px; overflow: auto; padding: .25rem; border: 1px solid var(--line); border-radius: 10px; margin-top: .5rem; }
.checklist label { display: flex; align-items: center; gap: .5rem; margin: 0; padding: .45rem .55rem; border-radius: 8px; font-weight: 500; font-size: .88rem; cursor: pointer; }
.checklist label:hover { background: var(--surface); }
.checklist input { width: auto; }

/* ── Auth ─────────────────────────────────────────────────────────────── */
.auth-wrap { display: flex; justify-content: center; padding: 2.5rem 1rem 4rem; }
.auth-card {
  width: 100%; max-width: 410px; border-radius: 18px; padding: 2.4rem 2.4rem 2rem; box-shadow: var(--shadow-lg);
}
.auth-brand { display: flex; flex-direction: column; align-items: center; text-align: center; }
.auth-brand img { display: block; }
.auth-split { display: flex; align-items: stretch; gap: 2rem; min-height: calc(100vh - var(--topbar-h) - 4rem); padding: 1rem; }
.auth-media { flex: 1 1 50%; display: flex; align-items: center; justify-content: center; }
.auth-video { display: block; width: 100%; max-width: 460px; height: auto; object-fit: contain; opacity: .6; border-radius: 16px; background: #fff; }
.auth-pane { flex: 1 1 50%; display: flex; align-items: center; justify-content: center; }
.auth-pane .auth-card { margin: 0; }
@media (max-width: 760px) {
  .auth-split { flex-direction: column; gap: 1rem; min-height: 0; padding: 0 0 2rem; }
  .auth-media { order: -1; }
  .auth-video { max-width: 200px; }
  .auth-card { padding: 1.8rem 1.4rem; }
}
.auth-wordmark { font-size: 1.65rem; margin-top: .8rem; }
.auth-wordmark span { color: var(--signal); }
.auth-sub { color: var(--muted); font-size: .9rem; margin: .35rem 0 0; }
.auth-card form label:first-of-type { margin-top: 1.5rem; }
.auth-submit { width: 100%; margin-top: 1.5rem; padding: .8rem; font-size: .98rem; }
.auth-alt { text-align: center; color: var(--muted); font-size: .9rem; margin: 1.1rem 0 0; }
.auth-alt a { font-weight: 600; }

/* ── Join / landing pages ─────────────────────────────────────────────── */
.landing { min-height: calc(100vh - var(--topbar-h)); display: flex; align-items: flex-start; justify-content: center; padding: 3rem 1rem 4rem; }
.landing-card { width: 100%; max-width: 620px; border-radius: var(--r-xl); padding: 0; overflow: hidden; box-shadow: var(--shadow-lg); }
.landing-hero {
  padding: 2rem 2rem 1.6rem; color: #fff; position: relative; overflow: hidden;
  background: radial-gradient(600px 220px at 85% -20%, rgba(127,227,227,.35), transparent 60%), linear-gradient(135deg, #1c2541, #233158 60%, #1e3a52);
}
.landing-hero .eyebrow { color: var(--mint); }
.landing-hero h1 { color: #fff; font-size: 1.9rem; margin: .45rem 0 .25rem; }
.landing-hero p { color: #c9d2ea; margin: 0; }
.landing-hero .hero-meta { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: 1rem; }
.landing-hero .badge { background: rgba(255,255,255,.1); color: #e6ecff; }
.landing-hero .badge.amber { background: rgba(233,196,106,.2); color: #ffe3a3; }
.landing-hero .badge.red { background: rgba(255,157,143,.18); color: #ffc7bf; }
.landing-body { padding: 1.6rem 2rem 2rem; }
.landing-body .imgstrip { margin-top: 0; }
.feature-list { list-style: none; padding: 0; margin: 0 0 1.25rem; display: grid; gap: .55rem; }
.feature-list li { display: flex; gap: .65rem; align-items: flex-start; font-size: .9rem; color: var(--ink-2); }
.feature-list .fi { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--signal-soft); color: var(--signal); }
.resume-box {
  display: flex; gap: 1rem; align-items: center; padding: 1rem; border-radius: 12px;
  background: var(--signal-soft); border: 1px solid var(--signal-line); margin-bottom: 1.2rem;
}
.resume-box .progress { margin-top: .4rem; background: #fff; }
.followups { border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem; margin-bottom: 1.2rem; }
.followups .fu-title { display: flex; align-items: center; gap: .4rem; margin: 0 0 .25rem; font-size: .95rem; }
.followups .fu-help { margin: 0 0 .7rem; }
.fu-list { list-style: none; margin: 0 0 .7rem; padding: 0; display: grid; gap: .4rem; }
.fu-list li { display: flex; align-items: center; gap: .75rem; padding: .5rem .65rem; border-radius: 10px; background: var(--surface); }
.fu-list .fu-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.fu-start { display: flex; gap: .5rem; flex-wrap: wrap; }
@media (max-width: 560px) { .landing-hero, .landing-body { padding-left: 1.25rem; padding-right: 1.25rem; } .resume-box { flex-direction: column; align-items: stretch; } }
.waiting-orb {
  width: 64px; height: 64px; margin: .5rem auto 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, var(--mint), var(--signal));
  animation: breathe 3.2s ease-in-out infinite;
}
@keyframes breathe { 0%,100% { transform: scale(.92); box-shadow: 0 0 0 0 rgba(11,138,138,.35); } 50% { transform: scale(1.05); box-shadow: 0 0 0 18px rgba(11,138,138,0); } }
.imgstrip { display: flex; gap: .6rem; flex-wrap: wrap; margin: .75rem 0 1.2rem; }
.imgstrip img { max-height: 120px; border-radius: 10px; border: 1px solid var(--line); }

/* ==========================================================================
   Student workspace (chat room + code IDE)
   ========================================================================== */
.ws-page { background: var(--surface); }
.ws { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.ws-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 1rem; padding: 0 1rem 0 .9rem; height: 60px;
  background: #fff; border-bottom: 1px solid var(--line); position: relative; z-index: 5;
}
.ws-brand { display: inline-flex; flex: 0 0 auto; }
.ws-brand img { display: block; }
.ws-titles { min-width: 0; flex: 0 1 auto; }
.ws-kicker { font-size: .72rem; color: var(--muted); font-weight: 600; margin: 0; display: flex; gap: .4rem; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-kicker .late { color: var(--red-ink); }
.ws-title { font-size: 1rem; margin: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-progress { flex: 1 1 auto; max-width: 260px; margin-left: auto; display: flex; flex-direction: column; gap: .3rem; }
.ws-progress-lbl { font-size: .74rem; color: var(--muted); font-weight: 600; display: flex; justify-content: space-between; }
.ws-tools { display: flex; align-items: center; gap: .25rem; flex: 0 0 auto; }
.ws-tools .lang-switch select { color: var(--ink-soft); border-color: var(--line-strong);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%236b748f' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E"); }
.ws-tools .lang-switch option { color: var(--ink); }
.status-pill {
  display: inline-flex; align-items: center; gap: .45rem; font: 600 .76rem var(--body); padding: .38rem .7rem;
  border-radius: 999px; background: var(--signal-soft); color: var(--signal-ink); white-space: nowrap;
}
.status-pill.done { background: var(--green-soft); color: var(--green-ink); }
.status-pill.ended { background: var(--red-soft); color: var(--red-ink); }
.status-pill .light { width: 8px; height: 8px; }
.code-toggle { gap: .4rem; display: inline-flex; width: auto; padding: 0 .6rem; font: 600 .8rem var(--body); }
@media (max-width: 760px) {
  .ws-head { gap: .5rem .6rem; height: auto; min-height: 56px; padding: .55rem .75rem .6rem; flex-wrap: wrap; }
  .ws-brand, .ws-head .status-pill, .code-toggle span { display: none; }
  .ws-titles { flex: 1 1 0; }
  .ws-progress { order: 10; flex-basis: 100%; max-width: none; margin: 0; }
  .ws-tools .lang-switch select { padding: .3rem 1.3rem .3rem .45rem; max-width: 92px; }
  .ide-mode, .ide-saved, .ide-tool .copy-label { display: none; }
  .ide-file { padding: 0 .75rem; }
}

.ws-tabs { display: none; }
.ws-main { flex: 1 1 auto; min-height: 0; display: flex; }
.ws-chat { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; background: var(--surface); }
.ws[data-layout="split"] .ws-chat { flex: 0 0 var(--chat-w, 42%); border-right: 1px solid var(--line); }
.ws-code { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; background: var(--ide-bg); }
.ws-resizer {
  flex: 0 0 6px; cursor: col-resize; background: var(--line); position: relative; display: none;
  transition: background .15s;
}
.ws-resizer::after { content: ""; position: absolute; top: 50%; left: 1px; width: 4px; height: 36px; margin-top: -18px; border-radius: 4px; background: var(--line-strong); }
.ws-resizer:hover, .ws-resizer.dragging, .ws-resizer:focus-visible { background: var(--signal-line); outline: none; }
.ws[data-layout="split"] .ws-resizer { display: block; }
.ws.resizing { cursor: col-resize; user-select: none; }

@media (max-width: 900px) {
  .ws[data-layout="split"] .ws-tabs {
    display: flex; flex: 0 0 auto; gap: .25rem; padding: .4rem .6rem; background: #fff; border-bottom: 1px solid var(--line);
  }
  .ws-tabs button {
    flex: 1; padding: .5rem; border-radius: 9px; border: none; background: transparent; font: 600 .86rem var(--body);
    color: var(--muted); cursor: pointer; display: inline-flex; justify-content: center; gap: .4rem; align-items: center;
  }
  .ws-tabs button[aria-selected="true"] { background: var(--signal-soft); color: var(--signal-ink); }
  .ws-tabs .dot-new { width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
  .ws[data-layout="split"] .ws-chat { flex: 1 1 auto; border-right: none; }
  .ws[data-layout="split"] .ws-resizer { display: none; }
  .ws[data-layout="split"][data-tab="chat"] .ws-code { display: none; }
  .ws[data-layout="split"][data-tab="code"] .ws-chat { display: none; }
}

/* Conversation */
.thread-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; position: relative; }
.thread { max-width: 780px; margin: 0 auto; padding: 1.5rem 1.25rem 1rem; display: flex; flex-direction: column; gap: 1.15rem; }
.ws[data-layout="split"] .thread { max-width: none; padding: 1.25rem 1.1rem .75rem; }

.intro-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
}
.intro-card .eyebrow { margin-bottom: .3rem; }
.intro-card h2 { font-size: 1.15rem; margin: 0 0 .35rem; }
.intro-card p { color: var(--ink-2); font-size: .92rem; margin: 0; }
.intro-card .chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }
.intro-card .imgstrip { margin: .8rem 0 0; }

.msg { display: flex; gap: .7rem; align-items: flex-start; max-width: 100%; animation: msg-in .28s ease both; }
@keyframes msg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg.assistant { align-self: stretch; }
.msg.user { align-self: flex-end; justify-content: flex-end; max-width: 86%; }
.msg.user.code { max-width: 100%; width: 100%; }
.msg .avatar { flex: 0 0 auto; margin-top: 2px; display: block; }
.msg-body { min-width: 0; flex: 1; }
.msg.user .msg-body { flex: 0 1 auto; }
.msg-meta { font-size: .74rem; color: var(--muted); font-weight: 600; margin: 0 0 .3rem; display: flex; gap: .4rem; align-items: center; }
.msg.user .msg-meta { justify-content: flex-end; }
.bubble { font-size: .95rem; line-height: 1.6; overflow-wrap: anywhere; }
.bubble.assistant {
  background: #fff; border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; padding: .85rem 1.05rem;
  box-shadow: var(--shadow-sm); color: var(--ink);
}
.bubble.user {
  background: var(--signal); color: #fff; padding: .7rem 1rem; border-radius: 16px 4px 16px 16px;
  white-space: pre-wrap;
}
.bubble img { max-width: 100%; border-radius: 10px; margin: .6rem 0; display: block; border: 1px solid var(--line); }
.bubble-audio { display: block; margin-top: .6rem; width: 100%; max-width: 320px; height: 36px; }
.msg.user.code .bubble.user { background: transparent; padding: 0; border-radius: 0; white-space: normal; }

/* Rich text inside bubbles */
.rich > :first-child { margin-top: 0; }
.rich > :last-child { margin-bottom: 0; }
.rich p { margin: 0 0 .65rem; }
.rich ul, .rich ol { margin: .3rem 0 .7rem; padding-left: 1.35rem; }
.rich li { margin: .2rem 0; }
.rich li::marker { color: var(--signal); }
.rich h3, .rich h4 { font-size: 1rem; margin: .9rem 0 .4rem; }
.rich blockquote { margin: .5rem 0; padding: .4rem .9rem; border-left: 3px solid var(--signal-line); color: var(--ink-2); background: var(--surface); border-radius: 0 8px 8px 0; }
.rich a { text-decoration: underline; text-underline-offset: 2px; }
.rich code:not(.cb-code) {
  font-family: var(--mono); font-size: .86em; background: #f0f3f9; border: 1px solid #e3e8f2;
  padding: .05em .35em; border-radius: 5px; color: #24305a;
}
.bubble.user .rich code:not(.cb-code), .bubble.user code { background: rgba(255,255,255,.18); border-color: transparent; color: #fff; }
.rich strong { font-weight: 650; }

/* Code blocks (tutor examples + learner submissions) */
.codeblock {
  margin: .65rem 0; border-radius: 12px; overflow: hidden; background: var(--ide-bg); border: 1px solid #1c2645;
  box-shadow: 0 1px 2px rgba(15,21,40,.12);
}
.codeblock-head {
  display: flex; align-items: center; gap: .5rem; padding: .4rem .5rem .4rem .85rem; background: #141c34;
  border-bottom: 1px solid #1f2a49; font: 600 .72rem var(--mono); color: var(--ide-muted); letter-spacing: .02em;
}
.codeblock-head .cb-lang { text-transform: lowercase; color: var(--mint); }
.codeblock-head .cb-title { color: #c6d0ee; font-family: var(--body); font-weight: 600; font-size: .76rem; }
.codeblock-head .cb-actions { margin-left: auto; display: flex; gap: .2rem; }
.cb-btn {
  background: transparent; border: 1px solid transparent; color: var(--ide-muted); border-radius: 7px;
  padding: .22rem .5rem; font: 600 .72rem var(--body); cursor: pointer; display: inline-flex; gap: .3rem; align-items: center;
}
.cb-btn:hover { color: #fff; background: rgba(255,255,255,.07); }
.codeblock pre { margin: 0; padding: .8rem 1rem; overflow-x: auto; white-space: pre; color: var(--ide-text); font: .86rem/1.6 var(--mono); tab-size: 4; }
.codeblock pre code { font: inherit; background: none; border: none; padding: 0; color: inherit; }
.codeblock.collapsed pre { max-height: 220px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 70%, transparent); mask-image: linear-gradient(#000 70%, transparent); }
.cb-expand { display: block; width: 100%; border: none; border-top: 1px solid #1f2a49; background: #121a31; color: var(--ide-muted); font: 600 .76rem var(--body); padding: .4rem; cursor: pointer; }
.cb-expand:hover { color: #fff; }
.verdict { display: inline-flex; align-items: center; gap: .3rem; font: 600 .72rem var(--body); padding: .15rem .5rem; border-radius: 999px; }
.verdict.ok { background: rgba(46,158,91,.18); color: #7ee2a6; }
.verdict.bad { background: rgba(209,69,59,.2); color: #ffaa9f; }
.verdict.neutral { background: rgba(255,255,255,.08); color: var(--ide-muted); }

/* Typing indicator */
.typing {
  background: #fff; border: 1px solid var(--line); border-radius: 4px 16px 16px 16px; padding: .8rem 1rem;
  display: inline-flex; gap: .4rem; align-items: center; box-shadow: var(--shadow-sm);
}
.typing .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--signal); animation: tk-blink 1.3s infinite; }
.typing .dot:nth-child(2) { animation-delay: .18s; }
.typing .dot:nth-child(3) { animation-delay: .36s; }
.typing .lbl { font-size: .8rem; color: var(--muted); margin-left: .3rem; }
@keyframes tk-blink { 0%,80%,100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.jump-latest {
  position: sticky; bottom: .75rem; margin: 0 auto; display: flex; width: max-content; align-items: center; gap: .35rem;
  background: var(--ink); color: #fff; border: none; border-radius: 999px; padding: .45rem .85rem; font: 600 .8rem var(--body);
  box-shadow: var(--shadow-lg); cursor: pointer; z-index: 3;
}

/* Dock: answer area pinned under the thread */
.dock { flex: 0 0 auto; padding: .6rem 1.25rem 1rem; background: linear-gradient(to top, var(--surface) 75%, rgba(245,247,251,0)); }
.dock-inner { max-width: 780px; margin: 0 auto; }
.ws[data-layout="split"] .dock { padding: .6rem 1.1rem .9rem; }
.ws[data-layout="split"] .dock-inner { max-width: none; }
.dock-foot { display: flex; justify-content: space-between; gap: 1rem; align-items: center; margin-top: .45rem; min-height: 1.2em; }
.dock-hint { font-size: .74rem; color: var(--faint); white-space: nowrap; }
@media (max-width: 560px) { .dock-hint { display: none; } .dock { padding: .5rem .75rem .75rem; } .thread { padding: 1rem .75rem; } }
.note { font-size: .8rem; color: var(--muted); }
.note.warn { color: var(--amber-ink); }
.note.err { color: var(--red-ink); }

.composer {
  display: flex; align-items: flex-end; gap: .5rem; border: 1.5px solid var(--line-strong); border-radius: 16px; background: #fff;
  padding: .45rem .45rem .45rem 1rem; transition: border-color .15s, box-shadow .15s; box-shadow: var(--shadow);
}
.composer:focus-within { border-color: var(--signal); box-shadow: var(--ring), var(--shadow); }
.composer textarea {
  flex: 1; min-height: 26px; max-height: 220px; border: none; background: transparent; padding: .5rem 0; resize: none;
  font-size: .95rem; box-shadow: none !important; line-height: 1.5;
}
.composer textarea:focus { outline: none; }
.composer-send {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; border: none; background: var(--signal); color: #fff;
  cursor: pointer; display: grid; place-items: center; transition: background .15s, transform .1s;
}
.composer-send:hover { background: var(--signal-press); }
.composer-send:active { transform: scale(.96); }
.composer-send:disabled { opacity: .45; cursor: not-allowed; }

/* Multiple choice */
.mcq { display: grid; gap: .5rem; }
.mcq-head { font-size: .76rem; color: var(--muted); font-weight: 600; margin: 0 0 .1rem; }
.mcq-option {
  display: flex; align-items: center; gap: .8rem; width: 100%; text-align: left; font: 500 .93rem/1.45 var(--body); color: var(--ink);
  background: #fff; border: 1.5px solid var(--line-strong); border-radius: 12px; padding: .7rem .9rem; cursor: pointer;
  transition: border-color .12s, background .12s, box-shadow .12s, transform .08s; box-shadow: var(--shadow-sm);
}
.mcq-option:hover { border-color: var(--signal); background: #fbfefe; }
.mcq-option:active { transform: scale(.995); }
.mcq-option .mcq-key {
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  font: 700 .8rem var(--mono); background: var(--surface-2); color: var(--ink-soft); transition: background .12s, color .12s;
}
.mcq-option:hover .mcq-key { background: var(--signal-soft); color: var(--signal-ink); }
.mcq-option.chosen { border-color: var(--signal); background: var(--signal-soft); }
.mcq-option.chosen .mcq-key { background: var(--signal); color: #fff; }
.mcq-option:disabled { cursor: default; }
.mcq-option:disabled:not(.chosen) { opacity: .5; }
.mcq-option code { font-family: var(--mono); font-size: .86em; background: #f0f3f9; padding: .05em .35em; border-radius: 5px; }

/* "Answer in the editor" call-to-action in the dock */
.code-cta {
  display: flex; align-items: center; gap: .85rem; padding: .8rem .9rem; border-radius: 14px;
  background: var(--ink); color: #e6ecff; box-shadow: var(--shadow);
}
.code-cta .cta-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: rgba(127,227,227,.14); color: var(--mint); flex: 0 0 auto; }
.code-cta .cta-text { flex: 1; font-size: .88rem; }
.code-cta .cta-text strong { display: block; color: #fff; font-size: .92rem; }
.code-cta .cta-text span { color: #a9b6dc; }
.code-cta .btn { background: var(--mint); color: var(--ink); }
.code-cta .btn:hover { background: #a6efef; }

/* Voice */
.voice {
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .8rem .9rem; border-radius: 14px;
  background: #fff; border: 1.5px solid var(--line-strong); box-shadow: var(--shadow);
}
.voice .voice-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--signal-soft); color: var(--signal); flex: 0 0 auto; }
.voice .voice-text { flex: 1; min-width: 160px; font-size: .88rem; }
.voice .voice-text strong { display: block; font-size: .92rem; }
.voice .voice-text span { color: var(--muted); }
.voice.recording { border-color: var(--red); }
.voice.recording .voice-icon { background: var(--red); color: #fff; animation: recpulse 1.4s ease-in-out infinite; }
.voice-timer { font: 600 .9rem var(--mono); color: var(--red-ink); min-width: 3.2em; }
.voice audio { height: 36px; max-width: 260px; }
.btn.record { background: var(--red); }
.btn.record:hover { background: #b93a31; }
@keyframes recpulse { 0%,100% { box-shadow: 0 0 0 0 rgba(209,69,59,.4); } 50% { box-shadow: 0 0 0 8px rgba(209,69,59,0); } }

/* End-of-activity banner + results */
.banner {
  display: flex; align-items: center; gap: .75rem; padding: .85rem 1rem; border-radius: 14px; font-size: .9rem; font-weight: 500;
}
.banner.done { background: var(--green-soft); border: 1px solid #c8e8d4; color: var(--green-ink); }
.banner.ended { background: var(--red-soft); border: 1px solid #f3cfc9; color: var(--red-ink); }
.banner.info { background: var(--blue-soft); border: 1px solid #cddff3; color: var(--blue-ink); }
.banner .banner-actions { margin-left: auto; display: flex; gap: .4rem; }

.result-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow); overflow: hidden;
  animation: msg-in .4s ease both;
}
.result-hero {
  display: flex; gap: 1.25rem; align-items: center; padding: 1.4rem 1.5rem;
  background: radial-gradient(500px 200px at 100% 0, rgba(46,158,91,.12), transparent 60%), linear-gradient(180deg, #f7fcf9, #fff);
  border-bottom: 1px solid var(--line);
}
.result-hero h2 { margin: .2rem 0 .2rem; font-size: 1.3rem; }
.result-hero .meta { font-size: .82rem; color: var(--muted); display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.ring { position: relative; width: 92px; height: 92px; flex: 0 0 auto; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring .ring-track { stroke: var(--surface-2); }
.ring .ring-val { stroke: var(--green); stroke-linecap: round; transition: stroke-dashoffset 1.1s cubic-bezier(.2,.8,.2,1); }
.ring .ring-num { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font: 800 1.6rem/1 var(--display); }
.ring .ring-num small { display: block; font-size: .7rem; color: var(--muted); font-weight: 600; margin-top: .15rem; }
.ring-check { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: var(--green); color: #fff; flex: 0 0 auto; box-shadow: 0 0 0 8px rgba(46,158,91,.14); }
.result-body { padding: 1.25rem 1.5rem 1.4rem; }
.result-body .summary { color: var(--ink-2); font-size: .95rem; }
.result-section { margin-top: 1.2rem; }
.result-section h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: .6rem; }
.score-row { display: grid; grid-template-columns: minmax(0, 1fr) 140px 52px; gap: .8rem; align-items: center; padding: .45rem 0; border-top: 1px solid var(--line); }
.score-row:first-of-type { border-top: none; }
.score-row .sr-name { font-weight: 600; font-size: .9rem; }
.score-row .sr-comment { font-size: .8rem; color: var(--muted); font-weight: 400; display: block; margin-top: .1rem; }
.score-row .sr-val { font: 700 .88rem var(--mono); text-align: right; }
@media (max-width: 560px) { .score-row { grid-template-columns: 1fr 52px; } .score-row .progress { grid-column: 1 / -1; grid-row: 2; } .result-hero { flex-direction: column; align-items: flex-start; } }
.topic-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.result-actions { display: flex; gap: .5rem; flex-wrap: wrap; padding: 1rem 1.5rem; border-top: 1px solid var(--line); background: #fafbfd; }

/* ── Code IDE pane ───────────────────────────────────────────────────── */
.ide { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; color: var(--ide-text); background: var(--ide-bg); }
.ide-bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: .5rem; height: 44px; padding: 0 .5rem 0 0;
  background: var(--ide-panel); border-bottom: 1px solid var(--ide-line);
}
.ide-file {
  height: 100%; display: inline-flex; align-items: center; gap: .5rem; padding: 0 1rem; font: 600 .82rem var(--mono);
  color: #e6ecff; background: var(--ide-bg); border-right: 1px solid var(--ide-line); position: relative;
}
.ide-file::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--mint); }
.ide-file .file-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber); display: none; }
.ide-file.dirty .file-dot { display: inline-block; }
.ide-lang { font: 600 .7rem var(--mono); color: var(--mint); text-transform: lowercase; padding: .15rem .45rem; border-radius: 6px; background: rgba(127,227,227,.1); }
.ide-mode { font: 600 .7rem var(--body); color: var(--ide-muted); padding: .2rem .5rem; border-radius: 6px; background: rgba(255,255,255,.06); display: inline-flex; gap: .3rem; align-items: center; }
.ide-mode.live { color: #ffd88a; background: rgba(233,196,106,.12); }
.ide-bar .spacer { flex: 1; }
.ide-saved { font-size: .72rem; color: var(--ide-muted); white-space: nowrap; transition: opacity .3s; }
.ide-tool {
  display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 30px; padding: 0 .4rem; border-radius: 8px; border: none;
  background: transparent; color: var(--ide-muted); cursor: pointer; font: 600 .76rem var(--body); gap: .3rem;
}
.ide-tool:hover { color: #fff; background: rgba(255,255,255,.07); }
.ide-tool:disabled { opacity: .35; cursor: not-allowed; }
.ide-tool.confirm { color: #ffb4a9; background: rgba(209,69,59,.18); }
.ide-sep { width: 1px; height: 18px; background: var(--ide-line); margin: 0 .15rem; }

.ide-banner {
  flex: 0 0 auto; display: flex; align-items: center; gap: .6rem; padding: .5rem .9rem; font-size: .8rem;
  background: #111a33; border-bottom: 1px solid var(--ide-line); color: #b9c5ea;
}
.ide-banner .bi { flex: 0 0 auto; display: grid; place-items: center; color: var(--mint); }
.ide-banner.check .bi { color: #8ff0b7; }
.ide-banner.warn { background: rgba(233,196,106,.08); color: #f3d79a; }
.ide-banner.warn .bi { color: #e9c46a; }
.ide-banner.lock { background: #10172b; color: var(--ide-muted); }
.ide-banner.lock .bi { color: var(--ide-muted); }

.ide-editor { flex: 1 1 auto; min-height: 120px; position: relative; overflow: hidden; }
.ide-editor .cm-editor { position: absolute; inset: 0; }
.ide.readonly .ide-editor { opacity: .82; }
/* Plain-textarea fallback editor (bundle unavailable) */
.fallback-editor { position: absolute; inset: 0; display: flex; background: var(--ide-bg); }
.fallback-editor .code-gutter {
  flex: 0 0 auto; min-width: 3em; overflow: hidden; user-select: none; padding: 12px 10px 12px 0; text-align: right;
  font: 14px/1.6 var(--mono); color: #4d5a80;
}
.fallback-editor .code-gutter pre { margin: 0; font: inherit; }
.fallback-editor textarea {
  flex: 1; border: none; outline: none; resize: none; padding: 12px 12px 12px 8px; font: 14px/1.6 var(--mono);
  color: var(--ide-text); background: transparent; white-space: pre; overflow: auto; tab-size: 4; box-shadow: none !important; border-radius: 0;
}

.ide-console { flex: 0 0 var(--console-h, 34%); min-height: 90px; display: flex; flex-direction: column; border-top: 1px solid var(--ide-line); background: #0a1020; }
.ide-console.collapsed { flex-basis: auto; min-height: 0; }
.ide-console.collapsed .console-body { display: none; }
.console-head { flex: 0 0 auto; display: flex; align-items: center; gap: .6rem; padding: .35rem .5rem .35rem .9rem; background: var(--ide-panel); border-bottom: 1px solid var(--ide-line); }
.console-title { font: 650 .72rem var(--body); text-transform: uppercase; letter-spacing: .08em; color: var(--ide-muted); display: inline-flex; gap: .4rem; align-items: center; }
.run-status { font: 600 .76rem var(--body); display: inline-flex; align-items: center; gap: .35rem; color: var(--ide-muted); }
.run-status.ok { color: #7ee2a6; }
.run-status.fail { color: #ff9d8f; }
.run-status.busy { color: #ffd88a; }
.run-status .spin { width: 12px; height: 12px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.run-time { font: 500 .72rem var(--mono); color: #5d6a92; }
.console-body { flex: 1 1 auto; min-height: 0; overflow: auto; padding: .6rem .9rem .8rem; font: .84rem/1.55 var(--mono); }
.console-body pre { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; }
.console-body .out { color: #d9e2ff; }
.console-body .err { color: #ff9d8f; margin-top: .3rem; }
.console-empty { color: #56638c; font-family: var(--body); font-size: .84rem; display: flex; gap: .5rem; align-items: center; }
.console-verdict { margin-bottom: .55rem; padding: .5rem .7rem; border-radius: 9px; font: 600 .82rem var(--body); display: flex; gap: .5rem; align-items: flex-start; }
.console-verdict.ok { background: rgba(46,158,91,.14); color: #8ff0b7; }
.console-verdict.fail { background: rgba(209,69,59,.14); color: #ffb0a5; }
.console-verdict.info { background: rgba(255,255,255,.05); color: #b9c5ea; }

.ide-actions {
  flex: 0 0 auto; display: flex; align-items: center; gap: .55rem; padding: .6rem .75rem; background: var(--ide-panel); border-top: 1px solid var(--ide-line);
}
.ide-keys { font-size: .74rem; color: var(--ide-muted); display: inline-flex; gap: .35rem; align-items: center; flex-wrap: wrap; margin-right: auto; }
.ide-keys kbd { background: rgba(255,255,255,.06); border-color: #2c3758; color: #c6d0ee; }
.btn.run { background: #1d2848; color: #e6ecff; border-color: #33406a; }
.btn.run:hover { background: #26335c; }
.btn.run svg { color: #7ee2a6; }
.btn.submit { background: var(--mint); color: var(--ink); }
.btn.submit:hover { background: #a6efef; }
.btn.submit.confirm { background: #e9c46a; }
@media (max-width: 560px) { .ide-keys { display: none; } .ide-actions .btn { flex: 1; } }

/* Code token colours (classHighlighter) — dark editor + code blocks */
.tok-keyword, .tok-operatorKeyword, .tok-controlKeyword, .tok-definitionKeyword, .tok-moduleKeyword { color: #c792ea; }
.tok-string, .tok-string2, .tok-character, .tok-inserted { color: #a5e07e; }
.tok-number, .tok-bool, .tok-atom, .tok-literal { color: #f7a96b; }
.tok-comment { color: #6a7aa6; font-style: italic; }
.tok-variableName { color: #e6ecff; }
.tok-variableName.tok-definition, .tok-definition { color: #82c8ff; }
.tok-function, .tok-variableName2 { color: #82aaff; }
.tok-propertyName { color: #8bd5f2; }
.tok-typeName, .tok-className, .tok-namespace { color: #ffcb6b; }
.tok-operator, .tok-punctuation { color: #89ddff; }
.tok-meta, .tok-annotation { color: #ffcb6b; }
.tok-self, .tok-special { color: #ff8f8f; }
.tok-invalid, .tok-deleted { color: #ff6e6e; }
.tok-heading, .tok-strong { font-weight: 700; }
.tok-emphasis { font-style: italic; }
.tok-link, .tok-url { color: #82aaff; text-decoration: underline; }
/* Light editor theme */
.ide[data-theme="light"] { --ide-bg: #ffffff; --ide-panel: #f4f6fb; --ide-line: #e1e6f0; --ide-text: #1c2541; --ide-muted: #6b748f; color: var(--ide-text); }
.ide[data-theme="light"] .ide-file { color: var(--ink); }
.ide[data-theme="light"] .ide-console { background: #fbfcfe; }
.ide[data-theme="light"] .console-body .out { color: #1c2541; }
.ide[data-theme="light"] .console-body .err { color: #b2382f; }
.ide[data-theme="light"] .ide-banner { background: #f7f9fd; color: var(--ink-2); }
.ide[data-theme="light"] .ide-banner .bi { color: var(--signal); }
.ide[data-theme="light"] .ide-tool:hover { color: var(--ink); background: rgba(28,37,65,.06); }
.ide[data-theme="light"] .btn.run { background: #fff; color: var(--ink); border-color: var(--line-strong); }
.ide[data-theme="light"] .btn.run svg { color: var(--green); }
.ide[data-theme="light"] .btn.submit { background: var(--signal); color: #fff; }
.ide[data-theme="light"] .ide-keys kbd { background: #fff; border-color: var(--line-strong); color: var(--ink-soft); }
.ide[data-theme="light"] .console-verdict.ok { color: var(--green-ink); background: var(--green-soft); }
.ide[data-theme="light"] .console-verdict.fail { color: var(--red-ink); background: var(--red-soft); }
.ide[data-theme="light"] .console-verdict.info { color: var(--ink-2); background: var(--surface-2); }
.ide[data-theme="light"] .run-status.ok { color: var(--green); }
.ide[data-theme="light"] .run-status.fail { color: var(--red); }
.ide[data-theme="light"] .run-status.busy { color: var(--amber-ink); }
.ide[data-theme="light"] .ide-lang { color: var(--signal-ink); background: var(--signal-soft); }
.ide[data-theme="light"] .tok-keyword, .ide[data-theme="light"] .tok-operatorKeyword, .ide[data-theme="light"] .tok-controlKeyword, .ide[data-theme="light"] .tok-definitionKeyword, .ide[data-theme="light"] .tok-moduleKeyword { color: #8a2fb8; }
.ide[data-theme="light"] .tok-string, .ide[data-theme="light"] .tok-string2 { color: #23863a; }
.ide[data-theme="light"] .tok-number, .ide[data-theme="light"] .tok-bool, .ide[data-theme="light"] .tok-atom { color: #c2570c; }
.ide[data-theme="light"] .tok-comment { color: #8a93ab; }
.ide[data-theme="light"] .tok-variableName { color: #1c2541; }
.ide[data-theme="light"] .tok-variableName.tok-definition, .ide[data-theme="light"] .tok-definition, .ide[data-theme="light"] .tok-function, .ide[data-theme="light"] .tok-variableName2 { color: #1f5fbf; }
.ide[data-theme="light"] .tok-propertyName { color: #0b7285; }
.ide[data-theme="light"] .tok-typeName, .ide[data-theme="light"] .tok-className, .ide[data-theme="light"] .tok-namespace, .ide[data-theme="light"] .tok-meta { color: #a8650b; }
.ide[data-theme="light"] .tok-operator, .ide[data-theme="light"] .tok-punctuation { color: #3a6a8a; }
.ide[data-theme="light"] .tok-self, .ide[data-theme="light"] .tok-special { color: #c0392b; }

/* ==========================================================================
   Teacher pages
   ========================================================================== */
.statusbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .9rem; }
.statusbar-state { display: flex; align-items: center; gap: .75rem; }
.statusbar-state .state-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-soft); flex: 0 0 auto; }
.statusbar-state.live .state-icon { background: var(--green-soft); color: var(--green); }
.statusbar-state.hw .state-icon { background: var(--violet-soft); color: var(--violet); }
.statusbar-state strong { display: block; }
.statusbar-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

.task-card { display: flex; flex-direction: column; gap: .7rem; }
.task-card .tc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.task-card h3 { margin: .25rem 0 0; font-size: 1.02rem; }
.task-card h3 a { color: var(--ink); }
.task-card .tc-meta { display: flex; gap: .4rem; flex-wrap: wrap; }
.task-card .tc-foot { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-size: .82rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: .7rem; margin-top: auto; }
.class-card .cc-band { height: 6px; margin: -1.25rem -1.25rem 1rem; border-radius: var(--radius) var(--radius) 0 0; background: linear-gradient(90deg, var(--signal), #3aa3c9); }
.class-card h3 { margin: 0; font-size: 1.05rem; }
.class-card .cc-stats { display: flex; gap: 1rem; font-size: .84rem; color: var(--muted); margin-top: .8rem; }
.class-card .cc-stats strong { color: var(--ink); }

.todo-item {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.15rem; border-bottom: 1px solid var(--line); color: inherit;
}
.todo-item:last-child { border-bottom: none; }
.todo-item:hover { background: #fbfcfe; text-decoration: none; }
.todo-item .ti-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 auto; background: var(--surface-2); color: var(--ink-soft); }
.todo-item .ti-icon.hw { background: var(--violet-soft); color: var(--violet); }
.todo-item .ti-icon.live { background: var(--green-soft); color: var(--green); }
.todo-item .ti-icon.done { background: var(--green); color: #fff; }
.todo-item .ti-main { flex: 1; min-width: 0; }
.todo-item .ti-title { font-weight: 650; color: var(--ink); }
.todo-item .ti-sub { font-size: .8rem; color: var(--muted); display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-top: .15rem; }
.todo-item .ti-side { display: flex; align-items: center; gap: .6rem; flex: 0 0 auto; }
@media (max-width: 600px) { .todo-item { flex-wrap: wrap; } .todo-item .ti-side { width: 100%; justify-content: flex-end; } }
.score-pill { font: 700 .82rem var(--mono); padding: .25rem .55rem; border-radius: 8px; background: var(--green-soft); color: var(--green-ink); }
.score-pill.mid { background: var(--amber-soft); color: var(--amber-ink); }
.score-pill.low { background: var(--red-soft); color: var(--red-ink); }

/* Gradebook matrix */
.gradebook { overflow: auto; max-height: 70vh; }
.gradebook table { font-size: .84rem; }
.gradebook th, .gradebook td { white-space: nowrap; padding: .55rem .7rem; text-align: center; }
.gradebook th:first-child, .gradebook td:first-child { text-align: left; position: sticky; left: 0; background: #fff; z-index: 1; box-shadow: 1px 0 0 var(--line); }
.gradebook thead th { position: sticky; top: 0; z-index: 2; text-transform: none; letter-spacing: 0; font-size: .78rem; color: var(--ink-soft); max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.gradebook thead th:first-child { z-index: 3; background: #fafbfd; }
.gradebook thead th a { color: var(--ink-soft); }
.gb-cell { display: inline-flex; align-items: center; gap: .3rem; padding: .2rem .5rem; border-radius: 7px; font-weight: 600; font-size: .78rem; }
.gb-cell.done { background: var(--green-soft); color: var(--green-ink); font-family: var(--mono); }
.gb-cell.progress { background: var(--amber-soft); color: var(--amber-ink); }
.gb-cell.todo { color: var(--faint); }
.gb-cell.late { box-shadow: inset 0 0 0 1.5px var(--red); }
.gb-na { color: var(--line-strong); }

.report-body { max-width: 74ch; }
.report-body h3 { font-size: 1rem; margin: 1.1rem 0 .3rem; padding-bottom: .25rem; border-bottom: 1px solid var(--line); }
.report-body p { margin: .4rem 0; font-size: .94rem; }
.report-body ul, .report-body ol { margin: .4rem 0 .6rem; padding-left: 1.3rem; }
.report-body li { margin: .25rem 0; font-size: .94rem; }
.report-body code { font-family: var(--mono); font-size: .85em; background: rgba(15,21,40,.07); padding: .1em .35em; border-radius: 5px; }

/* Teacher transcript */
.transcript .thread { max-width: none; padding: 0; }
.transcript .msg { animation: none; }
.check-note { margin-top: .5rem; font-size: .8rem; }
.check-note summary { cursor: pointer; color: var(--muted); }
.check-note pre { white-space: pre-wrap; background: var(--surface); padding: .6rem .75rem; border-radius: 8px; font: .78rem/1.5 var(--mono); margin: .4rem 0 0; }
.eval-card { border-left: 4px solid var(--green); }
.eval-score { font-family: var(--display); font-weight: 750; font-size: 2.1rem; margin: .1rem 0 .3rem; line-height: 1; }
.eval-score .muted { font-size: 1rem; font-weight: 600; }
.eval-raw { margin-top: .8rem; }
.eval-raw summary { cursor: pointer; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ── Print: a clean copy of the conversation + results ───────────────── */
@media print {
  body, .ws-page { background: #fff; }
  .topbar, .ws-tools, .ws-tabs, .dock, .ws-code, .ws-resizer, .result-actions, .jump-latest, .cb-actions, .no-print { display: none !important; }
  .ws { height: auto; overflow: visible; }
  .ws-main, .ws-chat, .thread-scroll { display: block; overflow: visible; height: auto; }
  .ws[data-layout="split"] .ws-chat { border: none; }
  .msg { break-inside: avoid; animation: none; }
  .bubble.user { background: #fff; color: var(--ink); border: 1px solid var(--line-strong); }
  .codeblock { break-inside: avoid; }
  .card, .result-card { box-shadow: none; }
}

/* ── Broadcast / projector view ──────────────────────────────────── */
.bcast-body {
  margin: 0; min-height: 100vh; color: #eaf0ff;
  background: radial-gradient(1200px 700px at 50% 18%, #243056 0%, #18203b 45%, #0f1528 100%);
  overflow: hidden;
}
.bcast-fx { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
.bcast { position: relative; z-index: 2; display: flex; flex-direction: column; min-height: 100vh; padding: 1.4rem 2rem 1rem; }
.bcast-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.bcast-eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; color: #8ea2d6; margin: 0 0 .2rem; }
.bcast-title { font-family: var(--display); font-size: 2rem; margin: 0; color: #fff; }
.bcast-controls { display: flex; align-items: center; gap: .6rem; }
.bcast-btn { padding: .45rem .9rem; }
.bcast-controls .btn.ghost { color: #eaf0ff; border-color: #3a4668; background: rgba(255,255,255,.04); }
.bcast-live { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; color: #cdd8f5; background: rgba(255,255,255,.05); padding: .35rem .7rem; border-radius: 999px; }

.sky { position: relative; flex: 1; margin: 1rem 0; }
.sky-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #7e8cb8; font-size: 1.1rem; }

.collective {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  text-align: center; z-index: 1; pointer-events: none;
}
.collective-glow {
  position: absolute; left: 50%; top: 50%; width: 360px; height: 360px; margin: -180px 0 0 -180px;
  border-radius: 50%; background: radial-gradient(circle, rgba(127,227,227,.5), rgba(127,227,227,0) 68%);
  transition: opacity 1.2s ease, transform 1.2s ease; opacity: .25;
}
.collective-num { position: relative; font-family: var(--display); font-size: 3.4rem; font-weight: 700; color: #fff; line-height: 1; }
.collective-lbl { position: relative; font-size: .85rem; letter-spacing: .12em; text-transform: uppercase; color: #aebbe6; }

.lanterns { position: absolute; inset: 0; }
.lantern { position: absolute; transform: translate(-50%,-50%); text-align: center; animation: drift 8s ease-in-out infinite; will-change: transform; }
@keyframes drift { 0%,100% { margin-top: 0; } 50% { margin-top: -10px; } }
.lantern-orb {
  --work: 0; display: block; width: 26px; height: 26px; margin: 0 auto; border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #fff, #9aa3b7);
  box-shadow: 0 0 12px 2px rgba(154,163,183,.5); transition: all .8s ease;
}
.lantern-name { display: block; margin-top: .35rem; font-size: .72rem; color: #c6d0ee; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lantern.st-progress .lantern-orb {
  width: calc(26px + var(--work) * 14px); height: calc(26px + var(--work) * 14px);
  background: radial-gradient(circle at 50% 38%, #fff, #e9c46a);
  box-shadow: 0 0 calc(14px + var(--work) * 22px) calc(2px + var(--work) * 6px) rgba(233,196,106,.55);
}
.lantern.st-finished .lantern-orb {
  background: radial-gradient(circle at 50% 38%, #ffffff, #2e9e5b);
  box-shadow: 0 0 22px 6px rgba(46,158,91,.6);
}
.lantern.rising { animation: rise 2.4s ease-out forwards; }
@keyframes rise { to { margin-top: -36px; } }

.bcast-foot { display: flex; gap: 1.8rem; flex-wrap: wrap; justify-content: center; padding: .6rem 0 .2rem; border-top: 1px solid rgba(255,255,255,.08); }
.tally { display: flex; align-items: center; gap: .45rem; font-size: 1rem; color: #cdd8f5; }
.tally .tnum { font-family: var(--display); font-weight: 700; font-size: 1.25rem; color: #fff; }
.tally .light { box-shadow: none; }
.dot-ink { display: inline-block; width: 11px; height: 11px; border-radius: 50%; background: #7fe3e3; }

/* ---------- "View as student" ---------- */
:root { --pv-h: 44px; }
.preview-bar {
  position: sticky; top: 0; z-index: 60; min-height: var(--pv-h); display: flex; align-items: center; gap: .4rem 1rem;
  flex-wrap: wrap; padding: .4rem 1.25rem; background: #3b2a00; color: #ffe9b0; font-size: .84rem;
  background: repeating-linear-gradient(-45deg, #3d2c05, #3d2c05 14px, #45330a 14px, #45330a 28px);
  border-bottom: 2px solid var(--amber);
}
.preview-bar .pv-label { display: inline-flex; align-items: center; gap: .35rem; color: #ffd36b; text-transform: uppercase; letter-spacing: .06em; font-size: .74rem; }
.preview-bar .pv-text { flex: 1; min-width: 200px; }
.preview-bar .pv-text em { font-style: normal; font-weight: 600; color: #fff; }
.preview-bar .pv-actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.preview-bar form { display: inline; margin: 0; }
.pv-btn {
  display: inline-flex; align-items: center; gap: .3rem; font: 600 .78rem/1 var(--body); padding: .42rem .7rem; border-radius: 999px;
  border: 1px solid rgba(255, 211, 107, .45); background: transparent; color: #ffe9b0; cursor: pointer; text-decoration: none;
}
.pv-btn:hover { background: rgba(255, 211, 107, .14); color: #fff; text-decoration: none; }
.pv-btn.primary { background: #ffd36b; border-color: #ffd36b; color: #3b2a00; }
.pv-btn.primary:hover { background: #ffe39a; color: #3b2a00; }
.has-preview .ws { height: calc(100vh - var(--pv-h)); height: calc(100dvh - var(--pv-h)); }
.has-preview .topbar { top: var(--pv-h); }
@media (max-width: 720px) { .preview-bar .pv-text { display: none; } }

.preview-callout {
  display: flex; gap: .8rem; align-items: center; padding: .9rem 1rem; border-radius: 12px;
  background: var(--amber-soft); border: 1px solid #f1d58f; color: var(--amber-ink);
}
.preview-callout .pc-icon { width: 38px; height: 38px; flex: none; border-radius: 10px; display: grid; place-items: center; background: #fbe7b5; }
.preview-callout strong { color: var(--ink); }
@media (max-width: 560px) { .preview-callout { flex-wrap: wrap; } }

.ti-flags { display: inline-flex; gap: .3rem; flex-wrap: wrap; }
.vis-switch { display: inline-flex; align-items: center; gap: .45rem; margin: 0; }
.vis-pill {
  display: inline-flex; align-items: center; gap: .35rem; font: 600 .78rem/1 var(--body); padding: .45rem .75rem;
  border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card); color: var(--ink-soft); cursor: pointer;
}
.vis-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grey); }
.vis-pill.on { border-color: var(--green); color: var(--green-ink); background: var(--green-soft); }
.vis-pill.on .dot { background: var(--green); }
.vis-pill.off { border-color: #f1d58f; color: var(--amber-ink); background: var(--amber-soft); }
.vis-pill.off .dot { background: var(--amber); }
.vis-pill:hover { box-shadow: var(--ring); }
.class-link { padding: .45rem .5rem; margin: 0 -.5rem; border-radius: 10px; color: inherit; text-decoration: none; }
.class-link:hover { background: var(--surface); text-decoration: none; }
.class-link > svg { color: var(--faint); }

/* ==========================================================================
   Class outline (LMS course page) · activity types · dialogs · settings
   ========================================================================== */
.tone-teal   { --tone: var(--signal);  --tone-soft: var(--signal-soft); --tone-ink: var(--signal-ink); }
.tone-violet { --tone: var(--violet);  --tone-soft: var(--violet-soft); --tone-ink: #4c3cad; }
.tone-blue   { --tone: #2f6fbd;        --tone-soft: var(--blue-soft);   --tone-ink: var(--blue-ink); }
.tone-amber  { --tone: var(--amber);   --tone-soft: var(--amber-soft);  --tone-ink: var(--amber-ink); }
.tone-green  { --tone: var(--green);   --tone-soft: var(--green-soft);  --tone-ink: var(--green-ink); }
.tone-ink    { --tone: var(--ink-soft); --tone-soft: var(--surface-2);  --tone-ink: var(--ink); }
.tone-rose   { --tone: #c2416b;        --tone-soft: #fcebf1;           --tone-ink: #8a2148; }

.outline { display: flex; flex-direction: column; gap: 1rem; }
.ol-toolbar { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }
.ol-section {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm); transition: border-color .15s, box-shadow .15s, opacity .15s;
}
.ol-section.ol-general { background: linear-gradient(180deg, #fbfdfd, var(--card)); }
.ol-section.is-hidden { border-style: dashed; }
.ol-section.is-hidden > .ol-list, .ol-section.is-hidden > .ol-section-head .ol-section-title { opacity: .62; }
.ol-section.is-dragging { opacity: .4; }
.ol-section-head { display: flex; align-items: flex-start; gap: .65rem; padding: .95rem 1rem .4rem; }
.ol-section-title { flex: 1; min-width: 0; }
.ol-section-title h2 { margin: 0; font-size: 1.08rem; }
.ol-summary { margin: .35rem 0 0; max-width: 70ch; }
.ol-section-edit { margin: 0 1rem .6rem; padding: .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.ol-section-foot { padding: .2rem .6rem .6rem; }
.ol-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .75rem; font-size: .78rem; color: var(--muted); margin-top: .15rem; }
.ol-list, .ol-children { display: flex; flex-direction: column; gap: .4rem; padding: .25rem .75rem .5rem; min-height: 8px; }
.ol-children { margin: .35rem 0 .1rem 1.4rem; padding: .45rem .5rem; border-left: 2px solid var(--line); background: var(--surface); border-radius: 0 10px 10px 0; }
.ol-empty-drop { display: none; margin: 0; font-size: .82rem; color: var(--faint); text-align: center; padding: .8rem; border: 1.5px dashed var(--line-strong); border-radius: 10px; }
.is-empty > .ol-empty-drop { display: block; }

.ol-item {
  display: flex; align-items: center; gap: .65rem; padding: .6rem .65rem; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; transition: box-shadow .15s, border-color .15s, background .3s;
}
.ol-item:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.ol-item.is-dragging { opacity: .35; }
.ol-item.just-moved { animation: ol-moved 1s ease; }
@keyframes ol-moved { 0% { background: var(--signal-soft); border-color: var(--signal-line); } 100% { background: var(--card); } }
.ol-assignment { flex-direction: column; align-items: stretch; gap: 0; padding: .55rem .65rem; background: #fcfcfe; }
.ol-assignment.is-hidden { border-style: dashed; }
.ol-assignment-head { display: flex; align-items: center; gap: .65rem; }
.ol-grip { color: var(--faint); cursor: grab; display: inline-grid; place-items: center; padding: .2rem 0; touch-action: none; }
.ol-grip:hover { color: var(--ink-soft); }
.ol-grip:active { cursor: grabbing; }
.ol-kind {
  width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center; flex: 0 0 auto;
  background: var(--tone-soft, var(--surface-2)); color: var(--tone, var(--ink-soft));
}
.ol-main { flex: 1; min-width: 0; }
.ol-title { font-weight: 650; color: var(--ink); display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ol-progress { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; width: 92px; text-decoration: none !important; }
.ol-progress .progress { width: 100%; }
.ol-placeholder { border: 2px dashed var(--signal-line); background: var(--signal-soft); border-radius: 12px; min-height: 44px; }
.ol-placeholder.is-section { border-radius: var(--r-lg); }

/* Visibility switch (pill with track) */
.ol-switch {
  display: inline-flex; align-items: center; gap: .4rem; background: none; border: none; cursor: pointer;
  padding: .25rem .1rem; font: 600 .74rem var(--body); color: var(--muted); flex: 0 0 auto;
}
.ol-switch .track {
  width: 32px; height: 18px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .2s;
}
.ol-switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s;
}
.ol-switch[aria-checked="true"] .track { background: var(--green); }
.ol-switch[aria-checked="true"] .track::after { transform: translateX(14px); }
.ol-switch .lbl { min-width: 46px; text-align: left; }
.ol-switch[aria-checked="true"] .lbl.off, .ol-switch[aria-checked="false"] .lbl.on { display: none; }
.ol-switch[aria-checked="true"] { color: var(--green-ink); }
.ol-switch:disabled { opacity: .6; cursor: progress; }

/* Dropdown menus (<details class="menu">) */
details.menu { position: relative; flex: 0 0 auto; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; min-width: 200px; padding: .3rem;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
}
.menu-pop a, .menu-pop button {
  display: flex; align-items: center; gap: .55rem; width: 100%; padding: .5rem .6rem; border: none; background: none;
  border-radius: 8px; font: 550 .86rem var(--body); color: var(--ink); text-align: left; cursor: pointer;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--surface-2); text-decoration: none; }
.menu-pop .danger { color: var(--red-ink); }
.menu-pop form { margin: 0; }

.ol-toast {
  position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 90;
  background: var(--ink); color: #fff; padding: .55rem 1rem; border-radius: 999px; font-size: .86rem; font-weight: 600;
  box-shadow: var(--shadow-lg); animation: toast-in .2s ease;
}
.ol-toast.error { background: var(--red); }
.ol-toast.warn { background: var(--amber-ink); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

/* Wide modal dialogs (add activity, move to) */
dialog.modal.wide { width: min(760px, calc(100vw - 2rem)); }
.move-targets { display: flex; flex-direction: column; gap: .35rem; }
.move-target {
  text-align: left; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  font: 600 .9rem var(--body); cursor: pointer; color: var(--ink);
}
.move-target:hover { border-color: var(--signal-line); background: var(--signal-soft); }
.move-target.is-assignment { margin-left: 1.25rem; font-weight: 550; }
.move-target.is-current { border-color: var(--signal); }

/* Activity type cards (Add activity dialog, Settings → Activity types) */
.kind-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .7rem; }
.kind-card {
  position: relative; display: flex; gap: .75rem; align-items: flex-start; padding: .9rem; border-radius: 14px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
a.kind-card:hover { text-decoration: none; border-color: var(--tone); box-shadow: var(--shadow); transform: translateY(-1px); }
.kind-card .kind-icon, .kind-icon {
  width: 42px; height: 42px; border-radius: 12px; display: inline-grid; place-items: center; flex: 0 0 auto;
  background: var(--tone-soft, var(--surface-2)); color: var(--tone, var(--ink-soft));
}
.kind-icon.small { width: 36px; height: 36px; }
.kind-body { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.kind-title { font-weight: 700; }
.kind-desc { font-size: .8rem; color: var(--muted); line-height: 1.4; }
label.kind-card input { position: absolute; opacity: 0; pointer-events: none; }
label.kind-card .kind-check {
  position: absolute; top: .6rem; right: .6rem; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; border: 1.5px solid var(--line-strong); color: transparent;
}
label.kind-card:has(input:checked) { border-color: var(--tone); box-shadow: 0 0 0 3px var(--tone-soft); }
label.kind-card:has(input:checked) .kind-check { background: var(--tone); border-color: var(--tone); color: #fff; }
label.kind-card:has(input:not(:checked)) { opacity: .7; }
.import-row {
  display: flex; align-items: center; gap: .75rem; margin-top: .9rem; padding: .8rem .9rem;
  border: 1.5px dashed var(--line-strong); border-radius: 14px; background: var(--surface);
}
.kind-badge { display: inline-flex; align-items: center; gap: .3rem; font: 650 .72rem var(--body); padding: .28rem .55rem; border-radius: 999px; background: var(--tone-soft); color: var(--tone-ink); }

/* Settings */
.settings-card { max-width: 720px; }
.role-select { width: auto; padding: .3rem 1.8rem .3rem .55rem; font-size: .84rem; font-weight: 600; }
.role-select.role-admin { color: #4c3cad; }
.role-select.role-teacher { color: var(--signal-ink); }
.role-legend { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .55rem; font-size: .85rem; color: var(--ink-2); }
.role-legend .badge { margin-right: .3rem; }
tr.row-muted td { opacity: .55; }

/* Student class page: modules */
.st-section { margin-bottom: 1.25rem; }
.st-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; margin: 0 0 .5rem; flex-wrap: wrap; }
.st-section-head h2 { margin: 0; font-size: 1.05rem; }
.st-assignment { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin: .2rem 0; overflow: hidden; }
.st-assignment-head { display: flex; align-items: center; gap: .75rem; padding: .8rem 1rem; background: #fbfcfe; border-bottom: 1px solid var(--line); }
.st-assignment-head .progress { width: 110px; }

@media (max-width: 720px) {
  .ol-progress { display: none; }
  .ol-switch .lbl { display: none !important; }
  .ol-children { margin-left: .4rem; }
}

/* AutograderAI questions editor */
.pe-problem { border: 1px solid var(--line); border-radius: 14px; padding: .9rem; margin-top: .8rem; background: #fcfdfe; }
.pe-head { display: flex; align-items: center; gap: .5rem; }
.pe-n { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--blue-soft); color: var(--blue-ink); font: 700 .85rem var(--mono); flex: 0 0 auto; }
.pe-title { flex: 1; font-weight: 650; }
.pe-lang { width: auto; }
.pe-label-row { display: flex; align-items: center; justify-content: space-between; margin-top: .8rem; }
.pe-label-row label { margin: 0; }
.pe-preview { border: 1px solid var(--line); border-radius: 10px; padding: .7rem .9rem; background: #fff; min-height: 80px; }
.pe-code, .pe-io textarea { font: 500 .84rem/1.5 var(--mono); }
.pe-code { background: var(--ide-bg); color: var(--ide-text); border-color: var(--ide-line); }
.pe-tests { display: flex; flex-direction: column; gap: .5rem; margin-top: .4rem; }
.pe-test { border: 1px solid var(--line); border-radius: 10px; padding: .55rem .65rem; background: #fff; }
.pe-test.is-hidden { background: repeating-linear-gradient(135deg, #fff, #fff 8px, #f7f8fb 8px, #f7f8fb 16px); }
.pe-test-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.pe-test-n { font: 700 .78rem var(--mono); color: var(--muted); }
.pe-test-name { flex: 1; min-width: 140px; padding: .35rem .55rem; font-size: .85rem; }
.pe-check { display: inline-flex; align-items: center; gap: .3rem; margin: 0; font-size: .8rem; font-weight: 600; color: var(--ink-2); }
.pe-points { width: 64px; padding: .3rem .4rem; }
.pe-io { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .45rem; }
.pe-io-label { display: block; font: 650 .72rem var(--body); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .2rem; }
.pe-empty { margin: .3rem 0 0; }
@media (max-width: 640px) { .pe-io { grid-template-columns: 1fr; } }

/* Activity editor assistant pane */
.as-pane {
  position: fixed; top: var(--topbar-h); right: 0; bottom: 0; z-index: 35; width: 400px; max-width: 100vw;
  display: flex; flex-direction: column; background: var(--card); border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgba(28, 37, 65, .08); animation: as-in .25s ease;
}
@keyframes as-in { from { transform: translateX(24px); opacity: 0; } }
.as-pane[hidden] { display: none !important; }
@media (min-width: 1280px) {
  body.has-assistant.assistant-open main.wrap { margin-right: 400px; margin-left: max(0px, calc((100vw - 400px - 1180px) / 2)); }
  body.has-assistant.assistant-open .as-fab { display: none; }
}
.as-head { display: flex; align-items: center; gap: .65rem; padding: .85rem 1rem; border-bottom: 1px solid var(--line); background: linear-gradient(135deg, #f3fbfb, #f6f4ff); }
.as-logo {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, var(--signal), var(--violet)); box-shadow: 0 4px 12px rgba(11, 138, 138, .25);
}
.as-pane.is-busy .as-logo { animation: as-pulse 1.2s ease-in-out infinite; }
@keyframes as-pulse { 50% { transform: scale(.92) rotate(-8deg); box-shadow: 0 2px 18px rgba(109, 91, 208, .45); } }
.as-sub { display: block; font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#as-sound[aria-pressed="true"] .as-sound-off, #as-sound[aria-pressed="false"] .as-sound-on { display: none; }
.as-body { flex: 1; overflow-y: auto; padding: .9rem 1rem 1rem; display: flex; flex-direction: column; gap: 1rem; scroll-behavior: smooth; }
.as-section-title { display: flex; justify-content: space-between; align-items: center; font: 700 .72rem var(--body); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: .45rem; }
.as-section-title > span { display: inline-flex; align-items: center; gap: .35rem; }
.as-score { text-transform: none; letter-spacing: 0; font-weight: 650; font-size: .74rem; }
.as-score.bad { color: var(--red-ink); } .as-score.mid { color: var(--amber-ink); } .as-score.good { color: var(--green-ink); }
.as-issues { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .35rem; }
.as-issue { font-size: .82rem; line-height: 1.4; padding: .5rem .6rem .5rem .75rem; border-radius: 10px; border-left: 3px solid; display: flex; flex-direction: column; gap: .35rem; }
.as-issue.error { background: var(--red-soft); border-color: var(--red); color: var(--red-ink); }
.as-issue.warn { background: var(--amber-soft); border-color: var(--amber); color: var(--amber-ink); }
.as-issue.info { background: var(--blue-soft); border-color: #7fa6d6; color: var(--blue-ink); }
.as-issue-actions { display: flex; gap: .4rem; justify-content: flex-end; }
.as-ok { font-size: .82rem; color: var(--green-ink); background: var(--green-soft); padding: .5rem .7rem; border-radius: 10px; }
.as-link, .as-fix { border: none; cursor: pointer; font: 650 .76rem var(--body); border-radius: 7px; padding: .25rem .55rem; }
.as-link { background: transparent; color: inherit; text-decoration: underline; }
.as-fix { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.as-fix:hover { background: var(--signal); color: #fff; }
.as-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.as-chip {
  display: inline-flex; align-items: center; gap: .35rem; border: 1px solid var(--line-strong); background: #fff;
  border-radius: 999px; padding: .38rem .7rem; font: 600 .8rem var(--body); color: var(--ink-soft); cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
}
.as-chip:hover { border-color: var(--signal-line); background: var(--signal-soft); color: var(--signal-ink); }
.as-chip:active { transform: scale(.97); }
.as-pane.is-busy .as-chip { opacity: .55; pointer-events: none; }
.as-log { display: flex; flex-direction: column; gap: .6rem; }
.as-msg { font-size: .87rem; line-height: 1.5; padding: .65rem .8rem; border-radius: 14px; max-width: 100%; animation: as-msg-in .2s ease; }
@keyframes as-msg-in { from { opacity: 0; transform: translateY(4px); } }
.as-msg.bot { background: var(--surface); border: 1px solid var(--line); border-top-left-radius: 4px; }
.as-msg.me { background: var(--signal); color: #fff; align-self: flex-end; border-top-right-radius: 4px; max-width: 88%; }
.as-msg.error { background: var(--red-soft); color: var(--red-ink); border-color: #f3cfc9; }
.as-msg p { margin: 0 0 .4rem; } .as-msg p:last-child { margin: 0; }
.as-dots { display: inline-flex; gap: 4px; padding: .2rem 0; }
.as-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--violet); animation: as-dot 1s ease-in-out infinite; }
.as-dots span:nth-child(2) { animation-delay: .15s; background: var(--signal); }
.as-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes as-dot { 50% { transform: translateY(-4px); opacity: .5; } }
.as-finding { font-size: .8rem; margin-top: .45rem; padding: .4rem .55rem; border-radius: 8px; background: #fff; border-left: 3px solid var(--amber); }
.as-finding.error { border-color: var(--red); } .as-finding.info { border-color: #7fa6d6; }
.as-sugg { margin-top: .6rem; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .6rem .7rem; transition: opacity .2s, border-color .2s; }
.as-sugg.applied { border-color: var(--green); background: #fbfefc; }
.as-sugg.dismissed { opacity: .4; }
.as-sugg-head { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.as-sugg-field { font: 700 .66rem var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--violet); background: var(--violet-soft); padding: .15rem .45rem; border-radius: 999px; }
.as-why { font-size: .78rem; color: var(--muted); margin: .3rem 0 0; }
.as-preview { font-size: .8rem; white-space: pre-wrap; background: var(--surface); border-radius: 8px; padding: .5rem .6rem; margin-top: .45rem; color: var(--ink-2); max-height: 7.5em; overflow: hidden; position: relative; }
.as-preview.is-long::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2em; background: linear-gradient(transparent, var(--surface)); }
.as-preview.expanded { max-height: none; }
.as-preview.expanded::after { display: none; }
.as-sugg-actions { display: flex; gap: .35rem; margin-top: .5rem; }
.as-input { display: flex; gap: .5rem; padding: .7rem .8rem; border-top: 1px solid var(--line); background: #fbfcfe; }
.as-input textarea { flex: 1; resize: none; font-size: .87rem; min-height: 42px; }
.as-input .btn { align-self: flex-end; padding: .6rem .75rem; }
.as-fab {
  position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 34; width: 52px; height: 52px; border-radius: 50%; border: none;
  display: grid; place-items: center; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, var(--signal), var(--violet)); box-shadow: 0 8px 24px rgba(11, 138, 138, .35);
  transition: transform .15s;
}
.as-fab:hover { transform: scale(1.06) rotate(-6deg); }
body.assistant-open .as-fab { display: none; }
.as-fab-dot { position: absolute; top: 6px; right: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--red); border: 2px solid #fff; }
.as-flash { animation: as-flash 1.4s ease; border-radius: 10px; }
@keyframes as-flash { 0%, 40% { box-shadow: 0 0 0 3px rgba(109, 91, 208, .45); background-color: rgba(109, 91, 208, .06); } 100% { box-shadow: 0 0 0 0 rgba(109, 91, 208, 0); } }
@media (max-width: 640px) { .as-pane { width: 100vw; } }

/* AutograderAI workspace */
.cr-main { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(320px, 40%) 1fr; }
.cr-left { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--card); }
.cr-right { display: flex; flex-direction: column; min-height: 0; background: var(--ide-bg); color: var(--ide-text); }
.cr-score { display: flex; flex-direction: column; align-items: flex-end; margin-left: auto; line-height: 1.1; }
.cr-score-lbl { font-size: .68rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.cr-score-val { font: 750 1.05rem var(--mono); color: var(--ink); }
.cr-qtabs { display: flex; gap: .3rem; padding: .6rem .7rem; overflow-x: auto; border-bottom: 1px solid var(--line); background: var(--surface); flex: 0 0 auto; }
.cr-qtab { display: inline-flex; align-items: center; gap: .45rem; padding: .35rem .65rem .35rem .4rem; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; font: 600 .82rem var(--body); color: var(--ink-soft); white-space: nowrap; max-width: 220px; }
.cr-qtab.active { border-color: var(--signal); box-shadow: var(--ring); color: var(--ink); }
.cr-qtitle { overflow: hidden; text-overflow: ellipsis; }
.cr-qn { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; font: 700 .74rem var(--mono); background: var(--surface-2); color: var(--ink-soft); flex: 0 0 auto; }
.cr-qn.full { background: var(--green); color: #fff; }
.cr-qn.part { background: var(--amber); color: #fff; }
.cr-qn.zero { background: var(--red); color: #fff; }
.cr-qscore { font: 600 .72rem var(--mono); color: var(--muted); }
.cr-lefttabs { display: flex; gap: .2rem; padding: 0 .7rem; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.cr-lefttabs button { border: none; background: none; padding: .6rem .7rem; font: 600 .84rem var(--body); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: .35rem; }
.cr-lefttabs button[aria-selected="true"] { color: var(--signal-ink); border-bottom-color: var(--signal); }
.cr-lefttabs .count { font-size: .7rem; background: var(--violet-soft); color: #4c3cad; padding: .05rem .4rem; border-radius: 999px; }
.cr-pane { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 1rem 1.15rem 1.5rem; }
.cr-ptitle { font-size: 1.2rem; margin: 0 0 .6rem; }
.cr-pbody { font-size: .93rem; line-height: 1.6; }
.cr-pmeta { font-size: .78rem; color: var(--muted); margin: .8rem 0 0; }
.cr-examples { display: flex; flex-direction: column; gap: .6rem; margin-top: 1rem; }
.cr-example { border: 1px solid var(--line); border-radius: 12px; padding: .6rem .7rem; background: var(--surface); }
.cr-example-head { display: flex; justify-content: space-between; align-items: center; font-size: .85rem; margin-bottom: .35rem; }
.cr-io { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.cr-io.three { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: .5rem; }
.cr-io pre, .cr-console pre { margin: 0; padding: .45rem .55rem; border-radius: 8px; font: 500 .8rem/1.45 var(--mono); white-space: pre-wrap; word-break: break-word; max-height: 200px; overflow: auto; }
.cr-example pre { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.cr-io-lbl { display: block; font: 650 .68rem var(--body); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: .2rem; }
.cr-helper { display: flex; flex-direction: column; padding: 0; }
.cr-helper-thread { flex: 1 1 auto; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .55rem; }
.cr-help-intro { display: flex; gap: .5rem; font-size: .84rem; color: var(--ink-2); background: var(--violet-soft); border-radius: 12px; padding: .65rem .75rem; }
.cr-help-msg { font-size: .88rem; line-height: 1.5; padding: .6rem .75rem; border-radius: 14px; max-width: 92%; }
.cr-help-msg.bot { background: var(--surface); border: 1px solid var(--line); border-top-left-radius: 4px; }
.cr-help-msg.me { background: var(--signal); color: #fff; align-self: flex-end; border-top-right-radius: 4px; }
.cr-help-msg.thinking { color: var(--muted); animation: pulse-text 1.2s ease-in-out infinite; }
.cr-help-msg.error { background: var(--red-soft); color: var(--red-ink); }
@keyframes pulse-text { 50% { opacity: .4; } }
.cr-helper-input { display: flex; gap: .5rem; padding: .6rem .7rem; border-top: 1px solid var(--line); }
.cr-helper-input textarea { flex: 1; resize: none; font-size: .87rem; }
.cr-helper-input .btn { align-self: flex-end; }
.cr-bar { display: flex; align-items: center; gap: .5rem; padding: .5rem .7rem; border-bottom: 1px solid var(--ide-line); background: var(--ide-panel); flex: 0 0 auto; }
.cr-lang { font: 600 .74rem var(--mono); color: var(--mint); background: rgba(127,227,227,.1); padding: .2rem .5rem; border-radius: 6px; }
.cr-saved { font-size: .72rem; color: var(--ide-muted); }
.cr-dark { color: var(--ide-muted) !important; }
.cr-dark:hover { background: rgba(255,255,255,.06) !important; color: #fff !important; }
.cr-run { background: #2b3a63; }
.cr-run:hover { background: #374a7c; }
.cr-submit { background: var(--green); }
.cr-submit:hover { background: #26854c; }
.cr-bar .btn.is-busy { opacity: .7; pointer-events: none; }
.cr-bar .btn.is-busy svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.cr-submit.celebrate { animation: celebrate .9s ease; }
@keyframes celebrate { 30% { transform: scale(1.12); box-shadow: 0 0 0 8px rgba(46,158,91,.25); } }
.cr-editor { flex: 1 1 60%; min-height: 180px; overflow: hidden; }
.cr-editor > .cm-editor { height: 100%; }
.cr-fallback { width: 100%; height: 100%; background: var(--ide-bg); color: var(--ide-text); border: none; font: 500 .9rem/1.6 var(--mono); padding: 12px; resize: none; }
.cr-console { flex: 0 0 38%; min-height: 140px; display: flex; flex-direction: column; border-top: 1px solid var(--ide-line); background: var(--ide-panel); }
.cr-console-tabs { display: flex; gap: .15rem; padding: 0 .6rem; border-bottom: 1px solid var(--ide-line); flex: 0 0 auto; }
.cr-console-tabs button { border: none; background: none; padding: .5rem .65rem; font: 600 .8rem var(--body); color: var(--ide-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.cr-console-tabs button[aria-selected="true"] { color: #fff; border-bottom-color: var(--mint); }
.cr-console-tabs .count { font: 600 .7rem var(--mono); color: var(--mint); margin-left: .2rem; }
.cr-console-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: .6rem .75rem; }
.cr-hint { color: var(--ide-muted); font-size: .84rem; margin: .3rem 0; }
.cr-stdin { width: 100%; height: 100%; min-height: 100px; background: var(--ide-bg); color: var(--ide-text); border: 1px solid var(--ide-line); border-radius: 8px; font: 500 .84rem/1.5 var(--mono); resize: none; }
.cr-console pre { background: var(--ide-bg); color: #d9e2ff; border: 1px solid var(--ide-line); }
.cr-console pre.cr-stderr { color: #ff9d8f; }
.cr-run-head { font: 650 .8rem var(--body); margin: 0 0 .4rem; color: var(--mint); }
.cr-run-head.timeout, .cr-run-head.flood, .cr-run-head.failed { color: #ffcb6b; }
.cr-summary { font: 700 .86rem var(--body); padding: .5rem .7rem; border-radius: 8px; margin-bottom: .5rem; }
.cr-summary.full { background: rgba(46,158,91,.2); color: #8ef0b4; }
.cr-summary.part { background: rgba(217,145,0,.18); color: #ffd27a; }
.cr-summary.zero { background: rgba(209,69,59,.2); color: #ffb0a6; }
.cr-summary.pending { background: rgba(255,255,255,.06); color: var(--ide-muted); }
.cr-test { border: 1px solid var(--ide-line); border-radius: 8px; margin-bottom: .35rem; padding: .1rem .55rem; }
.cr-test summary { display: flex; align-items: center; gap: .55rem; cursor: pointer; padding: .35rem 0; font-size: .84rem; list-style: none; }
.cr-test summary::-webkit-details-marker { display: none; }
.cr-test-icon { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-weight: 800; font-size: .78rem; background: rgba(255,255,255,.08); }
.cr-test.passed .cr-test-icon { background: var(--green); color: #fff; }
.cr-test.failed .cr-test-icon, .cr-test.timeout .cr-test-icon, .cr-test.flood .cr-test-icon { background: var(--red); color: #fff; }
.cr-test.queued .cr-test-icon, .cr-test.running .cr-test-icon { animation: pulse-text 1s ease-in-out infinite; }
.cr-test-name { flex: 1; }
.cr-test-verdict { font-size: .74rem; color: var(--ide-muted); }
.cr-test .cr-io-lbl { color: var(--ide-muted); }
.cr-test > .cr-io, .cr-test > pre { margin-bottom: .5rem; }
@media (max-width: 860px) {
  .cr-main { grid-template-columns: 1fr; grid-template-rows: 45% 55%; }
  .cr-left { border-right: none; border-bottom: 1px solid var(--line); }
  .cr-io.three { grid-template-columns: 1fr; }
  .cr-score-lbl { display: none; }
}

/* External activities: screenshot proof · Group activities */
.composer-attach {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line-strong); background: #fff;
  color: var(--amber-ink); cursor: pointer; display: grid; place-items: center; margin-left: -.55rem; align-self: flex-end;
}
.composer-attach:hover { background: var(--amber-soft); border-color: var(--amber); }
.proof-img { display: block; max-width: min(360px, 100%); max-height: 300px; border-radius: 10px; cursor: zoom-in; margin-bottom: .35rem; background: #fff; }
.msg.user.other { align-self: flex-start; justify-content: flex-start; }
.msg.user.other .msg-meta { justify-content: flex-start; }
.msg.user.other .bubble.user { background: var(--violet-soft); color: var(--ink); border-top-left-radius: 6px; border-top-right-radius: 16px; }
.group-bar {
  display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; padding: .45rem 1.1rem; font-size: .84rem;
  background: linear-gradient(90deg, var(--green-soft), #fff); border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.group-name { display: inline-flex; align-items: center; gap: .35rem; color: var(--green-ink); }
.group-count { font: 600 .74rem var(--mono); color: var(--muted); }
.group-members { display: flex; gap: .3rem; flex-wrap: wrap; flex: 1; }
.member-chip { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: .12rem .55rem; font-size: .78rem; font-weight: 600; color: var(--ink-soft); }
.member-chip.me { border-color: var(--green); color: var(--green-ink); }
.group-code { font-size: .78rem; color: var(--muted); }
.group-code code { font: 700 .86rem var(--mono); color: var(--ink); background: #fff; padding: .1rem .4rem; border-radius: 6px; border: 1px dashed var(--line-strong); letter-spacing: .08em; }
.cr-review { padding: .8rem 0; border-top: 1px solid var(--line); }
.cr-review:first-of-type { border-top: none; }
.gradebook .gb-assignment { background: #f7f6ff; }

/* Rich text: tables and math */
.rich .table-scroll { overflow-x: auto; margin: .5rem 0 .8rem; }
.rich table.md-table { width: auto; min-width: 50%; font-size: .9em; border: 1px solid var(--line); border-radius: 8px; border-collapse: separate; border-spacing: 0; overflow: hidden; }
.rich table.md-table th, .rich table.md-table td { padding: .4rem .7rem; border-bottom: 1px solid var(--line); text-transform: none; letter-spacing: 0; font-size: inherit; }
.rich table.md-table th { background: var(--surface); color: var(--ink); font-weight: 650; }
.rich table.md-table tr:last-child td { border-bottom: none; }
.rich .math-block { margin: .6rem 0 .9rem; overflow-x: auto; overflow-y: hidden; padding: .2rem 0; }
.rich .katex { font-size: 1.08em; }
.rich code.math-src { font-family: var(--mono); }
.bubble.user .rich .katex, .msg.user .katex { color: inherit; }
.cr-loading { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .9rem; padding: 1rem 0; }
