/* bughouse.css — шведские шахматы 2 на 2 в кабинете (bughouse.js).
   Клетки и фигуры — из puzzle.css (.pz-board, .pz-sq…), стикеры — из
   duels.css (.duel-react). Цвета акцента — var(--accent…): у «Дебюта» свой,
   у школ NEMZO синий (nemzo.css). */
.bh-card[hidden], .bh-card [hidden] { display: none !important; }
.bh-card { margin-bottom: var(--s4, 16px); }
.bh-title { display: flex; align-items: center; gap: var(--s2, 8px); }
.bh-icon { flex: none; color: var(--accent); }
.bh-say { margin: var(--s2, 8px) 0 0; font-weight: 600; }
.bh-say:empty { display: none; }
.bh-say[data-kind="err"] { color: var(--danger, #b3261e); }
.bh-say[data-kind="ok"] { color: var(--ok, #1f7a3a); }
.bh-h { margin: var(--s4, 16px) 0 var(--s2, 8px); font-size: 1rem; }
.bh-row-btns { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2, 8px); }
.bh-tc { display: flex; flex-wrap: wrap; gap: var(--s2, 8px); }
.bh-chip {
  min-height: 44px; min-width: 64px; padding: 0 var(--s3, 12px);
  border: 1px solid var(--line-strong, #cfc8ba); border-radius: 999px; background: var(--surface, #fff); color: var(--ink, #14151a);
  font: inherit; font-weight: 700; cursor: pointer;
}
.bh-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.bh-chip:disabled { opacity: .5; cursor: default; }
.bh-check { display: flex; align-items: flex-start; gap: var(--s2, 8px); margin: var(--s3, 12px) 0 0; min-height: 44px; cursor: pointer; }
.bh-check input { width: 22px; height: 22px; flex: 0 0 22px; margin: 1px 0 0; accent-color: var(--accent); }
.bh-check small { display: block; color: var(--muted, #6b6b73); font-size: .8125rem; }
.bh-code-form { display: flex; flex-wrap: wrap; gap: var(--s2, 8px); align-items: center; }
.bh-code-in { width: 7.5em; font-size: 1.25rem; letter-spacing: .2em; text-align: center; font-variant-numeric: tabular-nums; }
.bh-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2, 8px); }
.bh-item {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2, 8px) var(--s3, 12px);
  padding: var(--s2, 8px) var(--s3, 12px); border: 1px solid var(--line, #e6e0d4); border-radius: var(--r-md, 12px);
}
.bh-item.is-invite { border-color: var(--accent); background: var(--accent-soft); }
.bh-item-text { flex: 1 1 12rem; min-width: 0; }
.bh-item-text b { display: block; }
.bh-item-sub { font-size: .875rem; color: var(--muted, #6b6b73); }
.bh-rules { margin-top: var(--s3, 12px); }
.bh-rules summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 650; color: var(--accent-ink); }
.bh-rules ul { margin: 0; padding-left: 1.2em; }
.bh-rules li { margin: 4px 0; }

/* Комната: код, места, кнопки */
.bh-room-code { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2, 8px) var(--s3, 12px); margin-top: var(--s3, 12px); }
.bh-code-big {
  font-size: 1.75rem; font-weight: 800; letter-spacing: .18em; font-variant-numeric: tabular-nums;
  padding: 2px 12px; border-radius: var(--r-md, 12px); background: var(--accent-soft); color: var(--accent-ink);
}
.bh-seats { display: grid; gap: var(--s3, 12px); margin-top: var(--s3, 12px); }
@media (min-width: 560px) { .bh-seats { grid-template-columns: 1fr 1fr; } }
.bh-board-box { padding: var(--s2, 8px) var(--s3, 12px); border: 1px solid var(--line, #e6e0d4); border-radius: var(--r-md, 12px); }
.bh-board-box h4 { margin: 0 0 var(--s2, 8px); font-size: .9375rem; }
.bh-seat { display: flex; align-items: center; gap: var(--s2, 8px); min-height: 48px; padding: 4px 0; }
.bh-seat + .bh-seat { border-top: 1px dashed var(--line, #e6e0d4); }
.bh-seat-pc { flex: none; width: 28px; height: 28px; }
.bh-seat-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.bh-seat.is-me .bh-seat-name { color: var(--accent-ink); }
.bh-seat-empty { color: var(--muted, #6b6b73); font-weight: 400; }
.bh-ready { flex: none; font-size: .8125rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #e3f4e8; color: #1f6b35; }
.bh-wait { flex: none; font-size: .8125rem; color: var(--muted, #6b6b73); }
.bh-dot { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: #2fa44f; vertical-align: 1px; }
.bh-team { flex: none; width: 10px; align-self: stretch; border-radius: 4px; }
.bh-t0 { background: var(--accent); }
.bh-t1 { background: #f5a021; }
.bh-teams { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: var(--s2, 8px) 0 0; font-size: .875rem; color: var(--muted, #6b6b73); }
.bh-teams span { display: inline-flex; align-items: center; gap: 6px; }
.bh-teams i { display: inline-block; width: 10px; height: 14px; border-radius: 3px; }
.bh-room-acts { display: flex; flex-wrap: wrap; gap: var(--s2, 8px); margin-top: var(--s3, 12px); }
.bh-room-acts .btn[hidden] { display: none; }
.bh-ready-btn[aria-pressed="true"] { --btn-bg: #1f7a3a; --btn-bd: #1f7a3a; --btn-fg: #fff; }
.bh-note { margin: var(--s2, 8px) 0 0; font-size: .875rem; color: var(--muted, #6b6b73); }
.bh-last { margin: var(--s3, 12px) 0 0; padding: var(--s2, 8px) var(--s3, 12px); border-radius: var(--r-md, 12px); background: var(--surface-2, #f3efe7); font-weight: 600; }
.bh-last.is-win { background: #e3f4e8; color: #1f6b35; }
.bh-mates { max-height: 360px; overflow: auto; }
.bh-mate-name { flex: 1 1 8rem; min-width: 0; font-weight: 600; }

/* Окно игры */
@media (min-width: 561px) { .bh-dialog.pz-dialog { width: min(100vw - 24px, 1100px); } }
.bh-dialog .pz-body { padding: var(--s2, 8px) var(--s3, 12px) var(--s3, 12px); }
@media (max-width: 560px) { .bh-dialog .pz-body { padding: 4px 6px 12px; } .bh-dialog .pz-head { padding: 8px 8px 0 10px; } }
.bh-dialog .pz-head { padding: var(--s3, 12px) var(--s3, 12px) 0; }
.bh-first { margin: 4px 0 0; padding: 6px 10px; border-radius: var(--r-md, 12px); background: #fff4d6; font-weight: 600; font-size: .9375rem; }
.bh-game { display: grid; gap: var(--s3, 12px); align-items: start; }
@media (min-width: 820px) {
  .bh-game { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
  .bh-main .pz-board { max-width: min(100%, calc(100dvh - 260px)); margin: 0 auto; }
}
.bh-pl { display: flex; align-items: center; gap: 6px; min-height: 40px; margin: 4px 0; }
.bh-pl-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; font-size: .9375rem; }
.bh-pl-name small { font-weight: 400; color: var(--muted, #6b6b73); }
.bh-clock {
  flex: none; min-width: 4.2em; padding: 4px 8px; border-radius: 8px; background: var(--surface-2, #f3efe7);
  font-weight: 800; font-variant-numeric: tabular-nums; text-align: center;
}
.bh-clock.is-on { background: #fff4d6; box-shadow: inset 0 0 0 2px #f5a021; }
.bh-clock.is-low.is-on { background: #ffe1dc; box-shadow: inset 0 0 0 2px var(--danger, #b3261e); }
/* Запас — фигуры с числом; свой — кнопки (постановка). */
.bh-pocket { display: flex; flex-wrap: wrap; gap: 4px; min-height: 0; }
.bh-pk {
  position: relative; display: inline-flex; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 6px;
  background: var(--surface-2, #f3efe7);
}
.bh-pk img { width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; user-select: none; }
.bh-pk b { position: absolute; right: -4px; bottom: -4px; min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px;
  background: var(--ink, #14151a); color: #fff; font-size: 11px; line-height: 16px; text-align: center; }
.bh-my-pocket { margin: 2px 0 4px; min-height: 48px; align-items: center; touch-action: none; }
.bh-my-pocket .bh-pk { width: 48px; height: 48px; cursor: pointer; border: 2px solid transparent; touch-action: none; -webkit-touch-callout: none; }
.bh-my-pocket .bh-pk b { font-size: 12px; min-width: 18px; height: 18px; line-height: 18px; }
.bh-my-pocket .bh-pk[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.bh-my-pocket .bh-pk:disabled { cursor: default; opacity: .55; }
.bh-my-pocket .bh-pk:focus-visible { outline: 3px solid var(--focus, #2f6fed); outline-offset: 1px; }
.bh-pocket-empty { font-size: .8125rem; color: var(--muted, #6b6b73); }
.bh-status { margin: 4px 0 0; }

/* Доска напарника: на телефоне — мельче, рядом сигналы. */
.bh-side { display: grid; grid-template-columns: minmax(0, 46%) minmax(0, 1fr); gap: var(--s2, 8px) var(--s3, 12px); align-items: start; }
@media (min-width: 820px) { .bh-side { grid-template-columns: minmax(0, 1fr); } }
.bh-side.is-zoom { grid-template-columns: minmax(0, 1fr); }
.bh-side-h { margin: 0 0 2px; font-size: .8125rem; font-weight: 700; color: var(--muted, #6b6b73); text-transform: uppercase; letter-spacing: .04em; }
.bh-mini .pz-board { cursor: zoom-in; }
.bh-side.is-zoom .bh-mini .pz-board { cursor: zoom-out; }
.bh-mini .pz-sq { cursor: inherit; }
.bh-mini .bh-pl { min-height: 30px; margin: 2px 0; }
.bh-mini .bh-pl-name { font-size: .8125rem; }
.bh-mini .bh-clock { font-size: .8125rem; min-width: 3.6em; padding: 2px 6px; }
.bh-mini .bh-pk { width: 20px; height: 20px; }
.bh-mini .bh-pk b { min-width: 13px; height: 13px; font-size: 9px; line-height: 13px; right: -3px; bottom: -3px; }
.bh-zoom { min-height: 36px; margin-top: 4px; font-size: .8125rem; }
.bh-cues { display: grid; gap: var(--s2, 8px); grid-column: 1 / -1; }
.bh-side > .bh-heard { align-self: start; margin-top: 22px; }
@media (min-width: 820px) { .bh-side > .bh-heard { margin-top: 0; } }
.bh-side.is-zoom > .bh-heard { margin-top: 0; }
.bh-heard { min-height: 44px; margin: 0; padding: 8px 10px; border-radius: var(--r-md, 12px); background: var(--surface-2, #f3efe7); font-weight: 700; }
.bh-heard.is-new { background: var(--accent-soft); color: var(--accent-ink); box-shadow: inset 0 0 0 2px var(--accent); }
.bh-heard-from { display: block; font-size: .75rem; font-weight: 600; color: var(--muted, #6b6b73); }
.bh-signals { display: flex; flex-wrap: wrap; gap: 6px; }
.bh-sig {
  min-height: 40px; padding: 4px 10px; border: 1px solid var(--line-strong, #cfc8ba); border-radius: 999px;
  background: var(--surface, #fff); color: var(--ink, #14151a); font: inherit; font-size: .875rem; font-weight: 600; cursor: pointer;
}
.bh-sig.is-sent { background: var(--accent-soft); border-color: var(--accent); }
.bh-signals.is-wait .bh-sig:not(.is-sent) { opacity: .45; }
.bh-more { min-height: 40px; }
.bh-reacts { display: flex; flex-wrap: wrap; gap: 6px; }
.bh-reacts .duel-react { width: 48px; height: 48px; }
.bh-reacts .duel-react img { width: 40px; height: 40px; }
.bh-bubble { position: absolute; left: 50%; top: 6px; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px; background: rgba(20, 21, 26, .85); color: #fff; font-weight: 700; font-size: .875rem; white-space: nowrap; }
.bh-bubble img { width: 32px; height: 32px; }
.bh-acts { display: flex; flex-wrap: wrap; gap: var(--s2, 8px); margin-top: var(--s3, 12px); }
.bh-acts .btn[hidden] { display: none; }

/* Итог игры — поверх доски. */
.bh-result {
  position: absolute; inset: 0; z-index: 7; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 16px; text-align: center; background: rgba(255, 255, 255, .9); border-radius: 6px;
}
.bh-result h3 { margin: 0; font-size: 1.5rem; }
.bh-result p { margin: 0; font-weight: 600; }
.bh-result.is-win h3 { color: #1f6b35; }
.bh-result .bh-row-btns { justify-content: center; }
/* Подсветка постановок: те же кружки, что у ходов (pz-dot). */
.bh-dialog .pz-sq.pz-dot.is-drop::after { background: color-mix(in srgb, var(--accent) 55%, transparent); }
@media (prefers-reduced-motion: reduce) { .bh-heard, .bh-sig { transition: none; } }

/* Аватар и имя-ссылка игрока (профиль по нажатию, 03.11.2026) */
.bh-ava { flex: 0 0 auto; width: 24px; height: 24px; margin-right: 6px; border-radius: 50%; object-fit: cover; vertical-align: middle;
  background: var(--surface-2, #f3efe7); cursor: pointer; }
.bh-ava-empty { display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--muted, #6b6b73); }
.bh-kid { font-weight: inherit; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.bh-pl-name { display: inline-flex; align-items: center; min-width: 0; }
.bh-photo-dlg { padding: 12px; border: 0; border-radius: 16px; text-align: center; }
.bh-photo-dlg img { display: block; max-width: min(80vw, 420px); max-height: 70vh; border-radius: 12px; }
.bh-photo-dlg p { margin: 8px 0 0; font-weight: 600; }
/* Рекс-бот на месте (bughouse_rex.go) */
.bh-ava-rex { background: #e3f4e8; color: #1f6b35; }
.bh-rex-name { font-weight: 600; }
.bh-seat .btn-sm + .btn-sm { margin-left: 4px; }
