/* 临字 LinZi - marketing site design system.
   Scholarly / literary: warm paper, ink text, vermilion brand. */

:root {
  --paper: #faf7f2;
  --card: #ffffff;
  --border: #eae3d9;
  --brand: #a33a2b;
  --brand-deep: #8c3a27;
  --ink: #1f1e1c;
  --muted: #5e5b54;
  --jade: #2d5a4c;
  --serif-cjk: 'Noto Serif TC', 'Noto Serif SC', 'Source Han Serif TC', serif;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --phonetic: 'Noto Sans', 'Noto Sans TC', 'Noto Sans SC', system-ui, sans-serif;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(31, 30, 28, .06), 0 8px 30px rgba(31, 30, 28, .05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background-color: var(--paper);
  /* faint 米字格 practice grid, tiled */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cg fill='none' stroke='%231f1e1c' stroke-opacity='0.032'%3E%3Cpath d='M0.5 0.5h159v159h-159z'/%3E%3Cpath d='M0.5 0.5l159 159M159.5 0.5l-159 159M80 0v160M0 80h160'/%3E%3C/g%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.hanzi { font-family: var(--serif-cjk); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 247, 242, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  display: flex; align-items: center; gap: 28px;
  max-width: 1120px; margin: 0 auto; padding: 14px 24px;
}
.nav-logo {
  display: flex; align-items: baseline; gap: 9px;
  font-weight: 700; color: var(--ink); font-size: 1.05rem;
  letter-spacing: .04em;
}
.nav-logo .zi {
  font-family: var(--serif-cjk);
  color: var(--brand); font-size: 1.5rem; font-weight: 700;
}
.nav-links { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.nav-links a { color: var(--muted); font-size: .92rem; font-weight: 500; }
.nav-links a:hover { color: var(--ink); text-decoration: none; }
.nav-cta {
  background: var(--brand); color: #fff !important;
  padding: 9px 18px; border-radius: 999px; font-weight: 600;
}
.nav-cta:hover { background: var(--brand-deep); }
@media (max-width: 820px) { .nav-links a:not(.nav-cta) { display: none; } }

/* ---------- hero ---------- */
.hero { padding: 84px 0 72px; }
.hero-grid {
  display: grid; grid-template-columns: 1.1fr .9fr;
  gap: 56px; align-items: center;
}
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } }
.eyebrow {
  display: inline-block; font-size: .78rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--jade); background: rgba(45, 90, 76, .08);
  border: 1px solid rgba(45, 90, 76, .18);
  padding: 6px 14px; border-radius: 999px; margin-bottom: 22px;
}
h1.hero-title {
  font-size: clamp(2.1rem, 4.6vw, 3.3rem);
  line-height: 1.18; font-weight: 800; letter-spacing: -.02em;
}
.hero-sub { margin-top: 20px; font-size: 1.1rem; color: var(--muted); max-width: 34rem; }
.badges { display: flex; gap: 12px; margin-top: 30px; flex-wrap: wrap; }
.store-badge {
  display: inline-flex; align-items: center; gap: 10px;
  background: #23201c; color: #f3efe8; border: 1px solid transparent; border-radius: 10px;
  padding: 10px 18px; font-size: .85rem; line-height: 1.25;
}
.store-badge:hover { text-decoration: none; opacity: .88; }
.store-badge b { font-size: 1rem; display: block; }
.store-badge.soon { opacity: .72; }
.store-badge.soon i { font-style: normal; font-size: .78rem; color: #cbb; }
.proof-pill {
  margin-top: 22px; font-size: .82rem; color: var(--muted);
}
.proof-pill b { color: var(--jade); }

/* phone mockup */
.phone {
  width: 300px; margin: 0 auto; border-radius: 40px;
  background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow), 0 30px 60px rgba(31,30,28,.10);
  padding: 18px; position: relative;
}
.phone::before {
  content: ''; position: absolute; top: 10px; left: 50%;
  transform: translateX(-50%); width: 90px; height: 8px;
  background: var(--border); border-radius: 4px;
}
.phone-card {
  margin-top: 26px; border: 1px solid var(--border);
  border-radius: 18px; padding: 26px 18px; text-align: center;
  background: linear-gradient(180deg, #fffdf9, #fff);
}
.phone-card .glyph {
  font-family: var(--serif-cjk); font-size: 4.6rem;
  font-weight: 700; color: var(--ink); line-height: 1.2;
}
.phone-card .zy {
  font-family: var(--phonetic); color: var(--brand);
  font-size: 1.15rem; letter-spacing: .06em; margin-top: 4px;
}
.phone-card .py { color: var(--muted); font-size: .95rem; margin-top: 2px; }
.phone-hint {
  margin-top: 14px; display: flex; gap: 8px; justify-content: center;
}
.phone-hint span {
  font-size: .72rem; padding: 4px 10px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--border); color: var(--muted);
}
.phone-progress { margin-top: 16px; }
.phone-progress .bar {
  height: 6px; border-radius: 3px; background: var(--border); overflow: hidden;
}
.phone-progress .bar i {
  display: block; height: 100%; width: 38%; border-radius: 3px;
  background: var(--brand);
}
.phone-progress p { font-size: .75rem; color: var(--muted); margin-top: 8px; text-align: center; }

