/* =========================================================
   研墨 · Editorial study desk
   ========================================================= */
:root {
  --bg: #f2eee5;
  --bg-deep: #e9e2d5;
  --paper: #fbf8f1;
  --paper-2: #f7f2e8;
  --ink: #202a25;
  --ink-soft: #3c473f;
  --muted: #737a70;
  --muted-2: #93998f;
  --line: #d8d0c1;
  --line-strong: #bfb5a3;
  --accent: #b64b32;
  --accent-soft: #f2ded5;
  --accent-deep: #8f3522;
  --moss: #2f5d4d;
  --moss-soft: #dce7de;
  --gold: #ad8750;
  --gold-soft: #eee3cc;
  --blue: #3e6177;
  --danger: #a23c32;
  --shadow: 0 18px 50px -28px rgba(46, 39, 28, .38);
  --shadow-soft: 0 8px 30px -20px rgba(46, 39, 28, .28);
  --radius: 16px;
  --radius-sm: 10px;
  --serif: "Songti SC", "STSong", "Noto Serif SC", "SimSun", Georgia, "Times New Roman", serif;
  --sans: "Aptos", "Segoe UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --maxw: 1220px;
}

[data-theme="dark"] {
  --bg: #151b18;
  --bg-deep: #101512;
  --paper: #1d2521;
  --paper-2: #222b26;
  --ink: #eae4d7;
  --ink-soft: #d3cec2;
  --muted: #a1a89e;
  --muted-2: #7f877e;
  --line: #344039;
  --line-strong: #4a584f;
  --accent: #df7958;
  --accent-soft: #3a2822;
  --accent-deep: #f09a7c;
  --moss: #8db9a4;
  --moss-soft: #26382f;
  --gold: #c7a56f;
  --gold-soft: #382f22;
  --blue: #8bb1c5;
  --danger: #e08a7e;
  --shadow: 0 18px 55px -24px rgba(0, 0, 0, .62);
  --shadow-soft: 0 8px 32px -18px rgba(0, 0, 0, .48);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 55% at 8% 0%, rgba(255,255,255,.65), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 15%, rgba(182,75,50,.055), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg) 55%, var(--bg-deep));
}
[data-theme="dark"] body::before {
  background:
    radial-gradient(ellipse 80% 55% at 8% 0%, rgba(120,160,135,.07), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 15%, rgba(223,121,88,.06), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg) 55%, var(--bg-deep));
}
.grain {
  position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .3;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.11'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
[data-theme="dark"] .grain { mix-blend-mode: screen; opacity: .17; }

::selection { background: var(--accent); color: #fff9f0; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
svg { display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
img { max-width: 100%; }
p, h1, h2, h3, h4, ul, ol, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
mark { background: transparent; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.skip-link {
  position: fixed; left: 14px; top: -60px; z-index: 200;
  background: var(--ink); color: var(--paper); padding: 8px 14px; border-radius: 8px;
}
.skip-link:focus { top: 10px; }

/* ---------- shared ---------- */
.wrap { width: min(var(--maxw), calc(100% - 48px)); margin-inline: auto; }
.serif { font-family: var(--serif); }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.tiny { font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.divider { height: 1px; background: var(--line); border: 0; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .15em; text-transform: uppercase;
  color: var(--moss); font-weight: 600;
}
.eyebrow::before { content: ""; width: 22px; height: 1px; background: currentColor; opacity: .65; }
.kicker {
  font-family: var(--mono); font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--accent); font-weight: 700;
}
.section-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  margin-bottom: 26px;
}
.section-head h2 {
  font-family: var(--serif); font-weight: 700; font-size: clamp(25px, 3vw, 34px);
  line-height: 1.25; letter-spacing: -.01em;
}
.section-head p { margin-top: 8px; color: var(--muted); max-width: 56ch; }
.section-link {
  flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft);
  border-bottom: 1px solid var(--line-strong); padding-bottom: 3px; white-space: nowrap;
}
.section-link svg { width: 13px; height: 13px; flex: none; }
.section-link:hover { color: var(--accent); border-color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 42px; padding: 0 18px; border-radius: 999px;
  border: 1px solid transparent; background: var(--ink); color: var(--paper);
  font-weight: 600; font-size: 13.5px; transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--accent); color: #fff9f1; }
.btn-primary:hover { background: var(--accent-deep); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { border-color: var(--ink); background: var(--paper); }
.btn-soft { background: var(--paper); color: var(--ink); border-color: var(--line); }
.btn-soft:hover { border-color: var(--line-strong); }
.btn-sm { min-height: 34px; padding: 0 13px; font-size: 12.5px; }
.btn-xs { min-height: 28px; padding: 0 10px; font-size: 11.5px; gap: 5px; }
.btn-block { width: 100%; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); background: transparent; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 75%, transparent); color: var(--ink-soft);
  display: inline-grid; place-items: center; transition: .18s ease;
}
.icon-btn:hover { border-color: var(--line-strong); background: var(--paper); color: var(--accent); }
.icon-btn svg { width: 17px; height: 17px; }

.tag {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; line-height: 1; letter-spacing: .02em;
  padding: 6px 8px; border-radius: 6px; border: 1px solid var(--line);
  color: var(--muted); background: color-mix(in srgb, var(--paper) 55%, transparent);
  white-space: nowrap;
}
.tag.accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); background: var(--accent-soft); }
.tag.moss { color: var(--moss); border-color: color-mix(in srgb, var(--moss) 25%, var(--line)); background: var(--moss-soft); }
.tag.gold { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 30%, var(--line)); background: var(--gold-soft); }

.pill {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 11px; font-size: 11.5px; color: var(--muted);
  background: color-mix(in srgb, var(--paper) 70%, transparent);
}
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--moss); flex: none; }
.dot.accent { background: var(--accent); }

.field {
  width: 100%; border: 1px solid var(--line); background: var(--paper);
  border-radius: 10px; padding: 10px 12px; color: var(--ink); font-size: 14px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.field::placeholder { color: var(--muted-2); }
.field:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
textarea.field { resize: vertical; line-height: 1.8; }
label.field-label { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; letter-spacing: .03em; }

.empty {
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
  padding: 38px 26px; text-align: center; color: var(--muted); background: color-mix(in srgb, var(--paper) 45%, transparent);
}
.empty strong { display: block; font-family: var(--serif); font-size: 19px; color: var(--ink-soft); margin-bottom: 6px; }

/* ---------- header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 80;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.15);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
}
.topbar-inner {
  width: min(var(--maxw), calc(100% - 48px)); margin-inline: auto;
  min-height: 68px; display: flex; align-items: center; gap: 28px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; flex: none; }
.brand-seal {
  width: 38px; height: 38px; border-radius: 9px; background: var(--accent); color: #fff7ea;
  display: grid; place-items: center; font-family: var(--serif); font-size: 21px; font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 4px 12px -4px rgba(143,53,34,.5);
  transform: rotate(-2deg);
}
.brand-seal.small { width: 31px; height: 31px; font-size: 17px; border-radius: 7px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-family: var(--serif); font-size: 19px; letter-spacing: .15em; }
.brand-text small { margin-top: 4px; font-family: var(--mono); font-size: 8px; letter-spacing: .16em; color: var(--muted); }
.nav-links { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nav-links a {
  position: relative; padding: 8px 10px; font-size: 12.5px; color: var(--muted); border-radius: 8px;
  transition: color .18s ease, background .18s ease;
}
.nav-links a:hover { color: var(--ink); background: color-mix(in srgb, var(--paper) 65%, transparent); }
.nav-links a.active { color: var(--ink); font-weight: 600; }
.nav-links a.active::after {
  content: ""; position: absolute; left: 10px; right: 10px; bottom: 2px; height: 2px; background: var(--accent); border-radius: 2px;
}
.nav-actions { display: flex; align-items: center; gap: 7px; flex: none; }
.search-trigger { width: auto; padding: 0 10px 0 12px; border-radius: 999px; gap: 7px; display: inline-flex; align-items: center; }
.search-trigger svg { width: 14px; height: 14px; }
.search-hint { font-family: var(--mono); font-size: 9px; letter-spacing: .06em; color: var(--muted-2); }
.mobile-toggle { display: none; }
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

/* ---------- hero ---------- */
.home { padding: 54px 0 90px; }
.hero {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr);
  gap: clamp(34px, 6vw, 84px); align-items: center; padding: 30px 0 48px;
}
.hero-copy { position: relative; }
.hero-copy::after {
  content: "研"; position: absolute; right: -18px; top: -70px; z-index: -1;
  font-family: var(--serif); font-size: 220px; line-height: 1; color: var(--ink); opacity: .025;
  pointer-events: none;
}
.hero h1 {
  margin: 18px 0 20px; font-family: var(--serif); font-weight: 700;
  font-size: clamp(42px, 5.6vw, 68px); line-height: 1.14; letter-spacing: -.035em;
}
.hero h1 .accent {
  position: relative; display: inline-block; color: var(--accent); font-style: italic; padding-right: .05em;
}
.hero h1 .accent::after {
  content: ""; position: absolute; left: 2px; right: 4px; bottom: .08em; height: .12em;
  background: currentColor; opacity: .15; border-radius: 50%; transform: rotate(-1deg);
}
.hero-sub { max-width: 47ch; font-size: 15.5px; line-height: 1.9; color: var(--ink-soft); }
.hero-sub strong { color: var(--ink); font-weight: 600; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 11px; margin-top: 30px; }
.hero-meta {
  display: flex; flex-wrap: wrap; gap: 9px 18px; margin-top: 27px;
  color: var(--muted); font-size: 11.5px;
}
.hero-meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta i { width: 4px; height: 4px; border-radius: 50%; background: var(--line-strong); }

.ticket {
  position: relative; background: var(--paper); border: 1px solid var(--line);
  border-radius: 4px 18px 18px 4px; padding: 24px 25px 22px 31px;
  box-shadow: var(--shadow); transform: rotate(.7deg);
}
.ticket::before {
  content: ""; position: absolute; left: 12px; top: 18px; bottom: 18px; width: 1px;
  border-left: 1px dashed var(--line-strong);
}
.ticket::after {
  content: ""; position: absolute; left: -7px; top: 50%; width: 13px; height: 13px;
  border: 1px solid var(--line); border-radius: 50%; background: var(--bg); transform: translateY(-50%);
}
.ticket-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.ticket-label { font-family: var(--mono); font-size: 9.5px; letter-spacing: .15em; color: var(--accent); }
.ticket-no {
  font-family: var(--serif); font-size: 48px; line-height: .9; color: var(--accent); opacity: .9;
  letter-spacing: -.06em;
}
.ticket h2 { margin: 19px 0 9px; font-family: var(--serif); font-size: 25px; line-height: 1.35; }
.ticket p { color: var(--muted); font-size: 12.5px; line-height: 1.8; }
.ticket-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 20px; }
.ticket-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-top: 16px; border-top: 1px solid var(--line);
}
.ticket-foot small { color: var(--muted-2); font-size: 10.5px; line-height: 1.5; }
.ticket-stamp {
  position: absolute; right: -21px; bottom: 23px; width: 50px; height: 50px; border: 1px solid var(--accent);
  color: var(--accent); border-radius: 50%; display: grid; place-items: center; transform: rotate(-12deg);
  font-family: var(--serif); font-size: 10px; letter-spacing: .1em; opacity: .75; line-height: 1.2; text-align: center;
  background: var(--bg);
}
.mini-progress { margin-top: 4px; }
.mini-progress .bar { height: 4px; background: var(--line); border-radius: 99px; overflow: hidden; }
.mini-progress .bar i { display: block; height: 100%; background: var(--moss); border-radius: inherit; }

