:root {
  color-scheme: light;
  --bg: #f7f9fc;
  --sidebar: #f1f5f9;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-soft: #eef3f8;
  --panel: #fbfdff;
  --input-bg: #ffffff;
  --hover: #e8eef6;
  --ink: #1f2937;
  --muted: #687385;
  --line: #dce3ec;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --accent-soft: #e8f1ff;
  --focus-line: #8bb7ff;
  --brand-bg: #dcfff5;
  --danger: #b42318;
  --trig-sin: #0f9f7a;
  --trig-cos: #7c3aed;
  --trig-tan: #d97706;
  --shadow: 0 18px 48px rgba(20, 35, 65, 0.14);
  --composer-shadow: 0 10px 28px rgba(31, 41, 55, 0.08);
  --base-font-size: 14px;
  --conversation-width: 860px;
}

:root[data-theme="green"][data-contrast="high"] {
  --bg: #f4faf5;
  --sidebar: #e7f3e9;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-soft: #e4f0e7;
  --panel: #fbfefb;
  --input-bg: #ffffff;
  --hover: #d8eadc;
  --ink: #10251a;
  --muted: #3c5445;
  --line: #607a68;
  --line-strong: #415d4a;
  --accent: #08643d;
  --accent-ink: #ffffff;
  --accent-soft: #d8f2e2;
  --focus-line: #16734a;
  --brand-bg: #d7f1df;
}

.parent-toggle small {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  white-space: nowrap;
}

.parent-toggle:has(input:checked) small {
  color: var(--accent);
  font-weight: 700;
}

.learning-tool-category-tabs {
  margin: 2px 0 10px;
}

:root[data-contrast="high"] {
  --bg: #ffffff;
  --sidebar: #f3f3f3;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-soft: #eeeeee;
  --panel: #ffffff;
  --input-bg: #ffffff;
  --hover: #e5e5e5;
  --ink: #000000;
  --muted: #303030;
  --line: #555555;
  --accent: #0047b3;
}

:root[data-font-scale="small"] body {
  font-size: 13px;
}

:root[data-font-scale="large"] body,
:root[data-font-scale="large"] button,
:root[data-font-scale="large"] input,
:root[data-font-scale="large"] textarea,
:root[data-font-scale="large"] select {
  font-size: 15px;
}

:root[data-font-scale="large"] .message-content {
  font-size: 16px;
  line-height: 1.75;
}

/* v0.2 learning workflow */
.primary-study-actions {
  display: grid;
  gap: 6px;
  margin: 10px 0 14px;
}

.floating-pet.pet-panel-collapsed {
  grid-template-columns: auto;
}

.floating-pet.pet-panel-collapsed .floating-pet-panel,
.floating-pet.pet-panel-collapsed .floating-pet-level {
  display: none;
}

