:root {
  --ink: #18201f;
  --muted: #65706c;
  --soft: #f6f3ed;
  --paper: #fffdf8;
  --line: #e8e0d3;
  --accent: #0f7a68;
  --accent-deep: #0a4f47;
  --gold: #b8843a;
  --shadow: 0 24px 70px rgba(24, 32, 31, 0.08);
  font-family: "PingFang SC", "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(15, 122, 104, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(184, 132, 58, 0.05) 1px, transparent 1px),
    var(--soft);
  background-size: 84px 84px;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
a {
  -webkit-tap-highlight-color: transparent;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(15, 122, 104, 0.72);
  outline-offset: 3px;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0 18px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: "PingFang SC", sans-serif;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--ink);
  background: var(--paper);
  font-size: 22px;
}

.nav-link {
  color: var(--muted);
  font-family: "PingFang SC", sans-serif;
  font-size: 15px;
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  font-family: "PingFang SC", sans-serif;
}

.language-switch,
.panel-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.78);
  color: var(--accent-deep);
  font-family: "PingFang SC", sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.language-switch:hover,
.panel-switch:hover {
  border-color: var(--accent);
}

.review-toggle {
  min-height: 38px;
  margin-top: 18px;
  padding: 0 15px;
  border: 1px solid rgba(15, 122, 104, 0.34);
  background: rgba(255, 253, 248, 0.86);
  color: var(--accent-deep);
  font-family: "PingFang SC", sans-serif;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.review-toggle[aria-pressed="true"] {
  background: var(--accent-deep);
  color: var(--paper);
  border-color: var(--accent-deep);
}

.glyph-panel .review-toggle {
  display: block;
  width: 100%;
}

.glyph-panel .review-toggle + .review-toggle {
  margin-top: 10px;
}

.learn-toggle[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
}

.speak-warning {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--gold);
}

.hero {
  min-height: 430px;
  display: grid;
  align-items: end;
  padding: 76px 0 66px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent-deep);
  font-family: "PingFang SC", sans-serif;
  font-size: 14px;
  font-weight: 700;
}

h1 {
  max-width: 900px;
  margin: 0;
  font-size: clamp(46px, 7vw, 86px);
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: 0;
}

.hero-copy {
  max-width: 660px;
  margin: 28px 0 0;
  color: var(--muted);
  font-family: "PingFang SC", sans-serif;
  font-size: 18px;
  line-height: 1.9;
}

.language-hero {
  min-height: calc(100vh - 110px);
  padding-top: 56px;
  padding-bottom: 54px;
}

.language-hero h1 {
  max-width: 820px;
  font-size: clamp(38px, 5.6vw, 74px);
}

.language-choices {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 28px;
  font-family: "PingFang SC", sans-serif;
}

.language-choices a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 22px;
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  font-weight: 700;
}

.pinyin-hero {
  min-height: 340px;
}

.topic-hero {
  display: grid;
  align-content: end;
  min-height: 300px;
  padding: 62px 0 48px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.topic-hero h1 {
  max-width: 960px;
  font-size: clamp(38px, 5.8vw, 72px);
}

.topic-hero p:not(.eyebrow) {
  max-width: 760px;
  margin: 22px 0 0;
  color: var(--muted);
  font-family: "PingFang SC", sans-serif;
  font-size: 18px;
  line-height: 1.85;
}

.topic-results {
  padding-bottom: 72px;
}

.topic-learning {
  padding-bottom: 18px;
}

.topic-note-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.topic-note,
.meaning-contrast {
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.82);
  padding: 22px;
  font-family: "PingFang SC", sans-serif;
}

.topic-note h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.topic-note p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.mini-link-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
}

.wide-list {
  padding-bottom: 20px;
}

.mini-link-list a,
.meaning-contrast li {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.72);
  font-family: "PingFang SC", sans-serif;
}

.mini-link-list strong,
.meaning-contrast strong {
  color: var(--ink);
  font-size: 20px;
}

.mini-link-list span,
.meaning-contrast span {
  color: var(--accent-deep);
  font-weight: 800;
}

.mini-link-list small,
.meaning-contrast small {
  color: var(--muted);
  line-height: 1.45;
}

.meaning-contrast ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.learning-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
  padding: 32px 0 10px;
}

.dashboard-main,
.dashboard-side {
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.82);
}

.dashboard-main {
  min-height: 280px;
  padding: 34px;
  display: grid;
  align-content: center;
}

.dashboard-main h2 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(32px, 4.2vw, 56px);
  line-height: 1.04;
  font-weight: 600;
}

.dashboard-main p:not(.eyebrow) {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--muted);
  font-family: "PingFang SC", sans-serif;
  font-size: 17px;
  line-height: 1.75;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
  font-family: "PingFang SC", sans-serif;
}