/* ---------- stats ---------- */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stat { background: color-mix(in srgb, var(--paper) 72%, var(--bg)); padding: 20px 21px 18px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { font-size: 11px; color: var(--muted); letter-spacing: .04em; }
.stat-value { margin-top: 7px; font-family: var(--serif); font-size: 31px; line-height: 1; letter-spacing: -.02em; }
.stat-value small { font-family: var(--sans); font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 3px; letter-spacing: 0; }
.stat-note { margin-top: 7px; font-size: 10.5px; color: var(--muted-2); }
.stat-icon { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; color: var(--accent); }
.stat-icon svg { width: 13px; height: 13px; }

/* ---------- home sections ---------- */
.home-section { margin-top: 68px; }
.path-strip {
  display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.path-item { position: relative; padding: 20px 15px 21px 0; border-right: 1px solid var(--line); min-width: 0; }
.path-item:last-child { border-right: 0; padding-right: 0; }
.path-item .day { font-family: var(--mono); font-size: 9.5px; letter-spacing: .12em; color: var(--accent); }
.path-item h3 { margin: 9px 0 5px; font-family: var(--serif); font-size: 16px; line-height: 1.35; }
.path-item p { font-size: 11px; line-height: 1.65; color: var(--muted); }
.path-item a { position: absolute; inset: 0; }
.path-item:hover h3 { color: var(--accent); }
.path-item.done .day::after { content: " · 已完成"; color: var(--moss); }

.entry-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.entry-card {
  position: relative; display: flex; flex-direction: column; min-height: 220px;
  padding: 24px 23px 21px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.entry-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-soft); border-color: var(--line-strong); }
.entry-card .num { font-family: var(--mono); font-size: 10px; color: var(--accent); letter-spacing: .12em; }
.entry-card h3 { margin: 22px 0 9px; font-family: var(--serif); font-size: 24px; letter-spacing: -.01em; }
.entry-card p { font-size: 12.5px; color: var(--muted); line-height: 1.8; max-width: 30ch; }
.entry-card .arrow { margin-top: auto; padding-top: 22px; display: flex; align-items: center; justify-content: space-between; color: var(--ink-soft); font-size: 12px; }
.entry-card .arrow svg { width: 17px; height: 17px; transition: transform .2s ease; }
.entry-card:hover .arrow svg { transform: translateX(5px); color: var(--accent); }
.entry-card::after {
  content: attr(data-glyph); position: absolute; right: 10px; bottom: -26px; font-family: var(--serif);
  font-size: 120px; line-height: 1; color: var(--ink); opacity: .035; pointer-events: none;
}

.feature-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; align-items: stretch; }
.quote-panel {
  position: relative; padding: 34px 35px 30px; border-radius: var(--radius);
  background: var(--ink); color: #f4eee2; overflow: hidden; display: flex; flex-direction: column;
}
[data-theme="dark"] .quote-panel { background: #0e1411; border: 1px solid var(--line); }
.quote-panel::before {
  content: "“"; position: absolute; top: -42px; right: 24px; font-family: Georgia, serif;
  font-size: 220px; line-height: 1; color: #fff; opacity: .06;
}
.quote-panel .eyebrow { color: #c8a87a; }
.quote-panel blockquote {
  margin: 26px 0 22px; font-family: var(--serif); font-size: clamp(23px, 2.6vw, 31px);
  line-height: 1.55; letter-spacing: .01em; max-width: 26ch;
}
.quote-panel blockquote span { color: #d9a184; }
.quote-panel .quote-zh { color: rgba(244,238,226,.58); font-size: 12px; line-height: 1.8; }
.quote-foot { margin-top: auto; padding-top: 25px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.quote-foot .source { font-family: var(--mono); font-size: 9px; color: rgba(244,238,226,.42); letter-spacing: .08em; }

.daily-card { padding: 27px 26px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); display: flex; flex-direction: column; }
.daily-card .kicker { margin-bottom: 16px; }
.daily-card h3 { font-family: var(--serif); font-size: 22px; margin-bottom: 9px; }
.daily-card p { color: var(--muted); font-size: 12.5px; line-height: 1.8; }
.daily-card .daily-en { margin: 18px 0 11px; padding: 15px 16px; border-left: 2px solid var(--accent); background: var(--paper-2); font-family: Georgia, serif; font-size: 15px; line-height: 1.75; }
.daily-card .daily-zh { color: var(--muted); font-size: 12px; }
.daily-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 20px; }

/* ---------- page shell ---------- */
.page { padding: 38px 0 84px; }
.crumb { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); margin-bottom: 20px; }
.crumb a:hover { color: var(--accent); }
.crumb svg { width: 12px; height: 12px; opacity: .6; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 30px; margin-bottom: 34px; }
.page-head h1 { margin: 8px 0 10px; font-family: var(--serif); font-size: clamp(33px, 4.2vw, 50px); line-height: 1.15; letter-spacing: -.025em; }
.page-head p { color: var(--muted); max-width: 66ch; line-height: 1.85; }
.page-head .head-count { flex: none; text-align: right; color: var(--muted); }
.page-head .head-count strong { display: block; font-family: var(--serif); font-size: 30px; color: var(--ink); line-height: 1; }
.page-head .head-count span { font-size: 10px; letter-spacing: .08em; }

/* ---------- template library ---------- */
.library-layout { display: grid; grid-template-columns: 228px minmax(0, 1fr); gap: 28px; align-items: start; }
.filter-rail { position: sticky; top: 92px; border: 1px solid var(--line); border-radius: var(--radius); background: color-mix(in srgb, var(--paper) 68%, transparent); padding: 17px 15px; }
.rail-block + .rail-block { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.rail-title { font-family: var(--mono); font-size: 9px; letter-spacing: .13em; color: var(--muted-2); margin-bottom: 9px; text-transform: uppercase; }
.scope-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 3px; border-radius: 9px; background: var(--bg-deep); }
.scope-switch button {
  border: 0; background: transparent; color: var(--muted); border-radius: 7px; min-height: 31px;
  font-size: 12px; font-weight: 600; transition: .18s ease;
}
.scope-switch button.active { background: var(--paper); color: var(--ink); box-shadow: 0 1px 5px rgba(0,0,0,.06); }
.section-nav { display: flex; flex-direction: column; gap: 2px; }
.section-nav button {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; padding: 7px 9px; border: 0; border-radius: 7px; background: transparent;
  color: var(--muted); font-size: 11.5px; text-align: left;
}
.section-nav button span { font-family: var(--mono); font-size: 9px; color: var(--muted-2); }
.section-nav button:hover { background: var(--paper); color: var(--ink); }
.section-nav button.active { background: var(--ink); color: var(--paper); }
.section-nav button.active span { color: color-mix(in srgb, var(--paper) 58%, transparent); }
.rail-note { padding: 12px 13px; border-radius: 9px; background: var(--gold-soft); color: var(--ink-soft); font-size: 10.5px; line-height: 1.7; }
.rail-note strong { display: block; font-size: 11px; margin-bottom: 3px; color: var(--gold); }
.rail-progress { margin-top: 14px; }
.rail-progress small { color: var(--muted); font-size: 10px; }

.library-main { min-width: 0; }
.library-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px;
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--paper) 55%, transparent);
}
.search-box { position: relative; flex: 1; min-width: 190px; }
.search-box svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--muted); }
.search-box input { padding-left: 33px; border-color: transparent; background: transparent; font-size: 12.5px; }
.search-box input:focus { background: var(--paper); }
.toolbar-count { margin-left: auto; font-size: 10.5px; color: var(--muted-2); font-family: var(--mono); white-space: nowrap; }
.switchline { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); cursor: pointer; user-select: none; }
.switchline input { accent-color: var(--accent); width: 14px; height: 14px; }

