:root {
  --ink: #23312f;
  --muted: #68766f;
  --paper: #fffaf1;
  --cream: #f6efe3;
  --sage: #dce9dc;
  --mint: #eef8ee;
  --peach: #f7dfc8;
  --coral: #bf6d52;
  --teal: #266f68;
  --deep: #163e3a;
  --line: #e3d8c8;
  --shadow: 0 22px 70px rgba(34, 48, 44, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(220, 233, 220, 0.9), transparent 34rem),
    linear-gradient(180deg, #fffaf1 0%, #fffdf8 42%, #f8f2e8 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(18px, 4vw, 56px);
  background: rgba(255, 250, 241, 0.9);
  border-bottom: 1px solid rgba(222, 216, 204, 0.8);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: #fff;
  background: var(--teal);
  font-family: "PingFang SC", "Noto Sans CJK SC", serif;
}

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 18px;
  font-size: 0.94rem;
}

nav a,
.footer-links a {
  color: var(--muted);
  text-decoration: none;
}

nav a {
  padding: 8px 10px;
  border-radius: 999px;
}

nav a:hover,
.footer-links a:hover {
  color: var(--teal);
  background: rgba(38, 111, 104, 0.08);
}

main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  display: grid;
  gap: 24px;
  padding: clamp(34px, 6vw, 74px) 0 28px;
}

.home-hero {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  align-items: end;
}

.tool-hero {
  max-width: 780px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.mini-label {
  color: var(--coral);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  line-height: 1.08;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.35rem, 6vw, 4.9rem);
  letter-spacing: 0;
}

h2 {
  margin: 0 0 14px;
  font-size: clamp(1.45rem, 3vw, 2.1rem);
}

h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
}

.subtitle {
  max-width: 720px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 2vw, 1.28rem);
}

.hero-note {
  display: grid;
  gap: 10px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(140deg, #ffffff 0%, #f3faef 58%, #f7dfc8 100%);
  box-shadow: var(--shadow);
}

.hero-note span {
  color: var(--muted);
}

.studio-card {
  position: relative;
  overflow: hidden;
}

.studio-card::after {
  content: "习";
  position: absolute;
  right: 18px;
  bottom: -30px;
  color: rgba(38, 111, 104, 0.08);
  font-family: "PingFang SC", "Noto Sans CJK SC", serif;
  font-size: 9rem;
  font-weight: 900;
}

.hero-cta {
  z-index: 1;
  display: inline-flex;
  width: fit-content;
  margin-top: 6px;
  padding: 10px 14px;
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  background: var(--deep);
  font-weight: 800;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 22px 0 28px;
}

.activity-card {
  display: grid;
  position: relative;
  min-height: 174px;
  align-content: start;
  gap: 12px;
  padding: 22px;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 24px rgba(48, 56, 50, 0.06);
}

.activity-card::before {
  content: "";
  width: 42px;
  height: 5px;
  border-radius: 999px;
  background: var(--peach);
}

.activity-card:hover {
  border-color: var(--teal);
  transform: translateY(-2px);
}

.activity-card span {
  font-size: 1.22rem;
  font-weight: 800;
}

.activity-card p,
.content-page p,
.faq p,
.print-help p,
.split p {
  color: var(--muted);
  margin: 0;
}

.ad-slot {
  margin: 28px 0;
  padding: 18px;
  color: #7d7568;
  text-align: center;
  border: 1px dashed #cfc5b6;
  border-radius: 8px;
  background: #fbf7ef;
  font-size: 0.92rem;
}

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

.prompt-list li {
  display: grid;
  gap: 3px;
  padding: 12px;
  border: 1px solid #d7d1c8;
  border-radius: 6px;
  background: #fff;
}

.prompt-list span {
  color: var(--teal);
  font-weight: 800;
}

.prompt-list em {
  color: var(--muted);
  font-style: normal;
}

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

.tone-grid span {
  padding: 12px;
  border: 1px solid #d7d1c8;
  border-radius: 6px;
  background: #fff;
  font-size: 1.25rem;
  font-weight: 900;
  text-align: center;
}

.answer-sheet {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 2px dashed #c8beb0;
  break-before: page;
}

.flashcard-page {
  margin: 16px 0 24px;
  break-after: page;
}

.flashcard-page:last-child {
  break-after: auto;
}

.page-label {
  margin: 0 0 8px;
  text-align: right;
}

.link-band,
.split,
.faq,
.print-help,
.content-page,
.generator-shell {
  margin: 34px 0;
  padding: clamp(22px, 4vw, 34px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 44px rgba(34, 48, 44, 0.06);
}

.link-band div,
.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pill,
.quick-links a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 10px 14px;
  color: var(--teal);
  text-decoration: none;
  border: 1px solid #bed5cf;
  border-radius: 999px;
  background: #f4fbf8;
  font-weight: 700;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(280px, 1.1fr);
  gap: 28px;
}

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

.steps li {
  display: grid;
  gap: 4px;
  padding: 16px;
  border-radius: 8px;
  background: var(--cream);
}

.steps span {
  color: var(--muted);
}

.faq {
  display: grid;
  gap: 12px;
}

details {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
}

summary {
  cursor: pointer;
  font-weight: 800;
}

details p {
  padding-top: 10px;
}

.generator-shell {
  display: grid;
  grid-template-columns: minmax(290px, 380px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(247, 241, 231, 0.78));
}

.controls-panel {
  position: sticky;
  top: 84px;
  display: grid;
  gap: 18px;
  padding: 20px;
  border-radius: 8px;
  background: #fffaf1;
  border: 1px solid #eadfce;
  box-shadow: 0 12px 30px rgba(34, 48, 44, 0.08);
}

.panel-heading,
#tool-controls {
  display: grid;
  gap: 14px;
}

