:root {
  color-scheme: light;
  --ink: #19342f;
  --muted: #657670;
  --paper: #f5f1e8;
  --surface: #fffdf8;
  --line: #d7ddd6;
  --green: #1d6c5a;
  --green-dark: #124b40;
  --mint: #dbece3;
  --acid: #e9653b;
  --acid-soft: #fbe5dc;
  --gold: #d4a936;
  --wrong: #a63d2c;
  --shadow: 0 18px 60px rgb(25 52 47 / 10%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 8%, rgb(219 236 227 / 80%), transparent 28rem),
    linear-gradient(180deg, #faf7ef 0%, var(--paper) 100%);
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgb(233 101 59 / 35%);
  outline-offset: 3px;
}

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  min-height: 410px;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 72px;
  padding: 58px 4px 38px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 12px;
  color: var(--acid);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 700px;
  margin-bottom: 26px;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(3.8rem, 8vw, 7.4rem);
  font-weight: 800;
  line-height: 0.86;
  letter-spacing: -0.07em;
}

h1 span {
  color: var(--green);
}

.hero-copy {
  max-width: 580px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.8;
}

.hero-mark {
  position: relative;
  min-height: 300px;
}

.orb {
  position: absolute;
  z-index: 2;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: Georgia, "Times New Roman", serif;
  box-shadow: var(--shadow);
}

.orb sup {
  font-size: 0.55em;
}

.orb-one {
  width: 160px;
  height: 160px;
  top: 12px;
  right: 12%;
  color: white;
  background: var(--green);
  font-size: 2.4rem;
}

.orb-two {
  width: 205px;
  height: 205px;
  bottom: 0;
  left: 3%;
  color: var(--green-dark);
  background: #f0c85a;
  font-size: 2rem;
}

.bond {
  position: absolute;
  width: 220px;
  height: 4px;
  top: 48%;
  left: 30%;
  background: var(--ink);
  transform: rotate(-30deg);
  transform-origin: left center;
}

.bond::before,
.bond::after {
  content: "";
  position: absolute;
  width: 12px;
  height: 12px;
  top: -4px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
}

.bond::before { left: 38%; }
.bond::after { left: 58%; }

.control-panel,
.worksheet-section {
  border: 1px solid rgb(25 52 47 / 10%);
  border-radius: 30px;
  background: rgb(255 253 248 / 88%);
  box-shadow: var(--shadow);
}

.control-panel {
  padding: 34px;
}

.panel-heading,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

h2 {
  margin-bottom: 0;
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.05;
}

.progress-pill {
  flex: none;
  margin: 0;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: white;
  font-size: 0.82rem;
  font-weight: 700;
}

.control-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  margin: 36px 0 26px;
}

.control-block {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
}

.control-label {
  display: block;
  margin-bottom: 14px;
  font-size: 0.84rem;
  font-weight: 800;
}

.segmented,
.count-picker {
  display: grid;
  gap: 8px;
}

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