/* ---------- sections ---------- */
section.block { padding: 72px 0; }
section.block.tint { background: #f4efe6; border-block: 1px solid var(--border); }
.section-head { max-width: 44rem; margin-bottom: 40px; }
h2.section-title {
  font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -.015em;
}
.section-sub { color: var(--muted); margin-top: 12px; font-size: 1.02rem; }

/* ---------- demo ---------- */
.demo-tabs { display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap; }
.demo-tab {
  border: 1px solid var(--border); background: var(--card);
  padding: 9px 18px; border-radius: 999px; font-size: .9rem;
  font-weight: 600; color: var(--muted); cursor: pointer;
  font-family: var(--sans);
}
.demo-tab.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.demo-panel { display: none; }
.demo-panel.active { display: block; }
.demo-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px;
}
.demo-grid { display: grid; grid-template-columns: 340px 1fr; gap: 36px; align-items: start; }
@media (max-width: 860px) { .demo-grid { grid-template-columns: 1fr; } }
.char-picker { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.char-pick {
  font-family: var(--serif-cjk); font-size: 1.6rem; width: 56px; height: 56px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--paper);
  cursor: pointer; color: var(--ink);
}
.char-pick.active { border-color: var(--brand); color: var(--brand); background: #fdf3f1; }
#stroke-box {
  width: 320px; height: 320px; border-radius: 12px;
  background:
    linear-gradient(var(--border) 1px, transparent 1px) 0 50%/100% 1px no-repeat,
    linear-gradient(90deg, var(--border) 1px, transparent 1px) 50% 0/1px 100% no-repeat,
    linear-gradient(45deg, transparent 49.6%, var(--border) 49.6%, var(--border) 50.4%, transparent 50.4%),
    linear-gradient(-45deg, transparent 49.6%, var(--border) 49.6%, var(--border) 50.4%, transparent 50.4%),
    var(--card);
  border: 1px solid var(--border); touch-action: none;
}
.stroke-btns { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.btn {
  border: 1px solid var(--border); background: var(--card); color: var(--ink);
  padding: 10px 20px; border-radius: 10px; font-weight: 600; font-size: .9rem;
  cursor: pointer; font-family: var(--sans);
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--paper); }
.btn.primary:hover { background: var(--brand-deep); }
.btn:disabled { opacity: .45; cursor: default; }
.stroke-meta { font-size: .9rem; color: var(--muted); }
.stroke-meta b { color: var(--ink); }
#stroke-score { font-weight: 700; color: var(--jade); }

/* ---------- reader demo / story pages ---------- */
.reader {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 44px);
}
.reader-body {
  font-family: var(--serif-cjk);
  font-size: clamp(1.25rem, 2.4vw, 1.65rem);
  line-height: 2.3;
}
.reader-body.ruby-on rt { opacity: 1; }
.reader-body rt {
  font-family: var(--phonetic); font-size: .52em; color: var(--muted);
  opacity: 0; transition: opacity .15s; font-style: normal;
}
.reader-body ruby { cursor: pointer; }
.reader-body ruby:hover rt { opacity: 1; }
.reader-body .w-active { background: #fdf0ec; border-radius: 6px; }
.reader-body .en-line {
  display: none; font-family: var(--font-sans);
  font-size: .92rem; color: var(--muted); line-height: 1.55;
  margin: -2px 0 0; padding: 0 0 18px 2px;
}
.reader-body.en-on .en-line { display: block; }
.story-source { font-size: .82rem; color: var(--muted); font-style: italic; }
.reader-toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 18px; padding-bottom: 16px; border-bottom: 1px solid var(--border);
}
.toggle-pill {
  border: 1px solid var(--border); background: var(--paper); color: var(--muted);
  border-radius: 999px; padding: 6px 14px; font-size: .8rem; font-weight: 600;
  cursor: pointer; font-family: var(--sans);
}
.toggle-pill.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }
audio { height: 40px; }
.popover {
  position: absolute; z-index: 60; width: 250px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 12px 40px rgba(31,30,28,.16);
  padding: 14px 16px; font-size: .9rem; display: none;
}
.popover.open { display: block; }
.popover .pw { font-family: var(--serif-cjk); font-size: 1.5rem; font-weight: 700; }
.popover .pp { color: var(--brand); font-family: var(--phonetic); }
.popover .pz { color: var(--muted); font-family: var(--phonetic); margin-left: 8px; }
.popover .pd { color: var(--muted); margin-top: 6px; font-size: .85rem; }
.popover .pbtn {
  margin-top: 10px; width: 100%; font-size: .8rem; padding: 7px;
}
.conversion-note {
  margin-top: 22px; padding: 14px 18px; border-radius: 12px;
  background: #fdf3f1; border: 1px solid #f2d9d2; font-size: .9rem;
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}

