/* Student shell only. Mathematical objects retain their own geometry and states. */
body.mis-teacher-mode :is(#student-catalog,.student-catalog-header,.student-workspace-bar,.student-stepper,.student-current-task,.student-continue,.student-tool-hint){display:none!important}
body.mis-student-mode.mis-activity-view .student-native-summary,
body.mis-student-mode.mis-activity-view .student-native-scaffolding {display:none!important}
body.mis-student-mode.mis-activity-view #detail > .panel,
body.mis-student-mode.mis-activity-view #ku-detail > .ku-card {padding:0;border:0;background:transparent;box-shadow:none}
.mis-mode-switch {
  display: inline-flex;
  align-items: stretch;
  gap: 4px;
  padding: 4px;
  max-width: 100%;
  border: 1px solid #c9dcd3;
  border-radius: 12px;
  background: #edf5f0;
}
.mis-mode-switch [data-mis-mode] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 0;
  margin: 0;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #284f43;
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.mis-mode-switch [data-mis-mode][aria-pressed="true"] {
  border-color: #174d3e;
  background: #174d3e;
  color: #fff;
}
.mis-mode-switch [data-mis-mode]:hover:not([aria-pressed="true"]) {
  background: #dfeee5;
}
.mis-mode-switch [data-mis-mode]:focus-visible {
  outline: 3px solid #006f68;
  outline-offset: 3px;
}

body.mis-student-mode {
  --student-ink: #173e35;
  --student-muted: #476157;
  --student-green: #174d3e;
  --student-teal: #006f68;
  --student-warm: #f6bd45;
  --student-line: #d4e2da;
  --student-paper: #fff;
  --student-tint: #eef6f1;
  background: #f5f9f6;
  color: var(--student-ink);
  font-size: 18px;
  line-height: 1.6;
}
body.mis-student-mode > main {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 28px 32px;
  box-sizing: border-box;
}
body.mis-student-mode.mis-catalog-view :is(.content-intro, .ku-intro, .coverage-note, .workspace, .ku-workspace),
body.mis-student-mode.mis-catalog-view :is(.student-workspace-bar, .student-continue),
body.mis-student-mode.mis-activity-view :is(#student-catalog, .student-catalog-header, .finder, .ku-finder, .outcomes, .ku-sidebar, .tabs, .ku-tabs),
body.mis-teacher-mode :is(#student-catalog, .student-catalog-header, .student-workspace-bar, .student-continue, .student-tool-hint) {
  display: none !important;
}
body.mis-student-mode .student-stage-hidden,
body.mis-student-mode #student-catalog[hidden] {
  display: none !important;
}

/* Catalogue: a short introduction, useful filters, then the activity choices. */
body.mis-student-mode #student-catalog {
  min-width: 0;
  margin: 0;
}
body.mis-student-mode .student-catalog-header {
  margin: 4px 0 22px;
}
body.mis-student-mode .student-catalog-kicker {
  display: block;
  margin-bottom: 8px;
  color: var(--student-teal);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .04em;
}
body.mis-student-mode .student-catalog-header h1 {
  max-width: 24ch;
  margin: 0 0 10px;
  color: var(--student-ink);
  font: 760 clamp(28px, 3.2vw, 40px)/1.18 "Segoe UI", Arial, sans-serif;
  letter-spacing: -.7px;
  overflow-wrap: anywhere;
}
body.mis-student-mode .student-catalog-header p {
  max-width: 58ch;
  margin: 0;
  color: var(--student-muted);
  line-height: 1.55;
}
body.mis-student-mode.mis-catalog-view :is(.finder, .ku-finder) {
  display: block !important;
  margin: 0 0 24px;
  padding: 18px;
  border: 1px solid var(--student-line);
  border-radius: 14px;
  background: var(--student-paper);
  box-shadow: none;
}
/* The catalogue keeps the controls; programme notes remain in teacher view. */
body.mis-student-mode.mis-catalog-view .finder > .route-title,
body.mis-student-mode.mis-catalog-view .finder > small,
body.mis-student-mode.mis-catalog-view .finder .find-row > .check {
  display: none !important;
}
body.mis-student-mode :is(#grades, #ku-grades) {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  background: transparent;
}
body.mis-student-mode :is(#grades, #ku-grades) button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  min-width: 0;
  padding: 8px 4px;
  border: 1px solid var(--student-line);
  border-radius: 9px;
  background: #f7faf8;
  color: var(--student-ink);
  line-height: 1.3;
  white-space: normal;
  box-shadow: none;
  transform: none;
}
body.mis-student-mode :is(#grades, #ku-grades) button::after {
  content: none;
}
body.mis-student-mode :is(#grades, #ku-grades) button[aria-pressed="true"] {
  border-color: var(--student-teal);
  background: var(--student-teal);
  color: #fff;
  box-shadow: none;
  transform: none;
}
body.mis-student-mode :is(#grades, #ku-grades) button[aria-pressed="true"] span {
  color: inherit;
}
body.mis-student-mode :is(.find-row, .ku-filters) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
  gap: 16px;
  align-items: end;
}
body.mis-student-mode :is(.find-row, .ku-filters) > label {
  min-width: 0;
  margin: 0;
  gap: 6px;
  letter-spacing: 0;
}
body.mis-student-mode :is(#theme, #search, #ku-theme, #ku-search) {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  height: auto;
  padding: 10px 12px;
  border: 1px solid #9bb8aa;
  border-radius: 8px;
  background: #fff;
  color: var(--student-ink);
  box-sizing: border-box;
  font-size: 18px !important;
  line-height: 1.45;
}
body.mis-student-mode :is(#search, #ku-search)::placeholder {
  color: #5c7066;
  opacity: 1;
}
body.mis-student-mode :is(#theme, #search, #ku-theme, #ku-search):focus-visible {
  border-color: var(--student-teal);
  outline: 3px solid var(--student-teal);
  outline-offset: 3px;
}
body.mis-student-mode .student-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 20px 0 0;
}
body.mis-student-mode .student-card-grid:empty {
  display: block;
  margin: 0;
}
body.mis-student-mode .student-catalog-count {
  margin: 0;
  color: var(--student-muted);
  font-size: 16px;
  line-height: 1.4;
}
body.mis-student-mode a.student-activity-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-content: start;
  align-items: start;
  gap: 8px 14px;
  min-width: 0;
  min-height: 168px;
  padding: 20px;
  border: 1px solid var(--student-line);
  border-radius: 14px;
  background: #fff;
  color: var(--student-ink);
  text-align: start;
  text-decoration: none;
  box-shadow: 0 2px 5px #173e3506;
  transition: border-color .15s, background-color .15s;
}
body.mis-student-mode a.student-activity-card:hover {
  border-color: #65a28b;
  background: #fcfefc;
}
body.mis-student-mode a.student-activity-card:focus-visible {
  outline: 3px solid var(--student-teal);
  outline-offset: 4px;
}
body.mis-student-mode .student-card-icon {
  display: grid;
  place-items: center;
  grid-row: span 3;
  width: 48px;
  min-height: 48px;
  border-radius: 12px;
  background: #e1f0e8;
  color: var(--student-green);
  font-size: 25px;
  font-weight: 700;
  line-height: 1;
}
body.mis-student-mode .student-activity-card:nth-child(3n + 2) .student-card-icon {
  background: #e0f1ef;
  color: var(--student-teal);
}
body.mis-student-mode .student-activity-card:nth-child(3n) .student-card-icon {
  background: #fff0c9;
  color: #6a4800;
}
body.mis-student-mode .student-card-topic {
  display: block;
  margin: 0;
  color: var(--student-muted);
  font-size: 16px;
  font-weight: 550;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
body.mis-student-mode .student-card-title {
  display: block;
  grid-column: 2;
  margin: 0;
  color: var(--student-ink);
  font-size: 22px;
  font-weight: 720;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
body.mis-student-mode .student-card-start {
  display: block;
  grid-column: 2;
  margin-top: 7px;
  color: var(--student-teal);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
}
body.mis-student-mode :is(.student-empty, .student-empty-state, .student-catalog-empty) {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px solid var(--student-line);
  border-radius: 12px;
  background: #fff;
  color: var(--student-muted);
  overflow-wrap: anywhere;
}

/* Activity chrome stays in document flow; only the compact stepper is sticky. */
body.mis-student-mode.mis-activity-view :is(.workspace, .ku-workspace) {
  display: block !important;
  width: 100%;
  max-width: 1120px;
  min-width: 0;
  margin: 0 auto;
  padding: 0;
}
body.mis-student-mode :is(#detail, #ku-detail, .ku-card) {
  min-width: 0;
}
body.mis-student-mode .student-workspace-bar {
  display: block;
  margin: 0 0 12px;
  padding: 0;
}
body.mis-student-mode .student-workspace-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  min-width: 0;
  margin: 0 0 12px;
}
body.mis-student-mode .student-workspace-title {
  flex: 1 1 240px;
  min-width: 0;
  margin: 0 0 10px;
  color: var(--student-ink);
  font-size: clamp(23px, 2.3vw, 30px);
  font-weight: 750;
  line-height: 1.3;
  letter-spacing: -.4px;
  overflow-wrap: anywhere;
}
body.mis-student-mode .student-workspace-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
body.mis-student-mode .student-workspace-bar :is(.backbutton, .student-back),
body.mis-student-mode .student-workspace-tools :is(button, a),
body.mis-student-mode .student-continue :is(button, a) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 9px 14px;
  border: 1px solid #a8c4b5;
  border-radius: 9px;
  background: #fff;
  color: var(--student-green);
  font-weight: 650;
  line-height: 1.4;
  text-align: center;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
}
body.mis-student-mode .student-stepper {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 20px;
  padding: 10px 0;
  border-bottom: 1px solid var(--student-line);
  background: #f5f9f6;
}
body.mis-student-mode .student-stepper [data-student-step] {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  min-height: 48px;
  margin: 0;
  padding: 9px 12px;
  border: 1px solid #bed3c7;
  border-radius: 9px;
  background: #fff;
  color: var(--student-muted);
  font-weight: 650;
  line-height: 1.35;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
}
body.mis-student-mode .student-stepper [aria-current="step"] {
  border-color: var(--student-green);
  background: var(--student-green);
  color: #fff;
  box-shadow: inset 0 -3px 0 var(--student-warm);
}
body.mis-student-mode .student-step-number {
  display: inline-grid;
  place-items: center;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e4f0e9;
  color: var(--student-green);
  font-size: 15px;
  font-weight: 750;
  line-height: 1;
}
body.mis-student-mode .student-stepper [aria-current="step"] .student-step-number {
  background: var(--student-warm);
  color: #3f2d00;
}
body.mis-student-mode .student-current-task {
  max-width: 68ch;
  margin: 8px 0 18px;
  color: var(--student-ink);
  font-weight: 500;
  line-height: 1.55;
  overflow-wrap: anywhere;
}
body.mis-student-mode .student-stepper [data-student-step]:disabled {
  opacity: .65;
  cursor: not-allowed;
}
body.mis-student-mode :is(.student-stage-predict, .student-stage-explore, .student-stage-apply) {
  min-width: 0;
  scroll-margin-top: 104px;
}
body.mis-student-mode :is(#tab-body, #ku-content) {
  min-width: 0;
  padding: 0;
  font-size: 18px;
  line-height: 1.6;
}
body.mis-student-mode :is(.prompt, .ku-prediction).student-stage-predict,
body.mis-student-mode :is(.prompt, .ku-prediction, .ku-reflect).student-stage-apply,
body.mis-student-mode :is(#tab-body, #ku-content)[data-learning-step] > :is(.prompt, .ku-prediction),
body.mis-student-mode .learning-evidence {
  margin: 0 0 18px;
  padding: 20px;
  border: 1px solid var(--student-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: none;
}
body.mis-student-mode .prompt.student-stage-predict::before,
body.mis-student-mode :is(#tab-body, #ku-content)[data-learning-step] > .prompt::before {
  content: none;
}
body.mis-student-mode :is(.student-stage-predict, .student-stage-apply) textarea,
body.mis-student-mode :is(#tab-body, #ku-content)[data-learning-step] :is(#prediction, #reason, #extended-prediction, #ku-first, #reflection, #extended-reflection, #ku-reflection, #transfer-answer, #ku-transfer, #transfer-reason) {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 112px;
  margin: 8px 0 14px;
  padding: 12px;
  border: 1px solid #9db9aa;
  border-radius: 9px;
  background: #fff;
  color: var(--student-ink);
  box-sizing: border-box;
  font-size: 18px !important;
  line-height: 1.6;
  resize: vertical;
}
body.mis-student-mode :is(.student-stage-predict, .student-stage-apply) textarea:focus-visible,
body.mis-student-mode :is(#tab-body, #ku-content)[data-learning-step] :is(#prediction, #reason, #extended-prediction, #ku-first, #reflection, #extended-reflection, #ku-reflection, #transfer-answer, #ku-transfer, #transfer-reason):focus-visible {
  border-color: var(--student-teal);
  outline: 3px solid var(--student-teal);
  outline-offset: 3px;
}
body.mis-student-mode .student-workspace-canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 12px 0;
  padding: 0;
  background: #fff;
}
body.mis-student-mode .object-exercise {
  min-width: 0;
  max-width: 100%;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid var(--student-line);
  border-radius: 12px;
  background: #fff;
  box-shadow: none;
  box-sizing: border-box;
}
body.mis-student-mode .student-tool-hint {
  margin: 8px 0 12px;
  color: var(--student-muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}
body.mis-student-mode :is(.student-collapsible-help, .student-quiet-details) {
  min-width: 0;
  margin: 12px 0;
  padding: 0 14px;
  border: 1px solid var(--student-line);
  border-radius: 10px;
  background: #f5faf7;
}
body.mis-student-mode :is(.student-collapsible-help, .student-quiet-details) > summary,
body.mis-student-mode :is(.student-collapsible-help, .student-quiet-details) details > summary {
  min-height: 44px;
  padding: 10px 0;
  color: var(--student-green);
  font-weight: 650;
  line-height: 1.45;
  overflow-wrap: anywhere;
  cursor: pointer;
}
body.mis-student-mode :is(.student-collapsible-help, .student-quiet-details)[open] {
  padding-bottom: 12px;
}
body.mis-student-mode :is(.student-collapsible-help, .student-quiet-details) > :last-child {
  margin-bottom: 0;
}
body.mis-student-mode .student-continue {
  position: static;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--student-line);
}
body.mis-student-mode .student-continue :is(button, a) {
  min-height: 48px;
  border-color: var(--student-teal);
  background: var(--student-teal);
  color: #fff;
}
body.mis-student-mode .student-continue button:disabled {
  opacity: .6;
  cursor: not-allowed;
}
body.mis-student-mode :is(.student-workspace-bar, .student-stepper, .student-continue) :is(button, a):focus-visible,
body.mis-student-mode :is(.student-collapsible-help, .student-quiet-details, .student-footer) > summary:focus-visible,
body.mis-student-mode :is(.student-collapsible-help, .student-quiet-details) details > summary:focus-visible,
body.mis-student-mode .student-footer summary:focus-visible {
  outline: 3px solid var(--student-teal);
  outline-offset: 3px;
}
body.mis-student-mode .student-footer {
  max-width: 1120px;
  margin: 24px auto 0;
  padding: 16px 0 0;
  border: 0;
  border-top: 1px solid var(--student-line);
  background: transparent;
  color: var(--student-muted);
}
body.mis-student-mode .student-footer summary {
  min-height: 44px;
  padding: 9px 0;
  color: var(--student-muted);
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
}
body.mis-student-mode .student-footer :is(p, li) {
  max-width: 75ch;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  body.mis-student-mode .student-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body.mis-student-mode .student-workspace-bar {
    gap: 10px 14px;
  }
}
@media (max-width: 760px) {
  /* The existing mobile header is nowrap; the new mode widget needs its own row. */
  body.mamoste-theme.mis-student-mode > header.mis-navigation-ready,
  body.mamoste-theme.mis-teacher-mode > header.mis-navigation-ready {
    flex-wrap: wrap !important;
  }
  header.mis-navigation-ready > .mis-mode-switch {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
}
@media (max-width: 600px) {
  body.mis-student-mode > main {
    padding: 14px 12px 24px;
  }
  .mis-mode-switch {
    gap: 2px;
    padding: 3px;
  }
  .mis-mode-switch [data-mis-mode] {
    padding: 8px 11px;
  }
  body.mis-student-mode.mis-catalog-view .student-catalog-header {
    margin: 0 0 14px;
  }
  body.mis-student-mode .student-catalog-header h1 {
    font-size: 29px;
    letter-spacing: -.5px;
  }
  body.mis-student-mode.mis-catalog-view :is(.finder, .ku-finder) {
    padding: 12px;
    margin-bottom: 14px;
  }
  body.mis-student-mode :is(#grades, #ku-grades) {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 14px;
  }
  body.mis-student-mode.mis-catalog-view :is(#grades, #ku-grades) {
    margin-bottom: 12px;
  }
  body.mis-student-mode :is(#grades, #ku-grades) button {
    min-height: 48px;
    padding: 7px 3px;
  }
  body.mis-student-mode :is(.find-row, .ku-filters) {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }
  body.mis-student-mode.mis-catalog-view :is(.find-row, .ku-filters) {
    gap: 10px;
  }
  body.mis-student-mode .student-card-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    margin-top: 16px;
  }
  body.mis-student-mode.mis-catalog-view .student-card-grid {
    margin-top: 12px;
  }
  body.mis-student-mode a.student-activity-card {
    min-height: 132px;
    padding: 16px;
    gap: 7px 12px;
  }
  body.mis-student-mode .student-card-title {
    font-size: 21px;
  }
  body.mis-student-mode .student-workspace-bar {
    margin-bottom: 8px;
  }
  body.mis-student-mode .student-workspace-heading {
    gap: 8px;
    margin-bottom: 10px;
  }
  body.mis-student-mode .student-workspace-title {
    font-size: 25px;
    margin: 0 0 8px;
  }
  body.mis-student-mode .student-workspace-tools {
    flex: 1 1 auto;
    justify-content: flex-end;
    gap: 6px;
  }
  body.mis-student-mode .student-workspace-bar :is(.backbutton, .student-back),
  body.mis-student-mode .student-workspace-tools :is(button, a) {
    padding: 8px 10px;
  }
  body.mis-student-mode .student-stepper {
    gap: 6px;
    margin-bottom: 14px;
    padding: 8px 0;
  }
  body.mis-student-mode .student-stepper [data-student-step] {
    flex-direction: column;
    gap: 2px;
    min-height: 50px;
    padding: 7px 4px;
  }
  body.mis-student-mode :is(.prompt, .ku-prediction).student-stage-predict,
  body.mis-student-mode :is(.prompt, .ku-prediction, .ku-reflect).student-stage-apply,
  body.mis-student-mode :is(#tab-body, #ku-content)[data-learning-step] > :is(.prompt, .ku-prediction),
  body.mis-student-mode .learning-evidence {
    padding: 14px;
    margin-bottom: 14px;
  }
  body.mis-student-mode .object-exercise,
  body.mis-student-mode .object-exercise > section {
    padding: 8px;
  }
  body.mis-student-mode .object-exercise {
    margin: 10px 0;
    border-radius: 10px;
  }
  body.mis-student-mode :is(.student-collapsible-help, .student-quiet-details) {
    padding-inline: 10px;
  }
  body.mis-student-mode .student-continue {
    margin-top: 14px;
    padding-top: 12px;
  }
  body.mis-student-mode .student-continue :is(button, a) {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mis-mode-switch [data-mis-mode],
  body.mis-student-mode :is(.student-activity-card, .student-stepper, .student-continue) {
    transition: none;
    animation: none;
    scroll-behavior: auto;
  }
}
@media (forced-colors: active) {
  .mis-mode-switch [data-mis-mode][aria-pressed="true"],
  body.mis-student-mode .student-stepper [aria-current="step"],
  body.mis-student-mode :is(#grades, #ku-grades) [aria-pressed="true"] {
    border: 2px solid Highlight;
    outline: 2px solid Highlight;
    outline-offset: -4px;
  }
}
@media print {
  .mis-mode-switch,
  body.mis-student-mode :is(.student-workspace-tools, .student-stepper, .student-continue, .student-footer, .student-collapsible-help) {
    display: none !important;
  }
  body.mis-student-mode {
    background: #fff;
  }
  body.mis-student-mode > main {
    max-width: none;
    padding: 0;
  }
  body.mis-student-mode :is(.student-stage-predict, .student-stage-apply, .learning-evidence, .object-exercise) {
    border-color: #777;
    background: #fff;
    box-shadow: none;
  }
  body.mis-student-mode .student-workspace-title {
    order: initial;
    flex-basis: 100%;
  }
  body.mis-student-mode .student-quiet-details > :not(summary) {
    display: block !important;
  }
  body.mis-student-mode .object-exercise {
    print-color-adjust: exact;
  }
  body.mis-student-mode .student-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  body.mis-student-mode a.student-activity-card {
    break-inside: avoid;
    box-shadow: none;
  }
}