.study-entry-button {
  display: flex;
  min-height: 38px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line-strong, #cfd5d2);
  border-radius: 7px;
  background: var(--soft-accent, #edf6f1);
  color: var(--text, #202725);
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.study-entry-button.secondary {
  background: var(--panel, #fff);
}

.study-entry-button strong {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 11px;
  background: var(--accent, #22835f);
  color: #fff;
  font-size: 12px;
}

.task-search-input {
  width: 100%;
  min-height: 32px;
  margin: 6px 0 8px;
  border: 1px solid var(--line, #dfe3e1);
  border-radius: 6px;
  background: var(--panel, #fff);
  color: var(--text, #202725);
  padding: 6px 9px;
  font: inherit;
  font-size: 12px;
}

.task-panel.collapsed .task-search-input {
  display: none;
}

.task-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
  align-items: center;
}

.task-pin-mark {
  color: var(--accent, #22835f);
  font-size: 11px;
}

.topbar-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  align-items: flex-start;
}

.danger-icon-button {
  color: #b42318;
}

.stop-button {
  background: #9f2f2f;
}

.streaming-cursor::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 3px;
  background: currentColor;
  vertical-align: -0.12em;
  animation: streamingBlink 0.85s steps(1) infinite;
}

@keyframes streamingBlink {
  50% { opacity: 0; }
}

.settings-legal-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.parent-pin-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 8px;
  align-items: end;
}

.learning-center-modal {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  width: min(960px, calc(100vw - 40px));
  height: min(820px, calc(100vh - 40px));
  max-height: min(820px, calc(100vh - 40px));
  overflow: hidden;
}

.student-profile-bar,
.learning-center-toolbar,
.learning-center-tabs {
  display: flex;
  gap: 8px;
  align-items: center;
}

.student-profile-bar select,
.learning-center-toolbar input {
  flex: 1 1 auto;
}

.learning-center-tabs {
  margin-top: 14px;
  border-bottom: 1px solid var(--line, #dfe3e1);
  overflow-x: auto;
}

.learning-tab {
  min-height: 38px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted, #66706d);
  padding: 7px 10px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.learning-tab.active {
  border-bottom-color: var(--accent, #22835f);
  color: var(--text, #202725);
  font-weight: 700;
}

.learning-center-toolbar {
  margin: 12px 0;
}

.learning-center-panel {
  grid-row: 5;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: scroll;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  touch-action: pan-y;
  padding: 2px 8px 16px 2px;
}

.learning-center-panel::-webkit-scrollbar {
  width: 12px;
}

.learning-center-panel::-webkit-scrollbar-track {
  border-radius: 6px;
  background: var(--surface-soft);
}

.learning-center-panel::-webkit-scrollbar-thumb {
  border: 2px solid var(--surface-soft);
  border-radius: 6px;
  background: var(--muted);
}

.learning-center-panel::-webkit-scrollbar-thumb:hover {
  background: var(--ink);
}

.settings-modal.learning-tools-modal {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(1320px, calc(100vw - 32px));
  max-width: none;
  height: min(900px, calc(100vh - 32px));
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

.learning-tool-admin-main {
  margin-bottom: 14px;
  padding: 0;
}

.learning-tools-modal .learning-tool-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 4px 10px 2px;
}

.learning-tools-modal .learning-tool-open {
  min-height: 112px;
  align-items: flex-start;
  padding: 12px;
}

.learning-tools-modal .learning-tool-card-actions {
  position: static;
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.learning-tool-utility-panel {
  min-width: 0;
  max-height: 230px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  overflow: auto;
  scrollbar-width: thin;
}

.learning-tool-utility-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.learning-tool-utility-header h3 {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
}

.learning-tool-utility-header p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.learning-tool-inline-panel {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.learning-tool-inline-panel .tool-row {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 0;
}

.learning-tool-inline-panel .timer-row {
  grid-template-columns: repeat(2, minmax(0, auto));
  justify-content: start;
}

.learning-tool-inline-panel .tool-result {
  margin-top: 6px;
  margin-right: 0;
  margin-left: 0;
  overflow-wrap: anywhere;
}

.learning-tool-inline-panel.game-picker {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 12px;
}

.learning-tools-modal.physics-visualization-open {
  grid-template-rows: auto minmax(0, 1fr);
}

.learning-tools-modal.physics-visualization-open > .learning-tool-admin-main,
.learning-tools-modal.physics-visualization-open > .learning-tool-category-tabs,
.learning-tools-modal.physics-visualization-open > .learning-tool-grid {
  display: none;
}

.learning-tools-modal.physics-visualization-open .learning-tool-utility-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
  max-height: none;
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
  overflow: hidden;
}

.learning-tools-modal.physics-visualization-open .learning-tool-utility-header {
  align-items: center;
  margin-bottom: 8px;
}

.physics-visualization-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.physics-visualization-panel.hidden {
  display: none;
}

.physics-lab-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--line);
}

.physics-control-group {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.physics-control-group > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.physics-segmented {
  display: inline-flex;
  min-width: 0;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.physics-segmented button {
  min-height: 31px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 5px 9px;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
}

.physics-segmented button:hover {
  color: var(--accent);
}

.physics-segmented button.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(31, 70, 52, 0.13);
}

.physics-toolbar-actions {
  display: flex;
  gap: 7px;
  margin-left: auto;
}

.physics-lab-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 294px;
  gap: 14px;
  min-height: 0;
  padding-top: 10px;
}

.physics-stage-wrap {
  position: relative;
  min-width: 0;
  min-height: 300px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fcf9;
}

#physicsVisualizationCanvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 300px;
  cursor: grab;
  touch-action: none;
}

#physicsVisualizationCanvas.dragging {
  cursor: grabbing;
}

.physics-stage-legend {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px 10px;
  max-width: min(390px, calc(100% - 20px));
  padding: 6px 9px;
  border: 1px solid rgba(82, 111, 96, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.9);
  color: #4f6258;
  font-size: 10px;
  pointer-events: none;
}

.physics-stage-legend span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.physics-stage-legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #66776e;
}

.physics-stage-legend .positive {
  background: #d9434c;
}

.physics-stage-legend .negative {
  background: #2868c7;
}

.physics-stage-legend .test {
  border: 2px solid #b45a18;
  background: #fff;
}

.physics-stage-legend .field-line,
.physics-stage-legend .equipotential {
  width: 17px;
  height: 2px;
  border-radius: 0;
  background: #217450;
}

.physics-stage-legend .equipotential {
  background: #b04b55;
}

.physics-interaction-hint {
  position: absolute;
  right: 10px;
  bottom: 8px;
  left: 10px;
  margin: 0;
  padding: 6px 9px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.86);
  color: #53665c;
  font-size: 11px;
  text-align: center;
  pointer-events: none;
}

.physics-control-panel {
  min-width: 0;
  overflow-y: auto;
  padding: 0 5px 8px 0;
  scrollbar-width: thin;
}

.physics-control-panel > section {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.physics-control-panel > section:first-child {
  padding-top: 0;
}

.physics-control-panel h4 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 12px;
}

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

.physics-toggle-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

.physics-toggle-grid input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.physics-parameter-controls {
  display: grid;
  gap: 5px;
}

.physics-parameter-controls > label {
  display: grid;
  gap: 3px;
}

.physics-parameter-controls > label > span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.physics-parameter-controls output {
  color: var(--ink);
  font-weight: 750;
}

.physics-parameter-controls input[type="range"] {
  width: 100%;
  margin: 0;
  accent-color: var(--accent);
}

.physics-parameter-controls input:disabled {
  opacity: 0.42;
}

.physics-readings dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
}

.physics-readings dl > div {
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.physics-readings dt {
  color: var(--muted);
  font-size: 10px;
}

.physics-readings dd {
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.physics-formula-note {
  border-bottom: 0 !important;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.physics-formula-note strong {
  color: var(--ink);
}

.physics-formula-note p {
  margin: 4px 0 0;
}

.physics-formula-note a {
  color: var(--accent);
}

.physics-reference-note {
  position: relative;
  z-index: 2;
  margin: 6px 0 0;
  padding-top: 2px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10px;
  text-align: right;
}

.physics-reference-note a {
  color: var(--accent);
}

.learning-tools-modal.fullscreen-fallback.physics-visualization-open {
  padding: 14px 18px;
  border-radius: 0;
}

@media (max-width: 1080px) {
  .physics-lab-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .physics-control-group {
    flex: 1 1 360px;
  }

  .physics-segmented {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .physics-segmented button {
    white-space: normal;
  }

  .physics-toolbar-actions {
    align-self: end;
  }
}

@media (max-width: 760px) {
  .learning-tools-modal.physics-visualization-open .learning-tool-utility-header p {
    display: none;
  }

  .physics-visualization-panel {
    overflow-y: auto;
  }

  .physics-lab-toolbar {
    position: sticky;
    top: 0;
    z-index: 3;
    gap: 7px;
    background: var(--surface);
  }

  .physics-control-group {
    flex-basis: 100%;
  }

  .physics-segmented button {
    min-height: 38px;
    padding: 4px;
    font-size: 11px;
  }

  .physics-toolbar-actions {
    width: 100%;
    margin-left: 0;
  }

  .physics-toolbar-actions button {
    flex: 1;
  }

  .physics-lab-layout {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .physics-stage-wrap,
  #physicsVisualizationCanvas {
    min-height: min(54vh, 430px);
    height: min(54vh, 430px);
  }

  .physics-control-panel {
    display: grid;
    grid-template-columns: 1fr;
    overflow: visible;
    padding-right: 0;
  }

  .physics-stage-legend {
    top: 6px;
    right: 6px;
    left: 6px;
    justify-content: center;
    max-width: none;
  }

  .physics-reference-note {
    padding-bottom: 8px;
    text-align: left;
  }
}

.settings-modal.video-courses-modal {
  grid-template-rows: auto auto auto auto auto minmax(0, 1fr);
}

.video-course-stage-tabs {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 7px;
  margin: 8px 0 10px;
}

.video-course-stage-tab {
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding: 6px 8px;
  font: inherit;
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, color 150ms ease, transform 150ms ease;
}

.video-course-stage-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

.video-course-stage-tab.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.video-course-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 150px auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.video-course-toolbar input,
.video-course-toolbar select,
.video-course-form input,
.video-course-form select,
.video-course-form textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--ink);
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
}

.video-course-toolbar input,
.video-course-toolbar select {
  min-height: 34px;
}

.video-course-status {
  margin: -4px 0 10px;
  color: var(--muted);
  line-height: 1.45;
}

.video-course-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  min-height: 0;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.video-course-form label {
  min-width: 0;
  margin: 0;
}

.video-course-form label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-course-form textarea {
  min-height: 74px;
  resize: vertical;
}

.video-course-wide {
  grid-column: span 2;
}

.video-course-form-actions {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.video-course-form-actions .microcopy {
  flex: 1 1 220px;
  color: var(--muted);
}

.video-course-list {
  align-content: start;
}

.video-courses-modal .video-course-list {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.video-course-card {
  min-width: 0;
}

.video-courses-modal .video-course-open {
  grid-template-columns: 38px minmax(0, 1fr) 12px;
  gap: 12px;
  min-height: 96px;
  padding: 10px 12px;
}

.video-course-card.active .video-course-open {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 6px 18px rgba(29, 43, 54, 0.09);
}

.video-course-badge {
  align-self: start;
  width: 38px;
  height: 38px;
  border-radius: 7px;
  background: #e9f3ff;
  color: #1c5f99;
  font-size: 12px;
}

.electronic-tutorial-badge {
  background: #e8f5ea;
  color: #236946;
}

.electronic-tutorial-card.active .electronic-tutorial-open {
  border-color: #2e8a57;
  background: #eff9f2;
}

.video-course-card .learning-tool-copy {
  gap: 4px;
}

.video-course-card strong {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 12px;
  line-height: 1.3;
}

.video-course-card small {
  -webkit-line-clamp: 2;
  color: #69746f;
  font-size: 11px;
  line-height: 1.42;
}

.video-course-card em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
  color: #2f6fc5;
}

.video-course-card-actions {
  justify-content: flex-end;
}

.video-course-card-actions button {
  justify-content: center;
}

.knowledge-base-modal {
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  width: min(920px, calc(100vw - 32px));
  max-height: min(820px, calc(100vh - 32px));
  overflow: hidden;
}

.knowledge-base-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.knowledge-base-toggle {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 32px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.knowledge-base-form {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.knowledge-base-form textarea {
  min-height: 140px;
  resize: vertical;
}

#knowledgeBaseSearchInput {
  width: 100%;
  margin-bottom: 12px;
}

.knowledge-base-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.knowledge-base-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.knowledge-base-item.disabled {
  opacity: 0.62;
}

.knowledge-base-item-main {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.knowledge-base-item-main strong,
.knowledge-base-item-main span,
.knowledge-base-item-main p {
  min-width: 0;
}

.knowledge-base-item-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.knowledge-base-item-main span {
  color: var(--muted);
  font-size: 11px;
}

.knowledge-base-item-main p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.5;
}

.knowledge-base-item-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  max-width: 190px;
}

.self-study-plan {
  padding: 8px 6px 18px;
  border-bottom: 1px solid var(--line);
}

.self-study-plan-header,
.self-study-plan-actions,
.learning-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.self-study-plan-header > div > strong,
.self-study-plan-header > div > span {
  display: block;
}

.self-study-plan-header > div > strong {
  color: var(--ink);
  font-size: 16px;
}

.self-study-plan-header > div > span,
.learning-section-heading span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.self-study-duration {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.self-study-duration select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--ink);
  padding: 0 8px;
}

.self-study-goal {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.self-study-goal input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--ink);
  padding: 7px 9px;
  font: inherit;
  font-size: 13px;
}

.self-study-progress {
  height: 7px;
  margin: 12px 0 4px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--line);
}

.self-study-progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 180ms ease;
}

.self-study-task-list {
  margin-top: 7px;
  border-top: 1px solid var(--line);
}

.self-study-task {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 56px;
  border-bottom: 1px solid var(--line);
  padding: 9px 0;
}

.self-study-check {
  display: grid;
  place-items: center;
}

.self-study-check input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.self-study-task-copy {
  min-width: 0;
}

.self-study-task-copy strong,
.self-study-task-copy span {
  display: block;
  overflow-wrap: anywhere;
}

.self-study-task-copy strong {
  color: var(--ink);
  font-size: 13.5px;
}

.self-study-task-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.self-study-task.completed .self-study-task-copy strong {
  color: var(--muted);
  text-decoration: line-through;
}

.self-study-plan-actions {
  justify-content: flex-end;
  margin-top: 12px;
}

.learning-section-heading {
  margin: 18px 6px 4px;
}

.learning-section-heading strong {
  color: var(--ink);
  font-size: 14px;
}

.learning-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line, #dfe3e1);
}

.learning-center-panel .learning-item-row {
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  padding: 14px 6px;
}

.learning-center-panel .learning-item-actions,
.learning-center-panel .review-rating-actions {
  justify-content: flex-start;
}

.learning-center-panel .learning-item-actions {
  width: 100%;
}

.learning-item-main {
  min-width: 0;
}

.learning-item-main > strong,
.learning-item-main > span {
  display: block;
  overflow-wrap: anywhere;
}

.learning-item-main > span {
  margin-top: 4px;
  color: var(--muted, #66706d);
  font-size: 12px;
  line-height: 1.55;
}

.learning-item-question {
  margin-top: 5px;
  color: var(--text, #202725);
  font-size: 13px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.learning-item-label {
  margin-top: 7px;
  color: var(--muted, #66706d);
  font-size: 12px;
  font-weight: 700;
}

.learning-item-answer {
  margin-top: 7px;
}

.learning-item-answer summary {
  width: fit-content;
  color: var(--accent, #22835f);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.learning-record-output-banner {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 9px 0 12px;
}

.learning-record-output-banner div {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.learning-record-output-banner span {
  color: var(--muted);
  font-size: 12px;
}

.learning-item-question p,
.review-answer-box p {
  margin: 0 0 6px;
}

.learning-item-question p:last-child,
.review-answer-box p:last-child {
  margin-bottom: 0;
}

.learning-center-modal .math-display {
  justify-content: flex-start;
  margin: 7px 0;
  padding: 7px 9px;
  background: var(--input-bg, #fff);
}

.learning-item-actions,
.review-rating-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.review-answer-box {
  margin-top: 8px;
  border-left: 3px solid var(--accent, #22835f);
  border-radius: 0 7px 7px 0;
  background: var(--surface-soft, #f5f7f6);
  padding: 12px 14px;
  color: var(--ink, #202725);
  white-space: normal;
}

.learning-center-modal .message-content {
  max-width: 100%;
  color: var(--ink, #202725);
  font-size: 13.5px;
  line-height: 1.68;
  overflow-wrap: anywhere;
}

.learning-center-modal .message-content h2,
.learning-center-modal .message-content h3,
.learning-center-modal .message-content h4,
.learning-center-modal .message-content h5 {
  margin: 12px 0 6px;
  letter-spacing: 0;
  line-height: 1.4;
}

.learning-center-modal .message-content h2 {
  font-size: 17px;
}

.learning-center-modal .message-content h3 {
  font-size: 15px;
}

.learning-center-modal .message-content h4,
.learning-center-modal .message-content h5 {
  font-size: 14px;
}

.learning-center-modal .message-content ul,
.learning-center-modal .message-content ol {
  margin: 5px 0 9px 20px;
}

.learning-center-modal .message-content blockquote {
  margin: 8px 0;
}

.learning-center-modal .message-content table {
  min-width: 480px;
  font-size: 12.5px;
}

.learning-center-modal .message-content .code-block {
  margin: 9px 0;
}

.review-draft {
  width: 100%;
  min-height: 58px;
  margin-top: 9px;
  resize: vertical;
  border: 1px solid var(--line, #dfe3e1);
  border-radius: 6px;
  background: var(--input-bg, #fff);
  color: var(--text, #202725);
  padding: 8px 9px;
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
}

.report-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.report-metric {
  border: 1px solid var(--line, #dfe3e1);
  border-radius: 7px;
  padding: 12px;
  background: var(--panel-muted, #f5f7f6);
}

.learning-recommendation {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin: 12px 0;
  border-block: 1px solid var(--line);
  padding: 12px 0;
  color: var(--ink);
}

.report-metric strong,
.report-metric span {
  display: block;
}

.report-metric strong {
  font-size: 22px;
}

.report-metric span {
  margin-top: 4px;
  color: var(--muted, #66706d);
  font-size: 12px;
}

.mastery-row {
  display: grid;
  grid-template-columns: 60px minmax(0, 1fr) 40px;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
  font-size: 13px;
}

.mastery-track {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--line, #dfe3e1);
}

.mastery-track > span {
  display: block;
  height: 100%;
  background: var(--accent, #22835f);
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--accent, #22835f);
  outline-offset: 2px;
}

@media (max-width: 860px) {
  .learning-center-modal {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    max-height: calc(100vh - 16px);
  }

  .settings-modal.learning-tools-modal {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    max-height: calc(100vh - 16px);
    grid-template-rows: auto auto minmax(180px, 1fr) auto;
  }

  .knowledge-base-modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .knowledge-base-item {
    grid-template-columns: 1fr;
  }

  .knowledge-base-item-actions {
    justify-content: flex-start;
    max-width: none;
  }

  .learning-tool-utility-panel {
    max-height: 34vh;
  }

  .learning-tool-inline-panel.game-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .self-study-plan-header,
  .self-study-plan-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .self-study-duration {
    justify-content: space-between;
  }

  .self-study-plan-actions .compact {
    width: 100%;
  }

  .self-study-task {
    grid-template-columns: 24px minmax(0, 1fr);
  }

  .self-study-task > button {
    grid-column: 2;
    justify-self: start;
  }

  .learning-item-row,
  .parent-pin-row {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

:root[data-theme="green"] {
  --bg: #f5faf6;
  --sidebar: #edf7ef;
  --surface-soft: #eaf4ed;
  --panel: #fbfefb;
  --hover: #dfeee4;
  --ink: #1f2f27;
  --muted: #66756b;
  --line: #d7e6dc;
  --accent: #20845a;
  --accent-soft: #e1f5eb;
  --focus-line: #73c69e;
  --brand-bg: #dff8e8;
}

:root[data-theme="warm"] {
  --bg: #fbfaf6;
  --sidebar: #f4f0e7;
  --surface-soft: #f2ecdf;
  --panel: #fffdf8;
  --hover: #ebe4d7;
  --ink: #2f2a22;
  --muted: #786f61;
  --line: #e4dccd;
  --accent: #b45309;
  --accent-soft: #fff2d6;
  --focus-line: #e8b766;
  --brand-bg: #fff1cf;
}

:root[data-theme="ocean"] {
  --bg: #f3f8fb;
  --sidebar: #e9f2f7;
  --surface-soft: #e5eef5;
  --panel: #fafdff;
  --hover: #dceaf3;
  --ink: #1f2d3a;
  --muted: #637382;
  --line: #d4e2ec;
  --accent: #0e7490;
  --accent-soft: #e0f2fe;
  --focus-line: #67c7df;
  --brand-bg: #d7f6ff;
}

:root[data-theme="night"] {
  color-scheme: dark;
  --bg: #111827;
  --sidebar: #0f172a;
  --surface: #182235;
  --surface-elevated: #1f2a3d;
  --surface-soft: #253149;
  --panel: #151f30;
  --input-bg: #121c2d;
  --hover: #253149;
  --ink: #e5edf8;
  --muted: #a5b0c2;
  --line: #334155;
  --accent: #60a5fa;
  --accent-ink: #09111f;
  --accent-soft: #1e3a5f;
  --focus-line: #60a5fa;
  --brand-bg: #173b43;
  --danger: #fca5a5;
  --trig-sin: #34d399;
  --trig-cos: #c4b5fd;
  --trig-tan: #fbbf24;
  --shadow: 0 20px 54px rgba(0, 0, 0, 0.42);
  --composer-shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-size: var(--base-font-size);
  line-height: 1.55;
  font-family:
    "Segoe UI",
    "Microsoft YaHei",
    system-ui,
    -apple-system,
    sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button:not(:disabled):active {
  transform: translateY(1px);
  filter: brightness(0.94);
}

.hidden {
  display: none !important;
}

.app-shell {
  --conversation-width: 860px;
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.app-shell.sidebar-collapsed {
  --conversation-width: 1240px;
  grid-template-columns: 0 minmax(0, 1fr);
}

.app-shell.app-locked {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

.sidebar-toggle-button {
  position: fixed;
  z-index: 35;
  top: 12px;
  left: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 78px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  color: var(--ink);
  padding: 0 10px;
  box-shadow: 0 10px 24px rgba(29, 43, 54, 0.12);
  transition: left 180ms ease, background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.sidebar-toggle-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar-toggle-button span {
  font-size: 17px;
  line-height: 1;
}

.sidebar-toggle-button strong {
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.app-shell:not(.sidebar-collapsed) .sidebar-toggle-button {
  left: 232px;
  min-width: 54px;
  padding-inline: 8px;
}

body:not(.android-app) .app-shell:not(.sidebar-collapsed) .sidebar-toggle-button {
  display: none;
}

body:not(.android-app) .app-shell:not(.sidebar-collapsed) .sidebar {
  padding-top: 16px;
}

.sidebar {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: 14px;
  border-right: 1px solid var(--line);
  background: var(--sidebar);
  transition: opacity 160ms ease, padding 160ms ease, border-color 160ms ease;
}

.app-shell.sidebar-collapsed .sidebar {
  display: none;
  overflow: hidden;
  padding: 0;
  border-right: 0;
  opacity: 0;
  pointer-events: none;
}

.app-shell.sidebar-collapsed .topbar {
  padding-left: 104px;
}

.brand-area {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.brand {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 6px 8px 10px;
}

.brand .sidebar-collapse-button {
  position: absolute;
  top: 50%;
  right: 8px;
  bottom: auto;
  display: none;
  width: 62px;
  min-width: 62px;
  height: 28px;
  min-height: 28px;
  flex: 0 0 62px;
  gap: 3px;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 700;
  box-shadow: none;
  transform: translateY(-50%);
}

body:not(.android-app) .app-shell:not(.sidebar-collapsed) .sidebar-collapse-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

body:not(.android-app) .app-shell:not(.sidebar-collapsed) .brand p {
  padding-right: 68px;
}

.brand-copy {
  min-width: 0;
  flex: 1;
}

.brand-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  display: grid;
  flex: 0 0 30px;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--brand-bg);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.camera-header h2,
.camera-header p,
.modal-header h2,
.modal-header p {
  margin: 0;
}

.brand h1 {
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
}

.model-balance-button {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 88px;
  min-height: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--muted);
  padding: 2px 6px;
  font: inherit;
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.model-balance-button:hover,
.model-balance-button:focus-visible {
  border-color: var(--accent);
  color: var(--text);
}

.model-balance-button.available {
  border-color: #65a30d;
  background: #f0fdf4;
  color: #3f6212;
}

.model-balance-button.low,
.model-balance-button.insufficient {
  border-color: #dc2626;
  background: #fef2f2;
  color: #b91c1c;
  font-weight: 700;
}

[data-theme="night"] .model-balance-button.available {
  background: #153321;
  color: #bbf7d0;
}

[data-theme="night"] .model-balance-button.low,
[data-theme="night"] .model-balance-button.insufficient {
  background: #451a1a;
  color: #fecaca;
}

.model-balance-panel {
  margin: -4px 8px 4px 48px;
  border-left: 3px solid var(--line);
  padding: 5px 0 5px 9px;
}

.model-balance-panel.warning {
  border-left-color: #dc2626;
}

.model-balance-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.model-balance-panel-header .small-icon-button {
  width: 24px;
  height: 24px;
  min-height: 24px;
  font-size: 15px;
}

.model-balance-panel strong {
  display: block;
  font-size: 12px;
}

.model-balance-panel p {
  margin: 3px 0 7px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.model-balance-panel.warning p {
  color: #b91c1c;
}

.model-balance-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.model-balance-actions .small-icon-button.spinning {
  animation: balanceRefreshSpin 0.8s linear infinite;
}

@keyframes balanceRefreshSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .model-balance-actions .small-icon-button.spinning {
    animation: none;
  }
}

.brand p,
.topbar p,
.camera-header p,
.modal-header p,
.microcopy,
.status-text,
.sidebar-section-title {
  color: var(--muted);
  font-size: 12px;
}

.generated-output-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 6px 0 0 8px;
  vertical-align: middle;
}

.generated-output-actions .ghost-button {
  min-height: 30px;
}

.new-task-button,
.task-item,
.prompt-button,
.fold-tasks-button,
.small-icon-button,
.ghost-button,
.primary-button,
.send-button,
.icon-button,
.text-button,
.context-menu button,
.mini-button {
  border-radius: 8px;
}

.new-task-button {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
}

.new-task-button:hover,
.task-item:hover,
.prompt-button:hover,
.small-icon-button:hover,
.ghost-button:hover,
.icon-button:hover,
.text-button:hover,
.mini-button:hover,
.context-menu button:hover {
  background: var(--hover);
}

.button-icon {
  font-weight: 800;
}

.sidebar-section-title {
  padding: 10px 8px 2px;
  font-weight: 600;
}

.prompt-panel,
.skill-panel,
.study-panel,
.task-panel {
  display: grid;
  flex: 0 0 auto;
  gap: 9px;
  min-height: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.study-panel {
  max-height: 300px;
  overflow-y: auto;
}

.task-panel {
  min-height: auto;
}

.sidebar-support-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  flex: 0 0 auto;
  margin: 0 8px 5px;
}

#openUsageGuideButton {
  grid-column: 2;
}

.sidebar-support-button {
  display: grid;
  grid-template-rows: 20px auto;
  place-items: center;
  gap: 3px;
  min-width: 0;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 6px 3px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
}

.sidebar-support-button:hover,
.sidebar-support-button:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar-support-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: var(--accent);
  font-size: 17px;
  line-height: 1;
}

.collapsible-body,
.task-panel .task-list,
.task-panel .fold-tasks-button {
  display: grid;
}

.study-panel.collapsed .collapsible-body,
.prompt-panel.collapsed .collapsible-body,
.skill-panel.collapsed .collapsible-body,
.task-panel.collapsed .task-list,
.task-panel.collapsed .fold-tasks-button {
  display: none;
}

.sidebar-toggle-title {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
}

.sidebar-toggle-title:hover {
  color: var(--ink);
  background: var(--hover);
}

.prompt-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.prompt-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.small-icon-button {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  background: transparent;
  color: var(--ink);
  font-size: 17px;
}

.small-text-button {
  min-height: 26px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 650;
}

.small-text-button:hover {
  background: var(--hover);
  color: var(--ink);
}

.prompt-list {
  display: grid;
  gap: 4px;
  max-height: 132px;
  overflow-y: auto;
}

.learning-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 0 8px;
}

.learning-center-stats {
  padding: 2px 0 0;
}

.learning-stats div {
  display: grid;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 7px 6px;
  text-align: center;
}

.learning-stats strong {
  font-size: 16px;
}

.learning-stats span,
.study-subtitle,
.study-empty,
.study-list-item span {
  color: var(--muted);
  font-size: 11px;
}

.study-subtitle {
  padding: 2px 8px 0;
  font-weight: 750;
}

.study-list {
  display: grid;
  gap: 4px;
  padding: 0 8px;
}

.study-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 9px;
  text-align: center;
}

.study-list-item {
  display: grid;
  gap: 3px;
  min-width: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 8px;
  text-align: left;
}

.study-list-item:hover {
  background: var(--hover);
}

.study-list-item strong,
.study-list-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.learning-tool-list {
  display: grid;
  gap: 8px;
  padding: 0 8px;
}

.learning-tool-card {
  position: relative;
  min-width: 0;
}

.learning-tool-card-actions {
  position: absolute;
  z-index: 2;
  top: 7px;
  right: 7px;
  display: grid;
  grid-template-columns: repeat(2, 24px);
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 4px 14px rgba(29, 43, 54, 0.1);
  opacity: 0;
  transform: translateY(-2px);
  pointer-events: none;
  transition: opacity 150ms ease, transform 150ms ease;
}

.learning-tool-card:hover .learning-tool-card-actions,
.learning-tool-card:focus-within .learning-tool-card-actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.learning-tool-card-actions .small-icon-button {
  width: 24px;
  height: 24px;
  min-height: 24px;
  border-radius: 6px;
  font-size: 12px;
}

.learning-tool-card-actions .small-icon-button:disabled {
  opacity: 0.35;
}

.learning-tool-open {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 14px;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-width: 0;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
  box-shadow: 0 1px 2px rgba(29, 43, 54, 0.04);
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.learning-tool-open:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 6px 18px rgba(29, 43, 54, 0.09);
  transform: translateY(-1px);
}

.learning-tool-open:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.learning-tool-badge {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 14%, transparent);
}

.learning-tool-card[data-tool-runner="math-animation"] .learning-tool-badge {
  background: #fff0c7;
  color: #9a5700;
  font-size: 22px;
}

.learning-tool-card[data-tool-runner="python"] .learning-tool-badge {
  background: #dff5ff;
  color: #126b91;
}

.learning-tool-card[data-tool-runner="typing"] .learning-tool-badge {
  background: #e7f6dd;
  color: #3f7625;
}

.learning-tool-card[data-tool-runner="cpp"] .learning-tool-badge {
  background: #e9e9ff;
  color: #4c4aa3;
}

.learning-tool-card[data-tool-runner="frontend"] .learning-tool-badge {
  background: #dff7f1;
  color: #13735d;
}

.learning-tool-card[data-tool-runner="office"] .learning-tool-badge {
  background: #ffe9df;
  color: #a54824;
  font-size: 9px;
}

.learning-tool-card[data-tool-runner="games"] .learning-tool-badge,
.learning-tool-card[data-tool-runner="calculator"] .learning-tool-badge {
  background: #fff0c7;
  color: #8b5a00;
}

.learning-tool-card[data-tool-runner="speaking"] .learning-tool-badge,
.learning-tool-card[data-tool-runner="timer"] .learning-tool-badge {
  background: #ffe6e8;
  color: #9d3444;
}

.learning-tool-card[data-tool-runner="prompt"] .learning-tool-badge {
  background: #e5f1ec;
  color: #27644f;
}

.learning-tool-card[data-learning-tool-id="question-tips"] .learning-tool-badge {
  background: #e1f4e8;
  color: #246a40;
}

.learning-tool-card[data-learning-tool-id="middle-school-math-keypoints"] .learning-tool-badge {
  background: #fff0d8;
  color: #96520b;
}

.learning-tool-card[data-learning-tool-id="high-school-math-keypoints"] .learning-tool-badge {
  background: #e8e9ff;
  color: #4a4b9a;
}

.learning-tool-card[data-learning-tool-id="chemistry-formulas"] .learning-tool-badge {
  background: #dcf5ee;
  color: #14705b;
}

.learning-tool-card[data-learning-tool-id="physics-formulas"] .learning-tool-badge {
  background: #dff1ff;
  color: #16638f;
}

.learning-tool-card[data-learning-tool-id="math-formulas"] .learning-tool-badge {
  background: #fff5bf;
  color: #825d00;
}

.learning-tool-card[data-learning-tool-id="middle-school-english-words"] .learning-tool-badge {
  background: #ffe5e8;
  color: #963a49;
}

.learning-tool-card[data-learning-tool-id="high-school-english-words"] .learning-tool-badge {
  background: #e6edf7;
  color: #3d587d;
}

.learning-tool-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.learning-tool-open-mark {
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  transition: color 150ms ease, transform 150ms ease;
}

.learning-tool-open:hover .learning-tool-open-mark {
  color: var(--accent);
  transform: translateX(2px);
}

.learning-tool-open strong,
.learning-tool-open small,
.learning-tool-open em {
  display: block;
  min-width: 0;
}

.learning-tool-open strong {
  font-size: 13px;
  line-height: 1.35;
}

.learning-tool-open small {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.learning-tool-open em {
  margin-top: 2px;
  color: var(--accent);
  font-size: 10px;
  font-style: normal;
  font-weight: 750;
}

.learning-tool-admin {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 8px;
}

.learning-tool-admin select {
  flex: 1 1 120px;
  min-width: 0;
  height: 30px;
  border-radius: 8px;
  font-size: 12px;
}

.tool-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  padding: 0 8px;
}

.tool-row input {
  min-width: 0;
  height: 32px;
  border-radius: 8px;
  font-size: 12px;
}

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

.tool-result {
  min-height: 28px;
  margin: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding: 6px 8px;
  font-size: 12px;
  line-height: 1.35;
}

.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 8px;
}

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

.game-option-button {
  min-width: 0;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 5px 7px;
  font-size: 12px;
}

.game-option-button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.pet-panel {
  display: grid;
  flex: 0 0 auto;
  gap: 8px;
  min-height: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.pet-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  padding: 0 8px;
}

.pet-avatar-button {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--accent-soft);
  overflow: hidden;
}

.pet-avatar {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  transform-origin: center bottom;
}

.pet-avatar-button:hover .pet-avatar {
  transform: translateY(-3px) scale(1.04);
}

.pet-animated-emoji {
  display: inline-block;
  font-size: calc(32px * var(--pet-scale, 1));
  line-height: 1;
  transform-origin: center bottom;
  animation: petIdle 1.85s ease-in-out infinite;
  transition: font-size 180ms ease;
}

.pet-animated-emoji.compact {
  font-size: calc(34px * var(--pet-scale, 1));
}

.pet-avatar-media {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
  animation: petMediaFloat 2.2s ease-in-out infinite;
}

.pet-avatar.has-custom-pet,
.pet-avatar-button.has-custom-pet,
.floating-pet-avatar.has-custom-pet {
  padding: 3px;
  background: var(--surface);
}

.pet-meta {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.pet-name-input {
  height: 30px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 750;
}

.pet-select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 5px;
}

.pet-select-row select {
  min-width: 0;
  height: 30px;
  border-radius: 7px;
  padding: 0 6px;
  font-size: 12px;
}

.pet-level-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.pet-level-row strong {
  color: var(--accent);
}

.pet-xp-track {
  height: 7px;
  border-radius: 999px;
  background: var(--surface-soft);
  overflow: hidden;
}

.pet-xp-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #14b8a6, #84cc16);
  transition: width 260ms ease;
}

.pet-mood {
  min-height: 28px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.pet-talk-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px 42px;
  gap: 6px;
  padding: 0 8px;
}

.pet-talk-row input {
  height: 32px;
  border-radius: 8px;
  font-size: 12px;
}

.floating-pet {
  position: fixed;
  right: 22px;
  top: 74px;
  bottom: auto;
  z-index: 120;
  display: grid;
  grid-template-columns: auto minmax(180px, 260px);
  gap: 8px;
  align-items: end;
  pointer-events: none;
}

.floating-pet.dragging {
  cursor: grabbing;
}

.floating-pet-identity {
  display: grid;
  justify-items: center;
  gap: 6px;
  pointer-events: auto;
}

.floating-pet-level {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.1);
}

.floating-pet-panel {
  display: grid;
  gap: 8px;
  pointer-events: auto;
}

.floating-pet-avatar {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--accent-soft);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.18);
  line-height: 1;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
}

.floating-pet.dragging .floating-pet-avatar {
  cursor: grabbing;
}

.floating-pet-bubble {
  border: 1px solid var(--line);
  border-radius: 12px 12px 12px 4px;
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.14);
  padding: 10px 12px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  pointer-events: auto;
}

.floating-pet-talk-row {
  padding: 0;
}

.floating-pet-talk-row input {
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.pet-voice-button {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 9px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.12);
}

.pet-voice-button .voice-icon-svg {
  width: 21px;
  height: 21px;
}

.pet-visibility-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pet-visibility-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.pet-settings-card .pet-visibility-toggle span {
  display: inline;
  margin-bottom: 0;
}

.pet-settings-card {
  grid-template-columns: 72px minmax(0, 1fr);
  padding: 2px 0 8px;
}

.pet-settings-card .pet-avatar-button {
  width: 72px;
  height: 72px;
}

.pet-settings-card label {
  margin-bottom: 8px;
}

.pet-settings-card label span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.pet-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 8px;
}

.pet-upload-row span {
  color: var(--muted);
  font-size: 12px;
}

.floating-pet.pet-jump .floating-pet-avatar {
  animation: petJump 760ms ease both;
}

@keyframes petJump {
  0% {
    transform: translateY(22px) scale(0.86);
    opacity: 0;
  }
  38% {
    transform: translateY(-14px) scale(1.06);
    opacity: 1;
  }
  62% {
    transform: translateY(4px) scale(0.98);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes petIdle {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg) scale(1);
  }

  35% {
    transform: translateY(-5px) rotate(3deg) scale(1.06);
  }

  62% {
    transform: translateY(1px) rotate(-1deg) scale(0.98);
  }
}

@keyframes petMediaFloat {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-4px) scale(1.04);
  }
}

.skill-list {
  display: grid;
  gap: 5px;
  max-height: 190px;
  overflow-y: auto;
}

.skill-panel-note {
  margin: 0 8px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  padding: 7px 9px;
}

.skill-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}

.skill-item:hover,
.skill-item.active {
  background: var(--hover);
}

.skill-item input {
  width: auto;
  height: auto;
  margin-top: 4px;
}

.skill-item span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.skill-item strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skill-item small {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  align-items: center;
}

.prompt-button {
  min-width: 0;
  min-height: 34px;
  background: transparent;
  color: var(--ink);
  overflow: hidden;
  padding: 0 10px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-form {
  display: grid;
  gap: 8px;
  padding: 0 8px;
}

.prompt-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

.prompt-manager-modal {
  max-height: min(680px, calc(100vh - 48px));
  overflow: hidden;
}

.prompt-manager-list {
  display: grid;
  gap: 8px;
  max-height: 480px;
  overflow-y: auto;
}

.prompt-manager-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.skill-manager-list {
  display: grid;
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
}

.skill-manager-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(0, 1.6fr) auto auto;
  gap: 8px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.skill-manager-row input[type="checkbox"] {
  width: auto;
  height: auto;
  margin-top: 10px;
}

.skill-manager-row textarea {
  min-height: 76px;
  border: 1px solid var(--line);
  padding: 8px 10px;
  resize: vertical;
}

.settings-modal.speaking-practice-modal {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(1180px, calc(100vw - 40px));
  height: min(820px, calc(100vh - 40px));
  overflow: hidden;
}

.tool-tutorial-modal {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  width: min(1180px, calc(100vw - 40px));
  height: min(820px, calc(100vh - 40px));
  overflow: hidden;
}

.tool-course-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.45fr);
  gap: 14px;
  align-items: center;
  min-width: 0;
  padding: 2px 2px 10px;
}

.tool-course-progress-copy {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  min-width: 0;
  font-size: 12px;
}

.tool-course-progress-copy strong {
  color: var(--accent);
}

.tool-course-progress-copy span {
  color: var(--muted);
}

.tool-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 7px;
  background: var(--surface-soft);
}

.tool-progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

.tool-tutorial-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.tool-lesson-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 10px;
}

.tool-lesson-button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 3px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 9px;
  text-align: left;
}

.tool-lesson-index {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.tool-lesson-button.active .tool-lesson-index {
  background: var(--accent);
  color: #fff;
}

.tool-lesson-button.completed:not(.active) .tool-lesson-index {
  background: #d7f2df;
  color: #18723a;
}

.tool-lesson-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.tool-lesson-button:hover,
.tool-lesson-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.tool-lesson-button strong,
.tool-lesson-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.tool-tutorial-main {
  display: grid;
  grid-template-columns: minmax(230px, 0.82fr) minmax(320px, 1.18fr);
  gap: 12px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.tool-tutorial-main.reading-mode {
  grid-template-columns: minmax(0, 920px);
  justify-content: center;
}

.tool-tutorial-main.math-animation-mode {
  grid-template-columns: minmax(0, 1020px);
}

.tool-lesson-panel,
.tool-code-panel {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 12px;
}

.tool-lesson-panel h3 {
  margin: 0;
  font-size: 18px;
}

.tool-lesson-panel.reading-mode {
  padding: clamp(16px, 2.4vw, 28px);
}

.tool-lesson-panel.math-animation-mode {
  gap: 8px;
  padding: clamp(10px, 1.4vw, 16px);
}

.tool-lesson-content {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.75;
}

.tool-lesson-content h3 {
  margin: 20px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 15px;
}

.tool-lesson-content h3:first-child {
  margin-top: 0;
}

.tool-lesson-content p,
.tool-lesson-content ul,
.tool-lesson-content ol {
  margin: 8px 0;
}

.tool-lesson-content li + li {
  margin-top: 5px;
}

.tool-lesson-content code {
  overflow-wrap: anywhere;
}

.tool-lesson-content .code-block {
  margin: 10px 0;
}

.tool-lesson-checklist {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.tool-lesson-checklist > strong {
  font-size: 13px;
}

.tool-lesson-checklist label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  color: var(--muted);
  font-size: 13px;
}

.tool-lesson-checklist input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 2px 0 0;
}

.tool-lesson-navigation {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.tool-lesson-navigation button {
  min-width: 0;
}

.tool-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.tool-live-metrics {
  flex: 1;
  overflow: hidden;
  color: var(--accent);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-code-actions,
.tool-office-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.tool-code-panel textarea {
  width: 100%;
  min-height: 210px;
  resize: vertical;
  border-radius: 10px;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 13px;
  line-height: 1.55;
}

.tool-output {
  min-height: 96px;
  max-height: 180px;
  overflow: auto;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--ink);
  padding: 10px;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.tool-typing-diff {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  max-height: 116px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 9px;
  font-family: Consolas, "Cascadia Code", monospace;
}

.typing-char {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  min-height: 24px;
  border-radius: 4px;
  padding: 1px 3px;
  white-space: pre;
}

.typing-char.correct {
  background: #d7f2df;
  color: #18723a;
}

.typing-char.wrong {
  background: #fee2e2;
  color: #b42318;
}

.typing-char.missing {
  border: 1px dashed #d09b31;
  color: #8a5a00;
}

.tool-tutorial-modal.code-focus #toolLevelTabs,
.tool-tutorial-modal.code-focus .tool-course-progress,
.tool-tutorial-modal.code-focus .tool-lesson-list,
.tool-tutorial-modal.code-focus .tool-lesson-panel {
  display: none;
}

.tool-tutorial-modal.code-focus {
  grid-template-rows: auto minmax(0, 1fr);
}

.tool-tutorial-modal.code-focus .tool-tutorial-layout,
.tool-tutorial-modal.code-focus .tool-tutorial-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

.tool-tutorial-modal.code-focus .tool-code-panel textarea {
  min-height: 300px;
}

.tool-tutorial-modal:fullscreen {
  width: 100vw;
  height: 100vh;
  border: 0;
  border-radius: 0;
}

.tool-preview-frame {
  width: 100%;
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.speaking-practice-header {
  padding-bottom: 10px;
}

.speaking-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  width: min(480px, 100%);
  min-height: 38px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 4px;
}

.speaking-mode-tab {
  min-width: 0;
  min-height: 30px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.speaking-mode-tab.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(20, 35, 65, 0.1);
}

.speaking-tab-shell,
.speaking-tab-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.speaking-tab-panel:not(.active) {
  display: none;
}

.speaking-practice-layout {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  gap: 12px;
  min-height: 0;
  height: 100%;
}

.speaking-practice-side,
.speaking-study-nav {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.speaking-practice-side {
  display: grid;
  grid-template-rows: auto auto auto auto;
  align-content: start;
  gap: 12px;
  overflow-y: auto;
  padding: 14px;
}

.speaking-field-grid {
  display: grid;
  gap: 10px;
}

.speaking-field-grid label {
  display: grid;
  gap: 5px;
}

.speaking-field-grid label > span,
.speaking-section-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.speaking-session-guide {
  display: grid;
  gap: 7px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.speaking-session-guide strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
}

.speaking-phrase-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.speaking-phrase-chip {
  min-height: 28px;
  max-width: 100%;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  overflow: hidden;
  padding: 4px 8px;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.speaking-practice-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.speaking-practice-actions button {
  flex: 1;
}

.speaking-status {
  min-height: 48px;
  margin: 0;
  line-height: 1.55;
  white-space: normal;
}

.speaking-practice-main {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.speaking-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  scrollbar-gutter: stable;
}

.speaking-empty-state {
  display: grid;
  place-items: center;
  min-height: 240px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
  padding: 24px;
}

.speaking-bubble {
  width: fit-content;
  max-width: min(660px, 92%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 11px 13px;
  box-shadow: 0 6px 18px rgba(20, 35, 65, 0.05);
}

.speaking-bubble.user {
  align-self: flex-end;
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line));
  background: var(--accent-soft);
}

.speaking-bubble.assistant {
  align-self: flex-start;
  border-left: 3px solid var(--trig-sin);
}

.speaking-bubble-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.speaking-bubble-content {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.7;
}

.speaking-bubble-content p,
.speaking-bubble-content ul,
.speaking-bubble-content ol {
  margin-top: 0;
  margin-bottom: 8px;
}

.speaking-play-button,
.speaking-audio-button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--accent);
  font-weight: 800;
}

.speaking-play-button {
  min-width: 30px;
  min-height: 28px;
  font-size: 13px;
}

.speaking-audio-button {
  min-height: 34px;
  padding: 0 11px;
  white-space: nowrap;
}

.speaking-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px auto;
  gap: 8px;
  align-items: end;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 10px;
}

.speaking-input-row textarea {
  min-height: 52px;
  max-height: 120px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  resize: vertical;
}

.speaking-study-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.speaking-study-nav {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 12px;
  overflow: hidden;
  padding: 14px;
}

.speaking-study-nav h3,
.speaking-study-content h3,
.speaking-study-content h4 {
  margin: 3px 0 0;
  color: var(--ink);
}

.phonetic-group-tabs,
.speaking-course-level-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 3px;
}

.phonetic-group-tabs button,
.speaking-course-level-tabs button {
  min-width: 0;
  min-height: 28px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  padding: 0 4px;
  font-size: 11px;
  font-weight: 700;
}

.phonetic-group-tabs button.active,
.speaking-course-level-tabs button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.phonetic-lesson-list,
.speaking-course-list {
  display: grid;
  align-content: start;
  gap: 6px;
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.phonetic-lesson-button,
.speaking-course-lesson-button {
  display: grid;
  min-width: 0;
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 7px 8px;
}

.phonetic-lesson-button {
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.phonetic-lesson-button:hover,
.speaking-course-lesson-button:hover {
  background: var(--hover);
}

.phonetic-lesson-button.active,
.speaking-course-lesson-button.active {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  background: var(--surface);
}

.phonetic-list-symbol {
  color: var(--trig-cos);
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 19px;
  font-weight: 700;
  text-align: center;
}

.phonetic-lesson-button span:last-child,
.speaking-course-lesson-button span {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.speaking-course-lesson-button small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.speaking-study-content {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.phonetic-detail {
  display: grid;
  align-content: start;
  overflow-y: auto;
  padding: 20px;
}

.phonetic-focus-header,
.speaking-course-header {
  display: grid;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
}

.phonetic-focus-header {
  grid-template-columns: 86px minmax(0, 1fr) auto;
}

.phonetic-symbol {
  display: grid;
  width: 86px;
  height: 72px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--trig-cos) 30%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--trig-cos) 8%, var(--surface));
  color: var(--trig-cos);
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 30px;
  font-weight: 700;
}

.phonetic-focus-header p,
.speaking-course-header p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.speaking-content-badge {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  border-radius: 5px;
  background: color-mix(in srgb, var(--trig-sin) 12%, var(--surface));
  color: var(--trig-sin);
  padding: 0 7px;
  font-size: 10px;
  font-weight: 800;
}

.phonetic-tip-band,
.phonetic-contrast-row,
.speaking-course-task {
  display: grid;
  gap: 5px;
  border-left: 3px solid var(--trig-tan);
  background: color-mix(in srgb, var(--trig-tan) 7%, var(--surface));
  padding: 11px 13px;
}

.phonetic-tip-band {
  margin-top: 16px;
}

.phonetic-tip-band p,
.phonetic-contrast-row p {
  margin: 0;
  color: var(--ink);
  line-height: 1.6;
}

.speaking-content-section {
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.speaking-content-heading,
.phonetic-practice-section,
.speaking-course-progress-head,
.speaking-course-task,
.speaking-course-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.phonetic-example-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.phonetic-example-button {
  display: grid;
  min-width: 0;
  min-height: 74px;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px;
  text-align: left;
}

.phonetic-example-button strong {
  font-size: 15px;
}

.phonetic-example-button span {
  color: var(--trig-cos);
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 12px;
}

.phonetic-example-button small,
.phonetic-practice-section small {
  color: var(--muted);
  font-size: 11px;
}

.phonetic-contrast-row {
  margin-top: 16px;
}

.phonetic-practice-section {
  border-bottom: 0;
  padding-bottom: 0;
}

.phonetic-practice-section p {
  margin: 5px 0 2px;
  font-size: 17px;
  font-weight: 700;
}

.speaking-course-layout {
  grid-template-columns: 280px minmax(0, 1fr);
}

.speaking-course-nav {
  grid-template-rows: auto auto auto minmax(0, 1fr);
}

.speaking-course-progress-head h3 {
  margin-top: 2px;
}

.speaking-course-progress-head strong {
  color: var(--accent);
  font-size: 12px;
}

.speaking-course-progress-track {
  height: 6px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}

.speaking-course-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--trig-sin);
  transition: width 180ms ease;
}

.speaking-course-lesson-button {
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
}

.speaking-course-order {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.speaking-course-lesson-button.completed .speaking-course-order {
  background: color-mix(in srgb, var(--trig-sin) 16%, var(--surface));
  color: var(--trig-sin);
}

.speaking-course-content {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  padding: 18px 20px 12px;
}

.speaking-course-header {
  grid-template-columns: minmax(0, 1fr) auto;
}

.speaking-course-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.speaking-course-scroll {
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding-right: 5px;
}

.speaking-goal-list {
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding-left: 20px;
  line-height: 1.55;
}

.speaking-word-list,
.speaking-pattern-list,
.speaking-dialogue-list {
  display: grid;
  gap: 7px;
  margin-top: 9px;
}

.speaking-word-row,
.speaking-pattern-row,
.speaking-dialogue-row {
  display: grid;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  padding: 6px 0 8px;
}

.speaking-word-row {
  grid-template-columns: minmax(90px, 0.7fr) minmax(120px, 0.9fr) minmax(80px, 1fr) 30px;
}

.speaking-pattern-row {
  grid-template-columns: minmax(0, 1fr) minmax(120px, 0.75fr) 30px;
}

.speaking-dialogue-row {
  grid-template-columns: 26px minmax(0, 1fr) minmax(110px, 0.8fr) 30px;
}

.speaking-word-row span,
.speaking-pattern-row span,
.speaking-dialogue-row span {
  min-width: 0;
  line-height: 1.45;
}

.speaking-ipa {
  color: var(--trig-cos);
  font-family: "Cambria Math", "Times New Roman", serif;
  font-size: 12px;
}

.speaking-translation {
  color: var(--muted);
  font-size: 12px;
}

.speaking-row-play {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--accent);
  font-size: 11px;
}

.speaking-dialogue-speaker {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.speaking-course-task {
  margin: 16px 0 4px;
}

.speaking-course-task strong {
  display: block;
  margin-top: 4px;
  line-height: 1.5;
}

.speaking-course-footer {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.speaking-course-footer button {
  min-width: 96px;
}

.danger-button {
  color: var(--danger);
}

.empty-manager-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.ghost-button.tiny,
.primary-button.tiny {
  min-height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.task-list {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
  max-height: 280px;
  overflow-y: auto;
}

.task-item {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.task-item-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  align-items: stretch;
  gap: 2px;
  border-radius: 6px;
}

.task-item-shell.active {
  background: var(--hover);
}

.task-item-shell .task-item {
  min-width: 0;
}

.task-rename-button {
  display: grid;
  width: 30px;
  min-width: 30px;
  min-height: 42px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.task-rename-button:hover,
.task-rename-button:focus-visible {
  background: var(--accent-soft);
  color: var(--accent);
}

.fold-tasks-button {
  min-height: 32px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  padding: 0 10px;
  font-size: 12px;
  font-weight: 650;
}

.fold-tasks-button:hover {
  background: var(--hover);
  color: var(--ink);
}

.task-item.active {
  background: var(--hover);
}

.task-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.task-meta {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.workspace {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  min-width: 0;
  min-height: 0;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.workspace.camera-collapsed {
  --conversation-width: 1240px;
  grid-template-columns: minmax(0, 1fr) 78px;
}

.chat-column,
.camera-column {
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: 100vh;
  overflow: hidden;
}

.chat-column {
  display: grid;
  grid-template-rows: minmax(62px, auto) minmax(0, 1fr) minmax(112px, auto);
  background: var(--surface);
}

.topbar,
.camera-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 62px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.topbar-title {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.learning-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.android-camera-launch-button {
  display: none;
}

.learning-toolbar > label,
.learning-mode-control {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.learning-mode-control label {
  color: inherit;
  font: inherit;
}

.learning-toolbar select {
  width: auto;
  min-width: 76px;
  height: 30px;
  border-radius: 7px;
  padding: 0 8px;
  color: var(--ink);
  font-size: 12px;
}

.learning-mode-control,
.parent-toggle {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0 8px;
}

.learning-mode-control input,
.parent-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  box-shadow: none;
}

.learning-mode-control:has(input:not(:checked)) select {
  opacity: 0.48;
}

.topbar h2,
.camera-header h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 650;
}

.topbar-actions,
.camera-controls,
.composer-actions,
.modal-actions,
.preview-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-actions,
.camera-controls {
  flex-shrink: 0;
}

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

input,
select {
  height: 36px;
  padding: 0 10px;
}

select {
  min-width: 152px;
}

textarea {
  min-height: 54px;
  max-height: 180px;
  resize: none;
  padding: 10px 2px;
  border: 0;
  line-height: 1.5;
}

input:focus,
select:focus {
  border-color: var(--focus-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea:focus {
  box-shadow: none;
}

.generation-optional-textarea {
  width: 100%;
  min-height: 96px;
  max-height: 240px;
  border: 1px solid var(--line-strong, var(--line));
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--ink);
  padding: 10px 11px;
  resize: vertical;
}

.generation-optional-textarea:hover {
  border-color: color-mix(in srgb, var(--line-strong, var(--line)) 72%, var(--accent));
}

.generation-optional-textarea:focus {
  border-color: var(--focus-line);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.primary-button,
.send-button {
  min-height: 36px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
}

.primary-button:hover,
.send-button:hover {
  background: color-mix(in srgb, var(--accent) 86%, black);
}

.primary-button.compact {
  min-width: 74px;
  padding: 0 12px;
}

.ghost-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.ghost-button.active,
.primary-button.active {
  background: var(--accent);
  color: var(--accent-ink);
}

.icon-button {
  display: grid;
  flex: 0 0 34px;
  place-items: center;
  width: 34px;
  height: 34px;
  background: transparent;
  color: var(--muted);
  font-size: 19px;
  line-height: 1;
}

.icon-button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.voice-button {
  color: #0068c9;
}

.voice-button:hover,
.voice-button.active {
  background: #eaf4ff;
  color: #005eb8;
}

.voice-icon-svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 0 30px;
  scrollbar-gutter: stable;
}

.message {
  width: min(100%, var(--conversation-width));
  margin: 0 auto;
  padding: 18px 24px;
}

.message.user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
}

.message.assistant {
  display: block;
}

.message.system {
  color: var(--muted);
  text-align: center;
}

.processing-message {
  color: var(--muted);
}

.processing-content {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border-radius: 18px;
  background: var(--surface-soft);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 650;
}

.processing-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  animation: processingPulse 1s ease-in-out infinite;
}

@keyframes processingPulse {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.86);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

.message-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.message.user .message-head {
  display: none;
}

.message-role {
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.message-footer {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

.user-message-footer {
  justify-content: flex-end;
  margin-top: 4px;
}

.message-action-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  padding: 0 8px;
  font-size: 13px;
}

.message-action-button:hover {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--ink);
}

.message-action-button:disabled {
  cursor: default;
  opacity: 0.62;
}

.import-learning-tool-button {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  color: var(--ink);
}

.assistant-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.quick-action-button {
  min-height: 28px;
  border-color: var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 0 9px;
  font-size: 12px;
}

.assistant-learning-extras {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.learning-extra-block {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.learning-extra-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.learning-extra-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.learning-extra-question {
  min-height: 30px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.55;
  overflow-wrap: anywhere;
  text-align: left;
}

.learning-extra-question .math {
  font-size: 1em;
}

.learning-extra-question:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.action-icon {
  color: var(--accent);
  font-size: 17px;
  line-height: 1;
}

.message-time {
  color: var(--muted);
}

.generated-file-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  max-width: 720px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px;
}

.generated-file-type {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
}

.generated-file-main {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 2px;
  color: var(--ink);
  text-align: left;
}

.generated-file-main:hover strong {
  color: var(--accent);
}

.generated-file-main strong,
.generated-file-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generated-file-main strong {
  font-size: 14px;
}

.generated-file-main span {
  color: var(--muted);
  font-size: 11px;
}

.generated-file-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.generated-file-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 9px;
  font-size: 12px;
}

.generated-file-action:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.agent-command-card .agent-command-body {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 12px;
}

.agent-command-card.danger .agent-command-body {
  border-color: #fca5a5;
  background: #fff7f7;
}

.agent-command-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.agent-command-reason {
  color: var(--ink);
  font-size: 14px;
}

.agent-command-body pre {
  overflow-x: auto;
  margin: 0;
  border-radius: 8px;
  background: #111827;
  color: #e5e7eb;
  padding: 10px;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 12px;
  line-height: 1.5;
}

.agent-command-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.mini-button {
  min-height: 28px;
  padding: 0 8px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
}

.speak-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--accent);
}

.speaker-mark {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 900;
  line-height: 1;
}

.message-content {
  max-width: 100%;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.78;
  letter-spacing: 0;
  overflow-wrap: break-word;
}

.message.user .message-content {
  max-width: min(640px, 88%);
  border-radius: 18px;
  background: var(--surface-soft);
  padding: 11px 15px;
  white-space: pre-wrap;
}

.message-upload-summary {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  width: min(640px, 88%);
  min-width: 0;
  margin-top: 7px;
  border-left: 2px solid var(--accent);
  padding-left: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.message-upload-label {
  flex: 0 0 auto;
  font-weight: 700;
}

.message-upload-files {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  min-width: 0;
}

.message-upload-file {
  max-width: 100%;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.message-upload-file + .message-upload-file::before {
  margin-right: 12px;
  color: var(--muted);
  content: "·";
}

.message.assistant .message-content {
  white-space: normal;
}

.message-content p {
  margin: 0 0 14px;
}

.message-content p:last-child {
  margin-bottom: 0;
}

.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5 {
  margin: 22px 0 9px;
  color: var(--ink);
  line-height: 1.42;
  letter-spacing: 0;
}

.message-content > :first-child {
  margin-top: 0;
}

.message-content h2 {
  font-size: 20px;
}

.message-content h3 {
  font-size: 17px;
}

.message-content h4,
.message-content h5 {
  font-size: 15.5px;
}

.message-content ul,
.message-content ol {
  margin: 0 0 14px;
  padding-left: 1.55em;
}

.message-content li {
  margin: 5px 0;
  padding-left: 0.12em;
}

.message-content li::marker {
  color: var(--accent);
  font-weight: 700;
}

.message-content blockquote {
  margin: 12px 0 16px;
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: var(--surface-soft);
  padding: 10px 13px;
  color: var(--muted);
}

.message-content blockquote > :last-child {
  margin-bottom: 0;
}

.message-content hr {
  height: 1px;
  margin: 20px 0;
  border: 0;
  background: var(--line);
}

.message-content a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.message-content strong {
  color: var(--ink);
}

.message-content code {
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
  padding: 1px 5px;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 0.92em;
}

.markdown-media {
  display: grid;
  gap: 8px;
  margin: 12px 0 16px;
  max-width: 560px;
}

.markdown-media img,
.markdown-media video {
  width: 100%;
  max-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: var(--surface-soft);
}

.markdown-media audio {
  width: 100%;
}

.markdown-media figcaption {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.media-placeholder {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.media-placeholder div {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.math {
  font-family:
    Cambria Math,
    "Times New Roman",
    "Microsoft YaHei",
    serif;
  font-size: 1.06em;
  font-variant-numeric: lining-nums tabular-nums;
}

.math math {
  font-family:
    Cambria Math,
    "STIX Two Math",
    "Times New Roman",
    serif;
  font-size: 1.02em;
}

.math .katex,
.math .katex-display {
  color: inherit;
}

.math .katex {
  font-size: 1em;
}

.math .katex-display {
  margin: 0;
}

.math-inline {
  display: inline;
  vertical-align: baseline;
}

.math-display {
  display: block;
  box-sizing: border-box;
  width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  margin: 16px 0 18px;
  border-block: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 13px 16px;
  color: var(--ink);
  line-height: 1.65;
  scrollbar-width: thin;
  text-align: center;
  white-space: nowrap;
}

.math sub,
.math sup {
  position: static;
  font-size: 0.72em;
  line-height: 0;
}

.math sub {
  vertical-align: sub;
}

.math sup {
  vertical-align: super;
}

.math-display .math-aligned {
  white-space: normal;
}

.math-frac {
  display: inline-grid;
  grid-template-rows: auto auto;
  align-items: center;
  margin: 0 0.2em;
  vertical-align: middle;
  text-align: center;
  line-height: 1.08;
}

.math-frac > span:first-child {
  min-width: 1.6em;
  padding: 0 0.24em 0.14em;
  border-bottom: 1px solid currentColor;
}

.math-frac > span:last-child {
  padding: 0.14em 0.24em 0;
}

.math-binom {
  display: inline-grid;
  grid-template-rows: auto auto;
  position: relative;
  margin: 0 0.48em;
  line-height: 1;
  vertical-align: middle;
}

.math-binom::before,
.math-binom::after {
  position: absolute;
  top: 50%;
  font-size: 1.8em;
  line-height: 1;
  transform: translateY(-52%);
}

.math-binom::before {
  right: 100%;
  content: "(";
}

.math-binom::after {
  left: 100%;
  content: ")";
}

.math-binom > span {
  text-align: center;
}

.math-overline {
  display: inline-block;
  padding-top: 0.04em;
  text-decoration: overline;
}

.math-root {
  display: inline-flex;
  align-items: stretch;
  gap: 0.06em;
}

.math-root > span {
  border-top: 1px solid currentColor;
  padding: 0 0.1em;
}

.math-boxed {
  display: inline-block;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  padding: 0.02em 0.28em;
  line-height: 1.35;
}

.math-text {
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
}

.math-roman {
  font-style: normal;
}

.math-aligned {
  display: inline-grid;
  grid-auto-rows: auto;
  gap: 0.18em;
  max-width: 100%;
  text-align: left;
}

.math-aligned-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 0.32em;
  align-items: baseline;
}

.math-display .math-aligned-row {
  justify-content: start;
}

.math-matrix {
  display: inline-flex;
  align-items: center;
  gap: 0.12em;
  vertical-align: middle;
}

.math-matrix-bracket {
  font-size: 2.9em;
  font-weight: 300;
  line-height: 0.85;
}

.math-matrix-body {
  display: grid;
  gap: 0.06em;
}

.math-matrix-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(1.2em, auto);
  gap: 0.55em;
  justify-content: center;
  text-align: center;
}

.math-cases {
  display: inline-flex;
  align-items: center;
  gap: 0.16em;
  vertical-align: middle;
}

.math-case-brace {
  font-size: 2.8em;
  line-height: 0.9;
}

.math-case-rows {
  display: grid;
  gap: 0.16em;
  text-align: left;
}

.math-case-row {
  display: grid;
  grid-template-columns: auto auto;
  gap: 0.7em;
  align-items: baseline;
}

.code-block {
  overflow: hidden;
  margin: 14px 0 18px;
  border: 1px solid #d4d9e0;
  border-radius: 8px;
  background: #f4f5f7;
}

.code-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 0 10px;
  border-bottom: 1px solid #d4d9e0;
  background: #e9ecef;
  color: #59636f;
  font-size: 12px;
}

.code-toolbar span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-toolbar-actions {
  display: flex;
  flex-shrink: 0;
  gap: 6px;
  align-items: center;
}

.copy-code-button,
.toggle-code-button {
  min-height: 26px;
  border-radius: 6px;
  background: transparent;
  color: #495462;
  padding: 0 8px;
}

.copy-code-button:hover,
.toggle-code-button:hover {
  background: #dce1e6;
}

.code-block pre {
  margin: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding: 15px 16px;
  scrollbar-width: thin;
}

.code-block code {
  border: 0;
  background: transparent;
  color: #252d38;
  padding: 0;
  font-size: 13px;
  line-height: 1.62;
}

.collapsed-code-block {
  position: relative;
}

.collapsed-code-block pre {
  max-height: 260px;
  overflow: hidden;
}

.collapsed-code-block:not(.expanded-code-block)::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 72px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(244, 245, 247, 0), #f4f5f7 82%);
}

.collapsed-code-block.expanded-code-block pre {
  max-height: 560px;
  overflow: auto;
}

.table-wrap {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  margin: 14px 0 18px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  scrollbar-width: thin;
}

.message-content table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.6;
}

.message-content th,
.message-content td {
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 9px 11px;
  text-align: left;
  vertical-align: top;
}

.message-content tr > :last-child {
  border-right: 0;
}

.message-content tbody tr:last-child td {
  border-bottom: 0;
}

.message-content th {
  background: var(--surface-soft);
  font-weight: 700;
}

.message-content tbody tr:nth-child(even) {
  background: var(--panel);
}

.message img {
  display: block;
  max-width: 260px;
  max-height: 190px;
  margin: 10px 0 0 auto;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.message video,
.message audio {
  display: block;
  width: min(100%, 520px);
  margin-top: 10px;
}

.message video {
  max-height: 320px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #111827;
}

.message.assistant img {
  margin-right: auto;
  margin-left: 0;
}

.message.user img {
  margin-right: 0;
  margin-left: auto;
}

.message .markdown-media img,
.message .markdown-media video {
  width: 100%;
  max-width: 100%;
  max-height: 360px;
  margin: 0;
}

.message .markdown-media audio {
  width: 100%;
  margin: 0;
}

.study-viz-card {
  display: grid;
  gap: 12px;
  width: min(var(--study-viz-width, 50%), 100%);
  min-width: min(420px, 100%);
  max-width: 100%;
  margin: 14px auto 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 14px;
}

.study-viz-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.study-viz-header-copy {
  display: grid;
  flex: 1 1 auto;
  gap: 4px;
  min-width: 0;
}

.study-viz-size-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
}

.study-viz-size-actions .icon-button {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
}

.study-viz-header h3,
.study-viz-header p {
  margin: 0;
}

.study-viz-header h3 {
  color: var(--ink);
  font-size: 16px;
  font-weight: 650;
}

.study-viz-header p {
  color: var(--muted);
  font-size: 12px;
}

.study-viz-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.study-viz-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.study-viz-controls label {
  display: grid;
  flex: 1 1 240px;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.study-viz-controls input {
  width: 100%;
  accent-color: var(--accent);
}

.study-viz-controls strong {
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.study-viz-card svg {
  display: block;
  width: 100%;
  height: auto;
}

.study-viz-axis {
  stroke: var(--line);
  stroke-width: 1.4;
}

.study-viz-grid {
  stroke: color-mix(in srgb, var(--line) 68%, transparent);
  stroke-width: 1;
}

.study-viz-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.study-viz-dot {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 2;
}

.study-viz-dot.secondary {
  fill: var(--trig-cos);
}

.study-viz-bar {
  fill: var(--accent);
  opacity: 0.82;
}

.study-viz-tick {
  fill: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.study-viz-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 16px;
  color: var(--muted);
  font-size: 12px;
}

.study-viz-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.study-viz-legend i {
  display: inline-block;
  width: 18px;
  height: 3px;
  border-radius: 2px;
}

.study-viz-error {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--danger);
  padding: 10px 12px;
  font-size: 13px;
}

.interactive-html-card {
  display: grid;
  gap: 10px;
  max-width: 100%;
  margin: 14px 0 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px;
}

.interactive-html-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.interactive-html-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.interactive-html-card:fullscreen,
.interactive-html-card.fullscreen-fallback {
  position: relative;
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  padding: 0;
  resize: none;
  overflow: hidden;
}

.interactive-html-card.fullscreen-fallback {
  position: fixed;
  inset: 0;
  z-index: 142;
}

.interactive-html-card:fullscreen .interactive-html-frame,
.interactive-html-card.fullscreen-fallback .interactive-html-frame {
  width: 100%;
  height: 100% !important;
  max-height: none;
  border: 0;
  border-radius: 0;
}

.interactive-html-card:fullscreen .interactive-html-toolbar,
.interactive-html-card.fullscreen-fallback .interactive-html-toolbar {
  position: absolute;
  z-index: 2147483646;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: calc(14px + env(safe-area-inset-right, 0px));
  display: block;
}

.interactive-html-card:fullscreen .interactive-html-toolbar > span,
.interactive-html-card.fullscreen-fallback .interactive-html-toolbar > span,
.interactive-html-card:fullscreen .interactive-html-actions > :not(.interactive-html-fullscreen-button),
.interactive-html-card.fullscreen-fallback .interactive-html-actions > :not(.interactive-html-fullscreen-button) {
  display: none;
}

.interactive-html-card:fullscreen .interactive-html-fullscreen-button,
.interactive-html-card.fullscreen-fallback .interactive-html-fullscreen-button {
  position: fixed;
  z-index: 2147483647;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: calc(14px + env(safe-area-inset-right, 0px));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 124px;
  height: 48px;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid rgba(15, 103, 68, 0.28);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.97);
  color: #0f6744;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.24);
  backdrop-filter: blur(10px);
}

.interactive-html-card:fullscreen .interactive-html-fullscreen-button:hover,
.interactive-html-card:fullscreen .interactive-html-fullscreen-button:focus-visible,
.interactive-html-card.fullscreen-fallback .interactive-html-fullscreen-button:hover,
.interactive-html-card.fullscreen-fallback .interactive-html-fullscreen-button:focus-visible {
  border-color: #0f6744;
  background: #ffffff;
  color: #0b5136;
  box-shadow: 0 10px 32px rgba(15, 103, 68, 0.3);
}

.interactive-html-frame {
  display: block;
  width: 100%;
  min-height: 180px;
  max-height: min(78vh, 960px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}


.android-top-menu {
  display: none;
}

@media (max-width: 700px) {
  .study-viz-card {
    width: 100%;
    min-width: 0;
  }

  .interactive-html-card {
    padding: 8px;
  }

  .interactive-html-frame {
    min-height: 180px;
    max-height: 72vh;
  }
}

/* v0.3.0 UI polish: unified desktop visual layer */
:root {
  --bg: #eef3f7;
  --sidebar: #f8fafc;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-soft: #eef6f4;
  --panel: #f9fbfd;
  --input-bg: #ffffff;
  --hover: #edf4f8;
  --ink: #162033;
  --muted: #667385;
  --line: #d8e2ea;
  --line-strong: #c7d4df;
  --accent: #176da8;
  --accent-ink: #ffffff;
  --accent-soft: #e6f2fb;
  --accent-2: #0f8f78;
  --accent-2-soft: #e4f6f1;
  --accent-warm: #d88a16;
  --focus-line: #72add5;
  --brand-bg: #e4f6f1;
  --danger: #b42318;
  --shadow: 0 18px 44px rgba(22, 32, 51, 0.13);
  --soft-shadow: 0 10px 28px rgba(22, 32, 51, 0.08);
  --composer-shadow: 0 12px 32px rgba(22, 32, 51, 0.10);
}

:root[data-theme="night"] {
  --bg: #111827;
  --sidebar: #172033;
  --surface: #1d2738;
  --surface-elevated: #222e42;
  --surface-soft: #263349;
  --panel: #182236;
  --input-bg: #111827;
  --hover: #263449;
  --ink: #f4f7fb;
  --muted: #aeb9c8;
  --line: #344158;
  --line-strong: #46546b;
  --accent: #58b7ec;
  --accent-soft: #17324a;
  --accent-2: #6ee7d1;
  --accent-2-soft: #123b35;
  --accent-warm: #f8b84e;
  --focus-line: #75c7f6;
  --brand-bg: #123b35;
  --shadow: 0 22px 54px rgba(0, 0, 0, 0.38);
  --soft-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  --composer-shadow: 0 16px 38px rgba(0, 0, 0, 0.30);
}

body {
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  text-rendering: geometricPrecision;
}

.app-shell {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0) 220px),
    var(--bg);
}

:root[data-theme="night"] .app-shell {
  background: var(--bg);
}

.sidebar {
  gap: 14px;
  padding: 16px 14px;
  border-right-color: color-mix(in srgb, var(--line) 82%, transparent);
  background: color-mix(in srgb, var(--sidebar) 94%, var(--surface));
}

.brand {
  gap: 12px;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
  box-shadow: var(--soft-shadow);
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 18%, var(--line));
  background: var(--brand-bg);
}

.brand h1 {
  color: var(--ink);
  font-size: 18px;
  font-weight: 850;
}

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

.model-balance-button {
  max-width: 98px;
  border-radius: 999px;
  border-color: color-mix(in srgb, var(--accent) 20%, var(--line));
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 750;
}

.sidebar-support-actions {
  margin: 2px 0 0;
  gap: 8px;
}

.sidebar-support-button {
  min-height: 58px;
  border-radius: 8px;
  border-color: var(--line);
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease;
}

.sidebar-support-button:hover,
.sidebar-support-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: var(--soft-shadow);
}

.new-task-button {
  min-height: 44px;
  border-radius: 8px;
  border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
  background: var(--accent);
  color: #ffffff;
  box-shadow: var(--soft-shadow);
}

.new-task-button:hover {
  background: color-mix(in srgb, var(--accent) 88%, #000000);
}

.primary-study-actions {
  gap: 8px;
  margin: 0 0 4px;
}

.study-entry-button {
  min-height: 42px;
  border-radius: 8px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 9px 11px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset;
}

.study-entry-button:first-child {
  border-color: color-mix(in srgb, var(--accent-2) 30%, var(--line));
  background: var(--accent-2-soft);
}

.study-entry-button:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  background: var(--hover);
}

.study-entry-button strong {
  background: var(--accent-2);
  color: #ffffff;
}

.prompt-panel,
.skill-panel,
.study-panel,
.task-panel {
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 92%, var(--panel));
  padding: 12px 10px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset;
}

.prompt-panel-header,
.sidebar-section-title,
.sidebar-toggle-title {
  padding-inline: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
}

.prompt-button,
.task-item,
.fold-tasks-button,
.task-search-input {
  border-radius: 8px;
}

.task-item.active,
.prompt-button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.sidebar-toggle-button {
  top: 14px;
  border-radius: 8px;
  border-color: color-mix(in srgb, var(--line) 80%, transparent);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(14px);
}

.app-shell:not(.sidebar-collapsed) .sidebar-toggle-button {
  left: 236px;
}

.chat-column {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 78%, transparent), transparent 230px),
    var(--panel);
}

.topbar,
.camera-header {
  min-height: 76px;
  border-bottom-color: color-mix(in srgb, var(--line) 76%, transparent);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px);
}

.topbar h2,
.camera-header h2 {
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.topbar p,
.camera-header p {
  color: var(--muted);
}

.learning-toolbar {
  gap: 8px;
}

.learning-mode-control,
.parent-toggle {
  min-height: 32px;
  border-radius: 999px;
  border-color: color-mix(in srgb, var(--line) 88%, transparent);
  background: var(--surface);
  padding-inline: 10px;
}

.learning-toolbar select {
  height: 28px;
  min-width: 72px;
  border: 0;
  background: transparent;
  padding-inline: 4px;
}

.icon-button,
.small-icon-button,
.small-text-button,
.message-action-button,
.generated-file-action,
.mini-button,
.ghost-button,
.primary-button,
.send-button {
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.icon-button {
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--line);
  background: var(--surface);
  color: var(--accent);
  box-shadow: var(--soft-shadow);
}

.primary-button,
.send-button {
  border-radius: 8px;
  background: var(--accent);
  box-shadow: var(--soft-shadow);
}

.primary-button:hover,
.send-button:hover {
  background: color-mix(in srgb, var(--accent) 88%, #000000);
}

.messages {
  gap: 4px;
  padding: 28px 0 34px;
}

.message {
  padding: 12px 24px;
}

.message-head {
  margin-bottom: 7px;
  padding-left: 2px;
}

.message-role {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.message.assistant .message-content {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px 18px;
  box-shadow: var(--soft-shadow);
}

.message.user .message-content {
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  padding: 12px 15px;
  box-shadow: var(--soft-shadow);
}

.message.system .message-content {
  display: inline-block;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  padding: 8px 13px;
}

.message-content {
  line-height: 1.75;
}

.message-content h2,
.message-content h3,
.message-content h4,
.message-content h5 {
  color: var(--ink);
}

.message-content blockquote {
  border-left-color: var(--accent-2);
  background: var(--accent-2-soft);
  color: color-mix(in srgb, var(--ink) 76%, var(--muted));
}

.message-content code {
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface));
  color: var(--accent);
}

.message-content table,
.generated-file-card,
.interactive-html-card,
.study-viz-card,
.agent-command-card .agent-command-body {
  border-radius: 8px;
}

.message-footer,
.assistant-learning-extras {
  border-color: color-mix(in srgb, var(--line) 82%, transparent);
}

.composer {
  padding: 12px 24px 20px;
  background: linear-gradient(180deg, transparent, var(--panel) 24%);
}

.composer-input-row {
  border-radius: 8px;
  border-color: color-mix(in srgb, var(--line-strong) 86%, transparent);
  background: var(--surface);
  padding: 12px 13px;
  box-shadow: var(--composer-shadow);
}

.composer-input-row:focus-within {
  border-color: var(--focus-line);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-soft) 82%, transparent), var(--composer-shadow);
}

