/* SentenceCoach — 青花 "blue and white".
   Rice paper and ink by day, inkstone and paper-white by night. The working colour is the cobalt blue of
   青花 porcelain (calm, not a warning); vermilion (朱砂) is kept for the seal logo and for what is wrong in a
   correction, jade for what is right. Hanzi sit in 田字格 practice squares; pinyin is coloured by tone
   (1 red, 2 orange, 3 green, 4 blue, neutral grey). */

/* Curly quotes from a Western serif, so “English” in headings is not set with CJK full-width quotes. */
@font-face { font-family: "Latin Quotes"; src: local("Georgia"), local("Times New Roman"), local("Noto Serif"); unicode-range: U+2018-201F; }

:root {
  --bg: #f7f3ea; --bg-2: #efe8d8; --surface: #fffdf7; --ink: #1f1b16; --ink-2: #3a332b; --muted: #6b6257; --faint: #8f8576;
  --line: rgba(31, 27, 22, .10); --line-2: rgba(31, 27, 22, .18);
  --accent: #2b5f8f; --accent-ink: #234f78; --accent-soft: #e4ecf4; --seal: #b8452e; --seal-soft: #f6e6e0; --jade: #2f7a5f; --jade-soft: #e0efe7; --gold: #a97a1e; --gold-soft: #f6ecd4;
  --grid: rgba(43, 95, 143, .26);
  --t1: #d0402b; --t2: #d0841a; --t3: #2f8a4f; --t4: #2c63c6; --t5: #8f8576;
  --shadow: 0 1px 2px rgba(31,27,22,.05), 0 12px 32px -18px rgba(31,27,22,.28);
  --shadow-lift: 0 2px 4px rgba(31,27,22,.06), 0 22px 44px -20px rgba(31,27,22,.36);
  --radius: 18px; --radius-sm: 12px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --serif: "Latin Quotes", "Noto Serif SC", "Songti SC", "STSong", "Source Han Serif SC", "SimSun", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15130f; --bg-2: #1c1914; --surface: #211d18; --ink: #ede6d8; --ink-2: #d9d0bf; --muted: #a99f8e; --faint: #857b6b;
    --line: rgba(237, 230, 216, .10); --line-2: rgba(237, 230, 216, .18);
    --accent: #82acd8; --accent-ink: #a7c6e8; --accent-soft: #1d2a37; --seal: #e07a62; --seal-soft: #3a2420; --jade: #67c29d; --jade-soft: #1b3229; --gold: #e0b45a; --gold-soft: #33291a;
    --grid: rgba(130, 172, 216, .30);
    --t1: #f07563; --t2: #f0a94a; --t3: #6cc98a; --t4: #79a5f2; --t5: #a99f8e;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 12px 32px -18px rgba(0,0,0,.7); --shadow-lift: 0 22px 44px -20px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.65 var(--sans);
  /* Faint paper grain. */
  background-image: radial-gradient(rgba(120, 96, 60, .05) 1px, transparent 1px); background-size: 4px 4px;
}
@media (prefers-color-scheme: dark) { body { background-image: radial-gradient(rgba(255, 240, 210, .025) 1px, transparent 1px); } }
[lang|="zh"] { font-family: var(--serif); font-weight: 500; }
a { color: var(--accent-ink); text-decoration-color: color-mix(in srgb, var(--accent) 35%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; z-index: 9; background: var(--surface); padding: 6px 10px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
::selection { background: var(--accent-soft); }

/* ——— Header ——— */
header.site { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 12px 24px; min-height: 64px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.logo { width: 32px; height: 32px; color: var(--seal); flex: none; transform: rotate(-3deg); }
.brand-name { font: 600 19px/1 var(--sans); letter-spacing: -.01em; } .brand-name b { font-weight: 800; }
.brand-zh { font-size: 13px; color: var(--muted); padding-left: 10px; border-left: 1px solid var(--line-2); }
header nav { display: flex; gap: 2px; flex-wrap: wrap; margin-left: auto; font-size: 15px; }
header nav a { color: var(--ink-2); text-decoration: none; padding: 7px 12px; border-radius: 999px; }
header nav a:hover { background: var(--bg-2); color: var(--ink); }
header nav a[aria-current] { background: var(--ink); color: var(--bg); }
@media (max-width: 720px) {
  .bar { padding-top: 8px; padding-bottom: 8px; min-height: 0; }
  .brand-zh { display: none; }
  header nav { margin-left: 0; width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; margin-bottom: 2px; }
  header nav a { white-space: nowrap; padding: 6px 11px; }
}

/* ——— Type ——— */
main { padding: 20px 16px 72px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
h1 { font-size: clamp(30px, 4.6vw, 46px); line-height: 1.15; margin: 8px 0 14px; text-wrap: balance; }
h2 { font-size: clamp(21px, 2.4vw, 26px); line-height: 1.3; margin: 44px 0 14px; }
h1 em { font-style: normal; color: var(--accent); }
.lede { font-size: 19px; line-height: 1.6; color: var(--ink-2); margin: 0 0 14px; max-width: 72ch; }
.meta, .fine { font-size: 14px; color: var(--muted); }
.kicker { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: 14px; letter-spacing: .12em; color: var(--accent-ink); }
.kicker::before { content: ""; width: 18px; height: 2px; background: var(--accent); border-radius: 2px; }
.crumbs { font-size: 13px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 18px; }
.crumbs a { color: var(--muted); text-decoration: none; } .crumbs a:hover { color: var(--accent); }
.crumbs .sep { color: var(--faint); }
.page-head { margin-bottom: 26px; padding-bottom: 22px; border-bottom: 1px dashed var(--line-2); }
.sh { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.sh-zh { font-size: 13px; font-weight: 600; letter-spacing: .15em; color: var(--accent); border: 1px solid var(--accent); border-radius: 4px; padding: 1px 6px 2px 7px; transform: translateY(-3px); }
.note { background: var(--gold-soft); border-left: 3px solid var(--gold); border-radius: 0 10px 10px 0; padding: 12px 16px; color: var(--ink-2); }
.prose { max-width: 72ch; } .prose li { margin: 6px 0; }
.more { font-weight: 600; text-decoration: none; }
code, .pattern { font-family: var(--mono); font-size: .9em; }

/* Tone colours */
.py { color: var(--muted); font-family: var(--sans); font-weight: 400; letter-spacing: .01em; }
.t1 { color: var(--t1); } .t2 { color: var(--t2); } .t3 { color: var(--t3); } .t4 { color: var(--t4); } .t5 { color: var(--t5); }
.big-py { font-size: clamp(26px, 3.4vw, 34px); font-weight: 500; }

/* ——— 田字格 tiles ——— */
.tiles { display: inline-flex; gap: 10px; flex-wrap: wrap; }
.tile-col { display: inline-flex; flex-direction: column; align-items: center; gap: 4px; }
.tile-py { font: 500 15px/1 var(--sans); }
.tile {
  --s: 108px; width: var(--s); height: var(--s); display: grid; place-items: center;
  font: 700 calc(var(--s) * .66)/1 var(--serif); color: var(--ink);
  background:
    linear-gradient(var(--grid), var(--grid)) center / 100% 1px no-repeat,
    linear-gradient(var(--grid), var(--grid)) center / 1px 100% no-repeat,
    linear-gradient(45deg, transparent calc(50% - .5px), color-mix(in srgb, var(--grid) 55%, transparent) 50%, transparent calc(50% + .5px)),
    linear-gradient(-45deg, transparent calc(50% - .5px), color-mix(in srgb, var(--grid) 55%, transparent) 50%, transparent calc(50% + .5px)),
    var(--surface);
  border: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); border-radius: 6px; box-shadow: var(--shadow);
}
.tiles.md .tile { --s: 64px; border-width: 1.5px; } .tiles.md .tile-py { font-size: 13px; }
@media (max-width: 600px) { .tile { --s: 84px; } .tiles.md .tile { --s: 54px; } }

/* ——— Hero ——— */
.hero { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .85fr); gap: 40px; align-items: start; padding: 26px 0 8px; }
.hero h1 { font-size: clamp(36px, 5.4vw, 60px); margin-top: 14px; }
.hero-side { padding-top: 70px; }
@media (max-width: 900px) { .hero { grid-template-columns: 1fr; gap: 8px; } .hero-side { padding-top: 0; } }
.demo { position: relative; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 20px 18px; box-shadow: var(--shadow-lift); transform: rotate(1.2deg); }
.demo figcaption { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--faint); margin-bottom: 8px; }
.demo-in { font-size: 24px; margin: 0 0 10px; }
.redpen { text-decoration: underline wavy var(--seal); text-decoration-thickness: 1.5px; text-underline-offset: 6px; }
.demo .res { margin-top: 6px; }
.seal { position: absolute; right: 16px; top: 14px; width: 46px; height: 46px; display: grid; place-items: center; font: 700 26px/1 var(--serif); color: var(--seal); border: 2.5px solid var(--seal); border-radius: 8px; transform: rotate(8deg); opacity: .85; }
.stats { list-style: none; padding: 0; margin: 40px 0 0; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); }
.stats li { padding: 18px 12px; display: grid; gap: 2px; text-align: center; } .stats li + li { border-left: 1px solid var(--line); }
.stats b { font: 700 30px/1.1 var(--serif); color: var(--ink); } .stats span { font-size: 14px; color: var(--muted); }
@media (max-width: 640px) { .stats { grid-template-columns: 1fr 1fr; } .stats li:nth-child(3) { border-left: 0; } .stats li:nth-child(n+3) { border-top: 1px solid var(--line); } }
.features { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.feature { display: flex; gap: 16px; align-items: center; height: 100%; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); transition: transform .15s, box-shadow .15s, border-color .15s; }
.feature:hover { color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow-lift); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.feature > span:last-child { display: grid; gap: 2px; } .feature b { font-size: 17px; } .feature > span > span { color: var(--muted); font-size: 15px; line-height: 1.45; }
.glyph { flex: none; width: 60px; height: 60px; display: grid; place-items: center; font: 700 34px/1 var(--serif); color: var(--accent);
  background: linear-gradient(var(--grid), var(--grid)) center / 100% 1px no-repeat, linear-gradient(var(--grid), var(--grid)) center / 1px 100% no-repeat, var(--accent-soft); border-radius: 10px; }

/* ——— Checker ——— */
.checker { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin: 22px 0; }
.checker.inline { margin-top: 40px; background: linear-gradient(180deg, var(--accent-soft), var(--surface) 80px); }
.checker-h { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; font: 700 19px/1.3 var(--serif); }
.pen { color: var(--accent); }
.paper { border-radius: 12px; background: repeating-linear-gradient(var(--bg) 0 43px, var(--line) 43px 44px); background-position: 0 8px; border: 1px solid var(--line-2); padding-top: 8px; }
.checker textarea { display: block; width: 100%; font: 500 23px/44px var(--serif); padding: 0 14px; min-height: 132px; border: 0; background: transparent; color: var(--ink); resize: vertical; }
.checker textarea::placeholder { color: var(--faint); }
.paper:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.samples { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 10px 0 0; font-size: 14px; color: var(--muted); }
.sample { font: 500 15px var(--serif); color: var(--ink-2); background: var(--bg); border: 1px dashed var(--line-2); border-radius: 999px; padding: 4px 11px; cursor: pointer; }
.sample:hover { border-color: var(--accent); color: var(--accent-ink); }
.checker-opts { display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; margin-top: 12px; font-size: 15px; }
.checker-opts label { display: flex; gap: 8px; align-items: center; color: var(--muted); }
.checker input, .checker select { font: inherit; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); color: var(--ink); }
.checker input:focus, .checker select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.btn { margin-left: auto; font: 700 16px var(--sans); background: var(--accent); color: #fff; border: 0; border-radius: 12px; padding: 12px 20px; cursor: pointer; box-shadow: 0 6px 18px -10px var(--accent); transition: transform .12s, background .12s; }
.btn:hover { background: var(--accent-ink); transform: translateY(-1px); } .btn:active { transform: none; }
.btn:disabled { opacity: .6; cursor: wait; }
@media (max-width: 520px) { .btn { width: 100%; margin-left: 0; } }
.checker > .fine { margin: 10px 0 0; }
.result:empty { display: none; }
.result { margin-top: 14px; border-top: 1px dashed var(--line-2); padding-top: 14px; }
.res .verdict { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; margin: 0 0 10px; padding: 4px 12px; border-radius: 999px; }
.res.ok .verdict { background: var(--jade-soft); color: var(--jade); } .res.ok .verdict::before { content: "✓"; }
.res.fix .verdict { background: var(--accent-soft); color: var(--accent-ink); } .res.fix .verdict::before { content: "✎"; }
.label { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin: 12px 0 2px; }
.res .zh { margin: 0; font-family: var(--serif); } .res .big { font-size: 26px; line-height: 1.4; }
.res .py, .res .en { display: block; margin: 2px 0; } .res .en { color: var(--muted); font-style: italic; }
.issues { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; }
.issues li { display: grid; gap: 4px; padding: 10px 12px; background: var(--bg); border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0; }
.type { justify-self: start; font-size: 12px; font-weight: 600; letter-spacing: .03em; background: var(--accent-soft); color: var(--accent-ink); border-radius: 6px; padding: 1px 8px; }
.edit { font-size: 19px; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; } .expl { color: var(--ink-2); font-size: 15px; }
del { color: var(--seal); text-decoration: line-through 2px var(--seal); } ins { color: var(--jade); text-decoration: none; font-weight: 700; border-bottom: 2px solid var(--jade); }
.warn { color: var(--gold); font-weight: 600; } .error { color: var(--accent-ink); font-weight: 600; } .loading { color: var(--muted); }
.loading::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 8px; border-radius: 50%; border: 2px solid var(--accent); border-right-color: transparent; animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
.checklist { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.checklist li { display: grid; gap: 2px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.checklist b { font-size: 15px; } .checklist span { color: var(--ink-2); font-size: 15px; }
.steps { counter-reset: s; list-style: none; padding: 0; display: grid; gap: 10px; max-width: 72ch; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: baseline; }
.steps li::before { content: counter(s); flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: var(--bg); font: 700 14px var(--sans); }

/* ——— Examples and mistakes ——— */
.examples { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ex { display: grid; gap: 2px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); border-left: 3px solid var(--jade); }
.ex .zh { font-size: 23px; line-height: 1.45; } .ex .py { font-size: 15px; } .ex .en { color: var(--muted); font-size: 15px; }
.mistakes { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.mistakes > li { padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 600px) { .pair { grid-template-columns: 1fr; } }
.pair p { margin: 0; display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; border-radius: 10px; font-size: 20px; }
.wrong { background: var(--seal-soft); } .wrong span[lang] { text-decoration: line-through 1.5px var(--seal); color: var(--ink-2); }
.right { background: var(--jade-soft); } .right span[lang] { color: var(--ink); }
.mark { flex: none; font: 700 15px var(--sans); } .wrong .mark { color: var(--seal); } .right .mark { color: var(--jade); }
.why { margin: 10px 2px 0; color: var(--ink-2); font-size: 15px; }

/* ——— Word and measure-word heads ——— */
.word-head { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; padding: 8px 0 26px; margin-bottom: 8px; border-bottom: 1px dashed var(--line-2); }
.word-info { flex: 1 1 320px; min-width: 0; }
.word-head h1 { margin: 4px 0 6px; }
.meaning { font-size: 20px; color: var(--ink-2); margin: 0 0 12px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin: 0; }
.badge { font-size: 13px; color: var(--ink-2); background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.seal-badge { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; font-weight: 600; }
.card-sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 2px 20px 8px; margin-top: 22px; }
.card-sec .sh { margin-top: 18px; }
.compare .vs { display: flex; align-items: center; gap: 14px; font-size: 34px; margin: 0 0 6px; }
.compare .vs a { text-decoration: none; } .vs-x { font: 600 14px var(--sans); color: var(--faint); text-transform: uppercase; letter-spacing: .1em; }
.answer-card { display: flex; gap: 24px; align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; }
.answer-card > div:last-child { flex: 1 1 280px; } .answer-card .lede { margin: 0; }
.plain { padding-left: 20px; }

/* ——— Grids and cards ——— */
.level-grid, .grammar-grid, .mw-grid, .phrase-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.level-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.level-card { display: grid; gap: 6px; height: 100%; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
a.level-card:hover, .level-card:has(.lv-link:hover) { border-color: color-mix(in srgb, var(--accent) 40%, transparent); box-shadow: var(--shadow-lift); }
.lv-link { display: grid; gap: 2px; text-decoration: none; color: var(--ink); }
.lv { font: 700 24px/1.1 var(--serif); color: var(--accent); }
.level-card b { font-size: 16px; } .level-card > span:last-child, .lv-meta { font-size: 14px; color: var(--muted); }
.lv-bar { height: 6px; border-radius: 3px; background: var(--bg-2); position: relative; overflow: hidden; }
.lv-bar::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: linear-gradient(90deg, var(--accent), var(--jade)); border-radius: 3px; }
.lv-sub { font-size: 14px; font-weight: 600; text-decoration: none; }
.level-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 14px; }
.level-tabs a { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-2); text-decoration: none; color: var(--ink-2); font-size: 15px; }
.level-tabs a[aria-current] { background: var(--accent); border-color: var(--accent); color: #fff; }
.grammar-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.gcard { display: grid; gap: 4px; height: 100%; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); transition: transform .15s, box-shadow .15s; }
.gcard:hover { color: var(--ink); transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.g-zh { font: 700 30px/1.2 var(--serif); color: var(--accent); } .gcard b { font-size: 15px; font-weight: 600; } .g-lv { font-size: 13px; color: var(--muted); }
.mw-grid { grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); margin: 18px 0 8px; }
.mw-card { display: grid; justify-items: center; gap: 6px; text-align: center; height: 100%; padding: 14px 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
.mw-card:hover { color: var(--ink); border-color: color-mix(in srgb, var(--accent) 40%, transparent); box-shadow: var(--shadow-lift); }
.mw-counts { font-size: 14px; color: var(--ink-2); line-height: 1.35; } .mw-ex { font-size: 15px; color: var(--muted); }
.phrase-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.phrase-grid a { display: grid; gap: 1px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); }
.phrase-grid a:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.phrase-grid .zh { font: 700 21px var(--serif); } .phrase-grid .py { font-size: 14px; } .phrase-grid .en { font-size: 14px; color: var(--muted); }
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 15px; }
.chips li:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.chips a { text-decoration: none; } .chips .py { font-size: 13px; margin-left: 2px; }

/* ——— Grammar ——— */
.patterns { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.patterns li { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 4px 18px; align-items: baseline; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); }
@media (max-width: 640px) { .patterns li { grid-template-columns: 1fr; } }
.patterns li > span { color: var(--ink-2); font-size: 15px; }
code.pattern { font-family: var(--mono); font-size: 15px; color: var(--ink); background: var(--bg-2); border-radius: 6px; padding: 3px 8px; line-height: 1.8; }
.patterns code.pattern { background: none; padding: 0; color: var(--accent-ink); font-weight: 600; }
.formula { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 28px; padding: 16px 20px; background: var(--surface); border: 1px dashed var(--accent); border-radius: var(--radius); margin: 6px 0 4px; }
.formula .op, .formula .eq { color: var(--faint); font: 400 22px var(--sans); } .formula .hl { color: var(--accent); font-weight: 700; }
.formula span:last-child { font: 500 18px var(--sans); color: var(--muted); }
.related { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 36px; }
.related > span { font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin-right: 4px; }
.related a { padding: 4px 12px; border: 1px solid var(--line-2); border-radius: 999px; text-decoration: none; font-size: 15px; }

/* ——— Sentence structure ——— */
.order { margin: 10px 0 24px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.order ol { list-style: none; padding: 0; margin: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.order li { flex: 1 1 96px; display: grid; gap: 2px; justify-items: center; text-align: center; padding: 12px 8px; border-radius: 12px; background: var(--bg); border-top: 3px solid var(--accent); }
.order li:nth-child(5) { border-top-color: var(--jade); background: var(--jade-soft); }
.o-zh { font: 700 22px/1.3 var(--serif); } .order .py { font-size: 13px; } .o-k { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.order figcaption { margin-top: 12px; font-size: 15px; color: var(--muted); } .order figcaption span { color: var(--ink); font-size: 18px; margin-right: 6px; }
.toc { background: var(--bg-2); border-radius: var(--radius-sm); padding: 6px 18px; }
.toc ol { columns: 2; font-size: 15px; } .toc li { margin: 4px 0; } .toc a { text-decoration: none; }
@media (max-width: 600px) { .toc ol { columns: 1; } }
.rule { scroll-margin-top: 90px; }

/* ——— HSK writing ——— */
.parts { list-style: none; padding: 0; display: grid; gap: 14px; counter-reset: p; }
.part { counter-increment: p; position: relative; padding: 18px 20px 10px 64px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.part::before { content: counter(p); position: absolute; left: 18px; top: 18px; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: var(--accent); color: #fff; font: 700 16px var(--serif); }
.part h2 { margin: 2px 0 4px; font-size: 21px; } .part-items { margin: 0; font-size: 14px; color: var(--accent-ink); font-weight: 600; }
.prompt { font: 700 19px var(--serif); margin: 24px 0 -8px; }

/* ——— Tables ——— */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { position: sticky; top: 0; background: var(--bg-2); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
tbody tr:last-child td { border-bottom: 0; } tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
td.zh { font: 700 21px/1.3 var(--serif); white-space: nowrap; } td.zh a { text-decoration: none; color: var(--ink); } td.zh a:hover { color: var(--accent); }
td.mw { color: var(--accent); } td.num { color: var(--faint); font-variant-numeric: tabular-nums; }

/* ——— FAQ ——— */
.faq { margin-top: 44px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0 16px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; padding: 13px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 20px; line-height: 1; } .faq details[open] summary::after { content: "−"; }
.faq details p { margin: 0 0 14px; color: var(--ink-2); }

/* ——— Footer ——— */
footer.site { background: #1d1914; color: #d8cfbf; padding: 40px 0 20px; font-size: 15px; }
footer.site a { color: #efe7d8; text-decoration: none; } footer.site a:hover { color: #fff; text-decoration: underline; }
footer.site .brand { color: #fff; } footer.site .logo { color: #c9553c; }
.foot-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 24px; }
@media (max-width: 760px) { .foot-grid { grid-template-columns: 1fr 1fr; } .foot-about { grid-column: 1 / -1; } }
.foot-about p { color: #a99f8e; max-width: 40ch; }
.foot-motto { font-size: 20px; letter-spacing: .3em; color: #9fbfe0 !important; }
.foot-h { font-weight: 700; margin: 0 0 8px; color: #fff; } footer ul { list-style: none; padding: 0; margin: 0; } footer li { margin: 6px 0; }
.foot-fine { color: #857b6b; border-top: 1px solid rgba(255,255,255,.08); padding-top: 16px; margin-top: 28px; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } html { scroll-behavior: auto; } }

/* ——— Practice (连词成句) ——— */
.practice { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin: 8px 0 12px; }
.pr-top { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.pr-score { color: var(--jade); font-weight: 600; }
.pr-en { font-size: 18px; color: var(--ink-2); margin: 10px 0 12px; font-style: italic; }
.pr-answer { min-height: 66px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; border-radius: 12px; background: repeating-linear-gradient(var(--bg) 0 64px, var(--line) 64px 65px); border: 1px dashed var(--line-2); }
.pr-hint { color: var(--faint); font-size: 15px; }
.pr-bank { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; min-height: 50px; }
.chunk { font: 600 22px/1 var(--serif); color: var(--ink); background: var(--surface); border: 1.5px solid var(--line-2); border-bottom-width: 3px; border-radius: 10px; padding: 10px 14px; cursor: pointer; transition: transform .1s, border-color .1s; }
.chunk:hover { border-color: var(--accent); transform: translateY(-1px); }
.pr-answer .chunk { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.done .chunk { cursor: default; transform: none; }
.chunk.static { display: inline-block; cursor: default; font-size: 18px; padding: 6px 10px; margin: 0 6px 6px 0; }
.pr-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.pr-actions .btn:last-child { margin-left: auto; }
.btn.ghost { margin-left: 0; background: transparent; color: var(--ink-2); border: 1px solid var(--line-2); box-shadow: none; font-weight: 600; }
.btn.ghost:hover { background: var(--bg-2); color: var(--ink); transform: none; }
.pr-result:empty { display: none; } .pr-result { margin-top: 14px; border-top: 1px dashed var(--line-2); padding-top: 14px; }
@media (max-width: 520px) { .chunk { font-size: 20px; padding: 9px 12px; } .pr-actions .btn { flex: 1; } }
.drill { padding-left: 22px; display: grid; gap: 10px; }
.drill li { padding: 4px 0 8px; border-bottom: 1px solid var(--line); }
.drill-q { margin: 4px 0; } .drill details summary { cursor: pointer; color: var(--accent-ink); font-weight: 600; font-size: 15px; }
.drill .zh { font-size: 20px; margin: 6px 0 0; } .drill .en { color: var(--muted); margin: 2px 0 0; }

/* ——— Exam pages ——— */
table.exam td, table.exam th { white-space: nowrap; } td.num-r { text-align: right; font-variant-numeric: tabular-nums; }
.lv-links { font-size: 14px; } .lv-links a { font-weight: 600; text-decoration: none; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--accent-soft); }
.timeline li { position: relative; display: grid; gap: 2px; padding: 0 0 18px 22px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.timeline li:last-child::before { background: var(--accent); }
.timeline b { font-family: var(--serif); } .timeline span { color: var(--ink-2); }
.sources { margin-top: 30px; }

/* ——— Listen buttons ——— */
.say { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-left: 8px; vertical-align: middle; padding: 0; border: 1px solid var(--line-2); border-radius: 50%; background: var(--surface); color: var(--accent); cursor: pointer; }
.say svg { width: 16px; height: 16px; } .say:hover { background: var(--accent-soft); }
.say[hidden] { display: none; }
h1 .say { width: 36px; height: 36px; } h1 .say svg { width: 20px; height: 20px; }
.answer-tiles { display: flex; align-items: center; gap: 6px; }
.kicker .say { width: 26px; height: 26px; margin-left: 4px; }

/* ——— Checker extras ——— */
.suggest { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 10px 0 0; padding: 12px 14px; background: var(--accent-soft); border-radius: 12px; }
.suggest .btn { margin-left: auto; }
.saved { margin-top: 10px; }
.checker > .fine a { color: var(--muted); }

/* ——— Search ——— */
.search-link { order: 3; margin-left: 8px; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--ink-2); }
.search-link:hover { background: var(--bg-2); color: var(--ink); } .search-link svg { width: 20px; height: 20px; }
header nav { order: 2; }
form.search { display: flex; gap: 8px; margin: 0 0 18px; }
form.search input { flex: 1; min-width: 0; font: 500 20px var(--serif); padding: 10px 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); color: var(--ink); }
form.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
form.search .btn { margin-left: 0; }
.results { list-style: none; padding: 0; display: grid; gap: 8px; }
.results a { display: grid; grid-template-columns: auto auto 1fr auto; gap: 4px 12px; align-items: baseline; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); }
.results a:hover { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.r-zh { font: 700 22px var(--serif); } .r-en { color: var(--ink-2); font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .results a { grid-template-columns: auto 1fr auto; } .results .r-en { grid-column: 1 / -1; white-space: normal; } }

/* ——— My mistakes ——— */
.mistake-log { list-style: none; padding: 0; display: grid; gap: 10px; }
.mistake-log li { padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); display: grid; gap: 6px; }
.mistake-log .wrong, .mistake-log .right { margin: 0; display: flex; gap: 10px; align-items: center; padding: 6px 10px; border-radius: 8px; font-size: 19px; }
.mistake-log .why { margin: 0; padding-left: 2px; } .mistake-log .fine { margin: 0; }
.linkish { background: none; border: 0; padding: 0; color: var(--accent-ink); text-decoration: underline; cursor: pointer; font: inherit; }

/* ——— Practice and guides ——— */
.page-head.compact { margin-bottom: 12px; padding-bottom: 0; border-bottom: 0; }
.page-head.compact h1 { font-size: clamp(26px, 4vw, 38px); }
.pr-top { align-items: center; gap: 12px; }
.pr-toggle { display: inline-flex; gap: 6px; align-items: center; margin-left: auto; cursor: pointer; }
.pr-en[hidden] { display: block; visibility: hidden; }
.plain-steps { margin: 6px 0; padding-left: 20px; color: var(--ink-2); font-size: 15px; } .plain-steps li { margin: 3px 0; }

/* ——— Phones: the header scrolls away (it took 100px), and the nav fades at the edge to show it scrolls ——— */
@media (max-width: 720px) {
  header.site { position: static; }
  header nav { -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); padding-right: 24px; }
  .search-link { order: 1; margin-left: auto; }
  .pr-actions .btn.ghost { flex: 0 1 auto; }
}
@media (max-width: 520px) {
  .pr-actions { flex-wrap: nowrap; }
  .pr-actions .btn { width: auto; padding: 12px 12px; font-size: 15px; }
  .pr-actions .btn:last-child { flex: 1; }
}
form.search .btn { width: auto; flex: none; }

/* ——— Pinyin sandhi, HSK vocabulary analyzer, exports & share bar ——— */
.res-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.res-bar .verdict { margin: 0; }
.share-btn { font-size: 14px; }
.bar-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.bar-row .level-tabs, .bar-row .formula { margin: 0; }
.dl-links { margin: 0; font-size: 14px; color: var(--muted); font-weight: 600; }
.ruby-grid { display: flex; flex-wrap: wrap; gap: 8px 6px; align-items: flex-end; padding: 12px 14px; background: var(--bg); border-radius: 12px; margin: 4px 0 12px; }
.ruby-cell { display: inline-flex; flex-direction: column; align-items: center; padding: 4px 7px; border-radius: 8px; border: 1px solid transparent; }
.ruby-cell.sandhi { background: var(--gold-soft); border-color: color-mix(in srgb, var(--gold) 45%, transparent); }
.ruby-py { font: 600 14px/1.2 var(--sans); }
.ruby-orig { font: 400 11px/1 var(--sans); color: var(--faint); text-decoration: line-through; }
.ruby-zh { font: 700 24px/1.25 var(--serif); }
.ruby-zh a { text-decoration: none; color: inherit; } .ruby-zh a:hover { color: var(--accent); }
.ruby-punct { font: 700 22px/1.25 var(--serif); padding: 0 2px 4px; color: var(--muted); }
.lv-chips { list-style: none; padding: 0; margin: 6px 0 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.lv-chip { display: inline-flex; gap: 6px; align-items: baseline; padding: 4px 11px; border-radius: 999px; font-size: 14px; background: var(--bg); border: 1px solid var(--line-2); }
.annotated-text { line-height: 2.1; font-size: 22px; padding: 14px 16px; background: var(--bg); border-radius: 12px; margin: 4px 0 14px; }
.v-link { text-decoration: none; color: inherit; }
.v-tok { display: inline-block; padding: 1px 6px; margin: 0 2px; border-radius: 6px; border-bottom: 2px solid var(--line-2); }
.v-tok sub { font: 600 11px var(--sans); margin-left: 2px; color: var(--muted); }
.lv-1 { background: color-mix(in srgb, var(--jade-soft) 75%, transparent); border-color: var(--jade); }
.lv-2 { background: color-mix(in srgb, var(--accent-soft) 75%, transparent); border-color: var(--accent); }
.lv-3 { background: color-mix(in srgb, var(--gold-soft) 75%, transparent); border-color: var(--gold); }
.lv-4, .lv-5, .lv-6 { background: color-mix(in srgb, var(--seal-soft) 70%, transparent); border-color: var(--seal); }

/* ——— Spot the mistake quiz, printable worksheets & embed box ——— */
.spot-choices { display: grid; gap: 10px; margin: 12px 0 14px; }
.spot-btn { width: 100%; text-align: left; font: 600 22px/1.4 var(--serif); color: var(--ink); background: var(--bg); border: 1.5px solid var(--line-2); border-radius: 12px; padding: 14px 18px; cursor: pointer; transition: border-color .12s, background .12s; }
.spot-btn:hover { border-color: var(--accent); background: var(--surface); }
.spot-btn.is-right { background: var(--jade-soft); border-color: var(--jade); }
.spot-btn.is-wrong { background: var(--seal-soft); border-color: var(--seal); text-decoration: line-through 1.5px var(--seal); }
.pr-toggle select { font: inherit; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); color: var(--ink); }
.code-box { overflow-x: auto; padding: 14px 16px; background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 12px; font: 14px/1.5 var(--mono); }
.worksheet { background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 28px 32px; box-shadow: var(--shadow); }
.ws-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 12px; border-bottom: 2px solid var(--ink); padding-bottom: 14px; margin-bottom: 18px; }
.ws-head h1 { font-size: 28px; margin: 4px 0 0; }
.ws-meta { font-size: 15px; color: var(--muted); margin: 0; }
.ws-grid { list-style: none; padding: 0; margin: 12px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px 24px; }
.ws-word { display: grid; gap: 6px; }
.ws-info .zh { font: 700 20px var(--serif); }
.ws-boxes { display: flex; gap: 6px; flex-wrap: wrap; }
.tile.ws-tile { --s: 48px; border-width: 1px; box-shadow: none; }
.tile.ws-tile.trace { color: color-mix(in srgb, var(--ink) 28%, transparent); }
.ws-list { padding-left: 22px; display: grid; gap: 14px; }
.ws-list p { margin: 0 0 4px; }
.ws-line { height: 28px; border-bottom: 1px dashed var(--line-2); }
.ws-answers { margin-top: 32px; padding-top: 16px; border-top: 1px dashed var(--line-2); font-size: 14px; color: var(--ink-2); }
@media print {
  header.site, footer.site, .crumbs, .no-print { display: none !important; }
  body { background: #fff; color: #000; font-size: 14px; }
  main { padding: 0; max-width: none; }
  .worksheet { border: 0; box-shadow: none; padding: 0; }
}
