:root {
  --ink: #202226;
  --muted: #657080;
  --line: #d9dee7;
  --paper: #f7f8fb;
  --panel: #ffffff;
  --blue: #2f6fbb;
  --green: #2d8c73;
  --red: #c84a4a;
  --gold: #b98316;
  --violet: #6652aa;
  --shadow: 0 16px 40px rgba(28, 36, 50, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  background:
    linear-gradient(90deg, rgba(47, 111, 187, 0.06) 1px, transparent 1px),
    linear-gradient(0deg, rgba(47, 111, 187, 0.06) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 32px;
}

.topbar {
  min-height: 118px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  color: #fff;
  background: #233142;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: #72d0bd;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

.topbar h1 {
  margin: 0;
  max-width: 790px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.16;
  letter-spacing: 0;
}

.score-panel {
  width: 128px;
  height: 78px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 4px;
  color: #233142;
  background: #f2c75c;
  border-radius: 8px;
}

.score-label {
  font-size: 13px;
  color: #65480a;
}

.score-panel strong {
  font-size: 28px;
  line-height: 1;
}

.step-tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 16px 0;
}

.step-tab,
.primary-button,
.secondary-button,
.mini-button,
.icon-button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.step-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  padding: 0 8px;
  white-space: nowrap;
}

.step-tab span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eef4f8;
  font-size: 13px;
  font-weight: 700;
}

.step-tab:hover,
.secondary-button:hover,
.mini-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  border-color: #9ca8ba;
}

.step-tab.active {
  color: #fff;
  background: var(--blue);
  border-color: var(--blue);
  font-weight: 700;
}

.step-tab.active span {
  color: var(--blue);
  background: #fff;
}

.step-tab.done {
  border-color: rgba(45, 140, 115, 0.45);
}

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

.main-pane,
.side-pane {
  min-width: 0;
}

.main-pane,
.tool-block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.main-pane {
  padding: 20px;
}

.task-head,
.step-work-head,
.block-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.task-head {
  margin-bottom: 16px;
}

.task-head h2,
.step-work h2,
.tool-block h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.icon-button {
  width: 46px;
  flex: 0 0 46px;
  display: grid;
  place-items: center;
  padding: 0;
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.problem-card {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 18px;
  padding: 16px;
  border: 1px solid #cdd5e1;
  border-radius: 8px;
  background: #fbfcff;
}

.visual-box {
  min-height: 245px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: #eef4f8;
  border: 1px solid #d4e0e8;
}

.visual-box svg {
  width: 100%;
  height: 100%;
  max-height: 245px;
}

.problem-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

#problemText {
  margin: 0 0 16px;
  font-size: 20px;
  line-height: 1.7;
}

.given-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 12px;
  margin: 0;
  padding: 14px;
  border-left: 4px solid var(--green);
  background: #eff8f5;
}

.given-list dt {
  color: #1d6a57;
  font-weight: 700;
}

.given-list dd {
  margin: 0;
  min-width: 0;
}

.step-work {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.status-pill {
  flex: 0 0 auto;
  min-width: 76px;
  padding: 8px 12px;
  text-align: center;
  color: #77540e;
  background: #fff2cc;
  border: 1px solid #edd08b;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.status-pill.done {
  color: #1d6a57;
  background: #eff8f5;
  border-color: #a9d5c9;
}

.step-prompt {
  margin: 14px 0 10px;
  color: var(--muted);
  line-height: 1.65;
}

textarea {
  width: 100%;
  min-height: 112px;
  resize: vertical;
  padding: 12px 14px;
  color: var(--ink);
  border: 1px solid #b9c2cf;
  border-radius: 8px;
  background: #fff;
  outline: none;
}

textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 111, 187, 0.16);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.primary-button,
.secondary-button {
  padding: 0 18px;
  font-weight: 700;
}

.primary-button {
  color: #fff;
  background: var(--green);
  border-color: var(--green);
}

.secondary-button {
  background: #fff;
}

.feedback {
  min-height: 28px;
  margin: 12px 0 0;
  line-height: 1.6;
  color: var(--muted);
}

.feedback.success {
  color: var(--green);
  font-weight: 700;
}

.feedback.warn {
  color: var(--gold);
  font-weight: 700;
}

.side-pane {
  display: grid;
  gap: 16px;
}

.tool-block {
  padding: 18px;
}

.flow-list {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.flow-list li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 8px;
  border-radius: 8px;
}

.flow-list li.active {
  background: #eef5ff;
}

.flow-list li.done {
  background: #eff8f5;
}

.flow-list span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--violet);
  border-radius: 50%;
  font-weight: 700;
}

.flow-list li.done span {
  background: var(--green);
}

.flow-list p {
  margin: 5px 0 0;
  line-height: 1.55;
  color: var(--muted);
}

.mini-button {
  min-height: 34px;
  padding: 0 12px;
  color: #fff;
  background: #7b5f26;
  border-color: #7b5f26;
}

.remix-card {
  min-height: 122px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid #c8d1df;
  border-radius: 8px;
  background: #f9fafc;
}

.remix-card strong {
  display: block;
  margin-bottom: 8px;
  color: #1d6a57;
}

.remix-card p {
  margin: 0;
  line-height: 1.6;
  color: var(--muted);
}

.check-list {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  padding-left: 20px;
  position: relative;
  color: var(--muted);
  line-height: 1.55;
}

.check-list li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
}

.svg-label {
  font-size: 14px;
  fill: #26313f;
  font-weight: 700;
}

.svg-muted {
  font-size: 12px;
  fill: #657080;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .side-pane {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .topbar {
    display: grid;
    padding: 18px;
  }

  .topbar h1 {
    font-size: 28px;
  }

  .score-panel {
    width: 100%;
    height: 58px;
    grid-template-columns: auto auto;
    justify-content: center;
  }

  .step-tabs {
    grid-template-columns: repeat(2, 1fr);
  }

  .step-tab {
    justify-content: flex-start;
    padding: 0 12px;
  }

  .main-pane,
  .tool-block {
    padding: 14px;
  }

  .problem-card {
    grid-template-columns: 1fr;
  }

  .visual-box {
    min-height: 210px;
  }

  #problemText {
    font-size: 18px;
  }

  .side-pane {
    grid-template-columns: 1fr;
  }

  .action-row {
    display: grid;
  }
}