textarea {
  color: var(--ink);
}

.composer-tool-group .icon-button,
.composer-actions .ghost-button {
  background: color-mix(in srgb, var(--surface) 86%, var(--panel));
}

.send-button {
  min-width: 96px;
  height: 38px;
}

.voice-button {
  color: var(--accent-2);
}

.voice-button:hover,
.voice-button.active {
  background: var(--accent-2-soft);
  color: var(--accent-2);
}

.camera-column {
  border-left-color: color-mix(in srgb, var(--line) 82%, transparent);
  background: color-mix(in srgb, var(--sidebar) 78%, var(--panel));
}

.camera-column:not(.collapsed) {
  box-shadow: -14px 0 38px rgba(22, 32, 51, 0.06);
}

.camera-toggle-button {
  border-radius: 8px;
  border-color: var(--line);
  background: var(--surface);
}

.video-stage,
.capture-preview,
.preview-box {
  border-radius: 8px;
}

.video-stage {
  border-color: color-mix(in srgb, var(--line) 78%, transparent);
  box-shadow: var(--soft-shadow);
}

.empty-camera-state {
  background: var(--surface);
}

.empty-camera-icon {
  border-radius: 8px;
  border-color: color-mix(in srgb, var(--accent) 16%, var(--line));
  background: var(--accent-soft);
}

