/* Общая основа трёх вариантов: цвета задаёт каждый вариант своими переменными */
:root {
  --bg: #fbfaf7; --bg2: #f3f1ea; --ink: #16181d; --muted: #61666f; --line: #e4e0d6;
  --accent: #1f6b4f; --accent-ink: #fff; --accent-soft: #e3efe8;
  --sq-l: #efeadf; --sq-d: #9fb59c; --sq-last: rgba(255, 205, 40, .32); --sq-sel: rgba(31, 107, 79, .28);
  --arrow-g: #1d8a4e; --arrow-r: #d4402c; --arrow-b: #2d6fe0; --arrow-y: #e0a200;
  --font: 'Onest', system-ui, -apple-system, sans-serif;
  --r: 18px;
  --head: 64px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: var(--head); }
body { background: var(--bg); color: var(--ink); font: 400 17px/1.55 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .35; cursor: default; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.wrap { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
h1 { font-size: clamp(36px, 5.4vw, 64px); line-height: 1.04; letter-spacing: -.025em; font-weight: 700; }
h2 { font-size: clamp(30px, 3.8vw, 46px); line-height: 1.08; letter-spacing: -.02em; font-weight: 700; margin-bottom: clamp(24px, 3vw, 40px); }
h3 { font-size: 21px; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; }
.sec { padding: clamp(64px, 9vw, 120px) 0; }
.lead { font-size: clamp(18px, 1.6vw, 21px); color: var(--muted); max-width: 34em; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 24px; border-radius: 14px; background: var(--accent); color: var(--accent-ink); font-weight: 600; font-size: 16px; line-height: 1.2; text-align: center; transition: transform .15s, background-color .2s, box-shadow .2s; }
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.98); }
.btn.ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1.5px var(--ink); filter: none; }
.btn.sm { min-height: 44px; padding: 0 18px; font-size: 15px; border-radius: 12px; }
.btn.lg { min-height: 58px; padding: 0 28px; font-size: 17px; }
.btn svg { width: 22px; height: 22px; fill: currentColor; flex: none; }

/* Шапка */
.top { position: sticky; top: 0; z-index: 20; height: var(--head); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid transparent; transition: border-color .3s; }
.top.scrolled { border-color: var(--line); }
.top .wrap { height: 100%; display: flex; align-items: center; gap: 28px; }
.logo { font-weight: 700; font-size: 17px; letter-spacing: -.01em; white-space: nowrap; display: flex; align-items: center; gap: 10px; }
.logo svg { width: 30px; height: 30px; flex: none; }
.nav { display: flex; gap: 26px; margin-left: auto; font-size: 15px; color: var(--muted); }
.nav a:hover { color: var(--ink); }
@media (max-width: 860px) { .nav { display: none; } .top .btn { margin-left: auto; } }
@media (max-width: 420px) { .top .wrap { gap: 10px; } .logo { font-size: 15px; gap: 8px; } .logo svg { width: 24px; height: 24px; } .top .btn.sm { padding: 0 14px; } }