.segmented button,
.count-picker button {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.segmented button:hover,
.count-picker button:hover {
  transform: translateY(-1px);
  border-color: var(--green);
}

.segmented button {
  padding: 15px;
  text-align: left;
}

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

.segmented strong { margin-bottom: 4px; }
.segmented small { color: var(--muted); }

.segmented button.is-active,
.count-picker button.is-active {
  color: white;
  border-color: var(--green);
  background: var(--green);
}

.segmented button.is-active small { color: rgb(255 255 255 / 70%); }

.control-note {
  min-height: 44px;
  margin: 14px 2px 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.6;
}

.count-picker {
  grid-template-columns: repeat(4, 1fr);
}

.count-picker button {
  min-height: 48px;
  padding: 8px;
  font-weight: 800;
}

.custom-count-row {
  display: grid;
  grid-template-columns: auto 82px 1fr;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.8rem;
}

.custom-count-row input {
  width: 82px;
  padding: 9px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: white;
  text-align: center;
}

.custom-count-row input:disabled {
  color: #a7afa9;
  background: #f1f2ef;
}

.custom-count-row input[aria-invalid="true"] {
  border-color: var(--wrong);
}

.primary-button,
.secondary-button {
  min-height: 54px;
  padding: 0 24px;
  border-radius: 16px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: 0;
  color: white;
  background: var(--acid);
  box-shadow: 0 10px 25px rgb(233 101 59 / 20%);
}

.primary-button:hover { background: #d95731; }

.primary-button.compact {
  width: auto;
  min-width: 210px;
  justify-content: center;
}

.secondary-button {
  border: 1px solid var(--line);
  background: white;
}

.worksheet-section {
  margin-top: 30px;
  padding: 34px;
}

.section-heading {
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.section-heading > p {
  max-width: 350px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
  text-align: right;
}

.empty-state {
  padding: 70px 20px 58px;
  color: var(--muted);
  text-align: center;
}

.empty-symbol {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  margin: 0 auto 22px;
  border-radius: 24px;
  color: white;
  background: var(--green);
  font-family: Georgia, serif;
  font-size: 2.2rem;
  transform: rotate(-5deg);
}

.empty-state h3 {
  margin-bottom: 8px;
  color: var(--ink);
  font-family: "Songti SC", "STSong", Georgia, serif;
  font-size: 1.5rem;
}

.worksheet-list {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.question-card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 310px;
  align-items: center;
  gap: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
}

.question-number {
  align-self: stretch;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--line);
  color: var(--green);
  font-family: Georgia, serif;
  font-size: 1.1rem;
  font-weight: 800;
}

.question-main {
  min-width: 0;
}

.condition-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
}

.condition-label,
.condition-tag {
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 750;
}

.condition-label {
  padding: 5px 8px;
  color: white;
  background: var(--acid);
}

.condition-tag {
  padding: 5px 10px;
  color: #874027;
  background: var(--acid-soft);
}

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

.ion-chip {
  min-width: 72px;
  padding: 10px 13px;
  border: 1px solid #cfdbd3;
  border-radius: 12px;
  color: var(--green-dark);
  background: var(--mint);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.16rem;
  font-weight: 700;
  text-align: center;
}

.ion-chip sup {
  margin-left: 1px;
  font-size: 0.67em;
}

.judgement {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-width: 0;
  padding: 0;
  border: 0;
}

.judge-box {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 750;
  transition: border-color 150ms ease, background 150ms ease;
}

.judge-box:hover {
  border-color: var(--green);
}

.judge-box input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.box-mark {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border: 2px solid #aeb8b1;
  border-radius: 5px;
}

.judge-box:has(input:checked) {
  color: var(--green-dark);
  border-color: var(--green);
  background: var(--mint);
}

.judge-box:has(input:checked) .box-mark {
  border-color: var(--green);
  background: var(--green);
  box-shadow: inset 0 0 0 3px var(--mint);
}

.judgement:disabled .judge-box {
  cursor: default;
  opacity: 0.8;
}

.answer-feedback {
  grid-column: 2 / -1;
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  padding: 13px 15px;
  border-radius: 12px;
  font-size: 0.8rem;
  line-height: 1.55;
}

.answer-feedback.is-correct {
  color: var(--green-dark);
  background: var(--mint);
}

.answer-feedback.is-wrong {
  color: #7b3025;
  background: var(--acid-soft);
}

.worksheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

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

.summary {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-top: 22px;
  padding: 18px 20px;
  border: 1px solid #b9d3c5;
  border-radius: 16px;
  color: var(--green-dark);
  background: var(--mint);
}

.summary strong {
  font-family: Georgia, serif;
  font-size: 1.8rem;
}

.summary.is-error {
  color: var(--wrong);
  border-color: #ecc5bc;
  background: var(--acid-soft);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 38px 4px 46px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
    gap: 20px;
  }

  .hero-mark { display: none; }
  .control-grid { grid-template-columns: 1fr; }

  .question-card {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .judgement { grid-column: 2; }
  .answer-feedback { grid-column: 2; }
}

@media (max-width: 620px) {
  .page-shell { width: min(100% - 20px, 1180px); }
  .hero { padding-top: 40px; }
  h1 { font-size: clamp(3.4rem, 17vw, 5rem); }
  .control-panel,
  .worksheet-section { padding: 22px 16px; border-radius: 22px; }
  .panel-heading,
  .section-heading { display: block; }
  .progress-pill { display: inline-block; margin-top: 14px; }
  .section-heading > p { text-align: left; }
  .count-picker { grid-template-columns: 1fr 1fr; }
  .custom-count-row { grid-template-columns: auto 72px 1fr; }

  .question-card {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .question-number {
    display: block;
    padding-bottom: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .judgement,
  .answer-feedback { grid-column: 1; }
  .answer-feedback { grid-template-columns: 1fr; }
  .ion-chip { flex: 1; min-width: 64px; }
  .worksheet-actions { flex-direction: column-reverse; }
  .primary-button.compact { width: 100%; }
  footer { display: grid; }
}

@media print {
  body { background: white; }
  .page-shell { width: 100%; }
  .hero-mark,
  .control-panel,
  .worksheet-actions,
  footer { display: none !important; }
  .hero { min-height: auto; padding: 0 0 20px; }
  h1 { font-size: 3rem; }
  .hero-copy { display: none; }
  .worksheet-section { margin: 0; padding: 0; border: 0; box-shadow: none; }
  .question-card { break-inside: avoid; }
}