.dashboard-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--accent-deep);
  font-weight: 800;
}

.dashboard-actions a.is-disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
}

.dashboard-actions .primary-action {
  border-color: var(--accent-deep);
  background: var(--accent-deep);
  color: var(--paper);
}

.dashboard-side {
  display: grid;
  gap: 0;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
  font-family: "PingFang SC", sans-serif;
}

.dashboard-stats div {
  min-width: 0;
  padding: 20px 18px;
  border-right: 1px solid var(--line);
}

.dashboard-stats div:last-child {
  border-right: 0;
}

.dashboard-stats span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.dashboard-stats strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
}

.today-lesson {
  padding: 22px;
}

.today-lesson h3 {
  margin: 0 0 14px;
  font-size: 18px;
  font-weight: 700;
}

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

.lesson-strip a {
  min-width: 0;
  min-height: 92px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.72);
  font-family: "PingFang SC", sans-serif;
}

.lesson-strip strong {
  font-size: 32px;
  line-height: 1;
  font-weight: 500;
}

.lesson-strip span,
.lesson-strip small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lesson-strip span {
  color: var(--accent-deep);
  font-size: 14px;
  font-weight: 800;
}

.lesson-strip small {
  color: var(--muted);
  font-size: 12px;
}

.compact-head {
  padding-top: 44px;
}

.topic-card {
  min-height: 250px;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 62px 0 24px;
}

.section-head h2 {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
}

.section-head p {
  max-width: 440px;
  margin: 0;
  color: var(--muted);
  font-family: "PingFang SC", sans-serif;
  line-height: 1.8;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  padding-bottom: 28px;
}

.progress-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
  padding: 18px 20px;
  border: 1px solid rgba(232, 224, 211, 0.96);
  background: rgba(255, 253, 248, 0.82);
  font-family: "PingFang SC", sans-serif;
}

.progress-panel > div:first-child {
  min-width: 230px;
}

.progress-panel[hidden] {
  display: none;
}

.progress-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 800;
}

.progress-panel strong {
  display: block;
  font-size: 22px;
  line-height: 1.2;
}

.progress-panel p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.progress-meter-wrap {
  flex: 1 1 320px;
  min-width: 220px;
}

.progress-meter-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.progress-meter-meta strong {
  color: var(--accent-deep);
  font-size: 18px;
}

.progress-meter {
  display: block;
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(232, 224, 211, 0.96);
  background: rgba(246, 243, 237, 0.86);
  appearance: none;
}

.progress-meter::-webkit-progress-bar {
  background: rgba(246, 243, 237, 0.86);
}

.progress-meter::-webkit-progress-value {
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
}

.progress-meter::-moz-progress-bar {
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
}

.progress-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.progress-actions a,
.progress-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--accent-deep);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.progress-actions a {
  border-color: rgba(15, 122, 104, 0.42);
}

.library-tools {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 16px;
  align-items: end;
  margin-bottom: 18px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  font-family: "PingFang SC", sans-serif;
}

.search-box,
.filter-row label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-box input,
.filter-row select {
  min-height: 46px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.82);
  color: var(--ink);
  font: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.search-box input {
  width: 100%;
  padding: 0 16px;
  font-size: 17px;
}

.search-box input:focus,
.filter-row select:focus,
.blend-controls select:focus {
  border-color: rgba(15, 122, 104, 0.56);
  background: var(--paper);
  box-shadow: 0 10px 26px rgba(24, 32, 31, 0.06);
}

.filter-row {
  display: flex;
  align-items: end;
  gap: 12px;
}

.filter-row select {
  min-width: 96px;
  padding: 0 12px;
}

