/* ==========================================================================
   Learning — by Akshay Kotish
   Soft-clay interface.

   The whole surface is one continuous piece of clay. Nothing has a hard border;
   depth comes from a matched pair of shadows — a dark one down-right and a light
   one up-left — so elements read as pressed out of the background or pushed
   into it. Radii are large and soft, the palette is warm and low-contrast.

   Three depths, used consistently:
     .clay        raised — cards, buttons, anything you can act on
     .clay-in     pressed — inputs, wells, anything that receives content
     .clay-flat   barely there — quiet grouping

   The compiler is the deliberate exception: it stays a pure black-and-white
   terminal, set into a clay bezel. See the bottom of this file.
   ========================================================================== */

:root {
  /* Sky clay, light.
     The neutrals carry the blue, not just the accent — a sky-blue button on a
     warm tan surface is two temperatures arguing. Everything is tinted from the
     same hue so the whole surface reads as one material. */
  --bg:        #dce5ef;
  --surface:   #e4ecf5;
  --raised:    #ebf2fa;
  --sunken:    #ccd9e7;

  --text:      #2c3b4a;
  --muted:     #63788d;
  --faint:     #8da2b7;

  --accent:      #2589d1;
  --accent-soft: #53a6e2;
  --accent-ink:  #ffffff;
  --accent-wash: rgba(37, 137, 209, .14);

  --ok:        #2f8f6b;
  --ok-wash:   rgba(47, 143, 107, .16);
  --warn:      #b8862f;
  --warn-wash: rgba(184, 134, 47, .16);
  --err:       #c0544a;
  --err-wash:  rgba(192, 84, 74, .14);

  /* The two lights that make clay look like clay */
  --dark:  rgba(139, 158, 179, .55);
  --light: rgba(252, 254, 255, .95);

  --r-sm: 12px;
  --r:    18px;
  --r-lg: 26px;
  --r-xl: 34px;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --header-h:  68px;
}

:root[data-theme="dark"] {
  --bg:        #1e2732;
  --surface:   #25303b;
  --raised:    #2b3744;
  --sunken:    #182028;

  --text:      #dde8f2;
  --muted:     #95a8ba;
  --faint:     #6c7e90;

  --accent:      #56b6f0;
  --accent-soft: #85cbf6;
  --accent-ink:  #10202b;
  --accent-wash: rgba(86, 182, 240, .16);

  --ok:        #5fc79a;
  --ok-wash:   rgba(95, 199, 154, .16);
  --warn:      #e0b055;
  --warn-wash: rgba(224, 176, 85, .16);
  --err:       #ec8175;
  --err-wash:  rgba(236, 129, 117, .16);

  --dark:  rgba(6, 10, 14, .62);
  --light: rgba(64, 80, 96, .48);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--dark); border-radius: 8px;
  border: 4px solid transparent; background-clip: content-box;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

/* ---------- the three clay depths ---------- */

.clay {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: 6px 6px 14px var(--dark), -6px -6px 14px var(--light);
}
.clay-in {
  background: var(--sunken);
  border-radius: var(--r);
  box-shadow: inset 4px 4px 9px var(--dark), inset -4px -4px 9px var(--light);
}
.clay-flat {
  background: var(--surface);
  border-radius: var(--r);
  box-shadow: 3px 3px 7px var(--dark), -3px -3px 7px var(--light);
}

/* ---------- Boot ---------- */

.boot {
  height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 22px; color: var(--muted);
}
.boot-mark {
  width: 74px; height: 74px; border-radius: 24px;
  background: var(--surface); color: var(--accent);
  display: grid; place-items: center; font-size: 34px; font-weight: 800;
  box-shadow: 8px 8px 18px var(--dark), -8px -8px 18px var(--light);
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(.93); }
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--r);
  background: var(--surface); color: var(--text);
  font-size: 14.5px; font-weight: 600; white-space: nowrap;
  box-shadow: 4px 4px 10px var(--dark), -4px -4px 10px var(--light);
  transition: box-shadow .16s, transform .12s, color .16s, background .16s;
}
.btn:hover:not(:disabled) {
  box-shadow: 5px 5px 12px var(--dark), -5px -5px 12px var(--light);
  transform: translateY(-1px);
}
.btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: inset 4px 4px 9px var(--dark), inset -4px -4px 9px var(--light);
}
.btn:disabled {
  opacity: .5; cursor: not-allowed;
  box-shadow: inset 2px 2px 6px var(--dark), inset -2px -2px 6px var(--light);
}

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-soft); }
.btn-primary:disabled { background: var(--surface); color: var(--faint); }

.btn-ok { background: var(--ok); color: #fff; }
.btn-danger { background: var(--err); color: #fff; }

.btn-ghost { background: transparent; box-shadow: none; color: var(--muted); }
.btn-ghost:hover:not(:disabled) {
  background: var(--surface); color: var(--text);
  box-shadow: 3px 3px 8px var(--dark), -3px -3px 8px var(--light);
}

.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: var(--r-sm); }
.btn-lg { padding: 14px 30px; font-size: 16px; border-radius: var(--r); }
.btn-block { width: 100%; }

.btn-round {
  width: 42px; height: 42px; padding: 0; border-radius: 50%;
  display: grid; place-items: center;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); padding-left: 4px; }