.camera-privacy-indicator.active {
  color: var(--accent-2);
}

.camera-privacy-indicator.active::before {
  background: var(--accent-2);
}

.floating-pet {
  filter: drop-shadow(0 18px 28px rgba(22, 32, 51, 0.18));
}

.floating-pet-avatar,
.pet-avatar-button {
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 20%, var(--line));
  background: var(--accent-2-soft);
  box-shadow: var(--soft-shadow);
}

.floating-pet-level,
.floating-pet-bubble,
.floating-pet-panel {
  border-color: var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--soft-shadow);
}

.pet-xp-track {
  background: color-mix(in srgb, var(--line) 45%, var(--surface-soft));
}

.pet-xp-track span {
  background: linear-gradient(90deg, var(--accent-2), var(--accent-warm));
}

.modal-backdrop,
.license-backdrop {
  background: rgba(22, 32, 51, 0.34);
  backdrop-filter: blur(14px);
}

.settings-modal,
.license-card,
.legal-consent-card {
  border-radius: 8px;
  border-color: color-mix(in srgb, var(--line) 86%, transparent);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-header {
  border-bottom: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  margin-bottom: 16px;
  padding-bottom: 14px;
}

.modal-header h2 {
  color: var(--ink);
  font-weight: 850;
}

.license-brand img,
.machine-code-box,
.license-form input,
.context-menu,
.selection-followup-bar {
  border-radius: 8px;
}

.machine-code-box {
  background: var(--panel);
}

input,
select,
textarea {
  border-color: var(--line);
}

input:focus,
select:focus,
.license-form input:focus {
  border-color: var(--focus-line);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-soft) 82%, transparent);
}

::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 8px;
  background: color-mix(in srgb, var(--muted) 42%, transparent);
  background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--muted) 62%, transparent);
  background-clip: padding-box;
}

@media (max-width: 1180px) {
  .app-shell:not(.sidebar-collapsed) .sidebar-toggle-button {
    left: 216px;
  }

  .composer {
    padding-inline: 16px;
  }

  .message {
    padding-inline: 16px;
  }
}

@media (max-width: 700px) {
  .topbar {
    padding-left: 72px;
  }

  .learning-mode-control,
  .parent-toggle {
    border-radius: 8px;
  }

  .message.assistant .message-content,
  .message.user .message-content {
    max-width: 100%;
  }
}

.study-viz-step-stage {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.study-viz-step-counter {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.study-viz-step-text {
  min-height: 48px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.7;
}

.study-viz-step-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-soft);
  overflow: hidden;
}

.study-viz-step-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

.trig-demo {
  display: grid;
  gap: 10px;
  max-width: 100%;
}

.trig-demo-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.trig-demo-stat {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px 10px;
}

.trig-demo-stat span {
  color: var(--muted);
  font-size: 12px;
}

