/* ChessRobots: тёмная тема, шапка, акцент оранжевый */

/* Гарантируем что [hidden] всегда скрывает элемент,
   даже если другие CSS-правила задают display: flex/inline-flex */
[hidden] { display: none !important; }

:root {
  /* Тёплый уголь, ближе к винтажной иллюстрации (без холодного синего) */
  --pcb-paper: #0f0e0b;
  --pcb-paper-2: #181612;
  --pcb-paper-dark: #0a0907;
  --pcb-ink: #e8e6e3;
  --pcb-ink-2: #b8b5af;
  --pcb-muted: #8a8790;
  --pcb-bar: #070605;
  --pcb-orange: #e0702e;
  --pcb-orange-mid: #f08845;
  --pcb-orange-dark: #a84a18;
  --pcb-cream: #f4efe6;
  --pcb-novice: #3d5c4a;
  --pcb-tact: #c45c26;
  --pcb-strat: #2c2c2c;
  --pcb-master: #6b6560;
  --pcb-legend: #8b2f2f;
  --pcb-sage: #4a6354;
  --pcb-send: #449a65;
  --pcb-send-border: #2a6d47;
  --pcb-send-shadow: #215a3a;
  --font-sans: "Inter", system-ui, -apple-system, sans-serif;
  --font-display: var(--font-sans);
  --font-mega: var(--font-sans);
  --font-ui: var(--font-sans);
  --font-nav: var(--font-sans);
  --pcb-terra: #c45c3a;
  --pcb-terra-bright: #e07850;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.pcb-theme {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--pcb-ink);
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--pcb-paper);
  color-scheme: dark;
}

/* Зернистость (чуть сильнее и крупнее — ближе к постеру / плёнке) */
body.pcb-theme::before {
  content: "";
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
  z-index: 9998;
  opacity: 0.055;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.62' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

body.pcb-theme::after {
  content: "";
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
  z-index: 9997;
  background: radial-gradient(ellipse 120% 100% at 50% 15%, transparent 0%, rgba(0, 0, 0, 0.4) 100%);
}

/*
 * Во время партии — только контент, без «лендинговой» шапки.
 * Дубль с html.pcb-play-view-open: старые WebView (Android 11 и др.) не поддерживают :has().
 */
body.pcb-theme:has(#view-play:not([hidden])) .pcb-topbar,
html.pcb-play-view-open .pcb-topbar {
  display: none;
}

/* Партия: не скроллить всю страницу — часы и статус остаются сверху, листается только блок с доской */
html:has(#view-play:not([hidden])),
html.pcb-play-view-open {
  height: 100dvh;
  overflow: hidden;
}

html:has(#view-play:not([hidden])) body.pcb-theme,
html.pcb-play-view-open body.pcb-theme {
  min-height: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

html:has(#view-play:not([hidden])) .pcb-main,
html.pcb-play-view-open .pcb-main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
}

html:has(#view-play:not([hidden])) #view-play,
html.pcb-play-view-open #view-play {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

html:has(#view-play:not([hidden])) #view-play:has(.main-layout.with-live-eval),
html.pcb-play-view-open #view-play.pcb-view-play--live-eval {
  overflow-x: visible;
  overflow-y: hidden;
}

html:has(#view-play:not([hidden])) #view-play .play-header,
html.pcb-play-view-open #view-play .play-header {
  flex-shrink: 0;
}

html:has(#view-play:not([hidden])) #view-play .main-layout,
html.pcb-play-view-open #view-play .main-layout {
  flex: 1 1 auto;
  min-height: 0;
  /* stretch: иначе layout-primary сжимается до ширины доски и панель «История» режется overflow */
  align-items: stretch;
  overflow-y: auto;
  /* auto: при ширине «шкала + чат + доска + история» > экрана прокрутка, hidden обрезала историю справа */
  overflow-x: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* иначе при появлении вертикального скроллбара сужается полезная ширина — доска не пересчитывается и ломается hit-test */
@supports (scrollbar-gutter: stable) {
  html:has(#view-play:not([hidden])) #view-play .main-layout,
  html.pcb-play-view-open #view-play .main-layout {
    scrollbar-gutter: stable;
  }
}

/*
 * Со шкалой ряд шире вьюпорта: overflow-x:auto — иначе hidden обрезает слева столбик оценки.
 * scrollLeft=0 (см. game.js) — в начале видна шкала слева от доски.
 */
html:has(#view-play:not([hidden])) #view-play .main-layout.with-live-eval,
html.pcb-play-view-open #view-play .main-layout.with-live-eval {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

#view-play:not([hidden]) #main-layout.main-layout.with-live-eval {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

/*
 * Дубль правил без html:has(): если :has не сработал, .main-layout остаётся с align-items:center
 * из базового блока — layout-primary сжимается, ряд «шкала+доска» обрезается по overflow-x.
 */
#view-play:not([hidden]) #main-layout.main-layout {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
  overflow-y: auto;
  overflow-x: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

@supports (scrollbar-gutter: stable) {
  #view-play:not([hidden]) #main-layout.main-layout {
    scrollbar-gutter: stable;
  }
}

#view-play:not([hidden]) #main-layout.main-layout:not(.with-live-eval) {
  overflow-x: auto;
}

#view-play:not([hidden]) .layout-primary {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

#view-play:not([hidden]) #main-layout.main-layout.with-review .layout-primary {
  width: auto;
  flex: 0 1 auto;
  min-width: 0;
}

html:has(#view-play:not([hidden])) #view-play .layout-primary,
html.pcb-play-view-open #view-play .layout-primary {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* Разбор: первичная колонка — по содержимому (оценка + доска), чтобы панель была справа в одном ряду */
html:has(#view-play:not([hidden])) #view-play .main-layout.with-review .layout-primary,
html.pcb-play-view-open #view-play .main-layout.with-review .layout-primary {
  width: auto;
  flex: 0 1 auto;
  min-width: 0;
}

.pcb-topbar--landing {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(12, 10, 8, 0.93);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 240, 220, 0.06);
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.45);
}

/* Профилактика: полоса над контентом */
.pcb-maint-banner {
  position: relative;
  z-index: 11;
  background: linear-gradient(90deg, #1a1210 0%, #2a1a12 50%, #1a1210 100%);
  border-bottom: 1px solid rgba(200, 120, 60, 0.4);
  padding: 0.5rem 1rem;
}
.pcb-maint-banner__inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  max-width: 56rem;
  margin: 0 auto;
}
.pcb-maint-banner__body {
  flex: 1 1 12rem;
  min-width: 0;
}
.pcb-maint-banner__title {
  display: block;
  font-size: 0.92rem;
  color: #f0d4a8;
  margin: 0 0 0.2rem;
}
.pcb-maint-banner__desc {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: rgba(255, 240, 220, 0.88);
}

/* Полная блокировка сайта: отдельная страница 503 */
.pcb-maint-full-page {
  min-height: 100vh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #12100e 0%, #1a1510 50%, #0e0c0a 100%);
}
.pcb-maint-full {
  text-align: center;
  padding: 1.5rem 1rem 2.5rem;
  max-width: 42rem;
}
.pcb-maint-full__h1 {
  font-size: 1.35rem;
  font-weight: 800;
  color: #f0d4a8;
  margin: 0 0 1rem;
}
.pcb-maint-full__art {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  margin: 0 auto 1.25rem;
}
.pcb-maint-full__msg {
  font-size: 0.95rem;
  line-height: 1.5;
  color: rgba(255, 240, 220, 0.92);
  margin: 0 0 0.75rem;
}
.pcb-maint-full__hint {
  font-size: 0.82rem;
  color: rgba(255, 240, 220, 0.55);
  margin: 0;
}

.pcb-email-verify-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1rem;
  padding: 0.55rem 1.25rem;
  background: linear-gradient(90deg, #0a1620 0%, #122a38 50%, #0a1620 100%);
  border-bottom: 1px solid rgba(80, 160, 220, 0.35);
  text-align: center;
  position: relative;
  z-index: 10;
}
.pcb-email-verify-banner__text {
  font-size: 0.82rem;
  color: #a8d0f0;
  max-width: 42rem;
  line-height: 1.35;
}
.pcb-email-verify-banner__form {
  margin: 0;
}

/* Страница «Проверьте почту» (auth_check_email.html) */
.pcb-check-email-card {
  text-align: center;
}
.pcb-check-email-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5.5rem;
  height: 5.5rem;
  margin: 0.25rem auto 1rem;
  border-radius: 50%;
  background: rgba(80, 160, 220, 0.12);
  color: #a8d0f0;
  border: 1px solid rgba(80, 160, 220, 0.35);
}
.pcb-check-email-hint {
  margin: 0.85rem auto 0;
  max-width: 32rem;
  font-size: 0.9rem;
  color: var(--pcb-muted, #b0b0b0);
  line-height: 1.5;
}
.pcb-check-email-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1.25rem;
}

/* Устаревший Chromium / WebView — см. partial pcb_unsupported_browser.html */
.pcb-unsupported-browser {
  position: sticky;
  top: 0;
  z-index: 10050;
  background: linear-gradient(90deg, #231208 0%, #351a0c 45%, #231208 100%);
  border-bottom: 1px solid rgba(240, 112, 48, 0.45);
  color: var(--pcb-ink);
  font-size: 0.88rem;
  line-height: 1.45;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.35);
}

.pcb-unsupported-browser__inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0.65rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
}

.pcb-unsupported-browser__text {
  margin: 0;
  flex: 1 1 16rem;
  min-width: 0;
  color: #e4d8ce;
}

.pcb-unsupported-browser__text strong {
  color: #ffb090;
  font-weight: 700;
}

.pcb-unsupported-browser__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  flex: 0 1 auto;
}

.pcb-unsupported-browser__link {
  color: var(--pcb-orange-mid);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

.pcb-unsupported-browser__link:hover,
.pcb-unsupported-browser__link:focus {
  color: var(--pcb-cream);
}

.pcb-unsupported-browser__dismiss {
  margin: 0;
  padding: 0.35rem 0.85rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(0, 0, 0, 0.35);
  color: var(--pcb-ink-2);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.pcb-unsupported-browser__dismiss:hover,
.pcb-unsupported-browser__dismiss:focus {
  color: var(--pcb-ink);
  border-color: rgba(255, 255, 255, 0.35);
}

/* Мобильные раскрывашки: на ≤640px свёрнуто; на ≥641px — contents, summary скрыт */
.pcb-mobile-disclose > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  margin: 0 0 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--pcb-ink-2);
  font-size: 0.9rem;
  font-weight: 600;
  -webkit-tap-highlight-color: rgba(240, 136, 69, 0.15);
}

.pcb-mobile-disclose > summary::-webkit-details-marker {
  display: none;
}

.pcb-mobile-disclose > summary::after {
  content: "▾";
  margin-left: auto;
  transition: transform 0.18s ease;
}

.pcb-mobile-disclose[open] > summary::after {
  transform: rotate(180deg);
}

@media (min-width: 641px) {
  details.pcb-mobile-disclose {
    display: contents;
  }

  details.pcb-mobile-disclose > summary {
    display: none;
  }

  /*
   * Fallback: закрытый <details> скрывает слот после summary; основной фикс — `open` в
   * разметке + pcb_mobile_disclose_sync.html. Это страховка (в т.ч. без JS).
   */
  details.pcb-mobile-disclose > :not(summary) {
    display: block !important;
  }
}

.pcb-topbar {
  position: relative;
  z-index: 10;
  background: var(--pcb-bar);
  color: var(--pcb-cream);
  border-bottom: 3px solid var(--pcb-orange);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Лига: шапка остаётся вверху при скролле — иначе offset у .pcb-ladder-ranks-sticky
   считает «высоту шапки», а сама шапка уже уехала → пустая полоса над полосой разрядов */
/* Дубль с pcb-page--ladder: старые WebView не поддерживают :has() */
body:has(.pcb-ladder) .pcb-topbar,
body.pcb-page--ladder .pcb-topbar {
  position: sticky;
  top: 0;
  z-index: 25;
}

.pcb-topbar-inner {
  /* Как на главной: та же ширина колонки и боковые отступы, чтобы лого не «уезжало» вправо */
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.35rem;
  height: 3.75rem;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
}

/* Лига / кабинет: как на главной — те же боковые 1.35rem, что у .pcb-main--landing */
body:has(.pcb-main--dashboard) .pcb-topbar-inner,
body.pcb-page--dashboard .pcb-topbar-inner {
  max-width: min(1400px, 96vw);
  padding-left: 1.35rem;
  padding-right: 1.35rem;
}

/*
 * Лига: внутри main блок .pcb-ladder уже max-width 1180px и по центру — шапка шире,
 * лого оказывается левее карточки. Сдвигаем только padding-left шапки на половину «зазора».
 */
body:has(.pcb-ladder) .pcb-topbar-inner,
body.pcb-page--ladder .pcb-topbar-inner {
  padding-left: calc(
    1.35rem + max(0px, (min(1400px, 96vw) - 2.7rem - 1180px) / 2)
  );
}

.pcb-topbar-inner--landing {
  max-width: 1240px;
  padding: 0.75rem 1.35rem;
  gap: 0.75rem 1rem;
}

.pcb-topbar-inner--landing .pcb-nav {
  flex: 1 1 auto;
  min-width: min(100%, 260px);
}

.pcb-topbar-inner--landing .pcb-nav--landing-bar {
  justify-content: flex-end;
  gap: 1rem 1.5rem;
}

.pcb-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pcb-logo--link {
  text-decoration: none;
  color: inherit;
}

.pcb-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25rem 1.25rem;
  font-family: var(--font-nav);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.pcb-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--pcb-cream);
  text-decoration: none;
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.pcb-nav-link:hover {
  color: var(--pcb-orange-mid);
  border-bottom-color: rgba(224, 112, 46, 0.45);
}

.pcb-nav-link--active,
.pcb-nav-link--active:hover {
  color: var(--pcb-orange-mid);
  border-bottom-color: var(--pcb-orange-mid);
}

.pcb-nav-link--dim {
  color: var(--pcb-muted);
}

.pcb-nav-link--dim:hover {
  color: var(--pcb-ink-2);
}

@media (min-width: 641px) {
  .pcb-topbar-inner .pcb-nav--topbar-end,
  .pcb-topbar-inner .pcb-nav--landing-bar,
  .pcb-topbar-inner .pcb-nav--play-header {
    flex-wrap: nowrap;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
  }
}

.pcb-nav--topbar-end {
  flex: 1 1 auto;
  justify-content: flex-end;
  gap: 0.75rem 1.25rem;
}

.pcb-nav--play-header {
  flex: 1 1 auto;
  width: 100%;
  max-width: none;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem 1.5rem;
}

.pcb-nav-userblock {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  align-self: center;
  flex-shrink: 0;
  gap: 0.55rem;
  padding: 0.2rem 1rem 0.2rem 0;
  margin-right: 0.15rem;
  border-right: 1px solid rgba(255, 240, 220, 0.28);
}

/* Чип: имя + ранг в одной рамке */
.pcb-nav-userchip {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  gap: 0.45rem;
  padding: 0 0.55rem 0 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.pcb-nav-userbox-label {
  color: var(--pcb-muted);
  font-family: var(--font-nav);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.pcb-nav-userbox-name {
  color: var(--pcb-orange-mid);
  font-weight: 800;
  font-size: 0.95rem;
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  text-transform: none;
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Имя в том же «металлическом» стиле, что подпись разряда в Лиге (цвет от текущей темы лиги) */
.pcb-nav-userbox-name--tier {
  color: unset;
  font-size: 1.05rem;
  font-weight: 800;
  background: linear-gradient(180deg, var(--m-a) 0%, var(--m-b) 42%, var(--m-c) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55));
}
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .pcb-nav-userbox-name--tier {
    color: #e4e8ee;
    background: none;
    filter: none;
  }
}

/* Логотип по центру шапки — только мобилка (≤640px), см. блок MOBILE ниже. Десктоп: обычный flex */

/* Шапка только с лого (например /play без входа) — по центру на любом широком экране */
@media (min-width: 641px) {
  .pcb-topbar-inner:not(.pcb-topbar-inner--has-hamburger) {
    justify-content: center;
  }
}

@media (max-width: 900px) {
  .pcb-topbar--landing .pcb-topbar-inner--landing {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0.45rem;
  }

  /* Сброс абсолютного лого под сетку главной */
  .pcb-topbar--landing .pcb-topbar-inner--landing .pcb-logo--link {
    position: static;
    left: auto;
    z-index: auto;
    transform: none;
    justify-self: center;
  }

  .pcb-topbar--landing .pcb-nav.pcb-nav--landing-bar {
    width: 100%;
    justify-content: flex-end;
    padding-top: 0.45rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    min-width: 100%;
  }
}

.pcb-logo-img {
  display: block;
  height: 2.5rem;
  width: auto;
  max-width: 2.35rem;
  object-fit: contain;
  flex-shrink: 0;
}

.pcb-logo-text {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pcb-logo-accent {
  color: var(--pcb-orange);
}

.pcb-main {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem 2.5rem;
}

.pcb-main--landing {
  max-width: 1240px;
  padding-left: 1.35rem;
  padding-right: 1.35rem;
}

.view[hidden] {
  display: none !important;
}

/* —— Лендинг настройки —— */
.pcb-setup {
  padding-top: 1.25rem;
}

.pcb-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem 2.5rem;
  align-items: center;
  margin-bottom: 2.25rem;
  padding: 0.5rem 0 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

@media (min-width: 900px) {
  .pcb-hero:not(:has(.pcb-hero-disclose)) {
    grid-template-columns: minmax(280px, 1fr) minmax(300px, 1.05fr);
    align-items: center;
    min-height: min(52vh, 420px);
  }

  /* Лендинг: текст слева в .pcb-hero-copy; мокап в <details> — две колонки */
  .pcb-hero:has(.pcb-hero-disclose) {
    grid-template-columns: minmax(280px, 1fr) minmax(300px, 1.05fr);
    grid-template-areas:
      "heroCopy heroArt";
    align-items: center;
    min-height: min(52vh, 420px);
  }

  .pcb-hero:has(.pcb-hero-disclose) .pcb-hero-copy {
    grid-area: heroCopy;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

  .pcb-hero:has(.pcb-hero-disclose) .pcb-hero-disclose {
    display: contents;
  }

  .pcb-hero:has(.pcb-hero-disclose) .pcb-hero-disclose > summary {
    display: none;
  }

  .pcb-hero:has(.pcb-hero-disclose) .pcb-hero-art {
    grid-area: heroArt;
    align-self: center;
  }
}

.pcb-setup--landing-only .pcb-hero {
  margin-bottom: 1.25rem;
  padding-bottom: 0;
  border-bottom: none;
}

.pcb-guest-notice {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0 1.5rem;
  padding: 1rem 1.2rem;
  border: 1px solid var(--pcb-terra-bright);
  border-radius: 12px;
  background: rgba(203, 108, 62, .12);
}
.pcb-guest-notice > div:first-child { flex: 1 1 300px; min-width: 0; }
.pcb-guest-notice h2 { margin: 0 0 .4rem; font-size: 1.1rem; color: var(--pcb-cream); }
.pcb-guest-notice p { margin: .3rem 0; line-height: 1.5; }
.pcb-guest-notice p a { color: #9ac9ff; text-decoration: underline; }
.pcb-guest-notice-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
@media (max-width: 600px) {
  .pcb-guest-notice-actions { width: 100%; }
  .pcb-guest-notice-actions .pcb-btn { width: 100%; box-sizing: border-box; }
}

.pcb-home-analysis {
  width: 100%;
  min-width: 0;
  margin: 0 0 1.4rem;
  padding: 1.1rem;
  box-sizing: border-box;
  border: 1px solid rgba(184, 151, 112, 0.28);
  border-radius: 12px;
  background: var(--pcb-paper-2);
}
.pcb-home-analysis-title { display: block; margin-bottom: .65rem; font-weight: 700; }
.pcb-home-analysis-row { display: flex; gap: .6rem; }
.pcb-home-analysis-row .pcb-input { flex: 1; width: 0; min-width: 0; font-size: .9rem; }
.pcb-home-analysis-row .pcb-btn { flex-shrink: 0; }
.pcb-home-analysis-options { display: flex; align-items: center; gap: .6rem; margin-top: .7rem; font-size: .85rem; }
.pcb-home-analysis-options .pcb-input { width: auto; padding: .35rem .6rem; font-size: .85rem; }
.pcb-home-analysis-help { margin: .7rem 0 0; font-size: .85rem; line-height: 1.55; color: var(--pcb-muted); }
.pcb-home-analysis-help a { color: var(--pcb-orange-mid); text-decoration: underline; }
.coach-chat-login-hint a { color: #9ac9ff; text-decoration: underline; }
.pcb-home-analysis-status { margin: .65rem 0 0; font-size: .85rem; }
.pcb-home-analysis-status--error { color: #ffaaa0; }
@media (max-width: 600px) {
  .pcb-home-analysis-row { flex-direction: column; }
  .pcb-home-analysis-row .pcb-input { width: 100%; flex: auto; box-sizing: border-box; }
}

.pcb-lcoach {
  width: 100%;
  min-width: 0;
  margin: 0 0 1.6rem;
  padding: 1.15rem;
  box-sizing: border-box;
  border: 1px solid rgba(232, 168, 92, 0.35);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(203, 108, 62, 0.14), rgba(33, 27, 45, 0.3));
}
.pcb-lcoach-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 1.1rem;
  align-items: start;
}
.pcb-lcoach-badge {
  display: inline-block;
  margin-bottom: 0.5rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(240, 196, 154, 0.4);
  background: rgba(240, 136, 69, 0.14);
  color: #f0c49a;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.pcb-lcoach-title {
  margin: 0 0 0.4rem;
  font-size: 1.45rem;
  line-height: 1.2;
  color: var(--pcb-cream);
}
.pcb-lcoach-sub {
  margin: 0 0 0.9rem;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--pcb-muted);
}
.pcb-lcoach-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 0.8rem;
}
.pcb-lcoach-ctas .pcb-btn { font-size: 0.8rem; }
.pcb-lcoach-note {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.5);
}
.pcb-lcoach-chat {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(18, 15, 13, 0.55);
  box-sizing: border-box;
}
.pcb-lcoach-compose-bar {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  min-width: 0;
}
/* Honeypot от ботов: визуально скрыт, но присутствует в DOM */
.pcb-lcoach-hp {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.pcb-lcoach-log {
  flex: 1 1 auto;
  min-height: 9rem;
  max-height: min(24rem, 56dvh);
  --pcb-lcoach-font-rem: 0.8rem;
}
.pcb-lcoach-log .bot-chat-msg-text {
  font-size: var(--pcb-lcoach-font-rem);
}
.pcb-lcoach-quick {
  margin: 0;
}
.pcb-lcoach-quick .coach-quick-btn {
  font-size: var(--coach-chat-font-rem, 0.9rem);
  line-height: 1.3;
  padding: 0.5rem 0.75rem;
  white-space: normal;
  text-overflow: clip;
}
.pcb-lcoach-quick .coach-quick-btn:disabled {
  opacity: 0.6;
}
.pcb-lcoach-fen-input {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 0.4rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.28);
  color: #f2ebe3;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  line-height: 1.3;
}
.pcb-lcoach-fen-input:focus {
  outline: none;
  border-color: rgba(240, 196, 154, 0.45);
}
.pcb-lcoach-fen-input::placeholder {
  color: rgba(242, 235, 227, 0.42);
}
.pcb-lcoach-error .bot-chat-msg-text {
  color: #ffaaa0;
  font-style: normal;
}
@media (max-width: 900px) {
  .pcb-lcoach-inner { grid-template-columns: 1fr; }
  .pcb-lcoach-log { max-height: min(20rem, 48dvh); }
}
@media (max-width: 640px) {
  /* На телефонах мало места: кнопка отправки — под полем ввода на всю ширину ряда */
  .pcb-lcoach-compose { grid-template-columns: minmax(0, 1fr); }
  .pcb-lcoach-compose-bar .coach-chat-send {
    margin-left: auto;
    padding-left: 1.4rem;
    padding-right: 1.4rem;
  }
}

.pcb-mega {
  margin: 0 0 1.1rem;
  font-family: var(--font-mega);
  font-weight: 800;
  font-size: clamp(2.25rem, 5.5vw, 3.6rem);
  line-height: 1.03;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pcb-cream);
}

.pcb-mega-line {
  display: block;
}

.pcb-mega-line--accent {
  color: var(--pcb-terra-bright);
}

.pcb-lead {
  margin: 0 0 1.5rem;
  max-width: 26rem;
  font-size: 1.02rem;
  color: var(--pcb-muted);
  line-height: 1.6;
}

/* Hero: лид сразу под мега-заголовком, перед кнопками */
.pcb-hero .pcb-hero-copy .pcb-mega {
  margin-bottom: 0.65rem;
}

.pcb-lead--hero {
  margin-top: 0;
  margin-bottom: 1.25rem;
}

.pcb-play-page-lead {
  max-width: 40rem;
}

.pcb-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: 1.75rem;
}

.pcb-btn--hero {
  text-decoration: none;
  box-sizing: border-box;
}

.pcb-play-tri {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent #fff;
}

.pcb-btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.82rem 1.25rem;
  border-radius: 6px;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--pcb-cream);
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.35);
  box-shadow: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.pcb-btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.5);
}

.pcb-btn-dark {
  color: var(--pcb-cream);
  background: #1a1a1e;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  text-decoration: none;
}

.pcb-btn-dark:hover {
  background: #24242a;
  border-color: rgba(255, 255, 255, 0.3);
}

.pcb-filter-ic {
  width: 14px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 2px;
  position: relative;
  opacity: 0.9;
}

.pcb-filter-ic::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  top: 3px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 4px 0 currentColor;
}

.pcb-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.74rem;
  color: var(--pcb-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-family: var(--font-nav);
  font-weight: 600;
}

.pcb-hero-stat {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.pcb-hero-stat-ic {
  font-size: 1rem;
  opacity: 0.95;
}

.pcb-hero-stat strong {
  color: var(--pcb-cream);
  font-weight: 700;
}

/* Иллюстрация справа (макет) */
.pcb-hero-art {
  position: relative;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.pcb-hero-img {
  display: block;
  width: 100%;
  max-width: min(640px, 100%);
  height: auto;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
  object-fit: contain;
}

.pcb-btn--hero-ai-outline {
  border-color: rgba(120, 190, 255, 0.5) !important;
  color: #c8e8ff !important;
}

.pcb-btn--hero-ai-outline:hover {
  background: rgba(72, 168, 255, 0.12) !important;
  border-color: rgba(160, 210, 255, 0.75) !important;
}

.pcb-ai-promo {
  margin: 0 0 1.25rem;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(120, 190, 255, 0.28);
  background:
    radial-gradient(ellipse 70% 80% at 0% 0%, rgba(72, 168, 255, 0.12), transparent 55%),
    rgba(10, 12, 18, 0.55);
}

.pcb-ai-promo__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
  margin-bottom: 0.45rem;
}

.pcb-ai-promo__badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 5px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0d1520;
  background: linear-gradient(135deg, #7ec8ff, #b49cff);
}

.pcb-ai-promo__title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #c8e8ff;
}

.pcb-ai-promo__lead {
  margin: 0 0 0.55rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.86);
}

.pcb-ai-promo__features {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.3rem;
}

.pcb-ai-promo__features li {
  position: relative;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.72);
}

.pcb-ai-promo__features li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.42em;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #5eb8ff, #9b7cff);
}

.pcb-ai-promo__note {
  margin: 0.55rem 0 0;
  font-size: 0.76rem;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.5);
}

.analysis-import-wrap .pcb-ai-promo {
  margin-top: 0.35rem;
  margin-bottom: 1rem;
  text-align: left;
}

.pcb-table-link--ai {
  color: #9ed4ff !important;
  font-weight: 700;
}

.pcb-table-link--ai:hover {
  color: #d4eeff !important;
}

.pcb-btn--review-ai {
  border-color: rgba(120, 190, 255, 0.45) !important;
  color: #c8e8ff !important;
}

.pcb-btn--review-ai:hover {
  background: rgba(72, 168, 255, 0.14) !important;
  border-color: rgba(160, 210, 255, 0.7) !important;
}

/* См. .pcb-btn.pcb-btn--review-ai-row ниже — после базового .pcb-btn */

/* —— Лендинг: блок под героем (ширина = .pcb-main--landing) —— */
.pcb-landing-more {
  padding: 0 0 2.75rem;
}

.pcb-landing-more-inner {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.pcb-landing-lede {
  margin: 0 0 1.35rem;
  max-width: 38rem;
  font-size: clamp(1.05rem, 2.2vw, 1.22rem);
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: var(--pcb-cream);
}

.pcb-landing-pitch-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
  align-items: stretch;
}

@media (min-width: 640px) {
  .pcb-landing-pitch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.1rem;
  }
}

@media (min-width: 1024px) {
  .pcb-landing-pitch-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.15rem;
  }
}

/* Карточки «питч»: текст поверх нижней части иллюстрации, полупрозрачная подложка */
.pcb-landing-pitch-card {
  position: relative;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.35);
  background-color: #0a0a0c;
}

.pcb-landing-pitch-media {
  position: relative;
  width: 100%;
  aspect-ratio: 256 / 341;
  overflow: hidden;
  background: #121014;
}

/* Старые WebView (Chrome <88): без aspect-ratio контейнер схлопывается до 0 — intrinsic-ratio через padding-top */
@supports not (aspect-ratio: 1) {
  .pcb-landing-pitch-media {
    height: 0;
    padding-top: calc(341 / 256 * 100%);
  }
  .pcb-landing-pitch-media img {
    position: absolute;
    top: 0;
    left: 0;
  }
}

.pcb-landing-pitch-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 38%;
  /* Осветление исходников через CSS (~+20% к прежнему уровню) */
  filter: brightness(1.29) contrast(1.02) saturate(1.03);
}

.pcb-landing-pitch-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  box-sizing: border-box;
  height: 13.5rem;
  max-height: 100%;
  padding: 0.75rem 0.9rem 0.85rem;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(0, 0, 0, 0.52);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 -12px 28px rgba(0, 0, 0, 0.35);
  -webkit-overflow-scrolling: touch;
}

.pcb-landing-pitch-kicker {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pcb-orange-mid);
}

.pcb-landing-pitch-head {
  margin: 0 0 0.45rem;
  font-size: clamp(1.02rem, 2.1vw, 1.18rem);
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: 0.02em;
  color: var(--pcb-cream);
  /* Резерв под две строки — описания выравниваются по верху */
  min-height: 2.7em;
}

.pcb-landing-pitch-sub {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: rgba(210, 214, 222, 0.92);
}

/* —— Футер —— */
.pcb-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: var(--pcb-paper-dark);
  padding: 2rem 0;
  margin-top: auto;
}

.pcb-footer-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.35rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
}

.pcb-footer-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.pcb-footer-logo {
  opacity: 0.75;
}

.pcb-footer-brand .pcb-logo-text {
  font-size: 1rem;
  color: var(--pcb-ink-2);
}

.pcb-footer-copy {
  margin: 0;
  font-size: 0.82rem;
  color: var(--pcb-muted);
  flex: 1 1 auto;
  text-align: center;
}

@media (max-width: 640px) {
  .pcb-footer-inner {
    flex-direction: column;
    align-items: flex-start;
    text-align: left;
  }
  .pcb-footer-copy {
    text-align: left;
    order: 3;
  }
}

.pcb-footer-links {
  display: flex;
  gap: 1.25rem;
}

.pcb-footer-link {
  color: var(--pcb-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: color 0.15s ease;
}

.pcb-footer-link:hover {
  color: var(--pcb-orange-mid);
}

.pcb-h2 {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.25rem, 3vw, 1.65rem);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pcb-ink);
}

.pcb-h2-sub {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--pcb-muted);
}

.pcb-custom-bots-wrap {
  margin-bottom: 1.5rem;
}

.pcb-bots-page {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0.35rem 1rem 2rem;
  width: 100%;
  box-sizing: border-box;
}

.pcb-bots-page-intro {
  margin-bottom: 1.35rem;
}

.pcb-bots-page-intro .pcb-h3 {
  margin-bottom: 0.45rem;
}

.pcb-bots-page-back {
  margin: 0.85rem 0 0;
}

.pcb-bots-section {
  margin-bottom: 1.85rem;
}

.pcb-bots-section[hidden] {
  display: none !important;
}

.pcb-h3 {
  margin: 0 0 0.3rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.05rem, 2.4vw, 1.35rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--pcb-ink);
}

.pcb-section-sub {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--pcb-muted);
  max-width: 42rem;
}

.pcb-engine-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 560px));
  justify-content: center;
  align-items: stretch;
  gap: 1rem;
  margin-top: 0.85rem;
  width: 100%;
}

.pcb-engine-row > .pcb-bot-card {
  height: 100%;
  box-sizing: border-box;
}

.pcb-engine-row .pcb-bot-card--engine-wide {
  grid-column: 1 / -1;
  width: 100%;
  max-width: min(100%, calc(560px * 2 + 1rem));
  margin-inline: auto;
}

.pcb-fine--engine-card {
  max-width: none;
  width: 100%;
  margin: 0.65rem 0 0;
  box-sizing: border-box;
}

#pcb-engine-card.pcb-bot-card {
  padding: 0.7rem 0.8rem 0.75rem;
}

#pcb-engine-card .pcb-fine {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
  margin-left: 0;
  margin-right: 0;
}

/* ——— Герой: аватар + имя ——— */
.pcb-setup-hero {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.pcb-setup-hero .pcb-bot-card-avatar {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  border: 2px solid rgba(224, 112, 46, 0.35);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

.pcb-setup-hero .pcb-bot-card-name {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
}

.pcb-setup-hero-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ——— Секция сценария — без лишнего card-стиля ——— */
.pcb-setup-section {
  margin: 0 0 1rem;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  max-width: none;
  width: 100%;
  box-sizing: border-box;
}

.pcb-setup-section .pcb-fine-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--pcb-muted);
}

.pcb-setup-section--elo .pcb-elo-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

#pcb-bot-elo-range {
  flex: 1;
  min-width: 0;
  height: 0.45rem;
  accent-color: var(--pcb-orange);
}

.pcb-elo-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--pcb-ink-2);
  min-width: 2.75rem;
  text-align: right;
}

.pcb-elo-hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: var(--pcb-muted);
}

/* ——— Группа опций: галочки в одном блоке ——— */
.pcb-setup-options {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.pcb-setup-option {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s ease, opacity 0.2s ease;
}

.pcb-setup-option + .pcb-setup-option {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.pcb-setup-option:hover {
  background: rgba(255, 255, 255, 0.03);
}

.pcb-setup-option input[type="checkbox"] {
  margin-top: 0.18rem;
  flex-shrink: 0;
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--pcb-orange);
  cursor: pointer;
}

.pcb-setup-option-text {
  font-size: 0.9rem;
  line-height: 1.4;
  color: var(--pcb-ink-2);
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}

#pcb-engine-card .pcb-fine-label {
  font-size: 0.84rem;
}

#pcb-engine-card .pcb-bot-card-actions {
  margin-top: auto;
  padding-top: 0.45rem;
  gap: 0.4rem;
}

#pcb-engine-card .pcb-bot-card-actions .pcb-btn {
  font-size: 0.8rem;
}

.pcb-bot-card--engine {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-top: 4px solid var(--pcb-orange);
}

.pcb-inline-link {
  color: var(--pcb-orange-mid);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.pcb-inline-link:hover {
  color: var(--pcb-orange-mid);
}

.pcb-main-bot-groups {
  display: flex;
  flex-direction: column;
  gap: 1.35rem;
}

.pcb-catalog-toolbar {
  margin-bottom: 1.25rem;
  padding: 1rem 1.05rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(24, 22, 18, 0.95), rgba(15, 14, 11, 0.98));
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

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

.pcb-catalog-search {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.75rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.9rem;
  font-family: var(--font-ui);
  color: var(--pcb-ink);
  background: var(--pcb-bar);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}

.pcb-catalog-search::placeholder {
  color: var(--pcb-muted);
}

.pcb-catalog-search:focus {
  outline: 2px solid var(--pcb-orange);
  outline-offset: 1px;
}

.pcb-catalog-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
}

.pcb-catalog-filters:last-of-type {
  margin-bottom: 0;
}

.pcb-catalog-chip {
  cursor: pointer;
  padding: 0.38rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-ui);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--pcb-ink-2);
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.pcb-catalog-chip:hover {
  color: var(--pcb-ink);
  border-color: rgba(240, 136, 69, 0.35);
}

.pcb-catalog-chip.is-active {
  color: #fff;
  background: linear-gradient(180deg, #c86838, var(--pcb-orange-dark));
  border-color: var(--pcb-orange-mid);
}

.pcb-catalog-empty {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--pcb-muted);
}

.pcb-bot-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* display:flex перебивает нативный [hidden] — без этого поиск/фильтры ставят hidden, но карточки остаются на экране */
.pcb-bot-group[hidden],
.pcb-bot-card[hidden] {
  display: none !important;
}

.pcb-bot-group-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.88rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--pcb-ink);
}

.pcb-bot-group-hint {
  margin: 0 0 0.15rem;
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--pcb-muted);
  max-width: 42rem;
}

.pcb-bots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 560px));
  justify-content: center;
  align-items: stretch;
  gap: 1rem;
}

.pcb-bots-grid > .pcb-bot-card {
  height: 100%;
  box-sizing: border-box;
}

