/* ============================================================
   ДУРАК ОНЛАЙН — дизайн-система прототипа
   Мобильный first (в КР основной трафик — Android), светлая тема,
   один зелёный акцент, сукно стола, орнамент «кочкор мүйүз» на сукне.
   ============================================================ */

/* Шрифты — со своего сервера (/fonts, переменные woff2: кириллица + латиница; взяты из Google Fonts, лицензия OFL) */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("../fonts/manrope-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400 800; font-display: swap; src: url("../fonts/manrope-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 500 600; font-display: swap; src: url("../fonts/unbounded-cyrillic.woff2") format("woff2"); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Unbounded"; font-style: normal; font-weight: 500 600; font-display: swap; src: url("../fonts/unbounded-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
    color-scheme: light;
    --bg: #f6f7f3;
    --bg-2: #eef1ec;
    --surface: #ffffff;
    --surface-2: #f1f4ef;
    --line: #e0e6de;
    --line-strong: #c5d0c8;
    --felt: #14664a;
    --felt-2: #1f8262;
    --accent: #0f7a57;
    --accent-2: #18966c;
    --accent-ink: #ffffff;
    --accent-soft: rgba(15, 122, 87, .08);
    --accent-line: rgba(15, 122, 87, .22);
    --warm: #ffe2a0;
    --note: #8a5a00;
    --note-bg: #fff6dd;
    --note-line: #e3c36a;
    --red: #d93a3f;
    --green: #1f9d6b;
    --text: #17211d;
    --muted: #5c6a63;
    --card: #ffffff;
    --card-red: #d0312d;
    --card-black: #1b1f1d;

    --r-sm: 10px;
    --r: 16px;
    --r-lg: 24px;
    --shadow: 0 12px 32px rgba(20, 40, 30, .14);
    --shadow-sm: 0 1px 2px rgba(20, 40, 30, .05), 0 4px 14px rgba(20, 40, 30, .04);

    --font-head: "Unbounded", system-ui, sans-serif;
    --font-body: "Manrope", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.55;
    min-height: 100vh;
    overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
* { -webkit-tap-highlight-color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
    /* Полоска таймера — не украшение, а информация: без неё кажется, что время уже вышло */
    #timerBar { transition: revert !important; }
}

/* Орнамент: стилизованный «кочкор мүйүз» (бараний рог) — очень тихо, только фактура */
.ornament {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cpath d='M60 20c-14 0-24 10-24 22 0 9 7 15 15 15 6 0 10-4 10-9 0-4-3-7-7-7M60 20c14 0 24 10 24 22 0 9-7 15-15 15-6 0-10-4-10-9 0-4 3-7 7-7M60 100c-14 0-24-10-24-22 0-9 7-15 15-15 6 0 10 4 10 9 0 4-3 7-7 7M60 100c14 0 24-10 24-22 0-9-7-15-15-15-6 0-10 4-10 9 0 4 3 7 7 7' fill='none' stroke='%230f7a57' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-size: 120px 120px;
}

.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); }
@media (min-width: 1100px) { .container { padding: 0 24px; } }

