/* ============================================================
   shihanzi 识汉字 — общий стиль сайта
   «Печатный плакат»: кремовая бумага #FCF5E4, тушь #212121,
   красная печать #F4143F и золото #EDB217.

   Правила палитры (важно для контраста):
   - #F4143F (--red) — только крупные/декоративные элементы: логотип,
     большие иероглифы, рамки. Для мелкого текста и кнопок с белым
     текстом он не проходит WCAG (3.85:1 на креме), поэтому там —
     --seal / --seal-fill (тот же красный, на тон глубже).
   - #EDB217 (--gold) — только заливки с тёмным текстом поверх
     (8.4:1). Золотой ТЕКСТ на креме нечитаем — для него --gold-ink.

   Тема переключается атрибутом data-theme на <html> (см. header.php);
   без явного выбора — по системной настройке.
   ============================================================ */

:root{
  /* ---- светлая тема (по умолчанию) ---- */
  --bg:#FCF5E4;
  --surface:#FFFCF4;
  --surface-2:#F6ECD3;
  --surface-3:#EDDFBC;
  --ink:#212121;
  --ink-soft:#5C564A;
  --ink-faint:#9A917F;
  --muted:var(--ink-soft);
  --stone:var(--ink-soft);
  --line:#E1D3AE;
  --line-soft:#ECE1C4;
  --edge:#212121;          /* «печатная» обводка карточек и кнопок */
  --hard:#212121;          /* цвет жёсткой тени-оттиска */
  --hover-edge:#212121;

  --red:#F4143F;
  --seal:#D40F37;          /* красный для текста/обводок (4.9:1) */
  --seal-strong:#B00C2E;
  --seal-fill:#D40F37;     /* красная заливка под белый текст (5.3:1) */
  --seal-tint:rgba(244,20,63,.09);
  --on-seal:#FFFFFF;

  --gold:#EDB217;
  --gold-ink:#8A6A00;
  --gold-tint:rgba(237,178,23,.22);
  --on-gold:#212121;

  --jade:#1B7A4C;          /* «верно / пройдено» */
  --jade-strong:#14603B;
  --jade-fill:#1B7A4C;
  --jade-tint:rgba(27,122,76,.1);

  --mark-bg:var(--gold);
  --mark-ink:inherit;

  --footer-bg:#212121;
  --footer-ink:#FCF5E4;
  --footer-soft:#B8AF9C;
  --footer-line:#3A3834;

  --paper-canvas:#FCF5E4;  /* холст HanziWriter — всегда светлый */

  --shadow-sm:0 1px 0 rgba(33,33,33,.05), 0 8px 22px rgba(33,33,33,.06);
  --shadow-md:0 18px 40px rgba(33,33,33,.14);
  --shadow-hard:4px 4px 0 var(--hard);
  --shadow-hard-lg:7px 7px 0 var(--hover-edge);

  --r-sm:10px;
  --r:14px;
  --r-lg:20px;

  --font-display:'Unbounded', 'Noto Serif SC', system-ui, sans-serif;
  --font-ui:'Onest', 'Noto Serif SC', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-hz:'Noto Serif SC', 'Songti SC', 'SimSun', serif;

  /* уровни HSK: от золота к туши — «сложность нарастает» */
  --hsk1:#EDB217; --hsk2:#F08A24; --hsk3:#E0103A; --hsk4:#B80F33; --hsk5:#7A1028; --hsk6:#212121;
  --hsk1-on:#212121; --hsk2-on:#212121; --hsk3-on:#FFFFFF; --hsk4-on:#FFFFFF; --hsk5-on:#FFFFFF; --hsk6-on:#FCF5E4;

  color-scheme:light;
}

:root[data-theme="dark"]{
  --bg:#161616;
  --surface:#212121;
  --surface-2:#2A2A2A;
  --surface-3:#353535;
  --ink:#FCF5E4;
  --ink-soft:#B8AF9C;
  --ink-faint:#7D766A;
  --line:#3A3834;
  --line-soft:#2E2D2A;
  --edge:#4A463F;
  --hard:#050505;
  --hover-edge:#EDB217;

  --seal:#FF4D6A;
  --seal-strong:#FF7088;
  --seal-fill:#D40F37;
  --seal-tint:rgba(255,77,106,.12);

  --gold-ink:#EDB217;
  --gold-tint:rgba(237,178,23,.16);

  --jade:#4CD08A;
  --jade-strong:#79DEA8;
  --jade-fill:#1B7A4C;
  --jade-tint:rgba(76,208,138,.12);

  --mark-bg:transparent;
  --mark-ink:#EDB217;

  --footer-bg:#0E0E0E;
  --footer-ink:#FCF5E4;
  --footer-soft:#A39A87;
  --footer-line:#2B2A27;

  --shadow-sm:0 1px 0 rgba(0,0,0,.4), 0 8px 22px rgba(0,0,0,.3);
  --shadow-md:0 18px 40px rgba(0,0,0,.55);

  --hsk1:#EDB217; --hsk2:#F2903A; --hsk3:#FF4D6A; --hsk4:#E0103A; --hsk5:#B0335A; --hsk6:#FCF5E4;
  --hsk1-on:#212121; --hsk2-on:#212121; --hsk3-on:#212121; --hsk4-on:#FFFFFF; --hsk5-on:#FFFFFF; --hsk6-on:#212121;

  color-scheme:dark;
}

@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#161616;
    --surface:#212121;
    --surface-2:#2A2A2A;
    --surface-3:#353535;
    --ink:#FCF5E4;
    --ink-soft:#B8AF9C;
    --ink-faint:#7D766A;
    --line:#3A3834;
    --line-soft:#2E2D2A;
    --edge:#4A463F;
    --hard:#050505;
    --hover-edge:#EDB217;

    --seal:#FF4D6A;
    --seal-strong:#FF7088;
    --seal-fill:#D40F37;
    --seal-tint:rgba(255,77,106,.12);

    --gold-ink:#EDB217;
    --gold-tint:rgba(237,178,23,.16);

    --jade:#4CD08A;
    --jade-strong:#79DEA8;
    --jade-fill:#1B7A4C;
    --jade-tint:rgba(76,208,138,.12);

    --mark-bg:transparent;
    --mark-ink:#EDB217;

    --footer-bg:#0E0E0E;
    --footer-ink:#FCF5E4;
    --footer-soft:#A39A87;
    --footer-line:#2B2A27;

    --shadow-sm:0 1px 0 rgba(0,0,0,.4), 0 8px 22px rgba(0,0,0,.3);
    --shadow-md:0 18px 40px rgba(0,0,0,.55);

    --hsk1:#EDB217; --hsk2:#F2903A; --hsk3:#FF4D6A; --hsk4:#E0103A; --hsk5:#B0335A; --hsk6:#FCF5E4;
    --hsk1-on:#212121; --hsk2-on:#212121; --hsk3-on:#212121; --hsk4-on:#FFFFFF; --hsk5-on:#FFFFFF; --hsk6-on:#212121;

    color-scheme:dark;
  }
}

/* ============================================================
   База
   ============================================================ */
*{box-sizing:border-box;}
html{scroll-behavior:smooth; -webkit-text-size-adjust:100%;}
body{
  margin:0;
  background-color:var(--bg);
  color:var(--ink);
  font-family:var(--font-ui);
  font-size:16px;
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  min-height:100vh;
  display:flex;
  flex-direction:column;
}
main.wrap{flex:1 0 auto; width:100%;}

a{color:inherit; text-decoration:none;}
p a:not([class]), li a:not([class]), .alert a:not([class]), .lead a:not([class]){
  color:var(--seal);
  text-decoration:underline;
  text-decoration-thickness:1.5px;
  text-underline-offset:2px;
}
p a:not([class]):hover, li a:not([class]):hover, .alert a:not([class]):hover{text-decoration-thickness:2.5px;}
img{max-width:100%;}
button, input, select, textarea{font-family:inherit;}

.hz{font-family:var(--font-hz);}

