/* ===== Режим «2 × 2» (шахматы вчетвером) ===== */
.t4dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.25); vertical-align: -1px; }
.t4dot.sm { width: 8px; height: 8px; margin-right: 5px; vertical-align: 1px; }
.t4dot.big { width: 34px; height: 34px; }
.t4team { display: inline-flex; align-items: center; gap: 3px; padding: 3px 10px 3px 7px; border-radius: 20px; background: var(--card2); font-size: 12px; font-weight: 700; color: var(--text); white-space: nowrap; }
.t4team .t4dot { width: 9px; height: 9px; }
.t4team .t4dot + .t4dot { margin-left: -4px; margin-right: 4px; }
.t4logo { display: inline-grid; place-items: center; flex: none; }
.t4logo svg, .qt-t4 .qt-ic svg { border-radius: 6px; }

/* Плитка на главной: пять плиток в ряд */
.qtiles { grid-template-columns: repeat(5, 1fr); }
.qt-t4 { --qc: #d2484f; background: linear-gradient(135deg, rgba(210,72,79,.13), rgba(74,143,208,.1) 50%, rgba(79,165,101,.1)), var(--card) !important; }
@media (max-width: 1100px) { .qtiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .qtiles { grid-template-columns: 1fr 1fr; } .qtiles .qt-t4 { grid-column: 1 / -1; order: -1; } }

/* ----- Комната ----- */
.t4rgrid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, 1fr); gap: 18px; align-items: start; }
@media (max-width: 900px) { .t4rgrid { grid-template-columns: 1fr; } }
.t4cross { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-areas: ". top ." "left mid right" ". bot ."; gap: 12px; padding: 18px; }
.t4c-top { grid-area: top; } .t4c-left { grid-area: left; } .t4c-right { grid-area: right; } .t4c-bot { grid-area: bot; }
.t4c-mid { grid-area: mid; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; }
.t4c-mid svg { width: 100%; max-width: 120px; height: auto; filter: drop-shadow(0 10px 18px rgba(0,0,0,.45)); }
.t4vs { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.t4vs b { color: var(--muted); font-size: 12px; letter-spacing: 1px; }
.t4seat { position: relative; min-width: 0; display: flex; flex-direction: column; gap: 8px; height: 100%; min-height: 168px; padding: 10px; border-radius: 14px; background: var(--card2);
  border: 2px solid color-mix(in srgb, var(--sc) 55%, transparent); box-shadow: inset 0 3px 0 var(--sc); transition: transform .15s, border-color .15s, background .15s; }
.t4seat.sel { border-color: #fff; transform: scale(1.03); }
.t4seat.canswap { cursor: pointer; border-style: dashed; }
.t4seat.canswap:hover { background: var(--card3); transform: translateY(-2px); }
.t4s-h { display: flex; align-items: center; gap: 6px; font-size: 13px; white-space: nowrap; }
.t4s-h .t4swap { margin-left: auto; padding: 4px; width: 28px; height: 28px; }
.t4s-h .t4swap.on { background: #fff; color: #161512; }
.t4s-h .t4swap svg { width: 16px; height: 16px; }
.t4s-b { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; min-width: 0; }
.t4s-name { font-weight: 800; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t4s-name .tag { padding: 1px 7px; font-size: 11px; vertical-align: 2px; }
.t4s-name .tag svg { width: 12px; height: 12px; }
.t4s-st { font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.t4s-st svg { width: 14px; height: 14px; }
.t4s-st.ok { color: #a7dc72; } .t4s-st.wait { color: var(--gold); }
.t4s-empty { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; border: 2px dashed rgba(255,255,255,.18); color: var(--dim); }
.t4s-empty svg { width: 26px; height: 26px; }
.t4s-team { font-size: 11px; color: var(--dim); text-align: center; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; }
.t4kick { position: absolute; top: 40px; right: 8px; width: 26px; height: 26px; padding: 4px; }
.t4kick svg { width: 14px; height: 14px; }
@media (max-width: 560px) {
  .t4cross { gap: 7px; padding: 10px; }
  .t4seat { min-height: 140px; padding: 7px; }
  .t4s-h { font-size: 11px; } .t4s-h .muted { display: none; }
  .t4seat .ava { width: 44px !important; height: 44px !important; }
  .t4s-b button { font-size: 12px; padding: 6px 8px; }
  .t4vs .t4team { font-size: 10px; padding: 2px 7px; }
}
.t4panel { display: flex; flex-direction: column; gap: 10px; }
.t4panel label { margin-top: 2px; }
.t4tc { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.t4rules { display: flex; flex-direction: column; gap: 8px; font-size: 14px; color: var(--muted); background: var(--card2); border-radius: 12px; padding: 12px; }
.t4rules > div { display: block; padding-left: 24px; text-indent: -24px; line-height: 1.45; } .t4rules b { color: var(--text); }
.t4rules svg.ic { width: 16px; height: 16px; margin-right: 8px; vertical-align: -3px; }
.t4rules .t4dot { width: 9px; height: 9px; margin: 0 3px 0 2px; vertical-align: 0; }
.t4acts { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.t4alert { text-decoration: none; color: var(--text); }
.t4alert small .t4dot { width: 9px; height: 9px; }
.t4go { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 10px; font-weight: 700; color: #fff; background: linear-gradient(180deg, #95c95e, #81b64c); box-shadow: 0 3px 0 #5d8a32; }

/* ----- Партия ----- */
.t4game { grid-template-columns: minmax(0, auto) 330px; }
@media (max-width: 960px) { .t4game { grid-template-columns: 1fr; } .t4wrap { width: min(780px, calc(100vw - 16px)); min-width: 0; } }
.t4wrap { position: relative; width: min(780px, calc(100vh - 110px), calc(100vw - 24px)); min-width: 300px; }
.t4board { display: grid; grid-template-columns: repeat(14, 1fr); aspect-ratio: 1; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.t4board .v { aspect-ratio: 1; }
.t4board .sq.l { background: #e8e8e8; }
.t4board .sq.d { background: #b6b6b6; }
.t4board .sq.last.l, .t4board .sq.sel.l { background: #f3ea8e; }
.t4board .sq.last.d, .t4board .sq.sel.d { background: #d6c95f; }
.t4board .sq.mine { cursor: grab; }
.t4board .sq img { inset: 3%; width: 94%; height: 94%; }
.t4board .coord { font-size: clamp(6px, 1vw, 10px); }
.t4board .sq.l .coord { color: #9a9a9a; } .t4board .sq.d .coord { color: #eee; }
.t4board .coord.rk { left: 2px; top: 1px; } .t4board .coord.fl { right: 2px; bottom: 0; }
/* края доски — с тенью, как у обычной */
.t4board .sq { box-shadow: 0 0 0 .5px rgba(0,0,0,.04); }

/* Игроки в углах доски */
.t4pl { position: absolute; width: calc(300% / 14 - 8px); height: calc(300% / 14 - 8px); display: flex; flex-direction: column; justify-content: space-between; gap: 4px;
  padding: 6px; border-radius: 12px; background: var(--card); border: 2px solid color-mix(in srgb, var(--pc) 40%, transparent); box-shadow: inset 0 3px 0 var(--pc); transition: box-shadow .2s, border-color .2s, transform .2s; overflow: hidden; }
.t4pl.p-tl { left: 4px; top: 4px; } .t4pl.p-tr { right: 4px; top: 4px; } .t4pl.p-bl { left: 4px; bottom: 4px; } .t4pl.p-br { right: 4px; bottom: 4px; }
.t4pl.turn { border-color: var(--pc); box-shadow: inset 0 3px 0 var(--pc), 0 0 0 3px color-mix(in srgb, var(--pc) 35%, transparent), 0 10px 26px rgba(0,0,0,.45); transform: scale(1.03); }
.t4pl.lost { opacity: .55; filter: grayscale(.6); }
.t4pl-top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.t4pl-top .ava { flex: none; }
.t4pl-n { min-width: 0; line-height: 1.15; }
.t4pl-n .nm { display: block; font-weight: 800; font-size: clamp(11px, 1.6vw, 14px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t4pl-n small { display: block; color: var(--pc); font-weight: 700; font-size: clamp(9px, 1.2vw, 11px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t4clk { font: 800 clamp(15px, 3vw, 26px)/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums; text-align: center; padding: 6px 4px; border-radius: 8px;
  background: #2b2a27; color: #8d8a84; transition: background .2s, color .2s; }
.t4clk.run { background: var(--pc); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.t4clk.low.run { background: var(--red); animation: tick 1s infinite; }
.t4clk.off { display: grid; place-items: center; } .t4clk.off svg { width: 18px; height: 18px; }
@media (max-width: 520px) {
  .t4pl { padding: 3px; border-radius: 8px; width: calc(300% / 14 - 4px); height: calc(300% / 14 - 4px); }
  .t4pl.p-tl { left: 2px; top: 2px; } .t4pl.p-tr { right: 2px; top: 2px; } .t4pl.p-bl { left: 2px; bottom: 2px; } .t4pl.p-br { right: 2px; bottom: 2px; }
  .t4pl-top .ava { width: 20px !important; height: 20px !important; }
  .t4pl-top { gap: 3px; }
  .t4clk { padding: 3px 2px; border-radius: 6px; }
}
.t4pr { border-radius: 0; background: rgba(0,0,0,.45); }
.t4pr-in { display: flex; gap: 8px; width: 46%; justify-content: center; background: var(--card); padding: 10px; border-radius: 16px; box-shadow: 0 12px 30px rgba(0,0,0,.5); }
.t4pr-in button { width: 25%; background: #e8e8e8; }
.t4chk { margin-top: 8px; font-weight: 800; color: #ff8a80; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; align-items: center; }
.t4chk .t4dot { margin-right: -4px; }
.t4game .status .tc { display: flex; gap: 6px; justify-content: center; align-items: center; flex-wrap: wrap; }
.t4moves { grid-template-columns: 34px repeat(4, minmax(0, 1fr)); font-size: 13px; }
.t4moves .m { padding: 5px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t4moves .n { padding: 5px 6px; }

/* Итог партии */
.t4res { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 16px 0 6px; flex-wrap: wrap; }
.t4rteam { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px; border-radius: 14px; background: var(--card2); }
.t4rteam.win { box-shadow: 0 0 0 2px var(--accent); background: rgba(129,182,76,.12); }
.t4rpl { display: flex; gap: 10px; }
.t4rpl .p { display: flex; flex-direction: column; align-items: center; gap: 3px; font-weight: 700; font-size: 13px; max-width: 90px; }
.t4rpl .p > span { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t4rpl small { font-weight: 700; }

/* Карточка партии 2 × 2 */
.t4card .t4mini { display: grid; place-items: center; background: #3a3834; }
.t4card .t4mini svg { width: 72%; height: 72%; filter: drop-shadow(0 8px 14px rgba(0,0,0,.45)); }
.t4ava4 { display: flex; gap: 10px; flex: none; padding: 4px 0 4px 4px; }
.glist .gcard .t4ava4 .ava { width: 30px !important; height: 30px !important; }
/* Цветная рамка повторяет форму самой аватарки (раньше рамка была круглой, а аватарка — квадратной) */
.t4ava4 > span { display: inline-flex; border-radius: 0; box-shadow: none; }
.t4ava4 > span > .ava, .t4ava4 > span > .ava.botava { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--pc); }

/* Боты в комнате */
.t4s-b .ic-img, .t4acts .ic-img { width: 18px; height: 18px; vertical-align: -4px; }
.t4s-b button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; max-width: 100%; }
.t4lv { gap: 7px !important; font-weight: 700; }
.t4s-st .lvbar { margin-right: 4px; }
.t4levels { grid-template-columns: repeat(3, 1fr) !important; }
@media (max-width: 480px) { .t4levels { grid-template-columns: 1fr !important; } }
@media (max-width: 560px) { .t4s-b button { font-size: 11px; padding: 5px 6px; gap: 3px; } .t4s-b .ic-img { width: 14px; height: 14px; } }
@media (max-width: 560px) {
  .t4kick { top: 32px; right: 3px; width: 22px; height: 22px; padding: 3px; background: rgba(0,0,0,.45); }
  .t4kick svg { width: 12px; height: 12px; }
  .t4s-h .t4swap { width: 22px; height: 22px; padding: 3px; } .t4s-h .t4swap svg { width: 13px; height: 13px; }
  .t4vs { max-width: 100%; } .t4vs .t4team { font-size: 9px; padding: 2px 5px; gap: 2px; max-width: 100%; overflow: hidden; }
  .t4c-mid { gap: 6px; }
}

/* ----- Обложка режима и миниатюры доски ----- */
.t4ico { border-radius: 0 !important; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); flex: none; }
.qt-t4 .qt-ic { background: linear-gradient(145deg, #3d3a35, #24221f) !important; }
.t4bsvg { display: block; width: 100%; height: 100%; }
.t4cover { width: 100%; max-width: 190px; aspect-ratio: 1; padding: 7%; border-radius: 18px; flex: none;
  background: radial-gradient(circle at 30% 20%, #4a463f, #26241f 75%); box-shadow: inset 0 0 0 1px rgba(255,255,255,.07), 0 12px 28px rgba(0,0,0,.4); }
.t4cover .t4bsvg { filter: drop-shadow(0 4px 6px rgba(0,0,0,.45)); }
.t4c-mid svg.t4bsvg { max-width: none; filter: drop-shadow(0 4px 6px rgba(0,0,0,.45)); }
.t4hero { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.t4hero .t4cover { width: 132px; }
.t4hero-t { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.t4hero-t b { color: var(--muted); font-size: 11px; letter-spacing: 1px; }
@media (max-width: 480px) { .t4hero .t4cover { width: 96px; } }
/* карточка партии: настоящая позиция, цвета не приглушаем */
.t4card .t4mini { display: block; padding: 6%; background: radial-gradient(circle at 30% 20%, #4a463f, #26241f 75%) !important; }
.t4card .t4mini svg { width: 100%; height: 100%; filter: none; }
.t4card .t4mini .t4cover { padding: 0; background: none; box-shadow: none; max-width: none; }
.glist .gcard.t4card:not(.mymove) .mini { filter: none; }
.glist .gcard.t4card.loss .mini, .glist .gcard.t4card.draw .mini, .glist .gcard.t4card.aborted .mini { filter: saturate(.7) brightness(.85); }

/* ----- Пересадка в комнате ----- */
.t4s-b .t4swap { background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; padding: 3px 8px; gap: 4px; width: auto; height: auto; margin: 0; }
.t4s-b .t4swap:hover { color: var(--text); background: rgba(255,255,255,.07); }
.t4s-b .t4swap svg { width: 14px; height: 14px; }
.t4seat { overflow: hidden; }
.t4over { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(22,21,18,.78); backdrop-filter: blur(2px); border-radius: 12px; animation: fadeIn .15s; z-index: 2; }
.t4seat.sel .t4over { background: rgba(22,21,18,.55); }
.t4seat.sel { border-color: #fff; transform: none; }
.t4seat.canswap { cursor: default; border-style: solid; }
.t4seat.canswap:hover { background: var(--card2); transform: none; }
@media (max-width: 560px) { .t4s-b .t4swap span { display: none; } .t4over button { font-size: 12px; padding: 6px 8px; } }

.t4cover .t4bsvg, .t4card .t4mini .t4bsvg { width: 100%; height: auto; aspect-ratio: 1; max-width: none; }
.t4hero .t4cover { padding: 8px; }
.t4card .t4mini { padding: 4%; }
.qt-t4 .qt-ic svg { width: 34px; height: 34px; }
@media (max-width: 560px) { .t4vs .t4team { white-space: normal; text-align: center; border-radius: 10px; line-height: 1.15; overflow: visible; } }

/* ----- История: вкладки; статистика 2 × 2 ----- */
.htabs { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 18px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.htabs a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 10px; font-weight: 700; color: var(--muted); text-decoration: none; transition: background-color .15s, color .15s; }
.htabs a:hover { color: var(--text); }
.htabs a.on { background: var(--card3); color: var(--text); }
.htabs a .count { height: 22px; min-width: 22px; font-size: 12px; }
.t4stat { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 12px; padding: 9px 12px; border-radius: 12px; background: var(--card2); color: var(--text); text-decoration: none; font-size: 13px; transition: background-color .15s; }
.t4stat:hover { background: var(--card3); }
.t4stat span { font-weight: 800; margin-right: 4px; } .t4stat b { font-size: 15px; } .t4stat i { font-style: normal; color: var(--muted); margin-right: 6px; }
.t4more { display: inline-flex; align-items: center; gap: 4px; margin-top: 10px; font-weight: 700; font-size: 14px; color: var(--muted); }
.t4more:hover { color: var(--text); } .t4more .ic { width: 16px; height: 16px; }
.side-row .sr-h .t4ico { vertical-align: -4px; margin-right: 4px; }

/* Доска не должна «плыть»: размеры клеток заданы жёстко и не зависят от содержимого.
   Раньше клетки тянулись по содержимому, и при выборе фигуры с возможным взятием сетка разъезжалась. */
.t4board { grid-template-columns: repeat(14, minmax(0, 1fr)); grid-template-rows: repeat(14, minmax(0, 1fr)); width: 100%; height: auto; min-height: 0; }
.t4board .sq, .t4board .v { aspect-ratio: auto; min-width: 0; min-height: 0; width: auto; height: auto; }
.t4wrap { aspect-ratio: 1; }

/* Класс «cap» у клеток совпадал с классом подписей (.cap { margin-bottom: 10px }) — из-за этого доска и разъезжалась. */
.board .sq, .t4board .sq { margin: 0; letter-spacing: 0; }
.t4board .sq.tgt.take::after { width: 100%; height: 100%; max-width: 100%; max-height: 100%; background: radial-gradient(transparent 0 64%, rgba(0,0,0,.22) 65% 80%, transparent 81%); animation: capIn .35s ease both; }
/* серые фигуры выбывших */
.t4board .sq img[src*="/pieces4/x"] { opacity: .8; }

/* ----- Подсказка: стрелка поверх доски ----- */
.t4arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }
.t4arrows path { animation: fadeIn .25s; }

/* ----- Каждый за себя: очки и места ----- */
.qtiles { grid-template-columns: repeat(6, 1fr); }
@media (max-width: 1250px) { .qtiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .qtiles { grid-template-columns: 1fr 1fr; } .qtiles .qt-t4 { grid-column: auto; order: 0; } }
.qt-ffa { --qc: #e2b12f; }
.qt-ffa .qt-ic, .qt-t4 .qt-ic { background: linear-gradient(145deg, #3d3a35, #24221f) !important; }
.qt-ffa .qt-ic svg { width: 34px; height: 34px; }
.opts.t4wide button { padding: 10px 12px; font-size: 14px; }
.opts.t4wide button small { white-space: normal; line-height: 1.25; }
.t4pts { margin-left: auto; align-self: flex-start; min-width: 26px; padding: 2px 6px; border-radius: 8px; background: var(--pc); color: #fff; font-size: clamp(11px, 1.5vw, 14px); text-align: center; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
.t4pl.lost .t4pts { background: #55524c; }
.t4stand { display: flex; flex-direction: column; gap: 4px; margin: 10px 0 4px; text-align: left; }
.t4stand > div { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: var(--card2); font-size: 14px; font-weight: 600; }
.t4stand > div.me { box-shadow: inset 0 0 0 1px rgba(255,255,255,.18); }
.t4stand > div.out { opacity: .55; }
.t4stand i { font-style: normal; color: var(--dim); width: 12px; font-weight: 800; }
.t4stand span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t4stand em { font-style: normal; font-size: 12px; color: var(--muted); }
.t4stand b { font-size: 15px; min-width: 22px; text-align: right; }
.t4places { display: flex; flex-direction: column; gap: 6px; margin: 16px 0 6px; text-align: left; }
.t4place { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--card2); }
.t4place.win { box-shadow: 0 0 0 2px var(--accent); background: rgba(129,182,76,.12); }
.t4place.me .nm { text-decoration: underline; text-decoration-color: rgba(255,255,255,.3); text-underline-offset: 3px; }
.t4place .pl { width: 18px; font-size: 18px; color: var(--muted); text-align: center; }
.t4place.win .pl { color: var(--gold); }
.t4place .nm { flex: 1; min-width: 0; display: flex; flex-direction: column; font-weight: 700; overflow: hidden; }
.t4place .nm small { font-weight: 700; font-size: 12px; }
.t4place .pts { font-size: 20px; }
.t4moves .m.tok { color: var(--muted); font-style: italic; font-size: 12px; }
.t4ava4 > span.out { opacity: .4; filter: grayscale(1); }
.t4game .offer { flex-wrap: wrap; }
.t4game .offer .ic { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.t4game .controls { flex-wrap: wrap; }

.t4game .offer, .game .offer { animation: none; }
.game .offer .ic { width: 16px; height: 16px; vertical-align: -3px; margin-right: 4px; }
.game .controls { flex-wrap: wrap; }
.t4stat + .t4stat { margin-top: 6px; }
@media (max-width: 520px) { .t4game.ffa .t4pl-top .ava { display: none; } .t4pts { min-width: 20px; padding: 1px 4px; border-radius: 6px; } }

/* ===== Большие мониторы: доска занимает всю высоту окна =====
   Раньше доска была ограничена 780–820 пикселями, и на экране 2K занимала половину. Теперь она растёт вместе с окном:
   по высоте — до краёв, по ширине — всё, что осталось рядом с боковой панелью. */
@supports selector(:has(a)) {
  @media (min-width: 1000px) {
    main:has(> .game:not(.lesson)) { max-width: none; padding-bottom: 24px; }
    /* Шахматы вчетвером */
    .t4game { --side: clamp(300px, 22vw, 440px); grid-template-columns: minmax(0, auto) var(--side); gap: 24px; }
    .t4wrap { width: min(calc(100vh - 56px), calc(100vw - var(--sbw) - 64px - 24px - var(--side) - 18px)); container-type: inline-size; }
    /* Обычная партия: над и под доской — строки игроков */
    .game:not(.lesson):not(.t4game) { --side: clamp(310px, 22vw, 440px); grid-template-columns: minmax(0, auto) var(--side); gap: 24px; }
    .game:not(.lesson):not(.t4game) .boardwrap { width: min(calc(100vh - 170px), calc(100vw - var(--sbw) - 64px - 24px - var(--side) - 18px)); }
    .game:not(.lesson) .side { max-width: none; }
    /* Список ходов растёт вместе с окном */
    .game:not(.lesson) .moves { max-height: max(330px, calc(100vh - 620px)); }
  }
}
/* Подписи в углах доски вчетвером растут вместе с доской */
@supports (width: 1cqw) {
  @media (min-width: 1000px) {
    .t4pl { padding: clamp(6px, 1cqw, 14px); border-radius: clamp(12px, 1.6cqw, 20px); gap: clamp(4px, .6cqw, 10px); }
    .t4pl-top { gap: clamp(6px, .9cqw, 12px); }
    .t4pl-top .ava { width: clamp(30px, 4.4cqw, 58px) !important; height: clamp(30px, 4.4cqw, 58px) !important; }
    .t4pl-n .nm { font-size: clamp(13px, 1.9cqw, 24px); }
    .t4pl-n small { font-size: clamp(10px, 1.35cqw, 17px); }
    .t4clk { font-size: clamp(20px, 3.6cqw, 46px); padding: clamp(6px, .9cqw, 12px) 4px; border-radius: clamp(8px, 1cqw, 14px); }
    .t4clk.off svg { width: clamp(18px, 2.6cqw, 32px); height: clamp(18px, 2.6cqw, 32px); }
    .t4pts { font-size: clamp(13px, 1.9cqw, 24px); min-width: clamp(26px, 3.6cqw, 46px); padding: 2px clamp(6px, .8cqw, 10px); }
    .t4board .coord { font-size: clamp(8px, 1.05cqw, 14px); }
  }
}

/* Очень широкие экраны: боковая панель чуть крупнее, чтобы не терялась рядом с большой доской */
@media (min-width: 2200px) and (min-height: 1100px) { .game:not(.lesson) .side { zoom: 1.15; } }
/* Высокое узкое окно (монитор повёрнут): панель уходит под доску, а доска занимает всю ширину */
@supports selector(:has(a)) {
  @media (min-width: 1000px) and (max-aspect-ratio: 11/10) {
    .game:not(.lesson), .t4game { grid-template-columns: minmax(0, 1fr) !important; justify-items: center; }
    .t4wrap { width: min(calc(100vh - 56px), calc(100vw - var(--sbw) - 64px - 18px)); }
    .game:not(.lesson):not(.t4game) .boardwrap { width: min(calc(100vh - 170px), calc(100vw - var(--sbw) - 64px - 18px)); }
    .game:not(.lesson) .side { max-width: 760px; }
    .game:not(.lesson) .moves { max-height: 240px; }
  }
}

/* ----- Почему нельзя рокироваться: битое поле и фигура, которая его бьёт ----- */
.t4board .sq.danger::before { content: ""; position: absolute; inset: 0; z-index: 1; background: repeating-linear-gradient(45deg, rgba(229,83,75,.6) 0 12%, rgba(229,83,75,.32) 12% 24%); animation: fadeIn .2s; }
.t4board .sq.threat::before { content: ""; position: absolute; inset: 4%; z-index: 1; border-radius: 50%; box-shadow: inset 0 0 0 clamp(2px, .35cqw, 5px) #e5534b; background: rgba(229,83,75,.22); animation: fadeIn .2s; }
.t4note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: rgba(229,83,75,.12); border: 1px solid rgba(229,83,75,.4); font-size: 14px; line-height: 1.4; }
.t4note > .ic { width: 20px; height: 20px; flex: none; color: #ff8a80; margin-top: 1px; }
.t4note b { color: var(--text); }
.t4note small { display: block; margin-top: 6px; color: var(--muted); font-size: 12.5px; }

/* ----- Стрелки напарнику ----- */
.t4arrows path.ally { paint-order: stroke; filter: drop-shadow(0 .03px .06px rgba(0,0,0,.45)); }
button.t4arrbtn.on { background: var(--accent); color: #fff; box-shadow: 0 3px 0 #4f7f2a; }
.t4game .hintbox .ic { flex: none; }

/* ----- Поворот доски ----- */
.navb button.on { background: var(--accent); color: #fff; }
.t4viewnote { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.t4viewnote span { flex: 1; min-width: 0; }
.t4viewnote button { flex: none; }

/* ===== Доска на восьмерых (24 × 24) ===== */
.t4board { grid-template-columns: repeat(var(--n, 14), minmax(0, 1fr)); grid-template-rows: repeat(var(--n, 14), minmax(0, 1fr)); }
.t4dot { box-shadow: inset 0 0 0 1px rgba(0,0,0,.25), 0 0 0 1px rgba(255,255,255,.2); }
/* Таблички игроков: в каждом углу двое */
.t4game.big .t4pl.t4pl8 { width: calc(300% / 24 - 6px); height: calc(300% / 24 - 6px); padding: 3px; gap: 3px; border: 0; background: rgba(22,21,18,.5); justify-content: center; border-radius: 10px; box-shadow: none; }
.t4game.big .t4pl.t4pl8.p-tl { left: 3px; top: 3px; } .t4game.big .t4pl.t4pl8.p-tr { right: 3px; top: 3px; } .t4game.big .t4pl.t4pl8.p-bl { left: 3px; bottom: 3px; } .t4game.big .t4pl.t4pl8.p-br { right: 3px; bottom: 3px; }
.t4cr { flex: 1; min-height: 0; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 1px; padding: 0 5px; border-radius: 7px; background: var(--card2); border-left: 5px solid var(--pc); overflow: hidden; font-size: clamp(7px, 1.25vw, 11px); line-height: 1.15; }
.t4cr.turn { background: var(--card3); box-shadow: inset 0 0 0 2px var(--pc); }
.t4cr.lost { opacity: .45; }
.t4cr .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; color: var(--text); }
.t4cr.me .nm { color: #fff; }
.t4cr em { font-style: normal; color: var(--muted); font-size: .8em; font-weight: 600; }
.t4cr .ln { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-width: 0; }
.t4cr .ln i { font-style: normal; color: var(--pc); font-size: .85em; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t4cr .t4pts { margin: 0; align-self: center; min-width: 0; padding: 0 4px; border-radius: 5px; font-size: .95em; flex: none; }
.t4clk8 { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--muted); font-size: 1.25em; }
.t4clk8.run { color: #fff; } .t4clk8.low { color: #ff8a80; }
@media (max-width: 700px) { .t4cr { padding: 0 2px; border-left-width: 3px; } .t4cr:not(.noclk) .nm, .t4cr.noclk .ln, .t4cr .t4pts { display: none; } .t4clk8 { font-size: 1.15em; } }
@supports (width: 1cqw) { @media (min-width: 1000px) { .t4cr { font-size: clamp(9px, 1.3cqw, 19px); padding: 0 clamp(4px, .6cqw, 10px); border-left-width: clamp(4px, .5cqw, 8px); } .t4game.big .t4board .coord { font-size: clamp(7px, .75cqw, 11px); } } }
.t4game.big .t4board .coord { font-size: clamp(5px, 1.1vw, 9px); }
.t4game.big .t4board .coord.rk { left: 1px; top: 0; } .t4game.big .t4board .coord.fl { right: 1px; bottom: 0; }
/* Места команд в боковой панели */
.t4tmem { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 2px 10px; overflow: visible !important; white-space: normal !important; }
.t4tmem u { text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.t4tmem u.out { opacity: .45; text-decoration: line-through; }
.t4place.team .nm { gap: 4px; }
.t4place.team .nm small { font-weight: 600; color: var(--muted); white-space: normal; line-height: 1.5; }
.t4place.team .nm small .t4dot { margin: 0 4px 0 0; }
.t4game .tc .t4ico { vertical-align: -4px; margin-right: 4px; }
/* Комната на восемь мест: по двое на каждой стороне, как армии на доске */
.t4ring { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-areas: ". sy sp ." "sb mid mid so" "sr mid mid sg" ". sw sk ."; gap: 10px; padding: 14px; }
.t4ring .t4c-mid { grid-area: mid; }
.t4ring .t4cover { max-width: 250px; }
.t4room.big .t4rgrid { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); }
.t4room.big .t4seat { min-height: 150px; padding: 8px; gap: 5px; }
.t4room.big .t4seat button.small { padding: 5px 6px; font-size: 12px; }
.t4room.big .t4seat .t4s-name { font-size: 13px; }
@media (max-width: 1250px) { .t4room.big .t4rgrid { grid-template-columns: 1fr; } }
@media (max-width: 700px) { .t4ring { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-areas: "mid mid" "sy sp" "sb so" "sr sg" "sw sk"; gap: 7px; padding: 10px; } .t4ring .t4cover { max-width: 190px; } }
.opts.c3.t4wide button small { white-space: normal; line-height: 1.25; }
@media (max-width: 520px) { .opts.c3.t4wide { grid-template-columns: 1fr; } }
/* Карточки партий на восьмерых */
.t4card.big .t4ava4 { gap: 8px; flex-wrap: wrap; }
.glist .gcard.big .t4ava4 .ava { width: 22px !important; height: 22px !important; }
.t4card.big .t4ava4 > span > .ava, .t4card.big .t4ava4 > span > .ava.botava { box-shadow: 0 0 0 1px var(--card), 0 0 0 3px var(--pc); }
/* Семь плиток режимов на главной */
.qtiles { grid-template-columns: repeat(7, minmax(0, 1fr)); }
@media (max-width: 1500px) { .qtiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 700px) { .qtiles { grid-template-columns: 1fr 1fr; } }
.qt-big { --qc: #9b6bd6; }
.qt-big .qt-ic { background: linear-gradient(145deg, #3d3a35, #24221f) !important; }
.qt-big .qt-ic svg { width: 34px; height: 34px; }

/* ----- Линия превращения пешки: клетки чуть подкрашены цветом игрока ----- */
.t4board .sq.pz { box-shadow: inset 0 0 0 99px color-mix(in srgb, var(--pz, #d9a441) 17%, transparent), 0 0 0 .5px rgba(0,0,0,.04); }
.t4pznote i { display: inline-block; width: 18px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: 0; opacity: .55; box-shadow: inset 0 0 0 1px rgba(255,255,255,.25); }

/* ----- Тёмная доска (переключатель с луной под списком ходов) ----- */
.t4game .navb { grid-template-columns: repeat(6, 1fr); }
.t4game.dark .t4board .sq.l { background: #96938a; }
.t4game.dark .t4board .sq.d { background: #6f6d66; }
.t4game.dark .t4board .sq.last.l, .t4game.dark .t4board .sq.sel.l { background: #bdb25a; }
.t4game.dark .t4board .sq.last.d, .t4game.dark .t4board .sq.sel.d { background: #9c9040; }
.t4game.dark .t4board .sq.l .coord, .t4game.dark .t4board .sq.d .coord { color: rgba(255,255,255,.6); }
.t4game.dark .t4board .sq.pz { box-shadow: inset 0 0 0 99px color-mix(in srgb, var(--pz, #d9a441) 24%, transparent), 0 0 0 .5px rgba(0,0,0,.04); }
.t4game.dark .t4board .sq img { filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
/* Солнышко в центре доски: над клетками, под фигурами (у фигур z-index 2), клики проходят сквозь него */
.t4sun { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; opacity: .9; }
.t4sun .t4sunrays { animation: t4sunSpin 60s linear infinite; }
@keyframes t4sunSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .t4sun .t4sunrays { animation: none; } }
/* Безумные единороги: скачут поверх доски, клики проходят сквозь них. Эмодзи 🦄 смотрит влево — когда бежит вправо, зеркалим */
.t4uni { position: absolute; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; container-type: size; }
.t4u { position: absolute; left: 0; width: 100%; height: 0; }
.t4ux { position: absolute; top: 0; left: -12%; animation: t4uX 12s linear infinite; }
@keyframes t4uX { 0% { left: -12%; transform: scaleX(-1); } 49.99% { left: 100%; transform: scaleX(-1); } 50% { left: 100%; transform: scaleX(1); } 100% { left: -12%; transform: scaleX(1); } }
.t4ub { position: relative; transform-origin: 50% 100%; animation: t4uB .8s ease-in-out infinite; }
@keyframes t4uB {
  0%, 100% { transform: translateY(0) scale(1.18, .8) rotate(0); }
  20% { transform: translateY(calc(var(--bh) * -.7)) scale(.88, 1.14) rotate(-14deg); }
  50% { transform: translateY(calc(var(--bh) * -1)) scale(1) rotate(16deg); }
  80% { transform: translateY(calc(var(--bh) * -.5)) scale(.95, 1.06) rotate(-6deg); }
}
.t4uh { display: block; font-size: calc(var(--sz) * 1cqw); line-height: 1; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  animation-name: t4uHue, t4uWob; animation-timing-function: linear, ease-in-out; animation-iteration-count: infinite; }
@keyframes t4uHue {
  from { filter: hue-rotate(var(--h0, 0deg)) saturate(2.4) drop-shadow(0 0 .12em #ff3fd2) drop-shadow(0 0 .3em #7cf); }
  to { filter: hue-rotate(calc(var(--h0, 0deg) + 360deg)) saturate(2.4) drop-shadow(0 0 .12em #ff3fd2) drop-shadow(0 0 .3em #7cf); }
}
@keyframes t4uWob { 0%, 100% { transform: rotate(0) scale(1); } 25% { transform: rotate(-18deg) scale(1.12); } 50% { transform: rotate(8deg) scale(.92) skewX(10deg); } 75% { transform: rotate(22deg) scale(1.08) skewX(-8deg); } }
.t4ut { position: absolute; right: -.5em; bottom: 10%; font-size: calc(var(--sz) * .42cqw); line-height: 1; font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; animation: t4uT 1.4s ease-out infinite; }
@keyframes t4uT { 0% { opacity: 0; transform: translate(0, 0) scale(.4) rotate(0); } 25% { opacity: 1; } 100% { opacity: 0; transform: translate(1.6em, .8em) scale(1.3) rotate(200deg); } }
/* ===== Психодел: радужная заливка, радуга, звёзды (под фигурами) ===== */
.t4tint { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; mix-blend-mode: color; opacity: .42; }
.t4tint i { position: absolute; inset: -50%; background: conic-gradient(from 0deg, #ff004c, #ff9a00, #f6ff00, #00ff6a, #00d5ff, #4b5bff, #d000ff, #ff004c); animation: t4spin 24s linear infinite; }
@keyframes t4spin { to { transform: rotate(360deg); } }
.t4tripbg { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; container-type: size; }
.t4rainbow { position: absolute; inset: 0; width: 100%; height: 100%; transform-origin: 50% 62%; animation: t4rbw 7s ease-in-out infinite; }
@keyframes t4rbw { 0%, 100% { transform: scale(.94); opacity: .55; } 50% { transform: scale(1.04); opacity: .9; } }
.t4tw { position: absolute; font-style: normal; line-height: 1; font-size: calc(var(--sz) * 1cqw); text-shadow: 0 0 .4em currentColor; animation: t4tw 2s ease-in-out infinite; }
@keyframes t4tw { 0%, 100% { opacity: 0; transform: scale(.2) rotate(0); } 50% { opacity: 1; transform: scale(1.3) rotate(90deg); } }
/* ===== Психодел: парящая всячина, котики с радугой, пузыри (над фигурами, клики проходят насквозь) ===== */
.t4trip { position: absolute; inset: 0; z-index: 5; pointer-events: none; overflow: hidden; container-type: size; }
.t4trip, .t4tripbg { font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif; }
.t4d { position: absolute; animation: t4dX 8s ease-in-out infinite alternate; }
.t4dy { animation: t4dY 6s ease-in-out infinite alternate; }
@keyframes t4dX { from { transform: translateX(calc(var(--ax) * -1)); } to { transform: translateX(var(--ax)); } }
@keyframes t4dY { from { transform: translateY(calc(var(--ay) * -1)); } to { transform: translateY(var(--ay)); } }
.t4ds { display: block; line-height: 1; font-size: calc(var(--sz) * 1cqw); animation-name: t4dS, t4dH; animation-timing-function: linear, linear; animation-iteration-count: infinite, infinite; }
@keyframes t4dS { 0% { transform: rotate(0) scale(1); } 25% { transform: rotate(calc(var(--spin) * 90deg)) scale(1.35, .8); } 50% { transform: rotate(calc(var(--spin) * 180deg)) scale(.8, 1.3); } 75% { transform: rotate(calc(var(--spin) * 270deg)) scale(1.25); } 100% { transform: rotate(calc(var(--spin) * 360deg)) scale(1); } }
@keyframes t4dH { from { filter: hue-rotate(var(--h0, 0deg)) saturate(2); } to { filter: hue-rotate(calc(var(--h0, 0deg) + 360deg)) saturate(2); } }
.t4ny { position: absolute; left: 0; top: 0; display: flex; align-items: center; animation: t4ny 14s linear infinite; }
@keyframes t4ny { 0% { transform: translate(-40cqw, var(--y0)); } 45%, 100% { transform: translate(110cqw, var(--y1)); } }
.t4ny span { font-size: 5.5cqw; line-height: 1; margin-left: -1cqw; animation: t4nyb .4s steps(2) infinite; }
.t4nytr { width: 22cqw; height: 2.6cqw; border-radius: 1cqw 0 0 1cqw; opacity: .85; animation: t4nyb .4s steps(2) infinite reverse;
  background: linear-gradient(#ff2b2b 0 16.6%, #ff9a1f 0 33.3%, #ffe81f 0 50%, #3ee04b 0 66.6%, #2f8bff 0 83.3%, #8d3bff 0);
  -webkit-mask: linear-gradient(90deg, transparent, #000 40%); mask: linear-gradient(90deg, transparent, #000 40%); }
@keyframes t4nyb { from { transform: translateY(-.35cqw); } to { transform: translateY(.35cqw); } }
.t4bb { position: absolute; top: 105%; font-style: normal; line-height: 1; font-size: calc(var(--sz) * 1cqw); animation-name: t4bbUp, t4bbSw; animation-timing-function: linear, ease-in-out; animation-iteration-count: infinite, infinite; animation-direction: normal, alternate; }
@keyframes t4bbUp { 0% { top: 105%; opacity: 0; } 10%, 85% { opacity: .9; } 100% { top: -12%; opacity: 0; } }
@keyframes t4bbSw { from { transform: translateX(calc(var(--sw) * -1)); } to { transform: translateX(var(--sw)); } }
