/* Шахматы - приложение huEVO во фрейме. Вид - как у самого сайта (static/css/huevo-modern.css, huevo-square.css и
   темная схема huevo-dark.css): системный шрифт 13px, серый фон и белые карточки с тонкой рамкой, прямые углы,
   серые и темные кнопки, вкладки с красной чертой снизу, красный акцент. Схема - как у игрока на сайте: параметр
   запуска hu_scheme=light|dark, без него - prefers-color-scheme (класс ch-dark на <html> ставит скрипт в <head>).
   Доска остается деревянной. Фигуры - набор Colin M.L. Burnett (Wikimedia Commons, выбрана лицензия BSD, README.md). */
:root {
    --bg: #EDEEF0; --card: #FFFFFF; --line: #E7E8EC; --line-strong: #DCE1E6; --text: #1F2023; --muted: #818C99; --link: #2E3136;
    --head-2: #3A3A3A; --head-2h: #4D4D4D; --accent: #B01E1E; --accent-text: #B01E1E; --hover: #F0F2F5; --title: #FAFBFC;
    --btn: #E5E7EB; --btn-h: #DADDE2; --btn-text: #2E3136; --input: #FFFFFF; --input-line: #D3D9DE; --input-focus: #9EA4AB;
    --danger-bg: #FBE9E9; --danger-bg-h: #F6D5D5; --danger: #B3261E; --ok: #2E7D32; --sel-row: #F2F3F5; --note: #F7F8FA;
    --shadow: 0 0 0 1px var(--line-strong), 0 1px 2px rgba(0, 0, 0, .03); --overlay: rgba(0, 0, 0, .55);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --light: #F0D9B5; --dark: #B58863; --hl: rgba(155, 199, 0, .45); --sel: rgba(20, 85, 30, .5);
    color-scheme: light;
}
html.ch-dark {
    --bg: #141517; --card: #1E1F22; --line: #34373C; --line-strong: #464950; --text: #E4E6EA; --muted: #969CA5; --link: #DCDFE4;
    --head-2: #3A3C41; --head-2h: #4D4F55; --accent: #B01E1E; --accent-text: #E5605C; --hover: #26282C; --title: #26282C;
    --btn: #2E3035; --btn-h: #383B41; --btn-text: #E4E6EA; --input: #1E1F22; --input-line: #34373C; --input-focus: #464950;
    --danger-bg: #3A2224; --danger-bg-h: #4A2A2D; --danger: #F08A84; --ok: #7CC47F; --sel-row: #2E3035; --note: #26282C;
    color-scheme: dark;
}
html, body { margin: 0; min-height: 100%; background: var(--bg); }
body { overflow-x: hidden; }
.ch { font: 13px/1.45 var(--font); color: var(--text); -webkit-font-smoothing: antialiased; min-height: 100vh; display: flex; flex-direction: column; }
.ch *, .ch *::before, .ch *::after { box-sizing: border-box; }
.ch [hidden] { display: none !important; }
.ch button, .ch input, .ch select, .ch textarea { font: inherit; color: inherit; border-radius: 0; }
.ch a { color: var(--link); text-decoration: none; cursor: pointer; }
.ch a:hover { color: var(--accent-text); text-decoration: underline; }

/* ---------- вкладки: карточка с чертой снизу, как .ac-tabs / .mg-tabs сайта ---------- */
.ch-top { flex: 0 0 auto; display: flex; align-items: stretch; background: var(--card); box-shadow: var(--shadow); margin: 10px auto 0;
          max-width: 1080px; width: calc(100% - 20px); }
.ch-tabs { flex: 1 1 auto; display: flex; gap: 20px; padding: 0 20px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.ch-tabs::-webkit-scrollbar { display: none; }
.ch-tab { flex: 0 0 auto; padding: 12px 0 10px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted);
          font-weight: 500; white-space: nowrap; cursor: pointer; }