.panel-heading strong {
  font-size: 1.18rem;
}

.selected-characters {
  margin: 12px 0;
  padding: 10px 12px;
  color: var(--deep);
  border: 1px solid #cfe0cf;
  border-radius: 8px;
  background: var(--mint);
  font-size: 0.92rem;
}

.selected-characters {
  display: grid;
  gap: 6px;
}

.selected-characters span {
  font-family: "Kaiti SC", KaiTi, "STKaiti", "PingFang SC", serif;
  font-size: 1.7rem;
  letter-spacing: 0.08em;
}

.level-guide {
  display: grid;
  gap: 8px;
}

.level-guide div {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid #e1d7c7;
  border-radius: 8px;
  background: #fff;
}

.level-guide div.active {
  border-color: #9bc1b7;
  background: var(--mint);
}

.level-guide strong {
  color: var(--deep);
}

.level-guide span {
  color: var(--muted);
  font-size: 0.86rem;
}

label {
  display: grid;
  gap: 6px;
  color: #4e5c58;
  font-weight: 800;
  font-size: 0.92rem;
}

input,
select,
textarea,
button {
  width: 100%;
  border: 1px solid #cfc7bb;
  border-radius: 8px;
  font: inherit;
}

input,
select,
textarea {
  padding: 11px 12px;
  background: #fff;
  color: var(--ink);
}

button {
  min-height: 44px;
  padding: 10px 14px;
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--deep);
  border-color: var(--deep);
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

button.secondary {
  color: var(--teal);
  background: #fff;
}

.worksheet-preview {
  min-height: 620px;
  padding: 32px;
  border: 1px solid #d8d0c2;
  border-radius: 8px;
  background:
    linear-gradient(#ffffff, #ffffff) padding-box,
    repeating-linear-gradient(0deg, rgba(35, 49, 47, 0.025), rgba(35, 49, 47, 0.025) 1px, transparent 1px, transparent 32px);
  box-shadow: 0 26px 60px rgba(34, 48, 44, 0.12);
}

.worksheet {
  color: #1f2927;
}

.worksheet-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 3px solid var(--deep);
}