.trig-demo-stat strong {
  color: var(--ink);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.trig-demo-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.trig-demo-controls label {
  display: grid;
  flex: 1 1 260px;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.trig-demo-controls input {
  width: 100%;
  accent-color: var(--accent);
}

.trig-demo svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(430px, 46vh);
}

.trig-axis,
.trig-grid-line {
  stroke: var(--line);
  stroke-width: 1;
}

.trig-circle {
  fill: var(--surface-soft);
  stroke: var(--line);
  stroke-width: 1.5;
}

.trig-radius {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
}

.trig-sin-line,
.trig-cos-line,
.trig-tan-line {
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.trig-sin-line,
.trig-sin-proj {
  stroke: var(--trig-sin);
}

.trig-cos-line,
.trig-cos-proj {
  stroke: var(--trig-cos);
}

.trig-tan-line,
.trig-tan-proj {
  stroke: var(--trig-tan);
}

.trig-sin-proj,
.trig-cos-proj,
.trig-tan-proj,
.trig-dash {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 5 5;
}

.trig-dash {
  stroke: var(--muted);
}

.trig-dot {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 2;
}

.trig-sin-dot {
  fill: var(--trig-sin);
}

.trig-cos-dot {
  fill: var(--trig-cos);
}

.trig-tan-dot {
  fill: var(--trig-tan);
}

.trig-label,
.trig-tick,
.trig-formula {
  fill: var(--ink);
  font-size: 14px;
  font-weight: 400;
}

.trig-tick {
  fill: var(--muted);
}

.trig-demo-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 12px;
}

.trig-demo-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.trig-swatch {
  display: inline-block;
  width: 18px;
  height: 4px;
  border-radius: 999px;
  background: var(--accent);
}

.trig-swatch.sin {
  background: var(--trig-sin);
}

.trig-swatch.cos {
  background: var(--trig-cos);
}

.trig-swatch.tan {
  background: var(--trig-tan);
}

.math-animation-stage {
  margin: 0 0 10px;
}

.math-animation-stage .study-viz-card {
  gap: 8px;
  margin: 0;
  border: 0;
  background: var(--surface-soft);
  padding: clamp(8px, 1.2vw, 12px);
}

.math-animation-stage .study-viz-header {
  display: none;
}

.math-animation-stage .study-viz-header h3 {
  font-size: 15px;
}

.math-animation-stage .study-viz-header p {
  font-size: 11px;
  line-height: 1.35;
}

.math-animation-stage .study-viz-card svg {
  width: 100%;
  max-height: min(200px, 25vh);
  border-radius: 8px;
  background: var(--surface);
}

.math-animation-stage .study-viz-controls {
  min-height: 42px;
  gap: 7px;
  border-radius: 8px;
  background: var(--surface);
  padding: 7px 9px;
}

.math-animation-stage .study-viz-controls label {
  gap: 3px;
  font-size: 11px;
}

.math-animation-stage .trig-demo {
  gap: 6px;
}

.math-animation-stage .trig-demo-metrics {
  gap: 6px;
}

.math-animation-stage .trig-demo-stat {
  gap: 1px;
  padding: 5px 7px;
}

.math-animation-stage .trig-demo-stat span {
  font-size: 10px;
}

.math-animation-stage .trig-demo-stat strong {
  font-size: 14px;
}

.math-animation-stage .trig-demo-controls {
  gap: 6px;
}

.math-animation-stage .trig-demo-controls label {
  gap: 3px;
  font-size: 11px;
}

.math-animation-stage .trig-demo svg {
  max-height: min(200px, 25vh);
}

.math-animation-stage .trig-demo-legend {
  gap: 4px 10px;
  font-size: 10px;
}

.math-dual-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.math-dual-controls > strong {
  grid-column: 1 / -1;
}

.math-animation-fill,
.math-animation-empty,
.math-animation-grid,
.math-area-square {
  stroke: var(--surface);
  stroke-width: 2;
}

.math-animation-fill {
  fill: var(--accent);
}

.math-animation-empty {
  fill: color-mix(in srgb, var(--accent) 10%, var(--surface));
  stroke: color-mix(in srgb, var(--accent) 35%, var(--surface));
}

.math-animation-grid {
  fill: color-mix(in srgb, var(--accent) 72%, #ffffff);
}

.math-animation-grid.secondary {
  fill: color-mix(in srgb, var(--trig-cos) 52%, #ffffff);
}

.math-animation-block-label,
.math-clock-number,
.math-probability-label {
  fill: #ffffff;
  font-size: 13px;
  font-weight: 750;
}

.math-animation-caption {
  fill: var(--ink);
  font-size: 14px;
  font-weight: 650;
}

.math-clock-face {
  fill: color-mix(in srgb, var(--accent) 5%, var(--surface));
  stroke: color-mix(in srgb, var(--accent) 38%, var(--line));
  stroke-width: 3;
}

.math-clock-tick {
  stroke: var(--muted);
  stroke-width: 1.2;
}

.math-clock-tick.major {
  stroke: var(--ink);
  stroke-width: 2.6;
}

.math-clock-number {
  fill: var(--ink);
  font-size: 14px;
}

.math-clock-hand {
  stroke-linecap: round;
}

.math-clock-hand.hour {
  stroke: var(--ink);
  stroke-width: 8;
}

.math-clock-hand.minute {
  stroke: var(--accent);
  stroke-width: 5;
}

.math-clock-pin {
  fill: var(--accent);
  stroke: var(--surface);
  stroke-width: 3;
}

.math-triangle {
  fill: color-mix(in srgb, var(--accent) 18%, var(--surface));
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linejoin: round;
}

.math-right-angle {
  fill: none;
  stroke: var(--ink);
  stroke-width: 2;
}

.math-area-square.first {
  fill: #4a93c7;
}

.math-area-square.second {
  fill: #49a56f;
}

.math-area-square.sum {
  fill: #e97954;
}

.math-tangent-line {
  fill: none;
  stroke: var(--trig-tan);
  stroke-width: 2.6;
  stroke-linecap: round;
}

.math-conic-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.math-conic-focus {
  fill: var(--trig-tan);
  stroke: var(--surface);
  stroke-width: 2;
}

.math-probability-bar {
  fill: color-mix(in srgb, var(--accent) 68%, #ffffff);
}

.math-probability-bar.active {
  fill: var(--trig-tan);
}

.math-probability-label {
  fill: var(--ink);
  font-size: 11px;
}

@media (hover: none), (pointer: coarse) {
  .learning-tool-card-actions {
    position: static;
    grid-template-columns: repeat(4, 24px);
    width: max-content;
    margin: 4px 0 0 auto;
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
}

.composer {
  display: grid;
  align-self: end;
  gap: 0;
  width: min(100%, var(--conversation-width));
  margin: 0 auto;
  padding: 4px 22px 12px;
  background: var(--surface);
  position: relative;
  z-index: 5;
}

.attachment-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 0;
}

.attachment-strip:empty {
  display: none;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 260px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 7px 9px;
  color: var(--ink);
  font-size: 13px;
}

.attachment-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-chip img {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  object-fit: cover;
}

.media-chip-marker {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.remove-chip-button {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: transparent;
  color: var(--danger);
}

.composer-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  padding: 8px 10px;
  box-shadow: var(--composer-shadow);
}

.composer-input-row:focus-within {
  border-color: var(--focus-line);
}

.composer-text-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 8px;
  align-items: start;
  min-width: 0;
}

#promptInput {
  min-height: 48px;
  max-height: 120px;
  padding: 4px 2px;
}

.composer-actions {
  justify-content: space-between;
  gap: 6px;
  border-top: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  padding: 6px 0 0;
}

.composer-tool-group {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
  gap: 6px;
}

.composer-actions .ghost-button.compact {
  min-height: 30px;
  padding-inline: 10px;
}

.composer-actions .status-text {
  flex: 1 1 180px;
  min-width: 120px;
}

.send-button {
  min-width: 86px;
  min-height: 32px;
  height: 32px;
  padding: 0 16px;
}

.camera-column {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  contain: layout paint;
  border-left: 1px solid var(--line);
  background: var(--panel);
}

.camera-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.camera-title {
  min-width: 0;
}

.camera-privacy-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.camera-privacy-indicator::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #98a2b3;
  content: "";
}

.camera-privacy-indicator.active {
  color: #18723a;
}

.camera-privacy-indicator.active::before {
  background: #20a05a;
  box-shadow: 0 0 0 3px rgba(32, 160, 90, 0.16);
}

.camera-toggle-button {
  display: inline-flex;
  flex: 0 0 auto;
  width: auto;
  min-width: 62px;
  height: 34px;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0 8px;
  font-size: 20px;
  font-weight: 700;
}

.camera-toggle-text {
  display: inline-flex;
  align-items: center;
  gap: 0;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.15;
  white-space: nowrap;
}

.camera-column.collapsed .camera-toggle-button {
  min-width: 64px;
  height: auto;
  min-height: 58px;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
}

.camera-column.collapsed .camera-toggle-text {
  flex-direction: column;
}

.camera-column.collapsed .camera-toggle-text span {
  white-space: nowrap;
}

.camera-controls {
  grid-column: 1 / -1;
  flex-wrap: wrap;
  width: 100%;
}

.camera-controls select {
  flex: 1 1 100%;
}

.camera-column.collapsed {
  grid-template-rows: 1fr;
}

.camera-column.collapsed .camera-header {
  grid-template-columns: 1fr;
  align-content: start;
  justify-items: center;
  height: 100%;
  padding: 12px 6px;
}

.camera-column.collapsed .camera-title,
.camera-column.collapsed .camera-controls,
.camera-column.collapsed .video-stage,
.camera-column.collapsed .capture-preview {
  display: none;
}

.video-stage {
  position: relative;
  min-height: 0;
  height: auto;
  margin: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #111827;
  cursor: zoom-in;
  user-select: none;
  touch-action: none;
}

.video-stage.zoomed {
  cursor: grab;
}

.video-stage.panning {
  cursor: grabbing;
}

.video-stage.selecting {
  cursor: crosshair;
}

#cameraVideo,
.usb-camera-frame {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: 0 0;
  will-change: transform;
}

.usb-camera-frame {
  display: block;
}

.usb-camera-frame.hidden {
  display: none;
}

.selection-overlay {
  position: absolute;
  border: 2px solid #10b981;
  background: rgba(16, 185, 129, 0.14);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.36);
  pointer-events: none;
}

.empty-camera-state {
  position: absolute;
  inset: 0;
  display: grid;
  gap: 10px;
  place-items: center;
  align-content: center;
  border: 0;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
}

.empty-camera-state:hover {
  background: var(--panel);
  color: var(--ink);
}

.empty-camera-icon {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 34px;
  box-shadow: var(--composer-shadow);
}

.empty-camera-state strong {
  color: var(--ink);
  font-size: 16px;
}

.empty-camera-state span:last-child {
  font-size: 12px;
}

.zoom-badge {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 2;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.82);
  color: white;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
}

.capture-preview {
  padding: 0 12px 12px;
}

.preview-header {
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.capture-preview-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.capture-preview .preview-header {
  flex-wrap: wrap;
}

.capture-preview-actions button {
  flex: 0 0 auto;
}

.text-button {
  min-height: 30px;
  background: transparent;
  color: var(--danger);
  padding: 0 8px;
}

.preview-box {
  display: grid;
  place-items: center;
  min-height: 128px;
  max-height: 210px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  overflow: hidden;
}

.preview-box img {
  width: 100%;
  height: 100%;
  max-height: 210px;
  object-fit: contain;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.28);
}

.settings-modal {
  width: min(520px, calc(100vw - 40px));
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 20px;
  box-shadow: var(--shadow);
}

.settings-modal.general-settings-modal {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(720px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  overflow: hidden;
}

.settings-section-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 16px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.settings-section-tabs button {
  min-height: 38px;
  flex: 1;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.settings-section-tabs button:hover {
  background: color-mix(in srgb, var(--accent-soft) 62%, transparent);
  color: var(--ink);
}

.settings-section-tabs button.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--ink) 10%, transparent);
}

.settings-section-tabs button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus-line) 44%, transparent);
  outline-offset: 1px;
}

.settings-panels,
.settings-panel {
  min-width: 0;
  min-height: 0;
}

.settings-panels {
  overflow-y: auto;
  padding: 2px 3px 3px 1px;
  scrollbar-gutter: stable;
}

.settings-panel.hidden {
  display: none;
}

.settings-panel-actions {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.activation-status-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent-soft) 44%, var(--surface));
  padding: 14px;
}

.activation-status-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 22px;
  font-weight: 900;
}

.activation-status-card strong,
.activation-status-card p {
  display: block;
  margin: 0;
}

.activation-status-card strong {
  margin-top: 4px;
  color: var(--ink);
  font-size: 16px;
}

.activation-status-card p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.activation-status-badge {
  display: inline-flex;
  width: max-content;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 850;
}

.activation-status-card[data-state="trial"] .activation-status-icon {
  background: var(--accent-warm);
}

.activation-status-card[data-state="expired"],
.activation-status-card[data-state="locked"],
.activation-status-card[data-state="error"] {
  border-color: color-mix(in srgb, var(--danger) 34%, var(--line));
  background: color-mix(in srgb, var(--danger) 7%, var(--surface));
}

.activation-status-card[data-state="expired"] .activation-status-icon,
.activation-status-card[data-state="locked"] .activation-status-icon,
.activation-status-card[data-state="error"] .activation-status-icon {
  background: var(--danger);
}

.activation-machine-code-box {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  margin-bottom: 14px;
}

.activation-machine-code-box > span {
  grid-column: 1 / -1;
}

.activation-machine-code-box > code {
  min-width: 0;
}

.activation-settings-form {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 14px;
}

.activation-settings-form label,
.activation-settings-form .segmented-code-scroll {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

.settings-modal .segmented-code-scroll {
  display: block;
  margin: 0;
}

.settings-modal .segmented-code {
  display: inline-flex;
  gap: 2px;
  margin: 0;
  color: inherit;
  font-size: inherit;
}

.settings-modal .segmented-code .segmented-code-dash {
  display: inline;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.settings-modal .segmented-code .segmented-code-group {
  display: inline-flex;
  gap: 2px;
  margin: 0;
}

.settings-modal .license-form .segmented-code-char {
  width: 24px;
  min-width: 24px;
}

.app-prompt-backdrop {
  z-index: 240;
}

.app-prompt-modal {
  display: grid;
  gap: 14px;
  width: min(460px, calc(100vw - 32px));
  border-radius: 8px;
}

.app-prompt-modal .modal-header,
.app-prompt-modal label {
  margin: 0;
}

.app-prompt-actions {
  justify-content: flex-end;
}

.app-prompt-status {
  color: var(--danger);
}

.settings-modal.model-settings-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1120px, calc(100vw - 32px));
  height: min(820px, calc(100vh - 32px));
  overflow: hidden;
  padding: 18px;
}

.model-settings-layout {
  display: grid;
  grid-template-columns: minmax(340px, 0.9fr) minmax(430px, 1.1fr);
  min-height: 0;
  border-top: 1px solid var(--line);
}

.model-settings-form,
.model-setup-guide {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.model-settings-form {
  padding: 18px 20px 18px 2px;
}

.model-settings-form label {
  display: block;
  margin-bottom: 14px;
}

.model-settings-form label > span {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 750;
}

.model-settings-form code,
.model-setup-guide code,
.guide-scroll-document code {
  overflow-wrap: anywhere;
  color: var(--accent);
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 0.94em;
}

.model-setup-step {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 14px;
}

.model-setup-step > span,
.guide-eyebrow,
.guide-document-heading > span {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 800;
}

.model-setup-step strong {
  font-size: 14px;
}

.model-test-step {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.model-settings-actions,
.guide-button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.model-settings-status {
  min-height: 38px;
  margin-top: 10px;
  color: var(--muted);
  white-space: pre-line;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.model-setup-guide {
  border-left: 1px solid var(--line);
  padding: 18px 6px 24px 24px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.72;
}

.guide-document-heading {
  padding-bottom: 18px;
}

.guide-document-heading h3 {
  margin: 10px 0 6px;
  font-size: 20px;
  line-height: 1.35;
}

.guide-document-heading p,
.model-setup-guide section p,
.model-setup-guide section ul {
  margin: 0 0 10px;
}

.model-setup-guide > section {
  border-top: 1px solid var(--line);
  padding: 16px 0;
}

.model-setup-guide h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.model-setup-guide ul {
  padding-left: 20px;
}

.guide-definition-list,
.guide-config-example,
.guide-faq-list {
  display: grid;
  gap: 0;
  margin: 0;
}

.guide-definition-list > div,
.guide-config-example > div,
.guide-faq-list > div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 10px 0;
}

.guide-definition-list > div:first-child,
.guide-config-example > div:first-child,
.guide-faq-list > div:first-child {
  border-top: 0;
}

.guide-definition-list dt,
.guide-config-example dt,
.guide-faq-list dt {
  color: var(--ink);
  font-weight: 800;
}

.guide-definition-list dd,
.guide-config-example dd,
.guide-faq-list dd {
  min-width: 0;
  margin: 0;
  color: var(--muted);
}

.guide-steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-steps li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
}

.guide-steps li > span {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--surface);
  font-size: 12px;
  font-weight: 800;
}

.guide-steps p {
  color: var(--muted);
}

.guide-note,
.guide-warning {
  border-left: 3px solid var(--accent);
  background: var(--surface-soft);
  padding: 10px 12px;
  color: var(--muted);
  line-height: 1.65;
}

.guide-warning {
  border-left-color: var(--danger);
}

.settings-modal.help-guide-modal {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: min(1120px, calc(100vw - 32px));
  height: min(840px, calc(100vh - 32px));
  overflow: hidden;
  padding: 18px;
}

.guide-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

.guide-tab {
  min-height: 34px;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 750;
}

.guide-tab:hover {
  background: var(--hover);
  color: var(--ink);
}

.guide-tab.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

.help-guide-content,
.help-guide-panel {
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.help-guide-panel {
  display: grid;
  grid-template-columns: 174px minmax(0, 1fr);
}

.guide-section-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  padding: 14px 12px 14px 0;
}

.guide-section-nav button {
  min-height: 36px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  text-align: left;
}

.guide-section-nav button:hover,
.guide-section-nav button:focus-visible {
  background: var(--accent-soft);
  color: var(--accent);
}

.guide-scroll-document {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 20px 30px 26px;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

.guide-document-section {
  max-width: 760px;
  margin: 0 auto;
  border-top: 1px solid var(--line);
  padding: 24px 0;
  scroll-margin-top: 8px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.76;
}

.guide-document-section:first-child {
  border-top: 0;
}

.guide-document-section h3 {
  margin: 10px 0 8px;
  font-size: 21px;
  line-height: 1.35;
}

.guide-document-section h4 {
  margin: 18px 0 7px;
  font-size: 14px;
}

.guide-document-section p,
.guide-document-section ol,
.guide-document-section ul,
.guide-document-section dl {
  margin-top: 0;
  margin-bottom: 12px;
}

.guide-document-section ol,
.guide-document-section ul {
  padding-left: 22px;
}

.guide-document-section li {
  margin: 5px 0;
}

.guide-official-button {
  min-height: 36px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: white;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 750;
}

.guide-official-button.secondary {
  background: transparent;
  color: var(--accent);
}

.guide-official-button:not(:disabled):hover {
  filter: brightness(0.94);
}

.settings-modal.tool-tutorial-modal {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  width: calc(100vw - 24px);
  height: calc(100vh - 24px);
  max-width: none;
  max-height: none;
  padding: 16px;
  overflow: hidden;
}

.settings-modal.tool-tutorial-modal .modal-header {
  min-width: 0;
}

.settings-modal.tool-tutorial-modal .modal-header > div {
  min-width: 0;
}

.settings-modal.tool-tutorial-modal .modal-header h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-modal.tool-tutorial-modal .modal-header p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.4;
}

.modal-header-actions {
  display: flex;
  gap: 7px;
  align-items: center;
  flex: 0 0 auto;
}

.tool-designer-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1120px, calc(100vw - 32px));
  height: min(820px, calc(100vh - 32px));
  overflow: hidden;
}

.tool-designer-form {
  display: grid;
  align-content: start;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.tool-designer-basics {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 110px minmax(160px, 0.8fr);
  gap: 10px;
}

.tool-designer-basics label,
.tool-designer-prompt,
.tool-designer-levels label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tool-designer-summary {
  grid-column: 1 / -1;
}

.tool-designer-basics input,
.tool-designer-basics select,
.tool-designer-form textarea {
  width: 100%;
  min-width: 0;
  border-radius: 8px;
  color: var(--ink);
}

.tool-designer-form textarea {
  resize: vertical;
  font: 13px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Microsoft YaHei", sans-serif;
}

.tool-designer-levels {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.tool-designer-levels fieldset {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.tool-designer-levels legend {
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  padding: 0 6px;
}

.tool-designer-levels textarea[data-custom-field="code"] {
  font-family: Consolas, "Cascadia Code", monospace;
}

.tool-designer-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 8px;
  position: sticky;
  bottom: 0;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding-top: 12px;
}

.settings-legal-row {
  margin-bottom: 12px;
}

.legal-modal-backdrop {
  z-index: 180;
}

.legal-center-modal {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: min(900px, calc(100vw - 40px));
  height: min(760px, calc(100vh - 40px));
  overflow: hidden;
}

.legal-center-header {
  margin-bottom: 10px;
}

.legal-tabs {
  display: flex;
  gap: 4px;
  min-width: 0;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

.legal-tab {
  flex: 0 0 auto;
  min-height: 34px;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
}

.legal-tab:hover {
  background: var(--hover);
  color: var(--ink);
}

.legal-tab.active {
  border-bottom-color: var(--accent);
  color: var(--accent);
}

.legal-content {
  min-height: 0;
  overflow-y: auto;
  padding: 16px 10px 18px 2px;
  scrollbar-gutter: stable;
}

.legal-panel {
  max-width: 780px;
  margin: 0 auto;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.75;
}

.legal-panel h3,
.legal-panel h4,
.legal-panel p,
.legal-panel ul {
  margin-top: 0;
}

.legal-panel h3 {
  margin-bottom: 8px;
  font-size: 20px;
}

.legal-panel h4 {
  margin: 18px 0 6px;
  font-size: 14px;
}

.legal-panel p,
.legal-panel ul {
  margin-bottom: 10px;
}

.legal-panel ul {
  padding-left: 22px;
}

.legal-panel li {
  margin: 4px 0;
}

.legal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
}

.legal-consent-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px);
}

.legal-consent-card {
  display: grid;
  gap: 14px;
  width: min(620px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 22px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.2);
}

.legal-consent-card h2,
.legal-consent-card p {
  margin: 0;
}

.consent-intro {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.consent-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.consent-links button {
  min-width: 0;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--accent);
  padding: 5px 7px;
  font-size: 12px;
}

.consent-links button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.consent-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.consent-field select {
  width: 100%;
}

.legal-check-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.55;
}

.legal-check-row input {
  width: auto;
  height: auto;
  margin-top: 3px;
}

.consent-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.license-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--bg) 76%, transparent);
  backdrop-filter: blur(8px);
}

.license-card {
  display: grid;
  gap: 16px;
  width: min(720px, calc(100vw - 36px));
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 20px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.18);
}

.license-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.license-brand img {
  width: 46px;
  height: 46px;
  border-radius: 12px;
}

.license-brand h2,
.license-brand p {
  margin: 0;
}

.license-brand h2 {
  font-size: 19px;
  line-height: 1.25;
}

.license-brand p {
  color: var(--muted);
  font-size: 13px;
}

.machine-code-box {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  padding: 12px;
}

.machine-code-box span,
.license-form label span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.machine-code-box code {
  overflow-wrap: anywhere;
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--accent);
  padding: 10px;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 15px;
  font-weight: 800;
}

.license-form {
  display: grid;
  gap: 12px;
}

.license-form label {
  display: grid;
  gap: 6px;
}

.segmented-code-scroll {
  display: block;
  width: 100%;
  overflow-x: auto;
  padding: 4px 1px 8px;
  scrollbar-width: thin;
}

.segmented-code {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: max-content;
  font-family: Consolas, "Cascadia Code", monospace;
}

.segmented-code-prefix {
  display: inline-grid;
  place-items: center;
  height: 40px;
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
}

.segmented-code-dash {
  color: var(--muted);
  font-size: 18px;
  font-weight: 800;
}

.segmented-code-group {
  display: inline-flex;
  gap: 3px;
}

.license-form .segmented-code-char {
  width: 25px;
  min-width: 25px;
  height: 40px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--input-bg);
  padding: 0;
  font-family: Consolas, "Cascadia Code", monospace;
  font-size: 17px;
  font-weight: 800;
  line-height: 40px;
  text-align: center;
  text-transform: uppercase;
  caret-color: var(--accent);
}

.license-form .segmented-code-char:focus {
  border-color: var(--focus-line);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-soft) 82%, transparent);
  outline: none;
}

.license-form .segmented-code-char:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.ghost-button.compact {
  justify-self: start;
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.settings-modal label {
  display: block;
  margin-bottom: 12px;
}

.settings-modal label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

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

.modal-actions {
  justify-content: space-between;
}

.microcopy {
  min-height: 18px;
  margin: 0;
}

#settingsStatus {
  flex: 1;
  min-width: 0;
  white-space: pre-line;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

.context-menu {
  position: fixed;
  z-index: 30;
  width: 168px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 6px;
  box-shadow: var(--shadow);
}

.context-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  padding: 0 10px;
}

.context-menu button .context-menu-icon {
  width: 24px;
  flex: 0 0 24px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 800;
  text-align: center;
}

.context-menu button .context-menu-label {
  min-width: 0;
  color: inherit;
  font-size: 13px;
}

.selection-followup-bar {
  position: fixed;
  z-index: 160;
  display: flex;
  gap: 6px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 5px;
  box-shadow: var(--shadow);
}

.selection-followup-bar button {
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 0 11px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.selection-followup-bar button + button {
  background: var(--surface-soft);
  color: var(--ink);
}

@media (max-width: 1380px) {
  .tool-tutorial-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .tool-tutorial-main {
    grid-template-columns: minmax(240px, 0.85fr) minmax(320px, 1.15fr);
  }

  .tool-lesson-list {
    grid-auto-flow: column;
    grid-auto-columns: minmax(150px, 1fr);
    overflow-x: auto;
    overflow-y: hidden;
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 252px minmax(0, 1fr);
  }

  .settings-modal.learning-tools-modal {
    width: calc(100vw - 24px);
  }

  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(360px, 1fr) minmax(260px, 0.72fr);
  }

  .workspace.camera-collapsed {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) 48px;
  }

  .app-shell:not(.sidebar-collapsed) .sidebar-toggle-button {
    left: 212px;
  }

  .camera-column {
    grid-template-rows: auto minmax(220px, 1fr) auto;
    max-height: none;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .camera-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    min-width: 0;
  }

  .camera-controls select {
    grid-column: 1 / -1;
    min-width: 0;
  }

  .camera-controls button {
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
  }

  .camera-column.collapsed {
    overflow: hidden;
  }

  .video-stage {
    min-height: 220px;
  }

  .camera-column.collapsed .camera-header {
    align-content: center;
    justify-items: end;
    padding: 7px 12px;
  }

  .camera-column.collapsed .camera-toggle-button {
    min-width: 116px;
    min-height: 34px;
    height: 34px;
    flex-direction: row;
  }

  .camera-column.collapsed .camera-toggle-text {
    flex-direction: row;
  }

  .tool-tutorial-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .tool-tutorial-main {
    grid-template-columns: minmax(240px, 0.85fr) minmax(320px, 1.15fr);
  }

  .tool-lesson-list {
    grid-auto-flow: column;
    grid-auto-columns: minmax(150px, 1fr);
    overflow-x: auto;
    overflow-y: hidden;
  }

  .speaking-practice-layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .speaking-practice-side {
    grid-template-columns: 1fr;
  }

  .speaking-study-layout,
  .speaking-course-layout {
    grid-template-columns: 240px minmax(0, 1fr);
  }
}

