/* CodeLab — only the bits Ant Design doesn't cover: base sizing, the exercise
   card grid, the CodeMirror host, the preview iframe, and code output blocks.
   Everything else is themed through antd tokens (see src/theme.js). */

:root, :root[data-theme='dark'] {
  /* Accent family — customizable. These are the default (violet) fallbacks;
     src/accent.js overrides them on :root from the user's chosen colour. The
     dark theme uses the lighter 400 for --accent, the light theme the 600. */
  --accent-400: #a78bfa; --accent-500: #8b5cf6; --accent-600: #7c3aed; --accent-700: #6d28d9;
  --accent-rgb: 139, 92, 246; --accent-400-rgb: 167, 139, 250; --accent-600-rgb: 124, 58, 237;
  --page-fg: #ededf0; --hairline: #2b2b31; --accent: var(--accent-400);
  --muted: #8b8b96;       /* secondary/label text (was hardcoded inline across views) */
  --chrome: #0f0f11;      /* top bar + sidebar (darkest layer) */
  --content-bg: #161618;  /* content panel (a bit lighter) */
  --content-bg-rgb: 22, 22, 24; /* for rgba() fades that blend into the content panel */
  --elevated-bg: #26262b; /* modals / popovers (matches antd colorBgElevated) */
  --scroll-thumb: #3a3a42; --scroll-thumb-hover: #50505b;
  --ok: #34d399; --ok-bg: rgba(52, 211, 153, 0.16); /* "graded" signal */
  /* Semantic status colours. JS hex mirror in src/lib/constants.js (SEMANTIC) for
     chart props that need a real colour; plain DOM uses these vars directly. */
  --success: #34d399; --danger: #f36f6f; --warning: #e0a04a; --info: #3b82f6;
}
:root[data-theme='light'] {
  --page-fg: #1a1a1f; --hairline: #e6e6ea; --accent: var(--accent-600);
  --chrome: #ffffff;      /* top bar + sidebar (white) */
  --content-bg: #edeff3;  /* content panel (soft grey, darker than the chrome) */
  --content-bg-rgb: 237, 239, 243;
  --elevated-bg: #ffffff; /* modals / popovers (matches antd colorBgElevated) */
  --scroll-thumb: #cbced6; --scroll-thumb-hover: #aeb2bd;
  --ok: #16a34a; --ok-bg: rgba(22, 163, 74, 0.12);
  --success: #16a34a; --danger: #dc2626; --warning: #d97706; --info: #2563eb;
}

/* Corner-radius scale — the only rounding values used across the app. Theme-
   independent (rounding doesn't change between light/dark). AntD components round
   via the `borderRadius` token in src/theme.js, kept in sync with --radius-md.
   The JS mirror of this scale lives in src/lib/constants.js (RADIUS). Circles use
   50% directly; fully-rounded badges/bars use --pill. */
:root {
  --radius-xs: 2px;   /* tags, chips, tiny dots */
  --radius-sm: 3px;   /* code spans, small controls */
  --radius-md: 5px;   /* buttons, inputs, list rows, cards */
  --radius-lg: 8px;   /* panels, larger cards */
  --radius-xl: 12px;  /* hero / large containers */
  --pill: 999px;      /* fully-rounded badges, progress bars */
}

html, body, #root { height: 100%; margin: 0; }
/* App shell height: dvh tracks the *visible* viewport on mobile (excludes the
   browser address bar), so nothing gets pushed below the fold. vh is the
   fallback for browsers without dvh. */
.app-shell { height: 100vh; height: 100dvh; }
body { background: var(--chrome); color: var(--page-fg); font-family: system-ui, "Segoe UI", Roboto, sans-serif; }

/* Custom scrollbars — themed to match the charcoal / light surfaces. Chromium
   (the classroom browsers) uses ::-webkit-scrollbar; Firefox uses scrollbar-*.
   The thumb follows the active theme; always-dark surfaces (code output, the
   editor) override it below so a light thumb never sits on a dark block. */
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb); border-radius: var(--radius-md);
  border: 2px solid transparent; background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); background-clip: padding-box; }
*::-webkit-scrollbar-corner { background: transparent; }

/* Always-dark surfaces keep a dark thumb regardless of the app theme. */
.code-out, .console-panel, .markdown-body pre, .editor-host .cm-scroller {
  scrollbar-color: #45454f transparent;
}
.code-out::-webkit-scrollbar-thumb, .console-panel::-webkit-scrollbar-thumb,
.markdown-body pre::-webkit-scrollbar-thumb, .editor-host .cm-scroller::-webkit-scrollbar-thumb {
  background: #45454f; background-clip: padding-box;
}
.code-out::-webkit-scrollbar-thumb:hover, .console-panel::-webkit-scrollbar-thumb:hover,
.markdown-body pre::-webkit-scrollbar-thumb:hover, .editor-host .cm-scroller::-webkit-scrollbar-thumb:hover {
  background: #5a5a66; background-clip: padding-box;
}

/* Top bar (horizontal padding is set inline to beat antd's injected style) */
.topbar { display: flex; align-items: center; gap: 16px; height: 60px; }

/* Content panel: rounded top-left corner reveals the chrome as an inner curve.
   With the teacher rail present, the top-right corner mirrors it. */
.content-panel { background: var(--content-bg); border-top-left-radius: var(--radius-xl); }
.content-panel.has-rail { border-top-right-radius: var(--radius-xl); }
.topbar-search { flex: 1; max-width: 620px; margin: 0 auto; }

/* Sidebar nav — the active item gets a vivid, filled violet background
   (overrides the faint translucent highlight from the Menu theme tokens). */
.side-menu .ant-menu-item-selected::after { display: none; } /* drop antd's default marker */
/* One item shape for every state — flush left edge, rounded right corners — so
   the hover tint matches the selected pill exactly. */
.side-menu .ant-menu-item {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
}
.side-menu .ant-menu-item-selected {
  background: linear-gradient(135deg, var(--accent-500) 0%, var(--accent-600) 100%) !important;
}
.side-menu .ant-menu-item-selected,
.side-menu .ant-menu-item-selected .anticon,
.side-menu .ant-menu-item-selected .ant-menu-title-content,
.side-menu .ant-menu-item-selected a { color: #fff !important; }
.side-menu .ant-menu-item-selected .ant-menu-title-content { font-weight: 600; }

/* Two-line items: the name with a short muted caption under it. Scoped to the
   expanded rail — when collapsed AntD hides the label (caption included) and the
   plain `title` shows as a tooltip, so the collapsed icon row stays untouched. */
.side-menu:not(.ant-menu-inline-collapsed) .ant-menu-item {
  height: auto !important; line-height: 1.3 !important;
  padding-top: 6px !important; padding-bottom: 6px !important;
  display: flex; align-items: center;
}
.side-menu .ant-menu-item .ant-menu-title-content { min-width: 0; }
.side-item { display: flex; flex-direction: column; min-width: 0; }
.side-item-label { font-size: 13.5px; font-weight: 500; line-height: 1.3; }
.side-item-desc {
  font-size: 10.5px; font-weight: 400; line-height: 1.25; margin-top: 1px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.side-menu .ant-menu-item-selected .side-item-label { font-weight: 600; }
.side-menu .ant-menu-item-selected .side-item-desc { color: rgba(255, 255, 255, 0.82); }

/* Sectioned sidebar: brand on top, scrolling grouped menu, user panel docked
   at the bottom. */
.side-brand-head { padding: 16px 16px 10px; }
.side-brand-head.collapsed { padding: 16px 0 10px; display: grid; place-items: center; }
.side-menu-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 10px 8px 4px; }
/* The menu's scrollbar thumb only shows while hovering the sidebar — the gutter
   stays reserved, so nothing shifts; the track is always transparent. */
.side-menu-scroll { scrollbar-color: transparent transparent; }
.side-menu-scroll:hover { scrollbar-color: var(--scroll-thumb) transparent; }
.side-menu-scroll::-webkit-scrollbar-thumb { background: transparent; background-clip: padding-box; }
.side-menu-scroll:hover::-webkit-scrollbar-thumb { background: var(--scroll-thumb); background-clip: padding-box; }
.side-menu-scroll:hover::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); background-clip: padding-box; }
/* Section labels (MAIN / TEACHING / …) */
.side-menu.ant-menu .ant-menu-item-group-title {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
  color: #6d6d77; padding: 14px 12px 6px;
}
.side-menu.ant-menu-inline .ant-menu-item-group:first-child .ant-menu-item-group-title { padding-top: 4px; }

