:root {
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  color: #202432;
  background: #f1f2f6;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 1080px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% 10%, rgba(117, 71, 184, 0.08), transparent 28%),
    #f1f2f6;
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

.app-header {
  height: 66px;
  padding: 0 26px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid #e5e7ed;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 10;
}

.brand,
.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: linear-gradient(145deg, #3434b8, #7c3cc2);
  color: white;
  font: 800 20px Georgia, serif;
  box-shadow: 0 8px 16px rgba(74, 54, 164, 0.24);
}

.brand strong {
  display: block;
  font-size: 16px;
}

.brand span {
  display: block;
  color: #8a8e9a;
  font-size: 11px;
  margin-top: 2px;
}

.privacy-badge {
  color: #567063;
  background: #eff8f3;
  border: 1px solid #d8ede1;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
}

.ghost-button,
.small-button {
  border: 1px solid #dfe1e8;
  background: white;
  color: #555b6c;
  border-radius: 8px;
  padding: 7px 12px;
}

.settings-wrap {
  position: relative;
}

.settings-button[aria-expanded="true"] {
  color: #5d3fad;
  border-color: #cfc1ef;
  background: #f6f2ff;
}

.settings-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 226px;
  padding: 7px;
  border: 1px solid #e1e2e9;
  border-radius: 12px;
  background: white;
  box-shadow: 0 16px 42px rgba(37, 39, 55, .18);
  z-index: 30;
}

.settings-menu::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 22px;
  width: 11px;
  height: 11px;
  transform: rotate(45deg);
  border-left: 1px solid #e1e2e9;
  border-top: 1px solid #e1e2e9;
  background: white;
}

.settings-menu button {
  width: 100%;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 0;
  border-radius: 8px;
  color: #313544;
  background: transparent;
  text-align: left;
}

.settings-menu button:hover {
  background: #f4f1fb;
}

.settings-menu button > span:first-child {
  font-size: 17px;
  text-align: center;
}

.settings-menu strong,
.settings-menu small {
  display: block;
}