@media (max-width: 980px) {
  .settings-modal.model-settings-modal,
  .settings-modal.help-guide-modal {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    padding: 14px;
  }

  .model-settings-layout {
    display: block;
    overflow-y: auto;
  }

  .model-settings-form,
  .model-setup-guide {
    overflow: visible;
  }

  .model-settings-form {
    padding: 16px 2px 20px;
  }

  .model-setup-guide {
    border-top: 1px solid var(--line);
    border-left: 0;
    padding: 22px 2px 28px;
  }

  .help-guide-panel {
    grid-template-columns: 150px minmax(0, 1fr);
  }

  .guide-scroll-document {
    padding-inline: 18px 8px;
  }

  .settings-modal.learning-tools-modal {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    max-height: calc(100vh - 16px);
  }

  .video-course-stage-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .video-course-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(130px, auto);
  }

  .video-course-toolbar input {
    grid-column: 1 / -1;
  }

  .video-course-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 34vh;
    overflow: auto;
  }

  .math-animation-stage .study-viz-card svg {
    max-height: min(170px, 22vh);
  }

  .math-animation-stage .trig-demo svg {
    max-height: min(170px, 22vh);
  }

  .messages {
    padding: 18px 0 24px;
  }

  .message {
    padding-inline: 18px;
  }

  .message.user .message-content,
  .message-upload-summary {
    max-width: 94%;
  }

  .message-footer {
    gap: 7px;
  }

  .math-display {
    padding: 12px 13px;
  }

  .tool-course-progress {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .tool-tutorial-main {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    overflow-y: auto;
  }

  .tool-lesson-panel,
  .tool-code-panel {
    overflow: auto;
  }

  .tool-lesson-panel {
    min-height: 360px;
  }

  .tool-code-panel {
    min-height: 420px;
  }

  .tool-code-panel textarea {
    min-height: 180px;
  }

  .tool-designer-levels {
    grid-template-columns: 1fr;
  }

  .speaking-practice-layout,
  .speaking-study-layout,
  .speaking-course-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .speaking-practice-side {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: auto auto;
    align-items: start;
    max-height: 230px;
  }

  .speaking-field-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-column: 1 / -1;
  }

  .speaking-session-guide {
    border-bottom: 0;
    border-top: 0;
    padding: 0;
  }

  .speaking-study-nav {
    grid-template-columns: 180px minmax(220px, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    max-height: 220px;
  }

  .speaking-study-nav > div:first-child,
  .speaking-course-progress-head,
  .speaking-course-progress-track {
    grid-column: 1;
  }

  .phonetic-group-tabs,
  .speaking-course-level-tabs {
    grid-column: 1;
  }

  .phonetic-lesson-list,
  .speaking-course-list {
    grid-column: 2;
    grid-row: 1 / -1;
  }
}

@media (max-width: 700px) {
  .help-guide-panel {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .guide-section-nav {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 8px 0;
  }

  .guide-section-nav button {
    flex: 0 0 auto;
  }

  .guide-definition-list > div,
  .guide-config-example > div,
  .guide-faq-list > div {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .trig-demo-metrics {
    grid-template-columns: 1fr;
  }

  .legal-center-modal {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    padding: 14px;
  }

  .legal-consent-card {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    padding: 16px;
  }

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

  .legal-footer {
    flex-wrap: wrap;
    padding-top: 8px;
  }

  .settings-modal.speaking-practice-modal {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    padding: 14px;
  }

  .tool-tutorial-modal {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    padding: 14px;
  }

  .settings-modal.tool-tutorial-modal {
    grid-template-rows: auto auto auto minmax(0, 1fr);
  }

  .tool-designer-modal {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    padding: 14px;
  }

  .tool-designer-basics {
    grid-template-columns: 1fr;
  }

  .tool-designer-summary {
    grid-column: auto;
  }

  .settings-modal.tool-tutorial-modal .modal-header {
    align-items: flex-start;
  }

  .settings-modal.tool-tutorial-modal .modal-header h2 {
    white-space: normal;
  }

  .tool-lesson-list {
    grid-auto-columns: minmax(170px, 82vw);
    padding: 8px;
  }

  .tool-lesson-panel,
  .tool-code-panel,
  .tool-lesson-panel.reading-mode {
    padding: 12px;
  }

  .tool-lesson-navigation {
    position: sticky;
    bottom: 0;
    background: var(--panel);
  }

  .tool-lesson-navigation button {
    min-width: 0;
    flex: 1;
  }

  .tool-code-header,
  .learning-tool-admin {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .video-course-stage-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .video-course-stage-tab {
    flex: 0 0 auto;
    min-width: 72px;
  }

  .video-course-toolbar,
  .video-course-form {
    grid-template-columns: 1fr;
  }

  .video-course-wide {
    grid-column: auto;
  }

  .video-course-card {
    grid-template-columns: 1fr;
  }

  .video-courses-modal .video-course-list {
    grid-template-columns: 1fr;
  }

  .video-course-card-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .speaking-practice-side {
    grid-template-columns: 1fr;
    max-height: 290px;
  }

  .speaking-field-grid {
    grid-template-columns: 1fr;
  }

  .speaking-mode-tabs {
    width: 100%;
  }

  .speaking-study-nav {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
    max-height: 270px;
  }

  .speaking-study-nav > div:first-child,
  .speaking-course-progress-head,
  .speaking-course-progress-track,
  .phonetic-group-tabs,
  .speaking-course-level-tabs,
  .phonetic-lesson-list,
  .speaking-course-list {
    grid-column: 1;
    grid-row: auto;
  }

  .phonetic-focus-header,
  .speaking-course-header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .phonetic-example-grid {
    grid-template-columns: 1fr;
  }

  .speaking-word-row,
  .speaking-pattern-row,
  .speaking-dialogue-row {
    grid-template-columns: minmax(0, 1fr) 30px;
  }

  .speaking-word-row .speaking-ipa,
  .speaking-word-row .speaking-translation,
  .speaking-pattern-row .speaking-translation,
  .speaking-dialogue-row .speaking-translation {
    grid-column: 1;
  }

  .speaking-course-content,
  .phonetic-detail {
    padding: 14px;
  }

  .speaking-course-footer button {
    min-width: 0;
    flex: 1;
  }
}

/* Final UI polish overrides must stay at file end. */
.app-shell {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0) 220px),
    var(--bg);
}

.sidebar {
  gap: 14px;
  padding: 16px 14px;
  background: color-mix(in srgb, var(--sidebar) 94%, var(--surface));
}

.brand,
.prompt-panel,
.skill-panel,
.study-panel,
.task-panel,
.message.assistant .message-content,
.settings-modal,
.license-card,
.legal-consent-card {
  border-radius: 8px;
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--soft-shadow);
}

.brand {
  min-height: 64px;
  padding: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  flex-basis: 42px;
  border-radius: 8px;
  background: var(--brand-bg);
}

.brand h1 {
  font-size: 18px;
  font-weight: 850;
}

.new-task-button,
.primary-button,
.send-button {
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  box-shadow: var(--soft-shadow);
}

.new-task-button:hover,
.primary-button:hover,
.send-button:hover {
  background: color-mix(in srgb, var(--accent) 88%, #000000);
}

.new-task-button {
  border-color: color-mix(in srgb, var(--accent) 30%, var(--line));
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  color: var(--accent);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

.new-task-button:hover {
  background: color-mix(in srgb, var(--accent) 24%, var(--surface));
  color: var(--accent);
}

.ghost-button.active,
.primary-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.study-entry-button,
.sidebar-support-button,
.composer-input-row,
.camera-toggle-button,
.video-stage,
.capture-preview,
.preview-box,
.icon-button,
.small-icon-button,
.small-text-button,
.task-search-input,
.task-item,
.prompt-button,
.fold-tasks-button {
  border-radius: 8px;
}

.study-entry-button {
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.55) inset;
}

.study-entry-button:first-child {
  border-color: color-mix(in srgb, var(--accent-2) 30%, var(--line));
  background: var(--accent-2-soft);
}

.topbar,
.camera-header {
  min-height: 76px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(16px);
}

.topbar h2,
.camera-header h2 {
  font-size: 18px;
  font-weight: 800;
}

.learning-mode-control,
.parent-toggle {
  border-radius: 999px;
  background: var(--surface);
  padding-inline: 10px;
}

.chat-column {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--panel) 78%, transparent), transparent 230px),
    var(--panel);
}

.messages {
  gap: 4px;
  padding: 28px 0 12px;
}

.message {
  padding: 12px 24px;
}

.message:last-child {
  padding-bottom: 4px;
}

.message.assistant .message-content {
  border: 1px solid var(--line);
  padding: 16px 18px;
}

.message.user .message-content {
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
  box-shadow: var(--soft-shadow);
}

.composer {
  padding: 4px 24px 12px;
  background: linear-gradient(180deg, transparent, var(--panel) 24%);
}

.composer-input-row {
  border-color: var(--line-strong);
  background: var(--surface);
  padding: 8px 10px;
  box-shadow: var(--composer-shadow);
}

.composer-input-row:focus-within {
  border-color: var(--focus-line);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent-soft) 82%, transparent), var(--composer-shadow);
}

.voice-button {
  color: var(--accent-2);
}

.voice-button:hover,
.voice-button.active {
  background: var(--accent-2-soft);
  color: var(--accent-2);
}

.camera-column {
  background: color-mix(in srgb, var(--sidebar) 78%, var(--panel));
}

.empty-camera-icon,
.floating-pet-avatar,
.pet-avatar-button {
  border-radius: 8px;
  background: var(--accent-2-soft);
}

.modal-backdrop,
.license-backdrop {
  background: rgba(22, 32, 51, 0.34);
  backdrop-filter: blur(14px);
}

@media (max-width: 700px) {
  html,
  body,
  .app-shell {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-shell,
  .app-shell.sidebar-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-shell:not(.sidebar-collapsed) {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-shell:not(.sidebar-collapsed) .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 34;
    width: min(286px, calc(100vw - 26px));
    box-shadow: var(--shadow);
  }

  .app-shell:not(.sidebar-collapsed) .sidebar-toggle-button {
    left: min(232px, calc(100vw - 86px));
  }

  .app-shell.sidebar-collapsed .topbar,
  .topbar {
    padding-left: 104px;
  }

  .workspace,
  .chat-column {
    width: 100vw;
    max-width: 100vw;
    min-width: 0;
  }

  .workspace,
  .workspace.camera-collapsed {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
  }

  .workspace.camera-collapsed .camera-column {
    display: none;
  }

  .chat-column {
    grid-template-rows: minmax(92px, auto) minmax(0, 1fr) auto;
  }

  .topbar,
  .messages,
  .message,
  .composer {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .topbar {
    align-items: start;
    gap: 10px;
    padding-right: 12px;
  }

  .topbar-title {
    min-width: 0;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(2, 30px);
    gap: 6px;
  }

  .topbar-actions .icon-button {
    width: 30px;
    min-width: 30px;
    height: 30px;
    min-height: 30px;
  }

  .learning-mode-control,
  .parent-toggle {
    border-radius: 8px;
  }

  .message {
    padding-inline: 16px;
  }

  .message-footer,
  .assistant-quick-actions,
  .learning-extra-actions,
  .composer-actions,
  .composer-tool-group {
    max-width: 100%;
    flex-wrap: wrap;
  }

  .messages {
    padding-bottom: 12px;
    overflow-x: hidden;
  }

  .message-content,
  .message-upload-summary,
  .assistant-learning-extras,
  .generated-file-card {
    max-width: 100%;
    min-width: 0;
  }

  .composer {
    width: 100%;
    max-width: 100vw;
    padding: 4px 16px 10px;
    overflow: hidden;
  }

  .composer-input-row {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100%;
    padding: 7px 9px;
  }

  .composer-text-row {
    grid-template-columns: minmax(0, 1fr) 34px;
  }

  .composer-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 8px;
    padding: 0;
  }

  .composer-tool-group {
    display: flex;
    gap: 6px;
    overflow: visible;
  }

  .composer-tool-group .icon-button,
  .composer-tool-group .ghost-button.compact {
    min-width: 0;
    max-width: 100%;
    padding-inline: 10px;
    white-space: nowrap;
  }

  .composer-tool-group .ghost-button.compact {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #agentModeButton:empty,
  #statusText:empty {
    display: none;
  }

  #statusText {
    flex: 1 0 100%;
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
  }

  .send-button {
    min-width: 86px;
    width: 86px;
    justify-self: end;
  }

  .generated-file-card {
    grid-template-columns: 38px minmax(0, 1fr);
    width: 100%;
  }

  .generated-file-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

/* Exam workspace */
.exam-workspace-modal {
  width: min(1180px, calc(100vw - 28px));
  height: min(860px, calc(100vh - 28px));
  max-height: calc(100vh - 28px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

/* Learning workspaces */
.workspace-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-left: 12px;
}

.workspace-shortcut {
  min-height: 32px;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 5px 10px;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.workspace-shortcut:hover {
  border-color: #2f6f68;
  color: #185c56;
  background: #eef8f5;
}

.workspace-shortcut.prominent {
  border-color: #d8703a;
  background: #fff2e8;
  color: #9b3f1d;
  box-shadow: 0 0 0 2px rgba(216, 112, 58, 0.1);
}

#openExamGenerateButton {
  margin-left: 5px;
  border-color: #6aa4e8;
  background: #eef5ff;
  color: #245b9c;
}

#openExamGradeButton {
  border-color: #62a68a;
  background: #edf8f3;
  color: #1f6b50;
}

#openWordWorkspaceButton {
  border-color: #c77a7a;
  background: #fff2f2;
  color: #8e3434;
}

#openCoursewareWorkspaceButton {
  border-color: #6f83bd;
  background: #f1f4ff;
  color: #3e528f;
}

#openAnimationWorkspaceButton {
  border-color: #c69842;
  background: #fff8e8;
  color: #76551a;
}

#openLearningGameButton {
  border-color: #d16f57;
  background: #fff2ed;
  color: #8a3b29;
}

#openWorkspaceVideoCoursesButton {
  border-color: #4c91a8;
  background: #edf8fb;
  color: #246679;
}

.mistake-library-modal,
.ppt-workspace-modal,
.word-workspace-modal,
.courseware-workspace-modal,
.animation-workspace-modal,
.learning-game-modal {
  width: min(1240px, calc(100vw - 28px));
  height: min(860px, calc(100vh - 28px));
  max-height: calc(100vh - 28px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.learning-game-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
}

.learning-game-config,
.learning-game-main {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.learning-game-config {
  display: grid;
  align-content: start;
  gap: 12px;
  overflow-y: auto;
  padding: 15px;
}

.learning-game-config > label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.learning-game-config input,
.learning-game-config select,
.learning-game-config textarea {
  width: 100%;
  min-width: 0;
}

.learning-game-type-hint {
  min-height: 34px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
}

.learning-game-player-card {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.learning-game-player-card > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.learning-game-player-card strong {
  font-size: 20px;
}

.learning-game-player-card span,
.learning-game-player-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.learning-game-xp-track {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-soft);
}

.learning-game-xp-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 180ms ease;
}

.learning-game-stage-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.learning-game-stage-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--muted);
  font-size: 12px;
}

.learning-game-stage-list li > span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
}

.learning-game-stage-list li.active {
  color: var(--ink);
}

.learning-game-stage-list li.active > span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.learning-game-stage-list li.complete > span {
  border-color: #3a8a69;
  background: #eaf7f1;
  color: #24664d;
}

.learning-game-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  background: #ffffff;
}

.learning-game-status-row,
.learning-game-actions {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}

.learning-game-status-row {
  border-bottom: 1px solid var(--line);
}

.learning-game-status-row > span:first-child {
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 750;
}

.learning-game-status-row strong {
  margin-left: auto;
}

.learning-game-status-row #learningGameTimerText {
  min-width: 76px;
  color: #a44732;
  font-size: 12px;
  font-weight: 750;
  text-align: right;
}

.learning-game-content {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  background: #f5faf7;
  color: #18251f;
  padding: clamp(18px, 3vw, 34px);
}

.learning-game-content > article,
.learning-game-welcome {
  width: min(760px, 100%);
  margin: 0 auto;
}

.learning-game-welcome {
  display: grid;
  min-height: 100%;
  align-content: center;
  gap: 8px;
  text-align: center;
}

.learning-game-welcome h3,
.learning-game-welcome p,
.learning-game-lesson h3,
.learning-game-summary h3,
.learning-game-finish h3 {
  margin: 0;
}

.learning-game-welcome p,
.learning-game-summary p,
.learning-game-finish p {
  color: var(--muted);
  line-height: 1.7;
}

.learning-game-lesson > span,
.learning-game-summary > span,
.learning-game-finish > span,
.learning-game-question-level {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.learning-game-lesson .message-content {
  margin-top: 18px;
  max-width: none;
}

.learning-game-tip,
.learning-game-opponent,
.learning-game-feedback {
  margin-top: 18px;
  border-left: 3px solid var(--accent);
  background: var(--surface-soft);
  padding: 12px 14px;
  color: var(--muted);
  line-height: 1.6;
}

.learning-game-question h3 {
  margin: 0 0 18px;
  font-size: 20px;
  line-height: 1.6;
}

.learning-game-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.learning-game-option {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.learning-game-option > span:first-child {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.learning-game-option:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.learning-game-option.correct,
.learning-game-feedback.correct {
  border-color: #3a8a69;
  background: #eaf7f1;
}

.learning-game-option.incorrect,
.learning-game-feedback.incorrect {
  border-color: #c76554;
  background: #fff0ed;
}

.learning-game-feedback > span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.learning-game-opponent {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-left-color: #d16f57;
}

.learning-game-summary ol {
  display: grid;
  gap: 10px;
  margin: 20px 0;
  padding-left: 24px;
  line-height: 1.7;
}

.learning-game-summary-score {
  display: flex;
  align-items: center;
  gap: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
}

.learning-game-summary-score strong {
  font-size: 28px;
}

.learning-game-summary-score span {
  color: var(--muted);
}

.learning-game-result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin: 22px 0;
  background: var(--line);
}

.learning-game-result-grid > div {
  display: grid;
  gap: 4px;
  background: var(--surface);
  padding: 18px;
  text-align: center;
}

.learning-game-result-grid strong {
  font-size: 28px;
}

.learning-game-result-grid span {
  color: var(--muted);
  font-size: 12px;
}

.learning-game-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.mistake-library-layout {
  display: grid;
  grid-template-columns: minmax(210px, 0.72fr) minmax(390px, 1.5fr) minmax(220px, 0.78fr);
  gap: 14px;
  min-height: 0;
}

.mistake-roster-panel,
.mistake-items-panel,
.mistake-detail-panel,
.ppt-config-panel,
.ppt-preview-panel,
.word-config-panel,
.word-preview-panel,
.courseware-config-panel,
.courseware-preview-panel,
.animation-config-panel,
.animation-preview-panel {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.mistake-roster-panel,
.mistake-detail-panel,
.ppt-config-panel,
.word-config-panel,
.courseware-config-panel,
.animation-config-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding: 15px;
}

.mistake-roster-panel label,
.mistake-detail-panel label,
.ppt-config-panel label,
.word-config-panel label,
.courseware-config-panel label,
.animation-config-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.section-heading,
.mistake-toolbar,
.mistake-action-row,
.mistake-filter-row,
.workflow-camera-actions,
.ppt-preview-header,
.ppt-upload-panel,
.word-preview-header,
.word-upload-panel,
.courseware-preview-header,
.courseware-upload-panel,
.animation-preview-header,
.animation-input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.roster-student-list {
  display: grid;
  gap: 5px;
  max-height: 330px;
  overflow: auto;
}

.roster-student-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 8px 3px;
  text-align: left;
  cursor: pointer;
}

.roster-student-row small,
.mistake-item-main small,
.ppt-outline-slide small {
  color: var(--muted);
}

.mistake-items-panel {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
}

.mistake-toolbar {
  align-items: flex-start;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.mistake-filter-row,
.mistake-action-row {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.mistake-filter-row select {
  width: auto;
  min-width: 105px;
}

.mistake-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  padding: 9px 12px;
}

.mistake-list-heading strong {
  color: var(--ink);
  font-size: 13px;
}

.mistake-list-heading span {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mistake-list-body {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: var(--surface-soft);
}

.mistake-item-list {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
}

.settings-modal label.mistake-item-row {
  display: grid;
  grid-template-columns: 20px 64px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 80px;
  margin: 0 !important;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 9px 10px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.settings-modal label.mistake-item-row:hover {
  border-color: color-mix(in srgb, var(--accent) 42%, var(--line));
  box-shadow: 0 3px 10px rgba(22, 45, 36, 0.08);
}

.settings-modal label.mistake-item-row.selected {
  border-color: color-mix(in srgb, var(--accent) 68%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface));
}

.mistake-item-row > input[type="checkbox"] {
  justify-self: center;
  width: 18px;
  min-width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
  box-shadow: none;
}

.mistake-file-preview {
  display: grid !important;
  place-items: center;
  width: 64px;
  height: 56px;
  margin: 0 !important;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #eef2f8;
}

.mistake-file-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: #e9eef8;
  color: #315d9a;
  font-size: 12px;
  font-weight: 800;
}

.mistake-thumbnail-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mistake-item-main {
  display: grid !important;
  gap: 5px;
  min-width: 0;
  margin: 0 !important;
}

.mistake-item-header {
  display: flex !important;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin: 0 !important;
}

.mistake-item-header strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mistake-subject-chip {
  flex: 0 0 auto;
  display: inline-flex !important;
  align-items: center;
  min-height: 22px;
  margin: 0 !important;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent-soft) 64%, var(--surface));
  padding: 2px 8px;
  color: var(--accent);
  font-size: 11px !important;
  font-weight: 750;
  line-height: 1;
}

.mistake-item-meta {
  display: flex !important;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin: 0 !important;
  color: var(--muted);
  font-size: 11px !important;
  line-height: 1.35;
}

.mistake-item-meta > span,
.mistake-item-meta time {
  margin: 0 !important;
}

.mistake-note-preview {
  overflow: hidden;
  color: #79502f;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mistake-empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  padding: 24px;
  text-align: center;
}