.pcb-bot-card {
  cursor: default;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  text-align: left;
  min-width: 0;
  padding: 0.95rem 0.9rem 1.05rem;
  border: 1px solid rgba(224, 112, 46, 0.4);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--pcb-paper-2), var(--pcb-paper-dark));
  font-family: var(--font-ui);
  color: var(--pcb-ink);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.pcb-bot-card:hover:not(#pcb-engine-card) {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45);
  border-color: rgba(240, 136, 69, 0.55);
}

.pcb-bot-card-hit,
.pcb-bot-card-engine-hit {
  cursor: pointer;
}

.pcb-bot-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: auto;
  padding-top: 0.65rem;
  width: 100%;
  flex-shrink: 0;
}

.pcb-bot-card-actions .pcb-btn {
  flex: 1 1 calc(50% - 0.25rem);
  min-width: 6.5rem;
  justify-content: center;
  padding: 0.55rem 0.65rem;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
}

.pcb-bot-card-actions .pcb-btn .pcb-btn-ic {
  font-size: 0.95rem;
  line-height: 1;
}

/* Выбор цвета на главной: доступна / заблокирована под сценарий */
.pcb-bot-card-actions .pcb-btn.pcb-play-start--available {
  box-shadow: 0 0 0 1px rgba(240, 136, 69, 0.55), 0 2px 10px rgba(0, 0, 0, 0.25);
}

.pcb-bot-card-actions .pcb-btn.pcb-play-start--locked:disabled {
  opacity: 0.42;
  filter: grayscale(0.25);
  cursor: not-allowed;
  box-shadow: none;
}

.pcb-bot-card--engine:hover:not(#pcb-engine-card) {
  border-color: rgba(255, 255, 255, 0.14);
  border-top-color: var(--pcb-orange);
}

#pcb-engine-card.pcb-bot-card.pcb-play-main-card:hover {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05) inset !important;
  border: 1px solid rgba(224, 112, 46, 0.4) !important;
  border-top: 4px solid var(--pcb-orange) !important;
}

.pcb-bot-card.is-selected {
  outline: 2px solid var(--pcb-orange);
  outline-offset: 1px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.pcb-bot-card-row {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  width: 100%;
  min-width: 0;
}

.pcb-bot-card-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.12rem;
  text-align: left;
}

.pcb-bot-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
}

.pcb-bot-card-head .pcb-bot-card-name {
  flex: 1;
  min-width: 0;
}

.pcb-bot-card-rule {
  height: 1px;
  margin: 0.3rem 0 0.2rem;
  background: rgba(255, 255, 255, 0.1);
  width: 100%;
}

.pcb-bot-card-row .pcb-bot-card-avatar {
  width: 124px;
  height: 152px;
  border-radius: 12px;
  object-fit: cover;
  object-position: center 18%;
  flex-shrink: 0;
}

.pcb-bot-card-media {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-bottom: 0.45rem;
  min-width: 0;
}

.pcb-bot-card-titles {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.12rem;
  min-width: 0;
  flex: 1;
}

.pcb-bot-card-sub {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--pcb-ink-2);
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.pcb-bot-card-avatar {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
  background: var(--pcb-paper-2);
}

.pcb-bot-card-avatar--ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  line-height: 1;
}

.pcb-bot-card-name {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.25;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.pcb-bot-card-elo {
  display: block;
  font-size: 0.88rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--pcb-orange-mid);
  line-height: 1.25;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.pcb-bot-card-style {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--pcb-ink-2);
  letter-spacing: 0.02em;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.pcb-bot-card-desc {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--pcb-muted);
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
}

/* Полный текст описания (длинный лор); без line-clamp */
.pcb-bot-card-desc--main {
  margin-top: 0.15rem;
}

/* Слайдер */
.pcb-fine {
  max-width: 36rem;
  margin: 0 auto 1.5rem;
  padding: 1rem 1.15rem;
  background: linear-gradient(180deg, var(--pcb-paper-2), var(--pcb-paper));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 8px 24px rgba(0, 0, 0, 0.35);
}

.pcb-fine-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

.pcb-fine-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--pcb-muted);
}

.pcb-fine-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--pcb-orange-mid);
}

.pcb-fine input[type="range"] {
  width: 100%;
  accent-color: var(--pcb-orange);
  height: 0.4rem;
}

.pcb-fine-hint {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  color: var(--pcb-muted);
  line-height: 1.4;
}

.pcb-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.pcb-color-lock-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--pcb-muted);
  margin: -0.35rem 0 0.75rem;
  max-width: 28rem;
  margin-inline: auto;
  line-height: 1.4;
}

.pcb-btn:disabled {
  cursor: not-allowed;
  opacity: 0.38;
  filter: grayscale(0.25);
  transform: none;
  box-shadow: none;
}

.pcb-btn {
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.85rem 1.5rem;
  border-radius: 4px;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: transform 0.1s ease, filter 0.1s ease;
}

.pcb-btn:active {
  transform: translateY(1px);
}

.pcb-btn.pcb-btn-outline.pcb-btn--review-ai-row {
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.pcb-table--imported-games {
  min-width: 34rem;
}

.pcb-table--imported-games .pcb-td-white,
.pcb-table--imported-games .pcb-td-black {
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pcb-table--imported-games th:last-child,
.pcb-table--imported-games .pcb-td-actions {
  white-space: nowrap;
  text-align: right;
}

.pcb-btn--primary {
  background: linear-gradient(180deg, #e87840, var(--pcb-orange) 30%, var(--pcb-orange-mid));
  color: #fff;
  border: 2px solid var(--pcb-orange-dark);
  box-shadow: 0 4px 0 var(--pcb-orange-dark), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.pcb-btn--primary:hover {
  filter: brightness(1.05);
}

.pcb-btn.pcb-btn--primary.pcb-btn--hero {
  border-radius: 6px;
  padding: 0.82rem 1.35rem;
  font-weight: 700;
  font-size: 0.78rem;
  line-height: 1.2;
  letter-spacing: 0.08em;
  background: linear-gradient(180deg, var(--pcb-terra-bright), var(--pcb-terra));
  border: 1px solid rgba(0, 0, 0, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* Варианты главных кнопок отличаются только цветом фона. */
.pcb-btn.pcb-btn--primary.pcb-btn--hero.pcb-btn--hero-ai {
  background: linear-gradient(180deg, #3d8eef, #6b4fe0);
}

.pcb-btn.pcb-btn--primary.pcb-btn--hero.pcb-btn--hero-engine {
  background: linear-gradient(180deg, #327a4c, #235c3a);
}

.pcb-btn.pcb-btn--primary.pcb-btn--hero:hover {
  filter: brightness(1.05);
}

/* Герой: .pcb-btn задаёт border:none — без отдельного правила контур теряется */
.pcb-btn.pcb-btn-outline.pcb-btn--hero {
  border: 2px solid rgba(255, 255, 255, 0.45);
  background: rgba(8, 6, 4, 0.45);
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 0.82rem 1.35rem;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--pcb-cream);
}

.pcb-btn.pcb-btn-outline.pcb-btn--hero:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.62);
  filter: none;
}

.pcb-btn--ghost {
  background: transparent;
  color: var(--pcb-ink);
  border: 2px solid rgba(255, 255, 255, 0.28);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}

.pcb-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.06);
}

.pcb-btn-ic {
  font-size: 1.1rem;
}

.pcb-error {
  text-align: center;
  color: var(--pcb-legend);
  font-weight: 600;
  margin: 0.5rem 0 0;
}

/* ========== Экран игры ========== */
.view-play {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding-top: max(0.5rem, env(safe-area-inset-top, 0px));
}


/* Симметричные боковые колонки — середина совпадает с центром доски ниже */
.play-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 0.65rem;
  row-gap: 0.45rem;
  margin-bottom: 0.85rem;
  padding: 0.6rem 0.7rem;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: linear-gradient(180deg, var(--pcb-paper-2), var(--pcb-paper));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.play-status-wrap {
  grid-column: 1;
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
  max-width: 100%;
}

.play-opponent-badge {
  position: relative;
  flex-shrink: 0;
  width: 3.875rem;
  height: 3.875rem;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(0, 0, 0, 0.6);
  background-color: #000;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Только бейдж в шапке партии — не трогать .pcb-bot-card-avatar на главной */
.play-opponent-badge > .play-bot-avatar-img {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
  /* Не использовать атрибут hidden: при display:none часть браузеров не грузит/не декодирует src. */
  opacity: 1;
  transition: opacity 0.12s ease;
}

.play-opponent-badge > .play-bot-avatar-img--idle {
  opacity: 0;
}

.play-opponent-badge > .play-bot-avatar-fallback {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--pcb-cream);
  background: #000;
}

/* Как у .promotion-overlay: display:flex перебивает нативный [hidden] в части движков */
.play-opponent-badge > .play-bot-avatar-fallback[hidden] {
  display: none !important;
}

/* Чат с роботом: панель слева от доски */
.play-status-texts {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.bot-chat-panel {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  min-height: 0;
}

.bot-chat-panel-head {
  flex-shrink: 0;
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pcb-muted);
}

.bot-chat-log {
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(22rem, calc(100dvh - 14rem));
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-right: 0.15rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 120, 64, 0.45) transparent;
}

.bot-chat-log::-webkit-scrollbar {
  width: 6px;
}

.bot-chat-log::-webkit-scrollbar-thumb {
  background: rgba(232, 120, 64, 0.4);
  border-radius: 3px;
}

.bot-chat-msg {
  margin: 0;
  padding: 0.5rem 0.55rem;
  border-radius: 8px;
  border: 1px solid rgba(224, 112, 46, 0.28);
  background: linear-gradient(165deg, rgba(36, 32, 28, 0.98), rgba(18, 16, 14, 0.99));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  animation: botChatMsgIn 0.28s ease-out;
}

.bot-chat-msg-text {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--pcb-cream);
  font-style: italic;
}

@keyframes botChatMsgIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.play-status {
  flex: 1;
  margin: 0;
  min-width: 0;
  max-width: 100%;
  min-height: 1.5rem;
  font-size: 0.92rem;
  color: var(--pcb-ink-2);
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-line;
}

.play-status.error {
  color: var(--pcb-legend);
}

.play-header-trailing {
  grid-column: 3;
  justify-self: end;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  max-width: 100%;
  min-width: 0;
}

.play-header-user {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-left: 0.65rem;
  min-width: 0;
  max-width: min(22rem, 55vw);
}

.play-header-user-texts {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 0.06rem;
  min-width: 0;
  text-align: right;
}

.play-user-avatar-badge {
  flex-shrink: 0;
  width: 3.875rem;
  height: 3.875rem;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(0, 0, 0, 0.6);
  background-color: #000;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.play-user-avatar-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  pointer-events: none;
}

.play-header-user-label {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pcb-muted);
  line-height: 1;
}

.play-header-user-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--pcb-ink-2);
  line-height: 1.2;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.play-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  max-width: 100%;
  flex-shrink: 0;
}

/* Разбор: блок часов не показываем (в т.ч. если display у .play-clocks перебивает [hidden]) */
.main-layout.with-review #play-clocks {
  display: none !important;
}

/* Как у .play-bot-avatar-fallback: display:flex у .play-clocks может перебить нативный [hidden] */
#play-clocks[hidden] {
  display: none !important;
}

.play-clocks {
  grid-column: 2;
  justify-self: center;
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem 0.5rem;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.play-clock {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  padding: 0.28rem 0.4rem;
  flex: 0 0 auto;
  width: fit-content;
  max-width: min(7.1rem, calc(28vw + 1.5rem));
  min-width: 4.2rem;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

/* Белые — белый фон и чёрные цифры; чёрные — чёрный фон и светлые цифры */
.play-clock--white {
  background: #f2f0ec;
  border-color: rgba(30, 28, 24, 0.2);
  color: #121110;
}

.play-clock--black {
  background: #0d0c0b;
  border-color: rgba(255, 255, 255, 0.14);
  color: #f4f1eb;
}

/* Чей ход — только обводка и свечение */
.play-clock.is-active {
  border-color: #3ecf6e;
  box-shadow: 0 0 14px rgba(62, 207, 110, 0.32);
}

.play-clock-piece {
  font-size: clamp(0.95rem, 3.2vw, 1.1rem);
  line-height: 1;
  opacity: 0.95;
  flex-shrink: 0;
}

.play-clock--white .play-clock-piece {
  color: #121110;
  opacity: 1;
}

.play-clock--black .play-clock-piece {
  color: #f4f1eb;
  opacity: 1;
}

.play-clock-time {
  font-weight: 800;
  font-size: clamp(0.72rem, 3.6vw, 1.05rem);
  color: var(--pcb-cream);
  min-width: 0;
  text-align: center;
  white-space: nowrap;
}

.play-clock--white .play-clock-time {
  color: #0f0e0d;
}

.play-clock--black .play-clock-time {
  color: #faf8f5;
}

.analysis-move-quality {
  grid-column: 2;
  justify-self: center;
  max-width: min(96vw, 28rem);
  text-align: center;
  text-transform: uppercase;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: 0.08em;
  line-height: 1.2;
  white-space: normal;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.analysis-move-quality--good { color: #6fda7a; }
.analysis-move-quality--ok { color: #e0a03c; }
.analysis-move-quality--bad { color: #c86060; }
.analysis-move-quality--muted { color: var(--pcb-muted); }

/* Обёртка: на десктопе не меняет сетку (contents); на мобиле в разборе — фиксированная высота строки оценки */
.play-header-quality-slot {
  display: contents;
}

/* Подтверждение сдачи (в стиле time-control / results) */
.resign-confirm-overlay[hidden] {
  display: none !important;
}

.resign-confirm-overlay:not([hidden]) {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 280;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.resign-confirm-backdrop {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(8, 6, 4, 0.78);
  cursor: pointer;
}

.resign-confirm-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 22rem;
  padding: 1.15rem 1.2rem 1.05rem;
  border-radius: 10px;
  border: 1px solid rgba(240, 136, 69, 0.5);
  background: linear-gradient(180deg, var(--pcb-paper-2), var(--pcb-paper-dark));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

.resign-confirm-title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--pcb-ink);
}

.resign-confirm-text {
  margin: 0 0 1.1rem;
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--pcb-muted);
}

.resign-confirm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.resign-confirm-actions .btn-secondary {
  flex: 1 1 auto;
  min-width: 6.5rem;
}

.btn-resign-confirm {
  flex: 1 1 auto;
  min-width: 6.5rem;
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.55rem 1rem;
  border-radius: 4px;
  color: #fff;
  border: 2px solid var(--pcb-orange-dark);
  background: linear-gradient(180deg, #e87840, var(--pcb-orange) 35%, var(--pcb-orange-mid));
  box-shadow: 0 3px 0 var(--pcb-orange-dark), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  transition: filter 0.12s ease, transform 0.08s ease;
}

.btn-resign-confirm:hover {
  filter: brightness(1.06);
}

.btn-resign-confirm:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--pcb-orange-dark), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.time-control-overlay[hidden] {
  display: none !important;
}

.time-control-overlay:not([hidden]) {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  box-sizing: border-box;
}

.time-control-backdrop {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(8, 6, 4, 0.78);
  cursor: pointer;
}

.time-control-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 26rem;
  max-height: min(92vh, 640px);
  overflow-y: auto;
  padding: 1.1rem 1.15rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(240, 136, 69, 0.5);
  background: linear-gradient(180deg, var(--pcb-paper-2), var(--pcb-paper-dark));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
}

.time-control-title {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--pcb-ink);
}

.time-control-hint {
  margin: 0 0 0.85rem;
  font-size: 0.82rem;
  color: var(--pcb-muted);
  line-height: 1.4;
}

.time-control-section {
  margin-bottom: 0.75rem;
}

.time-control-section:last-of-type {
  margin-bottom: 0.5rem;
}

.time-control-cat {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pcb-muted);
}

.time-control-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.time-control-row--unlimited .time-control-presets {
  flex: 1;
}

.time-control-icon {
  flex-shrink: 0;
  width: 1.75rem;
  text-align: center;
  font-size: 1.25rem;
  line-height: 1;
}

.time-control-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
}

.tc-preset {
  flex: 1 1 30%;
  min-width: 4.5rem;
  padding: 0.5rem 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--pcb-ink);
  background: rgba(255, 255, 255, 0.07);
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  cursor: pointer;
  transition:
    border-color 0.12s ease,
    background 0.12s ease;
}

.tc-preset:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(240, 136, 69, 0.45);
}

.tc-preset:focus-visible {
  outline: none;
  border-color: var(--pcb-orange);
  box-shadow: 0 0 0 2px rgba(232, 120, 64, 0.35);
}

.tc-preset.is-selected {
  background: rgba(232, 120, 64, 0.14);
  border-color: var(--pcb-orange);
  box-shadow:
    0 0 0 1px rgba(232, 120, 64, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.tc-preset--wide {
  flex: 1 1 100%;
}

.time-control-footer {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.65rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.time-control-play {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.time-control-footer .time-control-cancel {
  width: 100%;
  justify-content: center;
  text-align: center;
}

.main-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.main-layout.with-review {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  gap: 1rem 1.25rem;
  align-items: flex-start;
}

/* Шкала слева от доски: узкий зазор без перекрытия поля */
.main-layout.with-review .board-eval-row {
  width: auto;
  max-width: 100%;
  gap: 0.35rem;
}

/*
 * Партия со шкалой — только на широком экране: max-content ряд, nowrap «доска+история».
 * На ≤900px это ломало ширину доски и порядок блоков на телефоне/планшете.
 */
@media (min-width: 901px) {
  .main-layout.with-live-eval .board-eval-row {
    width: max-content;
    max-width: none;
    margin-inline: auto;
    gap: 0.85rem;
    justify-content: flex-start;
  }

  .main-layout.with-live-eval .play-board-and-history {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 0.3rem 0.4rem;
    min-width: min-content;
  }
}

.main-layout.with-review .play-board-and-history,
.main-layout.with-live-eval .play-board-and-history {
  /* иначе 100% ширина съедает весь ряд — группа «шкала + доска» не центрируется */
  width: auto;
  max-width: 100%;
  min-width: 0;
}

/* Разбор: доска у шкалы слева */
.main-layout.with-review .play-board-and-history {
  flex: 0 1 auto;
  justify-content: flex-start;
}

.layout-primary {
  flex: 0 0 auto;
}

.board-eval-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0.5rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: visible;
}

/* Колонка чата слева от доски */
.bot-chat-panel.bot-chat-left {
  width: 14.5rem;
  max-width: min(14.5rem, 92vw);
  flex: 0 0 auto;
  align-self: flex-start;
  max-height: min(32rem, calc(100dvh - 10rem));
  padding: 0.55rem 0.6rem 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(165deg, rgba(42, 38, 34, 0.95), rgba(22, 20, 18, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 8px 24px rgba(0, 0, 0, 0.35);
}

.main-layout.with-review .bot-chat-panel.bot-chat-left {
  display: flex !important;
  flex-direction: column;
  min-height: 0;
}

.main-layout.with-review .bot-chat-panel.bot-chat-left.coach-chat-panel--review #bot-chat-log,
.main-layout.with-review .bot-chat-panel.bot-chat-left.coach-chat-panel--review #bot-chat-panel-title {
  display: none !important;
}

.main-layout.with-review .bot-chat-panel.bot-chat-left.coach-chat-panel--review {
  min-height: min(26rem, calc(100dvh - 10rem));
}

@media (min-width: 901px) {
  .main-layout.with-review .bot-chat-panel.bot-chat-left.coach-chat-panel--review {
    align-self: stretch;
    max-height: none;
    min-height: 0;
  }

  .main-layout.with-review .bot-chat-panel.bot-chat-left.coach-chat-panel--review .coach-chat-compose-bar {
    margin-top: 0.05rem;
  }

  .main-layout.with-review .bot-chat-panel.bot-chat-left.coach-chat-panel--review .coach-msg-toolbar {
    display: none !important;
  }
}

.main-layout.with-review .bot-chat-panel.bot-chat-left.coach-chat-panel--review #coach-chat-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.main-layout.with-review .bot-chat-panel.bot-chat-left.coach-chat-panel--review .coach-chat-body {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.main-layout.with-review .bot-chat-panel.bot-chat-left.coach-chat-panel--review .coach-chat-log {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-top: 0.1rem;
}

.main-layout.with-review .bot-chat-panel.bot-chat-left.coach-chat-panel--review .coach-chat-compose {
  min-width: 0;
}

.main-layout.with-review .bot-chat-panel.bot-chat-left.coach-chat-panel--review #coach-chat-head {
  display: flex;
}

.coach-chat-quick[hidden] {
  display: none !important;
}

.coach-chat-head {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  flex-shrink: 0;
  padding-bottom: 0.45rem;
  margin-bottom: 0.35rem;
}

.coach-chat-head .coach-chat-panel-head {
  margin: 0;
  flex: 0 0 auto;
  min-width: 0;
  line-height: 1.65rem;
  align-self: center;
}

.coach-chat-font-controls {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.2rem;
}

.coach-chat-font-controls--head {
  display: flex;
  margin-left: auto;
}

.coach-chat-font-controls--compose {
  display: none;
}

.coach-chat-head-tools {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.2rem;
  margin-left: 0;
}

.coach-font-btn {
  min-width: 1.65rem;
  height: 1.65rem;
  padding: 0;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.35);
  color: var(--pcb-cream);
  font-family: var(--font-ui);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.coach-font-btn:hover:not(:disabled) {
  border-color: rgba(240, 196, 154, 0.45);
  background: rgba(240, 196, 154, 0.12);
}

.coach-font-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.coach-settings-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 0;
}

.coach-settings-btn__icon {
  display: block;
  width: 0.875rem;
  height: 0.875rem;
  flex-shrink: 0;
}

.coach-settings-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 290;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: max(1rem, env(safe-area-inset-top, 0px)) 1rem
    max(1rem, env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
}

.coach-settings-overlay[hidden] {
  display: none !important;
}

.coach-settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 6, 4, 0.78);
  cursor: pointer;
}

.coach-settings-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 24rem;
  max-height: min(92dvh, calc(100dvh - 2rem));
  margin: auto;
  padding: 1.15rem 1.2rem 1.05rem;
  border-radius: 10px;
  border: 1px solid rgba(240, 136, 69, 0.5);
  background: linear-gradient(180deg, var(--pcb-paper-2), var(--pcb-paper-dark));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.coach-settings-title {
  margin: 0 0 0.85rem;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--pcb-ink);
}

.coach-settings-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.coach-settings-scroll {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-height: 0;
  flex: 1 1 auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-right: 0.1rem;
}

.coach-settings-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
}

.coach-settings-legend {
  margin: 0 0 0.45rem;
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--pcb-muted);
}

.coach-settings-radio,
.coach-settings-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--pcb-ink);
  cursor: pointer;
}

.coach-settings-radio + .coach-settings-radio {
  margin-top: 0.35rem;
}

.coach-settings-check + .coach-settings-check {
  margin-top: 0.35rem;
}

.coach-settings-check:has(input:disabled) {
  opacity: 0.55;
  cursor: not-allowed;
}

.coach-settings-check input:disabled {
  cursor: not-allowed;
}

.coach-settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.coach-settings-label {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--pcb-muted);
}

.coach-settings-tone-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.coach-settings-tone {
  flex: 1 1 auto;
  accent-color: var(--pcb-orange);
}

.coach-settings-tone-end {
  flex-shrink: 0;
  font-size: 0.72rem;
  color: var(--pcb-muted);
  max-width: 4.5rem;
  line-height: 1.2;
}

.coach-settings-tone-value {
  font-size: 0.78rem;
  color: rgba(240, 136, 69, 0.95);
  text-align: center;
}

.coach-settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.25rem;
  flex-shrink: 0;
  padding-top: 0.35rem;
  background: linear-gradient(180deg, transparent, var(--pcb-paper-dark) 28%);
}

.coach-settings-actions .btn-secondary {
  flex: 1 1 auto;
  min-width: 6.5rem;
}

@media (max-width: 640px) {
  .coach-settings-dialog {
    max-height: min(94dvh, calc(100dvh - 1.25rem));
    padding: 1rem 1rem 0.9rem;
  }

  .coach-settings-form,
  .coach-settings-scroll {
    gap: 0.7rem;
  }

}

.coach-ply-thinking {
  align-self: flex-start;
  max-width: 92%;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  background: rgba(32, 40, 54, 0.92);
  border: 1px solid rgba(240, 136, 69, 0.22);
}

.coach-ply-thinking__label {
  margin: 0 0 0.35rem;
  font-size: 0.74rem;
  color: rgba(240, 196, 154, 0.88);
  font-style: italic;
}

.coach-chat-panel {
  display: none;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

.coach-chat-body {
  flex: 1 1 auto;
  min-height: 8rem;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.coach-chat-panel-head {
  margin-bottom: 0;
}

.coach-chat-log {
  flex: 1 1 auto;
  min-height: 6rem;
  max-height: none;
  overflow-x: hidden;
  overflow-y: auto;
  --coach-chat-font-rem: 0.9rem;
  overflow-anchor: none;
}

.coach-chat-log .bot-chat-msg-text {
  font-size: var(--coach-chat-font-rem);
}

.coach-chat-status {
  margin: 0;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.55);
  font-style: italic;
}

.bot-chat-msg--typing {
  align-self: flex-start;
  width: auto;
  min-width: 3rem;
  padding: 0.5rem 0.65rem;
}

.coach-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  min-height: 1.1rem;
}

.coach-typing-dots span {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  animation: coachTypingDot 1.15s ease-in-out infinite;
}

.coach-typing-dots span:nth-child(2) {
  animation-delay: 0.16s;
}

.coach-typing-dots span:nth-child(3) {
  animation-delay: 0.32s;
}

@keyframes coachTypingDot {
  0%,
  55%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  28% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .coach-typing-dots span {
    animation: none;
    opacity: 0.65;
  }
}

.coach-chat-quick {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.3rem;
  margin: 0;
  flex-shrink: 0;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.coach-chat-quick:has(.coach-quick-btn:only-child) .coach-quick-btn {
  grid-column: 1 / -1;
}

.coach-chat-head > .coach-chat-quick {
  display: flex;
  flex: 1 1 28rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  width: auto;
}

.coach-chat-head .coach-quick-btn {
  width: auto;
  white-space: normal;
}

.coach-quick-btn {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 0.3rem 0.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  color: rgba(242, 235, 227, 0.94);
  font-family: var(--font-ui);
  font-size: var(--coach-chat-font-rem, 0.9rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-transform: none;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(240, 136, 69, 0.2);
  touch-action: manipulation;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    color 0.12s ease;
}

.coach-quick-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(240, 196, 154, 0.35);
  color: #fff;
}

.coach-quick-btn:active:not(:disabled) {
  background: rgba(240, 136, 69, 0.16);
}

.coach-quick-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.coach-chat-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  min-width: 0;
}

.coach-chat-compose-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-shrink: 0;
  width: auto;
  box-sizing: border-box;
}

.coach-chat-compose-bar .coach-chat-font-controls {
  display: none;
  align-items: center;
  gap: 0.2rem;
  flex: 0 0 auto;
  justify-content: flex-start;
}

.coach-chat-compose-bar .coach-chat-send {
  align-self: auto;
  flex: 0 0 auto;
  margin-left: auto;
}

.coach-chat-compose--blocked .coach-chat-input {
  opacity: 0.72;
  cursor: not-allowed;
}

.coach-chat-compose--blocked .coach-chat-send {
  opacity: 0.55;
  cursor: not-allowed;
}

.coach-chat-login-hint[hidden] {
  display: none !important;
}

.coach-chat-input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  resize: none;
  height: 2.35rem;
  min-height: 2.35rem;
  max-height: 2.35rem;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.45rem 0.55rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.28);
  color: #f2ebe3;
  font: inherit;
  line-height: 1.35;
}

.coach-chat-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.coach-chat-send {
  align-self: flex-end;
  height: 2.35rem;
  padding: 0.4rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 800;
}

.coach-chat-send.btn-secondary {
  color: #fff;
  opacity: 1;
  border: 2px solid var(--pcb-send-border);
  background: var(--pcb-send);
  box-shadow: 0 3px 0 var(--pcb-send-shadow);
  transition: filter 0.12s ease, transform 0.08s ease;
}

.coach-chat-send.btn-secondary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.coach-chat-send.btn-secondary:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--pcb-send-shadow);
}

.coach-chat-login-hint {
  grid-column: 1 / -1;
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  line-height: 1.35;
  color: rgba(240, 196, 154, 0.85);
}

.bot-chat-msg--moment {
  border-left: 3px solid rgba(240, 136, 69, 0.75);
  padding-left: 0.55rem;
}

.bot-chat-msg--moment-stale {
  opacity: 0.92;
  border-left-color: rgba(240, 196, 154, 0.45);
}

.coach-moment-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.55rem;
  margin-bottom: 0.35rem;
}

.coach-moment-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #f5c9a8;
  background: rgba(240, 136, 69, 0.18);
  border: 1px solid rgba(240, 136, 69, 0.35);
}

.coach-moment-stale-hint {
  font-size: 0.72rem;
  color: rgba(240, 196, 154, 0.72);
}

.coach-moment-jump {
  margin-left: auto;
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  min-height: 0;
}

.bot-chat-msg--moment-wait {
  opacity: 0.85;
}

.coach-moment-wait__label {
  margin: 0 0 0.35rem;
  font-size: 0.74rem;
  color: rgba(240, 196, 154, 0.8);
}

.bot-chat-msg--coach .bot-chat-msg-text,
.bot-chat-msg--user .bot-chat-msg-text {
  font-style: normal;
}

.bot-chat-msg--user {
  align-self: flex-end;
  max-width: 92%;
  background: linear-gradient(165deg, rgba(58, 72, 96, 0.95), rgba(32, 40, 54, 0.98));
}

.bot-chat-msg--coach .bot-chat-msg-text {
  white-space: normal;
}

.bot-chat-msg--coach {
  position: relative;
}

.bot-chat-msg--coach .bot-chat-msg-text strong {
  font-weight: 650;
  color: #f0e6dc;
}

.bot-chat-msg--coach .bot-chat-msg-text em {
  font-style: italic;
  color: rgba(240, 230, 220, 0.92);
}

.coach-md-heading {
  display: block;
  margin: 0.35rem 0 0.15rem;
  font-size: 0.92em;
  letter-spacing: 0.02em;
  color: #f0c49a;
}

.coach-md-heading--1 {
  font-size: 1em;
}

.coach-md-heading--2 {
  font-size: 0.96em;
}

.bot-chat-msg--error .bot-chat-msg-text {
  color: #ffb4b4;
  font-style: normal;
}

.coach-move-ref {
  color: #8fd4ff;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
  cursor: pointer;
  margin: 0;
  white-space: nowrap;
}

.coach-move-ref:hover,
.coach-move-ref.coach-move-ref--active,
.coach-move-ref.coach-move-ref--pinned {
  color: #c8e8ff;
  text-decoration-style: solid;
}

.coach-move-ref.coach-move-ref--pinned {
  font-weight: 600;
}

.play-board-and-history {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: center;
  gap: 0.85rem 1rem;
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

/* Правая колонка: кнопки партии, моб. табы, история */
.play-side-panel {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 14.5rem;
  max-width: min(14.5rem, 92vw);
  flex: 0 0 auto;
  min-width: 0;
  box-sizing: border-box;
  gap: 0.35rem;
}

/*
 * Строка «История | Чат» + кнопки просмотра: на мобилке одна линия; на десктопе кнопки — после колонки
 * истории (order), табы скрыты (.play-mobile-tabs { display: none }).
 */

.play-mobile-tabs-bar {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
}

@media (max-width: 640px) {
  #view-play:not([hidden]) .play-mobile-tabs-bar,
  html.pcb-play-view-open #view-play .play-mobile-tabs-bar {
    order: 2;
  }

  #view-play:not([hidden]) .play-history-column,
  html.pcb-play-view-open #view-play .play-history-column {
    order: 3;
  }
}

@media (min-width: 641px) {
  #view-play:not([hidden]) .play-history-column,
  html.pcb-play-view-open #view-play .play-history-column {
    order: 2;
  }

  #view-play:not([hidden]) .play-mobile-tabs-bar,
  html.pcb-play-view-open #view-play .play-mobile-tabs-bar {
    order: 3;
  }

  #view-play:not([hidden]) .play-mobile-tabs-bar .play-move-history-replay,
  html.pcb-play-view-open #view-play .play-mobile-tabs-bar .play-move-history-replay {
    width: 100%;
    box-sizing: border-box;
  }
}

.play-history-actions {
  order: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  width: 100%;
  max-width: 100%;
}

.play-history-column {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  flex: 1 1 auto;
  min-height: 0;
}

.play-history-actions .btn-secondary,
.play-history-actions .btn-danger {
  flex: 1 1 0;
  min-width: 0;
}

.play-move-history {
  flex: 0 0 auto;
  align-self: flex-start;
  width: 100%;
  max-width: 100%;
  margin-top: 0;
  max-height: min(28rem, calc(100vw - 6rem));
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 0.55rem 0.6rem 0.5rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: linear-gradient(165deg, rgba(42, 38, 34, 0.95), rgba(22, 20, 18, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 8px 24px rgba(0, 0, 0, 0.35);
}

.play-move-history-head {
  flex-shrink: 0;
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pcb-muted);
}

/* Список ходов + кнопки просмотра: на десктопе — колонка, на мобилке в игре — одна строка (см. MOBILE) */
.play-move-history-strip {
  display: flex;
  flex-direction: column;
  /* auto: иначе при flex-basis:0 и высоте карточки auto полоса схлопывается и кнопки «выпадают» из блока */
  flex: 0 1 auto;
  min-height: 0;
  min-width: 0;
  gap: 0;
}

/* Десктоп: длинный список — прокрутка по max-height (без flex-basis:0 на полосе — иначе блок схлопывается) */
@media (min-width: 641px) {
  #view-play:not([hidden]) .play-move-history-strip .play-move-history-list,
  html.pcb-play-view-open #view-play .play-move-history-strip .play-move-history-list {
    max-height: min(22rem, calc(100vh - 11rem));
  }
}

.play-move-history-list {
  flex: 1 1 auto;
  min-height: 4rem;
  overflow-y: auto;
  overflow-x: hidden;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--pcb-ink);
  scrollbar-width: thin;
  scrollbar-color: rgba(232, 120, 64, 0.45) transparent;
}

.play-move-history-list::-webkit-scrollbar {
  width: 6px;
}

.play-move-history-list::-webkit-scrollbar-thumb {
  background: rgba(232, 120, 64, 0.4);
  border-radius: 3px;
}

.play-move-history-row {
  display: grid;
  grid-template-columns: 2.15rem minmax(0, 1fr);
  gap: 0.25rem 0.45rem;
  align-items: baseline;
  padding: 0.12rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.play-move-history-pair {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.5rem;
  align-items: baseline;
  min-width: 0;
}

.play-move-history-row:last-child {
  border-bottom: none;
}

.play-move-history-num {
  font-variant-numeric: tabular-nums;
  color: var(--pcb-muted);
  font-size: 0.72rem;
  text-align: right;
}

.play-move-history-san {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: #f5f0e8;
}

.play-move-history-san--user {
  color: #f0c49a;
}

.play-move-history-empty {
  margin: 0;
  font-size: 0.78rem;
  color: var(--pcb-muted);
  line-height: 1.45;
}

.play-move-history-replay {
  display: flex;
  flex-shrink: 0;
  gap: 0.35rem;
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.play-hist-replay-btn {
  flex: 1;
  min-width: 2.1rem;
  padding: 0.28rem 0.2rem;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--pcb-ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.play-hist-replay-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.16);
}

.play-hist-replay-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.play-hist-replay-btn--primary {
  flex: 1.35;
  color: #2a241c;
  background: linear-gradient(165deg, #f0c49a, #e8a86a);
  border-color: rgba(240, 196, 154, 0.45);
}

.play-hist-replay-btn--primary:hover:not(:disabled) {
  background: linear-gradient(165deg, #f5d4ae, #edb07e);
  border-color: rgba(240, 196, 154, 0.65);
}

.play-hist-replay-btn--current {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.28rem 0.4rem;
}

.play-hist-replay-btn--current .play-hist-replay-icon {
  display: block;
}

.play-move-history-row--replay {
  background: rgba(240, 196, 154, 0.12);
  border-radius: 4px;
  margin: 0 -0.15rem;
  padding-left: 0.15rem;
  padding-right: 0.15rem;
}

.board-outer {
  position: relative;
  /* inset под #board и promotion-overlay; WebView часто даёт height:100% у #board = 0 при aspect-ratio у родителя */
  --board-outer-inset: clamp(17px, 1.5vw, 22px);
  --board-outer-inset-y: calc(var(--board-outer-inset) - 3px);
  width: min(100vw - 2rem, 480px);
  aspect-ratio: 1;
  flex-shrink: 0;
  padding: var(--board-outer-inset-y) var(--board-outer-inset);
  background: linear-gradient(145deg, #3a3835, #252524 50%, #1a1a19);
  border-radius: 6px;
  border: 2px solid #0f0f0f;
  box-shadow: inset 0 0 0 2px var(--pcb-orange), 0 12px 28px rgba(0, 0, 0, 0.4);
}

.board-outer.coach-board-preview--hypothetical {
  background: linear-gradient(145deg, #4e4c49, #343332 50%, #2c2c2b);
  box-shadow:
    inset 0 0 0 2px rgba(240, 136, 69, 0.55),
    0 12px 28px rgba(0, 0, 0, 0.35),
    inset 0 0 48px rgba(255, 255, 255, 0.07);
}

.board-outer.coach-board-preview--hypothetical .cg-wrap {
  filter: brightness(1.16) saturate(0.94);
  transition: filter 0.15s ease;
}

/* Старые WebView (Android 11 и др.): без aspect-ratio высота = 0 — Chessground не рисует поле */
@supports not (aspect-ratio: 1) {
  .board-outer {
    height: min(100vw - 2rem, 480px);
  }

  @media (max-width: 640px) {
    #view-play:not([hidden]) .board-outer {
      height: min(var(--play-board-side-no-eval), 100vw);
    }

    #view-play:not([hidden]) .board-eval-row.pcb-board-eval-row--with-eval-strip .board-outer,
    #view-play:not([hidden]) .main-layout.with-live-eval .board-outer {
      height: min(var(--play-board-side-with-eval), 100vw);
    }
  }
}

/*
 * Узкая доска «под боковые колонки» — только на широком экране.
 * На планшетах и узких окнах calc(...) давал ≤0 и доска пропадала полностью.
 */
@media (min-width: 901px) {
  .main-layout.with-live-eval .board-outer {
    align-self: flex-start;
    width: min(
      min(100vw - 2rem, 480px),
      calc(100vw - 2rem - 3.25rem - 14.5rem - min(14.5rem, 38vw))
    );
    max-width: 100%;
  }
}

/* Без явного [hidden] display:flex ломает скрытие нативным атрибутом hidden */
.promotion-overlay[hidden] {
  display: none !important;
}

.promotion-overlay:not([hidden]) {
  position: absolute;
  top: var(--board-outer-inset-y);
  left: var(--board-outer-inset);
  right: var(--board-outer-inset);
  bottom: var(--board-outer-inset-y);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
}

.promotion-overlay-backdrop {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(10, 8, 6, 0.72);
  border-radius: 2px;
}

.promotion-dialog {
  position: relative;
  z-index: 1;
  max-width: 17rem;
  padding: 1rem 1.1rem 0.85rem;
  border-radius: 8px;
  border: 1px solid rgba(240, 136, 69, 0.45);
  background: linear-gradient(180deg, var(--pcb-paper-2), var(--pcb-paper-dark));
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55);
  text-align: center;
}

.promotion-title {
  margin: 0 0 0.2rem;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pcb-ink);
}

.promotion-hint {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  color: var(--pcb-muted);
  line-height: 1.35;
}

.promotion-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin-bottom: 0;
}