.result-count {
  min-width: 98px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.character-card {
  min-height: 260px;
  display: grid;
  grid-template-rows: 28px auto 1fr;
  gap: 14px;
  padding: 22px 24px 24px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.84);
  box-shadow: none;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.character-card.is-learned {
  border-color: rgba(15, 122, 104, 0.28);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  font-family: "PingFang SC", sans-serif;
}

.learned-badge,
.card-rank {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  line-height: 1;
}

.learned-badge {
  min-width: 0;
  max-width: calc(100% - 54px);
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-rank {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.character-card:hover {
  transform: translateY(-4px);
  border-color: rgba(15, 122, 104, 0.35);
  box-shadow: var(--shadow);
}

.character-card:active,
.example-list a:active,
.detail-nav a:active {
  transform: translateY(0);
}

.card-char {
  display: block;
  align-self: end;
  min-height: 92px;
  font-size: 82px;
  line-height: 1;
  font-weight: 500;
}

.card-meta {
  display: grid;
  gap: 8px;
  align-self: end;
  color: var(--muted);
  font-family: "PingFang SC", sans-serif;
  line-height: 1.35;
  min-width: 0;
}

.card-meta strong {
  display: block;
  color: var(--ink);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.15;
}

.card-meaning,
.card-traditional {
  display: block;
  overflow-wrap: anywhere;
}

.card-meaning {
  font-size: 17px;
}

.card-traditional {
  font-size: 15px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 16px 0 80px;
  font-family: "PingFang SC", sans-serif;
}

.pagination button,
.speak-button {
  min-height: 36px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--accent-deep);
  font-family: "PingFang SC", sans-serif;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.pagination button:hover,
.speak-button:hover,
.tone-contrast button:hover {
  border-color: rgba(15, 122, 104, 0.5);
  background: #fffaf0;
}

.pagination button {
  padding: 0 16px;
}

.pagination button:disabled {
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.55;
}

.empty-state {
  grid-column: 1 / -1;
  margin: 0;
  padding: 42px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.72);
  color: var(--muted);
  font-family: "PingFang SC", sans-serif;
}

.page-layout {
  display: grid;
  grid-template-columns: minmax(240px, 350px) minmax(0, 1fr);
  gap: 42px;
  min-height: calc(100vh - 90px);
  padding: 30px 0 28px;
  border-top: 1px solid var(--line);
}

.glyph-panel {
  position: sticky;
  top: 18px;
  align-self: start;
  min-height: min(560px, calc(100vh - 140px));
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 34px 28px;
  border: 1px solid var(--line);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.main-glyph {
  font-size: clamp(132px, 17vw, 210px);
  line-height: 0.96;
  font-weight: 500;
}

.pinyin {
  margin-top: 20px;
  color: var(--accent-deep);
  font-family: "PingFang SC", sans-serif;
  font-size: 30px;
  font-weight: 700;
}

.traditional {
  margin-top: 16px;
  color: var(--muted);
  font-family: "PingFang SC", sans-serif;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.trad-glyph {
  display: inline-block;
  margin-left: 8px;
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
  vertical-align: -0.08em;
}

.tone-note {
  margin-top: 8px;
  color: var(--muted);
  font-family: "PingFang SC", sans-serif;
  font-size: 14px;
  font-weight: 700;
}

.panel-switch {
  margin-top: 20px;
}

.speak-button {
  padding: 0 12px;
  font-size: 12px;
}

.glyph-speak {
  margin-top: 18px;
}

.mini-speak {
  float: right;
  min-height: 30px;
  margin-left: 10px;
  padding: 0 10px;
}

.sentence-speak {
  float: right;
  margin-left: 12px;
}

.content-flow {
  display: grid;
  gap: 14px;
}

.content-block {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.content-block h2 {
  margin: 0 0 10px;
  font-size: 20px;
  font-weight: 600;
}

.word-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.word-list li {
  padding: 12px 14px;
  border: 1px solid rgba(232, 224, 211, 0.9);
  background: rgba(255, 253, 248, 0.72);
  font-family: "PingFang SC", sans-serif;
}

.word-list strong {
  display: block;
  margin-bottom: 3px;
  font-size: 18px;
  font-weight: 700;
}

.word-list span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.word-list em,
.word-list small {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-style: normal;
  font-size: 13px;
  line-height: 1.4;
}

.word-list small {
  color: var(--muted);
  font-size: 12px;
}

.compact-word-list,
.related-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px;
  font-family: "PingFang SC", sans-serif;
}

.compact-word-list a,
.related-list a {
  display: block;
  min-height: 82px;
  padding: 12px 14px;
  border: 1px solid rgba(232, 224, 211, 0.9);
  background: rgba(255, 253, 248, 0.72);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.compact-word-list a:hover,
.related-list a:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 122, 104, 0.36);
  box-shadow: 0 14px 38px rgba(24, 32, 31, 0.06);
}

.compact-word-list strong,
.related-list strong {
  display: block;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.1;
}

.related-list strong {
  font-size: 30px;
}

.compact-word-list span,
.related-list span,
.related-list small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.related-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.related-columns h3 {
  margin: 0 0 10px;
  font-family: "PingFang SC", sans-serif;
  font-size: 15px;
  color: var(--accent-deep);
}

.related-empty {
  min-height: 82px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.54);
  color: var(--muted);
  font-family: "PingFang SC", sans-serif;
  font-size: 13px;
  line-height: 1.5;
}

.meaning-primary {
  margin: 0;
  color: var(--ink);
  font-size: 21px;
  line-height: 1.35;
}

.meaning-secondary {
  margin: 6px 0 0;
  color: var(--muted);
  font-family: "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.sentence {
  margin: 0;
  color: var(--ink);
  font-size: 23px;
  line-height: 1.35;
}

.sentence small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-family: "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.origin {
  margin: 0;
  color: var(--muted);
  font-family: "PingFang SC", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

.detail-nav {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-top: 2px;
  font-family: "PingFang SC", sans-serif;
}

.detail-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--accent-deep);
  font-weight: 700;
}

