/* ============================================================
   Слой «ощущения игры» (js/fx.js): полёт карт, отбой, реакции,
   настройки, меню соперника, итог с рейтингом. Токены — из style.css.
   ============================================================ */

/* ---------- Полёт карт ---------- */
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 40; overflow: hidden; }
.fx-ghost { position: fixed; will-change: transform, opacity; }
.fx-ghost > .pcard { box-shadow: 0 10px 24px rgba(10, 30, 20, .32); }
.fx-ghost > .pcard.back { border-width: 2px; }

/* Отбой — несколько рубашек, выглядывающих из-за правого края сукна */
.discard { position: absolute; right: calc(var(--tbl-w) * -.5); top: 44%; width: var(--tbl-w); height: calc(var(--tbl-w) * 1.42); pointer-events: none; z-index: 0; }
.discard .pcard { --w: var(--tbl-w); position: absolute; inset: 0; border-width: 2px; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.discard .pcard:nth-child(1) { transform: rotate(82deg); }
.discard .pcard:nth-child(2) { transform: rotate(97deg) translate(4px, 3px); }
.discard .pcard:nth-child(3) { transform: rotate(74deg) translate(-3px, 6px); }
.discard .pcard:nth-child(4) { transform: rotate(104deg) translate(2px, -5px); }
.center, .opps, .opponent, .status { z-index: 1; }
.game.no-board .discard { visibility: hidden; }

/* ---------- Рука на маленьком экране: у каждой карты видна полоса для пальца ----------
   Шаг между картами — не меньше 55% ширины карты (на 360px это ~33px, середина карты всегда открыта).
   Больше 9–10 карт — рука прокручивается пальцем, как и раньше. */
.hand .pcard { margin-left: max(calc(var(--hand-w) * -.45), min(calc(var(--hand-w) * -.3), calc((100% - var(--hand-w) * var(--n)) / (var(--n) - 1)))); }
.hand { scroll-snap-type: x proximity; scroll-padding: 0 8px; }
.hand .pcard { scroll-snap-align: start; }
.hand .pcard:first-child { margin-left: auto; }
.hand .pcard:focus-visible { z-index: 2; outline: 3px solid var(--warm); outline-offset: 1px; }
.hand .pcard.playable { box-shadow: 0 6px 14px rgba(20, 40, 30, .2), 0 0 0 1px rgba(15, 122, 87, .25); }
.hand .pcard.playable.is-trump { box-shadow: inset 0 0 0 2px #e0a92e, 0 6px 14px rgba(20, 40, 30, .2); }

/* ---------- Ваш ход: тёплое свечение руки и статуса ---------- */
.game[data-turn="p"] .hand {
    background: linear-gradient(180deg, transparent 15%, rgba(255, 226, 160, .28));
    box-shadow: inset 0 -2px 0 rgba(255, 226, 160, .9);
}
.game[data-turn="p"] .status { background: var(--accent); box-shadow: 0 0 0 2px rgba(255, 226, 160, .85), 0 4px 16px rgba(0, 0, 0, .18); }
.player-zone.fx-turn .hand { animation: fx-turn .7s ease-out 1; }
@keyframes fx-turn {
    0% { box-shadow: inset 0 -2px 0 rgba(255, 226, 160, .9), 0 0 0 0 rgba(255, 226, 160, .7); }
    100% { box-shadow: inset 0 -2px 0 rgba(255, 226, 160, .9), 0 0 0 14px rgba(255, 226, 160, 0); }
}
.timer.urgent i { background: var(--red); }

/* ---------- Кнопки-иконки в панели ---------- */
.bar-right { display: flex; gap: 6px; flex: 0 0 auto; }
.game-bar .back svg { width: 20px; height: 20px; }
.game-bar .back[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }

/* ---------- Поповеры ---------- */
.fx-pop {
    position: fixed; z-index: 80; background: var(--surface); color: var(--text);
    border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
    padding: 10px; max-width: calc(100vw - 16px);
    animation: fx-pop-in .16s cubic-bezier(.2, .8, .3, 1.2);
}
.fx-pop[hidden] { display: none; }
@keyframes fx-pop-in { from { opacity: 0; transform: translateY(6px) scale(.97); } }

.fx-settings { width: 280px; padding: 8px 12px; }
.fx-settings-h { font-weight: 800; font-size: 13px; color: var(--muted); padding: 4px 0 2px; }
.fx-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; cursor: pointer; border-top: 1px solid var(--line); position: relative; }
.fx-switch:first-of-type { border-top: 0; }
.fx-switch b { display: block; font-size: 15px; }
.fx-switch small { display: block; color: var(--muted); font-size: 12px; line-height: 1.3; }
.fx-switch input { position: absolute; opacity: 0; width: 44px; height: 26px; right: 0; margin: 0; cursor: pointer; }
.fx-switch i { flex: 0 0 auto; width: 44px; height: 26px; border-radius: 13px; background: var(--line-strong); position: relative; transition: background .15s; }
.fx-switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.fx-switch input:checked + i { background: var(--accent); }
.fx-switch input:checked + i::after { transform: translateX(18px); }
.fx-switch input:focus-visible + i { outline: 2px solid var(--accent); outline-offset: 2px; }
.fx-switch input:disabled + i { opacity: .45; }

/* ---------- Реакции ---------- */
.react-btn {
    flex: 0 0 auto; width: 52px; min-height: 52px; border-radius: 50%; display: grid; place-items: center;
    background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); position: relative;
}
.react-btn svg { width: 22px; height: 22px; color: var(--accent); }
.react-btn:hover, .react-btn[aria-expanded="true"] { border-color: var(--accent); }
.react-btn.cooling::after {
    content: ""; position: absolute; inset: -3px; border-radius: 50%;
    background: conic-gradient(var(--accent-line) var(--p, 0%), transparent 0);
    -webkit-mask: radial-gradient(circle, transparent 62%, #000 63%); mask: radial-gradient(circle, transparent 62%, #000 63%);
    animation: fx-cool 2s linear forwards;
}
@property --p { syntax: '<percentage>'; inherits: false; initial-value: 100%; }
@keyframes fx-cool { from { --p: 100%; } to { --p: 0%; } }
.game.no-board .react-btn { visibility: hidden; }
.react-menu { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: 296px; }
.react-menu button {
    min-height: 56px; border-radius: var(--r-sm); background: var(--surface-2); display: grid; place-items: center; align-content: center;
    font-size: 24px; line-height: 1; padding: 4px 2px; gap: 3px;
}
.react-menu button small { font-size: 10.5px; font-weight: 700; color: var(--muted); line-height: 1.1; }
.react-menu button:hover, .react-menu button:focus-visible { background: var(--accent-soft); outline: 2px solid var(--accent); outline-offset: 0; }

/* Пузырь реакции над аватаром */
.fx-tips { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.fx-bubble {
    position: fixed; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    background: #fff; color: var(--text); border-radius: 18px; padding: 6px 12px; font-weight: 800; font-size: 14px;
    box-shadow: 0 8px 22px rgba(10, 30, 20, .28); --tail: 50%;
    animation: fx-bubble-in .28s cubic-bezier(.2, .9, .3, 1.35);
    transform-origin: var(--tail) 100%;
}
.fx-bubble::after { content: ""; position: absolute; left: var(--tail); bottom: -6px; width: 12px; height: 12px; background: #fff; transform: translateX(-50%) rotate(45deg); border-radius: 2px; }
.fx-bubble.below { transform-origin: var(--tail) 0; }
.fx-bubble.below::after { bottom: auto; top: -6px; }
.fx-bubble-e { font-size: 22px; line-height: 1; }
.fx-bubble.out { opacity: 0; transform: translateY(-6px); transition: opacity .2s, transform .2s; }
@keyframes fx-bubble-in { from { opacity: 0; transform: scale(.4) translateY(8px); } }

/* Тост */
.fx-toast {
    position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translate(-50%, 12px); z-index: 110;
    width: max-content; max-width: calc(100vw - 32px); background: var(--text); color: #fff; padding: 10px 16px; border-radius: 14px;
    font-weight: 700; font-size: 14px; text-align: center; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
    transition: opacity .2s, transform .2s;
}
.fx-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Соперник: кнопка, уровень ---------- */
button.opp { text-align: left; color: #fff; cursor: pointer; font: inherit; }
button.opp:hover { background: rgba(0, 0, 0, .3); }
button.opp:focus-visible { outline: 2px solid var(--warm); outline-offset: 2px; }
.opp .opp-name { max-width: none; overflow: visible; }
.opp-line { display: flex; align-items: center; gap: 5px; min-width: 0; }
.opp-nm { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lvl {
    flex: 0 0 auto; min-width: 20px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-grid; place-items: center;
    background: var(--warm); color: #4a3200; font-size: 11px; font-weight: 800; line-height: 1;
}
.opp.is-muted .avatar { opacity: .7; }

/* ---------- Нижний лист: меню соперника ---------- */
.sheet { position: fixed; inset: 0; z-index: 90; background: rgba(23, 33, 29, .4); display: grid; align-items: end; justify-items: center; padding: 0 8px; }
.sheet[hidden] { display: none; }
.sheet-box {
    width: 100%; max-width: 420px; background: var(--surface); color: var(--text); border-radius: var(--r-lg) var(--r-lg) 0 0;
    padding: 18px 18px calc(18px + env(safe-area-inset-bottom)); box-shadow: var(--shadow);
    animation: fx-sheet-in .22s cubic-bezier(.2, .8, .3, 1);
}
@keyframes fx-sheet-in { from { transform: translateY(40%); opacity: 0; } }
@media (min-width: 600px) { .sheet { align-items: center; } .sheet-box { border-radius: var(--r-lg); } }
.sheet-head { display: flex; align-items: center; gap: 12px; }
.sheet-head .avatar { width: 48px; height: 48px; font-size: 20px; border-color: var(--line-strong); }
.sheet-head h2 { font-family: var(--font-body); font-weight: 800; font-size: 18px; margin: 0; overflow-wrap: anywhere; }
.sheet-head p { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.sheet-head > div { flex: 1; min-width: 0; }
.sheet-close { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 22px; color: var(--muted); flex: 0 0 auto; }
.sheet-close:hover { background: var(--surface-2); }
.sheet-actions { display: grid; gap: 8px; margin-top: 16px; }
.sheet-actions[hidden], .report-form[hidden] { display: none; }
.sheet-actions .btn { width: 100%; justify-content: center; }
.btn.btn-danger-ghost { color: var(--red); }
.report-form fieldset { border: 0; margin-top: 14px; }
.report-form legend { font-weight: 800; font-size: 15px; margin-bottom: 6px; }
.report-form label { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; font-size: 15px; cursor: pointer; border-top: 1px solid var(--line); }
.report-form label:first-of-type { border-top: 0; }
.report-form input { width: 20px; height: 20px; accent-color: var(--accent); }
.report-note { color: var(--muted); font-size: 13px; margin-top: 8px; }

/* ---------- Итог партии: рейтинг ---------- */
.deltas { list-style: none; display: grid; gap: 6px; margin: -6px 0 18px; text-align: left; }
.deltas[hidden] { display: none; }
.deltas li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--surface-2); font-weight: 700; font-size: 15px; }
.deltas li.me { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.deltas .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deltas .d { font-family: var(--font-head); font-weight: 600; font-variant-numeric: tabular-nums; }
.deltas .d.pos { color: var(--green); }
.deltas .d.neg { color: var(--red); }
.deltas .d.zero, .deltas .unrated { color: var(--muted); font-family: var(--font-body); font-weight: 700; font-size: 13px; }
.modal-box .modal-link + .modal-link { margin-left: 16px; }
.modal-box .modal-link[hidden] { display: none; }
.modal.open .modal-box { animation: fx-sheet-in .26s cubic-bezier(.2, .8, .3, 1.1); }

/* ---------- Меньше движения ---------- */
@media (prefers-reduced-motion: reduce) {
    .fx-pop, .fx-bubble, .sheet-box, .modal.open .modal-box, .player-zone.fx-turn .hand, .react-btn.cooling::after { animation: none !important; }
}
@media (orientation: landscape) and (max-height: 520px) {
    .react-btn { width: 44px; min-height: 44px; align-self: center; }
    .discard { top: 30%; }
}

/* Прогресс в окне итога */
.progress-box { margin: 12px 0 4px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--accent-soft); border: 1px solid var(--accent-line); text-align: left; }
.progress-box .lvl-up { font-family: var(--font-head); font-size: 18px; color: var(--accent); margin-bottom: 6px; animation: lvlPop .6s cubic-bezier(.2, 1.6, .4, 1) both; }
.progress-box .xp-row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--muted); }
.progress-box .xp-row b { color: var(--accent); }
.progress-box .xp-bar { height: 8px; border-radius: 4px; background: var(--line); margin-top: 8px; overflow: hidden; }
.progress-box .xp-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 4px; animation: xpGrow .9s ease-out both; transform-origin: left; }
.progress-box .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.progress-box .tag { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line-strong); }
.progress-box .tag.gold { background: var(--note-bg); border-color: var(--note-line); color: var(--note); }
@keyframes lvlPop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes xpGrow { from { transform: scaleX(0); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .progress-box .lvl-up, .progress-box .xp-bar i { animation: none; } }
.unrated-row .nm { white-space: normal; overflow: visible; text-overflow: clip; font-weight: 600; color: var(--muted); }

/* v3.1: серия дней и достижения в окне итога */
.progress-box .daily-line > span, .progress-box .ach-line { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.progress-box .daily-line > span > span:last-child, .progress-box .ach-line > span:last-child { min-width: 0; overflow-wrap: anywhere; line-height: 1.35; }
.progress-box .daily-line small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; margin-top: 2px; }
.progress-box .g-ico { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; line-height: 1; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.progress-box .ach-lines { flex-direction: column; align-items: stretch; gap: 6px; }
.progress-box .ach-line { padding: 6px 8px; margin: 0 -8px; border-radius: 8px; background: var(--note-bg); box-shadow: inset 0 0 0 1px var(--note-line); font-size: 13px; }
.progress-box .ach-line .g-ico { background: radial-gradient(circle at 35% 30%, #fff, #f6e2a6); box-shadow: none; }
.progress-box .ach-lines > a { align-self: flex-start; font-size: 13px; }
.progress-box .ach-lines > .muted { font-size: 12px; }
.fx-gain-pop { animation: gainPop .5s cubic-bezier(.2, 1.6, .4, 1) .15s both; }
@keyframes gainPop { from { transform: scale(.85); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .fx-gain-pop { animation: none; } }

/* v4: быстрая игра и турниры на столе */
.auto-start {
    margin: -4px 0 12px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent);
    font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; text-align: center;
}
.auto-start[hidden] { display: none; }
.tn-badge {
    display: inline-block; max-width: 100%; margin-top: 2px; padding: 2px 10px; border-radius: 999px;
    background: var(--note-bg); border: 1px solid var(--note-line); color: var(--note);
    font-size: 12px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle;
}
.game-bar { min-width: 0; }
.game-title { min-width: 0; flex: 1 1 auto; }
.game-title:has(.tn-badge) b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tn-result {
    display: grid; gap: 4px; justify-items: center; margin: -8px 0 16px; padding: 10px 12px; border-radius: var(--r-sm);
    background: var(--note-bg); box-shadow: inset 0 0 0 1px var(--note-line); font-size: 14px; color: var(--text);
}
.tn-result[hidden] { display: none; }
.tn-result small { font-size: 12px; color: var(--muted); font-weight: 600; }
.tn-result .tn-err { color: var(--red); }
.tn-result a { font-size: 13px; font-weight: 700; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

/* ============================================================
   v5 §4: удобство за столом (настройки js/fx.js → классы на body)
   ============================================================ */

/* Панель настроек: группы, прокрутка внутри на телефоне */
.fx-settings { width: 304px; max-height: calc(100vh - 80px); max-height: calc(100dvh - 80px); overflow-y: auto; overscroll-behavior: contain; padding: 4px 14px 10px; }
.fx-group + .fx-group { border-top: 1px solid var(--line-strong); margin-top: 4px; }
.fx-group .fx-settings-h { padding: 10px 0 0; text-transform: none; }
.fx-group .fx-switch { min-height: 48px; }
.fx-group > .fx-switch:first-of-type { border-top: 0; }
.fx-seg { border: 0; border-top: 1px solid var(--line); padding: 8px 0 10px; margin: 0; min-width: 0; }
.fx-group .fx-settings-h + .fx-seg { border-top: 0; }
.fx-seg legend { float: left; width: 100%; font-weight: 700; font-size: 15px; padding: 0; }
.fx-seg > small { display: block; clear: both; color: var(--muted); font-size: 12px; line-height: 1.3; }
.fx-seg-row { clear: both; display: flex; gap: 0; margin-top: 6px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 2px; background: var(--surface-2); }
.fx-seg-row label { flex: 1 1 0; min-width: 0; position: relative; cursor: pointer; }
.fx-seg-row input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; cursor: pointer; }
.fx-seg-row span { display: grid; place-items: center; min-height: 36px; padding: 0 4px; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--muted); text-align: center; line-height: 1.15; }
.fx-seg-row input:checked + span { background: var(--surface); color: var(--accent); box-shadow: 0 1px 3px rgba(20, 40, 30, .18), inset 0 0 0 1px var(--accent-line); }
.fx-seg-row input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Размер карт в руке: множитель к --hand-w. Шаг нахлёста и высота руки считаются от --hw */
body { --hand-k: 1; }
body.cards-s { --hand-k: .86; }
body.cards-l { --hand-k: 1.18; }
.hand { --hw: calc(var(--hand-w) * var(--hand-k)); min-height: calc(var(--hw) * 1.42 + 28px); }
.hand .pcard {
    --w: var(--hw);
    margin-left: max(calc(var(--hw) * -.45), min(calc(var(--hw) * -.3), calc((100% - var(--hw) * var(--n)) / (var(--n) - 1))));
}
.hand .pcard:first-child { margin-left: auto; }
@media (orientation: landscape) and (max-height: 520px) { .hand { min-height: calc(var(--hw) * 1.42 + 20px); } }

/* Четыре цвета мастей: ♦ синие, ♣ зелёные (контраст на белой карте 6.0:1 и 5.4:1) */
.four-color .pcard.s-D, .four-color .trump-suit.s-D { color: #1d5fc4; }
.four-color .pcard.s-C, .four-color .trump-suit.s-C { color: #137a3a; }

/* Для левши: кнопки действий и реакции — слева */
.lefty .actions { flex-direction: row-reverse; }
@media (orientation: landscape) and (max-height: 520px) {
    .lefty .game { grid-template-columns: auto minmax(0, 1fr); }
    .lefty .game .player-zone { grid-column: 2; grid-row: -2; padding: 0 max(10px, env(safe-area-inset-right)) 0 0; }
    .lefty .game .actions { grid-column: 1; grid-row: -2; flex-direction: column; padding-left: max(10px, env(safe-area-inset-left)); padding-right: 10px; }
}

/* «Беру» ждёт второго нажатия */
#takeBtn.confirm { background: var(--note-bg); border-color: var(--note); color: var(--note); }

/* Анимации «без» — как prefers-reduced-motion; полоска таймера остаётся: это информация */
.fx-still *:not(#timerBar):not(.t-ring-c), .fx-still *::before, .fx-still *::after { animation: none !important; transition: none !important; }

/* ============================================================
   ТРИНКА (js/trynka.js): банк, ставки, вскрытие. Фишки — белые с зелёным кантом,
   без золота и неона (knowledge/design-system.md)
   ============================================================ */
.game:not(.tk) .tk-center, .game:not(.tk) .tk-me, .game:not(.tk) .tk-acts { display: none; }
.game.tk .deck-zone, .game.tk .battlefield, .game.tk #discard,
.game.tk #takeBtn, .game.tk #doneBtn, .game.tk #beatBtn, .game.tk #transferBtn, .game.tk #cancelBtn { display: none !important; }
.game.tk .center { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.game.no-board .tk-me { visibility: hidden; }
.tk-center { display: grid; justify-items: center; gap: 6px; width: 100%; min-width: 0; }
.tk-pot { display: inline-flex; align-items: center; gap: 10px; padding: 8px 20px 8px 12px; border-radius: 999px; background: rgba(0, 0, 0, .22); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); }
.tk-stack { position: relative; width: 30px; height: 32px; flex: none; }
.tk-stack i { position: absolute; left: 0; width: 30px; height: 12px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 3px var(--accent-2), 0 1px 0 rgba(0, 0, 0, .3); }
.tk-stack i:nth-child(1) { top: 19px; } .tk-stack i:nth-child(2) { top: 11px; } .tk-stack i:nth-child(3) { top: 3px; }
.tk-pot-n { display: grid; line-height: 1.1; }
.tk-pot-n b { font-family: var(--font-head); font-weight: 600; font-size: 26px; font-variant-numeric: tabular-nums; }
.tk-pot-n small { font-size: 12px; font-weight: 700; opacity: .9; }
.tk-bets { margin: 0; font-size: 13px; font-weight: 700; opacity: .95; text-align: center; }
.tk-svara { max-width: 440px; width: 100%; background: var(--note-bg); color: var(--note); border-radius: var(--r); padding: 8px 12px; font-size: 13px; line-height: 1.35; display: grid; gap: 5px; text-align: center; }
.tk-svara[hidden] { display: none; }
.tk-svara > b { font-size: 16px; }
.tk-sv-hands { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; }
.tk-sv-hands > span { display: inline-flex; align-items: center; gap: 5px; opacity: .6; min-width: 0; }
.tk-sv-hands > span.eq { opacity: 1; }
.tk-sv-hands em { font-style: normal; font-weight: 800; max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-mini { display: inline-flex; gap: 2px; }
.tk-mc { display: inline-grid; place-items: center; align-content: center; width: 22px; height: 30px; border-radius: 4px; background: #fff; color: var(--card-black); font-size: 11px; font-weight: 800; line-height: 1; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.tk-mc small { font-size: 11px; }
.tk-mc.red { color: var(--card-red); }
.tk-mc.joker { box-shadow: inset 0 0 0 2px #e0a92e, 0 1px 2px rgba(0, 0, 0, .3); }
.four-color .tk-mc.s-D { color: #1d5fc4; }
.four-color .tk-mc.s-C { color: #137a3a; }
.tk-opp { position: relative; }
.tk-bet { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 7px; border-radius: 11px; background: #fff; color: var(--accent); font-weight: 800; font-size: 12px; box-shadow: inset 0 0 0 2px var(--accent-2); }
.tk-show { display: inline-flex; align-items: center; gap: 6px; }
.tk-show b { font-family: var(--font-head); font-weight: 600; font-size: 15px; }
.opp.is-winner { background: rgba(255, 255, 255, .2); box-shadow: 0 0 0 2px #fff, 0 0 0 6px rgba(255, 255, 255, .22); opacity: 1; }
.tk-flip .tk-mc { animation: tkFlip .45s ease both; }
.tk-flip .tk-mc:nth-child(2) { animation-delay: .08s; } .tk-flip .tk-mc:nth-child(3) { animation-delay: .16s; }
@keyframes tkFlip { from { transform: rotateY(90deg); } to { transform: none; } }
.tk-pop { animation: tkPop .45s ease; }
@keyframes tkPop { 0% { transform: scale(.9); opacity: 0; } 60% { transform: scale(1.03); opacity: 1; } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { .tk-flip .tk-mc, .tk-pop { animation: none; } }
.tk-me { display: flex; align-items: baseline; justify-content: center; flex-wrap: wrap; gap: 2px 12px; font-size: 14px; font-weight: 700; color: var(--muted); padding: 4px 8px 0; text-align: center; }
.tk-score { font-family: var(--font-head); font-weight: 600; font-size: 26px; color: var(--text); white-space: nowrap; }
.tk-me.is-turn .tk-score { color: var(--accent); }
.tk-me.is-winner .tk-score { color: var(--green); }
.game.tk .hand { padding-top: 10px; }
.game.tk .hand .pcard { cursor: default; margin-left: 10px; }
.game.tk .hand .pcard:first-child { margin-left: auto; }
.tk-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; flex: 1; min-width: 0; max-width: 560px; }
.actions .tk-acts .btn { flex: 1 1 auto; min-width: 0; max-width: none; min-height: 48px; padding: 0 14px; font-size: 15px; }
.game.tk .actions { align-items: center; }
@media (min-width: 1024px) { .game.tk .actions { max-width: 920px; } .tk-acts { max-width: 840px; } .actions .tk-acts .btn { flex: 0 1 auto; } }
@media (max-height: 760px) { .tk-svara { font-size: 12px; padding: 6px 10px; gap: 3px; } .tk-svara > b { font-size: 14px; } }
.game.tk .actions .react-btn { align-self: center; flex: none; }
.actions .tk-acts .btn[disabled] { display: inline-flex; opacity: .6; }
@media (max-width: 380px) { .actions .tk-acts { gap: 6px; } .actions .tk-acts .btn { font-size: 14px; padding: 0 10px; } }
.tk-chip-fly { position: fixed; z-index: 90; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 3px var(--accent-2), 0 2px 4px rgba(0, 0, 0, .3); pointer-events: none; }
.wait-mode { margin: -4px 0 12px; font-weight: 700; color: var(--accent); }
.wait-mode[hidden] { display: none; }
.deltas li.tk-now { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.deltas li.tk-now b { font-family: var(--font-head); font-weight: 600; }
.deltas li.tk-low { background: var(--note-bg); color: var(--note); font-size: 13px; }
.deltas li.tk-low .nm { white-space: normal; }
@media (orientation: landscape) and (max-height: 520px) {
    .tk-pot { padding: 4px 14px 4px 8px; } .tk-pot-n b { font-size: 20px; } .tk-score { font-size: 20px; }
    .actions .tk-acts { flex-direction: row; max-width: 300px; } .actions .tk-acts .btn { min-height: 40px; font-size: 13px; }
}

/* ===== v7: тренировка, парный 2×2, много соперников (knowledge/protocol-v7.md) ===== */
.practice-badge {
    display: inline-block; margin-top: 2px; padding: 1px 10px; border-radius: 999px;
    background: var(--note-bg); color: var(--note); border: 1px solid var(--note-line); font-weight: 700; font-size: 12px; white-space: nowrap;
}
.opp.is-bot .avatar { background: #eef3ff; font-size: 17px; }
.opp-tag { display: inline-block; margin-right: 5px; padding: 0 6px; border-radius: 6px; font-size: 11px; font-weight: 800; line-height: 1.5; vertical-align: 1px; }
.opp-tag.partner { background: #fff; color: var(--accent); }
/* Партнёр — светлым «своим» цветом, соперники — тёплой полоской */
.opp.is-partner { background: rgba(255, 255, 255, .22); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .85); }
.opp.is-partner .avatar { border-color: #bff0d8; }
.opp.is-rival { box-shadow: inset 0 0 0 1.5px rgba(255, 205, 140, .7); }
.opp.is-partner.is-waiting, .opp.is-rival.is-waiting { box-shadow: 0 0 0 2px var(--warm), 0 0 0 6px rgba(255, 226, 160, .25); }
.pairs-note { margin: 10px 0 0; padding: 8px 12px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--text); font-size: 13px; font-weight: 600; }
.pairs-note[hidden], #shareBox[hidden] { display: none; }
.team-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; }
.team-dot.t0 { background: var(--accent); }
.team-dot.t1 { background: #d98a2b; }
.partner-tag { color: var(--accent); }
.seat-row.is-bot .avatar { font-size: 16px; }
.deltas li.partner { box-shadow: inset 3px 0 0 var(--accent-2); }

/* Много соперников (4–9): компактные плашки сеткой на телефоне, полукругом на компьютере */
.opps.many { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 4px; justify-content: stretch; }
.opps.many .opp { min-width: 0; gap: 4px; padding: 3px 5px 3px 3px; border-radius: 12px; }
.opps.many .opp .avatar { width: 24px; height: 24px; font-size: 12px; border-width: 1.5px; }
.opps.many .opp.is-bot .avatar { font-size: 14px; }
.opps.many .opp .pcard.opp-back { display: none; }
.opps.many .opp-name { min-width: 0; font-size: 12px; line-height: 1.2; letter-spacing: -.01em; }
.opps.many .opp-name small { font-size: 11px; line-height: 1.2; white-space: normal; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; }
.opps.many .opp-nm { max-width: none; }
.opps.many .opp-line { overflow: hidden; }
.opps.many .opp-tag { font-size: 10px; padding: 0 4px; margin-right: 3px; }
.opps.many .lvl { display: none; }
/* тринка: ставка — значком в углу, вскрытые карты — под именем */
.opps.many .tk-opp { flex-wrap: wrap; }
.opps.many .tk-bet { position: absolute; top: -5px; right: -3px; min-width: 22px; height: 18px; padding: 0 5px; font-size: 11px; }
.opps.many .tk-show { flex-basis: 100%; gap: 4px; justify-content: center; }
.opps.many .tk-mc { width: 18px; height: 25px; font-size: 10px; }
.opps.many .tk-mc small { font-size: 10px; }
.opps.many .tk-show b { font-size: 13px; }
@media (max-width: 359px) { .opps.many { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); } }
/* Телефон, вскрытие тринки: вместо строки фишек — карты и очки, плашка остаётся в две строки */
@media (max-width: 899px), (max-height: 599px) {
    .opps.many .tk-opp:has(.tk-show) .opp-name small { display: none; }
    .opps.many .tk-opp:has(.tk-show) { row-gap: 2px; }
    .opps.many .tk-mc { width: 16px; height: 22px; font-size: 9.5px; }
    .opps.many .tk-mc small { font-size: 9.5px; }
}
@media (min-width: 600px) { .opps.many { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 6px; } }
/* Компьютер: в ряд по дуге, плашка — столбиком (аватар, имя, карты) */
@media (min-width: 900px) and (min-height: 600px) {
    .opps.many { display: flex; flex-wrap: nowrap; justify-content: center; align-items: flex-start; gap: 6px; padding-bottom: 30px; }
    .opps.many .opp {
        flex: 0 1 100px; min-width: 76px; flex-direction: column; align-items: center; text-align: center;
        padding: 6px 6px 7px; border-radius: 16px; transform: translateY(var(--arc, 0px));
    }
    .opps.many .opp .avatar { width: 36px; height: 36px; font-size: 15px; }
    .opps.many .opp.is-bot .avatar { font-size: 19px; }
    .opps.many .opp-name { width: 100%; font-size: 13px; }
    .opps.many .opp-line { justify-content: center; }
    .opps.many .opp-name small { white-space: normal; font-size: 11.5px; }
    .opps.many .opp-tag { display: block; width: max-content; margin: 1px auto 2px; }
    .opps.many .tk-bet { top: -4px; right: -2px; }
}
@media (orientation: landscape) and (max-height: 520px) {
    .opps.many { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 3px; }
    .opps.many .opp { padding: 2px 6px 2px 2px; }
    .opps.many .opp .avatar { width: 22px; height: 22px; }
}
/* Итог на 8–10 игроков: окно не выше экрана, строки плотнее */
.modal-box { max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
.deltas:has(li:nth-child(7)) { gap: 4px; }
.deltas:has(li:nth-child(7)) li { padding: 5px 12px; font-size: 14px; }

/* Тринка: ряд главных кнопок + компактный ряд ставок (одна золотая кнопка на экран) */
.tk-acts { flex-direction: column; align-items: stretch; }
.tk-main { display: flex; gap: 8px; }
.tk-main .btn { flex: 1 1 0; }
.tk-main .btn-primary { flex: 1.4 1 0; }
.tk-show { border-color: var(--gold, #d4af37) !important; color: var(--gold, #d4af37) !important; }
.tk-raises { display: flex; align-items: center; gap: 6px; justify-content: center; }
.tk-raises-l { font-size: 13px; opacity: .8; white-space: nowrap; margin-right: 2px; }
.actions .tk-acts .tk-raises .btn { flex: 0 1 72px; min-height: 40px; padding: 0 8px; font-size: 14px; }