.section-block { margin-bottom: 32px; scroll-margin-top: 96px; }
.section-block-head { display: flex; align-items: baseline; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line-strong); margin-bottom: 13px; }
.section-block-head h2 { font-family: var(--serif); font-size: 21px; }
.section-block-head .count { font-family: var(--mono); font-size: 9.5px; color: var(--muted-2); }
.section-block-head .desc { margin-left: auto; font-size: 10.5px; color: var(--muted); text-align: right; max-width: 45ch; }
.sentence-grid { display: grid; gap: 9px; }
.sentence-card {
  position: relative; padding: 15px 17px 13px; border: 1px solid var(--line); border-radius: 11px;
  background: color-mix(in srgb, var(--paper) 78%, var(--bg)); transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.sentence-card:hover { border-color: var(--line-strong); background: var(--paper); box-shadow: var(--shadow-soft); }
.sentence-card.is-fav { border-left: 2px solid var(--accent); }
.sentence-top { display: flex; align-items: center; gap: 8px; }
.sentence-group { font-family: var(--mono); font-size: 9px; letter-spacing: .06em; color: var(--accent); text-transform: uppercase; }
.sentence-label { font-size: 10.5px; color: var(--muted-2); }
.sentence-actions { margin-left: auto; display: flex; align-items: center; gap: 3px; }
.mini-act {
  width: 27px; height: 27px; border: 0; background: transparent; border-radius: 6px; color: var(--muted-2);
  display: grid; place-items: center; transition: .16s ease;
}
.mini-act:hover { color: var(--accent); background: var(--accent-soft); }
.mini-act.is-on { color: var(--accent); }
.mini-act svg { width: 14px; height: 14px; }
.sentence-en { margin: 8px 0 5px; font-family: Georgia, "Times New Roman", serif; font-size: 15px; line-height: 1.7; color: var(--ink); }
.slot {
  display: inline; color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent);
  padding: 0 3px; border-radius: 3px; font-family: var(--mono); font-size: .78em;
  font-style: normal; white-space: nowrap; letter-spacing: -.02em;
}
.slot i { font-style: normal; font-family: var(--sans); font-size: .92em; opacity: .82; }
.slot.filled { color: var(--moss); background: var(--moss-soft); font-family: var(--sans); font-size: .9em; }
.sentence-en .slot { font-size: 12px; }
.sentence-zh .slot { font-size: 9.5px; padding: 0 2px; }
.scaffold-line .slot { font-size: 11px; }
.template-item .en .slot { font-size: 11.5px; }
.sentence-zh { font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.sentence-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.sentence-foot .use-btn { margin-left: auto; }
.sentence-note { margin-top: 9px; padding-top: 8px; border-top: 1px dashed var(--line); font-size: 10.5px; color: var(--muted-2); }
.sentence-card.hide, .section-block.hide { display: none; }

/* ---------- template studio: left config / right essay canvas ---------- */
.template-studio { display: grid; grid-template-columns: 292px minmax(0, 1fr); gap: 20px; align-items: start; }
.studio-side {
  position: sticky; top: 92px; padding: 20px 17px 16px; border: 1px solid var(--line);
  border-radius: 15px; background: color-mix(in srgb, var(--paper) 74%, transparent);
}
.studio-side-head h2 { margin: 7px 0 4px; font-family: var(--serif); font-size: 24px; }
.studio-side-head p { margin-bottom: 14px; color: var(--muted); font-size: 10.5px; line-height: 1.7; }
.studio-side .scope-switch { width: 100%; }
.studio-side .format-switch { margin-top: 7px; width: 100%; }
.studio-side .format-switch button { flex: 1; }
.studio-nav { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.studio-nav button {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%;
  border: 0; background: transparent; color: var(--muted); padding: 7px 6px; border-radius: 6px;
  font-size: 10.5px; text-align: left;
}
.studio-nav button span:last-child { font-family: var(--mono); font-size: 8.5px; color: var(--muted-2); }
.studio-nav button:hover { background: var(--paper); color: var(--accent); }
.studio-stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 16px; padding: 10px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.studio-stat div { display: flex; flex-direction: column; align-items: center; gap: 3px; border-right: 1px solid var(--line); }
.studio-stat div:last-child { border-right: 0; }
.studio-stat span { font-size: 8.5px; color: var(--muted-2); }
.studio-stat b { font-family: var(--serif); font-size: 20px; line-height: 1; }
.studio-side-actions { display: grid; gap: 6px; margin-top: 14px; }
.studio-tip { margin-top: 13px; padding: 10px 11px; border-radius: 7px; background: var(--gold-soft); color: var(--ink-soft); font-size: 9.5px; line-height: 1.7; }
.studio-canvas { min-width: 0; }
.studio-sheet {
  position: relative; min-height: 540px; padding: 0 27px 16px; border: 1px solid var(--line);
  border-radius: 4px; background: var(--paper); box-shadow: var(--shadow);
}
.studio-sheet::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--accent), var(--gold), var(--moss)); opacity: .7; }
.studio-sheet-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; padding: 25px 0 17px; border-bottom: 1px solid var(--line); }
.studio-sheet-head h2 { margin: 7px 0 4px; font-family: var(--serif); font-size: 28px; line-height: 1.3; }
.studio-sheet-head p { max-width: 55ch; font-size: 10.5px; color: var(--muted); line-height: 1.75; }
.studio-page { font-family: var(--mono); font-size: 9px; color: var(--muted-2); letter-spacing: .08em; }
.studio-sheet-body { padding: 14px 0 8px; }
.studio-para {
  display: grid; grid-template-columns: 42px minmax(0, 1fr) 92px; gap: 13px; align-items: start;
  width: 100%; padding: 18px 12px 18px 0; text-align: left; border: 0; border-bottom: 1px dashed var(--line);
  background: transparent; transition: background .17s ease, padding .17s ease;
}
.studio-para:last-child { border-bottom: 0; }
.studio-para:hover { background: color-mix(in srgb, var(--accent-soft) 34%, transparent); padding-left: 10px; border-radius: 8px; }
.studio-para-no { font-family: var(--serif); font-size: 30px; line-height: 1; color: var(--accent); padding-top: 2px; }
.studio-para-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.studio-para-kicker { font-family: var(--mono); font-size: 8px; letter-spacing: .1em; color: var(--muted-2); text-transform: uppercase; }
.studio-para-main strong { font-family: var(--serif); font-size: 20px; line-height: 1.3; }
.studio-para-desc { font-size: 10.5px; line-height: 1.7; color: var(--muted); }
.studio-para-skeleton { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; margin-top: 4px; }
.studio-para-skeleton i { font-style: normal; font-size: 8.5px; color: var(--moss); background: var(--moss-soft); border-radius: 4px; padding: 3px 5px; }
.studio-para-skeleton em { font-style: normal; color: var(--line-strong); font-size: 9px; }
.studio-para-foot { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding-top: 5px; font-size: 9px; color: var(--muted-2); text-align: right; }
.studio-para-foot b { font-family: var(--serif); font-size: 25px; line-height: 1; color: var(--accent); font-weight: 400; }
.studio-para-foot span { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.studio-para-foot svg { width: 10px; height: 10px; }
.studio-para:hover .studio-para-foot { color: var(--accent); }
.studio-sheet-foot { display: flex; justify-content: space-between; gap: 14px; padding-top: 13px; border-top: 1px solid var(--line); font-family: var(--mono); font-size: 8.5px; color: var(--muted-2); letter-spacing: .02em; }
.service-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper-2); }
.service-toolbar .search-box { flex: 1; min-width: 190px; }
.service-toolbar .toolbar-count { margin-left: auto; }
.service-toolbar + .bp-type-tabs { margin-top: 10px; }

/* ---------- template blueprint ---------- */
.blank-demo {
  color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-radius: 3px; padding: 0 4px; font-family: var(--mono); font-size: .85em; white-space: nowrap;
}
.blueprint-card {
  position: relative; padding: 25px 26px 21px; border: 1px solid var(--line);
  border-radius: 18px; background: var(--paper); box-shadow: var(--shadow-soft); overflow: hidden;
}
.blueprint-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--gold), var(--moss)); opacity: .75;
}
.blueprint-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 26px; flex-wrap: wrap; }
.blueprint-head h2 { margin: 8px 0 5px; font-family: var(--serif); font-size: 28px; line-height: 1.3; }
.blueprint-head p { max-width: 64ch; color: var(--muted); font-size: 11.5px; line-height: 1.8; }
.blueprint-controls { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.scope-switch.wide { width: 220px; }
.format-switch { display: flex; gap: 3px; padding: 3px; border-radius: 8px; background: var(--bg-deep); }
.format-switch button {
  border: 0; background: transparent; color: var(--muted); border-radius: 6px;
  min-height: 27px; padding: 0 12px; font-size: 10.5px; transition: .16s ease;
}
.format-switch button.active { background: var(--paper); color: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.06); font-weight: 600; }
.blueprint-flow { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 22px; }
.blueprint-flow.small { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.bp-block {
  position: relative; display: flex; flex-direction: column; gap: 5px; min-width: 0;
  padding: 15px 15px 13px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--paper-2); text-align: left; transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.bp-block:hover { border-color: var(--line-strong); transform: translateY(-2px); box-shadow: var(--shadow-soft); }
.bp-block.active {
  border-color: var(--accent); background: linear-gradient(180deg, color-mix(in srgb, var(--accent-soft) 58%, var(--paper)), var(--paper));
  box-shadow: 0 9px 28px -20px color-mix(in srgb, var(--accent) 55%, transparent);
}
.bp-block:not(:last-child)::after {
  content: "›"; position: absolute; right: -13px; top: 46%; z-index: 2;
  font-family: var(--serif); font-size: 19px; color: var(--line-strong); line-height: 1; pointer-events: none;
}
.bp-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bp-no { font-family: var(--serif); font-size: 24px; line-height: 1; color: var(--accent); }
.bp-tag { font-family: var(--mono); font-size: 8.5px; letter-spacing: .06em; color: var(--muted-2); }
.bp-title { margin-top: 2px; font-family: var(--serif); font-size: 20px; line-height: 1.3; }
.blueprint-flow.small .bp-title { font-size: 18px; }
.bp-desc { min-height: 32px; font-size: 10.5px; color: var(--muted); line-height: 1.65; }
.blueprint-flow.small .bp-desc { min-height: 46px; }
.bp-skeleton { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; margin: 5px 0 2px; }
.bp-skeleton i {
  font-style: normal; padding: 3px 5px; border-radius: 4px; background: var(--moss-soft);
  color: var(--moss); font-size: 8.5px; line-height: 1.2; white-space: nowrap;
}
.bp-skeleton em { font-style: normal; color: var(--line-strong); font-size: 9px; }
.bp-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  margin-top: auto; padding-top: 9px; border-top: 1px solid var(--line);
  font-size: 9px; color: var(--muted-2);
}
.bp-foot svg { width: 10px; height: 10px; }
.bp-block.active .bp-foot { color: var(--accent); }
.blueprint-note {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px;
  padding-top: 13px; border-top: 1px dashed var(--line); font-size: 10.5px; color: var(--muted);
}
.blueprint-note strong { font-family: var(--mono); font-size: 8.5px; letter-spacing: .08em; color: var(--gold); text-transform: uppercase; }
.blueprint-note a { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; color: var(--ink-soft); border-bottom: 1px solid var(--line-strong); padding-bottom: 2px; white-space: nowrap; }
.blueprint-note a svg { width: 12px; height: 12px; flex: none; }
.blueprint-note a:hover { color: var(--accent); border-color: var(--accent); }