/* ---------- Кнопки ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 48px; padding: 0 22px;
    border-radius: 999px; font-weight: 700; font-size: 15px;
    transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
    white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-2); }
.btn-primary:active { background: #0c6548; }
.btn-ghost { border: 1px solid var(--line-strong); background: var(--surface); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm { min-height: 44px; padding: 0 18px; font-size: 14px; }
.btn[disabled] { background: var(--surface-2); color: #7d8a83; border-color: var(--line); box-shadow: none; pointer-events: none; }

/* ---------- Шапка ---------- */
.header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 12px; }
@media (min-width: 960px) { .header-inner { height: 64px; } }
.logo { font-family: var(--font-head); font-weight: 600; font-size: 14px; letter-spacing: .04em; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.logo-mark {
    width: 30px; height: 30px; border-radius: var(--r-sm);
    background: var(--accent);
    color: var(--accent-ink); display: grid; place-items: center; font-size: 16px; flex: 0 0 auto;
}
.nav { display: none; gap: 24px; color: var(--muted); font-weight: 600; font-size: 15px; }
.nav a { transition: color .15s ease; }
.nav a:hover { color: var(--text); }
.nav a { padding: 10px 0; }
.nav a.active { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.header-actions { display: flex; gap: 8px; align-items: center; }
.lang { display: none; font-size: 13px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; }
.lang b { color: var(--text); }

@media (max-width: 359px) { .logo { font-size: 12px; gap: 6px; } .logo-mark { width: 26px; height: 26px; font-size: 14px; } .header .btn-sm { padding: 0 12px; } }
@media (min-width: 400px) { .logo { font-size: 16px; } }
@media (min-width: 480px) { .lang { display: inline-block; } .logo { font-size: 18px; } }
@media (min-width: 960px) { .nav { display: flex; } }
@media (min-width: 1100px) { .logo { font-size: 20px; } }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 40px 0 56px; overflow: hidden; }
.hero-grid { position: relative; display: grid; gap: 36px; align-items: center; }
.badge {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 13px; font-weight: 700; color: var(--accent);
    background: var(--accent-soft); border: 1px solid var(--accent-line);
    padding: 6px 12px; border-radius: 999px;
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(31, 157, 107, .18); }
h1 {
    font-family: var(--font-head); font-weight: 600;
    font-size: clamp(28px, 7.4vw, 48px); line-height: 1.12; letter-spacing: -.02em;
    margin: 18px 0 16px;
}
h1 em { font-style: normal; color: var(--accent); }
.lead { color: var(--muted); font-size: 17px; max-width: 540px; }
.lead a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
@media (max-width: 479px) { .hero-cta .btn { flex: 1 1 100%; } }
.hero-facts { display: grid; grid-template-columns: repeat(3, auto); justify-content: start; gap: 12px 28px; margin-top: 32px; }
.fact b { display: block; font-family: var(--font-head); font-weight: 600; font-size: 18px; white-space: nowrap; }
.fact span { color: var(--muted); font-size: 13px; }

/* Веер карт в hero */
.fan { position: relative; height: 210px; display: grid; place-items: center; }
.fan .pcard { position: absolute; width: 96px; height: 136px; transform-origin: 50% 120%; box-shadow: var(--shadow); }
.fan .pcard .c-tl, .fan .pcard .c-br { font-size: 22px; }
.fan .pcard .c-tl small, .fan .pcard .c-br small { font-size: 19px; }
.fan .pcard:nth-child(1) { transform: rotate(-30deg) translateX(-40px); }
.fan .pcard:nth-child(2) { transform: rotate(-10deg) translateX(-14px); }
.fan .pcard:nth-child(3) { transform: rotate(10deg) translateX(14px); }
.fan .pcard:nth-child(4) { transform: rotate(30deg) translateX(40px); }

@media (min-width: 860px) {
    .hero { padding: 72px 0 88px; }
    .hero-grid { grid-template-columns: 1.1fr .9fr; }
    .fan { height: 380px; }
    .fan .pcard { width: 160px; height: 228px; }
    .fan .pcard .c-tl, .fan .pcard .c-br { font-size: 28px; top: 12px; left: 12px; }
    .fan .pcard .c-br { top: auto; left: auto; bottom: 12px; right: 12px; }
    .fan .pcard .c-tl small, .fan .pcard .c-br small { font-size: 24px; }
    .fan .pcard .c-mid { font-size: 64px; }
}

/* ---------- Игральная карта ---------- */
.pcard {
    background: var(--card); color: var(--card-black);
    border-radius: 12px; position: relative;
    font-family: var(--font-head); font-weight: 600;
    user-select: none;
    border: 1px solid rgba(23, 33, 29, .12);
}
.pcard.red { color: var(--card-red); }
.pcard .c-tl, .pcard .c-br { position: absolute; display: flex; flex-direction: column; align-items: center; line-height: 1; font-size: 18px; }
.pcard .c-tl { top: 8px; left: 8px; }
.pcard .c-br { bottom: 8px; right: 8px; transform: rotate(180deg); }
.pcard .c-tl small, .pcard .c-br small { font-size: 16px; margin-top: 2px; }
.pcard .c-mid { position: absolute; inset: 0; display: grid; place-items: center; font-size: 46px; opacity: .9; }
.pcard.back {
    background: linear-gradient(135deg, var(--felt-2), var(--felt));
    border: 3px solid var(--card);
}
.pcard.back::after {
    content: ""; position: absolute; inset: 6px; border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, .45);
    background-image: inherit;
}