.mistake-detail-preview {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.mistake-detail-placeholder {
  display: grid;
  gap: 5px;
  place-items: center;
  min-height: 132px;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.mistake-detail-placeholder strong {
  color: var(--ink);
  font-size: 20px;
}

.mistake-detail-placeholder span {
  margin: 0 !important;
  font-size: 12px !important;
  line-height: 1.55;
}

.mistake-detail-media {
  display: grid;
  place-items: center;
  width: 100%;
  height: 148px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #eef2f8;
}

.mistake-detail-media .mistake-thumbnail-image {
  object-fit: contain;
}

.mistake-detail-file {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
}

.mistake-detail-file strong,
.mistake-detail-file span {
  min-width: 0;
  margin: 0 !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mistake-detail-file strong {
  color: var(--ink);
  font-size: 12px;
}

.mistake-detail-file span {
  color: var(--muted);
  font-size: 11px !important;
}

.mistake-selection-summary,
.exam-context-summary {
  border-left: 3px solid #d8703a;
  background: #fff7f0;
  color: #70402c;
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.55;
}

.mistake-detail-actions {
  display: grid;
  gap: 8px;
  margin-top: 4px;
}

.ppt-workspace-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.82fr) minmax(0, 1.35fr);
  gap: 16px;
  min-height: 0;
}

.word-workspace-layout {
  display: grid;
  grid-template-columns: minmax(330px, 0.86fr) minmax(0, 1.4fr);
  gap: 16px;
  min-height: 0;
}

.courseware-workspace-layout {
  display: grid;
  grid-template-columns: minmax(330px, 0.86fr) minmax(0, 1.46fr);
  gap: 16px;
  min-height: 0;
}

.animation-workspace-layout {
  display: grid;
  grid-template-columns: minmax(330px, 0.84fr) minmax(0, 1.46fr);
  gap: 16px;
  min-height: 0;
}

.ppt-field-grid,
.word-field-grid,
.courseware-field-grid,
.animation-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.ppt-option-row,
.word-option-row,
.courseware-option-row {
  grid-template-columns: auto minmax(0, 1fr) !important;
  align-items: center;
}

.ppt-preview-panel,
.word-preview-panel,
.courseware-preview-panel,
.animation-preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.ppt-preview-header,
.word-preview-header,
.courseware-preview-header,
.animation-preview-header {
  border-bottom: 1px solid var(--line);
  padding: 13px 15px;
}

.ppt-preview-header > div:first-child,
.word-preview-header > div:first-child,
.courseware-preview-header > div:first-child,
.animation-preview-header > div:first-child {
  display: grid;
  gap: 3px;
}

.ppt-preview-header-actions,
.ppt-preview-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ppt-preview-header-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.ppt-preview-tabs {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 2px;
}

.ppt-preview-tab {
  min-width: 52px;
  min-height: 28px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 750;
}

.ppt-preview-tab.active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(23, 33, 43, 0.12);
}

.animation-preview-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.courseware-preview-actions {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.ppt-preview-header span,
.ppt-upload-panel span,
.word-preview-header span,
.word-upload-panel span,
.courseware-preview-header span,
.courseware-upload-panel span,
.animation-preview-header span,
.animation-input-actions span {
  color: var(--muted);
  font-size: 12px;
}

.ppt-preview-workspace {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto 94px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #e7ebef;
}

.ppt-html-preview-workspace {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #e7ebef;
  padding: 12px;
}

.ppt-html-preview-workspace iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1px solid rgba(23, 33, 43, 0.16);
  border-radius: 6px;
  background: #f5f7f8;
}

.ppt-preview-panel.html-preview-fullscreen {
  z-index: 145;
  grid-template-rows: minmax(0, 1fr);
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #e7ebef;
  overflow: hidden;
}

.ppt-preview-panel.html-preview-fullscreen .ppt-preview-header {
  position: absolute;
  z-index: 3;
  top: 12px;
  right: 12px;
  border: 0;
  padding: 0;
}

.ppt-preview-panel.html-preview-fullscreen .ppt-preview-header > :first-child,
.ppt-preview-panel.html-preview-fullscreen .ppt-preview-tabs,
.ppt-preview-panel.html-preview-fullscreen .ppt-preview-header-actions > :not(#pptHtmlFullscreenButton),
.ppt-preview-panel.html-preview-fullscreen > .generation-revision-panel {
  display: none;
}

.ppt-preview-panel.html-preview-fullscreen #pptHtmlFullscreenButton {
  border-color: rgba(23, 33, 43, 0.2);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 16px rgba(23, 33, 43, 0.16);
}

.ppt-preview-panel.html-preview-fullscreen .ppt-html-preview-workspace {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  padding: 0;
}

.ppt-preview-panel.html-preview-fullscreen .ppt-html-preview-workspace iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
}

.ppt-preview-panel.ppt-preview-fullscreen {
  z-index: 145;
  grid-template-rows: minmax(0, 1fr);
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: #161b22;
}

.ppt-preview-panel.ppt-preview-fullscreen .ppt-preview-header {
  position: absolute;
  z-index: 4;
  top: 12px;
  right: 12px;
  border: 0;
  padding: 0;
}

.ppt-preview-panel.ppt-preview-fullscreen .ppt-preview-header > :first-child,
.ppt-preview-panel.ppt-preview-fullscreen .ppt-preview-tabs,
.ppt-preview-panel.ppt-preview-fullscreen .ppt-preview-header-actions > :not(#pptHtmlFullscreenButton),
.ppt-preview-panel.ppt-preview-fullscreen > .generation-revision-panel,
.ppt-preview-panel.ppt-preview-fullscreen .ppt-outline-preview {
  display: none;
}

.ppt-preview-panel.ppt-preview-fullscreen #pptHtmlFullscreenButton {
  border-color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.22);
}

.ppt-preview-panel.ppt-preview-fullscreen .ppt-preview-workspace {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  width: 100%;
  height: 100%;
  background: #161b22;
}

.ppt-preview-panel.ppt-preview-fullscreen .ppt-slide-stage {
  min-height: 0;
  padding: 10px;
}

.ppt-preview-panel.ppt-preview-fullscreen .ppt-slide-preview {
  max-width: 100%;
  max-height: 100%;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.38);
}

.ppt-preview-panel.ppt-preview-fullscreen .ppt-rendered-slide-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ppt-preview-panel.ppt-preview-fullscreen .ppt-preview-navigation {
  z-index: 2;
  width: max-content;
  margin: 0 auto 10px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.94);
  padding: 4px 8px;
}


.ppt-slide-stage {
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  overflow: auto;
  padding: 16px;
}

.ppt-slide-preview {
  position: relative;
  width: min(100%, 760px);
  overflow: hidden;
  border: 1px solid rgba(23, 33, 43, 0.16);
  background: var(--ppt-bg);
  color: var(--ppt-text);
  box-shadow: 0 12px 28px rgba(29, 40, 51, 0.16);
  container-type: inline-size;
  font-family: "Microsoft YaHei", "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.ppt-slide-preview.is-empty {
  display: grid;
  aspect-ratio: 16 / 9;
  place-items: center;
  background: #f8fafb;
  box-shadow: none;
  color: #66717d;
  font-size: 13px;
}

.ppt-slide-preview.is-rendered {
  background: #fff;
}

.ppt-rendered-slide-image {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  object-fit: contain;
}

.ppt-preview-style-teaching {
  --ppt-bg: #fbfcfd;
  --ppt-cover: #163d43;
  --ppt-text: #18232d;
  --ppt-muted: #66717b;
  --ppt-accent: #d85f38;
  --ppt-support: #16877d;
  --ppt-soft: #e8f2ef;
}

.ppt-preview-style-academic {
  --ppt-bg: #f7f8fa;
  --ppt-cover: #243446;
  --ppt-text: #17212b;
  --ppt-muted: #5e6976;
  --ppt-accent: #0c7379;
  --ppt-support: #c06b38;
  --ppt-soft: #e5eff0;
}

.ppt-preview-style-business {
  --ppt-bg: #f9fafb;
  --ppt-cover: #25313b;
  --ppt-text: #19242e;
  --ppt-muted: #65707b;
  --ppt-accent: #177a70;
  --ppt-support: #d2773e;
  --ppt-soft: #e4f0ed;
}

.ppt-preview-style-youth {
  --ppt-bg: #fffdfb;
  --ppt-cover: #334859;
  --ppt-text: #202934;
  --ppt-muted: #68727d;
  --ppt-accent: #d94f4f;
  --ppt-support: #148a91;
  --ppt-soft: #fff0d8;
}

.ppt-slide-preview > header {
  position: relative;
  padding: 5.2% 6.2% 0;
}

.ppt-slide-preview > header::after {
  display: block;
  width: 8%;
  min-width: 34px;
  height: 3px;
  margin-top: 2.2%;
  background: var(--ppt-accent);
  content: "";
}

.ppt-slide-preview > header > span,
.ppt-preview-cover > span {
  color: var(--ppt-accent);
  font-size: clamp(8px, 1.55cqw, 13px);
  font-weight: 800;
  text-transform: uppercase;
}

.ppt-slide-preview h2,
.ppt-slide-preview h3,
.ppt-slide-preview h4,
.ppt-slide-preview p {
  letter-spacing: 0;
}

.ppt-slide-preview > header h3 {
  max-width: 88%;
  margin: 1.2% 0 0;
  color: var(--ppt-text);
  font-size: clamp(17px, 3.6cqw, 29px);
  line-height: 1.22;
}

.ppt-slide-preview > header p {
  margin: 1% 0 0;
  color: var(--ppt-muted);
  font-size: clamp(9px, 1.55cqw, 13px);
}

.ppt-slide-preview > main {
  position: absolute;
  inset: 30% 6.2% 9%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.ppt-preview-cover {
  display: flex;
  position: absolute;
  inset: 0;
  flex-direction: column;
  justify-content: center;
  background: var(--ppt-cover);
  padding: 9%;
  color: #fff;
}

.ppt-preview-cover::before {
  position: absolute;
  top: 0;
  right: 8%;
  width: 18%;
  height: 7px;
  background: var(--ppt-accent);
  content: "";
}

.ppt-preview-cover h2 {
  max-width: 82%;
  margin: 2% 0 0;
  color: #fff;
  font-size: clamp(22px, 6.2cqw, 50px);
  line-height: 1.16;
}

.ppt-preview-cover p {
  max-width: 72%;
  margin: 2.5% 0 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: clamp(10px, 2cqw, 17px);
  line-height: 1.55;
}

.ppt-preview-cover small {
  margin-top: 6%;
  color: rgba(255, 255, 255, 0.72);
  font-size: clamp(8px, 1.4cqw, 12px);
}

.ppt-preview-key-message {
  margin: 0 0 3%;
  color: var(--ppt-text);
  font-size: clamp(12px, 2.35cqw, 19px);
  font-weight: 800;
  line-height: 1.35;
}

.ppt-preview-body-copy {
  margin: 2% 0 0;
  color: var(--ppt-muted);
  font-size: clamp(8px, 1.45cqw, 12px);
  line-height: 1.55;
}

.ppt-preview-bullets {
  display: grid;
  gap: clamp(5px, 1.8cqw, 14px);
  margin: 2% 0 0;
  padding: 0;
  list-style: none;
}

.ppt-preview-bullets li {
  position: relative;
  color: var(--ppt-text);
  padding-left: 3.2%;
  font-size: clamp(9px, 1.75cqw, 14px);
  line-height: 1.45;
}

.ppt-preview-bullets li::before {
  position: absolute;
  top: 0.58em;
  left: 0;
  width: 1.25%;
  aspect-ratio: 1;
  background: var(--ppt-accent);
  content: "";
}

.ppt-preview-equations {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3%;
  margin-top: 3%;
  color: var(--ppt-text);
  font-size: clamp(9px, 1.7cqw, 15px);
}

.ppt-preview-equations .math-display {
  max-width: 48%;
  margin: 0;
  border: 0;
  background: var(--ppt-soft);
  padding: 1.5% 2.2%;
}

.ppt-preview-columns,
.ppt-preview-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 2.2%;
  height: 78%;
}

.ppt-preview-columns.count-1 {
  grid-template-columns: 1fr;
}

.ppt-preview-columns.count-2,
.ppt-preview-metrics:has(section:nth-child(2):last-child) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ppt-preview-columns section,
.ppt-preview-metrics section {
  min-width: 0;
  overflow: hidden;
  border-top: 4px solid var(--ppt-support);
  background: #fff;
  padding: 8%;
  box-shadow: 0 4px 13px rgba(30, 44, 55, 0.08);
}

.ppt-preview-columns section > span {
  color: var(--ppt-accent);
  font-size: clamp(8px, 1.35cqw, 11px);
  font-weight: 850;
}

.ppt-preview-columns h4,
.ppt-preview-metrics h4 {
  margin: 7% 0 0;
  color: var(--ppt-text);
  font-size: clamp(10px, 1.8cqw, 15px);
  line-height: 1.3;
}

.ppt-preview-columns p,
.ppt-preview-metrics p {
  margin: 6% 0 0;
  color: var(--ppt-muted);
  font-size: clamp(7px, 1.2cqw, 10px);
  line-height: 1.45;
}

.ppt-preview-columns .ppt-preview-bullets {
  gap: 4px;
}

.ppt-preview-columns .ppt-preview-bullets li {
  font-size: clamp(7px, 1.15cqw, 10px);
}

.ppt-preview-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  height: auto;
}

.ppt-preview-metrics section {
  border-top-color: var(--ppt-accent);
  padding: 9%;
}

.ppt-preview-metrics section > strong {
  display: block;
  color: var(--ppt-support);
  font-size: clamp(18px, 4.1cqw, 34px);
  line-height: 1;
}

.ppt-preview-split {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 4%;
  height: 100%;
}

.ppt-preview-media {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  margin: 0;
  background: var(--ppt-soft);
}

.ppt-preview-media img {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
  margin: 0;
  object-fit: cover;
}

.ppt-preview-media.is-placeholder {
  display: grid;
  position: relative;
  place-items: center;
  background: linear-gradient(135deg, var(--ppt-soft) 0 62%, rgba(22, 135, 125, 0.16) 62% 100%);
}

.ppt-preview-media.is-placeholder::before {
  width: 24%;
  aspect-ratio: 1;
  border: 2px solid var(--ppt-support);
  border-radius: 50%;
  content: "";
}

.ppt-preview-media.is-placeholder span {
  position: absolute;
  right: 7%;
  bottom: 7%;
  color: var(--ppt-support);
  font-size: clamp(7px, 1.2cqw, 10px);
  font-weight: 800;
}

.ppt-preview-text-panel {
  min-width: 0;
  overflow: hidden;
  padding: 2% 0;
}

.ppt-preview-process {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1.6%;
  margin-top: 5%;
}

.ppt-preview-process section {
  position: relative;
  min-width: 0;
  border-top: 2px solid var(--ppt-support);
  padding-top: 12%;
}

.ppt-preview-process section:not(:last-child)::after {
  position: absolute;
  top: -2px;
  right: -10%;
  width: 10%;
  border-top: 2px solid var(--ppt-support);
  content: "";
}

.ppt-preview-process b {
  display: grid;
  width: clamp(18px, 3.5cqw, 28px);
  aspect-ratio: 1;
  place-items: center;
  background: var(--ppt-accent);
  color: #fff;
  font-size: clamp(8px, 1.3cqw, 11px);
}

.ppt-preview-process span {
  display: block;
  margin-top: 8%;
  color: var(--ppt-text);
  font-size: clamp(7px, 1.25cqw, 11px);
  font-weight: 700;
  line-height: 1.35;
}

.ppt-preview-bar-chart {
  display: grid;
  gap: 7%;
  height: 72%;
  align-content: center;
}

.ppt-preview-bar-chart > div {
  display: grid;
  grid-template-columns: minmax(54px, 0.7fr) 3fr minmax(30px, 0.4fr);
  align-items: center;
  gap: 2%;
  color: var(--ppt-text);
  font-size: clamp(7px, 1.3cqw, 11px);
}

.ppt-preview-bar-chart > div > b {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ppt-preview-bar-chart > div > span {
  height: clamp(8px, 1.7cqw, 14px);
  background: #e3e7ea;
}

.ppt-preview-bar-chart i {
  display: block;
  height: 100%;
}

.ppt-preview-pie-chart {
  display: grid;
  grid-template-columns: minmax(120px, 0.85fr) 1.15fr;
  align-items: center;
  gap: 8%;
  height: 76%;
}

.ppt-preview-pie {
  width: min(100%, 190px);
  aspect-ratio: 1;
  border-radius: 50%;
}

.ppt-preview-legend {
  display: grid;
  gap: 8%;
  color: var(--ppt-text);
  font-size: clamp(7px, 1.35cqw, 11px);
}

.ppt-preview-legend span {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
}

.ppt-preview-legend i {
  width: 9px;
  aspect-ratio: 1;
}

.ppt-preview-line-chart {
  height: 76%;
}

.ppt-preview-line-chart svg {
  width: 100%;
  height: calc(100% - 22px);
  overflow: visible;
}

.ppt-preview-line-chart path {
  fill: none;
  stroke: #c9d0d5;
  stroke-width: 1;
}

.ppt-preview-line-chart polyline {
  fill: none;
  stroke: var(--ppt-support);
  stroke-width: 3;
}

.ppt-preview-line-chart circle {
  fill: var(--ppt-accent);
}

.ppt-preview-line-chart text {
  fill: var(--ppt-muted);
  font-size: 9px;
  text-anchor: middle;
}

.ppt-preview-line-chart > div {
  display: flex;
  justify-content: space-around;
  color: var(--ppt-muted);
  font-size: clamp(7px, 1.15cqw, 10px);
}

.ppt-preview-table-wrap {
  max-height: 78%;
  overflow: hidden;
  border: 1px solid #dce1e5;
}

.ppt-preview-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  color: var(--ppt-text);
  font-size: clamp(7px, 1.2cqw, 10px);
}

.ppt-preview-table-wrap th,
.ppt-preview-table-wrap td {
  border-right: 1px solid #dce1e5;
  border-bottom: 1px solid #dce1e5;
  padding: 2.1% 2.4%;
  text-align: left;
}

.ppt-preview-table-wrap th {
  background: var(--ppt-support);
  color: #fff;
}

.ppt-slide-preview > footer {
  display: flex;
  position: absolute;
  right: 6.2%;
  bottom: 3.2%;
  left: 6.2%;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ppt-muted);
  font-size: clamp(6px, 1.05cqw, 9px);
}

.ppt-slide-preview > footer span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ppt-preview-layout-section > main,
.ppt-preview-layout-statement > main,
.ppt-preview-layout-question > main,
.ppt-preview-layout-quote > main,
.ppt-preview-layout-summary > main {
  display: flex;
  inset: 30% 10% 12%;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.ppt-preview-layout-section .ppt-preview-key-message,
.ppt-preview-layout-statement .ppt-preview-key-message,
.ppt-preview-layout-question .ppt-preview-key-message,
.ppt-preview-layout-quote .ppt-preview-key-message,
.ppt-preview-layout-summary .ppt-preview-key-message {
  font-size: clamp(15px, 3.4cqw, 28px);
}

.ppt-preview-navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-top: 1px solid #d4d9de;
  border-bottom: 1px solid #d4d9de;
  background: #f8fafb;
  padding: 7px 12px;
}

.ppt-preview-navigation > span {
  min-width: 58px;
  color: #4d5965;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  text-align: center;
}

.ppt-preview-arrow {
  width: 34px;
  min-width: 34px;
  height: 30px;
  padding: 0;
  font-size: 16px;
}

.ppt-outline-preview {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  background: #f2f4f6;
  padding: 8px 12px;
  scrollbar-width: thin;
}

.word-preview-content {
  overflow: auto;
  padding: 22px 28px 36px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.78;
}

.word-preview-content > :first-child {
  margin-top: 0;
}

.word-preview-content h1,
.word-preview-content h2,
.word-preview-content h3 {
  margin: 22px 0 10px;
  line-height: 1.42;
}

.word-preview-content table {
  font-size: 13px;
}

.courseware-preview-content {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: #e8edf3;
  padding: 12px 14px 28px;
  color: var(--ink);
}

.courseware-preview-content > p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.courseware-preview-content .interactive-html-card {
  width: 100%;
  max-height: none;
  margin: 0;
}

.courseware-preview-content .interactive-html-courseware-card .interactive-html-frame {
  min-height: 360px;
  max-height: min(68vh, 700px);
  aspect-ratio: 16 / 9;
}

.courseware-preview-content .interactive-html-courseware-card.courseware-vertical .interactive-html-frame {
  min-height: min(68vh, 700px);
  height: min(68vh, 700px);
  aspect-ratio: auto;
}

.generation-upload-panel {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px 12px;
}

.generation-upload-panel > span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generation-file-list {
  display: grid;
  gap: 5px;
  height: max-content;
  max-height: 180px;
  overflow: auto;
}

.generation-file-list:not(:empty) {
  min-height: 57px;
}

.generation-file-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  min-width: 0;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 7px;
}

.generation-file-details {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.generation-file-thumbnail {
  display: grid;
  width: 42px;
  min-width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--accent);
  padding: 0;
  font: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}

.generation-file-thumbnail:hover,
.generation-file-thumbnail:focus-visible {
  border-color: var(--accent);
}

.generation-file-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.generation-file-item strong,
.generation-file-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.generation-file-item strong {
  color: var(--ink);
  font-size: 12px;
}

.generation-file-item small,
.generation-file-empty {
  color: var(--muted);
  font-size: 11px;
}

.generation-file-remove-button {
  flex: 0 0 auto;
  min-height: 28px;
  border-color: color-mix(in srgb, var(--danger) 38%, var(--line));
  padding: 4px 9px;
  color: var(--danger);
  font-size: 11px;
}

.generation-file-preview-button {
  flex: 0 0 auto;
  min-height: 28px;
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  padding: 4px 9px;
  color: var(--accent);
  font-size: 11px;
}

.generation-file-preview-modal {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(880px, calc(100vw - 36px));
  height: min(760px, calc(100vh - 36px));
  overflow: hidden;
}

.generation-file-preview-content {
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 12px;
}

.generation-file-preview-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.generation-file-preview-text {
  width: 100%;
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  font: 13px/1.7 "Microsoft YaHei", "Segoe UI", sans-serif;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .generation-file-item {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .generation-file-thumbnail {
    width: 36px;
    min-width: 36px;
    height: 36px;
  }

  .generation-file-actions {
    grid-column: 2;
    justify-content: flex-end;
  }
}

.generation-file-empty {
  margin: 0;
  padding: 6px 2px;
}

.courseware-upload-panel {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.courseware-upload-panel span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.courseware-reference-list {
  display: grid;
  gap: 5px;
  height: max-content;
  max-height: 170px;
  overflow: auto;
}

.courseware-reference-list:not(:empty) {
  min-height: 57px;
}

.courseware-reference-item {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 7px 3px;
}

.courseware-reference-item > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.courseware-reference-item strong,
.courseware-reference-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.courseware-reference-item strong {
  color: var(--ink);
  font-size: 12px;
}

.courseware-reference-item small {
  color: var(--muted);
  font-size: 10px;
}

.animation-preview-content {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 12px 14px 28px;
  color: var(--ink);
}

.animation-preview-content > p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.animation-preview-content .interactive-html-card {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-width: none;
  max-height: none;
  margin: 0;
  resize: none;
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr);
}

.animation-preview-content {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}

.animation-preview-content .interactive-html-frame {
  width: 100%;
  height: 100% !important;
  min-height: 0;
  max-height: none;
}

.animation-input-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.animation-input-actions span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.animation-reference-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  max-height: 190px;
  overflow: auto;
}

.animation-reference-item {
  position: relative;
  display: grid;
  gap: 5px;
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
  padding: 5px;
}

.animation-reference-item img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 4px;
  background: var(--surface);
  object-fit: cover;
}

