:root {
  --background: 36 33% 97%;
  --foreground: 0 0% 10%;
  --card: 40 50% 99%;
  --card-foreground: 0 0% 10%;
  --primary: 0 0% 10%;
  --primary-foreground: 36 33% 97%;
  --secondary: 36 27% 92%;
  --muted: 36 22% 89%;
  --muted-foreground: 35 15% 48%;
  --seal: 8 64% 47%;
  --seal-foreground: 40 50% 98%;
  --border: 36 25% 83%;
  --radius: 0.5rem;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-serif: "Songti SC", "STSong", "SimSun", serif;
}

html.dark {
  --background: 0 0% 10%;
  --foreground: 36 22% 89%;
  --card: 0 0% 14%;
  --card-foreground: 36 22% 89%;
  --primary: 36 22% 89%;
  --primary-foreground: 0 0% 10%;
  --secondary: 30 7% 16%;
  --muted: 30 7% 16%;
  --muted-foreground: 36 15% 59%;
  --seal: 8 70% 52%;
  --seal-foreground: 40 50% 98%;
  --border: 30 8% 21%;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }
button, select, input, textarea { font: inherit; color: inherit; }

.site-main { flex: 1 0 auto; }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* Header */
.site-header {
  position: relative;
  z-index: 40;
  padding: 1.25rem 0;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 700; }
.brand-name { display: none; }
.nav-desktop { display: flex; gap: 1.5rem; flex: 1; justify-content: center; }
.nav-link { color: hsl(var(--muted-foreground)); transition: color .2s; }
.nav-link:hover, .nav-link.active { color: hsl(var(--seal)); }
.header-actions { display: flex; align-items: center; gap: .75rem; }
.icon-button {
  border: 1px solid hsl(var(--border));
  background: transparent;
  border-radius: 999px;
  width: 2.25rem; height: 2.25rem;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.icon-button:hover { background: hsl(var(--secondary)); }
.lang-select {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: .35rem .5rem;
}
.menu-toggle { display: none; }
.mobile-menu { border-top: 1px solid hsl(var(--border)); background: hsl(var(--background)); }
.mobile-nav { display: flex; flex-direction: column; padding: 1rem; gap: .75rem; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .6rem 1.1rem;
  border-radius: var(--radius);
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s, background .2s, color .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.btn-seal { background: hsl(var(--seal)); color: hsl(var(--seal-foreground)); }

/* Hero */
.hero { position: relative; overflow: hidden; }
.hero-bg {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-size: clamp(12rem, 34vw, 26rem);
  font-weight: 700;
  opacity: .05;
  pointer-events: none;
  user-select: none;
}
.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 3rem;
  align-items: center;
  padding: 4rem 1rem 5rem;
}
.hero-copy h1 {
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  line-height: 1.15;
  margin: 0 0 1.25rem;
}
.hero-desc { font-size: 1.15rem; color: hsl(var(--muted-foreground)); margin: 0 0 2rem; max-width: 36rem; }
.seal-text { color: hsl(var(--seal)); }
.hero-demo { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.demo-box {
  width: 220px; height: 220px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, hsl(var(--card)), hsl(var(--secondary)));
  border: 1px solid hsl(var(--border));
  border-radius: 1rem;
  box-shadow: 0 10px 30px rgb(0 0 0 / .08);
}
.demo-char { font-family: var(--font-serif); font-size: 7rem; line-height: 1; }
.demo-chars { display: flex; gap: .5rem; }
.demo-char-btn {
  width: 2.5rem; height: 2.5rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--secondary));
  font-family: var(--font-serif);
  font-size: 1.2rem;
  cursor: pointer;
}
.demo-char-btn.active { background: hsl(var(--seal)); color: hsl(var(--seal-foreground)); border-color: transparent; }