.promotion-choice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  min-height: 3.25rem;
  padding: 0.45rem 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pcb-ink);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.1s ease;
}

.promotion-choice-btn:hover {
  background: rgba(224, 112, 46, 0.2);
  border-color: rgba(240, 136, 69, 0.55);
}

.promotion-choice-btn:active {
  transform: scale(0.98);
}

.promotion-choice-ic {
  font-size: 1.65rem;
  line-height: 1;
  user-select: none;
}

.board-outer cg-board {
  background-color: transparent !important;
  background-image: conic-gradient(rgba(112, 42, 25, 0.22) 25%, transparent 0 50%, rgba(112, 42, 25, 0.22) 0 75%, transparent 0), url("/static/boards/board-terra.jpg?v=1") !important;
  background-size: 25% 25%, cover;
  border-radius: 2px;
}

#board {
  position: absolute;
  top: var(--board-outer-inset-y);
  left: var(--board-outer-inset);
  right: var(--board-outer-inset);
  bottom: var(--board-outer-inset-y);
  width: auto;
  height: auto;
  border-radius: 2px;
  /* Координаты Chessground (top:-20px / bottom:-4px) рисуются в padding .board-outer */
  overflow: visible;
}

/*
 * Старые WebView (Android 10–11): Chessground при mount меряет .cg-wrap, и если на этом тике
 * у #board ещё 0×0 (или родитель только что показался), .cg-wrap так и остаётся 0×0.
 * Принудительно растягиваем wrap/container/board на всю площадь #board.
 */
.board-outer #board > .cg-wrap,
.board-outer .cg-wrap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
}

.board-outer .cg-wrap > cg-container {
  width: 100%;
  height: 100%;
}

/* Клетка под фигурой почти не видна: у фигур z-index:2. Король — обводка на самой фигуре. */
.board-outer cg-board square.check {
  background-color: rgba(200, 50, 50, 0.4) !important;
  background-image: linear-gradient(180deg, rgba(235, 90, 90, 0.45), rgba(160, 40, 40, 0.35)) !important;
  box-shadow: inset 0 0 0 2px rgba(130, 30, 30, 0.45);
}

/* Subtle origin, framed destination: preserve board texture and piece contrast. */
.board-outer cg-board square.coach-hl-from,
.board-outer cg-board square.coach-hl-sq,
.board-outer cg-board square.review-best-from {
  --move-rgb:177,138,255;
  background-color:rgba(var(--move-rgb),.12) !important;
  background-image:radial-gradient(circle,transparent 48%,rgba(var(--move-rgb),.2) 100%) !important;
  box-shadow:inset 0 0 0 2px rgba(var(--move-rgb),.55);
  border-radius:4px;
}
.board-outer cg-board square.coach-hl-to,
.board-outer cg-board square.review-best-to {
  --move-rgb:177,138,255;
  background-color:rgba(var(--move-rgb),.18) !important;
  background-image:radial-gradient(circle,transparent 40%,rgba(var(--move-rgb),.3) 100%) !important;
  box-shadow:inset 0 0 0 3px rgba(var(--move-rgb),.92),inset 0 0 14px rgba(var(--move-rgb),.16);
  border-radius:4px;
}
.board-outer cg-board square.coach-hl-from,
.board-outer cg-board square.coach-hl-to,
.board-outer cg-board square.coach-hl-sq {--move-rgb:177,138,255;}
.board-outer svg.cg-shapes line {stroke-linecap:round;filter:drop-shadow(0 1px 1px #10221a88);}

.board-outer .cg-wrap cg-board piece.king-in-check {
  box-shadow:
    inset 0 0 0 3px rgba(235, 55, 55, 0.98),
    0 0 16px rgba(255, 70, 70, 0.85);
  border-radius: 3px;
  z-index: 10 !important;
}

.board-outer .cg-wrap coords {
  opacity: 1;
  font-size: clamp(12px, 1vw, 15px);
  font-weight: 700;
  line-height: 1;
}

.board-outer coords coord {
  color: #fff3dc !important;
  text-shadow: 0 1px 2px #000;
}

/* Координаты — в тёмной рамке .board-outer, не поверх клеток */
.board-outer .cg-wrap coords.ranks {
  top: 0;
  left: calc(-1 * var(--board-outer-inset) + 2px);
  width: calc(var(--board-outer-inset) - 2px);
  align-items: stretch;
}

.board-outer .cg-wrap coords.ranks coord {
  transform: none;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
}

.board-outer .cg-wrap coords.files {
  bottom: calc(-1 * var(--board-outer-inset-y) + 1px);
  left: 0;
  height: calc(var(--board-outer-inset-y) - 1px);
}

.board-outer .cg-wrap coords.files coord {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
}

.eval-column[hidden] {
  display: none !important;
}

/* JS снимает hidden; запас против залипшего атрибута / кэша старой разметки */
#eval-column.eval-column--live {
  display: flex !important;
}

.eval-column {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 2.5rem;
  flex-shrink: 0;
  align-self: stretch;
  min-height: 0;
}

.eval-king {
  font-size: 0.75rem;
  color: var(--pcb-muted);
  user-select: none;
}

.eval-track {
  flex: 1 1 auto;
  width: 100%;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin: 0.2rem 0;
}

.eval-white-fill {
  flex: 1 1 0;
  min-height: 3px;
  background: linear-gradient(180deg, #f5f2ec, #c8c4bc);
  transition: flex 0.14s ease-out;
}

.eval-black-fill {
  flex: 1 1 0;
  min-height: 3px;
  background: linear-gradient(180deg, #4a4540, #1a1918);
  transition: flex 0.14s ease-out;
}

.eval-readout {
  font-size: 0.62rem;
  font-variant-numeric: tabular-nums;
  color: var(--pcb-muted);
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Партия: шкала без оранжевой обводки — нейтральная рамка как у трека */
.main-layout.with-live-eval .eval-column {
  flex-shrink: 0;
  position: relative;
  min-width: 2.35rem;
  width: max(2.35rem, clamp(1.35rem, 4.2vw, 2.4rem));
  padding: 0.3rem 0.25rem;
  box-sizing: border-box;
  background: linear-gradient(180deg, rgba(42, 36, 30, 0.99), rgba(18, 16, 14, 1));
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.main-layout.with-live-eval .eval-king {
  color: rgba(252, 244, 230, 0.72);
}

.main-layout.with-live-eval .eval-track {
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.main-layout.with-live-eval .eval-white-fill {
  background: linear-gradient(180deg, #fffefb, #e2ddd4);
}

.main-layout.with-live-eval .eval-black-fill {
  background: linear-gradient(180deg, #2e2b28, #0c0b0a);
}

.main-layout.with-live-eval .eval-readout {
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: rgba(252, 246, 236, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  /* узкая колонка + ellipsis давали «+…» вместо +0.00 */
  max-width: none;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.review-aside {
  flex: 1 1 260px;
  max-width: 320px;
  min-width: 220px;
}

.review-section-inner {
  padding: 1.1rem 1.15rem;
  background: linear-gradient(180deg, var(--pcb-paper-2), var(--pcb-paper));
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

/* Табы разбора — только на ≤640px (см. блок MOBILE) */
.review-mobile-tabs {
  display: none;
}

.review-mtab {
  flex: 1 1 0;
  min-width: 0;
  min-height: 40px;
  padding: 0.38rem 0.25rem;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pcb-cream);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(240, 136, 69, 0.2);
  touch-action: manipulation;
}

.review-mtab.is-active {
  color: #2a241c;
  background: linear-gradient(165deg, #f0c49a, #e8a86a);
  border-color: rgba(240, 196, 154, 0.45);
}

#review-body {
  display: flex;
  flex-direction: column;
  gap: 0;
}

@media (min-width: 641px) {
  #review-body {
    gap: 0.45rem;
  }

  /*
   * Десктоп: одна колонка как в main (без табов). Не используем display:contents —
   * в колонке flex/grid контент с «расплющенными» секциями часто не рисуется.
   * Все секции видны сразу; is-active на мобилке скрывает лишнее — здесь не влияет.
   */
  .main-layout.with-review #review-body > .review-pane {
    display: flex !important;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
  }

  .main-layout.with-review #review-body > .review-pane--moves {
    margin-top: -0.05rem;
  }

  .main-layout.with-review .review-stats-duel {
    margin-bottom: 0.35rem;
  }

  .main-layout.with-review .review-acc-step-strip:has(.js-reset-review-exploration[hidden]) {
    display: none !important;
    margin: 0 !important;
  }

  .main-layout.with-review #review-body > .review-mobile-tabs,
  .main-layout.with-review #review-body > .review-tab-toolbar {
    display: none !important;
  }

  .main-layout.with-review #review-tab-coach,
  .main-layout.with-review .review-pane--coach {
    display: none !important;
  }

  .main-layout.with-review #review-last-moves-line,
  .main-layout.with-review #review-moves-host {
    display: none !important;
  }

  .main-layout.with-review #review-body .review-moves-stack {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    min-width: 0;
  }

  .main-layout.with-review #review-body .review-moves-controls {
    display: block;
    margin-top: 0;
  }
}

.review-close-row {
  display: flex;
  justify-content: center;
  margin: 0 0 0.55rem;
}

.review-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 0.85rem;
  color: var(--pcb-ink);
  text-align: center;
}

.review-muted {
  color: var(--pcb-muted);
  margin: 0;
  font-size: 0.9rem;
}

.review-error {
  color: var(--pcb-legend);
  margin: 0 0 0.5rem;
}

/* Premium gate в панели разбора при исчерпании лимита */
.review-premium-gate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1.25rem 1rem;
  border: 1px solid rgba(240, 136, 69, 0.35);
  border-radius: 12px;
  background: rgba(240, 136, 69, 0.07);
  text-align: center;
}

.review-premium-gate__crown {
  font-size: 2rem;
  line-height: 1;
  color: #f08845;
}

.review-premium-gate__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--pcb-ink-2);
}

.review-premium-gate__sub {
  margin: 0;
  font-size: 0.8rem;
  color: var(--pcb-muted);
  line-height: 1.4;
}

/* Кнопка «Анализ» с исчерпанным лимитом */
.results-btn-analyze--locked {
  background: rgba(240, 136, 69, 0.12) !important;
  border: 1.5px solid rgba(240, 136, 69, 0.45) !important;
  color: #f08845 !important;
  cursor: not-allowed;
  box-shadow: none !important;
}

/* Точность в боковой панели разбора: два блока без строки «ходов» */
.review-stats-duel {
  display: flex;
  align-items: stretch;
  justify-content: center;
  margin: 0 0 1rem;
  padding: 0.12rem;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.review-stats-card {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.42rem;
  padding: 0.55rem 0.55rem 0.75rem;
  min-width: 0;
}

.review-stats-card--you {
  background: rgba(255, 255, 255, 0.035);
}

.review-stats-card--bot {
  background: rgba(255, 255, 255, 0.02);
}

.review-stats-card-gap {
  flex: 0 0 1px;
  width: 1px;
  align-self: stretch;
  margin: 0.45rem 0.12rem;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(255, 255, 255, 0.11) 22%,
    rgba(255, 255, 255, 0.11) 78%,
    transparent 100%
  );
}

/* Полоска цвета стороны: белые / чёрные */
.review-stats-card-cue {
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 3px;
  flex-shrink: 0;
}

.review-stats-card-cue--white {
  background: linear-gradient(90deg, #f6f2eb, #cfc7be);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.review-stats-card-cue--black {
  background: linear-gradient(90deg, #2c2a28, #0c0b0a);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35);
}

.review-stats-card-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-width: 0;
  width: 100%;
  flex: 1 1 auto;
}

.review-stats-card-label {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  text-align: center;
  max-width: 100%;
  width: 100%;
  font-size: clamp(0.58rem, 2.4vw, 0.66rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--pcb-muted);
  line-height: 1.25;
  min-height: 2.5em;
}

.review-stats-card-value {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.72rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.08;
  color: var(--pcb-cream);
  flex-shrink: 0;
}

.review-stats-card-value--great { color: #6fda7a; }
.review-stats-card-value--good  { color: #c8d46a; }
.review-stats-card-value--ok    { color: #e0a03c; }
.review-stats-card-value--poor  { color: #c86060; }

.review-stats-card-value--muted {
  color: var(--pcb-muted);
  font-size: 1.28rem;
  font-weight: 700;
}

#review-stats {
  width: 100%;
}

/* Десктоп: дисклеймер убран; вместо списка истории — одна строка «Ход N: …» + сброс */
@media (min-width: 641px) {
  .main-layout.with-review .pcb-accuracy-disclaimer--review {
    display: none !important;
  }

  .main-layout.with-review .play-side-panel {
    display: none !important;
  }

  /* Сброс только в полосе под точностью — не дублировать в блоке PGN */
  .main-layout.with-review #btn-reset-exploration {
    display: none !important;
  }

  .main-layout.with-review .review-acc-step-strip {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin-top: 0.25rem;
    min-width: 0;
  }

  .main-layout.with-review #btn-reset-exploration-acc,
  .main-layout.with-review .review-acc-reset-btn {
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 0.5rem 0.9rem;
    font-size: 0.85rem;
    white-space: nowrap;
    display: block;
  }
}

/* Мобилка: полоса с десктопной кнопкой сброса не используется (сброс — в .review-tab-toolbar) */
@media (max-width: 640px) {
  .main-layout.with-review .review-acc-step-strip {
    display: none !important;
  }
}

.review-aside .pcb-accuracy-disclaimer {
  margin-top: 0.65rem;
  margin-bottom: 0.85rem;
  text-align: center;
  font-size: 0.76rem;
}

.review-slider-label {
  display: none;
}

/* Колонка: скролл только по списку ходов; ползунок и шаги под ним (не sticky к viewport). */
.review-moves-stack {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.review-moves-controls {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.review-control-block {
  padding: 0.6rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(0, 0, 0, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.review-control-block__title {
  display: block;
  margin: 0 0 0.45rem;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--pcb-muted);
  text-align: center;
  cursor: default;
}

.review-moves-topbar {
  display: none;
}

/* Строка «Сброс» под табами разбора — только мобилка (display включается в MOBILE ≤640px) */
.review-tab-toolbar {
  display: none;
}

.review-last-moves-line {
  margin: 0;
  padding: 0;
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--pcb-cream);
  line-height: 1.3;
}

.review-last-moves-line--muted {
  color: var(--pcb-muted);
  font-weight: 500;
  font-size: 0.78rem;
}

.review-slider-row {
  display: grid;
  grid-template-columns: 2.6rem 1fr 2.6rem;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0;
}

.review-slider-row > button,
.review-step-row button,
.review-step-nav-btn {
  padding: 0;
  flex-shrink: 0;
  background: linear-gradient(180deg, #4a4845, #353432);
  color: var(--pcb-cream);
  border: 2px solid #1a1918;
  font-size: 0.85rem;
  box-shadow: 0 2px 0 #0f0f0f;
  border-radius: 8px;
}

.review-step-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
}

.review-step-nav-btn__icon {
  display: block;
  width: 1.35rem;
  height: 1.35rem;
  flex-shrink: 0;
  pointer-events: none;
}

.review-slider-row > button {
  width: 2.6rem;
  height: 2.35rem;
  min-height: 0;
  line-height: 1;
}

.review-slider-row input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--pcb-orange);
}

.review-step-row {
  display: grid;
  grid-template-columns: 2.6rem 1fr 2.6rem;
  align-items: stretch;
  gap: 0.5rem;
  margin-bottom: 0;
}

.review-step-row button,
.review-step-nav-btn {
  width: 2.6rem;
  min-width: 2.6rem;
  max-width: 2.6rem;
  min-height: 2.75rem;
  height: 2.75rem;
  max-height: 2.75rem;
  align-self: stretch;
  font-size: 1.15rem;
  line-height: 1;
}

.review-move-quality {
  display: none;
}

.review-show-best-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.14);
  font-size: 0.85rem;
  color: var(--pcb-cream);
  cursor: pointer;
  user-select: none;
}

.review-show-best-row input[type="checkbox"] {
  accent-color: var(--pcb-orange);
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.rev-step-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.08rem;
  min-width: 0;
  max-width: 100%;
  padding: 0.3rem 0.35rem;
  text-align: center;
  overflow: hidden;
  align-self: stretch;
}

.rev-step-label__num {
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pcb-muted);
  line-height: 1.2;
}

.rev-step-label__san {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--pcb-cream);
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  word-break: break-word;
}

.rev-step-label__san--muted {
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: normal;
  color: var(--pcb-muted);
  letter-spacing: 0.02em;
}

.rev-step-label__line {
  font-family: var(--font-ui);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--pcb-cream);
  line-height: 1.25;
  max-width: 100%;
  overflow: hidden;
  white-space: normal;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  word-break: break-word;
}

.review-copy-pgn-after-best {
  margin-top: 0.35rem;
}

.review-copy-pgn-after-best .btn-secondary {
  width: 100%;
  box-sizing: border-box;
}

/* Дубликат кнопки на вкладке «PGN» только в мобильной раскладке */
.review-pgn-mobile-copy-wrap {
  display: none;
}

@media (max-width: 640px) {
  .main-layout.with-review .review-pgn-mobile-copy-wrap {
    display: block;
    margin-bottom: 0.65rem;
  }

  /* Вкладка «Точность»: без дисклеймера (на десктопе он тоже скрыт в ≥641px) */
  .main-layout.with-review .pcb-accuracy-disclaimer--review {
    display: none !important;
  }

  /*
   * Вся секция post на мобилке не нужна (#btn-copy-pgn только для десктопа).
   * Важно: перебить .review-pane.is-active { display:flex !important } из блока MOBILE.
   */
  .main-layout.with-review #review-body > .review-pane--post {
    display: none !important;
  }

  .main-layout.with-review .review-pane--moves .review-show-best-row {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
  }
}

.review-moves-coach-thinking {
  display: none;
}

.review-moves-coach-thinking__thinking[hidden] {
  display: none !important;
}

.review-caption {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: var(--pcb-muted);
  min-height: 2.5rem;
  line-height: 1.35;
  text-align: center;
}

.review-caption-lines {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: 100%;
}

.review-caption-line1,
.review-caption-line2 {
  width: 100%;
  text-align: center;
}

.review-caption-line2 {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
}

.review-caption-line1--plain {
  color: var(--pcb-muted);
  font-weight: 500;
}

.review-caption-san {
  font-weight: 800;
  color: var(--pcb-ink);
}

.review-caption-role {
  color: var(--pcb-muted);
  font-weight: 600;
}

/* Классификация хода в разборе (ключи из app/analysis.py classify_loss) */
.review-class {
  display: inline-block;
  padding: 0.24rem 0.72rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  vertical-align: middle;
  line-height: 1.2;
  border: 1px solid transparent;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
}

.review-class--best {
  color: #0a1f0f;
  background: #6edc84;
  border-color: rgba(34, 120, 60, 0.42);
}

.review-class--good {
  color: #1a2a12;
  background: #a9d978;
  border-color: rgba(100, 130, 50, 0.38);
}

.review-class--inaccuracy {
  color: #2a2210;
  background: #e8c96e;
  border-color: rgba(160, 110, 30, 0.42);
}

.review-class--mistake {
  color: #2a1510;
  background: #e69a66;
  border-color: rgba(180, 80, 30, 0.45);
}

.review-class--blunder {
  color: #fff8f6;
  background: #d9564b;
  border-color: rgba(120, 20, 20, 0.5);
}

.review-class--unknown {
  color: var(--pcb-ink-2);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

/* Кнопка сброса исследования */
.btn-reset-exploration {
  display: block;
  width: 100%;
  margin-bottom: 0.65rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-nav);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pcb-orange-mid);
  background: rgba(224, 112, 46, 0.1);
  border: 1px solid rgba(224, 112, 46, 0.3);
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn-reset-exploration:hover {
  background: rgba(224, 112, 46, 0.2);
  border-color: rgba(224, 112, 46, 0.5);
}

.btn-reset-exploration[hidden] { display: none !important; }

/* Нижние кнопки разбора */
.review-bottom-actions {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 0.85rem;
}

.review-bottom-actions .btn-secondary {
  width: 100%;
  flex: none;
  box-sizing: border-box;
}

.btn-close-review-header {
  white-space: nowrap;
}

.btn-close-review-panel {
  white-space: nowrap;
  width: 100%;
  flex: none;
  box-sizing: border-box;
  justify-content: center;
}

/* Кнопки общие (разбор, модалка) */
button {
  cursor: pointer;
  font-family: var(--font-ui);
  font-weight: 700;
  border-radius: 4px;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary {
  background: linear-gradient(180deg, #4a4845, #353432);
  color: var(--pcb-cream);
  border: 2px solid #1a1918;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  box-shadow: 0 3px 0 #0f0f0f;
}

.btn-secondary:hover {
  filter: brightness(1.08);
}

.btn-danger {
  background: linear-gradient(180deg, #a63a3a, #7a2828);
  color: #fff;
  border: 2px solid #4a1515;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  box-shadow: 0 3px 0 #3a1010;
}

.results-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.results-overlay[hidden] {
  display: none !important;
}

.results-overlay-backdrop {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(20, 18, 16, 0.72);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.results-card {
  width: 100%;
  max-width: 420px;
  padding: 1.35rem 1.45rem;
  background: linear-gradient(180deg, var(--pcb-paper-2), var(--pcb-paper-dark));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  color: var(--pcb-ink);
}

.results-card--final {
  position: relative;
  z-index: 1;
  max-width: min(380px, 100%);
  text-align: center;
  padding: 2.5rem 2rem 2rem;
  animation: results-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes results-pop {
  from { opacity: 0; transform: scale(0.88) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* Продвижение по лиге после победы */
.ladder-celebration-overlay {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 205;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.ladder-celebration-overlay[hidden] {
  display: none !important;
}

.ladder-celebration-backdrop {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: radial-gradient(
      ellipse 90% 70% at 50% 40%,
      rgba(224, 112, 46, 0.22) 0%,
      rgba(10, 9, 7, 0.88) 62%
    ),
    rgba(12, 10, 8, 0.82);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.ladder-celebration-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: min(22rem, 100%);
  padding: 2rem 1.75rem 1.75rem;
  text-align: center;
  background: linear-gradient(165deg, rgba(40, 32, 26, 0.98), rgba(14, 12, 10, 0.99));
  /* Фолбек для WebView без color-mix() */
  border: 1px solid rgba(224, 112, 46, 0.5);
  border: 1px solid color-mix(in srgb, var(--pcb-orange-mid) 45%, rgba(255, 255, 255, 0.12));
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.35),
    0 28px 70px rgba(0, 0, 0, 0.65),
    0 0 48px rgba(224, 112, 46, 0.18);
  animation: ladder-celeb-pop 0.45s cubic-bezier(0.34, 1.45, 0.64, 1) both;
}

@keyframes ladder-celeb-pop {
  from {
    opacity: 0;
    transform: scale(0.82) translateY(18px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.ladder-celebration-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--pcb-orange-mid);
}

.ladder-celebration-title {
  margin: 0 0 1.1rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.35rem;
  line-height: 1.2;
  letter-spacing: 0.02em;
  color: var(--pcb-cream);
  text-wrap: balance;
}

.ladder-celebration-rank-wrap {
  display: flex;
  justify-content: center;
  margin: 0 0 1rem;
}

.ladder-celebration-sub {
  margin: 0 0 1.35rem;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--pcb-ink-2);
}

/* Торжественное окно: разряд крупнее, чем на карточках роботов (без scale — чётче шрифт). */
.ladder-celebration-card .pcb-ladder-rank-pill {
  padding: 0.48rem 1.15rem;
  /* Фолбек без color-mix() — упрощённая верхняя подсветка */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -8px 18px rgba(0, 0, 0, 0.38),
    0 0 18px var(--m-glow);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--m-accent) 12%, rgba(255, 255, 255, 0.1)),
    inset 0 -8px 18px rgba(0, 0, 0, 0.38),
    0 0 18px var(--m-glow);
}

.ladder-celebration-card .pcb-ladder-rank-pill__txt {
  font-size: clamp(1.05rem, 4.5vw, 1.45rem);
  letter-spacing: 0.05em;
}

/* Вердикт */
.results-verdict {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  margin-bottom: 0.85rem;
}

.results-verdict-icon {
  font-size: 1.8rem;
  line-height: 1;
  display: block;
  margin-bottom: 0.1rem;
  opacity: 0.75;
}

.results-verdict-text {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 0;
  line-height: 1;
}

.results-verdict--win .results-verdict-icon,
.results-verdict--win .results-verdict-text {
  color: #4ade80;
}

.results-verdict--loss .results-verdict-icon,
.results-verdict--loss .results-verdict-text {
  color: #b84444;
}

.results-verdict--draw .results-verdict-icon,
.results-verdict--draw .results-verdict-text {
  color: var(--pcb-ink-2);
}

/* Причина */
.results-reason {
  font-size: 0.95rem;
  color: var(--pcb-ink-2);
  margin: 0 0 1.1rem;
  line-height: 1.5;
}

/* Точность ходов (разбор движка; рейтинг Эло — отдельный блок ниже) */
.results-accuracy-block {
  margin-bottom: 1.1rem;
}
.results-acc-block-title {
  margin: 0 0 0.45rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--pcb-muted);
}

.results-accuracy-block .pcb-accuracy-disclaimer {
  margin-top: 0.65rem;
  text-align: center;
  font-size: 0.78rem;
}

.results-accuracy-wrap {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 0;
  margin-bottom: 0;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.results-acc-row {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 0.55rem 0.6rem 0.78rem;
  gap: 0.42rem;
  min-width: 0;
}

.results-acc-row:first-child {
  background: rgba(255, 255, 255, 0.03);
}

.results-acc-row:last-child {
  background: rgba(255, 255, 255, 0.015);
}

.results-acc-cue {
  display: block;
  width: 100%;
  height: 4px;
  border-radius: 3px;
  flex-shrink: 0;
}

.results-acc-cue--white {
  background: linear-gradient(90deg, #f6f2eb, #cfc7be);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.results-acc-cue--black {
  background: linear-gradient(90deg, #2c2a28, #0c0b0a);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.12),
    inset 0 -1px 0 rgba(0, 0, 0, 0.35);
}

.results-acc-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-width: 0;
  width: 100%;
  flex: 1 1 auto;
}

.results-acc-label {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
  hyphens: auto;
  text-align: center;
  max-width: 100%;
  width: 100%;
  font-size: clamp(0.58rem, 2.2vw, 0.7rem);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--pcb-muted);
  line-height: 1.25;
  min-height: 2.5em;
}

.results-acc-val {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 2.05rem;
  color: var(--pcb-cream);
  line-height: 1.05;
  flex-shrink: 0;
}

.results-acc-val--great { color: #6fda7a; }
.results-acc-val--good  { color: #c8d46a; }
.results-acc-val--ok    { color: #e0a03c; }
.results-acc-val--poor  { color: #c86060; }

.results-acc-divider {
  flex: 0 0 1px;
  width: 1px;
  align-self: stretch;
  margin: 0.5rem 0.12rem;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(255, 255, 255, 0.12) 18%,
    rgba(255, 255, 255, 0.12) 82%,
    transparent 100%
  );
}

/* Ожидание расчёта точности (разбор движка) */
.results-acc-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  margin-top: 0.65rem;
  padding: 0.35rem 0.5rem;
  color: var(--pcb-muted);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.results-acc-loading[hidden] {
  display: none !important;
}
.results-acc-loading-spinner {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--pcb-orange);
  animation: results-acc-spin 0.65s linear infinite;
}
.results-acc-loading-label {
  white-space: nowrap;
}
@keyframes results-acc-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .results-acc-loading-spinner {
    animation: none;
    border-top-color: rgba(255, 255, 255, 0.35);
  }
}

/* Рейтинг после партии */
.results-rating-wrap {
  margin-bottom: 1.75rem;
  font-family: var(--font-display);
}

.results-rating-wrap[hidden] { display: none !important; }

.results-rating-card {
  max-width: 22rem;
  margin-left: auto;
  margin-right: auto;
  padding: 0.65rem 0.85rem 0.75rem;
  border-radius: var(--pcb-radius-md, 10px);
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

.results-rating-title {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--pcb-text-muted, #888);
}

.results-rating-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.results-rating-cat {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--pcb-cream);
}

.results-rating-change {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.results-rating-delta {
  font-size: 1.5rem;
  font-weight: 800;
}

.results-rating-delta--pos { color: #6fda7a; }
.results-rating-delta--neg { color: #e05050; }
.results-rating-delta--zero { color: var(--pcb-ink-2); }

.results-rating-sep {
  color: var(--pcb-muted);
  font-size: 1rem;
  font-weight: 400;
}

.results-rating-after {
  color: var(--pcb-cream);
  font-size: 1.5rem;
  font-weight: 800;
}

.results-rating-legend {
  margin: 0.5rem 0 0;
  font-size: 0.68rem;
  line-height: 1.35;
  font-weight: 500;
  color: var(--pcb-text-muted, #888);
}

/* Кнопки */
.results-final-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.pcb-btn--wide {
  width: 100%;
  justify-content: center;
}

/* Старые стили (оставляем для совместимости) */
.results-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 0.75rem;
}

.results-summary {
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--pcb-ink-2);
  margin-bottom: 1rem;
}

.results-summary p {
  margin: 0 0 0.4rem;
}

.results-subtitle {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0 0 0.35rem;
  color: var(--pcb-ink);
}

.results-pgn-block {
  margin: 1rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.results-export-hint {
  font-size: 0.82rem;
  line-height: 1.4;
  margin: 0 0 0.45rem;
}

.results-fen {
  margin: 0.35rem 0 0.6rem;
  padding: 0.6rem 0.7rem;
  font-size: 0.7rem;
  line-height: 1.45;
  font-family: ui-monospace, monospace;
  word-break: break-all;
  white-space: pre-wrap;
  background: var(--pcb-bar);
  color: var(--pcb-cream);
  border-radius: 4px;
  border: 2px solid #0a0a0a;
  max-height: 6.5rem;
  overflow: auto;
}

.results-accuracy-note {
  font-size: 0.82rem;
  color: var(--pcb-muted);
  margin: 0 0 1rem;
  line-height: 1.45;
}

.results-accuracy-block + .results-accuracy-block {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.results-accuracy {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  color: var(--pcb-muted);
  line-height: 1.45;
}

.results-accuracy .results-accuracy-score {
  display: inline-block;
  color: var(--pcb-ink);
  font-weight: 700;
  font-size: 1.06rem;
  letter-spacing: 0.01em;
}

.results-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Сразу под итогом партии — видно без прокрутки длинного блока точности/PGN */
.results-actions--primary {
  margin: 0 0 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

@media (max-width: 860px) {
  .bot-chat-panel.bot-chat-left {
    width: 100%;
    max-width: 100%;
    max-height: 12rem;
  }

  .board-eval-row {
    flex-wrap: wrap;
  }
}

.results-actions button {
  width: 100%;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, #e87840, var(--pcb-orange-mid));
  color: #fff;
  border: 2px solid var(--pcb-orange-dark);
  box-shadow: 0 3px 0 var(--pcb-orange-dark);
}

.results-actions .btn-secondary {
  box-shadow: 0 3px 0 #0f0f0f;
}

.btn-copy-fen {
  font-size: 0.85rem;
}

/*
 * Разбор партии: на «узком десктопе» и всех телефонах/планшетах — одна колонка
 * (доска сверху, панель разбора на всю ширину). Иначе flex-row + min-width у aside
 * даёт горизонтальный скролл и обрезанный текст справа.
 */
@media (max-width: 1024px) {
  .main-layout.with-review {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    align-content: stretch;
  }

  #view-play:not([hidden]) #main-layout.main-layout.with-review .layout-primary,
  html.pcb-play-view-open #view-play .main-layout.with-review .layout-primary {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .review-aside {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: 1 1 auto;
    box-sizing: border-box;
  }

  .review-section-inner {
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  .review-title {
    overflow-wrap: anywhere;
    hyphens: auto;
  }
}

@media (max-width: 720px) {
  .review-step-row {
    grid-template-columns: 2.5rem 1fr 2.5rem;
    gap: 0.45rem;
  }
  .review-step-row button,
  .review-step-nav-btn {
    width: 2.5rem;
    min-width: 2.5rem;
    max-width: 2.5rem;
    min-height: 2.6rem;
    height: 2.6rem;
    max-height: 2.6rem;
    font-size: 1.05rem;
  }
  .rev-step-label__san {
    font-size: 0.92rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pcb-btn:active {
    transform: none;
  }
  .eval-white-fill,
  .eval-black-fill {
    transition: none;
  }
}

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

.pcb-play-setup {
  max-width: 48rem;
  margin: 1.5rem auto 0;
  padding: 0 1rem 2rem;
}

.pcb-play-setup-nav {
  display: flex;
  margin-bottom: 0.65rem;
}
.pcb-play-setup-nav .pcb-btn {
  min-height: 44px;
  box-sizing: border-box;
  padding: 0.5rem 0.85rem;
  font-size: 0.85rem;
}

/* /play — только настройка: карточка не уезжает ниже экрана */
/* Дубль с pcb-setup-view-open: старые WebView не поддерживают :has() */
html:has(#view-setup:not([hidden])) #view-setup.pcb-setup,
html.pcb-setup-view-open #view-setup.pcb-setup {
  padding-top: 0.5rem;
}

html:has(#view-setup:not([hidden])) .pcb-play-setup,
html.pcb-setup-view-open .pcb-play-setup {
  margin-top: 0.5rem;
  padding: 0 0.75rem 1rem;
}

html:has(#view-setup:not([hidden])) #pcb-engine-card.pcb-play-main-card,
html.pcb-setup-view-open #pcb-engine-card.pcb-play-main-card {
  box-sizing: border-box;
  overflow: visible;
}

html:has(#view-setup:not([hidden])) .pcb-play-main-lead,
html.pcb-setup-view-open .pcb-play-main-lead {
  margin-bottom: 1rem;
}

/* Выделение главной карточки настройки на странице /play */
.pcb-play-main-card {
  padding: 1.5rem 1.75rem 2rem !important;
  border: 1px solid rgba(224, 112, 46, 0.4) !important;
  border-top: 4px solid var(--pcb-orange) !important;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05) inset !important;
  background: linear-gradient(165deg, rgba(24, 22, 18, 0.98), rgba(10, 9, 7, 0.98)) !important;
}

.pcb-play-main-title {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--pcb-cream);
  text-align: center;
}

.pcb-play-main-lead {
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
  color: var(--pcb-muted);
  text-align: center;
}

.pcb-fine--stack {
  padding: 0.75rem 1rem 0.25rem;
}

/* Showcase-кнопка выбора сценария */
.pcb-scenario-showcase {
  display: block;
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(232, 230, 227, 0.18);
  background: var(--pcb-paper-2);
  color: var(--pcb-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.pcb-scenario-showcase:hover {
  border-color: rgba(240, 136, 69, 0.5);
  background: rgba(255, 255, 255, 0.05);
}

.pcb-scenario-showcase:focus-visible {
  outline: none;
  border-color: var(--pcb-orange);
  box-shadow: 0 0 0 2px rgba(232, 120, 64, 0.3);
}

/* Состояние: не выбрано */
.pcb-scenario-showcase__empty-top {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.pcb-scenario-showcase__empty-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  opacity: 0.7;
}

.pcb-scenario-showcase__empty-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
  min-width: 0;
}

.pcb-scenario-showcase__empty-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--pcb-muted);
}

.pcb-scenario-showcase__empty-count {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--pcb-ink-2);
}

/* Состояние: выбрано */
.pcb-scenario-showcase__selected-top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pcb-scenario-showcase__check {
  font-size: 1rem;
  color: #6fda7a;
  flex-shrink: 0;
}

.pcb-scenario-showcase__selected-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--pcb-ink);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pcb-scenario-showcase__selected-desc {
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--pcb-muted);
}

/* Кнопка «Выбрать» / «Изменить» */
.pcb-scenario-showcase__cta {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #f08845;
  white-space: nowrap;
}

/* Chips-превью сценариев */
.pcb-scenario-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.pcb-scenario-chip {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--pcb-ink-2);
  white-space: nowrap;
}

.pcb-scenario-chip--more {
  color: #f08845;
  border-color: rgba(240, 136, 69, 0.3);
  background: rgba(240, 136, 69, 0.08);
}

.scenario-picker-dialog {
  max-width: min(40rem, 96vw);
}

.scenario-picker-body {
  margin-bottom: 0.15rem;
}

.scenario-picker-section .scenario-picker-row {
  align-items: flex-start;
}

.scenario-picker-presets.scenario-picker-presets--grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
  gap: 0.45rem;
  width: 100%;
  flex: 1 1 100%;
}

.scenario-picker-presets.scenario-picker-presets--stack {
  display: flex;
  flex-direction: column;
  width: 100%;
  flex: 1 1 100%;
}

.tc-preset.sp-preset--card {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 4.25rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.2rem;
  padding: 0.45rem 0.5rem;
  text-align: left;
}

.sp-preset-name {
  font-weight: 800;
  font-size: 0.84rem;
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.sp-preset-desc {
  font-weight: 500;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--pcb-muted);
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
}

/* Premium-locked сценарий */
.sp-preset--locked {
  opacity: 0.5;
  cursor: not-allowed;
  position: relative;
}

.sp-preset--locked:hover {
  opacity: 0.65;
}

.sp-preset-premium-badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  background: linear-gradient(135deg, #e8b820, #c08000);
  color: #3a2200;
  margin-top: 0.15rem;
  align-self: flex-start;
}

/* Бейдж Premium у разблокированных сценариев (у Premium-пользователей) */
.sp-preset-premium-badge--owned {
  background: transparent;
  border: 1px solid rgba(240, 136, 69, 0.45);
  color: #f08845;
  font-weight: 700;
}

/* Кнопка «Сыграть снова» */
.results-btn-rematch--locked {
  opacity: 0.45;
  cursor: not-allowed;
  position: relative;
}

/* Кнопка «Переиграть» в лестнице — заблокировано для не-Premium */
.pcb-ladder-play--locked {
  background: rgba(240, 136, 69, 0.12) !important;
  border: 1.5px solid rgba(240, 136, 69, 0.45) !important;
  color: #f08845 !important;
  cursor: not-allowed;
  box-shadow: none !important;
  letter-spacing: 0.04em;
}

.results-btn-rematch--locked::after {
  content: "♛ Premium";
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.65rem;
  font-weight: 800;
  color: #f08845;
  white-space: nowrap;
  pointer-events: none;
}

/* Premium gate toast */
.pcb-premium-gate-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: linear-gradient(135deg, #2a1200, #1a0d00);
  border: 1px solid rgba(240, 136, 69, 0.5);
  border-radius: 12px;
  padding: 0.75rem 1.25rem;
  color: var(--pcb-cream);
  font-size: 0.9rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5), 0 0 0 1px rgba(240, 136, 69, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 9999;
  white-space: nowrap;
}

.pcb-premium-gate-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.pcb-premium-gate-toast__icon {
  font-size: 1.5rem;
  color: #f08845;
  line-height: 1;
}

/* Корона ♛ в Premium-бейджах и кнопках */
.pcb-premium-crown {
  font-size: 1.3em;
  line-height: 1;
  vertical-align: -0.1em;
}

.scenario-picker-footer {
  margin-top: 0.5rem;
}

.pcb-scenario-desc {
  margin: 0.5rem 0 0;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--pcb-ink-2);
  max-width: 42rem;
}

/* Заблокированные опции (резерв под будущие режимы) */
.pcb-fine--scenario-locked,
.pcb-fine--live-eval-locked,
.pcb-fine--takeback-locked {
  opacity: 0.35;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.2s ease;
}


.pcb-live-eval-label {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0;
  cursor: pointer;
  font-size: 0.92rem;
  line-height: 1.4;
  color: var(--pcb-ink-2);
  user-select: none;
}

.pcb-live-eval-label input {
  margin-top: 0.22rem;
  flex-shrink: 0;
  width: 1.08rem;
  height: 1.08rem;
  accent-color: var(--pcb-orange);
  cursor: pointer;
}

.pcb-live-eval-text {
  display: block;
  font-weight: 600;
  color: var(--pcb-ink);
}

/* ——— Вход / кабинет ——— */
.pcb-main--narrow {
  max-width: 44rem;
  margin: 0 auto;
  padding: 0 1rem 2.5rem;
}

/* Кабинет / лига: шире стандартной колонки форм */
.pcb-main--dashboard {
  max-width: min(1400px, 96vw);
  margin: 0 auto;
  padding: 0 1.35rem 2.5rem;
}

.pcb-nav-logout {
  display: inline;
  margin: 0;
  padding: 0;
}

.pcb-nav-link--btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}

.pcb-nav-link--btn:hover {
  color: var(--pcb-orange);
}

.pcb-flash-list {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
}

.pcb-flash {
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
}

.pcb-flash--ok {
  background: rgba(46, 120, 72, 0.25);
  border: 1px solid rgba(120, 200, 140, 0.35);
  color: var(--pcb-cream);
}

.pcb-flash--error {
  background: rgba(120, 36, 28, 0.35);
  border: 1px solid rgba(232, 120, 64, 0.4);
  color: var(--pcb-cream);
}

.pcb-auth-card {
  margin-top: 1.25rem;
  padding: 1.25rem 1.35rem 1.5rem;
  border-radius: 14px;
  border: 1px solid rgba(232, 120, 64, 0.22);
  background: linear-gradient(165deg, rgba(36, 32, 28, 0.98), rgba(18, 16, 14, 0.99));
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}

.pcb-auth-title {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pcb-ink);
}

.pcb-auth-lead {
  margin: 0 0 1.1rem;
  font-size: 0.92rem;
  line-height: 1.45;
  color: var(--pcb-ink-2);
}

.pcb-auth-beta-note {
  margin: -0.25rem 0 1.1rem;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(240, 136, 69, 0.28);
  background: rgba(240, 136, 69, 0.07);
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--pcb-ink-2);
}

.pcb-auth-beta-note strong {
  font-weight: 700;
  color: var(--pcb-cream);
}

/* Сравнение точности с внешними сайтами (анализ, итоги партии) */
.pcb-accuracy-disclaimer {
  display: block;
  margin: 0.55rem 0 0;
  font-size: 0.84em;
  line-height: 1.45;
  font-weight: 400;
  color: var(--pcb-muted);
}

/* ——— Страница импорта /analysis: выбор Lichess vs Chess.com ——— */
/* Полоска лимита анализов на странице /analysis */
.analysis-limit-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border-radius: 10px;
  border: 1px solid rgba(240, 136, 69, 0.25);
  background: rgba(240, 136, 69, 0.07);
  font-size: 0.88rem;
}

.analysis-limit-bar--exhausted {
  border-color: rgba(240, 136, 69, 0.5);
  background: rgba(240, 136, 69, 0.12);
}

.analysis-limit-bar__crown {
  font-size: 1.4rem;
  line-height: 1;
  color: #f08845;
  flex-shrink: 0;
}

.analysis-limit-bar__icon {
  font-size: 1.1rem;
  color: var(--pcb-muted);
  flex-shrink: 0;
}

.analysis-limit-bar__content {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.analysis-limit-bar__text {
  font-weight: 600;
  color: var(--pcb-ink-2);
}

.analysis-limit-bar__text--exhausted {
  color: #f08845;
}

.analysis-limit-bar__sub {
  font-size: 0.78rem;
  color: var(--pcb-muted);
}

.analysis-limit-bar__pips {
  display: flex;
  gap: 5px;
  margin-left: auto;
  flex-shrink: 0;
}

.analysis-limit-bar__pip {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(240, 136, 69, 0.55);
}

.analysis-limit-bar__pip--used {
  background: rgba(255, 255, 255, 0.15);
}

.analysis-import-wrap .analysis-page-subtitle {
  margin: 0 0 1.25rem;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--pcb-ink-2);
  max-width: 36rem;
  margin-left: auto;
  margin-right: auto;
}

.analysis-platform-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

@media (max-width: 640px) {
  .analysis-platform-grid {
    grid-template-columns: 1fr;
  }
}

.analysis-platform-card {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 0.95rem 1rem 0.85rem;
  border-radius: 14px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: linear-gradient(165deg, rgba(40, 36, 32, 0.95), rgba(22, 20, 18, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition:
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease,
    transform 0.12s ease;
}

.analysis-platform-card:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: linear-gradient(165deg, rgba(46, 42, 38, 0.98), rgba(26, 24, 22, 0.99));
}

.analysis-platform-card:focus-visible {
  outline: 2px solid var(--pcb-orange-mid);
  outline-offset: 2px;
}

.analysis-platform-card.is-selected {
  border-color: var(--pcb-orange-mid);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 0 0 1px rgba(240, 136, 69, 0.35),
    0 10px 28px rgba(0, 0, 0, 0.35);
}

.analysis-platform-card__radio {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-sizing: border-box;
  pointer-events: none;
}

.analysis-platform-card.is-selected .analysis-platform-card__radio {
  border-color: var(--pcb-orange-mid);
  background: var(--pcb-orange-mid);
}

.analysis-platform-card__radio-mark {
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1;
  color: transparent;
  transform: translateY(0.02rem);
}

.analysis-platform-card.is-selected .analysis-platform-card__radio-mark {
  color: #121110;
}

.analysis-platform-card__icon {
  flex: 0 0 auto;
  width: 2.65rem;
  height: 2.65rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  line-height: 1;
  margin-top: 0.1rem;
}

.analysis-platform-card__icon--lichess {
  background: radial-gradient(circle at 35% 30%, #4a4744, #1c1a18);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f4f1eb;
}

.analysis-platform-card__icon--chesscom {
  background: radial-gradient(circle at 35% 30%, #1f3d2d, #0f2418);
  border: 1px solid rgba(76, 175, 115, 0.35);
  color: #7ee0a0;
}

.analysis-platform-card__text {
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  min-width: 0;
  padding-right: 1.6rem;
}

.analysis-platform-card__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--pcb-cream);
}

.analysis-platform-info {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0.95rem;
  margin-bottom: 0.35rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.22);
}

.analysis-platform-info__icon {
  flex: 0 0 auto;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  font-style: italic;
  color: var(--pcb-ink-2);
  margin-top: 0.08rem;
}

.analysis-platform-info__text {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--pcb-ink-2);
}

