:root {
  color-scheme: light;
  --page: #f5f5f7;
  --surface: #ffffff;
  --surface-soft: #fbfbfd;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --line-soft: #e8e8ed;
  --blue: #0071e3;
  --blue-soft: #eaf4ff;
  --black: #1d1d1f;
  --white: #ffffff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.07);
  --soft-shadow: 0 12px 34px rgba(0, 0, 0, 0.045);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--page);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font-family:
    "PingFang SC",
    "SF Pro Display",
    "SF Pro Text",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Microsoft YaHei UI",
    "Microsoft YaHei",
    sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(1180px, calc(100vw - 56px));
  margin: 0 auto;
  padding: 26px 0 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 68px;
}

.product-mark {
  display: flex;
  align-items: center;
  gap: 0;
}

.panel-title p,
.result-header p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
}

h1,
h2 {
  margin: 0;
  color: var(--text);
  letter-spacing: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.08;
  font-weight: 700;
}

h2 {
  font-size: 24px;
  line-height: 1.16;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: 420px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.control-panel,
.result-panel {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.control-panel {
  position: sticky;
  top: 22px;
  padding: 20px;
  margin-top: 0;
}

.result-panel {
  min-height: 700px;
  padding: 22px;
  margin-top: 0;
}

.panel-title,
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
}

.field {
  margin-top: 18px;
}

.field label {
  display: block;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 14px;
  font-weight: 650;
}

.segmented,
.chip-grid,
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 8px;
  background: #eeeeef;
}

.segmented.subject-grid {
  grid-auto-flow: row;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.segmented.grade-grid {
  grid-auto-flow: row;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.segmented.exercise-grid {
  grid-auto-flow: row;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.option {
  min-height: 40px;
  padding: 8px 13px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #424245;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.option:hover {
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
}

.option.is-active {
  background: var(--surface);
  color: var(--text);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    inset 0 0 0 0.5px rgba(0, 0, 0, 0.05);
}

.option:active {
  transform: scale(0.985);
}

.chip-grid .option,
.chip-list .option {
  border: 1px solid var(--line-soft);
  background: var(--surface-soft);
}

.chip-grid .option:hover,
.chip-list .option:hover {
  border-color: #c6c6cc;
  background: var(--surface);
}

.chip-grid .option.is-active,
.chip-list .option.is-active {
  border-color: rgba(0, 113, 227, 0.26);
  background: var(--blue-soft);
  color: var(--blue);
  box-shadow: inset 0 0 0 0.5px rgba(0, 113, 227, 0.18);
}

.text-input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  outline: none;
  font-size: 15px;
  font-weight: 600;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.textarea-input {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--text);
  outline: none;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.65;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.textarea-input:focus {
  border-color: rgba(0, 113, 227, 0.42);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}

.text-input:focus {
  border-color: rgba(0, 113, 227, 0.42);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}

.chip-list {
  margin-top: 10px;
}

.chip-list .option {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

.chip-grid .option {
  min-height: 38px;
  font-size: 13px;
}

.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.compact .option {
  min-height: 36px;
  padding-inline: 8px;
  font-size: 13px;
}

.primary-action {
  width: 100%;
  min-height: 48px;
  margin-top: 22px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: var(--white);
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 14px 30px rgba(0, 113, 227, 0.24);
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.primary-action:hover {
  background: #0077ed;
  box-shadow: 0 18px 34px rgba(0, 113, 227, 0.29);
}

.primary-action:active {
  transform: scale(0.99);
}

.primary-action:disabled,
.primary-action.is-loading {
  cursor: wait;
  opacity: 0.72;
}

.summary-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 0;
}

.summary-strip span {
  padding: 7px 11px;
  border-radius: 999px;
  background: #f0f0f2;
  color: #515154;
  font-size: 12px;
  font-weight: 600;
}

.assistant-card {
  display: block;
  padding: 22px;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--soft-shadow);
  min-height: 300px;
}

.output {
  display: grid;
  gap: 18px;
}

.section-block {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-soft);
}

.section-block:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.section-block h3 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  font-weight: 700;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin: 0 0 8px;
}

.section-copy {
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.section-copy:hover {
  background: var(--surface);
  border-color: rgba(0, 113, 227, 0.3);
}

.section-block p,
.section-block ul {
  margin: 0;
  color: #424245;
  font-size: 16px;
  line-height: 1.82;
}

.section-block ul {
  padding-left: 22px;
}

.section-block li + li {
  margin-top: 6px;
}

.script-block {
  padding: 18px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfbfd, #f5f5f7);
}

.script-block h3 {
  color: var(--blue);
}

.exercise-block {
  padding: 18px;
  border: 0;
  border-radius: 8px;
  background: #fbfbfd;
}

.mindmap-block {
  padding: 18px;
  border: 0;
  border-radius: 8px;
  background: #fbfbfd;
}

.exercise-list {
  display: grid;
  gap: 12px;
}

.exercise-item {
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #ffffff;
}

.exercise-item strong {
  display: block;
  margin-bottom: 8px;
  color: var(--blue);
  font-size: 14px;
}

.exercise-item p {
  margin: 0 0 12px;
}

.exercise-item dl {
  display: grid;
  gap: 6px 12px;
  grid-template-columns: 72px minmax(0, 1fr);
  margin: 0;
}

.exercise-item dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.exercise-item dd {
  margin: 0;
  color: #424245;
  font-size: 14px;
  line-height: 1.7;
}

.mindmap-outline {
  display: grid;
  gap: 14px;
}

.mindmap-outline > strong {
  display: block;
  color: var(--blue);
  font-size: 15px;
}

.mindmap-outline > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mindmap-outline article {
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #fff;
}

.mindmap-outline h4 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 14px;
}

.mindmap-outline ul {
  margin: 0;
  padding-left: 18px;
}

.mindmap-outline li {
  color: #424245;
  font-size: 13px;
  line-height: 1.65;
}

.empty-state p {
  color: var(--muted);
}

.empty-hero {
  display: grid;
  gap: 24px;
  padding: 4px 0 0;
}

.empty-kicker {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.empty-hero h3 {
  margin: 0;
  color: var(--text);
  font-size: 22px;
  line-height: 1.28;
  font-weight: 750;
}

.empty-hero > div > p:not(.empty-kicker) {
  max-width: 560px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.7;
}

.empty-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.empty-steps div {
  min-height: 132px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfbfd, #f6f6f8);
}

.empty-steps span {
  display: inline-flex;
  margin-bottom: 18px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 750;
}

.empty-steps strong {
  display: block;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
}

.empty-steps p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 5;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(29, 29, 31, 0.94);
  color: #ffffff;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 650;
}

@media (max-width: 980px) {
  .app-shell {
    width: min(100vw - 24px, 760px);
  }

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

  .control-panel {
    position: static;
  }

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

  .empty-steps {
    grid-template-columns: 1fr;
  }

  .mindmap-outline > div {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: 100%;
    padding: 0;
  }

  .topbar {
    padding: 16px;
  }

  .workspace {
    gap: 0;
  }

  .control-panel,
  .result-panel {
    border-radius: 0;
    box-shadow: none;
  }

  .control-panel,
  .result-panel {
    padding: 16px;
  }

  .two-cols,
  .result-header {
    display: grid;
    grid-template-columns: 1fr;
  }

  .segmented {
    grid-auto-flow: row;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .segmented.subject-grid,
  .segmented.grade-grid,
  .segmented.exercise-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  h1 {
    font-size: 26px;
  }

  h2 {
    font-size: 21px;
  }

}
