:root {
  color-scheme: light;
  --ink: #1d2428;
  --muted: #5d6a70;
  --line: #d9e0dd;
  --surface: #f7f8f4;
  --paper: #ffffff;
  --accent: #c24633;
  --accent-2: #17766f;
  --accent-3: #7b5d12;
  --code: #17201d;
  --code-text: #eaf2ec;
  --shadow: 0 14px 38px rgba(28, 35, 34, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--surface);
  font-family: "Segoe UI Variable", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

button {
  border: 0;
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.login-screen {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 32px;
  align-items: center;
  padding: 32px;
  background: #20302c;
  color: #f4f6ee;
}

.login-copy {
  max-width: 620px;
}

.login-copy p:last-child {
  color: #cad8d2;
  line-height: 1.7;
}

.login-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.login-panel {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  padding: 22px;
  background: #f7f8f4;
  color: var(--ink);
  box-shadow: var(--shadow);
}

.login-panel label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  min-height: 100svh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100svh;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  background: #20302c;
  color: #f4f6ee;
}

.side-problem {
  display: grid;
  gap: 14px;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
}

.eyebrow {
  margin: 0;
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: #91d0c5;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 2.7rem;
  line-height: 1.02;
}

h2 {
  margin: 4px 0 0;
  font-size: 1.8rem;
  line-height: 1.12;
}

h3 {
  margin: 2px 0 0;
  font-size: 1.05rem;
  line-height: 1.22;
}

.side-problem p {
  margin: 0;
  color: #cad8d2;
  line-height: 1.65;
  white-space: pre-line;
}

.problem-meta {
  color: #91d0c5 !important;
  font-size: 0.84rem;
  font-weight: 700;
}

.problem-source {
  color: #f4f6ee;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.side-problem h2 {
  color: #f4f6ee;
}

.side-problem ul {
  margin: 0;
  padding-left: 20px;
  color: #e0ebe5;
  line-height: 1.7;
}

.concept-block {
  display: grid;
  gap: 8px;
}

.concept-title {
  color: #91d0c5;
  font-size: 0.78rem;
  font-weight: 750;
}

.concept-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.concept-chip {
  min-height: 32px;
  padding: 7px 9px;
  border: 1px solid rgba(145, 208, 197, 0.4);
  border-radius: 8px;
  color: #f4f6ee;
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.concept-chip:hover {
  background: rgba(145, 208, 197, 0.18);
}

.concept-chip.is-busy,
.concept-chip:disabled {
  cursor: wait;
  opacity: 0.66;
}

.concept-empty {
  color: #cad8d2;
  font-size: 0.86rem;
}

.tab-list {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.tab-button {
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #f4f6ee;
  background: rgba(255, 255, 255, 0.08);
  text-align: left;
  transition: background 160ms ease, transform 160ms ease;
}

.tab-button:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.14);
}

.tab-button.active {
  background: var(--accent);
}

.logout-button {
  background: rgba(255, 255, 255, 0.04);
}

.main-area {
  padding: 14px;
  min-width: 0;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
  animation: riseIn 220ms ease both;
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar,
.section-heading,
.code-actions,
.check-row,
.teacher-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.code-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: 100%;
  margin-top: 14px;
}

.student-id {
  display: grid;
  gap: 6px;
  min-width: 150px;
  color: var(--muted);
  font-size: 0.9rem;
}

.topbar {
  justify-content: space-between;
  margin-bottom: 12px;
}

.topbar-controls {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(220px, 1fr);
  gap: 12px;
  width: min(620px, 100%);
  margin-left: 0;
}

.problem-picker {
  min-width: 220px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: var(--paper);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(23, 118, 111, 0.12);
}

.task-strip span,
.coach-box .section-heading span,
.language-pill {
  display: inline-flex;
  width: fit-content;
  border-radius: 8px;
  padding: 5px 8px;
  color: #ffffff;
  background: var(--accent-2);
  font-size: 0.76rem;
  font-weight: 750;
}

.box-note,
.status-line {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.workspace-grid,
.teacher-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(380px, 0.8fr);
  gap: 14px;
  align-items: start;
}

.code-workbench,
.coach-box,
.teacher-form,
.teacher-side,
.problem-detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.code-workbench,
.teacher-form,
.teacher-side,
.problem-detail {
  padding: 18px;
}

.code-workbench {
  display: flex;
  flex-direction: column;
  height: calc(100svh - 112px);
  min-height: 680px;
}

.problem-detail {
  margin-bottom: 24px;
}

.problem-detail p {
  color: var(--muted);
  line-height: 1.7;
}

.problem-detail ul {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--ink);
  line-height: 1.8;
}

.coach-column {
  display: flex;
  height: calc(100svh - 112px);
  min-height: 680px;
  max-height: 920px;
  overflow: hidden;
}

.coach-box {
  display: flex;
  min-height: 0;
  overflow: hidden;
  flex-direction: column;
  padding: 16px;
  border: 2px solid #cdd8d2;
}

.unified-coach {
  flex: 1;
  padding: 0;
  border-color: #9dafa7;
  border-radius: 14px;
  background: #fbfcfa;
  box-shadow: 0 20px 54px rgba(20, 41, 34, 0.12), 0 2px 0 rgba(255, 255, 255, 0.9) inset;
}