.analysis-platform-info__accent {
  display: block;
  margin-top: 0.2rem;
  color: var(--pcb-cream);
  font-weight: 600;
}

.analysis-import-wrap .analysis-import-disclaimer {
  text-align: center;
  margin: 0.85rem 0 1rem;
}

/* Страница /analysis: ширина и отступы (вместо inline-стилей) */
.analysis-import-wrap.pcb-auth-card {
  max-width: 920px;
  margin-left: auto;
  margin-right: auto;
  margin-top: 2rem;
}

.pcb-auth-title--center {
  text-align: center;
}

.pcb-saved-games-section {
  margin-top: 2rem;
}

.analysis-limit-bar--spaced {
  margin-top: 1.5rem;
}

.pcb-auth-mail-hint {
  margin: -0.35rem 0 1rem;
  padding: 0.65rem 0.8rem;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--pcb-ink-2);
  background: rgba(232, 120, 64, 0.12);
  border: 1px solid rgba(232, 120, 64, 0.28);
  border-radius: 8px;
}

.pcb-auth-mail-hint code {
  font-size: 0.88em;
  word-break: break-all;
}

.pcb-auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.pcb-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.pcb-field-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pcb-muted);
}

.pcb-input {
  box-sizing: border-box;
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  color: var(--pcb-cream);
  font-size: 0.95rem;
}

.pcb-input:focus {
  outline: 2px solid rgba(232, 120, 64, 0.45);
  outline-offset: 1px;
}

.pcb-auth-hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.pcb-auth-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

/* Контурная ссылка рядом с primary: те же отступы/шрифт и «ступенька» 4px как у .pcb-btn--primary */
.pcb-auth-actions .pcb-btn.pcb-btn-outline {
  border: 2px solid rgba(255, 255, 255, 0.48);
  background: rgba(8, 6, 4, 0.55);
  box-shadow:
    0 4px 0 rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: var(--pcb-cream);
  text-decoration: none;
  font-weight: 800;
  font-size: 0.88rem;
  letter-spacing: 0.06em;
  padding: 0.85rem 1.5rem;
  white-space: nowrap;
  box-sizing: border-box;
  line-height: 1.1;
}

.pcb-auth-actions .pcb-btn.pcb-btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.65);
  filter: none;
}

.pcb-cabinet {
  padding-top: 2rem;
}

/* ── Шапка кабинета ── */
.pcb-cabinet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.pcb-cabinet--dash .pcb-cabinet-header {
  padding-bottom: 1.15rem;
  margin-bottom: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.pcb-cabinet-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--pcb-cream);
  margin: 0;
  line-height: 1.1;
}
.pcb-cabinet--dash .pcb-cabinet-title {
  color: #fafafa;
}
.pcb-cabinet-settings-link {
  font-size: 1.125rem;
  line-height: 1.15;
  color: var(--pcb-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}
.pcb-cabinet-settings-link:hover { color: var(--pcb-cream); }

.pcb-cabinet-empty {
  font-size: 0.92rem;
  color: var(--pcb-ink-2);
  line-height: 1.5;
}

.pcb-table-wrap {
  margin-top: 1rem;
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pcb-cabinet--dash .pcb-table-wrap {
  margin-top: 1rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: #101010;
}

.pcb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  color: var(--pcb-ink-2);
}

.pcb-table th,
.pcb-table td {
  padding: 0.5rem 0.65rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.pcb-cabinet--dash .pcb-table th,
.pcb-cabinet--dash .pcb-table td {
  border-bottom: 1px solid #222;
}

.pcb-table th {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pcb-muted);
  background: rgba(0, 0, 0, 0.25);
}

.pcb-cabinet--dash .pcb-table th {
  background: transparent;
  color: #9a9a9a;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.pcb-table tbody tr:hover td {
  background: rgba(232, 120, 64, 0.06);
}

.pcb-cabinet--dash .pcb-table tbody tr:hover td {
  background: rgba(240, 136, 69, 0.07);
}

.pcb-table-link {
  color: var(--pcb-orange-mid);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.pcb-cabinet--dash .pcb-table tbody .pcb-table-link::after {
  content: " >";
  font-weight: 700;
  opacity: 0.95;
}

.pcb-table-link:hover {
  text-decoration: underline;
}

.pcb-cabinet--dash .pcb-table tbody .pcb-table-link:hover {
  color: var(--pcb-orange);
  text-decoration: none;
}

.pcb-cabinet-back {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

/* ——— Список партий: табы фильтра ——— */
.pcb-games-section {
  margin-top: 2rem;
  transition: opacity 0.15s ease;
}

.pcb-tc-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
  width: 100%;
}

.pcb-tc-tab {
  flex: 1 1 0;
  min-width: 0;
  display: block;
  padding: 0.4rem 0.55rem;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.12);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--pcb-ink-2);
  text-decoration: none;
  text-align: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.pcb-tc-tab:hover {
  background: rgba(255,255,255,0.06);
  color: var(--pcb-cream);
}
.pcb-tc-tab--active {
  background: rgba(224,112,46,0.18);
  border-color: var(--pcb-orange-mid);
  color: var(--pcb-orange-mid);
}

.pcb-tc-tab--active:hover {
  background: rgba(224, 112, 46, 0.24);
  border-color: var(--pcb-orange-mid);
  color: var(--pcb-orange-mid);
}

.pcb-cabinet--dash .pcb-tc-tab {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.2);
  color: #c4c4c4;
}
.pcb-cabinet--dash .pcb-tc-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #eee;
  border-color: rgba(255, 255, 255, 0.2);
}
.pcb-cabinet--dash .pcb-tc-tab--active {
  background: rgba(240, 136, 69, 0.12);
  border-color: var(--pcb-orange-mid);
  color: var(--pcb-orange-mid);
  box-shadow: 0 0 0 1px rgba(240, 136, 69, 0.15);
}

.pcb-cabinet--dash .pcb-tc-tab--active:hover {
  background: rgba(240, 136, 69, 0.2);
  border-color: var(--pcb-orange-mid);
  color: var(--pcb-orange-mid);
  box-shadow: 0 0 0 1px rgba(240, 136, 69, 0.28);
}

/* ——— Пагинация ——— */
.pcb-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin-top: 1.25rem;
}

.pcb-page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--pcb-ink-2);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
a.pcb-page-btn:hover {
  background: rgba(255,255,255,0.07);
  color: var(--pcb-cream);
}
.pcb-page-btn--active {
  background: rgba(224,112,46,0.2);
  border-color: var(--pcb-orange-mid);
  color: var(--pcb-orange-mid);
  cursor: default;
}
.pcb-page-btn--disabled {
  opacity: 0.3;
  cursor: default;
}
.pcb-page-ellipsis {
  color: var(--pcb-ink-2);
  font-size: 0.85rem;
  padding: 0 0.2rem;
}

.pcb-pagination-info {
  margin-top: 0.5rem;
  font-size: 0.78rem;
  color: var(--pcb-ink-2);
}

/* Кабинет: тёмный «дашборд» — нейтральный уголь, карточки чуть светлее */
.pcb-cabinet--dash {
  margin: 0 -0.25rem;
  padding: 1.25rem 0.85rem 2.5rem;
  border-radius: 12px;
  background: #0b0b0b;
  border: 1px solid rgba(255, 255, 255, 0.045);
  box-sizing: border-box;
}

/* Заголовки секций: оранжевый + вертикальная полоса */
.pcb-cabinet--dash .pcb-cabinet-section-title {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--pcb-orange-mid);
  margin: 0 0 1.05rem;
}
.pcb-cabinet--dash .pcb-cabinet-section-title::before {
  content: "";
  width: 4px;
  height: 1.2rem;
  border-radius: 2px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--pcb-orange-mid), var(--pcb-orange-dark));
  box-shadow: 0 0 12px rgba(240, 136, 69, 0.42);
}

/* ——— Статистика по контролю времени ——— */
.pcb-stats-section {
  margin: 1.5rem 0 2rem;
}

.pcb-cabinet--dash .pcb-stats-section {
  margin-top: 1.35rem;
  margin-bottom: 2rem;
}

.pcb-stats-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0 0 0.75rem;
}

.pcb-cabinet--dash .pcb-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(152px, 1fr));
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}

.pcb-stats-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.9rem 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1 1 140px;
}

.pcb-cabinet--dash .pcb-stats-card {
  flex: initial;
  min-width: 0;
  background: #161616;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 1rem 1.05rem 0.85rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.pcb-stats-card-tc {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pcb-orange);
}

.pcb-cabinet--dash .pcb-stats-card-tc {
  color: var(--pcb-orange-mid);
  font-weight: 800;
}