.worksheet-title {
  font-size: 2rem;
  font-weight: 900;
}

.worksheet-subtitle,
.worksheet-meta {
  color: #53605d;
}

.word-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.word-table th,
.word-table td {
  padding: 10px;
  border: 1px solid #d5d5d5;
  text-align: left;
}

.hanzi {
  font-family: "PingFang SC", "Noto Sans CJK SC", "Songti SC", serif;
  font-size: 2.2rem;
  line-height: 1;
}

.hanzi.large {
  font-size: 4.5rem;
}

.trace-row {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: center;
  margin: 14px 0;
  break-inside: avoid;
}

.trace-cells,
.blank-cells {
  display: grid;
  grid-template-columns: repeat(6, minmax(54px, 1fr));
  gap: 6px;
}

.trace-cell {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1 / 1;
  min-width: 0;
  min-height: 0;
  border: 1.5px solid #3f4543;
  color: rgba(31, 41, 39, 0.22);
  font-family: "PingFang SC", "Noto Sans CJK SC", serif;
  font-size: 2.6rem;
}

.font-kai,
.font-kai .hanzi,
.trace-cell.font-kai {
  font-family: "Kaiti SC", KaiTi, "STKaiti", "PingFang SC", serif;
}

.font-song,
.font-song .hanzi,
.trace-cell.font-song {
  font-family: "Songti SC", SimSun, "Noto Serif CJK SC", serif;
}

.font-sans,
.font-sans .hanzi,
.trace-cell.font-sans {
  font-family: "PingFang SC", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
}

.font-rounded,
.font-rounded .hanzi,
.trace-cell.font-rounded {
  font-family: "Hiragino Sans GB", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-weight: 700;
}

.trace-cell.tian::before,
.trace-cell.tian::after {
  content: "";
  position: absolute;
  background: rgba(63, 69, 67, 0.22);
}

.trace-cell.tian::before {
  width: 1px;
  height: 100%;
}

.trace-cell.tian::after {
  width: 100%;
  height: 1px;
}

.trace-cell.mi {
  background-image:
    linear-gradient(45deg, transparent 49.2%, rgba(63, 69, 67, 0.42) 50%, transparent 50.8%),
    linear-gradient(-45deg, transparent 49.2%, rgba(63, 69, 67, 0.42) 50%, transparent 50.8%);
}

.trace-cell.mi::before,
.trace-cell.mi::after {
  content: "";
  position: absolute;
  background: rgba(63, 69, 67, 0.22);
}

.trace-cell.mi::before {
  width: 1.5px;
  height: 100%;
}

.trace-cell.mi::after {
  width: 100%;
  height: 1.5px;
}

.pinyin-model {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  align-items: center;
  margin: 12px 0;
}

.pinyin-text {
  font-size: 2.2rem;
  font-weight: 900;
}

.writing-lines {
  display: grid;
  gap: 10px;
}

.writing-line {
  min-height: 42px;
  border-bottom: 2px solid #b8b8b8;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 19px, rgba(0, 0, 0, 0.08) 20px);
}

.matching-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

.match-item {
  display: flex;
  justify-content: space-between;
  min-height: 48px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #bbb;
}

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

.flashcard-grid.cards-8 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.flashcard-grid.cards-many {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.flashcard {
  display: grid;
  place-items: center;
  min-height: 168px;
  padding: 14px;
  text-align: center;
  border: 2px dashed #979797;
  break-inside: avoid;
}

.flashcard .cue {
  color: #8a918f;
  font-size: 1.5rem;
}

.color-swatch {
  width: 54px;
  height: 32px;
  border: 1px solid #7a7a7a;
  border-radius: 999px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.45);
}

.word-search-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 2px;
  width: min(100%, 520px);
}

