/* ============================================================
   Шахматы с нуля — визуальная система
   Современная: холодная бумага, тёмные чернила, цветной акцент,
   крупная типографика, доска как центральный объект.
   ============================================================ */

:root {
  --paper: #f2f4f7;
  --paper-2: #e9ecf2;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --ink: #12151c;
  --ink-soft: #2c3340;
  --muted: #667085;
  --muted-2: #98a1b3;
  --line: #dfe3ea;
  --line-soft: #eceff4;

  --acc: #2f5bff;
  --acc-deep: #1f3fd0;
  --acc-soft: #e8edff;
  --lime: #c6f24e;
  --lime-ink: #3b4a12;
  --coral: #ff6b4a;
  --coral-soft: #ffe9e3;
  --ok: #147a4f;
  --ok-soft: #e4f5ec;
  --err: #c0392b;
  --err-soft: #fdedea;

  --sq-light: #eeeee2;
  --sq-dark: #7fa650;
  --sq-move: #2f5bff;
  --sq-check: #ff5a3c;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, ui-serif, serif;
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --shadow-1: 0 1px 2px rgba(18, 21, 28, .06), 0 1px 1px rgba(18, 21, 28, .04);
  --shadow-2: 0 18px 50px -24px rgba(18, 21, 28, .45);
  --sidebar: 252px;
  --ease: cubic-bezier(.22, .61, .36, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 85% -10%, rgba(47, 91, 255, .10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(198, 242, 78, .16), transparent 60%),
    var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--acc-soft); color: var(--acc-deep); }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 6px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.02em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

/* ---------- каркас ---------- */

.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }

.sidebar {
  position: sticky; top: 0; height: 100vh;
  padding: 22px 16px 18px;
  display: flex; flex-direction: column; gap: 20px;
  background: rgba(255, 255, 255, .72);
  backdrop-filter: saturate(150%) blur(14px);
  border-right: 1px solid var(--line);
  z-index: 20;
}

.brand { display: flex; flex-direction: column; gap: 6px; padding: 0 8px; }
.brand-mark { display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; letter-spacing: -.02em; }
.brand-mark .glyph { width: 34px; height: 34px; border-radius: 10px; background: var(--ink); color: var(--lime); display: grid; place-items: center; font-size: 20px; line-height: 1; }
.brand-mark em { font-style: normal; color: var(--acc); font-weight: 600; }
.brand-sub { font-size: 11.5px; color: var(--muted); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: .16em; color: var(--muted-2); padding: 0 10px; margin: 4px 0 6px; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--ink-soft); text-decoration: none; font-size: 13.5px; transition: background .16s var(--ease), color .16s var(--ease); width: 100%; text-align: left; }
.nav-item svg { width: 17px; height: 17px; flex: 0 0 17px; opacity: .7; }
.nav-item:hover { background: var(--paper-2); }
.nav-item.is-active { background: var(--ink); color: #fff; }
.nav-item.is-active svg { opacity: 1; color: var(--lime); }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.streak-box { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-md); padding: 12px 13px; }
.streak-box .row { display: flex; align-items: baseline; justify-content: space-between; }
.streak-n { font-size: 22px; font-weight: 700; line-height: 1; }
.streak-lbl { font-size: 11px; color: var(--muted); text-align: right; }
.streak-bars { display: flex; gap: 3px; margin-top: 10px; }
.streak-bars i { height: 5px; flex: 1; border-radius: 3px; background: var(--line); }
.streak-bars i.on { background: var(--acc); }
.sidebar-note { font-size: 11px; color: var(--muted-2); padding: 0 6px; line-height: 1.45; }

.main { min-width: 0; padding: 0 0 90px; }
.topbar { position: sticky; top: 0; z-index: 15; display: flex; align-items: center; gap: 14px; padding: 14px 36px; background: rgba(242, 244, 247, .78); backdrop-filter: saturate(150%) blur(12px); border-bottom: 1px solid var(--line-soft); }
.topbar .crumb { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.topbar .crumb b { color: var(--ink); font-weight: 600; }
.topbar .spacer { flex: 1; }
.search-btn { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 7px 12px 7px 10px; font-size: 13px; }
.search-btn svg { width: 14px; height: 14px; }
.search-btn kbd { font-family: var(--sans); font-size: 10.5px; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--muted-2); }