.pcb-stats-card-wdl {
  display: flex;
  gap: 1rem;
  margin: 0.25rem 0 0.6rem;
}
.pcb-stats-card-wdl span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}
.pcb-stats-card-wdl em {
  font-style: normal;
  font-family: var(--font-body, Inter, sans-serif);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.pcb-stats-w { color: #6fcf97; }
.pcb-stats-w em { color: rgba(111,207,151,0.7); }
.pcb-stats-d { color: var(--pcb-muted); }
.pcb-stats-d em { color: var(--pcb-muted); }
.pcb-stats-l { color: #eb5757; }
.pcb-stats-l em { color: rgba(235,87,87,0.7); }

/* Трёхсегментный бар */
.pcb-stats-bar-wrap {
  height: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
  display: flex;
  margin-bottom: 0.55rem;
}

.pcb-cabinet--dash .pcb-stats-bar-wrap {
  height: 6px;
  border-radius: 4px;
  background: #2a2a2a;
}
.pcb-stats-bar-w { background: #6fcf97; }
.pcb-stats-bar-d { background: rgba(255,255,255,0.25); }
.pcb-stats-bar-l { background: #eb5757; }
.pcb-stats-bar-empty { flex: 1; }

.pcb-stats-card-footer {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--pcb-muted);
}

.pcb-cabinet--dash .pcb-stats-card-footer {
  color: #8c8c8c;
}

.pcb-stats-total { flex: 1; }

/* Карточка «Лига роботов»: только ссылка-заголовок и W/D/L */
.pcb-stats-league-head {
  width: 100%;
}
.pcb-stats-card--league .pcb-stats-card-wdl {
  margin-top: 0.35rem;
}
.pcb-stats-card-tc--league {
  text-decoration: none;
  color: var(--pcb-orange);
  line-height: 1.25;
}
.pcb-stats-card-tc--league:hover {
  color: var(--pcb-cream, #f4f0e8);
}

.pcb-stats-card--league .pcb-ladder-rank-wrap {
  margin: 0 0 0.5rem;
}

.pcb-stats-pct {
  font-weight: 600;
  color: var(--pcb-text);
}

.pcb-tc-rating-no-history {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--pcb-text-muted, #888);
  max-width: 16rem;
}

.pcb-tc-rating-one-game {
  font-size: 0.75rem;
  color: var(--pcb-muted);
  margin: 0.25rem 0 0;
}

/* Цвет результата в таблице партий */
.pcb-result-win  { color: #6fcf97; font-weight: 600; }
.pcb-result-draw { color: var(--pcb-muted); }
.pcb-result-loss { color: #eb5757; }

/* Иконка цвета фигур */
.pcb-color-piece {
  font-size: 1.1rem;
  line-height: 1;
}
.pcb-color-piece--white { color: #f0d9b5; }
.pcb-color-piece--black { color: #8b6343; }

/* Дельта рейтинга */
.pcb-delta {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.85rem;
}
.pcb-delta--pos  { color: #6fcf97; }
.pcb-delta--neg  { color: #eb5757; }
.pcb-delta--zero { color: var(--pcb-muted); }

/* Компактные колонки таблицы */
.pcb-td-date  { white-space: nowrap; color: var(--pcb-muted); font-size: 0.82rem; }
.pcb-td-color { text-align: center; }
.pcb-td-tc    { white-space: nowrap; }
.pcb-td-elo   { white-space: nowrap; }
.pcb-td-delta { text-align: center; white-space: nowrap; }

/* Списки партий: на узком экране — карточки, кнопка разбора без горизонтального скролла */
@media (max-width: 640px) {
  .pcb-table-wrap--cards-mobile {
    overflow-x: visible;
    border: none;
    background: transparent;
  }

  .pcb-table-wrap--cards-mobile .pcb-table {
    min-width: 0;
    width: 100%;
    display: block;
  }

  .pcb-table-wrap--cards-mobile .pcb-table tbody {
    display: block;
  }

  .pcb-table-wrap--cards-mobile .pcb-table thead {
    display: none;
  }

  .pcb-table-wrap--cards-mobile .pcb-table tbody tr {
    display: grid;
    gap: 0.3rem 0.65rem;
    margin-bottom: 0.65rem;
    padding: 0.75rem 0.85rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: #101010;
  }

  .pcb-table-wrap--cards-mobile .pcb-table tbody tr:hover td {
    background: transparent;
  }

  .pcb-table-wrap--cards-mobile .pcb-table td {
    display: block;
    border: none;
    padding: 0;
  }

  .pcb-table-wrap--cards-mobile .pcb-table--games tbody tr {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "date color"
      "result result"
      "tc elo"
      "delta delta"
      "action action";
  }

  .pcb-table-wrap--cards-mobile .pcb-table--games tbody tr:has(.pcb-td-scenario) {
    grid-template-areas:
      "date color"
      "result result"
      "tc elo"
      "scenario scenario"
      "delta delta"
      "action action";
  }

  .pcb-table-wrap--cards-mobile .pcb-table--games .pcb-td-date { grid-area: date; }
  .pcb-table-wrap--cards-mobile .pcb-table--games .pcb-td-color {
    grid-area: color;
    justify-self: end;
    text-align: right;
  }
  .pcb-table-wrap--cards-mobile .pcb-table--games .pcb-td-result {
    grid-area: result;
    font-size: 0.95rem;
  }
  .pcb-table-wrap--cards-mobile .pcb-table--games .pcb-td-tc {
    grid-area: tc;
    font-size: 0.8rem;
    color: var(--pcb-muted);
  }
  .pcb-table-wrap--cards-mobile .pcb-table--games .pcb-td-elo {
    grid-area: elo;
    justify-self: end;
    font-size: 0.8rem;
    color: var(--pcb-muted);
  }
  .pcb-table-wrap--cards-mobile .pcb-table--games .pcb-td-scenario {
    grid-area: scenario;
    font-size: 0.8rem;
    color: var(--pcb-muted);
  }
  .pcb-table-wrap--cards-mobile .pcb-table--games .pcb-td-delta { grid-area: delta; }

  .pcb-table-wrap--cards-mobile .pcb-table--imported-games tbody tr {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "white white"
      "black black"
      "result date"
      "action action";
  }

  .pcb-table-wrap--cards-mobile .pcb-table--imported-games .pcb-td-white {
    grid-area: white;
    font-weight: 600;
    color: var(--pcb-cream);
  }
  .pcb-table-wrap--cards-mobile .pcb-table--imported-games .pcb-td-black {
    grid-area: black;
    font-size: 0.88rem;
    color: var(--pcb-ink-2);
  }
  .pcb-table-wrap--cards-mobile .pcb-table--imported-games .pcb-td-result {
    grid-area: result;
    font-size: 0.95rem;
  }
  .pcb-table-wrap--cards-mobile .pcb-table--imported-games .pcb-td-date {
    grid-area: date;
    justify-self: end;
    text-align: right;
  }

  .pcb-table-wrap--cards-mobile .pcb-td-actions {
    grid-area: action;
    margin-top: 0.35rem;
    padding-top: 0.55rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
  }

  .pcb-table-wrap--cards-mobile .pcb-td-actions .pcb-table-link,
  .pcb-table-wrap--cards-mobile .pcb-td-actions .pcb-btn--review-ai-row {
    display: block;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    white-space: normal;
  }

  .pcb-table-wrap--cards-mobile .pcb-td-actions .pcb-table-link {
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border: 1px solid rgba(120, 190, 255, 0.45);
    background: rgba(72, 168, 255, 0.08);
    text-decoration: none;
  }

  .pcb-table-wrap--cards-mobile .pcb-td-actions .pcb-table-link:not(.pcb-table-link--ai) {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
    color: var(--pcb-orange-mid);
  }

  .pcb-table-wrap--cards-mobile .pcb-td-actions .pcb-btn--review-ai-row {
    padding: 0.55rem 0.75rem;
    font-size: 0.875rem;
  }

  .pcb-cabinet--dash .pcb-table-wrap--cards-mobile .pcb-table tbody .pcb-table-link::after {
    content: none;
  }
}

.pcb-settings-hint {
  margin: -0.25rem 0 0.75rem;
  font-size: 0.85rem;
  color: var(--pcb-muted);
}

.pcb-support-link-wrap {
  margin: 1.25rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.9rem;
  color: var(--pcb-muted);
  text-align: center;
}

.pcb-support-link {
  color: var(--pcb-accent, #e8b84a);
  font-weight: 600;
  text-decoration: none;
}

.pcb-support-link:hover {
  text-decoration: underline;
}

.pcb-support-link__hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.85rem;
  color: var(--pcb-muted);
}

.pcb-auth-card .pcb-support-link-wrap {
  text-align: left;
}

.sup-list-toolbar {
  margin-bottom: 1rem;
}

.sup-tickets {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sup-ticket {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.sup-ticket:hover {
  border-color: rgba(232, 184, 74, 0.35);
}

.sup-ticket__title {
  display: block;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.sup-ticket__meta {
  display: block;
  font-size: 0.8rem;
  color: var(--pcb-muted);
  margin-bottom: 0.35rem;
}

.sup-ticket__preview {
  display: block;
  font-size: 0.85rem;
  color: var(--pcb-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sup-ticket__unread {
  color: var(--pcb-accent, #e8b84a);
  font-weight: 600;
}

.sup-empty-list {
  margin: 0.5rem 0 1rem;
  color: var(--pcb-muted);
  font-size: 0.9rem;
}

.sup-back {
  margin-bottom: 0.75rem;
}

.sup-thread-title {
  margin: 0 0 0.25rem;
  font-size: 1.2rem;
}

.sup-thread-meta {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--pcb-muted);
}

.sup-thread-actions {
  margin-bottom: 0.75rem;
}

.sup-pagination {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: center;
}

.sup-page-btn {
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.sup-page-info {
  font-size: 0.85rem;
  color: var(--pcb-muted);
}

.sup-page {
  max-width: 42rem;
  margin: 0 auto;
}

.sup-hero__title {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
}

.sup-hero__lead {
  margin: 0 0 1.25rem;
  color: var(--pcb-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.sup-chat {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sup-messages {
  min-height: 12rem;
  max-height: min(50vh, 28rem);
  overflow-y: auto;
  padding: 1rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.sup-empty {
  margin: 0;
  color: var(--pcb-muted);
  font-size: 0.9rem;
}

.sup-msg {
  margin-bottom: 0.85rem;
  max-width: 92%;
}

.sup-msg--mine {
  margin-left: auto;
}

.sup-msg__meta {
  margin: 0 0 0.25rem;
  font-size: 0.75rem;
  color: var(--pcb-muted);
}

.sup-msg__body {
  margin: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.sup-msg--mine .sup-msg__body {
  background: rgba(232, 184, 74, 0.15);
}

.sup-msg--admin .sup-msg__body {
  background: rgba(100, 160, 120, 0.18);
}

.sup-msg__img-link {
  display: inline-block;
  margin-top: 0.35rem;
}

.sup-msg__img {
  display: block;
  max-width: min(100%, 320px);
  max-height: 240px;
  border-radius: 8px;
  object-fit: contain;
}

.sup-compose {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sup-field__label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.85rem;
  color: var(--pcb-muted);
}

.sup-input--area {
  width: 100%;
  min-height: 6rem;
  resize: vertical;
  box-sizing: border-box;
}

.sup-file-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.8rem;
  color: var(--pcb-muted);
}

.sup-status {
  margin: 0;
  font-size: 0.9rem;
  color: var(--pcb-muted);
}

.sup-status--err {
  color: #f08080;
}

.pcb-premium-crown {
  color: #f5c842;
  font-style: normal;
  font-size: 1.3em;
  line-height: 1;
  vertical-align: middle;
  margin-right: 0.25em;
  filter: drop-shadow(0 1px 3px rgba(200, 150, 0, 0.6));
}
.pcb-settings-premium {
  margin: -0.25rem 0 0.75rem;
  font-size: 0.88rem;
  color: #f5c842;
  font-weight: 600;
}

.pcb-settings-fieldset {
  margin: 0.5rem 0 0;
  padding: 0.85rem 1rem 0.25rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

.pcb-settings-legend {
  padding: 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--pcb-muted);
}

.pcb-settings-avatar-fieldset {
  margin-top: 0.75rem;
}

.pcb-settings-avatar-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.pcb-settings-avatar-preview-slot {
  flex-shrink: 0;
}

.pcb-settings-avatar-file-field {
  width: 100%;
}

.pcb-settings-avatar-preview {
  flex-shrink: 0;
  width: 96px;
  height: 96px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.25);
}

.pcb-settings-avatar-placeholder {
  flex-shrink: 0;
  width: 96px;
  height: 96px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 800;
  color: var(--pcb-muted);
  border: 2px dashed rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.2);
}

.pcb-settings-file-custom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
}

.pcb-settings-file-pick {
  flex-shrink: 0;
}

.pcb-settings-file-name {
  font-size: 0.82rem;
  color: var(--pcb-muted);
  word-break: break-word;
  line-height: 1.3;
  min-width: 0;
}

.pcb-settings-avatar-controls {
  flex: 1 1 12rem;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.pcb-settings-remove-avatar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  color: var(--pcb-ink-2);
  cursor: pointer;
}

.pcb-settings-remove-avatar input {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.pcb-settings-avatar-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--pcb-muted);
  line-height: 1.35;
}

/* ——— Рейтинг: герой в кабинете ——— */
.pcb-rating-hero {
  display: flex;
  align-items: center;
  gap: 2rem;
  margin: 0.5rem 0 1.75rem;
  padding: 1.25rem 1.5rem;
  background: linear-gradient(135deg, rgba(224,112,46,0.08), rgba(224,112,46,0.03));
  border: 1px solid rgba(224,112,46,0.2);
  border-radius: 12px;
}

.pcb-rating-hero-score {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex-shrink: 0;
}

.pcb-rating-hero-num {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
  color: var(--pcb-orange-mid);
}

.pcb-rating-hero-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--pcb-muted);
  margin-top: 0.25rem;
}

.pcb-rating-chart-wrap {
  flex: 1;
  min-width: 0;
}

.pcb-rating-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 80px;
}

/* Разряд лиги в шапке (Железо IV и т.п.) */
.pcb-nav-ladder-rank-link {
  flex-shrink: 0;
  text-decoration: none;
  line-height: 1;
}
.pcb-nav-ladder-rank-link:hover .pcb-ladder-rank-pill {
  /* Фолбек без color-mix() */
  border-color: rgba(255, 248, 235, 0.32);
  border-color: color-mix(in srgb, var(--m-accent) 42%, rgba(255, 248, 235, 0.18));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    inset 0 -6px 14px rgba(0, 0, 0, 0.35),
    0 0 14px var(--m-glow);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--m-accent) 14%, rgba(255, 255, 255, 0.1)),
    inset 0 -6px 14px rgba(0, 0, 0, 0.35),
    0 0 14px var(--m-glow);
}
.pcb-nav-userblock .pcb-ladder-rank-pill--nav {
  padding: 0.28rem 0.58rem 0.3rem;
  max-width: 11rem;
}
.pcb-nav-userblock .pcb-ladder-rank-pill--nav .pcb-ladder-rank-pill__txt {
  font-size: 0.72rem;
  letter-spacing: 0.035em;
}

.pcb-nav-userblock {
  gap: 0.4rem 0.6rem;
}
.pcb-premium-pill {
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  gap: 0.3rem;
  flex-shrink: 0;
  padding: 0 0.75rem;
  border-radius: 8px;
  border: 1px solid #a07010;
  background: linear-gradient(160deg, #ffe880 0%, #e8b820 40%, #c08000 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 200, 0.45),
    0 0 14px rgba(220, 170, 20, 0.5),
    0 2px 6px rgba(0, 0, 0, 0.4);
  vertical-align: middle;
}
.pcb-premium-pill__txt {
  font-family: var(--font-display, inherit);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.2;
  white-space: nowrap;
  color: #3a2200;
  text-shadow: 0 1px 0 rgba(255, 220, 100, 0.4);
}
.pcb-premium-pill__crown {
  font-size: 1rem;
  line-height: 1;
  display: inline-block;
  position: relative;
  top: -0.1em;
}

/* ——— Рейтинги по категориям в кабинете ——— */
.pcb-tc-ratings {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1.25rem 0;
}
.pcb-tc-rating-card {
  background: var(--pcb-surface-2, #1e1e1e);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1 1 180px;
}
.pcb-tc-rating-label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--pcb-text-muted, #888);
}
.pcb-tc-rating-num {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  color: var(--pcb-orange-mid);
}
/* Дивизион (Железо / Серебро / …) — заметное достижение */
.pcb-tc-rating-tier {
  align-self: flex-start;
  margin: 0.35rem 0 0.55rem;
  padding: 0.4rem 0.85rem 0.45rem;
  border-radius: 10px;
  background: linear-gradient(
    165deg,
    rgba(255, 248, 235, 0.14) 0%,
    rgba(180, 165, 140, 0.06) 42%,
    rgba(40, 38, 34, 0.55) 100%
  );
  border: 1px solid rgba(255, 235, 200, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 4px 14px rgba(0, 0, 0, 0.35);
}
.pcb-tc-rating-tier-text {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  line-height: 1.25;
  text-transform: none;
  color: #f2ebe0;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  background: linear-gradient(
    180deg,
    #fff9ef 0%,
    #e8dcc8 38%,
    #c4b59a 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .pcb-tc-rating-tier-text {
    color: #ebe4d8;
    background: none;
  }
}
.pcb-tc-rating-card .pcb-rating-chart-wrap {
  margin-top: 0.25rem;
}

/* ——— Лига роботов ——— */
.pcb-ladder {
  max-width: 1180px;
  margin: 0 auto;
  overflow: visible;
  --lm-on-surface: #e6e1e5;
  --lm-on-variant: #cac4d0;
  --lm-surface: #1c1b1f;
  --lm-surface-high: #252329;
  --lm-outline: #938f99;
  --lm-outline-variant: #49454f;
  --lm-primary: #ffb86c;
  --lm-on-primary: #381e00;
  --lm-primary-container: #5c3d1a;
  --lm-on-primary-container: #ffdcc0;
  --lm-elevation-1: 0 1px 2px rgba(0, 0, 0, 0.28), 0 1px 3px 1px rgba(0, 0, 0, 0.12);
  --lm-elevation-2: 0 1px 2px rgba(0, 0, 0, 0.22), 0 2px 6px 2px rgba(0, 0, 0, 0.14);
  color: var(--lm-on-surface);
}
.pcb-ladder-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: stretch;
  overflow: visible;
}
.pcb-ladder-summary {
  padding: 0 0.1rem;
}
.pcb-ladder-ranks-sticky {
  position: sticky;
  top: calc(3.75rem + 3px);
  /* Выше сетки роботов: иначе следующий по DOM блок рисуется поверх при скролле */
  z-index: 15;
  align-self: stretch;
  width: 100%;
  flex-shrink: 0;
  margin: 0;
  padding: 0.55rem 0.65rem 0.7rem;
  border-radius: 14px;
  /* Фолбек без color-mix() */
  background: var(--lm-surface-high);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--lm-surface-high) 94%, #000) 0%,
    var(--lm-surface-high) 100%
  );
  color: var(--lm-on-surface);
  border: 1px solid var(--lm-outline-variant);
  border: 1px solid color-mix(in srgb, var(--lm-outline-variant) 72%, transparent);
  box-shadow: var(--lm-elevation-2), 0 14px 36px rgba(0, 0, 0, 0.28);
}
/* Рельса разрядов: металлы — свои цвета (--m-a/b/c текст, --m-accent рамка/свечение) */
.pcb-lm-peek__row,
.pcb-ladder-rank-pill,
.pcb-nav-userbox-name--tier {
  --m-a: #e8eaef;
  --m-b: #b4bcc8;
  --m-c: #4e5560;
  --m-accent: #aeb8c6;
  --m-glow: rgba(175, 185, 200, 0.36);
}
.pcb-lm-peek__row[data-theme="iron"],
.pcb-ladder-rank-pill[data-theme="iron"],
.pcb-nav-userbox-name--tier[data-theme="iron"] {
  --m-a: #eef0f5;
  --m-b: #b8c0ce;
  --m-c: #4a5562;
  --m-accent: #aeb8c6;
  --m-glow: rgba(175, 188, 205, 0.38);
}
.pcb-lm-peek__row[data-theme="bronze"],
.pcb-ladder-rank-pill[data-theme="bronze"],
.pcb-nav-userbox-name--tier[data-theme="bronze"] {
  --m-a: #fff2e0;
  --m-b: #e0b078;
  --m-c: #6a4428;
  --m-accent: #d4a574;
  --m-glow: rgba(220, 165, 100, 0.42);
}
.pcb-lm-peek__row[data-theme="silver"],
.pcb-ladder-rank-pill[data-theme="silver"],
.pcb-nav-userbox-name--tier[data-theme="silver"] {
  --m-a: #ffffff;
  --m-b: #c8d2e4;
  --m-c: #5a6a82;
  --m-accent: #b8c8e0;
  --m-glow: rgba(180, 200, 235, 0.4);
}
.pcb-lm-peek__row[data-theme="gold"],
.pcb-ladder-rank-pill[data-theme="gold"],
.pcb-nav-userbox-name--tier[data-theme="gold"] {
  --m-a: #fff8dc;
  --m-b: #f0d060;
  --m-c: #8a6820;
  --m-accent: #f0c85a;
  --m-glow: rgba(255, 215, 120, 0.45);
}
.pcb-lm-peek__row[data-theme="platinum"],
.pcb-ladder-rank-pill[data-theme="platinum"],
.pcb-nav-userbox-name--tier[data-theme="platinum"] {
  --m-a: #e8fbff;
  --m-b: #7fd4f0;
  --m-c: #2a6a82;
  --m-accent: #8ed4f2;
  --m-glow: rgba(120, 210, 245, 0.42);
}
.pcb-lm-peek__row[data-theme="emerald"],
.pcb-ladder-rank-pill[data-theme="emerald"],
.pcb-nav-userbox-name--tier[data-theme="emerald"] {
  --m-a: #e8fff4;
  --m-b: #58e0a8;
  --m-c: #1a6a48;
  --m-accent: #4fe0a0;
  --m-glow: rgba(80, 230, 170, 0.4);
}
.pcb-lm-peek__row[data-theme="diamond"],
.pcb-ladder-rank-pill[data-theme="diamond"],
.pcb-nav-userbox-name--tier[data-theme="diamond"] {
  --m-a: #f0f8ff;
  --m-b: #8ec8ff;
  --m-c: #2a5088;
  --m-accent: #8ec6ff;
  --m-glow: rgba(130, 200, 255, 0.45);
}
.pcb-lm-peek__row[data-theme="master"],
.pcb-ladder-rank-pill[data-theme="master"],
.pcb-nav-userbox-name--tier[data-theme="master"] {
  --m-a: #f4eeff;
  --m-b: #c8a8ff;
  --m-c: #5a4080;
  --m-accent: #c9b0ff;
  --m-glow: rgba(200, 170, 255, 0.42);
}
.pcb-lm-peek__row[data-theme="grandmaster"],
.pcb-ladder-rank-pill[data-theme="grandmaster"],
.pcb-nav-userbox-name--tier[data-theme="grandmaster"] {
  --m-a: #fff0e8;
  --m-b: #ffb088;
  --m-c: #8a4020;
  --m-accent: #ff9a6e;
  --m-glow: rgba(255, 150, 100, 0.42);
}
.pcb-lm-peek__row[data-theme="legend"],
.pcb-ladder-rank-pill[data-theme="legend"],
.pcb-nav-userbox-name--tier[data-theme="legend"] {
  --m-a: #ffe8f4;
  --m-b: #ff8ec8;
  --m-c: #883060;
  --m-accent: #ff7eb3;
  --m-glow: rgba(255, 120, 180, 0.42);
}
.pcb-lm-peek__row[data-theme="champion"],
.pcb-ladder-rank-pill[data-theme="champion"],
.pcb-nav-userbox-name--tier[data-theme="champion"] {
  --m-a: #fffce8;
  --m-b: #ffe066;
  --m-c: #8a6820;
  --m-accent: #ffd56e;
  --m-glow: rgba(255, 220, 100, 0.55);
}

.pcb-lm-peek {
  margin-bottom: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.35rem;
}

.pcb-lm-peek--compact {
  gap: 0.2rem;
}

#ladder-rank-peek-host {
  width: 100%;
  min-width: 0;
}

.pcb-lm-peek__arr {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 3rem;
  width: 3rem;
  min-height: 3.5rem;
  align-self: stretch;
  /* Фолбек без color-mix() */
  border: 1px solid var(--lm-outline-variant);
  border: 1px solid color-mix(in srgb, var(--lm-outline-variant) 60%, transparent);
  border-radius: 16px;
  background: var(--lm-surface-high);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--lm-surface-high) 88%, #fff) 0%,
    var(--lm-surface) 100%
  );
  color: var(--lm-on-surface);
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
  box-shadow: 0 1px 0 color-mix(in srgb, #fff 6%, transparent);
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    opacity 0.18s ease,
    transform 0.12s ease;
}

.pcb-lm-peek--compact .pcb-lm-peek__arr {
  min-width: 3rem;
  width: 3rem;
  min-height: 3.45rem;
  border-radius: 14px;
}

.pcb-lm-peek__arr:hover:not(:disabled) {
  /* Фолбек без color-mix() */
  border-color: var(--lm-primary);
  border-color: color-mix(in srgb, var(--lm-primary) 45%, var(--lm-outline-variant));
  color: var(--lm-primary);
  background: var(--lm-surface-high);
  background: color-mix(in srgb, var(--lm-primary) 12%, var(--lm-surface-high));
}
.pcb-lm-peek__arr:active:not(:disabled) {
  transform: scale(0.98);
}
.pcb-lm-peek__arr:disabled {
  opacity: 0.28;
  cursor: default;
}

.pcb-lm-peek__shell {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
  gap: 0.5rem;
  padding: 0.55rem 0.55rem;
  border-radius: 20px;
  /* Фолбек без color-mix() */
  border: 1px solid var(--lm-outline-variant);
  border: 1px solid color-mix(in srgb, var(--lm-outline-variant) 50%, transparent);
  background: linear-gradient(165deg, var(--lm-surface-high) 0%, var(--lm-surface) 100%);
  background:
    radial-gradient(
      85% 90% at 50% 50%,
      color-mix(in srgb, var(--lm-primary) 6%, transparent) 0%,
      transparent 55%
    ),
    linear-gradient(165deg, var(--lm-surface-high) 0%, color-mix(in srgb, var(--lm-surface) 68%, #0a0a0c) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 32px rgba(0, 0, 0, 0.24);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #fff 5%, transparent),
    0 10px 32px rgba(0, 0, 0, 0.24);
}

.pcb-lm-peek--compact .pcb-lm-peek__shell {
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border-radius: 16px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 6px 18px rgba(0, 0, 0, 0.35);
}

.pcb-lm-peek__strip {
  display: flex;
  flex-direction: row;
  flex: 1 1 0;
  gap: 0.55rem;
  padding: 0;
  min-width: 0;
  align-items: stretch;
}

.pcb-lm-peek--compact .pcb-lm-peek__strip {
  gap: 0.55rem;
}

.pcb-lm-peek__row {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

/* Капсула разряда (база — «текущий» тон металла; состояния ниже перекрывают) */
.pcb-lm-peek__row-inner {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
  min-height: 3.45rem;
  padding: 0.62rem 0.85rem;
  border-radius: 999px;
  /* Фолбек без color-mix() */
  border: 1px solid rgba(255, 248, 235, 0.18);
  border: 1px solid color-mix(in srgb, var(--m-accent) 24%, rgba(255, 248, 235, 0.1));
  background: linear-gradient(180deg, #2e2c32 0%, #151418 100%);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--m-accent) 16%, #2e2c32) 0%,
    color-mix(in srgb, var(--m-accent) 5%, #151418) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -8px 20px rgba(0, 0, 0, 0.35);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--m-accent) 10%, rgba(255, 255, 255, 0.08)),
    inset 0 -8px 20px rgba(0, 0, 0, 0.35);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.pcb-lm-peek__row-inner::before {
  content: "";
  display: none;
  position: absolute;
  left: 12%;
  right: 12%;
  top: 6px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.7) 50%,
    transparent
  );
  pointer-events: none;
}

.pcb-lm-peek__row-lab {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-display, inherit);
  font-size: clamp(0.92rem, 2.5vw, 1.15rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.04em;
  background: linear-gradient(180deg, var(--m-a) 0%, var(--m-b) 42%, var(--m-c) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.55));
}

@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .pcb-lm-peek__row-lab {
    color: #e4dcd0;
    background: none;
    filter: none;
  }
  .pcb-lm-peek__row--done .pcb-lm-peek__row-lab {
    color: #b5ada2;
  }
  .pcb-lm-peek__row--ahead .pcb-lm-peek__row-lab {
    color: #5c5954;
  }
  .pcb-lm-peek__row--here .pcb-lm-peek__row-lab {
    color: #fdfaf4;
  }
}

/* Пройдено: тот же металл, приглушённо */
.pcb-lm-peek__row--done .pcb-lm-peek__row-inner {
  /* Фолбек без color-mix() */
  border-color: rgba(0, 0, 0, 0.55);
  border-color: color-mix(in srgb, var(--m-accent) 12%, rgba(0, 0, 0, 0.45));
  background: linear-gradient(180deg, #222226 0%, #101012 100%);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--m-accent) 6%, #222226) 0%,
    #101012 100%
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}
.pcb-lm-peek__row--done .pcb-lm-peek__row-lab {
  background: linear-gradient(180deg, var(--m-a) 0%, var(--m-b) 45%, var(--m-c) 100%);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--m-a) 58%, #888) 0%,
    color-mix(in srgb, var(--m-b) 45%, #555) 45%,
    color-mix(in srgb, var(--m-c) 72%, #333) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Впереди: ещё темнее, цвет металла едва читается */
.pcb-lm-peek__row--ahead .pcb-lm-peek__row-inner {
  /* Фолбек без color-mix() */
  border-color: rgba(0, 0, 0, 0.55);
  border-color: color-mix(in srgb, var(--m-accent) 7%, rgba(0, 0, 0, 0.55));
  background: linear-gradient(180deg, #1a191e 0%, #0c0c0f 100%);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--m-accent) 3%, #1a191e) 0%,
    #0c0c0f 100%
  );
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}
.pcb-lm-peek__row--ahead .pcb-lm-peek__row-lab {
  background: linear-gradient(180deg, #3a3836 0%, #1a1a1c 100%);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--m-a) 22%, #3a3836) 0%,
    color-mix(in srgb, var(--m-c) 88%, #1a1a1c) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.65));
}

/* Текущий разряд: светлая обводка + блик сверху */
.pcb-lm-peek__row--here {
  padding: 0;
  background: none;
  box-shadow: none;
}
.pcb-lm-peek__row--here .pcb-lm-peek__row-inner {
  min-height: 3.55rem;
  padding: 0.65rem 0.95rem;
  /* Фолбек без color-mix() */
  border: 1px solid #f5f0e8;
  border: 1px solid color-mix(in srgb, var(--m-accent) 38%, #f5f0e8);
  background: linear-gradient(180deg, #3a373e 0%, #1c1b20 100%);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--m-accent) 34%, #3a373e) 0%,
    color-mix(in srgb, var(--m-accent) 8%, #1c1b20) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -12px 28px rgba(0, 0, 0, 0.42),
    0 0 20px var(--m-glow);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #fff 14%, transparent),
    inset 0 -12px 28px rgba(0, 0, 0, 0.42),
    0 0 20px var(--m-glow);
}
.pcb-lm-peek__row--here .pcb-lm-peek__row-inner::before {
  display: block;
}
.pcb-lm-peek__row--here .pcb-lm-peek__row-lab {
  font-size: clamp(0.98rem, 2.75vw, 1.22rem);
  background: linear-gradient(180deg, #ffffff 0%, var(--m-a) 32%, var(--m-b) 72%, var(--m-c) 100%);
  background: linear-gradient(
    180deg,
    #ffffff 0%,
    color-mix(in srgb, var(--m-a) 90%, #fff) 32%,
    var(--m-b) 72%,
    var(--m-c) 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.65));
}

/* Мини-плашка разряда на карточке робота — тот же язык */
.pcb-ladder-rank-wrap {
  margin: 0 0 0.35rem;
}
.pcb-ladder-rank-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  /* Фолбек без color-mix() */
  border: 1px solid rgba(255, 248, 235, 0.22);
  border: 1px solid color-mix(in srgb, var(--m-accent) 26%, rgba(255, 248, 235, 0.12));
  background: linear-gradient(180deg, #2c2a30 0%, #151518 100%);
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--m-accent) 18%, #2c2a30) 0%,
    color-mix(in srgb, var(--m-accent) 6%, #151518) 100%
  );
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -6px 14px rgba(0, 0, 0, 0.35),
    0 0 12px var(--m-glow);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--m-accent) 12%, rgba(255, 255, 255, 0.08)),
    inset 0 -6px 14px rgba(0, 0, 0, 0.35),
    0 0 12px var(--m-glow);
  vertical-align: middle;
}
.pcb-ladder-rank-pill__txt {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-display, inherit);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.2;
  background: linear-gradient(180deg, var(--m-a) 0%, var(--m-b) 42%, var(--m-c) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.55));
}
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .pcb-ladder-rank-pill__txt {
    color: #e4dcd0;
    background: none;
    filter: none;
  }
}


.pcb-lm-linear {
  position: relative;
  height: 8px;
  border-radius: 999px;
  margin-bottom: 0.85rem;
  overflow: hidden;
  /* Фолбек без color-mix() */
  background: var(--lm-outline-variant);
  background: color-mix(in srgb, var(--lm-outline-variant) 55%, transparent);
}

.pcb-lm-linear--rank {
  margin-top: 1rem;
  height: 6px;
}

.pcb-lm-linear--rank .pcb-lm-linear__fill {
  background: #8fd4a6;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, #8fd4a6 88%, #fff) 0%,
    #8fd4a6 100%
  );
  box-shadow: 0 0 12px rgba(143, 212, 166, 0.45);
  box-shadow: 0 0 12px color-mix(in srgb, #8fd4a6 45%, transparent);
}
.pcb-lm-linear__bg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  border-radius: inherit;
  opacity: 0.35;
  background: var(--lm-surface);
}
.pcb-lm-linear__fill {
  position: absolute;
  top: 0;
  right: auto;
  bottom: 0;
  left: 0;
  border-radius: inherit;
  background: var(--lm-primary);
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--lm-primary) 88%, #fff) 0%,
    var(--lm-primary) 100%
  );
  box-shadow: 0 0 12px var(--lm-primary);
  box-shadow: 0 0 12px color-mix(in srgb, var(--lm-primary) 45%, transparent);
  transition: width 0.35s cubic-bezier(0.2, 0, 0, 1);
}
.pcb-lm-meta {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--lm-on-variant);
}
.pcb-lm-meta strong {
  color: var(--lm-on-surface);
  font-weight: 700;
}
.pcb-lm-hint {
  margin: 0.85rem 0 0;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--lm-on-primary-container);
  /* Фолбек без color-mix() */
  background: var(--lm-primary-container);
  background: color-mix(in srgb, var(--lm-primary-container) 88%, transparent);
  border: 1px solid var(--lm-primary);
  border: 1px solid color-mix(in srgb, var(--lm-primary) 22%, transparent);
}
.pcb-lm-empty {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  color: #9a96a3;
}
.pcb-ladder-head {
  position: relative;
  overflow: hidden;
  margin-bottom: 2rem;
  padding: 2.25rem 2.5rem;
  border-radius: 22px;
  background:
    linear-gradient(
      105deg,
      rgba(9, 8, 7, 0.99) 0%,
      rgba(14, 12, 10, 0.97) 45%,
      rgba(20, 15, 12, 0.95) 100%
    );
  border: 1px solid rgba(240, 136, 69, 0.28);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45),
    0 0 28px rgba(224, 112, 46, 0.1),
    inset 0 1px 0 rgba(255, 220, 190, 0.05),
    inset 0 -1px 0 rgba(0, 0, 0, 0.38);
}

/* Другой рисунок: косая «штриховка» + блик + тёплое пятно справа (без полоски сверху) */
.pcb-ladder-head::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 0;
  background-image:
    radial-gradient(ellipse 95% 70% at 100% 55%, rgba(224, 112, 46, 0.14) 0%, transparent 55%),
    radial-gradient(ellipse 55% 45% at 8% 12%, rgba(255, 248, 235, 0.06) 0%, transparent 60%),
    repeating-linear-gradient(
      -32deg,
      transparent 0 10px,
      rgba(200, 170, 140, 0.05) 10px 11px
    ),
    repeating-linear-gradient(
      32deg,
      transparent 0 14px,
      rgba(160, 130, 110, 0.04) 14px 15px
    );
  background-size: auto, auto, 100% 100%, 100% 100%;
  opacity: 0.92;
  mask-image: linear-gradient(
    to right,
    transparent 0%,
    rgba(0, 0, 0, 0.12) 22%,
    black 42%,
    black 100%
  );
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0%,
    rgba(0, 0, 0, 0.12) 22%,
    black 42%,
    black 100%
  );
}

.pcb-ladder-head-content {
  position: relative;
  z-index: 1;
  max-width: 48rem;
}

.pcb-ladder-head-top {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.85rem 1.25rem;
  margin-bottom: 0.85rem;
}

.pcb-ladder-head-top .pcb-ladder-title {
  margin-bottom: 0;
  flex: 1 1 12rem;
}

.pcb-ladder-hof-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.85rem;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--pcb-orange-mid);
  background: rgba(224, 112, 46, 0.1);
  border: 1px solid rgba(224, 112, 46, 0.35);
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.pcb-ladder-hof-link:hover {
  color: #ffa66d;
  background: rgba(224, 112, 46, 0.18);
  border-color: rgba(224, 112, 46, 0.55);
}

.pcb-ladder-title {
  font-family: var(--font-display);
  font-size: 2.25rem;
  font-weight: 800;
  margin: 0 0 0.85rem;
  color: var(--pcb-cream);
  letter-spacing: -0.01em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.pcb-ladder-season-badge {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-body, sans-serif);
  letter-spacing: 0.02em;
  color: var(--pcb-orange-mid);
  background: rgba(224, 112, 46, 0.12);
  border: 1px solid rgba(240, 136, 69, 0.42);
  border-radius: 999px;
  padding: 0.18em 0.72em;
  vertical-align: middle;
  margin-left: 0.5rem;
  white-space: nowrap;
  text-shadow: none;
}
.pcb-ladder-lead {
  color: var(--pcb-ink-2);
  line-height: 1.65;
  margin: 0;
  font-size: 0.95rem;
}
.pcb-ladder-lead strong {
  color: var(--pcb-orange-mid);
  font-weight: 700;
}
.pcb-ladder-stars-legend {
  list-style: none;
  padding: 0;
  margin: 0.75rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.25rem;
  font-size: 0.82rem;
  color: var(--pcb-ink-2);
}
.pcb-ladder-stars-legend li {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.pcb-ladder-error {
  color: #f6a08a;
  margin: 0 0 1rem;
}
.pcb-ladder-grid {
  position: relative;
  z-index: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}
.pcb-ladder-empty {
  color: var(--pcb-text-muted, #888);
  grid-column: 1 / -1;
}
.pcb-ladder-card {
  background: var(--pcb-surface-2, #1e1e1e);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.22), 0 2px 6px 2px rgba(0, 0, 0, 0.09);
}
.pcb-ladder-card-top {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
}
.pcb-ladder-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid rgba(224, 112, 46, 0.35);
}
.pcb-ladder-avatar--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  background: rgba(255, 255, 255, 0.06);
}
.pcb-ladder-card-meta {
  min-width: 0;
}
.pcb-ladder-name {
  font-size: 1.05rem;
  font-weight: 800;
  margin: 0 0 0.15rem;
  line-height: 1.2;
}
.pcb-ladder-elo {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  color: var(--pcb-orange-mid, #e0702e);
  font-weight: 700;
}
.pcb-ladder-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
}
.pcb-ladder-badge--locked {
  background: rgba(255, 255, 255, 0.08);
  color: #aaa;
}
.pcb-ladder-badge--open {
  background: rgba(46, 160, 90, 0.2);
  color: #8fd4a6;
}
.pcb-ladder-badge--beaten {
  background: rgba(224, 112, 46, 0.18);
  color: #f0b080;
}
.pcb-ladder-badge-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.pcb-ladder-stars {
  display: flex;
  gap: 0.15rem;
  align-items: center;
}
.pcb-star {
  flex-shrink: 0;
}
.pcb-star--filled {
  fill: #f5b041;
}
.pcb-star--empty {
  fill: rgba(255, 255, 255, 0.15);
}
.pcb-ladder-acc-val {
  font-weight: 800;
  color: #8fd4a6;
}
.pcb-ladder-acc-val--none {
  color: var(--pcb-text-muted, #9a9a9a);
  font-weight: 400;
}
.pcb-ladder-desc {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--pcb-text-muted, #9a9a9a);
  flex: 1;
}
.pcb-ladder-card-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.pcb-ladder-card-actions .pcb-btn {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: center;
}

/* ==========================================================================
   ЗАЛ СЛАВЫ
   ========================================================================== */

.pcb-hof {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1rem 4rem;
}

.pcb-hof-head {
  text-align: center;
  margin-bottom: 2.5rem;
}

/* Trophy */
.pcb-hof-trophy-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 28px rgba(212, 168, 32, 0.45))
          drop-shadow(0 0 60px rgba(212, 168, 32, 0.2));
  animation: hof-trophy-float 4s ease-in-out infinite;
}

@keyframes hof-trophy-float {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-7px); }
}

.pcb-hof-trophy {
  width: 160px;
  height: 174px;
}

.pcb-hof-title {
  font-family: var(--font-display);
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--pcb-cream);
  margin: 0 0 0.6rem;
  letter-spacing: 0.5px;
}

.pcb-hof-lead {
  font-size: 0.95rem;
  color: var(--pcb-muted);
  line-height: 1.6;
  margin: 0;
}

/* Tabs */
.pcb-hof-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.pcb-hof-tab {
  padding: 0.5rem 1.2rem;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: var(--pcb-muted);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}

.pcb-hof-tab:hover {
  color: var(--pcb-cream);
  border-color: rgba(255,255,255,0.14);
}

.pcb-hof-tab--active {
  background: rgba(224, 112, 46, 0.14);
  border-color: rgba(240, 136, 69, 0.45);
  color: var(--pcb-orange-mid);
}

.pcb-hof-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.pcb-hof-card {
  display: flex;
  align-items: center;
  padding: 1rem 1.25rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  transition: transform 0.2s ease, background 0.2s ease;
}

.pcb-hof-card:hover {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

.pcb-hof-pos {
  width: 2.5rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--pcb-muted);
  text-align: center;
  margin-right: 1rem;
}

.pcb-hof-card--top-1 .pcb-hof-pos {
  color: #f5b041;
  font-size: 1.5rem;
  text-shadow: 0 0 12px rgba(245, 176, 65, 0.4);
}

.pcb-hof-card--top-2 .pcb-hof-pos {
  color: #d6dbdf;
  font-size: 1.4rem;
}

.pcb-hof-card--top-3 .pcb-hof-pos {
  color: #dc7633;
  font-size: 1.3rem;
}

.pcb-hof-user {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  min-width: 0;
}

.pcb-hof-avatar {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.pcb-hof-avatar--fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--pcb-muted);
  width: 48px;
  height: 48px;
  border-radius: 8px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.1);
}

.pcb-hof-name-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.pcb-hof-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--pcb-cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pcb-hof-rank {
  display: flex;
  align-items: center;
}

.pcb-hof-stats {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-left: 1rem;
}

.pcb-hof-stat {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
}

.pcb-hof-stat-val {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--pcb-cream);
}

.pcb-hof-stat-lbl {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--pcb-muted);
}

.pcb-hof-stat--stars {
  align-items: center;
  gap: 0.35rem;
}

.pcb-hof-stat--stars .pcb-hof-stat-val {
  color: #f5b041;
}

.pcb-hof-empty {
  text-align: center;
  font-size: 1.1rem;
  color: var(--pcb-muted);
  padding: 3rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
}

@media (max-width: 600px) {
  .pcb-hof-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
  }
  
  .pcb-hof-pos {
    display: none;
  }
  
  .pcb-hof-user {
    width: 100%;
  }
  
  .pcb-hof-stats {
    margin-left: 0;
    width: 100%;
    justify-content: space-between;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
  }
}

.pcb-table td.result-win { color: #4ade80; font-weight: 600; }
.pcb-table td.result-loss { color: #b84444; font-weight: 600; }
.pcb-table td.result-draw { color: var(--pcb-ink-2); font-weight: 600; }

#review-loading {
  text-align: center;
  font-size: 1rem;
  margin-top: 2rem;
}

.main-layout.with-review #review-loading[hidden],
.main-layout.with-review #review-error[hidden] {
  display: none !important;
  margin: 0 !important;
}

.loading-dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

/* ═══════════════════════════════════════════════
   PREMIUM PAGE
   ═══════════════════════════════════════════════ */

/* Nav link */
.pcb-nav-link--premium {
  color: #f08845 !important;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}
.pcb-nav-link--premium:hover {
  color: #f5c842 !important;
}

.pcb-nav-link--ai {
  color: #9ed4ff !important;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
}

.pcb-nav-link--ai::before {
  content: "✦";
  font-size: 0.72em;
  opacity: 0.85;
}

.pcb-nav-link--ai:hover {
  color: #d4eeff !important;
}

/* Page wrapper */
.prm-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

/* ── HERO ── */
.prm-hero {
  position: relative;
  text-align: center;
  padding: 5rem 1rem 4rem;
  overflow: hidden;
}

.prm-hero__bg {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
  z-index: 0;
}

.prm-hero__orb {
  position: absolute;
  border-radius: 50%;
}
.prm-hero__orb--1 {
  width: 500px; height: 500px;
  top: -150px; left: -100px;
  animation: prm-drift 12s ease-in-out infinite alternate;
}
.prm-hero__orb--2 {
  width: 350px; height: 350px;
  bottom: -100px; right: -50px;
  animation: prm-drift 16s ease-in-out infinite alternate-reverse;
}

.prm-float {
  position: absolute;
  width: 48px; height: 48px;
}
.prm-float--a { top: 15%; left: 8%;  animation: prm-float 7s ease-in-out infinite; }
.prm-float--b { top: 60%; right: 6%; animation: prm-float 9s ease-in-out infinite 1s; }
.prm-float--c { bottom: 10%; left: 15%; animation: prm-float 11s ease-in-out infinite 2s; }

@keyframes prm-drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(30px, 20px) scale(1.05); }
}
@keyframes prm-float {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50%       { transform: translateY(-14px) rotate(4deg); }
}

.prm-hero__inner {
  position: relative;
  z-index: 1;
}

/* Crown SVG */
.prm-crown-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}
.prm-crown-svg {
  width: 90px;
  height: auto;
  filter: drop-shadow(0 0 18px rgba(245, 200, 66, 0.4));
  animation: prm-crown-pulse 3s ease-in-out infinite;
}
.prm-crown-sparkles {
  animation: prm-sparkle 2s ease-in-out infinite;
}
@keyframes prm-crown-pulse {
  0%, 100% { filter: drop-shadow(0 0 18px rgba(245, 200, 66, 0.35)); }
  50%       { filter: drop-shadow(0 0 30px rgba(245, 200, 66, 0.6)); }
}
@keyframes prm-sparkle {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(0.7); }
}

.prm-hero__title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--pcb-cream);
  margin: 0 0 0.6rem;
  line-height: 1.1;
}
.prm-hero__accent {
  background: linear-gradient(90deg, #f5c842, #f08845);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.prm-hero__sub {
  font-size: 1.1rem;
  color: var(--pcb-ink-2);
  margin: 0 0 2rem;
  line-height: 1.5;
}
.prm-hero-disclose .prm-hero__sub {
  margin-bottom: 1rem;
}
.prm-hero__trial {
  margin: 0 auto 1.25rem;
  max-width: 36rem;
  padding: 0.7rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(240, 136, 69, 0.3);
  background: rgba(240, 136, 69, 0.08);
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--pcb-ink-2);
  text-align: center;
}
.prm-hero__trial strong {
  color: var(--pcb-cream);
  font-weight: 700;
}
.prm-hero__cta {
  font-size: 1rem;
  padding: 0.85rem 2.5rem;
  letter-spacing: 0.04em;
  animation: prm-cta-glow 3s ease-in-out infinite;
}
@keyframes prm-cta-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240, 136, 69, 0); }
  50%       { box-shadow: 0 0 20px 4px rgba(240, 136, 69, 0.3); }
}
.prm-hero__note {
  margin: 1rem 0 0;
  font-size: 0.95rem;
  line-height: 1.45;
  font-weight: 500;
  color: var(--pcb-ink-2);
}
.prm-hero__note .prm-link {
  font-size: 1em;
  font-weight: 700;
}
.prm-link {
  color: #f08845;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── SECTION TITLE ── */
.prm-section-title {
  text-align: center;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--pcb-cream);
  margin: 0 0 2rem;
}

/* ── FEATURES GRID ── */
.prm-features {
  padding: 3rem 0 2rem;
}

.prm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.prm-card {
  background: var(--pcb-paper-2);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px;
  padding: 1.5rem;
  transition: border-color 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
}
.prm-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(135deg, rgba(240,136,69,0.04) 0%, transparent 60%);
  pointer-events: none;
}
.prm-card:hover {
  border-color: rgba(240, 136, 69, 0.35);
  transform: translateY(-2px);
}
.prm-card--wide {
  grid-column: span 2;
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
}
.prm-card--wide .prm-card__icon-wrap {
  flex-shrink: 0;
  margin-top: 0.2rem;
}
.prm-card__icon-wrap {
  margin-bottom: 1rem;
}
.prm-card__icon {
  width: 48px;
  height: 48px;
  display: block;
}
.prm-card__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--pcb-cream);
  margin: 0 0 0.5rem;
}
.prm-card__desc {
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--pcb-ink-2);
  margin: 0;
}
@media (max-width: 600px) {
  .prm-grid { grid-template-columns: 1fr; }
  .prm-card--wide { grid-column: span 1; flex-direction: column; }
}