/* ---------- features ---------- */
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .feat-grid { grid-template-columns: 1fr; } }
.feat {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow);
}
.feat .ic {
  width: 44px; height: 44px; border-radius: 12px; display: grid;
  place-items: center; background: #fdf3f1; color: var(--brand);
  font-family: var(--serif-cjk); font-size: 1.3rem; font-weight: 700;
  margin-bottom: 16px;
}
.feat h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; }
.feat p { font-size: .92rem; color: var(--muted); }

/* ---------- pricing ---------- */
.price-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 960px) { .price-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .price-grid { grid-template-columns: 1fr; } }
.price {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; position: relative;
}
.price.popular { border-color: var(--brand); border-width: 2px; }
.price .tag {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--brand); color: #fff; font-size: .72rem; font-weight: 700;
  padding: 4px 14px; border-radius: 999px; white-space: nowrap;
}
.price h3 { font-size: 1rem; font-weight: 700; }
.price .amount { font-size: 2rem; font-weight: 800; margin: 10px 0 2px; }
.price .per { color: var(--muted); font-size: .85rem; }
.price ul { list-style: none; margin: 18px 0 22px; flex: 1; }
.price li {
  font-size: .88rem; color: var(--muted); padding: 5px 0 5px 22px; position: relative;
}
.price li::before { content: '✓'; position: absolute; left: 0; color: var(--jade); font-weight: 700; }
.price .btn { text-align: center; }

/* ---------- schools ---------- */
.b2b-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }
@media (max-width: 900px) { .b2b-grid { grid-template-columns: 1fr; } }
.cap { display: flex; gap: 14px; margin-bottom: 22px; }
.cap .dot {
  flex: none; width: 40px; height: 40px; border-radius: 10px;
  background: rgba(45,90,76,.1); color: var(--jade);
  display: grid; place-items: center; font-weight: 700;
  font-family: var(--serif-cjk);
}
.cap h4 { font-size: .98rem; margin-bottom: 4px; }
.cap p { font-size: .88rem; color: var(--muted); }
form.lead {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px;
}
form.lead label { display: block; font-size: .82rem; font-weight: 600; margin: 14px 0 5px; }
form.lead input, form.lead select, form.lead textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 9px;
  padding: 10px 12px; font: inherit; font-size: .92rem; background: #fff;
}
form.lead input:focus, form.lead select:focus, form.lead textarea:focus {
  outline: 2px solid rgba(163, 58, 43, .3); border-color: var(--brand);
}
form.lead textarea { min-height: 90px; resize: vertical; }
#lead-status { font-size: .88rem; margin-top: 10px; }
#lead-status.ok { color: var(--jade); font-weight: 600; }
#lead-status.err { color: var(--brand); }