.animation-reference-item figcaption {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.animation-reference-item .generation-file-remove-button {
  position: absolute;
  top: 8px;
  right: 8px;
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(22, 32, 51, 0.76);
  color: #fff;
}

.word-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.generation-revision-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  border-top: 1px solid var(--line);
  background: var(--panel);
  padding: 11px 14px;
}

.generation-revision-panel textarea {
  min-width: 0;
  max-height: 120px;
  resize: vertical;
}

.generation-revision-panel > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.ppt-outline-slide {
  display: block;
  position: relative;
  flex: 0 0 132px;
  min-width: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 5px;
  background: #dfe4e8;
  color: #26323d;
  padding: 3px;
  text-align: left;
  cursor: pointer;
}

.ppt-outline-slide:hover {
  border-color: #9eb0bb;
}

.ppt-outline-slide.active {
  border-color: #16877d;
  box-shadow: inset 0 0 0 1px rgba(22, 135, 125, 0.12);
}

.ppt-outline-slide > span {
  position: absolute;
  z-index: 1;
  top: 6px;
  left: 6px;
  border-radius: 3px;
  background: rgba(20, 29, 37, 0.78);
  color: #fff;
  padding: 2px 4px;
  font-size: 9px;
  font-weight: 850;
}

.ppt-outline-slide > img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 2px;
  object-fit: contain;
}

.ppt-outline-slide > i {
  display: block;
  width: 100%;
  height: 100%;
  background: #f7f8f9;
}

.workflow-camera-modal {
  width: min(900px, calc(100vw - 30px));
  display: grid;
  gap: 14px;
}

.workflow-camera-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 360px;
  overflow: hidden;
  border-radius: 8px;
  background: #151a21;
  touch-action: none;
  cursor: grab;
}

.workflow-camera-stage video {
  width: 100%;
  max-height: 65vh;
  object-fit: contain;
  transform-origin: center;
  pointer-events: none;
  will-change: transform;
}

.workflow-camera-stage.selecting {
  cursor: crosshair;
}

.workflow-camera-selection {
  position: absolute;
  z-index: 2;
  border: 2px solid #f0a33b;
  background: rgba(240, 163, 59, 0.12);
  pointer-events: none;
}

.workflow-camera-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.workflow-camera-toolbar label {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 260px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.workflow-camera-toolbar select {
  min-width: 180px;
}

#workflowCameraZoomBadge {
  min-width: 52px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.exam-mistake-picker {
  display: grid;
  gap: 9px;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  background: #f8fafc;
  padding: 11px;
}

.exam-mistake-picker-header,
.exam-mistake-folder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.exam-mistake-folder-row select {
  flex: 1 1 220px;
}

.exam-mistake-picker-list {
  display: grid;
  max-height: 190px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

.exam-mistake-file-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 8px 4px;
  cursor: pointer;
}

.exam-mistake-file-row.selected {
  background: #edf7f3;
}

.exam-mistake-file-row > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.exam-mistake-file-row strong,
.exam-mistake-file-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exam-mistake-file-row small {
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 980px) {
  .mistake-library-layout,
  .ppt-workspace-layout,
  .word-workspace-layout,
  .courseware-workspace-layout,
  .animation-workspace-layout {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .mistake-library-modal,
  .ppt-workspace-modal,
  .word-workspace-modal,
  .courseware-workspace-modal,
  .animation-workspace-modal {
    display: flex;
    flex-direction: column;
    overflow: auto;
  }

  .mistake-roster-panel,
  .mistake-detail-panel {
    overflow: visible;
  }

  .mistake-items-panel,
  .ppt-preview-panel,
  .word-preview-panel,
  .courseware-preview-panel,
  .animation-preview-panel {
    min-height: 420px;
  }
}

@media (max-width: 680px) {
  .workspace-shortcuts {
    width: 100%;
    margin-left: 0;
  }

  .workspace-shortcut {
    flex: 1 1 calc(50% - 4px);
  }

  .ppt-field-grid,
  .word-field-grid,
  .animation-field-grid {
    grid-template-columns: 1fr;
  }

  .generation-revision-panel {
    grid-template-columns: 1fr;
  }
}

.exam-workspace-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.exam-workspace-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.92fr) minmax(0, 1.35fr);
  gap: 16px;
  min-height: 0;
}

.exam-panel,
.exam-preview-panel {
  min-width: 0;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.exam-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  overflow: auto;
  padding: 16px;
}

.exam-panel label {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.exam-panel label input,
.exam-panel label select,
.exam-panel label textarea {
  color: var(--ink);
  font-weight: 500;
}

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

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

.exam-question-types label {
  grid-template-columns: auto minmax(0, 1fr) 70px;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 8px;
}

.exam-question-types input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.exam-question-types input[type="number"] {
  height: 30px;
  min-width: 0;
}

.exam-actions,
.exam-export-actions,
.exam-upload-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.exam-actions {
  justify-content: flex-end;
}

.exam-upload-panel {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.exam-upload-panel span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.exam-preview-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
}

.exam-preview-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  padding: 12px 14px;
}

.exam-preview-header > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.exam-preview-header strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.exam-preview-header span {
  color: var(--muted);
  font-size: 12px;
}

.exam-preview-content {
  overflow: auto;
  padding: 22px 24px 34px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.78;
}

.exam-preview-content > :first-child {
  margin-top: 0;
}

.exam-preview-content h2,
.exam-preview-content h3,
.exam-preview-content h4 {
  margin: 22px 0 10px;
  line-height: 1.45;
}

.exam-preview-content table {
  font-size: 13px;
}

.exam-answer-space {
  display: grid;
  gap: 16px;
  margin: 10px 0 22px;
  padding: 0 4px;
}

.exam-answer-space span {
  display: block;
  height: 28px;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 56%, transparent);
}

.exam-preview-content .study-viz-card {
  background: var(--surface);
}

.exam-stream-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.exam-stream-indicator::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
  animation: exam-stream-pulse 1.1s ease-in-out infinite;
}

@keyframes exam-stream-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

@media (max-width: 980px) {
  .exam-workspace-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(360px, 1fr);
    overflow: auto;
  }

  .exam-panel {
    overflow: visible;
  }
}

@media (max-width: 700px) {
  .exam-workspace-modal {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    padding: 14px;
  }

  .exam-field-grid,
  .exam-question-types {
    grid-template-columns: 1fr;
  }

  .exam-preview-header {
    align-items: stretch;
    flex-direction: column;
  }

  .exam-export-actions button {
    flex: 1;
  }

  .exam-preview-content {
    padding: 18px 16px 28px;
  }
}

@media (max-width: 820px) {
  .learning-game-modal {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    max-height: calc(100vh - 16px);
  }

  .learning-game-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(360px, 1fr);
    overflow-y: auto;
  }

  .learning-game-config {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .learning-game-config > button,
  .learning-game-config > .generation-upload-panel,
  .learning-game-config > .generation-file-list,
  .learning-game-config > .learning-game-description-field,
  .learning-game-config > .learning-game-start-actions,
  .learning-game-config > .learning-game-ai-status,
  .learning-game-player-card,
  .learning-game-stage-list {
    grid-column: 1 / -1;
  }

  .learning-game-stage-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .learning-game-options {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .learning-game-config {
    grid-template-columns: 1fr;
  }

  .learning-game-stage-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .learning-game-status-row {
    flex-wrap: wrap;
  }

  .learning-game-status-row strong {
    margin-left: 0;
  }

  .learning-game-result-grid {
    grid-template-columns: 1fr;
  }
}

/* v0.3.9 focused layout and learning-workspace fixes */
.primary-study-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.primary-study-actions .study-entry-button {
  min-width: 0;
}

.primary-study-actions .learning-stats {
  grid-column: 1 / -1;
}

.task-panel .task-list {
  max-height: 260px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.active-task-title-row {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
}

.active-task-title-row h2 {
  flex: 0 1 auto;
  min-width: 0;
}

.topbar .ai-output-disclaimer {
  margin-left: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
}

.topbar-rename-button {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  flex: 0 0 28px;
  color: var(--muted);
  font-size: 15px;
}

.active-task-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  margin-left: 10px;
}

.active-task-actions .icon-button {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px;
  flex-basis: 30px;
}

.learning-toolbar {
  flex-wrap: nowrap;
  gap: 4px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.learning-mode-control,
.parent-toggle {
  min-height: 30px;
  flex: 0 0 auto;
  gap: 3px;
  padding-inline: 6px;
}

.learning-toolbar select {
  width: auto;
  min-width: 54px;
  max-width: 74px;
  height: 26px;
  padding-inline: 2px;
}

.workspace-shortcuts {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 4px;
}

.workspace-shortcut {
  min-height: 30px;
  padding: 4px 7px;
  white-space: nowrap;
}

#openExamGenerateButton {
  margin-left: 0;
}

.message {
  padding: 12px 10px 12px 18px;
}

.message.assistant .message-content {
  min-width: 0;
  padding: 16px 14px 16px 18px;
}

.math-display {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
}

.video-course-stage-tabs {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5px;
}

.video-course-stage-tab {
  min-height: 30px;
  padding: 4px 5px;
  font-size: 12px;
}

.interactive-html-card {
  grid-template-rows: auto minmax(180px, 1fr);
  width: min(720px, 100%);
  min-width: min(320px, 100%);
  max-width: 100%;
  max-height: min(760px, 80vh);
  margin: 14px auto 18px;
  resize: both;
  overflow: auto;
}

.interactive-html-frame {
  max-height: min(58vh, 520px);
}

.interactive-html-card.manual-size .interactive-html-frame {
  height: 100% !important;
  max-height: none;
}

.courseware-preview-content {
  overflow: hidden;
}

.courseware-preview-content .interactive-html-courseware-card {
  grid-template-rows: auto minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
  max-height: none;
  margin: 0;
  resize: none;
  overflow: hidden;
}

.courseware-preview-content .interactive-html-courseware-card .interactive-html-frame,
.courseware-preview-content .interactive-html-courseware-card.courseware-vertical .interactive-html-frame {
  width: 100%;
  height: 100% !important;
  min-height: 0;
  max-height: none;
  aspect-ratio: auto;
}

.courseware-preview-content .interactive-html-courseware-card:fullscreen,
.courseware-preview-content .interactive-html-courseware-card.fullscreen-fallback {
  grid-template-rows: minmax(0, 1fr);
}

.courseware-preview-content .interactive-html-courseware-card:fullscreen .interactive-html-frame,
.courseware-preview-content .interactive-html-courseware-card.fullscreen-fallback .interactive-html-frame {
  grid-row: 1;
  min-height: 100%;
}

.interactive-html-card:fullscreen,
.interactive-html-card.fullscreen-fallback {
  grid-template-rows: minmax(0, 1fr);
  max-width: none;
  max-height: none;
  resize: none;
  overflow: hidden;
}

.interactive-html-card:fullscreen .interactive-html-frame,
.interactive-html-card.fullscreen-fallback .interactive-html-frame {
  grid-row: 1;
  min-height: 100%;
}

.interactive-html-size-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.interactive-html-size-actions .icon-button {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
}

.learning-game-start-actions {
  display: grid;
  gap: 8px;
}

.learning-game-ai-status {
  min-height: 34px;
  margin: -3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.learning-game-content .interactive-html-card {
  width: 100%;
  height: 100%;
  min-height: 0;
  max-width: none;
  max-height: none;
  margin-block: 0;
  resize: none;
  overflow: hidden;
  grid-template-rows: auto minmax(0, 1fr);
}

.learning-game-content .interactive-html-game-card .interactive-html-frame {
  width: 100%;
  height: 100% !important;
  min-height: 0;
  max-height: none;
}

.learning-game-content .interactive-html-game-card:fullscreen,
.learning-game-content .interactive-html-game-card.fullscreen-fallback {
  position: fixed;
  inset: 0;
  z-index: 142;
  grid-template-rows: minmax(0, 1fr);
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
}

.learning-game-content .interactive-html-game-card:fullscreen .interactive-html-frame,
.learning-game-content .interactive-html-game-card.fullscreen-fallback .interactive-html-frame {
  grid-row: 1;
  width: 100%;
  height: 100% !important;
  min-height: 100%;
  max-height: none;
}

.learning-game-actions #learningGameResetButton {
  margin-right: auto;
}

@media (max-width: 700px) {
  .primary-study-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .video-course-stage-tabs {
    display: flex;
    gap: 5px;
    overflow-x: auto;
  }

  .video-course-stage-tab {
    flex: 0 0 auto;
    min-width: 62px;
  }

  .interactive-html-card {
    width: 100%;
    min-width: 0;
    resize: vertical;
  }

  .message {
    padding-inline: 10px;
  }
}

/* About and focused presentation surfaces */
.about-modal-backdrop {
  z-index: 130;
  background: rgba(19, 32, 28, 0.42);
  backdrop-filter: blur(8px);
}

.about-modal {
  width: min(820px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(18, 34, 28, 0.24);
}

.about-modal-header,
.about-modal-footer,
.message-focus-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.about-modal-header {
  padding: 26px 28px 22px;
  color: #ffffff;
  background: linear-gradient(115deg, #176846 0%, #176846 58%, #195f83 100%);
}

.about-modal-header .icon-button {
  align-self: flex-start;
  border-color: rgba(255, 255, 255, 0.38);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.about-brand-lockup {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 18px;
}

.about-brand-lockup img {
  width: 72px;
  height: 72px;
  flex: 0 0 72px;
  border: 3px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  background: #ffffff;
}

.about-brand-lockup span,
.message-focus-header span {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  opacity: 0.8;
}

.about-brand-lockup h2 {
  margin: 0;
  color: #ffffff;
  font-size: 30px;
  line-height: 1.2;
}

.about-brand-lockup p {
  margin: 7px 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: 14px;
}

.about-modal-body {
  padding: 26px 28px 24px;
}

.about-intro {
  margin: 0 0 22px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.75;
}

.about-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin-bottom: 22px;
}

.about-feature-grid > div {
  min-width: 0;
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  padding: 12px 14px;
}

.about-feature-grid > div:nth-child(2n) {
  border-left-color: #287ca3;
}

.about-feature-grid strong,
.about-feature-grid span,
.about-contact-band span,
.about-contact-band strong {
  display: block;
}

.about-feature-grid strong {
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
}

.about-feature-grid span,
.about-footnote {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.about-contact-band {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
  border: 1px solid color-mix(in srgb, #d39a1d 38%, var(--line));
  background: color-mix(in srgb, #fff6d8 54%, var(--surface));
  padding: 15px 17px;
}

.about-contact-band span {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 11px;
}

.about-contact-band strong {
  color: var(--ink);
  font-size: 16px;
  overflow-wrap: anywhere;
}

.about-footnote {
  margin: 18px 0 0;
}

.about-modal-footer {
  border-top: 1px solid var(--line);
  padding: 15px 28px;
  color: var(--muted);
  font-size: 12px;
}

.update-modal-backdrop {
  z-index: 170;
  background: rgba(19, 32, 28, 0.44);
  backdrop-filter: blur(6px);
}

.settings-modal.update-modal {
  width: min(680px, calc(100vw - 32px));
  max-height: min(780px, calc(100vh - 32px));
  overflow: auto;
  border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--line));
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(18, 34, 28, 0.24);
}

.update-modal-header {
  margin: 0;
  border-bottom: 1px solid var(--line);
  padding: 20px 22px;
  background: color-mix(in srgb, var(--panel) 88%, #e9f5ef);
}

.update-title-lockup {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 13px;
}

.update-title-lockup img {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  object-fit: cover;
}

.update-title-lockup h2,
.update-title-lockup p,
.update-status-copy p,
.update-data-note p,
.update-release-notes p {
  margin: 0;
}

.update-title-lockup h2 {
  font-size: 21px;
  line-height: 1.3;
}

.update-title-lockup p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.update-modal-body {
  display: grid;
  gap: 16px;
  padding: 20px 22px;
}

.update-status-panel {
  --update-state: var(--muted);
  --update-state-soft: color-mix(in srgb, var(--panel) 82%, #f1f4f3);
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  min-height: 78px;
  border-left: 4px solid var(--update-state);
  background: var(--update-state-soft);
  padding: 13px 15px 13px 13px;
}

.update-status-panel[data-status="checking"],
.update-status-panel[data-status="available"],
.update-status-panel[data-status="downloading"] {
  --update-state: #287ca3;
  --update-state-soft: color-mix(in srgb, #eaf5fb 68%, var(--surface));
}

.update-status-panel[data-status="downloaded"],
.update-status-panel[data-status="not-available"] {
  --update-state: #19805f;
  --update-state-soft: color-mix(in srgb, #e8f6ef 70%, var(--surface));
}

.update-status-panel[data-status="error"] {
  --update-state: #c14d3a;
  --update-state-soft: color-mix(in srgb, #fff0ec 72%, var(--surface));
}

.update-status-symbol {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--update-state) 44%, transparent);
  border-radius: 50%;
  color: var(--update-state);
  background: var(--surface);
  font-size: 21px;
  font-weight: 850;
}

.update-status-panel[data-status="checking"] .update-status-symbol,
.update-status-panel[data-status="downloading"] .update-status-symbol {
  animation: update-status-spin 1.2s linear infinite;
}

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

.update-status-copy {
  min-width: 0;
}

.update-status-copy strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
}

.update-status-copy p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.update-status-badge {
  border: 1px solid color-mix(in srgb, var(--update-state) 35%, var(--line));
  border-radius: 4px;
  color: var(--update-state);
  background: var(--surface);
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.update-version-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
  align-items: stretch;
  border-block: 1px solid var(--line);
}

.update-version-row > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 14px 10px;
}

.update-version-row > div:first-child {
  padding-left: 2px;
}

.update-version-row > div.latest {
  padding-right: 2px;
  text-align: right;
}

.update-version-row span {
  color: var(--muted);
  font-size: 11px;
}

.update-version-row strong {
  color: var(--ink);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.update-version-row .latest strong {
  color: #287ca3;
}

.update-version-arrow {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 18px;
}

.update-progress-section,
.update-release-notes {
  display: grid;
  gap: 9px;
}

.update-progress-heading,
.update-progress-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.update-progress-heading strong {
  font-size: 13px;
}

.update-progress-heading span {
  color: #287ca3;
  font-size: 13px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}

.update-progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 5px;
  background: color-mix(in srgb, var(--line) 72%, var(--panel));
}

.update-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #287ca3;
  transition: width 180ms ease;
}

.update-progress-details {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.update-release-notes {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.update-release-notes > strong {
  font-size: 13px;
}

.update-release-notes p {
  max-height: 132px;
  overflow: auto;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.update-data-note {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 10px;
  border: 1px solid color-mix(in srgb, #d39a1d 34%, var(--line));
  background: color-mix(in srgb, #fff6d8 54%, var(--surface));
  padding: 12px 14px;
}

.update-data-note > span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: #19805f;
  font-size: 13px;
  font-weight: 900;
}

.update-data-note strong {
  display: block;
  margin-bottom: 3px;
  font-size: 12px;
}

.update-data-note p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.update-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--line);
  padding: 14px 22px;
}

.update-modal-footer > span {
  color: var(--muted);
  font-size: 11px;
}

.update-modal-footer > div {
  display: flex;
  flex: none;
  gap: 9px;
}

.update-modal-footer button {
  min-width: 108px;
}

.message-focus-header-button {
  width: auto;
  height: 26px;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-left: 6px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.message-focus-header-button:hover {
  color: var(--accent);
  background: var(--accent-soft);
}

.workspace-fullscreen-button {
  min-width: 82px;
  justify-content: center;
  white-space: nowrap;
}

.message-focus-backdrop {
  z-index: 140;
  background: rgba(13, 25, 21, 0.58);
}

.message-focus-modal {
  width: min(1040px, calc(100vw - 32px));
  height: min(860px, calc(100vh - 32px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(11, 29, 22, 0.3);
}

.message-focus-modal:fullscreen,
.message-focus-modal.fullscreen-fallback {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: var(--panel);
}

.message-focus-modal.fullscreen-fallback {
  position: fixed;
  inset: 0;
  z-index: 141;
}

.message-focus-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  padding: 14px 22px;
}

.message-focus-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
}

.message-focus-content {
  overflow: auto;
  padding: 28px max(24px, calc((100% - 900px) / 2));
}

.message-focus-modal:fullscreen .message-focus-content,
.message-focus-modal.fullscreen-fallback .message-focus-content {
  width: 100%;
  max-width: none;
  padding: 24px;
}

.message-focus-modal:fullscreen .message-focus-question,
.message-focus-modal:fullscreen .message-focus-answer,
.message-focus-modal.fullscreen-fallback .message-focus-question,
.message-focus-modal.fullscreen-fallback .message-focus-answer {
  width: 100%;
  max-width: none;
}

.message-focus-question,
.message-focus-answer {
  margin-bottom: 18px;
  padding: 20px 22px;
}

.message-focus-question {
  border-left: 4px solid #287ca3;
  background: color-mix(in srgb, #e7f5fb 66%, var(--surface));
}

.message-focus-answer {
  border-left: 4px solid var(--accent);
  background: var(--surface);
}

.message-focus-question > span,
.message-focus-answer > span {
  display: block;
  margin-bottom: 10px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.message-focus-question img {
  display: block;
  max-width: min(640px, 100%);
  max-height: 460px;
  margin-top: 14px;
  object-fit: contain;
}

@media (max-width: 620px) {
  .settings-modal.general-settings-modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    padding: 14px;
  }

  .settings-section-tabs {
    margin-bottom: 12px;
  }

  .settings-section-tabs button {
    min-height: 44px;
  }

  .activation-status-card {
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 12px;
  }

  .activation-status-icon {
    width: 40px;
    height: 40px;
  }

  .activation-status-card > button {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 44px;
  }

  .activation-machine-code-box {
    grid-template-columns: 1fr;
  }

  .activation-machine-code-box > code,
  .activation-machine-code-box > button {
    grid-column: 1;
  }

  .activation-machine-code-box > button,
  .settings-panel-actions > button {
    width: 100%;
    min-height: 44px;
  }

  .settings-panel-actions {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .message-focus-modal:fullscreen .message-focus-content,
  .message-focus-modal.fullscreen-fallback .message-focus-content {
    padding: 12px;
  }

  .about-modal-header,
  .about-modal-body,
  .about-modal-footer {
    padding-inline: 18px;
  }

  .about-brand-lockup img {
    width: 56px;
    height: 56px;
    flex-basis: 56px;
    border-radius: 12px;
  }

  .about-feature-grid,
  .about-contact-band {
    grid-template-columns: 1fr;
  }

  .about-modal-footer > span {
    display: none;
  }

  .update-modal-header,
  .update-modal-body,
  .update-modal-footer {
    padding-inline: 15px;
  }

  .update-status-panel {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .update-status-symbol {
    width: 38px;
    height: 38px;
  }

  .update-status-badge {
    grid-column: 2;
    width: max-content;
  }

  .update-modal-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .update-modal-footer > span {
    display: none;
  }

  .update-modal-footer > div,
  .update-modal-footer button {
    width: 100%;
  }
}
