:root {
  color-scheme: light;
  --ink: #182327;
  --muted: #657177;
  --line: #d8dfe2;
  --surface: #ffffff;
  --surface-soft: #f4f7f8;
  --surface-strong: #e9eff1;
  --teal: #146d73;
  --teal-dark: #0e5157;
  --teal-soft: #e5f2f2;
  --rust: #b74d3b;
  --rust-soft: #faebe7;
  --amber: #a96c12;
  --amber-soft: #fff4dc;
  --green: #2f7658;
  --green-soft: #e7f2ec;
  --focus: #246da8;
  --shadow: 0 10px 28px rgba(23, 42, 48, 0.1);
}

/* v2.1 AI-primary evidence and student reflection surfaces */
.workspace-status-detail {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.measurement-readout,
.drag-record-status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid #c8d5d7;
  border-radius: 5px;
  color: #33484d;
  background: #f7faf9;
  font-weight: 600;
  white-space: normal;
}

.drag-record-status.is-complete {
  color: #235b43;
  border-color: #a9cbbb;
  background: #eef7f2;
}

.record-summary {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-left: 4px solid var(--teal);
  background: #f2f8f8;
}

.record-summary > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--teal-dark);
  font-size: 11px;
  font-weight: 700;
}

.record-summary svg {
  width: 15px;
  height: 15px;
}