.detail-nav a:hover {
  border-color: var(--accent);
}

.pinyin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 24px;
  padding: 34px 0 72px;
  border-top: 1px solid var(--line);
}

.pinyin-block {
  min-width: 0;
}

.pinyin-practice,
.tone-practice,
.pinyin-initials,
.pinyin-rules {
  grid-column: 1 / -1;
}

.pinyin-practice {
  background: rgba(255, 253, 248, 0.48);
}

.blend-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 220px)) minmax(220px, 1fr);
  gap: 14px;
  align-items: end;
  font-family: "PingFang SC", sans-serif;
}

.blend-controls label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.blend-controls select {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.blend-result {
  display: flex;
  align-items: center;
  gap: 12px;
}

.blend-result strong {
  min-width: 140px;
  color: var(--accent-deep);
  font-size: 44px;
  line-height: 1;
}

.practice-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-family: "PingFang SC", sans-serif;
  line-height: 1.65;
}

.example-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(138px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.example-list a {
  padding: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.72);
  font-family: "PingFang SC", sans-serif;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.example-list a:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 122, 104, 0.4);
  box-shadow: 0 14px 38px rgba(24, 32, 31, 0.06);
}

.example-list strong {
  display: block;
  font-size: 34px;
  line-height: 1;
}

.example-list span,
.example-list small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.45;
}

.tone-contrast {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tone-contrast button {
  min-width: 86px;
  min-height: 64px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font-size: 28px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.tone-contrast button:active,
.speak-button:active,
.pagination button:active {
  transform: translateY(1px);
}

.pinyin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pinyin-grid li,
.pinyin-rules li {
  padding: 14px 16px;
  border: 1px solid rgba(232, 224, 211, 0.9);
  background: rgba(255, 253, 248, 0.72);
  font-family: "PingFang SC", sans-serif;
}

.pinyin-pick {
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.pinyin-pick:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 34px rgba(24, 32, 31, 0.06);
  transform: translateY(-2px);
}

.pinyin-grid strong {
  display: block;
  color: var(--ink);
  font-size: 28px;
  line-height: 1;
}

.pinyin-grid span,
.pinyin-rules span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.pinyin-grid small {
  display: block;
  margin-top: 6px;
  color: var(--accent-deep);
  font-size: 12px;
  line-height: 1.45;
}

.pinyin-subblock + .pinyin-subblock {
  margin-top: 18px;
}

.pinyin-subblock h3 {
  margin: 0 0 10px;
  font-family: "PingFang SC", sans-serif;
  font-size: 16px;
}

.pinyin-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pinyin-chip-list span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.72);
  color: var(--ink);
  font-family: "PingFang SC", sans-serif;
  font-weight: 700;
}

.pinyin-whole span {
  min-width: 68px;
}

.tone-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.pinyin-rules ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pinyin-rules strong {
  display: block;
  font-size: 18px;
}

.converter-hero {
  min-height: 340px;
}

.converter-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
  padding: 34px 0 72px;
  border-top: 1px solid var(--line);
}

.converter-panel {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.72);
  box-shadow: 0 16px 48px rgba(24, 32, 31, 0.05);
}

.converter-input-label {
  display: block;
  margin-bottom: 10px;
  color: var(--accent-deep);
  font-family: "PingFang SC", sans-serif;
  font-size: 14px;
  font-weight: 800;
}

.converter-panel textarea {
  display: block;
  width: 100%;
  min-height: 260px;
  resize: vertical;
  padding: 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: 18px/1.8 "PingFang SC", sans-serif;
}

.converter-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-top: 14px;
  font-family: "PingFang SC", sans-serif;
}

.converter-controls label {
  display: grid;
  gap: 7px;
  min-width: 140px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.converter-controls select {
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
}

.converter-output-panel {
  display: grid;
  align-content: start;
  gap: 16px;
}

.converter-output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.converter-output-head strong {
  display: block;
  margin-top: 4px;
  font-family: "PingFang SC", sans-serif;
  font-size: 18px;
}

.converter-output {
  display: block;
  min-height: 150px;
  padding: 18px;
  border: 1px solid rgba(15, 122, 104, 0.24);
  background: rgba(246, 243, 237, 0.72);
  color: var(--accent-deep);
  font-family: "PingFang SC", sans-serif;
  font-size: 24px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.converter-token-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 10px;
}

.converter-token {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.78);
  font-family: "PingFang SC", sans-serif;
}

.converter-token strong,
.converter-token span,
.converter-token small {
  display: block;
}

