:root {
  --bg: #161512; --card: #262522; --card2: #312f2b; --card3: #3b3934; --line: rgba(255,255,255,.07);
  --text: #ecebe9; --muted: #a09d97; --dim: #77746e;
  --accent: #81b64c; --accent-d: #5e8f32; --accent-glow: rgba(129,182,76,.35);
  --red: #e5534b; --gold: #f2c14e; --blue: #5aa9e6;
  --light: #ebecd0; --dark: #739552;
  --lastL: #f5f682; --lastD: #b9ca43;
  --r: 16px;
  --ease: cubic-bezier(.2,.8,.2,1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { touch-action: pan-x pan-y; }
html { -webkit-touch-callout: none; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; color: var(--text); font: 15px/1.45 system-ui, -apple-system, "SF Pro Text", "Segoe UI", Roboto, sans-serif; }
body { background: radial-gradient(1200px 600px at 50% -200px, #2a2d22 0%, var(--bg) 60%) fixed, var(--bg); min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; border-radius: 10px; padding: 9px 16px; background: var(--card3); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  transition: transform .12s var(--ease), filter .15s, background .15s, box-shadow .15s; }
button:hover { filter: brightness(1.12); }
button:active { transform: scale(.96); }
button:disabled { opacity: .5; cursor: default; transform: none; }
button.primary { background: linear-gradient(180deg, #95c95e, var(--accent)); color: #fff; box-shadow: 0 3px 0 var(--accent-d), 0 6px 18px var(--accent-glow); text-shadow: 0 1px 1px rgba(0,0,0,.25); }
button.primary:active { box-shadow: 0 1px 0 var(--accent-d); transform: translateY(2px); }
button.danger { background: #5a2624; color: #ffd9d6; }
button.ghost { background: transparent; color: var(--muted); }
button.ghost:hover { background: rgba(255,255,255,.06); color: var(--text); }
button.small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
button.big { padding: 14px 22px; font-size: 17px; border-radius: 12px; }
button.icon { width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center; border-radius: 10px; }
input { background: #1c1b19; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; transition: border-color .15s, box-shadow .15s; }
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* Шапка */
.top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) 10px max(18px, env(safe-area-inset-left));
  background: rgba(22,21,18,.82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; letter-spacing: -.3px; }
.logo img { width: 30px; height: 30px; filter: drop-shadow(0 2px 6px rgba(129,182,76,.5)); }
.logo span b { color: var(--accent); }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a { padding: 7px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; transition: background .15s, color .15s; position: relative; display: inline-flex; align-items: center; gap: 7px; }
.nav a .ic { width: 19px; height: 19px; }
.nav a:hover { background: rgba(255,255,255,.05); color: var(--text); }
.nav a.on { color: var(--text); background: rgba(255,255,255,.07); }
.nav .badge { position: absolute; top: -2px; right: -2px; }
.nav a.on .ic { color: var(--accent); }
.spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 9px; padding: 4px 6px 4px 4px; border-radius: 12px; cursor: pointer; transition: background .15s; position: relative; }
.me:hover { background: rgba(255,255,255,.06); }
.me .nm { font-weight: 700; line-height: 1.1; }
.me .rt { font-size: 12px; color: var(--muted); }
.menu { position: absolute; right: 0; top: calc(100% + 8px); background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 6px; min-width: 210px;
  box-shadow: 0 16px 40px rgba(0,0,0,.5); animation: pop .18s var(--ease); z-index: 40; }
.menu button { display: flex; justify-content: flex-start; gap: 10px; width: 100%; text-align: left; background: transparent; font-weight: 500; }
.menu button .ic { color: var(--muted); }
.menu button:hover { background: rgba(255,255,255,.07); }
@media (max-width: 700px) {
  .top { padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) 6px max(10px, env(safe-area-inset-left)); gap: 6px; }
  .logo span { display: none; }
  .logo img { width: 28px; height: 28px; }
  .nav { margin-left: 0; flex: 1; justify-content: space-around; gap: 0; }
  .nav a { flex-direction: column; gap: 3px; padding: 6px 4px 4px; min-width: 58px; font-size: 11px; line-height: 1.1; border-radius: 12px; }
  .nav a .ic { width: 23px; height: 23px; }
  .nav a.on { background: rgba(129,182,76,.14); color: var(--text); }
  .nav .badge { top: 0; right: 8px; }
  .spacer { display: none; }
  .me { padding: 2px; }
  .me .ava { width: 34px !important; height: 34px !important; }
  .me .nm, .me .rt { display: none; }
}

main { max-width: 1180px; margin: 0 auto; padding: 20px max(18px, env(safe-area-inset-right)) calc(60px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); }
@media (max-width: 700px) { main { padding: 14px max(12px, env(safe-area-inset-right)) calc(40px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); } }

/* Анимации */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(129,182,76,.7); } 70% { box-shadow: 0 0 0 7px rgba(129,182,76,0); } 100% { box-shadow: 0 0 0 0 rgba(129,182,76,0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }
@keyframes bounceIn { 0% { opacity: 0; transform: scale(.7); } 60% { opacity: 1; transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes tick { 50% { opacity: .55; } }
@keyframes fadeIn { from { opacity: 0; } }
.enter > * { animation: fadeUp .45s var(--ease) both; }
.enter > *:nth-child(2) { animation-delay: .05s; } .enter > *:nth-child(3) { animation-delay: .1s; }
.enter > *:nth-child(4) { animation-delay: .15s; } .enter > *:nth-child(5) { animation-delay: .2s; }
.enter > *:nth-child(6) { animation-delay: .25s; } .enter > *:nth-child(n+7) { animation-delay: .3s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Аватарки */
.ava { position: relative; flex: none; border-radius: 22%; display: inline-block; }
.ava img, .ava .letter { width: 100%; height: 100%; border-radius: 22%; object-fit: cover; display: grid; place-items: center; }
.ava .letter { color: #fff; font-weight: 800; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.ava .on { position: absolute; right: -3px; bottom: -3px; width: 30%; height: 30%; max-width: 22px; max-height: 22px; min-width: 10px; min-height: 10px;
  background: var(--accent); border-radius: 50%; border: 3px solid var(--card); animation: pulse 2s infinite; }

/* Секции и карусели */
.section { margin-bottom: 28px; }
.sec-h { display: flex; align-items: center; gap: 10px; margin: 0 2px 12px; }
.sec-h h2 { margin: 0; font-size: 21px; letter-spacing: -.3px; }
.count { background: var(--card3); color: var(--muted); border-radius: 20px; min-width: 26px; height: 26px; padding: 0 8px; display: inline-grid; place-items: center; font-size: 13px; font-weight: 700; }
.sec-h .all { margin-left: auto; color: var(--muted); font-weight: 700; font-size: 15px; transition: color .15s; }
.sec-h .all:hover { color: var(--text); }
.sec-h .arrows { display: flex; gap: 6px; }
@media (hover: none), (max-width: 700px) { .sec-h .arrows { display: none; } }
.carousel { display: flex; gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; padding: 6px 2px 14px; margin: 0 -2px;
  scrollbar-width: none; overscroll-behavior-x: contain; }
.carousel::-webkit-scrollbar { display: none; }
.carousel > * { scroll-snap-align: start; flex: none; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.grid.games { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
@media (max-width: 500px) { .grid { grid-template-columns: 1fr 1fr; gap: 10px; } .grid.games { grid-template-columns: 1fr 1fr; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; }
.empty { color: var(--muted); padding: 22px; text-align: center; background: var(--card); border: 1px dashed rgba(255,255,255,.1); border-radius: var(--r); width: 100%; }

/* Карточка друга */
.fcard { width: 190px; background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line); border-radius: 20px; padding: 18px 14px 14px;
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 4px; position: relative;
  transition: transform .2s var(--ease), box-shadow .2s, border-color .2s; }
.grid .fcard { width: auto; }
.fcard:hover { transform: translateY(-4px); box-shadow: 0 14px 30px rgba(0,0,0,.35); border-color: rgba(255,255,255,.12); }
.fcard .ava { margin-bottom: 8px; }
.fcard .fname { font-weight: 800; font-size: 17px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcard .frating { font-size: 13px; color: var(--gold); font-weight: 700; }
.fcard .fstat { font-size: 14px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 10px; }
.fcard .fstat.online { color: var(--accent); font-weight: 600; }
.fcard button.primary, .fcard .btnrow { width: 100%; margin-top: auto; }
.fcard .x { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; padding: 0; border-radius: 8px; background: transparent; color: var(--dim); opacity: 0; transition: opacity .15s; }
.fcard:hover .x { opacity: 1; }
@media (hover: none) { .fcard .x { opacity: .7; } }
.fcard.add { justify-content: center; border-style: dashed; border-color: rgba(255,255,255,.14); background: transparent; cursor: pointer; min-height: 250px; }
.fcard.add .plus { width: 76px; height: 76px; border-radius: 22%; display: grid; place-items: center; font-size: 40px; color: var(--accent); background: rgba(129,182,76,.1); margin-bottom: 10px; transition: transform .25s var(--ease); }
.fcard.add:hover .plus { transform: rotate(90deg) scale(1.05); }
.btnrow { display: flex; gap: 6px; }
.btnrow button { flex: 1; padding: 8px 6px; }

/* Карточка партии */
.gcard { width: 240px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; }
.grid .gcard { width: auto; }
.gcard .mini { border-radius: 14px; overflow: hidden; border: 4px solid #4a4843; box-shadow: 0 8px 22px rgba(0,0,0,.35); transition: transform .22s var(--ease), box-shadow .22s; aspect-ratio: 1; background: #4a4843; }
.gcard:hover .mini { transform: translateY(-4px) scale(1.015); box-shadow: 0 16px 32px rgba(0,0,0,.45); }
.gcard.win .mini { border-color: #5d7f3a; } .gcard.loss .mini { border-color: #7a3936; } .gcard.mymove .mini { border-color: var(--accent); }
.mini svg { display: block; width: 100%; height: 100%; }
.gcard .gmeta { display: flex; align-items: center; gap: 10px; min-width: 0; }
.gcard .gtext { min-width: 0; flex: 1; }
.gcard .gname { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard .gname small { color: var(--muted); font-weight: 600; font-size: 13px; }
.gcard .gsub { font-size: 14px; font-weight: 700; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
@media (max-width: 500px) { .gcard .gname { font-size: 14px; } .gcard .gsub { font-size: 12px; } .gcard .gmeta .ava { display: none; } }
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 7px; padding: 1px 8px; font-size: 13px; font-weight: 800; }
.chip.win { background: rgba(129,182,76,.18); color: #9fd36a; }
.chip.loss { background: rgba(229,83,75,.16); color: #ff8a80; }
.chip.draw { background: rgba(255,255,255,.1); color: #ddd; }
.chip.turn { background: var(--accent); color: #fff; }
.red { color: var(--red) !important; }
.plus-d { color: #9fd36a; } .minus-d { color: #ff8a80; }

/* Герой и статистика */
.hero { display: flex; align-items: center; gap: 20px; padding: 22px; margin-bottom: 26px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #2f3a24 0%, #262522 55%); }
.hero::after { content: ""; position: absolute; right: -40px; top: -30px; width: 260px; height: 260px; background: url(/pieces/wN.svg) no-repeat center/contain; opacity: .06; transform: rotate(-12deg); pointer-events: none; }
.hero h1 { margin: 0; font-size: 26px; letter-spacing: -.5px; }
.hero .rating { display: flex; align-items: baseline; gap: 8px; margin-top: 2px; }

.hero .wdl { color: var(--muted); font-size: 14px; margin-top: 2px; }
.hero .cta { margin-left: auto; z-index: 1; }
@media (max-width: 700px) {
  .hero { flex-wrap: wrap; gap: 14px; padding: 18px; }
  .hero .cta { margin-left: 0; width: 100%; }
  .hero .cta button { width: 100%; }
}
.stats { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; }
@media (max-width: 800px) { .stats { grid-template-columns: 1fr; } }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi { background: var(--card2); border-radius: 12px; padding: 12px; }
.kpi b { display: block; font-size: 24px; letter-spacing: -.5px; }
.kpi span { color: var(--muted); font-size: 13px; }
.wdlbar { display: flex; height: 10px; border-radius: 6px; overflow: hidden; background: var(--card3); margin: 14px 0 8px; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; }
.spark { width: 100%; height: 130px; display: block; }
.spark path.line { stroke-dasharray: 3000; stroke-dashoffset: 3000; animation: draw 1.4s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* Заявки и приглашения */
.alerts { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.alert { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px; background: linear-gradient(90deg, rgba(129,182,76,.16), var(--card) 70%);
  border: 1px solid rgba(129,182,76,.3); flex-wrap: wrap; }
.alert.out { background: var(--card); border-color: var(--line); }
.alert .txt { flex: 1; min-width: 160px; }
.alert .txt small { display: block; color: var(--muted); }

/* Вход */
.auth { max-width: 400px; margin: 6vh auto; text-align: center; }
.auth .logo-big { width: 84px; height: 84px; margin: 0 auto 8px; display: block; filter: drop-shadow(0 6px 20px rgba(129,182,76,.55)); animation: bounceIn .7s var(--ease); }
.auth h1 { margin: 0 0 4px; font-size: 30px; letter-spacing: -.6px; }
.auth form { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; text-align: left; }
.seg { display: flex; background: #1c1b19; border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; background: transparent; color: var(--muted); }
.seg button.on { background: var(--card3); color: var(--text); box-shadow: 0 2px 8px rgba(0,0,0,.3); }
.err { color: #ff8a80; min-height: 20px; font-size: 14px; }

/* Модальное окно */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 14px; animation: fadeIn .2s; }
.modal .box { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 22px; width: 100%; max-width: 440px; max-height: 92vh; overflow-y: auto;
  box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: pop .25s var(--ease); }
.modal h2 { margin: 0 0 14px; font-size: 20px; display: flex; align-items: center; gap: 10px; }
.modal label { display: block; margin: 14px 0 8px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; }
@media (max-width: 600px) {
  .modal { align-items: flex-end; padding: 0; }
  .modal .box { border-radius: 22px 22px 0 0; max-width: none; animation: sheet .3s var(--ease); padding-bottom: max(22px, env(safe-area-inset-bottom)); }
}
@keyframes sheet { from { transform: translateY(100%); } }
.opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.opts.c3 { grid-template-columns: repeat(3, 1fr); }
.opts.c5 { grid-template-columns: repeat(5, 1fr); }
.opts.c2 { grid-template-columns: repeat(2, 1fr); }
.opts button { background: var(--card2); border: 2px solid transparent; padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.opts button small { color: var(--muted); font-weight: 500; font-size: 11px; }
.opts button.on { border-color: var(--accent); background: rgba(129,182,76,.15); }
.opts button img { width: 30px; height: 30px; }
.total { margin: 16px 0; padding: 12px; background: var(--card2); border-radius: 12px; text-align: center; color: var(--muted); }
.total b { color: var(--text); }
.mrow { display: flex; gap: 8px; justify-content: flex-end; }
.pick { display: flex; flex-direction: column; gap: 6px; }
.pick .row { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 12px; background: var(--card2); cursor: pointer; transition: background .15s, transform .15s; }
.pick .row:hover { background: var(--card3); transform: translateX(3px); }
.pick .row .t { flex: 1; min-width: 0; font-weight: 700; }
.pick .row small { color: var(--muted); display: block; font-weight: 500; }

/* Уведомления */
#toasts { position: fixed; right: 16px; top: calc(76px + env(safe-area-inset-top)); display: flex; flex-direction: column; gap: 10px; z-index: 60; max-width: calc(100vw - 32px); width: 380px; pointer-events: none; }
.toast { --tc: var(--accent); --tbg: rgba(129,182,76,.16);
  position: relative; pointer-events: auto; overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none;
  display: flex; gap: 12px; align-items: flex-start; padding: 13px 40px 15px 13px; color: var(--text);
  background: linear-gradient(135deg, rgba(255,255,255,.055), rgba(255,255,255,0) 55%), rgba(40,38,35,.94);
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border: 1px solid rgba(255,255,255,.09); border-radius: 16px;
  box-shadow: 0 18px 40px -8px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.06);
  animation: toastIn .42s cubic-bezier(.2,1.2,.3,1); transition: opacity .3s, transform .3s var(--ease), max-height .3s; }
.toast::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 70px; background: radial-gradient(circle at 30px 30px, var(--tbg), transparent 70%); pointer-events: none; }
.toast.k-ok { --tc: #8fd16a; --tbg: rgba(143,209,106,.18); }
.toast.k-err { --tc: #ff6b61; --tbg: rgba(255,107,97,.2); }
.toast.k-warn { --tc: #f2c14e; --tbg: rgba(242,193,78,.17); }
.toast.k-invite { --tc: #6db5ec; --tbg: rgba(109,181,236,.2); }
.toast.k-game { --tc: #95c95e; --tbg: rgba(149,201,94,.22); }
.toast.k-friend { --tc: #b48ae0; --tbg: rgba(180,138,224,.2); }
.toast .tic { position: relative; flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--tc);
  background: var(--tbg); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tc) 35%, transparent); }
.toast .tic .ic { width: 22px; height: 22px; }
.toast .tic.ava-ic { background: none; box-shadow: none; border-radius: 50%; }
.toast .tic.ava-ic::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; border: 2px solid var(--tc); animation: tPulse 1.6s ease-out infinite; }
.toast.k-invite .tic.ava-ic::after, .toast.k-game .tic.ava-ic::after { display: block; }
.toast .tic.ava-ic::after { display: none; }
.toast.notitle { align-items: center; }
.toast .tbody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; padding-top: 1px; }
.toast .tt { font-size: 14.5px; font-weight: 800; letter-spacing: -.1px; color: #fff; }
.toast .t { font-size: 13.5px; line-height: 1.4; color: #d6d4cf; overflow-wrap: anywhere; }
.toast .tt + .t { color: var(--muted); }
.toast .tb { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.toast .tb button { min-width: 84px; }
.toast .tx { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; padding: 0; border-radius: 8px; display: grid; place-items: center;
  background: transparent; box-shadow: none; color: var(--dim); opacity: .7; transition: background .15s, color .15s, opacity .15s; }
.toast .tx .ic { width: 15px; height: 15px; }
.toast .tx:hover { background: rgba(255,255,255,.08); color: var(--text); opacity: 1; }
.toast .tbar { position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: linear-gradient(90deg, color-mix(in srgb, var(--tc) 60%, transparent), var(--tc));
  transform-origin: left; animation: tBar linear forwards; opacity: .85; }
.toast.paused .tbar { animation-play-state: paused; }
.toast.drag { transition: none; cursor: grabbing; }
.toast.out { opacity: 0; transform: translateX(40px) scale(.96); }
@keyframes toastIn { from { opacity: 0; transform: translateX(46px) scale(.94); } }
@keyframes tBar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes tPulse { 0% { transform: scale(.95); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .toast, .toast .tic.ava-ic::after { animation: none; } }

/* ===== Партия ===== */
.game { display: grid; grid-template-columns: minmax(0, auto) 340px; gap: 22px; justify-content: center; align-items: start; }
@media (max-width: 960px) { .game { grid-template-columns: 1fr; justify-items: center; gap: 12px; } }
.boardwrap { width: min(680px, calc(100vh - 200px), calc(100vw - 24px)); min-width: 270px; }
.boardbox { position: relative; }
.board { position: relative; display: grid; grid-template-columns: repeat(8, 1fr); aspect-ratio: 1; border-radius: 8px; overflow: hidden;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; box-shadow: 0 12px 40px rgba(0,0,0,.55); }
.sq { position: relative; aspect-ratio: 1; }
.sq.l { background: var(--light); }
.sq.d { background: var(--dark); }
.sq.last.l, .sq.sel.l { background: var(--lastL); }
.sq.last.d, .sq.sel.d { background: var(--lastD); }
.sq.check { background: radial-gradient(circle, #ff3b30 0%, rgba(231,0,0,.75) 35%, rgba(169,0,0,0) 75%) !important; }
.sq img { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; -webkit-user-drag: none; }
.sq.mine { cursor: grab; }
.sq.tgt::after { content: ""; position: absolute; left: 50%; top: 50%; width: 32%; height: 32%; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(0,0,0,.16); pointer-events: none; z-index: 3; animation: dotIn .18s var(--ease); }
@keyframes dotIn { from { transform: translate(-50%, -50%) scale(0); } }
.sq.tgt.cap::after { width: 100%; height: 100%; background: radial-gradient(transparent 0 64%, rgba(0,0,0,.18) 65% 80%, transparent 81%); }
.sq.hover { box-shadow: inset 0 0 0 4px rgba(255,255,255,.75); }
.sq.dragfrom img { opacity: .3; }
.coord { position: absolute; font-size: clamp(9px, 1.6vw, 12px); font-weight: 800; pointer-events: none; z-index: 1; }
.coord.rk { left: 3px; top: 2px; }
.coord.fl { right: 4px; bottom: 1px; }
.sq.l .coord { color: var(--dark); }
.sq.d .coord { color: var(--light); }
.dragghost { position: fixed; pointer-events: none; z-index: 45; transform: translate(-50%, -50%); filter: drop-shadow(0 6px 8px rgba(0,0,0,.4)); }
.dragghost.touch { transform: translate(-50%, -50%); }
.promo { position: absolute; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; gap: 8px; z-index: 6; animation: fadeIn .15s; border-radius: 8px; }
.promo button { background: var(--light); padding: 6px; border-radius: 50%; width: 21%; aspect-ratio: 1; box-shadow: 0 8px 20px rgba(0,0,0,.4); animation: bounceIn .3s var(--ease) both; }
.promo button:nth-child(2) { animation-delay: .04s; } .promo button:nth-child(3) { animation-delay: .08s; } .promo button:nth-child(4) { animation-delay: .12s; }
.promo button:hover { background: #fff; transform: scale(1.08); }
.promo button img { width: 100%; height: 100%; }

.pbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 2px; }
.pinfo { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pinfo .who { min-width: 0; }
.pinfo .nm { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pinfo .nm small { color: var(--muted); font-weight: 600; }
.pinfo .caps { display: flex; align-items: center; height: 18px; }
.pinfo .caps img { width: 18px; height: 18px; margin-right: -6px; }
.pinfo .adv { color: var(--muted); font-size: 12px; margin-left: 9px; font-weight: 700; }
.clock { font: 800 26px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: #2b2a27; color: #8d8a84; padding: 8px 14px; border-radius: 10px; min-width: 112px; text-align: right;
  transition: background .25s, color .25s, transform .25s var(--ease); font-variant-numeric: tabular-nums; flex: none; }
.clock.run { background: #f1f0ee; color: #161512; transform: scale(1.04); box-shadow: 0 6px 18px rgba(0,0,0,.35); }
.clock.low.run { background: var(--red); color: #fff; animation: tick 1s infinite; }
@media (max-width: 600px) { .clock { font-size: 22px; min-width: 96px; padding: 7px 11px; } }

.side { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 680px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.status { padding: 16px; text-align: center; }
.status .big { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
.status .acts { display: flex; gap: 8px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.status .tc { color: var(--muted); font-size: 13px; margin-top: 6px; }
.turnpill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 30px; background: var(--card2); font-weight: 700; }
.turnpill.mine { background: rgba(129,182,76,.18); color: #a7dc72; }
.turnpill .dotc { width: 12px; height: 12px; border-radius: 50%; border: 1px solid rgba(255,255,255,.4); }
.moves { max-height: 330px; overflow-y: auto; display: grid; grid-template-columns: 44px 1fr 1fr; font-size: 15px; font-weight: 600; align-content: start; }
@media (max-width: 960px) { .moves { max-height: 150px; } }
.moves .n { color: var(--dim); padding: 6px 8px; background: rgba(0,0,0,.15); text-align: right; }
.moves .m { padding: 6px 12px; cursor: pointer; border-radius: 6px; margin: 1px 2px; transition: background .12s; }
.moves .m:hover { background: rgba(255,255,255,.07); }
.moves .m.cur { background: var(--accent); color: #fff; }
.navb { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.navb button { background: var(--card2); padding: 8px 0; }
.controls { display: flex; gap: 8px; }
.controls button { flex: 1; }
.offer { background: linear-gradient(90deg, rgba(242,193,78,.18), var(--card)); border: 1px solid rgba(242,193,78,.35); border-radius: 14px; padding: 12px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; animation: slideIn .3s var(--ease); }

/* Окно итога партии */
.result .box { text-align: center; }
.result .trophy { width: 88px; height: 88px; margin: 0 auto 8px; border-radius: 50%; display: grid; place-items: center; animation: bounceIn .6s var(--ease);
  background: radial-gradient(circle at 35% 30%, #4a4843, #2b2a27); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.result .trophy .ic { width: 46px; height: 46px; stroke-width: 1.8; }
.result .trophy.res-win { background: radial-gradient(circle at 35% 30%, #ffd86b, #c98b12); color: #fff; box-shadow: 0 10px 30px rgba(242,193,78,.4); }
.result .trophy.res-loss { color: #ff8a80; }
.result .trophy.res-draw, .result .trophy.res-muted { color: #ddd; }
.result h2 { justify-content: center; font-size: 26px; margin-bottom: 4px; }
.result .vs { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 18px 0; }
.result .vs .p { display: flex; flex-direction: column; align-items: center; gap: 6px; font-weight: 700; max-width: 120px; }
.result .vs .p span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.result .vs .p.win .ava { box-shadow: 0 0 0 3px var(--accent), 0 0 24px var(--accent-glow); }
.result .delta { font-size: 34px; font-weight: 900; letter-spacing: -1px; animation: bounceIn .6s .2s var(--ease) both; }
.result .acts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.result .acts .wide { grid-column: 1 / -1; }

.badge { background: var(--red); color: #fff; border-radius: 10px; padding: 0 6px; font-size: 11px; font-weight: 800; line-height: 17px; min-width: 17px; text-align: center; display: inline-block; }
.loadmore { display: flex; justify-content: center; margin-top: 18px; }
.addform { display: flex; gap: 8px; }
.addform input { flex: 1; }
.pagehead { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.pagehead h1 { margin: 0; font-size: 26px; letter-spacing: -.5px; }

/* Аватарки-фигуры и ссылки на профиль */
.ava .letter.piece { overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), inset 0 -10px 18px rgba(0,0,0,.18); }
.ava .letter.piece img { width: 80%; height: 80%; object-fit: contain; border-radius: 0; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.ava.link { cursor: pointer; transition: transform .18s var(--ease), filter .18s; }
.ava.link:hover { transform: scale(1.05); filter: brightness(1.08); }
.ulink { cursor: pointer; transition: color .15s; }
.ulink:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
textarea { width: 100%; background: #1c1b19; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; resize: vertical; min-height: 70px; transition: border-color .15s, box-shadow .15s; }
textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ===== Профиль ===== */
.cap { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .6px; margin-bottom: 10px; }
.phero { display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "ava main rating" "ava actions actions"; gap: 6px 24px; align-items: start;
  padding: 24px; margin-bottom: 16px; position: relative; overflow: hidden; background: linear-gradient(135deg, #2f3a24 0%, #262522 60%); }
.phero::after { content: ""; position: absolute; right: -50px; bottom: -60px; width: 280px; height: 280px; background: url(/pieces/wK.svg) no-repeat center/contain; opacity: .05; transform: rotate(10deg); pointer-events: none; }
.pava { grid-area: ava; }
.pava .ava { box-shadow: 0 12px 30px rgba(0,0,0,.45); border-radius: 22%; animation: bounceIn .55s var(--ease) both; }
.pava .ava .on { max-width: 28px; max-height: 28px; border-width: 4px; }
.pmain { grid-area: main; min-width: 0; }
.pname-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pname-row h1 { margin: 0; font-size: 30px; letter-spacing: -.6px; overflow-wrap: anywhere; }
.tag { background: rgba(255,255,255,.08); color: var(--muted); font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 20px; }
.pstatus { color: var(--muted); font-weight: 600; margin-top: 2px; }
.pstatus.online { color: var(--accent); }
.pstatus .playing { color: var(--gold); }
.bio { margin: 10px 0 0; max-width: 560px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; }
.empty-bio { color: var(--dim); font-style: italic; cursor: pointer; border: 1px dashed rgba(255,255,255,.14); border-radius: 10px; padding: 8px 12px; display: inline-block; transition: color .15s, border-color .15s; }
.empty-bio:hover { color: var(--text); border-color: var(--accent); }
.pmeta { display: flex; gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: 14px; margin-top: 12px; }
.prating { grid-area: rating; text-align: right; z-index: 1; }

.prating .cap { margin-bottom: 2px; }
.pactions { grid-area: actions; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; z-index: 1; }
@media (max-width: 700px) {
  .phero { grid-template-columns: auto 1fr; grid-template-areas: "ava rating" "main main" "actions actions"; padding: 18px; gap: 12px; }
  .pname-row h1 { font-size: 26px; }
  .prating { align-self: center; }
  .pactions button { flex: 1; }
  .pava .ava { width: 96px !important; height: 96px !important; }
}
.kgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; margin-bottom: 16px; }
@media (max-width: 800px) { .kgrid { grid-template-columns: repeat(3, 1fr); } }
.kgrid .kpi { background: var(--card); border: 1px solid var(--line); padding: 14px; transition: transform .2s var(--ease); }
.kgrid .kpi:hover { transform: translateY(-2px); }
.kpi.good b { color: #9fd36a; } .kpi.bad b { color: #ff8a80; }
.pgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 28px; }
@media (max-width: 800px) { .pgrid { grid-template-columns: 1fr; } }
.side-row + .side-row { margin-top: 16px; }
.sr-h { display: flex; justify-content: space-between; gap: 8px; font-weight: 700; align-items: center; flex-wrap: wrap; }
.sr-h img { width: 22px; height: 22px; vertical-align: -5px; }
.sr-h .muted { font-weight: 500; font-size: 13px; }
.wdlbar.thin { height: 8px; margin: 8px 0 6px; }
.h2h-row { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 6px 0 10px; }
.h2h .score { display: flex; align-items: baseline; gap: 10px; font-size: 40px; font-weight: 900; letter-spacing: -1px; }
.h2h .score span { color: var(--dim); }
.facts { display: flex; flex-direction: column; }
.facts > div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.facts > div:last-child { border-bottom: 0; }
.facts > div > span:last-child { font-weight: 700; text-align: right; }
.avaprev { display: flex; align-items: center; gap: 14px; }
.piecepick { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-top: 14px; }
.piecepick button { padding: 4px; background: var(--card2); border: 2px solid transparent; border-radius: 14px; aspect-ratio: 1; }
.piecepick button .letter { width: 100%; height: 100%; border-radius: 10px; display: grid; place-items: center; }
.piecepick button .letter img { width: 80%; height: 80%; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }
.piecepick button.on { border-color: var(--accent); background: rgba(129,182,76,.15); }
.colorpick { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.colorpick button { width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 3px solid transparent; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.colorpick button.on { border-color: #fff; transform: scale(1.1); }
.modal.still, .modal.still .box { animation: none; }

/* ===== Иконки ===== */
.ic { width: 1.2em; height: 1.2em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.22em; }
.ic-img { width: 1.45em; height: 1.45em; flex: none; filter: drop-shadow(0 1px 1px rgba(0,0,0,.3)); vertical-align: -.35em; }
button.big .ic-img { width: 1.6em; height: 1.6em; }
.modal h2 .ic, .modal h2 .ic-img { width: 26px; height: 26px; color: var(--accent); }
.opts button .ic { width: 22px; height: 22px; }
.opts button .ic.dice { width: 30px; height: 30px; stroke-width: 1.8; }
.opts.c2 button { flex-direction: row; flex-wrap: wrap; column-gap: 6px; }
.opts.c2 button small { flex-basis: 100%; }
.tag { display: inline-flex; align-items: center; gap: 5px; }
.tag .ic { width: 14px; height: 14px; }
.pmeta span { display: inline-flex; align-items: center; gap: 6px; }
.pmeta .ic { width: 16px; height: 16px; }
.ic.flame { color: #ff9a3c; }
.gsub .ic { width: 14px; height: 14px; }
.status .big { display: inline-flex; align-items: center; gap: 8px; }
.status .big .ic { width: 26px; height: 26px; }
.res-win { color: var(--gold); } .res-loss { color: #ff8a80; }
.navb button .ic { width: 20px; height: 20px; }
.fcard .x .ic { width: 16px; height: 16px; }
.sec-h .arrows .ic { width: 18px; height: 18px; }
.pick .row > .muted .ic { width: 20px; height: 20px; }

/* ===== Рейтинг: число + маленькая подпись elo справа снизу ===== */
.elo { display: inline-flex; align-items: flex-end; gap: .14em; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; white-space: nowrap; }
.elo small { font-size: max(9.5px, .48em); font-weight: 800; letter-spacing: .04em; opacity: .7; line-height: 1; margin-bottom: .08em; }
.elo.sm { font-size: 13px; color: var(--muted); font-weight: 700; }
.elo.sm small { font-size: 10px; }
.elo.gold { color: var(--gold); }
.elo.big { font-size: 32px; color: var(--gold); letter-spacing: -.5px; margin-top: 4px; }
.elo.huge { font-size: 42px; color: var(--gold); letter-spacing: -1px; }
.elo.kpi-elo { font-size: 24px; color: var(--gold); letter-spacing: -.5px; margin-bottom: 4px; }
.kpi .elo.kpi-elo + span { display: block; }
.frating .elo { font-size: 14px; color: var(--gold); }
.me .rt .elo { font-size: 12px; color: var(--muted); }
.prating .elo { justify-content: flex-end; }
@media (max-width: 700px) {
  #toasts { top: auto; bottom: calc(12px + env(safe-area-inset-bottom)); left: 12px; right: 12px; width: auto; max-width: none; flex-direction: column-reverse; }
  .toast { animation: toastUp .38s cubic-bezier(.2,1.2,.3,1); }
  .toast.out { transform: translateY(24px) scale(.96); }
}
@keyframes toastUp { from { opacity: 0; transform: translateY(30px) scale(.95); } }
.result .vs .p small { display: inline-flex; gap: 6px; align-items: flex-end; }
/* Двойное касание не масштабирует кнопки и доску */
button, a, .sq, .boardbox, .pbar, .navb, .controls { touch-action: manipulation; }
.boardwrap, .boardrow { touch-action: pan-y; }
img { -webkit-user-drag: none; -webkit-touch-callout: none; }
.board, .board .sq { touch-action: none; }
/* iPhone увеличивает страницу при фокусе на поле с шрифтом меньше 16px */
@media (max-width: 700px) { input, textarea { font-size: 16px; } }
.sq.tgt.castle::after { width: 100%; height: 100%; background: radial-gradient(transparent 0 64%, rgba(129,182,76,.75) 65% 80%, transparent 81%); }

/* ===== Анализ партии ===== */
button.review-btn { background: linear-gradient(180deg, #74b2ee, #4a86c8); color: #fff; box-shadow: 0 3px 0 #2f5f94, 0 6px 18px rgba(74,134,200,.3); text-shadow: 0 1px 1px rgba(0,0,0,.25); }
button.review-btn:active { box-shadow: 0 1px 0 #2f5f94; transform: translateY(2px); }
button.review-btn.big { padding: 13px 20px; font-size: 16px; }
.boardrow { display: flex; gap: 8px; align-items: stretch; }
.boardrow .boardbox { flex: 1; min-width: 0; }
.evalbar { width: 24px; flex: none; border-radius: 6px; overflow: hidden; background: #403d39; position: relative; display: flex; flex-direction: column; justify-content: flex-end;
  box-shadow: 0 12px 40px rgba(0,0,0,.45), inset 0 0 0 1px rgba(255,255,255,.06); }
.evalbar.flip { justify-content: flex-start; }
.evfill { background: #f1efe9; transition: height .55s var(--ease); }
.evtxt { position: absolute; left: 0; right: 0; text-align: center; font-size: 10px; font-weight: 900; letter-spacing: -.3px; }
.evtxt.w { bottom: 5px; color: #2b2a27; } .evtxt.b { top: 5px; color: #eee; }
.evalbar.flip .evtxt.w { top: 5px; bottom: auto; } .evalbar.flip .evtxt.b { bottom: 5px; top: auto; }
@media (max-width: 600px) { .evalbar { width: 16px; } .evtxt { font-size: 8px; } .boardrow { gap: 5px; } }
.arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 7; }
.arrows line { animation: fadeIn .3s; }
.clsmark { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; flex: none; box-shadow: 0 2px 5px rgba(0,0,0,.35); }
.clsmark b { font-size: 12px; font-weight: 900; letter-spacing: -.5px; line-height: 1; }
.clsmark .ic { width: 14px; height: 14px; stroke-width: 2.6; }
.clsmark[title="Лучший"] .ic { fill: #fff; stroke-width: 1.5; }
.clsmark.sm { width: 22px; height: 22px; }
.clsmark.xs { width: 17px; height: 17px; margin-right: 6px; vertical-align: -3px; box-shadow: none; }
.clsmark.xs b { font-size: 9px; } .clsmark.xs .ic { width: 10px; height: 10px; }
.clsmark.onboard { position: absolute; top: -7%; right: -7%; width: 44%; height: 44%; z-index: 8; animation: bounceIn .35s var(--ease) both; box-shadow: 0 3px 8px rgba(0,0,0,.45); border: 2px solid #fff; }
.clsmark.onboard b { font-size: clamp(9px, 2.4vw, 17px); }
.clsmark.onboard .ic { width: 58%; height: 58%; }
.rvtop { display: flex; justify-content: space-between; gap: 8px; }
.rvtitle { font-weight: 800; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rvtitle .muted { font-weight: 500; font-size: 13px; }
.rvhead { padding: 16px; }
.rvload { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 16px 0 4px; }
.rvknight { width: 64px; height: 64px; animation: hop 1s var(--ease) infinite; filter: drop-shadow(0 6px 10px rgba(0,0,0,.4)); }
@keyframes hop { 50% { transform: translateY(-10px) rotate(-8deg); } }
.progress { width: 100%; height: 10px; background: var(--card3); border-radius: 6px; overflow: hidden; }
.progress div { height: 100%; background: linear-gradient(90deg, #95c95e, #81b64c); transition: width .4s var(--ease); border-radius: 6px; }
.rvcomment { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--cc, var(--accent)); border-radius: var(--r); padding: 14px 16px; animation: fadeIn .2s; }
.rvcomment.start { border-left-color: #5b8fc7; }
.cm-title { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.cm-title .cm-eval { margin-left: auto; background: var(--card3); border-radius: 8px; padding: 3px 9px; font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; }
.cm-text { margin-top: 8px; line-height: 1.5; }
.cm-text .bestsan { color: #9fd36a; }
.cm-line { margin-top: 8px; font-size: 13px; color: var(--muted); display: flex; gap: 6px; align-items: flex-start; }
.cm-line .ic { color: var(--gold); flex: none; margin-top: 1px; }
.cm-line span { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.rvnav { border-top: 0; padding: 0; }
.rvnav button.primary { padding: 10px 0; }
.rvgraph { padding: 0; }
.evgraph { width: 100%; height: 110px; display: block; cursor: pointer; }
.rvsum { padding: 16px; }
.rvplayers { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 10px; margin: 14px 0 12px; }
.rvp { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.rvpn { font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rvacc-l { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; padding-bottom: 10px; }
.acc-pill { font-size: 22px; font-weight: 900; padding: 4px 14px; border-radius: 10px; font-variant-numeric: tabular-nums; letter-spacing: -.5px; animation: bounceIn .5s var(--ease) both; }
.acc-pill.w { background: #f1efe9; color: #161512; }
.acc-pill.b { background: #161512; color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.pbar .acc-pill { font-size: 16px; padding: 4px 10px; }
.rvtable { display: flex; flex-direction: column; gap: 2px; }
.rvrow { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; padding: 5px 0; border-top: 1px solid var(--line); }
.rvrow .n { text-align: center; font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.rvrow .lbl { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; }
.rvmoves .m { display: flex; align-items: center; }

/* ===== Подсказки и игра с компьютером ===== */
.opts.c6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.opts.c6 button small { font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
@media (max-width: 420px) { .opts.c6 { grid-template-columns: repeat(3, 1fr); } }
.modal label .ic { width: 15px; height: 15px; vertical-align: -3px; color: var(--gold); }
.hintnote { margin-top: 8px; font-size: 13px; color: var(--muted); background: rgba(91,143,199,.12); border: 1px solid rgba(91,143,199,.3); border-radius: 10px; padding: 8px 10px; display: flex; gap: 8px; align-items: flex-start; }
.hintnote .ic { color: #8fb8e6; flex: none; margin-top: 2px; }
.levels { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
@media (max-width: 480px) { .levels { grid-template-columns: repeat(3, 1fr); } }
.levels button { flex-direction: column; gap: 3px; background: var(--card2); border: 2px solid transparent; padding: 10px 4px; }
.levels button b { font-size: 13px; } .levels button small { color: var(--muted); font-weight: 500; font-size: 11px; }
.levels button.on { border-color: var(--accent); background: rgba(129,182,76,.15); }
.lvbar { display: flex; gap: 2px; align-items: flex-end; height: 16px; }
.lvbar i { width: 4px; border-radius: 2px; background: var(--accent); }
.lvbar i:nth-child(1) { height: 5px; } .lvbar i:nth-child(2) { height: 8px; } .lvbar i:nth-child(3) { height: 11px; } .lvbar i:nth-child(4) { height: 14px; } .lvbar i:nth-child(5) { height: 16px; background: var(--gold); }
.pick .botrow { background: linear-gradient(90deg, rgba(91,143,199,.2), var(--card2)); border: 1px solid rgba(91,143,199,.35); }
.hintchip { flex: 0 0 auto; width: auto; display: inline-flex; align-items: center; gap: 3px; background: rgba(242,193,78,.15); color: var(--gold); border-radius: 8px; padding: 4px 8px; font-weight: 800; font-size: 13px; margin-left: auto; margin-right: 8px; }
.hintchip .ic { width: 15px; height: 15px; }
.hintchip.empty { opacity: .45; }
.clock.off { display: grid; place-items: center; min-width: 56px; }
.clock.off .ic { width: 22px; height: 22px; }
button.hintbtn { background: linear-gradient(180deg, #f6cf6a, #e0a92c); color: #2b2110; box-shadow: 0 3px 0 #a87a17; }
button.hintbtn .hc { background: rgba(0,0,0,.18); border-radius: 6px; padding: 0 6px; font-size: 13px; }
button.hintbtn:disabled { opacity: .45; }
.hintbox { display: flex; align-items: center; gap: 10px; background: rgba(91,143,199,.15); border: 1px solid rgba(91,143,199,.4); border-radius: 14px; padding: 10px 14px; animation: slideIn .25s var(--ease); }
.hintbox > .ic { color: #8fb8e6; width: 22px; height: 22px; }
.hintbox b { color: #9fd36a; font-size: 16px; }
.hintbox .cm-eval { margin-left: auto; background: var(--card3); border-radius: 8px; padding: 3px 9px; font-weight: 800; font-size: 14px; }
.controls { flex-wrap: wrap; }

/* Доска: клетки всегда ровно 1/8, не зависят от содержимого (иначе Safari раздувает клетки при подсветке взятия) */
.board { grid-template-columns: repeat(8, minmax(0, 1fr)) !important; grid-template-rows: repeat(8, minmax(0, 1fr)) !important; width: 100%; aspect-ratio: 1 / 1; contain: layout size; }
.board .sq { aspect-ratio: auto; min-width: 0; min-height: 0; width: 100%; height: 100%; }
.board .sq::after { box-sizing: border-box; }
.sq.tgt.cap::after { width: 100% !important; height: 100% !important; max-width: 100%; max-height: 100%; }

/* ===== Тренер ===== */
.coach-ava { display: inline-grid !important; place-items: center; border-radius: 22%; background: radial-gradient(circle at 30% 25%, #9fd36a, #3f6b22); color: #fff; flex: none; }
.coach-ava .ic { width: 55%; height: 55%; fill: #fff; stroke-width: 1.4; }
.pick .coachrow { background: linear-gradient(90deg, rgba(129,182,76,.2), var(--card2)); border: 1px solid rgba(129,182,76,.35); }
.coachbox { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--cc, var(--accent)); border-radius: 14px; padding: 12px 14px; animation: slideIn .25s var(--ease); }
.coachbox > div { flex: 1; min-width: 0; }
.coachbox .bestsan { color: #9fd36a; }
.coachbox .clsmark { width: 30px; height: 30px; }
.coachbox .clsmark b { font-size: 14px; }
.coachbox.wait { color: var(--muted); border-left-color: #5b8fc7; }
.clsmark.pending { background: #5b8fc7; animation: pulseDot 1s infinite; }
@keyframes pulseDot { 50% { opacity: .45; } }
.clsmark.onboard.still { animation: none; }
.moves .m { display: flex; align-items: center; }
.clsmark.onboard.edge-r { right: 2%; }
.clsmark.onboard.edge-t { top: 2%; }
/* Крупнее значки внутри кружков */
.clsmark b { font-size: 14px; letter-spacing: -1px; }
.clsmark .ic { width: 17px; height: 17px; }
.clsmark.xs { width: 19px; height: 19px; }
.clsmark.xs b { font-size: 11px; } .clsmark.xs .ic { width: 13px; height: 13px; }
.clsmark.sm b { font-size: 13px; } .clsmark.sm .ic { width: 15px; height: 15px; }
.clsmark.onboard b { font-size: clamp(12px, 3.2vw, 22px); }
.clsmark.onboard .ic { width: 74%; height: 74%; }
.coachbox .clsmark b { font-size: 17px; } .coachbox .clsmark .ic { width: 20px; height: 20px; }
.clsmark[title="Лучший"] .ic { stroke-width: 1.2; }

/* ===== Плавные анимации доски ===== */
.sq { transition: background-color .35s ease; }
.sq img.moving { filter: drop-shadow(0 6px 6px rgba(0,0,0,.35)); }
.sq img { transition: filter .3s ease; }
.sq.tgt::after { animation: dotIn .32s cubic-bezier(.3,1.2,.5,1) both; }
@keyframes dotIn { from { opacity: 0; transform: translate(-50%, -50%) scale(.3); } }
.sq.tgt.cap::after, .sq.tgt.castle::after { animation: capIn .35s ease both; }
@keyframes capIn { from { opacity: 0; transform: translate(-50%, -50%) scale(1.25); } }
.sq.check { animation: checkPulse 1.4s ease-in-out infinite; }
@keyframes checkPulse { 50% { filter: brightness(1.15); } }
.clsmark.onboard { animation: badgeIn .6s cubic-bezier(.3,1.4,.5,1) .38s both; }
@keyframes badgeIn { from { opacity: 0; transform: scale(0) rotate(-30deg); } }
.arrows line { animation: arrowIn .5s ease both; }
@keyframes arrowIn { from { opacity: 0; } }
.evfill { transition: height .9s cubic-bezier(.45,.05,.2,1); }
.dragghost { transition: filter .2s; }
@media (prefers-reduced-motion: reduce) { .sq, .sq img, .evfill { transition: none; } .sq.check { animation: none; } }

/* ===== Обучение ===== */
a.btnlink { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 10px; padding: 9px 16px; background: var(--card3); font-weight: 600; color: var(--text); text-decoration: none; transition: transform .15s, filter .15s; }
a.btnlink.primary { background: linear-gradient(180deg, #95c95e, #81b64c); color: #fff; box-shadow: 0 4px 0 #5d8a32, 0 8px 22px rgba(129,182,76,.35); }
a.btnlink.big { padding: 14px 24px; font-size: 17px; }
a.btnlink.ghost { background: transparent; color: var(--muted); }
a.btnlink.small { padding: 6px 10px; font-size: 14px; }
a.btnlink:hover { filter: brightness(1.08); }
.lhero .lh-ic { width: 84px; height: 84px; border-radius: 22%; flex: none; display: grid; place-items: center; background: radial-gradient(circle at 30% 25%, #9fd36a, #3f6b22); box-shadow: 0 10px 26px rgba(0,0,0,.4); }
.lhero .lh-ic img { width: 76%; filter: drop-shadow(0 3px 4px rgba(0,0,0,.4)); animation: lhop 2.6s ease-in-out infinite; }
@keyframes lhop { 0%, 70%, 100% { transform: none; } 80% { transform: translateY(-8px) rotate(-6deg); } 90% { transform: translateY(0) rotate(2deg); } }
.lprog { height: 10px; background: var(--card3); border-radius: 6px; overflow: hidden; margin-top: 12px; max-width: 420px; }
.lprog div { height: 100%; background: linear-gradient(90deg, #95c95e, #81b64c); border-radius: 6px; transition: width .8s var(--ease); }
.lgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.lcard { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; color: var(--text); text-decoration: none;
  transition: transform .2s var(--ease), border-color .2s, background .2s; animation: lcardIn .45s var(--ease) both; }
@keyframes lcardIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.lcard:hover { transform: translateY(-2px); border-color: rgba(129,182,76,.5); }
.lcard .lc-ic { width: 46px; height: 46px; border-radius: 12px; background: var(--card3); display: grid; place-items: center; flex: none; }
.lcard .lc-ic img { width: 82%; }
.lcard .lc-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.lcard .lc-t small { color: var(--muted); font-size: 13px; }
.lcard .lc-st { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--card3); color: var(--muted); flex: none; }
.lcard .lc-st .ic { width: 15px; height: 15px; }
.lcard.done .lc-st { background: var(--accent); color: #fff; }
.lcard.done .lc-ic { background: rgba(129,182,76,.18); }
.lcard.next { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(129,182,76,.15); }
.lcard.next .lc-st { background: var(--accent); color: #fff; animation: pulseDot 1.6s infinite; }
.lnav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.lnav .muted { font-size: 13px; }
.lread { max-width: 720px; margin: 0 auto; padding: 22px; line-height: 1.6; }
.lread-h { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.lread-h img { width: 40px; height: 40px; }
.lread-h h1 { margin: 0; font-size: 24px; }
.ltext p { margin: 6px 0 12px; line-height: 1.55; }
.ltask { display: flex; align-items: center; gap: 8px; font-weight: 800; background: rgba(129,182,76,.14); border: 1px solid rgba(129,182,76,.35); border-radius: 12px; padding: 10px 12px; }
.ltask .ic { color: var(--accent); flex: none; }
.lstatus { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--muted); animation: fadeIn .25s; }
.lstatus.ok { color: #9fd36a; font-size: 17px; } .lstatus.bad { color: #ffb36b; }
.lstatus .ic { width: 20px; height: 20px; }
.lstarc .ic { color: var(--gold); fill: var(--gold); }
.controls .wide { grid-column: 1 / -1; width: 100%; }
.lstar { position: absolute; inset: 22%; display: grid; place-items: center; z-index: 3; pointer-events: none; color: #f2c14e; animation: starBob 1.6s ease-in-out infinite; }
.lstar .ic { width: 100%; height: 100%; fill: #f6cf5a; stroke: #a87a17; stroke-width: 1.2; filter: drop-shadow(0 3px 4px rgba(0,0,0,.35)); }
.lstar.onpiece { inset: auto 4% 4% auto; width: 38%; height: 38%; }
@keyframes starBob { 50% { transform: translateY(-6%) scale(1.08); } }
.sq.lhint { box-shadow: inset 0 0 0 4px #5b8fc7; animation: hintPulse 1s ease-in-out infinite; }
@keyframes hintPulse { 50% { box-shadow: inset 0 0 0 7px rgba(91,143,199,.6); } }
.board.shake { animation: bshake .45s; }
@keyframes bshake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.lvalues { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 14px 0; }
.lvalues div { background: var(--card3); border-radius: 12px; padding: 10px 4px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.lvalues img { width: 42px; height: 42px; } .lvalues b { font-size: 22px; color: var(--gold); } .lvalues span { font-size: 12px; color: var(--muted); }
@media (max-width: 520px) { .lvalues { grid-template-columns: repeat(3, 1fr); } }
.lrules { padding-left: 22px; } .lrules li { margin: 8px 0; }
.lconfetti { position: absolute; inset: 0; pointer-events: none; z-index: 20; overflow: visible; }
.lconfetti i { position: absolute; top: 55%; width: 10px; height: 14px; border-radius: 2px; opacity: 0; animation: conf 1.3s cubic-bezier(.2,.7,.4,1) both; }
@keyframes conf { 0% { opacity: 1; transform: translate(0, 0) rotate(0); } 100% { opacity: 0; transform: translate(var(--x), calc(var(--y) + 260px)) rotate(var(--r)); } }
.lwin { position: absolute; left: 50%; top: 50%; width: 110px; height: 110px; margin: -55px 0 0 -55px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #a6d86c, #5d8a32); color: #fff; display: grid; place-items: center; z-index: 19; pointer-events: none;
  box-shadow: 0 14px 40px rgba(0,0,0,.45); animation: winPop 1.6s cubic-bezier(.3,1.4,.5,1) .3s both; }
.lwin .ic { width: 60px; height: 60px; stroke-width: 3; }
@keyframes winPop { 0% { opacity: 0; transform: scale(0); } 25% { opacity: 1; transform: scale(1); } 75% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.3); } }
@media (max-width: 700px) {
  .nav a { min-width: 0; flex: 1; padding: 6px 2px 4px; font-size: 10.5px; }
  .lhero { flex-wrap: wrap; } .lhero .cta a { width: 100%; }
}

.game.lesson { display: grid; grid-template-columns: auto minmax(280px, 380px); grid-template-areas: "board top" "board bottom"; gap: 14px 22px; align-items: start; justify-content: center; }
.game.lesson .boardwrap { grid-area: board; }
.game.lesson .ltop { grid-area: top; }
.game.lesson .lbottom { grid-area: bottom; display: flex; flex-direction: column; gap: 10px; }
@media (max-width: 900px) {
  .game.lesson { grid-template-columns: 1fr; grid-template-areas: "top" "board" "bottom"; gap: 10px; }
  .game.lesson .boardwrap { margin: 0 auto; }
  .ltop.panel { padding: 12px 14px; }
  .ltop .lread-h img { width: 30px; height: 30px; } .ltop .lread-h h1 { font-size: 20px; }
  .ltop p { margin: 4px 0 8px; font-size: 14px; line-height: 1.45; }
  .ltask { padding: 8px 10px; font-size: 14px; }
}
.game.lesson { grid-template-rows: auto 1fr; }
.game.lesson .lbottom { align-self: start; }
.ltop.panel { padding: 16px 18px; }

/* ===== Карта прохождения ===== */
.lhud { display: flex; align-items: center; gap: 16px; padding: 18px; margin-bottom: 14px; background: linear-gradient(135deg, #2f3a24 0%, #262522 70%); }
.lhud .lh-ic { width: 72px; height: 72px; border-radius: 22%; flex: none; display: grid; place-items: center; background: radial-gradient(circle at 30% 25%, #ffd86b, #c98b12); box-shadow: 0 10px 26px rgba(0,0,0,.4); }
.lhud .lh-ic img { width: 76%; filter: drop-shadow(0 3px 4px rgba(0,0,0,.4)); animation: lhop 2.6s ease-in-out infinite; }
.lhud .lh-main { flex: 1; min-width: 0; }
.lhud h1 { margin: 0; font-size: 24px; letter-spacing: -.4px; }
.lhud .lprog { margin-top: 8px; }
.lh-stats { display: flex; gap: 8px; }
.lh-stats > div { display: flex; flex-direction: column; align-items: center; background: rgba(0,0,0,.25); border-radius: 12px; padding: 8px 12px; min-width: 66px; }
.lh-stats .ic { width: 20px; height: 20px; color: var(--gold); fill: var(--gold); }
.lh-stats .fl .ic { color: #ff9a3c; fill: #ff9a3c; }
.lh-stats b { font-size: 20px; line-height: 1.1; } .lh-stats span { font-size: 11px; color: var(--muted); text-align: center; }
@media (max-width: 560px) { .lhud { flex-wrap: wrap; } .lh-stats { width: 100%; } .lh-stats > div { flex: 1; } .lhud .lh-ic { width: 58px; height: 58px; } }
a.lgo { display: flex; width: min(420px, 100%); margin: 0 auto 6px; }
.lallok { text-align: center; color: var(--gold); font-weight: 800; display: flex; gap: 8px; justify-content: center; align-items: center; }
.lpath { position: relative; margin: 10px auto 40px; max-width: 100%; }
.lpath > svg { position: absolute; inset: 0; overflow: visible; }
.lp-all { fill: none; stroke: #3a3834; stroke-width: 10; stroke-linecap: round; stroke-dasharray: 2 18; }
.lp-done { fill: none; stroke: var(--accent); stroke-width: 10; stroke-linecap: round; stroke-dasharray: 2 18; filter: drop-shadow(0 0 6px rgba(129,182,76,.6)); }
.lbanner { position: absolute; left: 0; right: 0; height: 92px; border-radius: 18px; padding: 12px 16px; display: flex; flex-direction: column; justify-content: center;
  background: linear-gradient(135deg, var(--sc), color-mix(in srgb, var(--sc) 45%, #161512)); color: #fff; box-shadow: 0 8px 22px rgba(0,0,0,.35); z-index: 1; overflow: hidden; }
.lbanner::after { content: ""; position: absolute; right: -10px; bottom: -22px; width: 110px; height: 110px; background: url(/pieces/wN.svg) no-repeat center/contain; opacity: .15; transform: rotate(-12deg); }
.lbanner small { font-weight: 800; font-size: 12px; letter-spacing: .5px; opacity: .85; text-transform: uppercase; }
.lbanner b { font-size: 20px; } .lbanner span { font-size: 13px; opacity: .85; }
.lbanner.done small::after { content: "  ✓ пройдена"; }
.lnode { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; text-decoration: none; color: var(--text); z-index: 2; width: 120px; }
.lnode .ln-c { position: relative; width: 70px; height: 70px; border-radius: 50%; display: grid; place-items: center; background: var(--sc); box-shadow: 0 6px 0 color-mix(in srgb, var(--sc) 55%, #000), 0 10px 20px rgba(0,0,0,.35); transition: transform .15s; }
.lnode .ln-c img { width: 66%; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.lnode:active .ln-c { transform: translateY(4px); box-shadow: 0 2px 0 color-mix(in srgb, var(--sc) 55%, #000); }
.lnode .ln-t { margin-top: 10px; font-size: 13px; font-weight: 800; text-align: center; background: rgba(22,21,18,.85); padding: 2px 8px; border-radius: 8px; }
.lnode.locked .ln-c { background: #3a3834; box-shadow: 0 6px 0 #262522, 0 10px 20px rgba(0,0,0,.3); }
.lnode.locked .ln-c .ic { width: 28px; height: 28px; color: #77746e; }
.lnode.locked .ln-t { color: var(--dim); }
.lnode.locked.nope .ln-c { animation: bshake .4s; }
.lnode.cur .ln-c { animation: nodePulse 1.8s ease-in-out infinite; }
@keyframes nodePulse { 0%, 100% { box-shadow: 0 6px 0 color-mix(in srgb, var(--sc) 55%, #000), 0 0 0 0 color-mix(in srgb, var(--sc) 60%, transparent); } 50% { box-shadow: 0 6px 0 color-mix(in srgb, var(--sc) 55%, #000), 0 0 0 14px transparent; } }
.lnode.cur .ln-t { background: var(--sc); color: #fff; }
.lnode.boss .ln-c { width: 84px; height: 84px; }
.ln-crown { position: absolute; top: -16px; left: 50%; transform: translateX(-50%) rotate(-8deg); color: #ffd86b; }
.ln-crown .ic { width: 28px; height: 28px; fill: #ffd86b; stroke: #a87a17; stroke-width: 1.4; filter: drop-shadow(0 2px 2px rgba(0,0,0,.4)); }
.lstars { display: inline-flex; gap: 1px; }
.lstars i { display: inline-grid; color: #4a4843; }
.lstars i .ic { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.lstars i.on { color: #f6cf5a; }
.lstars.sm { margin-top: 3px; }
.lstars.big i .ic { width: 38px; height: 38px; }
.lstars.big i { animation: starPop .5s cubic-bezier(.3,1.6,.5,1) both; }
.lstars.big i:nth-child(2) { transform: translateY(-8px); }
@keyframes starPop { from { opacity: 0; transform: scale(0) rotate(-40deg); } }
.lchest { position: absolute; transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 16px; padding: 0; z-index: 2; color: #fff;
  background: linear-gradient(180deg, #c98b12, #8a5a08); box-shadow: 0 6px 0 #5f3e05, 0 10px 20px rgba(0,0,0,.35); }
.lchest .ic { width: 34px; height: 34px; }
.lchest.locked { filter: grayscale(1) brightness(.6); }
.lchest.ready { animation: chestWiggle 1.6s ease-in-out infinite; }
@keyframes chestWiggle { 0%, 60%, 100% { transform: translate(-50%, -50%); } 70% { transform: translate(-50%, -50%) rotate(-10deg); } 80% { transform: translate(-50%, -50%) rotate(10deg); } 90% { transform: translate(-50%, -50%) rotate(-6deg); } }
.lchest.open { background: linear-gradient(180deg, #4a4843, #2b2a27); box-shadow: 0 6px 0 #1c1b19; color: #f6cf5a; }
.lmascot { position: absolute; z-index: 3; width: 0; height: 0; cursor: pointer; }
.lmascot img { position: absolute; width: 54px; height: 54px; top: -40px; filter: drop-shadow(0 5px 6px rgba(0,0,0,.5)); animation: masIdle 2.4s ease-in-out infinite; }
.lmascot.right img { left: 58px; } .lmascot.left img { right: 58px; transform: scaleX(-1); }
.lmascot.left img { animation-name: masIdleL; }
@keyframes masIdle { 50% { transform: translateY(-6px) rotate(-4deg); } }
@keyframes masIdleL { 0%, 100% { transform: scaleX(-1); } 50% { transform: scaleX(-1) translateY(-6px) rotate(-4deg); } }
.lmascot.hop img { animation: masHop .5s cubic-bezier(.3,1.5,.5,1); }
@keyframes masHop { 40% { transform: translateY(-22px) rotate(-12deg); } }
.lbubble { position: absolute; top: -96px; width: 150px; background: #fff; color: #161512; font-size: 12.5px; font-weight: 700; line-height: 1.3; padding: 7px 10px; border-radius: 12px; box-shadow: 0 6px 16px rgba(0,0,0,.35); animation: fadeIn .4s; }
.lmascot.right .lbubble { left: 40px; } .lmascot.left .lbubble { right: 40px; }
.lbubble::after { content: ""; position: absolute; bottom: -6px; width: 12px; height: 12px; background: #fff; transform: rotate(45deg); }
.lmascot.right .lbubble::after { left: 26px; } .lmascot.left .lbubble::after { right: 26px; }
.bosstag { color: var(--gold); display: inline-flex; align-items: center; gap: 4px; } .bosstag .ic { width: 14px; height: 14px; fill: var(--gold); }
/* Итог урока */
.lresult { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lr-txt { display: flex; flex-direction: column; flex: 1; min-width: 120px; } .lr-txt b { font-size: 18px; color: #9fd36a; } .lr-txt .muted { font-size: 13px; }
.xpgain { background: linear-gradient(180deg, #74b2ee, #4a86c8); color: #fff; font-weight: 900; border-radius: 10px; padding: 5px 10px; animation: bounceIn .5s .7s both; }
.lquip { display: flex; align-items: center; gap: 10px; margin-top: 10px; background: rgba(255,255,255,.06); border-radius: 12px; padding: 8px 10px; font-weight: 600; font-size: 14px; }
.lquip img { width: 34px; height: 34px; flex: none; animation: masHop .6s .5s; }
.rankup { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; padding: 10px; border-radius: 12px; background: linear-gradient(135deg, rgba(242,193,78,.25), rgba(242,193,78,.08)); border: 1px solid rgba(242,193,78,.5); color: var(--gold); animation: bounceIn .6s 1s both; }
.rankup img { width: 30px; height: 30px; } .rankup b { color: #fff; }
/* Сундук */
.chestbox { text-align: center; }
.chest-anim { position: relative; width: 110px; height: 110px; margin: 4px auto 6px; border-radius: 24px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(180deg, #f6cf6a, #c98b12); box-shadow: 0 10px 30px rgba(242,193,78,.45); animation: chestOpen 1s cubic-bezier(.3,1.4,.5,1) both; }
.chest-anim .ic { width: 64px; height: 64px; }
.chest-anim i { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: #ffe9a3; opacity: 0; animation: spark .9s ease-out .5s both; }
.chest-anim i:nth-child(2) { --dx: -70px; --dy: -50px; } .chest-anim i:nth-child(3) { --dx: 70px; --dy: -55px; } .chest-anim i:nth-child(4) { --dx: -80px; --dy: 20px; }
.chest-anim i:nth-child(5) { --dx: 80px; --dy: 25px; } .chest-anim i:nth-child(6) { --dx: 0; --dy: -85px; } .chest-anim i:nth-child(7) { --dx: 0; --dy: 70px; }
@keyframes chestOpen { 0% { transform: scale(.3) rotate(-20deg); } 30% { transform: scale(1.1) rotate(8deg); } 45% { transform: rotate(-8deg); } 60% { transform: rotate(5deg); } 100% { transform: none; } }
@keyframes spark { 0% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.4); } }
.chestbox .xpgain { display: inline-block; font-size: 18px; margin: 4px 0; }
.chestfact { display: flex; gap: 10px; text-align: left; margin-top: 12px; background: var(--card3); border-radius: 12px; padding: 12px; font-size: 14px; line-height: 1.45; }
.chestfact .ic { color: var(--gold); flex: none; margin-top: 2px; }
.lnode .ln-t { max-width: 130px; line-height: 1.2; }
.lbubble { top: -88px; }

/* Кнопка «Продолжить» поверх доски после урока */
.lcont { position: absolute; left: 50%; bottom: 8%; transform: translateX(-50%); z-index: 21; white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis;
  box-shadow: 0 4px 0 #5d8a32, 0 12px 30px rgba(0,0,0,.5); animation: lcontIn .55s cubic-bezier(.3,1.4,.5,1) 1.5s both; }
@keyframes lcontIn { from { opacity: 0; transform: translate(-50%, 30px) scale(.8); } to { opacity: 1; transform: translateX(-50%); } }
.lcont .ic { width: 20px; height: 20px; }
.controls button.big { padding: 14px; font-size: 16px; }
.game.lesson .board { touch-action: none; }
.controls .wide { flex: 1 1 100%; grid-column: 1 / -1; width: 100%; }

/* Анимации в уроках */
.sq img.capfade { z-index: 4; animation: capFade .55s ease forwards; pointer-events: none; }
@keyframes capFade { to { opacity: 0; transform: scale(.4) rotate(25deg); } }
.starburst { position: absolute; inset: 0; z-index: 7; pointer-events: none; display: grid; place-items: center; }
.starburst .ic { width: 70%; height: 70%; fill: #ffd86b; stroke: #a87a17; stroke-width: 1; animation: starFly .8s cubic-bezier(.3,.8,.4,1) forwards; }
@keyframes starFly { 0% { transform: scale(.6); opacity: 1; } 40% { transform: scale(1.5) rotate(25deg); opacity: 1; } 100% { transform: translateY(-120%) scale(.5) rotate(90deg); opacity: 0; } }
.starburst i { position: absolute; left: 50%; top: 50%; width: 7px; height: 7px; margin: -3.5px; border-radius: 50%; background: #ffe9a3; animation: starSpark .7s ease-out forwards; }
.starburst i:nth-child(2) { --dx: -36px; --dy: -24px; } .starburst i:nth-child(3) { --dx: 36px; --dy: -26px; } .starburst i:nth-child(4) { --dx: -40px; --dy: 18px; }
.starburst i:nth-child(5) { --dx: 40px; --dy: 20px; } .starburst i:nth-child(6) { --dx: 0; --dy: -44px; } .starburst i:nth-child(7) { --dx: 0; --dy: 40px; }
@keyframes starSpark { to { transform: translate(var(--dx), var(--dy)) scale(.3); opacity: 0; } }

/* Перетаскивание пальцем: фигура над пальцем, того же размера, клетка-цель в рамке */
.dragghost.touch { transform: translate(-50%, -50%) !important; }
.sq.hover { box-shadow: inset 0 0 0 4px rgba(255,255,255,.9), inset 0 0 0 999px rgba(255,255,255,.12); }

/* Стрелки каруселей не путать со стрелками на доске */
.sec-h .arrows { position: static; inset: auto; width: auto; height: auto; pointer-events: auto; z-index: auto; }
.navplay { display: none; }

/* ===== Плитки быстрых действий ===== */
.qtiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 26px; }
.qtile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 16px; border-radius: 16px; text-align: left; color: var(--text);
  background: var(--card); border: 1px solid var(--line); transition: transform .2s var(--ease), border-color .2s, background .2s; position: relative; overflow: hidden; }
.qtile:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--qc) 60%, transparent); background: color-mix(in srgb, var(--qc) 10%, var(--card)); }
.qtile b { font-size: 17px; margin-top: 8px; } .qtile small { color: var(--muted); font-size: 13px; font-weight: 500; }
.qt-ic { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; background: var(--qc); color: #fff; box-shadow: 0 6px 16px color-mix(in srgb, var(--qc) 40%, transparent); }
.qt-ic .ic { width: 24px; height: 24px; } .qt-ic img { width: 80%; }
.qt-friend { --qc: #81b64c; } .qt-bot { --qc: #5b8fc7; } .qt-coach { --qc: #e0a92c; } .qt-learn { --qc: #b48ae0; }
.qt-coach .qt-ic .ic { fill: #fff; }
@media (max-width: 700px) { .qtiles { grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; } .qtile { padding: 13px; } .qt-ic { width: 40px; height: 40px; } .qtile b { font-size: 15px; } .qtile small { font-size: 12px; } }

/* Виджет учёбы */
.lwidget { display: flex; align-items: center; gap: 14px; color: var(--text); text-decoration: none; transition: transform .2s var(--ease), border-color .2s; }
.lwidget:hover { transform: translateY(-2px); border-color: rgba(180,138,224,.5); }
.lw-ic { width: 56px; height: 56px; border-radius: 16px; flex: none; display: grid; place-items: center; background: radial-gradient(circle at 30% 25%, #ffd86b, #c98b12); }
.lw-ic img { width: 76%; }
.lw-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; } .lw-t small { color: var(--muted); font-size: 12px; } .lw-t b { font-size: 15px; }
.lw-t .lprog { margin-top: 4px; height: 8px; } .lw-t .lprog span { display: block; height: 100%; background: linear-gradient(90deg, #95c95e, #81b64c); border-radius: 6px; }
.lw-go { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; flex: none; }

/* ===== ПК: вертикальное меню слева ===== */
@media (min-width: 1000px) {
  :root { --sbw: 220px; }
  .top { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sbw); flex-direction: column; align-items: stretch; gap: 4px; padding: 18px 12px 14px;
    border-bottom: 0; border-right: 1px solid var(--line); background: rgba(19,18,16,.94); }
  .logo { padding: 2px 8px 16px; font-size: 18px; }
  .logo img { width: 32px; height: 32px; }
  .logo span { display: flex; flex-direction: column; line-height: 1.05; }
  .logo span b { font-size: 14px; }
  .nav { flex-direction: column; margin: 0; gap: 3px; }
  .nav a { padding: 11px 12px; font-size: 16px; gap: 12px; border-radius: 10px; }
  .nav a .ic { width: 22px; height: 22px; }
  .nav a.on { background: rgba(129,182,76,.14); }
  .nav a.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
  .nav .badge { top: 50%; right: 10px; transform: translateY(-50%); }
  .navplay { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; padding: 13px 12px; font-size: 16px; }
  .navplay img { width: 22px; height: 22px; }
  .spacer { display: block; flex: 1; }
  #userbox .me { padding: 8px; border-radius: 12px; background: rgba(255,255,255,.04); }
  #userbox .me > div:last-child { min-width: 0; }
  #userbox .me .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .top .menu { top: auto; bottom: calc(100% + 8px); left: 0; right: auto; }
  body { padding-left: var(--sbw); }
  main { max-width: 1260px; padding: 28px 32px 60px; }
  #toasts { right: 18px; }

  /* Главная: две колонки */
  .homegrid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 26px; align-items: start; }
  .hg-side .stats { grid-template-columns: 1fr; }
  .hg-side { position: sticky; top: 24px; }
}
/* Узкий ПК: меню из одних значков */
@media (min-width: 1000px) and (max-width: 1279px) {
  :root { --sbw: 84px; }
  .logo { justify-content: center; padding: 2px 0 16px; } .logo span { display: none; }
  .nav a { flex-direction: column; gap: 4px; padding: 9px 2px; font-size: 11px; text-align: center; }
  .nav a.on::before { left: -12px; }
  .nav .badge { top: 2px; right: 8px; transform: none; }
  .navplay { flex-direction: column; gap: 3px; padding: 10px 2px; font-size: 12px; }
  #userbox .me { justify-content: center; } #userbox .me .nm, #userbox .me .rt { display: none; }
  .homegrid { grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
}
@media (min-width: 1000px) {
  .hg-side, .hg-main { min-width: 0; }
  .hg-side .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .hg-side .kpi { min-width: 0; overflow: hidden; }
  /* Доска крупнее: сверху больше нет шапки */
  .game:not(.lesson) .boardwrap { width: min(820px, calc(100vh - 150px), calc(min(1260px, 100vw - var(--sbw)) - 64px - 370px)); }
  .game.lesson .boardwrap { width: min(820px, calc(100vh - 150px), calc(min(1260px, 100vw - var(--sbw)) - 64px - 410px)); }
}

/* ===== Карточка игрока на главной ===== */
.phero { display: flex; align-items: center; gap: 20px; padding: 20px 22px; margin-bottom: 16px; position: relative; overflow: hidden;
  background: linear-gradient(115deg, rgba(129,182,76,.16) 0%, rgba(129,182,76,.04) 38%, transparent 60%), var(--card); }
.phero::after { content: ""; position: absolute; right: 0; top: 0; bottom: 0; width: 46%; pointer-events: none; opacity: .05;
  background: conic-gradient(#fff 25%, transparent 0 50%, #fff 0 75%, transparent 0) 0 0 / 34px 34px;
  -webkit-mask: linear-gradient(90deg, transparent, #000 70%); mask: linear-gradient(90deg, transparent, #000 70%); }
.ph-who { display: flex; align-items: center; gap: 16px; min-width: 0; flex: 1; position: relative; z-index: 1; }
.ph-who .ava { box-shadow: 0 0 0 3px rgba(129,182,76,.35), 0 10px 24px rgba(0,0,0,.4); border-radius: 22px; flex: none; }
.ph-id { min-width: 0; }
.ph-greet { color: var(--muted); font-size: 13px; font-weight: 700; }
.ph-id h1 { margin: 1px 0 6px; font-size: 26px; letter-spacing: -.5px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-id h1 a { color: var(--text); }
.ph-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.ph-elo { background: rgba(242,193,78,.14); border: 1px solid rgba(242,193,78,.35); border-radius: 10px; padding: 3px 10px; font-weight: 900; font-size: 18px; color: var(--gold); }
.ph-elo .elo { color: var(--gold); }
.ph-tag { display: inline-flex; align-items: center; gap: 5px; background: rgba(255,255,255,.06); border-radius: 10px; padding: 5px 9px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.ph-tag .ic { width: 14px; height: 14px; }
.ph-stats { display: flex; gap: 10px; align-items: stretch; position: relative; z-index: 1; }
.ph-s { min-width: 84px; padding: 10px 12px; border-radius: 14px; background: rgba(0,0,0,.22); border: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ph-s b { font-size: 24px; line-height: 1.1; } .ph-s span { font-size: 12px; color: var(--muted); font-weight: 600; }
.ph-s.w b { color: #9fd36a; } .ph-s.d b { color: #b9b6b0; } .ph-s.l b { color: #f07a6a; }
.ph-ring { width: 74px; height: 74px; border-radius: 50%; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), rgba(255,255,255,.08) 0); }
.ph-ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--card); }
.ph-ring b, .ph-ring span { position: relative; } .ph-ring b { font-size: 17px; line-height: 1; } .ph-ring span { font-size: 10.5px; color: var(--muted); font-weight: 700; }
@media (max-width: 860px) {
  .phero { flex-direction: column; align-items: stretch; gap: 14px; padding: 16px; }
  .ph-stats { display: grid; grid-template-columns: auto 1fr 1fr 1fr; gap: 8px; }
  .ph-s { min-width: 0; padding: 8px 4px; } .ph-s b { font-size: 21px; } .ph-s span { font-size: 11px; }
  .ph-ring { width: 64px; height: 64px; }
  .ph-who .ava { width: 64px !important; height: 64px !important; }
  .ph-id h1 { font-size: 23px; }
}
.lstatus.note { color: #8fb8e6; }
.lquiz { display: flex; flex-direction: column; gap: 8px; }
.lquiz button { justify-content: flex-start; text-align: left; gap: 10px; padding: 12px 14px; background: var(--card2); border: 2px solid var(--line); font-weight: 700; white-space: normal; line-height: 1.3; }
.lquiz button:hover:not(:disabled) { border-color: rgba(129,182,76,.6); }
.lquiz .qk { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; background: var(--card3); flex: none; font-size: 13px; }
.lquiz button.ok { border-color: var(--accent); background: rgba(129,182,76,.18); opacity: 1; } .lquiz button.ok .qk { background: var(--accent); color: #fff; }
.lquiz button.no { border-color: rgba(236,75,59,.5); background: rgba(236,75,59,.1); opacity: .7; text-decoration: line-through; } .lquiz button.no .qk { background: var(--red); color: #fff; }
.lstatus.bad, .lstatus.note { display: block; line-height: 1.45; font-weight: 600; }
.lstatus.bad i, .lstatus.note i { display: block; margin-top: 4px; font-weight: 500; }

/* Значок фигуры в записи хода */
img.fig { width: 1.15em; height: 1.15em; vertical-align: -.22em; margin-right: 1px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.6)); }
/* Корзина на карточке партии с ботом */
.gcard { position: relative; }
.gdel { position: absolute; top: 8px; right: 8px; z-index: 3; width: 34px; height: 34px; padding: 0; border-radius: 10px; display: grid; place-items: center;
  background: rgba(22,21,18,.82); color: var(--muted); border: 1px solid var(--line); opacity: .9; transition: color .15s, background .15s, transform .15s; }
.gdel .ic { width: 18px; height: 18px; }
.gdel:hover { color: #fff; background: var(--red); transform: scale(1.06); }
.delbox .del-ic { width: 64px; height: 64px; border-radius: 50%; margin: 4px auto 10px; display: grid; place-items: center; background: rgba(236,75,59,.15); color: var(--red); }
.delbox .del-ic .ic { width: 30px; height: 30px; }
.gdel { background: rgba(0,0,0,.72); color: #fff; }

/* Значки бота и тренера вместо аватарки */
.ava.botava { display: inline-grid; place-items: center; flex: none; border-radius: 26%; background: #5b8fc7; box-shadow: 0 6px 16px rgba(91,143,199,.4); color: #fff; }
.ava.botava img { width: 80%; height: 80%; object-fit: contain; border-radius: 0; filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.ava.botava.coach { background: #e0a92c; box-shadow: 0 6px 16px rgba(224,169,44,.4); }
.ava.botava .ic { width: 56%; height: 56%; fill: #fff; stroke: #fff; }
.gsub.glevel { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.gsub.glevel b { color: var(--text); }
.gsub.glevel .lvbar { height: 16px; } .gsub.glevel .lvbar i { width: 3px; }

/* ===== Список партий как на chess.com: доска слева, соперник справа ===== */
.glist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 700px) { .glist { grid-template-columns: 1fr; gap: 10px; } }
.glist .gcard { width: auto; display: grid; grid-template-columns: 136px minmax(0, 1fr); gap: 14px; align-items: center; padding: 10px; border-radius: 14px;
  background: var(--card); border: 1px solid var(--line); transition: background .2s, border-color .2s, transform .2s var(--ease); }
.glist .gcard:hover { background: var(--card2); border-color: #4a4843; transform: translateY(-2px); }
.glist .gcard .mini { border-width: 0; border-radius: 6px; box-shadow: none; }
.glist .gcard:hover .mini { transform: none; box-shadow: none; }
.glist .gcard:not(.mymove) .mini { filter: saturate(.25) brightness(.72); }
.glist .gcard.mymove { border-color: rgba(129,182,76,.55); }
.glist .gcard .gmeta { flex-direction: column; align-items: flex-start; gap: 8px; }
.glist .gcard .gmeta .ava { display: inline-block !important; width: 58px !important; height: 58px !important; }
.glist .gcard .gmeta .ava.botava { display: inline-grid !important; }
.glist .gcard .gname { font-size: 15px; }
.glist .gcard .gsub { font-size: 13px; }
.glist .gdel { top: 10px; right: 10px; }
@media (max-width: 700px) { .glist .gcard { grid-template-columns: 112px minmax(0, 1fr); } .glist .gcard .gmeta .ava { width: 48px !important; height: 48px !important; } }

/* ===== Движение: одна система для всего сайта =====
   Правила: появление — короткое и спокойное (прозрачность + 8px), наведение — подъём на 2px,
   нажатие — лёгкое сжатие. Ничего не крутится и не прыгает без повода. */
:root { --t-fast: .14s; --t: .18s; --t-slow: .32s; --ease-out: cubic-bezier(.22,.8,.3,1); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes bounceIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
@keyframes reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes growX { from { transform: scaleX(0); } to { transform: none; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(129,182,76,.45); } 70%, 100% { box-shadow: 0 0 0 5px rgba(129,182,76,0); } }

/* Появление страницы: блоки по очереди, быстро */
.enter > * { animation: rise var(--t-slow) var(--ease-out) both; }
.enter > *:nth-child(2) { animation-delay: .04s; } .enter > *:nth-child(3) { animation-delay: .08s; }
.enter > *:nth-child(4) { animation-delay: .12s; } .enter > *:nth-child(5) { animation-delay: .16s; }
.enter > *:nth-child(6) { animation-delay: .2s; } .enter > *:nth-child(n+7) { animation-delay: .22s; }
/* Главная: две колонки появляются секциями, а не одним большим куском */
.enter > .homegrid { animation: none; }
.enter > .homegrid .section { animation: rise var(--t-slow) var(--ease-out) both; animation-delay: .14s; }
.enter > .homegrid .hg-main .section:nth-child(2), .enter > .homegrid .hg-side .section:nth-child(1) { animation-delay: .18s; }
.enter > .homegrid .hg-main .section:nth-child(3), .enter > .homegrid .hg-side .section:nth-child(2) { animation-delay: .22s; }
/* Графики рисуются один раз при входе, а не при каждом обновлении данных */
.spark path.line { stroke-dasharray: none; stroke-dashoffset: 0; animation: none; }
.enter .spark { animation: reveal .7s var(--ease-out) .25s both; }
.enter .wdlbar > div { transform-origin: left; animation: growX .5s var(--ease-out) .25s both; }
@property --p { syntax: '<number>'; inherits: true; initial-value: 0; }
@keyframes ringFill { from { --p: 0; } }
.enter .ph-ring { animation: ringFill .7s var(--ease-out) .15s both; }
.pava .ava { animation: none; }
.enter .pava .ava { animation: bounceIn var(--t-slow) var(--ease-out) both; }
.ava .on { animation: pulse 2.6s ease-out infinite; }

/* Наведение и нажатие: одинаково у всех карточек */
.fcard, .qtile, .lwidget, .kgrid .kpi, .glist .gcard, .gcard .mini, .lcard {
  transition: transform var(--t) var(--ease-out), box-shadow var(--t) var(--ease-out), border-color var(--t), background-color var(--t); }
.fcard:hover { transform: translateY(-2px); box-shadow: 0 10px 22px rgba(0,0,0,.3); }
.qtile:hover, .lwidget:hover, .kgrid .kpi:hover, .glist .gcard:hover, .lcard:hover { transform: translateY(-2px); }
.gcard:hover .mini { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(0,0,0,.4); }
.glist .gcard:hover .mini { transform: none; box-shadow: none; }
.fcard:active, .qtile:active, .lwidget:active, .glist .gcard:active { transform: scale(.985); transition-duration: var(--t-fast); }
.ava.link:hover { transform: scale(1.03); }
.pick .row { transition: background-color var(--t-fast); }
.pick .row:hover { transform: none; }
.gdel:hover { transform: none; }
@media (hover: none) { .fcard:hover, .qtile:hover, .lwidget:hover, .kgrid .kpi:hover, .glist .gcard:hover, .lcard:hover, .gcard:hover .mini { transform: none; box-shadow: none; } }

/* «Добавить друга»: ровный плюс, без вращения */
.fcard.add { transition: border-color var(--t), background-color var(--t), transform var(--t) var(--ease-out); }
.fcard.add .plus { font-size: 0; width: 76px; height: 76px; border-radius: 22%; margin-bottom: 10px; color: var(--accent); background: rgba(129,182,76,.1);
  transition: background-color var(--t), transform var(--t) var(--ease-out), color var(--t); }
.fcard.add .plus .ic { width: 34px; height: 34px; stroke-width: 2.4; display: block; }
.fcard.add:hover { border-color: rgba(129,182,76,.55); background: rgba(129,182,76,.05); box-shadow: none; }
.fcard.add:hover .plus { transform: scale(1.06); background: var(--accent); color: #fff; }

/* Плитки быстрых действий: содержимое прижато к верху, чтобы подписи стояли на одной линии */
.qtile { justify-content: flex-start; }
.qt-ic { transition: transform var(--t) var(--ease-out); }
.qtile:hover .qt-ic { transform: scale(1.05); }

/* Окна и уведомления */
@media (min-width: 601px) { .modal .box { animation: pop .22s var(--ease-out); } }
.modal.still, .modal.still .box { animation: none; }
.result .trophy, .result .delta, .acc-pill { animation-duration: .4s; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Вопросы в окне сайта */
.askbox .ask-ic { width: 64px; height: 64px; border-radius: 50%; margin: 4px auto 12px; display: grid; place-items: center; background: rgba(129,182,76,.15); color: var(--accent); }
.askbox .ask-ic .ic { width: 30px; height: 30px; }
.askbox.danger .ask-ic { background: rgba(236,75,59,.15); color: var(--red); }
.askbox .mrow button { flex: 1; }

/* ----- Выбор набора фигур ----- */
.modal.skinbox .box { max-width: 760px; }
.skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; max-height: min(62vh, 640px); overflow-y: auto; padding: 2px; }
.skin { display: flex; flex-direction: column; align-items: stretch; gap: 0; padding: 8px; border-radius: 14px; background: var(--card2); border: 2px solid transparent; text-align: left; cursor: pointer; font-weight: 400; }
.skin:hover { background: var(--card3); }
.skin.on { border-color: var(--accent); }
.skin .pvimg { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; border-radius: 8px; background: #b6b6b6; }
.skin.busy { opacity: .6; pointer-events: none; }
/* Окно с двумя десятками картинок: без размытия фона и с отложенной отрисовкой карточек за краем — иначе прокрутка тормозит */
.modal.skinbox { backdrop-filter: none; -webkit-backdrop-filter: none; background: rgba(0,0,0,.72); }
.skins .skin { content-visibility: auto; contain-intrinsic-size: auto 150px; }
.skin b { margin-top: 8px; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.skin small { color: var(--muted); font-size: 12.5px; }
.skin .tag { font-size: 11px; }
/* Неприметная кнопка смены набора в партии */
.skinmini { align-self: flex-end; margin-left: auto; display: block; width: 26px; height: 26px; padding: 3px; border-radius: 8px; background: transparent; opacity: .28; box-shadow: none; }
.skinmini:hover, .skinmini:focus-visible { opacity: .9; background: var(--card2); }
.skinmini img { width: 100%; height: 100%; display: block; }
/* Строка «Ваши фигуры» в окнах новой партии */
.skinrow { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 12px 6px 6px; background: var(--card2); border-radius: 12px; text-align: left; font-weight: 400; }
.skinrow .pv2 { display: grid; grid-template-columns: repeat(4, 34px); border-radius: 8px; overflow: hidden; flex: none; }
.skinrow .pv2 img { width: 34px; height: 34px; display: block; background: var(--light); } .skinrow .pv2 img:nth-child(even) { background: var(--dark); }
.skinrow b { flex: 1; min-width: 0; } .skinrow small { color: var(--muted); }
/* Набор игрока на его месте в комнате */
.t4s-skin { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); max-width: 100%; }
.t4s-skin img { width: 22px; height: 22px; flex: none; }
.t4s-skin span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.t4s-skin { padding: 3px 8px 3px 4px; border-radius: 9px; background: var(--card3); color: var(--text); font-weight: 600; }

/* Срубленные чёрные фигуры (у игрока белыми) — на светлой подложке: на тёмном фоне их не видно */
.pinfo .caps.onlight { display: inline-flex; background: #d9d5ca; border-radius: 7px; padding: 0 7px 0 3px; height: 22px; align-self: flex-start; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.pinfo .caps.onlight .adv { color: #3b3933; }
/* Свои стрелки на обычной доске и кнопка режима */
.myarrows { z-index: 8; }
.navb.nav6 { grid-template-columns: repeat(6, 1fr); }
.navb button.on { background: var(--accent); color: #fff; }

/* ===== Предходы ===== */
.sq.pre.l { background: #c9b8e6; }
.sq.pre.d { background: #9d86c4; }
.board.premode .sq.tgt::after { background: rgba(80,40,140,.32); }
.board.premode .sq.tgt.cap::after { background: radial-gradient(transparent 0 64%, rgba(80,40,140,.38) 65% 80%, transparent 81%); }
.premove-note { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700;
  color: #d9c9ff; background: rgba(157,134,196,.2); border: 1px solid rgba(157,134,196,.35); cursor: pointer; }
.premove-note .ic { width: 14px; height: 14px; }
/* ===== Окно уведомлений ===== */
.notif-hero { display: flex; gap: 14px; align-items: center; margin: 4px 0 14px; }
.notif-hero .bell { width: 56px; height: 56px; border-radius: 16px; flex: none; display: grid; place-items: center; color: #6db5ec; background: rgba(109,181,236,.16); box-shadow: inset 0 0 0 1px rgba(109,181,236,.35); }
.notif-hero .bell .ic { width: 30px; height: 30px; }
.notif-hero .bell.on { color: var(--accent); background: rgba(129,182,76,.16); box-shadow: inset 0 0 0 1px rgba(129,182,76,.4); animation: bellRing 1.2s ease .2s; }
@keyframes bellRing { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(14deg); } 30% { transform: rotate(-12deg); } 45% { transform: rotate(8deg); } 60% { transform: rotate(-5deg); } }
.notif-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.notif-list li { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--muted); }
.notif-list li .ic { width: 18px; height: 18px; color: var(--accent); flex: none; }
.notif-state { font-weight: 800; }
.notif-state.on { color: var(--accent); } .notif-state.off { color: var(--muted); } .notif-state.bad { color: var(--red); }
.notif-tip { font-size: 13px; color: var(--muted); background: var(--card2); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; line-height: 1.45; }

/* ===== Настройки игрока ===== */
.no-coords .board .coord { display: none; }
.no-dots .board:not(.premode) .sq.tgt::after { display: none; }
.no-last .sq.last:not(.sel):not(.pre).l { background: var(--light); }
.no-last .sq.last:not(.sel):not(.pre).d { background: var(--dark); }
.no-caps .pinfo .caps { visibility: hidden; }
.big-clock .clock { font-size: 34px; padding: 10px 16px; min-width: 140px; }
@media (max-width: 700px) { .big-clock .clock { font-size: 30px; min-width: 124px; } }
.no-anim .sq.tgt::after { animation: none; }
.settabs { display: flex; gap: 8px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.settabs::-webkit-scrollbar { display: none; }
.settabs button { background: var(--card); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; padding: 10px 16px; border-radius: 12px; }
.settabs button .ic { width: 18px; height: 18px; }
.settabs button.on { background: rgba(129,182,76,.16); border-color: rgba(129,182,76,.5); color: var(--text); }
.settabs button.on .ic { color: var(--accent); }
.setcard { padding: 18px 20px; animation: fadeIn .2s; }
.slabel { font-size: 12px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: var(--dim); margin: 18px 0 8px; }
.setcard > .slabel:first-child, .setgrid .slabel:first-child { margin-top: 0; }
.slist { display: flex; flex-direction: column; }
.srow { display: flex; align-items: center; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.slist .srow:last-child { border-bottom: 0; }
.srow .sl { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.srow .sl b { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.srow .sl b .ic { width: 18px; height: 18px; color: var(--accent); }
.srow .sl small { color: var(--muted); font-size: 13px; line-height: 1.4; }
.srow .sc { flex: none; display: flex; gap: 8px; align-items: center; }
/* Переключатель */
.sw { position: relative; display: inline-block; width: 48px; height: 28px; flex: none; cursor: pointer; }
.sw input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.sw i { position: absolute; inset: 0; border-radius: 99px; background: #4a4843; transition: background .2s; }
.sw i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); transition: transform .22s var(--ease); }
.sw input:checked + i { background: var(--accent); }
.sw input:checked + i::after { transform: translateX(20px); }
.sw input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.sw input:disabled + i { opacity: .4; }
/* Выбор из нескольких */
.seg { display: inline-flex; background: var(--card2); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { background: transparent; padding: 7px 13px; font-size: 13.5px; border-radius: 8px; color: var(--muted); }
.seg button.on { background: var(--card3); color: var(--text); box-shadow: 0 2px 6px rgba(0,0,0,.3); }
.volrow { display: flex; align-items: center; gap: 10px; }
.volrow input[type=range] { width: 170px; accent-color: var(--accent); }
.hours { display: flex; align-items: center; gap: 6px; }
.hours select { background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 9px; padding: 7px 8px; font: inherit; }
.hours select:disabled { opacity: .45; }
/* Доска и темы */
.setgrid { display: grid; grid-template-columns: 260px 1fr; gap: 22px; margin-bottom: 8px; }
.setboard { display: grid; grid-template-columns: repeat(8, 1fr); aspect-ratio: 1; border-radius: 10px; overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,.45); }
.setboard > div { position: relative; }
.setboard img { position: absolute; inset: 0; width: 100%; height: 100%; }
.setboard .pdot { position: absolute; left: 50%; top: 50%; width: 30%; height: 30%; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(0,0,0,.18); }
.setboard .pc { position: absolute; font-size: 9px; font-weight: 800; }
.setboard .pc.rk { left: 2px; top: 1px; } .setboard .pc.fl { right: 2px; bottom: 0; }
.themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.themetile { width: 100%; min-width: 0; flex-direction: column; gap: 6px; padding: 8px; background: var(--card2); border: 2px solid transparent; border-radius: 12px; font-size: 12.5px; }
.themetile.on { border-color: var(--accent); background: rgba(129,182,76,.13); }
.themetile .tt4 { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); width: 100%; aspect-ratio: 1; border-radius: 7px; overflow: hidden; }
.themetile .tt4 i { display: block; }
.themetile .tt4 img { position: absolute; left: 25%; top: 25%; width: 50%; height: 50%; filter: drop-shadow(0 3px 4px rgba(0,0,0,.35)); }
.setcard .skinrow { width: 100%; }
.pwform { display: grid; gap: 10px; max-width: 420px; background: var(--card2); }
.pwform .err { color: var(--red); font-size: 13.5px; min-height: 0; }
.pwform .err:empty { display: none; }
@media (max-width: 760px) {
  .setgrid { grid-template-columns: 1fr; }
  .setgrid > div:first-child { max-width: 300px; width: 100%; margin: 0 auto; }
  .themes { grid-template-columns: repeat(4, 1fr); }
  .srow { flex-wrap: wrap; }
  .srow.wide .sc { width: 100%; }
  .srow.wide .seg { width: 100%; } .srow.wide .seg button { flex: 1; }
  .themetile { padding: 6px; font-size: 11.5px; }
  .volrow input[type=range] { flex: 1; width: auto; }
  .setcard { padding: 14px 14px; }
}

/* ===== Достижения ===== */
.achcard { padding: 16px; }
.achtop { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; font-weight: 800; color: var(--gold); }
.achbig { flex: 1; height: 10px; border-radius: 99px; background: var(--card3); overflow: hidden; }
.achbig i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, #d08f57, #f2c14e, #ffe08a); box-shadow: 0 0 12px rgba(242,193,78,.5); }
.achgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; max-height: 470px; overflow: hidden; position: relative; }
.achgrid:not(.all)::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 60px; background: linear-gradient(transparent, var(--card)); pointer-events: none; }
.achgrid.all { max-height: none; }
.achgrid.all::after { display: none; }
.achmore { display: flex; margin: 10px auto 0; }
.achv { --tc: #d08f57; flex-direction: column; gap: 6px; padding: 14px 10px 12px; background: var(--card2); border: 1px solid var(--line); border-radius: 14px; text-align: center; font-weight: 400; min-width: 0; transition: transform .18s var(--ease), border-color .2s; }
.achv:hover { transform: translateY(-2px); filter: none; border-color: color-mix(in srgb, var(--tc) 50%, transparent); }
.achv.t2, .achdlg.t2 { --tc: #b9c4cf; } .achv.t3, .achdlg.t3 { --tc: #f2c14e; } .achv.t4, .achdlg.t4 { --tc: #c49bff; }
.achv b { font-size: 13.5px; line-height: 1.2; }
.achv small { font-size: 11.5px; color: var(--muted); line-height: 1.3; }
.ab { position: relative; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; flex: none;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--tc) 55%, #fff 0%), color-mix(in srgb, var(--tc) 25%, #1a1917));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tc) 70%, transparent), 0 6px 16px rgba(0,0,0,.4), inset 0 2px 4px rgba(255,255,255,.25); }
.ab .abi { filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); line-height: 1; }
.achv.got.t4 .ab, .achdlg.got.t4 .ab { animation: legendGlow 2.6s ease-in-out infinite; }
@keyframes legendGlow { 50% { box-shadow: 0 0 0 3px var(--tc), 0 0 22px var(--tc), inset 0 2px 4px rgba(255,255,255,.25); } }
.achv.locked .ab, .achdlg.locked .ab { background: var(--card3); box-shadow: 0 0 0 2px rgba(255,255,255,.08); }
.achv.locked .abi, .achdlg.locked .abi { filter: grayscale(1) brightness(.6); opacity: .55; }
.achv.locked b { color: var(--muted); }
.achbar { width: 100%; height: 5px; border-radius: 99px; background: var(--card3); overflow: hidden; margin-top: 2px; }
.achbar i { display: block; height: 100%; background: var(--tc); border-radius: 99px; }
.achbar.big { height: 8px; max-width: 260px; margin: 12px auto 4px; }
.achpr { font-variant-numeric: tabular-nums; }
.achdlg { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.achdlg .ab.big { width: 96px; height: 96px; font-size: 50px; margin-bottom: 6px; }
.achdlg h2 { justify-content: center; margin: 2px 0; }
.achtier { font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--tc); }
.achgot { margin-top: 10px; display: inline-flex; gap: 6px; align-items: center; color: var(--accent); font-weight: 700; font-size: 14px; }
.achgot .ic { width: 16px; height: 16px; }
.achgot.no { color: var(--muted); }
.toast.k-achv { --tc: #f2c14e; --tbg: rgba(242,193,78,.2); border-color: rgba(242,193,78,.35);
  background: linear-gradient(135deg, rgba(242,193,78,.16), rgba(255,255,255,0) 60%), rgba(40,38,35,.95); }
.toast.k-achv .tic.ava-ic::after { display: block; border-color: #f2c14e; }
.achtoast { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; background: radial-gradient(circle at 35% 30%, #ffe08a, #a8700d); box-shadow: 0 0 14px rgba(242,193,78,.55); animation: achPop .6s cubic-bezier(.3,1.6,.5,1); }
.achtoast.t1 { background: radial-gradient(circle at 35% 30%, #f0b583, #7a4a22); } .achtoast.t2 { background: radial-gradient(circle at 35% 30%, #eef3f7, #6d7883); }
.achtoast.t4 { background: radial-gradient(circle at 35% 30%, #e6d3ff, #5b3591); box-shadow: 0 0 16px rgba(196,155,255,.7); }
@keyframes achPop { 0% { transform: scale(0) rotate(-30deg); } 70% { transform: scale(1.2) rotate(8deg); } }

/* ===== Разбор ошибок ===== */
.cm-why { display: flex; gap: 8px; align-items: flex-start; margin-top: 8px; padding: 9px 11px; border-radius: 10px; background: rgba(255,255,255,.05); font-size: 14px; line-height: 1.45; }
.cm-why .ic { width: 18px; height: 18px; flex: none; color: var(--gold); margin-top: 1px; }
.kmpanel { display: flex; flex-direction: column; gap: 8px; }
.kmhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.kmhead .rvtitle .ic { color: #f5913b; }
.seg.sm button { padding: 5px 10px; font-size: 12.5px; }
.kmlist { display: flex; flex-direction: column; gap: 4px; max-height: 230px; overflow: auto; }
.kmrow { justify-content: flex-start; gap: 8px; padding: 7px 9px; background: var(--card2); border-radius: 9px; font-weight: 400; font-size: 13.5px; text-align: left; }
.kmrow b { white-space: nowrap; }
.kmrow span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.kmrow.cur { box-shadow: inset 0 0 0 2px var(--accent); }
.kmempty { display: flex; gap: 6px; align-items: center; padding: 4px 2px; }
.kmempty .ic { color: var(--accent); width: 18px; height: 18px; }
.drillbtn { width: 100%; margin-top: 2px; }
.drillpanel { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.drillhead { display: flex; justify-content: space-between; align-items: center; }
.drillprog { display: flex; gap: 4px; }
.drillprog i { flex: 1; height: 5px; border-radius: 99px; background: var(--card3); }
.drillprog i.ok { background: var(--accent); } .drillprog i.cur { background: var(--gold); }
.drilltxt { font-size: 14.5px; line-height: 1.5; }
.drillq { display: flex; gap: 8px; align-items: center; padding: 11px 13px; border-radius: 12px; background: rgba(91,143,199,.15); border: 1px solid rgba(91,143,199,.35); font-weight: 700; }
.drillq .ic { width: 19px; height: 19px; flex: none; }
.drillq.good { background: rgba(129,182,76,.16); border-color: rgba(129,182,76,.45); color: #cfe9b4; animation: bounceIn .35s var(--ease); }
.drillq.bad { background: rgba(229,83,75,.13); border-color: rgba(229,83,75,.4); color: #ffc9c5; animation: shakeX .35s; }
@keyframes shakeX { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.drillacts { display: flex; gap: 8px; flex-wrap: wrap; }
.drillpanel.done { text-align: center; align-items: center; }
.drillpanel.done h3 { margin: 0; }
.drillbig { font-size: 54px; animation: achPop .6s cubic-bezier(.3,1.6,.5,1); }
.pgnbox { width: 100%; font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; background: var(--card2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px; resize: vertical; }

/* ===== Быстрые реакции ===== */
.saywrap { position: relative; }
.saybtn { font-size: 18px; padding: 8px 12px; }
.saybtn.on { background: rgba(129,182,76,.2); }
.saypop { position: absolute; bottom: calc(100% + 8px); right: 0; z-index: 30; width: 270px; display: flex; flex-wrap: wrap; gap: 6px; padding: 10px; border-radius: 14px;
  background: rgba(40,38,35,.97); border: 1px solid rgba(255,255,255,.1); box-shadow: 0 16px 36px rgba(0,0,0,.55); animation: toastUp .2s var(--ease); }
.saypop button { padding: 6px 10px; font-size: 13px; border-radius: 9px; background: var(--card2); }
.saypop button.emo { font-size: 20px; padding: 4px 8px; }
.pbar { position: relative; }
.saybubble { position: absolute; display: block; height: auto; width: max-content; right: auto; left: 54px; z-index: 20; max-width: 220px; padding: 7px 13px; border-radius: 16px; background: #f1f0ee; color: #161512; font-weight: 700; font-size: 14px;
  box-shadow: 0 8px 22px rgba(0,0,0,.45); pointer-events: none; transition: opacity .3s, transform .3s; }
.saybubble.emo { font-size: 26px; padding: 3px 10px; }
.saybubble.top { top: calc(100% - 4px); bottom: auto; border-top-left-radius: 4px; }
.saybubble.bottom { bottom: calc(100% - 4px); top: auto; border-bottom-left-radius: 4px; }
.saybubble.fresh { animation: sayIn .35s cubic-bezier(.3,1.5,.5,1); }
.saybubble.out { opacity: 0; transform: scale(.8); }
@keyframes sayIn { from { opacity: 0; transform: scale(.5); } }
@media (max-width: 700px) { .saypop { right: auto; left: 50%; transform: translateX(-50%); width: min(300px, 92vw); } .achgrid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); } }

/* ===== Запись ходов (как на chess.com) ===== */
.mvtxt { display: inline-flex; align-items: center; gap: 1px; white-space: nowrap; }
.mvtxt img.fig { width: 1.25em; height: 1.25em; vertical-align: middle; margin-right: 1px; }
.mvchk, .mvmate { font-style: normal; font-weight: 900; margin-left: 1px; }
.mvchk { color: #ffb0a8; }
.mvmate { color: #ff6b61; }
.moves .m.cur .mvchk, .moves .m.cur .mvmate { color: #fff; }
.mvsq { font-variant-numeric: tabular-nums; }
.mvarr { margin: 0 2px; color: var(--muted); font-weight: 700; }
.mvarr.cap { color: #ff9a8f; }
.moves .m.cur .mvarr { color: rgba(255,255,255,.85); }
.moves .m { gap: 4px; }
.mvtime { position: relative; margin-left: auto; padding: 1px 5px; min-width: 38px; text-align: right; font-size: 11px; font-weight: 600; color: var(--dim);
  font-variant-numeric: tabular-nums; border-radius: 4px; overflow: hidden; flex: none; }
.mvtime i { position: absolute; right: 0; bottom: 0; height: 3px; border-radius: 2px; background: rgba(255,255,255,.22); }
.mvtime { z-index: 0; }
.moves .m.cur .mvtime { color: rgba(255,255,255,.85); }
.mvexplain { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-top: 1px solid var(--line); font-size: 13.5px; line-height: 1.35; min-height: 40px; }
.mvexplain > span:nth-child(2) { flex: 1; }
.mvdot { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.35); }
.mvdot.w { background: #fff; } .mvdot.b { background: #111; }
.mvhelp { width: 26px; height: 26px; padding: 0; border-radius: 50%; font-weight: 800; flex: none; margin-left: auto; }
.mvhelp.on { background: var(--accent); color: #fff; }
.mvlegend { display: grid; gap: 5px; padding: 4px 12px 10px; font-size: 12.5px; color: var(--muted); line-height: 1.4; animation: fadeIn .2s; }
.mvlegend b { color: var(--text); }
/* Строка ходов над доской — только на телефоне */
.mstrip { display: none; }
@media (max-width: 960px) {
  .mstrip { display: flex; align-items: center; gap: 2px; overflow-x: auto; white-space: nowrap; scrollbar-width: none; padding: 6px 4px; margin-bottom: 2px;
    background: var(--card); border-radius: 10px; font-weight: 700; font-size: 14.5px; scroll-behavior: smooth; }
  .mstrip::-webkit-scrollbar { display: none; }
  .mstrip .sn { color: var(--dim); padding: 0 2px 0 6px; font-weight: 600; }
  .mstrip .sm { padding: 4px 7px; border-radius: 7px; cursor: pointer; }
  .mstrip .sm.cur { background: var(--accent); color: #fff; }
  .mstrip .sm.cur .mvchk, .mstrip .sm.cur .mvmate { color: #fff; }
  .game:not(.review) #moves { display: none; }
  .game:not(.review) .mvexplain { border-top: 0; }
}

/* ===== Живой тренер ===== */
.coachbubble { display: flex; gap: 12px; align-items: flex-start; padding: 14px 14px 14px 12px; border-radius: 18px; position: relative;
  background: linear-gradient(135deg, rgba(91,143,199,.16), rgba(129,182,76,.08) 70%), var(--card); border: 1px solid rgba(91,143,199,.35);
  box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.coachbubble.fresh { animation: cbIn .45s cubic-bezier(.2,1.3,.3,1); }
@keyframes cbIn { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.coachbubble.mood-shock, .coachbubble.mood-worried { border-color: rgba(236,75,59,.5); background: linear-gradient(135deg, rgba(236,75,59,.16), rgba(255,255,255,0) 70%), var(--card); }
.coachbubble.mood-wow, .coachbubble.mood-party, .coachbubble.mood-cool { border-color: rgba(129,182,76,.55); background: linear-gradient(135deg, rgba(129,182,76,.2), rgba(255,255,255,0) 70%), var(--card); }
.coachbubble.mood-wink { border-color: rgba(242,193,78,.5); }
.cbava { position: relative; width: 52px; height: 52px; flex: none; }
.cbstar { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: radial-gradient(circle at 35% 30%, #ffd56b, #e09a1f); box-shadow: 0 6px 16px rgba(224,154,31,.45), inset 0 2px 3px rgba(255,255,255,.4); }
.cbstar .ic { width: 28px; height: 28px; fill: #fff; stroke: #fff; }
.cbmood { position: absolute; right: -6px; bottom: -4px; font-size: 22px; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0,0,0,.5)); }
.coachbubble.fresh .cbmood { animation: moodPop .55s cubic-bezier(.3,1.6,.5,1) .1s both; }
.coachbubble.fresh.mood-shock .cbava { animation: shakeX .4s .15s; }
@keyframes moodPop { from { transform: scale(0) rotate(-40deg); } }
.cbbody { flex: 1; min-width: 0; }
.cbhead { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.cbhead b { font-size: 15px; }
.cbbadge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; color: var(--cc); background: color-mix(in srgb, var(--cc) 15%, transparent); padding: 2px 8px 2px 3px; border-radius: 99px; }
.cbhints { margin-left: auto; width: 30px; height: 30px; padding: 0; border-radius: 9px; background: transparent; color: var(--dim); }
.cbhints.on { color: var(--gold); background: rgba(242,193,78,.12); }
.cbhints .ic { width: 17px; height: 17px; }
.cbtext { font-size: 15px; line-height: 1.45; }
.cbtext p { margin: 0 0 5px; }
.cbtext p:last-child { margin-bottom: 0; }
.cbmv { white-space: nowrap; color: #fff; }
.cbhint { display: flex; gap: 6px; align-items: flex-start; padding: 8px 10px; margin-top: 6px !important; border-radius: 10px; background: rgba(242,193,78,.12); color: #f6dfa3; font-size: 14px; }
.cbhint .ic { width: 17px; height: 17px; flex: none; margin-top: 1px; color: var(--gold); }
.cbhint.wait { background: transparent; padding: 2px 0; }
.cbsub { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.cbacts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.cbacts button.on { background: rgba(91,143,199,.3); }
.cbdots { display: inline-flex; gap: 4px; vertical-align: middle; margin-left: 4px; }
.cbdots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: cbDot 1.1s infinite; }
.cbdots i:nth-child(2) { animation-delay: .15s; } .cbdots i:nth-child(3) { animation-delay: .3s; }
@keyframes cbDot { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
@media (max-width: 960px) { .coachbubble { width: 100%; } .cbtext { font-size: 14.5px; } }

/* ===== Вкладка «Режимы» ===== */
.qt-modes { --qc: #b48ae0; }
.qt-ic3 { display: flex; align-items: center; height: 48px; }
.qt-ic3 i { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: #2f2d29; box-shadow: 0 0 0 2px var(--card), 0 4px 10px rgba(0,0,0,.35); margin-right: -8px; }
.qt-ic3 i:nth-child(2) { transform: translateY(-4px); } 
.qt-ic3 i svg { width: 26px; height: 26px; }
.qt-modes:hover .qt-ic3 i { margin-right: -2px; transition: margin .25s var(--ease); }
.nav a .badge.dotb { width: 9px; height: 9px; min-width: 0; padding: 0; }
.nav a svg:not(.ic) { width: 21px; height: 21px; flex: none; }
.modegrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 26px; }
.modecard { --mc: #81b64c; display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 18px; background: linear-gradient(160deg, color-mix(in srgb, var(--mc) 14%, transparent), transparent 55%), var(--card);
  border: 1px solid color-mix(in srgb, var(--mc) 30%, transparent); transition: transform .2s var(--ease), border-color .2s; }
.modecard:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--mc) 60%, transparent); }
.modecard.m-ffa { --mc: #ef6d65; } .modecard.m-big { --mc: #b48ae0; } .modecard.m-t4 { --mc: #6db5ec; }
.mc-top { display: flex; gap: 14px; align-items: center; }
.mc-ic { width: 72px; height: 72px; border-radius: 18px; flex: none; display: grid; place-items: center; background: #2f2d29; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), 0 6px 18px rgba(0,0,0,.35); }
.modecard h3 { margin: 0; font-size: 21px; letter-spacing: -.3px; }
.mc-who { color: var(--mc); font-weight: 700; font-size: 13px; margin-top: 2px; }
.modecard p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; flex: 1; }
.mc-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.mc-tags span { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 99px; background: var(--card2); color: var(--text); }
.mc-tags .ic { width: 14px; height: 14px; }
.mc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); }
.mc-stat { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; }
.mc-stat .ic { width: 15px; height: 15px; }
@media (max-width: 1100px) { .modegrid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) { .modegrid { grid-template-columns: 1fr; } .mc-ic { width: 60px; height: 60px; } .modecard { padding: 15px; } .qt-ic3 i { width: 34px; height: 34px; } .qt-ic3 i svg { width: 22px; height: 22px; } }
/* Шесть вкладок в шапке телефона */
@media (max-width: 700px) {
  .nav a svg:not(.ic) { width: 23px; height: 23px; }
  .nav a span:not(.badge) { overflow: hidden; text-overflow: ellipsis; max-width: 100%; white-space: nowrap; }
}
@media (max-width: 480px) {
  .top .logo { display: none; }
  .nav a { font-size: 10px; letter-spacing: -.2px; padding: 6px 1px 4px; }
  .nav a .ic, .nav a svg:not(.ic) { width: 22px; height: 22px; }
  .me .ava { width: 32px !important; height: 32px !important; }
}