.ink-divider { height: 1px; width: 75%; margin: 0 auto; background: linear-gradient(90deg, transparent, hsl(var(--seal) / .4), transparent); }
.ink-bg {
  background-image:
    radial-gradient(ellipse at 20% 20%, hsl(36 30% 94% / .6) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, hsl(36 25% 92% / .4) 0%, transparent 50%);
}
html.dark .ink-bg {
  background-image:
    radial-gradient(ellipse at 20% 20%, hsl(0 0% 14% / .8) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, hsl(0 0% 12% / .6) 0%, transparent 50%);
}

/* Sections */
.section { padding: 4rem 0; }
.section-title { text-align: center; font-size: clamp(1.7rem, 3vw, 2.4rem); margin: 0 0 2rem; }
.grid { display: grid; gap: 1.25rem; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  display: block;
  background: linear-gradient(135deg, hsl(var(--card)) 0%, hsl(var(--secondary)) 100%);
  border: 1px solid hsl(var(--border) / .8);
  border-radius: .75rem;
  padding: 1.5rem;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}
.card:hover { border-color: hsl(var(--seal) / .5); transform: translateY(-2px); box-shadow: 0 12px 28px rgb(0 0 0 / .08); }
.card h3 { margin: 0; font-size: 1.2rem; }
.card p { color: hsl(var(--muted-foreground)); margin: .75rem 0 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.hsk-card .btn { margin-top: 1rem; }
.seal-stamp {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.25rem; height: 2.25rem;
  flex: 0 0 auto;
  border-radius: .25rem;
  background: hsl(var(--seal));
  color: hsl(var(--seal-foreground));
  font-family: var(--font-serif);
  font-weight: 700;
}

.stats { background: hsl(var(--card) / .4); }
.stat { text-align: center; }
.stat strong {
  display: block;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 3rem);
  color: hsl(var(--seal));
  line-height: 1.1;
}
.stat span { color: hsl(var(--muted-foreground)); }

.cta { border-radius: 1rem; margin: 2rem auto; }
.cta-inner { text-align: center; max-width: 46rem; }
.cta-inner h2 { font-size: clamp(1.8rem, 3vw, 2.5rem); margin: 0 0 1rem; }
.cta-inner p { color: hsl(var(--muted-foreground)); margin: 0 0 1.75rem; }