.record-summary p {
  margin: 5px 0 0;
  color: #34464b;
  font-size: 13px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.student-result-dialog {
  width: min(920px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #b8c8ca;
  border-radius: 8px;
  box-shadow: 0 18px 54px rgba(23, 44, 48, 0.22);
}

.student-result-dialog::backdrop {
  background: rgba(25, 40, 44, 0.52);
}

.live-support-notice {
  width: min(100% - 32px, 1500px);
  margin: 12px auto 0;
  padding: 14px 18px;
  border: 1px solid #89c9cf;
  border-left: 5px solid #0b7a80;
  border-radius: 6px;
  background: #edf9f8;
  color: #12304a;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.live-support-notice[hidden] { display: none; }

.live-support-notice-main {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.live-support-notice-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #0b7a80;
  color: #fff;
}

.live-support-notice-main strong,
.live-support-notice-main p,
.live-support-notice-privacy,
.live-support-notice-actions p {
  display: block;
  margin: 0;
}

.live-support-notice-main strong { margin-top: 2px; font-size: 16px; }
.live-support-notice-main p { margin-top: 3px; color: #476178; font-size: 13px; }
.live-support-notice-privacy { margin-top: 5px; color: #0b6d73; font-size: 12px; }
.live-support-notice-privacy svg { width: 14px; height: 14px; vertical-align: -2px; }

.live-support-notice-actions {
  max-width: 580px;
  padding-left: 18px;
  border-left: 1px solid #b5dfe1;
}

.live-support-notice-actions[hidden] { display: none; }
.live-support-action-group + .live-support-action-group {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #c8e4e5;
}
.live-support-action-group[hidden] { display: none; }
.live-support-action-group p { margin-bottom: 8px; color: #28485f; font-size: 13px; }
.live-support-action-group > div { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.live-support-end-group p { color: #5d6d78; }
.live-support-notice-actions .button { min-height: 38px; padding: 8px 12px; }

@media (max-width: 800px) {
  .live-support-notice { align-items: stretch; flex-direction: column; gap: 12px; }
  .live-support-notice-actions { max-width: none; padding: 12px 0 0; border-left: 0; border-top: 1px solid #b5dfe1; }
  .live-support-action-group > div { justify-content: stretch; flex-wrap: wrap; }
  .live-support-notice-actions .button { flex: 1 1 150px; }
}

.student-result-header,
.student-result-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  background: #f7faf9;
}

.student-result-header {
  border-bottom: 1px solid var(--line);
}

.student-result-header h2 {
  margin: 3px 0 0;
  font-size: 22px;
}

.student-result-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.student-result-summary {
  padding: 16px 22px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.student-result-summary > div {
  min-width: 0;
  padding: 12px;
  background: var(--surface);
}

.student-result-summary span,
.student-result-summary strong {
  display: block;
}

.student-result-summary span {
  color: var(--muted);
  font-size: 11px;
}

.student-result-summary strong {
  margin-top: 5px;
  font-size: 20px;
}

.student-result-activities {
  max-height: min(510px, calc(100vh - 310px));
  padding: 18px 22px;
  overflow-y: auto;
  display: grid;
  gap: 12px;
}

.student-result-activity {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.student-result-activity-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.student-result-activity-heading span {
  color: var(--teal-dark);
  font-size: 10px;
  font-weight: 700;
}

.student-result-activity-heading h3 {
  margin: 4px 0 0;
  font-size: 15px;
}

.student-result-activity-heading > strong {
  flex: 0 0 auto;
  color: #235b43;
  font-size: 12px;
}

.student-result-process {
  margin-top: 10px;
  display: flex;
  gap: 8px 16px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 11px;
}

.student-result-response {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.student-result-response span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.student-result-response p,
.student-result-empty {
  margin: 4px 0 0;
  color: #33454a;
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.student-result-footer {
  border-top: 1px solid var(--line);
}

.student-result-footer-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.student-result-footer-copy > span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
}

.student-result-footer-copy svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
}

.student-result-footer-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.student-survey-dialog {
  width: min(1060px, calc(100vw - 28px));
  height: min(920px, calc(100vh - 24px));
  height: min(920px, calc(100dvh - 24px));
  max-height: min(920px, calc(100vh - 24px));
  max-height: min(920px, calc(100dvh - 24px));
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #b8c8ca;
  border-radius: 8px;
  box-shadow: 0 18px 54px rgba(23, 44, 48, 0.24);
}

.student-survey-dialog[open] {
  display: flex;
  flex-direction: column;
}

.student-survey-dialog::backdrop {
  background: rgba(25, 40, 44, 0.56);
}

.student-survey-header,
.student-survey-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 17px 22px;
  background: #f7faf9;
}

.student-survey-header {
  border-bottom: 1px solid var(--line);
}

.student-survey-header > div {
  min-width: 0;
}

.student-survey-heading-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.student-survey-mode {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid #9fc2b2;
  border-radius: 4px;
  color: #285d47;
  background: #eef7f2;
  font-size: 10px;
  font-weight: 700;
}

.student-survey-header h2 {
  margin: 4px 0 0;
  font-size: 21px;
  line-height: 1.35;
}

.student-survey-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.student-survey-scroll {
  flex: 1 1 auto;
  min-height: 0;
  padding: 18px 22px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.student-survey-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-left: 4px solid var(--teal);
  background: #eef7f7;
  color: #29474b;
}

.student-survey-notice svg {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-top: 2px;
  color: var(--teal);
}

.student-survey-notice p {
  margin: 0;
  font-size: 12px;
  line-height: 1.65;
}

.student-survey-nav {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.student-survey-nav button {
  min-height: 48px;
  padding: 8px 10px;
  color: #526368;
  background: var(--surface);
  border: 0;
  border-bottom: 3px solid transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.student-survey-nav button:hover,
.student-survey-nav button[aria-selected="true"] {
  color: var(--teal-dark);
  background: #f5fafa;
  border-bottom-color: var(--teal);
}

.student-survey-nav button:focus-visible {
  position: relative;
  z-index: 1;
  outline: 3px solid rgba(36, 109, 168, 0.28);
  outline-offset: -3px;
}

.student-survey-content {
  min-height: 470px;
}

.student-survey-section {
  padding-top: 22px;
}

.student-survey-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.student-survey-section-heading > span {
  flex: 0 0 30px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--teal);
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
}

.student-survey-section-heading h3 {
  margin: 0;
  font-size: 18px;
}

.student-survey-section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.student-survey-identity {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.student-survey-identity > div {
  min-width: 0;
  padding: 14px 12px;
}

.student-survey-identity > div + div {
  border-left: 1px solid var(--line);
}

.student-survey-identity span,
.student-survey-identity strong {
  display: block;
}

.student-survey-identity span {
  color: var(--muted);
  font-size: 10px;
}

.student-survey-identity strong {
  margin-top: 4px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.student-survey-question-list {
  display: grid;
}

.student-survey-question {
  min-width: 0;
  margin: 0;
  padding: 16px 4px 18px;
  border: 0;
  border-bottom: 1px solid var(--line);
}

.student-survey-question legend {
  width: 100%;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 0;
  color: #26383d;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
}

.student-survey-question legend > span {
  flex: 0 0 25px;
  color: var(--teal-dark);
  font-weight: 700;
}

.student-survey-choice-row {
  margin: 12px 0 0 34px;
  display: grid;
  gap: 7px;
}

.student-survey-choice-row-compact {
  grid-template-columns: repeat(3, minmax(0, 150px));
}

.student-survey-choice-row label {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.student-survey-choice-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.student-survey-choice-row label > span {
  min-height: 42px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #42545a;
  background: #fff;
  border: 1px solid #cbd6d9;
  border-radius: 5px;
  font-size: 12px;
  text-align: center;
}

.student-survey-choice-row input:checked + span {
  color: var(--teal-dark);
  background: var(--teal-soft);
  border-color: #4d9da2;
  box-shadow: inset 0 0 0 1px #4d9da2;
}

.student-survey-choice-row input:focus-visible + span {
  outline: 3px solid rgba(36, 109, 168, 0.28);
  outline-offset: 2px;
}

.student-survey-scale-key {
  padding: 10px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px 16px;
  color: #56666b;
  background: #f6f8f8;
  border-bottom: 1px solid var(--line);
  font-size: 10px;
}

.student-survey-scale-key b {
  color: var(--teal-dark);
}

.student-survey-likert-group {
  margin-top: 20px;
}

.student-survey-likert-group h4 {
  margin: 0;
  padding: 8px 10px;
  color: #27474b;
  background: #edf4f4;
  border-left: 4px solid #5c9397;
  font-size: 13px;
}

.student-survey-likert-options {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.student-survey-likert-options label > span {
  min-height: 54px;
  flex-direction: column;
  line-height: 1.25;
}

.student-survey-likert-options b {
  font-size: 13px;
}

.student-survey-likert-options small {
  color: #66757a;
  font-size: 9px;
}

.student-survey-written-list {
  display: grid;
}

.student-survey-written-question {
  position: relative;
  padding: 18px 4px 22px 38px;
  display: block;
  border-bottom: 1px solid var(--line);
}

.student-survey-written-number {
  position: absolute;
  top: 20px;
  left: 4px;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
}

.student-survey-written-question strong,
.student-survey-written-question small {
  display: block;
}

.student-survey-written-question strong {
  color: #26383d;
  font-size: 13px;
  line-height: 1.55;
}

.student-survey-written-question small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.65;
}

.student-survey-written-question textarea {
  width: 100%;
  min-height: 118px;
  margin-top: 10px;
  padding: 11px 12px;
  resize: vertical;
  color: var(--ink);
  background: #fff;
  border: 1px solid #bccacd;
  border-radius: 5px;
  font: inherit;
  font-size: 13px;
  line-height: 1.6;
}

.student-survey-written-question textarea:focus {
  outline: 3px solid rgba(36, 109, 168, 0.22);
  border-color: var(--focus);
}

.student-survey-character-count {
  margin-top: 4px;
  display: block;
  color: #78868a;
  font-size: 9px;
  text-align: right;
}

.student-survey-footer {
  border-top: 1px solid var(--line);
}

.student-survey-save-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.student-survey-save-copy span {
  color: var(--muted);
  font-size: 11px;
}

.student-survey-save-copy span[data-state="saved"] {
  color: var(--green);
}

.student-survey-save-copy span[data-state="offline"],
.student-survey-save-copy span[data-state="error"] {
  color: var(--rust);
}

.student-survey-save-copy strong {
  font-size: 12px;
}

.student-survey-footer-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

@media (max-width: 760px) {
  .workspace-status {
    padding: 8px 10px;
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .workspace-status > span:first-child {
    width: 100%;
    white-space: normal;
  }

  .workspace-status-detail {
    width: 100%;
    justify-content: flex-start;
  }

  .student-result-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .student-result-header,
  .student-result-footer {
    padding: 14px;
  }

  .student-result-header h2 {
    font-size: 18px;
  }

  .student-result-summary {
    padding: 10px 14px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .student-result-activities {
    max-height: calc(100vh - 330px);
    padding: 12px 14px;
  }

  .student-result-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .student-result-footer-actions {
    width: 100%;
  }

  .student-result-footer-actions .button {
    flex: 1 1 0;
  }

  .student-survey-dialog {
    width: calc(100vw - 12px);
    height: calc(100vh - 12px);
    height: calc(100dvh - 12px);
    max-height: calc(100vh - 12px);
    max-height: calc(100dvh - 12px);
  }

  .student-survey-header,
  .student-survey-footer {
    padding: 13px 14px;
  }

  .student-survey-header h2 {
    font-size: 17px;
  }

  .student-survey-scroll {
    padding: 14px;
  }

  .student-survey-nav {
    grid-template-columns: repeat(4, minmax(92px, 1fr));
    overflow-x: auto;
  }

  .student-survey-nav button {
    min-height: 44px;
    padding-inline: 6px;
  }

  .student-survey-content {
    min-height: 400px;
  }

  .student-survey-identity {
    grid-template-columns: 1fr;
  }

  .student-survey-identity > div + div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .student-survey-choice-row {
    margin-left: 0;
  }

  .student-survey-choice-row-compact {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .student-survey-likert-options {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .student-survey-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .student-survey-footer-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .student-survey-footer-actions .button:last-child {
    grid-column: 1 / -1;
  }

  .student-survey-footer-actions .button {
    width: 100%;
  }
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

html {
  background: var(--surface-soft);
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--surface-soft);
  font-family: "Noto Sans KR", "Malgun Gothic", sans-serif;
  font-size: 15px;
  line-height: 1.55;
}

button,
textarea,
select,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
textarea:focus-visible,
select:focus-visible,
input:focus-visible,
.visual-stage:focus-visible {
  outline: 3px solid rgba(36, 109, 168, 0.3);
  outline-offset: 2px;
}

.cloud-login-view {
  min-height: 100vh;
  padding: 28px 18px;
  display: grid;
  place-items: center;
  background:
    linear-gradient(90deg, var(--surface) 0 50%, var(--surface-soft) 50% 100%);
}

.cloud-login-panel {
  width: min(520px, 100%);
  padding: 34px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--teal);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.cloud-login-panel > .brand-mark {
  margin-bottom: 18px;
}

.cloud-login-panel h1 {
  margin: 5px 0 8px;
  font-size: 26px;
  line-height: 1.35;
}

.cloud-login-panel > p:not(.activity-kicker) {
  margin: 0 0 24px;
  color: var(--muted);
}

.cloud-login-panel form {
  display: grid;
  gap: 9px;
}

.cloud-login-panel label {
  margin-top: 5px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.cloud-login-panel input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid #bfc9cd;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
}

.cloud-login-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(110px, 0.7fr);
  gap: 12px;
}

.cloud-login-grid > div {
  display: grid;
  gap: 9px;
}

.cloud-login-submit {
  width: 100%;
  margin-top: 12px;
}

.cloud-login-status {
  min-height: 23px;
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.cloud-login-status[data-state="error"],
.cloud-login-status[data-state="offline"] {
  color: var(--rust);
}

.cloud-login-status[data-state="idle"] {
  color: var(--green);
}

.review-bar {
  position: relative;
  z-index: 30;
  min-height: 54px;
  padding: 8px max(18px, calc((100vw - 1440px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  color: #5a251d;
  background: var(--rust-soft);
  border-bottom: 1px solid #efc5bb;
}

.review-identity,
.review-controls,
.session-status,
.brand,
.progress-heading,
.workspace-status,
.assistant-identity,
.lesson-actions,
.phase-actions {
  display: flex;
  align-items: center;
}

.review-identity,
.review-controls {
  gap: 10px;
}

.review-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
}

.review-note,
.control-label {
  font-size: 12px;
  color: #7b4a43;
}

.segmented {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid #dca99f;
  border-radius: 6px;
  background: var(--surface);
}

.segmented button {
  min-height: 32px;
  padding: 4px 10px;
  border: 0;
  border-right: 1px solid #ead1cb;
  background: transparent;
  color: #74463e;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.is-active {
  color: #ffffff;
  background: var(--rust);
}

.review-icon-button,
.icon-button {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  cursor: pointer;
}

.review-icon-button {
  border-color: #dca99f;
  color: var(--rust);
}

.review-icon-button svg,
.icon-button svg,
.button svg,
.brand-mark svg,
.assistant-mark svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.app-shell {
  min-height: 100vh;
  background: var(--surface-soft);
}

body.review-mode .app-shell {
  min-height: calc(100vh - 54px);
}

.app-header {
  height: 72px;
  padding: 0 max(22px, calc((100vw - 1440px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand {
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark,
.assistant-mark {
  flex: 0 0 auto;
  display: inline-grid;
  place-items: center;
  color: #ffffff;
  background: var(--teal);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 7px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
}

.brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 12px;
}

.session-status {
  gap: 14px;
}

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
}

.save-status svg {
  width: 16px;
  height: 16px;
}

.save-status[data-state="connecting"],
.save-status[data-state="saving"] {
  color: var(--amber);
}

.save-status[data-state="offline"],
.save-status[data-state="error"] {
  color: var(--rust);
}

.learner-name {
  font-size: 13px;
  font-weight: 600;
}

.lesson-progress {
  padding: 18px max(22px, calc((100vw - 1440px) / 2)) 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.progress-heading {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
}

.progress-heading > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.section-label,
.activity-kicker,
.prompt-eyebrow {
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

.progress-heading > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.activity-nav {
  display: grid;
  grid-template-columns: repeat(7, minmax(90px, 1fr));
  gap: 0;
}

.activity-nav button {
  position: relative;
  min-height: 54px;
  padding: 22px 7px 5px;
  border: 0;
  border-top: 3px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.activity-nav button::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  width: 11px;
  height: 11px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--line);
  transform: translateX(-50%);
}

.activity-nav button.is-complete {
  border-top-color: var(--green);
  color: var(--green);
}

.activity-nav button.is-complete::before {
  background: var(--green);
}

.activity-nav button.is-active {
  border-top-color: var(--rust);
  color: var(--ink);
}

.activity-nav button.is-active::before {
  width: 15px;
  height: 15px;
  top: -9px;
  background: var(--rust);
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px 22px 36px;
}

.activity-heading {
  min-height: 90px;
  padding: 2px 0 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
}

.activity-heading h1 {
  max-width: 900px;
  margin: 4px 0 7px;
  font-size: 26px;
  line-height: 1.3;
}

.activity-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.activity-state {
  min-width: 130px;
  padding-top: 8px;
  text-align: right;
}

.activity-state span,
.activity-state strong {
  display: block;
}

.activity-state span {
  color: var(--muted);
  font-size: 12px;
}

.activity-state strong {
  margin-top: 3px;
  color: var(--teal-dark);
  font-size: 14px;
}

.episode-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(360px, 0.88fr);
  min-height: 600px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.workspace-panel {
  min-width: 0;
  display: grid;
  grid-template-rows: 56px minmax(460px, 1fr) 46px;
  background: #eef2f3;
  border-right: 1px solid var(--line);
}

.workspace-toolbar,
.response-panel,
.assistant-band {
  background: var(--surface);
}

.workspace-toolbar {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.tool-list,
.view-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-list {
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
}

.tools-locked {
  padding: 6px 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.tools-locked svg {
  width: 15px;
  height: 15px;
}

.view-tools {
  flex: 0 0 auto;
}

.tool-button {
  min-width: 54px;
  height: 38px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.tool-button svg {
  width: 16px;
  height: 16px;
}

.tool-button.is-active {
  color: var(--teal-dark);
  border-color: #8dbfc2;
  background: var(--teal-soft);
}

.tool-button.is-recommended {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 1px var(--teal);
}

.tool-role-badge {
  padding: 1px 4px;
  color: #ffffff;
  border-radius: 3px;
  background: var(--teal);
  font-size: 9px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.tool-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.visual-stage {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #eef2f3;
}

.ggb-recovery-notice {
  position: absolute;
  z-index: 7;
  left: 16px;
  right: 16px;
  bottom: 14px;
  min-height: 48px;
  padding: 8px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #512b22;
  border: 1px solid #d8a18f;
  border-radius: 6px;
  background: #fff8f5;
  box-shadow: 0 6px 18px rgba(55, 31, 25, 0.14);
  font-size: 12px;
  font-weight: 600;
}

.ggb-recovery-notice[hidden] {
  display: none;
}

.ggb-recovery-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ggb-recovery-actions .button {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 11px;
}

.ggb-recovery-actions .icon-button {
  width: 34px;
  height: 34px;
}

.visual-content {
  width: calc(100% - 32px);
  max-height: calc(100% - 32px);
  aspect-ratio: 16 / 10;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #cfd7da;
  border-radius: 4px;
  background: #ffffff;
}

.visual-content > img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.real-ggb-shell,
.real-ggb-mount {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.real-ggb-shell {
  position: relative;
  overflow: hidden;
  background: #ffffff;
}

.real-ggb-mount {
  display: grid;
  place-items: stretch;
}

.real-ggb-mount > div,
.real-ggb-mount iframe {
  width: 100% !important;
  height: 100% !important;
}

.real-ggb-loading {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--muted);
  background: #ffffff;
}

.real-ggb-loading-content {
  display: grid;
  width: min(100%, 520px);
  gap: 10px;
  justify-items: center;
  color: var(--muted);
  text-align: center;
}

.real-ggb-loading-content strong {
  color: var(--text);
}

.real-ggb-loading-content small {
  max-width: 48ch;
  line-height: 1.5;
}

.real-ggb-loading-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.visual-stage.is-ggb-locked .real-ggb-mount {
  pointer-events: none;
}

.visual-stage.is-attempt-locked .real-ggb-mount {
  pointer-events: none;
  filter: saturate(0.7);
}

.pennant-visual {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #fafaf8;
}

.pennant-visual > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.pennant-geometry {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.pennant-bisector,
.pennant-perpendicular,
.pennant-incircle {
  fill: none;
  vector-effect: non-scaling-stroke;
}

.pennant-bisector {
  stroke: #f8d45e;
  stroke-width: 2.4;
}

.pennant-bisector.is-given {
  stroke-dasharray: 7 5;
}

.pennant-bisector.is-student {
  stroke: #f7cf46;
}

.pennant-bisector.is-observed {
  stroke: #fff0a8;
  stroke-dasharray: 5 4;
}

.pennant-perpendicular {
  stroke: #ffffff;
  stroke-width: 2;
}

.pennant-incircle {
  stroke: #fff5b8;
  stroke-width: 2.8;
  fill: rgba(255, 255, 255, 0.08);
}

.pennant-point,
.pennant-foot {
  fill: #ffffff;
  stroke: #173f43;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}

.pennant-object-name {
  fill: #ffffff;
  stroke: rgba(23, 63, 67, 0.8);
  stroke-width: 0.5;
  paint-order: stroke;
  font-size: 4px;
  font-weight: 700;
  letter-spacing: 0;
}

.pennant-point-label {
  z-index: 3;
  width: 24px;
  height: 24px;
  font-size: 12px;
}

.pennant-point-label.point-p {
  left: 45%;
  top: 37.93%;
}

.pennant-point-label.point-i {
  left: 58.64%;
  top: 38.69%;
}

.community-map-visual {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: #dce9d0;
}

.community-map-background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.community-map-geometry {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-triangle,
.map-bisector,
.map-radius {
  fill: none;
  vector-effect: non-scaling-stroke;
}

.map-triangle {
  fill: rgba(255, 255, 255, 0.2);
  stroke: #174f55;
  stroke-width: 2.2;
}

.map-bisector {
  stroke: #cf563f;
  stroke-width: 1.7;
  stroke-dasharray: 7 5;
}

.map-radius {
  stroke: rgba(23, 79, 85, 0.72);
  stroke-width: 1.35;
}

.map-center-point {
  fill: #ffffff;
  stroke: #173f43;
  stroke-width: 1.8;
  vector-effect: non-scaling-stroke;
}

.village-site {
  position: absolute;
  z-index: 3;
  width: clamp(76px, 17%, 122px);
  aspect-ratio: 1;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.village-site > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.village-a {
  left: 30%;
  top: 20%;
}

.village-b {
  left: 18%;
  top: 75%;
}

.village-c {
  left: 77%;
  top: 70%;
}

.map-vertex-label {
  left: 64%;
  top: 68%;
}

.map-center-label {
  z-index: 4;
  left: 50.9%;
  top: 50.2%;
}

.community-map-visual.is-compact .village-site {
  width: clamp(54px, 18%, 88px);
}

.community-map-visual.is-compact .geometry-label {
  width: 21px;
  height: 21px;
  font-size: 11px;
}

.geometry-label {
  position: absolute;
  z-index: 2;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid #8aa2a5;
  border-radius: 50%;
  color: #173f43;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 1px 4px rgba(27, 54, 58, 0.18);
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.geometry-label.vertex-a {
  left: 15.8%;
  top: 36.3%;
}

.geometry-label.vertex-b {
  left: 73%;
  top: 72.5%;
}

.geometry-label.vertex-c {
  left: 73%;
  top: 7.3%;
}

.visual-compare {
  width: 100%;
  height: 100%;
  padding: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: var(--surface);
}

.visual-compare figure {
  min-width: 0;
  margin: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.visual-compare img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.visual-compare .community-map-visual {
  grid-row: 1;
}

.visual-compare .community-map-background {
  object-fit: cover;
}

.visual-compare figcaption {
  padding: 7px 9px;
  color: var(--muted);
  background: var(--surface-soft);
  border-top: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
}

.ggb-badge {
  position: absolute;
  right: 24px;
  bottom: 22px;
  min-height: 28px;
  padding: 4px 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #415157;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
}

.ggb-badge svg {
  width: 14px;
  height: 14px;
}

.visual-content.is-comparison ~ .ggb-badge {
  display: none;
}

.map-marker {
  position: absolute;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  padding: 0;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--rust);
  box-shadow: 0 2px 8px rgba(58, 27, 21, 0.32);
  pointer-events: none;
}

.map-marker span {
  position: absolute;
  inset: 7px;
  border: 2px solid #ffffff;
  border-radius: 50%;
}

.workspace-status {
  min-width: 0;
  padding: 0 14px;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  background: var(--surface);
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.workspace-status > span:first-child {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.workspace-status svg {
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
}

#evidenceStatus {
  flex: 0 0 auto;
  color: var(--green);
  font-weight: 600;
}

.response-panel {
  min-width: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
}

.phase-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(72px, 1fr);
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
}

.phase-tabs button {
  min-height: 46px;
  padding: 8px 6px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.phase-tabs button.is-active {
  color: var(--teal-dark);
  border-bottom-color: var(--teal);
}

.phase-tabs button.is-complete {
  color: var(--green);
}

.prompt-block {
  padding: 22px 0 16px;
}

.prompt-block h2 {
  margin: 4px 0 8px;
  font-size: 20px;
  line-height: 1.4;
}

.prompt-block p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.response-content {
  flex: 1 1 auto;
  min-height: 260px;
}

.answer-label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 700;
}

.answer-area {
  width: 100%;
  min-height: 120px;
  padding: 12px;
  resize: vertical;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid #b9c5c9;
  border-radius: 6px;
  line-height: 1.6;
}

.answer-area::placeholder {
  color: #929da1;
}

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

.choice-button {
  min-height: 48px;
  padding: 9px 10px;
  border: 1px solid #b9c5c9;
  border-radius: 6px;
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
}

.choice-button.is-selected {
  color: var(--teal-dark);
  border-color: var(--teal);
  background: var(--teal-soft);
}

.task-cue {
  padding: 13px 14px;
  display: flex;
  gap: 10px;
  color: #4d3b17;
  background: var(--amber-soft);
  border-left: 4px solid var(--amber);
  border-radius: 4px;
}

.task-cue svg {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
  margin-top: 2px;
}

.task-cue p {
  margin: 0;
  font-size: 13px;
}

.task-instruction {
  color: var(--ink);
  background: var(--surface-soft);
  border-left-color: var(--teal);
}

.task-observation {
  color: var(--ink);
  background: var(--green-soft);
  border-left-color: var(--green);
}

.response-spacer {
  height: 12px;
}

.construction-steps {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.phase-actions .button {
  min-width: 94px;
  flex: 0 0 auto;
  white-space: nowrap;
}

.construction-steps li {
  border-bottom: 1px solid var(--line);
}

.construction-steps button {
  width: 100%;
  min-height: 62px;
  padding: 10px 8px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.construction-steps li.is-active button {
  background: var(--teal-soft);
}

.construction-steps li.is-complete button {
  color: var(--muted);
}

.construction-steps li.is-continued button {
  color: var(--ink);
  background: var(--amber-soft);
}

.construction-steps li.is-locked button {
  color: #78868c;
  background: #f5f7f7;
  cursor: not-allowed;
  opacity: 0.78;
}

.construction-step-number {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  color: var(--teal-dark);
  background: var(--teal-soft);
  border-radius: 50%;
  font-size: 12px;
  font-weight: 800;
}

.construction-steps li.is-complete .construction-step-number {
  color: #fff;
  background: var(--green);
}

.construction-steps li.is-continued .construction-step-number {
  color: #fff;
  background: var(--amber);
}

.construction-steps li.is-continued button > svg,
.construction-steps li.is-continued .construction-step-copy strong small {
  color: var(--amber);
}

.construction-step-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.construction-step-copy strong {
  color: var(--teal-dark);
  font-size: 11px;
}

.construction-step-copy strong small {
  margin-left: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.construction-steps li.is-active .construction-step-copy strong small {
  color: var(--teal-dark);
}

.construction-step-copy > span {
  font-size: 13px;
  line-height: 1.55;
}

.construction-steps button > svg {
  width: 17px;
  height: 17px;
  color: var(--muted);
}

.construction-assist-action {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding: 10px 0 2px;
}

.construction-assist-action .button {
  min-height: 40px;
}

.observation-table,
.comparison-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.incenter-record-table {
  min-width: 0;
}

.incenter-record-table th:nth-child(1) {
  width: 29%;
}

.incenter-record-table th:nth-child(2) {
  width: 31%;
}

.incenter-record-table th:nth-child(3) {
  width: 40%;
}

.observation-table th,
.observation-table td,
.comparison-table th,
.comparison-table td {
  padding: 9px 7px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.observation-table th,
.comparison-table th {
  background: var(--surface-soft);
  font-weight: 700;
}

.observation-table select,
.comparison-table select {
  width: 100%;
  min-height: 34px;
  padding: 4px 6px;
  border: 1px solid #b9c5c9;
  border-radius: 4px;
  background: var(--surface);
}

.micro-status {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
}

.micro-status svg {
  width: 16px;
  height: 16px;
}

.phase-actions {
  min-height: 56px;
  margin-top: 18px;
  padding-top: 14px;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
}

.button {
  min-height: 40px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-weight: 700;
  cursor: pointer;
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.button-help-anchor {
  position: relative;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
}

.button-help-anchor > .button {
  width: 100%;
}

.button-help-anchor.has-button-help {
  cursor: help;
}

.button-help-anchor.has-button-help > .button:disabled {
  pointer-events: none;
}

.button-help-anchor:focus-visible {
  outline: 3px solid rgba(12, 119, 124, 0.28);
  outline-offset: 3px;
}

.button-help-tooltip {
  position: absolute;
  z-index: 30;
  right: 0;
  bottom: calc(100% + 9px);
  width: max-content;
  max-width: min(320px, calc(100vw - 32px));
  padding: 9px 11px;
  color: #ffffff;
  background: #26373b;
  border: 1px solid #26373b;
  border-radius: 6px;
  box-shadow: 0 8px 20px rgba(23, 41, 46, 0.18);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
  text-align: left;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease, visibility 120ms ease;
}

.button-help-tooltip[hidden] {
  display: none;
}

.button-help-anchor.has-button-help:hover .button-help-tooltip,
.button-help-anchor.has-button-help:focus-visible .button-help-tooltip,
.button-help-anchor.has-button-help:focus-within .button-help-tooltip {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.button-primary {
  color: #ffffff;
  background: var(--teal);
  border-color: var(--teal);
}

.button-primary:hover:not(:disabled) {
  background: var(--teal-dark);
}

.button-secondary {
  color: #46555a;
  background: var(--surface);
  border-color: #b9c5c9;
}

.save-hint {
  min-width: 0;
  flex: 1 1 180px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.save-hint.is-navigation {
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
}

.teacher-intervention-band {
  min-height: 116px;
  margin-top: 18px;
  padding: 17px 20px;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  border-block: 1px solid #d9c078;
  border-left: 5px solid #a97816;
  background: #fffaf0;
}

.teacher-intervention-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.teacher-intervention-mark {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #ffffff;
  background: #8a6214;
}

.teacher-intervention-mark svg { width: 19px; height: 19px; }
.teacher-intervention-identity h2 { margin: 2px 0 0; font-size: 15px; }
.teacher-intervention-meta { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.teacher-intervention-message {
  min-width: 0;
  margin: 0;
  padding-left: 20px;
  border-left: 1px solid #decf9f;
  color: #342f23;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.button-teacher {
  color: #ffffff;
  background: #2e7153;
  border-color: #2e7153;
}

.button-teacher:hover:not(:disabled) { background: #245b43; }
.teacher-intervention-band[data-state="viewed"],
.teacher-intervention-band[data-state="responded"] { border-color: #b8d0c3; border-left-color: #2e7153; background: #f3f8f5; }
.teacher-intervention-band[data-state="viewed"] .teacher-intervention-mark,
.teacher-intervention-band[data-state="responded"] .teacher-intervention-mark { background: #2e7153; }

.assistant-band {
  min-height: 132px;
  margin-top: 18px;
  padding: 18px 20px;
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  border: 1px solid #bbd9db;
  border-left: 5px solid var(--teal);
  border-radius: 8px;
}

.assistant-identity {
  gap: 10px;
}

.assistant-mark {
  width: 38px;
  height: 38px;
  border-radius: 7px;
}

.assistant-identity h2 {
  margin: 2px 0 0;
  font-size: 15px;
}

.assistant-message {
  min-width: 0;
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.feedback-level {
  display: block;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
}

.assistant-message p {
  margin: 4px 0 6px;
  font-size: 14px;
}

.feedback-policy {
  color: var(--muted);
  font-size: 11px;
}

.button-assistant {
  min-width: 148px;
  color: var(--teal-dark);
  background: var(--teal-soft);
  border-color: #91bec1;
}

.assistant-actions {
  min-width: 190px;
  display: flex;
  justify-content: flex-end;
}

.feedback-decision-actions {
  width: min(260px, 100%);
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
}

.feedback-decision-actions[hidden] {
  display: none;
}

.feedback-decision-actions .button {
  width: 100%;
  min-width: 0;
  justify-content: flex-start;
  white-space: normal;
  text-align: left;
}

.assistant-band.is-loading {
  border-left-color: #6d8589;
  background: #f7f9f9;
}

.button-spinner {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  border: 2px solid rgba(23, 79, 85, 0.25);
  border-top-color: var(--teal-dark);
  border-radius: 50%;
  animation: feedback-spin 0.8s linear infinite;
}

@keyframes feedback-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .button-spinner { animation: none; }
}

.assistant-band.is-disabled {
  border-color: var(--line);
  border-left-color: #89969b;
}

.assistant-band.is-disabled .assistant-mark {
  background: #75858b;
}

.lesson-actions {
  min-height: 72px;
  margin-top: 18px;
  justify-content: space-between;
  gap: 20px;
}

.lesson-completion {
  text-align: center;
}

.lesson-completion span,
.lesson-completion strong {
  display: block;
}

.lesson-completion span {
  color: var(--muted);
  font-size: 11px;
}

.lesson-completion strong {
  margin-top: 2px;
  font-size: 13px;
}

.inspector {
  position: fixed;
  z-index: 50;
  top: 0;
  right: 0;
  width: min(440px, 94vw);
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -14px 0 34px rgba(23, 42, 48, 0.18);
  transform: translateX(102%);
  transition: transform 180ms ease;
}

.inspector.is-open {
  transform: translateX(0);
}

.inspector-header {
  min-height: 76px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--rust-soft);
  border-bottom: 1px solid #efc5bb;
}

.inspector-header h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.inspector-body {
  overflow-y: auto;
  padding: 18px;
}

.machine-state {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.machine-state > div {
  padding: 9px 10px;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.machine-state > div:last-child {
  border-bottom: 0;
}

.machine-state dt {
  color: var(--muted);
  font-size: 11px;
}

.machine-state dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
}

.inspector-body section {
  margin-top: 22px;
}

.inspector-body h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.evidence-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.evidence-list li {
  position: relative;
  min-height: 30px;
  padding: 5px 0 5px 22px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.evidence-list li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 11px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--green);
  border-radius: 50%;
}

.rubric-row {
  padding: 11px 0;
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 10px;
  border-bottom: 1px solid var(--line);
}

.rubric-row span {
  color: var(--rust);
  font-size: 12px;
  font-weight: 700;
}

.rubric-row p {
  margin: 0;
  color: #4f5e63;
  font-size: 12px;
}

.scrim {
  position: fixed;
  z-index: 45;
  inset: 0;
  background: rgba(17, 30, 35, 0.38);
}

@media (max-width: 1120px) {
  .review-note,
  .control-label {
    display: none;
  }

  .episode-layout {
    grid-template-columns: minmax(0, 1.2fr) minmax(340px, 0.8fr);
  }

  .tool-button span {
    display: none;
  }

  .tool-button {
    min-width: 38px;
    padding: 4px;
  }

  .tool-role-badge {
    display: none;
  }

  .assistant-band {
    grid-template-columns: 180px minmax(0, 1fr);
  }

  .teacher-intervention-band {
    grid-template-columns: 180px minmax(0, 1fr);
  }

  .teacher-intervention-band .button-teacher {
    grid-column: 2;
    justify-self: start;
  }

  .assistant-actions {
    grid-column: 2;
    justify-self: start;
    justify-content: flex-start;
  }
}

@media (max-width: 860px) {
  .review-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .review-controls {
    width: 100%;
  }

  .segmented {
    flex: 1 1 auto;
  }

  .segmented button {
    flex: 1 1 25%;
    padding-inline: 5px;
  }

  .app-header {
    height: 64px;
  }

  .save-status,
  .learner-name {
    display: none;
  }

  .activity-nav {
    grid-template-columns: repeat(7, 92px);
    overflow-x: auto;
    padding-top: 4px;
  }

  main {
    padding-inline: 14px;
  }

  .activity-heading {
    min-height: 0;
  }

  .activity-heading h1 {
    font-size: 23px;
  }

  .episode-layout {
    display: block;
  }

  .workspace-panel {
    grid-template-rows: 54px minmax(360px, 56vh) 44px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .response-panel {
    min-height: 520px;
  }

  .assistant-band {
    grid-template-columns: 1fr auto;
  }

  .teacher-intervention-band {
    grid-template-columns: 1fr auto;
  }

  .teacher-intervention-message {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 14px 0 0;
    border-top: 1px solid #decf9f;
    border-left: 0;
  }

  .teacher-intervention-band .button-teacher {
    grid-column: 2;
    grid-row: 1;
  }

  .assistant-message {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 14px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .assistant-band .button-assistant {
    grid-column: 2;
    grid-row: 1;
  }
}

@media (max-width: 560px) {
  .cloud-login-view {
    padding: 0;
    place-items: stretch;
    background: var(--surface);
  }

  .cloud-login-panel {
    width: 100%;
    min-height: 100vh;
    padding: 32px 20px;
    border: 0;
    border-top: 5px solid var(--teal);
    border-radius: 0;
    box-shadow: none;
  }

  .cloud-login-grid {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .incenter-record-scroll {
    overflow: visible;
  }

  .incenter-record-table {
    min-width: 0;
  }

  .incenter-record-table thead {
    display: none;
  }

  .incenter-record-table,
  .incenter-record-table tbody,
  .incenter-record-table tr,
  .incenter-record-table td {
    display: block;
    width: 100%;
  }

  .incenter-record-table tr {
    margin-bottom: 9px;
    border: 1px solid var(--line);
    border-radius: 4px;
    overflow: hidden;
  }

  .incenter-record-table td {
    border: 0;
  }

  .incenter-record-table td + td {
    border-top: 1px solid var(--line);
  }

  .incenter-record-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
  }

  body {
    font-size: 14px;
  }

  .review-bar {
    padding-inline: 10px;
  }

  .review-identity strong {
    font-size: 13px;
  }

  .segmented button {
    min-height: 36px;
    font-size: 10px;
  }

  .app-header,
  .lesson-progress {
    padding-inline: 14px;
  }

  .brand strong {
    font-size: 15px;
  }

  .brand small {
    display: none;
  }

  .progress-heading > div {
    display: block;
  }

  .progress-heading .section-label {
    display: block;
  }

  .activity-heading {
    display: block;
  }

  .activity-heading h1 {
    font-size: 21px;
  }

  .activity-state {
    min-width: 0;
    padding-top: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: left;
  }

  .activity-state strong {
    margin-top: 0;
  }

  .workspace-panel {
    grid-template-rows: 54px 330px 44px;
  }

  .view-tools .icon-button:nth-child(2),
  .view-tools .icon-button:nth-child(5) {
    display: none;
  }

  .workspace-toolbar {
    padding-inline: 8px;
  }

  .tool-list {
    padding-bottom: 2px;
  }

  .ggb-recovery-notice {
    left: 8px;
    right: 8px;
    bottom: 8px;
    align-items: stretch;
    flex-direction: column;
  }

  .ggb-recovery-actions {
    width: 100%;
  }

  .ggb-recovery-actions .button {
    flex: 1 1 auto;
  }

  .visual-content {
    width: calc(100% - 18px);
  }

  .visual-content.is-comparison {
    height: calc(100% - 18px);
    max-height: none;
    aspect-ratio: auto;
  }

  .visual-compare {
    padding: 8px;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr 1fr;
    min-height: 0;
  }

  .visual-compare figure {
    grid-template-rows: minmax(0, 1fr) 28px;
  }

  .visual-compare figcaption {
    padding: 4px;
  }

  .workspace-status > span:first-child {
    max-width: 68%;
  }

  .response-panel {
    min-height: 540px;
    padding: 16px;
  }

  .prompt-block h2 {
    font-size: 18px;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

  .phase-actions {
    flex-wrap: wrap;
  }

  .phase-actions .button-help-tooltip {
    right: auto;
    left: 0;
  }

  .save-hint {
    width: 100%;
    order: -1;
  }

  .assistant-band {
    padding: 15px;
  }

  .teacher-intervention-band {
    padding: 15px;
  }

  .teacher-intervention-band .button-teacher {
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
  }

  .assistant-actions {
    grid-column: 1 / -1;
    width: 100%;
  }

  .assistant-actions > .button,
  .feedback-decision-actions {
    width: 100%;
  }

  .lesson-actions {
    gap: 8px;
  }

  .lesson-completion {
    display: none;
  }

  .lesson-actions .button {
    flex: 1 1 50%;
    padding-inline: 8px;
  }

  .lesson-actions > .button-help-anchor {
    flex: 1 1 50%;
  }
}

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

/* Keep the expanded evidence status readable after the legacy mobile rules. */
@media (max-width: 760px) {
  .workspace-panel {
    grid-template-rows: 54px 330px auto;
  }

  .workspace-status {
    min-height: 58px;
    padding: 8px 10px;
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .workspace-status > span:first-child {
    width: 100%;
    max-width: none;
    overflow: visible;
    white-space: normal;
    text-overflow: clip;
  }

  .workspace-status-detail {
    width: 100%;
    justify-content: flex-start;
  }
}
