/* ===== IGRY V CHATE: doski, lobby, menyu. Tema cherez sushchestvuyushchie peremennye base.css ===== */
/* Ispolzuem realnye peremennye: --accent, --text, --text-secondary, --border, --bubble-other. Fallbacki dlya nadezhnosti. */

.aya-game-host { display: block; margin: 2px 0; }
.aya-game {
    box-sizing: border-box;
    max-width: min(320px, 82vw);
    background: var(--bubble-other, #fff);
    border: 1px solid var(--border, rgba(0,56,65,.1));
    border-radius: 18px;
    padding: 14px 14px 15px;
    color: var(--text, #1A1D21);
    box-shadow: 0 1px 2px rgba(0,56,65,.05), 0 8px 24px rgba(0,56,65,.08);
    -webkit-user-select: none; user-select: none;
}
.aya-game { position: relative; }
.aya-game-loading { color: var(--text-secondary, #65676B); font-size: 14px; text-align: center; padding: 18px 8px; }
.aya-game-title { font-weight: 700; font-size: 15px; letter-spacing: -.01em; margin-bottom: 11px; padding-right: 32px; }
/* knopka «na ves ekran» */
.aya-game-expand { position: absolute; top: 10px; right: 10px; z-index: 2; width: 30px; height: 30px; padding: 0; border: none; border-radius: 10px; background: var(--soft, rgba(0,56,65,.06)); color: var(--text-secondary, #65676B); font-size: 15px; line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background .15s ease, transform .12s ease; }
.aya-game-expand:active { background: var(--soft-hover, rgba(0,0,0,.1)); transform: scale(.92); }
.aya-game-status { margin-top: 10px; font-size: 13px; color: var(--text-secondary, #65676B); text-align: center; min-height: 18px; }
.aya-game-controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 10px; }

/* --- knopki: myagkie pilyuli, brand-petrol dlya glavnogo dejstviya --- */
.aya-game-btn {
    appearance: none; border: none;
    background: var(--soft, #f1f1ef); color: var(--text, #1A1D21);
    border-radius: 12px; padding: 9px 14px; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: background .15s, opacity .15s, transform .12s ease; line-height: 1;
    box-shadow: inset 0 0 0 1px var(--border, rgba(0,56,65,.08));
}
.aya-game-btn:active { transform: scale(.96); }
.aya-game-btn.primary {
    background: linear-gradient(135deg, var(--brand, #005f6d), var(--brand-dark, #0a7c88));
    color: #fff; box-shadow: 0 3px 10px rgba(0,95,109,.28);
}
.aya-game-btn:disabled { opacity: .45; cursor: default; }

/* --- knopka «Играть» v kompozere --- */
.game-btn-mobile {
    flex: 0 0 auto; width: 38px; height: 38px; border: none; background: transparent;
    font-size: 21px; line-height: 1; cursor: pointer; padding: 0; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; color: var(--text, #1A1D21);
}
.game-btn-mobile:active { background: var(--border, rgba(0,0,0,.06)); }

/* ===== KRESTIKI-NOLIKI ===== */
.ttt-board { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: min(240px, 66vw); margin: 0 auto; }
.ttt-cell {
    aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
    font-size: 34px; font-weight: 700; border-radius: 12px; border: none;
    background: var(--border, rgba(0,56,65,.08)); color: var(--text, #1A1D21); cursor: default;
}
.ttt-board.can-tap .ttt-cell:not(:disabled) { cursor: pointer; box-shadow: inset 0 0 0 2px var(--accent, #ff8c42); background: transparent; }
.ttt-cell.v1 { color: var(--aya-petrol, #005f6d); }
.ttt-cell.v2 { color: var(--accent, #ff8c42); }
.ttt-cell.ttt-win { background: var(--aya-pill-active-bg, #cfe8db); }

/* ===== SHASHKI ===== */
.ch-board { display: grid; grid-template-columns: repeat(8, 1fr); width: min(288px, 78vw); margin: 0 auto; border-radius: 8px; overflow: hidden; border: 1px solid var(--border-strong, rgba(0,0,0,.15)); }
.ch-sq { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; position: relative; }
.ch-light { background: #efdcbf; }
.ch-dark { background: #9a6b3f; }
.ch-board.can-tap .ch-dark { cursor: pointer; }
.ch-sel { box-shadow: inset 0 0 0 3px var(--accent, #ff8c42); }
.ch-pc { width: 72%; height: 72%; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 15px; box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.ch-pc-1, .ch-pc-3 { background: radial-gradient(circle at 35% 30%, #ff6b5e, #c0392b); color: #ffe; }
.ch-pc-2, .ch-pc-4 { background: radial-gradient(circle at 35% 30%, #4a4a4a, #111); color: #ffd54a; }
.ch-king { box-shadow: 0 0 0 2px #ffd54a, 0 1px 2px rgba(0,0,0,.4); }

/* ===== SHAHMATY ===== */
.cs-board { display: grid; grid-template-columns: repeat(8, 1fr); width: min(304px, 82vw); margin: 0 auto; border-radius: 8px; overflow: hidden; border: 1px solid var(--border-strong, rgba(0,0,0,.15)); }
.cs-sq { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; position: relative; }
.cs-light { background: #efdcbf; }
.cs-dark { background: #9a6b3f; }
.cs-board.can-tap .cs-sq { cursor: pointer; }
.cs-pc { font-size: 26px; line-height: 1; text-shadow: 0 1px 1px rgba(0,0,0,.35); }
.cs-lastmv { box-shadow: inset 0 0 0 3px rgba(255,213,74,.75); }
.cs-sel { box-shadow: inset 0 0 0 3px var(--accent, #ff8c42); }
.cs-hint::after { content: ''; position: absolute; width: 30%; height: 30%; border-radius: 50%; background: rgba(0,0,0,.28); }
.cs-cap { box-shadow: inset 0 0 0 3px rgba(232,80,46,.85); }
.cs-promo { display: flex; gap: 10px; justify-content: center; margin-bottom: 14px; }
.cs-promo-b { font-size: 28px; padding: 10px 14px; }

/* ===== REVERSI ===== */
.rv-score { text-align: center; font-size: 15px; font-weight: 700; margin-bottom: 8px; display: flex; gap: 8px; align-items: center; justify-content: center; }
.rv-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; border-radius: 50%; font-size: 13px; padding: 0 6px; }
.rv-b1 { background: #222; color: #fff; }
.rv-b2 { background: #f4f4f4; color: #222; border: 1px solid rgba(0,0,0,.2); }
.rv-board { display: grid; grid-template-columns: repeat(8, 1fr); width: min(288px, 78vw); margin: 0 auto; background: #1f6f43; border: 2px solid #17532f; border-radius: 6px; overflow: hidden; }
.rv-sq { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; position: relative; box-shadow: inset 0 0 0 1px rgba(0,0,0,.18); }
.rv-board.can-tap .rv-sq { cursor: pointer; }
.rv-disc { width: 74%; height: 74%; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.rv-disc-1 { background: radial-gradient(circle at 35% 30%, #555, #000); }
.rv-disc-2 { background: radial-gradient(circle at 35% 30%, #fff, #cfcfcf); }
.rv-hint::after { content: ''; position: absolute; width: 28%; height: 28%; border-radius: 50%; background: rgba(255,255,255,.45); }

/* ===== CHETYRE V RYAD ===== */
.c4-board { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; width: min(266px, 74vw); margin: 0 auto; background: #2a68c4; padding: 6px; border-radius: 10px; }
.c4-cell { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; }
.c4-board.can-tap .c4-cell { cursor: pointer; }
.c4-disc { width: 82%; height: 82%; border-radius: 50%; }
.c4-disc-0 { background: var(--bubble-other, #fff); box-shadow: inset 0 2px 4px rgba(0,0,0,.35); }
.c4-disc-1 { background: radial-gradient(circle at 35% 30%, #ff6b5e, #c0392b); box-shadow: 0 1px 2px rgba(0,0,0,.35); }
.c4-disc-2 { background: radial-gradient(circle at 35% 30%, #ffe14d, #e0a800); box-shadow: 0 1px 2px rgba(0,0,0,.35); }
.c4-win .c4-disc { box-shadow: 0 0 0 3px #fff, 0 1px 2px rgba(0,0,0,.4); }
.c4-lastmv .c4-disc { outline: 2px solid rgba(255,255,255,.7); outline-offset: -2px; }

/* ===== NARDY / BACKGAMMON ===== */
/* Nardy: vpisyvaem v ekran po SHIRINE i VYSOTE (v landscape ranshe vylezala po vysote). */
/* Kartochku s nardami delaem SHIRE ostalnyh igr — pochti vsya shirina ekrana (nardy — shirokaya doska).
   NE ispolzuem :has() — on ne rabotaet v etom WKWebView; cepляemsya za klass tipa igry (buildHtml: aya-game-<type>). */
.aya-game-backgammon, .aya-game-longnard { max-width: min(96vw, 460px); }
/* Rama: tyoplyj oreh s myagkim voloknom (repeating-gradient), vnutrennyaya ten, skruglenie.
   Ramka/otstupy v px (cq-edinicy na samom kontejnere ne rezolvyatsya ot nego samogo). */
.bg-wrap {
    width: 100%; max-width: min(460px, 74vh); margin: 0 auto;
    background:
        repeating-linear-gradient(92deg, rgba(255,214,160,.05) 0 3px, rgba(0,0,0,0) 3px 8px, rgba(30,12,2,.07) 8px 11px, rgba(0,0,0,0) 11px 17px),
        linear-gradient(160deg, #6d4423, #56351a 55%, #472b13);
    border: 3px solid #38220f; border-radius: 14px; padding: 6px;
    box-shadow: inset 0 1px 0 rgba(255,206,150,.16), inset 0 0 10px rgba(0,0,0,.35), 0 4px 14px rgba(40,20,5,.22);
    container-type: inline-size; box-sizing: border-box;
}
/* Polnoekranka: doska = 100% shiriny kartochki (uzhe uchityvaet ee padding -> NE vylezaet vbok),
   ogranichena po VYSOTE (82vh) i absolyutom. Bez vmin/vw — oni ignorirovali padding i doska vyezzhala vpravo. */
.aya-game-fs-host .bg-wrap { width: 100%; max-width: min(560px, 82vh); }
/* Vysota polovin/razmery fishek/bara/kubikov — v cqw (% shiriny doski) -> vsyo masshtabiruetsya
   vmeste s .bg-wrap i vpisyvaetsya v ekran (i v landscape). Px pered cqw — folbэk dlya staryh iOS. */
/* Igrovoe pole: dve polovinki dereva potemnee ramy, vinetka po krayam, shchel-«petlya» mezhdu nimi. */
.bg-half {
    display: flex; align-items: stretch; height: 92px; height: 29cqw;
    position: relative; overflow: hidden;
    background: linear-gradient(180deg, #7d4e24, #6f421d);
    box-shadow: inset 0 0 12px rgba(42,20,5,.45);
}
.bg-half.bg-top { border-radius: 8px 8px 2px 2px; }
.bg-half.bg-bottom { margin-top: 3px; border-radius: 2px 2px 8px 8px; }
.bg-quad { display: flex; flex: 1; }
.bg-point { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; padding: 2px 0; min-width: 0; }
.bg-top .bg-point { justify-content: flex-start; }
.bg-bottom .bg-point { justify-content: flex-end; }
/* Treugolniki: chyotkij clip-path, gradient ot osnovaniya k vershine (obyom), tonkaya kromka drop-shadow. */
.bg-point::before {
    content: ''; position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: 0;
    filter: drop-shadow(0 0 1px rgba(42,20,5,.5));
}
.bg-top .bg-point::before { clip-path: polygon(0 0, 100% 0, 50% 92%); background: linear-gradient(180deg, var(--pt1), var(--pt2) 88%); }
.bg-bottom .bg-point::before { clip-path: polygon(50% 8%, 0 100%, 100% 100%); background: linear-gradient(0deg, var(--pt1), var(--pt2) 88%); }
.bg-pt-a { --pt1: #f0e0bc; --pt2: #d3b483; }
.bg-pt-b { --pt1: #b5652f; --pt2: #8d451e; }
/* Shashki: obyomnye shajby — blik sverhu, pritenenie snizu, tokarnaya kanavka po krugu. */
.bg-disc { width: 15px; height: 15px; width: 5.1cqw; height: 5.1cqw; border-radius: 50%; margin: 1px 0; margin: .2cqw 0; z-index: 1; flex: 0 0 auto; }
.bg-disc-1 {
    background:
        radial-gradient(circle at 50% 50%, rgba(0,0,0,0) 52%, rgba(120,90,40,.22) 56% 62%, rgba(0,0,0,0) 66%),
        radial-gradient(circle at 32% 28%, #ffffff, #efe8d6 45%, #d6caae 78%, #bfb192);
    box-shadow: inset 0 1px 1px rgba(255,255,255,.9), inset 0 -2px 3px rgba(120,96,54,.38), 0 1px 2px rgba(20,10,2,.45);
}
.bg-disc-2 {
    background:
        radial-gradient(circle at 50% 50%, rgba(0,0,0,0) 52%, rgba(255,255,255,.10) 56% 62%, rgba(0,0,0,0) 66%),
        radial-gradient(circle at 32% 28%, #7c7168, #3d342c 45%, #231c15 78%, #150f0a);
    box-shadow: inset 0 1px 1px rgba(255,255,255,.22), inset 0 -2px 3px rgba(0,0,0,.55), 0 1px 2px rgba(20,10,2,.5);
}
/* Schyotchik stopki: kruglyj bejdzh POVERH krajnej shashki (otricatelnyj otstup), a ne pod nej. */
.bg-count {
    z-index: 2; font-size: 10px; font-size: 3.1cqw; font-weight: 800; line-height: 1;
    padding: 2px 4px; border-radius: 999px; margin-top: -10px; margin-top: -3.4cqw;
    box-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.bg-count-1 { background: #fffdf4; color: #2b1d0e; }
.bg-count-2 { background: #241d17; color: #f5efe2; border: 1px solid rgba(255,255,255,.18); }
/* Bar po centru: tochenyj derevyannyj stolbik s prodolnym bleskom. */
.bg-bar {
    width: 20px; flex: 0 0 20px; width: 7cqw; flex-basis: 7cqw; position: relative;
    background: linear-gradient(90deg, #331d0c, #593719 28%, #6b4624 50%, #593719 72%, #2e1a0a);
    box-shadow: inset 0 0 6px rgba(0,0,0,.4);
    display: flex; flex-direction: column; align-items: center;
}
.bg-bar-top { justify-content: flex-start; padding-top: 2px; }
.bg-bar-bottom { justify-content: flex-end; padding-bottom: 2px; }
/* Podsvetki hodov: zalivka po forme SAMOGO treugolnika (clip-path), spokojnye tyoplye tona. */
.bg-movable { cursor: pointer; }
.bg-movable::after, .bg-sel::after, .bg-hint::after { content: ''; position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: 2; pointer-events: none; }
.bg-top .bg-point::after { clip-path: polygon(0 0, 100% 0, 50% 92%); }
.bg-bottom .bg-point::after { clip-path: polygon(50% 8%, 0 100%, 100% 100%); }
.bg-point.bg-movable::after { background: rgba(255,166,64,.28); }
.bg-point.bg-sel::after { background: rgba(255,204,88,.45); }
.bg-point.bg-hint::after { background: rgba(124,196,108,.42); }
.bg-point.bg-movable::before { filter: drop-shadow(0 0 1px rgba(42,20,5,.5)) drop-shadow(0 0 4px rgba(255,152,52,.65)); }
.bg-point.bg-sel::before { filter: drop-shadow(0 0 1px rgba(42,20,5,.5)) drop-shadow(0 0 4px rgba(255,198,74,.75)); }
/* Bar — pryamougolnaya ramka-podsvetka (clip-path tut ne nuzhen). */
.bg-bar.bg-movable, .bg-bar.bg-sel { cursor: pointer; position: relative; }
.bg-bar.bg-movable::after { left: 1px; right: 1px; top: 1px; bottom: 1px; border-radius: 4px; background: rgba(255,166,64,.2); box-shadow: inset 0 0 0 2px rgba(255,166,64,.9); }
.bg-bar.bg-sel::after { left: 1px; right: 1px; top: 1px; bottom: 1px; border-radius: 4px; background: rgba(255,204,88,.22); box-shadow: inset 0 0 0 2px rgba(255,204,88,.95); }
/* Snyatye shashki: gromozdkie lotki «Соперник снял / Вы сняли» UBRANY (po prosbe vladelca).
   Vmesto nih — kompaktnyj bejdzh v stroke statusa (⚪ 3/15 · ⚫ 1/15), a sbros (bearing off) —
   knopka «Снять шашку» v .aya-game-controls (poyavlyaetsya tolko kogda vybrana shashka,
   kotoroj legalno snyatsya — ta zhe proverka hintTo['off'], hod tot zhe: from=sel, to='off'). */
.bg-off-note { white-space: nowrap; font-weight: 600; opacity: .9; }
/* Kubiki: kost slonovoj kosti s tochkami-pipsami (risuyutsya radial-gradientami po klassu bg-die-vN). */
.bg-dice { display: flex; gap: 8px; justify-content: center; align-items: center; margin-top: 10px; }
.bg-die {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; width: 8.6cqw; height: 8.6cqw; border-radius: 22%;
    --pip: #33230f; --face: linear-gradient(145deg, #fffef7, #ece2cc);
    background: var(--face);
    color: #222; font-weight: 800; font-size: 16px; font-size: 4.6cqw;
    box-shadow: inset 0 1px 1px rgba(255,255,255,.85), inset 0 -2px 3px rgba(96,70,40,.28), 0 2px 5px rgba(30,15,4,.35);
}
/* Est klass znacheniya -> pryachem cifru i risuem pipsy; bez klassa ostayotsya krupnaya cifra (folbэk). */
.bg-die[class*="bg-die-v"] { color: transparent; }
.bg-die-v1 { background: radial-gradient(9% 9% at 50% 50%, var(--pip) 98%, rgba(0,0,0,0)) , var(--face); }
.bg-die-v2 { background: radial-gradient(9% 9% at 28% 28%, var(--pip) 98%, rgba(0,0,0,0)), radial-gradient(9% 9% at 72% 72%, var(--pip) 98%, rgba(0,0,0,0)), var(--face); }
.bg-die-v3 { background: radial-gradient(9% 9% at 25% 25%, var(--pip) 98%, rgba(0,0,0,0)), radial-gradient(9% 9% at 50% 50%, var(--pip) 98%, rgba(0,0,0,0)), radial-gradient(9% 9% at 75% 75%, var(--pip) 98%, rgba(0,0,0,0)), var(--face); }
.bg-die-v4 { background: radial-gradient(9% 9% at 28% 28%, var(--pip) 98%, rgba(0,0,0,0)), radial-gradient(9% 9% at 72% 28%, var(--pip) 98%, rgba(0,0,0,0)), radial-gradient(9% 9% at 28% 72%, var(--pip) 98%, rgba(0,0,0,0)), radial-gradient(9% 9% at 72% 72%, var(--pip) 98%, rgba(0,0,0,0)), var(--face); }
.bg-die-v5 { background: radial-gradient(9% 9% at 26% 26%, var(--pip) 98%, rgba(0,0,0,0)), radial-gradient(9% 9% at 74% 26%, var(--pip) 98%, rgba(0,0,0,0)), radial-gradient(9% 9% at 50% 50%, var(--pip) 98%, rgba(0,0,0,0)), radial-gradient(9% 9% at 26% 74%, var(--pip) 98%, rgba(0,0,0,0)), radial-gradient(9% 9% at 74% 74%, var(--pip) 98%, rgba(0,0,0,0)), var(--face); }
.bg-die-v6 { background: radial-gradient(9% 9% at 30% 26%, var(--pip) 98%, rgba(0,0,0,0)), radial-gradient(9% 9% at 30% 50%, var(--pip) 98%, rgba(0,0,0,0)), radial-gradient(9% 9% at 30% 74%, var(--pip) 98%, rgba(0,0,0,0)), radial-gradient(9% 9% at 70% 26%, var(--pip) 98%, rgba(0,0,0,0)), radial-gradient(9% 9% at 70% 50%, var(--pip) 98%, rgba(0,0,0,0)), radial-gradient(9% 9% at 70% 74%, var(--pip) 98%, rgba(0,0,0,0)), var(--face); }
.bg-die-dim { opacity: .4; filter: saturate(.4); }
.bg-die-dbl { font-size: 12px; font-weight: 700; color: var(--accent, #ff8c42); background: rgba(255,140,66,.12); border-radius: 999px; padding: 3px 9px; }

/* ===== MORSKOJ BOJ ===== */
.sb-wrap { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.sb-col { display: flex; flex-direction: column; align-items: center; }
.sb-label { font-size: 12px; color: var(--text-secondary, #65676B); margin-bottom: 4px; }
.sb-grid { display: grid; grid-template-columns: repeat(10, 1fr); width: min(200px, 60vw); border: 1px solid var(--border-strong, rgba(0,0,0,.2)); background: var(--border-strong, rgba(0,0,0,.2)); gap: 1px; }
.sbc {
    aspect-ratio: 1 / 1; background: var(--bubble-other, #fff); display: flex; align-items: center; justify-content: center;
    font-size: 11px; color: var(--text-secondary, #65676B); line-height: 1;
}
.sb-grid.can-tap .sbc { cursor: pointer; }
.sb-grid.can-tap .sbc:hover { background: var(--accent-light, #fff0eb); }
.sb-ship { background: #7fa8c9; }
.sb-ship-hit { background: #e8502e; color: #fff; }
.sb-miss { color: var(--text-secondary, #888); }
.sb-hit { background: #e8502e; color: #fff; }
.sb-sunk { background: #7a1f12; color: #fff; }

/* ===== GRUPPOVOE LOBBY ===== */
.aya-game-lobby { text-align: center; }
.lobby-q { font-size: 14px; margin-bottom: 8px; color: var(--text-secondary, #65676B); }
.lobby-players { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin-bottom: 10px; }
.lobby-player { background: var(--border, rgba(0,56,65,.08)); border-radius: 12px; padding: 4px 10px; font-size: 13px; }
.lobby-in, .lobby-wait { font-size: 13px; color: var(--text-secondary, #65676B); align-self: center; }

/* ===== TABLICA OCHKOV ===== */
.aya-score { margin-top: 10px; border-top: 1px solid var(--border, rgba(0,0,0,.08)); padding-top: 8px; }
.aya-score-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 4px; border-radius: 6px; }
.aya-score-row.win { background: var(--aya-pill-active-bg, #cfe8db); font-weight: 700; }
.aya-score-row b { color: var(--brand, #005f6d); }

/* ===== VIKTORINA ===== */
.quiz-head { font-size: 12px; color: var(--text-secondary, #65676B); text-align: center; }
.quiz-q { font-size: 15px; font-weight: 600; margin: 8px 0 10px; text-align: center; }
.quiz-opts { display: flex; flex-direction: column; gap: 8px; }
.quiz-opt { text-align: left; white-space: normal; }
.quiz-opt.chosen { border-color: var(--accent, #ff8c42); }
.quiz-opt.correct { background: #d6f0dc; border-color: #2e9e50; color: #16341f; }
.quiz-opt.wrong { background: #f7d9d2; border-color: #e8502e; color: #5a1c11; }
.quiz-timer { font-weight: 700; color: var(--brand, #005f6d); }

/* ===== VISELICA ===== */
.hm-head { font-size: 12px; color: var(--text-secondary, #65676B); text-align: center; }
.hm-stage { font-size: 40px; text-align: center; margin: 4px 0; }
.hm-mask { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin: 6px 0; }
.hm-ch { min-width: 18px; text-align: center; font-size: 22px; font-weight: 700; border-bottom: 2px solid var(--text, #1A1D21); }
.hm-wrong { text-align: center; font-size: 13px; color: #e8502e; margin: 4px 0; }
.hm-last { text-align: center; font-size: 12px; color: var(--text-secondary, #65676B); }
.hm-keys { display: grid; grid-template-columns: repeat(11, 1fr); gap: 3px; margin: 8px 0; }
.hm-key { padding: 6px 0; font-size: 13px; min-width: 0; }

/* ===== GORODA ===== */
.cities-last { font-size: 14px; text-align: center; }
.cities-need { text-align: center; font-size: 13px; color: var(--brand, #005f6d); font-weight: 600; margin: 4px 0; }
.cities-used { font-size: 12px; color: var(--text-secondary, #65676B); margin: 6px 0; word-break: break-word; }
.cities-input { display: flex; gap: 6px; margin-top: 8px; }
.cities-field { flex: 1; min-width: 0; border: 1px solid var(--border-strong, rgba(0,0,0,.16)); border-radius: 10px; padding: 8px 10px; font-size: 14px; background: var(--bg, #fff); color: var(--text, #1A1D21); }

/* ===== MENYU VYBORA IGRY ===== */
.aya-game-modal-ov { position: fixed; inset: 0; z-index: 4000; background: rgba(6,18,30,.45); display: flex; align-items: flex-end; justify-content: center; padding: 0; animation: aya-game-fade .15s ease; }
@keyframes aya-game-fade { from { opacity: 0; } to { opacity: 1; } }
.aya-game-modal { width: 100%; max-width: 480px; background: var(--bg, #fff); color: var(--text, #1A1D21); border-radius: 22px 22px 0 0; padding: 10px 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px rgba(0,16,34,.25); animation: aya-game-up .22s cubic-bezier(.22,1,.36,1); }
@keyframes aya-game-up { from { transform: translateY(24px); opacity: .6; } to { transform: translateY(0); opacity: 1; } }
/* ruchka-grabber sverhu shtorki */
.aya-game-modal::before { content: ''; display: block; width: 36px; height: 4px; border-radius: 999px; background: var(--text-tertiary, #6E7177); opacity: .35; margin: 2px auto 12px; }
.aya-game-modal-title { font-weight: 700; font-size: 17px; letter-spacing: -.01em; text-align: center; margin-bottom: 14px; }
.aya-game-modal-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 14px; }
.aya-game-pick { display: flex; flex-direction: column; align-items: center; gap: 7px; padding: 15px 8px; border: 1px solid var(--border, rgba(0,56,65,.1)); border-radius: 16px; background: var(--bubble-other, #fff); color: var(--text, #1A1D21); font-size: 13px; font-weight: 600; cursor: pointer; box-shadow: 0 1px 2px rgba(0,56,65,.05); transition: transform .12s ease, box-shadow .15s ease; }
.aya-game-pick:active { transform: scale(.96); }
.pick-ic { font-size: 28px; }
.aya-game-modal-close { width: 100%; }
.quiz-theme-list { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 14px; }
.quiz-count-row { display: flex; align-items: center; gap: 8px; justify-content: center; margin-bottom: 14px; font-size: 14px; }
/* Vybor varianta nard (Короткие/Длинные) */
.nardy-variants { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.nardy-var { flex-direction: row; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; }
.nardy-vtxt { display: flex; flex-direction: column; gap: 2px; }
.nardy-vtxt b { font-size: 15px; }
.nardy-desc { font-size: 12px; font-weight: 400; color: var(--text-secondary, #65676B); }
.nardy-colors { flex-direction: row; }
.nardy-colors .nardy-var { flex: 1; justify-content: center; text-align: center; }
/* Dlinnye nardy: bara net — delitel po centru kak uzkij pazh-zheobok v dereve */
.bg-wrap-long .bg-bar { width: 12px; flex-basis: 12px; width: 3.4cqw; flex-basis: 3.4cqw; background: linear-gradient(90deg, rgba(0,0,0,.32), rgba(0,0,0,.1) 50%, rgba(0,0,0,.32)); box-shadow: inset 0 0 5px rgba(0,0,0,.4); }
body.dark-theme .bg-wrap-long .bg-bar { background: linear-gradient(90deg, rgba(0,0,0,.45), rgba(0,0,0,.18) 50%, rgba(0,0,0,.45)); }

/* ===== POLNOEKRANNYJ REZHIM DOSKI ===== */
body.aya-game-fs-open { overflow: hidden; }                              /* chat pod overlayem ne skrollit */
.aya-game-fs-ov {
    position: fixed; inset: 0; z-index: 5000; display: flex; align-items: center; justify-content: center;
    background: var(--bg, #fff); overflow: auto;
    padding: calc(56px + env(safe-area-inset-top)) 12px calc(16px + env(safe-area-inset-bottom));
    animation: aya-game-fade .15s ease;
}
.aya-game-fs-close {
    position: fixed; top: calc(10px + env(safe-area-inset-top)); right: calc(12px + env(safe-area-inset-right)); z-index: 5001;
    width: 42px; height: 42px; border: none; border-radius: 50%; cursor: pointer;
    background: var(--soft, rgba(0,0,0,.08)); color: var(--text, #1A1D21); font-size: 20px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 10px rgba(0,40,48,.14);
}
.aya-game-fs-close:active { transform: scale(.95); }
.aya-game-fs-host { width: 100%; display: flex; justify-content: center; }
.aya-game-fs-host .aya-game { max-width: min(560px, 96vw); width: 100%; box-shadow: none; }
.aya-game-fs-host .aya-game-expand { display: none; }                    /* v polnoekranke pryachem — est knopka zakrytiya */
.aya-game-fs-host .aya-game-title { font-size: 18px; }
/* Uvelichivaem doski (perekryvaem vw/px-kapy) */
.aya-game-fs-host .ttt-board { width: min(400px, 80vmin); }
.aya-game-fs-host .ch-board,
.aya-game-fs-host .rv-board { width: min(460px, 88vmin); }
.aya-game-fs-host .cs-board { width: min(480px, 90vmin); }
.aya-game-fs-host .c4-board { width: min(440px, 86vmin); }
/* px — folbэk dlya brauzerov bez container queries; cqw povtoryaem, chtoby fs-pravilo ne lomalo proporcii */
.aya-game-fs-host .bg-half { height: 150px; height: 29cqw; }
.aya-game-fs-host .bg-disc { width: 26px; height: 26px; width: 5.1cqw; height: 5.1cqw; }
.aya-game-fs-host .sb-wrap { gap: 14px; }

/* LANDSCAPE (povyornutyj ekran) v POLNOM ekrane, tolko nardy: DVE KOLONKI.
   Sleva — doska .bg-wrap maksimalno po VYSOTE, sprava — panel .bg-side (kubiki, status, knopki).
   Shirina doski schitaetsya OT VYSOTY ekrana: vysota doski = 0.58*(w-18px)+21px (dve poloviny po
   29cqw + rama), poetomu w = calc(166vh - 160px) daet ~96% dostupnoj vysoty (overlay est 56px
   sverhu + 16px snizu + padding kartochki). Kapy 66vw/920px — chtoby panel sprava vsegda vlezala.
   cqw-masshtabirovanie vnutri .bg-wrap ne trogaem — ono ot shiriny samoj doski. */
@media (orientation: landscape) {
    .aya-game-fs-host .aya-game-backgammon,
    .aya-game-fs-host .aya-game-longnard {
        max-width: none;
        display: flex; flex-direction: row; align-items: center; justify-content: center;
        gap: 18px; padding: 10px 14px;
    }
    /* zagolovok ne dolzhen syest kolonku — absolyutom v svobodnuyu polosu NAD kartochkoj
       (overlay imeet 56px sverhu pod knopku zakrytiya, tuda i vstaet, ne perekryvaya dosku) */
    .aya-game-fs-host .aya-game-backgammon .aya-game-title,
    .aya-game-fs-host .aya-game-longnard .aya-game-title {
        position: absolute; top: -32px; left: 4px; margin: 0; padding: 0;
        font-size: 15px; opacity: .8;
    }
    /* LEVAYA kolonka: doska, razmer ot vysoty ekrana (obe nardy: .bg-wrap i .bg-wrap-long) */
    .aya-game-fs-host .aya-game-backgammon .bg-wrap,
    .aya-game-fs-host .aya-game-longnard .bg-wrap {
        flex: 0 0 auto; margin: 0;
        width: min(calc(166vh - 160px), 72vw, 920px); max-width: none;
    }
    /* PRAVAYA kolonka: kubiki + status + upravlenie vertikalno, po centru ostavshejsya shiriny */
    .aya-game-fs-host .bg-side {
        flex: 1 1 auto; min-width: 140px; max-width: 300px; align-self: stretch;
        display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    }
    /* kubiki vne .bg-wrap (cqw tut = vyuport) — fiksiruem priyatnyj krupnyj razmer v px */
    .aya-game-fs-host .bg-side .bg-die { width: 46px; height: 46px; font-size: 24px; }
    .aya-game-fs-host .bg-side .aya-game-status { font-size: 14px; }
    .aya-game-fs-host .bg-side .aya-game-controls { flex-direction: column; align-items: stretch; width: 100%; max-width: 190px; }
}
.aya-game-fs-host .sb-grid { width: min(340px, 44vmin); }

/* ===== TYOMNAYA TEMA ===== */
body.dark-theme .aya-game { background: var(--bubble-other, #2D333B); box-shadow: 0 2px 10px rgba(0,0,0,.3); }
body.dark-theme .ttt-cell { background: rgba(255,255,255,.06); }
body.dark-theme .sbc { background: #1f262d; }
body.dark-theme .sb-ship { background: #3d6f9a; }
body.dark-theme .ch-light { background: #c9a97a; }
body.dark-theme .ch-dark { background: #6d4a29; }
body.dark-theme .cs-light { background: #c9a97a; }
body.dark-theme .cs-dark { background: #6d4a29; }
body.dark-theme .rv-board { background: #1a5c37; border-color: #0f3d24; }
body.dark-theme .rv-b2 { background: #d8d8d8; }
body.dark-theme .c4-disc-0 { background: #161d27; }
body.dark-theme .c4-board { background: #24528f; }
body.dark-theme .bg-wrap {
    background:
        repeating-linear-gradient(92deg, rgba(255,214,160,.04) 0 3px, rgba(0,0,0,0) 3px 8px, rgba(0,0,0,.1) 8px 11px, rgba(0,0,0,0) 11px 17px),
        linear-gradient(160deg, #452a12, #35200c 55%, #2a1808);
    border-color: #1e1105;
    box-shadow: inset 0 1px 0 rgba(255,206,150,.08), inset 0 0 10px rgba(0,0,0,.5), 0 4px 14px rgba(0,0,0,.4);
}
body.dark-theme .bg-half { background: linear-gradient(180deg, #543018, #472613); box-shadow: inset 0 0 12px rgba(0,0,0,.55); }
body.dark-theme .bg-pt-a { --pt1: #cfa872; --pt2: #a67c46; }
body.dark-theme .bg-pt-b { --pt1: #8a4a20; --pt2: #613111; }
body.dark-theme .bg-bar { background: linear-gradient(90deg, #1e1105, #3a2110 28%, #472a14 50%, #3a2110 72%, #1a0e04); }
body.dark-theme .bg-die { --pip: #211505; --face: linear-gradient(145deg, #efe8d6, #d5c9ae); box-shadow: inset 0 1px 1px rgba(255,255,255,.6), inset 0 -2px 3px rgba(60,42,20,.4), 0 2px 5px rgba(0,0,0,.5); }
body.dark-theme .bg-count-1 { background: #efe8d6; }
body.dark-theme .cities-field { background: #1f262d; }
body.dark-theme .quiz-opt.correct { background: #204a2a; color: #d6f0dc; }
body.dark-theme .quiz-opt.wrong { background: #4a201a; color: #f7d9d2; }
body.dark-theme .aya-game-modal { background: #161D27; }
body.dark-theme .aya-game-pick { background: #222b35; }
body.dark-theme .aya-game-fs-ov { background: var(--bg, #0f141a); }
body.dark-theme .aya-game-fs-close { background: rgba(255,255,255,.12); color: #fff; }