/* ── COMPARE TABLE ── */
.prm-compare {
  padding: 2.5rem 0;
}
.prm-table-wrap {
  overflow-x: auto;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.08);
}
.prm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.prm-table thead tr {
  background: rgba(255,255,255,0.04);
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.prm-table th {
  padding: 1rem 1.25rem;
  font-weight: 700;
  color: var(--pcb-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  text-align: center;
}
.prm-table__feature-col { text-align: left !important; }
.prm-table__premium-col { color: #f08845 !important; }
.prm-table__premium-label { color: #f08845; font-size: 0.85rem; }

.prm-table td {
  padding: 0.9rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: var(--pcb-ink-2);
  text-align: center;
}
.prm-table td:first-child { text-align: left; color: var(--pcb-ink); font-weight: 500; }
.prm-table tbody tr:last-child td { border-bottom: none; }
.prm-table tbody tr:hover { background: rgba(255,255,255,0.02); }

.prm-check { font-weight: 700; font-size: 1rem; }
.prm-check--yes { color: #6fda7a; }
.prm-check--no  { color: rgba(255,255,255,0.2); }

/* ── CTA BOTTOM ── */
.prm-cta-bottom {
  margin-top: 3rem;
  border-radius: 20px;
  background: var(--pcb-paper-2);
  border: 1px solid rgba(240,136,69,0.2);
  position: relative;
  overflow: hidden;
  padding: 3.5rem 2rem;
  text-align: center;
}
.prm-cta-bottom__inner {
  position: relative;
  z-index: 1;
}
.prm-cta-bottom__crown {
  font-size: 3rem;
  line-height: 1;
  color: #f08845;
  margin-bottom: 0.75rem;
  animation: prm-crown-pulse 3s ease-in-out infinite;
  display: block;
}
.prm-cta-bottom__title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--pcb-cream);
  margin: 0 0 0.5rem;
}
.prm-cta-bottom__sub {
  color: var(--pcb-ink-2);
  margin: 0 0 1.75rem;
  font-size: 0.95rem;
}
.prm-cta-bottom__btn {
  padding: 0.85rem 2.5rem;
}

/* Chessboard pattern */
.prm-cta-bottom__board {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  opacity: 0.035;
  pointer-events: none;
  z-index: 0;
}
.prm-board-cell--dark { background: #f08845; }

/* Мобильные табы /play — на десктопе не занимают места */
.play-mobile-tabs {
  display: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HAMBURGER BUTTON  (hidden on desktop, visible on mobile)
   ═══════════════════════════════════════════════════════════════════════════ */

.pcb-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* gap во flex ломается в части WebView — три полоски сливаются в одну; отступы задаём margin у баров */
  gap: 0;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 6px;
  transition: background 0.15s;
  position: relative;
  z-index: 101;
  -webkit-appearance: none;
  appearance: none;
}
.pcb-hamburger:hover { background: rgba(255,255,255,0.07); }
.pcb-hamburger__bar {
  display: block;
  box-sizing: border-box;
  width: 22px;
  min-height: 3px;
  height: 3px;
  flex-shrink: 0;
  background: var(--pcb-cream);
  border-radius: 2px;
  transition: transform 0.22s ease, opacity 0.22s ease;
  transform-origin: center;
}
.pcb-hamburger__bar + .pcb-hamburger__bar {
  margin-top: 5px;
}
.pcb-hamburger--open .pcb-hamburger__bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.pcb-hamburger--open .pcb-hamburger__bar:nth-child(2) { opacity: 0; transform: scaleX(0); }
.pcb-hamburger--open .pcb-hamburger__bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* Overlay behind mobile nav drawer */
.pcb-nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 190;
  background: rgba(0,0,0,0.55);
  pointer-events: auto;
}
.pcb-nav-overlay--visible { display: block; }

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE  ≤ 640px
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  /*
   * Иначе backdrop-filter на шапке создаёт containing block для position:fixed —
   * выезжающее меню (#pcb-mobile-nav) позиционируется относительно HEADER, а не viewport,
   * и скрипт с top=getBoundingClientRect().bottom ломает высоту ящика (видно ~32px).
   */
  .pcb-topbar--landing {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    /* Каскад: базовое .pcb-topbar (ниже по файлу) сбрасывает sticky — возвращаем,
       иначе после скролла гамбургер уезжает вместе со страницей и меню недоступно. */
    position: sticky;
    top: 0;
    z-index: 100;
  }

  /* Меню открыто: шапка выше оверлея (крестик кликабелен), ящик — выше шапки */
  body.pcb-menu-open .pcb-topbar {
    z-index: 300;
  }

  /* ── Hamburger слева; лого по центру первой строки (главная — см. .pcb-topbar--landing ниже) ── */
  .pcb-hamburger {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    order: 0;
  }

  .pcb-topbar-inner:has(.pcb-hamburger) .pcb-logo--link,
  .pcb-topbar-inner.pcb-topbar-inner--has-hamburger .pcb-logo--link {
    order: 1;
  }

  /* Мобильная шапка: гамбургер | лого по центру | симметричный отступ */
  .pcb-topbar-inner.pcb-topbar-inner--has-hamburger {
    display: grid;
    grid-template-columns: 3rem minmax(0, 1fr) 3rem;
    align-items: center;
    gap: 0;
  }

  .pcb-topbar-inner.pcb-topbar-inner--has-hamburger .pcb-hamburger {
    grid-column: 1;
    grid-row: 1;
    order: unset;
  }

  .pcb-topbar-inner.pcb-topbar-inner--has-hamburger .pcb-logo--link {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    order: unset;
    position: static;
    transform: none;
    left: auto;
    z-index: auto;
  }

  .pcb-topbar-inner:not(.pcb-topbar-inner--has-hamburger) {
    justify-content: center;
  }

  /* ── Сброс лэндинговых стилей nav из 900px-блока (drawer-режим) ── */
  .pcb-topbar-inner--landing .pcb-nav {
    min-width: 0;
    width: auto;
    flex: none;
    border-top: none;
    padding-top: 0;
  }

  /* ── Topbar ── */
  .pcb-topbar-inner {
    padding: 0 0.9rem;
    height: 3.25rem;
  }
  .pcb-topbar-inner--landing {
    padding: 0.6rem 0.9rem;
    height: auto;
  }
  body:has(.pcb-ladder) .pcb-topbar-inner,
  body.pcb-page--ladder .pcb-topbar-inner {
    padding-left: 0.9rem;
  }

  /* ── Nav drawer ── */
  .pcb-nav--topbar-end,
  .pcb-nav--landing-bar,
  .pcb-nav--play-header {
    display: none;
    position: fixed;
    top: 3.5rem; /* fallback; overridden by JS */
    left: 0;
    right: auto;
    bottom: 0;
    width: min(320px, 85vw);
    z-index: 200;
    background: var(--pcb-bar);
    border-right: 1px solid rgba(255,255,255,0.08);
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: flex-start;
    padding: 1rem 0;
    gap: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
    pointer-events: auto;
  }
  .pcb-nav--topbar-end.pcb-nav--open,
  .pcb-nav--landing-bar.pcb-nav--open,
  .pcb-nav--play-header.pcb-nav--open {
    display: flex;
  }

  /* Nav links in drawer */
  .pcb-nav--topbar-end .pcb-nav-link,
  .pcb-nav--topbar-end .pcb-nav-link--btn,
  .pcb-nav--landing-bar .pcb-nav-link,
  .pcb-nav--landing-bar .pcb-nav-link--btn,
  .pcb-nav--play-header .pcb-nav-link,
  .pcb-nav--play-header .pcb-nav-link--btn {
    width: 100%;
    box-sizing: border-box;
    padding: 0.85rem 1.5rem;
    font-size: 0.88rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    border-left: none;
    border-right: none;
    border-top: none;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-align: left;
    min-height: 48px;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(240,136,69,0.15);
    touch-action: manipulation;
  }
  .pcb-nav--topbar-end .pcb-nav-link--active,
  .pcb-nav--play-header .pcb-nav-link--active {
    border-bottom-color: rgba(255,255,255,0.05);
    background: rgba(240,136,69,0.08);
  }

  /* User block in drawer */
  .pcb-nav--landing-bar .pcb-nav-link--active {
    border-bottom-color: rgba(255,255,255,0.05);
    background: rgba(240,136,69,0.08);
  }

  .pcb-nav-userblock {
    padding: 1rem 1.5rem;
    border-right: none;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    margin-right: 0;
    flex-wrap: wrap;
    gap: 0.5rem;
    order: -1;
  }
  .pcb-nav-userchip {
    align-self: auto;
    padding: 0.4rem 0.75rem;
  }
  .pcb-nav-userbox-name {
    max-width: 10rem;
  }

  /* Logout form in drawer */
  .pcb-nav-logout {
    padding: 0.5rem 1.5rem 0;
  }
  .pcb-nav-logout .pcb-nav-link--btn {
    background: none;
    color: var(--pcb-cream);
    border: none;
    border-radius: 0;
    padding: 0.85rem 0;
    border-top: 1px solid rgba(255,255,255,0.05);
    border-bottom: none;
    width: 100%;
  }

  /* Premium pill in drawer — slim */
  .pcb-premium-pill {
    font-size: 0.72rem;
    padding: 0.2rem 0.5rem;
  }

  /* ── Main content padding ── */
  .pcb-main--narrow { padding-left: 0.9rem; padding-right: 0.9rem; }

  /* ── Landing ── */
  .pcb-main--landing { padding: 0 0.9rem; }

  /* ── Game setup card ── */
  .pcb-play-main-card {
    padding: 1.1rem 1.1rem 1.5rem !important;
  }
  html:has(#view-setup:not([hidden])) .pcb-play-setup,
  html.pcb-setup-view-open .pcb-play-setup {
    padding: 0 0.5rem 0.75rem;
    margin-top: 0.25rem;
  }
  .pcb-setup-option {
    min-height: 44px;
  }

  /* ── Analysis ── */
  .analysis-platform-card__icon { width: 2.2rem; height: 2.2rem; }

  /* ── Hall of fame ── */
  .pcb-hof-filters {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  /* ── Premium page ── */
  .prm-hero { padding: 1.75rem 1rem 1.5rem; }
  .prm-crown-svg {
    width: 56px;
  }
  .prm-hero__title { font-size: clamp(1.7rem, 8vw, 2.4rem); }
  .prm-hero__sub { font-size: 0.9rem; margin-bottom: 1rem; }
  .prm-hero__trial {
    margin: 0 0 1rem;
    font-size: 0.88rem;
    padding: 0.6rem 0.85rem;
    text-align: left;
  }
  .prm-hero__note { margin-top: 0; margin-bottom: 0; font-size: 0.92rem; }
  .prm-section-title { font-size: 1.3rem; }
  .prm-features { padding: 2rem 0 1.5rem; }
  .prm-features-disclose > summary {
    margin-bottom: 0.35rem;
  }

  /* Заголовок секции дублирует текст summary на мобильных — оставляем для скринридеров */
  .prm-features-disclose .prm-section-title {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
  .prm-compare { padding: 2rem 0 1.5rem; }
  .prm-cta-bottom { margin: 1.5rem 0 2rem; padding: 2.5rem 1rem; }
  .prm-cta-bottom__title { font-size: 1.3rem; }

  /* ── Ladder page ── */
  /* На мобильном основной отступ уже даёт .pcb-main — без двойных вложенных паддингов,
     иначе карточкам роботов остаётся ~300px вместо ~350px ширины. */
  .pcb-ladder {
    padding: 0;
  }
  body.pcb-page--ladder .pcb-main {
    padding-left: 1rem;
    padding-right: 1rem;
  }
  .pcb-ladder-head {
    padding: 1rem 0.9rem;
  }
  .pcb-guest-notice {
    margin: 0.75rem 0 1rem;
    padding: 0.8rem 0.9rem;
    gap: 0.6rem;
  }
  .pcb-guest-notice h2 {
    font-size: 0.98rem;
    margin: 0 0 0.15rem;
  }
  .pcb-guest-notice p {
    font-size: 0.85rem;
    line-height: 1.45;
  }
  .pcb-ladder-card {
    padding: 0.9rem 1rem;
  }
  .pcb-ladder-card__name {
    font-size: 0.85rem;
  }

  /* ── Touch / iOS: без авто-зума в полях ── */
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    font-size: 16px;
  }

  /* ── Лендинг: hero-кнопки на всю ширину ── */
  .pcb-hero {
    padding: 0.25rem 0 1.25rem;
    gap: 1rem;
  }

  .pcb-hero-actions {
    flex-direction: column;
    align-items: stretch;
    margin-bottom: 0.75rem;
  }

  .pcb-hero-actions .pcb-btn,
  .pcb-hero-actions .pcb-btn-outline {
    width: 100%;
    min-height: 48px;
    justify-content: center;
    box-sizing: border-box;
  }

  .pcb-hero-disclose > summary {
    margin-bottom: 0.35rem;
  }

  /* ── Авторизация / формы ── */
  .pcb-auth-card {
    padding: 1rem 0.9rem;
  }

  .pcb-auth-form .pcb-btn {
    width: 100%;
    min-height: 48px;
    box-sizing: border-box;
  }

  .pcb-field .pcb-input {
    min-height: 44px;
    box-sizing: border-box;
  }

  /* ── Кабинет: статистика одной колонкой, таблицы со скроллом ── */
  .pcb-cabinet--dash .pcb-stats-grid {
    grid-template-columns: 1fr;
  }

  .pcb-ladder-grid {
    grid-template-columns: 1fr;
  }

  /* Лига: лента разрядов — одна капсула на мобиле (см. peekWindow в ladder.js) */
  .pcb-lm-peek--compact .pcb-lm-peek__arr {
    min-width: 2.5rem;
    width: 2.5rem;
    min-height: 3.15rem;
  }

  .pcb-lm-peek--compact .pcb-lm-peek__shell {
    gap: 0.35rem;
    padding: 0.45rem 0.45rem;
  }

  .pcb-lm-peek__strip {
    gap: 0.35rem;
  }

  .pcb-lm-peek__row-inner {
    min-height: 3.15rem;
    padding: 0.5rem 1rem;
  }

  .pcb-lm-peek__row-lab {
    font-size: clamp(1.02rem, 4.5vw, 1.28rem);
    letter-spacing: 0.06em;
  }

  .pcb-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .pcb-table {
    min-width: 20rem;
  }

  /* ── Настройки / premium ── */
  .pcb-settings-avatar-row {
    flex-direction: column;
    align-items: stretch;
  }

  .prm-hero__cta {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* ── /play: горизонтальный скролл только на десктопе со шкалой ── */
  html:has(#view-play:not([hidden])) #view-play .main-layout,
  html:has(#view-play:not([hidden])) #view-play .main-layout.with-live-eval,
  html.pcb-play-view-open #view-play .main-layout,
  html.pcb-play-view-open #view-play .main-layout.with-live-eval {
    overflow-x: hidden;
  }

  html:has(#view-play:not([hidden])) #view-play:has(.main-layout.with-live-eval),
  html.pcb-play-view-open #view-play.pcb-view-play--live-eval {
    overflow-x: hidden;
  }

  #view-play:not([hidden]) #main-layout.main-layout.with-live-eval {
    overflow-x: hidden;
  }

  /*
   * Шкала оценки — слева от доски (как на десктопе), не под ней.
   * Ряд: [шкала][доска+табы+история]; чат при вкладке «Чат» — строкой ниже на всю ширину.
   */
  /* Весь экран: учитываем safe-area, без боковых полей у main; доска по максимуму */
  #view-play:not([hidden]) {
    --play-eval-strip: 1.5rem;
    --play-eval-gap: 0.1rem;
    --play-safe-t: env(safe-area-inset-top, 0px);
    --play-safe-b: env(safe-area-inset-bottom, 0px);
    --play-safe-x: calc(env(safe-area-inset-left, 0px) + env(safe-area-inset-right, 0px));
    /* Шапка партии + строка табов (~компактно) */
    --play-dvh-offset: 5.5rem;
    /* vw/vh: старые WebView не понимают dvw/dvh — иначе min(...) становится невалидным и доска схлопывается */
    --play-board-side-no-eval: min(
      calc(100vw - var(--play-safe-x)),
      calc(100vh - var(--play-safe-t) - var(--play-safe-b) - var(--play-dvh-offset))
    );
    --play-board-side-with-eval: min(
      calc(100vw - var(--play-safe-x) - var(--play-eval-strip) - var(--play-eval-gap)),
      calc(100vh - var(--play-safe-t) - var(--play-safe-b) - var(--play-dvh-offset))
    );
  }

  @supports ((width: 100dvw) and (height: 100dvh)) {
    #view-play:not([hidden]) {
      --play-board-side-no-eval: min(
        calc(100dvw - var(--play-safe-x)),
        calc(100dvh - var(--play-safe-t) - var(--play-safe-b) - var(--play-dvh-offset))
      );
      --play-board-side-with-eval: min(
        calc(100dvw - var(--play-safe-x) - var(--play-eval-strip) - var(--play-eval-gap)),
        calc(100dvh - var(--play-safe-t) - var(--play-safe-b) - var(--play-dvh-offset))
      );
    }
  }

  html:has(#view-play:not([hidden])) .pcb-main,
  html.pcb-play-view-open .pcb-main {
    padding: 0;
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    max-width: none;
    width: 100%;
  }

  .view-play {
    /* Боковые safe-area уже учтены у .pcb-main. */
    padding: var(--play-safe-t) 0 0;
    flex: 1 1 auto;
    min-height: 0;
    box-sizing: border-box;
  }

  /* Одна колонка на всю высоту экрана (все вкладки) */
  #view-play:not([hidden]) .layout-primary {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  /* Прокрутка сохраняет доступ к действиям и чату на низких экранах */
  html:has(#view-play:not([hidden])) #view-play .main-layout:not(.with-review),
  html.pcb-play-view-open #view-play .main-layout:not(.with-review) {
    overflow-y: auto;
    scrollbar-gutter: auto;
  }

  #view-play:not([hidden]) #main-layout.main-layout:not(.with-review) {
    overflow-y: auto;
    scrollbar-gutter: auto;
  }

  /* На мобилке не центрируем основной блок — иначе доска «плывёт» относительно шкалы */
  #view-play:not([hidden]) #main-layout.main-layout {
    align-items: stretch;
    width: 100%;
  }

  .board-eval-row {
    flex: 1 1 auto;
    min-height: 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
    /* stretch — строки с чатом/историей занимают оставшуюся высоту экрана */
    align-content: stretch;
    justify-content: flex-start;
    gap: var(--play-eval-gap);
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .main-layout.with-live-eval .board-eval-row {
    width: 100%;
    max-width: 100%;
    margin-inline: 0;
  }

  /*
   * Ряд «шкала + доска»: без width:100% у блока доски — иначе flex-wrap переносит колонку на новую строку
   * и шкала оказывается не слева от доски (или визуально «пропадает»).
   * Десктоп это правило не затрагивает (оно только в MOBILE ≤640px).
   */
  #view-play:not([hidden]) #main-layout.main-layout.with-live-eval .board-eval-row .play-board-and-history {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    max-width: 100%;
    align-items: stretch;
  }

  /* Порядок: шкала → блок доски; чат — новая строка (flex-basis 100%) */
  .board-eval-row #eval-column:not([hidden]) {
    order: 0;
    flex: 0 0 var(--play-eval-strip);
    width: var(--play-eval-strip);
    min-width: var(--play-eval-strip);
    align-self: flex-start;
    /* Только max-height сжимал столбик до высоты иконок/текста; задаём высоту = стороне доски */
    height: var(--play-board-side-with-eval);
    min-height: var(--play-board-side-with-eval);
    max-height: var(--play-board-side-with-eval);
    padding: 0.2rem 1px;
    box-sizing: border-box;
  }

  .board-eval-row #eval-column:not([hidden]) .eval-king {
    font-size: 0.62rem;
    line-height: 1;
  }

  .board-eval-row #eval-column:not([hidden]) .eval-readout {
    font-size: 0.55rem;
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
  }

  .board-eval-row #eval-column:not([hidden]) .eval-track {
    min-height: 0;
    flex: 1 1 auto;
    margin: 0.12rem 0;
  }

  .board-eval-row .play-board-and-history {
    order: 1;
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    width: auto;
    max-width: 100%;
    align-self: stretch;
  }

  .board-eval-row:has(> #eval-column:not([hidden])) .play-board-and-history,
  .board-eval-row.pcb-board-eval-row--with-eval-strip .play-board-and-history {
    max-width: min(100%, calc(100% - var(--play-eval-strip) - var(--play-eval-gap)));
  }

  .board-eval-row .bot-chat-panel.bot-chat-left {
    order: 2;
    flex: 1 1 auto;
    width: 100%;
    min-width: 100%;
    max-width: none;
    min-height: 0;
    max-height: none;
  }

  /* Чат на всю оставшуюся высоту под доской */
  #view-play:not([hidden]) #main-layout.is-tab-chat .bot-chat-panel.bot-chat-left {
    flex: 1 1 auto;
    min-height: 10rem;
  }

  /* Иначе max-height у .bot-chat-log режет область и не даёт заполнить экран */
  #view-play:not([hidden]) .bot-chat-log {
    max-height: none;
  }

  .play-board-and-history {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 0.35rem;
  }

  /* Доска прижата к шкале слева, без центрирования в колонке (убирает пустоту справа) */
  .play-board-and-history .board-outer {
    margin-inline: 0;
    align-self: flex-start;
  }

  .main-layout.with-live-eval .play-board-and-history {
    flex-wrap: nowrap;
    min-width: 0;
    justify-content: flex-start;
  }

  .board-outer {
    --board-outer-inset: 10px;
    --board-outer-inset-y: 10px;
    width: min(var(--play-board-side-no-eval), 100%);
    max-width: 100%;
    aspect-ratio: 1;
    padding: var(--board-outer-inset-y) var(--board-outer-inset);
    align-self: flex-start;
    box-sizing: border-box;
  }

  /* Узкая доска только когда столбик оценки не [hidden] */
  .board-eval-row:has(> #eval-column:not([hidden])) .board-outer,
  .board-eval-row.pcb-board-eval-row--with-eval-strip .board-outer {
    width: min(var(--play-board-side-with-eval), 100%);
    max-width: 100%;
    aspect-ratio: 1;
  }

  /*
   * Десктоп: .main-layout.with-live-eval .board-outer вычитает колонки истории/чата из 100vw —
   * на мобилке это даёт отрицательную ширину и доска исчезает (оставлена пустота под шапкой).
   */
  #view-play:not([hidden]) .main-layout.with-live-eval .board-outer {
    width: min(var(--play-board-side-with-eval), 100%);
    max-width: 100%;
    aspect-ratio: 1;
  }

  /* История на вкладке «История»: заголовок скрыт; лента ходов; кнопки просмотра — в строке с вкладками */
  #view-play:not([hidden]) #main-layout.is-tab-history .play-history-column {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  #view-play:not([hidden]) #main-layout.is-tab-history .play-move-history-head {
    display: none !important;
  }

  #view-play:not([hidden]) #main-layout.is-tab-history .play-move-history {
    flex: 1 1 0;
    min-height: 0;
    max-height: none;
    align-self: stretch;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0.4rem 0.45rem 0.45rem;
  }

  #view-play:not([hidden]) #main-layout.is-tab-history .play-move-history-strip {
    flex: 1 1 0;
    flex-direction: row;
    align-items: stretch;
    gap: 0.35rem;
    min-height: 0;
    min-width: 0;
  }

  #view-play:not([hidden]) #main-layout.is-tab-history .play-move-history-list {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.4rem;
    scrollbar-width: thin;
  }

  #view-play:not([hidden]) #main-layout.is-tab-history .play-move-history-list .play-move-history-row {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 1.75rem minmax(0, max-content);
    padding: 0.1rem 0.35rem 0.1rem 0;
    margin: 0;
    border-bottom: none;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
  }

  #view-play:not([hidden]) #main-layout.is-tab-history
    .play-move-history-list
    .play-move-history-row:last-child {
    border-right: none;
    padding-right: 0;
  }

  /* Кнопки просмотра — в одной строке с вкладками (и на вкладке «Чат», где нет .is-tab-history) */
  #view-play:not([hidden]) .play-mobile-tabs-bar {
    align-items: center;
    flex-wrap: nowrap;
    gap: 0.35rem;
  }

  #view-play:not([hidden]) .play-mobile-tabs-bar .play-mobile-tabs {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
    max-width: none;
  }

  #view-play:not([hidden]) .play-mobile-tabs-bar .play-move-history-replay {
    flex: 0 0 auto;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    align-items: center;
    align-self: center;
    gap: 0.3rem;
  }

  #view-play:not([hidden]) .play-mobile-tabs-bar .play-hist-replay-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 2.75rem;
    width: 2.75rem;
    height: 2.75rem;
    min-width: 2.75rem;
    min-height: 2.75rem;
    box-sizing: border-box;
    padding: 0.35rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: var(--pcb-cream);
    font-size: 1.12rem;
    line-height: 1;
    font-weight: 700;
  }

  #view-play:not([hidden]) .play-mobile-tabs-bar .play-hist-replay-icon {
    width: 24px;
    height: 24px;
  }

  .play-mobile-tabs {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.3rem;
    width: 100%;
    box-sizing: border-box;
    padding: 0.15rem 0;
    margin: 0;
    flex-shrink: 0;
  }

  .main-layout.with-review .play-mobile-tabs,
  .main-layout.with-review .play-mobile-tabs-bar {
    display: none !important;
  }

  /*
   * Разбор на телефоне: история переносится в #review-moves-host — колонку у доски прячем.
   * На десктопе переноса нет — правила не должны действовать (иначе пустота вместо списка ходов).
   */
  .main-layout.with-review .play-move-history {
    display: none !important;
  }

  .main-layout.with-review .play-history-column {
    display: none !important;
  }

  .main-layout.with-review .play-history-actions {
    display: none !important;
  }

  .play-mobile-tab {
    flex: 1 1 0;
    min-width: 0;
    min-height: 40px;
    padding: 0.38rem 0.3rem;
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--pcb-cream);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    cursor: pointer;
    -webkit-tap-highlight-color: rgba(240, 136, 69, 0.2);
    touch-action: manipulation;
  }

  .play-mobile-tab.is-active {
    color: #2a241c;
    background: linear-gradient(165deg, #f0c49a, #e8a86a);
    border-color: rgba(240, 196, 154, 0.45);
  }

  #main-layout.with-review .board-eval-row > .bot-chat-panel.bot-chat-left {
    display: none !important;
  }

  #main-layout:not(.is-tab-chat) .bot-chat-panel.bot-chat-left:not(.coach-chat-panel--review) {
    display: none !important;
  }

  #main-layout.is-tab-chat .bot-chat-panel.bot-chat-left {
    display: flex !important;
  }

  #main-layout.is-tab-chat .play-history-column {
    display: none !important;
  }

  .play-history-column {
    width: 100%;
    max-width: none;
  }

  #main-layout:not(.is-tab-history) .play-move-history {
    display: none !important;
  }

  #main-layout.is-tab-history .play-move-history {
    display: flex !important;
  }

  .play-side-panel {
    width: 100%;
    max-width: none;
    box-sizing: border-box;
  }

  #view-play:not([hidden]) #main-layout.is-tab-history .play-side-panel {
    flex: 1 1 auto;
    min-height: 0;
  }

  /* max-height перенесён выше для is-tab-history — заполняем экран; без вкладки истории ограничение не нужно */

  .play-header {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 0.4rem;
    row-gap: 0.25rem;
    margin-bottom: 0.25rem;
    padding: 0.32rem 0.4rem;
    border-radius: 0;
  }

  .play-status-wrap,
  .play-clocks,
  .analysis-move-quality,
  .play-header-trailing {
    grid-column: 1;
    justify-self: stretch;
    max-width: 100%;
  }

  .play-clocks {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    gap: 0.25rem;
  }

  .play-clock {
    min-width: 3.5rem;
    padding: 0.2rem 0.25rem;
  }

  .play-status-wrap {
    grid-row: 1 / span 2;
    gap: 0.4rem;
  }

  .play-status {
    font-size: 0.78rem;
    line-height: 1.3;
  }

  .play-header-trailing {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
  }

  .play-header-quality-slot:empty {
    display: none;
  }

  .play-header-user-texts {
    flex-direction: row;
    align-items: baseline;
    gap: 0.3rem;
  }

  .play-header-user {
    max-width: 100%;
  }

  .play-header-user-name {
    max-width: 7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .play-user-avatar-badge {
    width: 1.5rem;
    height: 1.5rem;
  }

  .play-opponent-badge {
    width: 2.75rem;
    height: 2.75rem;
  }

  /* Разбор (анализ): без аватарок; соперник и «Вы» в одну линию; оценка хода — ниже, фикс. высота */
  /* Разбор на телефоне: без шапки с именами — больше места под доску и чат */
  #view-play:has(.main-layout.with-review) .play-header {
    display: none !important;
  }

  #view-play:has(.main-layout.with-review) .play-opponent-badge,
  #view-play:has(.main-layout.with-review) .play-user-avatar-badge {
    display: none !important;
  }

  #view-play:has(.main-layout.with-review) .play-status-wrap {
    gap: 0;
    align-self: center;
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  #view-play:has(.main-layout.with-review) .play-header-user {
    margin-left: 0;
    gap: 0.35rem;
    max-width: none;
  }

  #view-play:has(.main-layout.with-review) .play-header {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto minmax(2.65rem, 2.65rem);
    align-items: center;
    column-gap: 0.45rem;
    row-gap: 0.3rem;
  }

  #view-play:has(.main-layout.with-review) .play-header-trailing {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    align-self: center;
  }

  #view-play:has(.main-layout.with-review) .play-clocks {
    display: none !important;
  }

  #view-play:has(.main-layout.with-review) .play-header-quality-slot {
    display: flex;
    grid-column: 1 / -1;
    grid-row: 2;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 2.65rem;
    max-height: 2.65rem;
    padding: 0 0.2rem;
    overflow: hidden;
  }

  #view-play:has(.main-layout.with-review) .play-header-quality-slot .analysis-move-quality {
    grid-column: auto;
    justify-self: center;
    max-width: 100%;
    margin: 0;
    padding: 0;
    font-size: clamp(0.72rem, 3.4vw, 0.95rem);
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #view-play:has(.main-layout.with-review) .play-status {
    min-height: auto;
    font-size: 0.85rem;
    line-height: 1.25;
  }

  #view-play:has(.main-layout.with-review) .play-header-user-name {
    max-width: min(42vw, 9rem);
  }

  .main-layout.with-review {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0.75rem;
  }

  /* Дубль специфичности: не даём row из базового .main-layout.with-review «всплыть» */
  #view-play:not([hidden]) #main-layout.main-layout.with-review,
  html.pcb-play-view-open #view-play .main-layout.with-review {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
  }

  #view-play:not([hidden]) .review-aside,
  html.pcb-play-view-open #view-play .review-aside {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: 1 1 0;
    display: flex;
    flex-direction: column;
    min-height: min(48dvh, 32rem);
    overflow: hidden;
  }

  /* Разбор на телефоне: колонка как в игре — доска, табы, скроллящаяся панель */
  #view-play:not([hidden]) #main-layout.main-layout.with-review,
  html.pcb-play-view-open #view-play .main-layout.with-review {
    gap: 0;
    flex: 1 1 auto;
    min-height: 0;
    /* вертикальный скролл только внутри панели табов — иначе ломается высота и доска */
    overflow-y: hidden;
    overflow-x: hidden;
    overscroll-behavior-y: none;
  }

  #view-play:not([hidden]) #main-layout.main-layout.with-review .layout-primary,
  html.pcb-play-view-open #view-play .main-layout.with-review .layout-primary {
    flex: 0 0 auto;
    flex-shrink: 0;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    align-self: stretch;
  }

  /* Ряд «шкала + доска»: группа по центру, без пустоты справа от доски */
  #view-play:not([hidden]) #main-layout.main-layout.with-review .board-eval-row,
  html.pcb-play-view-open #view-play .main-layout.with-review .board-eval-row {
    justify-content: center;
    align-items: flex-start;
    width: 100%;
  }

  #view-play:not([hidden]) #main-layout.main-layout.with-review .board-eval-row .play-board-and-history,
  html.pcb-play-view-open #view-play .main-layout.with-review .board-eval-row .play-board-and-history {
    flex: 0 0 auto;
    min-width: 0;
    width: auto;
    max-width: none;
    align-items: stretch;
  }

  #view-play:not([hidden]) #main-layout.main-layout.with-review .board-eval-row .board-outer,
  html.pcb-play-view-open #view-play .main-layout.with-review .board-eval-row .board-outer {
    flex-shrink: 0;
    box-sizing: border-box;
  }

  /*
   * Разбор: доска на всю ширину ряда (минус шкала оценки), высота — по оставшемуся dvh.
   * Резерв под панель табов: одинаковый на всех вкладках (не увеличивать на «Тренер»).
   */
  #view-play:not([hidden]) #main-layout.main-layout.with-review,
  html.pcb-play-view-open #view-play .main-layout.with-review {
    --play-review-panel-reserve: min(22rem, 42dvh);
    --play-board-side-with-eval: min(
      calc(100vw - var(--play-safe-x) - var(--play-eval-strip) - var(--play-eval-gap)),
      calc(
        100vh - var(--play-safe-t) - var(--play-safe-b) - var(--play-dvh-offset) -
          var(--play-review-panel-reserve)
      )
    );
  }

  @supports ((width: 100dvw) and (height: 100dvh)) {
    #view-play:not([hidden]) #main-layout.main-layout.with-review,
    html.pcb-play-view-open #view-play .main-layout.with-review {
      --play-board-side-with-eval: min(
        calc(100dvw - var(--play-safe-x) - var(--play-eval-strip) - var(--play-eval-gap)),
        calc(
          100dvh - var(--play-safe-t) - var(--play-safe-b) - var(--play-dvh-offset) -
            var(--play-review-panel-reserve)
        )
      );
    }
  }

  #view-play:not([hidden]) #main-layout.main-layout.with-review .board-eval-row,
  html.pcb-play-view-open #view-play .main-layout.with-review .board-eval-row {
    gap: var(--play-eval-gap);
  }

  #view-play:not([hidden]) #main-layout.main-layout.with-review .play-board-and-history,
  html.pcb-play-view-open #view-play .main-layout.with-review .play-board-and-history {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
    min-width: 0;
    align-items: stretch;
  }

  #view-play:not([hidden]) #main-layout.main-layout.with-review .play-board-and-history .board-outer,
  html.pcb-play-view-open #view-play .main-layout.with-review .play-board-and-history .board-outer {
    margin-inline: 0;
    align-self: stretch;
    width: var(--play-board-side-with-eval);
    max-width: var(--play-board-side-with-eval);
    max-height: var(--play-board-side-with-eval);
    aspect-ratio: 1;
    height: auto;
    flex-shrink: 0;
    box-sizing: border-box;
  }

  #view-play:not([hidden]) #main-layout.main-layout.with-review .board-eval-row #eval-column:not([hidden]),
  html.pcb-play-view-open #view-play .main-layout.with-review .board-eval-row #eval-column:not([hidden]) {
    flex: 0 0 var(--play-eval-strip);
    align-self: flex-start;
  }

  /* Не менять размер доски при переключении на «Тренер» — иначе шкала укорачивается, а доска нет */
  /*
   * Разбор: строка доски не должна быть flex:1 с min-height:0 — иначе ряд съедается панелью
   * разбора и Chessground измеряет wrap как 0×0 (чёрное поле без фигур).
   */
  #view-play:not([hidden]) #main-layout.main-layout.with-review .board-eval-row,
  html.pcb-play-view-open #view-play .main-layout.with-review .board-eval-row {
    flex: 0 0 auto;
    min-height: auto;
    align-self: stretch;
  }

  /* Подсчёт точности: на время убираем доску и показываем текст — иначе ломается колонка flex */
  #view-play:not([hidden]) #main-layout.main-layout.with-review.review-computing .board-eval-row,
  html.pcb-play-view-open #view-play .main-layout.with-review.review-computing .board-eval-row {
    display: none !important;
  }

  #view-play:not([hidden]) #main-layout.main-layout.with-review.review-computing #review-loading,
  html.pcb-play-view-open #view-play .main-layout.with-review.review-computing #review-loading {
    display: none !important;
  }

  .review-primary-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    box-sizing: border-box;
    min-height: min(88vmin, 26rem);
    padding: 1.35rem 1rem;
    margin: 0 0 0.35rem;
    text-align: center;
    background: linear-gradient(165deg, rgba(42, 38, 34, 0.85), rgba(22, 20, 18, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
  }

  #view-play:not([hidden]) #main-layout.main-layout.with-review.review-computing .review-primary-loading,
  html.pcb-play-view-open #view-play .main-layout.with-review.review-computing .review-primary-loading {
    display: flex;
  }

  .review-primary-loading__title {
    margin: 0 0 0.45rem;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--pcb-cream, #f5ebe0);
    letter-spacing: 0.02em;
  }

  .review-primary-loading__sub {
    margin: 0;
    font-size: 0.85rem;
    color: var(--pcb-muted, rgba(245, 235, 224, 0.55));
  }

  .main-layout.with-review .review-section-inner {
    flex: 1 1 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    padding: 0.45rem 0.55rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-bottom: none;
    box-shadow: none;
  }

  .main-layout.with-review .review-title {
    display: none !important;
  }

  .main-layout.with-review .review-acc-verdict {
    flex-shrink: 0;
    margin: 0 0 0.45rem;
  }

  .main-layout.with-review .review-acc-verdict .results-verdict-text {
    font-size: 1.15rem;
    margin: 0;
    text-align: center;
  }

  .main-layout.with-review .review-pane--acc .review-acc-verdict:not([hidden]) {
    display: flex;
  }

  .main-layout.with-review .review-close-row {
    display: flex;
    justify-content: stretch;
    margin: 0 0 0.4rem;
    flex-shrink: 0;
    /* над вкладками — всегда видна, не уезжает за низ экрана */
    order: 9;
    position: sticky;
    top: 0;
    z-index: 3;
    background: linear-gradient(180deg, var(--pcb-paper-2), var(--pcb-paper));
    padding-bottom: 0.15rem;
  }

  .main-layout.with-review .review-close-row .btn-close-review-panel {
    width: 100%;
  }

  .main-layout.with-review .review-section-inner > #review-loading {
    order: 5;
    margin-top: 0;
  }

  .main-layout.with-review .review-section-inner > #review-error:not([hidden]) {
    order: 8;
  }

  .main-layout.with-review .review-section-inner > #review-body {
    order: 10;
  }

  .main-layout.with-review .btn-close-review-panel {
    padding: 0.35rem 0.65rem;
    font-size: 0.78rem;
    min-height: 40px;
  }

  .main-layout.with-review .review-mobile-tabs {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 3;
    flex-shrink: 0;
    gap: 0.3rem;
    padding-bottom: 0.35rem;
    margin-bottom: 0.15rem;
    background: linear-gradient(180deg, var(--pcb-paper-2) 70%, var(--pcb-paper));
  }

  .main-layout.with-review .review-mtab {
    font-size: 0.62rem;
    letter-spacing: 0.03em;
    padding: 0.38rem 0.15rem;
  }

  .main-layout.with-review .review-mtab--coach {
    letter-spacing: 0.02em;
  }

  .main-layout.with-review .review-tab-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-shrink: 0;
    width: 100%;
    box-sizing: border-box;
    margin: 0 0 0.45rem;
    min-height: 0;
  }

  .main-layout.with-review .review-tab-toolbar:has(.js-reset-review-exploration[hidden]) {
    display: none;
  }

  .main-layout.with-review .btn-reset-exploration--under-tabs {
    width: auto;
    margin-bottom: 0;
    padding: 0.35rem 0.7rem;
    font-size: 0.68rem;
    letter-spacing: 0.06em;
    white-space: nowrap;
  }

  /* Дубль сброса в PGN на телефоне не нужен — под табами одна кнопка */
  .main-layout.with-review #btn-reset-exploration {
    display: none !important;
  }

  .main-layout.with-review #review-body.review-body--coach-tab {
    flex: 1 1 0;
    min-height: 10rem;
    max-height: none;
  }

  .main-layout.with-review.review-mobile-tab-coach .review-section-inner {
    overflow: hidden;
  }

  .main-layout.with-review.review-mobile-tab-coach .review-close-row {
    margin-bottom: 0.25rem;
    padding-bottom: 0.1rem;
  }

  .main-layout.with-review #review-body {
    /* чуть выше — панель с табами + контент вкладки (шапка скрыта) */
    flex: 1 1 0;
    min-height: 0;
    max-height: min(72dvh, 44rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  .main-layout.with-review .review-pane:not(.is-active) {
    display: none !important;
  }

  .main-layout.with-review .review-pane.is-active {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
  }

  .main-layout.with-review .review-pane--moves.is-active .review-moves-stack {
    flex: 1 1 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  /* Вкладка «Ходы»: без строки «два последних хода» и без слайдера/⏮⏭ — только ← | текст хода | → */
  .main-layout.with-review .review-pane--moves.is-active .review-moves-topbar {
    display: none !important;
  }

  .main-layout.with-review .review-pane--moves.is-active .review-moves-host {
    display: none !important;
  }

  .main-layout.with-review .review-pane--moves.is-active .review-moves-controls {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    flex-shrink: 0;
    padding-top: 0.25rem;
    padding-bottom: max(0.35rem, env(safe-area-inset-bottom, 0px));
    margin-top: 0;
    position: relative;
    background: transparent;
    box-shadow: none;
  }

  .main-layout.with-review .review-pane--moves.is-active .review-control-block--scrub {
    display: none !important;
  }

  .main-layout.with-review .review-pane--moves.is-active .review-slider-label,
  .main-layout.with-review .review-pane--moves.is-active .review-slider-row {
    display: none !important;
  }

  .main-layout.with-review .review-pane--moves.is-active .review-control-block--step {
    padding-bottom: 0.6rem;
  }

  .main-layout.with-review .review-pane--moves.is-active .review-move-quality {
    display: block;
    flex-shrink: 0;
    width: 100%;
    margin: 0.2rem 0 0.15rem;
    padding: 0.2rem 0.35rem;
    text-align: center;
    font-size: clamp(0.72rem, 3.2vw, 0.92rem);
    line-height: 1.3;
    letter-spacing: 0.06em;
    white-space: normal;
    overflow-wrap: anywhere;
    text-transform: uppercase;
    background: transparent;
    border: none;
    box-shadow: none;
  }

  .main-layout.with-review .review-pane--moves.is-active .review-move-quality[hidden] {
    display: none !important;
  }

  .main-layout.with-review .review-pane--moves.is-active .review-step-row {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0;
    grid-template-columns: unset;
  }

  .main-layout.with-review .review-pane--moves.is-active #rev-step-label {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    padding: 0.2rem 0.15rem;
    overflow: hidden;
  }

  .main-layout.with-review .review-pane--moves.is-active .rev-step-label__num {
    font-size: 0.65rem;
  }

  .main-layout.with-review .review-pane--moves.is-active .rev-step-label__san {
    font-size: 0.88rem;
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  .main-layout.with-review .review-pane--moves.is-active .rev-step-label__line {
    font-size: 0.78rem;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  .main-layout.with-review .review-pane--moves.is-active .review-moves-controls .review-step-nav-btn {
    flex: 0 0 3.25rem;
    width: 3.25rem;
    min-width: 3.25rem;
    max-width: 3.25rem;
    height: 3rem;
    min-height: 3rem;
    max-height: 3rem;
    align-self: center;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  .main-layout.with-review .review-pane--moves.is-active .review-step-nav-btn__icon {
    width: 1.55rem;
    height: 1.55rem;
  }

  .main-layout.with-review .review-pane--moves.is-active .review-moves-coach-thinking {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    flex-shrink: 0;
    margin: 0.15rem 0 max(0.5rem, env(safe-area-inset-bottom, 0px));
    padding: 0.45rem 0.65rem 0.55rem;
    text-align: center;
    border-radius: 8px;
    background: rgba(32, 40, 54, 0.72);
    border: 1px solid rgba(240, 136, 69, 0.18);
  }

  .main-layout.with-review .review-pane--moves.is-active .review-moves-coach-thinking[hidden] {
    display: none !important;
  }

  .main-layout.with-review .review-pane--moves.is-active .review-moves-coach-thinking__label {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.35;
    color: rgba(240, 196, 154, 0.9);
    font-style: italic;
  }

  .main-layout.with-review .review-pane--moves.is-active .review-moves-coach-thinking .coach-typing-dots,
  .main-layout.with-review .review-pane--moves.is-active .review-moves-coach-thinking__thinking {
    justify-content: center;
  }

  .main-layout.with-review .review-pane--pgn.is-active .review-bottom-actions {
    flex-shrink: 0;
    padding-bottom: max(0.25rem, env(safe-area-inset-bottom, 0px));
  }

  .main-layout.with-review .review-pane--pgn.is-active .review-pgn-mobile-copy-wrap .js-copy-pgn {
    width: 100%;
    box-sizing: border-box;
    min-height: 44px;
  }

  .main-layout.with-review .review-pane--acc.is-active,
  .main-layout.with-review .review-pane--post.is-active,
  .main-layout.with-review .review-pane--pgn.is-active {
    flex: 1 1 0;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .main-layout.with-review .review-pane--coach.is-active {
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    display: flex !important;
    flex-direction: column;
  }

  .main-layout.with-review .review-coach-host {
    flex: 1 1 0;
    min-height: min(46dvh, 30rem);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .main-layout.with-review .review-coach-host .bot-chat-panel.bot-chat-left {
    display: flex !important;
    flex: 1 1 0;
    align-self: stretch;
    min-height: 0;
    max-height: none;
    height: auto;
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    flex-direction: column;
  }

  .main-layout.with-review .review-coach-host #coach-chat-panel {
    display: flex !important;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
    gap: 0;
  }

  .main-layout.with-review .review-coach-host .coach-chat-body {
    flex: 1 1 0;
    min-height: 8rem;
    max-height: none;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.22);
  }

  .main-layout.with-review .review-coach-host .coach-chat-log {
    flex: 1 1 0;
    min-height: 6.5rem;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.45rem 0.5rem;
    box-sizing: border-box;
  }

  .main-layout.with-review .review-coach-host .coach-chat-log:empty::before {
    content: "";
    display: block;
    min-height: 3.5rem;
  }

  .main-layout.with-review .review-coach-host .coach-chat-log.coach-chat-log--waiting::before {
    content: attr(data-waiting-label);
    display: block;
    padding: 0.35rem 0.1rem;
    font-size: 0.82rem;
    line-height: 1.35;
    color: rgba(240, 230, 220, 0.55);
    font-style: italic;
  }

  .main-layout.with-review .review-coach-host .coach-chat-head > .coach-chat-quick {
    order: 3;
    flex-basis: 100%;
    display: grid;
  }

  .main-layout.with-review .review-coach-host .coach-chat-compose {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 0.35rem;
    row-gap: 0.25rem;
    margin-top: 0.22rem;
    padding-top: 0;
    padding-bottom: max(0.25rem, env(safe-area-inset-bottom, 0px));
    border-top: none;
    background: transparent;
    box-shadow: none;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
  }

  .main-layout.with-review .review-coach-host .coach-chat-compose .coach-chat-login-hint {
    grid-column: 1 / -1;
    margin: 0;
  }

  .main-layout.with-review .review-coach-host .coach-chat-compose .coach-chat-input {
    grid-column: 1;
    min-height: 2.35rem;
    height: 2.35rem;
    max-height: 2.35rem;
    resize: none;
    overflow-x: auto;
    overflow-y: hidden;
    font-size: 0.92rem;
    line-height: 1.25;
    padding: 0.45rem 0.55rem;
    white-space: nowrap;
  }

  .main-layout.with-review .review-coach-host .coach-chat-font-controls--head {
    display: flex;
  }

  .main-layout.with-review .review-coach-host .coach-chat-font-controls--compose {
    display: none !important;
  }

  .main-layout.with-review .review-coach-host .coach-chat-compose .coach-chat-compose-bar {
    grid-column: 2;
    width: auto;
    min-width: 0;
    align-self: stretch;
    justify-content: flex-end;
  }

  .main-layout.with-review .review-coach-host .coach-chat-compose .coach-chat-send {
    margin-left: 0;
    align-self: center;
    width: auto;
    min-width: 5.25rem;
    max-width: 6.75rem;
    min-height: 2.35rem;
    height: 2.35rem;
    padding: 0 0.7rem;
    margin-top: 0;
    font-size: 0.76rem;
    letter-spacing: 0.02em;
    white-space: nowrap;
  }

  .main-layout.with-review .review-coach-host .coach-chat-head {
    justify-content: flex-end;
    flex-shrink: 0;
    padding-bottom: 0.15rem;
    margin-bottom: 0.1rem;
    border-bottom: none;
  }

  .main-layout.with-review .review-coach-host .coach-chat-head .coach-chat-panel-head {
    display: none;
  }

  .main-layout.with-review .review-coach-host .coach-quick-btn {
    font-size: var(--coach-chat-font-rem, 0.9rem);
    padding: 0.26rem 0.45rem;
  }

  .main-layout.with-review .review-coach-host .coach-quick-btn:disabled {
    opacity: 0.72;
    border-color: rgba(255, 255, 255, 0.14);
    color: rgba(236, 217, 198, 0.88);
  }

  /* Модалки: bottom sheet — не выше вьюпорта минус safe-area, контент скроллится внутри */
  .time-control-overlay:not([hidden]),
  .scenario-picker-overlay:not([hidden]) {
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
  }

  .time-control-dialog,
  .scenario-picker-dialog {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border-radius: 16px 16px 0 0;
    max-height: min(
      88dvh,
      calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px) - 0.5rem)
    );
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    margin-top: auto;
    margin-bottom: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

  .results-overlay {
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .results-card,
  .results-card--final {
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 92dvh;
    overflow-y: auto;
    margin-top: auto;
  }

  .results-card--final {
    padding: 1.5rem 1rem 1.25rem;
  }

  .resign-confirm-overlay:not([hidden]),
  .ladder-celebration-overlay:not([hidden]) {
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  .resign-confirm-dialog,
  .ladder-celebration-card {
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 92dvh;
    overflow-y: auto;
    margin-top: auto;
  }

  .time-control-footer .pcb-btn,
  .time-control-presets .tc-preset,
  .results-final-actions .pcb-btn {
    min-height: 48px;
  }

  .promotion-choice-btn {
    min-height: 48px;
  }

  /* ── Все страницы: формы входа/регистрации/сброса — кнопки на всю ширину ── */
  .pcb-auth-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
  }

  .pcb-auth-actions .pcb-btn,
  .pcb-auth-actions .pcb-btn-outline,
  .pcb-auth-actions .pcb-btn--ghost {
    width: 100%;
    justify-content: center;
    min-height: 48px;
    box-sizing: border-box;
  }

  .pcb-auth-lead {
    overflow-wrap: anywhere;
  }

  .pcb-auth-beta-note {
    overflow-wrap: anywhere;
  }

  .pcb-auth-card {
    min-width: 0;
  }

  /* Мои партии: табы фильтра — горизонтальный скролл, удобные тач-цели */
  .pcb-tc-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.45rem;
    padding-bottom: 0.2rem;
    margin-bottom: 0.85rem;
    scrollbar-width: thin;
  }

  .pcb-tc-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: max-content;
    min-height: 44px;
    padding: 0.45rem 0.9rem;
  }

  /* Пагинация (анализ, кабинет) */
  .pcb-pagination {
    justify-content: center;
    gap: 0.35rem;
  }

  .pcb-page-btn {
    min-width: 2.4rem;
    min-height: 2.4rem;
  }

  .pcb-pagination-info {
    text-align: center;
    line-height: 1.45;
  }

  /* /analysis: лимит, подсказка платформы */
  .analysis-limit-bar {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .analysis-limit-bar__pips {
    margin-left: 0;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    row-gap: 0.35rem;
    padding-top: 0.25rem;
  }

  .analysis-platform-info {
    flex-wrap: wrap;
  }

  .analysis-import-wrap.pcb-auth-card {
    margin-top: 1rem;
  }

  /* Кабинет: заголовок + ссылка настройки */
  .pcb-cabinet-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .pcb-cabinet-settings-link {
    align-self: flex-start;
  }

  .pcb-cabinet-title {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  /* Лига: вводный блок */
  .pcb-ladder-head {
    padding: 1rem 1rem;
    margin-bottom: 1rem;
    border-radius: 16px;
  }

  .pcb-ladder-title {
    margin: 0 0 0.4rem;
    font-size: clamp(1.15rem, 4.5vw, 1.75rem);
    line-height: 1.2;
  }

  .pcb-ladder-lead {
    font-size: 0.88rem;
  }

  .pcb-ladder-stars-legend {
    font-size: 0.8rem;
  }

  .pcb-ladder-disclose > summary {
    margin-top: 0.25rem;
  }

  /* Зал славы */
  .pcb-hof {
    padding: 1.25rem 0.6rem 2.5rem;
  }

  .pcb-hof-head {
    margin-bottom: 1.25rem;
  }

  .pcb-hof-title {
    font-size: clamp(1.35rem, 5.5vw, 2rem);
  }

  .pcb-hof-disclose > summary {
    margin-bottom: 0.35rem;
  }

  .pcb-hof-tabs {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem;
  }

  .pcb-hof-tab {
    flex: 1 1 auto;
    min-width: 0;
    text-align: center;
    min-height: 44px;
  }

  .pcb-hof-trophy {
    width: min(160px, 48vw);
    height: auto;
  }

  /* Premium */
  .prm-page {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  /* Настройки: fieldset */
  .pcb-settings-fieldset {
    padding: 0.8rem 0.75rem 0.5rem;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   MOBILE  ≤ 420px  (small phones)
   ═══════════════════════════════════════════════════════════════════════════ */
@media (max-width: 420px) {
  .pcb-topbar-inner { padding: 0 0.75rem; height: 3rem; }
  .pcb-nav--topbar-end,
  .pcb-nav--play-header {
    top: 3rem;
  }
  .pcb-logo-text { font-size: 0.85rem; }
  .pcb-play-main-card { padding: 0.9rem 0.9rem 1.25rem !important; }
  .pcb-btn { font-size: 0.8rem; padding: 0.6rem 1rem; }
}

/* Разбор: чат слева на десктопе, под доской на планшете. */
.review-coach-wide-host {
  display: none;
}

@media (min-width: 641px) {
  #view-play:has(.main-layout.with-review) .play-header {
    padding-block: 0.25rem;
    margin-bottom: 0.5rem;
    row-gap: 0.25rem;
  }

  #view-play:has(.main-layout.with-review) .play-opponent-badge,
  #view-play:has(.main-layout.with-review) .play-user-avatar-badge {
    width: 2.25rem;
    height: 2.25rem;
  }

  .main-layout.with-review > .review-coach-wide-host:not(:empty) {
    display: flex;
    order: 3;
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .main-layout.with-review .review-coach-wide-host > .bot-chat-panel.bot-chat-left {
    display: flex !important;
    flex: 1 1 auto;
    align-self: stretch;
    width: 100%;
    max-width: none;
    min-width: 0;
    min-height: clamp(18rem, 34vh, 26rem);
    max-height: none;
    box-sizing: border-box;
    padding-top: 0.25rem;
  }

  .main-layout.with-review .review-coach-wide-host .coach-chat-head {
    padding-bottom: 0;
    margin-bottom: 0.2rem;
  }

  .main-layout.with-review .review-coach-wide-host .coach-chat-panel-head {
    line-height: 1.5rem;
  }
}

@media (min-width: 1025px) {
  body:has(#view-play .main-layout.with-review) .pcb-main {
    max-width: none;
    padding-inline: 1rem;
  }

  #view-play:has(.main-layout.with-review) {
    container-type: size;
  }

  #view-play .main-layout.with-review .board-outer {
    width: var(--review-board-size);
    height: var(--review-board-size);
    box-sizing: border-box;
  }

  #view-play:not([hidden]) #main-layout.main-layout.with-review,
  html.pcb-play-view-open #view-play .main-layout.with-review {
    display: grid;
    --review-board-auto-size: min(calc(100cqh - 4rem), calc(100cqw - clamp(240px, 28cqw, 460px) - clamp(220px, 20cqw, 320px) - 4.85rem));
    --review-board-size: max(280px, min(var(--review-board-requested-size, var(--review-board-auto-size)), calc(100cqh - 4rem), calc(100cqw - 240px - clamp(220px, 20cqw, 320px) - 4.85rem)));
    grid-template-columns: minmax(240px, 1fr) calc(var(--review-board-size) + 2.85rem) clamp(220px, 20cqw, 320px);
    grid-template-rows: minmax(0, 1fr);
    scrollbar-gutter: auto;
    grid-template-areas: "review-chat review-board review-controls";
    justify-content: center;
    align-items: start;
    gap: 1rem 1.25rem;
    width: 100%;
  }

  #view-play:not([hidden]) #main-layout.main-layout.with-review > .layout-primary,
  html.pcb-play-view-open #view-play .main-layout.with-review > .layout-primary {
    grid-area: review-board;
    width: auto;
    min-width: 0;
  }

  #view-play:not([hidden]) #main-layout.main-layout.with-review > .review-aside,
  html.pcb-play-view-open #view-play .main-layout.with-review > .review-aside {
    grid-area: review-controls;
    align-self: start;
    width: 100%;
    min-width: 220px;
    max-width: none;
    height: 100%;
    min-height: 0;
    max-height: none;
    overflow: hidden;
    box-sizing: border-box;
  }

  .main-layout.with-review > .review-aside > .review-section-inner {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    box-sizing: border-box;
    padding: 0.75rem;
  }

  .main-layout.with-review > .review-aside #review-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    padding-right: 0;
    overscroll-behavior: contain;
    scrollbar-gutter: auto;
  }

  .main-layout.with-review .review-title {
    margin-bottom: 0.5rem;
  }

  /* После переноса чата пустые вкладки не должны оставлять flex-gap. */
  .main-layout.with-review #review-body > .review-pane--coach:has(> #review-coach-host:empty),
  .main-layout.with-review #review-body > .review-pane--pgn {
    display: none !important;
  }

  .main-layout.with-review .review-acc-verdict {
    margin-bottom: 0.35rem;
  }

  .main-layout.with-review .review-acc-verdict .results-verdict-text {
    font-size: 1.5rem;
  }

  .main-layout.with-review .review-stats-card {
    padding: 0.4rem 0.5rem;
    gap: 0.25rem;
  }

  .main-layout.with-review .review-control-block {
    padding: 0.4rem 0.5rem;
  }

  .main-layout.with-review .review-show-best-row {
    margin-bottom: 0;
    padding: 0.4rem 0.5rem;
  }

  #view-play:not([hidden]) #main-layout.main-layout.with-review > .review-coach-wide-host,
  html.pcb-play-view-open #view-play .main-layout.with-review > .review-coach-wide-host {
    grid-area: review-chat;
    width: 100%;
    min-width: 0;
    contain: inline-size;
    height: 100%;
  }

  .main-layout.with-review .review-coach-wide-host > .bot-chat-panel.bot-chat-left {
    min-height: 0;
    max-height: 100%;
  }

  .main-layout.with-review .review-coach-wide-host .coach-chat-quick {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    padding-bottom: 0.35rem;
    margin-block: 0.2rem;
    gap: 0.4rem;
  }

  .main-layout.with-review .review-coach-wide-host .coach-quick-btn {
    width: 100%;
    max-width: 100%;
    font-size: var(--coach-chat-font-rem, 0.9rem);
    line-height: 1.3;
    padding: 0.4rem;
    border-radius: 6px;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .main-layout.with-review .review-coach-wide-host .coach-chat-compose {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .main-layout.with-review .review-coach-wide-host .coach-chat-compose-bar {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.3rem;
  }

  .main-layout.with-review .review-coach-wide-host .coach-chat-stop,
  .main-layout.with-review .review-coach-wide-host .coach-chat-send {
    height: 2.35rem;
    min-width: 0;
    margin: 0;
    padding: 0.4rem 0.5rem;
    font-size: 0.85rem;
    align-self: center;
  }

  .main-layout.with-review .board-eval-row #eval-column:not([hidden]) {
    height: var(--review-board-height, 30rem);
    min-height: var(--review-board-height, 30rem);
    max-height: var(--review-board-height, 30rem);
  }
}

