/* Длинные нарды: тёмная тема, объёмные кнопки, цветные значки, доска в центре главной. Палитры — «Графит» (по умолчанию),
   «Синий», «Орех», «Слива» (data-palette); тёмная тема по умолчанию, светлая — data-theme="light" или "auto".
   Тёмная тема — по умолчанию; светлая — вручную (data-theme="light") или по системе (data-theme="auto"). */

:root {
  color-scheme: dark;
  --font-display: 'Nunito', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  /* палитра «Графит» (по умолчанию): почти чёрный фон, оранжевая главная кнопка */
  --bg: #141518; --nav-bg: #0E0F11; --card: #1B1D21; --card2: #222429;
  --raised: #2A2D33; --raised-hover: #33373E; --raised-edge: #08090A; --seg-on: #444952;
  --text: #F3F4F6; --muted: rgba(243, 244, 246, .62); --tertiary: rgba(243, 244, 246, .38);
  --sep: rgba(255, 255, 255, .08); --fill: rgba(255, 255, 255, .06); --fill2: rgba(255, 255, 255, .11);
  --material: rgba(27, 29, 33, .96); --scrim: rgba(4, 5, 6, .64);
  --shadow: 0 0 0 transparent; --shadow-pop: 0 14px 44px rgba(0, 0, 0, .55);
  /* главная кнопка — объёмная; акцент — ссылки, выбор, переключатели; --acc-l — акцент для светлой темы */
  --go: #F26B2C; --go-hi: #FF8A4C; --go-edge: #A8431A; --on-go: #FFFFFF;
  --acc: #FF9A62; --acc-tint: rgba(255, 154, 98, .15); --on-acc: #2B1204; --acc-l: #C9561C; --acc-l-tint: rgba(201, 86, 28, .12);
  --blue: var(--acc); --blue-tint: var(--acc-tint); --on-blue: var(--on-acc);
  --green: #6CCB86; --green-fill: #4CB86A; --red: #F26B5E; --red-fill: #E5483B;
  --orange: #F2A23C; --orange-fill: #F29A2E; --yellow: #F4C542; --yellow-fill: #F4C542;
  --inverse: #F3F4F6; --inverse-text: #141518;
  /* доска «по теме»: светлое дерево, красные и сланцевые пункты */
  --b-frame: #4A3426; --b-surface: #E8DCC2; --b-tray: #3A281C; --b-bar: #3A281C;
  --tri-a: #B4432F; --tri-b: #3D4A57; --b-label: rgba(255, 240, 214, .6); --b-orn: rgba(255, 240, 214, .32);
  --pw-1: #FFFFFF; --pw-2: #E6E0D4; --pw-edge: #A89F8F; --pw-ring: rgba(0, 0, 0, .1);
  --pb-1: #474B55; --pb-2: #15181D; --pb-edge: #000000; --pb-ring: rgba(255, 255, 255, .12);
  --q-inacc: var(--yellow); --q-inacc-fill: var(--yellow-fill); --q-inacc-on: #3D2E00;
  --q-mistake: var(--orange); --q-mistake-fill: var(--orange-fill); --q-mistake-on: #2E1600;
  --q-blunder: var(--red); --q-blunder-fill: var(--red-fill); --q-blunder-on: #FFFFFF;
  --q-good: var(--green);
  --mv: #2C7BE5; --mv-soft: rgba(44, 123, 229, .24); --on-mv: #FFFFFF;
  --arr-played: rgba(243, 244, 246, .7);
  --arr-best: var(--green-fill);
  --r: 12px;
}
/* ---------- Палитры (data-palette): фон и панели тёмной темы, главная кнопка, акцент, доска «по теме» ---------- */
:root[data-palette="blue"] {
  --bg: #111418; --nav-bg: #0B0D10; --card: #181C21; --card2: #1F242A;
  --raised: #272D35; --raised-hover: #30373F; --raised-edge: #07080A; --seg-on: #3E4652;
  --text: #F1F4F7; --material: rgba(24, 28, 33, .96);
  --go: #2F7BF5; --go-hi: #4E95FF; --go-edge: #1B4FAA; --on-go: #FFFFFF;
  --acc: #6AAEFF; --acc-tint: rgba(106, 174, 255, .16); --on-acc: #04172E; --acc-l: #1F6FE0; --acc-l-tint: rgba(31, 111, 224, .12);
  --inverse-text: #111418;
  --b-frame: #3B2B20; --b-surface: #22384A; --b-tray: #2B1F17; --b-bar: #2B1F17;
  --tri-a: #E6DCC6; --tri-b: #C24B3A; --b-label: rgba(255, 240, 214, .55); --b-orn: rgba(255, 240, 214, .3);
  --mv: #F7C25E; --mv-soft: rgba(247, 194, 94, .3); --on-mv: #2B1A02;
}
:root[data-palette="walnut"] {
  --bg: #1A1612; --nav-bg: #13100D; --card: #221D18; --card2: #2A241E;
  --raised: #332B24; --raised-hover: #3D342B; --raised-edge: #0C0A08; --seg-on: #4B4036;
  --text: #F5EFE8; --muted: rgba(245, 239, 232, .62); --tertiary: rgba(245, 239, 232, .38); --material: rgba(34, 29, 24, .96);
  --go: #CC6E36; --go-hi: #E38B4F; --go-edge: #84431E; --on-go: #FFFFFF;
  --acc: #E9B47A; --acc-tint: rgba(233, 180, 122, .16); --on-acc: #2A1A08; --acc-l: #A45A20; --acc-l-tint: rgba(164, 90, 32, .12);
  --inverse: #F5EFE8; --inverse-text: #1A1612;
  --b-frame: #2E2017; --b-surface: #D8B98A; --b-tray: #4A3220; --b-bar: #4A3220;
  --tri-a: #6B3B22; --tri-b: #F2E4C8; --b-label: rgba(255, 240, 214, .6); --b-orn: rgba(255, 240, 214, .32);
  --mv: #1E6FD9; --mv-soft: rgba(30, 111, 217, .26); --on-mv: #FFFFFF;
}
:root[data-palette="plum"] {
  --bg: #18141E; --nav-bg: #110E16; --card: #201B28; --card2: #272130;
  --raised: #2F283B; --raised-hover: #383046; --raised-edge: #0B090E; --seg-on: #4A3F5C;
  --text: #F5F2FA; --muted: rgba(245, 242, 250, .62); --tertiary: rgba(245, 242, 250, .38); --material: rgba(32, 27, 40, .96);
  --go: #2FCB8D; --go-hi: #4FE0A8; --go-edge: #1A7F58; --on-go: #05281A;
  --acc: #B39DFF; --acc-tint: rgba(179, 157, 255, .16); --on-acc: #1A1033; --acc-l: #6C4FD8; --acc-l-tint: rgba(108, 79, 216, .12);
  --inverse: #F5F2FA; --inverse-text: #18141E;
  --b-frame: #3A2A22; --b-surface: #2D2439; --b-tray: #241A28; --b-bar: #241A28;
  --tri-a: #EDE3D0; --tri-b: #C2557A; --b-label: rgba(255, 240, 214, .55); --b-orn: rgba(255, 240, 214, .3);
  --mv: #4FE0A8; --mv-soft: rgba(79, 224, 168, .28); --on-mv: #05281A;
}
/* светлая тема: свои фон и панели, доска — светлое дерево; кнопка и акцент — из палитры */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #F2EFE9; --nav-bg: #FFFFFF; --card: #FFFFFF; --card2: #F5F2EC;
  --raised: #E9E5DD; --raised-hover: #DFDAD0; --raised-edge: #C4BDB0;
  --text: #191B20; --muted: rgba(25, 27, 32, .62); --tertiary: rgba(25, 27, 32, .38);
  --sep: rgba(25, 27, 32, .1); --fill: rgba(25, 27, 32, .05); --fill2: rgba(25, 27, 32, .09); --seg-on: #FFFFFF;
  --material: rgba(255, 255, 255, .95); --scrim: rgba(12, 14, 18, .42);
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 16px rgba(20, 22, 28, .06); --shadow-pop: 0 14px 44px rgba(20, 22, 28, .22);
  --blue: var(--acc-l); --blue-tint: var(--acc-l-tint); --on-blue: #FFFFFF;
  --green: #2E8A4A; --green-fill: #3FAE62; --red: #C9372C; --red-fill: #E5483B;
  --orange: #B85C00; --orange-fill: #EE9A2E; --yellow: #8A6D00; --yellow-fill: #F2BF45;
  --inverse: #191B20; --inverse-text: #FFFFFF;
  --b-frame: #7A5534; --b-surface: #F1E7D0; --b-tray: #684528; --b-bar: #684528;
  --tri-a: #B0463C; --tri-b: #34524C; --b-label: rgba(255, 240, 214, .72); --b-orn: rgba(255, 240, 214, .4);
  --pw-1: #FFFFFF; --pw-2: #E9E4DA; --pw-edge: #B9B0A0; --pw-ring: rgba(0, 0, 0, .08);
  --pb-1: #474B55; --pb-2: #191C22; --pb-edge: #000000; --pb-ring: rgba(255, 255, 255, .1);
  --q-inacc-on: #3D2E00; --q-mistake-on: #FFFFFF;
  --mv: #2C7BE5; --mv-soft: rgba(44, 123, 229, .22); --on-mv: #FFFFFF;
  --arr-played: rgba(25, 27, 32, .7);
}
@media (prefers-color-scheme: light) {
  :root[data-theme="auto"] {
    color-scheme: light;
    --bg: #F2EFE9; --nav-bg: #FFFFFF; --card: #FFFFFF; --card2: #F5F2EC;
    --raised: #E9E5DD; --raised-hover: #DFDAD0; --raised-edge: #C4BDB0;
    --text: #191B20; --muted: rgba(25, 27, 32, .62); --tertiary: rgba(25, 27, 32, .38);
    --sep: rgba(25, 27, 32, .1); --fill: rgba(25, 27, 32, .05); --fill2: rgba(25, 27, 32, .09); --seg-on: #FFFFFF;
    --material: rgba(255, 255, 255, .95); --scrim: rgba(12, 14, 18, .42);
    --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 16px rgba(20, 22, 28, .06); --shadow-pop: 0 14px 44px rgba(20, 22, 28, .22);
    --blue: var(--acc-l); --blue-tint: var(--acc-l-tint); --on-blue: #FFFFFF;
    --green: #2E8A4A; --green-fill: #3FAE62; --red: #C9372C; --red-fill: #E5483B;
    --orange: #B85C00; --orange-fill: #EE9A2E; --yellow: #8A6D00; --yellow-fill: #F2BF45;
    --inverse: #191B20; --inverse-text: #FFFFFF;
    --b-frame: #7A5534; --b-surface: #F1E7D0; --b-tray: #684528; --b-bar: #684528;
    --tri-a: #B0463C; --tri-b: #34524C; --b-label: rgba(255, 240, 214, .72); --b-orn: rgba(255, 240, 214, .4);
    --pw-1: #FFFFFF; --pw-2: #E9E4DA; --pw-edge: #B9B0A0; --pw-ring: rgba(0, 0, 0, .08);
    --pb-1: #474B55; --pb-2: #191C22; --pb-edge: #000000; --pb-ring: rgba(255, 255, 255, .1);
    --q-inacc-on: #3D2E00; --q-mistake-on: #FFFFFF;
    --mv: #2C7BE5; --mv-soft: rgba(44, 123, 229, .22); --on-mv: #FFFFFF;
    --arr-played: rgba(25, 27, 32, .7);
  }
}
/* место под полосу прокрутки — всегда: раскрытое меню не сдвигает страницу */
html { scrollbar-gutter: stable; }
html.i18n-wait body { visibility: hidden; }

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', Inter, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px; line-height: 1.35; -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font: inherit; color: inherit; }
a { color: var(--blue); }
.hidden { display: none !important; }
.muted { color: var(--muted); font-weight: 400; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Кнопки: объёмные, нажимаются вниз ---------- */
.btn {
  border: 0; cursor: pointer; border-radius: 10px; height: 42px; padding: 0 18px;
  font-family: var(--font-display); font-weight: 800; font-size: 15.5px; letter-spacing: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  text-decoration: none; white-space: nowrap; position: relative;
  transition: transform .08s, box-shadow .08s, filter .15s, background .15s, opacity .15s;
}
.btn:disabled, .btn.disabled { opacity: .45; cursor: default; pointer-events: none; }
.btn.primary { background: linear-gradient(180deg, var(--go-hi), var(--go)); color: var(--on-go); box-shadow: 0 4px 0 var(--go-edge); text-shadow: 0 1px 1px rgba(0, 0, 0, .14); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--go-edge); }
.btn.ghost { background: var(--raised); color: var(--text); box-shadow: 0 3px 0 var(--raised-edge); }
.btn.ghost:hover { background: var(--raised-hover); }
.btn.ghost:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--raised-edge); }
.btn.big { height: 52px; font-size: 18px; width: 100%; border-radius: 12px; }
.btn.xl { height: 64px; font-size: 25px; width: 100%; border-radius: 12px; font-weight: 900; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 14px; border-radius: 9px; }
.icon-btn {
  width: 36px; height: 36px; flex: none; border-radius: 10px; border: 0; cursor: pointer; display: grid; place-items: center;
  background: transparent; color: var(--muted); font-size: 16px;
}
.icon-btn:hover { background: var(--fill); color: var(--text); }
.icon-btn svg { display: block; }

/* ---------- Поля, сегменты, переключатели ---------- */
form { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); }
.field input { height: 44px; background: var(--fill); border: 0; border-radius: 10px; padding: 0 12px; font-size: 17px; outline: none; }
.field input:focus { box-shadow: 0 0 0 2px var(--blue); }
.seg { display: flex; background: var(--fill); border-radius: 9px; padding: 2px; gap: 0; }
.seg label { flex: 1; min-width: 0; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.seg i {
  font-style: normal; display: flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 4px;
  border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .15s, box-shadow .15s;
}
.seg input:checked + i { background: var(--seg-on); font-weight: 600; box-shadow: 0 2px 6px rgba(0, 0, 0, .12), 0 0 0 .5px rgba(0, 0, 0, .04); }
.seg input:focus-visible + i { outline: 2px solid var(--blue); }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; flex: none; }
.dot.w { background: var(--pw-1); box-shadow: inset 0 0 0 1px var(--pw-edge); }
.dot.b { background: var(--pb-2); box-shadow: inset 0 0 0 1px var(--pb-edge); }
.dot.r { background: linear-gradient(90deg, var(--pw-1) 50%, var(--pb-2) 50%); box-shadow: inset 0 0 0 1px var(--pw-edge); }
.pal { width: 14px; height: 14px; border-radius: 50%; display: inline-block; flex: none; background: linear-gradient(135deg, var(--pa) 50%, var(--pb) 50%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25), 0 0 0 1px rgba(0, 0, 0, .25); }

.check { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 15px; user-select: none; min-height: 32px; }
.check > span:last-child { flex: 1; min-width: 0; order: -1; }
.check small { display: block; font-size: 13px; color: var(--muted); }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.check .sw { width: 51px; height: 31px; border-radius: 16px; background: var(--fill2); position: relative; transition: background .2s; flex: none; }
.check .sw::after { content: ''; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .2); transition: transform .2s; }
.check input:checked + .sw { background: var(--blue); }
.check input:checked + .sw::after { transform: translateX(20px); }
.check input:focus-visible + .sw { outline: 2px solid var(--blue); outline-offset: 2px; }
.check.sm { font-size: 13px; color: var(--muted); }