.bp-panel {
  margin-top: 18px; padding: 24px 26px 22px; border: 1px solid var(--line);
  border-radius: 18px; background: var(--paper); scroll-margin-top: 88px;
}
.bp-panel-head { display: flex; justify-content: space-between; gap: 22px; align-items: flex-start; }
.bp-panel-head h2 { margin: 6px 0 5px; font-family: var(--serif); font-size: 29px; line-height: 1.3; }
.bp-panel-head p { max-width: 65ch; font-size: 11.5px; color: var(--muted); line-height: 1.8; }
.bp-panel-count { flex: none; text-align: right; }
.bp-panel-count strong { display: block; font-family: var(--serif); font-size: 34px; line-height: 1; color: var(--accent); }
.bp-panel-count span { font-size: 9px; color: var(--muted-2); letter-spacing: .06em; }
.bp-skeleton-line { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 15px; padding: 9px 11px; border-radius: 8px; background: var(--paper-2); border: 1px solid var(--line); }
.bp-skeleton-line span { font-size: 10px; color: var(--moss); background: var(--moss-soft); border-radius: 4px; padding: 3px 6px; }
.bp-skeleton-line em { font-style: normal; color: var(--line-strong); font-size: 10px; }
.bp-type-tabs { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 15px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.bp-type-tabs button {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--muted); padding: 6px 11px; font-size: 10.5px; transition: .16s ease;
}
.bp-type-tabs button span { font-family: var(--mono); font-size: 8.5px; color: var(--muted-2); }
.bp-type-tabs button:hover { border-color: var(--line-strong); color: var(--ink); }
.bp-type-tabs button.active { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.bp-type-tabs button.active span { color: color-mix(in srgb, var(--paper) 58%, transparent); }
.bp-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 14px 0 18px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: color-mix(in srgb, var(--paper-2) 58%, transparent); }
.bp-toolbar .search-box { flex: 1; min-width: 180px; }
.bp-toolbar .toolbar-count { margin-left: auto; }
.bp-group { margin-top: 22px; }
.bp-group-head { display: flex; align-items: baseline; gap: 9px; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.bp-group-head h3 { font-family: var(--serif); font-size: 19px; }
.bp-group-head > span { font-family: var(--mono); font-size: 9px; color: var(--muted-2); }
.bp-group-head p { margin-left: auto; max-width: 42ch; text-align: right; font-size: 10px; color: var(--muted); }
.bp-group.hide { display: none; }

/* ---------- question image ---------- */
.question-image-wrap {
  position: relative; display: block; width: 100%; margin-top: 9px; padding: 8px;
  border: 1px solid var(--line); border-radius: 10px; background: #fffdf8;
  overflow: hidden; cursor: zoom-in; text-align: left;
}
.question-image-wrap img { display: block; width: 100%; max-height: 405px; object-fit: contain; }
.question-image-wrap:hover { border-color: var(--accent); }
.zoom-hint {
  position: absolute; right: 9px; bottom: 9px; padding: 3px 7px; border-radius: 4px;
  background: rgba(32,42,37,.82); color: #fff9ef; font-size: 8.5px; letter-spacing: .04em;
}
.image-caption { margin-top: 7px; font-size: 10px; color: var(--muted-2); text-align: center; }
.zoom-image { display: block; width: 100%; max-height: 74vh; object-fit: contain; background: #fffdf8; border-radius: 8px; }

/* ---------- builder ---------- */
.builder-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 22px; align-items: start; }
.builder-side { position: sticky; top: 92px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); overflow: hidden; }
.builder-side-head { padding: 16px 17px 12px; border-bottom: 1px solid var(--line); }
.builder-side-head h2 { font-family: var(--serif); font-size: 19px; margin-bottom: 4px; }
.builder-side-head p { font-size: 10.5px; color: var(--muted); }
.builder-side .scope-switch { margin: 12px 15px; }
.builder-search { padding: 0 15px 10px; }
.builder-list { max-height: 455px; overflow: auto; padding: 0 9px 10px; scrollbar-width: thin; }
.builder-row { display: flex; align-items: flex-start; gap: 9px; padding: 9px 8px; border-radius: 8px; border: 0; background: transparent; width: 100%; text-align: left; }
.builder-row:hover { background: var(--paper-2); }
.builder-row .row-text { min-width: 0; flex: 1; }
.builder-row .row-group { font-family: var(--mono); font-size: 8.5px; color: var(--accent); letter-spacing: .04em; }
.builder-row .row-en { margin-top: 2px; font-family: Georgia, serif; font-size: 11.5px; line-height: 1.55; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.builder-row .add-btn { flex: none; width: 23px; height: 23px; border-radius: 50%; border: 1px solid var(--line); background: var(--paper); color: var(--muted); display: grid; place-items: center; }
.builder-row:hover .add-btn { color: var(--accent); border-color: var(--accent); }
.builder-row .add-btn svg { width: 11px; height: 11px; }
.builder-main { min-width: 0; }
.paper {
  background: var(--paper); border: 1px solid var(--line); border-radius: 4px;
  box-shadow: var(--shadow-soft); padding: 30px 32px 27px; position: relative;
}
.paper::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--accent), var(--gold), var(--moss)); opacity: .75; }
.paper-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; padding-bottom: 19px; border-bottom: 1px solid var(--line); }
.paper-head h2 { font-family: var(--serif); font-size: 25px; line-height: 1.3; }
.paper-head p { font-size: 11px; color: var(--muted); margin-top: 4px; }
.paper-head-actions { display: flex; gap: 7px; flex-wrap: wrap; justify-content: flex-end; }
.paper-name { display: flex; gap: 12px; align-items: flex-end; margin: 18px 0 22px; flex-wrap: wrap; }
.paper-name .grow { flex: 1; min-width: 220px; }
.paper-name input { font-family: var(--serif); font-size: 20px; }
.saved-templates { margin-top: 17px; }
.saved-templates summary { cursor: pointer; font-size: 11.5px; color: var(--muted); }
.saved-list { margin-top: 9px; display: grid; gap: 6px; }
.saved-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper-2); font-size: 11.5px; }
.saved-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-item .date { font-family: var(--mono); font-size: 9px; color: var(--muted-2); }
.template-item { position: relative; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.template-item:last-child { border-bottom: 0; }
.drag-no { font-family: var(--mono); font-size: 9px; color: var(--muted-2); padding-top: 5px; }
.template-item .body { min-width: 0; }
.template-item .meta { display: flex; gap: 7px; align-items: center; margin-bottom: 4px; }
.template-item .group { font-family: var(--mono); font-size: 8.5px; color: var(--accent); letter-spacing: .04em; }
.template-item .en { font-family: Georgia, serif; font-size: 14.5px; line-height: 1.75; }

.template-item .zh { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.template-item .ops { display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.template-item .ops button { border: 0; background: transparent; color: var(--muted-2); width: 24px; height: 22px; border-radius: 4px; display: grid; place-items: center; }
.template-item .ops button:hover { background: var(--paper-2); color: var(--accent); }
.template-item .ops svg { width: 12px; height: 12px; }
.paper-empty { padding: 44px 25px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); background: var(--paper-2); }
.paper-empty .glyph { font-family: var(--serif); font-size: 44px; color: var(--line-strong); line-height: 1; margin-bottom: 13px; }
.paper-empty strong { display: block; font-family: var(--serif); color: var(--ink-soft); font-size: 19px; margin-bottom: 6px; }
.slot-form { margin-top: 23px; padding-top: 18px; border-top: 1px solid var(--line); }
.slot-form-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.slot-form-head h3 { font-family: var(--serif); font-size: 17px; }
.slot-form-head span { font-size: 10px; color: var(--muted); }
.slot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.slot-field input { font-size: 12.5px; padding: 8px 9px; }
.paper-foot { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 23px; padding-top: 17px; border-top: 1px solid var(--line); }
.paper-foot .meta { margin-left: auto; font-size: 10px; color: var(--muted-2); }
.custom-sentence-btn { margin: 5px 15px 13px; width: calc(100% - 30px); }

/* ---------- apply ---------- */
.stepper { display: flex; align-items: center; gap: 0; margin-bottom: 27px; padding: 13px 17px; border: 1px solid var(--line); border-radius: 12px; background: color-mix(in srgb, var(--paper) 58%, transparent); }
.step { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted-2); }
.step .n { width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; font-family: var(--mono); font-size: 9px; }
.step.active { color: var(--ink); }
.step.active .n { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.done { color: var(--moss); }
.step.done .n { border-color: var(--moss); color: var(--moss); }
.step-line { flex: 1; height: 1px; background: var(--line); margin: 0 13px; min-width: 18px; }
.apply-note { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-left: 2px solid var(--gold); background: var(--gold-soft); border-radius: 0 9px 9px 0; margin-bottom: 20px; }
.apply-note strong { font-size: 12px; color: var(--gold); flex: none; }
.apply-note p { font-size: 11.5px; color: var(--ink-soft); line-height: 1.75; }
.apply-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.compact-sentence {
  position: relative; padding: 12px 13px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--paper); cursor: pointer; transition: .16s ease;
}
.compact-sentence:hover { border-color: var(--line-strong); }
.compact-sentence.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 48%, var(--paper)); box-shadow: inset 0 0 0 1px var(--accent); }
.compact-sentence .tick { position: absolute; right: 8px; top: 8px; width: 15px; height: 15px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--paper); display: grid; place-items: center; }
.compact-sentence .tick svg { width: 9px; height: 9px; opacity: 0; color: #fff; }
.compact-sentence.selected .tick { background: var(--accent); border-color: var(--accent); }
.compact-sentence.selected .tick svg { opacity: 1; }
.compact-sentence .group { font-family: var(--mono); font-size: 8px; color: var(--accent); letter-spacing: .04em; padding-right: 18px; }
.compact-sentence .en { margin-top: 4px; font-family: Georgia, serif; font-size: 12px; line-height: 1.55; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.compact-sentence .zh { margin-top: 4px; font-size: 9.5px; color: var(--muted-2); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

.basket {
  position: sticky; bottom: 18px; z-index: 30; margin-top: 24px;
  display: flex; align-items: center; gap: 14px; padding: 11px 12px 11px 16px;
  border: 1px solid var(--line-strong); border-radius: 14px; background: color-mix(in srgb, var(--paper) 93%, transparent);
  box-shadow: var(--shadow); backdrop-filter: blur(14px);
}
.basket .count { font-family: var(--serif); font-size: 26px; line-height: 1; color: var(--accent); }
.basket .label { font-size: 10px; color: var(--muted); line-height: 1.4; }
.basket .chips { display: flex; gap: 4px; flex-wrap: wrap; max-height: 48px; overflow: hidden; flex: 1; }
.basket .chips span { font-size: 9px; padding: 3px 6px; border-radius: 4px; background: var(--paper-2); color: var(--muted); border: 1px solid var(--line); }
.basket .btn { flex: none; }
.basket-empty { color: var(--muted-2); font-size: 10.5px; flex: 1; }

.apply-template-groups { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
.apply-template-group { border: 1px solid var(--line); border-radius: 13px; background: var(--paper); padding: 18px 18px 14px; }
.apply-template-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding-bottom: 9px; border-bottom: 1px solid var(--line); margin-bottom: 9px; }
.apply-template-head h2 { font-family: var(--serif); font-size: 23px; }
.apply-template-head span { font-family: var(--mono); font-size: 8.5px; color: var(--muted-2); }
.apply-template-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.apply-template-row:last-child { border-bottom: 0; }
.apply-template-main { flex: 1; min-width: 0; }
.apply-template-main strong { display: block; font-size: 12.5px; }
.apply-template-main span { font-size: 9.5px; color: var(--muted); }
.apply-template-foot { display: flex; align-items: center; gap: 10px; margin-top: 18px; font-size: 11px; color: var(--muted); }
.apply-template-summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 13px 16px; margin-bottom: 16px; border: 1px solid var(--line); border-left: 2px solid var(--moss); border-radius: 8px; background: var(--paper); }
.apply-template-summary > div { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.apply-template-summary strong { font-family: var(--serif); font-size: 18px; }
.apply-template-summary span:last-child { font-size: 10px; color: var(--muted); }
.apply-q-list { display: grid; gap: 5px; max-height: 55vh; overflow: auto; }
.apply-q-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); padding: 9px 11px; }
.apply-q-row:hover { border-color: var(--accent); }
.apply-q-main { flex: 1; min-width: 0; }
.apply-q-main strong { display: block; font-size: 12px; }
.apply-q-main span { display: block; font-size: 9.5px; color: var(--muted); line-height: 1.6; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.apply-q-arrow svg { width: 12px; height: 12px; color: var(--muted-2); }
.apply-imported-bar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; padding: 9px 15px; border-bottom: 1px solid var(--line); background: var(--moss-soft); font-size: 10px; color: var(--moss); }
.apply-imported-bar strong { font-family: var(--mono); font-size: 8.5px; letter-spacing: .04em; }
.apply-imported-bar span { color: var(--ink-soft); }
.apply-imported-bar button { margin-left: auto; border: 0; background: transparent; color: var(--accent); font-size: 9.5px; text-decoration: underline; }
.apply-imported-bar.hidden { background: var(--paper-2); color: var(--muted); }
.apply-hand-reference { border-bottom: 1px solid var(--line); background: var(--paper-2); }
.apply-hand-reference-head { display: flex; align-items: baseline; gap: 8px; padding: 9px 15px 5px; }
.apply-hand-reference-head strong { font-family: var(--mono); font-size: 8.5px; letter-spacing: .06em; color: var(--accent); }
.apply-hand-reference-head span { font-size: 9px; color: var(--muted-2); }
.apply-hand-reference pre { margin: 0; padding: 4px 15px 12px; max-height: 185px; overflow: auto; white-space: pre-wrap; font-family: Georgia, serif; font-size: 12px; line-height: 1.85; color: var(--ink-soft); }
.template-peek { white-space: pre-wrap; font-family: Georgia, serif; font-size: 14px; line-height: 2; padding: 18px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper-2); max-height: 60vh; overflow: auto; }
.match-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; }
.match-card { display: flex; flex-direction: column; padding: 19px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.match-card.best { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.match-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.match-head .score { font-family: var(--serif); font-size: 27px; line-height: 1; color: var(--accent); }
.match-head .score small { font-family: var(--sans); font-size: 8px; color: var(--muted); display: block; margin-top: 3px; letter-spacing: .05em; }
.match-card h3 { font-family: var(--serif); font-size: 19px; line-height: 1.35; margin: 15px 0 6px; }
.match-card .meta-line { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.match-card p { font-size: 11px; color: var(--muted); line-height: 1.7; }
.match-reason { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 10px; color: var(--moss); }
.match-card .btn { margin-top: auto; }
.match-actions { display: flex; gap: 9px; margin-top: 18px; flex-wrap: wrap; }

.apply-write { display: grid; grid-template-columns: minmax(300px, .9fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
.scaffold-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); padding: 21px 21px 18px; }
.scaffold-panel h2 { font-family: var(--serif); font-size: 21px; margin-bottom: 4px; }
.scaffold-panel > p { font-size: 10.5px; color: var(--muted); margin-bottom: 14px; }
.scaffold-block { margin-top: 13px; }
.scaffold-block .st { font-family: var(--mono); font-size: 8.5px; letter-spacing: .05em; color: var(--accent); margin-bottom: 5px; }
.scaffold-line { font-family: Georgia, serif; font-size: 12.5px; line-height: 2.15; color: var(--ink-soft); padding: 8px 0; border-bottom: 1px dashed var(--line); }
.scaffold-line .slot { border-bottom: 0; }
.scaffold-line .inline-blank { font-size: 10.5px; }
.apply-inline-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 9.5px; color: var(--muted-2); }
.apply-inline-meta b { color: var(--moss); font-family: var(--mono); }
.apply-slot-form { margin-top: 15px; }
.apply-slot-form .slot-grid { grid-template-columns: 1fr 1fr; }

/* ---------- practice ---------- */
.practice-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 22px; }
.practice-filter .search-box { max-width: 300px; }
.chip-group { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); }
.chip-group button { border: 0; background: transparent; color: var(--muted); font-size: 10.5px; padding: 6px 10px; border-radius: 999px; }
.chip-group button.active { background: var(--ink); color: var(--paper); }
.question-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.q-card {
  display: flex; flex-direction: column; min-height: 260px; padding: 20px 19px 17px;
  border: 1px solid var(--line); border-radius: 13px; background: var(--paper);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.q-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-soft); border-color: var(--line-strong); }