.converter-token strong {
  font-size: 24px;
  line-height: 1.1;
}

.converter-token span {
  margin-top: 6px;
  color: var(--accent-deep);
  font-size: 15px;
  line-height: 1.35;
}

.converter-token small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.global-ad-stack {
  display: grid;
  gap: 18px;
  margin: 28px 0 42px;
  padding-top: 8px;
  border-top: 1px solid rgba(232, 224, 211, 0.72);
}

.content-flow > .global-ad-stack,
.page-layout > .global-ad-stack {
  grid-column: 1 / -1;
}

.global-ad-slot {
  min-width: 0;
  min-height: 120px;
  overflow: hidden;
}

@media (min-width: 821px) {
  .content-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
  }

  .page-layout .word-list {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  /* Full-width blocks: short or content-rich ones read better across the row than
     paired in a column (the paired media blocks are tone + stroke, see below). */
  .meaning-block,
  .words-block,
  .more-words-block,
  .related-block,
  .character-depth,
  .detail-nav {
    grid-column: 1 / -1;
  }

  /* Keep the two "media" blocks (four-tone cards + stroke canvas) side by side and
     top-aligned so neither leaves a large vertical gap. */
  .tone-block,
  .stroke-block {
    align-self: start;
  }

  /* Related-character cards run ~4 across the full row instead of 2 in a half-column. */
  .related-list {
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  }
}

@media (max-width: 820px) {
  .site-shell {
    width: min(100% - 28px, 1180px);
  }

  .topbar {
    padding-top: 20px;
  }

  .hero {
    min-height: 360px;
    padding: 54px 0 44px;
  }

  .section-head {
    display: block;
  }

  .section-head p {
    margin-top: 12px;
  }

  .learning-dashboard {
    grid-template-columns: 1fr;
    padding-top: 22px;
  }

  .topic-note-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-main {
    min-height: 0;
    padding: 26px 22px;
  }

  .dashboard-stats {
    grid-template-columns: 1fr;
  }

  .dashboard-stats div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .dashboard-stats div:last-child {
    border-bottom: 0;
  }

  .lesson-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .library-tools {
    grid-template-columns: 1fr;
  }

  .progress-panel {
    display: block;
  }

  .progress-panel > div:first-child {
    min-width: 0;
  }

  .progress-meter-wrap {
    margin-top: 16px;
    min-width: 0;
  }

  .progress-actions {
    justify-content: flex-start;
    margin-top: 14px;
  }

  .filter-row {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .result-count {
    width: 100%;
    margin: 0;
  }

  .topbar,
  .top-actions {
    align-items: flex-start;
  }

  .top-actions {
    flex-direction: column;
    gap: 8px;
  }

  .page-layout {
    grid-template-columns: 1fr;
    gap: 24px;
    min-height: auto;
    padding-top: 28px;
  }

  .glyph-panel {
    position: static;
    min-height: 380px;
  }

  .word-list {
    grid-template-columns: 1fr;
  }

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

  .sentence {
    font-size: 24px;
  }

  .pinyin-layout,
  .converter-layout,
  .pinyin-rules ul {
    grid-template-columns: 1fr;
  }

  .blend-controls {
    grid-template-columns: 1fr;
  }

  .blend-result strong {
    font-size: 38px;
  }
}

/* Article / guide and about pages */
.guide-article {
  max-width: 760px;
  margin: 0 auto;
  padding: 8px 22px 40px;
}
.guide-article h2 {
  margin: 34px 0 12px;
  font-size: 23px;
  color: var(--ink);
}
.guide-article p,
.guide-article li {
  line-height: 1.75;
  color: #2c3a37;
  font-size: 16px;
}
.guide-article ul,
.guide-article ol {
  padding-left: 22px;
  margin: 12px 0;
}
.guide-article li {
  margin: 6px 0;
}
.guide-article a {
  color: var(--accent-deep);
  font-weight: 600;
}
.guide-article .lead {
  font-size: 18px;
  color: var(--muted);
}
.guide-article .han {
  font-family: "PingFang SC", "Hiragino Sans GB", sans-serif;
}
.guide-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 22px 30px;
}
.guide-card {
  display: block;
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 6px;
}
.guide-card strong {
  display: block;
  color: var(--ink);
  margin-bottom: 6px;
}
.guide-card span {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.guide-note {
  max-width: 760px;
  margin: 10px auto 0;
  padding: 14px 22px;
  color: var(--muted);
  font-size: 14px;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 26px 0 40px;
  font-family: "PingFang SC", sans-serif;
}
.site-footer nav {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}
.site-footer a {
  color: var(--muted);
  font-size: 15px;
  font-weight: 600;
}
.site-footer a:hover {
  color: var(--accent-deep);
}

/* Self-test: blur the answer on the character page until revealed */
.page-layout.selftest .pinyin,
.page-layout.selftest .tone-note,
.page-layout.selftest .meaning-primary {
  filter: blur(8px);
  cursor: pointer;
  user-select: none;
  transition: filter 0.15s ease;
}
.page-layout.selftest .pinyin.revealed,
.page-layout.selftest .tone-note.revealed,
.page-layout.selftest .meaning-primary.revealed {
  filter: none;
  cursor: default;
}
.selftest-toggle[aria-pressed="true"] {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--paper);
}