::selection{background:var(--gold); color:#212121;}

:focus-visible{outline:3px solid var(--gold); outline-offset:2px; border-radius:6px;}
:root[data-theme="light"] :focus-visible{outline-color:#212121;}

h1, h2, h3, h4, h5{color:var(--ink); text-wrap:balance;}
h2, h3{font-family:var(--font-display); font-weight:600; letter-spacing:-.01em; line-height:1.3;}
h2{font-size:26px; margin:0 0 12px;}
h3{font-size:19px; margin:0 0 10px;}
h4{font-family:var(--font-ui); font-weight:700;}
h5{font-family:var(--font-ui); font-weight:700;}
h6{font-family:var(--font-ui);}

.eyebrow{
  display:block;
  font-family:var(--font-ui);
  font-size:12.5px;
  font-weight:700;
  letter-spacing:.09em;
  text-transform:uppercase;
  color:var(--ink-soft);
  margin:0 0 6px;
}
h6.eyebrow{font-size:12px;}

.mark{
  color:var(--mark-ink);
  background:linear-gradient(transparent 58%, var(--mark-bg) 58%, var(--mark-bg) 90%, transparent 90%);
  padding:0 .06em;
  -webkit-box-decoration-break:clone;
  box-decoration-break:clone;
}

.skip-link{
  position:absolute; left:12px; top:-60px; z-index:100;
  background:var(--ink); color:var(--bg);
  padding:10px 16px; border-radius:var(--r-sm);
  font-weight:700; font-size:14px;
  transition:top .2s ease;
}
.skip-link:focus{top:12px;}

/* ---------- layout shell ---------- */
.wrap{max-width:1180px; margin:0 auto; padding:0 40px;}
main.wrap{padding-top:34px; padding-bottom:80px;}

/* ============================================================
   Шапка
   ============================================================ */
.site-header{
  position:sticky; top:0; z-index:50;
  background:color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter:saturate(1.2) blur(10px);
  backdrop-filter:saturate(1.2) blur(10px);
  border-bottom:2px solid var(--edge);
}
.nav{
  max-width:1400px;
  display:grid;
  grid-template-columns:auto 1fr auto;
  align-items:center;
  gap:18px;
  min-height:70px;
  font-family:var(--font-ui);
}
.nav-left{display:flex; align-items:center; gap:12px; min-width:0;}

.logo{display:inline-flex; align-items:center; gap:10px; white-space:nowrap;}
.logo-seal{
  width:40px; height:40px;
  display:inline-flex; align-items:center; justify-content:center;
  background:var(--red);
  color:#FCF5E4;
  font-size:23px; font-weight:900; line-height:1;
  border-radius:9px;
  box-shadow:inset 0 0 0 2.5px rgba(252,245,228,.35);
  transform:rotate(-4deg);
  transition:transform .25s ease;
  flex-shrink:0;
}
.logo:hover .logo-seal{transform:rotate(3deg) scale(1.04);}
.logo-word{display:flex; align-items:baseline; gap:7px;}
.logo .py{font-family:var(--font-display); font-weight:700; font-size:18px; letter-spacing:-.02em; color:var(--ink);}
.logo .logo-word .hz{font-size:17px; font-weight:700; color:var(--seal);}

.nav-menu{display:flex; align-items:center; gap:14px; min-width:0;}
.nav-right{display:flex; align-items:center; justify-content:center; gap:4px; flex:1; min-width:0; flex-wrap:wrap;}
.nav-right a{
  position:relative;
  padding:8px 12px;
  border-radius:var(--r-sm);
  font-size:15px; font-weight:500;
  color:var(--ink-soft);
  transition:color .2s ease, background-color .2s ease;
}
.nav-right a::after{
  content:"";
  position:absolute; left:12px; right:12px; bottom:3px;
  height:4px; border-radius:2px;
  background:var(--gold);
  transform:scaleX(0); transform-origin:left;
  transition:transform .25s ease;
}
.nav-right a:hover{color:var(--ink);}
.nav-right a:hover::after{transform:scaleX(1);}
.nav-right a.active{color:var(--ink); font-weight:700;}
.nav-right a.active::after{transform:scaleX(1);}
.nav-profile-link{display:none;}  /* на десктопе профиль — аватарка справа */

.auth{display:flex; align-items:center; gap:8px;}
.nav-tools{display:flex; align-items:center; gap:8px;}

.theme-toggle{
  display:inline-flex; align-items:center; justify-content:center;
  width:38px; height:38px;
  border:2px solid var(--edge);
  border-radius:var(--r-sm);
  background-color:var(--surface);
  color:var(--ink);
  cursor:pointer;
  font-size:16px; line-height:1;
  transition:background-color .2s ease, transform .2s ease;
}
.theme-toggle:hover{background-color:var(--gold); color:#212121; transform:translateY(-1px);}
.nav-toggle{
  display:none;
  align-items:center; justify-content:center;
  width:38px; height:38px;
  border:2px solid var(--edge);
  border-radius:var(--r-sm);
  background-color:var(--ink);
  color:var(--bg);
  cursor:pointer;
  font-size:17px; line-height:1;
}
.nav-toggle:hover{background-color:var(--seal-fill); color:#fff; border-color:var(--seal-fill);}

.nav-avatar-link{display:inline-flex; align-items:center; gap:8px; min-width:0; padding:4px 10px 4px 4px !important; border-radius:40px; border:2px solid transparent; transition:border-color .2s ease;}
.nav-avatar-link:hover{border-color:var(--edge);}
.nav-avatar-link .nav-avatar.avatar,
.nav-avatar-link .nav-avatar.avatar-img{width:30px; height:30px; font-size:13px; flex-shrink:0;}
.nav-username{max-width:110px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-weight:600; color:var(--ink);}
/* Аватарка-«быстрый доступ» — только на мобильном, где .nav-menu спрятан за гамбургер */
.nav-avatar-link.nav-avatar-quick{display:none; padding:2px !important;}

/* ============================================================
   Кнопки
   ============================================================ */
.cta, .btn-dark, .btn-outline, .form-submit{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  font-family:var(--font-ui);
  font-weight:700;
  font-size:15px;
  line-height:1.2;
  padding:12px 22px;
  border-radius:var(--r);
  border:2px solid var(--edge);
  cursor:pointer;
  text-align:center;
  text-decoration:none;
  transition:transform .15s ease, box-shadow .15s ease, background-color .2s ease, color .2s ease;
}
.cta{
  background-color:var(--seal-fill);
  color:var(--on-seal);
  box-shadow:3px 3px 0 var(--hard);
}
.cta:hover{transform:translate(-2px,-2px); box-shadow:5px 5px 0 var(--hover-edge); color:var(--on-seal);}
.cta:active{transform:translate(1px,1px); box-shadow:1px 1px 0 var(--hard);}
:root[data-theme="dark"] .cta{border-color:var(--seal-fill);}
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]) .cta{border-color:var(--seal-fill);} }

.btn-dark{
  background-color:var(--ink);
  color:var(--bg);
  padding:9px 18px;
  font-size:14px;
}
.btn-dark:hover{background-color:var(--seal-fill); border-color:var(--seal-fill); color:#fff; transform:translateY(-1px);}

.btn-outline{
  background-color:var(--surface);
  color:var(--ink);
  padding:10px 18px;
  font-size:14.5px;
}
.btn-outline:hover{background-color:var(--gold); color:#212121; transform:translate(-2px,-2px); box-shadow:3px 3px 0 var(--hard);}
.btn-outline:active{transform:none; box-shadow:none;}
.btn-sm{padding:7px 14px !important; font-size:13px !important; border-radius:var(--r-sm) !important;}
.btn-lg, .cta-lg{padding:15px 26px; font-size:16px;}

.btn-ghost{
  font-size:14.5px; font-weight:600;
  color:var(--ink-soft);
  padding:9px 8px;
  background:none; border:none; cursor:pointer;
  font-family:var(--font-ui);
  transition:color .2s ease;
}
.btn-ghost:hover{color:var(--seal);}
button:disabled, .cta[disabled]{opacity:.5; cursor:not-allowed; transform:none !important; box-shadow:none !important;}

/* ============================================================
   Главная: первый экран
   ============================================================ */
.hero{
  position:relative;
  display:grid;
  grid-template-columns:1.15fr .85fr;
  align-items:center;
  gap:40px;
  padding:26px 0 18px;
  animation:rise .6s ease both;
}
.hero.hero-narrow{grid-template-columns:1fr;}
.hero-copy{min-width:0;}
.hero .eyebrow{
  display:inline-block;
  background:var(--ink); color:var(--bg);
  padding:5px 12px; border-radius:30px;
  margin-bottom:22px;
}
h1{
  font-family:var(--font-display);
  font-weight:700;
  font-size:clamp(34px, 5vw, 60px);
  line-height:1.1;
  letter-spacing:-.025em;
  margin:0 0 20px;
  max-width:640px;
  color:var(--ink);
  overflow-wrap:break-word;
}
h1.small{font-size:clamp(28px, 3.6vw, 40px); margin:0 0 18px; max-width:none;}
.lead{color:var(--ink-soft); font-size:17.5px; line-height:1.6; max-width:560px; margin:0 0 26px;}
.hero .lead{font-size:18.5px;}
[style*="text-align:center"] .lead, .lead[style*="text-align:center"], .paywall-panel .lead{margin-left:auto; margin-right:auto;}
.hero-actions{display:flex; flex-wrap:wrap; gap:14px; align-items:center;}
.hero-note{margin:16px 0 0; font-size:14px; color:var(--ink-soft); max-width:460px;}

.hero-figure{
  margin:0;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  position:relative;
}

/* 米字格 — тетрадная клетка для прописей: рамка, пунктирные оси и диагонали */
.rice-grid{
  position:relative;
  display:grid; place-items:center;
  aspect-ratio:1;
  border:2.5px solid var(--red);
  border-radius:6px;
  background-color:var(--surface);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cg stroke='%23F4143F' stroke-opacity='.42' stroke-width='1' stroke-dasharray='4 4' vector-effect='non-scaling-stroke' fill='none'%3E%3Cpath d='M0 50H100M50 0V100M0 0L100 100M100 0L0 100' vector-effect='non-scaling-stroke'/%3E%3C/g%3E%3C/svg%3E");
  background-size:100% 100%;
}
.rice-grid-xl{
  width:min(360px, 100%);
  box-shadow:10px 10px 0 var(--gold);
}
.yong{
  font-size:clamp(150px, 18vw, 250px);
  line-height:1;
  font-weight:900;
  color:var(--red);
  position:relative;
}
.stroke-draw{display:inline-block; animation:ink-in 1.1s ease-out .25s both;}
.yong-caption{
  margin-top:26px;
  text-align:center;
  font-size:14px;
  color:var(--ink-soft);
  display:flex; flex-direction:column; align-items:center; gap:8px;
}
.yong-tag{
  display:inline-flex; align-items:baseline; gap:8px;
  background:var(--surface); border:2px solid var(--edge);
  border-radius:30px; padding:5px 14px;
  font-weight:600; color:var(--ink);
}
.yong-tag b{color:var(--seal); font-size:18px;}
.yong-caption > b{color:var(--seal);}

@keyframes ink-in{
  from{opacity:0; filter:blur(8px); transform:scale(.94);}
  to{opacity:1; filter:blur(0); transform:scale(1);}
}
@keyframes rise{
  from{opacity:0; transform:translateY(12px);}
  to{opacity:1; transform:translateY(0);}
}

/* ---------- полоса с цифрами ---------- */
.stat-strip{
  display:grid;
  grid-template-columns:repeat(4, 1fr);
  margin:44px 0 10px;
  border:2px solid var(--edge);
  border-radius:var(--r-lg);
  background:var(--surface);
  overflow:hidden;
  box-shadow:var(--shadow-hard);
}
.stat-strip-item{
  display:flex; flex-direction:column; gap:4px;
  padding:22px 24px;
  border-right:2px solid var(--edge);
  transition:background-color .2s ease;
}
.stat-strip-item:last-child{border-right:none;}
.stat-strip-item:hover{background:var(--gold-tint);}
.stat-strip-num{
  font-family:var(--font-display);
  font-weight:700;
  font-size:34px;
  line-height:1.1;
  letter-spacing:-.02em;
  color:var(--ink);
  font-variant-numeric:tabular-nums;
}
.stat-strip-item:first-child .stat-strip-num{color:var(--seal);}
.stat-strip-label{font-size:14px; color:var(--ink-soft); line-height:1.35;}

/* ---------- заголовок секции ---------- */
.section-head{margin:64px 0 22px; max-width:640px;}
.section-head h2{font-size:clamp(24px, 2.6vw, 32px); margin:0 0 8px;}
.section-head p{margin:0; color:var(--ink-soft); font-size:16px;}

/* ---------- шаги «как заниматься» ---------- */
.steps-list{
  list-style:none; margin:0; padding:0;
  display:grid; grid-template-columns:repeat(3, 1fr); gap:20px;
  counter-reset:none;
}
.steps-list li{
  position:relative;
  padding:26px 24px 24px;
  border-top:4px solid var(--edge);
  background:var(--surface-2);
  border-radius:0 0 var(--r) var(--r);
}
.steps-num{
  display:inline-flex; align-items:center; justify-content:center;
  width:40px; height:40px;
  border-radius:50%;
  background:var(--gold); color:#212121;
  font-family:var(--font-display); font-weight:700; font-size:17px;
  margin-bottom:14px;
}
.steps-list li:nth-child(2) .steps-num{background:var(--seal-fill); color:#fff;}
.steps-list li:nth-child(3) .steps-num{background:var(--ink); color:var(--bg);}
.steps-list h3{font-size:18px; margin:0 0 6px;}
.steps-list p{margin:0; color:var(--ink-soft); font-size:15px;}

/* ---------- призыв зарегистрироваться ---------- */
.cta-band{
  margin:56px 0 0;
  display:flex; align-items:center; justify-content:space-between; gap:24px; flex-wrap:wrap;
  padding:34px 38px;
  border-radius:var(--r-lg);
  background:var(--gold);
  color:#212121;
  border:2px solid #212121;
  box-shadow:6px 6px 0 #212121;
}
.cta-band h2{color:#212121; margin:0 0 6px;}
.cta-band p{margin:0; max-width:560px; color:#3A352C;}
.cta-band .cta{border-color:#212121; box-shadow:3px 3px 0 #212121;}
.cta-band .cta:hover{box-shadow:5px 5px 0 #212121;}

/* ============================================================
   Шапка внутренних страниц
   ============================================================ */
.page-hero{
  position:relative;
  overflow:hidden;
  display:flex; align-items:center; gap:28px;
  border:2px solid var(--edge);
  border-radius:var(--r-lg);
  background:var(--surface);
  padding:26px 28px 26px 32px;
  margin:0 0 30px;
  min-height:120px;
  box-shadow:var(--shadow-hard);
}
.page-hero-glyph{
  order:2;
  margin-left:auto;
  flex-shrink:0;
  width:96px; height:96px;
  display:grid; place-items:center;
  font-size:64px; font-weight:900; line-height:1;
  color:var(--red);
  border:2px solid var(--red);
  border-radius:5px;
  background-color:var(--surface);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cg stroke='%23F4143F' stroke-opacity='.42' stroke-width='1' stroke-dasharray='4 4' fill='none'%3E%3Cpath d='M0 50H100M50 0V100M0 0L100 100M100 0L0 100' vector-effect='non-scaling-stroke'/%3E%3C/g%3E%3C/svg%3E");
  background-size:100% 100%;
  transform:rotate(3deg);
  pointer-events:none;
  user-select:none;
}
.page-hero-body{position:relative; flex:1; min-width:0;}
.page-hero-caption{position:relative; font-size:17px; color:var(--ink-soft); max-width:660px; margin:0;}
.page-hero-accent-jade .page-hero-glyph{color:var(--ink); border-color:var(--ink); background-color:var(--gold); background-image:none; box-shadow:inset 0 0 0 5px var(--gold), inset 0 0 0 6.5px rgba(33,33,33,.45);}
:root[data-theme="dark"] .page-hero-accent-jade .page-hero-glyph{color:#212121; border-color:var(--gold);}
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]) .page-hero-accent-jade .page-hero-glyph{color:#212121; border-color:var(--gold);} }
.page-hero-accent-gold .page-hero-glyph{color:var(--gold-ink); border-color:var(--gold);}
.page-hero-caption + .page-hero-note{margin:8px 0 0; font-size:14px; color:var(--ink-soft);}
.page-hero-body > .page-hero-caption:first-child:not(:last-child){color:var(--ink); font-weight:500;}
.page-hero-progress{display:flex; align-items:center; gap:14px; margin-top:16px; font-size:14px; color:var(--ink-soft); flex-wrap:wrap;}
.page-hero-progress .progress{flex:1; min-width:160px; max-width:360px;}
.page-hero-progress b{color:var(--ink);}

/* ============================================================
   Карточки, сетки, панели
   ============================================================ */
.grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:22px;
  margin:22px 0 40px;
}
.grid-3{grid-template-columns:repeat(3, 1fr);}
.grid-home{grid-template-columns:repeat(3, 1fr); margin-top:0;}
.grid-home .card-feature{grid-column:span 2;}

.card{
  position:relative;
  background:var(--surface);
  border:2px solid var(--edge);
  border-radius:var(--r-lg);
  padding:26px 26px 24px;
  min-height:180px;
  display:flex; flex-direction:column; justify-content:flex-start;
  box-shadow:var(--shadow-hard);
  transition:transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
a.card:hover{transform:translate(-3px,-3px); box-shadow:var(--shadow-hard-lg); border-color:var(--hover-edge);}
a.card:active{transform:translate(1px,1px); box-shadow:1px 1px 0 var(--hard);}

.card h3{font-size:19px; margin:0 0 8px; color:var(--ink);}
.card p{font-size:15px; line-height:1.55; color:var(--ink-soft); margin:0; max-width:420px;}
.card-foot{display:flex; align-items:center; justify-content:space-between; margin-top:auto; padding-top:24px; gap:12px;}
.arrow{font-size:22px; color:var(--seal); font-weight:700; transition:transform .2s ease; line-height:1;}
a.card:hover .arrow{transform:translateX(5px);}

.card-feature{
  background:var(--red);
  color:#fff;
  border-color:#212121;
  padding:34px 34px 30px;
  overflow:hidden;
}
.card-feature::before{
  content:"课";
  position:absolute; right:-18px; bottom:-54px;
  font-family:var(--font-hz); font-weight:900;
  font-size:300px; line-height:1;
  color:rgba(255,255,255,.12);
  pointer-events:none;
}
.card-feature h3{font-size:clamp(26px, 3vw, 38px); color:#fff; margin-bottom:12px; position:relative;}
.card-feature p{color:rgba(255,255,255,.92); font-size:17px; max-width:460px; position:relative;}
.card-kicker{
  align-self:flex-start;
  display:inline-block; position:relative;
  background:var(--gold); color:#212121;
  font-size:12px; font-weight:700; letter-spacing:.08em; text-transform:uppercase;
  padding:4px 11px; border-radius:30px; border:2px solid #212121;
  margin-bottom:18px;
}
.card-feature .card-foot{position:relative;}
.card-feature .card-icon{--icon-color:#FCF5E4; color:var(--red); background:#FCF5E4; border-color:#212121;}
.card-go{display:inline-flex; align-items:center; gap:10px; font-weight:700; font-size:16px; background:#212121; color:#FCF5E4; padding:10px 18px; border-radius:var(--r);}
.card-feature .arrow{color:var(--gold);}
.card-feature:hover{border-color:#212121 !important;}
a.card.card-feature:hover{box-shadow:7px 7px 0 #212121;}

/* ---------- иконка карточки: печать-штамп 印章 ---------- */
.card-icon{
  width:52px; height:52px;
  display:flex; align-items:center; justify-content:center;
  border-radius:11px;
  border:2px solid var(--edge);
  background-color:var(--icon-color, var(--seal-fill));
  color:var(--icon-on, #fff);
  font-size:26px; font-weight:900;
  transform:rotate(-4deg);
  transition:transform .3s ease;
  flex-shrink:0;
}
a.card:hover .card-icon{transform:rotate(4deg) scale(1.06);}
.card-icon-seal{--icon-color:var(--seal-fill); --icon-on:#fff;}
.card-icon-jade{--icon-color:var(--ink); --icon-on:var(--bg);}
.card-icon-gold{--icon-color:var(--gold); --icon-on:#212121;}
.card-icon-ink{--icon-color:var(--surface); --icon-on:var(--ink);}

.card.locked{cursor:default; box-shadow:none; border-style:dashed; border-color:var(--ink-faint); background:transparent;}
.card.locked h3, .card.locked p{color:var(--ink-faint);}
.card.locked:hover{transform:none; box-shadow:none;}

.card.coming-soon{background:transparent; border:2px dashed var(--line); box-shadow:none; cursor:default;}
.card.coming-soon:hover{transform:none; box-shadow:none;}
.card.coming-soon h3{color:var(--ink-soft);}

/* ---------- универсальная панель ---------- */
.panel{
  background:var(--surface);
  border:2px solid var(--edge);
  border-radius:var(--r-lg);
  padding:30px 34px;
  margin-bottom:24px;
}
.panel > h3:first-child, .panel h3[style*="margin-top:0"]{margin-top:0;}

/* ---------- прогресс-полоса ---------- */
.progress{
  position:relative;
  height:10px;
  border-radius:20px;
  background:var(--surface-3);
  border:1.5px solid var(--edge);
  overflow:hidden;
}
.progress > span{display:block; height:100%; background:var(--seal-fill); border-radius:20px; transition:width .4s ease;}
.progress-lg{height:14px;}

/* ============================================================
   Курс: ступени и уроки
   ============================================================ */
.stage-card{min-height:210px; gap:6px; justify-content:flex-start;}
.stage-card-top{display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:14px;}
.stage-num{
  font-family:var(--font-display); font-weight:800;
  font-size:30px; line-height:1; letter-spacing:-.03em;
  color:var(--ink);
}
.stage-status{
  font-size:12px; font-weight:700; letter-spacing:.03em;
  padding:4px 10px; border-radius:30px;
  border:1.5px solid var(--edge);
  color:var(--ink);
  background:var(--surface);
  white-space:nowrap;
}
.stage-card h3{font-size:17px; margin-bottom:6px;}
.stage-card p{font-size:14.5px;}
.stage-card-foot{margin-top:auto; padding-top:18px; display:flex; flex-direction:column; gap:8px;}
.stage-meta{font-size:13px; color:var(--ink-soft); font-variant-numeric:tabular-nums;}
.stage-card.is-active .stage-status{background:var(--gold); color:#212121; border-color:#212121;}
.stage-card.is-active .stage-num{color:var(--seal);}
.stage-card.is-done .stage-status{background:var(--jade-fill); color:#fff; border-color:var(--jade-fill);}
.stage-card.is-done .progress > span{background:var(--jade-fill);}
.stage-card.locked .stage-num{color:var(--ink-faint);}
.stage-card.locked .stage-status{color:var(--ink-faint); border-color:var(--ink-faint); background:transparent;}

.module-title{
  font-size:18px; margin:40px 0 14px;
  display:flex; align-items:center; gap:12px;
}
.module-title::after{content:""; flex:1; height:2px; background:var(--line);}
.module-title:first-of-type{margin-top:22px;}

.lesson-list{display:grid; grid-template-columns:repeat(3, 1fr); gap:12px;}
.lesson-row{
  display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:14px;
  padding:12px 14px 12px 12px;
  background:var(--surface);
  border:2px solid var(--edge);
  border-radius:var(--r);
  transition:transform .15s ease, box-shadow .15s ease, background-color .2s ease;
  min-width:0;
}
a.lesson-row:hover{transform:translate(-2px,-2px); box-shadow:4px 4px 0 var(--hover-edge);}
.lesson-glyph{
  width:48px; height:48px;
  display:grid; place-items:center;
  font-size:26px; font-weight:700; line-height:1;
  border-radius:var(--r-sm);
  background:var(--surface-2);
  color:var(--ink);
}
.lesson-text{display:flex; flex-direction:column; min-width:0;}
.lesson-num{font-size:12px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-soft);}
.lesson-title{font-weight:600; font-size:15px; line-height:1.3; color:var(--ink); overflow-wrap:anywhere;}
.lesson-state{font-size:12.5px; font-weight:700; white-space:nowrap; color:var(--ink-soft);}
.lesson-row.completed .lesson-glyph{background:var(--jade-fill); color:#fff;}
.lesson-row.completed .lesson-state{color:var(--jade);}
.lesson-row.is-next{background:var(--gold-tint); box-shadow:4px 4px 0 var(--hard);}
.lesson-row.is-next .lesson-glyph{background:var(--seal-fill); color:#fff;}
.lesson-row.is-next .lesson-state{color:var(--seal);}
.lesson-row.locked{border-style:dashed; border-color:var(--ink-faint); background:transparent; cursor:default;}
.lesson-row.locked .lesson-glyph{background:transparent; font-size:18px;}
.lesson-row.locked .lesson-title, .lesson-row.locked .lesson-num, .lesson-row.locked .lesson-state{color:var(--ink-faint);}

/* ============================================================
   Китайский текст, пиньинь, озвучка
   ============================================================ */
.chinese{font-family:var(--font-hz); font-size:1.5em; line-height:1.3;}
.pinyin{color:var(--seal); font-family:var(--font-ui); font-weight:500; font-size:.95em; letter-spacing:.01em;}

.speak-btn{
  display:inline-flex; align-items:center; justify-content:center;
  width:36px; height:36px;
  flex-shrink:0;
  border:2px solid var(--edge);
  border-radius:50%;
  background-color:var(--surface);
  color:var(--ink);
  cursor:pointer;
  font-size:15px; line-height:1;
  transition:background-color .2s ease, transform .15s ease;
}
.speak-btn:hover{background-color:var(--gold); transform:scale(1.06);}
.speak-btn:active{transform:scale(.94);}
.speak-btn:disabled{opacity:.35; cursor:not-allowed;}
.speak-btn:disabled:hover{background-color:var(--surface); transform:none;}
.speak-btn.speaking{background-color:var(--gold); border-color:var(--edge); animation:speak-pulse 1s ease-in-out infinite;}
.speak-btn-sm{width:28px; height:28px; font-size:12px; border-width:1.5px;}
.sound-off .speak-btn{opacity:.4;}
.sound-off .speak-btn:hover{opacity:.7;}
@keyframes speak-pulse{
  0%, 100%{box-shadow:0 0 0 0 rgba(237,178,23,.55);}
  50%{box-shadow:0 0 0 7px rgba(237,178,23,0);}
}

/* ---------- панель настроек озвучки ---------- */
.sound-control{position:relative;}
.sound-panel{
  display:none;
  position:absolute;
  top:calc(100% + 10px); right:0;
  width:230px;
  background:var(--surface);
  border:2px solid var(--edge);
  border-radius:var(--r);
  padding:16px;
  box-shadow:var(--shadow-hard);
  z-index:60;
}
.sound-panel.open{display:block;}
.sound-panel-row{display:flex; align-items:center; gap:10px; font-size:14px; color:var(--ink); margin:0 0 14px; cursor:pointer;}
.sound-panel-row:last-child{margin-bottom:0;}
.sound-panel-volume{flex-direction:column; align-items:stretch; gap:6px; cursor:default;}
.sound-panel-volume span{font-size:12.5px; color:var(--ink-soft); font-weight:600;}
.sound-panel input[type="checkbox"]{width:18px; height:18px; accent-color:var(--seal-fill); cursor:pointer; flex-shrink:0;}
.sound-panel input[type="range"]{width:100%; accent-color:var(--seal-fill); cursor:pointer;}

/* ============================================================
   Словарь
   ============================================================ */
.char-chip-row{display:flex; flex-wrap:wrap; gap:10px; margin:22px 0 30px; align-items:center;}
.char-chip{
  min-width:54px; height:54px;
  display:inline-flex; align-items:center; justify-content:center;
  font-size:27px;
  white-space:nowrap;
  background-color:var(--surface);
  border:2px solid var(--edge);
  border-radius:var(--r);
  transition:background-color .2s ease, transform .15s ease;
}
.char-chip:hover{background-color:var(--gold); color:#212121; transform:translateY(-2px);}
.char-chip.active{background-color:var(--seal-fill); color:#fff; border-color:var(--edge);}
.char-chip-word{padding:0 16px; font-size:21px;}

.char-detail{display:grid; grid-template-columns:auto 1fr; gap:40px; align-items:start;}
.char-detail-writer{display:flex; flex-direction:column; align-items:center; gap:16px;}
/* Холст HanziWriter всегда светлая «бумага» — штрихи рисуются тёмным цветом,
   поэтому фон не зависит от темы. Сетка 米字格 помогает видеть пропорции. */
#hanzi-target{
  background-color:var(--paper-canvas);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cg stroke='%23F4143F' stroke-opacity='.3' stroke-width='1' stroke-dasharray='4 4' fill='none'%3E%3Cpath d='M0 50H100M50 0V100M0 0L100 100M100 0L0 100' vector-effect='non-scaling-stroke'/%3E%3C/g%3E%3C/svg%3E");
  background-size:100% 100%;
  border:2.5px solid var(--red);
  border-radius:8px;
  box-shadow:6px 6px 0 var(--gold);
}
.char-detail-controls{display:flex; gap:10px; flex-wrap:wrap; justify-content:center;}
.char-detail-info{padding-top:6px;}

.round-progress-badge{
  display:inline-block;
  font-weight:700; font-size:14px;
  color:#212121;
  background:var(--gold);
  border:2px solid var(--edge);
  border-radius:30px;
  padding:4px 14px;
  margin:0 0 10px;
  font-variant-numeric:tabular-nums;
}

@media(max-width:700px){
  .char-detail{grid-template-columns:1fr; justify-items:center; text-align:center; gap:18px;}
  .char-detail-writer{gap:8px;}
  .char-detail-writer p.lead{margin:4px 0 0 !important;}
  .char-detail-info{padding-top:0; display:flex; flex-direction:column; align-items:center; gap:6px;}
  .char-detail-info .round-progress-badge{margin:0;}
  .char-detail-info .pinyin{margin-bottom:0 !important;}
  .char-detail-info p{margin:0;}
}

/* ---------- поиск ---------- */
.search-box{position:relative; max-width:520px; margin-bottom:24px;}
.search-box input{
  width:100%;
  padding:14px 20px 14px 46px;
  border:2px solid var(--edge);
  border-radius:var(--r);
  background:var(--surface);
  font-family:var(--font-ui);
  font-size:16px;
  color:var(--ink);
  transition:box-shadow .15s ease;
}
.search-box input::placeholder{color:var(--ink-faint);}
.search-box input:focus{outline:none; box-shadow:4px 4px 0 var(--gold);}
/* только лупа (прямой потомок), не иконки внутри кнопок поиска */
.search-box > svg{
  position:absolute; left:17px; top:50%;
  transform:translateY(-50%);
  width:18px; height:18px;
  stroke:var(--ink); pointer-events:none;
}
.search-empty{display:none; color:var(--ink-soft); font-size:15px; padding:20px 0;}
.search-suggest{
  display:none;
  position:absolute; top:calc(100% + 8px); left:0; right:0;
  background:var(--surface);
  border:2px solid var(--edge);
  border-radius:var(--r);
  box-shadow:var(--shadow-hard);
  overflow:hidden;
  z-index:25;
}
.search-suggest.open{display:block;}
.search-suggest-item{
  display:flex; align-items:baseline; gap:10px;
  width:100%; text-align:left;
  padding:11px 16px;
  border:none; border-bottom:1px solid var(--line);
  background:none; color:var(--ink);
  font-family:var(--font-ui); font-size:14px;
  cursor:pointer;
}
.search-suggest-item:last-child{border-bottom:none;}
.search-suggest-item:hover, .search-suggest-item:focus{background:var(--gold-tint); outline:none;}
.search-suggest-char{font-family:var(--font-hz); font-size:20px; flex-shrink:0;}
.search-suggest-pinyin{color:var(--seal); flex-shrink:0; font-weight:500;}
.search-suggest-def{color:var(--ink-soft); overflow:hidden; text-overflow:ellipsis; white-space:nowrap;}
.search-suggest-empty{padding:14px 16px; color:var(--ink-soft); font-size:13.5px;}
.search-suggest-item.is-active{background:var(--gold-tint);}
.search-suggest-type{margin-left:auto; flex-shrink:0; font-size:11.5px; color:var(--ink-faint); text-transform:uppercase; letter-spacing:.05em;}
.search-suggest-label{padding:10px 16px 4px; font-size:11.5px; font-weight:700; letter-spacing:.08em; text-transform:uppercase; color:var(--ink-soft);}
.search-suggest-recent{color:var(--ink-faint); flex-shrink:0;}
.search-suggest-all{font-weight:600; color:var(--seal); background:var(--surface-2);}

/* ---------- словарь: вкладки, поиск, выдача ---------- */
.search-box.dict-search{display:flex; gap:10px; max-width:680px; margin-bottom:10px;}
.dict-search input{flex:1; min-width:0;}
.dict-search input::-webkit-search-cancel-button{cursor:pointer;}
.dict-search-btn{
  flex-shrink:0;
  padding:0 22px;
  font-family:var(--font-ui); font-weight:700; font-size:15px;
  border:2px solid var(--edge); border-radius:var(--r);
  background:var(--ink); color:var(--bg);
  cursor:pointer;
  transition:background-color .2s ease, transform .15s ease;
}
.dict-search-btn:hover{background:var(--seal-fill); border-color:var(--seal-fill); color:#fff;}
.dict-search .search-suggest{right:0;}
.dict-hint{font-size:13.5px; color:var(--ink-soft); margin:0 0 26px; max-width:680px;}
.dict-hint a{font-weight:600;}
kbd{
  display:inline-block; min-width:20px; padding:0 6px;
  font-family:var(--font-ui); font-size:12px; font-weight:700; line-height:18px; text-align:center;
  border:1.5px solid var(--edge); border-bottom-width:3px; border-radius:6px;
  background:var(--surface); color:var(--ink);
}

.dict-landing{display:grid; gap:20px;}
.dict-landing .panel{margin-bottom:0;}
.dict-example-row{display:grid; grid-template-columns:repeat(auto-fill, minmax(170px, 1fr)); gap:10px;}
.dict-example{
  display:flex; flex-direction:column; gap:2px;
  padding:12px 14px;
  border:2px solid var(--edge); border-radius:var(--r);
  background:var(--bg); color:var(--ink);
  transition:transform .15s ease, box-shadow .15s ease, background-color .2s ease;
}
.dict-example:hover{transform:translate(-2px,-2px); box-shadow:4px 4px 0 var(--hard); background:var(--gold-tint); color:var(--ink);}
.dict-example-q{font-weight:700; font-size:16px;}
.dict-example-q.hz{font-weight:600; font-size:19px;}
.dict-example-label{font-size:12.5px; color:var(--ink-soft);}
.dict-recent-head{display:flex; align-items:center; justify-content:space-between; gap:12px;}
.dict-recent-list{display:flex; flex-wrap:wrap; gap:8px;}
.dict-recent-list .chip.hz{font-weight:600; font-size:16px;}
.dict-link-btn{background:none; border:none; padding:0; font:inherit; font-size:13px; color:var(--ink-soft); text-decoration:underline; cursor:pointer;}
.dict-link-btn:hover{color:var(--seal);}

.dict-toolbar{display:flex; align-items:center; justify-content:space-between; gap:12px 20px; flex-wrap:wrap; margin-bottom:18px;}
.dict-summary{margin:0; color:var(--ink-soft);}
.dict-summary b{color:var(--ink);}
.dict-filters{margin-bottom:0;}
.chip-disabled{opacity:.45; pointer-events:none;}

.dict-empty ul{margin:0; color:var(--ink-soft);}

/* разбор фразы по словам */
.dict-phrase-head{display:flex; align-items:flex-start; justify-content:space-between; gap:12px 20px; flex-wrap:wrap; margin-bottom:16px;}
.dict-phrase-note{margin:0; font-size:13.5px; color:var(--ink-soft);}
.seg-row{display:flex; flex-wrap:wrap; gap:8px; align-items:stretch;}
.seg{
  display:flex; flex-direction:column; align-items:center; gap:1px;
  min-width:52px; padding:7px 10px 8px;
  border:2px solid var(--edge); border-radius:var(--r-sm);
  background:var(--surface); color:var(--ink);
  text-align:center;
  transition:transform .15s ease, box-shadow .15s ease, background-color .2s ease;
}
a.seg:hover{transform:translate(-2px,-2px); box-shadow:3px 3px 0 var(--hard); background:var(--gold-tint); color:var(--ink);}
.seg-py{font-size:12.5px; font-weight:600; color:var(--seal); white-space:nowrap;}
.seg-hz{font-size:24px; line-height:1.25;}
.seg-def{font-size:11.5px; color:var(--ink-soft); max-width:120px; line-height:1.25;}
.seg-plain{border-style:dashed; border-color:var(--line); background:transparent; min-width:0;}
.seg-break{flex-basis:100%; height:0;}

/* выдача + карточка */
.dict-layout{display:grid; gap:24px; align-items:start;}
.dict-layout.has-detail.has-results{grid-template-columns:minmax(0, 1fr) minmax(0, 1.15fr);}
.dict-layout.has-detail.has-results .dict-detail{position:sticky; top:90px; max-height:calc(100vh - 106px); overflow:auto; overscroll-behavior:contain;}
.dict-result-list{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:8px;}
.dict-result{
  display:grid; grid-template-columns:auto minmax(0, 1fr) auto; align-items:center; gap:14px;
  padding:10px 14px;
  border:2px solid var(--edge); border-radius:var(--r);
  background:var(--surface); color:var(--ink);
  transition:transform .15s ease, box-shadow .15s ease, background-color .2s ease;
}
.dict-result:hover{transform:translate(-2px,-2px); box-shadow:4px 4px 0 var(--hard); color:var(--ink);}
.dict-result.active{background:var(--gold-tint); box-shadow:4px 4px 0 var(--seal-fill);}
.dict-result-hz{font-size:28px; line-height:1.15; min-width:44px; text-align:center;}
.dict-result-hz.long{font-size:22px;}
.dict-result-body{display:flex; flex-direction:column; gap:2px; min-width:0;}
.dict-result-py{color:var(--seal); font-weight:600; font-size:14.5px;}
.dict-result-def{color:var(--ink-soft); font-size:14px; line-height:1.35; overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical;}
.dict-result-meta{display:flex; flex-direction:column; align-items:flex-end; gap:5px;}
.dict-result-meta .badge{font-size:11px; padding:2px 8px;}
.dict-type{font-size:11.5px; font-weight:600; letter-spacing:.05em; text-transform:uppercase; color:var(--ink-faint);}
.dict-more{margin-top:14px; width:100%;}
.dict-more.loading{opacity:.6; pointer-events:none;}

.dict-detail{margin-bottom:0; padding:26px 28px; scroll-margin-top:86px;}
.dict-detail-head{display:flex; align-items:center; gap:12px 18px; flex-wrap:wrap; margin-bottom:4px;}
.dict-detail-hz{font-size:56px; line-height:1.15;}
.dict-detail-tags{display:flex; align-items:center; gap:8px; flex-wrap:wrap;}
.dict-detail-tags .badge-script{margin-left:0;}
.dict-detail-py{display:flex; align-items:center; gap:10px; font-size:1.3rem; margin:0 0 18px;}
.dict-writer{align-items:flex-start; margin-bottom:20px;}
.dict-writer .char-detail-controls{justify-content:flex-start;}
.dict-word-writers{display:flex; flex-direction:column; align-items:flex-start; gap:10px; margin-bottom:20px;}
.dict-word-writer-row{display:flex; gap:8px; flex-wrap:wrap;}
.dict-word-writer{
  width:96px; height:96px; cursor:pointer;
  background-color:var(--paper-canvas);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cg stroke='%23F4143F' stroke-opacity='.3' stroke-width='1' stroke-dasharray='4 4' fill='none'%3E%3Cpath d='M0 50H100M50 0V100M0 0L100 100M100 0L0 100' vector-effect='non-scaling-stroke'/%3E%3C/g%3E%3C/svg%3E");
  background-size:100% 100%;
  border:2px solid var(--red); border-radius:6px;
}
.dict-word-writer.missing{display:none;}
.dict-detail-actions{margin-bottom:18px;}
.dict-detail-login{margin:0 0 18px; font-size:13px; color:var(--ink-soft);}
.dict-meanings{margin:0 0 18px; padding-left:20px;}
.dict-meanings li{margin-bottom:4px; line-height:1.45;}
.dict-meanings li::marker{color:var(--seal);}
.dict-detail-text{margin:0 0 18px;}
.dict-detail-en{color:var(--ink-soft); font-size:14.5px;}
.dict-parts{list-style:none; margin:0 0 12px; padding:0; display:grid; grid-template-columns:repeat(auto-fill, minmax(200px, 1fr)); gap:8px;}
.dict-part{
  display:flex; align-items:center; gap:10px;
  padding:8px 12px;
  border:2px solid var(--edge); border-radius:var(--r-sm);
  background:var(--bg); color:var(--ink); height:100%;
  transition:background-color .2s ease, transform .15s ease;
}
.dict-part:hover{background:var(--gold-tint); transform:translateY(-1px); color:var(--ink);}
.dict-part-hz{font-size:22px; flex-shrink:0;}
.dict-part-body{display:flex; flex-direction:column; min-width:0;}
.dict-part .dict-result-py{font-size:13px;}
.dict-part .dict-result-def{font-size:12.5px; -webkit-line-clamp:1;}
.dict-link-more{font-weight:600; font-size:14px;}

/* ---------- разбор иероглифа (includes/char_analysis.php) ---------- */
.hz-analysis{margin:4px 0 22px; padding-top:18px; border-top:2px dashed var(--line);}
.hz-analysis-top{display:flex; gap:22px; align-items:flex-start; flex-wrap:wrap; margin-bottom:14px;}
.hz-colored{
  flex-shrink:0; width:132px; height:132px;
  background-color:var(--paper-canvas);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cg stroke='%23F4143F' stroke-opacity='.25' stroke-width='1' stroke-dasharray='4 4' fill='none'%3E%3Cpath d='M0 50H100M50 0V100M0 0L100 100M100 0L0 100' vector-effect='non-scaling-stroke'/%3E%3C/g%3E%3C/svg%3E");
  background-size:100% 100%;
  border:2px solid var(--edge); border-radius:var(--r-sm);
}
.hz-colored svg{display:block;}
/* холст всегда светлый, поэтому цвета частей фиксированные, а не из темы */
.hz-colored path{transition:opacity .2s ease;}
.hz-stroke-0{fill:#D40F37;}
.hz-stroke-1{fill:#212121;}
.hz-stroke-2{fill:#B8860B;}
.hz-stroke-x{fill:#9A917F;}
.hz-colored[data-focus="0"] path:not([data-part="0"]),
.hz-colored[data-focus="1"] path:not([data-part="1"]),
.hz-colored[data-focus="2"] path:not([data-part="2"]){opacity:.14;}

.hz-facts{display:grid; grid-template-columns:auto 1fr; gap:6px 14px; margin:2px 0 0; flex:1; min-width:220px; align-content:start;}
.hz-facts dt{font-size:12px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-soft); padding-top:3px;}
.hz-facts dd{margin:0; font-size:15px;}
.hz-radical{display:inline-flex; align-items:baseline; gap:6px; font-weight:600; color:var(--ink);}
.hz-radical .hz{font-size:24px; line-height:1;}
.hz-radical .hz-radical-full{font-size:15px; color:var(--ink-soft);}
.hz-radical:hover{color:var(--seal);}
.hz-fact-note{display:block; font-size:13px; color:var(--ink-soft); margin-top:2px;}
.hz-ids{font-family:var(--font-hz); color:var(--seal); font-size:18px;}

.hz-parts, .panel .hz-parts{list-style:none; margin:0 0 14px; padding:0; display:flex; flex-direction:column; gap:8px;}
.panel .hz-parts li{margin-bottom:0;}
.hz-part{
  display:flex; align-items:center; gap:12px;
  padding:8px 12px;
  border:2px solid var(--edge); border-radius:var(--r-sm);
  background:var(--bg);
  transition:background-color .2s ease;
}
.hz-part:hover, .hz-part:focus{background:var(--gold-tint); outline:none;}
.hz-part-swatch{width:10px; align-self:stretch; border-radius:4px; flex-shrink:0;}
.hz-part-0 .hz-part-swatch{background:#D40F37;}
.hz-part-1 .hz-part-swatch{background:#212121;}
.hz-part-2 .hz-part-swatch{background:#B8860B;}
:root[data-theme="dark"] .hz-part-1 .hz-part-swatch{background:#FCF5E4;}
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]) .hz-part-1 .hz-part-swatch{background:#FCF5E4;} }
.hz-part-glyphs{display:flex; gap:2px; flex-shrink:0; min-width:40px;}
.hz-part-glyph{font-size:28px; line-height:1.1; color:var(--ink);}
a.hz-part-glyph:hover{color:var(--seal);}
.hz-part-body{display:flex; flex-direction:column; gap:3px; font-size:14.5px; min-width:0;}
.hz-part-children{font-size:13.5px; color:var(--ink-soft);}
.hz-role{align-self:flex-start; font-size:11.5px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; padding:2px 8px; border-radius:20px; border:1.5px solid currentColor;}
.hz-role-semantic{color:var(--seal);}
.hz-role-phonetic{color:var(--gold-ink);}
.hz-inline{font-size:1.15em; color:var(--ink); text-decoration:none; border-bottom:1.5px dotted var(--ink-faint);}
a.hz-inline:hover{color:var(--seal); border-bottom-color:var(--seal);}

.hz-etym{margin:0 0 14px; font-size:15px; line-height:1.6;}
.hz-etym .pinyin{font-size:1em;}
.hz-hint{display:block; margin-top:4px; color:var(--ink-soft);}

.hz-series{margin:0 0 12px;}
.hz-series-title{margin:0 0 8px; font-size:14px; color:var(--ink-soft);}
.hz-series-title .hz{font-size:1.15em; color:var(--ink);}
.hz-series-row{display:flex; flex-wrap:wrap; gap:6px;}
.hz-series-item{
  display:flex; flex-direction:column; align-items:center;
  min-width:52px; padding:5px 8px 6px;
  border:2px solid var(--edge); border-radius:var(--r-sm);
  background:var(--surface); color:var(--ink);
  transition:transform .15s ease, background-color .2s ease;
}
.hz-series-item:hover{transform:translateY(-2px); background:var(--gold-tint); color:var(--ink);}
.hz-series-item .hz{font-size:22px; line-height:1.2;}
.hz-series-item .pinyin{font-size:12.5px;}

.dict-hint-radicals{display:inline-block; margin-left:6px; font-weight:700;}

/* ---------- удаление аккаунта (profile.php, delete_account.php) ---------- */
.profile-danger{margin:30px 0 10px; padding:18px 22px; border:2px dashed var(--seal); border-radius:var(--r);}
.profile-danger h3{margin:0 0 6px; color:var(--seal);}
.profile-danger p{margin:0 0 12px; color:var(--ink-soft); font-size:14.5px;}
.profile-danger-btn{border-color:var(--seal); color:var(--seal);}
.profile-danger-btn:hover{background:var(--seal-fill); border-color:var(--seal-fill); color:#fff;}
.delete-account-list{margin:0 0 12px; padding-left:20px;}
.delete-account-list li{margin-bottom:4px;}
.delete-account-confirm{display:flex; align-items:flex-start; gap:8px; margin:4px 0 16px; font-size:14.5px; cursor:pointer;}
.delete-account-confirm input{margin-top:3px;}
.form-submit.delete-account-submit{background:var(--seal-fill); border-color:var(--edge); color:#fff;}

/* ---------- поиск по словарю на главной (index.php) ---------- */
.home-search{
  margin:0 0 30px; padding:22px 26px;
  border:2px solid var(--edge); border-radius:var(--r-lg);
  background:var(--surface); box-shadow:var(--shadow-hard);
}
.home-search-title{display:flex; align-items:center; gap:10px; font-size:21px; margin:0 0 14px;}
.home-search-title .hz{
  display:inline-flex; align-items:center; justify-content:center;
  width:36px; height:36px; font-size:22px;
  border:2px solid var(--edge); border-radius:var(--r-sm);
  background:var(--seal-fill); color:#fff;
}
.search-box.home-search-form{max-width:none; margin-bottom:10px;}
.home-search-hint{margin:0; font-size:14px; color:var(--ink-soft);}
.home-search-hint a{font-weight:600; white-space:nowrap;}
.home-search-hint a.hz{font-size:16px;}
.home-search-sep{margin:0 6px; color:var(--ink-faint);}
@media(max-width:560px){
  .home-search{padding:16px;}
  .home-search-title{font-size:18px;}
}

/* ---------- «Пары тонов» и «Собери иероглиф» (game_tones.php, game_assemble.php) ---------- */
.tones-help h3{margin-top:0;}
.tones-help-legend{display:flex; flex-wrap:wrap; gap:6px 18px; font-size:14px;}
.tones-help-legend b{display:inline-block; width:20px; height:20px; line-height:20px; text-align:center; border-radius:50%; background:var(--ink); color:var(--bg); font-size:12px; margin-right:4px;}
.tones-help-note{font-size:13px; color:var(--ink-faint);}
.tones-listen{display:flex; flex-direction:column; align-items:center; gap:8px; margin:14px 0 4px;}
.tones-play{
  width:84px; height:84px; border-radius:50%;
  border:2px solid var(--edge); background:var(--gold); color:#212121;
  font-size:32px; cursor:pointer; box-shadow:4px 4px 0 var(--hard);
  transition:transform .15s ease;
}
.tones-play:hover{transform:translate(-2px,-2px);}
.tones-play.speaking{animation:speak-pulse 1s ease-in-out infinite;}
.tones-plain{font-size:22px; font-weight:600; letter-spacing:.04em; color:var(--ink-soft);}
.tones-reveal{display:flex; flex-direction:column; align-items:center; gap:2px; margin-top:8px;}
.tones-reveal[hidden]{display:none;}
.tones-word{font-size:40px; line-height:1.2;}
.tones-def{font-size:14px; color:var(--ink-soft); text-align:center;}
.tones-option{display:flex; flex-direction:column; align-items:center; gap:2px;}
.tones-option-py{font-size:22px; font-weight:600;}
.tones-option-num{font-size:12px; opacity:.75;}
.tones-next-row{display:flex; justify-content:center; margin-top:16px;}
.tones-mistakes, .panel .tones-mistakes{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:8px;}
.tones-mistakes li{display:flex; align-items:center; gap:12px; flex-wrap:wrap; border-bottom:1px solid var(--line); padding-bottom:8px; margin:0;}
.tones-mistake-word{font-size:26px; color:var(--ink);}

.assemble-task{display:flex; flex-direction:column; align-items:center; gap:2px; margin:12px 0 6px;}
.assemble-py{font-size:24px; font-weight:600;}
.assemble-meaning{font-size:17px; color:var(--ink); text-align:center;}
.assemble-board{display:flex; flex-direction:column; align-items:center; gap:10px; margin:10px 0 16px;}
.assemble-slots{display:flex; gap:6px; padding:8px; border:2px dashed var(--line); border-radius:var(--r);}
.assemble-slots.is-tb{flex-direction:column;}
.assemble-slots.ok{border-color:var(--jade); border-style:solid;}
.assemble-slots.bad{border-color:var(--seal); border-style:solid;}
.assemble-slot{
  width:78px; height:78px;
  display:flex; align-items:center; justify-content:center;
  border:2px solid var(--line); border-radius:var(--r-sm);
  background:var(--paper-canvas); color:#212121; cursor:pointer;
}
.assemble-slot.filled{border-color:var(--edge);}
.assemble-slot .hz{font-size:44px; line-height:1;}
.assemble-slot-label{font-size:12.5px; color:#9A917F;}
.assemble-result{display:flex; flex-direction:column; align-items:center; gap:4px; text-align:center;}
.assemble-result[hidden]{display:none;}
.assemble-result-char{font-size:56px; line-height:1.1;}
.assemble-result-note{font-size:14px; color:var(--ink-soft);}
.assemble-result-note .hz{font-size:18px; color:var(--ink);}
.assemble-ok{color:var(--jade);}
.assemble-bad{color:var(--seal);}
.assemble-tiles{display:grid; grid-template-columns:repeat(3, 1fr); gap:8px; max-width:420px; margin:0 auto;}
.assemble-tile{
  display:flex; flex-direction:column; align-items:center; gap:2px;
  padding:8px 6px;
  border:2px solid var(--edge); border-radius:var(--r-sm);
  background:var(--surface); color:var(--ink); cursor:pointer;
  transition:transform .15s ease, background-color .2s ease, opacity .2s ease;
}
.assemble-tile:hover:not(:disabled){transform:translateY(-2px); background:var(--gold-tint);}
.assemble-tile .hz{font-size:32px; line-height:1.1;}
.assemble-tile-mean{font-size:11.5px; color:var(--ink-soft); max-width:100%; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.assemble-tile.used{opacity:.3;}
.assemble-tile:disabled{cursor:default; color:var(--ink);}
.assemble-slot:disabled{cursor:default; color:#212121; opacity:1;}
.assemble-played{font-size:15px;}
.assemble-played .hz{font-size:24px; margin:0 3px;}

/* ---------- тип словосложения (napisanie.php) ---------- */
.formation{margin:0 0 12px; padding:10px 14px; border-left:4px solid var(--seal); background:var(--surface-2); border-radius:0 var(--r-sm) var(--r-sm) 0;}
.formation-head{display:flex; flex-wrap:wrap; align-items:baseline; gap:6px 14px;}
.formation-type{font-weight:700; font-size:15px;}
.formation-formula{font-size:14px; color:var(--ink-soft);}
.formation-formula .hz{font-size:19px; color:var(--ink);}
.formation-plus{color:var(--seal); font-weight:700; margin:0 2px;}
.formation-mean{margin-left:3px;}
.formation-affix{margin-left:3px; font-size:12px; font-style:italic;}
.formation-desc{margin:4px 0 0; font-size:13.5px; color:var(--ink-soft);}
.formation-split{margin:8px 0 0; font-size:14px; display:flex; flex-wrap:wrap; align-items:center; gap:4px 6px;}
.formation-split .hz{font-size:18px; color:var(--seal);}

/* ---------- рукописный ввод (includes/handwriting.php) ---------- */
.dict-hw-toggle{
  flex-shrink:0;
  padding:0 14px;
  font-family:var(--font-ui); font-weight:700; font-size:15px;
  border:2px solid var(--edge); border-radius:var(--r);
  background:var(--surface); color:var(--ink);
  cursor:pointer;
  transition:background-color .2s ease;
}
.dict-hw-toggle:hover, .dict-hw-toggle.active{background:var(--gold); color:#212121;}
.dict-hw{
  display:flex; gap:20px; flex-wrap:wrap; align-items:flex-start;
  max-width:680px; margin:4px 0 14px; padding:16px;
  border:2px solid var(--edge); border-radius:var(--r);
  background:var(--surface);
}
.dict-hw[hidden]{display:none;}
.dict-hw-board{display:flex; flex-direction:column; gap:8px; flex-shrink:0;}
#dictHwCanvas{
  width:256px; height:256px; max-width:100%;
  touch-action:none; cursor:crosshair;
  background-color:var(--paper-canvas);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cg stroke='%23F4143F' stroke-opacity='.3' stroke-width='1' stroke-dasharray='4 4' fill='none'%3E%3Cpath d='M0 50H100M50 0V100M0 0L100 100M100 0L0 100' vector-effect='non-scaling-stroke'/%3E%3C/g%3E%3C/svg%3E");
  background-size:100% 100%;
  border:2px solid var(--red); border-radius:8px;
}
.dict-hw-actions{display:flex; gap:8px;}
.dict-hw-side{flex:1; min-width:200px;}
.dict-hw-status{margin:0 0 10px; font-size:14px; color:var(--ink-soft);}
.dict-hw-cands{display:flex; flex-wrap:wrap; gap:6px; min-height:52px; margin-bottom:10px;}
.dict-hw-cand{
  width:50px; height:50px;
  font-size:28px; line-height:1;
  border:2px solid var(--edge); border-radius:var(--r-sm);
  background:var(--bg); color:var(--ink);
  cursor:pointer;
  transition:background-color .15s ease, transform .15s ease;
}
.dict-hw-cand:first-child{border-color:var(--seal); box-shadow:2px 2px 0 var(--seal);}
.dict-hw-cand:hover{background:var(--gold); color:#212121; transform:translateY(-2px);}
.dict-hw-note{font-size:12.5px; color:var(--ink-faint); margin:0 0 6px;}
.dict-hw-credits{font-size:11.5px; color:var(--ink-faint); margin:0;}
@media(max-width:560px){
  .dict-hw-toggle{padding:0 12px;}
  .dict-hw-toggle-label{display:none;}
  .dict-hw{padding:12px; gap:12px;}
  .dict-hw-board{width:100%; align-items:center;}
  #dictHwCanvas{width:100%; height:auto; aspect-ratio:1;}
}

/* ---------- разбор слова по морфемам (napisanie.php) ---------- */
.morphemes{display:flex; flex-direction:column; gap:10px; margin-bottom:18px;}
.morpheme{border:2px solid var(--edge); border-radius:var(--r-sm); background:var(--bg); padding:10px 12px 12px;}
.morpheme-head{display:flex; gap:12px; align-items:flex-start;}
.morpheme-hz{font-size:36px; line-height:1; color:var(--ink); flex-shrink:0; padding-top:2px;}
.morpheme-hz:hover{color:var(--seal);}
.morpheme-info{display:flex; flex-direction:column; gap:3px; min-width:0; font-size:14px;}
.morpheme-info .pinyin{font-size:15px; font-weight:600;}
.morpheme-inword{font-weight:600; color:var(--ink);}
.morpheme-meanings{color:var(--ink-soft); font-size:13.5px; line-height:1.4;}
.morpheme-meanings .is-match{color:var(--ink); text-decoration:underline; text-decoration-color:var(--seal); text-underline-offset:3px;}
.morpheme-related{display:flex; flex-wrap:wrap; align-items:center; gap:6px; margin-top:10px; padding-top:9px; border-top:1px dashed var(--line);}
.morpheme-related-label{font-size:12.5px; color:var(--ink-soft); margin-right:2px;}
.morpheme-related-label .hz{font-size:15px; color:var(--ink);}
.morpheme-word{
  display:inline-flex; flex-direction:column; align-items:center;
  padding:4px 9px 5px;
  border:1.5px solid var(--line); border-radius:8px;
  background:var(--surface); color:var(--ink);
  transition:border-color .15s ease, background-color .2s ease;
}
.morpheme-word:hover{border-color:var(--edge); background:var(--gold-tint); color:var(--ink);}
.morpheme-word .hz{font-size:17px; line-height:1.25;}
.morpheme-word .hz b{color:var(--seal); font-weight:600;}
.morpheme-word-def{font-size:11px; color:var(--ink-soft); max-width:110px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.morpheme-all{font-size:13px; font-weight:600; margin-left:4px;}

/* ---------- примеры употребления (napisanie.php) ---------- */
.dict-examples, .panel .dict-examples{list-style:none; margin:0 0 8px; padding:0; display:flex; flex-direction:column;}
.panel .dict-examples li{margin:0;}
.dict-example-item{padding:9px 0 10px; border-bottom:1px solid var(--line);}
.dict-example-item:first-child{padding-top:2px;}
.dict-example-item.is-extra{display:none;}
.dict-examples.show-all .dict-example-item.is-extra{display:block;}
.dict-example-zh{display:flex; align-items:center; gap:8px;}
.dict-example-zh .hz{font-size:20px; line-height:1.35;}
.dict-example-zh mark{background:none; color:var(--seal); font-weight:600;}
.dict-example-py{font-size:13.5px; color:var(--seal); margin-top:1px;}
.dict-example-ru{font-size:14.5px; color:var(--ink-soft); margin-top:2px;}
.dict-examples-more{margin:0 0 18px;}

/* ---------- часть речи, частотность, парные формы, счётные слова (napisanie.php) ---------- */
.dict-pos{font-size:12px; font-weight:600; color:var(--ink-soft); border:1.5px solid var(--line); border-radius:20px; padding:2px 9px;}
.dict-detail-meta{display:flex; flex-wrap:wrap; align-items:center; gap:8px 16px; margin:2px 0 12px; font-size:13.5px; color:var(--ink-soft);}
.dict-freq{display:inline-flex; align-items:center; gap:7px;}
.dict-freq-bars{display:inline-flex; align-items:flex-end; gap:2px; height:13px;}
.dict-freq-bars i{display:block; width:4px; border-radius:1px; background:var(--line);}
.dict-freq-bars i:nth-child(1){height:5px;}
.dict-freq-bars i:nth-child(2){height:9px;}
.dict-freq-bars i:nth-child(3){height:13px;}
.dict-freq-1 .dict-freq-bars i:nth-child(-n+1),
.dict-freq-2 .dict-freq-bars i:nth-child(-n+2),
.dict-freq-3 .dict-freq-bars i{background:var(--seal);}
.dict-variant .hz{font-size:18px; color:var(--ink); margin-left:2px;}
.dict-variant a.hz:hover{color:var(--seal);}
.dict-measures, .panel .dict-measures{list-style:none; margin:0 0 18px; padding:0; display:flex; flex-wrap:wrap; gap:8px;}
.panel .dict-measures li{margin:0;}
.dict-measure{
  display:flex; align-items:center; gap:10px;
  padding:7px 12px 7px 10px;
  border:2px solid var(--edge); border-radius:var(--r-sm);
  background:var(--bg); color:var(--ink); max-width:340px;
  transition:background-color .2s ease, transform .15s ease;
}
.dict-measure:hover{background:var(--gold-tint); transform:translateY(-1px); color:var(--ink);}
.dict-measure-hz{font-size:28px; line-height:1;}
.dict-measure-body{display:flex; flex-direction:column; gap:2px; font-size:14px; min-width:0;}
.dict-measure-example{margin-left:6px; color:var(--ink-soft); font-size:15px;}
.dict-measure-desc{font-size:12.5px; color:var(--ink-soft); line-height:1.3;}
.counter-card.is-target{box-shadow:0 0 0 3px var(--seal), var(--shadow-hard);}

/* ---------- порядок черт (includes/char_analysis.php) ---------- */
.hz-strokes{margin:18px 0 6px; padding-top:16px; border-top:2px dashed var(--line); outline:none;}
.hz-strokes:focus-visible{box-shadow:0 0 0 3px var(--gold); border-radius:var(--r-sm);}
.hz-step{display:flex; align-items:center; gap:10px; flex-wrap:wrap; margin-bottom:14px;}
.hz-step-canvas{
  width:132px; height:132px; flex-shrink:0;
  background-color:var(--paper-canvas);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cg stroke='%23F4143F' stroke-opacity='.25' stroke-width='1' stroke-dasharray='4 4' fill='none'%3E%3Cpath d='M0 50H100M50 0V100M0 0L100 100M100 0L0 100' vector-effect='non-scaling-stroke'/%3E%3C/g%3E%3C/svg%3E");
  background-size:100% 100%;
  border:2px solid var(--edge); border-radius:var(--r-sm);
}
.hz-step-canvas svg, .hz-chart-step svg{display:block;}
.hz-draw{animation-name:hz-draw; animation-timing-function:ease-in-out; animation-fill-mode:forwards;}
@keyframes hz-draw{to{stroke-dashoffset:0;}}
@media (prefers-reduced-motion: reduce){ .hz-draw{animation-duration:.01s !important;} }
.hz-step-btn{
  width:38px; height:38px; flex-shrink:0;
  border:2px solid var(--edge); border-radius:50%;
  background:var(--surface); color:var(--ink);
  font-size:13px; cursor:pointer;
  transition:background-color .2s ease, transform .15s ease;
}
.hz-step-btn:hover:not(:disabled){background:var(--gold); color:#212121; transform:scale(1.06);}
.hz-step-btn:disabled{opacity:.3; cursor:default;}
.hz-step-info{flex:1; min-width:180px; display:flex; flex-direction:column; gap:3px; padding-left:6px;}
.hz-step-count{font-size:13px; color:var(--ink-soft);}
.hz-step-count b{color:var(--ink); font-size:15px;}
.hz-step-name{font-size:22px; line-height:1.2; min-height:27px;}
.hz-step-name .pinyin{font-size:15px;}
.hz-step-ru{font-size:15px; color:var(--ink); min-height:20px;}
.hz-step-replay{align-self:flex-start; margin-top:4px; padding:0; border:none; background:none; font:inherit; font-size:13px; color:var(--ink-soft); text-decoration:underline; cursor:pointer;}
.hz-step-replay:hover{color:var(--seal);}

.hz-chart, .panel .hz-chart{list-style:none; margin:0; padding:0; display:flex; flex-wrap:wrap; gap:6px;}
.panel .hz-chart li{margin:0;}
.hz-chart-step{
  position:relative;
  display:flex; flex-direction:column; align-items:center; gap:1px;
  padding:3px 3px 4px;
  border:1.5px solid var(--line); border-radius:8px;
  background:var(--paper-canvas); color:#212121;
  cursor:pointer;
  transition:border-color .15s ease, transform .15s ease;
}
.hz-chart-step:hover{border-color:var(--edge); transform:translateY(-1px);}
.hz-chart-step.active{border-color:var(--seal); box-shadow:0 0 0 2px var(--seal);}
.hz-chart-num{position:absolute; top:1px; left:4px; font-size:10px; font-weight:700; color:#9A917F;}
.hz-chart-name{font-size:11px; line-height:1.1; color:#5C564A;}
.hz-strokes-note{font-size:13px; color:var(--ink-faint); margin:10px 0 0;}
@media(max-width:560px){
  .hz-step-info{min-width:100%; padding-left:0;}
}

/* ---------- ключи (radicals.php) ---------- */
.dict-back{margin:0 0 18px;}
.dict-back a{font-weight:600;}
.radical-group{margin-bottom:26px;}
.radical-group-title{font-size:20px; margin:0 0 12px; display:flex; align-items:baseline; gap:8px;}
.radical-group-title span{font-family:var(--font-ui); font-size:14px; font-weight:500; color:var(--ink-soft);}
.radical-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(118px, 1fr)); gap:8px;}
.radical-tile{
  position:relative;
  display:flex; flex-direction:column; align-items:center; gap:2px;
  padding:12px 8px 10px;
  border:2px solid var(--edge); border-radius:var(--r);
  background:var(--surface); color:var(--ink); text-align:center;
  transition:transform .15s ease, box-shadow .15s ease, background-color .2s ease;
}
.radical-tile:hover{transform:translate(-2px,-2px); box-shadow:4px 4px 0 var(--hard); background:var(--gold-tint); color:var(--ink);}
.radical-tile.is-empty{opacity:.5; border-style:dashed;}
.radical-tile-num{position:absolute; top:6px; left:8px; font-size:11px; color:var(--ink-faint); font-variant-numeric:tabular-nums;}
.radical-tile-count{position:absolute; top:6px; right:8px; font-size:11px; font-weight:700; color:var(--ink-soft); font-variant-numeric:tabular-nums;}
.radical-tile-glyph{font-size:32px; line-height:1.15;}
.radical-tile-glyph small{font-size:16px; color:var(--ink-soft); margin-left:4px;}
.radical-tile-name{font-size:12.5px; color:var(--ink-soft); line-height:1.25;}
.radical-credits{font-size:12.5px; color:var(--ink-faint);}

.radical-hero .page-hero-caption .pinyin{font-size:1.05em;}
.radical-form{font-size:22px; margin:0 6px;}
.radical-nav{display:flex; align-items:center; gap:8px; flex-wrap:wrap; margin:0 0 18px;}
.radical-nav .hz{font-size:16px;}
.radical-nav-spacer{flex:1;}
.radical-filter{margin-bottom:0;}
.radical-help{font-size:14px; color:var(--ink-soft); margin:0 0 18px;}
.radical-chargroup{display:grid; grid-template-columns:76px 1fr; gap:12px; align-items:start; padding:10px 0; border-top:1px solid var(--line);}
.radical-chargroup-title{font-size:20px; margin:6px 0 0; line-height:1.1;}
.radical-chargroup-title span{display:block; font-family:var(--font-ui); font-size:12.5px; font-weight:500; color:var(--ink-soft);}
.radical-chars{display:flex; flex-wrap:wrap; gap:6px;}
.radical-char{
  display:flex; flex-direction:column; align-items:center;
  min-width:56px; padding:6px 8px 7px;
  border:2px solid var(--line); border-radius:var(--r-sm);
  background:var(--surface); color:var(--ink);
  transition:transform .15s ease, border-color .2s ease, background-color .2s ease;
}
.radical-char.is-hsk{border-color:var(--edge);}
.radical-char:hover{transform:translateY(-2px); border-color:var(--edge); background:var(--gold-tint); color:var(--ink);}
.radical-char .hz{font-size:24px; line-height:1.2;}
.radical-char-py{font-size:12px; color:var(--seal); font-weight:500;}

@media(max-width:560px){
  .hz-analysis-top{gap:14px;}
  .hz-colored{width:104px; height:104px;}
  .hz-colored svg{width:104px; height:104px;}
  .radical-grid{grid-template-columns:repeat(auto-fill, minmax(96px, 1fr));}
  .radical-tile-glyph{font-size:28px;}
  .radical-nav-spacer{display:none;}
  .radical-chargroup{grid-template-columns:52px 1fr; gap:8px;}
  .radical-chargroup-title{font-size:17px;}
}

@media(max-width:900px){
  .dict-layout.has-detail.has-results{grid-template-columns:1fr;}
  .dict-layout.has-detail.has-results .dict-detail{position:static; max-height:none; overflow:visible; order:-1;}
}
@media(max-width:560px){
  .search-box.dict-search{flex-wrap:nowrap;}
  .dict-search-btn{padding:0 14px;}
  .dict-result{grid-template-columns:auto minmax(0, 1fr); gap:10px 12px;}
  .dict-result-meta{grid-column:2; flex-direction:row; align-items:center; justify-content:flex-start;}
  .dict-detail{padding:20px 18px;}
  .dict-detail-hz{font-size:46px;}
  .dict-example-row{grid-template-columns:1fr 1fr;}
  .dict-hint-kbd{display:none;}
  .seg-row{gap:6px;}
  .seg{min-width:44px; padding:5px 7px 6px;}
  .seg-hz{font-size:20px;}
  .seg-def{max-width:84px; font-size:11px;}
}
}

/* ============================================================
   Фильтры, бейджи, HSK
   ============================================================ */
.chip-row{display:flex; flex-wrap:wrap; gap:8px; margin-bottom:30px;}
.chip{
  font-family:var(--font-ui);
  font-size:14px; font-weight:600;
  padding:8px 16px;
  border-radius:30px;
  border:2px solid var(--edge);
  color:var(--ink);
  background-color:var(--surface);
  cursor:pointer;
  transition:background-color .2s ease, transform .15s ease;
}
.chip .chip-count{opacity:.7; font-size:12px;}
.chip:hover{background-color:var(--gold-tint); transform:translateY(-1px);}
.chip.active{background-color:var(--ink); color:var(--bg); border-color:var(--edge);}
.chip.hsk-1.active{background:var(--hsk1); color:var(--hsk1-on);}
.chip.hsk-2.active{background:var(--hsk2); color:var(--hsk2-on);}
.chip.hsk-3.active{background:var(--hsk3); color:var(--hsk3-on);}
.chip.hsk-4.active{background:var(--hsk4); color:var(--hsk4-on);}
.chip.hsk-5.active{background:var(--hsk5); color:var(--hsk5-on);}
.chip.hsk-6.active{background:var(--hsk6); color:var(--hsk6-on);}

/* ---------- свободный режим в играх: выбор уровней HSK ---------- */
.free-mode-panel{padding:22px 26px;}
.free-mode-panel h3{margin:0 0 4px;}
.free-mode-sub{margin:0 0 14px; color:var(--ink-soft); font-size:14.5px;}
.free-mode-note{margin:-8px 0 14px; color:var(--ink-faint); font-size:13px;}
.free-mode-levels{display:flex; flex-wrap:wrap; gap:8px; margin-bottom:16px;}
.free-mode-level{position:relative; user-select:none;}
.free-mode-level input{position:absolute; opacity:0; width:1px; height:1px; pointer-events:none;}
.free-mode-level:has(input:focus-visible){outline:3px solid var(--gold); outline-offset:2px;}
.chip.hsk-none.active{background:var(--surface-3); color:var(--ink);}
.free-mode-all{font-family:var(--font-ui);}
.free-mode-foot{display:flex; align-items:center; gap:14px; flex-wrap:wrap;}
.free-mode-foot .cta:disabled{opacity:.45; cursor:not-allowed; transform:none; box-shadow:none;}
.free-mode-summary{font-size:14px; color:var(--ink-soft);}
.badge-free-mode{background:var(--surface-2); color:var(--ink); border:1.5px solid var(--edge);}
@media(max-width:560px){
  .free-mode-panel{padding:18px 16px;}
  .free-mode-levels .chip{padding:7px 12px; font-size:13.5px;}
}

.badge{
  font-family:var(--font-ui);
  font-size:12px; font-weight:700;
  letter-spacing:.03em;
  padding:4px 11px;
  border-radius:30px;
  display:inline-block;
  color:#fff;
  background:var(--ink);
  white-space:nowrap;
  line-height:1.4;
}
.badge-hsk-1{background:var(--hsk1); color:var(--hsk1-on);}
.badge-hsk-2{background:var(--hsk2); color:var(--hsk2-on);}
.badge-hsk-3{background:var(--hsk3); color:var(--hsk3-on);}
.badge-hsk-4{background:var(--hsk4); color:var(--hsk4-on);}
.badge-hsk-5{background:var(--hsk5); color:var(--hsk5-on);}
.badge-hsk-6{background:var(--hsk6); color:var(--hsk6-on);}

.badge-script{
  font-family:var(--font-ui);
  font-size:12px; font-weight:700;
  letter-spacing:.02em;
  padding:3px 11px;
  border-radius:30px;
  display:inline-block;
  vertical-align:middle;
  margin-left:10px;
  border:1.5px solid currentColor;
}
.badge-script-traditional{color:var(--seal);}
.badge-script-simplified{color:var(--jade);}

/* ---------- углублённая статистика (profile.php) ---------- */
.hsk-progress-list{display:flex; flex-direction:column; gap:12px;}
.hsk-progress-row{display:grid; grid-template-columns:70px 1fr 110px; align-items:center; gap:14px;}
.hsk-progress-bar{height:12px; border-radius:20px; background:var(--surface-3); border:1.5px solid var(--edge); overflow:hidden;}
.hsk-progress-fill{height:100%; border-radius:20px; transition:width .3s ease;}
.hsk-progress-num{font-family:var(--font-ui); font-weight:600; font-size:14px; text-align:right; font-variant-numeric:tabular-nums;}
.hsk-progress-pct{color:var(--ink-soft); font-family:var(--font-ui); font-size:12.5px;}
@media(max-width:520px){
  .hsk-progress-row{grid-template-columns:56px 1fr; grid-template-areas:"badge num" "bar bar"; row-gap:6px;}
  .hsk-progress-row .badge{grid-area:badge;}
  .hsk-progress-row .hsk-progress-num{grid-area:num;}
  .hsk-progress-row .hsk-progress-bar{grid-area:bar;}
}

/* ---------- секции грамматики по уровню HSK ---------- */
.hsk-section{
  border:2px solid var(--edge);
  border-left:10px solid var(--hsk-color, var(--edge));
  border-radius:var(--r-lg);
  margin-bottom:18px;
  overflow:hidden;
  background:var(--surface);
}
.hsk-section summary{
  cursor:pointer;
  list-style:none;
  padding:20px 26px;
  font-family:var(--font-display);
  font-weight:600;
  font-size:17px;
  color:var(--ink);
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  transition:background-color .2s ease;
}
.hsk-section summary:hover{background:var(--surface-2);}
.hsk-section summary::-webkit-details-marker{display:none;}
.hsk-section summary::after{
  content:"+";
  display:grid; place-items:center;
  width:30px; height:30px; flex-shrink:0;
  border:2px solid var(--edge); border-radius:50%;
  font-family:var(--font-ui); font-size:18px; font-weight:700; line-height:1;
  transition:transform .2s ease, background-color .2s ease;
}
.hsk-section[open] summary::after{transform:rotate(45deg); background:var(--gold); color:#212121;}
.hsk-section .count{font-family:var(--font-ui); font-weight:500; font-size:14px; color:var(--ink-soft); margin-left:auto;}
.hsk-section-body{padding:4px 24px 24px;}
.hsk-section-1{--hsk-color:var(--hsk1);}
.hsk-section-2{--hsk-color:var(--hsk2);}
.hsk-section-3{--hsk-color:var(--hsk3);}
.hsk-section-4{--hsk-color:var(--hsk4);}
.hsk-section-5{--hsk-color:var(--hsk5);}
.hsk-section-6{--hsk-color:var(--hsk6);}

/* ---------- компактная карточка грамматики ---------- */
.gram-item{
  background:var(--surface-2);
  border:1.5px solid var(--line);
  border-radius:var(--r);
  padding:20px 22px;
  margin-bottom:12px;
}
.gram-item-head{display:flex; align-items:baseline; justify-content:space-between; gap:12px; margin-bottom:4px; flex-wrap:wrap;}
.gram-item-head h4{font-family:var(--font-hz); font-weight:700; font-size:30px; line-height:1.25; margin:0; color:var(--ink);}
.gram-item .pinyin{display:block; font-size:15px; margin-bottom:8px;}
.gram-item p{margin:0; font-size:17.5px; line-height:1.65; color:var(--ink-soft);}

.gram-examples{display:flex; flex-direction:column; gap:8px; margin-top:14px;}
.gram-example{
  background:var(--surface);
  border-left:4px solid var(--red);
  border-radius:0 var(--r-sm) var(--r-sm) 0;
  padding:10px 16px;
}
.gram-example-zh-row{display:flex; align-items:center; gap:8px;}
.gram-example-zh{font-size:19px; color:var(--ink);}
.gram-example-ru{font-size:14.5px; color:var(--ink-soft); margin-top:2px;}

/* ---------- счётные слова ---------- */
.counter-category{
  font-family:var(--font-display);
  font-size:22px; font-weight:600;
  margin:48px 0 18px;
  color:var(--ink);
  display:flex; align-items:baseline; gap:12px; flex-wrap:wrap;
}
.counter-category .book-count{font-family:var(--font-ui); font-size:14px; color:var(--ink-soft); font-weight:500;}
.counter-category:first-of-type{margin-top:8px;}

.counter-grid{display:grid; grid-template-columns:1fr 1fr; gap:20px; margin-bottom:10px; align-items:start;}
.counter-card{
  background:var(--surface);
  border:2px solid var(--edge);
  border-radius:var(--r-lg);
  padding:30px;
  display:flex; flex-direction:column; align-items:center; justify-content:flex-start;
  text-align:center;
  transition:transform .18s ease, box-shadow .18s ease;
}
.counter-card:hover{transform:translate(-3px,-3px); box-shadow:5px 5px 0 var(--hover-edge);}
.counter-chinese-row{display:flex; align-items:center; gap:10px; margin-bottom:12px;}
.counter-chinese{font-size:64px; font-weight:700; line-height:1; color:var(--ink);}
.counter-pinyin{font-family:var(--font-ui); font-weight:500; font-size:21px; color:var(--seal); margin-bottom:12px;}
.counter-russian{font-size:17px; line-height:1.45; color:var(--ink); margin-bottom:12px;}
.counter-example{font-size:14.5px; color:var(--ink-soft); border-top:1.5px dashed var(--line); padding-top:14px; margin-top:14px; width:100%;}
@media(max-width:640px){
  .counter-grid{grid-template-columns:1fr;}
  .counter-card{padding:24px;}
}

/* ============================================================
   Формы и уведомления
   ============================================================ */
.form-card{
  max-width:460px;
  margin:30px auto;
  background:var(--surface);
  border:2px solid var(--edge);
  border-radius:var(--r-lg);
  padding:38px 40px 34px;
  box-shadow:6px 6px 0 var(--gold);
}
.form-card h2{font-family:var(--font-display); font-weight:700; font-size:26px; margin:0 0 24px; text-align:center; color:var(--ink);}
.field{margin-bottom:18px;}
.field label{display:block; font-family:var(--font-ui); font-size:13.5px; font-weight:600; color:var(--ink); margin-bottom:6px;}
.field input, .field select, .field textarea{
  width:100%;
  padding:12px 14px;
  border:2px solid var(--edge);
  border-radius:var(--r-sm);
  background:var(--surface);
  font-family:var(--font-ui);
  font-size:16px;
  color:var(--ink);
  transition:box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus{outline:none; box-shadow:3px 3px 0 var(--gold);}
.field input[type="checkbox"]{width:18px; height:18px; accent-color:var(--seal-fill); flex-shrink:0;}
.form-submit{
  width:100%;
  margin-top:8px;
  padding:14px;
  background-color:var(--seal-fill);
  color:#fff;
  font-size:16px;
  box-shadow:3px 3px 0 var(--hard);
}
.form-submit:hover{transform:translate(-2px,-2px); box-shadow:5px 5px 0 var(--hover-edge);}
.form-submit:active{transform:translate(1px,1px); box-shadow:1px 1px 0 var(--hard);}
.form-foot{text-align:center; margin-top:18px; font-size:14.5px; color:var(--ink-soft);}
.form-foot a{color:var(--seal); font-weight:600; text-decoration:underline; text-underline-offset:2px;}

.link-seal{color:var(--seal); font-weight:700; text-decoration:underline; text-underline-offset:2px;}
.link-seal:hover{text-decoration-thickness:2px;}

.alert{
  padding:14px 18px 14px 20px;
  border-radius:var(--r);
  font-size:15px;
  margin-bottom:20px;
  border:2px solid var(--edge);
  border-left-width:8px;
  border-left-color:var(--gold);
  background:var(--surface);
  color:var(--ink);
}
.alert-error{border-color:var(--seal-fill); border-left-color:var(--seal-fill); background:var(--seal-tint); color:var(--ink);}
.alert-success{border-color:var(--jade-fill); border-left-color:var(--jade-fill); background:var(--jade-tint); color:var(--ink);}
.alert ul{margin:0; padding-left:18px;}

/* ============================================================
   Профиль, аватарки, баннеры
   ============================================================ */
.profile-head{display:flex; align-items:center; gap:20px; margin-bottom:8px;}
.profile-head > div{min-width:0;}
.profile-head h1.small{overflow-wrap:anywhere; margin-bottom:6px;}
.profile-head .lead{overflow-wrap:anywhere;}
/* без баннера кнопка «Фон» стоит в углу панели — оставляем место под неё справа */
.profile-panel > .profile-top-actions + .profile-head:not(.profile-head-on-banner){padding-right:90px;}
.avatar{
  width:56px; height:56px; border-radius:50%;
  background:var(--avatar-accent, var(--seal-fill)); color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-family:var(--font-hz); font-size:22px;
  flex-shrink:0;
}
.avatar-img{width:56px; height:56px; border-radius:50%; object-fit:cover;}

.avatar-trigger{position:relative; padding:0; border:none; background:none; cursor:pointer; border-radius:50%; flex-shrink:0;}
.avatar-trigger:disabled{cursor:default;}
.avatar-trigger:not(:disabled):hover .avatar{filter:brightness(.92);}
.avatar-edit-badge{
  position:absolute; right:-2px; bottom:-2px;
  width:22px; height:22px; border-radius:50%;
  background:var(--gold); border:2px solid var(--edge);
  display:flex; align-items:center; justify-content:center;
  font-size:11px; color:#212121;
}

.avatar-picker{
  position:fixed; inset:0; background:rgba(22,22,22,.72);
  display:none; align-items:center; justify-content:center;
  padding:24px; z-index:200;
}
.avatar-picker.open{display:flex;}
.avatar-picker-panel{
  position:relative;
  background:var(--surface);
  border:2px solid var(--edge);
  border-radius:var(--r-lg);
  padding:36px 30px 30px;
  max-width:620px; width:100%;
  max-height:90vh; overflow-y:auto;
  box-shadow:8px 8px 0 var(--gold);
}
.avatar-option-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:16px;}
.avatar-option{
  position:relative;
  display:flex; flex-direction:column; align-items:center; gap:8px;
  padding:16px 12px;
  background:var(--surface-2);
  border:2px solid var(--line);
  border-radius:var(--r);
  cursor:pointer;
  font-family:inherit; text-align:center;
  transition:border-color .2s ease, transform .2s ease;
  overflow:hidden;
}
.avatar-option:hover{border-color:var(--edge); transform:translateY(-2px);}
.avatar-option.active{border-color:var(--jade-fill); background:var(--jade-tint);}
.avatar-option span{font-size:13px; color:var(--ink); line-height:1.25; font-weight:600;}
.avatar-option small{font-size:11.5px; color:var(--ink-soft);}
.avatar-option .avatar{width:100px; height:100px; font-size:36px; transition:transform .25s ease;}
.avatar-option:hover .avatar{transform:scale(1.1);}

.avatar-option.locked, .banner-option.locked{cursor:not-allowed; filter:grayscale(1); opacity:.55;}
.avatar-option.locked:hover{border-color:var(--line); transform:none;}
.avatar-option.locked:hover .avatar{transform:none;}
.avatar-option.locked small, .banner-option.locked small{color:var(--seal);}
.lock-badge{position:absolute; top:8px; right:8px; font-size:14px; line-height:1;}

/* эксклюзив для подписчиков — золото «купи», а не серое «прокачайся» */
.avatar-option.premium-locked, .banner-option.premium-locked{
  text-decoration:none; cursor:pointer; filter:none; opacity:1;
  border-color:var(--gold);
  background:linear-gradient(160deg, var(--gold-tint), transparent);
}
.avatar-option.premium-locked:hover, .banner-option.premium-locked:hover{border-color:var(--edge); transform:translateY(-2px); box-shadow:4px 4px 0 var(--gold);}
.avatar-option.premium-locked small, .banner-option.premium-locked small{color:var(--gold-ink); font-weight:700;}
.premium-lock-badge{color:var(--gold-ink);}
.premium-badge{position:absolute; top:8px; right:8px; font-size:13px; line-height:1; color:var(--gold-ink);}

/* ---------- варианты оформления аватарок ---------- */
.avatar-style-ink{background:radial-gradient(circle at 32% 28%, rgba(255,255,255,.5), transparent 62%), var(--avatar-accent);}
.avatar-style-watercolor{background:linear-gradient(135deg, rgba(255,255,255,.4), rgba(0,0,0,.1)), var(--avatar-accent);}
.avatar-style-papercut{background:var(--avatar-accent); border:2px dashed rgba(255,255,255,.6);}
.avatar-style-neon{background:#212121; color:var(--avatar-accent); box-shadow:0 0 0 2px var(--avatar-accent), 0 0 12px 1px var(--avatar-accent);}
.avatar-style-linocut{background:var(--avatar-accent); border:3px solid var(--ink);}
.avatar-style-freehand{background:var(--avatar-accent); border-radius:46% 54% 55% 45% / 50% 45% 55% 50%;}
.avatar-style-gongbi{background:var(--surface); color:var(--avatar-accent); box-shadow:0 0 0 1px var(--avatar-accent) inset, 0 0 0 4px var(--surface), 0 0 0 5px var(--avatar-accent);}
.avatar-style-storybook{background:linear-gradient(160deg, rgba(255,255,255,.45), rgba(255,255,255,0)), var(--avatar-accent);}
.avatar-style-minimal-line{background:var(--surface); color:var(--avatar-accent); border:2px solid var(--avatar-accent);}

.avatar-style-imperial-gold{background:radial-gradient(circle at 30% 25%, rgba(255,225,140,.55), transparent 60%), var(--avatar-accent); box-shadow:0 0 0 2px #EDB217, 0 0 14px 1px rgba(237,178,23,.5);}
.avatar-style-marble{background:linear-gradient(135deg, rgba(255,255,255,.55), rgba(255,255,255,.05) 45%, rgba(0,0,0,.14)), var(--avatar-accent); box-shadow:0 0 0 2px #EDB217;}
.avatar-style-cinnabar{background:radial-gradient(circle at 70% 72%, rgba(255,170,130,.45), transparent 55%), var(--avatar-accent); box-shadow:0 0 0 2px #EDB217;}
.avatar-style-black-lacquer{background:var(--avatar-accent); box-shadow:0 0 0 2px #EDB217, inset 0 0 12px rgba(237,178,23,.4);}

/* ---------- баннер профиля ---------- */
.profile-panel{position:relative; overflow:hidden;}
.profile-banner{margin:-30px -34px 20px; aspect-ratio:5.5 / 1; max-height:280px; position:relative; border-bottom:2px solid var(--edge);}
.profile-banner-media{position:absolute; inset:0; background-size:cover; background-position:center 30%;}
.profile-top-actions{position:absolute; top:14px; right:14px; z-index:5; display:flex; align-items:center; gap:10px;}
.banner-trigger{
  padding:7px 14px; border-radius:30px;
  background:var(--surface); border:2px solid var(--edge);
  color:var(--ink); font-size:13px; font-weight:600; font-family:var(--font-ui);
  cursor:pointer;
  transition:background-color .2s ease;
}
.banner-trigger:hover{background:var(--gold); color:#212121;}

/* ---------- бейджи лимита / серии ---------- */
.attempts-badge{
  display:inline-flex; align-items:center; gap:5px;
  padding:7px 14px; border-radius:30px;
  background:var(--seal-fill); color:#fff;
  border:2px solid var(--edge);
  font-size:13px; font-weight:700; font-family:var(--font-ui);
  text-decoration:none; white-space:nowrap;
  font-variant-numeric:tabular-nums;
  transition:transform .15s ease, box-shadow .15s ease;
}
.attempts-badge:hover{transform:translate(-1px,-1px); box-shadow:3px 3px 0 var(--hard); color:#fff;}
.attempts-badge-premium{background:var(--ink); color:var(--gold);}
.attempts-badge-premium:hover{color:var(--gold);}
.nav-attempts-badge{padding:6px 12px; font-size:12.5px;}
.streak-badge{background:var(--gold); color:#212121;}
.streak-badge:hover{color:#212121;}
.streak-badge-unlit{background:transparent; color:var(--ink-soft); border-style:dashed; border-color:var(--ink-faint); filter:grayscale(1);}
.streak-badge-unlit:hover{border-color:var(--edge); filter:none; box-shadow:none; color:var(--ink);}

.banner-picker-panel{max-width:760px;}
.banner-option-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:16px;}
.banner-option{
  position:relative;
  display:flex; flex-direction:column; align-items:flex-start; gap:4px;
  padding:10px;
  background:var(--surface-2);
  border:2px solid var(--line);
  border-radius:var(--r);
  cursor:pointer;
  font-family:inherit; text-align:left;
  transition:border-color .2s ease, transform .2s ease;
  overflow:hidden;
}
.banner-option:hover{border-color:var(--edge); transform:translateY(-2px);}
.banner-option.active{border-color:var(--jade-fill); background:var(--jade-tint);}
.banner-option.locked:hover{border-color:var(--line); transform:none;}
.banner-option.locked:hover .profile-banner-media{transform:none;}
.banner-option span{font-size:13px; color:var(--ink); padding:2px 2px 0; font-weight:600;}
.banner-option small{font-size:11.5px; color:var(--ink-soft); padding:0 2px;}
.banner-option .profile-banner-media{position:static; width:100%; height:80px; border-radius:var(--r-sm); transition:transform .3s ease;}
.banner-option:hover .profile-banner-media{transform:scale(1.05);}
.banner-option-empty{background:repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 8px, var(--line) 8px, var(--line) 9px);}

.banner-style-shanshui-ink{background:linear-gradient(180deg, rgba(255,255,255,.5) 0%, transparent 55%), var(--banner-accent);}
.banner-style-watercolor-plein{background:linear-gradient(120deg, rgba(255,255,255,.4), rgba(0,0,0,.08)), var(--banner-accent);}
.banner-style-ukiyo-indigo{background:linear-gradient(180deg, #10131c, var(--banner-accent));}
.banner-style-poster-gradient{background:linear-gradient(100deg, var(--banner-accent) 0%, rgba(255,255,255,.3) 100%);}
.banner-style-gongbi-fine{background:var(--surface-2); box-shadow:inset 0 0 0 2px var(--banner-accent);}
.banner-style-cold-watercolor{background:linear-gradient(160deg, rgba(255,255,255,.6), transparent 60%), var(--banner-accent);}
.banner-style-gouache-autumn{background:linear-gradient(100deg, var(--banner-accent), #F08A24 45%, #EDB217 100%);}
.banner-style-woodblock-bold{background:repeating-linear-gradient(0deg, var(--banner-accent), var(--banner-accent) 10px, rgba(0,0,0,.15) 10px, rgba(0,0,0,.15) 12px);}
.banner-style-pastel-storybook{background:linear-gradient(200deg, rgba(255,255,255,.5), rgba(255,255,255,0)), var(--banner-accent);}
.banner-style-papercut-sunset{background:linear-gradient(180deg, var(--banner-accent) 0%, #F4B860 60%, #FFD98E 100%);}
.banner-style-imperial-gold-banner{background:linear-gradient(120deg, var(--banner-accent) 0%, #EDB217 130%); box-shadow:inset 0 0 0 2px #EDB217;}
.banner-style-panorama-mist{background:linear-gradient(180deg, rgba(255,255,255,.6) 0%, transparent 45%, var(--banner-accent) 100%);}
.banner-style-turquoise-gradient{background:linear-gradient(100deg, var(--banner-accent) 0%, #6FBFBF 55%, #C9E8E8 100%);}
.banner-style-night-lanterns{
  background:
    radial-gradient(circle at 20% 35%, rgba(255,200,120,.55), transparent 40%),
    radial-gradient(circle at 75% 65%, rgba(255,160,90,.5), transparent 45%),
    linear-gradient(180deg, #1A1030, var(--banner-accent));
}

/* ---------- плитки статистики ---------- */
.stat-row{display:grid; grid-template-columns:repeat(3,1fr); gap:14px; margin:26px 0;}
.stat-row-6{grid-template-columns:repeat(6,1fr);}
.stat-row-5{grid-template-columns:repeat(5,1fr);}
.stat-row-4{grid-template-columns:repeat(4,1fr);}
.stat{
  background:var(--surface);
  border:2px solid var(--edge);
  border-radius:var(--r);
  padding:18px 18px 16px;
  text-align:left;
}
.stat .num{font-family:var(--font-display); font-weight:700; font-size:28px; line-height:1.15; color:var(--ink); font-variant-numeric:tabular-nums; letter-spacing:-.02em;}
.stat .label{font-family:var(--font-ui); font-size:13px; color:var(--ink-soft); margin-top:4px; line-height:1.35;}
.stat-wide{display:flex; align-items:center; justify-content:flex-start; gap:12px; margin-top:12px;}
.stat-wide .label{margin-top:0; font-size:14px;}
.stat-flame{background:var(--gold); border-color:var(--edge);}
.stat-flame .num, .stat-flame .label{color:#212121;}
.stat-flame-unlit{background:transparent; border-style:dashed; border-color:var(--ink-faint);}
.stat-flame-unlit .num{color:var(--ink-soft); filter:grayscale(1); opacity:.75;}
.stat-flame-unlit .label{color:var(--ink-soft);}

/* ---------- дашборд на главной ---------- */
.dashboard-panel{margin:40px 0 10px; box-shadow:var(--shadow-hard);}
.dashboard-head{display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px;}
.dashboard-head h3{font-size:22px;}
.dashboard-hint{margin:4px 0 0; font-size:14px; color:var(--ink-soft);}
.dashboard-hint a{color:var(--seal); font-weight:700;}
.dashboard-hint-dismissible{display:flex; align-items:center; justify-content:space-between; gap:10px;}
.dashboard-hint-close{
  flex-shrink:0;
  background:none; border:none; cursor:pointer;
  color:var(--ink-soft); font-size:13px; line-height:1;
  padding:4px 6px; border-radius:6px;
  transition:color .2s ease, background-color .2s ease;
}
.dashboard-hint-close:hover{color:var(--ink); background:var(--surface-2);}

/* ============================================================
   Подвал
   ============================================================ */
.site-footer{
  flex-shrink:0;
  background:var(--footer-bg);
  color:var(--footer-ink);
  margin-top:40px;
  border-top:2px solid var(--edge);
  overflow:hidden;
}
.footer-top{
  display:grid;
  grid-template-columns:minmax(260px, 1.1fr) 2fr;
  gap:48px;
  padding-top:56px;
  padding-bottom:40px;
}
.footer-brand .logo .py{color:var(--footer-ink);}
.footer-brand .logo .logo-word .hz{color:var(--gold);}
.site-footer .footer-brand p{color:var(--footer-soft); font-size:15px; line-height:1.6; margin:18px 0 22px; max-width:360px;}
.footer-brand .cta{box-shadow:3px 3px 0 var(--gold); border-color:var(--seal-fill);}
.footer-brand .cta:hover{box-shadow:5px 5px 0 var(--gold);}
.footer-cols{display:grid; grid-template-columns:repeat(4, 1fr); gap:28px;}
.footer-cols h5{
  font-family:var(--font-ui);
  font-size:12.5px; font-weight:700; letter-spacing:.09em; text-transform:uppercase;
  color:var(--gold);
  margin:4px 0 14px;
}
.footer-cols ul{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:9px;}
.footer-cols li{font-size:15px; line-height:1.35;}
.site-footer .footer-cols a{color:var(--footer-ink); text-decoration:none; transition:color .2s ease;}
.site-footer .footer-cols a:hover{color:var(--gold); text-decoration:underline; text-underline-offset:3px;}
.footer-glyphs{
  font-weight:900;
  font-size:clamp(90px, 17vw, 230px);
  line-height:.8;
  letter-spacing:.05em;
  text-align:center;
  color:transparent;
  -webkit-text-stroke:1.5px var(--footer-line);
  user-select:none;
  white-space:nowrap;
  margin-bottom:-.12em;
}
.footer-bottom{
  display:flex; flex-wrap:wrap; align-items:center; gap:10px 28px;
  padding-top:18px; padding-bottom:26px;
  border-top:1px solid var(--footer-line);
  font-size:13.5px;
  color:var(--footer-soft);
  position:relative;
  background:var(--footer-bg);
}
.footer-up{margin-left:auto; color:var(--footer-ink); font-weight:600;}
.footer-up:hover{color:var(--gold);}

/* ============================================================
   Игры и уроки
   ============================================================ */
.quiz-progress{color:var(--ink-soft); font-size:12.5px; font-weight:700; text-align:center; text-transform:uppercase; letter-spacing:.08em;}
.quiz-progress .badge{margin-left:10px; text-transform:none; letter-spacing:normal; vertical-align:middle;}
.quiz-timer{margin-left:10px; text-transform:none; letter-spacing:normal; font-variant-numeric:tabular-nums;}
.quiz-options{display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-top:18px;}
.quiz-option{
  font-family:var(--font-ui);
  font-size:19px; font-weight:500;
  padding:16px 18px;
  border:2px solid var(--edge);
  border-radius:var(--r);
  background:var(--surface);
  color:var(--ink);
  cursor:pointer;
  text-align:left;
  transition:transform .15s ease, box-shadow .15s ease, background-color .2s ease;
}
.quiz-option:hover{transform:translate(-2px,-2px); box-shadow:4px 4px 0 var(--hover-edge); background:var(--gold-tint);}
.quiz-option:active{transform:translate(1px,1px); box-shadow:none;}
.quiz-option.correct{background:var(--jade-fill); border-color:var(--edge); color:#fff;}
.quiz-option.wrong{background:var(--seal-fill); border-color:var(--edge); color:#fff;}
.quiz-option:disabled{cursor:default; opacity:1;}
.quiz-option.correct:disabled, .quiz-option.wrong:disabled{opacity:1 !important;}

/* ---------- курс: «сопоставь пары» ---------- */
.course-match{display:grid; grid-template-columns:1fr 1fr; gap:10px 16px; margin-top:16px;}
.course-match-col{display:flex; flex-direction:column; gap:10px;}
.course-match-item{
  font-family:var(--font-ui);
  font-size:16px;
  padding:12px 14px;
  border:2px solid var(--edge);
  border-radius:var(--r-sm);
  background:var(--surface);
  color:var(--ink);
  cursor:pointer;
  text-align:left;
  transition:transform .15s ease, background-color .2s ease;
}
.course-match-item.hz{font-family:var(--font-hz); font-size:1.4rem; text-align:center;}
.course-match-item:hover{background:var(--gold-tint); transform:translateY(-1px);}
.course-match-item.selected{background:var(--gold); color:#212121;}
.course-match-item.matched{background:var(--jade-fill); border-color:var(--jade-fill); color:#fff; cursor:default; opacity:.9;}
.course-match-item.wrong{background:var(--seal-fill); color:#fff;}

/* ---------- курс: карточка «объяснение слова» ---------- */
#lessonExplainDef{font-size:20px; text-align:center; margin:2px auto 0; max-width:480px; color:var(--ink);}
.course-explain-breakdown-item{
  display:flex; flex-direction:column; align-items:center; gap:6px;
  min-width:110px;
  padding:18px 20px;
  border:2px solid var(--edge);
  border-radius:var(--r);
  background:var(--surface);
  transition:transform .15s ease, box-shadow .15s ease;
}
.course-explain-breakdown-item:hover{transform:translate(-2px,-2px); box-shadow:4px 4px 0 var(--hover-edge);}
.course-explain-breakdown-item .hz{font-size:2.4rem; color:var(--red);}
.course-explain-breakdown-item small{font-size:13px; color:var(--ink-soft); text-align:center; max-width:130px; line-height:1.3;}
.course-explain-plus{align-self:center; color:var(--gold-ink); font-size:26px; font-weight:800;}

/* ---------- курс: карточка грамматики/фонетики ---------- */
.course-note-card{max-width:600px; margin:0 auto; text-align:left;}
.course-note-card h3{font-size:22px;}
.course-note-card .lead{margin-bottom:16px; color:var(--ink);}
.course-note-pattern{
  font-family:var(--font-ui);
  font-size:16px; font-weight:700;
  color:#212121;
  background:var(--gold);
  border:2px solid var(--edge);
  border-radius:var(--r-sm);
  padding:11px 15px;
  margin-bottom:16px;
}
.course-note-example{
  border-left:4px solid var(--red);
  padding:12px 16px;
  background:var(--surface-2);
  border-radius:0 var(--r-sm) var(--r-sm) 0;
}
.course-note-example .chinese{font-size:1.6rem; margin-bottom:2px;}
.course-note-example .pinyin{font-size:14.5px; margin-bottom:4px;}

/* ---------- курс: диалог ---------- */
.course-dialogue-line{
  display:grid;
  grid-template-columns:auto auto auto 1fr;
  align-items:center;
  gap:10px;
  padding:12px 0;
  border-bottom:1.5px dashed var(--line);
}
.course-dialogue-line:last-child{border-bottom:none;}
.course-dialogue-speaker{
  font-family:var(--font-display); font-weight:700; font-size:13px;
  width:28px; height:28px;
  display:grid; place-items:center;
  border-radius:50%;
  background:var(--ink); color:var(--bg);
}
.course-dialogue-line:nth-child(even) .course-dialogue-speaker{background:var(--seal-fill); color:#fff;}
.course-dialogue-line .chinese{font-size:1.3rem;}
.course-dialogue-line .pinyin{font-size:13.5px; white-space:nowrap;}
.course-dialogue-ru{font-size:14.5px; color:var(--ink-soft); grid-column:1 / -1;}
@media (min-width:560px){
  .course-dialogue-ru{grid-column:auto; text-align:right;}
  .course-dialogue-line{grid-template-columns:auto auto auto 1fr auto;}
}

/* ---------- сетка уровней в играх ---------- */
.level-grid{display:grid; grid-template-columns:repeat(10, 1fr); gap:8px; margin:20px 0 10px;}
.level-tile{
  position:relative;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:3px;
  aspect-ratio:1;
  border-radius:var(--r-sm);
  border:2px solid var(--edge);
  background-color:var(--surface);
  color:var(--ink);
  font-family:var(--font-ui);
  font-weight:700;
  font-size:15px;
  font-variant-numeric:tabular-nums;
  box-shadow:inset 0 5px 0 var(--tile-hsk, transparent);
  transition:transform .15s ease, box-shadow .15s ease;
}
a.level-tile:hover{transform:translate(-2px,-2px); box-shadow:inset 0 5px 0 var(--tile-hsk, transparent), 3px 3px 0 var(--hover-edge);}
.level-tile.hsk-1{--tile-hsk:var(--hsk1);}
.level-tile.hsk-2{--tile-hsk:var(--hsk2);}
.level-tile.hsk-3{--tile-hsk:var(--hsk3);}
.level-tile.hsk-4{--tile-hsk:var(--hsk4);}
.level-tile.hsk-5{--tile-hsk:var(--hsk5);}
.level-tile.hsk-6{--tile-hsk:var(--hsk6);}
.level-tile.locked{color:var(--ink-faint); border-style:dashed; border-color:var(--ink-faint); background:transparent; box-shadow:none; cursor:default; font-size:15px;}
.level-tile.locked:hover{transform:none;}
.level-tile-num{line-height:1;}

.level-tile-stars{display:flex; gap:1px; line-height:1;}
.level-tile-stars .star{font-size:12px; color:transparent; -webkit-text-stroke:1.2px var(--ink-faint);}
.level-tile-stars .star.filled{color:var(--gold); -webkit-text-stroke:1.2px var(--ink);}
/* звезда — SVG-иконка: пустая — только контур, заполненная — золото с обводкой */
.star .icon{width:1em; height:1em; vertical-align:middle; fill:transparent; stroke:var(--ink-faint); stroke-width:2; stroke-linejoin:round; paint-order:stroke;}
.star.filled .icon{fill:var(--gold); stroke:var(--ink);}

/* курс не оценивает результат звёздами — просто помечает пройденный урок */
.level-tile.completed{background:var(--jade-tint); border-color:var(--jade-fill); color:var(--jade);}
.level-tile-done{
  position:absolute; top:-8px; right:-8px;
  width:20px; height:20px; border-radius:50%;
  background:var(--jade-fill); color:#fff;
  border:2px solid var(--bg);
  display:flex; align-items:center; justify-content:center;
  font-size:11px; line-height:1;
}
.level-tile-gift{
  position:absolute; top:-8px; right:-8px;
  width:22px; height:22px; border-radius:50%;
  background:var(--gold);
  border:2px solid var(--edge);
  display:flex; align-items:center; justify-content:center;
  font-size:10px; line-height:1;
}

.result-stars{text-align:center; margin:14px 0;}
.result-stars .star .icon{stroke-width:1.6;}
.result-stars .star{font-size:40px; margin:0 3px; color:transparent; -webkit-text-stroke:2px var(--ink-faint);}
.result-stars .star.filled{color:var(--gold); -webkit-text-stroke:2px var(--ink);}

@media(max-width:700px){
  .level-grid{grid-template-columns:repeat(5, 1fr);}
}

/* ---------- игра «Категории» ---------- */
.sort-board{display:grid; grid-template-columns:1fr auto 1fr; align-items:stretch; gap:16px; margin-top:18px;}
.sort-zone{
  display:flex; align-items:center; justify-content:center;
  text-align:center;
  padding:28px 18px;
  min-height:140px;
  border:2px solid var(--edge);
  border-radius:var(--r-lg);
  background-color:var(--surface-2);
  color:var(--ink);
  cursor:pointer;
  transition:transform .15s ease, box-shadow .15s ease, background-color .2s ease;
}
.sort-zone-label{font-family:var(--font-display); font-weight:600; font-size:17px;}
.sort-zone:hover{transform:translate(-2px,-2px); box-shadow:4px 4px 0 var(--hover-edge); background:var(--gold-tint);}
.sort-zone.correct{background-color:var(--jade-fill); color:#fff;}
.sort-zone.wrong{background-color:var(--seal-fill); color:#fff;}
.sort-center{display:flex; align-items:center; justify-content:center; gap:10px; min-width:100px;}
.sort-center .chinese{font-size:3.2rem;}
.sort-hint{
  text-align:center;
  margin:24px 0 0;
  padding:22px 20px;
  border-radius:var(--r-lg);
  background:var(--surface-2);
  border:2px dashed var(--edge);
  visibility:hidden;
}
.sort-hint.visible{visibility:visible;}
.sort-hint-char{font-family:var(--font-hz); font-size:2.6rem; color:var(--ink); margin-bottom:6px;}
.sort-hint-pinyin{font-size:1.3rem; font-weight:500; color:var(--seal); margin-bottom:8px;}
.sort-hint-def{font-size:1.15rem; color:var(--ink-soft); margin-bottom:18px;}
@media(max-width:700px){
  .sort-board{grid-template-columns:1fr; grid-template-areas:"center" "left" "right";}
  .sort-center{grid-area:center;}
  .sort-zone:first-child{grid-area:left;}
  .sort-zone:last-child{grid-area:right;}
}

/* ---------- мемори ---------- */
.memory-grid{display:grid; grid-template-columns:repeat(4, 1fr); gap:10px; margin-top:16px;}
.memory-tile{aspect-ratio:1; padding:0; border:2px solid var(--edge); border-radius:var(--r-sm); background:none; cursor:pointer; perspective:600px;}
.memory-tile.matched{border-color:var(--jade-fill);}
.memory-tile-inner{position:relative; width:100%; height:100%; display:block; transform-style:preserve-3d; transition:transform .4s;}
.memory-tile.flipped .memory-tile-inner,
.memory-tile.matched .memory-tile-inner{transform:rotateY(180deg);}
.memory-tile-face{
  position:absolute; inset:0;
  display:flex; align-items:center; justify-content:center;
  padding:6px;
  border-radius:8px;
  backface-visibility:hidden;
  font-size:18px; font-weight:600; line-height:1.3;
  text-align:center;
  word-break:break-word;
  overflow:hidden;
}
.memory-tile-back{
  background-color:var(--seal-fill);
  background-image:radial-gradient(rgba(255,255,255,.18) 1.2px, transparent 1.4px);
  background-size:10px 10px;
  color:#FCF5E4; font-size:1.8rem;
}
.memory-tile-front{background:var(--surface); color:var(--ink); transform:rotateY(180deg);}
.memory-tile-front.hz{font-size:2.2rem;}
/* длинные переводы на квадратной карточке — мельче шрифт */
.memory-tile-front:not(.hz){font-size:11.5px; line-height:1.2; font-weight:500;}
.memory-tile.matched .memory-tile-front{background:var(--jade-fill); color:#fff;}

/* ---------- коллекция карточек ---------- */
.collection-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(140px, 1fr)); gap:14px; margin-top:14px;}
.collectible-card{
  display:block; width:100%;
  background:var(--surface-2);
  border:2px solid var(--edge);
  border-radius:var(--r);
  padding:18px 14px;
  text-align:center;
  font-family:inherit;
  color:var(--ink);
  cursor:default;
}
.collectible-card .glyph{font-size:2.4rem; margin-bottom:8px;}
.collectible-card .glyph-img{width:64px; height:64px; object-fit:cover; border-radius:var(--r-sm); border:2px solid var(--edge); margin-bottom:8px;}
.collectible-card h4{margin:0 0 4px; font-size:15px; color:var(--ink);}
.collectible-card p{margin:0; font-size:12.5px; color:var(--ink-soft);}
.collectible-card.locked{filter:grayscale(1); opacity:.5; border-style:dashed;}
.collectible-card.locked .glyph{color:var(--ink-soft);}
.card-unlock .glyph-img{width:140px; height:140px;}

.card-zoomable{cursor:zoom-in; transition:transform .15s ease, box-shadow .15s ease;}
.card-zoomable:hover{transform:translate(-2px,-2px); box-shadow:4px 4px 0 var(--hover-edge);}

/* ---------- лайтбокс ---------- */
.card-lightbox{position:fixed; inset:0; background:rgba(22,22,22,.78); display:none; align-items:center; justify-content:center; padding:24px; z-index:200;}
.card-lightbox.open{display:flex;}
.card-lightbox-panel{
  position:relative;
  background:var(--surface);
  border:2px solid var(--card-accent, var(--edge));
  border-radius:var(--r-lg);
  padding:36px 30px 30px;
  max-width:420px; width:100%;
  text-align:center;
  max-height:90vh; overflow-y:auto;
  box-shadow:8px 8px 0 var(--gold);
}
.card-lightbox-panel img{width:100%; max-width:320px; aspect-ratio:1; object-fit:cover; border-radius:var(--r); border:2px solid var(--edge); margin-bottom:18px;}
.card-lightbox-glyph{font-size:8rem; line-height:1; margin-bottom:12px;}
.card-lightbox-panel h4{margin:0 0 8px; font-size:22px; color:var(--ink); font-family:var(--font-display); font-weight:600;}
.card-lightbox-panel p{margin:0; font-size:15px; color:var(--ink-soft); line-height:1.5;}
.card-lightbox-close{
  position:absolute; top:14px; right:14px;
  width:34px; height:34px; border-radius:50%;
  border:2px solid var(--edge);
  background:var(--surface);
  color:var(--ink);
  font-size:15px; cursor:pointer;
}
.card-lightbox-close:hover{background:var(--gold); color:#212121;}

@keyframes card-unlock{
  from{opacity:0; filter:blur(8px) grayscale(1); transform:scale(.85) translateY(14px);}
  to{opacity:1; filter:blur(0) grayscale(0); transform:scale(1) translateY(0);}
}
.card-unlock{max-width:280px; margin:20px auto 0; animation:card-unlock 1s ease-out both; position:relative;}
.card-unlock .seal-stamp{
  margin-top:10px;
  display:inline-block;
  font-family:var(--font-ui);
  font-size:11.5px; font-weight:700;
  letter-spacing:.06em; text-transform:uppercase;
  color:#fff;
  background:var(--seal-fill);
  border:2px solid var(--edge);
  border-radius:6px;
  padding:3px 10px;
  transform:rotate(-4deg);
}
.avatar-unlock-reveal .avatar-reveal{width:140px; height:140px; font-size:52px; margin:0 auto 8px;}
.banner-unlock-reveal .banner-reveal-media{position:static; width:100%; height:120px; border-radius:var(--r); margin-bottom:8px;}

/* ============================================================
   Лимиты и подписка
   ============================================================ */
.paywall-panel{text-align:center;}
.paywall-panel h3{margin-top:0;}
.ad-stub-panel{max-width:440px; margin:0 auto; text-align:center;}
.ad-stub-timer{font-size:48px; font-family:var(--font-display); font-weight:700; color:var(--seal); margin:20px 0;}

.plan-grid{display:grid; grid-template-columns:repeat(auto-fit, minmax(200px, 1fr)); gap:18px; margin:26px 0 30px;}
.plan-card{
  position:relative;
  display:flex; flex-direction:column; align-items:center; gap:6px;
  padding:28px 20px 22px;
  background:var(--surface);
  border:2px solid var(--edge);
  border-radius:var(--r-lg);
  text-align:center;
}
.plan-card-best{box-shadow:6px 6px 0 var(--gold); background:var(--gold-tint);}
.plan-badge{
  position:absolute; top:-13px;
  background:var(--seal-fill); color:#fff;
  font-size:11.5px; font-weight:700; letter-spacing:.04em;
  font-family:var(--font-ui);
  padding:3px 12px; border-radius:30px;
  border:2px solid var(--edge);
}
.plan-card h4{margin:6px 0 0; font-size:16px; color:var(--ink);}
.plan-price{font-size:32px; font-family:var(--font-display); font-weight:700; color:var(--ink); letter-spacing:-.02em;}
.plan-price-sub{font-size:13px; color:var(--ink-soft); margin-bottom:10px;}
/* промокод на странице подписки */
.plan-price-old{font-size:20px; color:var(--ink-faint); font-weight:600; text-decoration-thickness:2px;}
.promo-form{max-width:460px; margin:22px 0 0;}
.promo-form label{display:block; font-weight:700; font-size:14px; margin-bottom:6px;}
.promo-row{display:flex; gap:10px;}
.promo-row input{flex:1; min-width:0; padding:10px 14px; border:2px solid var(--edge); border-radius:10px; background:var(--surface); color:var(--ink); font:inherit; text-transform:uppercase; letter-spacing:.04em;}
.promo-row input::placeholder{text-transform:none; letter-spacing:0;}
.promo-status{margin:8px 0 0; font-size:14px;}
.promo-ok{color:var(--jade);}
.promo-bad{color:var(--seal);}

.perks-list{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:10px;}
.perks-list li{display:flex; align-items:flex-start; gap:10px; font-size:15px; line-height:1.45;}
.perks-check{
  flex-shrink:0;
  width:22px; height:22px; border-radius:50%;
  background:var(--jade-fill); color:#fff;
  display:flex; align-items:center; justify-content:center;
  font-size:12px; font-weight:700;
  margin-top:1px;
}

/* ============================================================
   Заметки и повторение
   ============================================================ */
.note-toggle-btn{
  display:inline-flex; align-items:center; gap:6px;
  padding:9px 18px; border-radius:var(--r);
  background:var(--surface); border:2px solid var(--edge);
  color:var(--ink); font-size:14px; font-weight:600; font-family:var(--font-ui);
  cursor:pointer;
  transition:background-color .2s ease, color .2s ease, transform .15s ease;
}
.note-toggle-btn:hover{background:var(--gold); color:#212121; transform:translateY(-1px);}
.note-toggle-btn.active{background:var(--seal-fill); color:#fff;}
.note-toggle-btn.active:hover{color:#fff; background:var(--seal-strong);}
.note-toggle-btn-compact{padding:6px 10px; font-size:15px;}

.notes-grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(220px, 1fr)); gap:16px; margin-top:18px;}
.note-card{background:var(--surface); border:2px solid var(--edge); border-radius:var(--r); padding:16px;}
.note-card-head{display:flex; align-items:center; justify-content:space-between; gap:10px;}
.note-card-char{font-size:2rem; text-decoration:none; color:var(--ink);}
.note-card-char:hover{color:var(--seal);}
.note-remove-btn{
  width:28px; height:28px; border-radius:50%;
  border:2px solid var(--edge); background:var(--surface);
  color:var(--ink-soft); font-size:12px; cursor:pointer;
  flex-shrink:0;
  transition:background-color .2s ease, color .2s ease;
}
.note-remove-btn:hover{background:var(--seal-fill); color:#fff;}
.note-card-pinyin{font-size:1rem; margin:4px 0 6px; color:var(--seal); font-weight:500;}
.note-card-def{margin:0 0 10px; font-size:14px; color:var(--ink-soft);}
.note-text-form{display:flex; flex-direction:column; gap:8px;}
.note-text-form textarea{
  resize:vertical; min-height:56px;
  padding:8px 10px; border-radius:var(--r-sm);
  border:1.5px solid var(--edge); background:var(--surface-2);
  color:var(--ink); font-family:var(--font-ui); font-size:13.5px;
}
.note-text-form textarea:focus{outline:none; box-shadow:3px 3px 0 var(--gold);}
.note-save-btn{align-self:flex-start; border:2px solid var(--edge); border-radius:var(--r-sm); padding:6px 14px; font-size:13px;}
.note-anim-btn{border:2px solid var(--edge); border-radius:var(--r-sm); padding:6px 14px; font-size:13px; margin-bottom:10px;}
.note-save-btn:hover, .note-anim-btn:hover{background:var(--gold); color:#212121;}
.note-card-writer{display:flex; justify-content:center; margin:4px 0 12px;}
.hanzi-target-sm{
  width:180px; height:180px;
  background-color:var(--paper-canvas);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cg stroke='%23F4143F' stroke-opacity='.3' stroke-width='1' stroke-dasharray='4 4' fill='none'%3E%3Cpath d='M0 50H100M50 0V100M0 0L100 100M100 0L0 100' vector-effect='non-scaling-stroke'/%3E%3C/g%3E%3C/svg%3E");
  background-size:100% 100%;
  border:2px solid var(--red);
  border-radius:6px;
}

.review-cta-panel{display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap;}
.review-cta-actions{display:flex; align-items:center; flex-wrap:wrap; gap:10px;}
.review-exercise-select{
  padding:10px 12px;
  border-radius:var(--r-sm);
  border:2px solid var(--edge);
  background:var(--surface);
  color:var(--ink);
  font-family:var(--font-ui);
  font-size:14px; font-weight:600;
  cursor:pointer;
}
.review-answer{text-align:center; margin-bottom:8px;}
.review-note-text{font-size:14px; font-style:italic; color:var(--ink-soft); margin:8px auto 0; max-width:480px;}

/* ---------- таблицы и тексты документов (оферта, политика) ---------- */
.panel h2{font-size:21px; margin-top:26px;}
.panel h2:first-child{margin-top:0;}
.panel ul, .panel ol{padding-left:22px;}
.panel li{margin-bottom:4px;}
table{border-collapse:collapse; width:100%;}
th, td{padding:10px 12px; border-bottom:1.5px solid var(--line); text-align:left;}
th{font-family:var(--font-ui); font-weight:700; font-size:13px; letter-spacing:.04em; text-transform:uppercase; color:var(--ink-soft);}

/* ============================================================
   Адаптив
   ============================================================ */

/* Бургер включается раньше остального мобильного макета: пунктов меню и
   бейджей (серия, лимит, профиль) много, и на средних ширинах они
   не должны переноситься на вторую строку. */
@media(max-width:1180px){
  .nav{grid-template-columns:auto 1fr; position:relative;}
  .nav-tools{justify-self:end;}
  .nav-toggle{display:inline-flex;}
  .nav-menu{
    display:none;
    position:absolute;
    top:calc(100% + 2px);
    left:0; right:0;
    flex-direction:column;
    align-items:stretch;
    gap:12px;
    background:var(--bg);
    border-bottom:2px solid var(--edge);
    padding:14px 20px 20px;
    box-shadow:0 18px 30px rgba(0,0,0,.12);
    z-index:40;
    max-height:calc(100vh - 80px);
    overflow-y:auto;
  }
  .nav-menu.nav-open{display:flex;}
  .nav-right{flex-direction:column; align-items:stretch; gap:4px; flex:none;}
  .nav-right a{padding:13px 14px; font-size:17px; border-radius:var(--r-sm); border:2px solid transparent;}
  .nav-right a:hover{background:var(--surface-2);}
  .nav-right a::after{display:none;}
  .nav-right a.active{background:var(--gold); color:#212121; border-color:var(--edge);}
  .nav-profile-link{display:block;}
  .auth{flex-wrap:wrap; justify-content:flex-start; gap:8px; border-top:2px solid var(--line); padding-top:14px;}
  .auth .btn-dark, .auth .nav-login{flex:1; justify-content:center;}
  .nav-login{border:2px solid var(--edge) !important; border-radius:var(--r) !important; text-align:center; padding:9px 16px !important; color:var(--ink) !important;}
  .auth .nav-avatar-link{display:none;}
  .nav-logout{margin-left:auto;}
  .nav-avatar-link.nav-avatar-quick{display:inline-flex;}
}

@media(max-width:980px){
  .grid-3, .grid-home{grid-template-columns:1fr 1fr;}
  .grid-home .card-feature{grid-column:span 2; grid-row:auto;}
  .lesson-list{grid-template-columns:1fr 1fr;}
  .footer-top{grid-template-columns:1fr; gap:36px;}
  .stat-strip{grid-template-columns:1fr 1fr;}
  .stat-strip-item:nth-child(2){border-right:none;}
  .stat-strip-item:nth-child(-n+2){border-bottom:2px solid var(--edge);}
}

@media(max-width:880px){
  .wrap{padding:0 20px;}
  main.wrap{padding-top:24px;}
  .hero{grid-template-columns:1fr; gap:34px; padding-top:10px;}
  .rice-grid-xl{width:min(230px, 64vw); box-shadow:7px 7px 0 var(--gold);}
  .yong{font-size:150px;}
  .yong-caption{margin-top:18px;}
  .grid{grid-template-columns:1fr;}
  .stat-row{grid-template-columns:1fr 1fr;}
  .stat-row-6, .stat-row-5, .stat-row-4{grid-template-columns:1fr 1fr;}
  .memory-grid{grid-template-columns:repeat(3, 1fr);}
  .quiz-options{grid-template-columns:1fr;}
  .review-cta-panel{flex-direction:column; align-items:stretch; text-align:center;}
  .steps-list{grid-template-columns:1fr;}
  .footer-cols{grid-template-columns:1fr 1fr; gap:28px 20px;}
  .footer-top{padding-top:40px; padding-bottom:30px;}
  .panel{padding:24px 20px;}
  .profile-banner{margin:-24px -20px 18px;}
  .card{padding:22px 20px 20px;}
  .card-feature{padding:28px 22px 24px;}
  .page-hero{padding:20px; gap:16px; min-height:0;}
  .page-hero-glyph{width:68px; height:68px; font-size:44px;}
  .section-head{margin-top:48px;}
  .cta-band{padding:26px 22px;}
}

@media(max-width:640px){
  .grid-3, .grid-home{grid-template-columns:1fr;}
  .grid-home .card-feature{grid-column:auto;}
  .lesson-list{grid-template-columns:1fr;}
  .card-feature::before{font-size:220px; bottom:-40px;}
  .hero-actions{flex-direction:column; align-items:stretch;}
  .hero-actions .cta, .hero-actions .btn-outline{justify-content:center;}
  .stat-strip-num{font-size:27px;}
  .stat-strip-item{padding:16px 16px;}
  .page-hero-caption{font-size:15.5px;}
  .profile-panel > .profile-top-actions + .profile-head:not(.profile-head-on-banner){padding-right:0; padding-top:34px;}
  .profile-head{gap:14px;}
}

@media(max-width:480px){
  .logo .logo-word .hz{display:none;}
  .logo .py{font-size:17px;}
  .logo-seal{width:36px; height:36px; font-size:21px;}
  .nav-tools{gap:6px;}
  .theme-toggle, .nav-toggle{width:36px; height:36px;}
  .profile-head h1.small{font-size:24px;}
  .nav-username{display:none;}
  .stat-row, .stat-row-6, .stat-row-5, .stat-row-4{grid-template-columns:1fr 1fr;}
  .footer-bottom{gap:6px 16px;}
  .form-card{padding:28px 22px 24px;}
}

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

@media print{
  .site-header, .site-footer, .skip-link{display:none !important;}
  body{background:#fff; color:#000;}
}

/* ============================================================
   Иконки вместо эмодзи (includes/icons.php: icon('check'),
   shihanIcon('check') в скриптах) — цвет и размер берут от текста
   ============================================================ */
.icon{display:inline-block; width:1.15em; height:1.15em; vertical-align:-.2em; fill:currentColor; flex-shrink:0; pointer-events:none;}
.speak-btn .icon, .theme-toggle .icon, .nav-toggle .icon, .tones-play .icon,
.hz-step-btn .icon, .card-lightbox-close .icon, .dashboard-hint-close .icon,
.note-remove-btn .icon, .level-tile-gift .icon, .lock-badge .icon, .premium-badge .icon,
.perks-check .icon, .avatar-edit-badge .icon, .lesson-glyph .icon{vertical-align:middle;}
.theme-toggle .icon, .nav-toggle .icon{width:20px; height:20px;}
.speak-btn .icon{width:18px; height:18px;}
.speak-btn-sm .icon{width:15px; height:15px;}
.perks-check .icon{width:15px; height:15px;}
.level-tile-gift .icon{width:13px; height:13px; fill:#212121;}
.level-tile.locked .icon{width:16px; height:16px;}

/* ============================================================
   Приложение в RuStore: ссылка в подвале
   ============================================================ */
.footer-app{
  display:flex; flex-direction:column; align-items:flex-start; gap:14px;
  margin-top:26px; padding-top:22px; max-width:360px;
  border-top:1px solid var(--footer-line);
  color:var(--footer-ink); text-decoration:none;
}
.footer-app:focus-visible{outline:2px solid var(--gold); outline-offset:4px;}
.footer-app-head{display:flex; align-items:flex-start; gap:12px;}
.footer-app-head .icon{flex-shrink:0; width:26px; height:26px; margin-top:1px; color:var(--footer-soft); transition:color .15s ease;}
.footer-app-title{display:block; font-weight:700; font-size:15.5px; line-height:1.3;}
.footer-app-text{display:block; margin-top:3px; font-size:13.5px; line-height:1.45; color:var(--footer-soft);}
.footer-app-badge{display:block; margin-left:38px; width:150px; height:auto; opacity:.8; transition:opacity .15s ease;}
.footer-app:hover .footer-app-head .icon{color:var(--gold);}
.footer-app:hover .footer-app-badge{opacity:1;}