.q-top { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.q-year { font-family: var(--mono); font-size: 9.5px; letter-spacing: .04em; color: var(--muted); }
.q-card h3 { font-family: var(--serif); font-size: 21px; line-height: 1.35; margin: 17px 0 7px; }
.q-card .sub { font-size: 10.5px; color: var(--accent); }
.q-card p { font-size: 11px; color: var(--muted); line-height: 1.75; margin-top: 11px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.q-foot { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 15px; border-top: 1px solid var(--line); }
.q-foot .go { margin-left: auto; width: 27px; height: 27px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); }
.q-card:hover .q-foot .go { background: var(--accent); border-color: var(--accent); color: #fff; }
.q-foot .go svg { width: 12px; height: 12px; }

.workspace { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); gap: 20px; align-items: start; }
.prompt-panel, .writing-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.prompt-panel { padding: 24px 24px 22px; }
.prompt-panel h1 { font-family: var(--serif); font-size: 29px; line-height: 1.35; margin: 9px 0 10px; }
.prompt-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.prompt-box { padding: 15px 16px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; font-family: Georgia, serif; font-size: 13px; line-height: 1.85; color: var(--ink-soft); white-space: pre-wrap; }
.prompt-zh { margin-top: 12px; font-size: 11.5px; line-height: 1.8; color: var(--muted); }
.visual-block { margin-top: 17px; }
.visual-block h3, .prompt-section h3 { font-family: var(--mono); font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 9px; }
.chart-box { border: 1px solid var(--line); border-radius: 10px; background: #fffdf8; padding: 14px 15px 13px; margin-top: 9px; }
[data-theme="dark"] .chart-box { background: #f5f0e4; color: #222a25; }
.chart-title { font-family: var(--mono); font-size: 9px; letter-spacing: .03em; color: #59645b; margin-bottom: 12px; text-transform: uppercase; }
.chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chart-grid.single { grid-template-columns: 1fr; }
.pie-wrap { display: flex; gap: 13px; align-items: center; }
.pie {
  width: 92px; height: 92px; border-radius: 50%; flex: none; position: relative;
  background: conic-gradient(var(--accent) 0 39.3%, var(--gold) 39.3% 72.1%, #8aa391 72.1% 100%);
}
.pie::after { content: ""; position: absolute; inset: 20px; border-radius: 50%; background: #fffdf8; }
.legend { display: grid; gap: 6px; min-width: 0; }
.legend-row { display: flex; align-items: center; gap: 6px; font-size: 10px; color: #4e574f; }
.legend-dot { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.legend-row b { margin-left: auto; font-family: var(--mono); font-size: 9px; color: #222a25; }
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; gap: 4px; }
.bar-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 9.5px; color: #4e574f; }
.bar-meta b { font-family: var(--mono); color: #222a25; }
.bar-track { height: 7px; background: #e8e1d5; border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: inherit; }
.bar-fill.gold { background: var(--gold); }
.bar-fill.moss { background: #6f8d79; }
.line-chart { width: 100%; height: 118px; overflow: visible; }
.line-chart .axis { stroke: #d9d0c1; stroke-width: 1; }
.line-chart .gridline { stroke: #e9e2d6; stroke-width: 1; stroke-dasharray: 2 3; }
.line-chart .line { fill: none; stroke: var(--accent); stroke-width: 2.2; }
.line-chart .area { fill: color-mix(in srgb, var(--accent) 11%, transparent); stroke: none; }
.line-chart .point { fill: var(--accent); stroke: #fffdf8; stroke-width: 2; }
.line-chart text { fill: #6b736b; font-family: var(--mono); font-size: 8px; stroke: none; }
.data-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.data-table caption { text-align: left; font-family: var(--mono); font-size: 9px; color: #59645b; padding-bottom: 8px; }
.data-table th, .data-table td { padding: 6px 8px; border-bottom: 1px solid #e6dfd2; text-align: left; color: #303a32; }
.data-table th { font-size: 9px; text-transform: uppercase; letter-spacing: .04em; color: #687067; }
.scene-card {
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper-2);
  padding: 18px; position: relative; overflow: hidden;
}
.scene-card::after {
  content: attr(data-glyph); position: absolute; right: 12px; bottom: -18px;
  font-family: var(--serif); font-size: 90px; color: var(--ink); opacity: .05; line-height: 1;
}
.scene-caption { font-family: var(--serif); font-size: 19px; line-height: 1.45; margin-bottom: 8px; }
.scene-desc { font-size: 11.5px; line-height: 1.8; color: var(--muted); max-width: 48ch; position: relative; z-index: 1; }
.prompt-section { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.outline-list { display: grid; gap: 7px; }
.outline-list li { position: relative; padding-left: 17px; font-size: 11px; color: var(--ink-soft); line-height: 1.7; }
.outline-list li::before { content: "—"; position: absolute; left: 0; color: var(--accent); }
.prompt-actions { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 16px; }

.writing-panel { position: sticky; top: 90px; overflow: hidden; }
.writing-modebar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 9px 16px; border-bottom: 1px solid var(--line); background: var(--paper-2);
}
.mode-tabs { display: inline-flex; gap: 3px; padding: 3px; background: var(--bg-deep); border-radius: 8px; }
.mode-tabs button { border: 0; background: transparent; color: var(--muted); border-radius: 6px; padding: 5px 10px; font-size: 10.5px; }
.mode-tabs button.active { background: var(--paper); color: var(--accent); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.modebar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.modebar-right > span { font-size: 9.5px; color: var(--muted-2); }
.input-tabs { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); }
.input-tabs button { border: 0; background: transparent; color: var(--muted); border-radius: 4px; padding: 4px 8px; font-size: 9.5px; }
.input-tabs button.active { background: var(--ink); color: var(--paper); }
.handwriting-shell { background: var(--paper); }
.hand-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 15px; border-bottom: 1px solid var(--line); background: var(--paper-2); }
.hand-title strong { display: block; font-family: var(--serif); font-size: 16px; }
.hand-title span { font-size: 8.5px; color: var(--muted-2); }
.hand-tools { display: flex; align-items: center; gap: 3px; flex-wrap: wrap; }
.hand-tool { border: 1px solid var(--line); background: var(--paper); color: var(--muted); border-radius: 5px; padding: 5px 8px; font-size: 9.5px; }
.hand-tool.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.hand-tool:hover { border-color: var(--line-strong); color: var(--ink); }
.hand-size { display: inline-flex; align-items: center; gap: 5px; font-size: 9px; color: var(--muted); }
.hand-size input { width: 64px; accent-color: var(--accent); }
.hand-paper {
  position: relative; height: 535px; overflow: hidden;
  background-color: #fffdf8;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent 31px, #e7dfd1 31px, #e7dfd1 32px);
}
#handCanvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.hand-prompt {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 70%; padding: 14px 18px; border: 1px dashed #cfc6b6; border-radius: 8px;
  text-align: center; color: #8b9188; background: rgba(251,248,241,.72); font-size: 11px; line-height: 1.7;
  pointer-events: none;
}
.hand-expand-bar { display: flex; align-items: center; gap: 10px; padding: 9px 15px; border-top: 1px dashed var(--line); background: var(--paper-2); }
.hand-expand { border: 1px solid var(--line); background: var(--paper); color: var(--accent); border-radius: 6px; padding: 6px 13px; font-size: 10px; font-weight: 600; }
.hand-expand:hover { border-color: var(--accent); background: var(--accent-soft); }
.hand-expand-bar span { font-size: 8.5px; color: var(--muted-2); }
.hand-note { color: var(--muted-2); }
.writing-head { display: flex; align-items: center; gap: 11px; padding: 14px 17px; border-bottom: 1px solid var(--line); }
.timer { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 13px; color: var(--ink); }
.timer svg { width: 14px; height: 14px; color: var(--accent); }
.timer.running { color: var(--accent); }
.writing-head .divider-v { width: 1px; height: 16px; background: var(--line); }
.target-word { font-size: 10px; color: var(--muted); }
.writing-actions { margin-left: auto; display: flex; gap: 5px; align-items: center; }
.writing-actions .icon-btn { width: 30px; height: 30px; }
.writing-actions .icon-btn svg { width: 14px; height: 14px; }
.editor-wrap { position: relative; }
.editor {
  width: 100%; min-height: 405px; border: 0; background: var(--paper); resize: vertical;
  padding: 20px 21px; font-family: Georgia, "Times New Roman", serif; font-size: 15px; line-height: 2;
  color: var(--ink); outline: none; display: block;
}
.editor::placeholder { color: var(--muted-2); font-family: var(--sans); font-size: 12px; line-height: 1.8; }
.editor:focus { box-shadow: inset 3px 0 0 var(--accent); }
.editor-foot { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; padding: 9px 16px; border-top: 1px solid var(--line); background: var(--paper-2); font-size: 10px; color: var(--muted); }
.word-count strong { color: var(--ink); font-family: var(--mono); font-size: 11px; }
.word-count.warn strong { color: var(--accent); }
.word-count.ok strong { color: var(--moss); }
.draft-status { margin-left: auto; font-family: var(--mono); font-size: 9px; color: var(--muted-2); }
.writing-tip { padding: 12px 17px 15px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--gold-soft) 55%, var(--paper)); font-size: 10.5px; line-height: 1.7; color: var(--muted); }
.writing-tip strong { color: var(--gold); }
.last-score { font-size: 10px; color: var(--moss); }

/* ---------- inline blanks, guided writing, essay builder ---------- */
.inline-blank {
  display: inline; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, transparent); color: var(--accent);
  font: inherit; font-size: .84em; line-height: 1.3; padding: 0 3px;
  border-radius: 3px 3px 0 0; min-width: 6ch; max-width: 100%; vertical-align: baseline;
  transition: background .15s ease, border-color .15s ease;
}
.inline-blank::placeholder { color: var(--accent); opacity: .78; font-family: var(--sans); font-size: .8em; letter-spacing: -.02em; }
.inline-blank:focus { outline: none; background: var(--paper); border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 13%, transparent); }
.guided-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 12px 17px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--gold-soft) 55%, var(--paper));
}
.guided-bar strong { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; color: var(--gold); text-transform: uppercase; display: block; margin-bottom: 2px; }
.guided-bar span { font-size: 10px; color: var(--muted); }
.guided-count { font-family: var(--mono); color: var(--moss) !important; }
.guided-count b { font-size: 13px; }
.guided-paper { padding: 20px 22px 14px; max-height: 560px; overflow: auto; background: var(--paper); scrollbar-width: thin; }
.guided-paragraph + .guided-paragraph { margin-top: 15px; padding-top: 13px; border-top: 1px dashed var(--line); }
.guided-para-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 5px; }
.guided-para-head span { font-family: var(--mono); font-size: 8.5px; color: var(--accent); }
.guided-para-head strong { font-family: var(--serif); font-size: 15px; }
.guided-para-head em { font-style: normal; font-size: 8.5px; color: var(--muted-2); margin-left: auto; }
.guided-para-text { font-family: Georgia, "Times New Roman", serif; font-size: 14.5px; line-height: 2.4; color: var(--ink); }
.guided-sentence { display: inline; }
.guided-actions { display: flex; justify-content: flex-end; gap: 7px; flex-wrap: wrap; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--paper-2); }
.guided-preview { font-family: Georgia, serif; font-size: 14px; line-height: 1.95; background: var(--paper-2); border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
.essay-sheet { padding: 30px 34px 25px; }
.builder-gate { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: clamp(28px, 6vw, 80px); padding: 35px 0 80px; align-items: start; }
.gate-copy h1 { margin: 15px 0 18px; font-family: var(--serif); font-size: clamp(42px, 5vw, 62px); line-height: 1.15; letter-spacing: -.025em; }
.gate-copy p { max-width: 38ch; color: var(--muted); font-size: 14px; line-height: 1.9; }
.gate-copy p strong { color: var(--ink); }
.gate-copy .btn { margin-top: 24px; }
.gate-note { margin-top: 18px; padding: 12px 14px; border-left: 2px solid var(--gold); background: var(--gold-soft); font-size: 10.5px; color: var(--ink-soft); line-height: 1.7; }
.gate-library { border: 1px solid var(--line); border-radius: 16px; background: var(--paper); padding: 23px 24px; box-shadow: var(--shadow-soft); }
.gate-library-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.gate-library-head span:last-child { font-size: 9.5px; color: var(--muted-2); }
.gate-scope { margin-top: 18px; }
.gate-scope-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 7px; }
.gate-scope-head h3 { font-family: var(--serif); font-size: 20px; }
.gate-scope-head span { font-family: var(--mono); font-size: 8.5px; color: var(--muted-2); }
.gate-template { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper-2); margin-bottom: 6px; }
.gate-template:hover { border-color: var(--accent); background: var(--paper); }
.gate-template-main { flex: 1; min-width: 0; }
.gate-template-main strong { display: block; font-size: 12.5px; }
.gate-template-main span { font-size: 9.5px; color: var(--muted); }
.gate-template-arrow { color: var(--muted-2); }
.gate-template-arrow svg { width: 13px; height: 13px; }
.gate-empty { padding: 16px 12px; border: 1px dashed var(--line-strong); border-radius: 8px; color: var(--muted); font-size: 10.5px; text-align: center; }
.gate-empty.big { margin-top: 18px; padding: 34px 20px; }
.kind-switch { display: flex; gap: 3px; margin: 8px 15px 0; padding: 3px; background: var(--bg-deep); border-radius: 8px; }
.kind-switch button { flex: 1; border: 0; background: transparent; color: var(--muted); border-radius: 5px; padding: 6px 4px; font-size: 10px; }
.kind-switch button.active { background: var(--paper); color: var(--accent); font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.builder-template-actions { display: flex; gap: 5px; margin: 9px 15px 3px; }
.builder-template-actions .btn { flex: 1; padding-left: 6px; padding-right: 6px; }
.builder-view-tabs { display: inline-flex; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper-2); }
.builder-view-tabs button { border: 0; background: transparent; color: var(--muted); border-radius: 4px; padding: 5px 9px; font-size: 9.5px; }
.builder-view-tabs button.active { background: var(--ink); color: var(--paper); }
.essay-pos-list { display: grid; gap: 7px; }
.essay-slot { border: 1px solid var(--line); border-radius: 8px; background: var(--paper); padding: 7px 9px; }
.essay-slot.filled { border-left: 2px solid var(--accent); }
.essay-slot.empty { display: flex; align-items: center; gap: 10px; border-style: dashed; background: var(--paper-2); color: var(--muted); min-height: 38px; width: 100%; text-align: left; }
.essay-slot.empty:hover { border-color: var(--accent); color: var(--accent); }
.slot-label { display: block; font-family: var(--mono); font-size: 8px; letter-spacing: .04em; color: var(--accent); margin-bottom: 2px; white-space: nowrap; }
.essay-slot.empty .slot-label { margin: 0; flex: none; }
.slot-hint { font-size: 10px; color: var(--muted-2); }
.slot-line { display: flex; align-items: flex-start; gap: 7px; }
.slot-line .essay-sentence { flex: 1; min-width: 0; font-family: Georgia, serif; font-size: 15px; line-height: 2; }
.slot-delete {
  flex: none; width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent;
  color: var(--muted-2); display: grid; place-items: center; margin-top: 4px;
}
.slot-delete:hover { color: #fff; background: var(--danger); }
.slot-delete svg { width: 11px; height: 11px; }
.slot-extra { flex: none; border: 1px dashed var(--line-strong); background: transparent; color: var(--muted-2); border-radius: 4px; padding: 3px 6px; font-size: 8.5px; margin-top: 5px; white-space: nowrap; }
.slot-extra:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.essay-extra { display: flex; align-items: flex-start; gap: 7px; margin: 7px 0 0 38px; padding: 5px 8px; border-left: 2px solid var(--gold); background: var(--gold-soft); border-radius: 0 5px 5px 0; }
.extra-label { flex: none; font-family: var(--mono); font-size: 7.5px; letter-spacing: .04em; color: var(--gold); margin-top: 4px; }
.essay-extra .essay-sentence { flex: 1; font-family: Georgia, serif; font-size: 14px; line-height: 1.9; }
.essay-extra .slot-delete { margin-top: 1px; }
.sentence-card-block { margin-bottom: 15px; }
.sentence-card-en { font-family: Georgia, serif; font-size: 17px; line-height: 1.95; color: var(--ink); }
.sentence-card-zh { font-family: var(--serif); font-size: 14px; line-height: 1.9; color: var(--ink-soft); }
.sentence-card-example { padding: 11px 13px; border-left: 2px solid var(--accent); background: var(--paper-2); font-family: Georgia, serif; font-size: 15px; line-height: 1.9; color: var(--ink); }
.sentence-card-note { display: block; margin-top: 5px; font-size: 9px; line-height: 1.7; color: var(--muted); }
.sentence-related { display: grid; gap: 5px; }
.sentence-related-item { display: flex; align-items: baseline; gap: 9px; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--paper); border-radius: 6px; padding: 7px 9px; }
.sentence-related-item:hover { border-color: var(--accent); }
.sentence-related-item span { flex: none; font-family: var(--mono); font-size: 8px; color: var(--accent); }
.sentence-related-item strong { font-family: var(--serif); font-size: 12px; font-weight: 400; color: var(--ink-soft); }
.preview-para { margin-bottom: 18px; }
.preview-para-title { font-family: var(--mono); font-size: 8px; letter-spacing: .1em; color: var(--accent); text-transform: uppercase; margin-bottom: 6px; }
.preview-para-text { font-family: Georgia, serif; font-size: 16.5px; line-height: 2.15; color: var(--ink); }
.preview-para-text .slot { font-size: 12px; }
.preview-missing { margin-top: 5px; font-size: 9px; color: var(--muted-2); }
.essay-head { padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.essay-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.essay-meta > span:last-child { font-size: 9.5px; color: var(--muted-2); }
.essay-title-input {
  display: block; width: 100%; margin: 13px 0 4px; border: 0; border-bottom: 1px dashed transparent;
  background: transparent; color: var(--ink); font-family: var(--serif); font-size: 31px; line-height: 1.35;
  padding: 0 0 4px; outline: none;
}
.essay-title-input::placeholder { color: var(--muted-2); }
.essay-title-input:focus { border-bottom-color: var(--accent); }
.essay-byline { font-size: 10px; color: var(--muted); }
.essay-body { padding: 20px 0 8px; }
.essay-paragraph { position: relative; padding: 0 0 18px; margin-bottom: 14px; border-bottom: 1px dashed var(--line); }
.essay-paragraph:last-child { border-bottom: 0; }
.essay-para-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.essay-para-no { font-family: var(--mono); font-size: 8.5px; color: var(--accent); }
.essay-para-head strong { font-family: var(--serif); font-size: 16px; }
.essay-para-hint { font-size: 9.5px; color: var(--muted-2); }
.essay-add { margin-left: auto; border: 1px dashed var(--line-strong); border-radius: 5px; background: transparent; color: var(--muted); font-size: 9.5px; padding: 4px 7px; display: inline-flex; align-items: center; gap: 3px; }
.essay-add:hover { border-color: var(--accent); color: var(--accent); }
.essay-add svg { width: 10px; height: 10px; }
.essay-para-text { font-family: Georgia, "Times New Roman", serif; font-size: 16.5px; line-height: 2.35; color: var(--ink); min-height: 42px; }
.essay-sentence {
  display: inline; cursor: pointer; border-radius: 3px; padding: 1px 0;
  box-decoration-break: clone; -webkit-box-decoration-break: clone;
}
.essay-sentence:hover { background: color-mix(in srgb, var(--gold-soft) 62%, transparent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold-soft) 62%, transparent); }
.essay-sentence .inline-blank { cursor: text; }
.essay-empty {
  width: 100%; min-height: 54px; border: 1px dashed var(--line-strong); border-radius: 8px;
  background: var(--paper-2); color: var(--muted); font-size: 11px; display: flex; align-items: center; justify-content: center; gap: 5px;
}
.essay-empty:hover { color: var(--accent); border-color: var(--accent); }
.essay-empty svg { width: 12px; height: 12px; }
.essay-tip { padding: 10px 12px; border-radius: 7px; background: var(--gold-soft); color: var(--ink-soft); font-size: 10px; line-height: 1.7; margin: 2px 0 14px; }
.essay-tip::before { content: "提示 · "; font-family: var(--mono); font-size: 8.5px; color: var(--gold); letter-spacing: .06em; }
.knowledge-card {
  position: relative; margin-bottom: 16px; padding: 15px 16px 13px; border: 1px solid var(--line);
  border-radius: 10px; background: color-mix(in srgb, var(--gold-soft) 44%, var(--paper));
}
.kc-head { display: flex; align-items: center; gap: 9px; }
.kc-seal { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 6px; background: var(--ink); color: var(--paper); font-family: var(--serif); font-size: 15px; flex: none; }
.kc-head div { display: flex; flex-direction: column; }
.kc-head strong { font-family: var(--serif); font-size: 16px; line-height: 1.3; }
.kc-head span { font-size: 8.5px; color: var(--muted-2); letter-spacing: .03em; }
.kc-purpose { margin: 9px 0 8px; font-size: 10.5px; line-height: 1.75; color: var(--ink-soft); }
.kc-steps { margin: 0; padding: 0; list-style: none; counter-reset: kc; display: grid; gap: 4px; }
.kc-steps li { counter-increment: kc; position: relative; padding-left: 20px; font-size: 10px; line-height: 1.65; color: var(--muted); }
.kc-steps li::before { content: counter(kc, decimal-leading-zero); position: absolute; left: 0; top: 1px; font-family: var(--mono); font-size: 8px; color: var(--gold); }
.kc-bottom { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 10px; padding-top: 9px; border-top: 1px dashed var(--line); }
.kc-label { font-family: var(--mono); font-size: 8px; letter-spacing: .06em; color: var(--accent); text-transform: uppercase; }
.kc-bottom p { margin-top: 3px; font-size: 9.5px; line-height: 1.65; color: var(--muted); white-space: pre-line; }
.knowledge-card.compact { margin-bottom: 13px; padding: 12px 13px 11px; }
.knowledge-card.compact .kc-purpose { margin: 7px 0; }
.knowledge-card.compact .kc-bottom { gap: 9px; }
.template-knowledge-grid { display: grid; gap: 6px; margin-top: 4px; }
.tk-row { display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.tk-row.missing { border-style: dashed; background: var(--paper-2); }
.tk-no { font-family: var(--mono); font-size: 9px; color: var(--accent); padding-top: 3px; }
.tk-row div { min-width: 0; flex: 1; }
.tk-row strong { display: block; font-family: var(--serif); font-size: 15px; }
.tk-row span { display: block; font-size: 9.5px; color: var(--muted); line-height: 1.6; margin-top: 2px; }
.tk-row > b { flex: none; font-family: var(--mono); font-size: 9px; color: var(--moss); padding-top: 3px; }
.paragraph-services { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.service-card {
  display: flex; flex-direction: column; align-items: flex-start; gap: 5px; padding: 15px 14px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper-2); text-align: left;
}
.service-card > span { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--line-strong); display: grid; place-items: center; color: var(--accent); }
.service-card > span svg { width: 12px; height: 12px; }
.service-card strong { font-family: var(--serif); font-size: 17px; }
.service-card small { font-size: 9.5px; color: var(--muted); line-height: 1.6; }
.service-card:hover { border-color: var(--accent); background: var(--paper); }
.service-card.danger > span { color: var(--danger); }
.service-card:disabled { opacity: .45; cursor: not-allowed; }
.tm-category { margin-bottom: 17px; }
.tm-category-head { display: flex; align-items: baseline; gap: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.tm-category-head h3 { font-family: var(--serif); font-size: 18px; }
.tm-category-head span { font-family: var(--mono); font-size: 8.5px; color: var(--muted-2); }
.tm-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; padding: 8px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); margin-bottom: 4px; }
.tm-main { min-width: 140px; flex: 1; }
.tm-main strong { display: block; font-size: 12px; }
.tm-main span { font-size: 9px; color: var(--muted); }
.tm-category-add { display: flex; gap: 7px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.tm-category-add .field { flex: 1; }
.picker-list { display: grid; gap: 5px; max-height: 52vh; overflow: auto; }
.picker-row { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); padding: 9px 11px; }
.picker-row:hover { border-color: var(--accent); }
.picker-row:disabled { opacity: .48; cursor: not-allowed; }
.picker-main { min-width: 0; flex: 1; }
.picker-en { display: block; margin-top: 2px; font-family: Georgia, serif; font-size: 12px; line-height: 1.6; color: var(--ink-soft); }
.picker-add { flex: none; width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center; color: var(--muted); font-size: 9px; }
.picker-add svg { width: 11px; height: 11px; }

/* ---------- rubric modal ---------- */
.rubric { display: grid; gap: 9px; }
.rubric-item { display: flex; gap: 11px; align-items: flex-start; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper-2); cursor: pointer; }
.rubric-item input { margin-top: 4px; accent-color: var(--accent); width: 15px; height: 15px; }
.rubric-item strong { display: block; font-size: 12px; margin-bottom: 2px; }
.rubric-item span { display: block; font-size: 10px; color: var(--muted); line-height: 1.6; }
.score-preview { display: flex; align-items: baseline; gap: 5px; margin: 16px 0; }
.score-preview b { font-family: var(--serif); font-size: 40px; line-height: 1; color: var(--accent); }
.score-preview span { font-size: 11px; color: var(--muted); }

/* ---------- lexicon ---------- */
.lex-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.lex-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); padding: 23px 23px 20px; position: relative; overflow: hidden; }
.lex-card::after { content: attr(data-glyph); position: absolute; right: 17px; top: -25px; font-family: var(--serif); font-size: 100px; color: var(--ink); opacity: .035; }
.lex-head { display: flex; align-items: baseline; gap: 9px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.lex-head h2 { font-family: var(--serif); font-size: 25px; }
.lex-head .en { font-family: var(--mono); font-size: 9px; letter-spacing: .1em; color: var(--muted-2); text-transform: uppercase; }
.lex-head .core { margin-left: auto; font-size: 9.5px; color: var(--accent); }
.lex-group { margin-top: 14px; }
.lex-group h3 { font-family: var(--mono); font-size: 8.5px; letter-spacing: .06em; color: var(--muted-2); margin-bottom: 7px; }
.phrase-list { display: flex; flex-wrap: wrap; gap: 5px; }
.phrase {
  border: 1px solid var(--line); background: var(--paper-2); border-radius: 6px; padding: 5px 7px;
  text-align: left; font-size: 10.5px; color: var(--ink-soft); line-height: 1.35; transition: .16s ease;
}
.phrase span { display: block; font-size: 8.5px; color: var(--muted-2); margin-top: 1px; }
.phrase:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------- progress ---------- */
.progress-hero { display: grid; grid-template-columns: 1.1fr .9fr; gap: 18px; align-items: stretch; }
.progress-main { padding: 27px 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.progress-main h2 { font-family: var(--serif); font-size: 26px; margin: 8px 0 6px; }
.progress-main p { color: var(--muted); font-size: 12px; }
.ring-wrap { display: flex; gap: 26px; align-items: center; margin-top: 24px; }
.ring { width: 124px; height: 124px; flex: none; position: relative; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: var(--line); stroke-width: 7; fill: none; }
.ring .meter { stroke: var(--accent); stroke-width: 7; fill: none; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring-center b { font-family: var(--serif); font-size: 30px; line-height: 1; display: block; }
.ring-center span { font-size: 8px; color: var(--muted); letter-spacing: .08em; }
.ring-copy h3 { font-family: var(--serif); font-size: 19px; margin-bottom: 5px; }
.ring-copy p { font-size: 11px; line-height: 1.8; color: var(--muted); max-width: 28ch; }
.week-panel { padding: 24px 23px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ink); color: #eee7d9; display: flex; flex-direction: column; }
[data-theme="dark"] .week-panel { background: #0e1411; }
.week-panel h3 { font-family: var(--serif); font-size: 19px; margin: 5px 0 3px; }
.week-panel p { font-size: 10px; color: rgba(238,231,217,.48); }
.week-bars { display: flex; align-items: flex-end; gap: 7px; height: 112px; margin-top: 20px; }
.week-day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.week-day .bar { width: 100%; max-width: 30px; border-radius: 3px 3px 0 0; background: rgba(238,231,217,.18); min-height: 3px; transition: height .4s ease; }
.week-day .bar.has { background: #d29a7a; }
.week-day .lbl { font-family: var(--mono); font-size: 8px; color: rgba(238,231,217,.48); }
.week-day .cnt { font-family: var(--mono); font-size: 8px; color: rgba(238,231,217,.72); }
.progress-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 22px; }
.record-list { display: grid; gap: 8px; }
.record { display: flex; align-items: center; gap: 11px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); }
.record .date { font-family: var(--mono); font-size: 9px; color: var(--muted-2); flex: none; width: 74px; }
.record .main { min-width: 0; flex: 1; }
.record .main strong { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record .main span { font-size: 9.5px; color: var(--muted); }
.record .score { font-family: var(--mono); font-size: 10px; color: var(--moss); flex: none; }
.record .del { border: 0; background: transparent; color: var(--muted-2); width: 24px; height: 24px; border-radius: 5px; display: grid; place-items: center; }
.record .del:hover { color: var(--danger); background: var(--accent-soft); }
.record .del svg { width: 12px; height: 12px; }

/* ---------- modal & toast ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 120; background: rgba(18, 23, 20, .48);
  backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; padding: 20px;
  opacity: 0; animation: fadeIn .18s ease forwards;
}
.modal {
  width: min(660px, 100%); max-height: calc(100vh - 40px); overflow: auto;
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 16px;
  box-shadow: 0 30px 90px -30px rgba(0,0,0,.55); transform: translateY(8px) scale(.99);
  animation: modalIn .22s ease forwards;
}
.modal.wide { width: min(880px, 100%); }
.modal.slim { width: min(520px, 100%); }
.modal-head { display: flex; align-items: flex-start; gap: 15px; padding: 21px 24px 15px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-family: var(--serif); font-size: 24px; line-height: 1.3; }
.modal-head p { font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.modal-close { margin-left: auto; width: 31px; height: 31px; border-radius: 50%; border: 1px solid var(--line); background: transparent; display: grid; place-items: center; color: var(--muted); flex: none; }
.modal-close:hover { color: var(--accent); border-color: var(--accent); }
.modal-close svg { width: 14px; height: 14px; }
.modal-body { padding: 21px 24px 23px; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 24px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; font-size: 10px; color: var(--muted); }

.toast-root { position: fixed; right: 20px; bottom: 22px; z-index: 200; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  min-width: 200px; max-width: 360px; padding: 11px 15px; border-radius: 9px;
  background: var(--ink); color: var(--paper); font-size: 12px; line-height: 1.5;
  box-shadow: var(--shadow); display: flex; align-items: center; gap: 9px;
  animation: toastIn .25s ease both; pointer-events: auto;
}
.toast.accent { background: var(--accent); color: #fff8ef; }
.toast.moss { background: var(--moss); color: #f6f1e6; }
.toast svg { width: 14px; height: 14px; flex: none; }

/* ---------- command palette ---------- */
.palette { width: min(680px, 100%); background: var(--paper); border: 1px solid var(--line-strong); border-radius: 14px; overflow: hidden; box-shadow: 0 30px 100px -30px rgba(0,0,0,.6); animation: modalIn .18s ease both; }
.palette-input-wrap { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.palette-input-wrap svg { width: 17px; height: 17px; color: var(--muted); }
.palette-input-wrap input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 15px; }
.palette-input-wrap kbd { font-family: var(--mono); font-size: 9px; color: var(--muted-2); border: 1px solid var(--line); border-radius: 4px; padding: 2px 5px; }
.palette-body { max-height: 420px; overflow: auto; padding: 8px; }
.palette-label { font-family: var(--mono); font-size: 8.5px; letter-spacing: .1em; color: var(--muted-2); padding: 10px 10px 5px; text-transform: uppercase; }
.palette-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border: 0; background: transparent; border-radius: 7px; text-align: left; }
.palette-item:hover, .palette-item.active { background: var(--paper-2); }
.palette-item .p-main { min-width: 0; flex: 1; }
.palette-item .p-title { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .p-sub { font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item .p-kind { font-family: var(--mono); font-size: 8px; color: var(--muted-2); flex: none; }
.palette-empty { padding: 32px; text-align: center; color: var(--muted); font-size: 12px; }

/* ---------- animations ---------- */
@keyframes fadeIn { to { opacity: 1; } }
@keyframes modalIn { to { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseDot { 0%,100% { transform: scale(1); opacity: .7; } 50% { transform: scale(1.5); opacity: .25; } }
.view-enter { animation: rise .42s cubic-bezier(.2,.7,.2,1) both; }
.stagger > * { animation: rise .45s cubic-bezier(.2,.7,.2,1) both; }
.stagger > *:nth-child(1) { animation-delay: .03s; }
.stagger > *:nth-child(2) { animation-delay: .07s; }
.stagger > *:nth-child(3) { animation-delay: .11s; }
.stagger > *:nth-child(4) { animation-delay: .15s; }
.stagger > *:nth-child(5) { animation-delay: .19s; }
.stagger > *:nth-child(6) { animation-delay: .23s; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 36%, transparent); }
.footer-inner { width: min(var(--maxw), calc(100% - 48px)); margin-inline: auto; padding: 42px 0 28px; display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; }
.footer-brand { display: flex; gap: 12px; align-items: flex-start; }
.footer-brand strong { font-family: var(--serif); font-size: 18px; letter-spacing: .12em; }
.footer-brand p { margin-top: 5px; color: var(--muted); font-size: 11.5px; }
.footer-cols { display: flex; gap: 60px; }
.footer-cols div { display: flex; flex-direction: column; gap: 7px; }
.footer-cols span { font-family: var(--mono); font-size: 8.5px; letter-spacing: .12em; color: var(--muted-2); margin-bottom: 3px; text-transform: uppercase; }
.footer-cols a { font-size: 11.5px; color: var(--muted); }
.footer-cols a:hover { color: var(--accent); }
.footer-bottom { width: min(var(--maxw), calc(100% - 48px)); margin-inline: auto; border-top: 1px solid var(--line); padding: 14px 0 22px; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer-bottom p { font-size: 9.5px; color: var(--muted-2); line-height: 1.7; max-width: 76ch; }
.footer-mark { font-family: var(--mono); letter-spacing: .08em; white-space: nowrap; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .nav-links { gap: 0; }
  .nav-links a { padding: 8px 7px; font-size: 11.5px; }
  .home-hero { gap: 34px; }
  .hero { grid-template-columns: 1fr 360px; gap: 40px; }
  .question-grid { grid-template-columns: repeat(2, 1fr); }
  .apply-grid { grid-template-columns: repeat(2, 1fr); }
  .progress-grid { grid-template-columns: 1fr 1fr; }
  .lex-grid { grid-template-columns: 1fr 1fr; }
  .blueprint-flow.small { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bp-block:not(:last-child)::after { display: none; }
  .template-studio { grid-template-columns: 250px minmax(0, 1fr); }
  .studio-sheet { padding-left: 21px; padding-right: 21px; }
}
@media (max-width: 920px) {
  .wrap, .topbar-inner, .footer-inner, .footer-bottom { width: min(var(--maxw), calc(100% - 32px)); }
  .nav-links { display: none; }
  .mobile-toggle { display: grid; }
  .search-hint { display: none; }
  .nav-links.open {
    display: flex; flex-direction: column; position: absolute; top: 68px; left: 16px; right: 16px;
    background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 8px;
    box-shadow: var(--shadow); z-index: 90;
  }
  .nav-links.open a { padding: 10px 12px; font-size: 13px; }
  .nav-links.open a.active::after { display: none; }
  .nav-links.open a.active { background: var(--paper-2); }
  .hero { grid-template-columns: 1fr; }
  .hero > * { min-width: 0; }
  .ticket { width: 100%; max-width: 100%; transform: rotate(0); margin-top: 4px; min-width: 0; }
  .ticket-stamp { display: none; }
  .ticket-top > div:first-child { min-width: 0; }
  .ticket-foot small { max-width: 58%; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .path-strip { grid-template-columns: repeat(4, 1fr); }
  .path-item:nth-child(4) { border-right: 0; }
  .path-item { border-bottom: 1px solid var(--line); }
  .path-item:nth-child(n+5) { border-bottom: 0; }
  .entry-grid { grid-template-columns: 1fr; }
  .entry-card { min-height: 170px; }
  .feature-grid { grid-template-columns: 1fr; }
  .library-layout { grid-template-columns: 1fr; }
  .filter-rail { position: relative; top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .filter-rail .rail-block + .rail-block { margin: 0; padding: 0; border: 0; }
  .filter-rail .rail-block:last-child { display: none; }
  .section-nav { max-height: 170px; overflow: auto; }
  .builder-layout { grid-template-columns: 1fr; }
  .builder-side { position: relative; top: auto; }
  .builder-list { max-height: 260px; }
  .workspace, .apply-write { grid-template-columns: 1fr; }
  .writing-panel { position: relative; top: auto; }
  .prompt-panel { padding: 21px 19px; }
  .match-grid { grid-template-columns: 1fr; }
  .apply-template-groups { grid-template-columns: 1fr; }
  .guided-paper { max-height: none; padding: 17px 16px 11px; }
  .guided-actions { justify-content: flex-start; }
  .essay-sheet { padding: 24px 20px 20px; }
  .essay-title-input { font-size: 27px; }
  .essay-para-text { font-size: 15.5px; }
  .essay-para-hint { display: none; }
  .template-studio { grid-template-columns: 1fr; }
  .builder-gate { grid-template-columns: 1fr; gap: 24px; padding-top: 12px; }
  .gate-copy h1 { font-size: 38px; }
  .studio-side { position: static; }
  .studio-nav { display: grid; grid-template-columns: 1fr 1fr; }
  .studio-nav .rail-title { grid-column: 1 / -1; }
  .studio-side-actions { grid-template-columns: 1fr 1fr; }
  .studio-side-actions .btn:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .studio-sheet { min-height: 0; }
  .studio-para { grid-template-columns: 35px minmax(0, 1fr) 64px; gap: 9px; padding: 15px 5px; }
  .studio-para-no { font-size: 24px; }
  .studio-para-main strong { font-size: 18px; }
  .studio-sheet-foot { flex-direction: column; gap: 5px; }
  .progress-hero { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 18px; }
  .page-head .head-count { display: flex; align-items: baseline; gap: 8px; text-align: left; }
  .page-head .head-count strong { font-size: 23px; }
  .page-head .head-count span { font-size: 9.5px; }
  .blueprint-card, .bp-panel { padding: 21px 19px; }
  .blueprint-controls { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
  .blueprint-flow, .blueprint-flow.small {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px;
    overflow: visible; padding-bottom: 0;
  }
  .bp-block { min-width: 0; }
  .bp-block:not(:last-child)::after { display: none; }
  .bp-panel-head { flex-direction: column; gap: 10px; }
  .bp-panel-count { display: flex; align-items: baseline; gap: 7px; text-align: left; }
  .bp-panel-count strong { font-size: 25px; }
  .bp-group-head p { display: none; }
  .question-image-wrap img { max-height: 320px; }
}
@media (max-width: 640px) {
  body { font-size: 14px; }
  .topbar-inner { min-height: 60px; }
  .brand-text small { display: none; }
  .brand-seal { width: 34px; height: 34px; font-size: 19px; }
  .nav-links.open { top: 60px; }
  .home { padding-top: 32px; }
  .hero { padding-top: 12px; }
  .hero h1 { font-size: clamp(36px, 10vw, 48px); }
  .hero-sub { font-size: 14px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat { padding: 15px; }
  .stat-value { font-size: 26px; }
  .path-strip { grid-template-columns: 1fr 1fr; }
  .path-item { border-bottom: 1px solid var(--line) !important; padding: 16px 12px 16px 0; }
  .path-item:nth-child(2n) { border-right: 0; }
  .path-item:nth-child(n+7) { border-bottom: 0 !important; }
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .sentence-card { padding: 13px 13px 12px; }
  .sentence-en { font-size: 14px; }
  .blueprint-head h2 { font-size: 24px; }
  .bp-block { min-width: 0; padding: 13px 12px 11px; }
  .bp-desc { min-height: 0; font-size: 10px; }
  .bp-panel { padding: 18px 15px; }
  .bp-toolbar .search-box { flex-basis: 100%; }
  .bp-toolbar .toolbar-count { margin-left: 0; }
  .question-image-wrap img { max-height: 260px; }
  .sentence-actions { gap: 0; }
  .library-toolbar { padding: 8px; }
  .toolbar-count { width: 100%; margin-left: 0; }
  .paper { padding: 21px 17px 19px; }
  .paper-head { flex-direction: column; gap: 10px; }
  .paper-head-actions { justify-content: flex-start; }
  .slot-grid { grid-template-columns: 1fr; }
  .apply-grid { grid-template-columns: 1fr; }
  .stepper { padding: 11px; }
  .step span.step-name { display: none; }
  .step-line { margin: 0 7px; }
  .basket { flex-wrap: wrap; bottom: 10px; }
  .basket .chips { order: 4; flex-basis: 100%; max-height: 30px; }
  .question-grid { grid-template-columns: 1fr; }
  .q-card { min-height: 230px; }
  .chart-grid { grid-template-columns: 1fr; }
  .editor { min-height: 350px; padding: 15px; font-size: 14px; }
  .writing-head { flex-wrap: wrap; }
  .writing-actions { width: 100%; margin-left: 0; }
  .writing-modebar { padding: 8px 12px; }
  .writing-modebar > span, .modebar-right > span { display: none; }
  .handwriting-shell .hand-paper { height: 420px; }
  .hand-toolbar { padding: 9px 11px; }
  .hand-tools { gap: 4px; }
  .hand-size input { width: 52px; }
  .guided-bar { padding: 10px 12px; }
  .guided-paper { padding: 14px 12px 9px; }
  .guided-para-text { font-size: 13.5px; line-height: 2.35; }
  .guided-actions .btn-primary { width: 100%; }
  .essay-sheet { padding: 20px 15px 17px; }
  .essay-title-input { font-size: 24px; }
  .essay-para-head { flex-wrap: wrap; }
  .essay-add { margin-left: 0; }
  .essay-para-text { font-size: 14.5px; line-height: 2.2; }
  .essay-para-hint { display: none; }
  .studio-sheet { padding: 0 14px 13px; }
  .studio-sheet-head { padding: 20px 0 14px; }
  .studio-sheet-head h2 { font-size: 23px; }
  .studio-para { grid-template-columns: 30px minmax(0, 1fr); }
  .studio-para-foot { grid-column: 2; flex-direction: row; align-items: center; padding-top: 2px; }
  .studio-para-foot b { font-size: 18px; }
  .studio-para-foot span { margin-left: auto; }
  .studio-nav { grid-template-columns: 1fr; }
  .paragraph-services { grid-template-columns: 1fr; }
  .kc-bottom { grid-template-columns: 1fr; }
  .footer-inner { padding-top: 30px; gap: 24px; }
  .footer-cols { gap: 36px; }
  .progress-grid { grid-template-columns: 1fr; }
  .lex-grid { grid-template-columns: 1fr; }
  .ring-wrap { flex-direction: column; align-items: flex-start; gap: 16px; }
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal { max-height: 92vh; border-radius: 16px 16px 0 0; width: 100%; }
  .modal-body { padding: 17px 18px 19px; }
  .modal-head { padding: 17px 18px 12px; }
  .modal-foot { padding: 12px 18px 16px; }
  .toast-root { left: 14px; right: 14px; bottom: 14px; }
  .toast { max-width: none; width: 100%; }
  .quote-panel { padding: 25px 21px 22px; }
  .quote-panel blockquote { font-size: 22px; }
  .daily-card { padding: 21px 19px; }
}

/* ---------- print ---------- */
@media print {
  .topbar, .site-footer, .nav-actions, .filter-rail, .builder-side, .page-head, .paper-head-actions, .paper-foot, .toast-root, .modal-backdrop, .grain { display: none !important; }
  body { background: #fff; color: #111; }
  .page { padding: 0; }
  .paper { box-shadow: none; border: 0; padding: 0; }
  .builder-layout { display: block; }
  .template-item { break-inside: avoid; }
  .template-item .ops { display: none; }
  .sentence-en .slot, .template-item .en .slot { color: #111; background: transparent; }
}