/* Flashcard review page */
.review-stage, .review-empty, .review-done {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 22px 60px;
  text-align: center;
}
.review-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-family: "PingFang SC", sans-serif;
  font-size: 14px;
  margin-bottom: 14px;
}
.review-card {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 10px;
  padding: 40px 24px 30px;
  box-shadow: var(--shadow);
}
.review-glyph {
  display: block;
  width: 100%;
  border: 0;
  background: none;
  cursor: pointer;
  font-family: "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: clamp(110px, 28vw, 180px);
  line-height: 1.1;
  color: var(--ink);
}
.review-audio {
  margin-top: 4px;
}
.review-back {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.review-pinyin {
  font-family: "PingFang SC", sans-serif;
  font-size: 30px;
  font-weight: 800;
  color: var(--accent-deep);
}
.review-meaning {
  margin-top: 8px;
  font-size: 18px;
  color: var(--ink);
}
.review-words {
  margin-top: 10px;
  color: var(--muted);
  font-family: "PingFang SC", sans-serif;
  font-size: 15px;
}
.review-detail {
  display: inline-block;
  margin-top: 16px;
  color: var(--accent-deep);
  font-weight: 600;
  font-size: 14px;
}
.review-controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 22px;
  font-family: "PingFang SC", sans-serif;
}
.review-controls button,
.review-controls a {
  min-height: 46px;
  padding: 0 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--accent-deep);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
}
.review-controls .primary-action {
  border-color: var(--accent-deep);
  background: var(--accent-deep);
  color: var(--paper);
}
.review-hint {
  margin-top: 16px;
  color: var(--muted);
  font-family: "PingFang SC", sans-serif;
  font-size: 13px;
}
.review-empty h2, .review-done h2 {
  font-size: 26px;
}
.review-empty p, .review-done p {
  color: var(--muted);
  font-family: "PingFang SC", sans-serif;
  line-height: 1.7;
}

/* Flashcard deck picker */
.review-setpicker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}
.review-setpicker a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--accent-deep);
  font-family: "PingFang SC", sans-serif;
  font-weight: 700;
  font-size: 14px;
}
.review-setpicker a.primary-action {
  border-color: var(--accent-deep);
  background: var(--accent-deep);
  color: var(--paper);
}
.review-setpicker a[aria-current="true"] {
  outline: 2px solid var(--accent-deep);
  outline-offset: 1px;
}