/* ---------- Лобби и вход ---------- */
.screen { min-height: 100vh; min-height: 100dvh; }
#joinScreen { display: grid; place-items: start center; padding: 32px 16px 48px; }
.card { width: 100%; max-width: 460px; }
.brand { margin-bottom: 18px; }
.brand h1 { font-size: 34px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.brand .sub { margin-top: 4px; }
.logo { display: none; }
.sub { color: var(--muted); margin: 0; line-height: 1.45; font-size: 15px; }
.lc { width: 30px; height: 30px; border-radius: 50%; display: inline-block; }
.lc.w { background: radial-gradient(circle at 35% 30%, var(--pw-1), var(--pw-2) 75%); box-shadow: inset 0 0 0 1.5px var(--pw-edge); }
.lc.b { background: radial-gradient(circle at 35% 30%, var(--pb-1), var(--pb-2) 75%); box-shadow: inset 0 0 0 1.5px var(--pb-edge); margin-left: -8px; }
.spinner { display: inline-flex; margin-bottom: 8px; }
.spinner .lc { animation: bob 1.4s ease-in-out infinite; }
.spinner .lc.b { animation-delay: .7s; }
@keyframes bob { 50% { transform: translateY(-6px); } }

#createForm, #joinForm { background: var(--card); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow); }
/* карточка игрока в лобби */
.me-chip { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 12px 14px; background: var(--card); border-radius: 14px; color: var(--muted); font-size: 14px; min-width: 0; }
.me-ava { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 17px; color: #fff;
  background: linear-gradient(135deg, hsl(var(--h) 62% 58%), hsl(calc(var(--h) + 30) 58% 44%)); }
.me-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.me-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.me-name b { color: var(--text); font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-sub b { color: var(--text); font-weight: 600; }
.me-pen { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.me-pen:hover { background: var(--fill); color: var(--blue); }
.me-prof { flex: none; display: inline-flex; align-items: center; gap: 2px; padding: 7px 10px 7px 14px; border-radius: 999px; background: var(--fill); color: var(--text); font-weight: 600; font-size: 14px; text-decoration: none; }
.me-prof:hover { background: var(--fill2); }
.me-edit { display: flex; align-items: center; gap: 6px; }
.me-edit input { flex: 1 1 auto; width: 100%; min-width: 0; height: 34px; padding: 0 10px; border: 1.5px solid var(--blue); border-radius: 9px; background: var(--card); color: var(--text); font: 600 16px/1 inherit; font-family: inherit; outline: none; }
.me-edit input.bad { border-color: #FF3B30; }
.me-edit button { flex: none; width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 9px; cursor: pointer; }
.me-ok { background: var(--blue); color: var(--on-blue, #fff); }
.me-cancel { background: var(--fill); color: var(--text); }
.or { display: flex; align-items: center; gap: 12px; color: var(--tertiary); font-size: 13px; margin: 16px 0 12px; }
.or::before, .or::after { content: ''; flex: 1; height: .5px; background: var(--sep); }
.lobby-alt { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.lobby-alt .btn.big { font-size: 15px; }
.level-note { display: block; font-size: 13px; color: var(--muted); }
.rules { margin-top: 16px; background: var(--card); border-radius: var(--r); padding: 12px 16px; color: var(--muted); font-size: 14px; box-shadow: var(--shadow); }
.rules summary { cursor: pointer; color: var(--text); font-weight: 600; }
.rules ul { padding-left: 18px; line-height: 1.5; margin: 10px 0 0; }
.rules li { margin-bottom: 6px; }

/* ---------- Страницы: лидерборд, профиль ---------- */
/* колонка — не уже экрана: без minmax(0, …) самый широкий ребёнок (таблица рейтинга, ряд кнопок) распирал страницу, и
   на узком телефоне она уезжала вбок вместе с нижним меню */
.page { max-width: 760px; margin: 0 auto; padding: 20px 16px 48px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.page-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.page-head h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin: 0; text-align: center; }
.page-head > :last-child { justify-self: end; }
.page-head a.btn { background: transparent; padding: 0 4px; }
.big-seg { justify-self: center; width: 100%; max-width: 560px; }
.big-seg button { flex: 1; height: 30px; font-size: 13px; }
table.lb { width: 100%; border-collapse: collapse; font-size: 15px; }
#topScreen .panel { overflow-x: auto; }
table.lb th { text-align: left; color: var(--muted); font-weight: 400; font-size: 13px; padding: 4px 8px 8px; }
table.lb td { padding: 10px 8px; border-top: .5px solid var(--sep); }
table.lb td:first-child { color: var(--muted); width: 40px; }
table.lb tr.me td { background: var(--blue-tint); }
table.lb a { color: var(--text); text-decoration: none; font-weight: 500; }
table.lb .rt { font-weight: 600; }
/* узкий телефон (после основных правил таблицы — иначе они перекрывали эти): четыре подписи («По переписке», «Мои соперники») не помещались в строку — страница уезжала вбок */
@media (max-width: 440px) {
  .big-seg { flex-wrap: wrap; row-gap: 2px; }
  .big-seg button { flex: 1 1 auto; padding: 0 8px; font-size: 12.5px; white-space: nowrap; }
  table.lb { font-size: 14px; }
  table.lb th { font-size: 12px; }
  table.lb th, table.lb td { padding-left: 4px; padding-right: 4px; }
  table.lb td:nth-child(2) { overflow-wrap: anywhere; }
  table.lb.rd th:nth-child(5), table.lb.rd td:nth-child(5) { display: none; }
}
.gain.pos { color: var(--green); } .gain.neg { color: var(--red); }
.pl-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.pl-cards .pc { background: var(--card); border-radius: var(--r); padding: 12px 14px; box-shadow: var(--shadow); }
.pl-cards .pc b { display: block; font-size: 24px; font-weight: 600; letter-spacing: -.02em; }
.pl-cards .pc span { font-size: 13px; color: var(--muted); }
.pl-cards .pc.txt b { font-size: 18px; line-height: 29px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#plChart { width: 100%; height: 140px; }
#plChart .line { fill: none; stroke: var(--blue); stroke-width: 2.2; vector-effect: non-scaling-stroke; }
#plChart .area { fill: var(--blue-tint); }
#plChart text { fill: var(--muted); font-size: 12px; }
.mrow { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; padding: 10px 2px; border-top: .5px solid var(--sep); font-size: 15px; align-items: baseline; }
.mrow .res { font-weight: 600; } .mrow .res.w { color: var(--green); } .mrow .res.l { color: var(--red); }
.mrow a { color: var(--text); }
.mrow .gl { grid-column: 2 / -1; font-size: 13px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.mrow .gl a { color: var(--blue); text-decoration: none; }
.mrow small { color: var(--muted); }
.hint-text { color: var(--muted); font-size: 13px; margin: 12px 0 0; }

/* ---------- Игровой экран ---------- */
#game { padding: 16px; }
.layout { display: flex; gap: 16px; max-width: 1560px; margin: 0 auto; align-items: flex-start; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.side {
  width: 340px; flex: none; display: flex; flex-direction: column; gap: 12px;
  max-height: calc(100dvh - 32px); position: sticky; top: 16px; overflow-y: auto; scrollbar-width: thin;
  overscroll-behavior: contain; padding-bottom: 2px;
}
.pbar {
  width: 100%; max-width: var(--bw, 100%);
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px; min-height: 60px; border-radius: var(--r);
  background: var(--card); box-shadow: var(--shadow); transition: box-shadow .2s;
}
.pbar.active { box-shadow: inset 0 0 0 2px var(--blue), var(--shadow); }
.pinfo { display: flex; align-items: center; gap: 12px; min-width: 0; }
.chip { width: 30px; height: 30px; border-radius: 50%; flex: none; }
.chip.white { background: radial-gradient(circle at 35% 30%, var(--pw-1), var(--pw-2) 75%); box-shadow: inset 0 0 0 1.5px var(--pw-edge); }
.chip.black { background: radial-gradient(circle at 35% 30%, var(--pb-1), var(--pb-2) 75%); box-shadow: inset 0 0 0 1.5px var(--pb-edge); }
.ptext { min-width: 0; }
.pname { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pmeta { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.conn { width: 7px; height: 7px; border-radius: 50%; background: var(--green-fill); flex: none; }
.conn.off { background: var(--tertiary); }
.pstatus { flex: 1; text-align: center; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pscore { margin-left: auto; }
.score { font-weight: 600; font-size: 24px; letter-spacing: -.02em; line-height: 1; min-width: 26px; display: inline-block; text-align: center; }
.controls { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.controls .btn { height: 36px; padding: 0 14px; font-size: 15px; }
.status { color: var(--muted); font-size: 13px; margin-right: auto; padding-left: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.status.hl { color: var(--blue); font-weight: 600; background: var(--blue-tint); padding: 4px 10px; border-radius: 999px; }
.timer { font-weight: 600; color: var(--text); }
.timer.low { color: var(--red); }
.wp { font-weight: 600; font-size: 20px; letter-spacing: -.02em; min-width: 48px; text-align: right; color: var(--text); }
#oppWp { color: var(--muted); }

/* ---------- Доска ---------- */
.board-wrap { width: 100%; display: flex; justify-content: center; }
.board {
  position: relative; container-type: inline-size;
  width: min(100%, calc((100dvh - 186px) * 1.5714));
  aspect-ratio: 1100 / 700; border-radius: 2.2cqw;
  user-select: none; -webkit-user-select: none; touch-action: none; cursor: default;
}
#boardSvg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border-radius: inherit; }
#boardSvg .b-frame { fill: var(--b-frame); }
#boardSvg .b-surface { fill: var(--b-surface); }
#boardSvg .b-tray { fill: var(--b-tray); }
#boardSvg .b-bar { fill: var(--b-bar); }
#boardSvg .tri-a { fill: var(--tri-a); }
#boardSvg .tri-b { fill: var(--tri-b); }
#boardSvg .b-labels { fill: var(--b-label); font: 600 13px -apple-system, Inter, sans-serif; }
#boardSvg .b-orn { fill: none; stroke: var(--b-orn); stroke-width: 2; }
#boardSvg .b-mid { stroke: var(--b-orn); stroke-width: 2; }
#pieces, #hints { position: absolute; inset: 0; pointer-events: none; }
#hints { z-index: 350; }

.piece {
  position: absolute; border-radius: 50%;
  transition: left .42s cubic-bezier(.22, .8, .25, 1), top .42s cubic-bezier(.22, .8, .25, 1),
              width .3s, height .3s, border-radius .3s, box-shadow .2s, transform .15s;
}
.piece::after { content: ''; position: absolute; inset: 22%; border-radius: 50%; transition: opacity .2s; }
.piece::before { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; transition: box-shadow .2s; }
.piece.white { background: radial-gradient(circle at 35% 28%, var(--pw-1) 0%, var(--pw-1) 30%, var(--pw-2) 80%); box-shadow: inset 0 0 0 .14cqw var(--pw-edge), 0 .22cqw .45cqw rgba(0, 0, 0, .22); }
.piece.white::after { border: .14cqw solid var(--pw-ring); }
.piece.black { background: radial-gradient(circle at 35% 28%, var(--pb-1) 0%, var(--pb-2) 70%); box-shadow: inset 0 0 0 .14cqw var(--pb-edge), 0 .22cqw .45cqw rgba(0, 0, 0, .3); }
.piece.black::after { border: .14cqw solid var(--pb-ring); }
.piece.off { border-radius: .35cqw; }
.piece.off::after { opacity: 0; }
.piece.moving { z-index: 400 !important; }
/* ---------- Подсказка хода (renderHighlights / renderRoutes) ----------
   Метки двухцветные: цвет подсветки (--mv, у доски и палитры свой) и тёмная окантовка --hint-edge — так кольцо
   читается и на светлом пункте (жёлтый на кремовом), и на тёмном. */
:root { --hint-edge: rgba(10, 11, 13, .55); --hint-glow: color-mix(in srgb, var(--mv) 30%, transparent); --arr-opp: rgba(255, 255, 255, .82); }
.piece.movable::before { box-shadow: 0 0 0 .1cqw var(--hint-edge), 0 0 0 .3cqw var(--mv), 0 0 0 .4cqw var(--hint-edge); }
.piece.selected { transform: translateY(-.3cqw) scale(1.08); z-index: 300 !important; filter: drop-shadow(0 .7cqw .7cqw rgba(0, 0, 0, .35)); }
.piece.selected::before { box-shadow: 0 0 0 .1cqw var(--hint-edge), 0 0 0 .38cqw var(--mv), 0 0 0 .5cqw var(--hint-edge), 0 0 1.4cqw .4cqw var(--hint-glow); }
.piece.dragging { transition: none !important; transform: scale(1.12); z-index: 1000 !important; filter: drop-shadow(0 1.2cqw 1.2cqw rgba(0, 0, 0, .35)); }
.piece.last::after { box-shadow: 0 0 0 .16cqw var(--orange-fill); }
/* выбрана шашка — остальные чуть тише, шашки с ходом и выбранная — как есть */
#pieces.focusing .piece:not(.selected):not(.movable) { opacity: .72; transition: opacity .2s; }

/* цель: прозрачное место под шашку (по нему кликают) и кольцо-мишень внутри; под указателем — тень шашки */
.dest { position: absolute; pointer-events: auto; cursor: pointer; display: grid; place-items: center; animation: destIn .16s ease-out; }
.dest-ring { position: relative; width: 74%; height: 74%; border-radius: 50%; box-sizing: border-box; pointer-events: none;
  border: .32cqw solid var(--mv); background: color-mix(in srgb, var(--mv) 18%, transparent);
  box-shadow: 0 0 0 .1cqw var(--hint-edge), inset 0 0 0 .1cqw var(--hint-edge); transition: width .14s, height .14s, background .14s; }
.dest-ring::after { content: ''; position: absolute; inset: 36%; border-radius: 50%; background: var(--mv); box-shadow: 0 0 0 .1cqw var(--hint-edge); transition: opacity .14s; }
.dest.chain .dest-ring { border-style: dashed; background: color-mix(in srgb, var(--mv) 8%, transparent); }
.dest.chain .dest-ring::after { inset: 40%; }
.dest:hover .dest-ring { width: 96%; height: 96%; }
.dest.white:hover .dest-ring { background: radial-gradient(circle at 35% 28%, var(--pw-1), var(--pw-2) 85%); }
.dest.black:hover .dest-ring { background: radial-gradient(circle at 35% 28%, var(--pb-1), var(--pb-2) 85%); }
.dest:hover .dest-ring::after { opacity: 0; }
/* выброс: лоток с мягким светом */
.dest.tray { border-radius: .8cqw; box-sizing: border-box; border: .28cqw solid var(--mv); background: color-mix(in srgb, var(--mv) 14%, transparent);
  box-shadow: 0 0 0 .1cqw var(--hint-edge), inset 0 0 0 .1cqw var(--hint-edge); align-items: end; padding-bottom: .8cqw; transition: background .14s; }
.dest.tray:hover { background: color-mix(in srgb, var(--mv) 28%, transparent); }
.dest.tray.chain { border-style: dashed; }
/* кости хода — маленькая плашка со стороны середины доски */
.dest-tag {
  position: absolute; left: 50%; transform: translateX(-50%); min-width: 2.3cqw; height: 2.2cqw; padding: 0 .65cqw; z-index: 1;
  display: grid; place-items: center; border-radius: 999px; background: var(--mv); color: var(--on-mv); pointer-events: none;
  font: 800 max(10.5px, 1.3cqw)/1 var(--font-display, -apple-system), sans-serif; white-space: nowrap;
  box-shadow: 0 0 0 .12cqw var(--hint-edge), 0 .2cqw .5cqw rgba(0, 0, 0, .25);
}
.dest.top .dest-tag { bottom: -1.1cqw; }
.dest.bot .dest-tag { top: -1.1cqw; }
.dest.chain .dest-tag { background: #16171A; color: #FFFFFF; box-shadow: inset 0 0 0 .14cqw var(--mv), 0 .2cqw .5cqw rgba(0, 0, 0, .25); }
.dest.tray .dest-tag { position: static; transform: none; }
@keyframes destIn { from { transform: scale(.6); opacity: 0; } }
/* пункт цели: мягкий свет от основания конуса, без контура */
#ptHi .pt-hi { stroke: none; opacity: .55; }
#ptHi .pt-hi.chain { opacity: .3; }
#ptHi .ptg-a { stop-color: var(--mv); stop-opacity: .75; }
#ptHi .ptg-b { stop-color: var(--mv); stop-opacity: 0; }
/* кубики, которые потратит ход под указателем */
.die.spend { box-shadow: 0 0 0 .1cqw var(--hint-edge), 0 0 0 .32cqw var(--mv), 0 .3cqw .8cqw rgba(0, 0, 0, .25); transform: translateY(-.2cqw); }
.hint { position: absolute; border-radius: 50%; border: .22cqw dashed var(--mv); background: var(--mv-soft); }
.hint.tray { border-radius: .8cqw; border-style: solid; }
.from-mark { position: absolute; border-radius: 50%; border: .2cqw dashed var(--tertiary); }

/* линии: под цветной — тёмная подложка (видна на светлом), цвет — поверх */
#routeSvg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 120; }
#routeSvg .rl, #routeSvg .rl-halo { fill: none; stroke-linecap: round; stroke-linejoin: round; transition: opacity .15s; }
#routeSvg .rl-halo { stroke: var(--hint-edge); }
#routeSvg .rl.mv { stroke: var(--mv); stroke-width: 3.5; opacity: .8; }
#routeSvg .rl-halo.mv { stroke-width: 6.5; opacity: .5; }
#routeSvg .rl.mv.chain { stroke-width: 4.5; stroke-dasharray: .1 10; }
#routeSvg .rl-halo.mv.chain { display: none; }
#routeSvg .rl.mv.on { stroke-width: 6; opacity: 1; }
#routeSvg .rl-halo.mv.on { stroke-width: 9.5; opacity: .75; }
#routeSvg .mv.dim { opacity: .28; }
#routeSvg .rl-step { fill: var(--mv); stroke: var(--hint-edge); stroke-width: 2; }
#routeSvg .rl-step.dim { opacity: .3; }
#routeSvg .mk-mv { fill: var(--mv); stroke: var(--hint-edge); stroke-width: 1; }
/* последний ход соперника: пустое кольцо там, откуда ушла шашка */
#routeSvg .trail-from { fill: rgba(255, 255, 255, .08); stroke: var(--arr-opp); stroke-width: 3; stroke-dasharray: 6 6; opacity: .85; }
/* свои шашки, уже сыгранные в этом ходе */
#routeSvg .rl.done { stroke: var(--mv); stroke-width: 2.2; stroke-dasharray: 3 7; opacity: .45; }
#routeSvg .rl-halo.done { display: none; }
#routeSvg .mk-done { fill: var(--mv); opacity: .5; }
#routeSvg .done-from { fill: color-mix(in srgb, var(--mv) 8%, transparent); stroke: var(--mv); stroke-width: 2; stroke-dasharray: 4 6; opacity: .55; }
@media (prefers-reduced-motion: reduce) { .dest { animation: none; } }

#hintSvg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 250; }
#hintSvg .arr { stroke: var(--blue); stroke-width: 7; fill: none; stroke-linecap: round; opacity: .9; animation: hintIn .35s ease-out; }
#hintSvg marker path { fill: var(--blue); }
#hintSvg .alt { stroke: var(--muted); stroke-width: 4; stroke-dasharray: 10 9; opacity: .6; }
#hintSvg .num { fill: var(--on-blue); font: 700 20px -apple-system, Inter, sans-serif; text-anchor: middle; dominant-baseline: central; }
#hintSvg .numbg { fill: var(--blue); stroke: var(--card); stroke-width: 2; }
#hintSvg .arr.played { stroke: var(--arr-played); stroke-width: 6; opacity: .85; }
#hintSvg .arr.played.inacc { stroke: var(--q-inacc-fill); }
#hintSvg .arr.played.mistake { stroke: var(--q-mistake-fill); }
#hintSvg .arr.played.blunder { stroke: var(--q-blunder-fill); }
#hintSvg .arr.best { stroke: var(--arr-best); stroke-width: 7; stroke-dasharray: 14 9; opacity: .95; }
#hintSvg .mk-played { fill: var(--arr-played); }
#hintSvg .mk-best { fill: var(--arr-best); }
@keyframes hintIn { from { opacity: 0; } }

.band {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  display: flex; align-items: center; justify-content: center; gap: 1.2cqw;
  pointer-events: none; z-index: 600;
}
#myBand { left: 69.55%; }
#oppBand { left: 23.18%; }
.band .btn { pointer-events: auto; height: auto; font-size: max(13px, 1.5cqw); padding: .9cqw 2.2cqw; }
.band .note {
  background: var(--material); color: var(--text); border-radius: 999px;
  padding: .6cqw 1.6cqw; font-size: max(12px, 1.3cqw); font-weight: 500; white-space: nowrap;
  box-shadow: 0 .3cqw 1.2cqw rgba(0, 0, 0, .14);
}
.dice { display: flex; gap: 1cqw; }
.die {
  --s: 5.4cqw; width: var(--s); height: var(--s); border-radius: 18%;
  background: var(--die-bg); box-shadow: 0 .3cqw .8cqw rgba(0, 0, 0, .22), inset 0 0 0 .08cqw var(--die-edge);
  position: relative; flex: none; transition: opacity .25s, transform .25s;
}
.dice.quad .die { --s: 4.3cqw; }
.die.used { opacity: .35; transform: scale(.9); }
.die .pip, .d3-face .pip { position: absolute; width: 18%; height: 18%; transform: translate(-50%, -50%); border-radius: 50%; background: var(--die-pip); visibility: hidden; }
.die .pip.on { visibility: visible; }
.die.red .pip { background: var(--red-fill); }
.die.rolling { animation: tumble .7s cubic-bezier(.3, .7, .3, 1); }
@keyframes tumble { 0% { transform: translate(-6cqw, -3cqw) rotate(-200deg) scale(.7); opacity: 0; } 60% { transform: translate(.5cqw, .3cqw) rotate(15deg) scale(1.05); opacity: 1; } 100% { transform: none; } }
.dice.idle { animation: idle 2.4s ease-in-out infinite; }
.dice.idle .die { box-shadow: 0 0 0 .25cqw var(--blue), 0 .3cqw .8cqw rgba(0, 0, 0, .22); }
@keyframes idle { 50% { transform: translateY(-.4cqw); } }

#throwLayer { position: absolute; inset: 0; pointer-events: none; z-index: 700; perspective: 110cqw; perspective-origin: 50% 45%; }
.die.flying { position: absolute; --s: auto; box-shadow: 0 .8cqw 1.6cqw rgba(0, 0, 0, .3), inset 0 0 0 .08cqw var(--die-edge); }
/* в руке: только transform, без анимации — кости идут ровно за пальцем */
.die.held { filter: drop-shadow(0 1.4cqw 1.2cqw rgba(0, 0, 0, .3)); transition: none !important; will-change: transform; }
/* лежащие кости — под подсказками ходов, поднятой и летящей шашкой, но над остальными шашками */
#throwLayer.d3-low { z-index: 290; }
.d3-die { position: absolute; left: 0; top: 0; --u: 5.4cqw; width: var(--u); height: var(--u); transform-style: preserve-3d; }
.d3-lift { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .25s ease; }
.d3-cube { position: absolute; inset: 0; transform-style: preserve-3d; }
.d3-face { position: absolute; inset: 0; backface-visibility: hidden; }
/* грань: ровный цвет со спадом к скруглённым краям (симметрично — при вращении не «ездит»); свет и блик — слоями ниже */
/* Грань — квадрат чуть больше ребра (на 3% с каждой стороны): соседние грани заходят друг на друга, и на стыках
   нет щелей; без скругления углов — у скруглённых на вершине, где сходятся три грани, оставалась дырка.
   Скруглённое ребро нарисовано мягкой внутренней тенью; прозрачная рамка в 1px — сглаживание края при 3D-повороте.
   Задние грани скрывает dice3d.js (сам считает, какие видны) */
.d3-face { inset: -3%; box-sizing: border-box; border: 1px solid transparent; background: var(--die-face) padding-box;
  box-shadow: inset 0 0 .55cqw var(--die-rim), inset 0 0 0 .05cqw var(--die-edge); }
/* точки — лунки: темнее у верхнего края */
/* точка — кругом из градиента: край сглажен при любом повороте (у залитого круга с тенью он рвался) */
.d3-face .pip { width: 19%; height: 19%; border-radius: 0; background: radial-gradient(closest-side, var(--die-pip) 86%, color-mix(in srgb, var(--die-pip) 0%, transparent) 100%); }
.d3-gloss { position: absolute; inset: 0; border-radius: inherit; background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, .9), rgba(255, 255, 255, 0) 60%); opacity: 0; pointer-events: none; }
/* сыгранная кость — сплошная, но точки тонут в цвете грани, и сама она чуть «оседает» */
.d3-die.used .d3-lift { transform: scale(.86); }
.d3-face::after { content: ''; position: absolute; inset: 0; border-radius: inherit; background: var(--die-used); opacity: 0; transition: opacity .25s; pointer-events: none; }
.d3-die.used .d3-face::after { opacity: 1; }
/* ждут броска — покачиваются и обведены, как раньше плоские */
/* покачивание в ожидании броска — свойством translate у корня кости: анимация внутри preserve-3d (transform у .d3-lift)
   идёт не на видеокарте, а пересчётом стилей 60 раз в секунду (~37 мс/с главного потока), translate корня — на видеокарте */
.d3-die.idle { animation: d3idle 2.4s ease-in-out infinite; }
@keyframes d3idle { 50% { translate: 0 -.45cqw; } }
.d3-die.idle .d3-face.top { box-shadow: inset 0 0 .55cqw var(--die-rim), 0 0 0 .25cqw var(--blue); }
/* эту кость потратит ход под указателем */
.d3-die.spend .d3-lift { transform: translateZ(.5cqw); }
.d3-die.spend .d3-face.top { box-shadow: inset 0 0 .55cqw var(--die-rim), 0 0 0 .1cqw var(--hint-edge), 0 0 0 .32cqw var(--mv); }
/* дубль: четыре хода — четыре точки сбоку от пары */
.d3-dots { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; gap: .42cqw; padding: .55cqw .42cqw; border-radius: 999px; background: rgba(0, 0, 0, .34); transition: opacity .2s; pointer-events: none; }
.d3-dots i { width: .95cqw; height: .95cqw; border-radius: 50%; box-shadow: inset 0 0 0 .13cqw rgba(255, 255, 255, .55); transition: background .2s, box-shadow .2s; }
.d3-dots i.on { background: #FFFFFF; box-shadow: none; }
.d3-dots i.spend { background: var(--mv); box-shadow: 0 0 0 .13cqw var(--hint-edge); }
.d3-dots.gone { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .d3-die.idle { animation: none; } }
.d3-face .pip.on { visibility: visible; }
/* свой бросок до ответа сервера: точки приглушены (кость «смазана» в полёте), итог проявляется */
.d3-face .pip { transition: opacity .18s ease-out; }
.d3-die.pending .pip { opacity: .15; transition: none; }
/* тень грани — отдельным слоем: её прозрачность меняется каждый кадр, и грань с точками не перерисовывается */
.d3-shade { position: absolute; inset: 0; border-radius: inherit; background: #000; opacity: 0; pointer-events: none; }
/* тень под костью — мягкий градиент без filter: blur (размытие на движущемся слое дорого на телефонах) */
.d3-shadow { position: absolute; left: 0; top: 0; width: 6.5cqw; height: 6.5cqw; border-radius: 40%; background: radial-gradient(closest-side, rgba(0, 0, 0, .46), rgba(0, 0, 0, .2) 55%, rgba(0, 0, 0, 0)); pointer-events: none; }
/* слои видеокарты — только пока кости летят или в руке; лежащие кости (d3-low) их не держат */
#throwLayer:not(.d3-low) .d3-die, #throwLayer:not(.d3-low) .d3-cube { will-change: transform; }
#throwLayer:not(.d3-low) .d3-shadow { will-change: transform, opacity; }

.peek-banner {
  position: absolute; left: 50%; top: 1.2cqw; transform: translateX(-50%); z-index: 720;
  display: flex; align-items: center; gap: 10px 12px; flex-wrap: wrap; justify-content: center;
  background: var(--material); color: var(--text); border-radius: 14px; padding: 8px 8px 8px 14px; font-size: 14px;
  box-shadow: var(--shadow-pop); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); max-width: calc(100% - 24px);
}
.pb-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pb-n { color: var(--muted); font-size: 13px; }
.pb-mv { font-variant-numeric: tabular-nums; }
.pb-line { width: 100%; text-align: center; color: var(--muted); font-size: 13px; margin-top: -4px; }
.pb-line b { color: var(--green); font-weight: 600; }
.pb-q { font-weight: 600; font-size: 12px; padding: 2px 8px; border-radius: 999px; }
.pb-q.q-inacc { background: color-mix(in srgb, var(--q-inacc-fill) 22%, transparent); color: var(--q-inacc); }
.pb-q.q-mistake { background: color-mix(in srgb, var(--q-mistake-fill) 20%, transparent); color: var(--q-mistake); }
.pb-q.q-blunder { background: color-mix(in srgb, var(--q-blunder-fill) 18%, transparent); color: var(--q-blunder); }
.pb-q.q-good { background: color-mix(in srgb, var(--green-fill) 16%, transparent); color: var(--green); }
.pb-acts { display: flex; gap: 6px; }
.pb-btn { border: 0; background: var(--fill); color: var(--blue); border-radius: 999px; height: 32px; padding: 0 12px; font-size: 14px; font-weight: 600; cursor: pointer; }
.pb-btn.primary { background: var(--blue); color: var(--on-blue); }
.board.peeking .piece { cursor: default; }
.board.peeking::after { content: ''; position: absolute; inset: 0; box-shadow: inset 0 0 0 3px var(--blue); border-radius: inherit; pointer-events: none; z-index: 260; }

/* ---------- Боковая панель ---------- */
.panel { background: var(--card); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); flex: none; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; min-height: 28px; }
.panel-head b { font-weight: 600; }
.room-code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; letter-spacing: .08em; font-size: 13px; font-weight: 500; color: var(--muted); background: var(--fill); padding: 3px 8px; border-radius: 6px; }
.side-actions { display: flex; gap: 6px; align-items: center; }
.side-actions .btn { flex: 1; min-width: 0; }
.vol { width: 80px; min-width: 60px; accent-color: var(--blue); cursor: pointer; }
.settings { display: flex; flex-direction: column; border-top: .5px solid var(--sep); padding-top: 4px; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; cursor: pointer; border-bottom: .5px solid var(--sep); }
.set-row:last-child { border-bottom: 0; }
.set-row > span { flex: 1; display: flex; flex-direction: column; gap: 2px; font-size: 15px; min-width: 0; }
.set-row b { font-weight: 500; }
.set-row small { color: var(--muted); font-size: 13px; }
.set-row input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--green-fill); flex: none; }
.set-row .seg { width: 200px; flex: none; }

.calc { font-weight: 400; font-size: 13px; color: var(--muted); }
.prob-bar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--fill); }
.pb { height: 100%; transition: width .6s cubic-bezier(.3, .8, .3, 1); }
.pb.me { background: var(--blue); }
.pb.op { background: transparent; }
.prob-labels { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; }
.prob-labels span:first-child { font-size: 28px; font-weight: 600; letter-spacing: -.02em; }
.prob-labels span:last-child { color: var(--muted); text-align: right; }
#spark { width: 100%; height: 64px; display: block; }
#spark .mid { stroke: var(--sep); stroke-dasharray: 3 4; }
#spark .area { fill: var(--blue-tint); }
#spark .line { fill: none; stroke: var(--blue); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
#spark .dot { fill: var(--blue); }
#spark .empty { fill: var(--muted); font-size: 12px; }
.prob-mars { font-size: 13px; color: var(--muted); }
.turning { font-size: 13px; color: var(--muted); line-height: 1.45; }
.turning b { color: var(--text); font-weight: 600; }
.howcalc { font-size: 13px; color: var(--muted); line-height: 1.5; }
.howcalc summary { cursor: pointer; color: var(--blue); font-size: 13px; }
.howcalc p { margin: 8px 0 0; }
.howcalc b { color: var(--text); font-weight: 600; }

.mini-seg { display: flex; background: var(--fill); border-radius: 9px; padding: 2px; }
.mini-seg button { border: 0; background: none; color: var(--text); font-size: 13px; font-weight: 500; height: 26px; padding: 0 12px; border-radius: 7px; cursor: pointer; }
.mini-seg button.on { background: var(--seg-on); font-weight: 600; box-shadow: 0 2px 6px rgba(0, 0, 0, .12); }
.stats { width: 100%; border-collapse: collapse; font-size: 14px; }
.stats th { font-size: 13px; font-weight: 500; color: var(--muted); text-align: right; padding: 0 0 6px; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stats td { padding: 6px 0; border-top: .5px solid var(--sep); }
.stats td:first-child { color: var(--muted); }
.stats td:not(:first-child) { text-align: right; font-weight: 500; padding-left: 8px; white-space: nowrap; font-size: 14px; }
.stats td.good { color: var(--green); }
.stats td.bad { color: var(--red); }
.stats tr.sep td { border: 0; padding: 4px 0; }
.stats tr.grp td { color: var(--muted); font-size: 13px; font-weight: 600; padding: 14px 0 6px; border: 0; }
.faces { display: grid; gap: 6px; }
.faces-title { font-size: 13px; color: var(--muted); margin: 8px 0 6px; }
.faces-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.fcol { display: grid; gap: 4px; }
.fbars { height: 64px; display: flex; align-items: flex-end; justify-content: center; gap: 3px; background: var(--fill); border-radius: 6px; padding: 3px; }
.fb { width: 40%; min-height: 2px; border-radius: 3px 3px 1px 1px; position: relative; transition: height .5s cubic-bezier(.3, .8, .3, 1); }
.fb.white { background: var(--pw-2); box-shadow: inset 0 0 0 1px var(--pw-edge); }
.fb.black { background: var(--pb-2); }
.fb span { position: absolute; top: -14px; left: 50%; transform: translateX(-50%); font-size: 10px; color: var(--muted); }
.fface { text-align: center; font-size: 12px; font-weight: 600; }
.hist { display: grid; gap: 4px; }
.hrow { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; font-size: 13px; padding: 6px 8px; border-radius: 8px; background: var(--fill); }
.hrow span:nth-child(2) { font-weight: 600; }
.hrow.won span:nth-child(2) { color: var(--green); }
.hrow.lost span:nth-child(2) { color: var(--red); }
.hrow span:last-child { color: var(--muted); }

.log-nav { display: flex; }
.log-nav button { width: 32px; height: 28px; border: 0; background: transparent; color: var(--blue); border-radius: 8px; cursor: pointer; font-size: 15px; display: grid; place-items: center; }
.log-nav button:hover { background: var(--fill); }
.log-tools { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.log-only { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.log-only input { accent-color: var(--blue); width: 16px; height: 16px; }
.log-jump { border: 0; background: transparent; color: var(--blue); font-size: 13px; cursor: pointer; padding: 2px 0; }
.log-list { max-height: 280px; overflow-y: auto; display: flex; flex-direction: column; scrollbar-width: thin; margin: 0 -6px; }
.log-empty { color: var(--muted); font-size: 13px; padding: 8px 6px; }
.lg-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) minmax(0, 1fr); gap: 2px; align-items: stretch; border-top: .5px solid var(--sep); padding: 1px 0; }
.lg-row.head { border-top: 0; font-size: 12px; color: var(--muted); padding: 0 0 4px; }
.lg-row.head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 6px; }
.lg-row.one { grid-template-columns: 26px 70px minmax(0, 1fr); align-items: center; }
.lg-n { color: var(--tertiary); font-size: 12px; align-self: center; text-align: right; padding-right: 2px; }
.lg-who { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-cell { display: flex; align-items: center; gap: 6px; min-width: 0; text-align: left; border: 0; background: transparent; border-radius: 7px; padding: 5px 6px; cursor: pointer; font-size: 13px; color: var(--text); }
.lg-cell.empty { cursor: default; }
.lg-cell:not(.empty):hover { background: var(--fill); }
.lg-cell.sel { background: var(--blue-tint); }
.lg-mv { flex: 1; min-width: 0; white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }
.lg-q { flex: none; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; display: grid; place-items: center; font-weight: 700; font-size: 10px; }
.lg-cell.q-inacc .lg-q { background: var(--q-inacc-fill); color: var(--q-inacc-on); }
.lg-cell.q-mistake .lg-q { background: var(--q-mistake-fill); color: var(--q-mistake-on); }
.lg-cell.q-blunder .lg-q { background: var(--q-blunder-fill); color: var(--q-blunder-on); }
.lg-dice { display: inline-flex; gap: 2px; flex: none; }
.lg-die { width: 13px; height: 13px; border-radius: 3.5px; display: inline-block; background-color: var(--fill2); --p: radial-gradient(circle, var(--text) 0 1.4px, transparent 1.7px); }
.lg-die.d1 { background: var(--p) 50% 50% / 13px 13px no-repeat, var(--fill2); }
.lg-die.d2 { background: var(--p) 25% 25% / 6.5px 6.5px no-repeat, var(--p) 75% 75% / 6.5px 6.5px no-repeat, var(--fill2); }
.lg-die.d3 { background: var(--p) 0 0 / 6.5px 6.5px no-repeat, var(--p) 50% 50% / 6.5px 6.5px no-repeat, var(--p) 100% 100% / 6.5px 6.5px no-repeat, var(--fill2); }
.lg-die.d4 { background: var(--p) 0 0 / 6.5px 6.5px no-repeat, var(--p) 100% 0 / 6.5px 6.5px no-repeat, var(--p) 0 100% / 6.5px 6.5px no-repeat, var(--p) 100% 100% / 6.5px 6.5px no-repeat, var(--fill2); }
.lg-die.d5 { background: var(--p) 0 0 / 6.5px 6.5px no-repeat, var(--p) 100% 0 / 6.5px 6.5px no-repeat, var(--p) 50% 50% / 6.5px 6.5px no-repeat, var(--p) 0 100% / 6.5px 6.5px no-repeat, var(--p) 100% 100% / 6.5px 6.5px no-repeat, var(--fill2); }
.lg-die.d6 { background: var(--p) 0 0 / 6.5px 4.4px no-repeat, var(--p) 0 50% / 6.5px 4.4px no-repeat, var(--p) 0 100% / 6.5px 4.4px no-repeat, var(--p) 100% 0 / 6.5px 4.4px no-repeat, var(--p) 100% 50% / 6.5px 4.4px no-repeat, var(--p) 100% 100% / 6.5px 4.4px no-repeat, var(--fill2); }

.chat { min-height: 220px; }
.chat-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; min-height: 80px; max-height: 240px; }
.msg { font-size: 14px; line-height: 1.4; overflow-wrap: anywhere; }
.msg .who { font-weight: 600; margin-right: 6px; }
.msg .who.white, .msg .who.black { color: var(--text); }
.msg.sys { color: var(--muted); font-size: 13px; text-align: center; }
.chat-empty { color: var(--tertiary); font-size: 13px; text-align: center; margin: auto; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; min-width: 0; height: 36px; background: var(--fill); border: 0; border-radius: 999px; padding: 0 14px; outline: none; font-size: 15px; }
.chat-form input:focus { box-shadow: 0 0 0 2px var(--blue); }
.chat-form .btn { width: 36px; height: 36px; padding: 0; flex: none; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.quick button { background: var(--fill); border: 0; border-radius: 999px; height: 30px; padding: 0 12px; cursor: pointer; font-size: 13px; color: var(--text); }
.quick button:hover { background: var(--fill2); }

/* ---------- Оверлеи и всплывашки ---------- */
.overlay { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 16px; background: var(--scrim); animation: fade .2s ease; }
.overlay.soft { background: transparent; pointer-events: none; }
@keyframes fade { from { opacity: 0; } }
.modal {
  max-width: 440px; background: var(--card); border-radius: 22px; padding: 22px; text-align: left;
  box-shadow: var(--shadow-pop); animation: pop .3s cubic-bezier(.2, .9, .3, 1.15); max-height: calc(100dvh - 32px); overflow-y: auto;
}
.modal h2 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; margin: 0 0 4px; }
@keyframes pop { from { transform: scale(.94) translateY(8px); opacity: 0; } }
.linkbox { display: flex; gap: 8px; margin: 18px 0 10px; }
.linkbox input { flex: 1; min-width: 0; height: 40px; background: var(--fill); border: 0; border-radius: 10px; padding: 0 12px; font-size: 14px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; outline: none; }
#shareBtn { width: 100%; margin-top: 4px; }
.intro { text-align: center; }
.intro-dice { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 18px 0; }
.intro-dice > div { display: grid; gap: 8px; justify-items: center; color: var(--muted); font-size: 13px; }
.intro-dice .vs { font-size: 24px; color: var(--tertiary); }
.die-slot .die { --s: 60px; }
.trophy { display: none; }
.res-score { font-size: 40px; font-weight: 600; letter-spacing: -.02em; margin: 14px 0 12px; display: flex; justify-content: center; align-items: center; gap: 18px; text-align: center; }
.res-score small { font-size: 13px; color: var(--muted); font-weight: 400; display: block; letter-spacing: 0; }
.res-score .sep { color: var(--tertiary); }
.res-rating { font-size: 15px; margin: 0 0 12px; color: var(--muted); padding: 10px 12px; border-radius: 12px; background: var(--fill); }
.res-rating:empty { display: none; }
.res-rating b { color: var(--text); font-weight: 600; }
.res-actions { display: grid; gap: 10px; }
.review { text-align: left; margin: 4px 0 16px; font-size: 14px; max-height: 38vh; overflow: auto; }
.review .rv-head { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 12px; padding: 8px 0; border-bottom: .5px solid var(--sep); }
.review .rv-head b { font-weight: 600; }
.review .rv-title { color: var(--muted); font-size: 13px; margin: 12px 0 4px; }
.review .rv-row { display: grid; grid-template-columns: auto auto 1fr auto; gap: 10px; padding: 7px 6px; border-bottom: .5px solid var(--sep); align-items: baseline; }
.review .rv-row[data-turn] { cursor: pointer; border-radius: 8px; }
.review .rv-row[data-turn]:hover { background: var(--fill); }
.review .rv-row .q { font-weight: 600; }
.review .q.blunder { color: var(--q-blunder); } .review .q.mistake { color: var(--q-mistake); } .review .q.inacc { color: var(--q-inacc); }
.review .mv { color: var(--muted); font-size: 13px; }
.review .mv b { color: var(--green); font-weight: 600; }
/* разбор партии после неё: кнопка и «идёт разбор» */
.review .rv-ask { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 0 4px; text-align: center; color: var(--muted); }
.review .rv-ask small { font-size: 13px; }
.review div.rv-ask[role=status] { flex-direction: row; justify-content: center; gap: 10px; }
.rv-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--sep); border-top-color: var(--blue); animation: rvSpin .8s linear infinite; flex: none; }
@keyframes rvSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rv-spin { animation-duration: 2.4s; } }
.peek-back { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 1500; box-shadow: var(--shadow-pop); }

#game.replay .side .panel:not(.keep), #game.replay .controls .btn, #game.replay #oppStatus { display: none; }

.toast {
  position: fixed; left: 50%; top: 16px; transform: translate(-50%, -150%); z-index: 3000;
  background: var(--material); color: var(--text); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  padding: 10px 16px; border-radius: 14px; font-size: 14px; font-weight: 500; line-height: 1.4;
  transition: transform .3s cubic-bezier(.2, .9, .3, 1.15), opacity .2s; box-shadow: var(--shadow-pop);
  pointer-events: none; max-width: min(560px, calc(100vw - 32px)); text-align: center; opacity: 0; visibility: hidden;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.toast.warn { box-shadow: inset 0 0 0 1.5px var(--q-inacc-fill), var(--shadow-pop); }
.toast.bad { box-shadow: inset 0 0 0 1.5px var(--q-mistake-fill), var(--shadow-pop); }
.conn-lost { position: fixed; bottom: 0; left: 0; right: 0; background: var(--red-fill); color: #fff; text-align: center; padding: 8px; font-size: 14px; z-index: 3000; }

/* ---------- Адаптив ---------- */
@media (max-width: 1100px) { .side { width: 300px; } }
@media (max-width: 1000px) {
  .layout { flex-direction: column; align-items: stretch; }
  .side { width: 100%; max-height: none; position: static; overflow: visible; }
  .board { width: min(100%, calc((100dvh - 170px) * 1.5714)); }
}
@media (max-width: 640px) {
  #game { padding: 8px 8px 16px; }
  .main { gap: 6px; }
  .pbar { padding: 0 10px; gap: 8px; min-height: 50px; }
  .pstatus { display: none; }
  .chip { width: 22px; height: 22px; }
  .pname { font-size: 14px; }
  .score { font-size: 20px; min-width: 18px; }
  .controls .btn { height: 32px; padding: 0 10px; font-size: 13px; }
  .status { display: none; }
  .pinfo { flex: 1; min-width: 0; gap: 8px; }
  .ptext { overflow: hidden; }
  .pmeta { overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
  .controls { flex: none; gap: 6px; }
  .wp { font-size: 16px; min-width: 36px; }
  #myBar .wp { display: none; }
  .board { width: 100%; }
  .brand h1 { font-size: 30px; }
  .lobby-alt { grid-template-columns: 1fr; }
  .seg i { font-size: 12px; }
  .page-head h1 { font-size: 22px; }
  .modal { padding: 18px; }
  .modal h2 { font-size: 24px; }
  .set-row .seg { width: 170px; }
}
.theme-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; padding: 10px 16px; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); font-size: 15px; }
.theme-row .seg { width: 230px; }
.stats th { padding-left: 10px; }
.tg-short { display: none; }
@container (max-width: 620px) {
  .dest.chain .tg-full { display: none; }
  .dest.chain .tg-short { display: inline; }
  .dest-tag { min-width: 15px; height: 15px; padding: 0 3px; font-size: 9px; }
}
@media (max-width: 640px) {
  .pbar.me { flex-wrap: wrap; padding: 6px 10px; row-gap: 4px; }
  .pbar.me .pinfo { flex: 1 1 0; }
  .pbar.me .pscore { order: 2; }
  .pbar.me .controls { order: 3; flex: 1 0 100%; justify-content: flex-end; }
  .pbar.me .controls:not(:has(.btn:not(.hidden))) { display: none; }
}
.page-head > :first-child { justify-self: start; }
.pl-cards { grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); }

/* ---------- Стили костей (data-dice) ---------- */
:root { --die-face: #FFFFFF; --die-face2: #ECEAE5; --die-pip: #1C1C1E; --die-edge: rgba(0, 0, 0, .1); --die-core: #E2DFD8; --die-rim: rgba(0, 0, 0, .16); --die-used: color-mix(in srgb, var(--die-face2) 62%, transparent);
  --die-bg: radial-gradient(circle at 35% 30%, var(--die-face) 0%, var(--die-face) 45%, var(--die-face2) 100%); }
:root[data-dice="ivory"] { --die-face: #FFFBF1; --die-face2: #E8DCC2; --die-pip: #3A2716; --die-edge: rgba(90, 60, 20, .18); --die-core: #E3D5B8; --die-rim: rgba(110, 70, 20, .22); }
:root[data-dice="black"] { --die-face: #313134; --die-face2: #161618; --die-pip: #F5F5F7; --die-edge: rgba(255, 255, 255, .1); --die-core: #222225; --die-rim: rgba(0, 0, 0, .55); }
:root[data-dice="red"] { --die-face: #D93E33; --die-face2: #A3221A; --die-pip: #FFFFFF; --die-edge: rgba(0, 0, 0, .14); --die-core: #B52A20; --die-rim: rgba(70, 0, 0, .35); }

/* ---------- Стили доски (data-board); «По теме» — без атрибута ---------- */
:root[data-board="wood"] {
  --b-frame: #5B3A22; --b-surface: #E9DCC0; --b-tray: #4A2E1B; --b-bar: #4A2E1B;
  --tri-a: #9C3B2F; --tri-b: #2F5A48; --b-label: rgba(255, 236, 205, .6); --b-orn: rgba(255, 236, 205, .35);
  --mv: #2C7BE5; --mv-soft: rgba(44, 123, 229, .22); --on-mv: #FFFFFF;
}
:root[data-board="felt"] {
  --b-frame: #3B2A1D; --b-surface: #2F5D47; --b-tray: #2A1D13; --b-bar: #2A1D13;
  --tri-a: #E6D9BB; --tri-b: #1C3B2D; --b-label: rgba(255, 236, 205, .55); --b-orn: rgba(255, 236, 205, .3);
  --mv: #F6C744; --mv-soft: rgba(246, 199, 68, .3); --on-mv: #2A1F00;
}
:root[data-board="marble"] {
  --b-frame: #D6D2CB; --b-surface: #F5F3EF; --b-tray: #E5E1DA; --b-bar: #C9C4BB;
  --tri-a: #B7A086; --tri-b: #6C7C8E; --b-label: rgba(60, 60, 67, .5); --b-orn: rgba(60, 60, 67, .25);
  --mv: #2C7BE5; --mv-soft: rgba(44, 123, 229, .22); --on-mv: #FFFFFF;
}
.theme-card { margin-top: 16px; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 0 16px; }
.theme-card .theme-row { margin: 0; padding: 10px 0; box-shadow: none; border-radius: 0; background: none; border-bottom: .5px solid var(--sep); }
.theme-card .theme-row:last-child { border-bottom: 0; }
.theme-row .seg { width: 260px; }
@media (max-width: 640px) { .theme-row .seg, .set-row .seg { width: 210px; } .theme-row .seg i, .set-row .seg i { font-size: 11.5px; } }
.set-row:has(> .seg) { flex-wrap: wrap; row-gap: 8px; }
.set-row > .seg { width: 100%; }
@media (max-width: 640px) {
  .theme-row { flex-wrap: wrap; row-gap: 8px; }
  .theme-row .seg { width: 100%; }
  .theme-row .seg i, .set-row .seg i { font-size: 13px; }
}
@container (max-width: 620px) {
  .peek-banner { top: 4px; gap: 4px 8px; padding: 4px 4px 4px 10px; font-size: 12px; border-radius: 10px; }
  .pb-n { font-size: 11px; }
  .pb-btn { height: 24px; padding: 0 8px; font-size: 12px; }
  .pb-q { font-size: 10.5px; padding: 1px 6px; }
  .pb-line { font-size: 11px; }
}

/* ---------- Лобби (новая раскладка) ---------- */
.card.lobby { max-width: 520px; display: flex; flex-direction: column; gap: 14px; }
.lobby-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 2px; }
.lobby-head h1 { font-size: 34px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
.lobby-head .me-chip { margin: 4px 0 0; }
.lob-card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; }
.lob-quick { display: flex; align-items: center; gap: 14px; }
.lob-quick-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lob-quick-text b { font-size: 17px; font-weight: 600; }
.lob-quick-text span { font-size: 13px; color: var(--muted); }
.lob-quick .btn { height: 44px; padding: 0 22px; font-size: 16px; flex: none; }
#createForm.lob-card { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.lob-title { font-size: 17px; font-weight: 600; }
.mode-seg i { height: 34px; font-size: 14px; }
.lrows { display: flex; flex-direction: column; }
.lrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding: 6px 0; border-top: .5px solid var(--sep); font-size: 15px; }
.lrow:first-child { border-top: 0; }
.lrow > span:first-child { flex: none; }
.lrow input[name=name] { flex: 1; min-width: 0; height: 34px; border: 0; background: transparent; text-align: right; font-size: 17px; outline: none; color: var(--text); }
.lrow input[name=name]::placeholder { color: var(--tertiary); }
.lrow input[name=name]:focus { box-shadow: none; }
.lrow.col { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 0; }
.lrow.col > span { font-size: 13px; color: var(--muted); }
.lrow.check { cursor: pointer; }
.lrow.check > span:last-child { order: -1; }
.lob-code { display: flex; flex-direction: column; gap: 10px; }
.lob-code b { font-size: 15px; font-weight: 600; }
.lob-code-row { display: flex; gap: 8px; }
.lob-code-row input { flex: 1; min-width: 0; height: 40px; background: var(--fill); border: 0; border-radius: 10px; padding: 0 12px; font-size: 16px; outline: none; }
.lob-code-row input:focus { box-shadow: 0 0 0 2px var(--blue); }
.lob-more { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.lob-link, .lob-fold > summary {
  display: flex; align-items: center; justify-content: space-between; min-height: 46px; padding: 0 16px;
  font-size: 15px; color: var(--text); text-decoration: none; cursor: pointer; list-style: none;
}
.lob-fold > summary::-webkit-details-marker { display: none; }
.lob-link span, .lob-fold > summary::after { color: var(--tertiary); font-size: 20px; line-height: 1; }
.lob-fold > summary::after { content: '›'; transition: transform .2s; }
.lob-fold[open] > summary::after { transform: rotate(90deg); }
.lob-fold, .lob-link + .lob-fold { border-top: .5px solid var(--sep); }
.lob-fold-body { padding: 0 16px 12px; }
.lob-fold-body .theme-row { margin: 0; padding: 10px 0; background: none; box-shadow: none; border-radius: 0; border-top: .5px solid var(--sep); }
.lob-fold-body .theme-row:first-child { border-top: 0; }
.rules-body { color: var(--muted); font-size: 14px; }
.rules-body ul { margin: 0; padding-left: 18px; line-height: 1.5; }
.rules-body li { margin-bottom: 6px; }
@media (max-width: 640px) {
  .lobby-head h1 { font-size: 30px; }
  .lob-quick .btn { padding: 0 18px; }
}

/* ---------- v2: часы, контроль времени, метка партии ---------- */
.lob-quick { flex-direction: column; align-items: stretch; gap: 12px; }
.lob-quick-row { display: flex; align-items: center; gap: 14px; }
.tc-seg i { height: 32px; }
.pclock {
  flex: none; font-weight: 600; font-size: 18px; letter-spacing: -.01em; line-height: 1; font-variant-numeric: tabular-nums;
  padding: 7px 10px; border-radius: 9px; background: var(--fill); color: var(--muted); min-width: 64px; text-align: center;
  transition: background .2s, color .2s;
}
.pclock.run { background: var(--inverse); color: var(--inverse-text); }
.pclock.low { color: var(--red); background: color-mix(in srgb, var(--red-fill) 14%, transparent); }
.pclock.run.low { background: var(--red-fill); color: #fff; }
.game-tag {
  align-self: center; max-width: 100%; font-size: 13px; font-weight: 600; color: var(--blue); background: var(--blue-tint);
  padding: 4px 12px; border-radius: 999px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.game-tag b { color: var(--text); }
.game-info { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; color: var(--muted); margin-top: -4px; }
.game-info:empty { display: none; }
.gi-tc { font-weight: 600; color: var(--text); background: var(--fill); padding: 2px 8px; border-radius: 6px; }
@media (max-width: 640px) {
  .pclock { font-size: 15px; padding: 5px 7px; min-width: 52px; }
  .pbar.me .pclock { order: 2; }
}

/* ---------- v2: классы ходов и точность ---------- */
.log-summary { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.acc-chip { background: var(--fill); border-radius: 999px; padding: 2px 10px; color: var(--muted); }
.acc-chip b { color: var(--text); font-weight: 600; }
.lg-cell.q-best .lg-q { background: color-mix(in srgb, var(--green-fill) 20%, transparent); color: var(--green); }
.lg-cell.q-excellent .lg-q { background: color-mix(in srgb, var(--green-fill) 12%, transparent); color: var(--green); }
.lg-cell.q-good .lg-q { background: var(--fill); color: var(--muted); }
.review .rv-acc { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 10px; }
.review .rv-acc > div { background: var(--fill); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.review .rv-acc > div.top { box-shadow: inset 0 0 0 1.5px var(--green-fill); }
.review .rv-acc b { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.review .rv-acc span { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.review .rv-acc small { font-size: 12px; color: var(--muted); }
.rv-cls { width: 100%; border-collapse: collapse; font-size: 14px; }
.rv-cls th { font-weight: 400; color: var(--muted); font-size: 12px; text-align: right; padding: 2px 6px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rv-cls td { padding: 4px 6px; border-top: .5px solid var(--sep); text-align: right; font-weight: 600; }
.rv-cls td:first-child { text-align: left; font-weight: 400; }
.cls-mark { display: inline-block; min-width: 26px; font-style: normal; font-weight: 700; font-size: 12px; text-align: center; border-radius: 5px; margin-right: 8px; padding: 1px 0; }
.c-best .cls-mark { background: color-mix(in srgb, var(--green-fill) 20%, transparent); color: var(--green); }
.c-excellent .cls-mark { background: color-mix(in srgb, var(--green-fill) 12%, transparent); color: var(--green); }
.c-good .cls-mark { background: var(--fill); color: var(--muted); }
.c-inacc .cls-mark { background: var(--q-inacc-fill); color: var(--q-inacc-on); }
.c-mistake .cls-mark { background: var(--q-mistake-fill); color: var(--q-mistake-on); }
.c-blunder .cls-mark { background: var(--q-blunder-fill); color: var(--q-blunder-on); }
/* ---------- v2: проверка костей ---------- */
code { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: .92em; }
.gi-fair { border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); font-size: 13px; }
.gi-fair code { color: var(--text); }
.gi-fair:hover code { color: var(--blue); }
.res-fair { font-size: 13px; color: var(--muted); margin: -6px 0 14px; text-align: center; }
.res-fair a { font-weight: 600; text-decoration: none; }
.fair-head { gap: 0; }
.fair-row { display: grid; grid-template-columns: 170px 1fr; gap: 12px; padding: 10px 0; border-top: .5px solid var(--sep); font-size: 14px; align-items: baseline; }
.fair-row:first-child { border-top: 0; }
.fair-row > span { color: var(--muted); }
.fair-row small { display: block; font-size: 12px; color: var(--tertiary); }
.fair-row code { word-break: break-all; }
.fair-ok { color: var(--green); } .fair-bad { color: var(--red); }
.fair-sum { font-weight: 500; font-size: 14px; }
.fair-rolls { display: flex; flex-direction: column; max-height: 60vh; overflow: auto; }
.fr { display: grid; grid-template-columns: 36px 18px 1fr 64px 64px 18px; gap: 10px; align-items: center; padding: 6px 0; border-top: .5px solid var(--sep); font-size: 14px; }
.fr.fr-head { border-top: 0; color: var(--muted); font-size: 12px; position: sticky; top: 0; background: var(--card); }
.fr.bad { background: color-mix(in srgb, var(--red-fill) 10%, transparent); }
.fr .chip { width: 16px; height: 16px; }
.fr-k { color: var(--muted); text-align: right; }
.fr-ce { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-calc { font-weight: 600; }
.fair-how summary { cursor: pointer; font-weight: 600; }
.fair-how ol { margin: 8px 0 0; padding-left: 20px; line-height: 1.5; font-size: 14px; }
.fair-how p { margin: 0; font-size: 13px; }
@media (max-width: 640px) {
  .fair-row { grid-template-columns: 1fr; gap: 2px; }
  .fr { grid-template-columns: 28px 16px 1fr 52px 40px 14px; gap: 6px; font-size: 13px; }
}
/* ---------- v2: друзья и вызовы ---------- */
.lob-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.lob-title-row .muted { font-size: 13px; }
.fr-list { display: flex; flex-direction: column; }
.fr-row { display: flex; align-items: center; gap: 10px; min-height: 46px; border-top: .5px solid var(--sep); font-size: 15px; }
.fr-row:first-child { border-top: 0; }
.fdot { width: 8px; height: 8px; border-radius: 50%; background: var(--tertiary); flex: none; }
.fdot.on { background: var(--green-fill); }
.fdot.busy { background: var(--orange-fill); }
.fr-name { color: var(--text); text-decoration: none; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fr-rt { color: var(--muted); font-size: 13px; }
.fr-note { color: var(--muted); font-size: 13px; white-space: nowrap; }
.fr-act { margin-left: auto; display: flex; gap: 6px; flex: none; }
.fr-empty { margin: 0; font-size: 14px; }
.pl-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: center; }
.pl-online { font-size: 13px; }
.pl-tc .pc b small { font-size: 14px; color: var(--muted); margin-left: 2px; }
#topTc { margin-top: -6px; }
#topTc button:not(.on) { color: var(--muted); }
.ch-modal { width: 100%; }
.ch-modal .lrows { margin: 14px 0 16px; }
.ch-stack { position: fixed; right: 16px; bottom: 16px; z-index: 2500; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.ch-card {
  pointer-events: auto; background: var(--material); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-radius: 16px; box-shadow: var(--shadow-pop), inset 0 0 0 1.5px var(--blue); padding: 12px 14px; display: grid; gap: 10px; animation: pop .3s cubic-bezier(.2, .9, .3, 1.15);
}
.ch-text { font-size: 15px; line-height: 1.35; }
.ch-text small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.ch-acts { display: flex; gap: 8px; }
.ch-acts .btn { flex: 1; }
@media (max-width: 640px) { .ch-stack { right: 16px; left: 16px; width: auto; bottom: 12px; } }
/* ---------- v2: турниры ---------- */
.lob-tours { gap: 8px; }
.lob-tours span { margin-left: 0; }
.lob-badge { font-style: normal; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--fill); padding: 2px 8px; border-radius: 999px; margin-left: auto; }
.lob-badge.live { color: var(--on-blue); background: var(--blue); }
.gi-tour { font-weight: 600; text-decoration: none; }
#tourBody { display: grid; gap: 12px; }
.tour-intro { margin: 0; color: var(--muted); font-size: 14px; }
.tour-group { font-size: 13px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin: 6px 4px -4px; }
.tour-card { flex-direction: row; align-items: center; gap: 12px; }
.tour-card.running { box-shadow: inset 0 0 0 1.5px var(--blue), var(--shadow); }
.tour-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; color: var(--text); text-decoration: none; }
.tour-main b { font-size: 17px; font-weight: 600; }
.tour-main span { font-size: 13px; color: var(--muted); }
.tour-main .tour-time b, .tour-time b { color: var(--text); font-weight: 600; font-size: inherit; }
.tour-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; flex: none; }
.tour-in { color: var(--green); font-size: 13px; font-weight: 600; }
.tour-head { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px 16px; }
.tour-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 14px; color: var(--muted); }
.tour-st { font-weight: 600; font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--fill); color: var(--text); }
.tour-st.running { background: var(--blue); color: var(--on-blue); }
.tour-upd { font-weight: 400; font-size: 13px; }
.tour-lb .fdot { display: inline-block; margin-right: 8px; vertical-align: middle; }
.tour-score b { font-size: 17px; }
@media (max-width: 640px) {
  .tour-card { flex-direction: column; align-items: stretch; }
  .tour-acts { justify-content: flex-start; }
  .tour-lb td, .tour-lb th { padding-left: 4px; padding-right: 4px; }
}
/* ---------- v2: акция ---------- */
.lob-promo { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--text);
  background: linear-gradient(135deg, color-mix(in srgb, var(--blue) 16%, var(--card)), var(--card) 70%); box-shadow: inset 0 0 0 1.5px var(--blue-tint), var(--shadow); }
.lob-promo-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lob-promo-text b { font-size: 17px; font-weight: 600; }
.lob-promo-text span { font-size: 13px; color: var(--muted); }
.lob-promo-prize { flex: none; font-weight: 700; font-size: 17px; color: var(--on-blue); background: var(--blue); padding: 8px 14px; border-radius: 999px; white-space: nowrap; }
#promoBody { display: grid; gap: 12px; }
.promo-hero { gap: 14px; }
.promo-prize { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 2px; }
.promo-prize b { font-size: 40px; font-weight: 700; letter-spacing: -.02em; color: var(--blue); line-height: 1.1; }
.promo-prize span { color: var(--muted); font-size: 13px; }
.promo-rules { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.5; }
.promo-rules li { margin-bottom: 4px; }
.promo-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.promo-stats > div { background: var(--fill); border-radius: 12px; padding: 8px 12px; display: flex; flex-direction: column; }
.promo-stats b { font-size: 18px; font-weight: 600; }
.promo-stats span { font-size: 12px; color: var(--muted); }
.promo-reason { margin: 0; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--orange-fill) 14%, transparent); color: var(--text); font-size: 14px; }
.promo-row { display: grid; grid-template-columns: 1fr auto 140px; gap: 10px; padding: 8px 0; border-top: .5px solid var(--sep); font-size: 14px; align-items: baseline; }
.promo-row > :last-child { text-align: right; }
.pst { font-weight: 600; } .pst.good { color: var(--green); } .pst.bad { color: var(--red); } .pst.warn { color: var(--orange); }
.payout-form { display: grid; gap: 10px; text-align: left; }
.payout-title { font-weight: 600; font-size: 15px; }
.payout-wallet { height: 42px; background: var(--fill); border: 0; border-radius: 10px; padding: 0 12px; font-size: 15px; outline: none; font-family: ui-monospace, 'SF Mono', Menlo, monospace; min-width: 0; }
.payout-wallet:focus { box-shadow: 0 0 0 2px var(--blue); }
.payout-msg { margin: 0; font-size: 13px; }
.payout-msg.err { color: var(--red); }
.payout-done { color: var(--green); font-weight: 600; font-size: 14px; }
.res-promo { margin: 0 0 14px; padding: 12px; border-radius: 14px; background: var(--fill); display: grid; gap: 10px; }
.res-promo p { margin: 0; font-size: 14px; }
.res-promo-score { display: flex; align-items: baseline; gap: 10px; }
.res-promo-score b { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.res-promo-score span { font-size: 13px; color: var(--muted); }
@media (max-width: 640px) {
  .lob-promo-prize { font-size: 15px; padding: 6px 10px; }
  .promo-row { grid-template-columns: 1fr auto auto; }
}
/* ---------- v2: вход ---------- */
.login-row { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.login-row > .muted { font-size: 13px; }
.login-box { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; min-height: 40px; }
.login-box:empty { display: none; }
.login-g, .login-tg, .login-apple { min-height: 40px; display: flex; align-items: center; }
/* Sign in with Apple: по правилам Apple — белая кнопка на тёмном фоне, чёрная на светлом */
.btn-apple { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; min-width: 200px; padding: 0 18px; border-radius: 20px;
  border: 1px solid #fff; background: #fff; color: #000; font: 500 15px/1 -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; cursor: pointer; }
.btn-apple:disabled { opacity: .6; cursor: default; }
.btn-apple svg { margin-top: -2px; }
:root[data-theme="light"] .btn-apple { background: #000; color: #fff; border-color: #000; }
@media (prefers-color-scheme: light) { :root[data-theme="auto"] .btn-apple { background: #000; color: #fff; border-color: #000; } }
.promo-hero .login-box { justify-content: center; }
.rp-q.q-best, .rp-q.q-excellent { color: var(--green); }
.rp-q.q-good { color: var(--muted); }
.rp-q.q-inacc { color: var(--q-inacc); } .rp-q.q-mistake { color: var(--q-mistake); } .rp-q.q-blunder { color: var(--q-blunder); }

/* ---------- Вход, регистрация, аккаунт ---------- */
.modal { position: relative; }
.modal-x { position: absolute; top: 14px; right: 14px; width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--fill); color: var(--muted); cursor: pointer; }
.modal-x:hover { background: var(--fill2); color: var(--text); }
.auth-modal, .account-modal { width: 100%; max-width: 420px; }
.auth-modal h2, .account-modal h2 { padding-right: 40px; }
.auth-tabs { margin: 14px 0 4px; }
.auth-providers { justify-content: center; margin-top: 14px; }
.auth-form { display: grid; gap: 12px; margin-top: 12px; }
.auth-form .field input, .account-modal .field input { width: 100%; font-family: inherit; color: var(--text); }
.fhint { font-size: 12.5px; color: var(--muted); }
.fhint.ok { color: var(--green); }
.fhint.bad, .form-err { color: var(--red); }
.form-err { margin: 0; font-size: 14px; line-height: 1.4; }
.small { font-size: 13px; margin: 0; }
.captcha { min-height: 65px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--blue); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.login-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.verify-banner { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: var(--blue-tint); font-size: 14px; line-height: 1.45; }
.verify-banner b { font-weight: 600; }
.me-gear { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--fill); color: var(--text); cursor: pointer; }
.me-gear:hover { background: var(--fill2); }
.ac-head { display: flex; align-items: center; gap: 12px; margin: 14px 0 6px; }
.ac-head > div { display: grid; gap: 2px; min-width: 0; }
.ac-head b { font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-head .muted { font-size: 13px; }
.ac-sec { display: grid; gap: 10px; padding: 14px 0; border-top: .5px solid var(--sep); }
.ac-sec:first-of-type { border-top: 0; }
.ac-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ac-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; font-size: 15px; }
.ac-row.wrap { justify-content: flex-start; flex-wrap: wrap; gap: 6px; }
.ac-row > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.ac-dev { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; }
.ac-dev > div { display: grid; gap: 2px; min-width: 0; font-size: 15px; }
.ac-dev .tag { justify-self: start; }
.ac-dev .muted { font-size: 13px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 999px; background: var(--fill); color: var(--text); font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.tag.good { background: rgba(52, 199, 89, .16); color: var(--green); }
.btn.danger { color: var(--red); }

/* ---------- Часы хода ---------- */
.pclock { position: relative; overflow: hidden; }
.pclock b { font-weight: inherit; }
.pclock i { display: none; }
/* время на ход: полоска убывает вместе со временем */
.pclock.move i { display: block; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: currentColor; opacity: .55;
  transform-origin: left center; transform: scaleX(var(--p, 1)); transition: transform .25s linear; }
.pclock.move:not(.run) { opacity: .55; }
.pclock.low.run { animation: clockLow 1s ease-in-out infinite; }
@keyframes clockLow { 50% { filter: brightness(1.25); } }
@media (prefers-reduced-motion: reduce) { .pclock.low.run { animation: none; } }
.pips.urgent { color: var(--red); font-weight: 600; }

/* ---------- Партия без подсказок: оценки нейросети — после партии ---------- */
/* рейтинговая партия: оценок нейросети до конца партии нет — их панелей и меток не видно вовсе */
#game.no-eval #probPanel,
#game.no-eval #statsPanel,
#game.no-eval .log-tools, #game.no-eval #logSummary,
#game.no-eval .wp { display: none !important; }

/* ---------- Сдача ---------- */
.btn.solid-danger { background: var(--red-fill); color: #fff; }
.btn.solid-danger:hover { filter: brightness(1.06); }
.resign-modal { width: 100%; max-width: 400px; }
.resign-modal .sub { margin-top: 8px; }

/* ---------- Вырез, строка состояния и полоска «домой» ----------
   viewport-fit=cover: страница рисуется под вырезом (телефон боком) и под строкой состояния (приложение с экрана «Домой»),
   поэтому отступы — не меньше безопасной области */
#joinScreen {
  padding-top: max(32px, env(safe-area-inset-top)); padding-bottom: max(48px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
}
.page {
  padding-top: max(20px, env(safe-area-inset-top)); padding-bottom: max(48px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
}
#game {
  padding-top: max(16px, env(safe-area-inset-top)); padding-bottom: max(16px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
}
@media (max-width: 640px) {
  #game {
    padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: max(16px, env(safe-area-inset-bottom));
    padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right));
  }
}

/* ---------- Телефон боком: доска во весь экран ---------- */
.panel-btn, .side-close { display: none !important; }
@media (orientation: landscape) and (max-height: 540px) {
  #game {
    --pt: max(4px, env(safe-area-inset-top)); --pb: max(4px, calc(env(safe-area-inset-bottom) - 12px));
    --pl: max(8px, env(safe-area-inset-left)); --pr: max(8px, env(safe-area-inset-right));
    --rail: 168px;
    height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; padding: var(--pt) var(--pr) var(--pb) var(--pl);
  }
  #game .layout { height: 100%; max-width: none; gap: 0; }
  #game .side { display: none; }
  #game .main {
    height: 100%; display: grid; gap: 6px 10px; align-items: stretch;
    grid-template-columns: auto minmax(var(--rail), 1fr); grid-template-rows: auto auto minmax(0, 1fr);
  }
  #game .board-wrap { grid-column: 1; grid-row: 1 / -1; align-self: center; width: auto; }
  /* доска — по высоте экрана (с полями под вырез и полоску «домой»), рейка справа — что останется */
  #game .board { width: min(calc((100dvh - var(--pt) - var(--pb)) * 1.5714), calc(100vw - var(--pl) - var(--pr) - var(--rail) - 10px)); }
  #game .game-tag { grid-column: 2; grid-row: 2; align-self: start; white-space: normal; font-size: 12px; }
  /* плашки игроков в рейке: имя и счёт, ниже — часы; у моей над ними — кнопки (в две колонки) */
  #game .pbar {
    max-width: none; width: auto; min-height: 0; padding: 8px 10px; gap: 6px 8px;
    display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "info score" "clk clk"; align-items: center;
  }
  #game .pbar .pinfo { grid-area: info; min-width: 0; gap: 8px; align-items: flex-start; }
  #game .pbar .ptext { overflow: hidden; }
  /* рейка узкая: имя переносится (до двух строк), а не обрезается */
  #game .pbar .pname { font-size: 13.5px; line-height: 1.2; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  #game .pbar .pmeta { font-size: 12px; line-height: 1.25; white-space: normal; align-items: flex-start; }
  #game .pbar .pmeta .conn { margin-top: 4px; }
  #game .pbar .chip { width: 22px; height: 22px; margin-top: 1px; }
  #game .pbar .pstatus, #game .pbar .wp { display: none; }
  /* статус хода («Ваш ход», «Ход завершается…») — над кнопками */
  #game #myBar .controls .status { display: block; grid-column: 1 / -1; justify-self: center; margin: 0 0 2px; max-width: 100%; }
  #game #myBar .controls .status:empty { display: none; }
  #game .pbar .pclock { grid-area: clk; justify-self: start; font-size: 16px; padding: 5px 8px; min-width: 56px; }
  #game .pbar .pscore { grid-area: score; align-self: start; margin: 0; }
  #game .score { font-size: 20px; }
  #game #oppBar { grid-column: 2; grid-row: 1; }
  #game #myBar { grid-column: 2; grid-row: 3; align-self: stretch; grid-template-rows: minmax(0, 1fr) auto auto; grid-template-areas: "ctl ctl" "info score" "clk clk"; }
  #game #myBar .controls { grid-area: ctl; align-self: stretch; display: grid; grid-template-columns: 1fr 1fr; align-content: start; gap: 6px; min-height: 0; overflow-y: auto; }
  #game #myBar .controls .btn { height: 32px; padding: 0 6px; font-size: 12.5px; width: 100%; min-width: 0; }
  #game #myBar .controls #abortBtn, #game #myBar .controls #claimBtn, #game #myBar .controls #rerollBtn { grid-column: 1 / -1; }
  .panel-btn { display: inline-flex !important; }
  /* панели — листом справа поверх доски */
  #game.side-open .side {
    display: flex; position: fixed; z-index: 1500; top: 0; right: 0; bottom: 0; width: min(380px, 72vw); max-height: none;
    padding: var(--pt) var(--pr) var(--pb) 12px; background: var(--bg); overflow-y: auto; box-shadow: var(--shadow-pop);
  }
  #game.side-open .side-close { display: inline-flex !important; align-self: flex-start; flex: none; }
  #game.replay .main { grid-template-rows: auto auto minmax(0, 1fr); }
}
.resign-modal .res-actions { margin-top: 18px; }
/* итоги: реванш и следующая партия */
.res-note { margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--blue-tint); color: var(--text); font-size: 14px; font-weight: 500; text-align: center; }
.side-top { display: flex; gap: 8px; align-items: center; flex: none; }
.side-top .btn { background: transparent; padding: 0 4px; }

/* ---------- Телефон стоя: доска вертикально, на всю высоту ----------
   Доска повёрнута на 90° по часовой: моя «голова», дом и лоток — внизу, у моей плашки; соперник — сверху.
   Длинная сторона (--vlong) считается в app.js по высоте окна и плашек. Надписи разворачиваются обратно. */
#game.vboard .board-wrap { position: relative; width: calc(var(--vlong, 560px) / 1.5714); height: var(--vlong, 560px); margin: 0 auto; flex: none; }
#game.vboard .board { position: absolute; left: 0; top: 0; width: var(--vlong, 560px); max-width: none; transform-origin: 0 0; transform: translateX(calc(var(--vlong, 560px) / 1.5714)) rotate(90deg); }
#game.vboard #boardSvg .b-labels text, #game.vboard #hintSvg text { transform-box: fill-box; transform-origin: center; transform: rotate(-90deg); }
#game.vboard #boardSvg .b-labels { font-size: 17px; }
#game.vboard .band .note, #game.vboard .band .btn { transform: rotate(-90deg); }
#game.vboard .dest-tag { transform: translateX(-50%) rotate(-90deg); }
#game.vboard .dest.tray .dest-tag { transform: rotate(-90deg); }
#game.vboard .peek-banner { top: 50%; transform: translate(-50%, -50%) rotate(-90deg); max-width: 60cqw; }
#game.vboard .pbar { max-width: var(--bw, 100%); }


/* =====================================================================================================
   Оболочка сайта: на компьютере — колонка разделов слева, на телефоне — панель вкладок снизу.
   В партии меню нет: доска на весь экран.
   ===================================================================================================== */
:root { --nav-w: 208px; --tab-h: 58px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.nav { position: fixed; z-index: 1500; display: flex; background: var(--nav-bg); }
body.in-game .nav { display: none; }
.nav a { -webkit-tap-highlight-color: transparent; }
.nav-item { position: relative; text-decoration: none; color: var(--text); }
.nav-badge { font-style: normal; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px; background: var(--red-fill); color: #fff;
  font-size: 11px; font-weight: 800; display: inline-grid; place-items: center; line-height: 1; font-family: var(--font-display); }
.nav-count { font-style: normal; font-size: 12px; font-weight: 700; color: var(--muted); }
.nav-count.live { color: var(--green); }
.me-ava.sm { width: 30px; height: 30px; font-size: 13px; }
.me-ava.lg { width: 48px; height: 48px; font-size: 20px; }
.me-ava.xl { width: 84px; height: 84px; font-size: 36px; }
.me-ava.anon { background: var(--fill2); color: var(--muted); }
.nav .me-ava { width: 28px; height: 28px; font-size: 13px; }
.nav .me-ava svg { width: 62%; height: 62%; }

@media (min-width: 900px) {
  .nav { top: 0; left: 0; bottom: 0; width: var(--nav-w); flex-direction: column; gap: 2px;
    padding: max(14px, env(safe-area-inset-top)) 10px max(12px, env(safe-area-inset-bottom)); overflow-y: auto; scrollbar-width: none; }
  body:not(.in-game) #app { padding-left: var(--nav-w); }
  .nav-brand { display: flex; align-items: center; gap: 10px; padding: 2px 10px 16px; color: var(--text); text-decoration: none;
    font-family: var(--font-display); font-weight: 900; font-size: 25px; letter-spacing: -.01em; }
  .nav-logo { width: 36px; height: 36px; flex: none; }
  .nav-item { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 10px; border-radius: 8px;
    font-family: var(--font-display); font-size: 17px; font-weight: 800; transition: background .12s; }
  .nav-item:hover { background: var(--fill); }
  .nav-item.on { background: var(--fill2); }
  .nav-item .ni { width: 28px; height: 28px; flex: none; }
  .nav-item .nav-badge, .nav-item .nav-count { margin-left: auto; }
  .nav-fill { flex: 1; min-height: 12px; }
  .nav-auth { display: grid; gap: 12px; padding: 4px 2px 12px; }
  .nav-auth .btn { width: 100%; height: 40px; }
  .nav-me.guest { display: none; }
  .nav-me { padding: 8px 10px; gap: 10px; min-height: 52px; }
  .nav-me .me-ava { width: 32px; height: 32px; font-size: 14px; border-radius: 6px; }
  .nav-me-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
  .nav-me-text b { font-size: 15px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-me-text small { color: var(--muted); font-family: Inter, -apple-system, sans-serif; font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-me-tab { display: none; }
  .nav-tools { display: grid; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--sep); }
  .nav-tool { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border: 0; border-radius: 8px; background: none;
    color: var(--muted); font: 600 14px/1 Inter, -apple-system, sans-serif; cursor: pointer; text-align: left; }
  .nav-tool:hover { background: var(--fill); color: var(--text); }
  .nav-tool svg { width: 20px; height: 20px; flex: none; }
  .m-top { display: none !important; }
  .page { padding: max(28px, env(safe-area-inset-top)) 32px 56px; }
}
/* планшет и узкое окно: меню — одни значки, доске больше места */
@media (min-width: 900px) and (max-width: 1180px) {
  :root { --nav-w: 76px; }
  .nav { padding-left: 10px; padding-right: 10px; align-items: stretch; }
  .nav-brand { justify-content: center; padding: 2px 0 16px; }
  .nav-brand span, .nav-item .nl, .nav-tool span, .nav-me-text, .nav-auth, .nav-item .nav-count { display: none !important; }
  .nav-item { justify-content: center; padding: 0; }
  .nav-item .nav-badge { position: absolute; top: 3px; right: 4px; margin: 0; }
  .nav-me.guest { display: flex; }
  .nav-tool { justify-content: center; padding: 0; }
}
@media (max-width: 899.98px) {
  .nav { left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
    padding: 0 max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left));
    border-top: 1px solid var(--sep); justify-content: space-around; }
  body:not(.in-game) #app { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }
  .nav-brand, .nav-wide, .nav-fill, .nav-me-text, .nav-count, .nav-auth, .nav-tools { display: none !important; }
  .nav-item { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--muted); font-family: var(--font-display); font-size: 11px; font-weight: 800; }
  .nav-item .ni { width: 26px; height: 26px; filter: grayscale(1) opacity(.5); transition: filter .15s; }
  .nav-item .nl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .nav-item.on { color: var(--text); }
  .nav-item.on .ni { filter: none; }
  .nav-item .nav-badge { position: absolute; top: 4px; left: calc(50% + 6px); }
  .nav-me .me-ava { width: 26px; height: 26px; font-size: 12px; border-radius: 6px; }
  .nav-me.on .me-ava { box-shadow: 0 0 0 2px var(--text); }
  .ch-stack { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 10px); }
  body.in-game .ch-stack { bottom: 12px; }
}

/* ---------- Шрифт заголовков и кнопок: плотный, округлый ---------- */
.ph h1, .pl-id h1, .brand h1, .modal h2, .empty-state h2, .box-head h2, .panel-head, .score, .res-score, .lp-sc, .tr-r,
.pname, .u-name, .conv-top b, .pc b, table.lb .rt, .seg i { font-family: var(--font-display); }
.ph h1, .pl-id h1, .brand h1, .modal h2 { font-weight: 900; letter-spacing: -.01em; }
.empty-state h2, .box-head h2, .panel-head, .score, .pname, .u-name, .conv-top b { font-weight: 800; }
.seg i { font-weight: 700; }
.seg input:checked + i { font-weight: 800; }
.me-ava { border-radius: 24%; }
/* флаг страны рядом с ником */
.flag { display: inline-block; width: 20px; height: 15px; margin: 0 0 0 7px; border-radius: 2px; vertical-align: -2px; object-fit: cover; box-shadow: 0 0 0 1px rgba(0, 0, 0, .18); flex: none; }
.flag.lg { width: 28px; height: 21px; margin-left: 10px; border-radius: 3px; vertical-align: 1px; }
.country-row { gap: 10px; }
.country-row .flag { margin: 0; }
.country-row select { flex: 1; min-width: 0; height: 40px; padding: 0 10px; border: 0; border-radius: 10px; background: var(--fill); color: var(--text); font: inherit; font-size: 15px; outline: none; }
.country-row select:focus { box-shadow: 0 0 0 2px var(--blue); }
.flag-none { width: 28px; height: 21px; border-radius: 3px; background: var(--fill2); flex: none; }
.pdot { border-radius: 50%; }

/* ---------- Страницы: заголовок и карточки ---------- */
.page.wide { max-width: 1200px; }
.ph { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; padding: 4px 2px 2px; }
.ph-text { min-width: 0; }
.ph h1 { margin: 0; font-size: 34px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.ph-sub { margin: 6px 0 0; color: var(--muted); font-size: 15px; line-height: 1.4; }
.ph-back { display: inline-block; font-size: 15px; text-decoration: none; margin-bottom: 6px; }
.box { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.box-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-width: 0; }
.box-head h2 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.box-sub { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.box-link { font-size: 15px; text-decoration: none; white-space: nowrap; flex: none; }
.box-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 15px; }
.seg-fixed { flex: none; width: 196px; }
.seg-fixed.wide { width: 272px; }
.box.lob-more { padding: 0; gap: 0; overflow: hidden; }
.box.lob-promo { display: flex; padding: 16px; }
.mini-list { display: grid; min-width: 0; }
.mini-empty { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.45; }
.mini-req { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; padding: 10px 12px; border-radius: 10px;
  background: var(--blue-tint); color: var(--blue); font-weight: 600; font-size: 14px; text-decoration: none; }
.mini-more { font-size: 14px; text-decoration: none; padding-top: 8px; }
.empty-state { text-align: center; padding: 48px 20px; display: grid; justify-items: center; gap: 10px; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); }
.empty-state h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.empty-state p { margin: 0; color: var(--muted); max-width: 440px; line-height: 1.45; }
.empty-state .btn { margin-top: 6px; }
.gw-ico { display: inline-flex; margin-bottom: 4px; }
.gw-ico .lc { width: 34px; height: 34px; }
.gw-acts { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

/* ---------- Главная: доска и панель «Играть» ---------- */
.play-page { max-width: 1340px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 24px 28px; display: grid; gap: 12px; }
.play-grid { display: grid; grid-template-columns: minmax(0, 1fr) 368px; gap: 24px; align-items: start; }
/* Главная: «о сайте» — для новых игроков и поисковиков; русский или английский по языку интерфейса, на остальных скрыт */
.play-hero { --hw: min(100%, calc((100dvh - 156px) * 1.5714)); display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.hero-board { width: var(--hw); aspect-ratio: 1100 / 700; border-radius: 2.2%; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .28)); }
.hero-board svg { display: block; width: 100%; height: 100%; }
.hero-bar { width: var(--hw); display: flex; align-items: center; gap: 10px; min-height: 42px; min-width: 0;
  font-family: var(--font-display); font-weight: 800; font-size: 16px; }
.hero-bar .me-ava { width: 36px; height: 36px; border-radius: 6px; font-size: 16px; }
.hero-bar > b, .hero-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-bar em { font-style: normal; color: var(--muted); font-weight: 700; }
.hero-name { display: flex; align-items: center; gap: 6px; }
.hero-name input { width: 170px; max-width: 46vw; height: 32px; padding: 0 8px; margin-left: -8px; border: 0; border-radius: 6px; background: transparent;
  font: inherit; color: var(--text); outline: none; transition: background .12s; }
.hero-name input:hover, .hero-name input:focus { background: var(--fill); }
.hero-name input::placeholder { color: var(--tertiary); }
.hero-name svg { width: 15px; height: 15px; color: var(--tertiary); flex: none; pointer-events: none; margin-left: -30px; }
.hero-name input:focus + svg { opacity: 0; }
.hero-clock { margin-left: auto; flex: none; min-width: 108px; height: 40px; padding: 0 12px; border-radius: 6px; background: var(--card); color: var(--muted);
  font: 700 25px/40px Inter, -apple-system, sans-serif; text-align: right; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.hero-clock.on { background: var(--text); color: var(--bg); }
.hero-board .hb-frame { fill: var(--b-frame); }
.hero-board .hb-surface { fill: var(--b-surface); }
.hero-board .hb-tray { fill: var(--b-tray); }
.hero-board .hb-bar { fill: var(--b-bar); }
.hero-board .tri-a { fill: var(--tri-a); }
.hero-board .tri-b { fill: var(--tri-b); }
.hero-board .hb-w { fill: url(#hbW); stroke: var(--pw-edge); stroke-width: 1.6; }
.hero-board .hb-b { fill: url(#hbB); stroke: var(--pb-edge); stroke-width: 1.6; }
.hero-board .hb-wr { fill: none; stroke: var(--pw-ring); stroke-width: 1.6; }
.hero-board .hb-br { fill: none; stroke: var(--pb-ring); stroke-width: 1.6; }
.hero-board .hb-die { fill: var(--die-face); stroke: var(--die-edge); stroke-width: 1.5; }
.hero-board .hb-pip { fill: var(--die-pip); }
/* партия на главной (heroDemo): шашки едут к новым местам, выброшенные — плашками в лотке, кубики выкатываются */
.hero-board .hb-men, .hero-board .hb-dice { transition: opacity .45s ease; }
.hero-board .hb-men.fade, .hero-board .hb-dice.fade { opacity: 0; }
.hero-board .hb-man { transition: transform .43s cubic-bezier(.3, .7, .3, 1); }
.hero-board.snap .hb-man { transition: none; }
.hero-board .hb-man circle, .hero-board .hb-man .hb-slab { transition: opacity .25s; }
.hero-board .hb-man .hb-slab, .hero-board .hb-man.off circle { opacity: 0; }
.hero-board .hb-man.off .hb-slab { opacity: 1; }
.hero-board .hb-d { transition: opacity .3s; }
.hero-board .hb-d.used { opacity: .4; }
.hero-board .hb-roll { transform-box: fill-box; transform-origin: center; animation: hb-roll .5s cubic-bezier(.2, .8, .3, 1.15); }
@keyframes hb-roll { from { transform: translateY(-40px) scale(.5) rotate(-150deg); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .hero-board .hb-roll { animation: none; } }
.hb-w1 { stop-color: var(--pw-1); } .hb-w2 { stop-color: var(--pw-2); }
.hb-b1 { stop-color: var(--pb-1); } .hb-b2 { stop-color: var(--pb-2); }

.play-panel { background: var(--card); border-radius: 12px; padding: 18px; display: flex; flex-direction: column;
  min-height: min(660px, calc(100dvh - 48px)); position: sticky; top: 20px; box-shadow: var(--shadow); }
.pp { display: flex; flex-direction: column; gap: 14px; flex: 1; min-height: 0; }
.pp-title { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 4px 0 8px;
  font-family: var(--font-display); font-weight: 900; font-size: 34px; letter-spacing: -.01em; line-height: 1.1; }
.pp-ico { width: 42px; height: 42px; flex: none; }
.quick-form { display: flex; flex-direction: column; gap: 14px; }
.tc-pick { display: flex; align-items: center; gap: 12px; width: 100%; height: 62px; padding: 0 14px 0 16px; border: 0; border-radius: 10px;
  background: var(--raised); box-shadow: 0 3px 0 var(--raised-edge); color: var(--text); cursor: pointer; text-align: left; transition: background .12s; }
.tc-pick:hover { background: var(--raised-hover); }
.tcp-ico { width: 30px; height: 30px; flex: none; }
.tcp-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.tcp-text b { font-family: var(--font-display); font-weight: 900; font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcp-text small { color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tcp-chev { width: 22px; height: 22px; color: var(--muted); flex: none; transition: transform .2s; }
.tc-pick[aria-expanded="true"] .tcp-chev { transform: rotate(180deg); }
.tc-menu { display: grid; gap: 12px; padding: 2px 0 4px; }
.tcm-group { display: grid; gap: 7px; }
.tcm-label { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--muted); }
.tcm-label svg { width: 18px; height: 18px; flex: none; }
.tcm-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tcm-row:has(.sm) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tcm { position: relative; min-width: 0; }
.tcm input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tcm span { display: grid; place-items: center; height: 44px; border-radius: 8px; background: var(--raised); box-shadow: 0 2px 0 var(--raised-edge);
  font-family: var(--font-display); font-weight: 800; font-size: 17px; cursor: pointer; white-space: nowrap; transition: background .12s; }
.tcm span:hover { background: var(--raised-hover); }
.tcm input:checked + span { background: var(--raised-hover); box-shadow: inset 0 0 0 2px var(--go-hi), 0 2px 0 var(--raised-edge); }
.tcm input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.tcm-rated { justify-content: space-between; padding: 2px 2px 0; font-size: 14px; color: var(--text); }
.tcm-note { margin: 0; font-size: 13px; color: var(--muted); }
.pp-rows { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 8px; }
.pp-row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 62px; padding: 8px 16px; border: 0; border-radius: 10px;
  background: var(--raised); box-shadow: 0 3px 0 var(--raised-edge); color: var(--text); text-decoration: none; cursor: pointer; text-align: left;
  transition: background .12s, transform .08s, box-shadow .08s; font: inherit; }
.pp-row:hover { background: var(--raised-hover); }
.pp-row:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--raised-edge); }
.ppr-ico { width: 36px; height: 36px; flex: none; }
.ppr-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.ppr-text b { font-family: var(--font-display); font-weight: 900; font-size: 18px; }
.ppr-text small { color: var(--muted); font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ppr-text small:empty { display: none; }
.pp-row .lob-badge { margin-left: 0; }
.pp-row.promo { box-shadow: inset 0 0 0 2px var(--yellow-fill), 0 3px 0 var(--raised-edge); }
.pp-prize { font-style: normal; font-family: var(--font-display); font-weight: 900; color: var(--yellow); white-space: nowrap; }
.pp-foot { margin-top: auto; padding-top: 16px; display: flex; justify-content: center; gap: 8px 20px; flex-wrap: wrap; }
.pp-stat { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 600; }
.pp-stat b { color: var(--text); font-family: var(--font-display); font-weight: 900; font-size: 16px; }
.pp-stat:hover { color: var(--text); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green-fill); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green-fill) 28%, transparent); flex: none; }
.pp-head { display: flex; align-items: center; gap: 4px; margin: -4px 0 2px -6px; }
.pp-head h2 { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 32px 0 0;
  font-family: var(--font-display); font-weight: 900; font-size: 24px; }
.pp-head .pp-ico { width: 32px; height: 32px; }
.pp-back { width: 38px; height: 38px; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; flex: none; }
.pp-back:hover { background: var(--fill); color: var(--text); }
.pp-back svg { width: 22px; height: 22px; }
.pp-form { display: flex; flex-direction: column; gap: 12px; flex: 1; }
.pp-form > .btn.xl { margin-top: auto; }
.lvl-list { display: grid; gap: 6px; }
.lvl { display: flex; align-items: center; gap: 12px; padding: 7px 12px 7px 8px; border-radius: 10px; background: var(--card2); cursor: pointer; position: relative; transition: background .12s, box-shadow .12s; }
.lvl:hover { background: var(--raised); }
.lvl input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.lvl-ava { width: 42px; height: 42px; flex: none; border-radius: 8px; padding: 4px; background: color-mix(in srgb, var(--lv) 20%, transparent); }
.lvl-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.lvl-text b { font-family: var(--font-display); font-weight: 900; font-size: 16px; }
.lvl-text small { color: var(--muted); font-size: 12.5px; }
.lvl:has(input:checked) { background: var(--raised-hover); box-shadow: inset 0 0 0 2px var(--lv); }
.lvl:has(input:focus-visible) { outline: 2px solid var(--blue); outline-offset: 2px; }
.pp-more { border-radius: 10px; background: var(--card2); }
.pp-more summary { display: flex; align-items: center; gap: 10px; padding: 12px 14px; cursor: pointer; list-style: none; font-family: var(--font-display); font-weight: 800; font-size: 15px; }
.pp-more summary::-webkit-details-marker { display: none; }
.pp-more summary small { flex: 1; min-width: 0; text-align: right; color: var(--muted); font: 600 12.5px/1.3 Inter, -apple-system, sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-more .tcp-chev { width: 18px; height: 18px; }
.pp-more[open] summary .tcp-chev { transform: rotate(180deg); }
.pp-more .lrows { padding: 0 14px 10px; }
.pp-or { display: flex; align-items: center; gap: 12px; color: var(--tertiary); font-size: 13px; }
.pp-or::before, .pp-or::after { content: ''; flex: 1; height: 1px; background: var(--sep); }
.pp-note { margin: 0; font-size: 13px; color: var(--muted); text-align: center; line-height: 1.45; }
.play-panel .code-row { margin: 0; padding: 0; border: 0; }
.play-panel .code-row input { height: 44px; background: var(--card2); }
.play-panel .code-row .btn { height: 44px; }
/* шапка главной на телефоне: логотип, язык, оформление, правила */
.m-top { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.m-brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-family: var(--font-display); font-weight: 900; font-size: 23px; margin-right: auto; }
.m-brand svg { width: 32px; height: 32px; }
.m-tools { display: flex; gap: 4px; }
.m-tool { height: 38px; min-width: 38px; padding: 0 9px; border: 0; border-radius: 9px; background: var(--fill); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 5px; cursor: pointer; }
.m-tool svg { width: 20px; height: 20px; }
.m-tool b { font: 800 12px/1 var(--font-display); letter-spacing: .03em; color: var(--text); }
/* выбор языка */
.lang-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.lang-opt { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 48px; padding: 0 14px; border: 0; border-radius: 10px;
  background: var(--raised); box-shadow: 0 2px 0 var(--raised-edge); color: var(--text); font: 800 16px/1 var(--font-display); cursor: pointer; text-align: left; }
.lang-opt:hover { background: var(--raised-hover); }
.lang-opt small { color: var(--muted); font: 600 11px/1 Inter, -apple-system, sans-serif; text-transform: uppercase; letter-spacing: .04em; }
.lang-opt.on { box-shadow: inset 0 0 0 2px var(--go-hi), 0 2px 0 var(--raised-edge); }

@media (max-width: 1180px) {
  .play-grid { grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; }
  .play-page { padding-left: 18px; padding-right: 18px; }
}
@media (max-width: 899.98px) {
  .play-page { padding: max(10px, env(safe-area-inset-top)) 12px 16px; gap: 10px; }
  .play-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .play-hero { --hw: 100%; gap: 6px; }
  .hero-bar { min-height: 34px; font-size: 15px; }
  .hero-bar .me-ava { width: 30px; height: 30px; font-size: 14px; }
  .hero-clock { min-width: 84px; height: 32px; font-size: 19px; line-height: 32px; }
  .play-panel { position: static; min-height: 0; padding: 14px; }
  .pp-title { display: none; }
  .pp-foot { padding-top: 10px; }
}
@media (max-width: 899.98px) and (max-height: 760px) {
  .play-hero .hero-bar { display: none; }
}
@media (max-width: 420px) {
  .tcp-text b { font-size: 19px; }
  .btn.xl { height: 58px; font-size: 23px; }
  .pp-row { min-height: 56px; }
  .lang-list { grid-template-columns: minmax(0, 1fr); }
}

.check.mini { font-size: 13px; color: var(--muted); gap: 8px; min-height: 26px; flex: none; }
.check.mini .sw { width: 40px; height: 24px; }
.check.mini .sw::after { width: 20px; height: 20px; }
.check.mini input:checked + .sw::after { transform: translateX(16px); }
.level-seg i { font-size: 12.5px; }
.code-row { display: flex; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: .5px solid var(--sep); }
.code-row input { flex: 1; min-width: 0; height: 40px; background: var(--fill); border: 0; border-radius: 10px; padding: 0 12px; font-size: 15px; outline: none; color: var(--text); }
.code-row input:focus { box-shadow: 0 0 0 2px var(--blue); }
.code-row input::placeholder { color: var(--tertiary); }
/* карточка аккаунта */
.me-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.me-box .me-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.me-n { font-size: 17px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-s { font-size: 13px; color: var(--muted); }
.me-s b { color: var(--text); font-weight: 600; }
.me-pools { display: flex; gap: 6px; flex-wrap: wrap; }
.me-pools span { background: var(--fill); border-radius: 8px; padding: 4px 9px; font-size: 12px; color: var(--muted); }
.me-pools b { color: var(--text); margin-right: 5px; font-size: 14px; font-weight: 600; }
.me-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.me-acts .btn { flex: 1 1 auto; }
.me-acts.two .btn { flex: 1 1 0; }
.me-note { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.guest-name { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 15px; min-height: 44px; border-top: .5px solid var(--sep); border-bottom: .5px solid var(--sep); }
.guest-name input { flex: 1; min-width: 0; height: 36px; border: 0; background: transparent; text-align: right; font-size: 16px; outline: none; color: var(--text); }
.guest-name input::placeholder { color: var(--tertiary); }
/* строки игроков: друзья, поиск, заявки */
.urow { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: .5px solid var(--sep); min-width: 0; }
.urow:first-child, .mini-req + .urow { border-top: 0; }
.urow.sm { padding: 7px 0; gap: 10px; }
.u-ava { position: relative; flex: none; display: block; text-decoration: none; }
.pdot { position: absolute; right: -2px; bottom: -2px; width: 13px; height: 13px; border-radius: 50%; border: 2.5px solid var(--card); display: none; }
.pdot.on { display: block; background: var(--green-fill); }
.pdot.busy { display: block; background: var(--orange-fill); }
.u-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.u-name { color: var(--text); text-decoration: none; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.u-name:hover { color: var(--blue); }
.u-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-act { flex: none; display: flex; gap: 6px; align-items: center; }
.u-act .btn svg, .pl-actions .btn svg { margin-right: 1px; }
.u-note { font-size: 13px; color: var(--muted); }
.ibtn { width: 34px; height: 34px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--fill); color: var(--blue); cursor: pointer; text-decoration: none; flex: none; font-size: 12px; }
.ibtn:hover { background: var(--fill2); }
.ibtn.on { background: var(--blue); color: var(--on-blue); }
/* идущие партии: мини-доска */
.mini-board { display: block; width: 100%; height: auto; }
.mb-frame { fill: var(--b-frame); }
.mb-field { fill: var(--b-surface); }
.mb-bar { fill: var(--b-bar); }
.mb-ta { fill: var(--tri-a); }
.mb-tb { fill: var(--tri-b); }
.mb-w { fill: var(--pw-1); stroke: var(--pw-edge); stroke-width: 1; }
.mb-b { fill: var(--pb-2); stroke: var(--pb-edge); stroke-width: 1; }
/* «Смотреть»: шашка, которой только что пошли, — обводка до следующего хода за этим столом. Без анимации: вспышка
   толщины/цвета обводки перерисовывала SVG каждый кадр — на 24 живых столах ~18 % процессора, статичная — ~3 % */
.mini-board .hot { stroke: var(--acc); stroke-width: 3px; }
text.mb-n { font: 700 10px -apple-system, BlinkMacSystemFont, Inter, sans-serif; text-anchor: middle; stroke: none; }
text.mb-n.mb-w { fill: #1C1C1E; }
text.mb-n.mb-b { fill: #FFFFFF; }
.mb-die { fill: #FFFFFF; stroke: rgba(0, 0, 0, .28); stroke-width: .8; }
.mb-dv { font: 700 11px -apple-system, BlinkMacSystemFont, Inter, sans-serif; fill: #1C1C1E; text-anchor: middle; }
.mb-off { font: 600 11px -apple-system, BlinkMacSystemFont, Inter, sans-serif; fill: var(--muted); text-anchor: middle; }
.live-row { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 12px; align-items: center; padding: 9px 0; border-top: .5px solid var(--sep); color: var(--text); text-decoration: none; }
.live-row:first-child { border-top: 0; }
.live-row .mini-board { border-radius: 6px; }
.live-row:hover .lp b { color: var(--blue); }
.lr-text, .lc-names { display: grid; gap: 3px; min-width: 0; }
.lp { display: flex; align-items: center; gap: 6px; font-size: 14px; min-width: 0; }
.lp b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lp em { font-style: normal; color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.lp-sc { margin-left: auto; font-weight: 700; font-size: 15px; padding-left: 6px; }
.lp.turn .chip-s { box-shadow: 0 0 0 2px var(--green-fill); }
.lp-fr { font-size: 11px; font-weight: 600; color: var(--blue); background: var(--blue-tint); border-radius: 6px; padding: 1px 6px; flex: none; }
.chip-s { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.chip-s.white { background: var(--pw-1); box-shadow: inset 0 0 0 1px var(--pw-edge); }
.chip-s.black { background: var(--pb-2); box-shadow: inset 0 0 0 1px var(--pb-edge); }
.lp.turn .chip-s.white { box-shadow: inset 0 0 0 1px var(--pw-edge), 0 0 0 2px var(--green-fill); }
.lp.turn .chip-s.black { box-shadow: inset 0 0 0 1px var(--pb-edge), 0 0 0 2px var(--green-fill); }
.lr-meta, .lc-meta { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.lm-eye { display: inline-flex; align-items: center; gap: 3px; }
.lm-eye svg { width: 13px; height: 13px; }
.top-row { display: flex; align-items: center; gap: 10px; padding: 7px 6px; margin: 0 -6px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: 15px; min-width: 0; }
.top-row:hover { background: var(--fill); }
.top-row b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.top-row small { color: var(--muted); font-size: 12px; white-space: nowrap; }
.tr-n { width: 18px; color: var(--muted); font-size: 13px; text-align: right; flex: none; }
.tr-r { margin-left: auto; font-weight: 600; padding-left: 6px; }
.top-row.me { background: var(--blue-tint); }
.rec-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) auto auto 34px; gap: 10px; align-items: center; padding: 8px 0; border-top: .5px solid var(--sep); font-size: 15px; }
.rec-row:first-child { border-top: 0; }
.rec-row .res { font-weight: 600; }
.rec-row .res.w { color: var(--green); }
.rec-row .res.l { color: var(--red); }
.rec-vs { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-vs a { color: var(--text); text-decoration: none; font-weight: 500; }
.rec-vs small { color: var(--muted); margin-left: 8px; font-size: 12px; }
.rec-sc { font-weight: 600; }
/* «Смотреть» */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.live-grid:empty { display: none; }
.live-card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 12px; display: grid; gap: 10px; color: var(--text); text-decoration: none; transition: transform .15s, box-shadow .15s; }
.live-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); }
.live-card .mini-board { border-radius: 8px; }
/* «Друзья» */
.friends-body { display: grid; gap: 14px; }
.search-box { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 12px; box-shadow: var(--shadow); padding: 0 14px; height: 48px; color: var(--muted); }
.search-box input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: 17px; outline: none; color: var(--text); height: 100%; }
.search-box:focus-within { box-shadow: 0 0 0 2px var(--blue), var(--shadow); }
/* «Сообщения» */
.msg-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; height: calc(100dvh - 84px); min-height: 440px; }
.msg-side { display: flex; flex-direction: column; min-height: 0; min-width: 0; gap: 12px; }
.conv-list { flex: 1; min-width: 0; overflow-y: auto; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.conv-list .mini-empty { padding: 12px 10px; }
.conv { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; color: var(--text); text-decoration: none; flex: none; min-width: 0; }
.conv:hover { background: var(--fill); }
.conv.on { background: var(--blue-tint); }
.conv .pdot { border-color: var(--card); }
.conv-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.conv-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.conv-top b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-top time { color: var(--muted); font-size: 12px; flex: none; }
.conv-last { font-size: 13.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv.unread .conv-last { color: var(--text); font-weight: 500; }
.conv-sep { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; padding: 14px 10px 6px; }
.msg-main { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: .5px solid var(--sep); }
.thread-back { display: none; font-size: 32px; line-height: .8; text-decoration: none; padding: 0 8px 4px 0; }
.thread { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; overscroll-behavior: contain; }
.thread > .mini-empty { margin: auto; }
.thread-empty { margin: auto; text-align: center; color: var(--muted); display: grid; justify-items: center; gap: 8px; max-width: 300px; }
.thread-empty svg { width: 40px; height: 40px; opacity: .45; }
.thread-empty p { margin: 0; line-height: 1.45; }
.day-sep { text-align: center; font-size: 12px; color: var(--muted); margin: 10px 0 4px; font-weight: 500; }
.bub { max-width: min(520px, 80%); padding: 8px 12px 6px; border-radius: 18px; display: flex; flex-direction: column; gap: 2px; }
.bub p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.4; }
.bub time { font-size: 11px; opacity: .72; align-self: flex-end; }
.bub.mine { align-self: flex-end; background: var(--blue); color: var(--on-blue); border-bottom-right-radius: 6px; }
.bub.theirs { align-self: flex-start; background: var(--fill); color: var(--text); border-bottom-left-radius: 6px; }
.thread-more { align-self: center; margin-bottom: 6px; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: .5px solid var(--sep); }
.composer textarea { flex: 1; min-width: 0; resize: none; border: 0; border-radius: 19px; background: var(--fill); padding: 9px 14px; font: inherit; font-size: 16px; line-height: 1.3;
  max-height: 140px; outline: none; color: var(--text); }
.composer textarea:focus { box-shadow: 0 0 0 2px var(--blue); }
.composer-send { width: 38px; height: 38px; padding: 0; flex: none; }
.composer-note { margin: 0; padding: 12px 16px; border-top: .5px solid var(--sep); font-size: 14px; color: var(--muted); }
/* профиль */
.pl-head { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 14px 18px; padding: 4px 0; }
.pl-id { min-width: 0; }
.pl-id h1 { margin: 0; font-size: 30px; font-weight: 700; letter-spacing: -.02em; overflow-wrap: anywhere; line-height: 1.15; }
.pl-id .ph-sub { margin-top: 4px; }
.st-on { color: var(--green); font-weight: 600; }
.st-play { color: var(--orange); font-weight: 600; }
.pl-head .pl-actions { grid-column: 1 / -1; justify-content: flex-start; }
/* зритель */
.spect-bar { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 12px; border-radius: 12px; background: var(--blue-tint); color: var(--blue); font-weight: 600; font-size: 14px; flex: none; }
.spect-bar span { flex: 1; min-width: 0; }
.spect-bar .btn { background: var(--card); }
#game.spectating #undoBtn, #game.spectating .panel.chat, #game.spectating #reportBtn,
#game.spectating #nextBtn, #game.spectating #declineBtn, #game.spectating #resMatchBtn, #game.spectating #resNote { display: none !important; }
#game.spectating .board { cursor: default; }
.gi-watch { display: inline-flex; align-items: center; gap: 4px; }
.toast.link.show { pointer-events: auto; cursor: pointer; }
.field .opt { font-style: normal; color: var(--tertiary); }

@media (max-width: 899.98px) {
  .page { padding-top: max(16px, env(safe-area-inset-top)); }
  .ph h1 { font-size: 30px; }
  .msg-layout { grid-template-columns: minmax(0, 1fr); height: calc(100dvh - var(--tab-h) - env(safe-area-inset-bottom) - max(16px, env(safe-area-inset-top)) - 20px); min-height: 360px; }
  .msg-layout.thread-open .msg-side { display: none; }
  .msg-layout:not(.thread-open) .msg-main { display: none; }
  .msg-page { padding-bottom: 12px; }
  .thread-back { display: block; }
  .thread-head { padding: 8px 12px; }
}
@media (max-width: 560px) {
  .ph h1 { font-size: 28px; }
  .ph-sub { font-size: 14px; }
  .seg-fixed { width: 168px; }
  .seg-fixed.wide { width: 210px; }
  .seg-fixed.wide i { font-size: 12px; }
  .friends-body .urow, #searchList .urow { flex-wrap: wrap; }
  .friends-body .u-act { width: 100%; padding-left: 52px; flex-wrap: wrap; }
  .rec-row { grid-template-columns: 76px minmax(0, 1fr) auto 34px; }
  .rec-row .gain { display: none; }
  .pl-head { gap: 12px 14px; }
  .me-ava.xl { width: 64px; height: 64px; font-size: 28px; }
  .pl-id h1 { font-size: 26px; }
  .live-grid { grid-template-columns: 1fr; }
  .thread-head .u-act .btn { width: 36px; padding: 0; }
  .thread-head .u-act .btn .bt { display: none; }
}


/* ---------- Окна: оформление, правила, язык (на телефоне — лист снизу) ---------- */
.set-modal { width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 12px; position: relative; }
.set-modal h2 { font-size: 26px; padding-right: 36px; }
.set-modal .sub { margin: -6px 0 2px; font-size: 14px; }
.look-rows .theme-row { margin: 0; padding: 10px 0; background: none; box-shadow: none; border-radius: 0; border-top: .5px solid var(--sep); }
.look-rows .theme-row:first-child { border-top: 0; }
.set-modal .rules-body ul { margin: 0; padding-left: 18px; line-height: 1.5; color: var(--text); font-size: 15px; }
.set-modal .rules-body li { margin-bottom: 8px; }
@media (min-width: 900px) { .mob-only { display: none !important; } }
@media (max-width: 560px) {
  .overlay:has(> .set-modal) { place-items: end stretch; padding: 0; }
  .set-modal { max-width: none; border-radius: 22px 22px 0 0; padding-bottom: max(22px, env(safe-area-inset-bottom)); max-height: 92dvh; animation: sheet .28s cubic-bezier(.2, .9, .3, 1); }
  @keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
}

/* ---------- Задачи (/puzzle): экран партии в режиме задачи — без плашек игроков, часов, счёта, сдачи и чата ----------
   Панель задачи (app.js, renderPuzzle) — в колонке справа на широком экране, под доской — на узком, в рейке — телефон боком. */
#game.puzzle-mode #oppBar, #game.puzzle-mode #myBar, #game.puzzle-mode #gameTag, #game.puzzle-mode .side > .panel,
#game.puzzle-mode #spectBar, #game.puzzle-mode #watchBack { display: none !important; }
@media (max-width: 1000px) { #game.puzzle-mode .side { display: none !important; } }
.puzzle-box {
  width: var(--bw, 100%); max-width: 100%; box-sizing: border-box; margin: 2px auto 0; padding: 16px; border-radius: var(--r);
  background: var(--card); box-shadow: var(--shadow); display: grid; gap: 12px; line-height: 1.4; font-size: 15px;
}
.side .puzzle-box { width: 100%; margin: 0; }
.pz-head { display: flex; align-items: center; gap: 8px; min-width: 0; font-family: var(--font-display); font-size: 19px; font-weight: 900; }
.pz-ico { width: 24px; height: 24px; flex: none; }
.pz-chip { font: 700 12px/1 Inter, -apple-system, sans-serif; padding: 5px 9px; border-radius: 999px; background: var(--fill2); color: var(--muted); white-space: nowrap; }
.pz-chip.review { background: var(--blue-tint); color: var(--text); }
.pz-rate.fixed { color: var(--green); font-weight: 600; }
.pz-num { margin-left: auto; color: var(--muted); font: 600 13px/1.2 Inter, -apple-system, sans-serif; white-space: nowrap; }
.pz-task { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; background: var(--fill); }
.pz-task .chip { width: 30px; height: 30px; }
.pz-task-t { display: grid; gap: 1px; min-width: 0; flex: 1; }
.pz-task-t b { font-family: var(--font-display); font-size: 18px; font-weight: 900; }
.pz-task-t span { color: var(--muted); font-size: 14px; }
.pz-dice { display: flex; gap: 6px; flex: none; }
.pz-die { width: 34px; height: 34px; display: block; }
.pz-die rect { fill: #F8F5EE; stroke: rgba(0, 0, 0, .28); stroke-width: 1; }
.pz-die circle { fill: #1E2024; }
.pz-pips { color: var(--muted); font-size: 13.5px; margin-top: -4px; }
.pz-hint { font-size: 14px; color: var(--muted); }
.pz-hint.go { color: var(--text); font-weight: 600; }
.pz-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.pz-acts .btn { flex: 1 1 auto; height: 40px; padding: 0 14px; }
.pz-acts .pz-check { flex-grow: 2; }
.pz-check:not(:disabled) { animation: pzReady 1.8s ease-in-out infinite; }
@keyframes pzReady { 50% { filter: brightness(1.13); } }
@media (prefers-reduced-motion: reduce) { .pz-check:not(:disabled) { animation: none; } }
.pz-link { justify-self: start; border: 0; background: none; padding: 0; color: var(--muted); font: 600 13.5px/1.3 Inter, -apple-system, sans-serif; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--tertiary); }
.pz-link:hover { color: var(--text); }
.pz-verdict { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 12px; font-family: var(--font-display); font-size: 18px; font-weight: 900; }
.pz-verdict::before { display: grid; place-items: center; width: 26px; height: 26px; flex: none; border-radius: 50%; color: #fff; font: 900 15px/1 Inter, -apple-system, sans-serif; }
.pz-verdict.ok { background: rgba(76, 184, 106, .15); }
.pz-verdict.ok::before { content: '✓'; background: var(--green-fill); }
.pz-verdict.bad { background: rgba(229, 72, 59, .13); }
.pz-verdict.bad::before { content: '✕'; background: var(--red-fill); }
.pz-verdict.shown { background: var(--fill); }
.pz-verdict.shown::before { content: '→'; background: var(--fill2); color: var(--text); }
.pz-q { margin-left: auto; font: 700 12px/1 Inter, -apple-system, sans-serif; padding: 5px 9px; border-radius: 999px; color: #fff; background: var(--fill2); }
.pz-q.inacc { background: var(--q-inacc-fill); color: var(--q-inacc-on); }
.pz-q.mistake { background: var(--q-mistake-fill); color: var(--q-mistake-on); }
.pz-q.blunder { background: var(--q-blunder-fill); color: var(--q-blunder-on); }
.pz-line { font-size: 14.5px; }
.pz-mv { font-variant-numeric: tabular-nums; font-weight: 700; }
.pz-rate { font-size: 14.5px; color: var(--muted); }
.pz-rate b { color: var(--text); font-size: 16px; }
.puzzle-box em.up, .puzzle-box em.down { font-style: normal; font-weight: 800; }
.puzzle-box em.up { color: var(--green); }
.puzzle-box em.down { color: var(--red); }
.pz-sec { font: 700 11.5px/1.2 Inter, -apple-system, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: -4px; }
.pz-opts { display: grid; gap: 4px; }
.pz-opt {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px;
  border: 0; border-radius: 9px; background: var(--fill); color: var(--text); text-align: left; cursor: pointer; font-size: 14.5px;
}
.pz-opt:hover { background: var(--fill2); }
.pz-opt .pz-mv { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.pz-opt .pz-tag { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.pz-opt .pz-win { font-weight: 800; font-variant-numeric: tabular-nums; }
.pz-opt.best { box-shadow: inset 3px 0 0 var(--green-fill); }
.pz-opt.best .pz-win { color: var(--green); }
.pz-opt.mine:not(.best) { box-shadow: inset 3px 0 0 var(--red-fill); }
.pz-opt.sel { background: var(--fill2); outline: 1.5px solid var(--tertiary); outline-offset: -1.5px; }
.pz-why table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pz-why th { font: 700 12px/1.2 Inter, -apple-system, sans-serif; color: var(--muted); text-align: right; padding: 8px 0 6px 10px; white-space: nowrap; }
.pz-why td { padding: 7px 0 7px 10px; border-top: 1px solid var(--sep); text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; vertical-align: top; }
.pz-why td:first-child { text-align: left; padding-left: 0; color: var(--muted); font-weight: 500; white-space: normal; }
.pz-why .b { color: var(--green); }
.pz-vote { display: flex; align-items: center; gap: 2px; color: var(--muted); font-size: 13.5px; }
.pz-vote span { margin-right: auto; }
.pz-vote svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pz-vote .dn svg { transform: rotate(180deg); }
.pz-vote .on { color: var(--blue); background: var(--blue-tint); }
.pz-src { font-size: 13.5px; color: var(--muted); }
.pz-ctx { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14.5px; }
.pz-ctx .chip { width: 20px; height: 20px; }
.pz-ctx .pz-dice { margin-left: 2px; gap: 4px; }
.pz-ctx .pz-die { width: 24px; height: 24px; }
.pz-me { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid var(--sep); }
.pz-me-r { display: flex; align-items: baseline; gap: 8px; }
.pz-me-r span { color: var(--muted); font-size: 14px; }
.pz-me-r b { font-family: var(--font-display); font-size: 22px; font-weight: 900; }
.pz-me-s { color: var(--muted); font-size: 13px; }
.pz-hist { display: flex; flex-wrap: wrap; gap: 4px; }
.pz-hist a { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; font: 800 13px/1 Inter, -apple-system, sans-serif; text-decoration: none; color: #fff; }
.pz-hist a.ok { background: var(--green-fill); }
.pz-hist a.bad { background: var(--red-fill); }
.pz-prefs { display: grid; gap: 8px; }
.pz-prefs-t { font: 700 11.5px/1.2 Inter, -apple-system, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.pz-prefs select { height: 36px; border: 0; border-radius: 9px; background: var(--fill); padding: 0 10px; font-size: 14px; color: var(--text); }
.pz-prefs select option { background: var(--card); color: var(--text); }
.pz-note { font-size: 13.5px; padding: 8px 10px; border-radius: 9px; background: var(--blue-tint); }
.pz-empty { font-size: 15px; }
.pz-lobby { justify-self: start; font-size: 14px; color: var(--muted); text-decoration: none; }
/* стрелки задачи на доске: лучший ход — зелёный, сыгранный — красный, другие варианты — акцент */
#hintSvg .pz-arr { fill: none; stroke-width: 8; stroke-linecap: round; stroke-linejoin: round; opacity: .92; animation: hintIn .35s ease-out; }
#hintSvg .pz-arr.pz-b { stroke: var(--green-fill); }
#hintSvg .pz-arr.pz-m { stroke: var(--red-fill); }
#hintSvg .pz-arr.pz-a { stroke: var(--blue); }
#hintSvg marker.pz-b path, #hintSvg .pz-way.pz-b, #hintSvg .pz-cntbg.pz-b { fill: var(--green-fill); }
#hintSvg marker.pz-m path, #hintSvg .pz-way.pz-m, #hintSvg .pz-cntbg.pz-m { fill: var(--red-fill); }
#hintSvg marker.pz-a path, #hintSvg .pz-way.pz-a, #hintSvg .pz-cntbg.pz-a { fill: var(--blue); }
#hintSvg .pz-way, #hintSvg .pz-cntbg { stroke: var(--card); stroke-width: 2.5; }
#hintSvg .pz-cnt { fill: #fff; font: 800 17px Inter, -apple-system, sans-serif; text-anchor: middle; dominant-baseline: central; }
@media (max-width: 640px) {
  .puzzle-box { padding: 14px 12px; gap: 10px; }
  .pz-task { padding: 10px; }
  .pz-die { width: 30px; height: 30px; }
}
/* телефон боком: панель — в рейке справа от доски, со своей прокруткой */
@media (orientation: landscape) and (max-height: 540px) {
  #game.puzzle-mode .puzzle-box { grid-column: 2; grid-row: 1 / -1; width: auto; margin: 0; align-self: stretch; overflow-y: auto; padding: 12px; gap: 10px; }
}

/* «Готово»: ход сыгран, игрок с настройкой «Завершать ход кнопкой» подтверждает его сам */
#endBtn { animation: endIn .25s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes endIn { from { transform: scale(.85); opacity: 0; } }

/* ---------- Оформление: подпись над переключателем, переключатель во всю ширину (на компьютере было тесно) ---------- */
.look-rows .theme-row { flex-direction: column; align-items: stretch; gap: 8px; padding: 14px 0; }
.look-rows .theme-row > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.look-rows .theme-row .seg { width: 100%; }
.look-rows .seg i { height: 36px; padding: 0 10px; font-size: 14px; gap: 8px; }
.look-rows .seg .pal { width: 16px; height: 16px; }

/* ---------- Смотреть: порядок и страницы ---------- */
.watch-tools { display: flex; justify-content: flex-end; align-items: center; gap: 12px; flex-wrap: wrap; margin: -4px 0 0; }
.watch-tools.hidden { display: none; }
.pager { display: flex; justify-content: center; align-items: center; gap: 4px; flex-wrap: wrap; padding: 8px 0 4px; }
.pager button { min-width: 36px; height: 36px; padding: 0 10px; border: 0; border-radius: 10px; background: var(--card); color: var(--text); box-shadow: var(--shadow);
  font: 600 14px/1 var(--font-display, inherit); cursor: pointer; display: grid; place-items: center; }
.pager button:hover:not(:disabled):not(.on) { background: var(--fill2); }
.pager button.on { background: var(--blue); color: var(--on-blue); cursor: default; }
.pager button:disabled:not(.on) { opacity: .4; cursor: default; }
.pager .pg-gap { color: var(--tertiary); padding: 0 4px; }
.pager .pg-info { width: 100%; text-align: center; font-size: 13px; color: var(--muted); margin-top: 4px; }
.pager svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Профиль: последние матчи ---------- */
#plMatches { display: grid; }
.mt-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; grid-template-areas: "res vs right" "res games right"; gap: 6px 12px; align-items: center;
  padding: 12px 4px; border-top: .5px solid var(--sep); }
.mt-row:first-child { border-top: 0; }
.mt-res { grid-area: res; align-self: start; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font: 800 14px/1 var(--font-display, inherit); }
.mt-res svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.mt-res.w { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }
.mt-res.l { background: color-mix(in srgb, var(--red) 14%, transparent); color: var(--red); }
.mt-vs { grid-area: vs; min-width: 0; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.mt-vs .mt-opp { font-weight: 600; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.mt-vs a.mt-opp:hover { color: var(--blue); }
.mt-vs small { color: var(--muted); font-size: 13px; white-space: nowrap; }
.mt-right { grid-area: right; align-self: start; display: grid; justify-items: end; gap: 4px; }
.mt-sc { font: 700 16px/1 var(--font-display, inherit); font-variant-numeric: tabular-nums; }
.mt-gain { white-space: nowrap; text-align: right; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mt-gain.pos { color: var(--green); } .mt-gain.neg { color: var(--red); } .mt-gain.none { color: var(--tertiary); font-weight: 500; font-size: 12px; }
.mt-games { grid-area: games; display: flex; gap: 6px; flex-wrap: wrap; }
.mt-g { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px 0 8px; border-radius: 8px; background: var(--fill); color: var(--text);
  font-size: 12.5px; font-weight: 600; text-decoration: none; transition: background .15s; }
.mt-g:hover { background: var(--fill2); }
.mt-g svg { width: 10px; height: 10px; fill: var(--blue); }
.mt-g em { font-style: normal; color: var(--muted); font-weight: 500; }
.mt-more { justify-self: center; margin-top: 8px; }
@media (max-width: 560px) {
  .mt-row { grid-template-columns: 30px minmax(0, 1fr) auto; gap: 6px 10px; }
  .mt-res { width: 30px; height: 30px; }
}

/* ---------- Повтор партии: шкала и кнопки под доской, ходы — в панели справа ---------- */
.replay-bar { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 10px 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.replay-bar .rp-info { font-size: 14px; color: var(--muted); min-height: 20px; line-height: 1.45; }
.replay-bar .rp-info b { color: var(--text); font-weight: 600; }
.rp-row { display: flex; align-items: center; gap: 14px; }
.rp-ctrl { display: flex; gap: 2px; flex: none; }
.rp-btn { width: 36px; height: 34px; border: 0; border-radius: 9px; background: transparent; color: var(--text); cursor: pointer; display: grid; place-items: center; transition: background .15s; }
.rp-btn:hover { background: var(--fill); }
.rp-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.rp-btn svg path[d*="z"] { fill: currentColor; }
.rp-btn.play { background: var(--blue); color: var(--on-blue); width: 42px; }
.rp-btn.play:hover { background: var(--blue); filter: brightness(1.08); }
.rp-row input[type=range] { flex: 1; min-width: 80px; accent-color: var(--blue); }
.rp-players { display: grid; gap: 6px; }
.rp-pl { display: flex; align-items: center; gap: 8px; font-size: 14px; min-width: 0; }
.rp-pl b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-pl a { color: var(--text); text-decoration: none; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.rp-pl a:hover { color: var(--blue); }
.rp-pl .win { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.rp-list { max-height: min(46vh, 420px); }
.rp-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.rp-acts:not(:has(> :not(.hidden))) { display: none; }
#game.replay .pscore, #game.replay .pclock, #game.replay #status { display: none; }
#game.replay #logPanel { display: none; }
@media (max-width: 640px) {
  .rp-row { flex-wrap: wrap; gap: 6px; }
  .rp-ctrl { width: 100%; justify-content: space-between; }
  .rp-btn { width: 40px; }
  .rp-row input[type=range] { width: 100%; }
}
/* повтор на широком экране: управление внутри панели «Повтор партии» */
.rp-panel .replay-bar { background: none; box-shadow: none; padding: 4px 0 2px; border-top: .5px solid var(--sep); border-bottom: .5px solid var(--sep); border-radius: 0; }
.rp-panel .rp-row { flex-wrap: wrap; gap: 6px; }
.rp-panel .rp-ctrl { width: 100%; justify-content: space-between; }
.rp-panel .rp-row input[type=range] { width: 100%; }
.rp-panel .rp-info { font-size: 13px; }

/* ---------- Шансы на победу: только шансы и марс (переломный момент, график и «Как считаются» — убраны) ---------- */
#probPanel #turning, #probPanel #spark, #probPanel .howcalc { display: none; }

/* ---------- Назад из партии: кнопка с иконкой ---------- */
.side-back { display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 14px 0 8px; border: 0; border-radius: 10px;
  background: var(--card); color: var(--text); box-shadow: var(--shadow); font: 700 14px/1 var(--font-display, inherit); text-decoration: none; cursor: pointer;
  transition: background .15s, transform .15s; }
.side-back:hover { background: var(--card2); }
.side-back:active { transform: scale(.97); }
.side-back svg { width: 18px; height: 18px; color: var(--muted); transition: transform .15s, color .15s; }
.side-back:hover svg { transform: translateX(-2px); color: var(--text); }
.side-back.hidden { display: none; }

/* ---------- Турниры: заглушка ---------- */
.empty-state.soon { padding: 56px 20px; }
.empty-state .es-ico { width: 56px; height: 56px; margin-bottom: 4px; }

/* ---------- Только доска ---------- */
.focus-btn { width: 40px; padding: 0 !important; display: inline-grid; place-items: center; }
.focus-btn svg { width: 18px; height: 18px; }
#game.focus .side, #game.focus .pbar, #game.focus .game-tag, #game.focus .puzzle-box { display: none !important; }
#game.focus .layout { max-width: none; }
#game.focus .main { gap: 8px; }
#game.focus:not(.vboard) .board { width: min(100%, calc((100dvh - 76px) * 1.5714)); }
/* телефон стоя (доска повёрнута): по центру экрана, длина — от свободной высоты (syncBoardSize) */
#game.focus.vboard .main { min-height: calc(100dvh - 24px); justify-content: center; }
.focus-bar { width: var(--bw, 100%); max-width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; }
.focus-bar.hidden { display: none; }
.fb-info { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; font-size: 14px; }
.fb-sc { font: 800 18px/1 var(--font-display, inherit); font-variant-numeric: tabular-nums; padding: 0 4px; }
.fb-sc i { font-style: normal; color: var(--tertiary); margin: 0 2px; }
.fb-st { color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fb-st.hl { color: var(--acc); }
.fb-clk { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 9px; border-radius: 8px; background: var(--card); font: 700 14px/1 var(--font-display, inherit); font-variant-numeric: tabular-nums; color: var(--muted); }
.fb-clk.run { color: var(--text); box-shadow: inset 0 0 0 1.5px var(--acc); }
.fb-clk.low { color: var(--red); box-shadow: inset 0 0 0 1.5px var(--red); }
.fb-acts { display: flex; gap: 6px; flex: none; }
.fb-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; min-width: 36px; padding: 0 12px; border: 0; border-radius: 10px; background: var(--card); color: var(--text);
  font: 700 14px/1 var(--font-display, inherit); cursor: pointer; justify-content: center; transition: background .15s; }
.fb-btn:hover:not(:disabled) { background: var(--card2); }
.fb-btn:disabled { opacity: .45; cursor: default; }
.fb-btn svg { width: 18px; height: 18px; }
.fb-btn.primary { background: var(--go); color: var(--on-go); }
.fb-btn.hidden { display: none; }
#fbUndo { padding: 0; width: 36px; }
@media (max-width: 640px) {
  #game.focus { padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .fb-btn span { display: none; }
  #fbExit { padding: 0; width: 36px; }
  .fb-st { max-width: 40vw; font-size: 13px; }
}
/* телефон боком: рейки нет, доска — по высоте экрана за вычетом полоски */
@media (orientation: landscape) and (max-height: 540px) {
  #game.focus .main { display: flex; flex-direction: column; align-items: center; }
  #game.focus:not(.vboard) .board { width: min(calc((100dvh - var(--pt) - var(--pb) - 48px) * 1.5714), calc(100vw - var(--pl) - var(--pr))); }
  #game.focus .focus-bar { min-height: 36px; }
}

/* скрыть сообщения соперника (кнопка рядом с жалобой) — чат его сообщений не показывает */
.chat-muted .chat-list .msg.opp { display: none; }