/* Footer */
.site-footer {
  margin-top: 4rem;
  padding: 2rem 0 2.5rem;
  background: hsl(var(--foreground));
  color: hsl(var(--muted-foreground));
  font-size: .9rem;
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 2rem; }
.footer-col h5 { color: hsl(var(--background)); margin: 0 0 1rem; font-size: 1rem; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.footer-col a:hover { color: hsl(var(--seal)); }
.footer-meta { display: flex; flex-direction: column; gap: .5rem; }
.footer-links { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .5rem; }

/* 404 */
.notfound { text-align: center; padding: 4rem 1rem; }
.notfound h1 { font-size: 4rem; margin: 1rem 0 .5rem; }
.notfound p { color: hsl(var(--muted-foreground)); margin-bottom: 1.5rem; }

/* Shared page primitives */
.page { padding: 2.25rem 1rem 3rem; }
.page-narrow { max-width: 980px; }
.page-title { font-size: clamp(1.9rem, 4vw, 2.7rem); line-height: 1.15; margin: 0 0 1rem; }
.page-lead { color: hsl(var(--muted-foreground)); font-size: 1.05rem; margin: 0 0 1.75rem; max-width: 48rem; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; }
.center { text-align: center; margin-left: auto; margin-right: auto; }
.muted { color: hsl(var(--muted-foreground)); }
.section-heading { text-align: center; margin-bottom: 2rem; }
.section-heading h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); margin: 0 0 .5rem; }
.section-heading p { color: hsl(var(--muted-foreground)); margin: 0; }
.breadcrumbs { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; font-size: .9rem; color: hsl(var(--muted-foreground)); margin-bottom: 1.4rem; }
.breadcrumbs a:hover { color: hsl(var(--seal)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chip { display: inline-flex; align-items: center; justify-content: center; padding: .2rem .65rem; border-radius: 999px; background: hsl(var(--secondary)); color: hsl(var(--muted-foreground)); font-size: .85rem; }
.chip.active { background: hsl(var(--seal)); color: hsl(var(--seal-foreground)); }
.plain-list { margin: .5rem 0 0; padding-left: 1.2rem; color: hsl(var(--muted-foreground)); display: grid; gap: .35rem; }
.result-count { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; padding: .1rem .55rem; border-radius: 999px; background: hsl(var(--secondary)); color: hsl(var(--muted-foreground)); font-size: .85rem; }
.empty-state { color: hsl(var(--muted-foreground)); padding: 2rem 1rem; text-align: center; border: 1px dashed hsl(var(--border)); border-radius: var(--radius); }

.card h2 { margin: 0 0 .85rem; font-size: 1.45rem; }
.card h3 { margin: 1.1rem 0 .5rem; font-size: 1.15rem; }
.card + .card { margin-top: 1.25rem; }
.prose-card { margin-top: 2rem; }
.prose p { margin: 0 0 1rem; }
.prose h2 { margin-top: 1.8rem; }
.prose h3 { margin-top: 1.3rem; }
.prose ul, .prose ol { color: hsl(var(--muted-foreground)); }
.prose a { color: hsl(var(--seal)); text-decoration: underline; text-underline-offset: 2px; }

.feature-card { position: relative; }
.feature-card h2 { font-size: 1.25rem; margin: .8rem 0 .45rem; }
.feature-icon { display: inline-flex; width: 2rem; height: 2rem; font-size: 1rem; }
.howto-step { position: relative; padding: 1.5rem; border: 1px solid hsl(var(--border)); border-radius: .75rem; background: hsl(var(--card)); }
.howto-num { position: absolute; top: -1.1rem; left: 1rem; font-family: var(--font-serif); font-size: 3rem; color: hsl(var(--seal) / .18); line-height: 1; }
.howto-step h3 { margin: .35rem 0 .5rem; }
.howto-step p { color: hsl(var(--muted-foreground)); margin: 0; }
.faq-inner { max-width: 860px; }
.faq-list { display: grid; gap: .75rem; }
.faq-item { border: 1px solid hsl(var(--border)); border-radius: .65rem; background: hsl(var(--card)); }
.faq-item summary { cursor: pointer; padding: 1rem 1.15rem; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 1rem; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; color: hsl(var(--seal)); font-size: 1.2rem; }
.faq-item[open] summary::after { content: "−"; }
.faq-answer { padding: 0 1.15rem 1.1rem; color: hsl(var(--muted-foreground)); }

/* HSK / character grids */
.level-switch { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0 0 1.4rem; }
.char-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem; }
.char-card { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .9rem .5rem; border: 1px solid hsl(var(--border) / .75); border-radius: .65rem; background: hsl(var(--card)); text-align: center; transition: transform .15s, border-color .15s, background .15s; }
.char-card:hover { transform: translateY(-2px); border-color: hsl(var(--seal) / .55); background: hsl(var(--secondary)); }
.char-card-glyph { font-family: var(--font-serif); font-size: 2.1rem; line-height: 1.25; }
.char-card-pinyin { color: hsl(var(--muted-foreground)); font-size: .85rem; }
.char-card-meta { color: hsl(var(--muted-foreground)); font-size: .72rem; }
.char-card-level { color: hsl(var(--seal)); font-size: .75rem; }
.seal-large { width: auto; min-width: 3rem; padding: .45rem .75rem; font-size: .95rem; white-space: nowrap; }

/* Search */
.search-form { display: flex; gap: .6rem; margin: 0 auto 2rem; max-width: 720px; }
.search-form input { flex: 1; min-width: 0; padding: .72rem .9rem; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card)); }
.search-form input:focus { outline: 2px solid hsl(var(--seal) / .45); outline-offset: 1px; }
.search-results { margin-top: 2rem; }
.result-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.result-head h2 { margin: 0; }
.popular-section { margin-top: 2rem; }