/* ---------- Секции ---------- */
section { padding: 56px 0; }
.section-head { margin-bottom: 28px; }
.eyebrow { color: var(--accent); font-weight: 800; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
h2 { font-family: var(--font-head); font-weight: 500; font-size: clamp(20px, 4.4vw, 28px); line-height: 1.22; letter-spacing: -.01em; margin-top: 8px; }
.section-sub { color: var(--muted); margin-top: 10px; max-width: 620px; }

.grid-3 { display: grid; gap: 14px; }
@media (min-width: 760px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }

.tile {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
    padding: 22px; box-shadow: var(--shadow-sm);
}
.tile h3 { font-size: 18px; margin: 12px 0 6px; }
.tile h3:first-child { margin-top: 0; }
.tile p a, .faq p a, .rg p a, .check-list a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.tile p { color: var(--muted); font-size: 15px; }
.tile-ico {
    width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
    background: var(--accent-soft); color: var(--accent); font-size: 20px;
}
.step-num { font-family: var(--font-head); font-weight: 600; color: var(--accent); font-size: 14px; }

/* Блок доверия */
.trust {
    background: var(--surface); box-shadow: var(--shadow-sm);
    border: 1px solid var(--line); border-radius: var(--r-lg);
    padding: 28px 20px; display: grid; gap: 24px;
}
@media (min-width: 860px) { .trust { grid-template-columns: 1fr 1fr; padding: 40px; } }
.check-list { list-style: none; display: grid; gap: 14px; }
.check-list li { display: flex; gap: 12px; }
.check-list li::before {
    content: "✓"; flex: 0 0 24px; height: 24px; border-radius: 50%;
    background: rgba(31, 157, 107, .14); color: var(--green);
    display: grid; place-items: center; font-weight: 800; font-size: 13px; margin-top: 1px;
}
.check-list b { display: block; }
.check-list span { color: var(--muted); font-size: 14px; }
.placeholder { color: var(--note); background: var(--note-bg); border: 1px dashed var(--note-line); padding: 1px 6px; border-radius: 6px; font-size: .92em; }

/* FAQ */
.faq { display: grid; gap: 10px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.faq summary { cursor: pointer; font-weight: 700; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 18px; border-radius: var(--r); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent); font-size: 20px; line-height: 1; }
.faq details[open] summary::after { content: "–"; }
.faq p { color: var(--muted); padding: 0 18px 16px; font-size: 15px; }

/* Ответственная игра */
.rg {
    display: flex; gap: 16px; align-items: flex-start;
    background: rgba(217, 58, 63, .05); border: 1px solid rgba(217, 58, 63, .22);
    border-radius: var(--r); padding: 18px;
}
.rg-age { flex: 0 0 auto; font-family: var(--font-head); font-weight: 600; font-size: 18px; border: 2px solid var(--red); color: var(--red); border-radius: 50%; width: 48px; height: 48px; display: grid; place-items: center; }
.rg p { color: var(--muted); font-size: 14px; }

/* Футер */
.footer { border-top: 1px solid var(--line); padding: 32px 0 40px; color: var(--muted); font-size: 14px; }
.footer-grid { display: grid; gap: 20px; }
@media (min-width: 760px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.footer .footer-title { color: var(--text); margin-bottom: 4px; font-size: 14px; font-weight: 700; }
.footer a:not(.logo) { display: block; padding: 8px 0; }
.footer .logo { color: var(--text); margin-bottom: 10px; }
.footer a:hover { color: var(--text); }

/* Нижняя навигация (мобильная) */
.tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    display: grid; grid-template-columns: repeat(4, 1fr);
    background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line);
    backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 700; color: var(--muted); padding: 6px 4px 4px; }