.ai-mode-card {
  margin: -8px 0 18px;
  padding: 12px;
  border: 1px solid #ddd6f3;
  border-radius: 12px;
  background: linear-gradient(135deg, #faf8ff, #f4f8ff);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.work-type-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-bottom: 12px;
  padding: 4px;
  border-radius: 11px;
  background: #ececf2;
}

.work-type-switch button {
  padding: 8px 4px;
  border: 0;
  border-radius: 8px;
  color: #686d7d;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}

.work-type-switch button.active {
  color: white;
  background: linear-gradient(135deg, #4658dc, #8435c4);
}

.blueprint-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.exam-blueprint { border-left: 3px solid #7350bf; padding-left: 14px; }

.ai-mode-card strong,
.ai-mode-card small {
  display: block;
}

.ai-mode-card strong { font-size: 13px; }
.ai-mode-card small { margin-top: 3px; color: #85899a; font-size: 10px; }

.mode-switch {
  display: flex;
  padding: 3px;
  border-radius: 9px;
  background: #e9e7f1;
}

.mode-switch button {
  padding: 6px 9px;
  border: 0;
  border-radius: 7px;
  color: #747887;
  background: transparent;
  font-size: 11px;
}

.mode-switch button.active {
  color: white;
  background: linear-gradient(135deg, #4658dc, #8435c4);
  box-shadow: 0 3px 8px rgba(78, 61, 174, .22);
}

.ai-settings-dialog { width: min(720px, calc(100vw - 48px)); }

.ai-settings-heading {
  display: flex;
  gap: 13px;
  align-items: center;
  padding-right: 42px;
}

.ai-settings-heading h2 { margin: 0; font-size: 22px; }
.ai-settings-heading p { margin: 5px 0 0; color: #7e8291; font-size: 12px; }

.ai-settings-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: white;
  background: linear-gradient(135deg, #4856df, #8735c3);
  font-size: 21px;
}

.ai-security-note {
  margin: 18px 0 14px;
  padding: 10px 12px;
  border: 1px solid #cfe7da;
  border-radius: 9px;
  color: #47705b;
  background: #f1f9f5;
  font-size: 12px;
}

.ai-security-note.invalid { border-color: #efc7c7; color: #a34242; background: #fff4f4; }

.ai-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 13px;
}

.ai-settings-grid label { color: #555b6b; font-size: 12px; }
.ai-settings-grid .wide-field { grid-column: 1 / -1; }
.ai-settings-grid input,
.ai-settings-grid select {
  width: 100%;
  height: 40px;
  margin-top: 6px;
  padding: 0 11px;
  border: 1px solid #dfe1e9;
  border-radius: 8px;
  color: #303544;
  background: white;
}

.model-input-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ai-model-meta { display: flex; justify-content: space-between; margin: 10px 2px 0; color: #9195a2; font-size: 10px; }
.ai-capability-section {
  margin-top: 14px;
  padding: 13px;
  border: 1px solid #e1dcef;
  border-radius: 12px;
  background: #fbfaff;
}

.ai-capability-heading,
.image-model-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ai-capability-heading small,
.image-model-setting small {
  display: block;
  color: #9691a3;
  font-size: 9px;
  line-height: 1.4;
}

.ai-capability-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 10px 0 12px;
}

.ai-capability-item {
  padding: 8px 9px;
  border: 1px solid #e7e4ee;
  border-radius: 9px;
  background: white;
}

.ai-capability-item strong { display: block; margin-bottom: 5px; font-size: 11px; }
.ai-capability-item > small { display: block; margin-top: 5px; color: #9396a1; font-size: 8px; line-height: 1.35; }
.ai-capability-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.capability-badge { padding: 2px 6px; border-radius: 999px; font-size: 8px; background: #eef0f5; color: #666c79; }
.capability-badge.text { background: #eef1ff; color: #4658b7; }
.capability-badge.direct { background: #e9f8ef; color: #30744d; }
.capability-badge.planned { background: #fff5df; color: #976a19; }
.capability-badge.unsupported { background: #f3f3f5; color: #858995; }
.capability-badge.conditional { background: #f2ecfa; color: #7251a1; }

.image-model-setting {
  padding-top: 11px;
  border-top: 1px solid #e5e0ee;
}

.image-model-setting > div { min-width: 0; }
.image-model-setting label { min-width: 260px; color: #555b6b; font-size: 10px; }
.image-model-setting select { width: 100%; height: 36px; margin-top: 5px; padding: 0 9px; border: 1px solid #dfe1e9; border-radius: 8px; background: white; }
.ai-settings-actions { margin-top: 18px; display: grid; grid-template-columns: auto 1fr auto auto auto; gap: 8px; }
.ai-settings-actions .primary-button { width: auto; margin: 0; padding: 8px 16px; }
.danger-button { color: #b54747; }
.ai-settings-result { min-height: 18px; margin: 12px 0 0; color: #6f55b4; font-size: 12px; text-align: right; }

.ai-layout-panel {
  margin: 13px 0;
  padding: 11px;
  border: 1px dashed #cfc5e7;
  border-radius: 10px;
  background: #faf8ff;
}

.ai-layout-panel label { font-size: 12px; font-weight: 700; }
.ai-layout-panel textarea { width: 100%; margin: 7px 0; resize: vertical; }
.ai-layout-panel .small-button { width: 100%; color: #6547aa; }
.ai-layout-panel small { display: block; margin-top: 7px; color: #9991aa; font-size: 9px; line-height: 1.5; }

.primary-button.busy { opacity: .7; cursor: wait; }

@media (max-width: 1180px) {
  .privacy-badge { display: none; }
}

.settings-menu strong {
  font-size: 13px;
}

.settings-menu small {
  margin-top: 2px;
  color: #9295a0;
  font-size: 10px;
}

.app-shell {
  height: calc(100vh - 66px);
  min-height: 0;
  display: grid;
  grid-template-columns: 380px 1fr;
  overflow: hidden;
}

.control-panel {
  height: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #fbfbfd;
  border-right: 1px solid #dfe1e8;
  padding: 24px 22px 54px;
  scrollbar-width: thin;
  scrollbar-color: #c6c8d2 transparent;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 22px;
}

.eyebrow {
  display: block;
  color: #6f55b4;
  font-size: 10px;
  letter-spacing: 1.6px;
  font-weight: 800;
}

.panel-heading h1 {
  margin: 5px 0 0;
  font-size: 23px;
}

.version-pill {
  padding: 5px 9px;
  border-radius: 999px;
  color: #7253b5;
  background: #eee8fa;
  font-size: 11px;
}

.module-section {
  padding: 0 0 20px;
}

.module-section-title {
  color: #878b98;
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 9px;
}

.subject-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  padding: 4px;
  margin-bottom: 14px;
  border-radius: 11px;
  background: #ececf3;
}

.subject-switch button {
  border: 0;
  border-radius: 8px;
  padding: 9px 4px;
  color: #686d7b;
  background: transparent;
  font-weight: 700;
}

.subject-switch button.active {
  color: white;
  background: linear-gradient(100deg, #4452d5, #7e31b4);
  box-shadow: 0 4px 10px rgba(72, 60, 170, .2);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.module-button {
  min-width: 0;
  min-height: 62px;
  border: 1px solid #e0e1e8;
  border-radius: 10px;
  background: white;
  color: #555b6b;
  padding: 8px 3px 7px;
  font-size: 18px;
}

.module-button span {
  display: block;
  margin-top: 4px;
  white-space: nowrap;
  font-size: 10px;
}

.module-button:hover {
  border-color: #9d88d2;
  color: #6545ad;
}

.module-button.active {
  color: white;
  border-color: transparent;
  background: linear-gradient(145deg, #4e55ce, #793bb5);
  box-shadow: 0 6px 14px rgba(86, 68, 176, .22);
}

.form-section {
  padding: 18px 0 20px;
  border-top: 1px solid #e8e9ee;
}

.form-section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 13px;
}

.section-title h2 {
  font-size: 14px;
  margin: 0;
}

.step-number {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 7px;
  background: #ece9f8;
  color: #6846ae;
  font-size: 11px;
  font-weight: 800;
}

label {
  display: block;
  color: #555b6c;
  font-size: 12px;
  margin-bottom: 11px;
}

input[type="text"],
input:not([type]),
textarea,
select {
  width: 100%;
  border: 1px solid #d9dbe3;
  border-radius: 9px;
  background: white;
  padding: 10px 11px;
  margin-top: 6px;
  color: #252936;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

textarea {
  resize: vertical;
  line-height: 1.5;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #7a5cc0;
  box-shadow: 0 0 0 3px rgba(122, 92, 192, 0.1);
}

.primary-button,
.upload-button,
.generate-button,
.edit-button,
.export-button {
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 700;
}

.primary-button {
  border: 0;
  color: white;
  margin-bottom: 9px;
}

.gradient {
  background: linear-gradient(100deg, #4452d5, #7e31b4);
  box-shadow: 0 7px 16px rgba(76, 64, 181, 0.18);
}

.upload-button {
  border: 1px dashed #c9cad2;
  background: white;
  color: #626777;
  margin: 0;
  cursor: pointer;
}

.image-generation-options {
  display: grid;
  grid-template-columns: 125px 1fr;
  align-items: end;
  gap: 9px;
  margin: -1px 0 9px;
}

.image-generation-options label {
  margin: 0;
  color: #777b88;
  font-size: 10px;
}

.image-generation-options select {
  height: 34px;
  margin-top: 4px;
  padding: 0 7px;
  font-size: 11px;
}

.image-generation-options span {
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid #e0e2e9;
  border-radius: 8px;
  color: #777b88;
  background: #f8f9fb;
  font-size: 9px;
  line-height: 1.45;
}

.image-generation-options span.direct {
  border-color: #cfe7d8;
  color: #397456;
  background: #f1faf5;
}

.image-preview-dialog { width: min(760px, calc(100vw - 48px)); }
.image-preview-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 15px; padding-right: 42px; }
.image-preview-heading span { color: #7551b2; font-size: 9px; font-weight: 800; letter-spacing: .18em; }
.image-preview-heading h2 { margin: 4px 0 0; font-size: 22px; }
.image-preview-heading small { color: #9498a5; font-size: 10px; }
.generated-image-frame { margin-top: 17px; padding: 9px; border-radius: 14px; background: #f0f1f5; }
.generated-image-frame img { display: block; width: 100%; max-height: 55vh; object-fit: contain; border-radius: 9px; background: white; }
.image-preview-note { margin: 10px 0; color: #8b8e99; font-size: 10px; }
.image-preview-actions { display: flex; justify-content: flex-end; gap: 9px; }
.image-preview-actions .primary-button { width: auto; margin: 0; padding: 8px 18px; }

.microcopy {
  color: #a0a3ad;
  font-size: 10px;
  margin: 8px 0 0;
  text-align: center;
}

.check-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 5px 0 17px;
}

.check-grid label {
  margin: 0;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: #303544;
}

.question-type-row {
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #e2e3eb;
  border-radius: 10px;
  background: #fff;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.check-grid .question-type-toggle-label {
  min-width: 0;
  font-weight: 600;
}

.question-type-toggle-label span {
  white-space: normal;
}

.check-grid .question-count-label {
  gap: 4px;
  color: #777b88;
  font-size: 11px;
  white-space: nowrap;
}

.question-count-input {
  width: 44px;
  min-width: 44px;
  margin: 0;
  padding: 5px 4px;
  border-radius: 7px;
  text-align: center;
  font-size: 12px;
}

.question-count-input:disabled {
  opacity: .45;
  background: #f1f2f6;
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #604bb0;
}

.json-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: -4px;
}

.json-actions span {
  font-size: 11px;
  color: #9a9da8;
}

.json-actions span.valid {
  color: #2f8b58;
}

.json-actions span.invalid {
  color: #c24848;
}

.generate-button {
  color: white;
  border: 0;
  background: linear-gradient(100deg, #172b48, #263a53);
  box-shadow: 0 8px 18px rgba(23, 43, 72, 0.17);
  margin-bottom: 9px;
}

.edit-button {
  color: white;
  border: 0;
  background: #3d9a45;
  margin-bottom: 15px;
}

.edit-button.active {
  background: #c44230;
}

.setting-row {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 8px;
  align-items: center;
  margin: 10px 0 13px;
}

.setting-row span {
  color: #777b88;
  font-size: 12px;
}

.setting-row select {
  margin: 0;
}

.teaching-settings {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 8px;
}

.teaching-settings label {
  margin: 0;
}

.teaching-settings select {
  padding: 9px 6px;
  font-size: 11px;
}

.teaching-copy {
  text-align: left;
  margin-top: 9px;
}

.setting-label {
  color: #777b88;
  font-size: 12px;
  margin: 13px 0 7px;
}

.color-picker {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 13px 0;
}

.color-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid white;
  background: var(--dot);
  box-shadow: 0 0 0 1px #d5d6dc;
}

.color-dot.active {
  box-shadow: 0 0 0 2px #303543, 0 4px 10px rgba(0, 0, 0, 0.18);
}

.segmented-control {
  background: #ececf1;
  padding: 3px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: 10px;
}

.segmented-control button {
  border: 0;
  padding: 8px;
  color: #777b87;
  background: transparent;
  border-radius: 8px;
}

.segmented-control button.active {
  color: #2c303c;
  font-weight: 700;
  background: white;
  box-shadow: 0 2px 6px rgba(32, 36, 50, 0.09);
}

.export-button {
  border: 1px solid #d9dbe3;
  background: white;
  color: #454b5b;
  margin-bottom: 9px;
}

.bundle-button {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 9px;
  margin-bottom: 10px;
  color: white;
  font-weight: 800;
  background: linear-gradient(100deg, #7046b9, #375fd0);
  box-shadow: 0 8px 18px rgba(74, 70, 180, .2);
}

.export-button:hover,
.ghost-button:hover,
.small-button:hover {
  border-color: #9782ca;
  color: #6545ad;
}

.export-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.workspace {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.workspace-toolbar {
  height: 58px;
  background: rgba(247, 247, 250, 0.94);
  border-bottom: 1px solid #e1e2e8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.workspace-toolbar strong {
  display: block;
  font-size: 13px;
}

.workspace-toolbar span {
  color: #9295a0;
  font-size: 10px;
}

.zoom-control {
  display: flex;
  align-items: center;
  background: white;
  border: 1px solid #dedfe5;
  border-radius: 9px;
  overflow: hidden;
}

.zoom-control button {
  width: 34px;
  height: 30px;
  border: 0;
  background: white;
  color: #4d5362;
}

.zoom-control span {
  width: 50px;
  color: #616675;
  text-align: center;
}

.preview-scroll {
  flex: 1;
  overflow: auto;
  padding: 34px 42px 90px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.page-scale {
  transform: scale(0.82);
  transform-origin: top center;
  width: 794px;
  margin-bottom: -230px;
  transition: transform 0.2s ease;
}

.worksheet-page {
  --accent: #b53645;
  --ai-font-size: 13px;
  --ai-answer-height: 0px;
  width: 794px;
  min-height: 1123px;
  background: #fffefc;
  color: #303034;
  box-shadow: 0 18px 50px rgba(30, 33, 46, 0.17);
  padding: 48px 54px 34px;
  position: relative;
  font-family: Georgia, "Times New Roman", "Microsoft YaHei", serif;
}

.worksheet-page .question-item { font-size: var(--ai-font-size); }
.worksheet-page.ai-answer-large .question-item { padding-bottom: calc(12px + var(--ai-answer-height)); }
.worksheet-page.ai-density-compact .question-section { margin-top: 10px; }
.worksheet-page.ai-density-spacious .question-section { margin-top: 25px; }
.worksheet-page.ai-header-simple .worksheet-kicker,
.worksheet-page.ai-header-simple .paper-badge { display: none; }

.worksheet-header {
  text-align: center;
  border-bottom: 3px double var(--accent);
  padding-bottom: 15px;
  margin-bottom: 22px;
}

.worksheet-kicker {
  color: var(--accent);
  font: 700 10px "Segoe UI", sans-serif;
  letter-spacing: 3.6px;
}

.worksheet-header h1 {
  margin: 6px 0 14px;
  font: 800 30px "Microsoft YaHei", sans-serif;
  letter-spacing: 2px;
}

.paper-badge {
  display: inline-block;
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, white);
  border-radius: 999px;
  padding: 3px 9px;
  margin: -4px 0 12px;
  font: 700 10px "Microsoft YaHei", sans-serif;
}

.student-meta {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  color: #60636c;
  font: 11px "Microsoft YaHei", sans-serif;
}

.exam-meta {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-top: 11px;
  color: #484b55;
  font: 11px "Microsoft YaHei", sans-serif;
}

.exam-score-table {
  width: 100%;
  margin-top: 14px;
  border-collapse: collapse;
  font: 10px "Microsoft YaHei", sans-serif;
}

.exam-score-table th,
.exam-score-table td {
  height: 25px;
  border: 1px solid #777;
  text-align: center;
}

.worksheet-page.layout-exam {
  --accent: #263b65;
  background: #fff;
  padding: 39px 48px 34px;
  color: #202127;
}

.worksheet-page.layout-exam .worksheet-header {
  border-bottom: 2px solid #222;
  margin-bottom: 17px;
}

.worksheet-page.layout-exam .worksheet-header h1 { font-size: 27px; margin-bottom: 9px; }
.worksheet-page.layout-exam .paper-badge { border-color: #777; color: #333; }
.worksheet-page.layout-exam .question-section { break-inside: auto; margin-top: 14px; }
.worksheet-page.layout-exam .question-section h3 { color: #222; border-bottom-color: #999; }
.worksheet-page.layout-exam .question-index { background: #222; }
.worksheet-page.layout-exam .worksheet-footer { border-top-color: #777; color: #555; }

.hero-grid {
  display: grid;
  grid-template-columns: 1.55fr 0.85fr;
  gap: 22px;
  align-items: stretch;
}

.worksheet-page.module-no-image .hero-grid {
  display: none;
}

.worksheet-page.no-vocab:not(.module-no-image) .hero-grid {
  grid-template-columns: 1fr;
}

.worksheet-page.no-vocab .vocabulary-box {
  display: none;
}

.article-image-wrap {
  min-height: 226px;
  overflow: hidden;
  position: relative;
  border-radius: 3px;
  background: #ede7dd;
}

.article-image-wrap img {
  width: 100%;
  height: 226px;
  object-fit: cover;
  display: block;
}

.image-caption {
  position: absolute;
  left: 12px;
  bottom: 10px;
  color: white;
  background: rgba(21, 20, 27, 0.6);
  padding: 5px 8px;
  font: 700 8px "Segoe UI", sans-serif;
  letter-spacing: 1.3px;
}

.vocabulary-box {
  border-left: 3px solid var(--accent);
  padding: 9px 0 8px 16px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 8%, white), white);
}

.vocabulary-box h2 {
  color: var(--accent);
  font: 800 17px "Microsoft YaHei", sans-serif;
  margin: 0 0 10px;
}

.vocab-item {
  font-size: 11.5px;
  line-height: 1.48;
  margin: 0 0 5px;
}

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

.article-section {
  margin-top: 20px;
}

.article-title {
  text-align: center;
  color: var(--accent);
  font-size: 22px;
  margin: 0 0 11px;
}

.article-text {
  white-space: pre-line;
  font-size: 13.5px;
  line-height: 1.56;
  text-align: justify;
}

.question-section {
  margin-top: 21px;
  break-inside: avoid;
}

.question-section h3 {
  margin: 0 0 10px;
  padding-bottom: 5px;
  color: var(--accent);
  font: 800 15px "Microsoft YaHei", sans-serif;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 34%, white);
}

.question-section h3 span {
  color: white;
  display: inline-grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 7px;
  font-size: 11px;
}

.question-item {
  margin: 0 0 9px;
  font-size: 12.5px;
  line-height: 1.55;
}

.option-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 18px;
  margin: 5px 0 0 17px;
}

.answer {
  display: none;
  color: #276d46;
  background: #edf8f1;
  border-left: 3px solid #4d9c6d;
  padding: 6px 9px;
  margin-top: 5px;
  font: 11px "Microsoft YaHei", sans-serif;
}

.mode-teacher .answer {
  display: block;
}

.worksheet-footer {
  margin-top: 25px;
  border-top: 1px solid #dedbd6;
  padding-top: 10px;
  color: #99958d;
  display: flex;
  justify-content: space-between;
  font: 9px "Segoe UI", sans-serif;
  letter-spacing: 1px;
}

.worksheet-page.editing .editable,
.worksheet-page.editing .question-item,
.worksheet-page.editing .vocab-item {
  outline: 1px dashed #3d9a45;
  outline-offset: 3px;
  cursor: text;
}

/* 彩色卡片版 */
.worksheet-page.template-modern {
  background: #fbfbff;
  padding: 42px 48px 32px;
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
}

.template-modern .worksheet-header {
  text-align: left;
  border: 0;
  border-radius: 18px;
  padding: 24px 28px;
  color: white;
  background:
    linear-gradient(115deg, color-mix(in srgb, var(--accent) 88%, #273459), var(--accent));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 22%, transparent);
}

.template-modern .worksheet-kicker,
.template-modern .student-meta {
  color: rgba(255,255,255,.84);
}

.template-modern .paper-badge {
  color: white;
  border-color: rgba(255,255,255,.55);
}

.template-modern .worksheet-header h1 {
  margin: 5px 0 15px;
}

.template-modern .hero-grid {
  margin-top: 18px;
  grid-template-columns: 1.25fr 0.75fr;
}

.template-modern .article-image-wrap,
.template-modern .vocabulary-box,
.template-modern .article-section,
.template-modern .question-section {
  border-radius: 15px;
  box-shadow: 0 8px 22px rgba(38, 40, 70, 0.08);
}

.template-modern .vocabulary-box {
  border: 0;
  padding: 18px;
}

.template-modern .article-section {
  background: white;
  padding: 20px 24px;
}

.template-modern .article-title {
  text-align: left;
  font-family: Georgia, serif;
}

.template-modern .article-text {
  font-family: Georgia, "Times New Roman", serif;
}

.template-modern .question-section {
  background: white;
  padding: 17px 20px;
}

.template-modern .question-section h3 {
  border: 0;
}

/* 紧凑双栏版 */
.worksheet-page.template-compact {
  padding: 36px 42px 28px;
}

.template-compact .worksheet-header {
  text-align: left;
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  align-items: end;
  border-bottom: 2px solid var(--accent);
}

.template-compact .worksheet-kicker {
  grid-column: 1 / -1;
}

.template-compact .worksheet-header h1 {
  text-align: left;
  font-size: 25px;
  margin-bottom: 8px;
}

.template-compact .student-meta {
  grid-template-columns: 1fr;
  gap: 2px;
  text-align: right;
}

.template-compact .hero-grid {
  grid-template-columns: 1.15fr .85fr;
  gap: 15px;
}

.template-compact .article-image-wrap,
.template-compact .article-image-wrap img {
  height: 180px;
  min-height: 180px;
}

.template-compact .vocabulary-box {
  columns: 2;
  column-gap: 10px;
  font-size: 9px;
}

.template-compact .vocabulary-box h2 {
  column-span: all;
  font-size: 14px;
}

.template-compact .vocab-item {
  font-size: 9px;
}

.template-compact .article-section {
  margin-top: 14px;
}

.template-compact .article-title {
  font-size: 18px;
  margin-bottom: 6px;
}

.template-compact .article-text {
  columns: 2;
  column-gap: 26px;
  column-rule: 1px solid #e0ded9;
  font-size: 11.5px;
  line-height: 1.45;
}

.template-compact #questionsContainer {
  columns: 2;
  column-gap: 24px;
}

.template-compact .question-section {
  margin-top: 14px;
  display: inline-block;
  width: 100%;
}

.template-compact .question-item {
  font-size: 10.5px;
}

.template-compact .option-grid {
  grid-template-columns: 1fr;
}

/* 各模块专属作答结构 */
.response-area {
  margin: 7px 0 4px 17px;
  color: #72757d;
  font: 10px "Microsoft YaHei", sans-serif;
  break-inside: avoid;
}

.response-area i {
  display: block;
  min-height: 18px;
  border-bottom: 1px solid #bbbcc2;
}

.response-choice,
.response-inline {
  display: flex;
  align-items: end;
  gap: 6px;
}

.response-choice i {
  width: 72px;
}

.response-inline {
  display: inline-flex;
  vertical-align: middle;
  margin: 0 0 0 8px;
}

.response-inline i {
  width: 58px;
}

.response-ruled i,
.response-ancient i,
.response-work-lines i {
  min-height: 21px;
}

.response-vocabulary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.response-vocabulary i {
  height: 24px;
  border: 1px solid #c9cbd1;
  background: linear-gradient(to bottom, transparent 48%, #d9dbe0 50%, transparent 52%);
}

.response-character-boxes {
  display: flex;
  gap: 5px;
}

.response-character-boxes i {
  width: 28px;
  height: 28px;
  min-height: 28px;
  border: 1px solid #aeb1b8;
  background:
    linear-gradient(45deg, transparent 49%, #e4e5e8 50%, transparent 51%),
    linear-gradient(-45deg, transparent 49%, #e4e5e8 50%, transparent 51%);
}

.response-writing .writing-outline {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0 7px;
  margin-bottom: 9px;
}

.response-writing .writing-outline i {
  grid-column: 2;
}

.writing-grid {
  height: 168px;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, #b7b8bd);
  background-image:
    linear-gradient(to right, #d8d9dd 1px, transparent 1px),
    linear-gradient(to bottom, #d8d9dd 1px, transparent 1px);
  background-size: 28px 28px;
}

.response-picture-writing .observation-row {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr auto 1fr;
  gap: 7px;
  align-items: end;
  margin-bottom: 10px;
}

.response-picture-writing .writing-grid {
  height: 196px;
}

.response-error-card,
.response-solution-card {
  border: 1px solid #d6d7dc;
  border-radius: 6px;
  overflow: hidden;
}

.response-error-card > div,
.response-solution-card > div {
  display: grid;
  grid-template-columns: 62px 1fr;
  min-height: 35px;
  border-bottom: 1px solid #e2e3e6;
}

.response-error-card > div:last-child,
.response-solution-card > div:last-child {
  border-bottom: 0;
}

.response-error-card b,
.response-solution-card b {
  display: grid;
  place-items: center;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, white);
  border-right: 1px solid #e2e3e6;
}

.response-error-card i,
.response-solution-card i {
  margin: 0 10px;
  min-height: 28px;
}

.response-error-card .correction,
.response-solution-card > div:nth-child(2) {
  min-height: 59px;
}

.response-geometry {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 7px;
  align-items: end;
}

/* 单词默写：词表式双栏，便于遮挡中文或英文后默写。 */
.worksheet-page.layout-vocabulary .article-section {
  padding: 13px 16px;
  border: 1px solid #dedfe3;
  border-left: 4px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 3%, white);
}

.worksheet-page.layout-vocabulary #questionsContainer {
  columns: 2;
  column-gap: 24px;
}

.worksheet-page.layout-vocabulary .question-section {
  display: inline-block;
  width: 100%;
  margin-top: 16px;
}

/* 语法与翻译：句子练习更强调横线和对照留白。 */
.worksheet-page.layout-grammar .question-item,
.worksheet-page.layout-translation .question-item,
.worksheet-page.layout-language-use .question-item {
  padding: 5px 0;
}

.worksheet-page.layout-translation .question-section:nth-child(even) {
  padding-left: 15px;
  border-left: 3px solid color-mix(in srgb, var(--accent) 25%, white);
}

/* 作文与看图写话：题目要求在上，连续书写方格在下。 */
.worksheet-page.layout-writing .article-section,
.worksheet-page.layout-picture-writing .article-section {
  padding: 16px 19px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, #ddd);
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 4%, white);
}

.worksheet-page.layout-writing .question-section,
.worksheet-page.layout-picture-writing .question-section {
  break-inside: auto;
}

/* 错题重练：每题都是一张错因、方法、订正卡。 */
.worksheet-page.layout-error-review .question-item {
  margin: 12px 0 17px;
  padding: 11px;
  border: 1px solid #d9dade;
  border-radius: 8px;
  background: #fff;
  break-inside: avoid;
}

.worksheet-page.layout-error-review .response-error-card {
  margin-left: 0;
}

/* 口算与每日练：多栏紧凑题列。 */
.worksheet-page.layout-math-mental #questionsContainer,
.worksheet-page.layout-math-daily #questionsContainer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 24px;
}

.worksheet-page.layout-math-mental .question-section,
.worksheet-page.layout-math-daily .question-section {
  margin-top: 15px;
}

.worksheet-page.layout-math-mental .question-item,
.worksheet-page.layout-math-daily .question-item {
  padding: 5px 7px;
  border-bottom: 1px dashed #d4d5d9;
}

/* 竖式计算和方程：固定演算步骤线。 */
.worksheet-page.layout-math-calculation .question-item,
.worksheet-page.layout-math-equation .question-item {
  padding: 9px 12px;
  margin-bottom: 12px;
  border: 1px solid #dfe0e4;
  border-radius: 6px;
  break-inside: avoid;
}

.worksheet-page.layout-math-calculation .response-work-lines,
.worksheet-page.layout-math-equation .response-work-lines {
  margin-left: 0;
}

/* 应用题和几何：把思路、公式、列式、答案分开。 */
.worksheet-page.layout-math-word .question-item,
.worksheet-page.layout-math-geometry .question-item {
  margin-bottom: 17px;
  break-inside: avoid;
}

.worksheet-page.layout-math-word .response-solution-card,
.worksheet-page.layout-math-geometry .response-geometry {
  margin-left: 0;
}

/* 字词基础：田字格；古诗文：宽松横线，接近默写纸。 */
.worksheet-page.layout-chinese-basics #questionsContainer {
  columns: 2;
  column-gap: 22px;
}

.worksheet-page.layout-chinese-basics .question-section {
  display: inline-block;
  width: 100%;
}

.worksheet-page.layout-ancient .article-text {
  text-align: center;
  font-size: 16px;
  line-height: 2;
  letter-spacing: 2px;
}

.worksheet-page.layout-ancient .response-ancient i {
  min-height: 27px;
}

/* 专属结构优先于“紧凑双栏”模板的通用规则。 */
.template-compact.layout-writing #questionsContainer,
.template-compact.layout-picture-writing #questionsContainer,
.template-compact.layout-error-review #questionsContainer,
.template-compact.layout-math-calculation #questionsContainer,
.template-compact.layout-math-equation #questionsContainer,
.template-compact.layout-math-word #questionsContainer,
.template-compact.layout-math-geometry #questionsContainer {
  columns: auto;
}

.mode-teacher .response-area {
  opacity: .58;
}

.about-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(22, 25, 37, .52);
  backdrop-filter: blur(5px);
}

.about-dialog {
  width: min(620px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  position: relative;
  border: 1px solid rgba(255,255,255,.8);
  border-radius: 22px;
  padding: 28px;
  background:
    radial-gradient(circle at 90% 0, rgba(117,71,184,.13), transparent 30%),
    #fff;
  box-shadow: 0 28px 80px rgba(17, 20, 35, .28);
}

.about-close {
  position: absolute;
  top: 15px;
  right: 16px;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  color: #787c88;
  background: #f0f1f5;
  font-size: 22px;
  line-height: 1;
}

.about-close:hover {
  color: #4f32a1;
  background: #ece6fb;
}

.about-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-right: 36px;
}

.about-brand-mark {
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  display: grid;
  place-items: center;
  border-radius: 17px;
  color: white;
  background: linear-gradient(145deg, #3434b8, #7c3cc2);
  box-shadow: 0 12px 24px rgba(74, 54, 164, .25);
  font: 800 29px Georgia, serif;
}

.about-brand span {
  color: #7b5bbc;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 2px;
}

.about-brand h2 {
  margin: 3px 0 6px;
  font-size: 22px;
}

.about-brand p {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: #656a78;
  font-size: 11px;
}

.integrity-badge {
  padding: 3px 7px;
  border-radius: 999px;
  color: #397057 !important;
  background: #eaf7f0;
  letter-spacing: 0 !important;
  font-size: 9px !important;
}

.integrity-badge.invalid {
  color: #a23d3d !important;
  background: #fdeaea;
}

.about-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 24px 0 18px;
  padding: 4px;
  border-radius: 11px;
  background: #f0f0f5;
}

.about-tabs button {
  padding: 9px;
  border: 0;
  border-radius: 8px;
  color: #6d7180;
  background: transparent;
  font-weight: 700;
}

.about-tabs button.active {
  color: white;
  background: linear-gradient(100deg, #4452d5, #7e31b4);
  box-shadow: 0 5px 12px rgba(72, 60, 170, .22);
}

.about-panel {
  display: none;
}

.about-panel.active {
  display: block;
}

.about-feature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.about-feature-grid > div {
  display: grid;
  grid-template-columns: 30px 1fr;
  padding: 13px;
  border: 1px solid #e5e6ec;
  border-radius: 11px;
  background: #fbfbfd;
}

.about-feature-grid > div > span {
  grid-row: 1 / 3;
  font-size: 19px;
}

.about-feature-grid strong,
.about-feature-grid small {
  display: block;
}

.about-feature-grid strong {
  font-size: 12px;
}

.about-feature-grid small {
  margin-top: 3px;
  color: #8b8f9b;
  font-size: 10px;
}

.about-note {
  margin: 14px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  color: #667069;
  background: #eff8f3;
  font-size: 10px;
  text-align: center;
}

.developer-summary {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 14px;
}

.developer-avatar {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: white;
  background: linear-gradient(145deg, #4746c8, #8a3ebc);
  font-weight: 800;
}

.developer-summary small,
.developer-summary strong {
  display: block;
}

.developer-summary small {
  color: #9699a4;
  font-size: 9px;
}

.developer-summary strong {
  margin: 2px 0;
  font-size: 18px;
}

.developer-summary p {
  margin: 0;
  color: #717582;
  font-size: 10px;
}

.developer-card-frame {
  width: min(286px, 100%);
  margin: 0 auto;
  padding: 10px;
  border: 1px solid #e1e2e7;
  border-radius: 15px;
  background: white;
  box-shadow: 0 10px 30px rgba(37, 39, 55, .09);
}

.developer-card-frame img {
  width: 100%;
  max-height: 356px;
  display: block;
  border-radius: 10px;
  object-fit: contain;
}

.developer-tip {
  margin: 12px 0 0;
  color: #777b88;
  font-size: 10px;
  text-align: center;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  max-width: 380px;
  color: white;
  background: #262c3a;
  padding: 11px 16px;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(25, 28, 40, 0.25);
  font-size: 13px;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@page {
  size: A4;
  margin: 12mm 14mm;
}

.worksheet-page .question-item { font-size: var(--ai-font-size) !important; }
.worksheet-page.ai-answer-large .question-item { padding-bottom: calc(12px + var(--ai-answer-height)) !important; }

@media print {
  :root {
    background: white !important;
  }

  html,
  body {
    width: auto;
    min-width: 0;
    min-height: 0;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    background: white !important;
  }

  .no-print,
  .control-panel,
  .workspace-toolbar {
    display: none !important;
  }

  .app-shell,
  .workspace,
  .preview-scroll,
  .page-scale {
    display: block;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    transform: none !important;
  }

  .worksheet-page {
    width: 100%;
    min-height: 0;
    padding: 0 !important;
    box-shadow: none;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

/* 小芽老师 · soft product UI theme
   Aligns the desktop product surface with the light, rounded UI language used
   in the AI worksheet product video. Functional selectors and print layout
   remain unchanged. */
:root {
  --ui-bg: #f5f7ff;
  --ui-surface: #ffffff;
  --ui-surface-soft: #f9faff;
  --ui-ink: #1f2b45;
  --ui-muted: #7c88a2;
  --ui-border: #e4e8f3;
  --ui-purple: #6246ea;
  --ui-purple-2: #8b5cf6;
  --ui-cyan: #18b8df;
  --ui-green: #27b87a;
  --ui-shadow: 0 14px 34px rgba(75, 74, 166, .10);
}

body {
  color: var(--ui-ink);
  background:
    radial-gradient(circle at 90% 8%, rgba(139, 92, 246, .10), transparent 28%),
    radial-gradient(circle at 42% 100%, rgba(24, 184, 223, .07), transparent 34%),
    var(--ui-bg);
}

.app-header {
  height: 82px;
  padding: 0 36px;
  border-bottom-color: var(--ui-border);
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 5px 18px rgba(71, 80, 138, .05);
}

.brand { gap: 14px; }
.brand-mark,
.about-brand-mark,
.developer-avatar {
  border-radius: 16px;
  background: linear-gradient(145deg, var(--ui-purple), var(--ui-purple-2));
  box-shadow: 0 12px 24px rgba(98, 70, 234, .20);
}
.brand-mark { width: 46px; height: 46px; font-size: 23px; }
.brand-mark {
  width: 52px;
  height: 52px;
  font-size: 0;
  border-radius: 18px;
}
.brand-mark::before {
  content: "芽";
  color: #fff;
  font: 900 24px "Microsoft YaHei", sans-serif;
  line-height: 1;
}
.brand strong { color: var(--ui-ink); font-size: 17px; letter-spacing: .1px; }
.brand span { color: var(--ui-muted); font-size: 11px; }

.privacy-badge {
  color: #4f7c69;
  background: #effaf5;
  border-color: #d6efe2;
  padding: 8px 14px;
}

.ghost-button,
.small-button {
  border-color: #dfe4f0;
  border-radius: 12px;
  color: #5c6880;
  background: #fff;
  padding: 9px 14px;
}
.ghost-button:hover,
.small-button:hover,
.export-button:hover { border-color: #b9aaf7; color: var(--ui-purple); background: #fbfaff; }

.app-shell { height: calc(100vh - 82px); grid-template-columns: 424px 1fr; }
.control-panel {
  padding: 30px 26px 70px;
  background: linear-gradient(180deg, #ffffff 0%, #f7f8ff 100%);
  border-right-color: var(--ui-border);
  scrollbar-color: #c8c7f5 transparent;
}
.panel-heading { margin-bottom: 22px; }
.panel-heading h1 { color: var(--ui-ink); font-size: 28px; letter-spacing: -.6px; }
.eyebrow { color: var(--ui-purple); letter-spacing: 2px; }
.version-pill { color: #694de2; background: #f0ecff; border: 1px solid #e2dafe; }

.work-type-switch,
.subject-switch,
.segmented-control,
.about-tabs {
  border-radius: 18px;
  background: #f0f1f8;
  padding: 6px;
  box-shadow: inset 0 1px 2px rgba(61, 68, 112, .05);
}
.work-type-switch button,
.subject-switch button { border-radius: 13px; padding: 12px 4px; color: #68748d; font-size: 13px; }
.work-type-switch button.active,
.subject-switch button.active,
.about-tabs button.active {
  background: linear-gradient(110deg, var(--ui-purple), var(--ui-purple-2));
  box-shadow: 0 8px 18px rgba(98, 70, 234, .18);
}
.module-section-title { color: #71809c; margin: 14px 0 10px; }
.module-grid { gap: 11px; }
.module-button {
  min-height: 82px;
  border-color: var(--ui-border);
  border-radius: 19px;
  color: #55627d;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 8px 18px rgba(75, 74, 166, .07);
}
.module-button:hover { border-color: #b9aaf7; color: var(--ui-purple); background: #fff; }
.module-button.active {
  background: linear-gradient(145deg, #5f4ce5, #8746dc);
  box-shadow: 0 14px 28px rgba(98, 70, 234, .28);
}
.module-button span { margin-top: 7px; font-size: 11px; font-weight: 700; }

.ai-mode-card {
  margin: 8px 0 18px;
  padding: 15px;
  border-color: #ddd8ff;
  border-radius: 18px;
  background: linear-gradient(135deg, #fbfaff, #f0f8ff);
  box-shadow: var(--ui-shadow);
}
.ai-mode-card strong { color: var(--ui-ink); font-size: 14px; }
.ai-mode-card small { color: var(--ui-muted); }
.mode-switch { border-radius: 12px; background: #eceaf8; padding: 4px; }
.mode-switch button { border-radius: 9px; padding: 7px 10px; }
.mode-switch button.active { background: linear-gradient(110deg, var(--ui-purple), var(--ui-purple-2)); box-shadow: 0 5px 12px rgba(98,70,234,.16); }

.form-section {
  margin: 17px 0;
  padding: 21px;
  border: 1px solid #e0e4f0;
  border-radius: 24px;
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 12px 28px rgba(75, 74, 166, .07);
}
.form-section:first-of-type { padding-top: 21px; }
.section-title { margin-bottom: 16px; }
.section-title h2 { color: var(--ui-ink); font-size: 15px; }
.step-number { width: 25px; height: 25px; border-radius: 9px; color: var(--ui-purple); background: #f0edff; }
label { color: #65728e; }
input[type="text"], input:not([type]), textarea, select,
.ai-settings-grid input, .ai-settings-grid select,
.image-model-setting select {
  border-color: #dfe4f0;
  border-radius: 12px;
  color: var(--ui-ink);
  background: #fff;
}
input:focus, textarea:focus, select:focus { border-color: #8b78ef; box-shadow: 0 0 0 4px rgba(98,70,234,.11); }

.primary-button,
.bundle-button {
  min-height: 52px;
  border-radius: 16px;
  background: linear-gradient(110deg, var(--ui-purple), var(--ui-purple-2));
  box-shadow: 0 13px 26px rgba(98,70,234,.24);
  font-size: 14px;
}
.generate-button {
  min-height: 52px;
  border-radius: 16px;
  background: linear-gradient(110deg, #5b4be3, #8144d8);
  box-shadow: 0 13px 26px rgba(91,75,227,.22);
  font-size: 14px;
}
.edit-button { min-height: 52px; border-radius: 16px; background: linear-gradient(110deg, #20b57c, #48d69e); box-shadow: 0 12px 24px rgba(39,184,122,.20); }
.edit-button.active { background: linear-gradient(110deg, #e46861, #ef8a72); }
.upload-button { min-height: 48px; border-radius: 14px; border-color: #cbd2e4; color: #60708f; background: #fff; }
.image-generation-options span { border-radius: 10px; background: #f7f9fe; }

.question-type-row {
  padding: 11px 12px;
  border-color: var(--ui-border);
  border-radius: 14px;
  background: #fff;
}
.check-grid { gap: 9px; }
input[type="checkbox"] { accent-color: var(--ui-purple); }
.question-count-input { border-radius: 9px; }
.ai-layout-panel { border-radius: 16px; border-color: #c9bafc; background: #fbfaff; }
.segmented-control button { border-radius: 11px; }
.segmented-control button.active { color: var(--ui-purple); }

.workspace-toolbar {
  height: 80px;
  padding: 0 38px;
  background: rgba(255, 255, 255, .94);
  border-bottom-color: var(--ui-border);
}
.workspace-toolbar strong { color: var(--ui-ink); font-size: 17px; }
.workspace-toolbar span { color: var(--ui-muted); }
.zoom-control { border-color: #dfe4f0; border-radius: 14px; box-shadow: 0 4px 12px rgba(75,74,166,.05); }
.preview-scroll {
  padding: 52px 58px 110px;
  background:
    radial-gradient(circle at 54% 8%, rgba(139,92,246,.12), transparent 30%),
    linear-gradient(180deg, #f4f5ff, #f8faff 65%, #f5f9ff);
}
.worksheet-page {
  border-radius: 14px;
  box-shadow: 0 30px 78px rgba(65, 73, 132, .22);
}

.about-overlay { background: rgba(42, 48, 79, .42); backdrop-filter: blur(8px); }
.about-dialog {
  border-color: #e8e8ff;
  border-radius: 28px;
  background: radial-gradient(circle at 92% 0, rgba(139,92,246,.13), transparent 32%), #fff;
  box-shadow: 0 30px 90px rgba(47, 51, 95, .24);
}
.about-close { border-radius: 12px; background: #f0f1fa; }
.about-feature-grid > div { border-color: var(--ui-border); border-radius: 16px; background: #fbfcff; }
.developer-card-frame { border-color: var(--ui-border); border-radius: 18px; box-shadow: var(--ui-shadow); }
.ai-settings-icon { border-radius: 16px; background: linear-gradient(145deg, var(--ui-purple), var(--ui-purple-2)); }
.ai-security-note { border-radius: 14px; }
.ai-capability-section { border-radius: 18px; background: #fbfcff; }
.ai-capability-item { border-radius: 13px; }

.toast { border-radius: 14px; box-shadow: 0 14px 32px rgba(25,28,40,.2); }

.tool-navigation { display: flex; gap: 8px; align-items: center; }
.tool-navigation a { color: #694de2; text-decoration: none; padding: 9px 10px; border-radius: 10px; white-space: nowrap; font-size: 13px; }
.tool-navigation a:hover { background: #f0ecff; }
.preview-canvas { position: relative; flex: 0 0 auto; margin: 0 auto; }
.preview-scroll { justify-content: flex-start; padding: 28px 20px 60px; }
.page-scale { position: absolute; left: 0; top: 0; margin: 0; transform-origin: top left; }

@media screen {
  body { min-width: 320px; }
  .app-header { padding: 14px 20px; height: auto; min-height: 82px; gap: 18px; flex-wrap: wrap; }
  .header-actions { flex-wrap: wrap; gap: 8px; }
  .app-shell { grid-template-columns: minmax(330px, 400px) minmax(0, 1fr); }
  .workspace, .control-panel { min-width: 0; }
  .privacy-badge { display: none; }
}

@media screen and (max-width: 980px) {
  body { overflow: auto; }
  .app-header { position: relative; }
  .app-shell { display: block; height: auto; }
  .control-panel { overflow: visible; padding: 24px; border-right: 0; }
  .workspace { min-height: 600px; border-top: 1px solid #e0e4f0; }
  .workspace-toolbar { padding: 18px 24px; height: auto; min-height: 75px; }
  .preview-scroll { overflow: auto; }
  .about-dialog { width: min(700px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; padding: 24px; }
  .about-overlay { padding: 16px; }
}

@media screen and (max-width: 560px) {
  .app-header { padding: 16px; gap: 16px; }
  .brand { width: 100%; }
  .header-actions { width: 100%; }
  .tool-navigation { width: 100%; }
  .tool-navigation a { padding-left: 0; }
  .header-actions > .ghost-button, .settings-button { font-size: 12px; padding: 9px 10px; }
  .control-panel { padding: 20px 14px; }
  .form-section { padding: 18px 14px; }
  .panel-heading h1 { font-size: 24px; }
  .module-grid { gap: 8px; }
  .ai-mode-card { flex-wrap: wrap; gap: 12px; }
  .ai-settings-grid, .about-feature-grid { grid-template-columns: 1fr; }
  .ai-settings-grid .wide-field { grid-column: 1; }
  .model-input-row { display: grid; grid-template-columns: 1fr; }
  .ai-capability-list { grid-template-columns: 1fr; }
  .ai-settings-actions { flex-wrap: wrap; }
  .image-model-setting, .ai-model-meta, .image-preview-heading { display: grid; gap: 8px; }
  .about-dialog { padding: 22px 16px; }
  .about-brand h2, .ai-settings-heading h2 { font-size: 19px; }
  .about-brand { gap: 10px; }
  .about-brand-mark { flex-shrink: 0; }
  .toast { max-width: calc(100vw - 24px); white-space: normal; text-align: center; }
}

@media print {
  html,
  body { background: white !important; }
  .worksheet-page { border-radius: 0; box-shadow: none; }
  .preview-canvas { width: auto !important; height: auto !important; margin: 0; }
  .page-scale { position: static; }
  .worksheet-page .question-section { display: block; break-inside: auto; }
  .worksheet-page .question-section h3, .worksheet-page h2 { break-after: avoid-page; }
  .worksheet-page .question-section > p.question-item { break-after: avoid-page; }
  .worksheet-page .question-item, .worksheet-header, .hero-grid, .worksheet-footer,
  .worksheet-page tr { break-inside: avoid-page; }
  .worksheet-page p { orphans: 3; widows: 3; }
  .worksheet-page thead { display: table-header-group; }
  .worksheet-page .page-number { display: none; }
}