/* Character detail */
.char-hero { display: flex; align-items: center; gap: 2rem; }
.char-hero-glyph { font-family: var(--font-serif); font-size: clamp(4.5rem, 12vw, 7rem); line-height: 1; }
.char-hero-info { flex: 1; min-width: 0; }
.pinyin-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .85rem; }
.pinyin-row .label { color: hsl(var(--muted-foreground)); }
.pinyin-chip { display: inline-flex; align-items: center; gap: .35rem; border: 1px solid hsl(var(--border)); background: hsl(var(--secondary)); border-radius: 999px; padding: .25rem .7rem; font-size: 1rem; cursor: default; }
button.pinyin-chip { cursor: pointer; }
button.pinyin-chip:hover { border-color: hsl(var(--seal)); }
button.pinyin-chip.playing { background: hsl(var(--seal)); color: hsl(var(--seal-foreground)); }
.char-facts { display: flex; flex-wrap: wrap; gap: .6rem 1.5rem; margin: 0; }
.char-facts > div { display: flex; align-items: baseline; gap: .35rem; }
.char-facts dt { color: hsl(var(--muted-foreground)); font-size: .85rem; }
.char-facts dd { margin: 0; font-weight: 600; }
.write-layout { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: flex-start; }
.anim-wrap { flex: 0 0 auto; }
.hanzi-grid { width: 202px; height: 202px; padding: 6px; background: hsl(var(--secondary)); border: 1px solid hsl(var(--border)); border-radius: .5rem; }
.hanzi-canvas { width: 190px; height: 190px; background-image: linear-gradient(hsl(var(--muted-foreground) / .18) 1px, transparent 1px), linear-gradient(90deg, hsl(var(--muted-foreground) / .18) 1px, transparent 1px), linear-gradient(hsl(var(--muted-foreground) / .1) 1px, transparent 1px), linear-gradient(90deg, hsl(var(--muted-foreground) / .1) 1px, transparent 1px); background-size: 190px 190px, 190px 190px, 95px 95px, 95px 95px; background-position: 0 0, 0 0, 0 0, 0 0; }
.hanzi-canvas svg { display: block; }
.stroke-list { flex: 1; min-width: 260px; display: flex; flex-wrap: wrap; gap: .55rem; }
.stroke-item { margin: 0; text-align: center; color: hsl(var(--foreground)); }
.stroke-item svg { background: hsl(var(--secondary)); border: 1px solid hsl(var(--border)); border-radius: .35rem; }
.stroke-item figcaption { font-size: .8rem; color: hsl(var(--muted-foreground)); margin-top: .15rem; }
.writing-guide .guide-steps { margin: .75rem 0 0; padding-left: 1.25rem; color: hsl(var(--muted-foreground)); display: grid; gap: .45rem; }
.definition-list { list-style: none; padding: 0; margin: 0; display: grid; gap: .55rem; }
.definition-list li { display: flex; gap: .55rem; }
.pos { color: hsl(var(--seal)); font-size: .8rem; font-weight: 600; white-space: nowrap; }
.compound-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.compound { padding: .85rem; border-radius: .55rem; background: hsl(var(--secondary)); }
.compound-word { font-family: var(--font-serif); font-size: 1.25rem; margin-bottom: .25rem; }
.compound-word a:hover { color: hsl(var(--seal)); text-decoration: underline; }
.word-links { display: flex; flex-wrap: wrap; gap: .55rem; }
.word-link { padding: .4rem .85rem; border-radius: .5rem; background: hsl(var(--secondary)); font-size: 1.05rem; }
.word-link:hover { background: hsl(var(--seal)); color: hsl(var(--seal-foreground)); }
.related-chars { display: flex; flex-wrap: wrap; gap: .5rem; }
.related-char { display: inline-flex; align-items: center; justify-content: center; width: 3rem; height: 3rem; border-radius: .5rem; background: hsl(var(--secondary)); font-family: var(--font-serif); font-size: 1.5rem; }
.related-char:hover { background: hsl(var(--seal)); color: hsl(var(--seal-foreground)); }
.sentence-list { display: grid; gap: .8rem; }
.sentence { padding: 1rem; border-radius: .55rem; background: hsl(var(--secondary)); }
.sentence-cn { font-size: 1.1rem; margin-bottom: .35rem; }
.sentence-en { color: hsl(var(--muted-foreground)); }
.sentence-source { color: hsl(var(--muted-foreground)); font-size: .8rem; margin-top: .35rem; }