.tabbar svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active { color: var(--accent); }
.tabbar a.active::before { content: ""; position: absolute; top: -6px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent); }
@media (min-width: 960px) { .tabbar { display: none; } }
.has-tabbar { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
@media (min-width: 960px) { .has-tabbar { padding-bottom: 0; } }

/* Телефон боком: шапка не липнет, панель вкладок в одну строку */
@media (orientation: landscape) and (max-height: 520px) {
    .header { position: static; }
    .header-inner { height: 48px; }
    .tabbar { padding: 2px 4px calc(2px + env(safe-area-inset-bottom)); }
    .tabbar a { flex-direction: row; justify-content: center; gap: 6px; font-size: 12px; padding: 6px 4px; }
    .tabbar svg { width: 20px; height: 20px; }
    .tabbar a.active::before { top: -2px; }
    .has-tabbar { padding-bottom: calc(48px + env(safe-area-inset-bottom)); }
    .hero { padding: 20px 0 32px; }
    html { scroll-padding-top: 12px; }
}

/* ============================================================
   ЛОББИ
   ============================================================ */
.lobby-top { padding-top: 14px; padding-bottom: 8px; }
.balance-card {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    background: linear-gradient(135deg, var(--felt-2), var(--felt));
    border-radius: var(--r); padding: 12px 16px; margin-bottom: 12px;
    position: relative; overflow: hidden;
}
.balance-card { color: #fff; box-shadow: var(--shadow-sm); }
.balance-card > * { position: relative; }
.balance-label { font-size: 13px; color: #fff; opacity: .92; }
.balance-sum { font-family: var(--font-head); font-weight: 600; font-size: 22px; }
.demo-note { font-size: 12px; color: #fff; }
.balance-card .btn { background: #fff; color: var(--accent); box-shadow: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 6px; }
.chip {
    flex: 0 0 auto; min-height: 40px; padding: 0 16px; border-radius: 999px; display: inline-flex; align-items: center;
    background: var(--surface); border: 1px solid var(--line-strong);
    font-size: 14px; font-weight: 700; color: var(--muted);
}
@media (max-width: 479px) { .chips { gap: 6px; } .chip { padding: 0 11px; font-size: 13px; } }
.chip { transition: background .15s ease, color .15s ease, border-color .15s ease; }
.chip:hover { border-color: var(--accent); }
.chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.tables { display: grid; gap: 10px; margin: 10px 0 32px; }
@media (min-width: 760px) { .tables { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1100px) { .tables { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 359px) { .table-row { gap: 10px; padding: 12px; } .stake { width: 46px; height: 46px; font-size: 12px; } }
.table-row {
    display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
    padding: 14px; box-shadow: var(--shadow-sm);
    transition: border-color .15s ease, box-shadow .15s ease;
}
.table-row:hover { border-color: var(--accent-line); }
.stake {
    width: 54px; height: 54px; border-radius: 50%;
    display: grid; place-items: center; align-content: center; text-align: center;
    background: radial-gradient(circle at 30% 30%, var(--felt-2), var(--felt));
    color: #fff; font-weight: 600;
    font-family: var(--font-head); font-size: 14px; line-height: 1.05;
}
.stake small { display: block; font-family: var(--font-body); font-size: 11px; color: #fff; font-weight: 700; }
.table-info { min-width: 0; }
.table-info b { display: block; font-size: 15px; }
.table-meta .win { display: inline; color: var(--text); font-weight: 700; font-size: inherit; }
.seats-dots { display: inline-flex; gap: 4px; }
.tables-note { color: var(--muted); font-size: 13px; margin-top: 14px; }
.lobby-msg { margin-top: 12px; padding: 12px 14px; border-radius: var(--r); border: 1px dashed var(--note-line); background: var(--note-bg); color: var(--note); font-size: 14px; }
.lobby-msg a { text-decoration: underline; font-weight: 700; }
.empty { color: var(--muted); padding: 20px 0; display: grid; gap: 12px; justify-items: start; }
.table-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; color: var(--muted); font-size: 13px; margin-top: 4px; }
.seats { display: flex; gap: 4px; margin-top: 8px; align-items: center; }
.seats-label { font-size: 12px; font-weight: 700; color: var(--muted); margin-left: 4px; white-space: nowrap; }
.seat { width: 10px; height: 10px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px #93a39a; }
.seat.taken { background: var(--accent); box-shadow: none; }

.private-box {
    display: grid; gap: 12px; align-items: center;
    background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); padding: 18px;
}
@media (min-width: 760px) { .private-box { grid-template-columns: 1fr auto; } }
.private-box p { color: var(--muted); font-size: 14px; }

/* ============================================================
   ИГРОВОЙ СТОЛ
   Размеры карт — через переменные: --hand-w (рука), --tbl-w (стол),
   --opp-w (соперник). Брейкпоинты ниже меняют только их.
   ============================================================ */
.game-body { background: var(--bg); height: 100vh; height: 100dvh; overflow: hidden; overscroll-behavior: none; }
.game {
    --hand-w: 68px; --tbl-w: 54px; --opp-w: 38px;
    height: 100%; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto;
    max-width: 900px; margin: 0 auto;
    touch-action: manipulation; -webkit-user-select: none; user-select: none;
}
.game-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; gap: 10px; }
.game-bar .back { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); }
.game-bar .back:hover { border-color: var(--accent); }
.game-title { text-align: center; font-size: 13px; color: var(--muted); font-family: var(--font-body); font-weight: 400; line-height: 1.4; letter-spacing: 0; margin: 0; }
.game-title b { display: block; color: var(--text); font-size: 15px; }

/* Карта на столе масштабируется от своей ширины --w */
.game .pcard {
    width: var(--w); height: calc(var(--w) * 1.42); flex: 0 0 auto;
    font-size: calc(var(--w) * .22); border-radius: calc(var(--w) * .13);
}
.game .pcard .c-tl, .game .pcard .c-br { font-size: 1em; }
.game .pcard .c-tl { top: .4em; left: .4em; }
.game .pcard .c-br { bottom: .4em; right: .4em; }
.game .pcard .c-tl small, .game .pcard .c-br small { font-size: .9em; margin-top: .1em; }
.game .pcard .c-mid { font-size: 2em; }

.felt {
    position: relative; margin: 0 10px; border-radius: 28px; min-height: 0;
    background: radial-gradient(ellipse at 50% 45%, var(--felt-2), var(--felt) 70%);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .16), inset 0 10px 50px rgba(0, 0, 0, .18), var(--shadow);
    color: #fff;
    display: grid; grid-template-rows: auto minmax(0, 1fr) auto; padding: 12px; overflow: hidden;
}
.felt .ornament-layer { position: absolute; inset: 0; opacity: .07; pointer-events: none; filter: brightness(0) invert(1); }

.opponent { display: flex; flex-direction: column; align-items: center; gap: 6px; position: relative; }
.opp-id { display: flex; align-items: center; gap: 8px; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto;
    background: var(--surface-2); color: var(--accent); border: 2px solid #fff; transition: box-shadow .2s ease;
    display: grid; place-items: center; font-weight: 800;
}
.opp-name { font-size: 13px; font-weight: 700; line-height: 1.25; }
.opp-name small { display: block; font-weight: 600; color: #fff; opacity: .92; font-size: 12px; }
/* Чей ход: кольцо вокруг бота или подсветка своей руки */
.game[data-turn="b"] .avatar { box-shadow: 0 0 0 3px var(--warm), 0 0 0 7px rgba(255, 226, 160, .3); }
.game[data-turn="p"] .hand { background: linear-gradient(180deg, transparent, var(--accent-soft)); border-radius: var(--r); }
/* Рука сжимается сама: чем больше карт (--n), тем сильнее нахлёст */
.opp-hand { --n: 6; display: flex; justify-content: center; width: 100%; max-width: 420px; height: calc(var(--opp-w) * 1.42); }
.opp-hand .pcard {
    --w: var(--opp-w); border-width: 2px;
    margin-left: min(calc(var(--opp-w) * -.6), calc((100% - var(--opp-w) * var(--n)) / (var(--n) - 1)));
}
.opp-hand .pcard:first-child { margin-left: 0; }

.center { display: grid; grid-template-columns: calc(var(--tbl-w) * 1.9) minmax(0, 1fr); gap: 10px; align-items: center; position: relative; min-height: 0; }
.deck-zone { position: relative; height: calc(var(--tbl-w) * 1.42 + 34px); }
.deck-zone .pcard { --w: var(--tbl-w); position: absolute; top: 12px; }
.deck-zone .trump { left: calc(var(--tbl-w) * .62); transform: rotate(90deg); }
.deck-zone .stack { left: 0; }
.deck-count { position: absolute; left: 0; bottom: 0; font-size: 13px; font-weight: 800; color: #fff; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.trump-suit { background: #fff; color: var(--card-black); border-radius: 6px; padding: 0 6px; font-size: 18px; line-height: 1.3; }
.trump-suit.red { color: var(--card-red); }

.battlefield { display: flex; flex-wrap: wrap; justify-content: center; align-content: center; gap: 8px 10px; min-height: calc(var(--tbl-w) * 1.42 + 16px); }
.pair { position: relative; width: calc(var(--tbl-w) + 12px); height: calc(var(--tbl-w) * 1.42 + 16px); }
.pair .pcard { --w: var(--tbl-w); position: absolute; top: 0; left: 0; }
.pair .def { top: 16px; left: 12px; transform: rotate(8deg); }

.status {
    justify-self: center; text-align: center; font-weight: 700; font-size: 14px; line-height: 1.35;
    background: rgba(0, 0, 0, .3); color: #fff; padding: 6px 14px; border-radius: 18px;
    min-height: 31px; margin-top: 4px; max-width: 100%;
}

.player-zone { padding: 10px 10px 0; min-width: 0; }
.hand { --n: 6; display: flex; padding: 22px 0 6px; overflow-x: auto; scrollbar-width: none; min-height: calc(var(--hand-w) * 1.42 + 28px); }
.hand .pcard {
    --w: var(--hand-w); cursor: pointer; padding: 0; text-align: left;
    /* шаг между картами не меньше 18px: так в экран 360px влезает ~18 карт, дальше рука прокручивается */
    margin-left: max(calc(18px - var(--hand-w)), min(calc(var(--hand-w) * -.3), calc((100% - var(--hand-w) * var(--n)) / (var(--n) - 1))));
    transition: transform .15s ease, box-shadow .15s ease;
    box-shadow: 0 4px 12px rgba(20, 40, 30, .16);
}
.hand::-webkit-scrollbar { display: none; }
.hand .pcard:first-child { margin-left: auto; }
.hand .pcard:last-child { margin-right: auto; }
.hand .pcard.is-trump { box-shadow: inset 0 0 0 2px #e0a92e, 0 4px 12px rgba(20, 40, 30, .16); }
.hand .pcard.playable:active { transform: translateY(-18px) scale(1.03); }
.hand .pcard.playable { transform: translateY(-10px); }
.hand .pcard.dim { cursor: default; background: #f3f5f1; }
.hand .pcard.dim > * { opacity: .5; }
@media (hover: hover) { .hand .pcard.playable:hover { transform: translateY(-18px); } }

/* Показываем только доступное действие; место под кнопку зарезервировано */
.actions { display: flex; justify-content: center; gap: 10px; padding: 8px 14px calc(14px + env(safe-area-inset-bottom)); min-height: calc(74px + env(safe-area-inset-bottom)); }
.actions .btn { flex: 1; max-width: 420px; min-height: 52px; font-size: 16px; }
.actions .btn[disabled] { display: none; }
#takeBtn { border: 2px solid var(--accent); color: var(--accent); }

/* Узкие телефоны */
@media (max-width: 359px) { .game { --hand-w: 60px; --tbl-w: 42px; --opp-w: 32px; } .battlefield { gap: 6px 8px; } }

/* Планшет и окно ноутбука */
@media (min-width: 600px) and (min-height: 600px) {
    .game { --hand-w: 84px; --tbl-w: 70px; --opp-w: 46px; }
    .avatar { width: 44px; height: 44px; }
    .battlefield { gap: 12px 16px; }
}

/* ПК и ноутбук */
@media (max-width: 599px) and (min-height: 700px) { .game { --hand-w: 76px; --tbl-w: 58px; --opp-w: 34px; } }
@media (min-width: 1024px) {
    .game { max-width: 960px; }
    .center { max-width: 760px; width: 100%; margin: 0 auto; }
    .felt { border-radius: 40px; padding: 18px 24px; }
    .actions { width: 100%; max-width: 520px; margin: 0 auto; }
}
@media (min-width: 1024px) and (min-height: 760px) {
    .game { --hand-w: 104px; --tbl-w: 86px; --opp-w: 54px; padding-bottom: 12px; }
    .status { font-size: 16px; }
}

/* Телефон боком: кнопки уходят вправо от руки, соперник — в одну строку */
@media (orientation: landscape) and (max-height: 520px) {
    .game { --hand-w: 52px; --tbl-w: 42px; --opp-w: 28px; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr) auto; max-width: none; }
    .game-bar { grid-column: 1 / -1; padding: 4px max(14px, env(safe-area-inset-left)); }
    .game-bar .back { width: 40px; height: 40px; }
    .game-title { display: flex; gap: 8px; align-items: baseline; }
    .felt { grid-column: 1 / -1; padding: 6px 12px; border-radius: 18px; margin: 0 max(10px, env(safe-area-inset-left)); }
    .opponent { flex-direction: row; justify-content: center; gap: 12px; }
    .opp-hand { width: 220px; }
    .avatar { width: 28px; height: 28px; font-size: 13px; }
    .deck-zone { height: calc(var(--tbl-w) * 1.42 + 26px); }
    .deck-zone .pcard { top: 4px; }
    .battlefield { flex-wrap: nowrap; gap: 6px; }
    .status { font-size: 13px; min-height: 0; margin-top: 0; padding: 3px 12px; }
    .player-zone { padding: 0 0 0 max(10px, env(safe-area-inset-left)); }
    .hand { padding: 14px 0 6px; min-height: calc(var(--hand-w) * 1.42 + 20px); }
    .actions { flex-direction: column; justify-content: center; gap: 6px; padding: 4px max(10px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) 10px; }
    .actions { min-height: 0; min-width: 96px; }
    .actions .btn { flex: 0 0 auto; min-height: 44px; padding: 0 18px; font-size: 14px; }
}

/* ---------- Стол с живыми игроками ---------- */
.game.live { grid-template-rows: auto minmax(0, 1fr) auto auto auto; }
.game.no-board .opps, .game.no-board .center, .game.no-board .status,
.game.no-board .hand, .game.no-board .actions .btn, .game.no-board .timer { visibility: hidden; }
.opps { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; position: relative; }
.opp { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 999px; background: rgba(0, 0, 0, .2); transition: box-shadow .2s ease; }
.opp .avatar { width: 32px; height: 32px; font-size: 14px; }
.opp .opp-name { max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opp.is-waiting { box-shadow: 0 0 0 2px var(--warm), 0 0 0 6px rgba(255, 226, 160, .25); }
.opp.is-out { opacity: .55; }
#trumpSlot .pcard { --w: var(--tbl-w); position: absolute; top: 12px; left: calc(var(--tbl-w) * .62); transform: rotate(90deg); }
.pair.target .atk { outline: 3px solid var(--warm); outline-offset: 2px; cursor: pointer; }
.hand .pcard.selected { transform: translateY(-22px); box-shadow: 0 0 0 3px var(--accent), 0 8px 18px rgba(20, 40, 30, .25); }
.net-banner { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 3; max-width: calc(100% - 24px); background: var(--note-bg); color: var(--note); border: 1px dashed var(--note-line); border-radius: 14px; padding: 6px 14px; font-size: 13px; font-weight: 700; text-align: center; }
.overlay { position: absolute; inset: 0; z-index: 2; display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 14px; overflow-y: auto; }
.overlay[hidden], .net-banner[hidden] { display: none; }
.overlay-card { width: 100%; max-width: 440px; background: var(--surface); color: var(--text); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow); }
.overlay-card h2 { font-family: var(--font-body); font-weight: 800; font-size: 20px; margin: 0 0 12px; }
.overlay-note { color: var(--muted); font-size: 14px; margin-top: 12px; }
.seat-list { list-style: none; display: grid; gap: 8px; }
.seat-row { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.seat-row .avatar { border-color: var(--line-strong); }
.seat-row.empty-seat { color: var(--muted); font-weight: 600; }
.seat-row.empty-seat .avatar { border-style: dashed; color: var(--muted); background: transparent; }
.share-label { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin: 16px 0 6px; }
.share { display: flex; gap: 8px; }
.share input { flex: 1; min-width: 0; min-height: 44px; padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--line-strong); background: var(--bg-2); color: var(--text); font: inherit; font-size: 14px; }
.actions .btn[hidden] { display: none; }
@media (orientation: landscape) and (max-height: 520px) {
    .game.live { grid-template-rows: auto minmax(0, 1fr) auto auto; }
    .game.live .timer { grid-column: 1 / -1; }
    .opp .avatar { width: 26px; height: 26px; }
    .overlay-card { padding: 14px; }
    .seat-list { grid-template-columns: 1fr 1fr; }
}

/* Создание стола в лобби */
.create { margin-top: 0; }
.create-grid { display: grid; gap: 12px; margin-top: 14px; }
@media (min-width: 560px) { .create-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .create-grid { grid-template-columns: 2fr 1.4fr 1fr 1.4fr; } }
.check { display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 14px; font-weight: 600; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

.timer { height: 5px; background: var(--line); border-radius: 4px; overflow: hidden; margin: 8px 14px 0; }
.timer i { display: block; height: 100%; width: 100%; background: #93a39a; transform-origin: left; transform: scaleX(0); }
.timer.mine i { background: var(--accent); }

/* Модалка конца партии */
.modal { position: fixed; inset: 0; background: rgba(23, 33, 29, .45); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); display: none; place-items: center; z-index: 100; padding: 16px; }
.modal.open { display: grid; }
.modal-box { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--r-lg); padding: 28px 22px; max-width: 360px; width: 100%; text-align: center; }
.modal-box h2 { font-family: var(--font-head); font-weight: 600; font-size: 24px; margin: 0 0 8px; }
.modal-box .modal-link { display: inline-block; margin-top: 14px; color: var(--accent); font-weight: 700; font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.modal-box p { color: var(--muted); margin-bottom: 20px; }
.modal-box .btn { width: 100%; margin-top: 8px; }

/* ============================================================
   ВНУТРЕННИЕ СТРАНИЦЫ (правила, профиль, условия)
   ============================================================ */
.page { padding-top: 28px; padding-bottom: 48px; }
.page-narrow { max-width: 792px; }
.page h1 { font-size: clamp(24px, 5.6vw, 32px); margin: 8px 0 12px; }
.page .lead { max-width: none; }
.prose h2 { font-size: clamp(19px, 4vw, 24px); margin: 32px 0 10px; }
.prose { max-width: 68ch; }
.prose p, .prose li { color: #33413a; }
.toc { margin-top: 18px; }
.toc .chip:hover { color: var(--accent); }
.prose p + p { margin-top: 10px; }
.prose ul, .prose ol { padding-left: 22px; display: grid; gap: 6px; margin-top: 8px; }
.prose b { color: var(--text); }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.draft-note { margin: 16px 0 0; padding: 12px 14px; border-radius: var(--r); border: 1px dashed var(--note-line); background: var(--note-bg); color: var(--note); font-size: 14px; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; margin-top: 14px; box-shadow: var(--shadow-sm); }
.panel h2 { font-family: var(--font-body); font-size: 18px; margin: 0 0 4px; }
.panel > p { color: var(--muted); font-size: 14px; }
.panel-grid { display: grid; gap: 14px; }
@media (min-width: 860px) { .panel-grid { grid-template-columns: 1fr 1fr; align-items: start; } .panel-grid .panel { margin-top: 0; } }
.fields { display: grid; gap: 14px; margin-top: 16px; }
.field label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.field input, .field select {
    width: 100%; min-height: 48px; padding: 0 14px; border-radius: var(--r-sm);
    background: var(--surface); border: 1px solid var(--line-strong); color: var(--text); font: inherit;
}
.field input:focus, .field select:focus { border-color: var(--accent); outline: none; }
.field small { display: block; color: var(--muted); font-size: 13px; margin-top: 4px; }
.form-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.saved { color: #17805a; font-weight: 700; font-size: 14px; }
.note, .panel > p.note { color: var(--note); font-size: 13px; margin-top: 8px; }
.field-error { color: var(--red); font-size: 13px; font-weight: 700; margin-top: 4px; }

/* Объявление администрации (js/net.js) */
.announce-bar {
    position: sticky; top: 0; z-index: 60; padding: 8px 16px; text-align: center;
    font-size: 14px; font-weight: 600; color: var(--note); background: var(--note-bg); border-bottom: 1px solid var(--note-line);
}
.rest-bar a { text-decoration: underline; }
.rest-bar .rest-ok { margin-left: 8px; padding: 2px 12px; border-radius: 12px; background: var(--note); color: #fff; font-weight: 700; }

/* Тосты приглашений (js/net.js) */
.net-toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 80; display: grid; gap: 8px; width: min(420px, calc(100vw - 32px)); }
.net-toast { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 14px; border-radius: var(--r); background: var(--text); color: #fff; box-shadow: var(--shadow); font-size: 14px; font-weight: 600; animation: toastIn .25s ease-out both; }
.net-toast span { flex: 1; min-width: 0; }
.net-toast-btn { flex: none; padding: 6px 14px; border-radius: 14px; background: var(--accent-2); color: #fff; font-weight: 700; }
.net-toast-x { flex: none; width: 28px; height: 28px; border-radius: 50%; color: #fff; opacity: .7; font-size: 18px; }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .net-toast { animation: none; } }

/* Плашка «Связь потеряна» (js/net.js) — сверху любой страницы */
.conn-bar {
    position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 120;
    max-width: calc(100vw - 32px); padding: 8px 16px; border-radius: 999px; background: var(--text); color: #fff;
    font-size: 14px; font-weight: 700; text-align: center; box-shadow: var(--shadow); pointer-events: none;
}
.conn-bar[hidden] { display: none; }

/* ---------- Правила тринки: примеры комбинаций, переход между правилами ---------- */
.rules-switch { margin: 0; font-size: 14px; font-weight: 700; }
.rules-switch a { color: var(--accent); }
.rules-other { display: grid; gap: 2px; margin-top: 14px; padding: 12px 16px; border-radius: var(--r); border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--text); }
.rules-other b { color: var(--accent); font-size: 16px; }
.rules-other span { color: var(--muted); font-size: 14px; }
.rules-other:hover { border-color: var(--accent); }
.prose .ex-list { list-style: none; padding-left: 0; gap: 10px; }
.ex { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ex-cards { display: inline-flex; gap: 4px; flex: none; }
.ex-cards .pcard { width: 40px; height: 56px; border-radius: 7px; box-shadow: var(--shadow-sm); }
.ex-cards .pcard .c-tl { top: 4px; left: 5px; font-size: 14px; }
.ex-cards .pcard .c-tl small { font-size: 12px; margin-top: 1px; }
.ex-cards .pcard .c-mid { font-size: 20px; top: 16px; }
.ex-cards .pcard.joker { box-shadow: inset 0 0 0 2px #e0a92e, var(--shadow-sm); }
.ex-text { flex: 1 1 200px; min-width: 0; }

/* ---- С шулерами ---- */
.pcard.playable.cheaty { box-shadow: 0 0 0 2px #b45309 inset; }
.pcard.playable.cheaty::after { content: '!'; position: absolute; top: 4px; right: 6px; font: 800 12px/1 var(--font-body, sans-serif); color: #b45309; }
.pair.catchable .pcard { cursor: pointer; }
.cheat-btn { position: absolute; left: 50%; top: -14px; transform: translateX(-50%); z-index: 5; padding: 6px 12px; min-height: 36px; border: 0; border-radius: 999px;
    background: #c2410c; color: #fff; font: 800 14px/1 var(--font-body, sans-serif); box-shadow: 0 6px 16px rgba(0,0,0,.3); white-space: nowrap; cursor: pointer;
    animation: cheatPop .18s ease-out; }
.cheat-btn.on-def { top: 2px; left: calc(50% + 6px); }
.cheat-btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
@keyframes cheatPop { from { transform: translateX(-50%) scale(.6); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .cheat-btn { animation: none; } }