.input, .select, .textarea {
  padding: 13px 17px; width: 100%;
  background: var(--sunken); color: var(--text);
  border: none; border-radius: var(--r);
  box-shadow: inset 4px 4px 9px var(--dark), inset -4px -4px 9px var(--light);
  transition: box-shadow .16s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  box-shadow: inset 5px 5px 11px var(--dark), inset -5px -5px 11px var(--light),
              0 0 0 2px var(--accent-wash);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.textarea { resize: vertical; min-height: 86px; font-family: inherit; }

/* ==========================================================================
   Login
   ========================================================================== */

.login-page { height: 100vh; display: grid; place-items: center; overflow: auto; padding: 30px; }
.login-shell {
  width: 100%; max-width: 940px; display: grid; grid-template-columns: 1.05fr .95fr;
  background: var(--surface); border-radius: var(--r-xl); overflow: hidden;
  box-shadow: 14px 14px 34px var(--dark), -14px -14px 34px var(--light);
}

.login-hero { padding: 52px 46px; background: var(--bg); }
.login-hero .mark {
  width: 62px; height: 62px; border-radius: 20px; margin-bottom: 26px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 29px; font-weight: 800;
  box-shadow: 6px 6px 14px var(--dark), -6px -6px 14px var(--light);
}
.login-hero h1 { font-size: 35px; line-height: 1.14; letter-spacing: -.025em; margin-bottom: 8px; }
.login-hero .byline { color: var(--accent); font-weight: 700; margin-bottom: 24px; }
.login-hero p.lede { color: var(--muted); font-size: 16px; margin-bottom: 30px; }

.hero-stats { display: flex; gap: 14px; margin-bottom: 28px; }
.hero-stat {
  flex: 1; padding: 14px 12px; text-align: center;
  background: var(--surface); border-radius: var(--r);
  box-shadow: 4px 4px 10px var(--dark), -4px -4px 10px var(--light);
}
.hero-stat strong { display: block; font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.hero-stat span { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }

.hero-list { display: flex; flex-direction: column; gap: 12px; }
.hero-list li { list-style: none; display: flex; gap: 12px; align-items: flex-start; color: var(--muted); font-size: 14.5px; }
.hero-list li .tick {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0; margin-top: 1px;
  background: var(--surface); color: var(--ok);
  display: grid; place-items: center; font-size: 11px; font-weight: 800;
  box-shadow: 2px 2px 5px var(--dark), -2px -2px 5px var(--light);
}

.login-panel { padding: 52px 46px; display: flex; flex-direction: column; justify-content: center; }
.login-panel h2 { font-size: 26px; margin-bottom: 6px; letter-spacing: -.02em; }
.login-panel .sub { color: var(--muted); margin-bottom: 28px; }

.login-error {
  background: var(--err-wash); color: var(--err); border-radius: var(--r);
  padding: 12px 16px; margin-bottom: 16px; font-size: 14px; font-weight: 600;
}
.login-hint {
  margin-top: 24px; padding: 16px 18px; border-radius: var(--r);
  background: var(--sunken); font-size: 13px; color: var(--muted);
  box-shadow: inset 3px 3px 7px var(--dark), inset -3px -3px 7px var(--light);
}
.login-hint code { font-family: var(--mono); color: var(--accent); font-size: 12.5px; }

@media (max-width: 860px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-hero { padding: 38px 30px; }
  .login-panel { padding: 30px; }
  .hero-list { display: none; }
}

/* ==========================================================================
   Shell
   ========================================================================== */

.shell { height: 100vh; display: flex; flex-direction: column; }

.topbar {
  height: var(--header-h); flex-shrink: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px; padding: 0 22px;
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 12px; font-weight: 750; letter-spacing: -.01em; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 14px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 19px;
  box-shadow: 4px 4px 9px var(--dark), -4px -4px 9px var(--light);
}
.brand small { display: block; font-size: 11px; color: var(--faint); font-weight: 600; }
.topbar-spacer { flex: 1; }

.seg {
  display: flex; padding: 4px; border-radius: var(--r); background: var(--sunken);
  box-shadow: inset 3px 3px 7px var(--dark), inset -3px -3px 7px var(--light);
}
.seg button {
  padding: 6px 14px; border-radius: var(--r-sm); font-size: 13px;
  font-weight: 700; color: var(--muted); transition: all .16s;
}
.seg button.active {
  background: var(--surface); color: var(--accent);
  box-shadow: 3px 3px 7px var(--dark), -3px -3px 7px var(--light);
}

.user-chip {
  display: flex; align-items: center; gap: 11px; padding: 6px 16px 6px 6px;
  border-radius: 30px; background: var(--surface);
  box-shadow: 4px 4px 9px var(--dark), -4px -4px 9px var(--light);
}
.user-chip:active { box-shadow: inset 3px 3px 7px var(--dark), inset -3px -3px 7px var(--light); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700;
}
.user-chip .who { font-size: 13.5px; line-height: 1.3; text-align: left; font-weight: 650; }
.user-chip .who small { display: block; color: var(--faint); font-size: 11px; font-weight: 600; }

.body-row { flex: 1; display: flex; min-height: 0; gap: 18px; padding: 0 22px 22px; }

/* ==========================================================================
   Dashboard — the whole syllabus, centred
   --------------------------------------------------------------------------
   There is no sidebar. This page is the only map of the course, so it carries
   the standing, the single next action, and every topic.
   ========================================================================== */

.dash { flex: 1; overflow-y: auto; }
.dash-inner { max-width: 940px; margin: 0 auto; padding: 8px 6px 60px; }

.dash-head { margin-bottom: 26px; padding: 0 6px; }
.dash-head h1 { font-size: 31px; letter-spacing: -.03em; margin-bottom: 5px; }
.dash-head p { color: var(--muted); font-size: 16px; }

/* The one thing to press */
.hero-card {
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
  padding: 28px 32px; margin-bottom: 24px;
  background: var(--surface); border-radius: var(--r-xl);
  box-shadow: 8px 8px 20px var(--dark), -8px -8px 20px var(--light);
}
.hero-copy { flex: 1; min-width: 240px; }
.hero-kicker {
  font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 8px;
}
.hero-card h2 { font-size: 25px; letter-spacing: -.025em; margin-bottom: 8px; line-height: 1.25; }
.hero-meta {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 14px; color: var(--muted);
}
.hero-meta .dot-sep { color: var(--faint); }
.hero-go { flex-shrink: 0; min-width: 168px; }

.dash-section {
  font-size: 11.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--faint); margin: 34px 0 14px; padding-left: 6px;
}

/* Module block */
.mod-card {
  background: var(--surface); border-radius: var(--r-xl); margin-bottom: 18px;
  padding: 20px 22px 14px;
  box-shadow: 6px 6px 15px var(--dark), -6px -6px 15px var(--light);
}
.mod-head { display: flex; align-items: center; gap: 15px; margin-bottom: 14px; }
.mod-num {
  width: 42px; height: 42px; border-radius: 15px; flex-shrink: 0;
  background: var(--sunken); color: var(--muted);
  display: grid; place-items: center; font-size: 16px; font-weight: 800;
  box-shadow: inset 3px 3px 7px var(--dark), inset -3px -3px 7px var(--light);
}
.mod-num.done { background: var(--ok); color: #fff; box-shadow: 3px 3px 7px var(--dark); }
.mod-title { flex: 1; min-width: 0; }
.mod-title h4 { font-size: 17px; font-weight: 750; letter-spacing: -.015em; }
.mod-title p { font-size: 13.5px; color: var(--faint); margin-top: 2px; }

.mod-topics { display: flex; flex-direction: column; gap: 6px; }

.topic-row {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 13px 16px; border-radius: var(--r); text-align: left;
  background: var(--bg); color: var(--text); font-size: 14.5px;
  transition: all .16s;
}
.topic-row:hover:not(.locked) {
  background: var(--surface);
  box-shadow: 4px 4px 10px var(--dark), -4px -4px 10px var(--light);
  transform: translateX(3px);
}
.topic-row.locked { opacity: .42; cursor: not-allowed; }
.topic-row.next {
  background: var(--accent-wash);
  box-shadow: inset 3px 3px 7px var(--dark), inset -3px -3px 7px var(--light);
}

.row-node {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: var(--sunken); color: var(--faint);
  display: grid; place-items: center; font-size: 11px; font-weight: 800;
  box-shadow: inset 2px 2px 5px var(--dark), inset -2px -2px 5px var(--light);
}
.topic-row.done .row-node { background: var(--ok); color: #fff; box-shadow: 2px 2px 5px var(--dark); }
.topic-row.next .row-node { background: var(--accent); color: #fff; box-shadow: 2px 2px 5px var(--dark); }

.row-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.row-srv {
  font-size: 8.5px; padding: 3px 7px; border-radius: 7px; flex-shrink: 0;
  background: var(--accent-wash); color: var(--accent); font-weight: 800; letter-spacing: .05em;
}
.row-meta { font-size: 12.5px; color: var(--faint); flex-shrink: 0; width: 62px; text-align: right; }
.row-score { font-size: 12.5px; color: var(--muted); flex-shrink: 0; width: 58px; text-align: right; font-variant-numeric: tabular-nums; }
.row-go { flex-shrink: 0; width: 78px; text-align: right; font-size: 13px; font-weight: 700; color: var(--accent); }

@media (max-width: 720px) {
  .row-meta, .row-score { display: none; }
  .hero-go { width: 100%; }
}


/* ==========================================================================
   Guided stage — one screen at a time
   ========================================================================== */

/* Holds the guided stage (and the tutor panel beside it). Without this the
   stage would be a plain block and collapse to its content height, un-pinning
   the footer. */
.workspace {
  flex: 1; min-width: 0; min-height: 0;
  display: flex; gap: 18px; justify-content: center;
}

/* min-height:0 is what keeps the footer pinned. Without it this flex child is
   free to grow past the viewport whenever a lesson screen is tall, pushing the
   Continue button below the fold instead of letting .stage-scroll scroll. */
.stage {
  flex: 1; min-width: 0; min-height: 0; max-width: 1040px;
  display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-xl); overflow: hidden;
  box-shadow: 8px 8px 18px var(--dark), -8px -8px 18px var(--light);
}

.stage-head {
  flex-shrink: 0; padding: 18px 30px 16px;
  display: flex; align-items: center; gap: 18px;
}
.stage-head .where { min-width: 0; flex: 1; }
.stage-head .eyebrow {
  font-size: 11px; font-weight: 800; letter-spacing: .09em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 3px;
}
.stage-head h1 {
  font-size: 19px; letter-spacing: -.015em; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Step rail — the spine of the guided flow. Beads show exactly where you are,
   what you have done, and what has not opened yet. */
.rail { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; padding: 0 30px 16px; flex-shrink: 0; }
.bead {
  height: 9px; border-radius: 6px; flex: 1; min-width: 7px; max-width: 46px;
  background: var(--sunken);
  box-shadow: inset 2px 2px 4px var(--dark), inset -2px -2px 4px var(--light);
  transition: background .3s, box-shadow .3s;
}
.bead.done { background: var(--ok); box-shadow: 1px 1px 3px var(--dark); }
.bead.now  {
  background: var(--accent); box-shadow: 1px 1px 4px var(--dark);
  animation: beadPulse 2s ease-in-out infinite;
}
@keyframes beadPulse { 0%, 100% { opacity: 1; } 50% { opacity: .55; } }
.rail .sep { width: 1px; height: 14px; background: var(--dark); opacity: .4; margin: 0 5px; flex: 0 0 auto; }

.stage-scroll { flex: 1; overflow-y: auto; padding: 6px 30px 30px; }
.stage-inner { max-width: 760px; margin: 0 auto; }

.stage-foot {
  flex-shrink: 0; padding: 16px 30px 20px;
  display: flex; align-items: center; gap: 14px;
  background: var(--surface);
  box-shadow: 0 -10px 20px -14px var(--dark);
}
.stage-foot .spacer { flex: 1; }
.step-note { font-size: 13px; color: var(--faint); font-weight: 600; }
.step-note.blocked { color: var(--warn); }

/* Lesson screen */

.screen-card { padding: 4px 0 8px; }
.screen-kicker {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--muted); padding: 7px 14px; border-radius: 30px;
  background: var(--surface); margin-bottom: 18px;
  box-shadow: 3px 3px 7px var(--dark), -3px -3px 7px var(--light);
}

/* ---------- Markdown ---------- */

.md { font-size: 16px; line-height: 1.78; }
.md > *:first-child { margin-top: 0; }
.md h2 { font-size: 25px; margin: 0 0 18px; letter-spacing: -.02em; line-height: 1.25; }
.md h3 { font-size: 18px; margin: 28px 0 10px; letter-spacing: -.01em; }
.md p { margin: 15px 0; }
.md ul, .md ol { margin: 15px 0 15px 24px; }
.md li { margin: 8px 0; }
.md strong { font-weight: 700; }
.md em { font-style: italic; color: var(--muted); }

.md code {
  font-family: var(--mono); font-size: .86em;
  background: var(--sunken); padding: 3px 8px; border-radius: 8px; color: var(--accent);
  box-shadow: inset 2px 2px 4px var(--dark), inset -2px -2px 4px var(--light);
}
.md pre {
  background: var(--sunken); border-radius: var(--r); padding: 18px 20px; margin: 20px 0;
  overflow-x: auto; line-height: 1.65;
  box-shadow: inset 4px 4px 9px var(--dark), inset -4px -4px 9px var(--light);
}
.md pre code { background: none; box-shadow: none; padding: 0; font-size: 13.5px; color: var(--text); }

.md blockquote {
  background: var(--accent-wash); padding: 16px 20px; margin: 20px 0;
  border-radius: var(--r); border-left: 4px solid var(--accent);
}
.md blockquote p:first-child { margin-top: 0; }
.md blockquote p:last-child { margin-bottom: 0; }

.md table {
  width: 100%; border-collapse: separate; border-spacing: 0; margin: 20px 0; font-size: 14.5px;
  background: var(--sunken); border-radius: var(--r); overflow: hidden; display: block; overflow-x: auto;
  box-shadow: inset 3px 3px 7px var(--dark), inset -3px -3px 7px var(--light);
}
.md th, .md td { padding: 11px 16px; text-align: left; }
.md th { font-weight: 750; color: var(--accent); font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; }
.md tbody tr:nth-child(odd) { background: rgba(255, 255, 255, .16); }
:root[data-theme="dark"] .md tbody tr:nth-child(odd) { background: rgba(255, 255, 255, .03); }
.md hr { border: none; height: 2px; background: var(--dark); opacity: .3; margin: 28px 0; border-radius: 2px; }

/* Syntax colours for lesson prose (the compiler is monochrome — see bottom) */
.tok-key  { color: #9a5fa8; }
.tok-str  { color: #5c8a4a; }
.tok-num  { color: #c07038; }
.tok-com  { color: var(--faint); font-style: italic; }
.tok-fn   { color: #3f77ab; }
.tok-op   { color: #4a8a9a; }
.tok-bool { color: #b04a6a; }

:root[data-theme="dark"] .tok-key  { color: #d3a0dd; }
:root[data-theme="dark"] .tok-str  { color: #a8ce8f; }
:root[data-theme="dark"] .tok-num  { color: #e8a273; }
:root[data-theme="dark"] .tok-fn   { color: #8cb8e0; }
:root[data-theme="dark"] .tok-op   { color: #8ecdd8; }
:root[data-theme="dark"] .tok-bool { color: #e79aae; }

.key-points {
  margin-top: 30px; padding: 22px 26px; border-radius: var(--r-lg);
  background: var(--sunken);
  box-shadow: inset 4px 4px 9px var(--dark), inset -4px -4px 9px var(--light);
}
.key-points h3 {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--accent); margin-bottom: 14px; font-weight: 800;
}
.key-points li { list-style: none; padding-left: 30px; position: relative; margin: 11px 0; font-size: 15px; }
.key-points li::before {
  content: '✓'; position: absolute; left: 0; top: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--ok); color: #fff;
  display: grid; place-items: center; font-size: 10px; font-weight: 800;
}

/* ==========================================================================
   Questions
   ========================================================================== */

.q-kicker {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); padding: 8px 16px; border-radius: 30px;
  background: var(--accent-wash); margin-bottom: 20px;
}
.q-kicker.code { color: var(--ok); background: var(--ok-wash); }
.q-kicker.predict { color: var(--warn); background: var(--warn-wash); }

.q-prompt { font-size: 19px; line-height: 1.6; margin-bottom: 22px; font-weight: 550; }
.q-prompt code {
  font-family: var(--mono); font-size: .84em; background: var(--sunken);
  padding: 3px 8px; border-radius: 8px; color: var(--accent);
}

.q-snippet {
  background: var(--sunken); border-radius: var(--r); padding: 18px 20px; margin-bottom: 22px;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.65; overflow-x: auto; white-space: pre;
  box-shadow: inset 4px 4px 9px var(--dark), inset -4px -4px 9px var(--light);
}

.options { display: flex; flex-direction: column; gap: 12px; }
.option {
  display: flex; align-items: flex-start; gap: 14px; padding: 16px 20px;
  background: var(--surface); border-radius: var(--r); text-align: left;
  font-size: 15.5px; line-height: 1.55;
  box-shadow: 4px 4px 10px var(--dark), -4px -4px 10px var(--light);
  transition: all .16s;
}
.option:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 6px 6px 13px var(--dark), -6px -6px 13px var(--light); }
.option:active:not(:disabled) { transform: none; box-shadow: inset 4px 4px 9px var(--dark), inset -4px -4px 9px var(--light); }
.option .key {
  width: 30px; height: 30px; border-radius: 10px; flex-shrink: 0;
  background: var(--sunken); color: var(--muted);
  display: grid; place-items: center; font-size: 13px; font-weight: 800; font-family: var(--mono);
  box-shadow: inset 2px 2px 5px var(--dark), inset -2px -2px 5px var(--light);
}
.option.right { box-shadow: inset 4px 4px 9px var(--dark), inset -4px -4px 9px var(--light); background: var(--ok-wash); }
.option.right .key { background: var(--ok); color: #fff; box-shadow: none; }
.option.wrong { box-shadow: inset 4px 4px 9px var(--dark), inset -4px -4px 9px var(--light); background: var(--err-wash); }
.option.wrong .key { background: var(--err); color: #fff; box-shadow: none; }
.option:disabled { cursor: default; }
.option code { font-family: var(--mono); font-size: .88em; background: var(--sunken); padding: 2px 7px; border-radius: 7px; }

.verdict {
  margin-top: 22px; padding: 20px 24px; border-radius: var(--r-lg);
  font-size: 15px; line-height: 1.7; animation: rise .3s cubic-bezier(.3, 1, .4, 1);
}
.verdict.right { background: var(--ok-wash); }
.verdict.wrong { background: var(--err-wash); }
.verdict h4 { font-size: 15.5px; margin-bottom: 9px; display: flex; align-items: center; gap: 10px; font-weight: 750; }
.verdict.right h4 { color: var(--ok); }
.verdict.wrong h4 { color: var(--err); }
.verdict .badge-ring {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: #fff;
}
.verdict.right .badge-ring { background: var(--ok); }
.verdict.wrong .badge-ring { background: var(--err); }
.verdict code { font-family: var(--mono); font-size: .87em; background: var(--sunken); padding: 2px 7px; border-radius: 7px; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.hints { margin-top: 20px; display: flex; flex-direction: column; gap: 10px; }
.hint {
  display: flex; gap: 13px; padding: 15px 19px; border-radius: var(--r);
  background: var(--warn-wash); font-size: 14.5px; line-height: 1.6;
  animation: rise .25s ease;
}
.hint .bulb {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  background: var(--warn); color: #fff; display: grid; place-items: center; font-size: 13px;
}
.hint code { font-family: var(--mono); font-size: .88em; }

/* ==========================================================================
   The compiler — black-and-white terminal set into clay
   ========================================================================== */

.compiler {
  --term-bg:     #000000;
  --term-panel:  #0b0b0b;
  --term-line:   #262626;
  --term-bright: #ffffff;
  --term-fg:     #d4d4d4;
  --term-dim:    #8a8a8a;
  --term-faint:  #5c5c5c;

  margin-top: 22px; border-radius: var(--r-lg); overflow: hidden;
  background: var(--term-bg);
  /* Pressed into the clay, like a screen set into a panel. */
  box-shadow: inset 5px 5px 12px var(--dark), inset -5px -5px 12px var(--light),
              0 0 0 8px var(--surface), 7px 7px 16px var(--dark), -7px -7px 16px var(--light);
}

.editor-bar, .console-bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px; flex-shrink: 0;
  background: var(--term-panel); border-bottom: 1px solid var(--term-line);
}
.editor-bar .spacer, .console-bar .spacer { flex: 1; }
.runtime-tag {
  font-size: 10px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 8px; color: var(--term-dim); border: 1px solid var(--term-line);
}
.runtime-tag.server { background: var(--term-bright); color: #000; border-color: var(--term-bright); }
.save-state { font-size: 11.5px; color: var(--term-faint); font-weight: 600; }
.console-bar h3 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--term-dim); font-weight: 800; }
.console-bar .faint { color: var(--term-faint); font-size: 11px; }

.compiler .btn {
  background: transparent; color: var(--term-dim); box-shadow: none;
  border: 1px solid var(--term-line); border-radius: 10px; padding: 6px 13px; font-size: 12.5px;
}
.compiler .btn:hover:not(:disabled) { background: #1a1a1a; color: var(--term-bright); transform: none; box-shadow: none; }
.compiler .btn-primary {
  background: var(--term-bright); color: #000; border-color: var(--term-bright); font-weight: 700;
}
.compiler .btn-primary:hover:not(:disabled) { background: #d0d0d0; color: #000; }
.compiler .btn-primary:disabled { background: var(--term-line); color: var(--term-dim); border-color: var(--term-line); }

/* The editor is now a column: find bar, the code, then the status strip.
   `.editor-main` is the row that used to be `.editor` itself. */
.editor {
  position: relative; height: 320px; min-height: 170px; background: var(--term-bg);
  display: flex; flex-direction: column; resize: vertical; overflow: hidden;
}
.editor-main { display: flex; flex: 1; min-height: 0; }
.editor.is-readonly .editor-input { caret-color: transparent; }
.editor.is-readonly .gutter, .editor.is-readonly .editor-highlight { opacity: .65; }
.gutter {
  flex-shrink: 0; padding: 14px 10px 14px 16px; text-align: right;
  font-family: var(--mono); font-size: 13.2px; line-height: 1.62;
  color: var(--term-faint); background: var(--term-bg);
  user-select: none; border-right: 1px solid var(--term-line); overflow: hidden; min-width: 46px;
}
.editor-scroll { position: relative; flex: 1; overflow: auto; }
.editor-layer {
  margin: 0; padding: 14px 16px; border: none;
  font-family: var(--mono); font-size: 13.2px; line-height: 1.62; white-space: pre; tab-size: 2;
}
.editor-highlight { position: absolute; inset: 0; pointer-events: none; color: var(--term-fg); width: max-content; min-width: 100%; }
.editor-input {
  position: relative; display: block; width: 100%; height: 100%;
  background: transparent; color: transparent; caret-color: var(--term-bright);
  resize: none; outline: none; overflow: hidden;
}
.editor-input::selection { background: rgba(255, 255, 255, .22); }

/* Monochrome syntax — meaning through weight and value, not hue. */
.editor .tok-key  { color: var(--term-bright); font-weight: 650; }
.editor .tok-fn   { color: var(--term-bright); }
.editor .tok-bool { color: var(--term-bright); font-weight: 650; }
.editor .tok-str  { color: #b8b8b8; }
.editor .tok-num  { color: #e6e6e6; }
.editor .tok-op   { color: #9e9e9e; }
.editor .tok-com  { color: var(--term-faint); font-style: italic; }

.console-wrap { display: flex; flex-direction: column; background: var(--term-bg); min-height: 150px; max-height: 320px; }
.console-out { flex: 1; overflow-y: auto; padding: 12px 16px; font-family: var(--mono); font-size: 12.8px; line-height: 1.62; color: var(--term-fg); }

.line { display: flex; gap: 10px; padding: 1px 0; white-space: pre-wrap; word-break: break-word; }
.line .mark { color: var(--term-faint); flex-shrink: 0; user-select: none; }
.line.warn, .line.error { color: var(--term-bright); }
.line.error { font-weight: 600; }
.line.muted { color: var(--term-faint); font-style: italic; font-family: var(--sans); }

.err-box {
  background: var(--term-panel); border: 1px solid var(--term-line);
  border-left: 3px solid var(--term-bright); border-radius: 0 8px 8px 0;
  padding: 12px 15px; margin: 9px 0; color: var(--term-bright);
  white-space: pre-wrap; word-break: break-word;
}

.test-row { display: flex; gap: 10px; padding: 4px 0; align-items: flex-start; }
.test-row .icon { flex-shrink: 0; font-weight: 800; color: var(--term-bright); }
.test-row .name { flex: 1; color: var(--term-dim); }
.test-row.fail .name { color: var(--term-bright); font-weight: 600; }
.test-msg {
  margin: 4px 0 9px 28px; padding: 9px 13px;
  background: var(--term-panel); border-left: 2px solid var(--term-bright);
  border-radius: 0 8px 8px 0; color: var(--term-fg); white-space: pre-wrap; font-size: 12.4px;
}

.test-summary {
  display: flex; align-items: center; gap: 10px; padding: 10px 15px; margin-bottom: 9px;
  border-radius: 10px; font-family: var(--sans); font-size: 13.5px; font-weight: 700;
}
.test-summary.pass { border: 1px solid var(--term-line); color: var(--term-bright); }
.test-summary.fail { background: var(--term-bright); color: #000; }

/* ==========================================================================
   AI tutor
   ========================================================================== */

.tutor-panel {
  width: 380px; flex-shrink: 0; display: flex; flex-direction: column;
  min-height: 0; max-height: 100%;
  background: var(--surface); border-radius: var(--r-xl); overflow: hidden;
  box-shadow: 8px 8px 18px var(--dark), -8px -8px 18px var(--light);
}
.tutor-head { padding: 18px 22px 14px; display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.tutor-head h3 { font-size: 15px; font-weight: 750; }
.tutor-head .spacer { flex: 1; }
.tutor-scroll { flex: 1; overflow-y: auto; padding: 4px 18px 18px; display: flex; flex-direction: column; gap: 14px; }

.msg { max-width: 92%; padding: 14px 17px; font-size: 14.5px; line-height: 1.65; }
.msg.you {
  align-self: flex-end; background: var(--accent); color: #fff;
  border-radius: var(--r) var(--r) 6px var(--r);
  box-shadow: 3px 3px 8px var(--dark);
}
.msg.ai {
  align-self: flex-start; background: var(--sunken);
  border-radius: var(--r) var(--r) var(--r) 6px;
  box-shadow: inset 3px 3px 7px var(--dark), inset -3px -3px 7px var(--light);
}
.msg.ai code { font-family: var(--mono); font-size: .87em; background: var(--surface); padding: 2px 7px; border-radius: 7px; }
.msg.ai pre { background: var(--surface); border-radius: 10px; padding: 12px 14px; margin: 10px 0; overflow-x: auto; font-size: 12.6px; }
.msg.ai pre code { background: none; padding: 0; }
.msg.ai p { margin: 9px 0; }
.msg.ai p:first-child { margin-top: 0; }
.msg.ai p:last-child { margin-bottom: 0; }

.tutor-compose { flex-shrink: 0; padding: 16px 18px 18px; display: flex; gap: 10px; }
.tutor-compose .textarea { min-height: 46px; max-height: 130px; font-size: 14px; }

.tutor-empty { text-align: center; padding: 28px 14px; color: var(--muted); }
.tutor-empty .big { font-size: 40px; margin-bottom: 12px; }
.tutor-suggest {
  display: block; width: 100%; text-align: left; padding: 12px 16px; margin-top: 9px;
  background: var(--surface); border-radius: var(--r); font-size: 13.5px; color: var(--muted);
  box-shadow: 3px 3px 8px var(--dark), -3px -3px 8px var(--light);
  transition: all .16s;
}
.tutor-suggest:hover { color: var(--text); transform: translateY(-1px); }

.ai-off { margin: 18px; padding: 22px; text-align: center; border-radius: var(--r-lg); background: var(--warn-wash); }
.ai-off h4 { color: var(--warn); margin-bottom: 9px; font-size: 15px; }
.ai-off p { font-size: 13.5px; color: var(--muted); line-height: 1.65; }
.ai-off code { font-family: var(--mono); background: var(--sunken); padding: 3px 8px; border-radius: 7px; font-size: 12.5px; color: var(--accent); }

/* ==========================================================================
   Instructor
   ========================================================================== */

.inst-page { flex: 1; overflow-y: auto; padding: 4px 4px 40px; }
.inst-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; padding: 0 6px; }
.inst-head h1 { font-size: 27px; letter-spacing: -.025em; }
.inst-head .spacer { flex: 1; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--surface); border-radius: var(--r-lg); padding: 20px 22px;
  box-shadow: 6px 6px 14px var(--dark), -6px -6px 14px var(--light);
}
.stat-card .n { font-size: 30px; font-weight: 800; letter-spacing: -.025em; line-height: 1.1; }
.stat-card .l { font-size: 11.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .07em; margin-top: 5px; font-weight: 700; }
.stat-card.good .n { color: var(--ok); }
.stat-card.warn .n { color: var(--warn); }

.panel {
  background: var(--surface); border-radius: var(--r-xl); margin-bottom: 22px; overflow: hidden;
  box-shadow: 7px 7px 16px var(--dark), -7px -7px 16px var(--light);
}
.panel-head { display: flex; align-items: center; gap: 13px; padding: 20px 24px 14px; }
.panel-head h2 { font-size: 16.5px; font-weight: 750; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 6px 24px 24px; }
.panel-body.flush { padding: 0 0 8px; }

.control-row { display: flex; gap: 11px; flex-wrap: wrap; align-items: center; padding: 12px 0; }
.control-row + .control-row { border-top: 2px solid var(--sunken); }
.control-row .label { font-size: 11.5px; color: var(--faint); font-weight: 800; min-width: 112px; text-transform: uppercase; letter-spacing: .06em; }

table.grid { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: 14px; padding: 0 16px; }
table.grid th {
  text-align: left; padding: 6px 14px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--faint); font-weight: 800;
}
table.grid td { padding: 13px 14px; vertical-align: middle; background: var(--bg); }
table.grid td:first-child { border-radius: var(--r) 0 0 var(--r); }
table.grid td:last-child { border-radius: 0 var(--r) var(--r) 0; }
table.grid tr.clickable:hover td { background: var(--sunken); cursor: pointer; }

.presence { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 650; }
.presence .led { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex-shrink: 0; }
.presence.on .led { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-wash); }
.presence.on { color: var(--ok); }

.mini-bar { width: 84px; height: 9px; border-radius: 6px; background: var(--sunken); overflow: hidden; display: inline-block; vertical-align: middle; box-shadow: inset 2px 2px 4px var(--dark); }
.mini-bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; }

.tag { display: inline-block; padding: 4px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 750; background: var(--sunken); color: var(--muted); }
.tag.ok   { background: var(--ok-wash); color: var(--ok); }
.tag.err  { background: var(--err-wash); color: var(--err); }
.tag.warn { background: var(--warn-wash); color: var(--warn); }
.tag.lock { background: var(--err); color: #fff; }

.feed { max-height: 400px; overflow-y: auto; padding: 0 20px; }
.feed-item {
  display: flex; gap: 13px; padding: 12px 16px; margin-bottom: 6px; font-size: 13.5px;
  align-items: baseline; border-radius: var(--r); background: var(--bg);
}
.feed-item .when { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; flex-shrink: 0; width: 52px; }
.feed-item .who { font-weight: 750; flex-shrink: 0; }
.feed-item .what { color: var(--muted); flex: 1; }
.feed-item.ok .what { color: var(--ok); }
.feed-item.bad .what { color: var(--err); }
.feed-item.done { background: var(--ok-wash); }
.feed-item.done .what { color: var(--ok); font-weight: 700; }

.live-code {
  background: #000; border-radius: var(--r); padding: 16px 18px; margin-top: 10px;
  font-family: var(--mono); font-size: 12.6px; line-height: 1.6;
  max-height: 300px; overflow: auto; white-space: pre; color: #d4d4d4;
}
.live-code .tok-key, .live-code .tok-fn, .live-code .tok-bool { color: #fff; }
.live-code .tok-str { color: #b8b8b8; }
.live-code .tok-num { color: #e6e6e6; }
.live-code .tok-op  { color: #9e9e9e; }
.live-code .tok-com { color: #5c5c5c; font-style: italic; }

/* ==========================================================================
   Modal, toast, misc
   ========================================================================== */

.modal-veil {
  position: fixed; inset: 0; background: rgba(60, 50, 40, .42);
  display: grid; place-items: center; z-index: 100; padding: 24px;
  animation: fade .18s ease; backdrop-filter: blur(6px);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface); border-radius: var(--r-xl);
  box-shadow: 16px 16px 40px var(--dark), -16px -16px 40px var(--light);
  width: 100%; max-width: 500px; max-height: 88vh; overflow-y: auto;
  animation: pop .3s cubic-bezier(.25, 1.2, .4, 1);
}
.modal.wide { max-width: 820px; }
@keyframes pop { from { opacity: 0; transform: scale(.92) translateY(16px); } to { opacity: 1; transform: none; } }

.modal-head { padding: 26px 30px 0; }
.modal-head h2 { font-size: 21px; letter-spacing: -.02em; }
.modal-body { padding: 18px 30px; }
.modal-foot { padding: 0 30px 26px; display: flex; gap: 11px; justify-content: flex-end; }

.celebrate { text-align: center; padding: 44px 36px 34px; }
.celebrate .burst {
  width: 96px; height: 96px; margin: 0 auto 22px; border-radius: 34px;
  background: var(--ok); color: #fff;
  display: grid; place-items: center; font-size: 46px;
  box-shadow: 8px 8px 20px var(--dark), -8px -8px 20px var(--light);
  animation: bounce .7s cubic-bezier(.3, 1.6, .5, 1);
}
@keyframes bounce { 0% { transform: scale(0) rotate(-20deg); } 60% { transform: scale(1.16) rotate(7deg); } 100% { transform: scale(1); } }
.celebrate h2 { font-size: 27px; margin-bottom: 10px; letter-spacing: -.025em; }
.celebrate p { color: var(--muted); margin-bottom: 24px; font-size: 15.5px; }
.celebrate .score {
  display: inline-flex; align-items: center; gap: 11px; padding: 13px 26px; margin-bottom: 26px;
  background: var(--ok-wash); border-radius: 30px; color: var(--ok); font-weight: 750; font-size: 16px;
}
.celebrate .actions { display: flex; gap: 11px; justify-content: center; flex-wrap: wrap; }

.toast-stack { position: fixed; bottom: 26px; right: 26px; display: flex; flex-direction: column; gap: 11px; z-index: 200; max-width: 380px; }
.toast {
  background: var(--surface); border-radius: var(--r-lg); padding: 16px 20px; font-size: 14px; line-height: 1.55;
  box-shadow: 8px 8px 20px var(--dark), -8px -8px 20px var(--light);
  border-left: 5px solid var(--accent);
  animation: slideIn .3s cubic-bezier(.25, 1.2, .4, 1);
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }
.toast strong { display: block; margin-bottom: 3px; font-size: 14px; font-weight: 750; }
.toast .t-body { color: var(--muted); font-size: 13.5px; }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

.banner {
  display: flex; align-items: center; gap: 13px; padding: 14px 24px; margin: 0 22px 14px;
  font-size: 14.5px; border-radius: var(--r-lg); flex-shrink: 0; font-weight: 600;
}
.banner.lock { background: var(--err-wash); color: var(--err); }
.banner.note { background: var(--accent-wash); color: var(--accent); }
.banner .spacer { flex: 1; }

.empty { text-align: center; padding: 60px 24px; color: var(--faint); }
.empty .big {
  width: 76px; height: 76px; margin: 0 auto 18px; border-radius: 26px;
  background: var(--sunken); display: grid; place-items: center; font-size: 32px;
  box-shadow: inset 4px 4px 9px var(--dark), inset -4px -4px 9px var(--light);
}

.spinner {
  width: 15px; height: 15px; border: 2.5px solid var(--dark);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.split-h { display: flex; gap: 10px; align-items: center; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }

@media (max-width: 1240px) { .tutor-panel { display: none; } }
@media (max-width: 1000px) { .stage-scroll { padding: 6px 22px 24px; } }
@media (max-width: 820px) {
  .body-row { padding: 0 12px 12px; }
  .stage-head, .rail, .stage-foot { padding-left: 18px; padding-right: 18px; }
}

/* ==========================================================================
   Admin panel
   ========================================================================== */

.admin-inner { max-width: 1080px; }

.admin-tabs {
  display: flex; gap: 6px; padding: 6px; margin-bottom: 22px; flex-wrap: wrap;
  background: var(--sunken); border-radius: var(--r);
  box-shadow: inset 3px 3px 7px var(--dark), inset -3px -3px 7px var(--light);
}
.admin-tab {
  padding: 10px 20px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 650; color: var(--muted); transition: all .16s;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active {
  background: var(--surface); color: var(--accent);
  box-shadow: 3px 3px 8px var(--dark), -3px -3px 8px var(--light);
}
.admin-tab.danger { margin-left: auto; color: var(--err); }
.admin-tab.danger.active { color: var(--err); }

.admin-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 860px) { .admin-cols { grid-template-columns: 1fr; } }

/* Key/value readouts */
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv-row {
  display: flex; align-items: baseline; gap: 14px;
  padding: 9px 2px; font-size: 14px;
}
.kv-row + .kv-row { border-top: 1px solid var(--sunken); }
.kv-k { color: var(--muted); flex: 1; }
.kv-v { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }

/* Danger */
.danger-box {
  margin-top: 20px; padding: 18px 20px; border-radius: var(--r-lg);
  background: var(--err-wash);
}
.danger-box h4 { color: var(--err); font-size: 14.5px; margin-bottom: 6px; }
.danger-box p { font-size: 13.5px; color: var(--muted); margin-bottom: 14px; line-height: 1.6; }

.danger-panel { box-shadow: 6px 6px 15px var(--dark), -6px -6px 15px var(--light), inset 0 0 0 2px var(--err-wash); }
.danger-panel .panel-head h2 { color: var(--err); }

/* ---------- Classes ---------- */

.class-row {
  display: flex; align-items: center; gap: 16px; width: 100%;
  padding: 16px 18px; margin-bottom: 8px; border-radius: var(--r);
  background: var(--bg); text-align: left; color: var(--text); transition: all .16s;
}
.class-row:hover {
  background: var(--surface);
  box-shadow: 4px 4px 10px var(--dark), -4px -4px 10px var(--light);
  transform: translateX(3px);
}
.class-badge {
  width: 46px; height: 46px; border-radius: 16px; flex-shrink: 0;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 17px; font-weight: 800;
  box-shadow: 3px 3px 8px var(--dark);
}
.class-main { flex: 1; min-width: 0; }
.class-name { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.class-sub { font-size: 13px; color: var(--faint); margin-top: 2px; }
.class-stats { display: flex; align-items: center; gap: 10px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

.mini-head {
  font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint); margin: 20px 0 10px;
}
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.member-chip {
  display: inline-flex; align-items: center; gap: 9px;
  padding: 8px 10px 8px 15px; border-radius: 30px;
  background: var(--surface); font-size: 13.5px; font-weight: 600;
  box-shadow: 3px 3px 7px var(--dark), -3px -3px 7px var(--light);
}
.member-chip button {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  background: var(--sunken); color: var(--muted); font-size: 13px; line-height: 1;
  display: grid; place-items: center;
}
.member-chip button:hover { background: var(--err); color: #fff; }

/* ---------- Subjects ---------- */

.subject-card {
  padding: 18px 20px; margin-bottom: 10px; border-radius: var(--r-lg);
  background: var(--bg);
}
.subject-card.empty { opacity: .82; }

.subject-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.subject-mark {
  width: 48px; height: 48px; border-radius: 16px; flex-shrink: 0;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 21px; font-weight: 800;
  box-shadow: 3px 3px 8px var(--dark);
}
.subject-card.empty .subject-mark { background: var(--sunken); color: var(--faint); box-shadow: inset 2px 2px 5px var(--dark); }

.subject-name { font-size: 17px; font-weight: 750; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.subject-desc { font-size: 13.5px; color: var(--faint); margin-top: 3px; }

.subject-figures { display: flex; gap: 22px; flex-shrink: 0; }
.subject-figures > div { text-align: center; }
.subject-figures b { display: block; font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.subject-figures span {
  font-size: 10px; color: var(--faint); text-transform: uppercase;
  letter-spacing: .07em; font-weight: 700;
}

.subject-modules { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 16px; }
.module-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: 20px; background: var(--surface);
  font-size: 12.5px; font-weight: 600;
  box-shadow: 2px 2px 6px var(--dark), -2px -2px 6px var(--light);
}
.module-pill b {
  width: 17px; height: 17px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent-wash); color: var(--accent);
  display: grid; place-items: center; font-size: 9.5px; font-weight: 800;
}
.module-pill i { font-style: normal; color: var(--faint); font-size: 11px; }

.subject-note {
  margin-top: 14px; padding: 13px 16px; border-radius: var(--r);
  background: var(--warn-wash); color: var(--muted); font-size: 13.5px; line-height: 1.6;
}

.subject-pill {
  display: inline-block; padding: 2px 9px; border-radius: 20px; margin-right: 7px;
  background: var(--accent-wash); color: var(--accent);
  font-size: 11.5px; font-weight: 750;
}

.batch-pill {
  display: inline-block; padding: 2px 9px; border-radius: 20px; margin-right: 7px;
  background: var(--ok-wash); color: var(--ok);
  font-size: 11.5px; font-weight: 750;
}

/* ==========================================================================
   Live class — three panes describing one instant
   ========================================================================== */

.live-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
  background: var(--err); display: inline-block;
  box-shadow: 0 0 0 0 var(--err-wash);
  animation: livePulse 1.8s ease-out infinite;
}
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(181, 97, 79, .5); }
  70%  { box-shadow: 0 0 0 7px rgba(181, 97, 79, 0); }
  100% { box-shadow: 0 0 0 0 rgba(181, 97, 79, 0); }
}
.live-btn.active { background: var(--err); color: #fff; }
.live-btn.active .live-dot { background: #fff; }

.live { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 14px; position: relative; }

.live-top { display: flex; align-items: center; gap: 14px; flex-shrink: 0; flex-wrap: wrap; }
.live-title { min-width: 0; }
.live-kicker {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; font-weight: 800; letter-spacing: .08em;
  text-transform: uppercase; color: var(--err); margin-bottom: 2px;
}
.live-top h1 { font-size: 22px; letter-spacing: -.02em; line-height: 1.25; }

/* Left and right are fixed rails; the board takes what is left. */
.live-grid {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 310px minmax(0, 1fr) 300px; gap: 16px;
}

.live-pane {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border-radius: var(--r-xl); overflow: hidden;
  box-shadow: 7px 7px 16px var(--dark), -7px -7px 16px var(--light);
}
.live-pane-head {
  display: flex; align-items: center; gap: 10px; padding: 16px 20px 12px; flex-shrink: 0;
}
.live-pane-head h2 { font-size: 14px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }
.live-count {
  min-width: 24px; padding: 2px 8px; border-radius: 20px;
  background: var(--err-wash); color: var(--err);
  font-size: 12px; font-weight: 800; text-align: center;
}
.live-pane-body { flex: 1; overflow-y: auto; padding: 0 14px 16px; }
.live-board-body { padding: 4px 28px 24px; }

.live-empty { text-align: center; padding: 40px 18px; color: var(--faint); }
.live-empty span { font-size: 30px; display: block; margin-bottom: 10px; }
.live-empty p { font-size: 13.5px; line-height: 1.6; }

/* ---- student rows ---- */

.live-student {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 11px 13px; margin-bottom: 7px; border-radius: var(--r);
  background: var(--bg); color: var(--text); transition: all .15s;
}
.live-student:hover { background: var(--surface); box-shadow: 3px 3px 9px var(--dark), -3px -3px 9px var(--light); transform: translateX(2px); }
.live-student.incorrect { box-shadow: inset 3px 0 0 var(--err); }
.live-student.working   { box-shadow: inset 3px 0 0 var(--warn); }
.live-student.not-reached, .live-student.not-started { opacity: .72; }

.live-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0; position: relative;
  background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.live-avatar.tiny { width: 20px; height: 20px; font-size: 9px; }
.live-on {
  position: absolute; right: -1px; bottom: -1px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--ok); border: 2px solid var(--surface);
}

.live-student-main { flex: 1; min-width: 0; }
.live-student-name { font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-student-sub { font-size: 11.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-student-score { text-align: right; flex-shrink: 0; }
.live-student-score b { display: block; font-size: 14px; font-variant-numeric: tabular-nums; }
.live-student-score span { font-size: 10px; color: var(--faint); }

/* ---- board ---- */

.live-board-foot {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 12px 20px 16px; flex-shrink: 0;
  box-shadow: 0 -10px 20px -16px var(--dark);
}
.live-step { font-size: 13px; font-weight: 700; color: var(--muted); }
.live-board .option { cursor: default; }
.live-board .option:hover { transform: none; }

.live-solution { margin-top: 18px; }
.live-solution summary { cursor: pointer; font-size: 13px; font-weight: 650; color: var(--muted); }
.live-solution .live-code { margin-top: 10px; }

/* ---- answer tally ---- */

.live-bar {
  display: flex; height: 12px; border-radius: 8px; overflow: hidden; margin-bottom: 16px;
  background: var(--sunken);
  box-shadow: inset 2px 2px 5px var(--dark);
}
.live-bar i { display: block; }
.live-bar i.ok { background: var(--ok); }
.live-bar i.err { background: var(--err); }
.live-bar i.idle { background: var(--dark); opacity: .4; }

.live-group { margin-bottom: 16px; }
.live-group-head {
  display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px;
  font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase;
  color: var(--faint);
}
.live-group-head b { font-size: 13px; letter-spacing: 0; }
.live-group.ok   .live-group-head { color: var(--ok); }
.live-group.err  .live-group-head { color: var(--err); }
.live-group.warn .live-group-head { color: var(--warn); }
.live-group-empty { font-size: 12px; color: var(--faint); font-style: italic; }

.live-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.live-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px 4px 4px; border-radius: 20px;
  background: var(--bg); color: var(--text); font-size: 12.5px; font-weight: 600;
}
.live-chip:hover { background: var(--surface); box-shadow: 2px 2px 6px var(--dark), -2px -2px 6px var(--light); }
.live-chip.away { opacity: .5; }

/* ---- peek card ---- */

.live-peek {
  position: absolute; left: 16px; bottom: 16px; width: 300px; z-index: 20;
  padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface);
  box-shadow: 10px 10px 26px var(--dark), -10px -10px 26px var(--light);
  animation: rise .2s ease;
}
.live-peek-head { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.live-peek-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.live-peek-stats > div { text-align: center; }
.live-peek-stats b { display: block; font-size: 16px; font-weight: 800; }
.live-peek-stats span { font-size: 9.5px; color: var(--faint); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.live-peek-run { display: flex; align-items: center; gap: 9px; margin-top: 12px; }

@media (max-width: 1200px) {
  .live-grid { grid-template-columns: 260px minmax(0, 1fr) 250px; gap: 12px; }
}
@media (max-width: 940px) {
  .live-grid { grid-template-columns: 1fr; grid-template-rows: auto auto auto; overflow-y: auto; }
  .live-pane { max-height: 60vh; }
}

/* Toast action row — for the few toasts that ask you to do something. */
.toast .t-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.toast .t-actions .btn { padding: 5px 12px; font-size: 12.5px; }

/* ------------------------------------------------------------------ */
/* Dashboard: subjects, then syllabus beside your standing             */
/* ------------------------------------------------------------------ */

.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  margin-top: 26px;
}

.subject-tile {
  text-align: left;
  padding: 22px 24px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: 9px 9px 20px var(--dark), -9px -9px 20px var(--light);
  cursor: pointer;
  transition: transform .16s, box-shadow .16s;
  font: inherit;
  color: inherit;
}
.subject-tile:hover {
  transform: translateY(-2px);
  box-shadow: 12px 12px 26px var(--dark), -12px -12px 26px var(--light);
}
.subject-tile:active {
  transform: none;
  box-shadow: inset 5px 5px 12px var(--dark), inset -5px -5px 12px var(--light);
}
.subject-tile.empty-subject { opacity: .62; cursor: default; }
.subject-tile.empty-subject:hover { transform: none; }

.subject-tile-head { display: flex; align-items: center; gap: 10px; }
.subject-tile-head h3 { margin: 0; font-size: 19px; }
.subject-tile-head .tag { margin-left: auto; }
.subject-tile-desc {
  margin: 8px 0 16px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
}
.subject-tile-bar {
  height: 8px;
  border-radius: 99px;
  background: var(--surface);
  box-shadow: inset 3px 3px 6px var(--dark), inset -3px -3px 6px var(--light);
  overflow: hidden;
}
.subject-tile-bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
}
.subject-tile-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ---- the split ---- */

.course-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 26px;
  align-items: start;
}
.course-main { min-width: 0; }
/*
 * Deliberately not sticky.
 *
 * Pinning this column looked better in a mockup and was worse in use: the four
 * cards are taller than a laptop window, so a sticky column either hides its
 * own last card or traps the wheel inside its own scrollbar. Your standing is
 * something you read on arrival and then leave behind while you browse the
 * syllabus, so it scrolls away with everything else.
 */
.course-side {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
/* Below this the two columns stop being readable side by side. */
@media (max-width: 900px) {
  .course-split { grid-template-columns: minmax(0, 1fr); }
  .course-side { position: static; flex-direction: row; flex-wrap: wrap; }
  .course-side > div { flex: 1 1 240px; }
}

.side-card {
  padding: 18px 20px;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: 8px 8px 18px var(--dark), -8px -8px 18px var(--light);
  margin-bottom: 16px;
}
.side-card h4 {
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}

.rank-figure { display: flex; align-items: baseline; gap: 10px; }
.rank-figure b { font-size: 34px; line-height: 1; color: var(--accent); }
.rank-figure span { font-size: 13px; color: var(--muted); }
.rank-figure.solo b { color: var(--muted); }
.rank-note { margin: 12px 0 0; font-size: 13px; line-height: 1.5; }

.side-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 10px;
  margin-bottom: 16px;
}
.side-stat b { display: block; font-size: 20px; line-height: 1.2; }
.side-stat span { font-size: 11.5px; color: var(--muted); }

.side-bar {
  height: 9px;
  border-radius: 99px;
  background: var(--surface);
  box-shadow: inset 3px 3px 7px var(--dark), inset -3px -3px 7px var(--light);
  overflow: hidden;
}
.side-bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.side-bar-note { margin: 9px 0 0; font-size: 12px; color: var(--muted); }

.compare-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  font-size: 13px;
}
/* Same hairline the admin key/value rows use. */
.compare-row + .compare-row { border-top: 1px solid var(--sunken); }
.compare-label { color: var(--muted); }
.compare-mine { font-weight: 700; }
.compare-theirs { color: var(--muted); min-width: 34px; text-align: right; }
.compare-delta { font-size: 10px; }
.compare-delta.up { color: var(--ok); }
.compare-delta.down { color: var(--err); }
.compare-delta.level { color: var(--muted); }

.board { display: flex; flex-direction: column; gap: 2px; }
.board-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 10px;
  font-size: 13px;
}
.board-row.me {
  background: var(--surface);
  box-shadow: inset 3px 3px 7px var(--dark), inset -3px -3px 7px var(--light);
  font-weight: 700;
}
.board-pos { color: var(--muted); font-size: 12px; }
.board-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-score { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ */
/* Invite links, the join screen and the approval queue                */
/* ------------------------------------------------------------------ */

.join-card {
  max-width: 520px;
  margin: 60px auto;
  padding: 40px 42px;
  text-align: center;
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: 14px 14px 32px var(--dark), -14px -14px 32px var(--light);
}
.join-mark {
  width: 62px;
  height: 62px;
  margin: 0 auto 20px;
  display: grid;
  place-items: center;
  font-size: 26px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 5px 5px 11px var(--dark), inset -5px -5px 11px var(--light);
}
.join-mark.bad { filter: grayscale(1); opacity: .7; }
.join-kicker {
  font-size: 12px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.join-card h1 { margin: 0 0 12px; font-size: 28px; }
.join-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--muted);
  margin-bottom: 18px;
}
.join-desc { font-size: 14px; color: var(--muted); line-height: 1.6; margin: 0 0 22px; }
.join-note { font-size: 13.5px; color: var(--muted); margin: 0 0 22px; line-height: 1.6; }
.join-status {
  font-size: 15px;
  font-weight: 650;
  margin: 0 0 22px;
  padding: 14px 18px;
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: inset 4px 4px 9px var(--dark), inset -4px -4px 9px var(--light);
}
.join-status.ok { color: var(--ok); }
.join-status.wait { color: var(--warn); }

/* Waiting-to-join queue on the classroom page. */
.queue-panel { border: 2px solid var(--warn-wash); }
.queue-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
}
.queue-row + .queue-row { border-top: 1px solid var(--sunken); }
.queue-who { min-width: 0; }

/* Class membership list inside the invite dialog. */
.member-list { display: flex; flex-direction: column; }
.member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  font-size: 13.5px;
}
.member-row + .member-row { border-top: 1px solid var(--sunken); }

/* ==========================================================================
   Live class — the instructor's home page, and the room itself

   The hub reuses the dashboard's shapes on purpose: a teacher's home page and
   a student's home page are the same kind of thing, and there is no reason for
   them to look like two different products.
   ========================================================================== */

.hub { flex: 1; overflow-y: auto; }
.hub-inner { max-width: 1040px; margin: 0 auto; padding: 8px 6px 60px; }

.hub-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; padding: 0 6px; }
.hub-head h1 { font-size: 31px; letter-spacing: -.03em; margin-bottom: 5px; }
.hub-head p { color: var(--muted); font-size: 15.5px; max-width: 46ch; }
.hub-head .spacer { flex: 1; }
.hub-kicker {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--err); margin-bottom: 6px;
}
.hub-note { color: var(--muted); font-size: 13.5px; line-height: 1.6; margin: -6px 6px 14px; max-width: 60ch; }

/* ---- one class ---- */

.class-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 18px;
}
.class-card {
  display: flex; flex-direction: column; gap: 12px;
  padding: 20px 22px 16px; border-radius: var(--r-lg); background: var(--surface);
  box-shadow: 8px 8px 20px var(--dark), -8px -8px 20px var(--light);
}
/* A class that is running is the one thing on the page you might need to walk
   into, so it is ringed rather than merely labelled. */
.class-card.is-live { box-shadow: 0 0 0 2px var(--err-wash), 8px 8px 20px var(--dark), -8px -8px 20px var(--light); }

.class-card-head { display: flex; align-items: flex-start; gap: 10px; }
.class-card-title { min-width: 0; }
.class-card-title h4 { font-size: 18px; letter-spacing: -.02em; margin-bottom: 5px; }
.class-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.class-card .spacer { flex: 1; }
.live-tag { display: inline-flex; align-items: center; gap: 6px; background: var(--err-wash); color: var(--err); }

.class-card-stats { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.class-card-stats .ok-text { color: var(--ok); font-weight: 650; }
.class-card-bar { height: 7px; border-radius: 20px; background: var(--sunken); overflow: hidden; box-shadow: inset 2px 2px 5px var(--dark); }
.class-card-bar i { display: block; height: 100%; border-radius: 20px; background: var(--accent); }

.class-card-foot { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.class-card-foot .select { flex: 1; min-width: 150px; }
.field-inline { font-size: 12px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }

.class-card-live { display: flex; flex-direction: column; gap: 10px; padding: 13px 15px; border-radius: var(--r); background: var(--err-wash); }
.class-card-live p { font-size: 13.5px; line-height: 1.55; color: var(--text); }

.class-card-toggle {
  align-self: flex-start; padding: 4px 2px; background: none; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 650; cursor: pointer;
}
.class-card-toggle:hover { color: var(--accent); }

.class-roster { max-height: 320px; overflow-y: auto; padding-right: 4px; }
.roster-row { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--r); }
.roster-row + .roster-row { margin-top: 4px; }
.roster-row.on { background: var(--bg); }
.roster-main { flex: 1; min-width: 0; }
.roster-name { font-size: 13.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-sub { font-size: 11.5px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roster-score { text-align: right; flex-shrink: 0; }
.roster-score b { display: block; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.roster-score span { font-size: 10.5px; color: var(--faint); }

/* ---- subjects ---- */

.subject-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.subject-mini { padding: 16px 18px; border-radius: var(--r-lg); background: var(--surface); box-shadow: 6px 6px 15px var(--dark), -6px -6px 15px var(--light); }
.subject-mini.empty-subject { opacity: .6; }
.subject-mini h4 { font-size: 15.5px; margin-bottom: 5px; }
.subject-mini p { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin-bottom: 10px; }
.subject-mini-meta { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 12px; color: var(--faint); }

/* ---- syllabus ---- */

.syl-mod { background: var(--surface); border-radius: var(--r-lg); margin-bottom: 12px; overflow: hidden; box-shadow: 6px 6px 15px var(--dark), -6px -6px 15px var(--light); }
.syl-mod-head { display: flex; align-items: center; gap: 14px; width: 100%; padding: 15px 20px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.syl-mod-head:hover { background: var(--bg); }
.syl-num { width: 32px; height: 32px; border-radius: 12px; flex-shrink: 0; background: var(--sunken); color: var(--muted); display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.syl-mod-title { flex: 1; min-width: 0; }
.syl-mod-title b { display: block; font-size: 15px; }
.syl-mod-title small { display: block; font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.syl-caret { color: var(--faint); font-size: 12px; }

.syl-topics { padding: 0 14px 12px; }
.syl-topic { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--r); }
.syl-topic:hover { background: var(--bg); }
.syl-topic-title { flex: 1; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.syl-topic-meta { font-size: 11.5px; color: var(--faint); flex-shrink: 0; }

/* ---- the stage: people who have not joined ---- */

.live-away { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--sunken); }
.live-away-head { font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--faint); margin-bottom: 9px; }

/* ==========================================================================
   Watching a live class

   One column, wide type, no controls unless the instructor has handed them
   back. A student in a live lesson is looking at a board, not driving a page.
   ========================================================================== */

.watch { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; }

.watch-top {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; flex-shrink: 0;
  padding: 16px 24px; border-radius: var(--r-xl); background: var(--surface);
  box-shadow: 7px 7px 16px var(--dark), -7px -7px 16px var(--light);
}
.watch-top h1 { width: 100%; font-size: 24px; letter-spacing: -.025em; line-height: 1.25; }
.watch-top .live-kicker { width: 100%; }
.watch-meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; font-size: 13.5px; color: var(--muted); }
.watch-top .spacer { flex: 1; }

.watch-body {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 30px 40px 36px; border-radius: var(--r-xl); background: var(--surface);
  box-shadow: 7px 7px 16px var(--dark), -7px -7px 16px var(--light);
}
.watch-body .md { max-width: 68ch; margin: 0 auto; font-size: 16.5px; }
.watch-body .q-prompt { font-size: 18px; }

.watch-foot {
  display: flex; align-items: center; justify-content: center; gap: 14px; flex-shrink: 0;
  padding: 12px 18px; border-radius: var(--r-lg); background: var(--surface);
  box-shadow: inset 4px 4px 10px var(--dark), inset -4px -4px 10px var(--light);
}
.watch-foot .faint { font-size: 12.5px; color: var(--faint); }

.watch-empty { text-align: center; padding: 90px 20px; margin: auto; color: var(--muted); }
.watch-empty .big { font-size: 46px; margin-bottom: 14px; }
.watch-empty h2 { font-size: 23px; color: var(--text); margin-bottom: 8px; letter-spacing: -.02em; }
.watch-empty p { font-size: 14.5px; line-height: 1.6; max-width: 44ch; margin: 0 auto; }

@media (max-width: 900px) {
  .watch-body { padding: 22px 20px 26px; }
  .class-grid { grid-template-columns: 1fr; }
}

/* The topic picker on the stage. Capped so "any topic in the course" does not
   push the controls beside it onto their own row. */
.select.stage-topic { max-width: 320px; min-width: 200px; }

/* ==========================================================================
   Practice, results and reports

   Three screens added to the same clay. Nothing new is invented here: the
   practice set reuses the pressed well the compiler sits in, the marksheet
   reuses the panel, and the gradebook reuses the roster table. A revision
   screen that looked like a different product would read as a bolt-on.
   ========================================================================== */

/* ---------- shared: the grade colours ----------
   One hue ramp from the ok green to the err red, used identically on a pill, a
   bar and a band label. A grade must be the same colour everywhere it appears
   or the colour stops meaning anything. */

.g-Aplus, .g-A { color: var(--ok); }
.g-B          { color: #5aa87d; }
.g-C          { color: var(--warn); }
.g-D          { color: #d08f3d; }
.g-E          { color: var(--err); }
.g-none, .g---  { color: var(--faint); }

i.g-Aplus, i.g-A { background: var(--ok); }
i.g-B            { background: #5aa87d; }
i.g-C            { background: var(--warn); }
i.g-D            { background: #d08f3d; }
i.g-E            { background: var(--err); }

.grade-pill {
  display: inline-block; min-width: 34px; text-align: center;
  padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 800;
  background: var(--sunken);
  box-shadow: inset 2px 2px 4px var(--dark), inset -2px -2px 4px var(--light);
}

/* ---------- the shell's course / practice / results switch ---------- */

.seg.nav-seg { margin-right: 4px; }
.seg.nav-seg button { padding: 7px 15px; font-weight: 700; }

/* ---------- practice: the hub ---------- */

.practice-note {
  padding: 15px 20px; margin-bottom: 24px; border-radius: var(--r);
  background: var(--ok-wash); color: var(--text);
  font-size: 14px; line-height: 1.6;
}
.practice-note strong { color: var(--ok); }

.practice-starts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px; margin-bottom: 26px;
}
.practice-start {
  text-align: left; padding: 22px 24px; border-radius: var(--r-lg);
  background: var(--surface); color: var(--text);
  box-shadow: 6px 6px 14px var(--dark), -6px -6px 14px var(--light);
  transition: transform .16s, box-shadow .16s;
}
.practice-start:hover:not(.off) {
  transform: translateY(-2px);
  box-shadow: 8px 8px 18px var(--dark), -8px -8px 18px var(--light);
}
.practice-start.primary { background: var(--accent-wash); }
.practice-start.off { opacity: .55; cursor: not-allowed; }
.ps-kicker {
  font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent);
}
.practice-start h3 { font-size: 19px; font-weight: 750; margin: 8px 0 7px; letter-spacing: -.02em; }
.practice-start p { font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.ps-cta { display: inline-block; margin-top: 14px; font-weight: 750; color: var(--accent); font-size: 14px; }

.practice-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 14px; margin-bottom: 28px;
  padding: 18px 20px; border-radius: var(--r);
  background: var(--surface);
  box-shadow: 3px 3px 7px var(--dark), -3px -3px 7px var(--light);
}

.practice-modules { display: flex; flex-direction: column; gap: 16px; margin-bottom: 28px; }

.practice-history { display: flex; flex-direction: column; gap: 8px; }
.practice-hist {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 13px 18px; border-radius: var(--r); text-align: left;
  background: var(--surface); color: var(--text);
  box-shadow: 3px 3px 7px var(--dark), -3px -3px 7px var(--light);
}
.practice-hist:hover { box-shadow: 5px 5px 10px var(--dark), -5px -5px 10px var(--light); }
.ph-label { flex: 1; font-weight: 650; font-size: 14px; }
.ph-score { font-weight: 800; font-variant-numeric: tabular-nums; }
.ph-score.ok { color: var(--ok); }
.ph-state { font-size: 12.5px; }

/* ---------- practice: the runner ---------- */

.practice-score { margin-bottom: 22px; }
.ps-bar {
  height: 10px; border-radius: 6px; background: var(--sunken); overflow: hidden;
  box-shadow: inset 2px 2px 5px var(--dark);
}
.ps-bar i { display: block; height: 100%; background: var(--accent); border-radius: 6px; transition: width .3s; }
.ps-figures {
  display: flex; align-items: center; gap: 8px; margin-top: 9px;
  font-size: 13px; color: var(--muted);
}
.ps-figures .ok { color: var(--ok); font-weight: 700; }

.practice-questions { display: flex; flex-direction: column; gap: 20px; }

.practice-q {
  padding: 22px 24px; border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: 5px 5px 12px var(--dark), -5px -5px 12px var(--light);
}
/* A solved question recedes; one still open keeps its weight. */
.practice-q.right { opacity: .82; }
.practice-q.wrong { box-shadow: 5px 5px 12px var(--dark), -5px -5px 12px var(--light), inset 3px 0 0 var(--err); }

.pq-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.pq-n {
  width: 30px; height: 30px; flex-shrink: 0; border-radius: 10px;
  display: grid; place-items: center; font-size: 13px; font-weight: 800;
  background: var(--sunken); color: var(--muted);
  box-shadow: inset 2px 2px 4px var(--dark), inset -2px -2px 4px var(--light);
}
.pq-where { flex: 1; min-width: 0; }
.pq-where strong { display: block; font-size: 13.5px; font-weight: 700; }
.pq-where small { font-size: 11.5px; color: var(--faint); }
.tag.bad { background: var(--err-wash); color: var(--err); }

.pq-prompt { font-size: 15px; line-height: 1.65; margin-bottom: 16px; }
.pq-prompt p { margin-bottom: 10px; }
.pq-prompt code {
  font-family: var(--mono); font-size: .88em; padding: 2px 6px; border-radius: 6px;
  background: var(--sunken);
}

.pq-code {
  font-family: var(--mono); font-size: 13px; line-height: 1.6;
  padding: 16px 18px; border-radius: var(--r); margin-bottom: 16px;
  background: var(--sunken); overflow-x: auto;
  box-shadow: inset 3px 3px 7px var(--dark);
}

.pq-options { display: flex; flex-direction: column; gap: 9px; }
.pq-option {
  display: flex; align-items: flex-start; gap: 13px; width: 100%; text-align: left;
  padding: 13px 17px; border-radius: var(--r); font-size: 14.5px; line-height: 1.55;
  background: var(--surface); color: var(--text);
  box-shadow: 3px 3px 7px var(--dark), -3px -3px 7px var(--light);
  transition: box-shadow .14s;
}
.pq-option:hover { box-shadow: 5px 5px 10px var(--dark), -5px -5px 10px var(--light); }
.pq-option.correct { background: var(--ok-wash); box-shadow: inset 3px 3px 6px var(--dark); }
.pq-option.chosen-wrong { background: var(--err-wash); box-shadow: inset 3px 3px 6px var(--dark); }
.pq-letter {
  width: 24px; height: 24px; flex-shrink: 0; border-radius: 8px;
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
  background: var(--sunken); color: var(--muted);
}
.pq-option p { display: inline; }

.pq-feedback { margin-top: 15px; }
.pq-verdict { font-size: 14.5px; font-weight: 750; margin-bottom: 9px; }
.pq-verdict.ok { color: var(--ok); }
.pq-verdict.bad { color: var(--err); }
.pq-explain { font-size: 13.5px; line-height: 1.65; color: var(--muted); margin-bottom: 11px; }
.pq-explain code { font-family: var(--mono); font-size: .88em; }

.pq-checks { font-size: 12.5px; color: var(--muted); margin-bottom: 11px; line-height: 1.55; }
.pq-checks strong { color: var(--text); }
.pq-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; }

.pq-output { margin-top: 14px; display: flex; flex-direction: column; gap: 7px; }
.pq-logs {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
  padding: 13px 16px; border-radius: var(--r-sm);
  background: #0d151b; color: #cfdae4; overflow-x: auto;
}
.pq-test { display: flex; align-items: baseline; gap: 9px; font-size: 13px; }
.pq-test.pass { color: var(--ok); }
.pq-test.fail { color: var(--err); }
.pq-test small { color: var(--faint); font-size: 12px; }
.pq-error {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6;
  padding: 13px 16px; border-radius: var(--r-sm);
  background: var(--err-wash); color: var(--err); white-space: pre-wrap;
}
.pq-solution { margin-top: 10px; font-size: 13px; }
.pq-solution summary { cursor: pointer; color: var(--accent); font-weight: 650; }
.pq-solution pre {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; margin-top: 9px;
  padding: 14px 16px; border-radius: var(--r-sm); background: var(--sunken); overflow-x: auto;
}

.practice-foot { display: flex; gap: 12px; margin-top: 26px; }

/* ---------- results: the marksheet ---------- */

.report-head {
  display: flex; align-items: flex-start; gap: 20px; flex-wrap: wrap;
  margin-bottom: 26px;
}
.rh-left { flex: 1; min-width: 260px; }
.rh-left h1 { font-size: 30px; font-weight: 780; letter-spacing: -.03em; }
.rh-sub { font-size: 14.5px; color: var(--muted); margin-top: 6px; }
.rh-classes { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 11px; }
.rh-right { display: flex; gap: 9px; flex-shrink: 0; }

.report-figures {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px; margin-bottom: 18px;
}
.report-figure {
  padding: 20px 22px; border-radius: var(--r-lg); text-align: center;
  background: var(--surface);
  box-shadow: 5px 5px 12px var(--dark), -5px -5px 12px var(--light);
}
.report-figure b {
  display: block; font-size: 32px; font-weight: 820; letter-spacing: -.03em; line-height: 1.1;
}
.rf-label {
  display: block; margin-top: 6px; font-size: 11.5px; font-weight: 750;
  text-transform: uppercase; letter-spacing: .07em; color: var(--faint);
}
.report-figure small { display: block; margin-top: 8px; font-size: 12px; color: var(--muted); line-height: 1.45; }

.report-note {
  font-size: 13px; line-height: 1.65; color: var(--muted);
  padding: 14px 18px; margin-bottom: 26px; border-radius: var(--r);
  background: var(--surface);
  box-shadow: inset 3px 3px 7px var(--dark), inset -3px -3px 7px var(--light);
}

.report-modules { display: flex; flex-direction: column; gap: 10px; margin-bottom: 26px; }
.report-module {
  border-radius: var(--r); overflow: hidden;
  background: var(--surface);
  box-shadow: 3px 3px 8px var(--dark), -3px -3px 8px var(--light);
}
.rm-head {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 15px 20px; color: var(--text);
}
.rm-num {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 9px;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 800;
  background: var(--sunken); color: var(--muted);
}
.rm-num.done { background: var(--ok-wash); color: var(--ok); }
.rm-title { flex: 1; font-weight: 700; font-size: 14.5px; min-width: 0; }
.rm-fig {
  font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.rm-grade { font-size: 14px; font-weight: 800; min-width: 26px; text-align: right; }
.rm-caret { color: var(--faint); font-size: 11px; width: 12px; }

.rm-topics { display: none; padding: 0 20px 14px; }
.rm-topics.open { display: block; }
.rm-topic {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 14px; border-radius: var(--r-sm); font-size: 13px;
}
.rm-topic:nth-child(odd) { background: var(--sunken); }
.rt-name { flex: 1; min-width: 0; }
.rt-status { font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.rm-topic.s-completed .rt-status { color: var(--ok); }
.rm-topic.s-in-progress .rt-status { color: var(--warn); }
.rt-fig { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

.report-split {
  display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 22px;
}
.report-list { display: flex; flex-direction: column; gap: 10px; }
.rl-row { display: flex; align-items: baseline; gap: 12px; font-size: 13.5px; }
.rl-name { flex: 1; min-width: 0; }
.rl-figure { font-weight: 750; font-variant-numeric: tabular-nums; }
.rl-figure.ok { color: var(--ok); }
.rl-figure.bad { color: var(--err); }
.rl-note { font-size: 12px; }

.report-foot {
  display: flex; gap: 18px; flex-wrap: wrap; justify-content: space-between;
  margin-top: 30px; padding-top: 18px; font-size: 12px; color: var(--faint);
  border-top: 1px solid var(--sunken);
}

/* ---------- reports: the gradebook ---------- */

.reports { display: flex; flex-direction: column; gap: 20px; }
.reports-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.rb-scope { display: flex; gap: 10px; flex-wrap: wrap; flex: 1; }
.rb-scope .input { width: auto; min-width: 180px; }
.rb-actions { display: flex; gap: 9px; }

.reports-top { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

.dist { display: flex; align-items: flex-end; gap: 12px; height: 130px; padding: 0 4px; }
.dist-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.dist-bar {
  flex: 1; width: 100%; display: flex; align-items: flex-end;
  border-radius: var(--r-sm); background: var(--sunken);
  box-shadow: inset 2px 2px 5px var(--dark);
  overflow: hidden;
}
.dist-bar i { display: block; width: 100%; border-radius: var(--r-sm); min-height: 3px; transition: height .3s; }
.dist-n { font-size: 14px; font-weight: 800; margin-top: 8px; font-variant-numeric: tabular-nums; }
.dist-band { font-size: 11.5px; font-weight: 800; }
.dist-figures {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 16px; font-size: 12.5px; color: var(--muted);
}

.att-block { margin-bottom: 18px; }
.att-block:last-child { margin-bottom: 0; }
.att-block h4 {
  font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em;
  color: var(--faint); margin-bottom: 10px;
}
.att-people { display: flex; gap: 8px; flex-wrap: wrap; }
.att-chip {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start;
  padding: 8px 14px; border-radius: var(--r-sm); font-size: 13px; font-weight: 650;
  background: var(--surface); color: var(--text);
  box-shadow: 3px 3px 7px var(--dark), -3px -3px 7px var(--light);
}
.att-chip:hover { box-shadow: 5px 5px 10px var(--dark), -5px -5px 10px var(--light); }
.att-chip small { font-size: 11px; color: var(--faint); font-weight: 600; }
.att-chip.hot { background: var(--err-wash); }
.att-chip.cold { background: var(--sunken); }

.grade-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.grade-table th {
  text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em; color: var(--faint);
  white-space: nowrap;
}
.grade-table td { padding: 12px; vertical-align: middle; }
.grade-table tbody tr:nth-child(odd) { background: var(--sunken); }
.grade-table tbody tr:first-child td:first-child { border-top-left-radius: var(--r-sm); }
.grade-table td small.block { display: block; margin-top: 2px; font-size: 11.5px; }
.link-btn { color: var(--accent); font-weight: 700; text-align: left; }
.link-btn:hover { text-decoration: underline; }

/* ---------- printing ----------
   A report gets printed and emailed. Everything that is a control rather than
   information comes off, the clay flattens to ink on paper, and the module
   breakdown is forced open — a collapsed section prints as a missing section. */

@media print {
  .topbar, .banner, .no-print, .toast-stack, .admin-tabs, .reports-bar,
  .practice-foot, .inst-head .spacer { display: none !important; }

  :root, :root[data-theme="dark"] {
    --bg: #fff; --surface: #fff; --raised: #fff; --sunken: #f4f2ef;
    --text: #1a1a1a; --muted: #444; --faint: #777;
    --dark: rgba(0,0,0,.14); --light: rgba(0,0,0,0);
  }

  body, .shell, .workspace, .dash { background: #fff !important; }
  .dash-inner { max-width: none; padding: 0; }

  .panel, .report-figure, .report-module, .report-note {
    box-shadow: none !important;
    border: 1px solid #ddd;
    break-inside: avoid;
  }

  .rm-topics { display: block !important; }
  .rm-caret { display: none; }

  .grade-table { font-size: 11px; }
  .grade-table td, .grade-table th { padding: 6px 8px; }

  .report-foot { border-top: 1px solid #ccc; }

  @page { margin: 14mm; }
}

@media (max-width: 900px) {
  .report-split, .reports-top { grid-template-columns: 1fr; }
  .practice-starts { grid-template-columns: 1fr; }
  .rm-fig { display: none; }
  .rm-fig:last-of-type { display: block; }
}

/* ==========================================================================
   The editor's pro layer

   Everything here obeys the compiler's one rule: the terminal is monochrome.
   Meaning is carried by brightness, weight and position, never by hue — with a
   single exception for an error, because an error is the one thing that must
   survive being scrolled past, and inverse video is how this interface has
   always said "stop".
   ========================================================================== */

/* ---- decoration layer ----
   Sits under the highlighted text and above the background. Absolutely placed
   from measured character metrics, which is exact because the face is mono. */

.editor-decor { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
.editor-decor > * { position: absolute; top: 14px; left: 16px; }

.editor-active-line {
  width: 100%; left: 0; background: rgba(255, 255, 255, .045);
}
.editor-brace {
  background: rgba(255, 255, 255, .16);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .38);
  border-radius: 2px;
}
.editor-squiggle {
  border-bottom: 2px solid var(--term-bright);
  opacity: .8;
}

.editor-highlight, .editor-input { z-index: 1; }

.gutter div.has-error {
  color: var(--term-bg); background: var(--term-bright);
  font-weight: 800; border-radius: 3px;
}

/* ---- status strip ---- */

.editor-status {
  display: flex; align-items: center; gap: 14px; flex-shrink: 0;
  padding: 6px 16px; font-family: var(--mono); font-size: 11.5px;
  color: var(--term-faint); background: var(--term-bg);
  border-top: 1px solid var(--term-line);
}
.editor-status .spacer { flex: 1; }
.editor-status .faint { color: var(--term-line); }
.editor-status .has-error { color: var(--term-bright); font-weight: 700; }

/* ---- autocomplete ---- */

.editor-complete {
  position: absolute; top: 14px; left: 16px; z-index: 5; min-width: 190px;
  font-family: var(--mono); font-size: 12.5px;
  background: #0b0b0b; border: 1px solid var(--term-line);
  border-radius: 6px; overflow: hidden;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .6);
}
.ec-row {
  display: flex; align-items: center; gap: 10px;
  padding: 5px 11px; cursor: pointer; color: var(--term-fg);
}
.ec-row.on { background: var(--term-bright); color: #000; }
.ec-word { flex: 1; }
.ec-kind { font-size: 10px; letter-spacing: .05em; text-transform: uppercase; opacity: .55; }
.ec-row.on .ec-kind { opacity: .7; }

/* ---- find and replace ---- */

.editor-find {
  display: flex; align-items: center; gap: 6px; flex-shrink: 0;
  padding: 7px 12px; background: #0b0b0b;
  border-bottom: 1px solid var(--term-line);
}
/* An author `display` beats the user-agent's `[hidden] { display: none }`, so
   the attribute has to be honoured explicitly or the bar is always open. */
.editor-find[hidden] { display: none; }
.editor-complete[hidden] { display: none; }
.ef-input {
  background: var(--term-bg); color: var(--term-fg);
  border: 1px solid var(--term-line); border-radius: 5px;
  padding: 4px 9px; font-family: var(--mono); font-size: 12.2px; min-width: 0; flex: 1;
}
.ef-input:focus { outline: none; border-color: var(--term-bright); }
.ef-count {
  font-family: var(--mono); font-size: 11px; color: var(--term-faint);
  white-space: nowrap; min-width: 62px;
}
.ef-btn {
  background: transparent; color: var(--term-dim);
  border: 1px solid var(--term-line); border-radius: 5px;
  padding: 3px 9px; font-family: var(--mono); font-size: 11.5px; white-space: nowrap;
}
.ef-btn:hover { color: #000; background: var(--term-bright); border-color: var(--term-bright); }

@media (max-width: 720px) {
  .editor-find { flex-wrap: wrap; }
  .editor-status { font-size: 10.5px; gap: 9px; }
  .editor-status .faint { display: none; }
}

/* An error the student can act on: the line number is a button back to it. */
.err-box { display: flex; align-items: baseline; gap: 10px; }
.err-jump {
  flex-shrink: 0; font-family: var(--mono); font-size: 11.5px; font-weight: 700;
  padding: 2px 8px; border-radius: 4px;
  background: var(--term-bright); color: #000;
}
.err-jump:hover { opacity: .82; }

/* ---- the invite landing page ----
   Shares the sign-in layout, so somebody arriving from a link lands somewhere
   that already looks like the product rather than a bare form. */

.invite-box {
  padding: 18px 20px; margin: 18px 0; border-radius: var(--r);
  background: var(--accent-wash);
}
.invite-box h2 {
  font-size: 22px; font-weight: 780; letter-spacing: -.02em; margin: 6px 0 8px;
}
.invite-box .join-kicker {
  font-size: 11px; font-weight: 800; letter-spacing: .09em;
  text-transform: uppercase; color: var(--accent);
}
.invite-box .join-meta {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 13.5px; color: var(--muted);
}
.invite-box .join-desc { margin-top: 10px; font-size: 13.5px; color: var(--muted); line-height: 1.6; }

.field-hint { display: block; margin-top: 6px; font-size: 12px; color: var(--faint); line-height: 1.5; }

.join-card.standalone {
  max-width: 460px; margin: auto; text-align: center;
  padding: 40px 34px; border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: 8px 8px 20px var(--dark), -8px -8px 20px var(--light);
}