/* Docked user panel */
.side-user {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  margin: 6px 8px 8px; border-radius: var(--radius-lg); border: 1px solid var(--hairline); background: var(--content-bg);
}
.side-user.collapsed { justify-content: center; padding: 10px 0; background: transparent; border-color: transparent; }
.side-user-meta { flex: 1; min-width: 0; }
.side-user-name { font-size: 13px; font-weight: 600; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-role { font-size: 11px; color: #8b8b96; }
.side-user-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.side-user-actions .ant-btn { color: #8b8b96; }
.side-user-actions .ant-btn:hover { color: var(--accent); }

/* Quick-tip card — pinned to the bottom of a student's short menu, just
   above the docked user panel. */
.side-tips {
  margin: 0 8px; padding: 12px 12px 13px; flex-shrink: 0;
  border-radius: var(--radius-lg); border: 1px solid var(--hairline); background: var(--content-bg);
}
.side-tips-head {
  display: flex; align-items: center; gap: 6px; margin-bottom: 6px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent);
}
.side-tips-body { font-size: 12.5px; line-height: 1.45; color: #8b8b96; }

/* Accent swatches on the Options page */
.opt-swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.opt-swatch {
  width: 34px; height: 34px; border-radius: var(--radius-md); border: 2px solid transparent; cursor: pointer;
  display: grid; place-items: center; color: #fff; font-size: 13px; padding: 0; position: relative;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15) inset; transition: transform 0.1s ease;
}
.opt-swatch:hover { transform: scale(1.08); }
.opt-swatch.active { border-color: var(--page-fg); }
.opt-custom { overflow: hidden; }
.opt-custom input[type="color"] {
  opacity: 0; width: 100%; height: 100%; padding: 0; border: none; cursor: pointer;
}

/* Student "Mark as complete" toggle — reads green (the "done" signal) once set,
   distinct from the accent-coloured primary buttons. */
.complete-toggle.is-done.ant-btn { color: var(--ok); border-color: var(--ok); }
.complete-toggle.is-done.ant-btn:hover { color: var(--ok); border-color: var(--ok); opacity: 0.85; }

/* Exercise cards — a richer, more inviting layout for students. */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 18px; }
.card-grid .ant-card { height: 100%; }

.card-grid .ant-card.ex-card {
  position: relative; overflow: hidden; border-radius: var(--radius-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card-grid .ant-card.ex-card:hover {
  transform: translateY(-4px); border-color: var(--accent);
  box-shadow: 0 16px 34px -16px rgba(0, 0, 0, 0.5);
}

.ex-head { display: flex; align-items: flex-start; gap: 11px; }
/* Language marker: a bare coloured glyph, no tile behind it. The colour alone
   codes the language; the fixed box only reserves space so the card headers
   stay aligned down the grid. */
.ex-tile {
  width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center;
  font-weight: 700; font-size: 20px; letter-spacing: -0.03em;
  font-family: "Cascadia Code", Consolas, monospace;
}
.ex-tile .anticon { font-size: 22px; }
.ex-tile.web { color: var(--accent-400); }
.ex-tile.php { color: #fbbf24; }
.ex-head-main { flex: 1; min-width: 0; }
.ex-lang { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; color: #8b8b96; }
.ex-pills { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

.ex-title { font-size: 16px; font-weight: 600; line-height: 1.3; margin-top: 13px; }

.ex-status {
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; white-space: nowrap;
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 0;
}
.ex-status .anticon { font-size: 12px; }
.ex-status.done { color: var(--ok); background: var(--ok-bg); }
.ex-status.submitted { color: var(--accent); background: rgba(var(--accent-rgb), 0.18); }
.ex-status.new { color: #8b8b96; background: rgba(140, 140, 150, 0.15); }
/* Square the antd tags (category / course / exam / draft) on cards to match. */
.ex-card .ant-tag { border-radius: 0; }

.ex-foot { margin-top: auto; padding-top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ex-meta { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #8b8b96; }
.ex-meta.due-past { color: #f36f6f; }
.ex-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600;
  color: var(--accent); background: rgba(var(--accent-rgb), 0.14); padding: 2px 9px; border-radius: 0;
}
.ex-actions { margin-top: 12px; }
.ex-select { flex-shrink: 0; }

/* Bulk publish/unpublish bar — appears above the grid/list once items are checked. */
.bulk-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 14px; margin-bottom: 16px; border-radius: var(--radius-md);
  background: rgba(var(--accent-rgb), 0.12); border: 1px solid var(--accent);
}
.bulk-bar-count { font-size: 13px; font-weight: 600; }

/* Compact list view (Outlook-style rows) — an alternative to the card grid. */
/* flex-shrink:0 so the list keeps its full height inside the flex-column
   .page-body — otherwise overflow:hidden (for the rounded corners) makes it
   shrink and clip rows instead of letting .page-scroll scroll. */
.ex-list { border: 1px solid var(--hairline); border-radius: var(--radius-md); overflow: hidden; flex-shrink: 0; }
.ex-row {
  display: flex; align-items: center; gap: 12px; padding: 9px 14px; cursor: pointer;
  border-top: 1px solid var(--hairline); transition: background 0.12s ease;
}
.ex-row:first-child { border-top: none; }
.ex-row:hover { background: rgba(var(--accent-rgb), 0.06); }
.ex-tile.sm { width: 34px; height: 34px; border-radius: var(--radius-md); font-size: 14px; }
.ex-row-main { flex: 1; min-width: 0; }
.ex-row-title { display: flex; align-items: center; gap: 7px; min-width: 0; }
.ex-row-name {
  flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 14px; font-weight: 600;
}
.ex-row-sub {
  font-size: 12.5px; color: #8b8b96; margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ex-row-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ex-row-actions { flex-shrink: 0; margin-left: 4px; }
.ex-row.locked { opacity: 0.55; filter: grayscale(0.5); }

/* Contests — status-coloured cards; a pulsing dot marks a live contest. */
.join-card .join-icon {
  width: 42px; height: 42px; display: grid; place-items: center; flex-shrink: 0;
  color: var(--accent-400); font-size: 24px;
}
.join-input { width: 190px; letter-spacing: 0.12em; font-weight: 600; text-align: center; }

.card-grid .ant-card.contest-card {
  position: relative; overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card-grid .ant-card.contest-card:hover { transform: translateY(-4px); box-shadow: 0 16px 34px -16px rgba(0, 0, 0, 0.5); }
.contest-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; }
.contest-card.st-running::before { background: linear-gradient(90deg, #34d399, #10b981); }
.contest-card.st-running:hover { border-color: #10b981; }
.contest-card.st-lobby::before { background: linear-gradient(90deg, var(--accent-400), var(--accent-600)); }
.contest-card.st-lobby:hover { border-color: var(--accent); }
.contest-card.st-ended::before { background: var(--hairline); }

.ct-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ct-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: var(--pill); }
.ct-status.running { color: #10b981; background: rgba(16, 185, 129, 0.15); }
.ct-status.lobby { color: var(--accent); background: rgba(var(--accent-rgb), 0.16); }
.ct-status.ended { color: #8b8b96; background: rgba(140, 140, 150, 0.15); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #10b981; animation: live-pulse 1.6s infinite; }
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  70% { box-shadow: 0 0 0 7px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}
.ct-people { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #8b8b96; }
.ct-title { font-size: 16px; font-weight: 600; line-height: 1.3; margin-top: 12px; }
.ct-sub { font-size: 13px; color: #8b8b96; margin-top: 2px; }
.ct-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.ct-chip {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500;
  padding: 2px 9px; border-radius: var(--pill); border: 1px solid var(--hairline); color: #8b8b96;
}
.ct-chip .anticon { font-size: 12px; }
.ct-chip.lang-web { color: #b37feb; border-color: rgba(var(--accent-rgb), 0.35); background: rgba(var(--accent-rgb), 0.1); }
.ct-chip.lang-php { color: #e0a04a; border-color: rgba(217, 119, 6, 0.35); background: rgba(217, 119, 6, 0.1); }
.ct-code { margin-top: 11px; font-size: 13px; color: #8b8b96; }
.ct-code b { color: var(--accent); letter-spacing: 0.1em; font-size: 15px; }
.ct-foot { margin-top: auto; padding-top: 14px; }

/* Student grade "hero" — the payoff on their own submissions. */
.grade-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 12px;
  padding: 14px; border-radius: var(--radius-lg); background: var(--chrome); border: 1px solid var(--hairline); }
.grade-badge { width: 66px; height: 66px; border-radius: var(--radius-lg); flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-weight: 700; line-height: 1; }
.grade-badge .grade-num { font-size: 25px; }
.grade-badge .grade-den { font-size: 12px; opacity: 0.8; margin-top: 3px; }
.grade-badge[data-tier='good'] { color: var(--ok); background: var(--ok-bg); }
.grade-badge[data-tier='ok']   { color: var(--accent); background: rgba(var(--accent-rgb), 0.18); }
.grade-badge[data-tier='low']  { color: #e0a04a; background: rgba(217, 119, 6, 0.16); }
.grade-badge[data-tier='poor'] { color: #f36f6f; background: rgba(243, 111, 111, 0.16); }
.grade-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: #8b8b96; }
.grade-word { font-size: 17px; font-weight: 600; margin-top: 2px; }
.grade-pending { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; color: #8b8b96; }
.grade-pending .anticon { color: var(--accent); }
.grade-feedback { margin-top: 10px; font-size: 13px; line-height: 1.55;
  padding: 9px 12px; border-radius: var(--radius-md); border-left: 3px solid var(--accent); background: rgba(var(--accent-rgb), 0.08); }

/* Contest podium (top 3) — celebratory finish */
@keyframes podium-rise { from { transform: translateY(28px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.podium { display: flex; justify-content: center; align-items: flex-end; gap: 18px; padding: 8px 0 4px; flex-wrap: wrap; }
.podium-col { display: flex; flex-direction: column; align-items: center; animation: podium-rise .5s ease both; }
.podium-name { font-weight: 600; margin-top: 8px; text-align: center; max-width: 150px; line-height: 1.2; }
.podium-result { color: #a2a2ab; font-size: 13px; margin-top: 2px; }
.podium-block {
  width: 128px; margin-top: 10px; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex; align-items: flex-start; justify-content: center; padding-top: 10px;
  font-size: 30px; box-shadow: 0 -4px 24px -8px rgba(0,0,0,.5);
}
.podium-1 { height: 132px; background: linear-gradient(180deg, #fde68a, #f59e0b); }
.podium-2 { height: 102px; background: linear-gradient(180deg, #e5e7eb, #9ca3af); }
.podium-3 { height: 82px;  background: linear-gradient(180deg, #fed7aa, #d97706); }
/* The trophy replaces the medal emoji, so the place has to read from the block
   itself: a dark trophy on gold, silver and bronze. */
.podium-block .anticon { font-size: 26px; color: rgba(0, 0, 0, 0.45); }
.podium-1 .anticon { color: #7c4a03; }
.podium-2 .anticon { color: #4b5563; }
.podium-3 .anticon { color: #7c2d12; }

/* CodeMirror host */
.editor-host { border: 1px solid var(--hairline); border-radius: var(--radius-md); overflow: hidden; height: 100%; }
.editor-host .cm-editor { height: 100%; font-size: var(--cm-font-size, 13.5px); }
.editor-host .cm-scroller { overflow: auto; font-family: "Cascadia Code", Consolas, monospace; }

/* Workspace split — a resizable Splitter hosts the editor and output panes.
   Students switch between side-by-side and stacked and drag the divider. */
.ws-split-host { flex: 1; min-height: 0; }
.ws-split-host .ant-splitter { height: 100%; }
.ws-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
/* Keep pane content off the drag bar. */
.ws-splitter.ant-splitter-horizontal > .ant-splitter-panel:first-child .ws-pane { padding-right: 12px; }
.ws-splitter.ant-splitter-horizontal > .ant-splitter-panel:last-child .ws-pane { padding-left: 12px; }
.ws-splitter.ant-splitter-vertical > .ant-splitter-panel:first-child .ws-pane { padding-bottom: 12px; }
.ws-splitter.ant-splitter-vertical > .ant-splitter-panel:last-child .ws-pane { padding-top: 12px; }
.ws-preview { flex: 1; min-height: 0; width: 100%; border: 1px solid #2b2b31; border-radius: var(--radius-md); background: #fff; }

/* IDE-like pane headers (Editor / Preview / Output). */
.ws-pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 2px 8px; min-height: 22px; }
.ws-pane-title {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em; color: #8b8b96;
}
.ws-pane-title .anticon { font-size: 13px; color: var(--accent); }
.ws-save { font-size: 12px; color: #8b8b96; white-space: nowrap; }
.ws-head-actions { display: inline-flex; align-items: center; gap: 8px; }
.ws-max-btn.ant-btn { color: #8b8b96; }
.ws-max-btn.ant-btn:hover { color: var(--accent); }

/* Keyboard-shortcut hints (the workspace "?" popover). */
.kbd-hints { display: grid; gap: 9px; min-width: 210px; }
.kbd-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.kbd-keys { display: inline-flex; align-items: center; gap: 4px; }
.kbd-keys span { font-size: 12px; color: #8b8b96; }
.kbd-label { font-size: 13px; color: var(--page-fg); }
.kbd-hints kbd {
  display: inline-block; min-width: 22px; text-align: center; padding: 1px 6px;
  font-family: "Cascadia Code", Consolas, monospace; font-size: 12px; line-height: 18px; color: var(--page-fg);
  background: var(--chrome); border: 1px solid var(--hairline); border-radius: var(--radius-sm); box-shadow: 0 1px 0 var(--hairline);
}
/* Column so the single editor child stretches to full width (a row flex
   container would shrink it to its content width — a tiny editor). */
.ws-editor-wrap { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* A cohesive action bar under the editor: actions left, status/attempt right. */
.ws-toolbar {
  margin-top: 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 10px; border: 1px solid var(--hairline); border-radius: var(--radius-md); background: var(--chrome);
}
.ws-toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.ws-instructions-label { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.ws-instructions-label .anticon { color: var(--accent); }

/* Console + code output */
.ws-subhead { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: #6d6d77; }
.console-panel { margin-top: 10px; max-height: 9rem; overflow: auto; background: #0f0f11; border: 1px solid #2b2b31; border-radius: var(--radius-md); padding: 8px 12px; }
.console-lines { font-family: "Cascadia Code", Consolas, monospace; font-size: 12.5px; margin-top: 4px; }
.code-out {
  margin: 0; padding: 12px 14px; background: #0f0f11; border: 1px solid #2b2b31; border-radius: var(--radius-md);
  font-family: "Cascadia Code", Consolas, monospace; font-size: 12.5px; white-space: pre-wrap; overflow: auto; color: #ededf0;
}
.code-out.status-error { border-color: #f36f6f; }
.code-out.status-timeout { border-color: #f2c14e; }

/* ---------------------------------------------------------------------------
   VS Code-like student IDE. The chrome is always dark to match the (always
   dark) CodeMirror editor, regardless of the app's light/dark theme. */
.ws-ide {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  border: 1px solid #101013; border-radius: var(--radius-sm); overflow: hidden;
  background: #1e1e1e; box-shadow: 0 12px 34px -20px rgba(0, 0, 0, 0.65);
}
.ws-ide-body { flex: 1; min-height: 0; display: flex; }
.ws-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
/* Full-window overlay (in-app; z-index stays below antd modals/toasts so the
   submit/reset confirmations and messages still appear on top). */
.ws-ide.fullscreen { position: fixed; inset: 0; z-index: 900; border: none; border-radius: 0; }

/* Activity bar (left rail) */
.ws-activitybar {
  width: 48px; flex-shrink: 0; display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 8px 0; background: #26262b; border-right: 1px solid #101013;
}
/* Icon-only rail: no background chips — bigger icons that brighten on hover,
   with a thin left accent bar marking the active tool. */
.ws-act {
  width: 44px; height: 44px; display: grid; place-items: center; cursor: pointer; font-size: 25px;
  background: transparent; border: none; color: #8b8b96; position: relative;
  transition: color 0.15s ease, transform 0.1s ease;
}
.ws-act:hover:not(:disabled) { color: #ededf0; transform: scale(1.06); }
.ws-act.active { color: #fff; }
.ws-act.active::before {
  content: ''; position: absolute; left: -2px; top: 9px; bottom: 9px; width: 2.5px;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0; background: var(--accent);
}
.ws-act:disabled { opacity: 0.34; cursor: default; }
/* Primary actions read at a glance: Run green, Submit violet. */
.ws-act-run { color: #4ade80; }
.ws-act-run:hover:not(:disabled) { color: #22c55e; }
.ws-act-submit { color: var(--accent); }
.ws-act-submit:hover:not(:disabled) { color: #b8a5f5; }
.ws-act-hint { color: #f2c14e; }
.ws-act-hint:hover:not(:disabled) { color: #f59e0b; }
/* Hints modal */
.hint-item { margin-bottom: 14px; }
.hint-num { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); font-weight: 700; margin-bottom: 2px; }

/* Instructions side panel */
.ws-sidepanel {
  position: relative; width: 300px; flex-shrink: 0; display: flex; flex-direction: column; min-height: 0;
  background: #202023; border-right: 1px solid #101013;
}
/* Draggable right edge of the instructions panel. */
.ws-sidepanel-resizer { position: absolute; top: 0; right: -2px; width: 6px; height: 100%; z-index: 3; cursor: col-resize; }
.ws-sidepanel-resizer:hover { background: var(--accent); opacity: 0.6; }
.ws-col-resizing { cursor: col-resize; user-select: none; }
.ws-col-resizing iframe { pointer-events: none; }
.ws-sidepanel-head {
  height: 34px; flex-shrink: 0; display: flex; align-items: center; padding: 0 14px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #9a9aa4; font-weight: 600;
}
.ws-sidepanel-body { flex: 1; min-height: 0; overflow: auto; padding: 2px 14px 14px; color: #d4d4d4; }

/* Guided lesson panel (Codecademy-style step-by-step). The checklist ticks
   itself as the student's code satisfies each instruction, in order. */
.ws-lesson-count { margin-left: auto; font-weight: 600; color: #8b8b96; text-transform: none; letter-spacing: 0; }
.ws-lesson-bar { height: 3px; flex-shrink: 0; background: #2b2b31; }
.ws-lesson-bar > div { height: 100%; background: var(--accent); transition: width 0.3s ease; }
.ws-lesson-step-title {
  display: flex; align-items: baseline; gap: 8px; font-size: 14px; font-weight: 700;
  color: #e8e8ec; margin: 10px 0 4px;
}
.ws-lesson-step-no {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--accent); background: rgba(var(--accent-rgb), 0.14); padding: 1px 7px; border-radius: var(--pill); white-space: nowrap;
}
.ws-lesson-tasks { margin-top: 10px; border-top: 1px solid #2b2b31; padding-top: 8px; }
.ws-lesson-tasks-head {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #9a9aa4;
  font-weight: 600; margin-bottom: 6px;
}
.ws-lesson-task { display: flex; gap: 9px; padding: 7px 8px; border-radius: var(--radius-md); margin-bottom: 4px; opacity: 0.55; }
.ws-lesson-task.active { opacity: 1; background: rgba(var(--accent-rgb), 0.08); outline: 1px solid rgba(var(--accent-rgb), 0.25); }
.ws-lesson-task.done { opacity: 0.85; }
.ws-lesson-tick { flex-shrink: 0; margin-top: 2px; font-size: 15px; color: #54d38a; }
.ws-lesson-task.done .ws-lesson-tick .anticon { animation: lesson-pop 0.25s ease; }
@keyframes lesson-pop { 0% { transform: scale(0.4); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }
.ws-lesson-circle { display: block; width: 14px; height: 14px; border: 1.5px solid #6b6b76; border-radius: 50%; margin-top: 1px; }
.ws-lesson-task-body { min-width: 0; flex: 1; font-size: 13px; }
.ws-lesson-task-body .markdown-body p { margin: 0 0 4px; }
.ws-lesson-task.done .ws-lesson-task-body { color: #9a9aa4; }
.ws-lesson-fail { margin-top: 6px; color: #f36f6f; font-size: 12.5px; font-family: "Cascadia Code", Consolas, monospace; }
.ws-lesson-hint { margin-top: 10px; font-size: 12px; color: #8b8b96; font-style: italic; }
.ws-lesson-nav {
  flex-shrink: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 12px; border-top: 1px solid #101013;
}
/* OBE learning outcomes — announced at the start, confirmed on completion. */
.ws-lesson-outcomes {
  margin: 10px 0; padding: 10px 12px; border-radius: var(--radius-md);
  background: rgba(var(--accent-rgb), 0.08); border: 1px solid rgba(var(--accent-rgb), 0.22);
}
.ws-lesson-outcomes.attained { background: rgba(84, 211, 138, 0.08); border-color: rgba(84, 211, 138, 0.25); }
.ws-lesson-outcomes-intro { font-size: 12px; color: #9a9aa4; margin-bottom: 6px; }
.ws-lesson-outcomes ul { margin: 0; padding: 0; list-style: none; }
.ws-lesson-outcomes li {
  display: flex; gap: 8px; align-items: baseline; font-size: 12.5px; color: #d4d4d4; padding: 3px 0;
}
.ws-lesson-outcomes li .anticon { color: var(--accent); flex-shrink: 0; position: relative; top: 1px; }
.ws-lesson-outcomes.attained li .anticon { color: #54d38a; }

/* Lessons catalogue — course banner above the chapters */
.lesson-course { margin-bottom: 34px; }
.lesson-course-head {
  display: flex; align-items: baseline; gap: 10px; margin-bottom: 16px; padding: 10px 14px;
  border-radius: var(--radius-lg); background: rgba(var(--accent-rgb), 0.10); border: 1px solid rgba(var(--accent-rgb), 0.25);
}
.lesson-course-head .anticon { color: var(--accent); position: relative; top: 1px; }
.lesson-course-code { font-size: 15px; font-weight: 800; letter-spacing: 0.04em; color: var(--accent); }
.lesson-course-title { font-size: 15px; font-weight: 700; }

/* Lessons catalogue — chapters + sequential locking */
.lesson-chapter { margin-bottom: 28px; }
.lesson-chapter-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  margin: 0 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--hairline);
}
.lesson-chapter-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.lesson-chapter-progress { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: #8b8b96; white-space: nowrap; }
.lesson-chapter-bar {
  display: inline-block; width: 90px; height: 5px; border-radius: var(--pill); background: rgba(var(--accent-rgb), 0.15); overflow: hidden;
}
.lesson-chapter-bar > span { display: block; height: 100%; background: var(--accent); border-radius: var(--pill); transition: width 0.3s ease; }
/* Dial the accent back on the Lessons grid: the per-card badges become neutral
   info chips, so the violet reads as occasional anchors (course code, progress
   bar) instead of covering the page. Scoped to .lesson-course so the shared
   Exercises grid keeps its own styling. */
.lesson-course .ex-badge { color: var(--muted); background: rgba(140, 140, 150, 0.12); }
.ex-card.locked { opacity: 0.55; filter: grayscale(0.5); }
.ex-card.locked:hover { transform: none; box-shadow: none; }

/* Top-bar search — body snippets + match highlight */
.ts-snippet {
  font-size: 11.5px; color: #8b8b96; margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ts-hl { background: rgba(var(--accent-rgb), 0.28); color: inherit; padding: 0 1px; border-radius: var(--radius-xs); }

/* Gradebook grid */
.gb-cell {
  min-width: 40px; padding: 3px 8px; font-weight: 700; font-size: 13px; cursor: pointer;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-md); font-family: inherit;
}
.gb-cell:hover { border-color: var(--accent); background: rgba(var(--accent-rgb), 0.08); }
.gb-ungraded { color: #e0a04a; font-size: 18px; line-height: 1; }
.gb-col-head {
  max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block;
  background: none; border: none; cursor: pointer; font: inherit; font-size: 11.5px; font-weight: 600;
  color: inherit; padding: 0;
}
.gb-col-head:hover { color: var(--accent); text-decoration: underline; }

/* Outcome attainment report (OBE) */
.ob-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.ob-tile-num { font-size: 26px; font-weight: 700; line-height: 1.1; }
.ob-tile-label { font-size: 12px; color: #8b8b96; margin-top: 2px; }
.ob-list { margin: 0; padding: 0; list-style: none; }
.ob-list li { display: flex; gap: 7px; align-items: baseline; font-size: 12.5px; padding: 2px 0; }
.ob-list li .anticon { color: var(--accent); flex-shrink: 0; position: relative; top: 1px; }

/* Lesson builder (teacher page) */
.lb-step-row {
  padding: 5px 6px 5px 10px; border-radius: var(--radius-md); cursor: pointer; border: 1px solid transparent;
}
.lb-step-row:hover { background: rgba(var(--accent-rgb), 0.07); }
.lb-step-row.active { background: rgba(var(--accent-rgb), 0.12); border-color: rgba(var(--accent-rgb), 0.35); }
.lb-step-no {
  width: 20px; height: 20px; flex-shrink: 0; display: grid; place-items: center; font-size: 11px;
  font-weight: 700; color: var(--accent); background: rgba(var(--accent-rgb), 0.14); border-radius: 50%;
}
.lb-step-title { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-step-acts { display: none; flex-shrink: 0; }
.lb-step-row:hover .lb-step-acts, .lb-step-row.active .lb-step-acts { display: inline-flex; }
.lb-instr { border: 1px solid var(--hairline); border-radius: var(--radius-md); padding: 10px 12px; margin-bottom: 10px; }
.lb-check {
  border: 1px dashed var(--hairline); border-radius: var(--radius-md); padding: 8px 10px; margin-bottom: 8px;
  background: rgba(var(--accent-rgb), 0.04);
}
/* The student-view preview reuses the workspace panel styles, standalone. */
.lb-preview {
  width: 320px; border: 1px solid #101013; border-radius: var(--radius-md); overflow: hidden;
  position: sticky; top: 12px; max-height: calc(100vh - 140px);
}

/* File tabs (inside the editor) */
.cm-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.cm-tabs { display: flex; align-items: stretch; min-height: 34px; background: #26262b; border-bottom: 1px solid #101013; }
.cm-tab {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; cursor: pointer;
  background: transparent; border: none; border-right: 1px solid #101013; border-top: 2px solid transparent;
  color: #8b8b96; font-size: 13px; font-family: inherit; white-space: nowrap;
}
.cm-tab:hover { color: #d4d4d4; }
.cm-tab.active { background: #1e1e1e; color: #ededf0; border-top-color: var(--accent); }
.cm-tab-dot { width: 8px; height: 8px; border-radius: var(--radius-xs); flex-shrink: 0; }
.cm-tabs-extra { margin-left: auto; display: flex; align-items: center; padding-right: 4px; }
.cm-wrap .editor-host { border: none; border-radius: 0; } /* connect seamlessly to the tabs */

/* Output panel tabs */
.ws-panel-tabs { display: flex; align-items: stretch; min-height: 34px; background: #26262b; border-bottom: 1px solid #101013; }
.ws-ptab {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px; cursor: pointer;
  background: transparent; border: none; border-bottom: 2px solid transparent;
  color: #8b8b96; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
}
.ws-ptab:hover { color: #d4d4d4; }
.ws-ptab.active { color: #ededf0; border-bottom-color: var(--accent); }
.ws-ptab-badge {
  min-width: 16px; height: 16px; padding: 0 5px; border-radius: var(--radius-md); background: rgba(var(--accent-rgb), 0.3);
  color: #d9ccff; font-size: 10px; display: inline-grid; place-items: center;
}
.ws-panel-tabs-extra { margin-left: auto; display: flex; align-items: center; padding-right: 4px; }
.ws-panel-body { flex: 1; min-height: 0; display: flex; flex-direction: column; background: #1e1e1e; }
.ws-panel-body .ws-preview { border: none; border-radius: 0; }
.ws-panel-body > .code-out { flex: 1; border: none; border-radius: 0; background: #1e1e1e; }
/* A caller-supplied extra output tab (e.g. the contest leaderboard). */
.ws-ide-extra-tab { flex: 1; min-height: 0; overflow: auto; padding: 10px 12px; }

/* Console tab, problems list, and empty hints */
.console-panel.console-full { flex: 1; min-height: 0; max-height: none; margin: 0; padding: 8px 12px; border: none; border-radius: 0; background: #1e1e1e; overflow: auto; }
.console-line { font-family: "Cascadia Code", Consolas, monospace; font-size: 12.5px; padding: 1px 2px; color: #d4d4d4; }
.ws-empty-hint { padding: 14px; color: #8b8b96; font-size: 13px; }
.ws-problems { flex: 1; min-height: 0; overflow: auto; padding: 10px 14px; }
.ws-problems-head { font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.ws-problems-head.ok { color: #54d38a; }
.ws-problems-head.warn { color: #f2c14e; }
.ws-problems-head.err { color: #f36f6f; }
.ws-problem { font-family: "Cascadia Code", Consolas, monospace; font-size: 12.5px; padding: 2px 0; }

/* Toolbar (under the editor) — dark to match the IDE */
.ws-ide .ws-toolbar { margin: 0; border: none; border-top: 1px solid #101013; border-radius: 0; background: #26262b; }

/* Panes sit flush inside the IDE (the splitter bar is the only divider). */
.ws-ide .ws-splitter.ant-splitter-horizontal > .ant-splitter-panel:first-child .ws-pane,
.ws-ide .ws-splitter.ant-splitter-horizontal > .ant-splitter-panel:last-child .ws-pane,
.ws-ide .ws-splitter.ant-splitter-vertical > .ant-splitter-panel:first-child .ws-pane,
.ws-ide .ws-splitter.ant-splitter-vertical > .ant-splitter-panel:last-child .ws-pane { padding: 0; }

/* Status bar (VS Code-like, violet) */
.ws-statusbar {
  flex-shrink: 0; height: 24px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 6px; background: var(--accent-600); color: #fff; font-size: 12px; user-select: none;
}
.ws-status-left, .ws-status-right { display: flex; align-items: center; }
.ws-status-item { padding: 0 8px; white-space: nowrap; opacity: 0.96; }
.ws-status-btn { cursor: pointer; border-radius: var(--radius-sm); }
.ws-status-btn:hover { background: rgba(255, 255, 255, 0.18); }
/* Layout toggle (side-by-side / stacked) — recoloured so the Segmented sits on
   the accent status bar instead of its default light/dark surface. */
.ws-statusbar .ws-layout-ctrl .ant-segmented { background: rgba(255, 255, 255, 0.16); color: #fff; }
.ws-statusbar .ws-layout-ctrl .ant-segmented,
.ws-statusbar .ws-layout-ctrl .ant-segmented-item,
.ws-statusbar .ws-layout-ctrl .ant-segmented-item::after,
.ws-statusbar .ws-layout-ctrl .ant-segmented-thumb { border-radius: 0; }
.ws-statusbar .ws-layout-ctrl .ant-segmented-item { color: rgba(255, 255, 255, 0.8); }
.ws-statusbar .ws-layout-ctrl .ant-segmented-item:hover:not(.ant-segmented-item-selected) { color: #fff; }
.ws-statusbar .ws-layout-ctrl .ant-segmented-item:hover:not(.ant-segmented-item-selected)::after {
  background: rgba(255, 255, 255, 0.14);
}
.ws-statusbar .ws-layout-ctrl .ant-segmented-item-selected { background: rgba(255, 255, 255, 0.32); color: #fff; }
.ws-statusbar .ws-layout-ctrl .ant-segmented-thumb { background: rgba(255, 255, 255, 0.32); }

/* Editor font-size slider in the status bar (white on the violet bar). */
.ws-font-ctrl { display: inline-flex; align-items: center; gap: 6px; }
.ws-font-slider {
  width: 88px; height: 14px; margin: 0; cursor: pointer; vertical-align: middle;
  -webkit-appearance: none; appearance: none; background: transparent;
}
.ws-font-slider::-webkit-slider-runnable-track { height: 4px; border-radius: var(--pill); background: rgba(255, 255, 255, 0.35); }
.ws-font-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; margin-top: -4px;
  width: 12px; height: 12px; border-radius: 50%; background: #fff;
}
.ws-font-slider::-moz-range-track { height: 4px; border-radius: var(--pill); background: rgba(255, 255, 255, 0.35); }
.ws-font-slider::-moz-range-thumb { width: 12px; height: 12px; border: none; border-radius: 50%; background: #fff; }

.src-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: #6d6d77; margin-bottom: 4px; }

/* Rendered Markdown (problem statements) */
.markdown-body { font-size: 14px; line-height: 1.6; }
.markdown-body > :first-child { margin-top: 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { margin: 0.9em 0 0.4em; font-weight: 600; line-height: 1.3; }
.markdown-body h1 { font-size: 1.4em; }
.markdown-body h2 { font-size: 1.2em; }
.markdown-body h3 { font-size: 1.05em; }
.markdown-body p { margin: 0.5em 0; }
.markdown-body ul, .markdown-body ol { margin: 0.5em 0; padding-left: 1.4em; }
.markdown-body li { margin: 0.15em 0; }
.markdown-body code { background: rgba(var(--accent-rgb), 0.16); padding: 0.1em 0.35em; border-radius: var(--radius-sm); font-family: "Cascadia Code", Consolas, monospace; font-size: 0.9em; }
.markdown-body pre { background: #0f0f11; color: #ededf0; padding: 12px 14px; border-radius: var(--radius-md); overflow: auto; border: 1px solid var(--hairline); }
.markdown-body pre code { background: none; padding: 0; color: inherit; }
.markdown-body table { border-collapse: collapse; margin: 0.6em 0; }
.markdown-body th, .markdown-body td { border: 1px solid var(--hairline); padding: 5px 9px; }
.markdown-body a { color: var(--accent); }
.markdown-body blockquote { border-left: 3px solid var(--accent); margin: 0.6em 0; padding: 2px 0 2px 12px; opacity: 0.85; }
.markdown-body img { max-width: 100%; border-radius: var(--radius-sm); }
.markdown-body hr { border: none; border-top: 1px solid var(--hairline); margin: 1em 0; }

/* ---------------------------------------------------------------------------
   Login — split hero + form. Pure CSS + design tokens, no external assets
   (stays offline-safe). Works on both the dark and light themes. */
.login-root {
  position: relative; min-height: 100vh; display: flex;
  align-items: center; justify-content: center; padding: 24px; overflow: hidden;
}
/* Soft violet light-leak bleeding from behind the card onto the chrome. */
.login-glow {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(620px 440px at 18% 22%, rgba(var(--accent-rgb), 0.22), transparent 60%),
    radial-gradient(560px 520px at 84% 82%, rgba(var(--accent-400-rgb), 0.16), transparent 62%);
}
.login-theme-toggle { position: absolute; top: 18px; right: 20px; z-index: 2; }

.login-card {
  position: relative; z-index: 1; width: 100%; max-width: 940px;
  display: grid; grid-template-columns: 1.05fr 1fr;
  background: var(--content-bg); border: 1px solid var(--hairline);
  border-radius: var(--radius-xl); overflow: hidden;
  box-shadow: 0 30px 80px -34px rgba(0, 0, 0, 0.55), 0 10px 30px -14px rgba(0, 0, 0, 0.32);
  animation: login-rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes login-rise {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

/* Left: violet gradient hero with soft floating light blobs. */
.login-hero {
  position: relative; overflow: hidden; padding: 46px 42px; color: #f5f3ff;
  display: flex; flex-direction: column; justify-content: center;
  background: linear-gradient(150deg, var(--accent-700) 0%, var(--accent-500) 50%, var(--accent-400) 100%);
}
.login-hero-blob {
  position: absolute; border-radius: 50%; filter: blur(6px); opacity: 0.5;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 70%);
  animation: login-float 9s ease-in-out infinite;
}
.login-hero-blob-a { width: 230px; height: 230px; top: -64px; right: -46px; }
.login-hero-blob-b { width: 190px; height: 190px; bottom: -54px; left: -34px; animation-delay: -4.5s; }
@keyframes login-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(18px); } }

.login-hero-content { position: relative; z-index: 1; }
.login-hero-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 28px; }
.login-hero-mark {
  width: 44px; height: 44px; border-radius: var(--radius-md); display: block; object-fit: contain;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.45);
}
.login-hero-word { font-size: 23px; font-weight: 700; letter-spacing: -0.02em; }
.login-hero-word span { color: #ede9fe; }
.login-hero-title { margin: 0 0 14px; font-size: 32px; line-height: 1.14; font-weight: 700; letter-spacing: -0.02em; }
.login-hero-sub { margin: 0 0 26px; max-width: 34ch; font-size: 15px; line-height: 1.6; color: rgba(255, 255, 255, 0.86); }
.login-hero-list { list-style: none; margin: 0 0 28px; padding: 0; display: grid; gap: 12px; }
.login-hero-list li { display: flex; align-items: center; gap: 10px; font-size: 14px; color: rgba(255, 255, 255, 0.96); }
.login-hero-list .anticon { color: #ede9fe; font-size: 16px; flex-shrink: 0; }
.login-hero-langs { display: flex; flex-wrap: wrap; gap: 8px; }
.login-hero-langs span {
  padding: 4px 12px; border-radius: var(--pill); font-size: 12px; font-weight: 600; letter-spacing: 0.03em;
  color: #f5f3ff; background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.28);
}

/* Right: sign-in form. */
.login-form-panel { display: flex; align-items: center; justify-content: center; padding: 46px 44px; }
.login-form-inner { width: 100%; max-width: 340px; }
.login-brand-compact { display: none; margin-bottom: 22px; }
.login-form-head { margin-bottom: 26px; }
.login-input-icon { color: #9a9aa4; margin-right: 4px; }
.login-submit { margin-top: 6px; height: 46px; font-weight: 600; box-shadow: 0 10px 22px -10px rgba(var(--accent-rgb), 0.85); }
.login-foot { margin: 22px 0 0; text-align: center; font-size: 12px; color: #9a9aa4; }

/* Microsoft sign-in. Deliberately quieter than the accent-filled Sign in
   button: the school account is the easy route, but the password form is the
   one that still works when the internet doesn't. */
.login-sso { height: 46px; font-weight: 600; border-color: var(--hairline); }
.login-sso:hover { border-color: rgba(var(--accent-rgb), 0.55); }
.login-sso .anticon, .login-sso svg { flex-shrink: 0; }
.login-divider { margin: 18px 0 6px; border-color: var(--hairline); }
.login-divider span { font-size: 12px; color: #9a9aa4; }

/* Narrow screens: drop the hero, show a compact brand above the form. */
@media (max-width: 760px) {
  .login-card { grid-template-columns: 1fr; max-width: 420px; }
  .login-hero { display: none; }
  .login-form-panel { padding: 38px 30px; }
  .login-brand-compact { display: block; }
}

/* Teacher dashboard — Tabler-style overview. All colours come from the theme
   tokens (or explicit brand hexes) so it reads on both dark and light. */

/* Equal-height cards across a row, with the body as a flex column so sparklines
   and progress bars can pin to the bottom edge. */
.dash-kpi.ant-card { height: 100%; }
.dash-kpi.ant-card > .ant-card-body { height: 100%; display: flex; flex-direction: column; }
.dash-kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 22px; }
.dash-kpi-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: #8b8b96; }
.dash-kpi-value { font-size: 28px; font-weight: 700; line-height: 1.1; margin-top: 6px; }
.dash-kpi-unit { font-size: 14px; font-weight: 600; color: #8b8b96; }
/* Let the sparkline area bleed to the card edges, pinned to the bottom. */
.dash-kpi-spark { margin: auto -12px -12px; }
.dash-gauge.ant-card > .ant-card-body { justify-content: space-between; }

/* Dashboard welcome banner — violet gradient hero with floating blobs, a faint
   icon watermark, and an SVG wave cut into the page background at the bottom. */
/* Dashboard shell: a pinned banner over an independently scrolling body, so the
   banner spans the content-panel's true edges and the scrollbar sits below it. */
.dash-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.dash-view.dash-blank { align-items: center; justify-content: center; }
.dash-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 22px 24px 24px; }

/* Coloured masthead — a slimmer echo of the dashboard banner (below). The
   page title, subtitle and actions sit on the gradient band; a single arc
   wave blends its bottom edge into the page. */
.page-scroll { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.page-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 20px 24px 24px; }
.page-band {
  position: relative; flex-shrink: 0; overflow: hidden; padding: 11px 28px 18px;
  background: var(--content-bg);
}
/* The accent masthead is a wedge: full height on the left (under the title),
   tapering to a thin sliver on the right so the band melts into the content
   panel. Painted on ::before, beneath the z-index 2 body, so the title and
   actions stay crisp; the far right also colour-fades for a soft tip. */
.page-band::before {
  content: ''; position: absolute; inset: 0; z-index: 0;
  background:
    linear-gradient(90deg, rgba(var(--content-bg-rgb), 0) 62%, rgba(var(--content-bg-rgb), 1) 100%),
    linear-gradient(135deg, var(--accent-700) 0%, var(--accent-500) 55%, var(--accent-400) 100%);
  /* Wedge with a smooth curved taper — an SVG mask stretched to the band. Full
     height for the left ~60% (keeps the white title/subtitle on solid accent),
     then a soft S-curve down to a thin sliver on the right. Tune the path:
     `V4` = right-tip height (of 40), `60 40` = where the flat bottom starts. */
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 40' preserveAspectRatio='none'%3E%3Cpath d='M0 0 H100 V4 C85 4 78 40 60 40 H0 Z' fill='white'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 40' preserveAspectRatio='none'%3E%3Cpath d='M0 0 H100 V4 C85 4 78 40 60 40 H0 Z' fill='white'/%3E%3C/svg%3E") 0 0 / 100% 100% no-repeat;
}
.page-band-body { position: relative; z-index: 2; }
.page-band-sub { margin-top: 4px; font-size: 14px; color: rgba(255, 255, 255, 0.86); }
.page-band-back.ant-btn { color: rgba(255, 255, 255, 0.9); }
.page-band-back.ant-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.14); }
.page-band-extra { flex-shrink: 0; }
/* Blob + wave are hidden: both spanned the full width and fought the wedge shape.
   Flip these back to their original display to restore the rectangular masthead. */
.page-band-blob {
  display: none;
  position: absolute; width: 200px; height: 200px; top: -96px; right: 6%; border-radius: 50%; z-index: 1;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 70%);
  filter: blur(6px); pointer-events: none;
}
.page-band-wave { display: none; position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 11px; z-index: 2; }

/* A slim strip, not a hero: greeting on the left, actions on the right, one
   row. Every pixel it takes is a pixel of actual dashboard pushed below the
   fold, so it earns its height by being a signpost and nothing more.
   flex-wrap lets the actions drop to a second row on a narrow screen. */
.dash-banner {
  position: relative; overflow: hidden; flex-shrink: 0; min-height: 90px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 20px;
  /* Flush to the content-panel edges; its rounded top-left corner clips this.
     The bottom is heavier than the top because the wave overlays it. */
  padding: 14px 44px 26px;
  background: linear-gradient(135deg, var(--accent-700) 0%, var(--accent-500) 55%, var(--accent-400) 100%);
}
.dash-banner-body { position: relative; z-index: 2; min-width: 0; max-width: 60ch; }
.dash-banner-body h2.ant-typography { font-size: 24px; line-height: 1.2; }
.dash-banner-actions { position: relative; z-index: 2; flex-shrink: 0; }
.dash-banner-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; color: rgba(255, 255, 255, 0.8); margin-bottom: 5px; }
.dash-banner-ghost.ant-btn {
  background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.35); color: #fff;
}
.dash-banner-ghost.ant-btn:hover { background: rgba(255, 255, 255, 0.26); border-color: #fff; color: #fff; }
.dash-banner-blob {
  position: absolute; border-radius: 50%; z-index: 1; filter: blur(8px); opacity: 0.5; pointer-events: none;
  background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0) 70%);
}
.dash-banner-blob.a { width: 130px; height: 130px; top: -56px; right: 14%; }
.dash-banner-blob.b { width: 92px; height: 92px; bottom: -34px; right: 30%; }
.dash-banner-wave { position: absolute; left: 0; right: 0; bottom: -1px; width: 100%; height: 18px; z-index: 2; display: block; }

/* Student home — level/XP chips on the hero, XP bar, achievement grid. */
/* The student banner carries more than a greeting (level, streak, badges, the
   XP bar), so it stays stacked rather than collapsing to the teacher's one-row
   strip — trimmed to match, but not squeezed into a single line. */
.sd-banner { display: block; min-height: 0; padding: 18px 44px 30px; }
.sd-banner .dash-banner-body h2.ant-typography { font-size: 26px; }
.sd-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sd-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: var(--pill);
  background: rgba(255, 255, 255, 0.18); color: #fff; font-size: 13px; font-weight: 600;
}
.sd-xp { margin-top: 11px; max-width: 420px; }
.sd-xp-track { height: 10px; border-radius: var(--pill); background: rgba(255, 255, 255, 0.25); overflow: hidden; }
.sd-xp-track > span { display: block; height: 100%; border-radius: var(--pill); background: #fff; transition: width 0.4s ease; }
.sd-xp-label { margin-top: 5px; font-size: 12px; color: rgba(255, 255, 255, 0.9); }

.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 12px; }
.ach-card {
  border: 1px solid var(--hairline); border-radius: var(--radius-lg); padding: 14px 12px; text-align: center;
  background: var(--content-bg); opacity: 0.5; filter: grayscale(0.7); transition: transform 0.15s ease;
}
.ach-card.earned {
  opacity: 1; filter: none; border-color: var(--accent);
  box-shadow: 0 8px 22px -14px rgba(var(--accent-rgb), 0.7);
}
.ach-card.earned:hover { transform: translateY(-3px); }
.ach-icon { font-size: 26px; line-height: 1; color: var(--accent); }
/* Not yet earned: the whole card is already dimmed, so the icon just goes grey
   rather than teasing with the accent colour. */
.ach-card:not(.earned) .ach-icon { color: var(--muted); }
.ach-title { font-weight: 600; font-size: 13.5px; margin-top: 6px; }
.ach-desc { font-size: 11.5px; color: #8b8b96; margin-top: 2px; line-height: 1.35; }

/* Algorithm visualizer — animated bars + colour roles. */
.viz-bars {
  display: flex; align-items: flex-end; gap: 3px; height: 260px; padding: 8px 4px;
  background: var(--content-bg); border: 1px solid var(--hairline); border-radius: var(--radius-md);
}
.viz-bar {
  flex: 1; min-width: 4px; background: var(--accent-500); border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  display: flex; align-items: flex-start; justify-content: center; color: #fff;
  transition: height 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}
.viz-bar-val { font-size: 11px; font-weight: 600; margin-top: 3px; }
.viz-bar.compare { background: #f2c14e; color: #1a1a1f; }
.viz-bar.swap { background: #f36f6f; }
.viz-bar.sorted { background: var(--ok); }
.viz-bar.pivot { background: #a855f7; }
.viz-bar.mid { background: #3b82f6; }
.viz-bar.found { background: var(--ok); box-shadow: 0 0 0 2px var(--ok); }
.viz-bar.dim { opacity: 0.28; }
.viz-caption { margin-top: 10px; font-size: 14px; min-height: 22px; font-weight: 500; }
.viz-legend { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #8b8b96; }
.viz-swatch { width: 14px; height: 14px; border-radius: var(--radius-xs); display: inline-block; background: var(--accent-500); }
.viz-swatch.compare { background: #f2c14e; }
.viz-swatch.swap { background: #f36f6f; }
.viz-swatch.sorted { background: var(--ok); }
.viz-swatch.pivot { background: #a855f7; }
.viz-swatch.mid { background: #3b82f6; }
.viz-swatch.found { background: var(--ok); }
.viz-swatch.hot { background: var(--accent-500); }
.viz-swatch.win { background: rgba(var(--accent-rgb), 0.22); border: 1px solid rgba(var(--accent-rgb), 0.5); }
.viz-swatch.done { background: var(--ok); opacity: 0.55; }
.viz-swatch.path { background: rgba(var(--accent-rgb), 0.35); border: 1px solid var(--accent-500); }
.viz-swatch.frontier { background: rgba(var(--accent-rgb), 0.12); border: 1px dashed var(--accent-500); }

/* Array cells — two pointers / sliding window / prefix sums. Boxes (so negatives
   work) with a named pointer above and the index below; window shades a range. */
.viz-cells {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-end; min-height: 120px; padding: 12px 6px;
  background: var(--content-bg); border: 1px solid var(--hairline); border-radius: var(--radius-md);
}
.viz-cell-wrap { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.viz-cell-ptr { font-size: 11px; font-weight: 700; height: 14px; line-height: 14px; color: var(--accent-500); white-space: nowrap; }
.viz-cell {
  min-width: 34px; height: 40px; padding: 0 7px; display: flex; align-items: center; justify-content: center;
  font-weight: 600; border: 1.5px solid var(--hairline); border-radius: var(--radius-md); background: transparent;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.viz-cell-idx { font-size: 10px; color: #9a9aa6; }
.viz-cell.win { background: rgba(var(--accent-rgb), 0.10); border-color: rgba(var(--accent-rgb), 0.4); }
.viz-cell.hot { background: rgba(var(--accent-rgb), 0.22); border-color: var(--accent-500); }
.viz-cell.done { border-color: var(--ok); }
.viz-cell.found { background: var(--ok); border-color: var(--ok); color: #fff; }

/* Graph — SVG nodes at fixed x/y with edges (arrowheads if directed, weights if any). */
.viz-graph { overflow-x: auto; background: var(--content-bg); border: 1px solid var(--hairline); border-radius: var(--radius-md); padding: 8px; }
.viz-graph-edge { stroke: #9a9aa6; stroke-width: 1.6; transition: stroke 0.18s ease, stroke-width 0.18s ease; }
.viz-graph-edge.active { stroke: var(--accent-500); stroke-width: 2.6; }
.viz-graph-head { fill: #9a9aa6; }
.viz-graph-node { fill: transparent; stroke: var(--hairline); stroke-width: 1.8; transition: fill 0.18s ease, stroke 0.18s ease; }
.viz-graph-node.frontier { stroke: var(--accent-500); fill: rgba(var(--accent-rgb), 0.10); stroke-dasharray: 4 3; }
.viz-graph-node.hot { stroke: var(--accent-500); stroke-width: 2.6; fill: rgba(var(--accent-rgb), 0.22); }
.viz-graph-node.done { stroke: var(--ok); fill: rgba(var(--accent-rgb), 0.05); }
.viz-graph-node.found { stroke: var(--ok); stroke-width: 2.8; }
.viz-graph-val { fill: currentColor; font-weight: 600; font-size: 13px; }
.viz-graph-w { fill: #9a9aa6; font-size: 11px; font-weight: 600; }
.viz-graph-dist { fill: var(--accent-500); font-size: 11px; font-weight: 700; }

/* Binary tree — SVG circles positioned by in-order rank + depth, edges to children. */
.viz-tree { overflow-x: auto; background: var(--content-bg); border: 1px solid var(--hairline); border-radius: var(--radius-md); padding: 8px; }
.viz-tree-empty { color: #9a9aa6; padding: 30px; font-size: 13px; text-align: center; }
.viz-tree-edge { stroke: #9a9aa6; stroke-width: 1.6; }
.viz-tree-node { fill: transparent; stroke: var(--hairline); stroke-width: 1.8; transition: fill 0.18s ease, stroke 0.18s ease; }
.viz-tree-node.path { stroke: var(--accent-500); fill: rgba(var(--accent-rgb), 0.07); }
.viz-tree-node.hot { stroke: var(--accent-500); stroke-width: 2.4; fill: rgba(var(--accent-rgb), 0.20); }
.viz-tree-node.done { stroke: var(--ok); fill: rgba(var(--accent-rgb), 0.05); }
.viz-tree-node.found { stroke: var(--ok); stroke-width: 2.8; fill: rgba(var(--accent-rgb), 0.06); }
.viz-tree-val { fill: currentColor; font-weight: 600; font-size: 13px; }

/* Linked list — SVG nodes + arrows (see LinkedList renderer). */
.viz-ll { overflow-x: auto; background: var(--content-bg); border: 1px solid var(--hairline); border-radius: var(--radius-md); padding: 6px 4px; }
.viz-ll-node { fill: transparent; stroke: var(--hairline); stroke-width: 1.5; }
.viz-ll-node.hot { stroke: var(--accent-500); stroke-width: 2; fill: rgba(var(--accent-rgb), 0.16); }
.viz-ll-node.found { stroke: var(--ok); stroke-width: 2.5; fill: rgba(var(--accent-rgb), 0.06); }
.viz-ll-val { fill: currentColor; font-weight: 600; font-size: 14px; }
.viz-ll-ptr { fill: var(--accent-500); font-weight: 700; font-size: 11px; }
.viz-ll-arrow { stroke: #9a9aa6; stroke-width: 1.6; fill: none; }
.viz-ll-head { fill: #9a9aa6; }
.viz-ll-null { fill: #9a9aa6; font-size: 14px; }

/* Stack (vertical) & queue (horizontal), plus the input sequence strip. */
.viz-sq { background: var(--content-bg); border: 1px solid var(--hairline); border-radius: var(--radius-md); padding: 14px; min-height: 200px; }
.viz-instrip { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 16px; }
.viz-incell {
  min-width: 26px; height: 30px; padding: 0 7px; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; border: 1.5px solid var(--hairline); border-radius: var(--radius-sm);
}
.viz-incell.hot { border-color: var(--accent-500); background: rgba(var(--accent-rgb), 0.22); }
.viz-incell.done { opacity: 0.4; }
.viz-stack { display: flex; flex-direction: column; width: 128px; gap: 4px; }
.viz-stackcell {
  height: 34px; display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px solid var(--hairline); border-radius: var(--radius-md); font-weight: 600;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.viz-stackcell.top { border-color: var(--accent-500); }
.viz-stackcell.hot { background: rgba(var(--accent-rgb), 0.22); }
.viz-stack-base { margin-top: 6px; width: 128px; text-align: center; font-size: 11px; color: #9a9aa6; border-top: 2px solid var(--hairline); padding-top: 4px; }
.viz-stack-empty { color: #9a9aa6; font-size: 13px; padding: 6px 2px; }
.viz-tag { font-size: 10px; font-weight: 700; color: var(--accent-500); }
.viz-tag.side { color: #9a9aa6; align-self: center; }
.viz-queue { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.viz-qcell {
  min-width: 38px; height: 42px; padding: 0 9px; display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--hairline); border-radius: var(--radius-md); font-weight: 600;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.viz-qcell.hot { border-color: var(--accent-500); background: rgba(var(--accent-rgb), 0.22); }

/* Stage + code panel columns — side by side on desktop, stacked on mobile. */
.viz-layout { display: flex; flex-wrap: wrap; gap: 16px; align-items: stretch; margin-top: 4px; }
.viz-stage-col { flex: 1 1 300px; min-width: 260px; display: flex; flex-direction: column; }
.viz-code-col { flex: 0 1 360px; min-width: 240px; }
@media (max-width: 760px) {
  .viz-stage-col, .viz-code-col { flex: 1 1 100%; min-width: 0; }
  .viz-bars { height: 180px; gap: 2px; }
  .viz-bar-val { font-size: 10px; }
  .viz-code-body { max-height: 220px; }
  .viz-sq { min-height: 0; }
}

/* Synced code / pseudocode panel — the active line highlights per frame. */
.viz-code { display: flex; flex-direction: column; height: 100%; }
.viz-code-body {
  margin-top: 8px; flex: 1; overflow: auto;
  background: var(--content-bg); border: 1px solid var(--hairline); border-radius: var(--radius-md);
  padding: 8px 6px; font-family: var(--font-mono, ui-monospace, monospace); font-size: 12.5px; line-height: 1.7;
}
.viz-code-line {
  display: flex; gap: 8px; padding: 0 6px; border-radius: var(--radius-sm); white-space: pre;
  transition: background 0.18s ease;
}
.viz-code-line.active { background: rgba(var(--accent-rgb), 0.18); box-shadow: inset 3px 0 0 var(--accent-500); }
.viz-code-ln { color: #9a9aa6; user-select: none; min-width: 16px; text-align: right; opacity: 0.7; }
.viz-code-line.active .viz-code-ln { color: var(--accent-500); opacity: 1; }
.viz-code-txt { flex: 1; }

/* Tabbed edit dialogs (labs / exercises / problems) — the tab bar stays pinned
   while a tall tab (e.g. many checks) scrolls inside the modal body. Opaque
   background so content slides under. */
.edit-modal-tabs > .ant-tabs-nav {
  position: sticky; top: 0; z-index: 3;
  background: var(--elevated-bg);
}
/* Same idea on full editor PAGES (lesson builder) — pins to the page scroll. */
.edit-page-tabs > .ant-tabs-nav {
  position: sticky; top: 0; z-index: 5;
  background: var(--content-bg);
}

/* Hidden-check / test-case cards in the edit dialogs (theme-aware). */
.edit-check-card {
  background: var(--content-bg); border: 1px solid var(--hairline);
  border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 10px;
}

/* Teacher right rail — the "class pulse": grading inbox, live contests,
   reminders. Sits on the chrome layer (like the sidebar); cards use the
   content colour so the layering matches the left side. */
.pulse-rail {
  width: 276px; flex-shrink: 0; overflow-y: auto; padding: 12px 14px 14px 6px;
  background: var(--chrome);
}
.pulse-rail.closed {
  width: 30px; padding: 0; overflow: visible;
  display: flex; justify-content: flex-start; align-items: center; /* tab sits mid-height */
}
/* Collapsed rail — a vertical accent tab hugging the window edge. */
.pulse-tab {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 14px 5px; border: none; cursor: pointer;
  background: linear-gradient(180deg, var(--accent-500) 0%, var(--accent-600) 100%);
  color: #fff; font-weight: 700; font-size: 11.5px; letter-spacing: 0.05em;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.18);
  transition: filter 0.15s ease, padding 0.15s ease;
}
.pulse-tab:hover { filter: brightness(1.12); padding-right: 8px; }
.pulse-tab-label { writing-mode: vertical-rl; }
.pulse-tab-count {
  min-width: 18px; height: 18px; padding: 0 4px; border-radius: var(--pill);
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; color: var(--accent-600); font-size: 11px; font-weight: 700;
}
.pulse-rail-head {
  display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 8px;
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: #8b8b96;
}
.pulse-card {
  background: var(--content-bg); border: 1px solid var(--hairline);
  border-radius: var(--radius-lg); padding: 10px 12px; margin-bottom: 10px;
}
.pulse-card-head {
  display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; margin-bottom: 8px;
}
.pulse-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: var(--radius-md); cursor: pointer; }
.pulse-row:hover { background: rgba(var(--accent-rgb), 0.08); }
.pulse-row-main { flex: 1; min-width: 0; }
.pulse-row-title {
  display: block; font-size: 12.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pulse-row-sub {
  display: block; font-size: 11.5px; color: #8b8b96;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.pulse-row-meta { font-size: 11px; color: #8b8b96; flex-shrink: 0; }
.pulse-row-meta.live { color: var(--ok); font-weight: 700; }
.pulse-empty { font-size: 12px; color: #8b8b96; display: flex; gap: 6px; align-items: center; }
.pulse-note { font-size: 11.5px; color: #f2a33c; margin-top: 4px; display: flex; gap: 6px; align-items: center; }
.pulse-nag {
  font-size: 12px; padding: 7px 9px; border-radius: var(--radius-md); line-height: 1.45; margin-bottom: 6px;
  background: rgba(242, 193, 78, 0.10); border: 1px solid rgba(242, 193, 78, 0.35);
}
.pulse-nag:last-child { margin-bottom: 0; }
/* Same hover-only scrollbar behaviour as the left sidebar. */
.pulse-rail { scrollbar-color: transparent transparent; }
.pulse-rail:hover { scrollbar-color: var(--scroll-thumb) transparent; }
.pulse-rail::-webkit-scrollbar-thumb { background: transparent; background-clip: padding-box; }
.pulse-rail:hover::-webkit-scrollbar-thumb { background: var(--scroll-thumb); background-clip: padding-box; }

/* Weekly leaderboard rows. */
.lb-row { padding: 7px 8px; border-radius: var(--radius-md); }
.lb-row + .lb-row { margin-top: 2px; }
.lb-me { background: rgba(var(--accent-rgb), 0.12); font-weight: 600; }
.lb-rank { display: inline-block; min-width: 30px; font-weight: 700; text-align: center; }
/* Gold, silver, bronze — the colour is what says which place, now that the
   medal emoji is a trophy icon. */
.lb-rank-1 { color: #f59e0b; }
.lb-rank-2 { color: #9ca3af; }
.lb-rank-3 { color: #d97706; }

/* Quick-action pills under the banner. */
.dash-pills { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }
.dash-pill.ant-btn {
  height: 40px; border-radius: var(--pill); padding: 0 18px; font-weight: 600;
  border: 1px solid var(--hairline); background: var(--content-bg);
}
.dash-pill.ant-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Icon stat tiles (the "132 Sales" row). */
.dash-tile-card.ant-card { height: 100%; }
.dash-tile { display: flex; align-items: center; gap: 14px; }
/* Bare glyph, no filled tile: the colour is set inline per stat. */
.dash-tile-ico {
  width: 44px; height: 44px; flex-shrink: 0; display: grid; place-items: center;
  font-size: 26px;
}
.dash-tile-value { font-size: 20px; font-weight: 700; }
.dash-tile-label { font-size: 13px; font-weight: 600; }

/* The /20 grade-distribution bars. */
.dash-kpi .ant-statistic-title { font-size: 12.5px; margin-bottom: 2px; }
.dash-dist-row { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.dash-dist-label { width: 132px; flex-shrink: 0; font-size: 13px; }
.dash-dist-track {
  flex: 1; height: 12px; border-radius: var(--pill); overflow: hidden;
  background: rgba(140, 140, 150, 0.16);
}
.dash-dist-fill { display: block; height: 100%; border-radius: var(--pill); min-width: 2px; transition: width 0.45s ease; }
.dash-dist-val { width: 78px; flex-shrink: 0; text-align: right; font-size: 12px; color: #8b8b96; white-space: nowrap; }

/* Rubric library cards */
.card-grid .ant-card.rubric-card { transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease; }
.card-grid .ant-card.rubric-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 14px 30px -16px rgba(0, 0, 0, 0.5); }
.rubric-name { font-size: 16px; font-weight: 600; line-height: 1.3; }
.rubric-criteria { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.rubric-crit { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 13px; }
.rubric-crit-label { color: var(--page-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rubric-crit-pts { flex-shrink: 0; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.rubric-foot { margin-top: auto; padding-top: 14px; display: flex; align-items: center; gap: 8px; }
.class-ico {
  width: 42px; height: 42px; flex-shrink: 0; display: grid; place-items: center;
  color: var(--accent-400); font-size: 24px;
}

/* Selected submission row */
.row-selected > td { background: rgba(var(--accent-rgb), 0.16) !important; }

/* Master-detail (grading queue): full-height panes that scroll independently,
   so the list stays put while a long submission scrolls on the right. */
.mdl { flex: 1; min-height: 0; display: flex; gap: 16px; }
.mdl-master.ant-card { flex: 0 0 clamp(340px, 44%, 560px); display: flex; flex-direction: column; overflow: hidden; }
.mdl-master.ant-card > .ant-card-body { flex: 1; min-height: 0; overflow: hidden; }
.mdl-scroll { height: 100%; overflow: auto; }
/* Pin the master table header while the list scrolls (th carries the themed
   header background, so rows pass cleanly underneath). */
.mdl-scroll .ant-table-thead > tr > th { position: sticky; top: 0; z-index: 2; }
.mdl-detail { flex: 1; min-width: 0; overflow: auto; }
.mdl-blank { flex: 1; min-height: 0; display: grid; place-items: center; }
/* Narrow screens: stack the panes and let the page scroll as one. */
@media (max-width: 900px) {
  .mdl { flex-direction: column; overflow: auto; }
  .mdl-master.ant-card { flex: none; }
  .mdl-scroll { max-height: 340px; }
  .mdl-detail { flex: none; overflow: visible; }
}

/* ============================================================================
   Phones & small tablets — students taking a contest on their own device. The
   sidebar becomes an off-canvas drawer and the coding IDE becomes a stacked,
   tabbed single-pane layout usable on a touch screen.
   ========================================================================== */
@media (max-width: 760px) {
  /* Off-canvas sidebar: slides over the content instead of reserving width. */
  .ant-layout-sider.side-drawer {
    position: fixed; top: 60px; left: 0; bottom: 0; z-index: 1000;
    background: var(--chrome); transform: translateX(-100%); transition: transform 0.24s ease;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.45);
  }
  .ant-layout-sider.side-drawer.open { transform: translateX(0); }
  .side-scrim { position: fixed; inset: 60px 0 0 0; z-index: 999; background: rgba(0, 0, 0, 0.5); }

  /* Full-bleed content, tighter chrome. */
  .content-panel { border-top-left-radius: 0; }
  .topbar { gap: 8px; padding: 0 12px !important; }
  .page-band { padding: 14px 16px 24px; }
  .page-body { padding: 14px 14px 18px; }
  .dash-scroll { padding: 16px 14px 18px; }
  /* Narrow: the actions wrap under the greeting, so the strip grows a row. */
  .dash-banner { min-height: 0; padding: 14px 16px 24px; }
  .dash-banner-body h2.ant-typography { font-size: 20px; }
  .sd-banner { padding: 14px 16px 26px; }
  .sd-banner .dash-banner-body h2.ant-typography { font-size: 22px; }

  /* ---- Coding IDE: stacked, tabbed single-pane layout ---- */
  .ws-ide-mobile { border: none; border-radius: 0; box-shadow: none; position: relative; }
  .ws-mtoolbar {
    flex-shrink: 0; display: flex; align-items: center; gap: 2px;
    padding: 5px 8px; background: #26262b; border-bottom: 1px solid #101013;
  }
  .ws-mact {
    width: 42px; height: 38px; display: grid; place-items: center; font-size: 22px;
    background: transparent; border: none; color: #a6a6b0; border-radius: var(--radius-sm); cursor: pointer;
  }
  .ws-mact:disabled { opacity: 0.36; }
  .ws-mact.active { color: #fff; background: rgba(var(--accent-rgb), 0.22); }
  .ws-mact-run { color: #4ade80; }

  .ws-mtabs {
    flex-shrink: 0; display: flex; align-items: stretch; overflow-x: auto;
    background: #26262b; border-bottom: 1px solid #101013;
  }
  .ws-mtabs .ws-ptab { flex: 0 0 auto; }

  .ws-mbody { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
  /* Fill the body box directly rather than through the nested flex/percentage
     height chain — some mobile browsers resolve that chain to zero, which left
     the editor (and output) blank. Absolute inset gives CodeMirror a concrete
     height to measure. Only the active pane is shown (the rest are display:none). */
  .ws-mbody > .ws-editor-wrap,
  .ws-mbody > .ws-panel-body { position: absolute; inset: 0; min-height: 0; }

  /* Instructions as a full-screen overlay sheet (dismissable). */
  .ws-minstr {
    position: absolute; inset: 0; z-index: 20; display: flex; flex-direction: column; background: #202023;
  }
  .ws-minstr-head {
    height: 42px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
    padding: 0 6px 0 14px; border-bottom: 1px solid #101013;
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: #9a9aa4; font-weight: 600;
  }
  .ws-minstr-head button {
    width: 34px; height: 34px; display: grid; place-items: center; background: transparent;
    border: none; color: #c8c8d0; font-size: 16px; cursor: pointer;
  }
  .ws-statusbar-mobile { height: auto; min-height: 24px; padding: 2px 8px; flex-wrap: wrap; }
}

/* ============================================================================
   Moodle-style course page + assignment landing
   ========================================================================= */

/* --- Course page: index drawer + sections ------------------------------- */
.course-layout { display: flex; align-items: flex-start; gap: 22px; }

.course-index {
  position: sticky; top: 8px; align-self: flex-start; flex-shrink: 0;
  width: 224px; max-height: calc(100vh - 120px); overflow-y: auto;
  border: 1px solid var(--hairline); border-radius: var(--radius-lg);
  background: var(--content-bg);
}
.course-layout.no-index .course-index { display: none; }
.course-index-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 8px 10px 14px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  border-bottom: 1px solid var(--hairline);
}
.course-index-list { display: flex; flex-direction: column; padding: 6px; }
.course-index-item {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 7px 8px; border: none; background: transparent; cursor: pointer;
  border-radius: var(--radius-md); color: var(--page-fg); font-size: 13px;
  transition: background 0.12s ease;
}
.course-index-item:hover { background: rgba(var(--accent-rgb), 0.1); }
.course-index-num {
  flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  background: rgba(var(--accent-rgb), 0.16); color: var(--accent);
}
.course-index-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.course-index-count { flex-shrink: 0; font-size: 11px; color: var(--muted); }

.course-main { flex: 1; min-width: 0; }
.course-index-toggle.ant-btn { color: var(--muted); padding-left: 0; }

.mdl-section {
  border: 1px solid var(--hairline); border-radius: var(--radius-lg);
  background: var(--content-bg); margin-bottom: 14px; overflow: hidden;
}
.mdl-section-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
}
.mdl-section.collapsed .mdl-section-head { border-bottom: none; }
.mdl-section-toggle {
  flex-shrink: 0; width: 24px; height: 24px; display: grid; place-items: center;
  border: none; background: transparent; cursor: pointer; color: var(--muted);
  font-size: 12px; border-radius: var(--radius-sm);
}
.mdl-section-toggle:hover { background: rgba(var(--accent-rgb), 0.12); color: var(--accent); }
.mdl-section-num {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
  background: rgba(var(--accent-rgb), 0.16); color: var(--accent);
}
.mdl-section-title { flex: 1; min-width: 0; }
.mdl-section-title h2 { margin: 0; font-size: 16px; font-weight: 700; color: var(--page-fg); }
.mdl-section-progress {
  display: inline-flex; align-items: center; gap: 8px; flex-shrink: 0;
  font-size: 12px; color: var(--muted); white-space: nowrap;
}
.mdl-section-bar {
  display: inline-block; width: 70px; height: 6px; border-radius: var(--pill);
  background: var(--hairline); overflow: hidden;
}
.mdl-section-bar > span { display: block; height: 100%; background: var(--accent); border-radius: var(--pill); transition: width 0.3s ease; }
.mdl-section-actions { flex-shrink: 0; }
.mdl-section-body { padding: 0 14px 14px 50px; }
.mdl-section-summary {
  margin-bottom: 12px; padding: 10px 14px; font-size: 13px;
  border-left: 3px solid rgba(var(--accent-rgb), 0.5);
  background: rgba(var(--accent-rgb), 0.06); border-radius: 0 var(--radius-md) var(--radius-md) 0;
}
.mdl-section-summary .markdown-body { font-size: 13px; }
.mdl-section-summary .markdown-body > :first-child { margin-top: 0; }
.mdl-section-summary .markdown-body > :last-child { margin-bottom: 0; }

/* --- Activities (Moodle "module" rows) ---------------------------------- */
.mdl-activities { border: 1px solid var(--hairline); border-radius: var(--radius-md); overflow: hidden; }
.mdl-activity {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  border-top: 1px solid var(--hairline); transition: background 0.12s ease;
}
.mdl-activity:first-child { border-top: none; }
.mdl-activity:hover { background: rgba(var(--accent-rgb), 0.06); }
.mdl-activity.locked { opacity: 0.55; filter: grayscale(0.5); }
.mdl-activity.locked:hover { background: transparent; }
.mdl-lang-php { font-size: 12px; font-weight: 800; letter-spacing: 0.02em; }
/* Bare icons — the colour tells you the activity type, no chip behind it. */
.mdl-activity-icon {
  flex-shrink: 0; width: 38px; height: 38px;
  display: grid; place-items: center; font-size: 19px;
}
.mdl-activity-icon.type-lesson   { color: var(--accent); }
.mdl-activity-icon.type-exercise { color: #3b82f6; }
.mdl-activity-icon.type-lab      { color: #10b981; }
.mdl-activity-icon.type-problem  { color: #f59e0b; }
.mdl-activity-body { flex: 1; min-width: 0; }
.mdl-activity-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mdl-activity-title { font-weight: 600; font-size: 14px; color: var(--page-fg); }
.mdl-activity-type {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 600;
}
.mdl-activity-desc { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.mdl-activity-sub { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.mdl-chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px;
  color: var(--muted); background: rgba(140, 140, 150, 0.14);
  padding: 1px 8px; border-radius: var(--pill);
}
.mdl-chip .anticon { font-size: 10px; }
.mdl-activity-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.mdl-tick {
  width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--hairline);
  display: grid; place-items: center; color: transparent; flex-shrink: 0; font-size: 12px;
  padding: 0; background: transparent;
}
.mdl-tick.is-done { border-color: var(--ok); background: var(--ok); color: #fff; }
.mdl-tick.clickable { cursor: pointer; transition: border-color 0.12s ease, background 0.12s ease; }
.mdl-tick.clickable:not(.is-done):hover { border-color: var(--ok); background: var(--ok-bg); }
.mdl-tick.clickable.is-done:hover { filter: brightness(1.08); }

/* --- Assignment landing (status page) ----------------------------------- */
.mdl-assign-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.mdl-assign { max-width: 720px; margin: 4px auto 32px; }
.mdl-assign-card { margin-bottom: 16px; }
.mdl-assign-card .ant-card-head-title { font-size: 14px; }
.mdl-assign-card .ant-card-head-title .anticon { margin-right: 8px; color: var(--accent); }
.mdl-assign-table { display: flex; flex-direction: column; }
.mdl-assign-row {
  display: flex; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--hairline);
}
.mdl-assign-row:last-child { border-bottom: none; }
.mdl-assign-label { width: 150px; flex-shrink: 0; color: var(--muted); font-size: 13px; }
.mdl-assign-value { flex: 1; min-width: 0; font-size: 13px; }
.mdl-assign-value .anticon { margin-right: 5px; color: var(--muted); }
.mdl-due-past { color: #e5484d; font-weight: 600; }
.mdl-assign-grade { font-size: 30px; font-weight: 800; color: var(--ok); line-height: 1; }
.mdl-assign-grade span { font-size: 16px; font-weight: 600; color: var(--muted); }
.mdl-assign-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }

/* --- Readiness checklist ------------------------------------------------- */
.mdl-readiness { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.mdl-readiness li { font-size: 13px; color: var(--page-fg); }
.mdl-readiness li .anticon { color: #e5a400; margin-right: 6px; }

@media (max-width: 900px) {
  .course-layout { display: block; }
  .course-index {
    position: static; width: auto; max-height: none; margin-bottom: 16px;
  }
  .mdl-section-body { padding-left: 24px; }
  .mdl-assign-label { width: 120px; }
}