@media (max-width: 640px) {
  #view-play:not([hidden]) #main-layout.main-layout.with-review,
  html.pcb-play-view-open #view-play .main-layout.with-review {
    /* Иначе 15px gutter заставляет ряд «шкала + доска» переноситься и блоки перекрываются. */
    scrollbar-gutter: auto;
  }
}

/* ═══════════════════════════════════════════════════════════════════════════
   UX-итерация 2: импорт, прогресс разбора, Лига (актуальные соперники)
   ═══════════════════════════════════════════════════════════════════════════ */

/* Импорт партий: статус этапов и повтор неудавшихся */
.pcb-import-status {
  margin: 0.75rem 0 0;
  font-size: 0.85rem;
  color: var(--pcb-ink-2);
  min-height: 1.2em;
}
.pcb-import-status--error {
  color: #ff9d7a;
}
.pcb-import-retry {
  margin-top: 0.5rem;
}

/* Прогресс расчёта разбора */
.review-progress {
  text-align: center;
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: var(--pcb-ink-2);
}
.review-partial-note {
  margin: 0.4rem 0 0.6rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #ffcf9e;
  background: rgba(224, 112, 46, 0.12);
  border: 1px solid rgba(224, 112, 46, 0.3);
  border-radius: 8px;
}
.review-retry-btn {
  margin-top: 0.6rem;
}

/* Лига: фильтр «Актуальные / Все роботы» */
.pcb-ladder-view-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin: 0 0 0.9rem;
}
.pcb-ladder-view-toggle {
  display: inline-flex;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  overflow: hidden;
}
.pcb-ladder-view-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--pcb-ink-2);
  font: inherit;
  font-size: 0.82rem;
  padding: 0.45rem 0.9rem;
  min-height: 36px;
  cursor: pointer;
}
.pcb-ladder-view-btn.is-active {
  background: var(--pcb-orange);
  color: #1a120c;
  font-weight: 600;
}
.pcb-ladder-view-btn:focus-visible {
  outline: 2px solid var(--pcb-orange-mid);
  outline-offset: -2px;
}
.pcb-ladder-tc-hint {
  font-size: 0.75rem;
  color: var(--pcb-muted);
}

/* Лига: следующий соперник и возврат к выбранному роботу */
.pcb-ladder-badge--next {
  background: rgba(224, 112, 46, 0.16);
  border: 1px solid rgba(224, 112, 46, 0.45);
  color: var(--pcb-orange-mid);
}
.pcb-ladder-card--next {
  border-color: rgba(224, 112, 46, 0.4);
}
.pcb-ladder-card--focus {
  outline: 2px solid var(--pcb-orange-mid);
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════════════════
   UX-итерация 3: главная, настройка партии, чат, формы, кабинет, поддержка
   ═══════════════════════════════════════════════════════════════════════════ */

/* Настройка партии: ориентир силы у Elo + удобные кнопки цвета */
.pcb-elo-band {
  font-size: 0.8rem;
  color: var(--pcb-orange-mid);
  white-space: nowrap;
}
.pcb-bot-card-start {
  min-height: 44px;
}

/* Модалка контроля времени: формат и резюме параметров */
.time-control-format-hint {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  color: var(--pcb-muted);
}
.time-control-summary {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--pcb-ink-2);
  min-height: 1.1em;
}

/* AI-чат: метка позиции, заметка об обрыве, повтор */
.coach-msg-step-meta {
  margin-top: 0.2rem;
  font-size: 0.72rem;
  color: var(--pcb-muted);
}
.coach-msg-note {
  margin-top: 0.3rem;
  font-size: 0.75rem;
  color: #ffcf9e;
}
.coach-retry-btn {
  appearance: none;
  margin-top: 0.4rem;
  padding: 0.25rem 0.7rem;
  font: inherit;
  font-size: 0.78rem;
  color: var(--pcb-ink);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  cursor: pointer;
  min-height: 32px;
}
.coach-retry-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* Формы входа/регистрации: показ пароля, inline-ошибка, переключение */
.pcb-pw-field {
  display: flex;
  gap: 0.4rem;
  align-items: stretch;
}
.pcb-pw-field .pcb-input {
  flex: 1 1 auto;
  min-width: 0;
}
.pcb-pw-toggle {
  appearance: none;
  flex: 0 0 auto;
  padding: 0 0.7rem;
  font: inherit;
  font-size: 0.75rem;
  color: var(--pcb-ink-2);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  cursor: pointer;
}
.pcb-pw-toggle:focus-visible {
  outline: 2px solid var(--pcb-orange-mid);
  outline-offset: 1px;
}
.pcb-form-error {
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: #ff9d7a;
}
.pcb-auth-switch {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  text-align: center;
}
.pcb-auth-switch a {
  color: var(--pcb-orange-mid);
}

/* Кабинет: незавершённая партия */
.pcb-active-game-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0.6rem 0 1rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid rgba(224, 112, 46, 0.35);
  border-radius: 10px;
  background: rgba(224, 112, 46, 0.1);
}
.pcb-active-game-banner__text {
  font-size: 0.85rem;
  color: var(--pcb-cream);
}

/* Настройки: аватар и свёрнутая смена пароля */
.pcb-settings-avatar-error {
  margin: 0.4rem 0 0;
  font-size: 0.8rem;
  color: #ff9d7a;
}
.pcb-settings-fieldset-wrap > summary {
  cursor: pointer;
  color: var(--pcb-cream);
  font-weight: 600;
  padding: 0.3rem 0;
}
.pcb-settings-fieldset-wrap > summary:focus-visible {
  outline: 2px solid var(--pcb-orange-mid);
  outline-offset: 2px;
}
.pcb-settings-fieldset-wrap[open] > summary {
  margin-bottom: 0.4rem;
}

/* UX-08: иллюстрационные карточки лендинга — ниже на мобильном (текст остаётся читаемым) */
@media (max-width: 640px) {
  .pcb-landing-pitch-media {
    aspect-ratio: 4 / 3;
  }
  @supports not (aspect-ratio: 1) {
    .pcb-landing-pitch-media {
      padding-top: 75%;
    }
  }
}

/* UX-10: кнопка «Стоп» в AI-чате */
.coach-chat-stop {
  margin-right: auto;
}

/* Чат: чтение важнее служебных элементов; подсказки раскрываются по запросу. */
.coach-suggestions {
  grid-column: 1 / -1;
  min-width: 0;
}
.coach-suggestions > summary {
  cursor: pointer;
  color: var(--pcb-muted);
  font-size: 0.85rem;
  padding: 0.4rem 0;
}
.coach-suggestions[open] > summary { margin-bottom: 0.25rem; }
.coach-suggestions .coach-chat-quick { margin-bottom: 0.4rem; }
.main-layout.with-review .bot-chat-msg--coach {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0.5rem 0.15rem;
}
.coach-chat-compose-bar .coach-chat-stop {
  height: 2.35rem;
  margin: 0;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}
.coach-chat-compose-bar:has(.coach-chat-stop:not([hidden])) .coach-chat-send {
  display: none !important;
}
.review-desktop-moves { display: none; }
.review-close-icon { display: none; }

@media (min-width: 1025px) {
  .main-layout.with-review .review-section-inner { position: relative; }
  .main-layout.with-review .review-close-row {
    position: absolute;
    right: 0.75rem;
    top: 0.75rem;
    margin: 0;
  }
  .main-layout.with-review .review-close-row button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    min-height: 0;
    padding: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--pcb-orange-mid);
    box-shadow: none;
    border: 0;
  }
  .main-layout.with-review .review-close-row button:hover {
    background: rgba(240, 136, 69, 0.16);
    color: var(--pcb-orange);
  }
  .main-layout.with-review .review-close-label { display: none; }
  .main-layout.with-review .review-close-icon { display: block; }
  .main-layout.with-review .review-title {
    text-align: center;
    font-size: 0.85rem;
    padding-inline: 2.1rem;
    min-height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .main-layout.with-review .review-stats-card,
  .main-layout.with-review .review-control-block,
  .main-layout.with-review .review-show-best-row {
    background: transparent;
    box-shadow: none;
    border: 0;
  }
  .main-layout.with-review .review-acc-verdict .results-verdict-text {
    font-size: 1.1rem;
  }
  .main-layout.with-review #review-body > .review-pane--moves {
    flex: 1 1 auto;
    min-height: 12rem;
  }
  .main-layout.with-review #review-body .review-moves-stack {
    flex: 1;
    min-height: 0;
  }
  .main-layout.with-review #review-body .review-moves-controls {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 2.75rem));
    justify-content: center;
    grid-template-rows: 3.75rem 2.75rem auto;
    gap: 0.3rem;
    flex-shrink: 0;
    order: 0;
  }
  .main-layout.with-review .review-control-block,
  .main-layout.with-review .review-slider-row,
  .main-layout.with-review .review-step-row { display: contents; }
  .main-layout.with-review .review-control-block__title { display: none; }
  .main-layout.with-review #rev-step-label {
    grid-column: 1 / -1;
    grid-row: 1;
    font-size: 1rem;
    padding: 0.25rem 0;
    height: 3.75rem;
    box-sizing: border-box;
  }
  .main-layout.with-review #rev-first { grid-area: 2 / 1; }
  .main-layout.with-review #rev-prev { grid-area: 2 / 2; }
  .main-layout.with-review #rev-next { grid-area: 2 / 3; }
  .main-layout.with-review #rev-last { grid-area: 2 / 4; }
  .main-layout.with-review :is(#rev-first, #rev-prev, #rev-next, #rev-last) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 2.75rem;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: none;
  }
  .main-layout.with-review :is(#rev-first, #rev-prev, #rev-next, #rev-last):hover {
    background: rgba(255, 255, 255, 0.12);
  }
  .main-layout.with-review :is(#rev-prev, #rev-next) {
    background: #d6b68c;
    border-color: #e4cba9;
    color: #30271e;
  }
  .main-layout.with-review :is(#rev-prev, #rev-next):hover {
    background: #e8cba5;
    border-color: #f0d9bb;
  }
  .main-layout.with-review :is(#rev-prev, #rev-next):active {
    background: #c7a477;
  }
  .main-layout.with-review #rev-slider {
    grid-column: 1 / -1;
    grid-row: 3;
    width: 100%;
    margin: 0.4rem 0;
  }
  .main-layout.with-review #review-move-quality {
    display: flex !important;
    align-items: center;
    justify-content: center;
    order: 1;
    flex: 0 0 3rem;
    height: 3rem;
    min-height: 3rem;
    box-sizing: border-box;
    margin: 0;
    font-size: 0.8rem;
    line-height: 1.35;
    text-align: center;
    overflow-y: auto;
  }
  .main-layout.with-review #review-move-quality[hidden] {
    visibility: hidden;
  }
  .main-layout.with-review .review-show-best-row { order: 2; }
  .main-layout.with-review #review-show-best-move {
    appearance: none;
    width: 2rem;
    height: 1.15rem;
    border-radius: 1rem;
    background: #555;
    position: relative;
    flex-shrink: 0;
    cursor: pointer;
  }
  .main-layout.with-review #review-show-best-move::after {
    content: "";
    position: absolute;
    width: 0.85rem;
    height: 0.85rem;
    top: 0.15rem;
    left: 0.15rem;
    border-radius: 50%;
    background: white;
  }
  .main-layout.with-review #review-show-best-move:checked { background: #408458; }
  .main-layout.with-review #review-show-best-move:checked::after { left: 1rem; }
  .main-layout.with-review .review-desktop-moves {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
    order: -1;
    flex: 1 1 10rem;
    min-height: 6rem;
    overflow-y: auto;
    position: relative;
    gap: 0.15rem;
    padding: 0.4rem 0;
    border-block: 1px solid rgba(255,255,255,0.08);
  }
  .review-move-link {
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--pcb-ink);
    text-align: left;
    padding: 0.4rem;
    font: inherit;
    font-size: 0.85rem;
    cursor: pointer;
  }
  .review-move-link:hover { background: rgba(255,255,255,0.07); }
  .review-move-link[data-quality="mistake"] { color: #edb568; }
  .review-move-link[data-quality="blunder"] { color: #ed8b82; }
  .review-move-link.is-active { background: rgba(240,136,69,0.22); outline: 1px solid #c38353; outline-offset: -1px; }
  .main-layout.with-review #btn-copy-pgn {
    background: transparent;
    box-shadow: none;
    border: 0;
    font-size: 0.75rem;
    color: var(--pcb-muted);
  }
}

@media (max-width: 640px) {
  .main-layout.with-review .review-coach-host {
    min-height: 0 !important;
  }
  .main-layout.with-review .review-coach-host #coach-chat-panel {
    overflow-y: auto;
  }
  .main-layout.with-review .review-coach-host .coach-chat-body {
    min-height: 3rem;
    border: 0;
    background: transparent;
  }
  .main-layout.with-review .review-coach-host .coach-chat-log {
    min-height: 0;
  }
  .main-layout.with-review .review-coach-host .coach-suggestions[open] .coach-chat-quick {
    max-height: 7rem;
    overflow-y: auto;
  }
}

/* Ответ тренера: абзацы и смысловые блоки вместо сплошной стены текста. */
.coach-chat-log .bot-chat-msg-text .coach-md-paragraph {
  margin: 0 0 0.85em;
  line-height: 1.55;
}
.coach-chat-log .bot-chat-msg-text .coach-md-heading {
  display: block;
  margin: 1.15em 0 0.45em;
  padding-left: 0.65em;
  border-left: 2px solid var(--pcb-orange-mid);
  color: var(--pcb-cream);
  font: inherit;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0;
}
.coach-chat-log .bot-chat-msg-text .coach-md-list {
  margin: 0.4em 0 0.9em;
  padding-left: 1.25em;
  line-height: 1.5;
}
.coach-chat-log .coach-md-list li + li { margin-top: 0.5em; }
.coach-chat-log .coach-md-list li::marker { color: var(--pcb-orange-mid); }
.coach-chat-log .bot-chat-msg-text > :first-child { margin-top: 0; }
.coach-chat-log .bot-chat-msg-text > :last-child { margin-bottom: 0; }

.board-resize-handle { display: none; }
@media (min-width: 1025px) {
  .main-layout .board-resize-handle {
    display: block;
    position: absolute;
    right: 0;
    bottom: 0;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 0 0 4px 0;
    background: transparent;
    color: var(--pcb-orange-mid);
    cursor: nwse-resize;
    touch-action: none;
    z-index: 20;
  }
  .board-resize-handle::after {
    content: "";
    position: absolute;
    right: 4px;
    bottom: 4px;
    width: 12px;
    height: 12px;
    background: repeating-linear-gradient(135deg, transparent 0 3px, currentColor 3px 5px);
    clip-path: polygon(100% 0, 100% 100%, 0 100%);
  }
  .board-resize-handle:hover, .board-resize-handle:focus-visible {
    background: rgba(240,136,69,0.18);
  }
  .board-outer.is-resizing { user-select: none; }
}

/* Квадратным остаётся поле; горизонтальная рамка на 3px тоньше боковой. */
#view-play .board-outer {
  aspect-ratio: auto !important;
  height: auto !important;
  align-self: flex-start !important;
}
#view-play .board-outer::before {
  content: "";
  display: block;
  padding-top: 100%;
  pointer-events: none;
}