.word-search-grid span {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 1px solid #aaa;
  font-weight: 900;
}

.lesson-block {
  margin: 18px 0;
  padding: 16px;
  border: 1px solid #d7d1c8;
  border-radius: 6px;
  background: #fffefa;
  break-inside: avoid;
}

.lesson-overview {
  background: var(--mint);
  border-color: #cfe0cf;
}

.coloring-art {
  display: grid;
  place-items: center;
  min-height: 240px;
  margin: 18px 0;
  border: 3px solid #303836;
  border-radius: 24px;
  color: transparent;
  -webkit-text-stroke: 2px #303836;
  font-size: 8rem;
  background: #fff;
}

.preset-box {
  margin: 18px 0;
}

.content-page {
  max-width: 860px;
}

.content-page h2 {
  margin-top: 22px;
}

.contact-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.form-note {
  font-size: 0.9rem;
}

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

.research-grid article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
}

.check-list {
  padding-left: 22px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  width: min(1180px, calc(100% - 32px));
  margin: 40px auto 0;
  padding: 30px 0 42px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer p {
  margin: 6px 0 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

@media (max-width: 860px) {
  .site-header,
  .site-footer,
  .home-hero,
  .split,
  .generator-shell {
    grid-template-columns: 1fr;
  }

  .site-header,
  .site-footer {
    display: grid;
  }

  nav {
    justify-content: start;
  }

  .tool-grid,
  .research-grid {
    grid-template-columns: 1fr;
  }

  .tool-grid {
    gap: 12px;
  }

  .controls-panel {
    position: static;
  }

  .worksheet-preview {
    padding: 16px;
  }
}

@media (min-width: 861px) and (max-width: 1120px) {
  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media print {
  @page {
    size: letter;
    margin: 0.45in;
  }

  body {
    background: #fff;
  }

  .site-header,
  .site-footer,
  .controls-panel,
  .hero,
  .ad-slot,
  .faq,
  .print-help,
  .tool-grid,
  .link-band,
  button,
  nav {
    display: none !important;
  }

  main,
  .generator-shell,
  .worksheet-preview {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .worksheet-preview {
    min-height: auto;
  }

  .worksheet {
    font-size: 11pt;
  }

  .trace-cell {
    min-height: 0;
    aspect-ratio: 1 / 1;
    border-color: #222;
    color: rgba(0, 0, 0, 0.22);
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  .trace-cell.mi {
    background-image:
      linear-gradient(45deg, transparent 49.2%, rgba(0, 0, 0, 0.42) 50%, transparent 50.8%),
      linear-gradient(-45deg, transparent 49.2%, rgba(0, 0, 0, 0.42) 50%, transparent 50.8%);
  }

  .trace-cell.mi::before,
  .trace-cell.mi::after,
  .trace-cell.tian::before,
  .trace-cell.tian::after {
    background: rgba(0, 0, 0, 0.42);
  }

  .lesson-block,
  .trace-row,
  .flashcard,
  .match-item,
  .answer-sheet {
    break-inside: avoid;
  }
}
.theme-filter {
  display: grid;
  max-height: 280px;
  overflow: auto;
  gap: 12px;
  padding-right: 4px;
}

.filter-title {
  color: var(--deep);
  font-size: 1.02rem;
  font-weight: 900;
}

.theme-group {
  display: grid;
  gap: 7px;
}

.theme-group strong {
  color: var(--coral);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.theme-group div {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.theme-chip {
  width: auto;
  min-height: 34px;
  padding: 7px 10px;
  color: var(--deep);
  border: 1px solid #d5cbbd;
  border-radius: 999px;
  background: #fff;
  font-size: 0.86rem;
}

.theme-chip:hover,
.theme-chip.active {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.control-status {
  color: var(--muted);
  font-size: 0.86rem;
}

.control-status.active {
  color: var(--teal);
  font-weight: 800;
}