.ch-tab:hover { color: var(--text); }
.ch-tab.is-on { color: var(--text); border-bottom-color: var(--accent); }
.ch-tab .ch-dot { display: inline-block; width: 7px; height: 7px; margin-left: 5px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
.ch-test { background: #F0B429; color: #3A2A00; text-align: center; font-size: 11.5px; padding: 2px 4px; margin: 6px auto 0; max-width: 1080px; width: calc(100% - 20px); }
.ch-notice { margin: 10px auto 0; padding: 10px 14px; background: var(--card); box-shadow: var(--shadow); border-left: 3px solid var(--accent);
             display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 1080px; width: calc(100% - 20px); }

.ch-main { flex: 1 1 auto; padding: 10px; max-width: 1100px; width: 100%; margin: 0 auto; }
.ch-cols { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 12px; align-items: start; }

/* ---------- карточки (.vk-card сайта) ---------- */
.ch-panel { background: var(--card); box-shadow: var(--shadow); margin-bottom: 12px; }
.ch-ph { display: flex; align-items: center; gap: 6px; padding: 14px 20px; font-size: 16px; font-weight: 500; white-space: nowrap; min-width: 0; background: var(--title);
         border-bottom: 1px solid var(--line); }
.ch-ph small { font-weight: 400; font-size: 12px; color: var(--muted); }
.ch-ph .ch-right { margin-left: auto; font-weight: 400; }
.ch-pb { padding: 14px 20px; }
.ch-small { font-size: 12px; color: var(--muted); }
.ch-err { color: var(--danger); margin-top: 6px; }
.ch-err:empty { display: none; }
.ch-ok { color: var(--ok); }
.ch-empty { color: var(--muted); padding: 10px 0; }

/* кнопки (.vk-btn и .vk-btn-primary сайта) */
.ch-b { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 14px; border: 0;
        background: var(--head-2); color: #FFFFFF !important; font-weight: 600; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.ch-b:hover { background: var(--head-2h); }
.ch-b:disabled { opacity: .5; cursor: default; }
.ch-b-grey { background: var(--btn); color: var(--btn-text) !important; }
.ch-b-grey:hover { background: var(--btn-h); }
.ch-b-red { background: var(--danger-bg); color: var(--danger) !important; }
.ch-b-red:hover { background: var(--danger-bg-h); }
.ch-b-sm { height: 28px; padding: 0 11px; font-size: 12px; }
.ch-input { height: 32px; padding: 6px 9px; border: 1px solid var(--input-line); background: var(--input); color: var(--text); min-width: 0; outline: none; }
.ch-input:focus { border-color: var(--input-focus); box-shadow: 0 0 0 2px rgba(58, 58, 58, .08); }
.ch-input::placeholder { color: var(--muted); }
select.ch-input { padding: 4px 6px; }
.ch input[type=checkbox], .ch input[type=radio] { accent-color: var(--accent); }
.ch-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ch-row + .ch-row { margin-top: 8px; }

/* ---------- быстрая игра ---------- */
.ch-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ch-tile { position: relative; border: 1px solid var(--line-strong); background: var(--card); color: var(--text); padding: 12px 4px; text-align: center; cursor: pointer; }
.ch-tile:hover { background: var(--hover); }
.ch-tile b { display: block; font-size: 18px; font-weight: 600; }
.ch-tile span { color: var(--muted); font-size: 12px; }
.ch-tile i { position: absolute; right: 5px; top: 3px; font-style: normal; font-size: 11px; color: var(--accent-text); }
.ch-tile.is-on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ch-tile.is-on span::after { content: " · ищем..."; color: var(--accent-text); }

/* ---------- таблицы ---------- */
.ch-table { width: 100%; border-collapse: collapse; }
.ch-table th { text-align: left; font-weight: 400; color: var(--muted); border-bottom: 1px solid var(--line); padding: 6px; font-size: 12px; }
.ch-table td { border-bottom: 1px solid var(--line); padding: 7px 6px; vertical-align: middle; }
.ch-table tr:last-child td { border-bottom: 0; }
.ch-table tr.is-click { cursor: pointer; }
.ch-table tr.is-click:hover td { background: var(--hover); }
.ch-table .ch-num { text-align: right; white-space: nowrap; }
.ch-table a { font-weight: 600; }
.ch-res-win { color: var(--ok); }
.ch-res-loss { color: var(--danger); }
.ch-res-draw { color: var(--muted); }
.ch-plus { color: var(--ok); }
.ch-minus { color: var(--danger); }
.ch-online { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #A31F1F; margin-left: 5px; vertical-align: middle; }

/* ---------- чат ---------- */
.ch-chat-list { list-style: none; margin: 0; padding: 8px 20px; height: 230px; overflow-y: auto; }
.ch-chat-list li { padding: 3px 0; word-wrap: break-word; overflow-wrap: anywhere; }
.ch-chat-list .ch-t { color: var(--muted); font-size: 11px; margin-right: 4px; }
.ch-chat-list .ch-n { font-weight: 600; margin-right: 3px; }
.ch-chat-list .ch-x { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 3px; font-size: 12px; }
.ch-chat-list .ch-x:hover { color: var(--accent-text); }
.ch-chat-form { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
.ch-chat-form .ch-input { flex: 1 1 auto; }
.ch-chat-off { padding: 12px 20px; color: var(--muted); border-top: 1px solid var(--line); }

/* ---------- партия ---------- */
.ch-gwrap { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 12px; align-items: start; }
.ch-pbar { display: flex; align-items: center; gap: 8px; padding: 6px 0; min-height: 40px; }
.ch-pbar img.ch-av { width: 30px; height: 30px; object-fit: cover; border-radius: 50%; background: var(--btn); }
.ch-pbar .ch-pname { font-weight: 600; color: var(--link); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-pbar .ch-pname:hover { color: var(--accent-text); }
.ch-pbar .ch-prate { color: var(--muted); white-space: nowrap; }
.ch-pbar .ch-away { color: var(--danger); font-size: 12px; white-space: nowrap; }
.ch-clock { margin-left: auto; min-width: 82px; padding: 4px 10px; background: var(--card); box-shadow: var(--shadow); color: var(--muted);
            font: 600 20px/1.2 var(--font); font-variant-numeric: tabular-nums; text-align: right; }
.ch-clock.is-run { background: var(--head-2); color: #FFFFFF; box-shadow: none; }
.ch-clock.is-low { background: var(--accent); color: #FFFFFF; box-shadow: none; }

.ch-boardbox { position: relative; padding: 9px; background: linear-gradient(135deg, #7A4F2A, #9B6B3D 40%, #6E4423); }
.ch-board { position: relative; display: grid; grid-template-columns: repeat(8, 1fr); width: 100%; aspect-ratio: 1 / 1; user-select: none;
            -webkit-user-select: none; touch-action: none; -webkit-tap-highlight-color: transparent; }
.ch-sq { position: relative; background: var(--light); }
.ch-sq.d { background: var(--dark); }
.ch-sq.is-last::before { content: ""; position: absolute; inset: 0; background: var(--hl); }
.ch-sq.is-sel::before { content: ""; position: absolute; inset: 0; background: var(--sel); }
.ch-sq.is-check { background: radial-gradient(circle, #FF2A00 0%, rgba(231, 0, 0, .6) 35%, rgba(169, 0, 0, 0) 75%), var(--light); }
.ch-sq.d.is-check { background: radial-gradient(circle, #FF2A00 0%, rgba(231, 0, 0, .6) 35%, rgba(169, 0, 0, 0) 75%), var(--dark); }
.ch-sq img { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.ch-sq.is-dot::after { content: ""; position: absolute; left: 36%; top: 36%; width: 28%; height: 28%; border-radius: 50%; background: rgba(20, 85, 30, .5); z-index: 2; }
.ch-sq.is-cap::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 4px rgba(20, 85, 30, .5); z-index: 2; }
.ch-sq.is-hide img { opacity: .3; }
.ch-coord { position: absolute; font-size: 10px; font-weight: bold; pointer-events: none; z-index: 3; line-height: 1; }
.ch-coord.f { right: 2px; bottom: 1px; }
.ch-coord.r { left: 2px; top: 2px; }
.ch-sq .ch-coord { color: var(--dark); }
.ch-sq.d .ch-coord { color: var(--light); }
.ch-ghost { position: fixed; z-index: 50; pointer-events: none; width: 60px; height: 60px; transform: translate(-50%, -50%); }
.ch-promo { position: absolute; z-index: 10; inset: 0; background: rgba(0, 0, 0, .35); display: flex; align-items: center; justify-content: center; }

.ch-status { font-weight: 600; font-size: 14px; padding: 2px 0 8px; }
.ch-moves { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); }
.ch-moves table { width: 100%; border-collapse: collapse; }
.ch-moves td { padding: 4px 8px; }
.ch-moves td.n { width: 40px; color: var(--muted); background: var(--note); text-align: right; }
.ch-moves td.m { cursor: pointer; }
.ch-moves td.m:hover { background: var(--hover); }
.ch-moves td.m.is-cur { background: var(--sel-row); font-weight: 600; box-shadow: inset 2px 0 0 var(--accent); }
.ch-nav { display: flex; gap: 4px; margin: 8px 0; }
.ch-nav button { display: inline-flex; align-items: center; justify-content: center; flex: 1 1 0; height: 30px; border: 0; background: var(--btn); color: var(--btn-text); cursor: pointer; font-size: 15px; }
.ch-nav button:hover { background: var(--btn-h); }
.ch-acts { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.ch-offer { background: var(--note); border-left: 3px solid var(--accent); padding: 8px 10px; margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ch-result { background: var(--note); border-left: 3px solid var(--head-2); padding: 9px 10px; margin: 0 0 8px; font-weight: 600; font-size: 14px; }
html.ch-dark .ch-result { border-left-color: var(--muted); }
.ch-pgn { width: 100%; height: 120px; font: 11.5px/1.35 ui-monospace, Menlo, Consolas, monospace; border: 1px solid var(--input-line);
          background: var(--input); color: var(--text); padding: 6px; }

/* ---------- окна (.vk-modal сайта) ---------- */
.ch-modal { position: fixed; inset: 0; z-index: 40; background: var(--overlay); display: flex; align-items: flex-start; justify-content: center;
            padding: 30px 10px; overflow-y: auto; }
.ch-box { width: 100%; max-width: 460px; background: var(--card); box-shadow: 0 8px 30px rgba(0, 0, 0, .3); }
.ch-box-wide { max-width: 700px; }
.ch-box-head { display: flex; align-items: center; height: 52px; padding: 0 20px; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 600; }
.ch-box-head .ch-close { margin-left: auto; border: 0; background: none; color: var(--muted); font-size: 24px; line-height: 1; cursor: pointer; padding: 0; }
.ch-box-head .ch-close:hover { color: var(--text); }
.ch-box-body { padding: 14px 20px 16px; }
.ch-form p { margin: 0 0 12px; }
.ch-field { margin-bottom: 14px; }
.ch-field .ch-lab { color: var(--muted); font-size: 12px; margin-bottom: 5px; }
.ch-field .ch-small { margin-top: 4px; }
#ch-cf-cat { color: var(--text); font-weight: 600; margin-left: 4px; }
.ch-seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.ch-seg label { height: 30px; display: inline-flex; align-items: center; padding: 0 12px; cursor: pointer; background: var(--btn); color: var(--btn-text); font-weight: 600; font-size: 12.5px; }
.ch-seg label:hover { background: var(--btn-h); }
.ch-seg input { position: absolute; opacity: 0; pointer-events: none; }
.ch-seg label:has(input:checked) { background: var(--head-2); color: #FFFFFF; }
.ch-seg label:has(input:disabled) { opacity: .5; cursor: default; }
.ch-card { display: flex; gap: 14px; }
.ch-card img { width: 96px; height: 96px; object-fit: cover; flex: 0 0 auto; background: var(--btn); }
.ch-card b { font-size: 15px; }
.ch-chart { width: 100%; height: 120px; border: 1px solid var(--line); background: var(--note); }
.ch-subtabs { display: flex; flex-wrap: wrap; gap: 18px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.ch-subtab { padding: 9px 0 7px; border: 0; background: none; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; font-weight: 500; }
.ch-subtab:hover { color: var(--text); }
.ch-subtab.is-on { border-bottom-color: var(--accent); color: var(--text); }
.ch-code { font: 600 22px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: 3px; color: var(--text); }
.ch-mini { display: grid; grid-template-columns: repeat(8, 1fr); width: 64px; height: 64px; flex: 0 0 auto; }
.ch-mini i { display: block; background: var(--light); position: relative; }
.ch-mini i.d { background: var(--dark); }
.ch-mini i img { position: absolute; inset: 0; width: 100%; height: 100%; }
.ch-tv { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.ch-tv:last-child { border-bottom: 0; }
.ch-tv:hover { background: var(--hover); }
.ch-tv b { font-weight: 600; }

.ch-gate { padding: 40px 16px; text-align: center; }

/* ---------- значки, первый экран, поиск соперника ---------- */
.ch-ico { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ch-grow { flex: 1 1 160px; }
.ch-gap { margin-top: 10px; }
.ch-subhead { font-weight: 600; font-size: 14px; margin: 16px 0 6px; }
.ch-av-sm { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; vertical-align: middle; background: var(--btn); }
.ch-myrates { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line); }
.ch-rate { display: flex; flex-direction: column; align-items: center; padding: 9px 4px; min-width: 0; text-align: center; }
.ch-rate + .ch-rate { border-left: 1px solid var(--line); }
.ch-rate b { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ch-rate small { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.ch-seeking { box-shadow: 0 0 0 1px var(--accent), 0 1px 2px rgba(0, 0, 0, .03); }
.ch-seek-row { display: flex; align-items: center; gap: 12px; }
.ch-seek-text { flex: 1 1 auto; min-width: 0; }
.ch-seek-title { font-size: 15px; font-weight: 600; }
.ch-seek-title #ch-seek-time { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 500; }
.ch-spin { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent);
           animation: chSpin .9s linear infinite; }
.ch-offer .ch-spin { width: 14px; height: 14px; }
@keyframes chSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ch-spin { animation-duration: 3s; } }
.ch-tile-own b { color: var(--muted); }
.ch-seektable td:first-child, .ch-seektable th:first-child { padding-left: 20px; }
.ch-seektable td:last-child, .ch-seektable th:last-child { padding-right: 20px; }
.ch-table tr.is-mine td { background: var(--note); }
.ch-place { width: 34px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ch-inc { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: 100%; }
.ch-inc + .ch-inc { border-top: 1px solid var(--line); padding-top: 8px; }
.ch-inc > span:first-child { flex: 1 1 220px; }
.ch-inc-btns, .ch-offer-btns { display: inline-flex; gap: 6px; margin-left: auto; }
.ch-resume { margin: 0 0 12px; width: 100%; }
.ch-resume > span { flex: 1 1 auto; }
.ch-tv-text { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.ch-tv-text > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-tv-go { color: var(--muted); font-size: 12px; padding-right: 4px; }
.ch-tv:hover .ch-tv-go { color: var(--accent-text); }
.ch-chat-empty { color: var(--muted); padding: 8px 0 !important; }
.ch-find { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ch-find .ch-b { margin-left: auto; }
.ch-check { display: inline-flex; align-items: center; gap: 6px; }
.ch-num-in { width: 64px; }

/* ---------- партия: полосы игроков, итог, предложения ---------- */
.ch-pinfo { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.ch-pline { display: flex; align-items: baseline; gap: 6px; font-size: 12px; white-space: nowrap; }
.ch-pline .ch-prate { font-size: 12px; }
.ch-pdiff { font-weight: 600; }
.ch-pprev { color: var(--muted); }
.ch-you { font-weight: 400; color: var(--muted); font-size: 12px; }
.ch-watch { font-weight: 400; color: var(--muted); }
.ch-status.is-my { color: var(--accent-text); }
.ch-sq.is-mine { cursor: pointer; }
.ch-moves-empty { padding: 8px !important; }
.ch-offer-wait, .ch-offer-warn { gap: 8px; }
.ch-offer-wait { border-left-color: var(--line-strong); color: var(--muted); }
.ch-offer-warn { border-left-color: #E0A100; }
.ch-acts .ch-b, .ch-over-btns .ch-b { gap: 6px; }
.ch-over { border: 1px solid var(--line-strong); padding: 12px; margin-bottom: 10px; }
.ch-over-score { font-size: 30px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.ch-over-text { display: flex; flex-direction: column; margin: 2px 0 8px; }
.ch-over-text b { font-size: 15px; }
.ch-over-text span { color: var(--muted); }
.ch-over-rates { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.ch-over .ch-offer { margin-bottom: 10px; }
.ch-over-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-promo-box { background: var(--card); padding: 12px; box-shadow: 0 8px 30px rgba(0, 0, 0, .35); text-align: center; }
.ch-promo-title { font-weight: 600; margin-bottom: 8px; }
.ch-promo-list { display: flex; gap: 6px; }
.ch-promo-list button { display: flex; flex-direction: column; align-items: center; width: 68px; height: auto; padding: 4px 2px 6px; border: 1px solid var(--line-strong);
                        background: var(--card); color: var(--text); cursor: pointer; font-size: 11.5px; }
.ch-promo-list button:hover { background: var(--hover); border-color: var(--accent); }
.ch-promo-list img { width: 56px; height: 56px; background: var(--light); }

#ch-slot-board .ch-gctl { padding: 4px 0 2px; }
#ch-slot-board .ch-gctl:empty, #ch-slot-board .ch-status[hidden] + #ch-goffers:empty + .ch-acts[hidden] { display: none; }

/* ---------- карточка игрока ---------- */
.ch-card-info { flex: 1 1 auto; min-width: 0; }
.ch-card-name { font-size: 17px; font-weight: 600; }
.ch-card-total { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; }
.ch-rates-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin-top: 14px; }
.ch-rate-card { border: 1px solid var(--line-strong); padding: 8px 6px; display: flex; flex-direction: column; align-items: center; text-align: center; min-width: 0; }
.ch-rate-card[data-hist] { cursor: pointer; }
.ch-rate-card[data-hist]:hover { background: var(--hover); }
.ch-rate-card.is-on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.ch-rate-card b { font-size: 17px; font-weight: 600; }
.ch-rate-card small { color: var(--muted); font-size: 11.5px; }
.ch-chart-box { position: relative; margin-top: 4px; }
.ch-chart-max, .ch-chart-min { position: absolute; left: 6px; font-size: 11px; color: var(--muted); }
.ch-chart-max { top: 3px; }
.ch-chart-min { bottom: 5px; }

/* ---------- узко: телефон ---------- */
/* окно игры шире своей высоты (сайт на компьютере и планшете: фрейм 4:3 фиксированной высоты) - доска по высоте окна,
   рядом колонка с ходами; высота такого окна от клавиатуры не меняется */
@media (min-aspect-ratio: 1/1) {
    .ch-gwrap { grid-template-columns: minmax(0, min(520px, calc(100vh - 150px))) minmax(230px, 1fr); }
    .ch-moves { max-height: max(90px, calc(100vh - 420px)); }
}
@media (min-aspect-ratio: 1/1) and (max-height: 520px) {
    .ch-top { margin-top: 4px; }
    .ch-tab { padding: 8px 0 6px; }
    .ch-main { padding-top: 6px; }
    .ch-pbar { min-height: 34px; padding: 2px 0; }
    .ch-pbar img.ch-av { width: 24px; height: 24px; }
    .ch-clock { font-size: 16px; min-width: 64px; padding: 2px 8px; }
    .ch-boardbox { padding: 5px; }
    .ch-gwrap { grid-template-columns: minmax(0, calc(100vh - 128px)) minmax(220px, 1fr); }
}
@media (max-width: 860px) {
    .ch-cols { grid-template-columns: minmax(0, 1fr); }
    .ch-main { padding: 8px; }
    .ch-top, .ch-notice, .ch-test { margin-top: 8px; width: calc(100% - 16px); }
    .ch-chat-list { height: 170px; }
}
@media (max-width: 860px) and (max-aspect-ratio: 1/1) {
    .ch-gwrap { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
    .ch-tabs { gap: 14px; padding: 0 14px; }
    .ch-pb { padding: 12px 14px; }
    .ch-ph { padding: 12px 14px; font-size: 15px; }
    .ch-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
    .ch-tile { padding: 8px 2px; }
    .ch-tile b { font-size: 16px; }
    .ch-boardbox { padding: 0; margin: 0 -8px; }
    .ch-pbar { padding: 6px 0; }
    .ch-b { height: 40px; padding: 0 14px; }
    .ch-b-sm { height: 36px; }
    .ch-input { height: 40px; }
    .ch-nav button { height: 40px; }
    .ch-tab { padding: 13px 0 11px; }
    .ch-acts .ch-b { flex: 1 1 calc(50% - 6px); }
    .ch-over-btns .ch-b { flex: 1 1 calc(50% - 6px); }
    .ch-rate { padding: 7px 2px; }
    .ch-hero-btns .ch-b { flex: 1 1 0; }
    .ch-myrates, .ch-rates-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .ch-rate b, .ch-rate-card b { font-size: 15px; }
    .ch-rate small, .ch-rate-card small { font-size: 10.5px; }
    .ch-card img { width: 72px; height: 72px; }
    .ch-promo-list button { width: 62px; }
    .ch-promo-list img { width: 50px; height: 50px; }
    .ch-offer-btns, .ch-inc-btns { width: 100%; margin-left: 0; }
    .ch-offer-btns .ch-b, .ch-inc-btns .ch-b { flex: 1 1 0; }
    .ch-table .ch-hide-sm { display: none; }
    .ch-moves { max-height: 140px; }
    .ch-clock { font-size: 18px; min-width: 70px; }
    .ch-chat-list, .ch-chat-form, .ch-chat-off { padding-left: 14px; padding-right: 14px; }
    .ch-seektable td:first-child, .ch-seektable th:first-child { padding-left: 14px; }
    .ch-seektable td:last-child, .ch-seektable th:last-child { padding-right: 14px; }
    .ch-input { font-size: 16px; }   /* iOS не увеличивает страницу при вводе - как на сайте */
}
html.ch-dark .ch-clock.is-run { background: #E4E6EA; color: #141517; }
html.ch-dark .ch-clock.is-low { background: var(--accent); color: #FFFFFF; }
@media (max-width: 400px) { .ch-tabs { gap: 11px; padding: 0 10px; } }
.ch-nav button[aria-pressed="false"] { color: var(--accent-text); }
.ch-file { position: relative; overflow: hidden; }
.ch-file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
/* поле + кнопка (как строки форм сайта): поле тянется, кнопки во всех строках одной ширины, края совпадают */
.ch-irow { display: grid; grid-template-columns: minmax(0, 1fr) 136px; gap: 8px; align-items: stretch; }
.ch-irow + .ch-irow { margin-top: 8px; }
.ch-irow .ch-input, .ch-irow .ch-b { height: 34px; width: 100%; }
.ch-hero-btns { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
.ch-myrates { border-top: 0; }
.ch-empty { padding: 4px 0; }
.ch-main { padding-bottom: 24px; }
@media (max-width: 480px) {
    .ch-irow { grid-template-columns: minmax(0, 1fr) 120px; }
    .ch-irow .ch-input, .ch-irow .ch-b { height: 40px; }
    .ch-hero-btns { padding: 10px 14px; }
    .ch-hero-btns .ch-b { flex: 1 1 0; }
}
.ch-rate-card small, .ch-rate-card b { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 480px) { .ch-hide-sm { display: none !important; } .ch-rate-card { padding: 7px 2px; } }
@media (max-width: 400px) { .ch-rate small, .ch-rate-card small { font-size: 10px; } }
.ch-snd { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ch-snd:last-child { border-bottom: 0; }
.ch-snd-name { flex: 1 1 180px; min-width: 0; display: flex; flex-direction: column; }
.ch-snd-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; }
.ch-snd-ctl input[type=range] { width: 110px; accent-color: var(--accent); }
.ch-snd-vol { min-width: 34px; }
.ch input[type=range] { accent-color: var(--accent); }