/* League opponent cards: quiet navigation and one primary next action. */
.pcb-ladder-view-controls { justify-content: space-between; gap: .6rem 1.25rem; margin-bottom: 1.25rem; }
.pcb-ladder-view-toggle { border: 0; border-radius: 0; overflow: visible; gap: .7rem; }
.pcb-ladder-view-btn { min-height: 48px; border-bottom: 3px solid transparent; border-radius: 0; padding: .75rem .7rem; font-size: 1rem; font-weight: 700; }
.pcb-ladder-view-btn.is-active { color: var(--pcb-orange-mid); background: transparent; border-bottom-color: var(--pcb-orange); }
.pcb-ladder-view-btn:hover { color: var(--pcb-cream); }
.pcb-ladder-tc-hint { color: var(--pcb-ink-2); }
.pcb-ladder-card { padding: 1.25rem; gap: 1rem; background: linear-gradient(145deg, #1c1c1b, #121212); border-color: #333330; box-shadow: none; }
.pcb-ladder-card--next { border-color: var(--pcb-orange); background: linear-gradient(145deg, #2c2119, #171513); }
.pcb-ladder-card-status { min-height: 1.5rem; display: flex; align-items: center; }
.pcb-ladder-card-status .pcb-ladder-badge { font-size: .82rem; font-weight: 500; text-transform: none; letter-spacing: 0; background: none; border: 0; padding: 0; color: var(--pcb-ink-2); }
.pcb-ladder-card-status .pcb-ladder-badge--next { color: var(--pcb-orange-mid); display: flex; align-items: center; gap: .5rem; }
.pcb-ladder-card .pcb-star--filled { fill: var(--pcb-orange); }
.pcb-ladder-card-top { flex-direction: column; align-items: center; text-align: center; gap: .8rem; }
.pcb-ladder-card .pcb-ladder-avatar { width: 104px; height: 104px; }
.pcb-ladder-card--next .pcb-ladder-avatar { border-color: var(--pcb-orange); }
.pcb-ladder-card .pcb-ladder-name { font-size: 1.2rem; margin-bottom: .35rem; }
.pcb-ladder-card .pcb-ladder-elo { color: var(--pcb-ink-2); font-weight: 400; font-size: .85rem; margin: 0; }
.pcb-ladder-card .pcb-ladder-desc { font-size: .9rem; line-height: 1.5; color: var(--pcb-ink-2); min-height: 3em; }
.pcb-ladder-card-actions { display: grid; grid-auto-rows: auto; gap: .65rem; margin-top: .3rem; }
.pcb-ladder-card-actions .pcb-ladder-play { width: 100%; min-height: 44px; padding: .7rem; border-radius: 8px; box-shadow: none; text-transform: none; font-size: .95rem; letter-spacing: 0; }
.pcb-ladder-card-actions .pcb-btn--primary { background: var(--pcb-orange); border: 1px solid var(--pcb-orange-mid); color: #fff; }
.pcb-ladder-card-actions .pcb-btn--primary:hover { background: var(--pcb-orange-mid); }
.pcb-ladder-card-actions .pcb-ladder-rematch { background: rgba(224, 112, 46, .16); border: 1px solid rgba(240, 136, 69, .65); color: #fff; }
.pcb-ladder-card-actions .pcb-ladder-rematch:hover { background: rgba(224, 112, 46, .28); border-color: var(--pcb-orange-mid); }
.pcb-ladder-analysis {
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  width: 100%; min-height: 44px; box-sizing: border-box; padding: .65rem .75rem;
  border: 1px solid rgba(113, 174, 135, .24); border-radius: 8px;
  background: rgba(113, 174, 135, .075); color: #b6c9bb;
  text-decoration: none; font-size: .85rem;
  transition: background .15s ease, border-color .15s ease;
}
.pcb-ladder-analysis:hover { background: rgba(113, 174, 135, .14); border-color: rgba(113, 174, 135, .45); color: var(--pcb-cream); }
.pcb-ladder-analysis:focus-visible { outline: 2px solid #8ec8a0; outline-offset: 3px; }
.pcb-ladder-unlock { margin: 0; padding: .65rem; text-align: center; color: var(--pcb-ink-2); font-size: .85rem; line-height: 1.4; align-self: center; }
@media (max-width: 640px) {
  .pcb-ladder-view-controls { align-items: flex-start; flex-direction: column; }
  .pcb-ladder-view-toggle { width: 100%; gap: .5rem; }
  .pcb-ladder-view-btn { flex: 1; padding-inline: .25rem; font-size: .95rem; white-space: nowrap; }
  .pcb-ladder-grid { grid-template-columns: minmax(0, 1fr); }
  .pcb-ladder-card { padding: 1rem; gap: .8rem; }
  .pcb-ladder-card-top { flex-direction: row; text-align: left; align-items: center; }
  .pcb-ladder-card .pcb-ladder-avatar { width: 72px; height: 72px; }
  .pcb-ladder-card .pcb-ladder-desc { min-height: 0; }
  .pcb-ladder-card-actions { grid-template-rows: auto; }
}

/* League header: rank rail first, compact hero and paired progress bars. */
.pcb-ladder > .pcb-ladder-ranks-sticky { position: sticky; top: calc(3.75rem + 3px); z-index: 15; margin-bottom: 1.1rem; }
.pcb-ladder-head { padding: 1.5rem 2rem; margin-bottom: 1.4rem; }
.pcb-ladder-summary { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem 2rem; }
.pcb-ladder-progress-item { min-width: 0; }
.pcb-ladder-progress-item .pcb-lm-meta { margin: 0 0 .65rem; }
.pcb-ladder-progress-item .pcb-lm-linear { margin: 0; height: 7px; }
.pcb-ladder-summary > .pcb-lm-hint { grid-column: 1 / -1; margin: 0; }
@media (max-width: 640px) {
  .pcb-ladder-head { padding: 1rem; }
  .pcb-ladder-summary { grid-template-columns: minmax(0, 1fr); gap: 1.1rem; }
}

/* Live game: panels match the board, with the review's quiet move table. */
@media (min-width: 1025px) {
  #view-play #main-layout:not(.with-review) .bot-chat-panel.bot-chat-left,
  #view-play #main-layout:not(.with-review) .play-side-panel {
    height: var(--live-panel-height, auto);
    max-height: var(--live-panel-height, none);
    min-height: 0;
  }
  #view-play #main-layout:not(.with-review) .bot-chat-log { max-height: none; flex: 1; min-height: 0; }
  #view-play #main-layout:not(.with-review) .play-side-panel {
    padding: .7rem; border: 1px solid #ffffff1a; border-radius: 10px;
    background: linear-gradient(165deg, #24211e, #12110f); gap: .7rem;
  }
  #view-play #main-layout:not(.with-review) .play-history-column { flex: 1; min-height: 0; }
  #view-play #main-layout:not(.with-review) .play-move-history {
    flex: 1; min-height: 0; max-height: none; align-self: stretch;
    background: none; border: 0; box-shadow: none; padding: 0;
  }
  #view-play #main-layout:not(.with-review) .play-move-history-strip { flex: 1; min-height: 0; }
  #view-play #main-layout:not(.with-review) .play-move-history-list { max-height: none; min-height: 0; }
  #view-play #main-layout:not(.with-review) .play-move-history-row {
    grid-template-columns: 1.7rem minmax(0, 1fr); padding: .28rem 0; gap: .3rem;
    border-bottom-color: #ffffff08; align-items: center;
  }
  #view-play #main-layout:not(.with-review) .play-move-history-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .25rem; }
  #view-play #main-layout:not(.with-review) .play-move-history-san { padding: .35rem .25rem; font-size: .9rem; font-weight: 500; }
  #view-play #main-layout:not(.with-review) .play-move-history-row--replay { background: #e0702e22; outline: 1px solid #e0702e66; margin: 0; }
  #view-play #main-layout:not(.with-review) .play-move-history-head,
  #view-play #main-layout:not(.with-review) .bot-chat-panel-head { padding-bottom: .6rem; margin-bottom: .5rem; border-bottom: 1px solid #ffffff12; font-size: .75rem; }
  #view-play #main-layout:not(.with-review) .play-move-history-replay { justify-content: center; gap: .4rem; margin: 0; padding-top: .65rem; }
  #view-play #main-layout:not(.with-review) .play-hist-replay-btn { flex: 0 1 3rem; height: 2.75rem; box-shadow: none; font-size: 1.2rem; }
  #view-play #main-layout:not(.with-review) .play-hist-replay-btn--step { background: #d6b68c; color: #2a241c; border-color: #e4c9a3; }
  #view-play #main-layout:not(.with-review) .play-hist-replay-btn--step:hover:not(:disabled) { background: #e4c9a3; }
  #view-play #main-layout:not(.with-review) .play-hist-replay-btn--current { background: #ffffff08; color: var(--pcb-cream); border-color: #ffffff26; }
  #view-play #main-layout:not(.with-review) .play-history-actions button { box-shadow: none; background: #ffffff08; border: 1px solid #ffffff26; min-height: 40px; }
}

/* Compact opponent cards with a distinct, non-interactive unlock footer. */
.pcb-ladder-card { gap: .85rem; background: radial-gradient(ellipse at 50% 18%, #ffffff05, transparent 65%), linear-gradient(145deg, #1c1c1b, #121212); }
.pcb-ladder-card--next { background: radial-gradient(ellipse at 50% 18%, #e0702e12, transparent 65%), linear-gradient(145deg, #2c2119, #171513); }
.pcb-ladder-card-status .pcb-ladder-badge--locked { display: inline-flex; align-items: center; gap: .35rem; color: #b9b3ab; font-size: .75rem; }
.pcb-ladder-card .pcb-ladder-avatar { box-shadow: 0 0 0 5px #ffffff03, 0 8px 20px #0003; }
.pcb-ladder-card .pcb-ladder-desc { color: #bdb7ae; padding-top: .2rem; }
.pcb-ladder-card--locked .pcb-ladder-card-actions { margin: .25rem -1.25rem -1.25rem; padding: .85rem 1.25rem; border-top: 1px solid #ffffff0d; background: #ffffff03; border-radius: 0 0 15px 15px; }
.pcb-ladder-card--locked .pcb-ladder-unlock { padding: 0; font-size: .8rem; color: #aaa398; }
@media (max-width: 640px) {
  .pcb-ladder-card--locked .pcb-ladder-card-actions { margin: .15rem -1rem -1rem; padding: .8rem 1rem; }
}

/* Opponent descriptions: centered, softly tinted inset. */
.pcb-ladder-card .pcb-ladder-desc {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: .8rem .75rem;
  border: 1px solid rgba(214, 182, 140, .14);
  border-radius: 10px;
  background: rgba(214, 182, 140, .065);
  color: #d6c8b5;
  line-height: 1.5;
  text-wrap: pretty;
}
.pcb-ladder-card .pcb-ladder-desc:empty { display: none; }

.coach-chat-panel--review #robot-chat-form { display: none; }
#robot-chat-form { flex-shrink: 0; grid-template-columns: minmax(0, 1fr); gap: .55rem; margin-top: .7rem; }
#robot-chat-form[hidden] { display: none; }
#bot-chat-log .bot-chat-msg-text { font-size: var(--robot-chat-font-size, 16px); font-style: normal; line-height: 1.5; overflow-wrap: anywhere; }
.robot-chat-label { font-size: .8rem; color: var(--pcb-muted); }
#robot-chat-input { width: 100%; min-width: 0; box-sizing: border-box; }
.robot-chat-toolbar { position: relative; display: flex; justify-content: flex-end; align-items: center; gap: .35rem; min-width: 0; }
.robot-chat-font-controls { display: flex; align-items: center; gap: .1rem; }
.robot-chat-font-controls button, .robot-chat-picker summary {
  display: grid; place-items: center; width: 32px; height: 36px; padding: 0;
  border: 1px solid #ffffff20; border-radius: 9px; background: #ffffff08;
  box-shadow: none; color: #e6ded3; font-size: 1.15rem; cursor: pointer;
}
.robot-chat-font-controls button:disabled { opacity: .35; cursor: default; }
.robot-chat-picker { position: static; flex-shrink: 0; }
.robot-chat-picker summary { list-style: none; font-size: 1.5rem; }
.robot-chat-picker summary::-webkit-details-marker { display: none; }
.robot-chat-picker[open] summary { color: #8ee0ac; border-color: #4ca66b; }
#robot-chat-emojis {
  position: absolute; bottom: calc(100% + 8px); right: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  width: min(264px, calc(100vw - 64px)); max-height: 230px; overflow-y: auto;
  padding: .45rem; gap: .12rem; box-sizing: border-box;
  background: #24231f; border: 1px solid #ffffff25; border-radius: 13px;
  box-shadow: 0 8px 28px #0008;
}
#robot-chat-emojis button { background: transparent; border: 0; box-shadow: none; cursor: pointer; font-size: 1.4rem; padding: .35rem .15rem; border-radius: 7px; min-width: 0; }
#robot-chat-emojis button:hover { background: #ffffff15; }
#robot-chat-send { margin-left: 0; min-height: 36px; padding: .45rem .55rem; border: 1px solid #3da16a; border-radius: 9px; background: #25834c; color: #fff; box-shadow: none; font-size: .75rem; font-weight: 700; cursor: pointer; }
#robot-chat-send:hover:not(:disabled) { background: #2c9658; }
#robot-chat-send:disabled { background: #286040; color: #d5e6da; opacity: .75; cursor: wait; }
#robot-chat-status { color: var(--pcb-muted); font-size: .75rem; line-height: 1.4; }
#robot-chat-status:empty { display: none; }
#robot-chat-form :focus-visible { outline: 2px solid #8ee0ac; outline-offset: 2px; }

.robot-chat-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; flex-shrink: 0; margin-bottom: .5rem; }
.robot-chat-heading .bot-chat-panel-head { margin: 0; }
#robot-chat-font-controls[hidden], .coach-chat-panel--review .robot-chat-heading { display: none; }
#robot-chat-font-controls :focus-visible { outline: 2px solid #8ee0ac; outline-offset: 2px; }

/* Warm accent for the live game's resign action. */
#view-play #main-layout #btn-resign {
  background: rgba(224, 112, 46, .16);
  border: 1px solid rgba(240, 136, 69, .65);
  color: #ffe0c5;
  box-shadow: 0 0 12px rgba(224, 112, 46, .12), inset 0 1px 0 rgba(255, 183, 126, .08);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
#view-play #main-layout #btn-resign:hover:not(:disabled) {
  background: rgba(224, 112, 46, .27);
  border-color: #f08845;
  box-shadow: 0 0 16px rgba(224, 112, 46, .22);
}
#view-play #main-layout #btn-resign:focus-visible {
  outline: 2px solid #f08845;
  outline-offset: 3px;
}
#view-play #main-layout #btn-resign:disabled {
  opacity: .5;
  box-shadow: none;
}

.robot-chat-retry { align-self: flex-end; padding: .3rem .45rem; border: 1px solid #e0702e55; border-radius: 6px; background: #e0702e12; color: #edbd94; font-size: .75rem; cursor: pointer; box-shadow: none; }

@media (min-width: 1025px) {
  #view-play #main-layout:not(.with-review) .board-outer {
    width: min(var(--play-board-requested-size, 480px), var(--play-board-size-limit, 480px));
    box-sizing: border-box;
    max-width: 100%;
  }
}
@media (max-width: 640px) {
  #view-play:not([hidden]) #main-layout:not(.with-review) .board-outer {
    width: min(var(--play-board-side-no-eval), 100%);
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  #view-play:not([hidden]) #main-layout.with-live-eval:not(.with-review) .board-outer {
    width: min(var(--play-board-side-with-eval), 100%);
  }
}

@media (min-width: 1025px) {
  #view-play #main-layout:not(.with-review) .board-eval-row {
    max-width: 100%;
  }
  #view-play #main-layout:not(.with-review) .play-board-and-history {
    flex-wrap: nowrap;
    min-width: 0;
  }
}

#bot-chat-log .robot-chat-emoji {
  display: inline-block;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.65em;
  line-height: 1.25;
  vertical-align: middle;
  font-style: normal;
  font-weight: normal;
}
#bot-chat-log .robot-chat-emoji-only .robot-chat-emoji { font-size: 2.5em; }

/* Robot dialogue: distinguish the sender while keeping readable contrast. */
#bot-chat-log .bot-chat-msg--user {
  align-self: flex-end;
  max-width: 92%;
  background: linear-gradient(145deg, #244b36, #1b3829);
  border: 1px solid rgba(112, 186, 139, .4);
}
#bot-chat-log .bot-chat-msg--user .bot-chat-msg-text { color: #e4f2e8; }
#bot-chat-log .bot-chat-msg--assistant {
  align-self: flex-start;
  max-width: 96%;
  background: linear-gradient(145deg, #30271f, #211d18);
  border: 1px solid rgba(224, 112, 46, .25);
}

/* Preserve bubble height and a small gap above the composer when scrolling. */
#bot-chat-log .bot-chat-msg { flex-shrink: 0; box-sizing: border-box; }
#bot-chat-log { padding-bottom: .5rem; scroll-padding-bottom: .5rem; }

/* Match outgoing messages in the coach and robot conversations. */
.coach-chat-log .bot-chat-msg--user {
  background: linear-gradient(145deg, #244b36, #1b3829);
  border: 1px solid rgba(112, 186, 139, .4);
}
.coach-chat-log .bot-chat-msg--user .bot-chat-msg-text { color: #e4f2e8; }

/* Keep the composer inside the mobile chat; only the message log should grow. */
@media (max-width: 640px) {
  #view-play #main-layout.is-tab-chat:not(.with-review) .board-eval-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: max-content minmax(18rem, 1fr);
    align-content: stretch;
  }

  #view-play #main-layout.is-tab-chat:not(.with-review) .board-eval-row:has(> #eval-column:not([hidden])) {
    grid-template-columns: var(--play-eval-strip) minmax(0, 1fr);
  }

  #view-play #main-layout.is-tab-chat:not(.with-review) .play-board-and-history {
    grid-row: 1;
    max-width: 100%;
  }

  #view-play #main-layout.is-tab-chat:not(.with-review) #eval-column {
    grid-row: 1;
  }

  #view-play #main-layout.is-tab-chat:not(.with-review) #bot-chat-container {
    grid-column: 1 / -1;
    grid-row: 2;
    align-self: stretch;
    min-height: 18rem;
  }

  #robot-chat-input {
    /* Prevent iOS from zooming into a small input after reducing chat text. */
    font-size: max(16px, var(--robot-chat-input-size, 16px)) !important;
    min-height: 44px;
  }

  .robot-chat-font-controls button,
  .robot-chat-picker summary,
  #robot-chat-send {
    min-width: 44px;
    min-height: 44px;
  }

  #robot-chat-emojis button { min-height: 44px; }
}

/* Tablet chat also needs room for both its log and composer. */
@media (min-width: 641px) and (max-width: 860px) {
  #main-layout:not(.with-review) #bot-chat-container {
    height: 24rem;
    max-height: none;
  }
}

/* Mobile game: centered clocks and a chat that fits the visible viewport. */
@media (max-width: 640px) {
  html.pcb-play-view-open { height: var(--play-mobile-height, 100dvh); }
  #view-play .play-header {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }
  #view-play .play-status-wrap { grid-row: 1; }
  #view-play .play-opponent-badge { display: none; }
  #view-play .play-clocks { grid-column: 2; grid-row: 1; }
  #view-play .play-header-trailing { grid-column: 3; grid-row: 1; }
  #view-play .play-header-user { margin-left: 0; }
  #view-play .play-header-user-name { max-width: 100%; }
  #view-play .play-header-user-texts { min-width: 0; }

  html.pcb-play-view-open #view-play #main-layout.main-layout.is-tab-chat:not(.with-review) {
    overflow-x: hidden;
    overflow-y: auto;
  }
  #view-play #main-layout.is-tab-chat:not(.with-review) .board-eval-row {
    grid-template-rows: max-content minmax(10rem, 1fr);
  }
  #view-play #main-layout.is-tab-chat:not(.with-review) #bot-chat-container {
    min-height: 0;
    overflow: hidden;
  }
  #view-play #main-layout.is-tab-chat #bot-chat-log { min-height: 0; }

  #view-play #robot-chat-form {
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.35rem;
  }
  #view-play #robot-chat-form label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  #view-play .robot-chat-toolbar { display: contents; }
  #view-play #robot-chat-input { min-width: 0; }
  #view-play #robot-chat-status { grid-column: 1 / -1; }
  #view-play #robot-chat-status:empty { display: none; }
  #view-play .robot-chat-heading { margin-bottom: 0.25rem; }
}

/* Anchor the emoji panel to the composer, including the mobile contents toolbar. */
#view-play #robot-chat-form { position: relative; }
#view-play .robot-chat-toolbar { position: static; }

@media (max-width: 640px) {
  #view-play.is-robot-league:not([hidden]) #main-layout:not(.with-review) .board-outer {
    width: 100%;
    max-width: 100%;
    --board-outer-inset: 14px;
    --board-outer-inset-y: 14px;
    border: 0;
    border-radius: 0;
  }
}

.robot-chat-size-picker { display: none; }
@media (max-width: 640px) {
  #view-play.is-robot-league .robot-chat-heading { display: none; }
  #view-play #robot-chat-form { grid-template-columns: minmax(0, 1fr) auto auto auto; }
  .robot-chat-size-picker { display: block; position: static; }
  .robot-chat-size-picker summary {
    display: grid; place-items: center; list-style: none;
    width: 44px; height: 44px; padding: 0;
    border: 1px solid #ffffff20; border-radius: 9px;
    background: #ffffff08; color: #e6ded3; font-size: 16px; cursor: pointer;
  }
  .robot-chat-size-picker summary::-webkit-details-marker { display: none; }
  .robot-chat-size-picker[open] summary { color: #8ee0ac; border-color: #4ca66b; }
  #view-play .robot-chat-size-panel {
    position: absolute; bottom: calc(100% + 8px); right: 0; z-index: 21;
    width: min(264px, calc(100vw - 32px)); padding: 14px;
    box-sizing: border-box; background: #24231f;
    border: 1px solid #ffffff25; border-radius: 13px; box-shadow: 0 8px 28px #0008;
  }
  #view-play #robot-chat-form .robot-chat-size-panel label {
    position: static; width: auto; height: auto; clip-path: none;
    display: flex; justify-content: space-between; font-size: 14px;
  }
  #robot-chat-size { width: 100%; min-height: 44px; margin: 0; accent-color: #d6b68c; }
}

/* Keep mobile league coordinates in the frame, outside the playing squares. */
@media (max-width: 640px) {
  #view-play.is-robot-league #main-layout:not(.with-review) .cg-wrap coords {
    font-size: 11px;
  }
}

.review-tab-combined-label { display: none; }
@media (max-width: 1024px) {
  .main-layout.with-review #review-tab-coach { display: none; }
  .main-layout.with-review .review-tab-moves-label { display: none; }
  .main-layout.with-review .review-tab-combined-label { display: inline; }
  .main-layout.with-review #review-body:has(.review-pane--moves.is-active) {
    overflow-y: auto;
  }
  .main-layout.with-review #review-body .review-pane--moves.is-active {
    flex: 0 0 auto;
    overflow: visible;
  }
  .main-layout.with-review #review-body .review-pane--moves.is-active .review-moves-stack {
    flex: 0 0 auto;
    overflow: visible;
  }
  .main-layout.with-review #review-body:has(.review-pane--moves.is-active) > .review-pane--coach {
    display: flex !important;
    flex-direction: column;
    flex: 1 0 14rem;
    min-height: 14rem;
    overflow: visible;
  }
}

.coach-font-picker { position: relative; }
.coach-font-picker summary {
  list-style: none; cursor: pointer; display: grid; place-items: center;
  min-width: 44px; min-height: 44px; border: 1px solid #ffffff20;
  border-radius: 9px; color: var(--pcb-cream); background: #ffffff08;
}
.coach-font-picker summary::-webkit-details-marker { display: none; }
.coach-font-popover {
  position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 30;
  width: 200px; padding: 12px; border-radius: 10px;
  background: #24231f; border: 1px solid #ffffff25; color: var(--pcb-cream);
}
.coach-chat-font-controls--head .coach-font-popover { top: calc(100% + 6px); bottom: auto; }
.coach-font-range { width: 100%; min-height: 44px; accent-color: #d6b68c; }

@media (max-width: 1024px) {
  .main-layout.with-review .review-close-row { display: none; }
  .main-layout.with-review .review-mobile-tabs { align-items: center; }
  .main-layout.with-review .review-mobile-tabs #btn-close-review {
    flex: 0 0 44px; width: 44px; height: 44px; min-width: 44px;
    margin: 0 0 0 auto; padding: 0; display: grid; place-items: center;
    border: 0; background: transparent; box-shadow: none;
  }
  .main-layout.with-review .review-mobile-tabs #btn-close-review[hidden] { display: none; }
  .main-layout.with-review .review-mobile-tabs .review-close-label { display: none; }
  .main-layout.with-review .review-mobile-tabs .review-close-icon { display: block; }
}

@media (max-width: 1024px) {
  #view-play .coach-chat-font-controls--head { display: none !important; }
  #view-play .coach-chat-compose-bar .coach-chat-font-controls--compose {
    display: flex !important;
    flex: 0 0 auto;
    margin: 0;
  }
  #view-play .coach-chat-compose-bar { gap: 0.35rem; }
}

/* Use the same compact text-size picker in robot chat on desktop and tablet. */
@media (min-width: 641px) {
  #robot-chat-font-controls { display: none !important; }
  .robot-chat-size-picker { display: block; position: static; }
  .robot-chat-size-picker summary {
    display: grid; place-items: center; list-style: none;
    width: 32px; height: 36px; padding: 0;
    border: 1px solid #ffffff20; border-radius: 9px;
    background: #ffffff08; color: #e6ded3; font-size: 16px; cursor: pointer;
  }
  .robot-chat-size-picker summary::-webkit-details-marker { display: none; }
  .robot-chat-size-picker[open] summary { color: #8ee0ac; border-color: #4ca66b; }
  #view-play .robot-chat-size-panel {
    position: absolute; bottom: calc(100% + 8px); right: 0; z-index: 21;
    width: min(264px, 100%); padding: 14px;
    box-sizing: border-box; background: #24231f;
    border: 1px solid #ffffff25; border-radius: 13px; box-shadow: 0 8px 28px #0008;
  }
  #view-play #robot-chat-form .robot-chat-size-panel label {
    display: flex; justify-content: space-between; font-size: 14px;
  }
  #robot-chat-size { width: 100%; min-height: 36px; margin: 0; accent-color: #d6b68c; }
}

/* Coach text size belongs beside Send at every viewport width. */
#view-play .coach-chat-font-controls--head { display: none !important; }
#view-play .coach-chat-compose-bar .coach-chat-font-controls--compose {
  display: flex !important;
  flex: 0 0 auto;
  margin: 0;
}
#view-play .coach-chat-compose-bar { gap: 0.35rem; }

.coach-explain-actions { display: none; flex-wrap: wrap; gap: .4rem; margin-block: .4rem; }
.coach-explain-actions:has(button:not([hidden])) { display: flex; }
.coach-explain-actions button[hidden] { display: none; }
.coach-explain-actions button { font-size: .78rem; padding: .4rem .6rem; }

/* Contextual board actions: only visible while exploring a move or variation. */
.review-board-actions:not([hidden]) { display:flex; flex-wrap:wrap; align-items:center; gap:.45rem; padding:.65rem; margin:.5rem 0; border:1px solid #785336; border-radius:10px; background:#211b16; }
.review-board-actions > strong, .review-board-action-status { flex-basis:100%; }
.review-board-action-status { color:#c8b69f; font-size:.85rem; }
.review-board-actions button, .coach-reply-board-actions button { padding:.45rem .65rem; font-size:.8rem; min-height:40px; white-space:normal; }
.review-board-actions button[aria-pressed="true"] { background:#805732; color:#fff; }
.coach-reply-board-actions {display:flex;flex-wrap:wrap;gap:.4rem;margin-top:.65rem;}
@media(max-width:1024px) { .review-board-actions button {flex:1 1 auto;min-height:44px;} }
.review-board-actions {box-sizing:border-box; min-width:0; max-width:100%;}
.review-board-actions > strong {font-size:.95rem; color:#ead5b8;}
.review-board-actions button {border:1px solid #65513d; border-radius:8px; background:#28221c; box-shadow:none; color:#d6c8b8;}
.review-board-actions button[aria-pressed="true"] {border-color:#d39d65; background:#503922; color:#fff0dc;}
.review-board-actions .review-board-ask {background:#365444; border-color:#53745f; color:#fff;}
.review-board-actions button:focus-visible {outline:2px solid #edbc81;outline-offset:2px;}

/* Board-local disclosure: the collapsed chip leaves almost all squares visible. */
.review-board-tools {display:none;position:absolute;right:1.1rem;bottom:1.9rem;z-index:12;max-width:calc(100% - 2.2rem);color:#f0dfc5;}
.review-board-tools:has(#review-board-actions:not([hidden])) {display:block;}
.review-board-tools > summary {display:flex;align-items:center;justify-content:space-between;gap:.65rem;list-style:none;cursor:pointer;padding:.6rem .8rem;min-height:42px;box-sizing:border-box;border:1px solid #b58b57;border-radius:12px;background:rgba(24,20,16,.58);box-shadow:0 3px 15px #0007;font-size:.85rem;font-weight:650;}
.review-board-tools > summary::-webkit-details-marker {display:none;}
.review-board-tools[open] {width:min(360px,calc(100% - 2.2rem));}
.review-board-tools[open] .review-board-tools-chevron {transform:rotate(180deg);}
.review-board-tools > #review-board-actions:not([hidden]) {position:absolute;bottom:calc(100% + .4rem);right:0;width:100%;max-height:min(280px,45vh);overflow-y:auto;margin:0;padding:.7rem;background:rgba(24,20,16,.48);box-shadow:0 8px 26px #0008;border-color:#99754c;}
.review-board-tools .review-board-actions > strong {display:none;}
.review-board-tools summary:focus-visible {outline:2px solid #f3ca8e;outline-offset:3px;}
@media(max-width:640px) {.review-board-tools {right:.65rem;bottom:1.55rem;max-width:calc(100% - 1.3rem);} .review-board-tools[open]{width:calc(100% - 1.3rem);} .review-board-tools > summary {padding:.45rem .65rem;font-size:.78rem;} }

/* Transparent board controls keep the pieces visible without blurring them. */
.review-board-tools {text-shadow:0 1px 3px #000,0 0 7px #0009;}
.review-board-tools .review-board-action-status {color:#f3e5cf;}
.review-board-tools .review-board-actions button {background:rgba(30,25,20,.48);color:#f5e9d7;border-color:#c2a07499;}
.review-board-tools .review-board-actions button[aria-pressed="true"] {background:rgba(131,87,39,.55);border-color:#efbc78;}
.review-board-tools .review-board-actions .review-board-ask {background:rgba(40,92,64,.65);border-color:#8bc19b99;}
.review-board-tools:not([open])[data-unread="true"] > summary {border-color:#ffd38e;animation:board-advice-glow 2.8s ease-in-out infinite;}
@keyframes board-advice-glow {
  0%,100% {box-shadow:0 0 0 1px #eeb46644,0 0 8px #f4ac4844,0 3px 12px #0005;}
  50% {box-shadow:0 0 0 1px #ffdc9fbb,0 0 18px #f4ac4888,0 3px 12px #0005;}
}
@media(prefers-reduced-motion:reduce) {
  .review-board-tools:not([open])[data-unread="true"] > summary {animation:none;box-shadow:0 0 0 1px #ffdc9f88,0 0 12px #f4ac4877;}
}

@property --board-edge-angle {syntax:"<angle>";initial-value:0deg;inherits:false;}
.review-board-tools > summary {position:relative;touch-action:none;user-select:none;cursor:grab;}
.review-board-tools[data-dragging] > summary {cursor:grabbing;}
.review-board-tools:not([open])[data-unread="true"] > summary {animation:none;box-shadow:0 0 12px #f4ac4870;}
.review-board-tools:not([open])[data-unread="true"] > summary::after {
  content:"";position:absolute;inset:-2px;border-radius:inherit;padding:2px;pointer-events:none;
  background:conic-gradient(from var(--board-edge-angle),transparent 0deg,transparent 250deg,#ffc46dcc 285deg,#fff3d4 320deg,transparent 355deg);
  -webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);
  -webkit-mask-composite:xor;mask-composite:exclude;
  animation:board-edge-orbit 3.6s linear infinite;
}
@keyframes board-edge-orbit {to {--board-edge-angle:360deg;}}
.review-board-tools > #review-board-actions:not([hidden]) {max-height:min(280px,var(--board-tools-panel-height,45vh));}
.review-board-tools[data-panel-side="below"] > #review-board-actions:not([hidden]) {bottom:auto;top:calc(100% + .4rem);}
@media(prefers-reduced-motion:reduce) {.review-board-tools:not([open])[data-unread="true"] > summary::after {animation:none;}}

/* Distinct, readable actions for the position and the two engine continuations. */
.coach-reply-board-actions {display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,220px),1fr));gap:.55rem;margin-top:.85rem;}
.coach-reply-board-actions .coach-line-card {--line-accent:#a9c3dc;--line-tint:rgba(89,127,163,.14);display:flex;align-items:center;gap:.65rem;width:100%;min-width:0;padding:.7rem .8rem;border:1px solid color-mix(in srgb,var(--line-accent) 35%,transparent);border-left:3px solid var(--line-accent);border-radius:11px;background:var(--line-tint);box-shadow:none;text-align:left;text-transform:none;letter-spacing:normal;cursor:pointer;transition:background .15s,border-color .15s;}
.coach-reply-board-actions .coach-line-card--engine {--line-accent:#8dccab;--line-tint:rgba(66,136,103,.17);}
.coach-reply-board-actions .coach-line-card--played {--line-accent:#dbb078;--line-tint:rgba(166,113,53,.15);}
.coach-line-card__icon {display:grid;place-items:center;flex:0 0 30px;height:30px;border-radius:50%;background:var(--line-tint);color:var(--line-accent);font-size:.95rem;}
.coach-line-card__copy {display:flex;flex-direction:column;gap:.25rem;min-width:0;}
.coach-line-card__label {color:var(--line-accent);font-size:.78rem;font-weight:650;line-height:1.3;}
.coach-line-card__detail {color:#e4d9cb;font-size:.8rem;font-weight:450;line-height:1.45;overflow-wrap:anywhere;}
.coach-reply-board-actions .coach-line-card:hover {background:color-mix(in srgb,var(--line-accent) 23%,#181612);border-color:var(--line-accent);}
.coach-reply-board-actions .coach-line-card:focus-visible {outline:2px solid var(--line-accent);outline-offset:3px;}

/* Default anchor: right edge, vertically centered; dragging overrides top/left. */
.review-board-tools {bottom:auto;top:calc(50% - 22px);}
.review-board-tools > summary {border-color:#ffe2a1;border-width:2px;box-shadow:0 0 0 1px #ffd68a66,0 0 16px #ffbd5880;}
.review-board-tools:not([open])[data-unread="true"] > summary {border-color:#ffe8b3;box-shadow:0 0 0 1px #ffdb9688,0 0 18px #ffc261aa;}
.review-board-tools:not([open])[data-unread="true"] > summary::after {inset:-3px;padding:3px;background:conic-gradient(from var(--board-edge-angle),transparent 0deg,transparent 235deg,#ffc66fee 275deg,#fff9e6 315deg,#ffe3a6 335deg,transparent 360deg);}
@media(max-width:640px) {.review-board-tools {bottom:auto;top:calc(50% - 22px);}}

.board-outer svg.cg-shapes path.review-curved-arrow {
  stroke-linecap:round;stroke-linejoin:round;
  filter:drop-shadow(0 0 .025px #e0ceff) drop-shadow(0 0 .065px #a26aff);

}
@keyframes review-arrow-appear {from {opacity:0;} to {opacity:.9;}}
@media(prefers-reduced-motion:reduce) {.board-outer svg.cg-shapes path.review-curved-arrow {animation:none;}}

/* Leave space for keyboard focus as well as the selected move outline. */
.main-layout.with-review .review-desktop-moves {padding-inline:3px;box-sizing:border-box;}
.review-move-link:focus-visible {outline-offset:-2px;}


.pcb-cabinet--dash .pcb-stats-card--filter {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 160ms, background 160ms, box-shadow 160ms;
}
.pcb-cabinet--dash .pcb-stats-card--filter:hover {
  border-color: rgba(211, 147, 83, .65);
  background: #211b16;
}
.pcb-cabinet--dash .pcb-stats-card--filter[aria-current="true"] {
  border-color: #c88748;
  background: linear-gradient(135deg, #382719, #211b16);
  box-shadow: inset 0 0 0 1px rgba(200, 135, 72, .3);
}
.pcb-stats-card--filter:focus-visible {
  outline: 2px solid #e6b982;
  outline-offset: 3px;
}

/* Game library: source cards and readable match rows. */
.pcb-games-dashboard .pcb-stats-grid { gap: 12px; }
.pcb-games-dashboard .pcb-stats-card--filter {
  border-radius: 16px;
  padding: 18px;
  gap: 12px;
  background: linear-gradient(145deg, #1c1b19, #141413);
}
.pcb-games-dashboard .pcb-stats-card-tc {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #c4bab0;
  letter-spacing: .035em;
}
.pcb-source-indicator {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  border-radius: 50%;
  background: #514c45;
}
.pcb-games-dashboard .pcb-stats-card--filter[aria-current="true"] {
  background: linear-gradient(140deg, #38291c, #211c17);
  border-color: #d29a61;
  box-shadow: inset 0 2px 0 #e0ac76, 0 5px 20px #0003;
}
.pcb-games-dashboard [aria-current="true"] .pcb-stats-card-tc { color: #f0c28f; }
.pcb-games-dashboard [aria-current="true"] .pcb-source-indicator {
  background: #f0c28f;
  box-shadow: 0 0 10px #e4ab6866;
}
.pcb-games-dashboard .pcb-stats-card-wdl {
  justify-content: space-between;
  max-width: 230px;
  margin: 0;
}
.pcb-games-dashboard .pcb-stats-card-wdl span { align-items: flex-start; font-size: 1.7rem; gap: 6px; }
.pcb-games-dashboard .pcb-stats-bar-wrap { height: 4px; margin: 0; opacity: .8; }
.pcb-games-dashboard .pcb-stats-card-footer { margin-top: auto; color: #b0a79e; }
.pcb-games-dashboard .pcb-ladder-rank-wrap { margin: 0; }
.pcb-games-dashboard .pcb-table-wrap { border-radius: 16px; }
.pcb-games-dashboard .pcb-table--games th {
  color: #978e85;
  font-size: .7rem;
  letter-spacing: .075em;
  padding: 14px 16px;
}
.pcb-games-dashboard .pcb-table--games td { padding: 16px; }
.pcb-games-dashboard .pcb-table--games tbody tr { transition: background 160ms; }
.pcb-games-dashboard .pcb-table--games tbody tr:hover { background: rgba(211, 160, 105, .045); }
.pcb-games-dashboard .pcb-td-elo { font-weight: 600; color: #e1d7cc; white-space: normal; overflow-wrap: anywhere; }
.pcb-game-result-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 7px;
  background: #ffffff08;
  font-size: .8rem;
  white-space: nowrap;
}
.pcb-result-win .pcb-game-result-badge { background: #6fcf9712; }
.pcb-result-loss .pcb-game-result-badge { background: #eb575712; }
.pcb-games-dashboard .pcb-td-actions { text-align: right; }
.pcb-games-dashboard .pcb-table-link--ai {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border: 1px solid #c89d6638;
  border-radius: 8px;
  color: #dfba8f;
  background: #c89d660a;
  text-decoration: none;
  white-space: nowrap;
}
.pcb-games-dashboard .pcb-table-link--ai:hover { background: #c89d6620; border-color: #c89d6690; }
@media (max-width: 640px) {
  .pcb-games-dashboard .pcb-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .pcb-games-dashboard .pcb-stats-card--filter { padding: 13px; border-radius: 12px; gap: 10px; }
  .pcb-games-dashboard .pcb-stats-card-tc { font-size: .7rem; }
  .pcb-games-dashboard .pcb-stats-card-wdl { gap: 8px; }
  .pcb-games-dashboard .pcb-stats-card-wdl span { font-size: 1.35rem; }
  .pcb-games-dashboard .pcb-table--games tbody tr,
  .pcb-games-dashboard .pcb-table--games tbody tr:has(.pcb-td-scenario) {
    grid-template-areas: "date color" "elo elo" "result tc" "scenario scenario" "action action";
    gap: 10px;
    padding: 16px;
    border-radius: 14px;
    background: #191715;
  }
  .pcb-games-dashboard .pcb-table--games td { padding: 0; }
  .pcb-games-dashboard .pcb-table--games .pcb-td-elo { justify-self: start; font-size: 1rem; color: #e1d7cc; }
  .pcb-games-dashboard .pcb-table--games .pcb-td-tc { justify-self: end; align-self: center; }
  .pcb-games-dashboard .pcb-td-actions .pcb-table-link--ai { padding: 10px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .pcb-games-dashboard .pcb-stats-card--filter,
  .pcb-games-dashboard .pcb-table--games tbody tr { transition: none; }
}

/* Compact game library: keep related information within one reading column. */
.pcb-cabinet--dash.pcb-games-dashboard {
  width: 100%;
  max-width: 1040px;
  margin-inline: auto;
  padding: 24px;
}
.pcb-games-dashboard .pcb-stats-section { margin: 20px 0 28px; }
.pcb-games-dashboard .pcb-stats-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.pcb-games-dashboard .pcb-stats-card--filter { padding: 14px; gap: 10px; border-radius: 12px; }
.pcb-games-dashboard .pcb-stats-card-wdl { justify-content: flex-start; gap: 24px; }
.pcb-games-dashboard .pcb-stats-card-wdl span { font-size: 1.45rem; }
.pcb-games-dashboard .pcb-table--games th,
.pcb-games-dashboard .pcb-table--games td { padding: 12px; }
.pcb-games-dashboard .pcb-table--games .pcb-td-date { width: 150px; }
.pcb-games-dashboard .pcb-table--games .pcb-td-color { width: 52px; }
.pcb-games-dashboard .pcb-table--games .pcb-td-result { width: 110px; }
.pcb-games-dashboard .pcb-table--games .pcb-td-actions { width: 145px; }
@media (max-width: 800px) {
  .pcb-cabinet--dash.pcb-games-dashboard { padding: 16px; }
  .pcb-games-dashboard .pcb-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .pcb-cabinet--dash.pcb-games-dashboard { padding: 12px; }
  .pcb-games-dashboard .pcb-table--games td { width: auto; padding: 0; }
  .pcb-games-dashboard .pcb-table--games .pcb-td-date,
  .pcb-games-dashboard .pcb-table--games .pcb-td-color,
  .pcb-games-dashboard .pcb-table--games .pcb-td-result,
  .pcb-games-dashboard .pcb-table--games .pcb-td-actions { width: auto; }
}