.coach-heading {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  overflow: hidden;
  padding: 22px 20px 20px;
  color: #e9f2ee;
  background:
    radial-gradient(circle at 90% 10%, rgba(117, 215, 181, 0.18), transparent 35%),
    linear-gradient(135deg, #101d19 0%, #17352c 100%);
}

.coach-heading::after {
  position: absolute;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0.2;
  background-image:
    linear-gradient(rgba(168, 224, 205, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(168, 224, 205, 0.18) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(90deg, transparent 20%, #000 100%);
}

.coach-title-lockup {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 13px;
  align-items: center;
}

.coach-sigil {
  position: relative;
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgba(166, 231, 207, 0.48);
  color: #a8efd5;
  background: rgba(3, 15, 11, 0.3);
  box-shadow: 5px 5px 0 rgba(85, 171, 140, 0.16);
}

.coach-sigil b { font: 800 1.35rem "Cascadia Code", Consolas, monospace; transform: translate(-5px, -3px); }
.coach-sigil i { position: absolute; right: 7px; bottom: 5px; color: #f0a08d; font: 800 0.9rem "Cascadia Code", Consolas, monospace; }

.coach-heading-note {
  margin: 5px 0 0;
  color: #a9bbb5;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
}

.coach-heading h3 {
  margin: 4px 0 0;
  color: #fff;
  font-size: 1.3rem;
  letter-spacing: 0.02em;
}

.coach-heading .eyebrow { color: #85c9b2; }

.coach-mode-badge {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  border: 1px solid rgba(153, 220, 196, 0.38);
  border-radius: 999px;
  padding: 7px 10px;
  color: #c9ddd5;
  font: 700 0.7rem "Cascadia Code", Consolas, monospace;
  background: rgba(255, 255, 255, 0.04);
}

.coach-mode-toolbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-bottom: 1px solid #cbd6d1;
  background: #edf2ef;
}

.coach-tool {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 78px;
  padding: 15px 17px;
  color: #24322e;
  text-align: left;
  background: transparent;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.coach-tool + .coach-tool { border-left: 1px solid #cbd6d1; }
.coach-tool:hover { background: #fff; box-shadow: inset 0 -4px 0 #3f8f77; }
.coach-tool.is-busy { cursor: wait; opacity: 0.62; }
.coach-tool.is-active { color: #fff; background: #24745e; box-shadow: inset 0 -3px 0 #9ce0c8; }
.coach-tool.error-tool:hover { box-shadow: inset 0 -3px 0 #ca4f3c; }

.coach-tool > span:last-child { display: grid; gap: 4px; }
.coach-tool b { font-size: 0.92rem; }
.coach-tool small { color: #71807a; font-size: 0.72rem; line-height: 1.4; }
.coach-tool.is-active small { color: #d6ece4; }
.tool-index { color: #347f69; font: 750 0.68rem "Cascadia Code", Consolas, monospace; }
.error-tool .tool-index { color: #b84938; }
.coach-tool.is-active .tool-index { color: #fff; }

.coach-mode-hint {
  margin: 0;
  padding: 12px 18px;
  border-bottom: 1px solid #dce4e0;
  color: #65736e;
  font-size: 0.78rem;
  line-height: 1.55;
  background: #f7f9f7;
}

.syntax-topic-chips {
  display: block;
  max-height: 420px;
  overflow: auto;
  padding: 16px 18px 18px;
  border-bottom: 1px solid #d7e0dc;
  background: #f2f5f2;
}

.syntax-topic-chips[hidden] { display: none; }

.knowledge-directory-tabs {
  display: grid;
  gap: 7px;
  margin: 0 0 12px;
}

.knowledge-directory-tab {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 48px;
  border: 1px solid #cbd8d1;
  border-radius: 9px;
  padding: 8px 10px;
  color: #284139;
  text-align: left;
  background: #fff;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.knowledge-directory-tab:hover,
.knowledge-directory-tab.is-active {
  border-color: #2f8066;
  background: #eaf5ef;
  transform: translateX(2px);
}

.knowledge-directory-index {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 7px;
  color: #2f8066;
  background: #dceee5;
  font: 800 0.66rem "Cascadia Code", Consolas, monospace;
}

.knowledge-directory-tab > span:nth-child(2) {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.knowledge-directory-tab b { color: #1e342b; font-size: 0.78rem; }
.knowledge-directory-tab small { overflow: hidden; color: #718079; font-size: 0.64rem; text-overflow: ellipsis; white-space: nowrap; }
.knowledge-directory-tab > i { color: #a34c3d; font-size: 1rem; font-style: normal; transition: transform 150ms ease; }
.knowledge-directory-tab.is-active > i { transform: rotate(180deg); }

.knowledge-directory-panels { min-height: 0; }

.knowledge-subdirectory {
  display: grid;
  gap: 9px;
  border-top: 1px solid #d7e0dc;
  padding-top: 12px;
}

.knowledge-subdirectory-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.knowledge-subdirectory-heading > div { display: grid; gap: 2px; }
.knowledge-subdirectory-heading b { color: #213a30; font-size: 0.78rem; }
.knowledge-subdirectory-heading small { color: #77847f; font-size: 0.64rem; line-height: 1.45; }
.knowledge-subdirectory-heading > span { flex: 0 0 auto; color: #398068; font: 750 0.62rem "Cascadia Code", Consolas, monospace; }

.knowledge-subtag-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.concept-directory-chip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 36px;
  border: 1px solid #c7d7ce;
  border-radius: 7px;
  padding: 7px 9px;
  color: #315447;
  background: #fbfdfb;
  font-size: 0.7rem;
  font-weight: 750;
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.concept-directory-chip:hover {
  border-color: #3d8b70;
  background: #edf8f1;
  transform: translateY(-1px);
}

.concept-directory-chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.concept-directory-chip > i { color: #b04c3e; font-size: 0.72rem; font-style: normal; }
.syntax-directory-chip { grid-template-columns: minmax(0, 1fr) auto; }
.syntax-directory-chip small { grid-column: 1 / 2; overflow: hidden; color: #7b8983; font: 500 0.6rem "Cascadia Code", Consolas, monospace; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 640px) {
  .knowledge-subtag-grid { grid-template-columns: 1fr; }
}

.syntax-library-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding: 0 2px;
}

.syntax-library-header > div { display: grid; gap: 2px; }
.syntax-library-header b { color: #17231f; font-size: 0.95rem; }
.syntax-library-header small { color: #728079; font-size: 0.66rem; }
.syntax-library-kicker { color: #357d67; font: 750 0.6rem "Cascadia Code", Consolas, monospace; letter-spacing: 0.1em; }
.syntax-library-header a { flex: 0 0 auto; color: #a63f31; font-size: 0.67rem; font-weight: 800; text-decoration: none; }
.syntax-library-header a:hover { text-decoration: underline; }

.syntax-question-focus {
  display: grid;
  gap: 4px;
  margin: 0 0 12px;
  border: 1px solid #bfd8ca;
  border-left: 4px solid #2f8066;
  border-radius: 8px;
  padding: 10px 12px;
  background: #eaf5ef;
}

.syntax-question-focus span {
  color: #2b765b;
  font-size: 0.65rem;
  font-weight: 800;
}

.syntax-question-focus strong {
  color: #193329;
  font-size: 0.82rem;
  line-height: 1.45;
}

.syntax-question-focus small {
  color: #62756c;
  font-size: 0.68rem;
  line-height: 1.45;
}

.syntax-kind-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 11px; }
.syntax-kind-legend span { --legend-color: #58636d; display: inline-flex; align-items: center; gap: 5px; border: 1px solid #d1d8d4; border-radius: 999px; padding: 4px 7px; color: #65716b; background: rgba(255, 255, 255, 0.72); font-size: 0.61rem; font-weight: 750; }
.syntax-kind-legend i { width: 7px; height: 7px; border-radius: 2px; background: var(--legend-color); }
.syntax-kind-legend .is-function { --legend-color: #197457; }
.syntax-kind-legend .is-type { --legend-color: #2d65a1; }
.syntax-kind-legend .is-method { --legend-color: #a55724; }
.syntax-kind-legend .is-keyword { --legend-color: #a23f36; }
.syntax-kind-legend .is-operator { --legend-color: #806515; }
.syntax-kind-legend .is-syntax { --legend-color: #58636d; }

.syntax-library-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.syntax-group-list {
  display: grid;
  gap: 8px;
}

.syntax-group-section {
  min-width: 0;
}

.syntax-group-card {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto 20px;
  align-items: center;
  width: 100%;
  min-height: 62px;
  gap: 10px;
  border: 1px solid #b8cbc1;
  border-radius: 10px;
  padding: 10px 12px;
  color: #1d342b;
  background: linear-gradient(105deg, #edf7f1 0%, #fffdf8 72%);
  box-shadow: 0 3px 0 rgba(40, 82, 67, 0.05);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.syntax-group-card:hover,
.syntax-group-card[aria-expanded="true"] {
  border-color: #2e8066;
  background: linear-gradient(105deg, #e4f3eb 0%, #fffaf0 72%);
  box-shadow: 0 7px 18px rgba(40, 82, 67, 0.12), inset 4px 0 0 #2f8066;
  transform: translateX(2px);
}

.syntax-group-index {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #9fc0b0;
  border-radius: 8px;
  color: #26745b;
  background: #f9fffb;
  font: 800 0.68rem "Cascadia Code", Consolas, monospace;
  letter-spacing: 0.04em;
}

.syntax-group-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.syntax-group-copy strong {
  color: #1d342b;
  font-size: 0.84rem;
  font-weight: 850;
}

.syntax-group-copy small {
  overflow: hidden;
  color: #718079;
  font-size: 0.67rem;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.syntax-group-count {
  border: 1px solid #d0ded6;
  border-radius: 999px;
  padding: 4px 7px;
  color: #547064;
  background: rgba(255, 255, 255, 0.78);
  font: 700 0.61rem "Cascadia Code", Consolas, monospace;
  white-space: nowrap;
}

.syntax-group-chevron {
  color: #b24c3c;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
  transition: transform 160ms ease;
}

.syntax-group-card[aria-expanded="true"] .syntax-group-chevron {
  transform: rotate(180deg);
}

.syntax-group-panel {
  margin: -1px 6px 0;
  border: 1px solid #c7d9cf;
  border-top: 0;
  border-radius: 0 0 10px 10px;
  padding: 10px 8px 8px;
  background: #f8fcf9;
  box-shadow: inset 0 3px 9px rgba(35, 73, 59, 0.035);
  animation: syntax-panel-reveal 180ms ease-out;
}

.syntax-group-panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 3px 8px;
}

.syntax-group-panel-heading span {
  color: #2a6f58;
  font-size: 0.66rem;
  font-weight: 850;
}

.syntax-group-panel-heading small {
  color: #819089;
  font-size: 0.6rem;
}

.syntax-subtopic-grid {
  gap: 6px;
}

@keyframes syntax-panel-reveal {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

.syntax-topic-card {
  --kind-color: #46665b;
  --kind-soft: #edf2ef;
  --kind-border: #b9c9c2;
  position: relative;
  display: grid;
  grid-template-columns: minmax(82px, auto) minmax(0, 1fr) auto;
  align-items: center;
  min-width: 0;
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--kind-border);
  border-radius: 8px;
  color: #26342f;
  text-align: left;
  background: linear-gradient(90deg, var(--kind-soft) 0, #fff 38%);
  box-shadow: 0 2px 0 rgba(38, 77, 64, 0.04);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.syntax-topic-card:hover,
.syntax-topic-card.is-selected {
  z-index: 1;
  border-color: var(--kind-color);
  transform: translateX(3px);
  box-shadow: 0 6px 16px rgba(36, 64, 54, 0.1), inset 3px 0 0 var(--kind-color);
}

.syntax-topic-card.is-function { --kind-color: #197457; --kind-soft: #e5f4ed; --kind-border: #a8cdbf; }
.syntax-topic-card.is-type { --kind-color: #2d65a1; --kind-soft: #e9f1fa; --kind-border: #b5c9df; }
.syntax-topic-card.is-method { --kind-color: #a55724; --kind-soft: #fff0e5; --kind-border: #e1bfa8; }
.syntax-topic-card.is-keyword { --kind-color: #a23f36; --kind-soft: #fbeae7; --kind-border: #dfb4ae; }
.syntax-topic-card.is-operator { --kind-color: #806515; --kind-soft: #fbf3d9; --kind-border: #d7c68b; }
.syntax-topic-card.is-syntax { --kind-color: #58636d; --kind-soft: #edf0f2; --kind-border: #c3cbd0; }

.syntax-kind { display: inline-flex; align-items: center; gap: 5px; color: var(--kind-color); font: 800 0.6rem "Cascadia Code", Consolas, monospace; letter-spacing: 0.06em; }
.syntax-kind i { width: 7px; height: 7px; border-radius: 2px; background: var(--kind-color); box-shadow: 0 0 0 3px var(--kind-soft); }
.syntax-card-arrow { color: #b24c3c; font-size: 0.9rem; }
.syntax-token { overflow: hidden; border: 1px solid var(--kind-border); border-radius: 7px; padding: 7px 9px; color: var(--kind-color); background: rgba(255, 255, 255, 0.82); font: 800 0.86rem "Cascadia Code", Consolas, monospace; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.syntax-card-copy { display: grid; min-width: 0; gap: 2px; }
.syntax-card-copy strong { color: #1e2d27; font-size: 0.82rem; }
.syntax-card-copy small { display: -webkit-box; overflow: hidden; color: #65746d; font-size: 0.7rem; line-height: 1.45; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.syntax-card-end { display: grid; justify-items: end; gap: 3px; }

.unified-chat-output {
  margin: 0;
  border-top: 0;
  padding: 16px 18px 8px;
}

.unified-chat-input { padding: 0 18px; }
.unified-chat-input textarea { background: #fff; }
.coach-shortcut { margin: 7px 18px 13px; color: #87928e; font: 600 0.66rem "Cascadia Code", Consolas, monospace; }

.chat-error { border-left: 4px solid #c94b39; background: #fff7f4; }
.chat-syntax { border-left: 4px solid #2d8a70; background: #f4faf7; }
.chat-socratic { border-left: 4px solid #48635a; }
.chat-free { border-left: 4px solid #416ea8; background: #f3f7fc; }

#student[data-ai-condition="free_ai"] .coach-mode-toolbar { display: none; }
#student[data-ai-condition="free_ai"] .coach-mode-hint {
  border-left: 4px solid #416ea8;
  color: #4b617a;
  background: #f3f7fc;
}
#student[data-ai-condition="free_ai"] .coach-mode-badge {
  border-color: rgba(176, 205, 241, 0.46);
  color: #dbe9fa;
}

#codeEditor {
  flex: 1 1 auto;
  min-height: 280px;
  margin: 0;
  background: var(--code);
  color: var(--code-text);
  border: 0;
  border-radius: 0;
  font-family: "Cascadia Code", Consolas, monospace;
  line-height: 1.55;
  resize: none;
  tab-size: 4;
}

.editor-panel {
  --console-height: 220px;
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  margin: 12px 0 10px;
  border: 1px solid #31453f;
  border-radius: 8px;
  overflow: hidden;
  background: var(--code);
}

#codeEditorHost {
  flex: 1 1 auto;
  min-height: 280px;
}

.pane-title {
  padding: 8px 12px;
  color: #a9b8b0;
  border-bottom: 1px solid #31453f;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.82rem;
  background: #111a17;
}

.coach-box textarea {
  min-height: 72px;
  max-height: 112px;
  margin: 0;
  resize: vertical;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  padding: 10px 15px;
  border-radius: 8px;
  font-weight: 750;
  white-space: nowrap;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.primary-button {
  color: #fff;
  background: var(--accent);
}

.secondary-button {
  color: var(--ink);
  background: #e6ece8;
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 9px 20px rgba(28, 35, 34, 0.14);
}

.feedback-box,
.advice-output,
.answer-panel,
.problem-list,
.log-list {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.console-panel {
  flex: 0 0 var(--console-height);
  min-height: 120px;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--code);
}

.console-resizer {
  position: relative;
  flex: 0 0 10px;
  cursor: ns-resize;
  border-top: 1px solid #31453f;
  border-bottom: 1px solid #31453f;
  background: #16231f;
  touch-action: none;
}

.console-resizer::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 42px;
  height: 2px;
  border-radius: 8px;
  background: #6f8178;
  transform: translate(-50%, -50%);
}

.console-resizer:hover,
.console-resizer.is-dragging {
  background: #1c312b;
}

.console-title {
  padding: 8px 12px;
  color: #a9b8b0;
  border-bottom: 1px solid #31453f;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 0.82rem;
}

.console-panel .feedback-box {
  height: calc(100% - 35px);
  min-height: 0;
  max-height: none;
  margin-top: 0;
  border-top: 0;
  overflow-y: auto;
  padding: 14px;
  color: var(--code-text);
  font-family: "Cascadia Code", Consolas, monospace;
}

.console-muted {
  color: #a9b8b0;
}

.console-line,
.console-error,
.console-advice {
  margin: 8px 0;
}

.console-error,
.console-advice {
  color: #ffc4b7;
}

.advice-output {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding-right: 8px;
  white-space: normal;
}

.chat-output {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

.chat-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.chat-input-row textarea {
  min-height: 76px;
  max-height: 120px;
  margin: 0;
}

.chat-message {
  max-width: 94%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8faf6;
}

.chat-message span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.chat-message p {
  margin: 0;
  line-height: 1.6;
  white-space: pre-wrap;
}

.chat-user {
  align-self: flex-end;
  background: #e6ece8;
}

.chat-ai {
  align-self: flex-start;
}

.chat-knowledge-recommendations {
  align-self: flex-start;
  width: min(94%, 640px);
  border: 1px solid #c7d9d0;
  border-left: 4px solid #2d8a70;
  border-radius: 10px;
  padding: 11px 12px 12px;
  background: #f3faf6;
}

.chat-knowledge-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.chat-knowledge-heading strong {
  color: #1d604c;
  font-size: 0.82rem;
}

.chat-knowledge-heading small {
  color: #708078;
  font-size: 0.68rem;
}

.chat-knowledge-route-intro {
  margin-bottom: 9px;
  color: #42564d;
  font-size: 0.72rem;
  line-height: 1.55;
}

.chat-knowledge-route {
  display: grid;
  gap: 6px;
  margin: 0 0 10px;
  padding: 0;
  list-style: none;
}

.chat-knowledge-route li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.chat-knowledge-route li > span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #2d8a70;
  font: 800 0.62rem "Cascadia Code", Consolas, monospace;
}

.chat-knowledge-route li div {
  display: grid;
  gap: 2px;
  padding-top: 1px;
}

.chat-knowledge-route li strong {
  color: #25463a;
  font-size: 0.74rem;
}

.chat-knowledge-route li small {
  color: #65766e;
  font-size: 0.68rem;
  line-height: 1.45;
}

.chat-knowledge-card-caption {
  margin: 1px 0 7px;
  color: #8b4e42;
  font-size: 0.66rem;
  font-weight: 750;
}

.chat-knowledge-card-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.chat-knowledge-card {
  display: grid;
  min-width: 0;
  gap: 4px;
  border: 1px solid #b9d1c5;
  border-radius: 8px;
  padding: 10px;
  color: #20352c;
  text-align: left;
  background: #fff;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.chat-knowledge-card:hover,
.chat-knowledge-card:focus-visible {
  border-color: #2d8a70;
  box-shadow: 0 6px 16px rgba(45, 138, 112, 0.14);
  outline: none;
  transform: translateY(-1px);
}

.chat-knowledge-card-kind {
  color: #2d8a70;
  font: 800 0.62rem "Cascadia Code", Consolas, monospace;
  letter-spacing: 0.05em;
}

.chat-knowledge-card strong {
  overflow: hidden;
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-knowledge-card code {
  overflow: hidden;
  color: #65746d;
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-knowledge-card small {
  display: -webkit-box;
  min-height: 2.7em;
  overflow: hidden;
  color: #66756e;
  font-size: 0.7rem;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.chat-knowledge-card i {
  justify-self: end;
  color: #b24c3c;
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 750;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(12, 18, 16, 0.62);
}

.modal-backdrop[hidden] {
  display: none;
}

.concept-modal {
  position: relative;
  width: min(720px, 100%);
  max-height: min(760px, 88svh);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: var(--paper);
  box-shadow: 0 24px 80px rgba(28, 35, 34, 0.24);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  color: var(--ink);
  background: #e6ece8;
  font-size: 1.25rem;
}

.concept-modal h2 {
  margin-right: 44px;
}

.concept-modal h3 {
  margin-top: 18px;
}

.authority-box {
  margin: 16px 0;
  border-left: 4px solid var(--accent-2);
  border-radius: 8px;
  padding: 12px 14px;
  background: #eef5f1;
}

.authority-box h3 {
  margin-top: 0;
}

.authority-box p {
  margin: 8px 0;
  color: var(--ink);
  line-height: 1.75;
}

.authority-box a,
.authority-box span {
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 750;
}

.concept-modal ul,
.concept-modal ol {
  margin: 10px 0 0;
  padding-left: 20px;
  color: var(--ink);
  line-height: 1.75;
}

.concept-summary,
.answer-overview {
  color: var(--muted);
  line-height: 1.75;
}

.concept-modal pre {
  overflow-x: auto;
  border-radius: 8px;
  padding: 14px;
  color: var(--code-text);
  background: var(--code);
  font-family: "Cascadia Code", Consolas, monospace;
  line-height: 1.55;
}

.concept-example-list {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}

.concept-example-block {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.concept-example-block:first-child {
  border-top: 0;
  padding-top: 0;
}

.concept-example-block h4 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 1rem;
}

.concept-example-block pre {
  margin: 0;
}

.concept-example-block p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.syntax-detail-backdrop {
  inset: 0;
  z-index: 36;
  display: grid;
  place-items: center;
  width: 100vw;
  height: 100svh;
  padding: 18px;
  background: rgba(8, 25, 19, 0.18);
  backdrop-filter: blur(2px);
  pointer-events: auto;
}

.syntax-detail-modal {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1120px, calc(100vw - 36px));
  height: min(880px, calc(100svh - 36px));
  max-height: calc(100svh - 36px);
  overflow: hidden;
  border: 1px solid #9eaca6;
  border-radius: 16px;
  color: #1a2823;
  background: #fbfcf8;
  box-shadow: 18px 22px 70px rgba(6, 23, 17, 0.24);
  pointer-events: auto;
  animation: syntaxDrawerIn 220ms ease-out both;
}

.syntax-detail-modal.is-dragging {
  user-select: none;
  box-shadow: 22px 28px 82px rgba(6, 23, 17, 0.3);
}

@keyframes syntaxDrawerIn {
  from { opacity: 0; transform: translateY(6px) scale(0.995); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.syntax-detail-close {
  z-index: 2;
  top: 12px;
  right: 14px;
  border: 1px solid #becbc5;
  color: #29443a;
  background: rgba(255, 255, 255, 0.88);
}

.syntax-detail-close:hover { background: rgba(198, 74, 54, 0.88); }

.syntax-detail-hero {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid #cbd6d1;
  padding: 12px 58px 11px 28px;
  color: #1d382e;
  background:
    radial-gradient(circle at 88% 10%, rgba(217, 169, 66, 0.16), transparent 30%),
    linear-gradient(115deg, #f7f3e8 0%, #eef5ef 72%, #e3efe9 100%);
  cursor: default;
  touch-action: auto;
  grid-column: 1 / -1;
}

.syntax-detail-modal.is-dragging .syntax-detail-hero { cursor: default; }

.syntax-detail-hero-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 20px;
}

.syntax-detail-hero-kicker .eyebrow { margin: 0; }

.syntax-drag-hint {
  border: 1px solid rgba(61, 112, 92, 0.24);
  border-radius: 999px;
  padding: 2px 7px;
  color: #547268;
  background: rgba(255, 255, 255, 0.64);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.syntax-detail-hero::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 9px; background: linear-gradient(#24775b, #65a78d); }

.syntax-detail-hero .eyebrow { color: #3a8068; }
.syntax-detail-hero h2 { max-width: 620px; margin: 2px 0 4px; color: #152c24; font-size: clamp(1.22rem, 1.8vw, 1.6rem); line-height: 1.15; }
.syntax-detail-hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 14px; color: #66776f; font-size: 0.72rem; line-height: 1.35; }
.syntax-detail-hero a { display: inline-block; color: #a54636; font-size: 0.7rem; font-weight: 800; text-decoration: none; }
.syntax-detail-hero a:hover { text-decoration: underline; }

.syntax-detail-body { min-width: 0; overflow-y: auto; padding: 26px 32px 32px; background: linear-gradient(90deg, rgba(38, 119, 91, 0.035) 1px, transparent 1px) 0 0 / 36px 100%, #fbfcf8; }

.syntax-follow-up {
  position: relative;
  z-index: 2;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  padding: 20px 18px 14px;
  border-left: 1px solid #b8c8c1;
  background: linear-gradient(180deg, #edf4f0 0%, #f7f9f7 100%);
  box-shadow: -10px 0 28px rgba(16, 52, 40, 0.06);
}

.syntax-follow-up-heading {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.syntax-follow-up-heading > div { display: grid; gap: 4px; }
.syntax-follow-up-heading span { color: #34745f; font: 800 0.64rem "Cascadia Code", Consolas, monospace; letter-spacing: 0.08em; }
.syntax-follow-up-heading strong { color: #192d25; font-size: 1.05rem; }
.syntax-follow-up-heading small { color: #6f7d77; font-size: 0.66rem; }

.syntax-follow-up-thread {
  display: grid;
  min-height: 0;
  flex: 1 1 auto;
  align-content: start;
  gap: 7px;
  margin-bottom: 12px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid #c6d2cd;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  scrollbar-gutter: stable;
}

.syntax-follow-up-thread[hidden] { display: none; }
.syntax-follow-up-empty {
  display: grid;
  min-height: 150px;
  flex: 1 1 auto;
  place-items: center;
  margin: 0 0 12px;
  border: 1px dashed #b7c9c1;
  border-radius: 9px;
  padding: 18px;
  color: #687a72;
  background: rgba(255, 255, 255, 0.48);
  font-size: 0.76rem;
  line-height: 1.7;
  text-align: center;
}
.syntax-follow-up-empty[hidden] { display: none; }
.syntax-follow-up-message { max-width: 94%; border-radius: 7px; padding: 8px 10px; background: #e7f2ed; }
.syntax-follow-up-message.is-user { justify-self: end; background: #e6eae8; }
.syntax-follow-up-message span { display: block; margin-bottom: 3px; color: #64736d; font-size: 0.66rem; font-weight: 800; }
.syntax-follow-up-message p { margin: 0; color: #21332c; font-size: 0.78rem; line-height: 1.55; white-space: pre-wrap; }

.syntax-follow-up-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
}

.syntax-follow-up-composer textarea { min-height: 52px; max-height: 90px; margin: 0; resize: vertical; background: #fff; }
.syntax-follow-up-composer button { min-width: 76px; }
.syntax-follow-up-shortcut { margin: 7px 1px 0; color: #7b8983; font: 600 0.62rem "Cascadia Code", Consolas, monospace; }
.syntax-follow-up > p { margin: 6px 2px 0; color: #7b8983; font: 600 0.61rem "Cascadia Code", Consolas, monospace; }
.syntax-detail-lede { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 18px; }
.syntax-detail-badge { border: 1px solid #2f8066; border-radius: 999px; padding: 5px 9px; color: #176047; background: #e6f2ed; font-size: 0.7rem; font-weight: 800; }
.syntax-detail-badge.is-function { border-color: #197457; color: #145d47; background: #e5f4ed; }
.syntax-detail-badge.is-type { border-color: #2d65a1; color: #275789; background: #e9f1fa; }
.syntax-detail-badge.is-method { border-color: #a55724; color: #87471f; background: #fff0e5; }
.syntax-detail-badge.is-keyword { border-color: #a23f36; color: #87342d; background: #fbeae7; }
.syntax-detail-badge.is-operator { border-color: #806515; color: #6c5512; background: #fbf3d9; }
.syntax-detail-badge.is-syntax { border-color: #58636d; color: #4f5962; background: #edf0f2; }
.syntax-detail-badge.is-muted { border-color: #cbd5d0; color: #64746d; background: #edf1ef; }

.syntax-detail-takeaway { display: grid; gap: 7px; margin-bottom: 20px; border: 1px solid #a8cbbb; border-left: 5px solid #2c8a69; border-radius: 9px; padding: 15px 18px; background: linear-gradient(100deg, #e5f3ec, #f8fbf9); }
.syntax-detail-takeaway span { color: #28765c; font: 800 0.65rem "Cascadia Code", Consolas, monospace; letter-spacing: 0.08em; }
.syntax-detail-takeaway strong { color: #172a23; font-size: 1rem; line-height: 1.7; }

.syntax-confusion-note { display: grid; grid-template-columns: 92px 1fr; align-items: start; gap: 12px; margin: -8px 0 20px; border: 1px solid #e0c888; border-radius: 8px; padding: 12px 14px; background: #fff9e8; }
.syntax-confusion-note span { color: #826417; font: 800 0.66rem "Cascadia Code", Consolas, monospace; letter-spacing: 0.06em; }
.syntax-confusion-note p { margin: 0; color: #615733; line-height: 1.65; }

.syntax-detail-overview { display: grid; grid-template-columns: 1.08fr 0.92fr; gap: 12px; }
.syntax-detail-overview-single { grid-template-columns: 1fr; }
.syntax-detail-panel { border: 1px solid #d2dbd7; border-radius: 9px; padding: 17px 18px; background: #fff; }
.syntax-detail-panel.is-definition { border-left: 4px solid #2c8a69; background: #edf6f1; }
.syntax-detail-panel p { margin: 0; line-height: 1.75; }
.syntax-detail-panel ul { margin: 8px 0 0; padding-left: 18px; line-height: 1.7; }
.syntax-detail-label { margin-bottom: 7px !important; color: #28765c; font-size: 0.76rem; font-weight: 800; }

.syntax-detail-section { margin-top: 24px; }
.syntax-detail-section-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.syntax-detail-section-heading span { color: #c6513f; font: 800 0.66rem "Cascadia Code", Consolas, monospace; }
.syntax-detail-section-heading h3 { margin: 0; font-size: 1rem; }
.syntax-detail-code { margin: 0; border: 1px solid #26473c; border-radius: 8px; padding: 16px 18px; color: #dff8ed; background: #091b15; font: 600 0.84rem/1.7 "Cascadia Code", Consolas, monospace; white-space: pre-wrap; }

.syntax-extended-guide { display: grid; gap: 18px; }
.slice-index-board { overflow-x: auto; border: 1px solid #b9cec5; border-radius: 10px; padding: 16px; background: linear-gradient(135deg, #eef7f2 0%, #fbfcf8 65%); }
.slice-guide-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; min-width: 560px; margin-bottom: 14px; }
.slice-guide-heading > div { display: grid; gap: 4px; }
.slice-guide-heading span,
.slice-subheading span { color: #2a795f; font: 800 0.62rem "Cascadia Code", Consolas, monospace; letter-spacing: 0.09em; text-transform: uppercase; }
.slice-guide-heading strong { color: #17342a; font: 750 0.92rem "Cascadia Code", Consolas, monospace; }
.slice-guide-heading p { max-width: 330px; margin: 0; color: #617269; font-size: 0.78rem; line-height: 1.55; text-align: right; }
.slice-index-grid { display: grid; grid-template-columns: 78px repeat(var(--slice-count), minmax(54px, 1fr)); gap: 5px; min-width: 560px; }
.slice-index-row-label,
.slice-index-cell { display: grid; place-items: center; min-height: 39px; border-radius: 6px; }
.slice-index-row-label { justify-content: start; padding-left: 10px; color: #597068; background: #e2ebe7; font-size: 0.72rem; }
.slice-index-cell { border: 1px solid #d2ddd8; background: #fff; font: 750 0.78rem "Cascadia Code", Consolas, monospace; }
.slice-index-cell.is-character { border-color: #2a745b; color: #f0fff9; background: #174c3b; font-size: 0.9rem; }
.slice-index-cell.is-positive { color: #24644f; background: #edf7f2; }
.slice-index-cell.is-negative { border-color: #ebd0a2; color: #895f18; background: #fff7e7; }

.slice-subheading { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 -4px; }
.slice-subheading h4 { margin: 0; color: #23372f; font-size: 0.9rem; }
.slice-rule-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.slice-rule-card { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 10px; min-height: 142px; border: 1px solid #d1dbd6; border-radius: 9px; padding: 14px; background: #fff; }
.slice-rule-card:nth-child(3n + 1) { border-top: 3px solid #278063; }
.slice-rule-card:nth-child(3n + 2) { border-top: 3px solid #d09a31; }
.slice-rule-card:nth-child(3n) { border-top: 3px solid #b95542; }
.slice-rule-number { display: grid; place-items: center; align-self: start; width: 31px; height: 31px; border-radius: 50%; color: #f5fbf8; background: #244d3f; font: 800 0.63rem "Cascadia Code", Consolas, monospace; }
.slice-rule-card h4 { margin: 2px 0 7px; color: #1f332b; font-size: 0.86rem; }
.slice-rule-card p { margin: 0 0 10px; color: #596961; font-size: 0.78rem; line-height: 1.65; }
.slice-rule-card code { display: inline-block; max-width: 100%; border-radius: 5px; padding: 5px 7px; color: #154f3c; background: #edf5f1; font: 750 0.72rem "Cascadia Code", Consolas, monospace; white-space: normal; }

.slice-pattern-wrap { overflow-x: auto; border: 1px solid #cad6d0; border-radius: 9px; background: #fff; }
.slice-pattern-table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 0.76rem; }
.slice-pattern-table th { padding: 10px 12px; color: #d7eee5; background: #163e31; font-size: 0.68rem; text-align: left; letter-spacing: 0.05em; }
.slice-pattern-table td { border-top: 1px solid #e0e7e3; padding: 10px 12px; color: #56675f; line-height: 1.5; vertical-align: middle; }
.slice-pattern-table tbody tr:nth-child(even) { background: #f6f9f7; }
.slice-pattern-table tbody tr:hover { background: #edf5f1; }
.slice-pattern-table td:first-child code { color: #176147; font-weight: 800; }
.slice-pattern-table td:nth-child(3) code { color: #9a4a35; font-weight: 800; }

.slice-mutable-note { display: grid; gap: 12px; border: 1px solid #e3c88e; border-left: 4px solid #cb9730; border-radius: 9px; padding: 15px; background: #fff9eb; }
.slice-mutable-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
.slice-mutable-grid article { display: grid; grid-template-columns: 128px minmax(205px, 0.8fr) minmax(0, 1fr); align-items: start; gap: 10px; min-width: 0; border: 1px solid #ebdbb7; border-radius: 7px; padding: 11px 12px; background: rgba(255, 255, 255, 0.8); }
.slice-mutable-grid h4 { margin: 6px 0 0; color: #5f4c22; font-size: 0.8rem; }
.slice-mutable-grid code { display: block; overflow-wrap: anywhere; border-radius: 5px; padding: 7px; color: #694d13; background: #fff4d7; font: 700 0.68rem/1.5 "Cascadia Code", Consolas, monospace; white-space: normal; }
.slice-mutable-grid p { margin: 2px 0 0; color: #695f48; font-size: 0.74rem; line-height: 1.6; }

.syntax-parameter-list { overflow: hidden; border: 1px solid #d1dad6; border-radius: 8px; background: #fff; }
.syntax-parameter-row { display: grid; grid-template-columns: minmax(150px, 0.34fr) 1fr; align-items: center; gap: 18px; min-height: 62px; padding: 12px 15px; }
.syntax-parameter-row + .syntax-parameter-row { border-top: 1px solid #e3e9e6; }
.syntax-parameter-row code { justify-self: start; border-radius: 6px; padding: 5px 8px; color: #176147; background: #edf6f1; font: 750 0.78rem "Cascadia Code", Consolas, monospace; }
.syntax-parameter-row p { margin: 0; color: #53635c; line-height: 1.6; }
.syntax-return-note { display: grid; grid-template-columns: 88px 1fr; align-items: center; gap: 12px; margin-top: 10px; border: 1px solid #ead7a4; border-left: 4px solid #d2a43e; border-radius: 7px; padding: 12px 14px; background: #fff8e8; }
.syntax-return-note b { color: #805f16; }

.syntax-example-list { display: grid; gap: 16px; }
.syntax-example-card { overflow: hidden; border: 1px solid #ccd7d2; border-radius: 9px; background: #fff; }
.syntax-example-title { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid #d9e1dd; }
.syntax-example-title span { color: #2c7d62; font: 800 0.62rem "Cascadia Code", Consolas, monospace; letter-spacing: 0.08em; }
.syntax-example-flow { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(180px, 0.75fr); align-items: stretch; }
.syntax-example-code-block,
.syntax-example-output-block { display: grid; grid-template-rows: auto 1fr; min-width: 0; }
.syntax-example-output-block { border-left: 1px solid #314b41; background: #10261e; }
.syntax-example-label { display: block; padding: 8px 14px; color: #6f7d77; background: #edf1ef; font: 800 0.63rem "Cascadia Code", Consolas, monospace; letter-spacing: 0.08em; }
.syntax-example-output-block .syntax-example-label { color: #9ecbb9; background: #173329; }
.syntax-example-card .syntax-detail-code { min-height: 132px; border: 0; border-radius: 0; }
.syntax-example-output-block pre { min-height: 132px; margin: 0; border: 0; border-radius: 0; padding: 16px; color: #f4d58d; background: #10261e; font: 650 0.82rem/1.7 "Cascadia Code", Consolas, monospace; white-space: pre-wrap; }
.syntax-example-explanation { position: relative; z-index: 2; margin: 0; border-top: 1px solid #cfdad5; padding: 13px 15px 15px; color: #4f6158; line-height: 1.7; background: #f6faf7; }
.syntax-example-explanation b { color: #1f694f; }

.syntax-mistake-section { border: 1px solid #ead2cc; border-left: 4px solid #c9513f; border-radius: 9px; padding: 15px 17px; background: #fff5f2; }
.syntax-notes-section { border-top: 1px dashed #bfcac5; padding-top: 18px; }
.syntax-mistake-section ul,
.syntax-notes-section ul { margin: 6px 0 0; padding-left: 20px; line-height: 1.75; }

.feedback-box:empty,
.advice-output:empty,
.answer-panel:empty {
  display: none;
}

.result-error {
  color: #ffc4b7;
  font-weight: 750;
}

.result-ok {
  color: #93e5c9;
  font-weight: 750;
}

pre {
  white-space: pre-wrap;
  overflow-x: auto;
  border-radius: 8px;
  padding: 14px;
  color: var(--code-text);
  background: var(--code);
}

.teacher-form,
.api-config {
  display: grid;
  gap: 14px;
}

.teacher-form label,
.api-config label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
}

.api-config {
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.teacher-form .check-row {
  grid-template-columns: auto 1fr;
  justify-content: start;
  color: var(--ink);
}

.teacher-form .check-row input {
  width: auto;
}

.teacher-form textarea {
  min-height: 90px;
}

.teacher-form .code-input {
  min-height: 130px;
  font-family: "Cascadia Code", Consolas, monospace;
}

.problem-list,
.log-list {
  display: grid;
  gap: 10px;
}

.problem-item,
.log-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcf8;
}

.problem-item {
  display: grid;
  gap: 10px;
}

.problem-item header,
.problem-item footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.problem-item p,
.log-item p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.problem-status {
  width: fit-content;
  margin: 0 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 11px;
  font-weight: 750;
}

.status-pending {
  color: #5d6a70;
  background: #eef2ef;
}

.status-completed {
  color: #0d5f51;
  background: #dff3ed;
}

.status-stuck {
  color: #7b5d12;
  background: #fff1c7;
}

.status-attempted {
  color: #9b3928;
  background: #ffe5dc;
}

.progress-summary {
  margin: 14px 0 18px;
  overflow-x: auto;
}

.progress-summary table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  background: #fbfcf8;
}

.progress-summary th,
.progress-summary td {
  border: 1px solid var(--line);
  padding: 10px;
  text-align: left;
  white-space: nowrap;
}

.progress-summary th {
  color: var(--muted);
  background: #eef2ef;
}

.log-heading {
  margin-top: 26px;
}

.log-item strong {
  color: var(--accent-3);
}

@media (max-width: 980px) {
  .app-shell,
  .login-screen,
  .login-grid,
  .workspace-grid,
  .teacher-grid,
  .task-strip {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .coach-column {
    min-height: auto;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .coach-box {
    min-height: 360px;
  }

  .code-workbench {
    height: auto;
    min-height: auto;
  }

  .editor-panel {
    min-height: 660px;
  }

  #codeEditor {
    min-height: 420px;
  }

  #codeEditorHost {
    min-height: 420px;
    height: 420px;
  }

  .advice-output {
    max-height: 220px;
  }

  .topbar-controls {
    width: 100%;
  }

  .code-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .main-area,
  .login-screen,
  .sidebar,
  .code-workbench,
  .coach-box,
  .teacher-form,
  .teacher-side,
  .problem-detail {
    padding: 16px;
  }

  .topbar,
  .teacher-actions,
  .section-heading,
  .problem-item header,
  .problem-item footer {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-controls,
  .chat-input-row {
    grid-template-columns: 1fr;
  }

  .coach-heading { flex-direction: column; }
  .unified-coach { padding: 0; }
  .coach-title-lockup { align-items: flex-start; }
  .coach-mode-toolbar { grid-template-columns: 1fr; }
  .coach-tool + .coach-tool { border-top: 1px solid #cbd6d1; border-left: 0; }
  .syntax-library-grid { grid-template-columns: 1fr; }
  .syntax-library-header { align-items: flex-start; flex-direction: column; gap: 8px; }

  .syntax-detail-backdrop { width: 100vw; height: 100svh; padding: 0; }
  .syntax-detail-modal {
    top: 0 !important;
    left: 0 !important;
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr) auto;
    width: 100%;
    height: 100svh;
    max-height: 100svh;
    min-height: 100svh;
    border: 0;
    border-radius: 0;
  }
  .syntax-detail-hero { padding: 12px 52px 11px 20px; cursor: default; touch-action: auto; }
  .syntax-drag-hint { display: none; }
  .syntax-detail-hero-meta { gap: 3px 10px; }
  .syntax-detail-hero::after { display: none; }
  .syntax-detail-body { padding: 20px 18px; }
  .syntax-follow-up {
    max-height: 42svh;
    padding: 11px 12px 9px;
    border-top: 1px solid #b8c8c1;
    border-left: 0;
    box-shadow: 0 -10px 28px rgba(16, 52, 40, 0.08);
  }
  .syntax-follow-up-heading { align-items: flex-start; flex-direction: column; gap: 3px; }
  .syntax-follow-up-heading small { display: none; }
  .syntax-follow-up-thread { min-height: 90px; max-height: 140px; }
  .syntax-follow-up-empty { min-height: 80px; }
  .syntax-detail-overview { grid-template-columns: 1fr; }
  .syntax-confusion-note { grid-template-columns: 1fr; gap: 5px; }
  .syntax-example-flow { grid-template-columns: 1fr; }
  .syntax-example-output-block { border-top: 1px solid #314b41; border-left: 0; }
  .slice-rule-grid,
  .slice-mutable-grid { grid-template-columns: 1fr; }
  .slice-rule-card { min-height: 0; }
  .slice-mutable-grid article { grid-template-columns: 1fr; }
  .slice-mutable-grid h4,
  .slice-mutable-grid p { margin-top: 0; }
  .syntax-topic-card { grid-template-columns: minmax(72px, auto) minmax(0, 1fr); }
  .syntax-card-end { display: none; }
  .syntax-group-card { grid-template-columns: 30px minmax(0, 1fr) 18px; gap: 8px; padding: 9px 10px; }
  .syntax-group-index { width: 26px; height: 26px; }
  .syntax-group-count { display: none; }
  .syntax-group-panel { margin-left: 3px; margin-right: 3px; padding: 9px 6px 7px; }
  .syntax-group-panel-heading { align-items: flex-start; flex-direction: column; gap: 2px; }
  .syntax-parameter-row { grid-template-columns: 1fr; gap: 5px; }
  .code-actions {
    grid-template-columns: 1fr;
  }

  .primary-button,
  .secondary-button {
    width: 100%;
  }
}

/* Textbook edition login experience */
.login-screen {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(480px, 0.92fr);
  gap: 0;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  background: #0b100f;
  color: #f4f7f5;
}

.login-visual {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  border-right: 1px solid rgba(151, 225, 199, 0.2);
}

.login-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.72) contrast(1.08) brightness(0.55);
  transform: scale(1.04);
  animation: backdropBreath 14s ease-in-out infinite alternate;
  z-index: -4;
}

.login-visual::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(5, 11, 9, 0.18), rgba(5, 11, 9, 0.72) 92%), linear-gradient(180deg, rgba(7, 15, 12, 0.08), #07100d 108%);
  z-index: -3;
}

.visual-grid {
  position: absolute;
  inset: 0;
  opacity: 0.26;
  background-image: linear-gradient(rgba(150, 219, 195, 0.13) 1px, transparent 1px), linear-gradient(90deg, rgba(150, 219, 195, 0.13) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, black, transparent 90%);
  z-index: -2;
}

.scan-line {
  position: absolute;
  left: 0;
  right: 0;
  top: -10%;
  height: 1px;
  background: rgba(169, 246, 217, 0.72);
  box-shadow: 0 0 18px rgba(127, 233, 195, 0.52);
  animation: scan 7s linear infinite;
}

.data-traces span {
  position: absolute;
  width: 140px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #8ee3c4, transparent);
  opacity: 0;
  animation: trace 6s linear infinite;
}

.data-traces span:nth-child(1) { top: 18%; left: 9%; animation-delay: 0.3s; }
.data-traces span:nth-child(2) { top: 36%; left: 46%; animation-delay: 2.1s; }
.data-traces span:nth-child(3) { top: 69%; left: 18%; animation-delay: 3.7s; }
.data-traces span:nth-child(4) { top: 82%; left: 58%; animation-delay: 5s; }

.login-copy {
  position: absolute;
  top: clamp(48px, 9vh, 108px);
  left: clamp(34px, 7vw, 112px);
  right: 38px;
  max-width: none;
  animation: loginReveal 700ms 100ms cubic-bezier(.2,.8,.2,1) both;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #b9d5ca;
  font: 700 0.78rem "Cascadia Code", Consolas, monospace;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(148, 231, 201, 0.55);
  color: #98e7ca;
  background: rgba(9, 25, 19, 0.72);
}

.login-copy h1 {
  max-width: 670px;
  margin: 36px 0 22px;
  color: #f6faf8;
  font-size: clamp(3rem, 6.6vw, 6.8rem);
  font-weight: 760;
  line-height: 0.96;
}

.login-copy p,
.login-copy p:last-child { margin: 0; color: #c5d5cf; font-size: 1.05rem; line-height: 1.7; }

.code-sample {
  position: absolute;
  left: clamp(34px, 7vw, 112px);
  bottom: clamp(64px, 10vh, 120px);
  width: min(480px, calc(100% - 76px));
  border: 1px solid rgba(157, 228, 203, 0.28);
  background: rgba(5, 14, 11, 0.72);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(12px);
  animation: loginReveal 800ms 280ms cubic-bezier(.2,.8,.2,1) both;
}

.code-sample-bar { display: flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border-bottom: 1px solid rgba(157, 228, 203, 0.18); }
.code-sample-bar span { width: 6px; height: 6px; background: #c95b48; }
.code-sample-bar span:nth-child(2) { background: #d8bb57; }
.code-sample-bar span:nth-child(3) { background: #74c9a8; }
.code-sample-bar b { margin-left: 6px; color: #80998f; font: 500 0.72rem "Cascadia Code", Consolas, monospace; }
.code-sample pre { margin: 0; padding: 20px; color: #ddf3e9; background: transparent; font-size: clamp(0.82rem, 1.2vw, 0.98rem); line-height: 1.9; }
.code-sample pre i { margin-right: 18px; color: #53766a; font-style: normal; user-select: none; }
.code-cursor { display: inline-block; width: 9px; height: 1.1em; background: #98e7ca; animation: cursorBlink 900ms steps(1) infinite; vertical-align: -2px; }
.image-credit { position: absolute; bottom: 18px; left: 24px; margin: 0; color: rgba(210, 228, 221, 0.45); font-size: 0.68rem; }

.login-access {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: clamp(34px, 5vw, 76px);
  background: #f5f7f6;
  color: #18201e;
}

.access-header { margin-bottom: 34px; animation: loginReveal 650ms 180ms cubic-bezier(.2,.8,.2,1) both; }
.access-index { color: #247862; font: 700 0.72rem "Cascadia Code", Consolas, monospace; }
.access-header h2 { margin: 13px 0 10px; font-size: clamp(2rem, 3.3vw, 3.25rem); line-height: 1.05; }
.access-header p { margin: 0; color: #66716e; line-height: 1.65; }

.login-screen .login-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
.login-screen .login-panel {
  display: grid;
  grid-template-columns: minmax(190px, 0.82fr) minmax(180px, 1fr) minmax(160px, 0.68fr);
  gap: 18px;
  align-items: end;
  justify-content: normal;
  min-height: 132px;
  padding: 22px;
  border: 1px solid #d5ddda;
  border-left: 3px solid #23866d;
  border-radius: 4px;
  color: #18201e;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 14px 35px rgba(27, 43, 38, 0.06);
  animation: loginReveal 650ms 300ms cubic-bezier(.2,.8,.2,1) both;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.login-screen .login-panel:hover,
.login-screen .login-panel:focus-within { transform: translateX(-5px); border-color: #a9c9be; box-shadow: 12px 18px 44px rgba(27, 43, 38, 0.1); }
.login-screen .teacher-login { grid-template-columns: minmax(190px, 0.72fr) minmax(260px, 1.2fr) minmax(160px, 0.68fr); border-left-color: #c75d49; animation-delay: 410ms; }
.panel-heading { display: flex; align-items: flex-start; gap: 14px; align-self: center; }
.panel-number { color: #2f806a; font: 700 0.72rem "Cascadia Code", Consolas, monospace; }
.teacher-login .panel-number { color: #b8503d; }
.panel-heading h3 { margin: -2px 0 6px; font-size: 1.17rem; }
.panel-heading p { margin: 0; color: #75807c; font-size: 0.78rem; line-height: 1.45; }
.login-screen .login-panel label { display: grid; gap: 7px; color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.teacher-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.login-screen .login-panel input { height: 45px; border-radius: 3px; border-color: #cfd8d4; background: #f8faf9; font-weight: 600; }
.login-screen .login-panel input:focus { border-color: #26846c; box-shadow: 0 0 0 3px rgba(38, 132, 108, 0.12); background: #fff; }
.login-screen .teacher-login input:focus { border-color: #bf5a46; box-shadow: 0 0 0 3px rgba(191, 90, 70, 0.12); }
.login-screen .login-panel button { display: flex; min-height: 45px; align-items: center; justify-content: space-between; gap: 12px; border-radius: 3px; padding: 12px 15px; }
.login-panel button b { font-size: 1.15rem; transition: transform 180ms ease; }
.login-panel button:hover b { transform: translateX(4px); }
.login-access > .status-line { min-height: 26px; margin: 16px 0 0; color: #b14736; font-weight: 650; }
.access-footer { display: flex; flex-wrap: wrap; gap: 10px 24px; margin-top: 18px; color: #7b8582; font: 600 0.72rem "Cascadia Code", Consolas, monospace; animation: loginReveal 650ms 520ms both; }
.access-footer span { position: relative; }
.access-footer span:not(:last-child)::after { content: "/"; position: absolute; right: -15px; color: #b7bfbc; }

@keyframes loginReveal { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes scan { from { transform: translateY(-10vh); opacity: 0; } 12%, 86% { opacity: 0.7; } to { transform: translateY(120vh); opacity: 0; } }
@keyframes trace { 0% { transform: translateX(-80px); opacity: 0; } 16%, 58% { opacity: 0.72; } 76%, 100% { transform: translateX(240px); opacity: 0; } }
@keyframes backdropBreath { from { transform: scale(1.04); } to { transform: scale(1.09); } }
@keyframes cursorBlink { 50% { opacity: 0; } }

@media (max-width: 1180px) {
  .login-screen { grid-template-columns: minmax(340px, 0.8fr) minmax(500px, 1.2fr); }
  .login-screen .login-panel, .login-screen .teacher-login { grid-template-columns: minmax(150px, 0.8fr) minmax(190px, 1fr); }
  .login-screen .login-panel button { grid-column: 2; }
  .teacher-fields { grid-template-columns: 1fr; }
  .login-copy h1 { font-size: clamp(3rem, 6vw, 5.4rem); }
}

@media (max-width: 820px) {
  .login-screen { display: block; overflow: visible; padding: 0; background: #f5f7f6; }
  .login-visual { min-height: 48svh; border-right: 0; border-bottom: 1px solid rgba(151, 225, 199, 0.2); }
  .login-copy { top: 34px; left: 24px; right: 24px; }
  .login-copy h1 { margin: 22px 0 14px; font-size: clamp(2.65rem, 12vw, 4.8rem); }
  .code-sample { display: none; }
  .login-access { min-height: 52svh; padding: 34px 20px 42px; }
  .access-header { margin-bottom: 24px; }
  .login-screen .login-panel, .login-screen .teacher-login { grid-template-columns: 1fr; align-items: stretch; }
  .login-screen .login-panel button { grid-column: auto; }
  .teacher-fields { grid-template-columns: 1fr; }
  .login-screen .login-panel:hover, .login-screen .login-panel:focus-within { transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .login-backdrop, .scan-line, .data-traces span, .code-cursor, .login-copy, .code-sample, .access-header, .login-panel, .access-footer { animation: none !important; }
}

/* Teacher learning progress dashboard */
.teacher-dashboard {
  display: grid;
  gap: 14px;
  margin: 0 0 18px;
  padding: 16px;
  border: 1px solid #bcc9c3;
  border-radius: 14px;
  background: #edf2ef;
  box-shadow: 0 18px 48px rgba(23, 49, 40, 0.09);
}

.dashboard-heading {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  overflow: hidden;
  padding: 21px 22px;
  border-radius: 10px;
  color: #e9f2ee;
  background: #142b24;
}

.dashboard-heading::after {
  position: absolute;
  right: -42px;
  bottom: -72px;
  width: 230px;
  height: 160px;
  border: 1px solid rgba(136, 222, 191, 0.2);
  border-radius: 50%;
  content: "";
  box-shadow: 0 0 0 24px rgba(136, 222, 191, 0.04), 0 0 0 48px rgba(136, 222, 191, 0.025);
}

.dashboard-heading h2 { margin: 5px 0 4px; color: #fff; font-size: 1.45rem; }
.dashboard-heading p:last-child { margin: 0; color: #aec0b9; font-size: 0.82rem; }
.dashboard-heading .eyebrow { color: #82d0b4; }
.dashboard-freshness { position: relative; z-index: 1; flex: 0 0 auto; padding: 7px 10px; border: 1px solid rgba(142, 218, 192, 0.35); border-radius: 999px; color: #d3e8e0; font: 650 0.66rem "Cascadia Code", Consolas, monospace; }

.dashboard-filters {
  display: grid;
  grid-template-columns: minmax(190px, 1.3fr) minmax(160px, 0.8fr) minmax(150px, 0.7fr);
  gap: 10px;
  padding: 2px;
}

.dashboard-filters label { display: grid; gap: 6px; color: #617069; font-size: 0.7rem; font-weight: 800; }
.dashboard-filters input,
.dashboard-filters select { min-height: 42px; border-color: #c6d1cc; border-radius: 7px; background: #fff; }

.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-kpi {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 16px;
  border: 1px solid #c9d4cf;
  border-radius: 9px;
  background: #fff;
}

.dashboard-kpi::after { position: absolute; right: 0; bottom: 0; width: 38px; height: 4px; content: ""; background: #3b8b70; }
.dashboard-kpi.is-warn::after { background: #c65340; }
.dashboard-kpi span { display: block; color: #708079; font: 750 0.6rem "Cascadia Code", Consolas, monospace; letter-spacing: 0.08em; }
.dashboard-kpi strong { display: block; margin: 8px 0 5px; color: #17241f; font-size: clamp(1.45rem, 2.3vw, 2rem); line-height: 1; }
.dashboard-kpi small { display: block; overflow: hidden; color: #75817c; font-size: 0.67rem; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }

.dashboard-chart-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr); gap: 10px; }
.dashboard-card { min-width: 0; border: 1px solid #c9d4cf; border-radius: 9px; padding: 16px; background: #fff; }
.dashboard-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.dashboard-card-heading span { color: #397b65; font: 750 0.58rem "Cascadia Code", Consolas, monospace; letter-spacing: 0.09em; }
.dashboard-card-heading h3 { margin: 4px 0 0; font-size: 0.98rem; }
.dashboard-card-heading small { color: #87918d; font-size: 0.65rem; text-align: right; }
.experiment-control-card { border-color: #9fc5b5; background: linear-gradient(135deg, #f8fcfa, #eef7f2); }
.experiment-control-body > p { max-width: 780px; margin: 0 0 14px; color: #52635b; line-height: 1.65; font-size: 0.82rem; }
.experiment-control-row { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.experiment-control-row label { display: grid; gap: 6px; min-width: 210px; color: #617069; font-size: 0.7rem; font-weight: 800; }
.experiment-control-row select { min-height: 42px; border-color: #a9c7ba; border-radius: 7px; background: #fff; }
.experiment-control-row .secondary-button { min-height: 42px; }
.experiment-control-body .status-line { min-height: 20px; margin: 10px 0 0; color: #397b65; }
.submission-control-card { border-color: #d5b38d; background: linear-gradient(135deg, #fffaf4, #f9f3ec); }
.submission-control-card .dashboard-card-heading span { color: #9a6332; }
.submission-control-body > p { max-width: 860px; margin: 0 0 14px; color: #6c5a4c; line-height: 1.65; font-size: 0.82rem; }
.submission-control-row { display: flex; align-items: end; gap: 14px; flex-wrap: wrap; }
.submission-control-row label { display: grid; gap: 6px; min-width: 250px; color: #766457; font-size: 0.7rem; font-weight: 800; }
.submission-control-row label:first-child { min-width: 280px; }
.submission-control-row .submission-enabled-label { display: flex; align-items: center; min-width: 190px; min-height: 42px; gap: 8px; color: #533f31; }
.submission-control-row input[type="checkbox"] { width: auto; accent-color: #9a6332; }
.submission-control-row select,
.submission-control-row input[type="datetime-local"] { min-height: 42px; border-color: #d8b896; border-radius: 7px; background: #fff; }
.submission-control-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 12px; }
.submission-control-actions .secondary-button { min-height: 40px; }
.submission-control-actions .is-danger { color: #9b3f2e; border-color: #d39b8b; background: #fff4f0; }
.submission-scope-hint { min-height: 20px; margin: 10px 0 0; color: #8a5c31; font-size: 0.78rem; }
.submission-control-body .status-line { min-height: 20px; margin: 10px 0 0; color: #8a5c31; }
.difficulty-unit-control { display: grid; min-width: 190px; gap: 5px; justify-items: end; }
.difficulty-unit-control label { display: grid; grid-template-columns: auto minmax(132px, 1fr); align-items: center; gap: 8px; color: #64736c; font-size: 0.66rem; font-weight: 800; }
.difficulty-unit-control label > span { color: #397b65; letter-spacing: 0.04em; }
.difficulty-unit-control select {
  min-height: 34px;
  border: 1px solid #b9cbc3;
  border-radius: 6px;
  padding: 5px 28px 5px 9px;
  color: #1e4f40;
  font: 750 0.68rem "Cascadia Code", Consolas, monospace;
  background: #f3f8f5;
}
.difficulty-unit-control select:hover,
.difficulty-unit-control select:focus { border-color: #3e8d72; background: #fff; box-shadow: 0 0 0 3px rgba(62, 141, 114, 0.1); outline: none; }

.class-seat-card { padding-bottom: 14px; }
.class-seat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 7px; }
.class-seat {
  display: grid;
  min-width: 0;
  gap: 4px;
  padding: 9px 10px;
  border: 1px solid #ced8d3;
  border-radius: 7px;
  text-align: left;
  background: #f6f8f7;
}
.class-seat span { color: #84918b; font: 750 0.56rem "Cascadia Code", Consolas, monospace; }
.class-seat strong { overflow: hidden; color: #67736e; font-size: 0.68rem; text-overflow: ellipsis; white-space: nowrap; }
.class-seat.is-assigned { border-color: #9fc7b8; background: #e8f4ef; cursor: pointer; }
.class-seat.is-assigned span { color: #397a64; }
.class-seat.is-assigned strong { color: #195f4b; }
.class-seat.is-assigned:hover { border-color: #3e8d72; transform: translateY(-1px); box-shadow: 0 5px 12px rgba(37, 91, 72, 0.11); }
.class-seat.is-empty { border-style: dashed; background: #fafbfa; }
.class-seat.is-experimental { box-shadow: inset 3px 0 0 #3e8d72; }
.class-seat.is-control { box-shadow: inset 3px 0 0 #5479a8; }
.class-seat.is-control.is-assigned { border-color: #adc1da; background: #eef4fb; }
.class-seat.is-control.is-assigned span,
.class-seat.is-control.is-assigned strong { color: #355c8a; }
.group-badge { display: inline-flex; border-radius: 999px; padding: 4px 7px; font-size: 0.6rem; font-weight: 800; white-space: nowrap; }
.group-experimental { color: #17624d; background: #dff3eb; }
.group-control { color: #365f91; background: #e5effb; }

/* Compact teacher answer-access console */
.teacher-management-grid { grid-template-columns: 1fr; }
.teacher-management-grid .teacher-side { padding: 0; border: 0; background: transparent; box-shadow: none; }
.answer-manager {
  overflow: hidden;
  margin-bottom: 16px;
  border: 1px solid #b9c9c2;
  border-radius: 12px;
  background: #f8faf8;
  box-shadow: 0 18px 48px rgba(21, 48, 39, 0.09);
}
.answer-manager-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 24px;
  color: #eaf3ef;
  background:
    linear-gradient(90deg, rgba(102, 210, 171, 0.08) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(#17342b, #11271f);
}
.answer-manager-heading h2 { margin: 5px 0; color: #fff; font-size: 1.3rem; }
.answer-manager-heading p:last-child { margin: 0; color: #afc3bb; font-size: 0.78rem; }
.answer-manager-heading .eyebrow { color: #83d0b5; }
.answer-open-summary { display: grid; grid-template-columns: auto auto 1px auto auto; align-items: end; gap: 7px; padding: 10px 12px; border: 1px solid rgba(151, 218, 195, 0.28); border-radius: 8px; background: rgba(0, 0, 0, 0.14); }
.answer-open-summary strong { color: #fff; font: 850 1.2rem "Cascadia Code", Consolas, monospace; }
.answer-open-summary span { align-self: center; color: #b8cbc4; font-size: 0.65rem; }
.answer-open-summary i { align-self: stretch; width: 1px; margin: 0 4px; background: rgba(255, 255, 255, 0.18); }
.answer-manager-toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(170px, 0.42fr) auto; gap: 10px; align-items: end; padding: 14px 16px; border-bottom: 1px solid #d3ddd8; background: #eef3f0; }
.answer-manager-toolbar label { display: grid; gap: 5px; color: #64736c; font-size: 0.68rem; font-weight: 800; }
.answer-manager-toolbar input, .answer-manager-toolbar select { min-height: 40px; border-color: #c5d1cb; border-radius: 7px; background: #fff; }
.bulk-answer-button { min-height: 40px; padding: 9px 14px; border: 1px solid #237358; border-radius: 7px; color: #fff; font-size: 0.7rem; font-weight: 850; background: #237358; box-shadow: 0 7px 16px rgba(35, 115, 88, 0.16); }
.bulk-answer-button:hover:not(:disabled) { transform: translateY(-1px); background: #185f48; }
.bulk-answer-button.is-close-mode { border-color: #b75946; color: #9f3f2e; background: #fff1ed; box-shadow: none; }
.bulk-answer-button:disabled { border-color: #c9d2ce; color: #89938e; background: #e2e7e4; box-shadow: none; cursor: not-allowed; }

/* Research export center */
.learning-export-center { overflow: hidden; margin: 0 0 18px; border: 1px solid #b9c7c1; border-radius: 13px; background: #f5f7f5; box-shadow: 0 18px 48px rgba(19, 45, 36, 0.09); }
.export-center-heading { position: relative; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; overflow: hidden; padding: 24px; color: #ebf3ef; background: #172b24; }
.export-center-heading::after { position: absolute; right: 9%; bottom: -48px; width: 200px; height: 100px; border: 1px solid rgba(126, 203, 176, .2); border-radius: 50%; content: ""; box-shadow: 0 0 0 20px rgba(126, 203, 176, .035), 0 0 0 40px rgba(126, 203, 176, .02); }
.export-center-heading h2 { margin: 6px 0; color: #fff; font-size: 1.35rem; }
.export-center-heading p:last-child { max-width: 680px; margin: 0; color: #b4c5be; font-size: .78rem; line-height: 1.55; }
.export-center-heading .eyebrow { color: #82cfb4; }
.export-version { position: relative; z-index: 1; flex: 0 0 auto; padding: 7px 9px; border: 1px solid rgba(133, 210, 183, .3); border-radius: 5px; color: #c7ddd5; font: 700 .58rem "Cascadia Code", Consolas, monospace; letter-spacing: .04em; }
.export-data-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid #ccd6d1; background: #e9efec; }
.export-data-metrics div { display: flex; align-items: baseline; gap: 8px; padding: 13px 18px; border-right: 1px solid #ccd6d1; }
.export-data-metrics div:last-child { border-right: 0; }
.export-data-metrics strong { color: #1d4f3e; font: 850 1.05rem "Cascadia Code", Consolas, monospace; }
.export-data-metrics span { color: #728078; font-size: .65rem; font-weight: 750; }
.export-package-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 12px; padding: 16px; }
.export-package-card { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "mark copy" "mark scope" "mark button"; align-items: start; gap: 10px 15px; padding: 18px; border: 1px solid #cbd5d0; border-radius: 9px; background: #fff; }
.export-package-card.is-primary { border-color: #9fc2b4; background: #f8fcfa; }
.export-file-mark { grid-area: mark; display: grid; width: 46px; height: 58px; place-items: center; border-radius: 5px 5px 9px 5px; color: #eaf5f1; font: 850 .68rem "Cascadia Code", Consolas, monospace; background: #22684f; box-shadow: 5px 5px 0 #d8e8e1; }
.export-file-mark.is-csv { color: #fff5e8; background: #a9602d; box-shadow: 5px 5px 0 #f0dfcf; }
.export-package-copy { grid-area: copy; min-width: 0; }
.export-package-copy > span { color: #3f7d67; font: 750 .58rem "Cascadia Code", Consolas, monospace; letter-spacing: .08em; }
.export-package-copy h3 { margin: 5px 0 7px; font-size: .96rem; }
.export-package-copy p { margin: 0; color: #6f7c76; font-size: .69rem; line-height: 1.55; }
.export-package-copy ul { display: flex; flex-wrap: wrap; gap: 5px; margin: 10px 0 0; padding: 0; list-style: none; }
.export-package-copy li { padding: 4px 6px; border: 1px solid #d9e1dd; border-radius: 4px; color: #617069; font: 650 .55rem "Cascadia Code", Consolas, monospace; background: #f5f7f5; }
.export-scope-control { grid-area: scope; display: grid; gap: 4px; }
.export-scope-control label { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 8px; color: #687770; font-size: .65rem; font-weight: 800; }
.export-scope-control select { min-height: 34px; min-width: 0; padding: 6px 8px; border: 1px solid #c8d4ce; border-radius: 6px; color: #345247; font-size: .68rem; background: #f8fbf9; }
.export-scope-control small { color: #87938d; font-size: .6rem; line-height: 1.4; }
.export-download-button { grid-area: button; justify-self: start; min-height: 38px; padding: 8px 13px; border-radius: 6px; color: #fff; font-size: .69rem; font-weight: 850; background: #216d52; }
.export-download-button.is-secondary { color: #79431d; background: #f3e4d6; }
.export-download-button:hover { transform: translateY(-1px); box-shadow: 0 7px 16px rgba(25, 76, 58, .14); }
.export-status { min-height: 18px; margin: -4px 16px 10px; color: #287157; font-size: .66rem; font-weight: 750; }
.export-privacy-note { display: flex; gap: 10px; padding: 12px 17px; border-top: 1px solid #d1dad6; color: #78837e; font-size: .64rem; line-height: 1.5; background: #eef2f0; }
.export-privacy-note strong { flex: 0 0 auto; color: #a24d3a; }

@media (max-width: 800px) {
  .export-center-heading { flex-direction: column; }
  .export-data-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .export-data-metrics div:nth-child(2) { border-right: 0; }
  .export-package-grid { grid-template-columns: 1fr; }
}
.answer-manager .problem-list { display: grid; gap: 0; max-height: 620px; margin: 0; padding: 0; overflow: auto; border-top: 0; }
.answer-control-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; min-height: 66px; padding: 10px 16px; border-bottom: 1px solid #e0e7e3; background: #fff; transition: background 140ms ease; }
.answer-control-row:last-child { border-bottom: 0; }
.answer-control-row:hover { background: #f6f9f7; }
.answer-control-row.is-open { background: #f1f9f5; }
.answer-problem-identity { display: grid; grid-template-columns: 74px minmax(0, 1fr); align-items: center; gap: 12px; min-width: 0; }
.answer-problem-identity > span { color: #467563; font: 750 0.65rem "Cascadia Code", Consolas, monospace; letter-spacing: 0.03em; }
.answer-problem-identity div { min-width: 0; }
.answer-problem-identity strong { display: block; overflow: hidden; color: #22332c; font-size: 0.8rem; text-overflow: ellipsis; white-space: nowrap; }
.answer-problem-identity small { display: block; margin-top: 4px; color: #87928d; font-size: 0.62rem; }
.answer-control-actions { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.answer-preview-button { padding: 5px 8px; color: #607069; font-size: 0.66rem; font-weight: 750; background: transparent; }
.answer-preview-button:hover { color: #1b6b53; text-decoration: underline; }
.answer-toggle-switch { display: flex; align-items: center; gap: 8px; min-width: 106px; padding: 5px 7px; border: 1px solid #cdd6d2; border-radius: 999px; color: #69756f; background: #f1f4f2; }
.answer-toggle-switch b { min-width: 42px; font-size: 0.64rem; text-align: left; }
.switch-track { position: relative; width: 30px; height: 17px; border-radius: 999px; background: #aeb9b4; transition: background 160ms ease; }
.switch-track i { position: absolute; top: 3px; left: 3px; width: 11px; height: 11px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.24); transition: transform 160ms ease; }
.answer-toggle-switch[aria-checked="true"] { border-color: #92c2af; color: #176049; background: #e4f3ed; }
.answer-toggle-switch[aria-checked="true"] .switch-track { background: #2f896b; }
.answer-toggle-switch[aria-checked="true"] .switch-track i { transform: translateX(13px); }
.teacher-management-grid .api-config, .teacher-management-grid .log-heading, .teacher-management-grid .log-list { padding-right: 18px; padding-left: 18px; }

@media (max-width: 700px) {
  .answer-manager-heading, .answer-control-row { align-items: stretch; flex-direction: column; }
  .answer-manager-toolbar { grid-template-columns: 1fr; }
  .answer-control-actions { justify-content: space-between; }
  .answer-open-summary { align-self: flex-start; }
}

.distribution-chart { display: grid; gap: 9px; }
.distribution-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) 30px; gap: 10px; align-items: center; }
.distribution-row > span { color: #596860; font: 700 0.68rem "Cascadia Code", Consolas, monospace; }
.distribution-row > b { color: #26342f; font-size: 0.72rem; text-align: right; }
.distribution-track { height: 10px; overflow: hidden; border-radius: 999px; background: #e8eeeb; }
.distribution-track i { display: block; width: var(--bar-width); height: 100%; min-width: 2px; border-radius: inherit; background: #3e8d72; }

.attention-list { display: grid; gap: 8px; }
.attention-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 10px 11px; border-left: 3px solid #c95340; background: #fff7f4; }
.attention-item.is-medium { border-left-color: #ba851d; background: #fffaf0; }
.attention-item strong { font-size: 0.8rem; }
.attention-item p { margin: 3px 0 0; color: #7b706b; font-size: 0.67rem; line-height: 1.4; }
.attention-item button { align-self: center; color: #286e59; font-size: 0.68rem; font-weight: 800; background: transparent; }
.dashboard-empty { margin: 0; padding: 18px; color: #7b8781; font-size: 0.75rem; text-align: center; background: #f6f8f6; }

.dashboard-table-card { padding-bottom: 8px; }
.dashboard-table-wrap { overflow-x: auto; }
.dashboard-table { width: 100%; min-width: 780px; border-collapse: collapse; font-size: 0.72rem; }
.dashboard-table th { padding: 9px 8px; border-bottom: 1px solid #cdd7d2; color: #6a7771; font-size: 0.64rem; text-align: left; white-space: nowrap; background: #f4f7f5; }
.dashboard-table td { padding: 10px 8px; border-bottom: 1px solid #e3e8e5; color: #35423d; vertical-align: middle; }
.dashboard-table tbody tr:hover { background: #f7faf8; }
.dashboard-table tbody tr:last-child td { border-bottom: 0; }
.difficulty-rank { display: inline-grid; grid-template-columns: auto auto; align-items: center; gap: 6px; min-width: 66px; padding: 5px 7px; border-radius: 5px; background: #edf2ef; }
.difficulty-rank b { font: 850 .72rem "Cascadia Code", Consolas, monospace; }
.difficulty-rank small { font-size: .58rem; font-weight: 800; }
.difficulty-rank.is-hard { color: #a33f2f; background: #ffe9e2; }
.difficulty-rank.is-medium { color: #88620f; background: #fff1c9; }
.difficulty-rank.is-easy { color: #246b55; background: #e4f3ed; }
.student-detail-button { color: #1d6752; font-weight: 850; text-align: left; background: transparent; }
.student-detail-button:hover { text-decoration: underline; }
.risk-badge { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 5px 7px; font-size: 0.62rem; font-weight: 800; white-space: nowrap; }
.risk-badge::before { width: 6px; height: 6px; border-radius: 50%; content: ""; background: currentColor; }
.risk-high { color: #a63b2c; background: #ffe8e1; }
.risk-medium { color: #8b6412; background: #fff1c7; }
.risk-low { color: #16624f; background: #dff3eb; }
.mini-progress { display: grid; grid-template-columns: minmax(70px, 1fr) auto; gap: 7px; align-items: center; min-width: 130px; }
.mini-progress-track { height: 7px; overflow: hidden; border-radius: 999px; background: #e6ece9; }
.mini-progress-track i { display: block; width: var(--progress); height: 100%; background: #378970; }
.mini-progress b { font-size: 0.64rem; }
.metric-muted { color: #87918d; }

.student-progress-modal { width: min(860px, 100%); }
.student-modal-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 16px 0; }
.student-modal-summary div { padding: 12px; border: 1px solid #d4ddd9; border-radius: 7px; background: #f6f8f6; }
.student-modal-summary span { display: block; color: #79857f; font-size: 0.63rem; }
.student-modal-summary strong { display: block; margin-top: 5px; font-size: 1.15rem; }
.student-problem-groups { display: grid; gap: 12px; }
.student-problem-group { border: 1px solid #d6dfdb; border-radius: 8px; padding: 12px; }
.student-problem-group h3 { margin: 0 0 9px; font-size: 0.83rem; }
.student-problem-list { display: flex; flex-wrap: wrap; gap: 6px; }
.student-problem-chip { border-radius: 5px; padding: 6px 8px; color: #45534d; font: 650 0.63rem "Cascadia Code", Consolas, monospace; background: #edf2ef; }
.student-problem-chip.completed { color: #145c4b; background: #dff3eb; }
.student-problem-chip.attempted { color: #9a3e30; background: #ffe9e3; }
.student-problem-chip.stuck { color: #835e10; background: #fff0c5; }

@media (max-width: 1080px) {
  .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-chart-grid { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
  .teacher-dashboard { padding: 10px; }
  .dashboard-heading { flex-direction: column; }
  .dashboard-filters, .dashboard-kpis { grid-template-columns: 1fr; }
  .dashboard-card-heading { flex-direction: column; }
  .dashboard-card-heading small { text-align: left; }
  .difficulty-unit-control { width: 100%; justify-items: stretch; }
  .difficulty-unit-control label { grid-template-columns: auto minmax(0, 1fr); }
  .student-modal-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.submission-notice {
  margin: 0 0 12px;
  border: 1px solid #b8d3c4;
  border-radius: 8px;
  padding: 9px 12px;
  color: #23634d;
  font-size: 0.78rem;
  font-weight: 750;
  background: #edf8f2;
}

.submission-notice.is-closed {
  border-color: #e0aaa0;
  color: #9a3c2d;
  background: #fff0ed;
}

.quiz-panel {
  border: 1px solid var(--line, #d8d8d8);
  border-radius: 14px;
  background: #fff;
  padding: 22px;
  min-height: 330px;
}

.quiz-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  border-bottom: 1px solid #ececec;
  padding-bottom: 12px;
}

.quiz-heading h3 {
  margin: 4px 0 0;
}

.quiz-stem {
  white-space: pre-wrap;
  line-height: 1.8;
  font-size: 1.02rem;
  margin: 18px 0;
}

.quiz-options {
  display: grid;
  gap: 10px;
}

.quiz-option {
  display: grid;
  grid-template-columns: auto 30px 1fr;
  align-items: start;
  gap: 8px;
  border: 1px solid #dedede;
  border-radius: 10px;
  padding: 12px 14px;
  cursor: pointer;
  line-height: 1.55;
}

.quiz-option:hover {
  border-color: #777;
  background: #fafafa;
}

.quiz-panel[data-question-type="single_choice"] .quiz-option {
  background: linear-gradient(90deg, #fbfcfb, #ffffff);
}

.quiz-panel[data-question-type="single_choice"] .quiz-option:has(input:checked),
.quiz-panel[data-question-type="true_false"] .quiz-option:has(input:checked) {
  border-color: #1f6a56;
  background: #edf8f2;
  box-shadow: 0 0 0 2px rgba(31, 106, 86, 0.09);
}

.quiz-panel[data-question-type="true_false"] .quiz-options {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.quiz-panel[data-question-type="true_false"] .quiz-option {
  min-height: 64px;
  align-items: center;
  background: #fbfaf6;
}

@media (max-width: 620px) {
  .quiz-panel[data-question-type="true_false"] .quiz-options {
    grid-template-columns: 1fr;
  }
}

.quiz-option input {
  margin-top: 4px;
}

.quiz-option-label {
  font-weight: 700;
}

.quiz-scaffold-toggle {
  margin-top: 16px;
}

.quiz-scaffold {
  margin-top: 12px;
  border-left: 3px solid #222;
  padding: 10px 14px;
  background: #f7f7f7;
  line-height: 1.65;
}

.quiz-scaffold p {
  margin: 5px 0;
}

.quiz-result {
  display: grid;
  gap: 5px;
  margin-top: 16px;
  min-height: 1.4em;
  line-height: 1.6;
}

.quiz-correct {
  color: #176b3a;
}

.quiz-wrong {
  color: #9a2d2d;
}

.bank-text-label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.bank-text-input,
.bank-answer-textarea {
  width: 100%;
  border: 1px solid #cfd5d2;
  border-radius: 9px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  line-height: 1.65;
  padding: 12px 14px;
}

.bank-text-input:focus,
.bank-answer-textarea:focus {
  border-color: #1d2428;
  box-shadow: 0 0 0 3px rgba(29, 36, 40, 0.08);
  outline: none;
}

.bank-answer-textarea {
  min-height: 150px;
  resize: vertical;
}

.composite-question-list {
  display: grid;
  gap: 18px;
}

.composite-subquestion {
  border-top: 1px solid #e3e6e4;
  padding-top: 18px;
}

.subquestion-heading {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.subquestion-heading small {
  color: var(--muted);
  font-weight: 700;
}

.subquestion-heading p {
  margin: 4px 0 0;
  white-space: pre-wrap;
  line-height: 1.7;
}

.subquestion-number {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1d2428;
  color: #fff;
  font-weight: 700;
}

.ordering-hint {
  color: var(--muted);
  font-size: 0.82rem;
}

.ordering-list {
  display: grid;
  gap: 8px;
  list-style-position: inside;
  margin: 0;
  padding: 0;
}

.ordering-item {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid #d8ddda;
  border-radius: 9px;
  background: #fff;
  padding: 10px 12px;
}

.ordering-label {
  font-weight: 800;
}

.ordering-actions {
  display: flex;
  gap: 5px;
}

.ordering-actions button {
  width: 30px;
  height: 30px;
  border: 1px solid #cbd1ce;
  border-radius: 6px;
  background: #f7f8f4;
  cursor: pointer;
}