/* Плавающая шапка-пилюля (из третьего варианта): сверху на компьютере, таббаром с иконками внизу на телефоне */
.tabbar { position: fixed; z-index: 30; left: 50%; top: 16px; translate: -50% 0; display: flex; align-items: center; gap: 2px; padding: 6px; border-radius: 999px; background: rgba(30, 20, 14, .72); backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4); box-shadow: 0 8px 30px rgba(20, 12, 6, .22), inset 0 0 0 1px rgba(255, 240, 220, .08); }
.tabbar a { position: relative; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 999px; color: rgba(248, 238, 226, .74); font-size: 14.5px; font-weight: 500; white-space: nowrap; transition: background-color .25s, color .25s; }
.tabbar a:hover { color: #fff; }
.tabbar a svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: none; }
.tabbar a.on { background: rgba(248, 238, 226, .14); color: #fff; }
.tabbar .tb-logo { padding: 0 10px; }
.tabbar .tb-logo svg { display: block; width: 26px; height: 26px; fill: initial; stroke: none; }
.tabbar .tb-cta { background: #f3e6d4; color: #22180f; font-weight: 600; margin-left: 4px; }
.tabbar .tb-cta:hover, .tabbar .tb-cta.on { background: #fff; color: #22180f; }
.tb-n { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: #f3e6d4; color: #22180f; font-size: 12px; display: grid; place-items: center; }
.tb-n[hidden] { display: none; }
@media (max-width: 860px) {
  .tabbar { top: auto; bottom: calc(10px + env(safe-area-inset-bottom)); left: 10px; right: 10px; translate: none; justify-content: space-between; padding: 6px 8px; border-radius: 26px; }
  .tabbar .tb-logo, .tabbar .tb-wide { display: none; }
  .tb-n { position: absolute; top: 4px; right: calc(50% - 22px); min-width: 18px; height: 18px; font-size: 11px; }
  .tabbar a { flex-direction: column; gap: 3px; height: 54px; padding: 0 6px; font-size: 11px; border-radius: 18px; justify-content: center; flex: 1; }
  .tabbar a svg { display: block; width: 22px; height: 22px; }
  /* главное действие на телефоне: значок в кремовом кружке, подпись как у соседей — без тяжёлой плашки */
  .tabbar .tb-cta, .tabbar .tb-cta:hover, .tabbar .tb-cta.on { margin-left: 0; background: transparent; color: #f3e6d4; font-weight: 600; }
  .tabbar .tb-cta svg { width: 32px; height: 32px; margin: -5px 0; padding: 6px; border-radius: 50%; background: #f3e6d4; color: #22180f; }
  body:has(> .tabbar) { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
}

/* Появление при прокрутке */
.rv { opacity: 0; transform: translateY(22px); transition: opacity .8s cubic-bezier(.2, .8, .2, 1), transform .8s cubic-bezier(.2, .8, .2, 1); }
.rv.in { opacity: 1; transform: none; }
.res .rv:nth-child(2), .prog .rv:nth-child(2), .rev .rv:nth-child(2) { transition-delay: .08s; }
.res .rv:nth-child(3), .prog .rv:nth-child(3) { transition-delay: .16s; }
.prog .rv:nth-child(4) { transition-delay: .24s; }

/* Результаты учеников */
.res { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.res-i { background: var(--bg2); border-radius: var(--r); padding: 28px 26px 26px; display: flex; flex-direction: column; }
.res-n { font-size: clamp(48px, 5vw, 64px); font-weight: 700; line-height: 1; letter-spacing: -.03em; color: var(--accent); font-variant-numeric: tabular-nums; }
.res-u { font-weight: 600; margin-top: 6px; }
.res-t { color: var(--muted); margin-top: 14px; font-size: 16px; flex: 1; }
.res-who { margin-top: 18px; font-weight: 600; font-size: 15px; }
@media (max-width: 860px) { .res { grid-template-columns: 1fr; } }

/* Занятия */
.prog { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.prog-i { border: 1.5px solid var(--line); border-radius: var(--r); padding: 26px 24px 22px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.prog-i > p:not(.prog-meta) { color: var(--muted); font-size: 16px; flex: 1; }
.prog-meta { font-size: 14px; font-weight: 600; }
.prog-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 14px; margin-top: 6px; border-top: 1px solid var(--line); }
.prog-price { font-size: 15px; color: var(--muted); }
@media (max-width: 1080px) { .prog { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .prog { grid-template-columns: 1fr; } }

/* Отзывы */
.rev { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.rev-i { background: var(--bg2); border-radius: var(--r); padding: 30px 28px; display: flex; flex-direction: column; justify-content: space-between; gap: 22px; }
.rev-i blockquote { font-size: 18px; line-height: 1.55; }
.rev-i details { margin-top: 12px; }
.rev-i summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 15px; list-style: none; min-height: 44px; display: inline-flex; align-items: center; }
.rev-i summary::-webkit-details-marker { display: none; }
.rev-i details[open] summary { display: none; }
.rev-i figcaption { font-size: 15px; color: var(--muted); }
.rev-i figcaption b { color: var(--ink); margin-right: 6px; }
@media (max-width: 860px) { .rev { grid-template-columns: 1fr; } }

/* Подход */
.appr { list-style: none; padding: 0; display: grid; gap: 14px; counter-reset: a; }
.appr li { counter-increment: a; display: grid; grid-template-columns: 32px 1fr; gap: 10px; }
.appr li::before { content: counter(a); width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: 14px; display: grid; place-items: center; margin-top: 1px; }

/* Запись */
.cta-btns { display: flex; flex-wrap: wrap; gap: 12px; }
.cta-more { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 22px; color: var(--muted); font-size: 15px; }
.cta-more a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.cta-more a:hover { color: var(--ink); }
.cta-more svg { width: 20px; height: 20px; fill: currentColor; }
@media (max-width: 620px) { .cta-btns .btn { width: 100%; } }

.foot { padding: 28px 0 calc(28px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.foot .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ===== Доска ===== */
.cb { position: relative; aspect-ratio: 1; width: 100%; user-select: none; -webkit-user-select: none; touch-action: manipulation; border-radius: 10px; overflow: hidden; }
.cb-squares { position: absolute; inset: 0; display: grid; grid-template: repeat(8, 1fr) / repeat(8, 1fr); }
.cb-sq { position: relative; }
.cb-sq.l { background: var(--sq-l); }
.cb-sq.d { background: var(--sq-d); }
.cb-sq.last::after, .cb-sq.sel::after { content: ''; position: absolute; inset: 0; background: var(--sq-last); }
.cb-sq.sel::after { background: var(--sq-sel); }
.cb-sq.check::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle, rgba(220, 40, 30, .7) 0, rgba(220, 40, 30, .35) 40%, transparent 72%); }
.cb-sq.hint::before { content: ''; position: absolute; inset: 37%; border-radius: 50%; background: rgba(20, 30, 25, .22); z-index: 4; pointer-events: none; }
.cb-sq i { position: absolute; font: 600 clamp(8px, 1.4vw, 11px)/1 var(--font); font-style: normal; z-index: 1; }
.cb-sq.l i { color: var(--sq-d); }
.cb-sq.d i { color: var(--sq-l); }
.cb-f { right: 4%; bottom: 4%; }
.cb-r { left: 5%; top: 5%; }
.cb-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
/* плашка-подсказка с носиком над полем, как HintPlaque в RFL: белая, радиус 13, 13 px / 500, носик 12×6, появление пружиной от носика */
.cb-tip { position: absolute; z-index: 6; max-width: min(78%, 280px); width: max-content; padding: 6px 12px; border-radius: 13px; background: #fff; color: #111; font: 500 13px/1.35 var(--font); letter-spacing: -.2px; box-shadow: 0 10px 26px -10px rgba(20, 12, 6, .45); transform: translateY(calc(-100% - 8px)) scale(.86); transform-origin: var(--nose-x, 50%) 100%; opacity: 0; pointer-events: none; transition: transform .38s cubic-bezier(.2, 1.4, .4, 1), opacity .2s; }
.cb-tip.in { transform: translateY(calc(-100% - 8px)); opacity: 1; }
.cb-tip i { position: absolute; bottom: -5px; left: var(--nose-x, 50%); width: 12px; height: 6px; margin-left: -6px; background: #fff; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.cb-tip.below { transform: translateY(8px) scale(.86); transform-origin: var(--nose-x, 50%) 0; }
.cb-tip.below.in { transform: translateY(8px); }
.cb-tip.below i { bottom: auto; top: -5px; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
@media (prefers-reduced-motion: reduce) { .cb-tip { transition: opacity .2s; } }
/* администратор: плашку можно нажать и поправить комментарий, карандаш подсказывает это */
.cb-tip.edit { pointer-events: auto; cursor: pointer; }
.cb-tip.edit span::after { content: ''; display: inline-block; width: 13px; height: 13px; margin-left: 6px; vertical-align: -1px; background: #8a7f73; -webkit-mask: var(--pen) center / contain no-repeat; mask: var(--pen) center / contain no-repeat;
  --pen: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 20h4L19 9l-4-4L4 16z'/%3E%3C/svg%3E"); }
.ls-cm-b { width: 100%; }
.ls-cm-b[hidden], .ls-ed[hidden] { display: none; }
.ls-ed { display: grid; gap: 8px; }
.ls-ed-l { font-size: 14px; font-weight: 600; }
.ls-ed-l .fig { width: 1.15em; height: 1.15em; vertical-align: -3px; }
.ls-ed-t { width: 100%; border-radius: 14px; border: 1.5px solid var(--line); background: #fff; padding: 12px 14px; font: 16px/1.45 var(--font); color: var(--ink); resize: vertical; outline: none; }
.ls-ed-t:focus { border-color: var(--ink); }
.ls-ed-acts { display: flex; gap: 8px; }
.ls-ed-acts .btn { flex: 1; }
.ls-ed-err { color: #b3401f; font-size: 14px; }
.ls-ed-err:empty { display: none; }
.cb-arrows line { stroke-width: 15; stroke-linecap: round; opacity: 0; stroke-dasharray: var(--len) 999; stroke-dashoffset: var(--len); animation: cb-draw .5s .18s cubic-bezier(.3, .7, .3, 1) forwards; }
@keyframes cb-draw { 0% { opacity: .85; } to { opacity: .85; stroke-dashoffset: 0; } }
.cb-marks circle { fill: none; stroke-width: 7; opacity: 0; animation: cb-fade .4s .1s forwards; }
@keyframes cb-fade { to { opacity: .85; } }
.cb-pieces { position: absolute; inset: 0; z-index: 2; }
.cb-p { position: absolute; left: 0; top: 0; width: 12.5%; height: 12.5%; transition: transform .44s cubic-bezier(.25, .85, .3, 1), opacity .35s; will-change: transform; }
.cb-p svg { width: 100%; height: 100%; transition: transform .35s; filter: drop-shadow(0 1.5px 1px rgba(0, 0, 0, .18)); }
.cb-p.moving { z-index: 3; }
.cb-p.appear, .cb-p.gone { opacity: 0; }
.cb-p.gone svg { transform: scale(.7); }
.cb-p.drag { transition: none; z-index: 6; }
.cb.play .cb-p { cursor: grab; }
.cb-p.nope svg { animation: cb-nope .4s; }
@keyframes cb-nope { 20%, 60% { transform: translateX(-7%); } 40%, 80% { transform: translateX(7%); } }
@media (prefers-reduced-motion: reduce) { .cb-p, .cb-p svg { transition: none; } .cb-arrows line { animation-duration: .01s; } }

/* ===== Уроки: слева доска, справа нотация, как в ChessBase ===== */
.lessons { display: grid; gap: 18px; outline: none; }
.ls-tabs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin-inline: -16px; padding-inline: 16px; }
.ls-tabs::-webkit-scrollbar { display: none; }
.ls-tabs button { flex: none; text-align: left; padding: 10px 16px; border-radius: 14px; box-shadow: inset 0 0 0 1.5px var(--line); min-height: 52px; transition: background-color .2s, color .2s; }
.ls-tabs button b { display: block; font-weight: 600; font-size: 15px; }
.ls-tabs button span { display: block; font-size: 13px; color: var(--muted); }
.ls-tabs button[aria-selected=true] { background: var(--ink); color: var(--bg); box-shadow: none; }
.ls-tabs button[aria-selected=true] span { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.ls-main { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(20px, 3vw, 40px); align-items: start; }
.ls-left { display: grid; gap: 14px; width: clamp(420px, calc(100vh - 250px), 640px); width: clamp(420px, calc(var(--vh, 1vh) * 100 - 250px), 640px); }
.ls-what { min-height: 3.2em; font-size: 16px; color: var(--muted); }
.ls-what b { color: var(--ink); font-weight: 700; margin-right: 6px; white-space: nowrap; }
.ls-ctrl { display: flex; gap: 8px; }
.ls-next { flex: 1; }
.ib { width: 52px; height: 52px; flex: none; border-radius: 14px; box-shadow: inset 0 0 0 1.5px var(--line); display: grid; place-items: center; transition: box-shadow .2s; }
.ib:not(:disabled):hover { box-shadow: inset 0 0 0 1.5px var(--ink); }
.ib svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ib svg .fill { fill: currentColor; stroke: none; }

.ls-note { border-radius: var(--r); background: var(--bg2); padding: 24px 26px 28px; overflow-y: auto; height: min(calc(100vh - 150px), 760px); height: min(calc(var(--vh, 1vh) * 100 - 150px), 760px); outline: none; scrollbar-width: thin; }
.ls-title { font-weight: 700; font-size: 20px; line-height: 1.25; }
.ls-sub { font-size: 14px; color: var(--muted); margin-top: 2px; }
.ls-head { padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }
.ls-ask { background: var(--accent); color: var(--accent-ink); border-radius: 14px; padding: 14px 16px; font-weight: 600; margin-bottom: 16px; }
.ls-flow { display: grid; gap: 12px; font-size: 17px; line-height: 1.6; transition: filter .3s; }
.ls-flow.masked .mvs, .ls-flow.masked .var, .ls-flow.masked .cm { filter: blur(6px); pointer-events: none; user-select: none; }
.ls-flow .cm { font-size: 17px; line-height: 1.55; }
.ls-flow .mvs { font-weight: 700; }
.ls-flow .cmt { font-weight: 400; }
.ls-flow > .mvs + .mvs { margin-top: 4px; }
.mv { display: inline-flex; align-items: baseline; gap: 1px; padding: 1px 5px; margin: 0 -1px; border-radius: 7px; font-variant-numeric: tabular-nums; transition: background-color .15s, color .15s; white-space: nowrap; }
.mv:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.mv.on { background: var(--accent); color: var(--accent-ink); }
.mv .no { color: var(--muted); font-weight: 500; margin-right: 3px; }
.mv.on .no { color: inherit; opacity: .8; }
.fig { width: 1.4em; height: 1.4em; display: inline-block; vertical-align: -.36em; margin: 0 -1px 0 -3px; }
.mv.on .fig { filter: invert(1); }
.nag { text-decoration: none; margin-left: 2px; font-weight: 700; color: var(--accent); cursor: help; }
.mv.on .nag { color: inherit; }
.nag:not(.mg) { margin-left: 5px; font-weight: 500; }
.var { margin-left: 4px; padding: 2px 0 2px 14px; border-left: 2px solid var(--line); display: grid; gap: 4px; font-size: 15.5px; }
.var .mvs { font-weight: 400; }
.var .var { border-left-style: dashed; }
.cmi { color: var(--muted); font-size: .95em; }
.ls-what .fig { width: 1.15em; height: 1.15em; }
@media (max-width: 900px) {
  .ls-main { grid-template-columns: 1fr; }
  .ls-left { width: 100%; min-width: 0; }
  .ls-note { height: auto; max-height: 52vh; max-height: calc(var(--vh, 1vh) * 52); padding: 18px 18px 22px; }
}

/* Чему учат шахматы: четыре качества, у каждого переход к уроку */
.skills { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.skill { display: flex; flex-direction: column; gap: 10px; padding: 26px 24px 22px; border-radius: var(--r); background: var(--bg2); }
.skill-n { font-size: 14px; font-weight: 700; color: var(--accent); }
.skill p { color: var(--muted); font-size: 16px; flex: 1; }
.skill-try { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; font-size: 15px; margin-top: 6px; }
.skill-try svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.skill-try:hover svg { transform: translateX(4px); }
.skills-lead { margin: -12px 0 32px; }
@media (max-width: 1080px) { .skills { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .skills { grid-template-columns: 1fr; } }

/* Проявление текста по словам: снизу и из лёгкого размытия */
/* без обрезающей кромки: размытие не режется ровной линией */
.w { display: inline-block; vertical-align: top; }
.w > i { display: inline-block; font-style: inherit; transform: translateY(.35em); opacity: 0; filter: blur(5px); transition: transform .7s cubic-bezier(.2, .8, .2, 1), opacity .7s, filter .7s; transition-delay: calc(var(--d, 0ms) + var(--i) * var(--step, 18ms)); }
.in .w > i { transform: none; opacity: 1; filter: none; }
@media (prefers-reduced-motion: reduce) { .w > i { transition: none; transform: none; opacity: 1; filter: none; } }