/* Tools */
.tool-grid .feature-card { display: flex; flex-direction: column; align-items: flex-start; }
.practice-card { max-width: 720px; margin: 0 auto; }
.practice-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.practice-head h2 { margin: 0; }
.practice-wrap { border: 1px solid hsl(var(--border)); border-radius: .65rem; background: hsl(var(--card)); overflow: hidden; }
#practice-canvas { display: block; width: 100%; aspect-ratio: 1 / 1; touch-action: none; cursor: crosshair; }
.btn-danger { background: hsl(0 65% 50%); color: white; }
.btn-ghost { background: transparent; border-color: hsl(var(--border)); }
.template-grid { align-items: stretch; }
.template-card { display: flex; flex-direction: column; align-items: center; text-align: center; }
.template-card img { width: 140px; height: 140px; object-fit: contain; background: white; border-radius: .35rem; }
.template-card h2 { font-size: 1.15rem; margin: .8rem 0 .35rem; }
.template-card p { flex: 1; }
.template-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.template-option { display: flex; gap: .55rem; align-items: center; text-align: left; padding: .45rem; border: 1px solid hsl(var(--border)); border-radius: .55rem; background: hsl(var(--card)); cursor: pointer; }
.template-option.active { border-color: hsl(var(--seal)); box-shadow: 0 0 0 1px hsl(var(--seal) / .35); }
.template-option img { width: 64px; height: 64px; object-fit: contain; flex: 0 0 auto; background: white; border-radius: .3rem; }
.template-option strong { display: block; font-size: .9rem; }
.template-option small { display: block; color: hsl(var(--muted-foreground)); font-size: .72rem; line-height: 1.3; }
.worksheet-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(220px, .5fr); gap: 1.25rem; align-items: start; }
.worksheet-form { display: grid; gap: 1rem; }
.field { display: grid; gap: .4rem; }
.field > span, .field legend { font-weight: 600; }
.field textarea, .field select { width: 100%; padding: .6rem .7rem; border: 1px solid hsl(var(--border)); border-radius: .45rem; background: hsl(var(--card)); }
.field fieldset { border: 0; padding: 0; margin: 0; }
.range-row { display: flex; align-items: center; gap: .75rem; }
.range-row input { flex: 1; accent-color: hsl(var(--seal)); }
.range-row output { min-width: 3.5rem; color: hsl(var(--muted-foreground)); font-size: .9rem; }
.checkbox-field { display: flex; align-items: center; gap: .5rem; }
.checkbox-field input { accent-color: hsl(var(--seal)); }
.color-row { display: flex; flex-wrap: wrap; gap: .45rem; }
.color-dot { width: 2rem; height: 2rem; border-radius: .4rem; border: 2px solid transparent; cursor: pointer; }
.color-dot.active { border-color: hsl(var(--seal)); box-shadow: 0 0 0 2px hsl(var(--seal) / .25); }
.form-actions { display: flex; justify-content: flex-end; }
.worksheet-preview-card { position: sticky; top: 1rem; }
.preview-stack { position: relative; height: 180px; margin-bottom: .75rem; }
.preview-mini { position: absolute; inset: 0 20% 20px 0; background: white; border: 1px solid hsl(var(--border)); border-radius: .35rem; box-shadow: 0 8px 18px rgb(0 0 0 / .08); background-image: linear-gradient(#ddd 1px, transparent 1px), linear-gradient(90deg, #ddd 1px, transparent 1px); background-size: 22px 22px; }
.preview-mini + .preview-mini { inset: 22px 0 0 20%; }
.worksheet-about { margin-top: 2.5rem; }
.worksheet-about > h2 { font-size: 1.6rem; }
.worksheet-about .grid { align-items: start; }
.worksheet-about p { color: hsl(var(--muted-foreground)); }

/* Printable worksheet overlay */
.worksheet-overlay { position: fixed; inset: 0; z-index: 100; background: rgb(0 0 0 / .6); overflow: auto; padding: 2rem 1rem 5rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.preview-page { position: relative; width: 210mm; height: 297mm; background: white; color: #111; box-shadow: 0 12px 32px rgb(0 0 0 / .25); flex: 0 0 auto; page-break-after: always; }
.preview-page:last-of-type { page-break-after: auto; }
.preview-grid { position: absolute; inset: 20mm; display: grid; }
.preview-cell { display: flex; align-items: center; justify-content: center; background-repeat: no-repeat; background-size: 100% 100%; }
.preview-char { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; font-weight: 500; line-height: 1; }
.preview-page-no { position: absolute; top: 2mm; right: 4mm; color: #777; font-size: 10pt; }
.preview-controls { position: fixed; right: 1rem; bottom: 1rem; z-index: 101; display: flex; align-items: center; gap: .55rem; padding: .5rem .65rem; border-radius: .6rem; background: hsl(var(--card)); box-shadow: 0 10px 26px rgb(0 0 0 / .22); font-size: .85rem; }
@page { size: A4; margin: 0; }
@media print {
  body * { visibility: hidden; }
  .worksheet-overlay, .worksheet-overlay * { visibility: visible; }
  .worksheet-overlay { position: absolute; inset: 0; padding: 0; background: white; overflow: visible; display: block; }
  .preview-page { margin: 0; box-shadow: none; border-radius: 0; }
  .preview-controls { display: none !important; }
  [style*="background-image"], .preview-char { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Blog / static */
.blog-list { display: grid; gap: 1rem; }
.blog-card h2 { margin-bottom: .35rem; }
.blog-card h2 a:hover { color: hsl(var(--seal)); }
.blog-date { color: hsl(var(--muted-foreground)); font-size: .9rem; margin: 0 0 .5rem; }
.read-more { display: inline-block; margin-top: .75rem; color: hsl(var(--seal)); font-weight: 600; }
.read-more:hover { text-decoration: underline; }
.blog-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; color: hsl(var(--muted-foreground)); font-size: .9rem; margin-bottom: 1.5rem; }
.related-practice { margin-top: 1.5rem; }
.word-hero { text-align: center; }
.word-hero h1 { font-family: var(--font-serif); font-size: clamp(3.5rem, 12vw, 5.5rem); margin: 0 0 .5rem; }
.word-char-grid { display: flex; flex-wrap: wrap; gap: .75rem; }
.word-char-card { display: flex; flex-direction: column; align-items: center; gap: .2rem; min-width: 6rem; padding: 1rem; border-radius: .55rem; background: hsl(var(--secondary)); }
.word-char-card:hover { background: hsl(var(--seal)); color: hsl(var(--seal-foreground)); }
.word-char-glyph { font-family: var(--font-serif); font-size: 2.5rem; line-height: 1.1; }

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .char-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .worksheet-layout { grid-template-columns: 1fr; }
  .worksheet-preview-card { position: static; }
  .compound-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; padding-top: 2.5rem; }
  .hero-copy h1 { margin-left: auto; margin-right: auto; }
  .hero-desc { margin-left: auto; margin-right: auto; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .nav-desktop { display: none; }
  .menu-toggle { display: inline-flex; }
  .brand-name { display: inline; }
}

@media (max-width: 560px) {
  .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr; }
  .char-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .template-options { grid-template-columns: 1fr; }
  .compound-grid { grid-template-columns: 1fr; }
  .char-hero { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .page-heading { flex-direction: column; }
  .footer-grid { grid-template-columns: 1fr; }
  .lang-label { display: none; }
}