.view { max-width: 1120px; margin: 0 auto; padding: 30px 36px 0; }

/* ---------- типографика ---------- */

.display { font-size: clamp(30px, 4vw, 46px); line-height: 1.04; letter-spacing: -.035em; font-weight: 700; text-wrap: balance; }
.h2 { font-size: 22px; letter-spacing: -.025em; }
.eyebrow { font-size: 10.5px; text-transform: uppercase; letter-spacing: .18em; color: var(--muted-2); font-weight: 700; }
.lead { font-size: 16px; color: var(--ink-soft); line-height: 1.6; max-width: 64ch; }
.small { font-size: 12.5px; color: var(--muted); }
.tiny { font-size: 11px; color: var(--muted-2); }
.mono { font-family: var(--mono); font-size: .92em; }

/* ---------- карточки и кнопки ---------- */

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card-pad { padding: 20px 22px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 9px 16px; font-size: 13.5px; font-weight: 600; text-decoration: none; transition: transform .12s var(--ease), background .16s var(--ease), border-color .16s var(--ease); white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn--primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--primary:hover { background: #232a37; }
.btn--acc { background: var(--acc); border-color: var(--acc); color: #fff; }
.btn--acc:hover { background: var(--acc-deep); }
.btn--lime { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }
.btn--lime:hover { filter: brightness(.96); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn--ghost:hover { background: var(--paper-2); color: var(--ink); }
.btn--sm { padding: 6px 12px; font-size: 12.5px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.chip--acc { background: var(--acc-soft); border-color: #cfdaff; color: var(--acc-deep); }
.chip--lime { background: var(--lime); border-color: var(--lime); color: var(--lime-ink); }
.chip--coral { background: var(--coral-soft); border-color: #ffd2c7; color: #b23d24; }
.chip--ok { background: var(--ok-soft); border-color: #bfe6d1; color: var(--ok); }

.bar { display: block; height: 6px; border-radius: 4px; background: var(--paper-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--acc); border-radius: 4px; transition: width .5s var(--ease); }
.bar--lime > i { background: var(--lime); }

/* ---------- доска ---------- */

.cb {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 10px 30px -18px rgba(18, 21, 28, .55), 0 0 0 1px rgba(18, 21, 28, .14);
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
  background: var(--sq-light);
}
.cb-sq {
  position: relative; display: grid; place-items: center;
  cursor: pointer; border: 0; padding: 0; background: none;
  min-width: 0; min-height: 0;
}
.cb-sq.light { background: var(--sq-light); }
.cb-sq.dark { background: var(--sq-dark); }
.cb-sq.last::after { content: ""; position: absolute; inset: 0; background: rgba(198, 242, 78, .42); pointer-events: none; }
.cb-sq.sel::after { content: ""; position: absolute; inset: 0; background: rgba(47, 91, 255, .30); box-shadow: inset 0 0 0 2px var(--acc); pointer-events: none; }
/* Куда можно пойти: маленькая серая точка, как в привычных шахматных приложениях. */
.cb-sq.hint::before {
  content: ""; position: absolute; width: 28%; height: 28%; border-radius: 50%;
  background: rgba(18, 21, 28, .30); pointer-events: none; z-index: 2;
}
/* Взятие: серое кольцо по краю клетки, фигура остаётся видна. */
.cb-sq.hint.is-capture::before {
  width: 92%; height: 92%; border-radius: 50%;
  background: none; box-shadow: inset 0 0 0 5px rgba(18, 21, 28, .30);
}
/* Откуда ходим: тёплая жёлтая заливка под фигурой. */
.cb-sq.hint-from::after {
  content: ""; position: absolute; inset: 0;
  background: rgba(255, 205, 40, .38);
  box-shadow: inset 0 0 0 4px #ffb300;
  pointer-events: none;
}
/* Рекомендация «куда» при подсказке: яркая оранжевая клетка, мягко пульсирует. */
.cb-sq.hint.is-best::before, .cb-sq.best::before {
  inset: 4% !important; width: auto !important; height: auto !important; border-radius: 8px !important;
  background: rgba(255, 140, 0, .92) !important;
  box-shadow: inset 0 0 0 4px #c85a00, 0 0 0 3px rgba(255,255,255,.75) !important;
  animation: bestPulse 1.4s ease-in-out infinite;
  z-index: 3;
}
@keyframes bestPulse { 0%,100% { opacity: 1; } 50% { opacity: .6; } }
.cb-sq.check::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle, rgba(255, 90, 60, .85), rgba(255, 90, 60, 0) 72%); pointer-events: none; }

/* фигура — SVG, всегда по центру клетки: размер от ширины доски, а не от текста */
.cb-pc {
  width: 88%;
  height: 88%;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .28));
}
.cb-pc text { font-family: var(--sans); }

.cb-sq .coord { position: absolute; font-size: clamp(8px, 1.6vw, 11px); font-weight: 700; opacity: .6; pointer-events: none; line-height: 1; }
.cb-sq .coord.f { right: 3px; bottom: 2px; }
.cb-sq .coord.r { left: 3px; top: 2px; }
.cb-sq.light .coord { color: var(--sq-dark); }
.cb-sq.dark .coord { color: var(--sq-light); }

/* ---------- обзор ---------- */

.home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.home-date { font-size: 12px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; font-weight: 600; }
.home-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; margin-top: 22px; }

.continue { position: relative; overflow: hidden; padding: 24px 26px; display: flex; flex-direction: column; gap: 12px; background: var(--ink); color: #fff; border-color: var(--ink); }
.continue .eyebrow { color: rgba(255,255,255,.55); }
.continue h2 { font-size: 27px; line-height: 1.1; letter-spacing: -.03em; max-width: 22ch; color: #fff; }
.continue p { color: rgba(255,255,255,.72); max-width: 46ch; font-size: 14px; }
.continue .bar { background: rgba(255,255,255,.14); max-width: 320px; }
.continue .bar > i { background: var(--lime); }
.continue-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.lesson-numeral { position: absolute; right: 18px; bottom: -18px; font-size: 150px; font-weight: 800; letter-spacing: -.06em; color: rgba(255,255,255,.07); pointer-events: none; user-select: none; line-height: 1; }

.today { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.today-list { display: flex; flex-direction: column; gap: 8px; }
.today-item { display: flex; align-items: center; gap: 11px; padding: 10px 11px; border: 1px solid var(--line-soft); border-radius: var(--r-md); background: var(--surface-2); text-align: left; width: 100%; text-decoration: none; transition: border-color .15s var(--ease), background .15s var(--ease), transform .15s var(--ease); }
.today-item:hover { border-color: var(--line); background: #fff; transform: translateY(-1px); }
.today-item .dot { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); flex: 0 0 28px; color: var(--acc); }
.today-item .dot svg { width: 14px; height: 14px; }
.today-item .t { font-size: 13.5px; font-weight: 600; line-height: 1.3; display: block; }
.today-item .s { font-size: 11.5px; color: var(--muted); }
.today-item .go { margin-left: auto; color: var(--muted-2); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 16px; }
.stat { background: var(--surface); padding: 16px 18px; border-radius: var(--r-lg); border: 1px solid var(--line); }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.stat .v small { font-size: 13px; color: var(--muted-2); font-weight: 600; }
.stat .k { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin: 34px 0 12px; }

/* ---------- путь курса ---------- */

.path { display: flex; flex-direction: column; gap: 10px; }
.path-row { display: grid; grid-template-columns: 56px minmax(0, 1fr) 150px 20px; align-items: center; gap: 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); text-align: left; text-decoration: none; transition: border-color .15s var(--ease), transform .15s var(--ease), box-shadow .15s var(--ease); }
.path-row:hover { border-color: #c9d1dd; transform: translateY(-1px); box-shadow: var(--shadow-1); }
.path-row .n { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 15px; font-weight: 700; background: var(--paper-2); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.path-row.done .n { background: var(--lime); color: var(--lime-ink); }
.path-row.locked { opacity: .55; }
.path-row .ttl { font-size: 15.5px; font-weight: 650; line-height: 1.25; display: block; }
.path-row .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; display: block; }
.path-row .pw { display: flex; flex-direction: column; gap: 5px; }
.path-row .pct { font-size: 11px; color: var(--muted-2); font-variant-numeric: tabular-nums; font-weight: 600; }
.path-row .arw { justify-self: end; color: var(--muted-2); display: grid; }

.part { font-size: 11px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted-2); font-weight: 700; margin: 22px 0 8px; display: flex; align-items: center; gap: 10px; }
.part span { font-weight: 600; letter-spacing: 0; text-transform: none; font-size: 12px; color: var(--muted); }

/* ---------- урок ---------- */

.lesson-hero { display: flex; align-items: center; gap: 18px; padding-bottom: 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.lesson-hero .num { width: 74px; height: 74px; border-radius: 20px; display: grid; place-items: center; background: var(--ink); color: var(--lime); font-size: 26px; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; }
.lesson-hero .meta { flex: 1; min-width: 260px; }
.lesson-hero h1 { font-size: clamp(26px, 3.2vw, 36px); line-height: 1.06; letter-spacing: -.03em; margin: 2px 0 6px; }
.goals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.goal { font-size: 12.5px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; color: var(--ink-soft); }

.lesson-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; margin-top: 24px; }
.lesson-aside { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 12px; }
.aside-block { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); padding: 14px 15px; }
.aside-block h4 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted-2); margin-bottom: 8px; font-weight: 700; }
.aside-link { display: block; font-size: 13px; color: var(--ink-soft); padding: 4px 0; text-decoration: none; }
.aside-link:hover { color: var(--acc); }

.block { margin-bottom: 34px; }
.block-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.block-head h2 { font-size: 21px; letter-spacing: -.025em; }
.block-head .line { flex: 1; height: 1px; background: var(--line); }

.teacher { border-left: 4px solid var(--acc); }
.teacher p { font-size: 14.5px; line-height: 1.65; color: var(--ink-soft); max-width: 74ch; }
.teacher p + p { margin-top: 12px; }
.teacher b { color: var(--ink); font-weight: 650; }

.g-card { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); margin-bottom: 10px; overflow: hidden; }
.g-card > summary { display: flex; align-items: center; gap: 10px; padding: 13px 16px; cursor: pointer; list-style: none; }
.g-card > summary::-webkit-details-marker { display: none; }
.g-card > summary .t { font-size: 15.5px; font-weight: 650; }
.g-card > summary .tag { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; font-weight: 600; }
.g-card > summary .plus { margin-left: auto; color: var(--muted-2); transition: transform .2s var(--ease); }
.g-card[open] > summary .plus { transform: rotate(180deg); }
.g-body { padding: 4px 16px 18px; border-top: 1px solid var(--line-soft); }
.g-body > * + * { margin-top: 10px; }
.g-body p { font-size: 14px; color: var(--ink-soft); max-width: 70ch; line-height: 1.6; }
.g-body strong, .g-body b { font-weight: 700; color: var(--ink); }
.g-rule { background: var(--surface-2); border: 1px dashed #cfd6e2; border-radius: var(--r-sm); padding: 10px 13px; font-size: 13.5px; line-height: 1.55; }
.g-rule b { color: var(--acc-deep); }
.g-note { font-size: 12.5px; color: #3d4a12; background: #f2f9d9; border: 1px solid #dcecb0; border-radius: var(--r-sm); padding: 9px 12px; line-height: 1.5; }
.g-warn { font-size: 12.5px; color: #9d2f1d; background: var(--coral-soft); border: 1px solid #ffd2c7; border-radius: var(--r-sm); padding: 9px 12px; line-height: 1.5; }
.g-why { font-size: 13.5px; line-height: 1.6; color: var(--ink); background: var(--acc-soft); border-left: 3px solid var(--acc); border-radius: 0 var(--r-sm) var(--r-sm) 0; padding: 10px 13px; }
.g-why-t { display: block; font-size: 10.5px; text-transform: uppercase; letter-spacing: .14em; font-weight: 700; color: var(--acc-deep); margin-bottom: 4px; }

.g-prev { margin: 12px 0; }
.g-prev .cb { max-width: 280px; margin: 0 auto; }
.g-prev .cap { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 8px; }

.g-ex-head { font-size: 12.5px; color: var(--muted-2); font-weight: 700; }
ul.g-ex { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
ul.g-ex li { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); align-items: baseline; }
ul.g-ex li .de { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--ink); background: var(--paper-2); border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
ul.g-ex li .ru { font-size: 13px; color: var(--muted); }

table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; background: var(--surface); }
table.t th, table.t td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.t th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); font-weight: 700; background: var(--surface-2); }
table.t tr:last-child td { border-bottom: 0; }
table.t td:first-child { font-weight: 650; }
.table-wrap { border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden; }

.ex { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); padding: 16px; margin-bottom: 12px; }
.ex-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.ex-task { font-size: 14px; line-height: 1.55; }
.ex-task b { font-weight: 700; }
.ex-task .hintline { color: var(--muted); font-size: 12.5px; display: block; margin-top: 4px; }
.ex-grid { display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); gap: 18px; align-items: start; margin-top: 12px; }
.ex-side { display: flex; flex-direction: column; gap: 8px; }
.ex-line { font-size: 13px; color: var(--ink-soft); }
.ex-line b { font-weight: 700; }
.ex-solved { border-radius: var(--r-sm); background: var(--ok-soft); color: var(--ok); border: 1px solid #bfe6d1; padding: 9px 12px; font-size: 13px; font-weight: 600; }
.ex-miss { border-radius: var(--r-sm); background: var(--err-soft); color: var(--err); border: 1px solid #f6c9c2; padding: 9px 12px; font-size: 13px; line-height: 1.5; }

.quiz { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.quiz-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-bottom: 1px solid var(--line-soft); background: var(--surface-2); }
.quiz-body { padding: 20px 20px 22px; }
.q-prompt { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.q-text { font-size: 19px; font-weight: 650; line-height: 1.35; letter-spacing: -.015em; }
.q-text .blank { border-bottom: 2px solid var(--acc); padding: 0 10px; color: var(--acc); }
.q-opts { display: grid; gap: 8px; margin-top: 14px; }
.q-opt { display: flex; align-items: center; gap: 11px; text-align: left; padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); font-size: 14px; }
.q-opt:hover { border-color: var(--muted-2); }
.q-opt .k { width: 22px; height: 22px; border-radius: 7px; border: 1px solid var(--line); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--muted-2); flex: 0 0 22px; }
.q-opt.correct { border-color: #8fd0ae; background: var(--ok-soft); }
.q-opt.correct .k { border-color: #8fd0ae; color: var(--ok); }
.q-opt.wrong { border-color: #f0b2a6; background: var(--err-soft); }
.q-opt.wrong .k { border-color: #f0b2a6; color: var(--err); }
.q-fb { margin-top: 12px; font-size: 13px; display: none; line-height: 1.55; }
.q-fb.show { display: block; }
.q-fb .ok { color: var(--ok); font-weight: 700; }
.q-fb .no { color: var(--err); font-weight: 700; }
.q-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; }
.q-progress { display: flex; gap: 4px; }
.q-progress i { width: 18px; height: 4px; border-radius: 2px; background: var(--line); }
.q-progress i.done { background: var(--acc); }
.q-progress i.miss { background: var(--coral); }

/* ---------- фигуры ---------- */

.piece-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.piece-card { border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.piece-card .glyph { font-size: 40px; line-height: 1; color: var(--ink); }
.piece-card h3 { font-size: 17px; }
.piece-card .val { font-size: 11.5px; color: var(--muted); }
.piece-card p { font-size: 13px; color: var(--ink-soft); line-height: 1.55; }
.piece-card ul li { font-size: 12.5px; color: var(--muted); padding-left: 14px; position: relative; line-height: 1.5; }
.piece-card ul li::before { content: "→"; position: absolute; left: 0; color: var(--acc); }
.piece-card .cb { max-width: 240px; margin: 2px auto 0; }

/* ---------- тренажёр ---------- */

.trainer { max-width: 760px; margin: 0 auto; }
.trainer-top { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 14px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 7px 13px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.seg button.is-active { background: var(--ink); color: #fff; }
.session-bar { display: flex; gap: 4px; flex: 1; }
.session-bar i { flex: 1; height: 4px; background: var(--line); border-radius: 2px; }
.session-bar i.ok { background: var(--acc); }
.session-bar i.no { background: var(--coral); }

.pz { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-2); padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.pz-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pz-body { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 20px; align-items: start; }
.pz-side { display: flex; flex-direction: column; gap: 10px; }
.pz-goal { font-size: 16px; font-weight: 650; line-height: 1.3; }
.pz-meta { font-size: 12.5px; color: var(--muted); }

.session-done { text-align: center; padding: 34px 20px; }
.session-done .big { font-size: 40px; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.done-stats { display: flex; justify-content: center; gap: 26px; margin: 18px 0 22px; }
.done-stats .v { font-size: 24px; font-weight: 700; }
.done-stats .k { font-size: 11.5px; color: var(--muted); }

/* ---------- прогресс ---------- */

.prog-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 18px; }
.prog-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) 52px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.prog-row:last-child { border-bottom: 0; }
.prog-row .n { font-size: 14px; font-weight: 700; color: var(--muted-2); }
.prog-row .nm { font-size: 13px; }
.prog-row .pct { text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.heat { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; margin-top: 12px; }
.heat i { aspect-ratio: 1; border-radius: 3px; background: var(--paper-2); }
.heat i.l1 { background: #c9d6ff; }
.heat i.l2 { background: #93aaff; }
.heat i.l3 { background: var(--acc); }

/* ---------- методика ---------- */

.method { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.method-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; }
.method-item h4 { font-size: 15.5px; margin-bottom: 4px; }
.method-item p { font-size: 13px; color: var(--ink-soft); }
.callout { border: 1px solid var(--line); background: var(--surface); border-radius: var(--r-md); padding: 16px 18px; display: flex; gap: 14px; align-items: flex-start; }
.callout .mark { font-size: 26px; color: var(--acc); line-height: 1; font-weight: 800; }
.callout p { font-size: 13.5px; color: var(--ink-soft); }
.install-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.install-step { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); padding: 14px 15px; }
.install-step .n { font-size: 18px; font-weight: 800; color: var(--acc); }
.install-step .t { font-size: 13px; margin-top: 4px; }

/* ---------- поиск / оверлей / тост ---------- */

.overlay { position: fixed; inset: 0; background: rgba(18, 21, 28, .38); display: none; z-index: 60; padding: 10vh 20px 20px; backdrop-filter: blur(3px); }
.overlay.open { display: block; }
.palette { max-width: 600px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 30px 70px -30px rgba(0, 0, 0, .5); overflow: hidden; }
.field { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; flex: 1; }
.field svg { width: 15px; height: 15px; color: var(--muted-2); }
.field input { border: 0; outline: 0; background: none; font: inherit; font-size: 14px; width: 100%; color: var(--ink); }
.palette .field { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; max-width: none; padding: 15px 18px; }
.palette .field input { font-size: 16px; }
.palette-results { max-height: 52vh; overflow: auto; padding: 6px; }
.p-res { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 12px; border: 0; border-radius: 8px; background: none; font-size: 13.5px; }
.p-res:hover, .p-res.is-sel { background: var(--surface-2); }
.p-res .kind { margin-left: auto; font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); font-weight: 700; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; font-size: 13px; padding: 9px 16px; border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .2s var(--ease), transform .2s var(--ease); z-index: 80; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.empty { text-align: left; padding: 36px 20px; color: var(--muted); font-size: 14px; }

/* ---------- адаптив ---------- */

@media (max-width: 1060px) {
  .lesson-body { grid-template-columns: minmax(0, 1fr); }
  .lesson-aside { position: static; flex-direction: row; flex-wrap: wrap; }
  .aside-block { flex: 1; min-width: 180px; }
  .piece-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pz-body { grid-template-columns: minmax(0, 1fr); }
}

/* nav-autohide: меню убирается при скролле вниз и возвращается при скролле вверх */
@media (max-width: 860px) {
  .sidebar.nav-hidden { transform: translateY(130%); transition: transform .22s var(--ease); }
  .sidebar { transition: transform .22s var(--ease); }
  .nav-item { min-height: 54px; font-size: 9.5px; font-weight: 600; letter-spacing: 0; padding: 6px 2px; }
  .nav-item svg { width: 21px; height: 21px; }
  /* Бейдж хостинга живёт в iframe 64px внизу справа — меню поднимаем выше него. */
  .sidebar { bottom: calc(64px + env(safe-area-inset-bottom)); border-radius: 14px 14px 0 0; }
  .main { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }
  .nav-item svg { width: 22px; height: 22px; }
  .nav-item.is-active { background: var(--ink); color: #fff; }
  .nav-item.is-active svg { color: var(--lime); }
}

@media (max-width: 860px) {
  :root { --sidebar: 0px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: auto; flex-direction: row; align-items: center; padding: 8px; border-right: 0; border-top: 1px solid var(--line); background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px); gap: 2px; z-index: 40; }
  .brand, .sidebar .nav-label, .sidebar-foot { display: none; }
  .nav { flex-direction: row; width: 100%; justify-content: space-between; gap: 2px; }
  .nav-item { flex-direction: column; gap: 3px; font-size: 9px; padding: 6px 1px; justify-content: center; flex: 1 1 0; min-width: 0; white-space: nowrap; border-radius: 10px; }
  .nav-item[data-view="pieces"] { display: none; }
  .nav-item svg { width: 19px; height: 19px; flex: none; }
  .view { padding: 20px 14px 0; }
  .topbar { padding: 12px 14px; gap: 8px; }
  .topbar .crumb { white-space: nowrap; overflow: hidden; font-size: 11.5px; gap: 5px; min-width: 0; }
  .topbar .crumb b { overflow: hidden; text-overflow: ellipsis; }
  .search-btn span, .search-btn kbd { display: none; }
  .search-btn { padding: 8px; border-radius: 50%; }
  .main { padding-bottom: 90px; }
  .home-grid, .stats, .prog-grid, .method, .piece-grid { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .path-row { grid-template-columns: 48px minmax(0, 1fr) 18px; gap: 10px; }
  .path-row .pw { display: none; }
  .ex-grid { grid-template-columns: minmax(0, 1fr); }
  .install-steps { grid-template-columns: minmax(0, 1fr); }
  .cb-pc { font-size: min(10.5vw, 40px); }
  .lesson-numeral { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@supports (padding: env(safe-area-inset-bottom)) {
  .topbar { padding-top: calc(12px + env(safe-area-inset-top)); }
  @media (max-width: 860px) {
    .sidebar { padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
    /* Some hosts (Netlify free tier badge) draw a fixed banner bottom-right: keep nav above it. */
    #netlify-badge-holder, .netlify-badge { z-index: 39 !important; }
    .main { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
  }
}

/* ---------- netlify-badge-fix: баннер хостинга не должен перекрывать нижнее меню ---------- */
/* Баннер хостинга перекрывает нижнее меню — гасим его целиком (бесплатный тариф разрешает). */
/* HUD Netlify ставит бейдж внутрь srcdoc-iframe — гасим сам iframe. */
iframe[src*="netlify"], iframe[srcdoc*="netlify"], iframe[id*="netlify"], iframe[title*="Netlify"] { display: none !important; }
@media (max-width: 860px) {
  /* Поднимаем меню над баннером хостинга и оставляем место под него. */
  .sidebar { z-index: 45 !important; }
  body { padding-bottom: env(safe-area-inset-bottom); }
}

.hint-card {
  margin-top: 12px;
  border: 1px solid #d9e3b0;
  background: #f6fbe4;
  border-radius: var(--r-md);
  padding: 12px 14px;
}
.hint-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.hint-head b { font-size: 14px; }
.hint-body { font-size: 13.5px; line-height: 1.55; color: var(--ink-soft); }
.hint-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* Короткие подписи в нижнем меню на телефоне */
.lbl-short { display: none; }
@media (max-width: 860px) {
  .lbl-full { display: none; }
  .lbl-short { display: inline; }
}