/* Curated depth block (etymology / mnemonic / confusables) — character pages */
.character-depth .depth-part { margin-top: 14px; }
.character-depth .depth-part:first-of-type { margin-top: 4px; }
.character-depth h3 {
  margin: 0 0 4px;
  font-size: 14px;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.character-depth .depth-part p { margin: 0; line-height: 1.7; }
.depth-confusables { list-style: none; margin: 6px 0 0; padding: 0; }
.depth-confusables li {
  display: grid;
  grid-template-columns: 2.2em auto;
  align-items: baseline;
  gap: 4px 12px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.depth-confusables li:first-child { border-top: 0; }
.depth-confusable-char {
  grid-row: span 2;
  font-family: "PingFang SC", "Hiragino Sans GB", sans-serif;
  font-size: 30px;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  line-height: 1;
}
a.depth-confusable-char:hover { color: var(--accent-deep); }
.depth-confusable-pinyin {
  font-family: "PingFang SC", sans-serif;
  font-weight: 700;
  color: var(--accent-deep);
}
.depth-confusable-note { color: var(--ink); line-height: 1.6; }

/* Meaning page: per-character example sentences (content enrichment) */
.meaning-examples { display: grid; gap: 14px; margin-top: 8px; }
.meaning-example {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--paper);
}
.meaning-example h3 {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
}
.meaning-example h3 .han { font-size: 22px; margin-right: 2px; }
.meaning-example h3 a { color: var(--ink); text-decoration: none; }
.meaning-example h3 a:hover { color: var(--accent-deep); }
.meaning-example .sentence {
  margin: 4px 0;
  font-family: "PingFang SC", "Hiragino Sans GB", sans-serif;
  line-height: 1.7;
}
.meaning-example .sentence small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.meaning-example-words {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-family: "PingFang SC", sans-serif;
}

/* Syllable cross-linking: char page link to its syllable page + index directory */
.glyph-panel .syllable-link {
  display: inline-block;
  margin: 2px 0 4px;
  font-family: "PingFang SC", sans-serif;
  font-size: 13px;
  color: var(--accent-deep);
  font-weight: 600;
  text-decoration: none;
}
.glyph-panel .syllable-link:hover { text-decoration: underline; }
.syllable-index-list { display: flex; flex-wrap: wrap; gap: 6px; }
.syllable-index-list a {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: "PingFang SC", sans-serif;
  font-size: 13px;
  color: var(--accent-deep);
  text-decoration: none;
}
.syllable-index-list a:hover { background: var(--accent-deep); color: var(--paper); }

/* Clickable pinyin units (initials/finals/whole) — play real audio on click */
.pinyin-pick.is-playable { cursor: pointer; }
.pinyin-pick.is-playable:hover { border-color: var(--accent-deep); color: var(--accent-deep); }
.pinyin-chip-list .pinyin-pick.is-playable:active,
.pinyin-grid .pinyin-pick.is-playable:active { transform: translateY(1px); }

/* Stroke order (hanzi-writer) — character writing animation + tracing practice */
.stroke-order { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.stroke-target {
  width: 240px; height: 240px; max-width: 100%;
  background:
    linear-gradient(to right, transparent calc(50% - 1px), #eef1f0 50%, transparent calc(50% + 1px)),
    linear-gradient(to bottom, transparent calc(50% - 1px), #eef1f0 50%, transparent calc(50% + 1px));
  border: 1px solid var(--border, #e2e6e5);
  border-radius: 12px;
}
.stroke-controls { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.stroke-btn {
  appearance: none; cursor: pointer;
  border: 1px solid var(--accent, #0f7a68); background: #fff; color: var(--accent-deep, #0a4f47);
  padding: 8px 16px; border-radius: 999px; font-size: 0.95rem; font-weight: 600;
}
.stroke-btn:hover { background: var(--accent, #0f7a68); color: #fff; }
.stroke-btn:active { transform: translateY(1px); }
.stroke-hint { margin: 0; font-size: 0.85rem; color: var(--muted, #62706d); text-align: center; max-width: 360px; }
@media (prefers-color-scheme: dark) {
  .stroke-target { background-color: #11201e; border-color: #24403b; }
  .stroke-btn { background: transparent; }
}

/* HSK learning path — level overview + per-level character lists */
.band-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 8px; }
.band-card {
  display: flex; flex-direction: column; gap: 10px; padding: 18px;
  border: 1px solid var(--border, #e2e6e5); border-radius: 14px; background: var(--card, #fff);
  text-decoration: none; color: inherit; transition: border-color .15s, transform .15s;
}
.band-card:hover { border-color: var(--accent, #0f7a68); transform: translateY(-2px); }
.band-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.band-card-head strong { font-size: 1.25rem; color: var(--accent-deep, #0a4f47); }
.band-tag { font-size: 0.78rem; color: var(--muted, #62706d); background: var(--chip, #eef4f3); padding: 2px 8px; border-radius: 999px; }
.band-blurb { font-size: 0.9rem; color: var(--muted, #4f5b59); line-height: 1.5; }
.band-progress { display: flex; flex-direction: column; gap: 6px; margin-top: auto; }
.band-bar { display: block; height: 6px; border-radius: 999px; background: var(--chip, #e7eeec); overflow: hidden; }
.band-bar.inline-bar { width: 120px; display: inline-block; vertical-align: middle; margin-left: 10px; }
.band-bar-fill { display: block; height: 100%; width: 0; background: var(--accent, #0f7a68); border-radius: 999px; transition: width .3s; }
.band-count { font-size: 0.8rem; color: var(--muted, #62706d); }
.path-overall-line { font-size: 0.95rem; color: var(--muted, #4f5b59); }
.path-overall-line strong { color: var(--accent-deep, #0a4f47); }
.band-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; }
.band-nav a { color: var(--accent-deep, #0a4f47); text-decoration: none; font-weight: 600; }
.band-nav a:hover { text-decoration: underline; }
.band-nav-bottom { margin-top: 24px; }
/* learned state on path character cards */
.path-card .path-learned-badge { opacity: 0; color: var(--accent, #0f7a68); font-weight: 700; }
.path-card.is-learned { border-color: var(--accent, #0f7a68); }
.path-card.is-learned .path-learned-badge { opacity: 1; }
/* HSK badge on character pages */
.hsk-badge {
  display: inline-block; margin: 6px 0; padding: 3px 12px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 600; text-decoration: none;
  color: var(--accent-deep, #0a4f47); background: var(--chip, #eef4f3); border: 1px solid var(--border, #d8e2e0);
}
.hsk-badge:hover { background: var(--accent, #0f7a68); color: #fff; }
@media (prefers-color-scheme: dark) {
  .band-tag, .band-bar, .hsk-badge { background: #1a2b28; }
}

/* Four-tone comparison — pitch contour visuals + audio buttons */
.tone-block .tone-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 6px; }
.tone-cell {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 6px; cursor: pointer; text-align: center;
  border: 1px solid var(--border, #e2e6e5); border-radius: 12px; background: var(--card, #fff);
  color: inherit; font: inherit; transition: border-color .15s, background .15s, transform .1s;
}
.tone-cell:hover { border-color: var(--accent, #0f7a68); }
.tone-cell:active { transform: translateY(1px); }
.tone-cell.is-current { border-color: var(--accent, #0f7a68); background: var(--chip, #eef4f3); }
.tone-num { font-size: 0.78rem; color: var(--muted, #62706d); }
.tone-cell.is-current .tone-num { color: var(--accent-deep, #0a4f47); font-weight: 700; }
.tone-contour { color: var(--accent, #0f7a68); }
.tone-contour line, .tone-contour polyline { stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.tone-contour .tone-baseline { stroke: var(--border, #d8dedc); stroke-width: 1.5; }
.tone-syl { font-size: 1.15rem; font-weight: 600; }
.tone-current { font-size: 0.72rem; color: var(--accent-deep, #0a4f47); font-weight: 600; }
.tone-foot { margin-top: 8px; font-size: 0.85rem; color: var(--muted, #62706d); }
@media (max-width: 420px) { .tone-syl { font-size: 1rem; } .tone-cell { padding: 10px 3px; } }
@media (prefers-color-scheme: dark) { .tone-cell.is-current { background: #14241f; } }

/* Word-by-word gloss under the example sentence */
.sentence-gloss { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; align-items: flex-end; }
.gloss-word {
  display: inline-flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 8px; border-radius: 9px; background: var(--chip, #f1f5f4); border: 1px solid var(--border, #e7edec);
}
.gw-han { font-size: 1.15rem; line-height: 1.2; }
.gw-py { font-size: 0.74rem; color: var(--accent-deep, #0a4f47); }
.gw-en { font-size: 0.74rem; color: var(--muted, #5a6664); max-width: 12ch; text-align: center; line-height: 1.25; }
.gloss-punct { align-self: center; color: var(--muted, #93a09d); font-size: 1.1rem; padding: 0 2px; }
@media (prefers-color-scheme: dark) {
  .gloss-word { background: #14211e; border-color: #243733; }
}

/* SRS grade buttons (smart review) */
.srs-grades { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; width: 100%; }
.srs-grade {
  flex: 1 1 0; min-width: 64px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 8px; border: 1px solid var(--border, #e2e6e5); border-radius: 12px;
  background: var(--card, #fff); color: inherit; font-weight: 600; font-size: 0.98rem;
}
.srs-grade small { font-size: 0.68rem; opacity: 0.55; font-weight: 400; }
.srs-grade:hover { border-color: var(--accent, #0f7a68); }
.srs-grade.srs-again:hover { border-color: #c0563f; }
.srs-grade.primary-action { background: var(--accent, #0f7a68); color: #fff; border-color: var(--accent, #0f7a68); }

/* Smart-review due badge on the home dashboard */
.due-badge { font-weight: 700; opacity: 0.95; }

/* Blend practice: flag combinations that are not real Mandarin syllables */
.blend-result strong.is-invalid { color: var(--muted, #62706d); text-decoration: line-through; text-decoration-thickness: 2px; opacity: 0.7; }
.blend-note { font-size: 0.82rem; font-weight: 600; color: #b4541f; }
.speak-button:disabled, .speak-button.is-disabled { opacity: 0.45; cursor: not-allowed; }
.speak-button:disabled:hover, .speak-button.is-disabled:hover { background: inherit; color: inherit; }

/* Small speaker icon on clickable pinyin units, hinting they play audio */
.pinyin-pick { position: relative; }
.pinyin-pick[data-sound]::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 12px;
  height: 12px;
  background-color: var(--muted, #65706c);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 6H5L9 2.5v11L5 10H2z'/%3E%3Cpath d='M11.2 5.6a3.4 3.4 0 0 1 0 4.8' fill='none' stroke='%23000' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2 6H5L9 2.5v11L5 10H2z'/%3E%3Cpath d='M11.2 5.6a3.4 3.4 0 0 1 0 4.8' fill='none' stroke='%23000' stroke-width='1.3' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0.4;
  pointer-events: none;
  transition: opacity 160ms ease, background-color 160ms ease;
}
.pinyin-pick[data-sound]:hover::after {
  background-color: var(--accent, #0f7a68);
  opacity: 1;
}