/* ---------- lists (stories / compare indexes) ---------- */
.tile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 900px) { .tile-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .tile-grid { grid-template-columns: 1fr; } }
.tile {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px; display: block; color: var(--ink);
}
.tile:hover { text-decoration: none; border-color: var(--brand); box-shadow: var(--shadow); }
.tile .t-zh { font-family: var(--serif-cjk); font-size: 1.25rem; font-weight: 700; }
.tile .t-en { font-size: .84rem; color: var(--muted); margin-top: 4px; }
.tile .t-meta { font-size: .75rem; color: var(--muted); margin-top: 10px; display: flex; gap: 8px; align-items: center; }
.lvl {
  font-size: .68rem; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--border);
}
.group-title { font-family: var(--serif-cjk); font-size: 1.3rem; font-weight: 700; margin: 36px 0 14px; }
.pair-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 18px; margin: 22px 0;
}
.pair-char {
  background: var(--paper); border: 1px solid var(--border);
  border-radius: 16px; padding: 24px 22px; text-align: center;
  box-shadow: 0 1px 2px rgba(31, 30, 28, .05);
}
/* the big glyph sits on a subtle 米字格 (rice grid) practice square */
.pc-grid {
  width: 118px; height: 118px; margin: 0 auto; border-radius: 10px;
  border: 1px solid var(--border); background-color: var(--card);
  background-image:
    linear-gradient(to right, transparent calc(50% - .5px), var(--border) calc(50% - .5px), var(--border) calc(50% + .5px), transparent calc(50% + .5px)),
    linear-gradient(to bottom, transparent calc(50% - .5px), var(--border) calc(50% - .5px), var(--border) calc(50% + .5px), transparent calc(50% + .5px)),
    linear-gradient(45deg, transparent calc(50% - .5px), var(--border) calc(50% - .5px), var(--border) calc(50% + .5px), transparent calc(50% + .5px)),
    linear-gradient(-45deg, transparent calc(50% - .5px), var(--border) calc(50% - .5px), var(--border) calc(50% + .5px), transparent calc(50% + .5px));
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem; font-weight: 700; color: var(--ink);
}
.pc-word { font-size: 2.5rem; font-weight: 700; line-height: 1.15; margin-top: 6px; }
.pc-word .trad { font-size: 1.35rem; font-weight: 400; color: var(--muted); }
.pc-read { margin-top: 14px; font-family: var(--phonetic); color: var(--brand); font-size: 1.02rem; font-weight: 600; }
.pc-read .zy { color: var(--muted); font-weight: 400; font-size: .88rem; }
.pc-read .pc-trad { color: var(--muted); font-weight: 400; font-size: .95rem; }
.pc-gloss { margin-top: 8px; font-size: .9rem; color: var(--ink); line-height: 1.55; }
.pc-meta { margin-top: 6px; font-size: .8rem; color: var(--muted); }
.pc-hint {
  margin-top: 14px; font-size: .83rem; color: var(--muted); line-height: 1.5;
  background: var(--card); border: 1px dashed var(--border); border-radius: 8px;
  padding: 9px 12px;
}
.pc-strokes { margin-top: 16px; }
.pc-strokes-head {
  font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 9px;
}
.pc-cells { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.pc-cell {
  position: relative; width: 46px; height: 46px;
  background: var(--card); border: 1px solid var(--border); border-radius: 6px;
}
.pc-cell svg { display: block; width: 100%; height: 100%; }
.pc-cell path { fill: var(--ink); }
.pc-cell i {
  position: absolute; top: 2px; left: 5px; font-style: normal;
  font-size: .55rem; font-family: var(--phonetic); color: #bdb4a4;
}
.pc-cell:last-child { border-color: var(--brand); }
.compare-note {
  border-left: 3px solid var(--brand); background: var(--card);
  border-radius: 0 10px 10px 0; padding: 14px 18px;
  font-size: .92rem; color: var(--muted); margin: 26px 0 0;
}
.pc-ex { margin-top: 16px; text-align: left; border-left: 2px solid var(--border); padding-left: 12px; }
.pc-ex-zh { font-size: 1.08rem; }
.pc-ex-en { color: var(--muted); font-size: .85rem; margin: 3px 0 8px; }
.pc-ex audio { width: 100%; height: 32px; }
.cta-banner {
  position: relative; overflow: hidden;
  margin-top: 40px; padding: 46px 52px; border-radius: 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 36px;
  background:
    radial-gradient(130% 180% at 108% -20%, rgba(163, 58, 43, .45), transparent 55%),
    linear-gradient(115deg, #201e1b 30%, #2c2723);
  color: #f3efe8;
}
.cta-watermark {
  position: absolute; right: 34%; top: 50%; transform: translateY(-50%);
  font-size: 15rem; line-height: 1; color: rgba(243, 239, 232, .05);
  pointer-events: none; user-select: none;
}
.cta-copy { position: relative; }
.cta-banner h3 { font-family: var(--serif-cjk); font-size: 2rem; margin-bottom: 8px; }
.cta-banner p { color: #b9b2a6; font-size: .95rem; margin: 0; }
.cta-banner .badges { position: relative; margin-top: 0; flex-direction: column; align-items: stretch; gap: 10px; }
.cta-banner .store-badge {
  background: rgba(243, 239, 232, .07); border: 1px solid rgba(243, 239, 232, .22);
  min-width: 218px; justify-content: flex-start;
}
.cta-banner .store-badge:hover { background: rgba(243, 239, 232, .13); opacity: 1; }
.cta-banner .store-badge.soon i { color: #a89f92; }
.cta-banner .btn { background: var(--brand); border-color: var(--brand); color: #fff; }
@media (max-width: 720px) {
  .cta-banner { flex-direction: column; text-align: center; padding: 38px 26px; }
  .cta-watermark { right: -6%; font-size: 11rem; opacity: .8; }
  .cta-banner .badges { flex-direction: row; flex-wrap: wrap; justify-content: center; }
  .cta-banner .store-badge { min-width: 0; }
}

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--border); margin-top: 40px;
  padding: 40px 0 56px; background: #f4efe6;
}
.foot-grid { display: flex; gap: 40px; flex-wrap: wrap; justify-content: space-between; }
.foot-grid h5 { font-size: .8rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 10px; }
.foot-grid a { display: block; color: var(--ink); font-size: .9rem; padding: 3px 0; }
.copyright { margin-top: 30px; font-size: .8rem; color: var(--muted); }

/* legal pages */
.legal { max-width: 720px; }
.legal h2 { font-size: 1.15rem; margin: 28px 0 8px; }
.legal p, .legal li { font-size: .94rem; color: var(--muted); }
.legal ul { padding-left: 22px; margin: 8px 0; }

/* ---------------- dictionary ---------------- */
.crumb { font-size: .8rem; color: var(--muted); margin-bottom: 18px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--brand); }
.crumb-sep { margin: 0 8px; color: var(--border); }
.dict-head { display: flex; gap: 26px; align-items: flex-start; margin-bottom: 8px; }
.pc-grid.big { width: 148px; height: 148px; font-size: 5rem; flex-shrink: 0; }
.pc-word.big { font-size: 3rem; margin-top: 10px; }
.pc-word.big .trad { font-size: 1.6rem; }
.dict-title { font-size: 1.9rem; font-weight: 800; letter-spacing: -.01em; margin-top: 14px; }
.dict-sub { display: flex; gap: 14px; align-items: baseline; margin-top: 6px; color: var(--muted); font-size: 1rem; }
.dict-sub .trad { font-size: 1.25rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.dict-defs { margin: 22px 0 6px; }
.def-row { display: flex; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 1.02rem; line-height: 1.5; }
.def-row:last-child { border-bottom: 0; }
.def-n {
  flex-shrink: 0; width: 20px; height: 20px; margin-top: 3px; border-radius: 50%;
  background: var(--brand); color: var(--paper); font-size: .68rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.dict-block { margin-top: 26px; }
.dict-block h3 {
  font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px;
}
.chip-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.wchip {
  display: inline-flex; align-items: baseline; gap: 7px; padding: 6px 12px;
  background: var(--card); border: 1px solid var(--border); border-radius: 999px;
  font-size: .95rem; color: var(--ink); transition: border-color .15s, transform .15s;
}
a.wchip:hover { border-color: var(--brand); transform: translateY(-1px); }
.wchip-py { font-size: .74rem; color: var(--muted); font-family: var(--phonetic); }
/* decomposition tree */
.idc-root { display: inline-block; padding: 14px 16px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; }
.idc { display: inline-flex; align-items: center; gap: 6px; }
.idc-op { font-size: .7rem; color: #c2b8a6; font-family: var(--phonetic); }
.idc-kids { display: inline-flex; gap: 6px; align-items: center; }
.idc-kids.col { flex-direction: column; gap: 4px; }
.idc-kids.row { flex-direction: row; }
.idc-leaf {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 4px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--paper);
  font-size: 1.05rem; color: var(--ink);
}
a.idc-leaf:hover { border-color: var(--brand); color: var(--brand); }
/* tokenized example row */
.tok-row { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: flex-end; }
.tok { display: inline-flex; flex-direction: column; align-items: center; }
.tok-py { font-size: .66rem; font-family: var(--phonetic); color: var(--muted); }
.tok-zh { font-size: 1.15rem; }
.tok-pun { font-size: 1.15rem; }
/* dict landing */
.dict-search input {
  width: 100%; padding: 15px 20px; font-size: 1.05rem; font-family: inherit;
  border: 1px solid var(--border); border-radius: 14px; background: var(--card);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.dict-search input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(163, 58, 43, .08); }
.dict-tabs { display: flex; gap: 8px; align-items: center; margin: 18px 0 10px; }
.dtab {
  border: 1px solid var(--border); background: transparent; border-radius: 999px;
  padding: 7px 18px; font-size: .88rem; font-weight: 600; cursor: pointer; color: var(--muted);
  font-family: inherit;
}
.dtab.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.dict-count { margin-left: auto; font-size: .8rem; color: var(--muted); }
.dict-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.fchip {
  border: 1px solid var(--border); background: transparent; border-radius: 999px;
  padding: 4px 12px; font-size: .76rem; cursor: pointer; color: var(--muted); font-family: inherit;
}
.fchip.on { background: var(--brand); color: var(--paper); border-color: var(--brand); }
.dict-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 8px; }
.dtile {
  display: flex; flex-direction: column; padding: 10px 12px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--border); transition: border-color .15s;
}
.dtile:hover { border-color: var(--brand); }
.dtile-zh { font-size: 1.3rem; font-weight: 700; }
.dtile-py { font-size: .72rem; color: var(--brand); font-family: var(--phonetic); margin-top: 1px; }
.dtile-en { font-size: .76rem; color: var(--muted); margin-top: 4px; line-height: 1.35;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (max-width: 560px) {
  .dict-head { flex-direction: column; align-items: center; text-align: center; }
  .chips { justify-content: center; }
}
.pfoot { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.pdict { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.pdict:hover { color: var(--brand); }
a.pc-grid { color: inherit; display: flex; }
a.pc-grid:hover { border-color: var(--brand); }

/* ---------------- sounds chart ---------------- */
.s-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
.s-grid.tones { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.s-tile {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 8px; text-align: center;
}
.s-sym { font-size: 1.9rem; font-weight: 700; line-height: 1.1; }
.s-py { font-size: .76rem; color: var(--brand); font-family: var(--phonetic); margin-top: 2px; }
.s-char { display: inline-block; font-size: 1.3rem; margin-top: 6px; padding: 1px 10px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--paper); }
a.s-char:hover { border-color: var(--brand); }
.s-plays { display: flex; gap: 4px; justify-content: center; margin-top: 7px; }
.s-play {
  border: 1px solid var(--border); background: transparent; border-radius: 999px;
  padding: 2px 8px; font-size: .68rem; cursor: pointer; color: var(--muted); font-family: inherit;
}
.s-play:hover { border-color: var(--brand); color: var(--brand); }
.s-play.on { background: var(--brand); color: var(--paper); border-color: var(--brand); }

/* ---------------- web tools strip ---------------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.tool-tile {
  display: flex; flex-direction: column; gap: 3px;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px; color: var(--ink); transition: border-color .15s, transform .15s;
}
a.tool-tile:hover { border-color: var(--brand); transform: translateY(-2px); }
.tool-ic { font-size: 1.5rem; font-weight: 700; color: var(--brand); }
.tool-t { font-weight: 700; font-size: .95rem; }
.tool-p { font-size: .8rem; color: var(--muted); }

a.lvl { color: inherit; }
a.lvl:hover { border-color: var(--brand); color: var(--brand); }

/* ---------------- tone-colored pinyin ---------------- */
.t1 { color: #B23B2E; }   /* first tone: cinnabar */
.t2 { color: #2D6A4F; }   /* rising: jade */
.t3 { color: #2F5DA3; }   /* dipping: indigo */
.t4 { color: #7B3FA0; }   /* falling: plum */
.t5 { color: #8A8577; }   /* neutral: ash */

/* ---------------- dark mode ---------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #181614;
    --card: #232019;
    --border: #3a352c;
    --brand: #d9705c;
    --brand-deep: #e08a72;
    --ink: #ede8dd;
    --muted: #a39c8d;
    --jade: #6fae94;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 8px 30px rgba(0, 0, 0, .3);
  }
  body {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cg fill='none' stroke='%23ede8dd' stroke-opacity='0.03'%3E%3Cpath d='M0.5 0.5h159v159h-159z'/%3E%3Cpath d='M0.5 0.5l159 159M159.5 0.5l-159 159M80 0v160M0 80h160'/%3E%3C/g%3E%3C/svg%3E");
  }
  .nav { background: rgba(24, 22, 20, .88); }
  section.block.tint { background: #1e1b17; }
  .feat, .price, .tcard, .pair-char, .dict-block, .story-row,
  input, select, textarea { background: var(--card) !important; }
  .pair-char { background-image: none; }
  .phone-card { background: var(--card); }
  .pc-grid, .cp-grid { background-color: var(--card) !important; }
  input, select, textarea { color: var(--ink); }
  .reader-body .w-active { background: rgba(217, 112, 92, .18); }
  footer { background: #141210 !important; }
  .t1 { color: #e07a6a; } .t2 { color: #6fae94; } .t3 { color: #7ba3dd; }
  .t4 { color: #b08ad1; } .t5 { color: #8a8577; }
  .lvl { background: #2a261f; }
  .zy { color: var(--muted); }
  .store-badge { border-color: rgba(243, 239, 232, .18); background: #2e2a24; }
  .store-badge.soon i { color: #b8ac9c; }
  .char-pick.active, .feat .ic { background: rgba(217, 112, 92, .13); }
  .dd-card { background: var(--card); }
  .dd-card.flipped { background: var(--paper); }
  #stroke-box svg { filter: drop-shadow(0 1px 0 rgba(0, 0, 0, .3)); }
  .conversion-note { background: rgba(217, 112, 92, .10); border-color: rgba(224, 122, 106, .32); }
  .phone-card { background: var(--card); }
  .dict-search input:focus { box-shadow: 0 0 0 3px rgba(217, 112, 92, .18); }
}

/* ---------------- print (HSK lists / vocab sheets) ---------------- */
@media print {
  .nav, footer, .section-sub, .s-play, audio, .crumb { display: none !important; }
  body { background: #fff; }
  .block { padding: 0 !important; }
  .wrap { max-width: none; padding: 0; }
  .wgrid { grid-template-columns: repeat(3, 1fr); gap: 4px; }
  .wchip, .dict-block { border: 1px solid #ccc !important; box-shadow: none; break-inside: avoid; }
  .section-title { font-size: 1.4rem; }
  .t1, .t2, .t3, .t4, .t5 { color: #222; }
}

/* ---------------- story prev/next ---------------- */
.story-pn {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-top: 26px; padding-top: 18px;
  border-top: 1px solid var(--border);
}
.pn { display: inline-flex; align-items: center; gap: 6px; color: var(--ink);
  font-size: .92rem; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--card); max-width: 38%; }
a.pn:hover { border-color: var(--brand); text-decoration: none; }
.pn-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pn.idx { color: var(--muted); font-size: .82rem; border: none; background: none; }

/* bilingual story bits */
.t-en { font-size: .8rem; color: var(--muted); font-style: italic; margin-top: 2px; }

/* ---------------- character map ---------------- */
.map-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.map-bar input[type="search"] {
  flex: 1; min-width: 220px; padding: 11px 16px; font-size: .95rem; font-family: inherit;
  border: 1px solid var(--border); border-radius: 12px; background: var(--card);
  color: var(--ink); outline: none;
}
.map-bar input[type="search"]:focus { border-color: var(--brand); }
.map-tgl { display: inline-flex; align-items: center; gap: 7px; font-size: .84rem;
  color: var(--muted); cursor: pointer; user-select: none; }
.map-stage {
  position: relative; height: min(76vh, 780px); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden; background: var(--paper);
}
#map-cv { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.map-tip {
  position: absolute; pointer-events: none; z-index: 3;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 11px; font-size: .8rem; color: var(--muted); line-height: 1.35;
  box-shadow: 0 6px 20px rgba(31,30,28,.10); max-width: 170px;
}
.map-tip-py { color: var(--brand); font-family: var(--phonetic); }
.map-panel {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: 300px; z-index: 4;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; overflow-y: auto; box-shadow: 0 10px 30px rgba(31,30,28,.14);
}
.map-x { position: absolute; top: 10px; right: 12px; border: none; background: none;
  font-size: 1.3rem; color: var(--muted); cursor: pointer; line-height: 1; }
.map-x:hover { color: var(--ink); }
.map-head { display: flex; gap: 14px; align-items: center; }
.map-g {
  width: 64px; height: 64px; flex-shrink: 0; display: flex; align-items: center;
  justify-content: center; font-size: 2.5rem; font-weight: 700; color: var(--ink);
  border: 1px solid var(--border); border-radius: 12px; background: var(--paper);
}
.map-py { color: var(--brand); font-family: var(--phonetic); font-size: .95rem; }
.map-en { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.map-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.map-rad { font-size: .78rem; color: var(--muted); }
.map-rad:hover { color: var(--brand); }
.map-grp { margin-top: 16px; }
.map-grp h4 { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px; }
.map-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.map-chip {
  display: inline-flex; flex-direction: column; align-items: center; min-width: 42px;
  padding: 5px 7px 4px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--paper); color: var(--ink); font-size: 1.05rem; line-height: 1.15;
}
a.map-chip:hover { border-color: var(--brand); }
.map-chip-py { font-size: .58rem; color: var(--muted); font-family: var(--phonetic); }
.map-legend {
  position: absolute; left: 12px; bottom: 12px; z-index: 3;
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 12px; font-size: .72rem; color: var(--muted);
}
.map-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px;
  margin-right: 5px; vertical-align: -1px; }
.map-legend-hint { opacity: .75; }
@media (max-width: 720px) {
  .map-stage { height: 70vh; }
  .map-panel { width: min(300px, calc(100% - 24px)); }
  .map-legend { font-size: .62rem; gap: 8px; }
}

/* pinyin gets equal billing with zhuyin on the sounds chart */
.s-py-big { font-size: 1rem; font-weight: 600; color: var(--ink); margin-top: 3px; }

/* exploration breadcrumb on the character map */
.map-trail {
  position: absolute; top: 10px; left: 12px; z-index: 3;
  display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
  max-width: calc(100% - 340px); pointer-events: auto;
}
.map-trail-l { font-size: .6rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); background: var(--card); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 9px; }
.map-crumb {
  border: 1px solid var(--border); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 3px 9px; font-size: .9rem; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.map-crumb:hover { border-color: var(--brand); color: var(--brand); }
.map-trail-sep { color: var(--muted); font-size: .7rem; }
@media (max-width: 720px) { .map-trail { max-width: calc(100% - 24px); } }

/* ---------------- spaced review demo ---------------- */
.dd-card {
  position: relative; height: 320px; cursor: pointer; user-select: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 22px 26px; text-align: center; overflow: hidden;
  background: var(--paper); border: 1.5px solid var(--border); border-radius: 18px;
  transition: border-color .15s, transform .15s, box-shadow .2s;
}
.dd-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.dd-card:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; }
.dd-card.flipped { background: var(--card); border-color: var(--brand); box-shadow: var(--shadow); }
.dd-zh { font-size: 3.2rem; font-weight: 700; font-family: var(--serif, "Noto Serif SC", serif); line-height: 1.15; }
.dd-py { color: var(--brand); font-size: 1rem; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.dd-py .zy { color: var(--muted); font-size: .95rem; }
.dd-reveal { visibility: hidden; width: 100%; display: flex; flex-direction: column;
  gap: 4px; min-height: 96px; justify-content: flex-start; }
.dd-reveal.on { visibility: visible; }
.dd-en { font-size: 1.05rem; color: var(--ink); font-weight: 600; padding-top: 10px;
  border-top: 1px dashed var(--border); width: 100%; }
.dd-ex { font-size: 1rem; color: var(--ink); padding-top: 6px; }
.dd-ex-en { font-size: .8rem; color: var(--muted); }
.dd-hint { position: absolute; bottom: 12px; font-size: .72rem; color: var(--muted);
  letter-spacing: .05em; }
.dd-rates { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px;
  visibility: hidden; }
.dd-rates.on { visibility: visible; }
.dd-rate {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 4px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--card); color: var(--ink); font-weight: 700; font-size: .82rem;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dd-rate span { font-size: .64rem; font-weight: 400; color: var(--muted); }
.dd-rate:hover { border-color: var(--brand); }
.dd-rate[data-r="again"]:hover { background: #f6e4e0; }
.dd-rate[data-r="hard"]:hover { background: #f6ecdb; }
.dd-rate[data-r="good"]:hover { background: #e2efe6; }
.dd-rate[data-r="easy"]:hover { background: #e2e8f6; }
.dd-meta { display: flex; justify-content: space-between; align-items: center;
  margin-top: 10px; font-size: .74rem; color: var(--muted); min-height: 1.2em; }
.dd-due { color: var(--brand); font-weight: 600; }
@media (prefers-color-scheme: dark) {
  .dd-rate[data-r="again"]:hover { background: rgba(217, 112, 92, .16); }
  .dd-rate[data-r="hard"]:hover { background: rgba(199, 112, 43, .16); }
  .dd-rate[data-r="good"]:hover { background: rgba(111, 174, 148, .16); }
  .dd-rate[data-r="easy"]:hover { background: rgba(47, 93, 163, .22); }
}
@media (max-width: 640px) { .dd-rates { grid-template-columns: repeat(2, 1fr); } }
.dd-due[hidden] { display: none; }

/* ---------- teacher portal (/teacher/) ---------- */
.portal-panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px;
  margin-bottom: 22px;
}
.portal-panel h3 { margin-top: 0; }
.portal-panel h4 { margin: 22px 0 8px; }
.portal-panel input:not([type=file]), .portal-panel select, .portal-panel textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 9px;
  padding: 10px 12px; font: inherit; font-size: .92rem; background: #fff;
  box-sizing: border-box; margin-bottom: 8px;
}
.portal-panel input:focus, .portal-panel select:focus, .portal-panel textarea:focus {
  outline: 2px solid rgba(163, 58, 43, .3); border-color: var(--brand);
}
.portal-panel textarea { resize: vertical; font-family: inherit; }
.portal-panel label { display: block; font-size: .82rem; font-weight: 600; margin: 10px 0 4px; }
.portal-head { display: flex; align-items: center; justify-content: space-between; gap: 14px;
  margin: 26px 0 18px; }
.st { font-size: .88rem; margin-top: 10px; }
.st.ok { color: var(--jade); font-weight: 600; }
.st.err { color: var(--brand); }
.item-row { display: flex; align-items: center; gap: 12px; padding: 9px 0;
  border-bottom: 1px solid var(--border); font-size: .92rem; }
.item-row .grow { flex: 1; }
.btn.danger { color: var(--brand); padding: 6px 12px; font-size: .82rem; }
.btn.danger:hover { border-color: var(--brand); }
.preview-table { width: 100%; border-collapse: collapse; font-size: .85rem; margin: 12px 0 4px; }
.preview-table th { text-align: left; color: var(--muted); font-weight: 600;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border); padding: 4px 8px; }
.preview-table td { border-bottom: 1px solid var(--border); padding: 5px 8px; }
.preview-table tr.bad td { color: var(--brand); }
.clip { position: relative; cursor: pointer; font-size: 1rem; color: var(--muted);
  border: 1px solid var(--border); border-radius: 8px; padding: 2px 8px;
  display: inline-block; }
.clip input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.clip.has { color: var(--jade); border-color: var(--jade); font-weight: 700; }
.apkg-row { display: flex; align-items: center; gap: 12px; margin: 14px 0 4px;
  flex-wrap: wrap; }
.apkg-row .clip { padding: 8px 16px; font-size: .88rem; font-weight: 600;
  font-family: inherit; }
.apkg-row .st { margin: 0; flex: 1; min-width: 200px; }
.apkg-panel { border: 1px dashed var(--border); border-radius: 10px;
  padding: 12px 14px; margin: 12px 0; }
.apkg-panel .apkg-map { display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 6px 18px; margin: 10px 0 12px; }
.apkg-map-item { margin: 0 !important; font-weight: 500 !important;
  font-size: .8rem !important; display: flex; align-items: center; gap: 8px; }
.apkg-map-item span { flex: 0 0 110px; color: var(--muted); }
.apkg-map-item select { flex: 1; min-width: 0; margin: 0; }
@media (max-width: 560px) { .apkg-panel .apkg-map { grid-template-columns: 1fr; } }
@media (prefers-color-scheme: dark) {
  .portal-panel input:not([type=file]), .portal-panel select, .portal-panel textarea {
    background: var(--card);
  }
}
