/* =====================================================================
   Джокер — Telegram Mini App · стили
   Разделы: токены · база · экраны · меню · стол · топбар · поды ·
            карты · рука · взятка · листы · таблица · результаты · финал
   ===================================================================== */

/* ---------- Токены ---------- */
:root {
  --font-display: 'Playfair Display', 'Georgia', serif;
  --font-ui: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --gold: #e9c46a;
  --gold-2: #c9973f;
  --gold-ink: #3b2a08;
  --ink: #f6f2e8;
  --ink-2: rgba(246, 242, 232, .72);
  --ink-3: rgba(246, 242, 232, .48);
  --hit: #6fe0a0;
  --miss: #ff8a8a;
  --warn: #ffb86b;
  --under: #8cc8ff;

  --red-suit: #d42f3a;
  --black-suit: #17181c;
  --card-paper: #fbfaf5;

  /* стол (по умолчанию — зелёный) */
  --felt-1: #23784e;
  --felt-2: #0f4029;
  --felt-3: #072014;
  --felt-ink: #0a2a1b;
  --felt-glow: rgba(140, 255, 190, .10);

  /* рубашка (по умолчанию — рубин) */
  --back-1: #8e1b2b;
  --back-2: #5a0f1a;
  --back-line: rgba(255, 214, 140, .38);
  --back-gem: #e9c46a;

  --sat: max(env(safe-area-inset-top, 0px), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)));
  --sab: max(env(safe-area-inset-bottom, 0px), calc(var(--tg-safe-area-inset-bottom, 0px) + var(--tg-content-safe-area-inset-bottom, 0px)));
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --vh: var(--tg-viewport-stable-height, 100dvh);

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in: cubic-bezier(.5, 0, .75, 0);
  --ease-std: cubic-bezier(.4, 0, .2, 1);

  --glass: rgba(18, 22, 20, .72);
  --glass-line: rgba(255, 255, 255, .10);
  --sheet-bg: rgba(24, 27, 30, .86);
  --cw: 64px;
}

[data-theme="blue"] { --felt-1: #1f5a8c; --felt-2: #0d2a4c; --felt-3: #06142a; --felt-ink: #0a1f36; --felt-glow: rgba(140, 200, 255, .10); }
[data-theme="burgundy"] { --felt-1: #7a2334; --felt-2: #3b0d18; --felt-3: #1d050b; --felt-ink: #2b0a11; --felt-glow: rgba(255, 150, 170, .09); }
[data-theme="graphite"] { --felt-1: #474d57; --felt-2: #1c1f24; --felt-3: #0d0f12; --felt-ink: #121417; --felt-glow: rgba(220, 230, 255, .07); }

[data-back="ruby"] { --back-1: #8e1b2b; --back-2: #5a0f1a; --back-line: rgba(255, 214, 140, .38); --back-gem: #e9c46a; }
[data-back="sapphire"] { --back-1: #1c3d7a; --back-2: #0e1f45; --back-line: rgba(200, 220, 255, .36); --back-gem: #e9c46a; }
[data-back="emerald"] { --back-1: #146247; --back-2: #0a3324; --back-line: rgba(220, 255, 220, .32); --back-gem: #f1d58a; }
[data-back="onyx"] { --back-1: #2a2a2e; --back-2: #0f0f12; --back-line: rgba(233, 196, 106, .45); --back-gem: #e9c46a; }

/* ---------- База ---------- */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--felt-3);
  color: var(--ink);
  font-family: var(--font-ui);
  font-feature-settings: 'tnum' 1, 'lnum' 1;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
  user-select: none; -webkit-user-select: none;
  -webkit-touch-callout: none;
}
body { position: fixed; inset: 0; }
button { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; touch-action: manipulation; }
input { font: inherit; user-select: text; -webkit-user-select: text; }
svg { display: block; }
.num { font-variant-numeric: tabular-nums; }

#app {
  position: absolute; left: 0; right: 0; top: 0;
  height: var(--vh);
  overflow: hidden;
  overflow: clip;
  isolation: isolate;
}

/* фон-сукно (общий для меню и стола) */
.felt {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(120% 70% at 50% 42%, var(--felt-1) 0%, var(--felt-2) 62%, var(--felt-3) 100%);
}
.felt::before { /* шум */
  content: ""; position: absolute; inset: 0; opacity: .22; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .5  0 0 0 0 .5  0 0 0 0 .5  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.felt::after { /* виньетка + мягкий свет лампы */
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(60% 34% at 50% 40%, var(--felt-glow), transparent 70%),
    radial-gradient(140% 100% at 50% 45%, transparent 55%, rgba(0, 0, 0, .55) 100%);
}

/* ---------- Экраны ---------- */
.screen {
  position: absolute; inset: 0; z-index: 1;
  display: none;
  touch-action: none;
}
.screen.on { display: block; }
.screen.scroll { overflow-y: auto; touch-action: pan-y; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }

/* общие кнопки */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 16px;
  font-weight: 800; font-size: 17px; letter-spacing: -.01em;
  transition: transform 120ms var(--ease-out), opacity 160ms;
}
.btn:active { transform: scale(.96); }
.btn-gold {
  color: var(--gold-ink);
  background: linear-gradient(180deg, #f6dc8f 0%, var(--gold) 45%, var(--gold-2) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -2px 0 rgba(0, 0, 0, .15), 0 10px 24px -10px rgba(233, 196, 106, .55);
}
.btn-glass {
  color: var(--ink);
  background: rgba(255, 255, 255, .09);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.btn-danger { color: #fff; background: linear-gradient(180deg, #e3525c, #b52a35); }
.btn-wide { width: 100%; }
.btn small { display: block; font-weight: 600; font-size: 12px; opacity: .7; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center;
  color: var(--ink);
  background: rgba(0, 0, 0, .18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
  transition: transform 120ms var(--ease-out), background 160ms;
}
.icon-btn:active { transform: scale(.9); background: rgba(255, 255, 255, .12); }
.icon-btn svg { width: 22px; height: 22px; }

/* сегментированный контрол */
.seg {
  position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 3px; border-radius: 14px; background: rgba(0, 0, 0, .28);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.seg-ind {
  position: absolute; top: 3px; bottom: 3px; left: 3px; border-radius: 11px;
  background: rgba(255, 255, 255, .16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 4px 12px -4px rgba(0, 0, 0, .5);
  transition: transform 340ms cubic-bezier(.3, 1.25, .5, 1);
  will-change: transform;
}
.seg button {
  position: relative; z-index: 1; min-height: 44px; padding: 6px 4px; border-radius: 11px;
  font-weight: 700; font-size: 14px; color: var(--ink-2); line-height: 1.15;
  transition: color 200ms;
}
.seg button.on { color: var(--ink); }
.seg button small { display: block; font-weight: 600; font-size: 11px; color: var(--ink-3); margin-top: 1px; }

/* переключатель */
.toggle { position: relative; width: 52px; height: 32px; border-radius: 16px; background: rgba(255, 255, 255, .16); transition: background 220ms; flex: none; }
.toggle::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 28px; height: 28px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .3);
  transition: transform 300ms cubic-bezier(.3, 1.3, .5, 1);
}
.toggle.on { background: #34c76f; }
.toggle.on::after { transform: translateX(20px); }

/* ---------- Меню ---------- */
#menu .wrap, .page .wrap {
  position: relative; z-index: 1;
  min-height: 100%;
  max-width: 480px; margin: 0 auto;
  padding: calc(var(--sat) + 12px) calc(18px + var(--sar)) calc(var(--sab) + 18px) calc(18px + var(--sal));
  display: flex; flex-direction: column;
}
.logo { position: relative; height: 236px; margin-top: 4px; display: grid; place-items: end center; }
.logo-fan { position: absolute; left: 50%; top: 18px; width: 0; height: 150px; }
.logo-fan .card {
  position: absolute; left: calc(var(--cw) / -2); top: 8px;
  transform-origin: 50% 120%;
  animation: fanIn 900ms var(--ease-out) both;
}
.logo-fan .card .ci { animation: fanFloat 6s ease-in-out infinite; }
@keyframes fanIn { from { transform: rotate(0deg) translateY(40px); opacity: 0; } to { transform: rotate(var(--a)) translateY(0); opacity: 1; } }
@keyframes fanFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.wordmark {
  position: relative; margin: 0;
  font-family: var(--font-display); font-style: italic; font-weight: 900;
  font-size: 64px; line-height: .95; letter-spacing: -.03em;
  background: linear-gradient(180deg, #fff3cf 0%, var(--gold) 52%, #b9822f 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .45));
  animation: rise 700ms 200ms var(--ease-out) both;
}
.tagline { text-align: center; color: var(--ink-3); font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; margin: 8px 0 20px; animation: rise 700ms 300ms var(--ease-out) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.menu-actions { display: grid; gap: 10px; animation: rise 700ms 380ms var(--ease-out) both; }
.menu-card {
  margin-top: 14px; padding: 14px; border-radius: 20px;
  background: rgba(0, 0, 0, .22); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07);
  display: grid; gap: 12px;
  animation: rise 700ms 460ms var(--ease-out) both;
}
.menu-card label, .group-title { display: block; font-size: 12px; font-weight: 700; color: var(--ink-3); letter-spacing: .08em; text-transform: uppercase; margin: 0 0 6px 4px; }
.menu-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; animation: rise 700ms 540ms var(--ease-out) both; }
.menu-foot { margin-top: auto; padding-top: 16px; text-align: center; color: var(--ink-3); font-size: 12px; }

/* страницы (правила/настройки) */
.page { background: var(--felt-3); }
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.page-head h2 { margin: 0; font-family: var(--font-display); font-weight: 900; font-size: 30px; letter-spacing: -.02em; }
.group { border-radius: 18px; background: rgba(255, 255, 255, .055); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06); margin-bottom: 18px; overflow: hidden; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 54px; padding: 10px 14px; }
.row + .row { border-top: 1px solid rgba(255, 255, 255, .06); }
.row .lbl { font-weight: 700; font-size: 15px; }
.row .lbl small { display: block; font-weight: 500; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.row.col { flex-direction: column; align-items: stretch; }
.row .seg { width: 100%; }
.name-input { width: 100%; height: 44px; border-radius: 12px; border: 0; padding: 0 12px; background: rgba(0, 0, 0, .3); color: var(--ink); font-weight: 700; font-size: 16px; outline: none; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1); }
.name-input:focus { box-shadow: inset 0 0 0 2px var(--gold); }
.backs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.backs button { display: grid; place-items: center; padding: 6px 0; border-radius: 12px; transition: transform 120ms; }
.backs button:active { transform: scale(.94); }
.backs button.on { background: rgba(233, 196, 106, .16); box-shadow: inset 0 0 0 2px var(--gold); }

.rules { line-height: 1.5; font-size: 15px; color: var(--ink-2); }
.rules h3 { color: var(--ink); font-family: var(--font-display); font-size: 20px; margin: 18px 0 6px; letter-spacing: -.01em; }
.rules p, .rules li { margin: 0 0 8px; }
.rules ul { padding-left: 18px; margin: 0 0 8px; }
.rules b { color: var(--ink); }
.rules .r { color: #ff6b74; }
.rules table { border-collapse: collapse; width: 100%; font-size: 14px; }
.rules td { padding: 6px 4px; border-top: 1px solid rgba(255, 255, 255, .08); }
.rules td:last-child { text-align: right; font-weight: 800; color: var(--ink); }

/* ---------- Стол ---------- */
#game { contain: strict; }
#stage { position: absolute; inset: 0; z-index: 1; overflow: hidden; overflow: clip; touch-action: none; }

/* топбар */
.topbar {
  position: absolute; left: 0; right: 0; top: 0; z-index: 40;
  padding: calc(var(--sat) + 6px) calc(8px + var(--sar)) 6px calc(8px + var(--sal));
  display: flex; align-items: center; gap: 8px;
  background: linear-gradient(180deg, rgba(0, 0, 0, .38), rgba(0, 0, 0, 0));
}
.tb-info { flex: 1; min-width: 0; text-align: center; line-height: 1.2; }
.tb-line1 { font-size: 12.5px; font-weight: 700; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-line1 b { color: var(--ink); }
.tb-line2 { margin-top: 3px; min-height: 22px; display: flex; justify-content: center; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 11px;
  font-size: 12px; font-weight: 800; white-space: nowrap;
  background: rgba(0, 0, 0, .3); color: var(--ink-2);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
  transition: color 200ms, background 200ms;
}
.chip.over { color: var(--warn); background: rgba(255, 140, 60, .14); }
.chip.under { color: var(--under); background: rgba(80, 160, 255, .14); }
.chip.even { color: var(--ink); }
.trump-slot {
  position: relative; width: 44px; height: 44px; flex: none; border-radius: 14px;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, .18); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.trump-slot .card { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-8deg); }
.trump-slot .ts-suit {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: #fbfaf5; box-shadow: 0 2px 6px rgba(0, 0, 0, .35), inset 0 0 0 2px var(--gold);
}
.trump-slot .ts-suit svg { width: 20px; height: 20px; }
.trump-slot .ts-none { font-size: 9.5px; font-weight: 800; line-height: 1.05; text-align: center; color: var(--ink-2); text-transform: uppercase; letter-spacing: .02em; }
.trump-slot .ts-cap { position: absolute; bottom: -8px; left: 50%; transform: translateX(-50%); font-size: 8.5px; font-weight: 800; letter-spacing: .06em; color: var(--gold); text-transform: uppercase; text-shadow: 0 1px 2px rgba(0, 0, 0, .8); white-space: nowrap; }
.pop { animation: pop 420ms cubic-bezier(.3, 1.6, .5, 1); }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.28); } 100% { transform: scale(1); } }

/* ---------- Поды игроков ---------- */
.pod {
  position: absolute; left: 0; top: 0; z-index: 20; width: 84px;
  display: flex; flex-direction: column; align-items: center;
  pointer-events: none;
}
.pod-av { position: relative; width: 48px; height: 48px; flex: none; }
.pod-av .av { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 2px rgba(0, 0, 0, .35), 0 6px 14px -4px rgba(0, 0, 0, .6); }
.pod-av .av svg { width: 100%; height: 100%; }
.ring {
  position: absolute; inset: -5px; border-radius: 50%; opacity: 0;
  background: conic-gradient(from 0deg, rgba(233, 196, 106, .28) 0 40%, var(--gold) 78%, #fffbe8 90%, rgba(233, 196, 106, .28) 91%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px));
  transition: opacity 260ms;
}
.ring-glow { position: absolute; inset: -12px; border-radius: 50%; opacity: 0; background: radial-gradient(closest-side, rgba(233, 196, 106, .55), transparent); transition: opacity 260ms; }
.pod.turn .ring { opacity: 1; animation: spin 1.6s linear infinite; }
.pod.turn .ring-glow { opacity: 1; animation: breathe 1.6s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 0%, 100% { opacity: .35; transform: scale(.92); } 50% { opacity: .9; transform: scale(1.05); } }
.dealer-chip {
  position: absolute; right: -6px; bottom: -4px; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; font-weight: 900; color: var(--gold-ink);
  background: radial-gradient(circle at 35% 30%, #fff1c2, var(--gold) 55%, var(--gold-2));
  box-shadow: 0 2px 5px rgba(0, 0, 0, .5);
  transform: scale(0); transition: transform 360ms cubic-bezier(.3, 1.5, .5, 1);
}
.pod.dealer .dealer-chip { transform: scale(1); }
.pod-name { margin-top: 5px; max-width: 84px; font-size: 12.5px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.pod-score { font-size: 12px; font-weight: 700; color: var(--ink-2); text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.pod-badge {
  margin-top: 3px; min-width: 50px; height: 24px; padding: 0 8px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 13px; font-weight: 800; color: var(--ink);
  background: rgba(0, 0, 0, .38); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
  transition: background 220ms, color 220ms;
}
.pod-badge .bt { white-space: nowrap; }
.pod-badge.empty .bt { color: var(--ink-3); }
.pod-badge.hit { background: rgba(60, 200, 120, .25); box-shadow: inset 0 0 0 1px rgba(111, 224, 160, .5); }
.pod-badge.over { background: rgba(255, 90, 90, .22); box-shadow: inset 0 0 0 1px rgba(255, 138, 138, .45); }
.dots { display: inline-flex; gap: 2px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; background: rgba(255, 255, 255, .22); transition: background 200ms, transform 300ms cubic-bezier(.3, 1.6, .5, 1); }
.dots i.f { background: var(--gold); transform: scale(1.15); }
.dots i.x { background: var(--miss); }

/* горизонтальный под игрока */
.pod.h {
  width: auto; flex-direction: row; gap: 10px; align-items: center;
  height: 52px; padding: 0 12px 0 6px; border-radius: 26px;
  background: rgba(0, 0, 0, .3); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
  transform: translate(-50%, -50%);
  white-space: nowrap;
}
.pod.h .pod-av { width: 40px; height: 40px; }
.pod.h .pod-score { text-align: left; }
.pod.h .pod-meta { display: flex; flex-direction: column; min-width: 0; }
.pod.h .pod-name { margin: 0; max-width: 110px; text-align: left; }
.pod.h .pod-badge { margin: 0; }
.pod.h .ring { inset: -4px; }

/* пузырь заказа */
.bwrap { position: absolute; z-index: 5; left: 50%; top: -8px; transform: translate(-50%, -100%); pointer-events: none; }
.pod[data-seat="2"] .bwrap { top: auto; bottom: -8px; transform: translate(-50%, 100%); }
.pod[data-seat="1"] .bwrap { left: 74px; top: 24px; transform: translate(0, -50%); }
.pod[data-seat="3"] .bwrap { left: auto; right: 74px; top: 24px; transform: translate(0, -50%); }
.pod[data-seat="1"] .bubble::after, .pod[data-seat="3"] .bubble::after, .pod[data-seat="2"] .bubble::after { display: none; }
.bubble {
  position: relative; display: inline-flex; align-items: center; gap: 2px;
  padding: 6px 11px; border-radius: 14px;
  font-weight: 900; font-size: 15px; color: #1b1b1b; white-space: nowrap;
  background: #fffaf0; box-shadow: 0 8px 18px -6px rgba(0, 0, 0, .55);
  transform-origin: 50% 100%;
  pointer-events: none;
}
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; margin-left: -5px; background: inherit; transform: rotate(45deg); border-radius: 2px; }
.bubble small { font-weight: 700; font-size: 11px; color: #6d6450; margin-right: 4px; }
.bubble.zero { color: #6d6450; }

/* инлайн-масть в текстах */
.si { display: inline-block; width: 1em; height: 1em; vertical-align: -.14em; }
.si.r { color: var(--red-suit); }
.si.b { color: var(--black-suit); }
.toast .si.b, .sheet .si.b, .chip .si.b, .rules .si.b, .lt-empty .si.b { color: #f2f2f4; }
.toast .si.r, .sheet .si.r, .rules .si.r { color: #ff5a64; }
.jlabel .si.r { color: var(--red-suit); }
.jlabel .si.b, .bubble .si.b { color: var(--black-suit); }

/* ---------- Карты ---------- */
.card {
  position: absolute; left: 0; top: 0;
  width: var(--cw); height: calc(var(--cw) * 1.42);
  perspective: 700px;
  transform-origin: 50% 50%;
  contain: layout style;
}
#stage > .card { will-change: auto; }
.ci { position: absolute; inset: 0; transform-style: preserve-3d; transition: none; }
.card.down .ci { transform: rotateY(180deg); }
.cf, .cb {
  position: absolute; inset: 0; border-radius: calc(var(--cw) * .1);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  overflow: hidden;
}
.cb { transform: rotateY(180deg); }
/* статичная тень — отдельным слоем (не анимируется) */
.card::before {
  content: ""; position: absolute; inset: 1px; border-radius: calc(var(--cw) * .1);
  box-shadow: 0 calc(var(--cw) * .05) calc(var(--cw) * .12) rgba(0, 0, 0, .38);
  pointer-events: none;
}
/* усиленная тень при подъёме/перетаскивании — только opacity */
.card::after {
  content: ""; position: absolute; inset: 2px; border-radius: calc(var(--cw) * .1); z-index: -1;
  box-shadow: 0 calc(var(--cw) * .28) calc(var(--cw) * .4) rgba(0, 0, 0, .45);
  opacity: 0; transition: opacity 220ms; pointer-events: none;
}
.card.lifted::after, .card.dragging::after { opacity: 1; }

.cf {
  background: linear-gradient(160deg, #fffefa 0%, var(--card-paper) 55%, #efeadc 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14), inset 0 0 0 calc(var(--cw) * .03) rgba(255, 255, 255, .7);
  color: var(--black-suit);
}
.card.red .cf { color: var(--red-suit); }
.corner {
  position: absolute; left: calc(var(--cw) * .06); top: calc(var(--cw) * .05);
  width: calc(var(--cw) * .3);
  display: flex; flex-direction: column; align-items: center;
}
.corner.k { z-index: 2; padding: 0 0 calc(var(--cw) * .03); border-radius: 0 0 calc(var(--cw) * .06) 0; background: linear-gradient(160deg, #fffefa, var(--card-paper)); }
.corner.br.k { border-radius: 0 0 calc(var(--cw) * .06) 0; }
.corner.br { left: auto; top: auto; right: calc(var(--cw) * .06); bottom: calc(var(--cw) * .05); transform: rotate(180deg); }
.corner .rk {
  font-family: var(--font-ui); font-weight: 800;
  font-size: calc(var(--cw) * .3); line-height: .95; letter-spacing: -.06em;
}
.corner .rk.ten { letter-spacing: -.12em; font-size: calc(var(--cw) * .27); margin-left: -.1em; }
.corner svg { width: calc(var(--cw) * .2); height: calc(var(--cw) * .2); margin-top: calc(var(--cw) * .025); fill: currentColor; }
.pip { position: absolute; left: 50%; top: 54%; transform: translate(-50%, -50%); width: calc(var(--cw) * .5); height: calc(var(--cw) * .5); fill: currentColor; }
.pip.ace { width: calc(var(--cw) * .58); height: calc(var(--cw) * .58); }
.ace-ring { position: absolute; left: 50%; top: 54%; width: calc(var(--cw) * .82); height: calc(var(--cw) * .82); transform: translate(-50%, -50%); border-radius: 50%; border: calc(var(--cw) * .018) solid currentColor; opacity: .25; }
.ace-ring::after { content: ""; position: absolute; inset: calc(var(--cw) * .04); border-radius: 50%; border: 1px dashed currentColor; }
.court {
  position: absolute; left: 19%; right: 19%; top: 11%; bottom: 11%;
  border-radius: calc(var(--cw) * .05);
  background: linear-gradient(180deg, #fff6dd, #f3e0b0);
  box-shadow: inset 0 0 0 1px currentColor, inset 0 0 0 calc(var(--cw) * .035) #fff6dd, inset 0 0 0 calc(var(--cw) * .045) rgba(0, 0, 0, .25);
  overflow: hidden;
}
.court svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.card.joker .cf { background: radial-gradient(120% 90% at 50% 40%, #fffdf5, #f4ead2); }
.jk-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.jk-corner { position: absolute; left: calc(var(--cw) * .07); top: calc(var(--cw) * .06); width: calc(var(--cw) * .22); }
.jk-corner.br { left: auto; top: auto; right: calc(var(--cw) * .07); bottom: calc(var(--cw) * .06); transform: rotate(180deg); }
.jk-corner svg { width: 100%; height: auto; }

/* рубашка */
.cb {
  background:
    radial-gradient(circle at 50% 50%, transparent 0 calc(var(--cw) * .14), transparent calc(var(--cw) * .14)),
    repeating-linear-gradient(45deg, var(--back-line) 0 1px, transparent 1px calc(var(--cw) * .11)),
    repeating-linear-gradient(-45deg, var(--back-line) 0 1px, transparent 1px calc(var(--cw) * .11)),
    linear-gradient(160deg, var(--back-1), var(--back-2));
  box-shadow: inset 0 0 0 calc(var(--cw) * .045) #f6efe0, inset 0 0 0 calc(var(--cw) * .06) var(--back-gem), inset 0 0 0 1px rgba(0, 0, 0, .3);
}
.cb::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: calc(var(--cw) * .36); height: calc(var(--cw) * .36);
  transform: translate(-50%, -50%) rotate(45deg);
  border-radius: calc(var(--cw) * .06);
  background: radial-gradient(circle, var(--back-gem) 0 22%, var(--back-2) 24% 46%, var(--back-gem) 48% 54%, var(--back-1) 56%);
  box-shadow: 0 0 0 calc(var(--cw) * .02) var(--back-gem);
}
.cb::before { content: ""; position: absolute; inset: calc(var(--cw) * .1); border-radius: calc(var(--cw) * .05); box-shadow: inset 0 0 0 1px var(--back-line); }
.swatch { position: relative; }
.swatch .card, .tc-cards .card, .lt .card { position: relative; flex: none; }

/* состояния карт в руке */
.card .dim { position: absolute; inset: 0; border-radius: calc(var(--cw) * .1); background: rgba(10, 20, 15, .5); opacity: 0; transition: opacity 200ms; pointer-events: none; }
.card.illegal .dim { opacity: 1; }
.card .glow {
  position: absolute; inset: calc(var(--cw) * -.07); border-radius: calc(var(--cw) * .16); pointer-events: none;
  box-shadow: 0 0 0 calc(var(--cw) * .04) var(--gold), 0 0 calc(var(--cw) * .35) calc(var(--cw) * .06) rgba(233, 196, 106, .7);
  opacity: 0; transition: opacity 240ms;
}
.card.win .glow { opacity: 1; }
.card.shake .ci { animation: shake 380ms cubic-bezier(.36, .07, .19, .97); }
@keyframes shake { 10%, 90% { transform: translateX(-1px); } 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }

/* джокер: блеск */
.shimmer { position: absolute; inset: 0; border-radius: calc(var(--cw) * .1); overflow: hidden; pointer-events: none; }
.shimmer::after {
  content: ""; position: absolute; top: -20%; bottom: -20%; left: -60%; width: 50%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .85), transparent);
  transform: translateX(0) skewX(-12deg); opacity: 0;
}
.card.jfx .shimmer::after { animation: sweep 1100ms 150ms var(--ease-std) 2; }
@keyframes sweep { 0% { transform: translateX(0) skewX(-12deg); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateX(380%) skewX(-12deg); opacity: 0; } }
.jlabel {
  position: absolute; left: 50%; bottom: calc(var(--cw) * -.2); transform: translateX(-50%);
  padding: calc(var(--cw) * .04) calc(var(--cw) * .12); border-radius: 999px;
  font-size: calc(var(--cw) * .2); font-weight: 900; white-space: nowrap; color: #2a1b00;
  background: linear-gradient(180deg, #ffe9a6, var(--gold));
  box-shadow: 0 4px 10px rgba(0, 0, 0, .45);
  animation: jIn 420ms cubic-bezier(.3, 1.6, .5, 1) both;
}
.jlabel.low { background: linear-gradient(180deg, #e6ebf2, #b6c0cc); color: #1b2230; }
@keyframes jIn { from { transform: translateX(-50%) scale(.3); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

/* ---------- Взятка ---------- */
.trick-hit { position: absolute; z-index: 15; border-radius: 50%; }
.table-mark {
  position: absolute; z-index: 0; border-radius: 50%; pointer-events: none;
  display: grid; place-items: center;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05), inset 0 0 0 6px rgba(0, 0, 0, .05), inset 0 0 0 7px rgba(233, 196, 106, .07);
  background: radial-gradient(closest-side, rgba(255, 255, 255, .035), transparent);
}
.table-mark span {
  font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: calc(var(--cw) * .5);
  letter-spacing: -.02em; color: rgba(255, 255, 255, .06);
}
.trick-hint {
  position: absolute; z-index: 16; transform: translate(-50%, -50%);
  padding: 6px 12px; border-radius: 12px; font-size: 12px; font-weight: 700; color: var(--ink-3);
  pointer-events: none; opacity: 0; transition: opacity 300ms; white-space: nowrap;
}
.trick-hint.on { opacity: 1; }
.last-btn { position: absolute; z-index: 45; }

/* подсказка над рукой */
.toast {
  position: absolute; z-index: 300; left: 50%; top: 0;
  padding: 10px 16px; border-radius: 14px;
  font-weight: 800; font-size: 14.5px; line-height: 1.3; color: #fff; text-align: center;
  width: max-content; max-width: calc(100vw - 32px);
  background: rgba(20, 14, 14, .82); box-shadow: inset 0 0 0 1px rgba(255, 130, 130, .35), 0 10px 26px -8px rgba(0, 0, 0, .6);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  pointer-events: none; opacity: 0;
}
.toast.info { box-shadow: inset 0 0 0 1px rgba(233, 196, 106, .45), 0 10px 26px -8px rgba(0, 0, 0, .6); }
.toast svg { display: inline-block; width: 15px; height: 15px; vertical-align: -2px; }

/* ---------- Листы (bottom sheets) ---------- */
.sheet-root { position: absolute; inset: 0; z-index: 500; touch-action: none; }
.scrim { position: absolute; inset: 0; background: rgba(0, 0, 0, .42); opacity: 0; }
.sheet-root.clear .scrim { background: linear-gradient(180deg, transparent 30%, rgba(0, 0, 0, .35)); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0;
  max-width: 560px; margin: 0 auto;
  max-height: calc(var(--vh) - var(--sat) - 24px);
  display: flex; flex-direction: column;
  padding: 8px calc(16px + var(--sar)) calc(var(--sab) + 16px) calc(16px + var(--sal));
  border-radius: 26px 26px 0 0;
  background: var(--sheet-bg);
  -webkit-backdrop-filter: blur(26px) saturate(160%); backdrop-filter: blur(26px) saturate(160%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 -20px 50px -20px rgba(0, 0, 0, .6);
  transform: translateY(105%);
  will-change: transform;
}
.sheet.tall { height: calc(var(--vh) - var(--sat) - 24px); }
.grabber { flex: none; height: 22px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.grabber::before { content: ""; width: 38px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .28); }
.sheet-head { flex: none; display: flex; align-items: center; gap: 10px; margin-bottom: 12px; touch-action: none; }
.sheet-head h3 { flex: 1; margin: 0; font-family: var(--font-display); font-weight: 900; font-size: 24px; letter-spacing: -.02em; line-height: 1.1; }
.sheet-head p { margin: 2px 0 0; font-family: var(--font-ui); font-size: 13px; font-weight: 600; color: var(--ink-3); letter-spacing: 0; }
.sheet-body { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; -webkit-overflow-scrolling: touch; }
.sheet .close-x { width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, .1); display: grid; place-items: center; flex: none; }
.sheet .close-x svg { width: 16px; height: 16px; }

/* лист заказа */
.others { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; margin-bottom: 14px; }
.others .o { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 4px; border-radius: 15px; background: rgba(255, 255, 255, .07); font-size: 13px; font-weight: 700; color: var(--ink-2); }
.others .o .mini-av { width: 22px; height: 22px; border-radius: 50%; overflow: hidden; }
.others .o b { color: var(--ink); font-size: 14px; }
.others .o.wait b { color: var(--ink-3); }
.others .dl-mark { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; font-size: 9px; font-weight: 900; color: var(--gold-ink); background: var(--gold); }
.bid-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.bid-btn {
  position: relative; width: 58px; height: 58px; border-radius: 50%;
  font-size: 24px; font-weight: 900; color: var(--ink);
  background: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, .2), rgba(255, 255, 255, .06));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), 0 6px 14px -6px rgba(0, 0, 0, .6);
  transition: transform 140ms var(--ease-out), background 160ms;
}
.bid-btn:active { transform: scale(.9); }
.bid-btn.hot { color: var(--gold-ink); background: radial-gradient(circle at 50% 30%, #fff0bf, var(--gold) 60%, var(--gold-2)); }
.bid-btn.forbid { color: var(--ink-3); background: rgba(255, 255, 255, .03); pointer-events: none; }
.bid-btn.forbid::after { content: ""; position: absolute; left: 10px; right: 10px; top: 50%; height: 2.5px; border-radius: 2px; background: var(--miss); transform: rotate(-40deg); }
.bid-note { margin: 14px 4px 0; font-size: 13px; line-height: 1.4; color: var(--ink-3); text-align: center; }
.bid-note b { color: var(--miss); }
.bid-sum { text-align: center; margin-top: 10px; }

/* лист козыря */
.tc-cards { display: flex; justify-content: center; gap: 10px; margin: 2px 0 18px; --cw: 82px; }
.tc-cards .card { position: relative; animation: rise 500ms var(--ease-out) both; }
.tc-cards .card:nth-child(2) { animation-delay: 70ms; }
.tc-cards .card:nth-child(3) { animation-delay: 140ms; }
.suit-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.suit-btn {
  height: 72px; border-radius: 18px; display: grid; place-items: center; gap: 0;
  background: #fbfaf5; box-shadow: 0 8px 18px -10px rgba(0, 0, 0, .7), inset 0 -3px 0 rgba(0, 0, 0, .08);
  transition: transform 140ms var(--ease-out);
}
.suit-btn:active { transform: scale(.92); }
.suit-btn svg { width: 32px; height: 32px; }
.suit-btn span { font-size: 11px; font-weight: 800; color: #555; margin-top: -10px; }
.suit-btn.r { color: var(--red-suit); }
.suit-btn.b { color: var(--black-suit); }
.suit-btn svg { fill: currentColor; }
.sheet .btn-glass.wide { width: 100%; margin-top: 10px; }

/* лист джокера */
.jk-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.jk-mode {
  padding: 12px 10px; border-radius: 18px; text-align: left; min-height: 76px;
  background: rgba(255, 255, 255, .07); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
  transition: transform 140ms var(--ease-out), background 200ms, box-shadow 200ms;
}
.jk-mode:active { transform: scale(.96); }
.jk-mode b { display: block; font-size: 17px; font-weight: 900; }
.jk-mode span { display: block; font-size: 12px; color: var(--ink-3); margin-top: 3px; line-height: 1.3; }
.jk-mode.on { background: rgba(233, 196, 106, .18); box-shadow: inset 0 0 0 2px var(--gold); }
.jk-big { display: grid; gap: 10px; }
.jk-big .btn { min-height: 64px; font-size: 18px; flex-direction: column; gap: 0; }
.jk-big .btn small { font-size: 12px; }

/* ---------- Пулька (таблица) ---------- */
.ss-wrap { margin: 0 -8px; }
.ss { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 13px; }
.ss col.c0 { width: 46px; }
.ss th, .ss td { padding: 0 3px; height: 30px; text-align: center; white-space: nowrap; }
.ss thead th { position: sticky; top: 0; z-index: 2; height: 46px; background: #202326; font-weight: 800; font-size: 12px; color: var(--ink-2); vertical-align: middle; }
.ss thead th .mini-av { width: 22px; height: 22px; border-radius: 50%; overflow: hidden; margin: 0 auto 2px; }
.ss thead th .nm { display: block; overflow: hidden; text-overflow: ellipsis; }
.ss td { border-top: 1px solid rgba(255, 255, 255, .05); }
.ss td.c0 { font-weight: 800; color: var(--ink-2); font-size: 12px; text-align: left; padding-left: 8px; }
.ss td.c0 svg { display: inline-block; width: 11px; height: 11px; vertical-align: -1px; margin-left: 2px; }
.ss td.c0 .nt { font-size: 9px; color: var(--ink-3); margin-left: 2px; }
.ss .bd { display: inline-block; min-width: 14px; font-size: 11px; font-weight: 700; color: var(--ink-3); margin-right: 3px; text-align: right; }
.ss .pt { font-weight: 600; color: var(--ink-2); }
.ss .pt.hit { font-weight: 900; color: var(--ink); }
.ss .pt.miss { color: rgba(255, 160, 160, .7); }
.ss .pt.pen { color: #fff; background: rgba(214, 47, 58, .75); padding: 1px 4px; border-radius: 5px; font-weight: 900; }
.ss .dl { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); vertical-align: 2px; margin-left: 2px; }
.ss tr.cur td { background: rgba(233, 196, 106, .08); }
.ss tr.cur td.c0 { color: var(--gold); }
.ss tr.fut td { color: var(--ink-3); opacity: .55; }
.ss tr.ph td { height: 26px; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); text-align: left; padding-left: 8px; border-top: 0; background: rgba(233, 196, 106, .06); }
.ss tr.sub td { font-weight: 900; color: var(--ink); background: rgba(255, 255, 255, .05); border-top: 1px solid rgba(255, 255, 255, .14); }
.ss tr.sub td .pm { display: block; font-size: 10px; line-height: 1.1; font-weight: 800; }
.ss .star { color: var(--gold); }
.ss .cut { color: var(--miss); }
.ss tfoot td { position: sticky; bottom: 0; z-index: 2; height: 40px; background: #24282c; font-size: 15px; font-weight: 900; color: var(--gold); border-top: 1px solid rgba(233, 196, 106, .35); }
.ss tfoot td.c0 { font-size: 11px; color: var(--ink-2); }
.ss-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; margin: 10px 0 2px; font-size: 11px; color: var(--ink-3); }
.ss-legend b { color: var(--ink); }

/* последняя взятка */
.lt { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; --cw: 70px; justify-items: center; }
.lt .slot { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.lt .card { position: relative; margin-bottom: 10px; }
.lt .nm { font-size: 12px; font-weight: 700; color: var(--ink-2); max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lt .slot.w .nm { color: var(--gold); }
.lt .slot.w .card .glow { opacity: 1; }
.lt-empty { text-align: center; color: var(--ink-3); padding: 20px 0; }

/* ---------- Итоги раздачи ---------- */
.res { display: grid; gap: 8px; }
.res-row {
  display: grid; grid-template-columns: 34px 1fr 74px 70px; align-items: center; gap: 10px;
  padding: 9px 12px 9px 9px; border-radius: 16px; background: rgba(255, 255, 255, .06);
  animation: rise 460ms var(--ease-out) both;
}
.res-row .mini-av { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; }
.res-row .nm { font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-row .tot { font-size: 12px; font-weight: 700; color: var(--ink-3); }
.res-row .bt { text-align: center; font-weight: 800; font-size: 14px; color: var(--ink-2); }
.res-row .bt small { display: block; font-size: 9.5px; font-weight: 700; color: var(--ink-3); white-space: nowrap; }
.res-row .pts { text-align: right; font-weight: 900; font-size: 20px; }
.res-row.hit { box-shadow: inset 0 0 0 1px rgba(111, 224, 160, .35); }
.res-row.hit .pts { color: var(--hit); }
.res-row.miss .pts { color: var(--ink-2); }
.res-row.pen { box-shadow: inset 0 0 0 1px rgba(255, 110, 110, .45); background: rgba(214, 47, 58, .12); }
.res-row.pen .pts { color: var(--miss); }
.res-row.me { background: rgba(233, 196, 106, .1); }
.prem {
  margin-top: 14px; padding: 14px; border-radius: 18px; text-align: center;
  background: radial-gradient(120% 120% at 50% 0%, rgba(233, 196, 106, .28), rgba(233, 196, 106, .05));
  box-shadow: inset 0 0 0 1px rgba(233, 196, 106, .4);
  animation: rise 600ms 300ms var(--ease-out) both;
}
.prem h4 { margin: 0 0 6px; font-family: var(--font-display); font-weight: 900; font-size: 22px; color: var(--gold); }
.prem p { margin: 3px 0; font-size: 14px; font-weight: 700; color: var(--ink-2); }
.prem .plus { color: var(--hit); font-weight: 900; }
.prem .minus { color: var(--miss); font-weight: 900; }
.res-actions { display: grid; grid-template-columns: 56px 1fr; gap: 10px; margin-top: 16px; }

/* ---------- Финал ---------- */
#over .wrap { position: relative; z-index: 2; height: 100%; max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; padding: calc(var(--sat) + 20px) 18px calc(var(--sab) + 18px); }
#over h2 { margin: 0; text-align: center; font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 44px; letter-spacing: -.03em; color: var(--gold); animation: rise 700ms var(--ease-out) both; }
#over .sub { text-align: center; color: var(--ink-2); font-weight: 700; margin-top: 4px; animation: rise 700ms 100ms var(--ease-out) both; }
.podium { flex: 1; min-height: 240px; display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: end; gap: 8px; margin: 18px 0 12px; }
.pd { display: flex; flex-direction: column; align-items: center; text-align: center; }
.pd .mini-av { width: 54px; height: 54px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 3px rgba(255, 255, 255, .2); margin-bottom: 6px; }
.pd.p1 .mini-av { width: 70px; height: 70px; box-shadow: 0 0 0 3px var(--gold), 0 0 30px rgba(233, 196, 106, .55); }
.pd .nm { font-weight: 800; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd .sc { font-weight: 900; font-size: 18px; color: var(--ink); margin: 2px 0 8px; }
.pd .block {
  width: 100%; border-radius: 14px 14px 4px 4px; display: grid; place-items: start center; padding-top: 10px;
  font-family: var(--font-display); font-weight: 900; font-size: 34px; color: rgba(255, 255, 255, .85);
  background: linear-gradient(180deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, .05));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25);
  transform-origin: 50% 100%;
  animation: grow 800ms var(--ease-out) both;
}
.pd.p1 .block { height: 150px; background: linear-gradient(180deg, rgba(233, 196, 106, .7), rgba(233, 196, 106, .15)); color: #fff7dc; animation-delay: 500ms; }
.pd.p2 .block { height: 108px; animation-delay: 300ms; }
.pd.p3 .block { height: 78px; animation-delay: 150ms; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.pd .who { animation: rise 600ms both; }
.pd.p1 .who { animation-delay: 900ms; }
.pd.p2 .who { animation-delay: 700ms; }
.pd.p3 .who { animation-delay: 550ms; }
.fourth { text-align: center; color: var(--ink-3); font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.over-actions { display: grid; gap: 10px; }
.over-actions .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#confetti { position: absolute; inset: 0; z-index: 3; pointer-events: none; }

/* ---------- Подтверждение ---------- */
.confirm-text { text-align: center; color: var(--ink-2); font-size: 15px; margin: 0 0 16px; line-height: 1.4; }
.confirm-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- Доступность / reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .logo-fan .card, .logo-fan .card .ci, .wordmark, .tagline, .menu-actions, .menu-card, .menu-row,
  .pd .block, .pd .who, .res-row, .prem, .tc-cards .card { animation-duration: 1ms !important; animation-delay: 0ms !important; }
  .pod.turn .ring { animation: none; }
  .pod.turn .ring-glow { animation: none; opacity: .7; }
  .card.jfx .shimmer::after { animation: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .sheet { background: #1c1f22; -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (min-width: 700px) {
  .wordmark { font-size: 76px; }
}

/* =====================================================================
   Онлайн: меню, хаб, поиск, лобби, сеть, таймер хода, фразы
   ===================================================================== */
.av-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.mini-av, .pod-av .av, .pf-av, .lb-av, .rc { position: relative; }

/* кнопки главного меню */
.btn-xl { min-height: 64px; justify-content: flex-start; gap: 14px; padding: 0 20px; text-align: left; }
.btn-xl > svg { width: 26px; height: 26px; flex: none; }
.btn-xl > span { display: flex; flex-direction: column; line-height: 1.15; }
.btn-xl small { margin-top: 2px; }
.btn-gold.btn-xl > svg { color: var(--gold-ink); opacity: .85; }
.menu-continue {
  display: grid; grid-template-columns: auto 1fr; align-items: center; column-gap: 10px;
  padding: 10px 14px; border-radius: 16px; text-align: left;
  font-weight: 700; font-size: 14px; color: var(--ink-2);
  background: rgba(0, 0, 0, .18); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
  transition: transform 120ms var(--ease-out), background 160ms;
}
.menu-continue:active { transform: scale(.97); background: rgba(255, 255, 255, .06); }
.menu-continue small { grid-column: 2; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.mc-dot { grid-row: span 2; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 10px rgba(233, 196, 106, .8); }

/* профиль */
.profile {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; border-radius: 18px; margin-bottom: 14px;
  background: rgba(0, 0, 0, .22); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07);
}
.menu-profile { animation: rise 700ms 340ms var(--ease-out) both; }
.pf-av { width: 42px; height: 42px; flex: none; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 2px rgba(233, 196, 106, .55); }
.pf-av svg { width: 100%; height: 100%; }
.pf-meta { flex: 1; min-width: 0; }
.pf-name { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.pf-stats { font-size: 12.5px; font-weight: 700; color: var(--ink-3); margin-top: 1px; }
.pf-best { text-align: right; line-height: 1.05; }
.pf-best b { display: block; font-size: 17px; font-weight: 900; color: var(--gold); }
.pf-best small { font-size: 10.5px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .06em; }

/* хаб */
#online, #lobby { background: transparent; }
.hub-status {
  display: none; align-items: center; justify-content: center; gap: 8px; margin: -4px 0 12px;
  font-size: 13px; font-weight: 700; color: var(--ink-2);
}
.hub-status.on { display: flex; animation: rise 300ms var(--ease-out) both; }
.hub-status.bad { color: var(--miss); }
.hub-status svg { width: 16px; height: 16px; }
.hub-card {
  display: grid; gap: 12px; padding: 14px; margin-bottom: 12px; border-radius: 22px;
  background: rgba(0, 0, 0, .24); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07);
  animation: rise 520ms var(--ease-out) both;
}
.hub-card:nth-of-type(2) { animation-delay: 60ms; }
.hub-card:nth-of-type(3) { animation-delay: 120ms; }
.hub-card.hc-quick { background: radial-gradient(120% 140% at 0% 0%, rgba(233, 196, 106, .16), rgba(0, 0, 0, .24) 60%); box-shadow: inset 0 0 0 1px rgba(233, 196, 106, .22); }
.hc-head { display: flex; gap: 12px; align-items: center; }
.hc-head h3 { margin: 0; font-family: var(--font-display); font-weight: 900; font-size: 21px; letter-spacing: -.02em; line-height: 1.1; }
.hc-head p { margin: 2px 0 0; font-size: 12.5px; font-weight: 600; color: var(--ink-3); line-height: 1.3; }
.hc-ic { width: 40px; height: 40px; flex: none; border-radius: 13px; display: grid; place-items: center; color: var(--gold); background: rgba(233, 196, 106, .12); box-shadow: inset 0 0 0 1px rgba(233, 196, 106, .25); }
.hc-ic svg { width: 21px; height: 21px; }
.hc-opts { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: end; }
.hc-opt > span { display: block; font-size: 11.5px; font-weight: 700; color: var(--ink-3); letter-spacing: .08em; text-transform: uppercase; margin: 0 0 6px 4px; }
.hc-opt.row-opt { display: flex; flex-direction: column; align-items: flex-start; }
.hc-opt.row-opt .toggle { margin-bottom: 6px; }
.code-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.code-input {
  height: 52px; min-width: 0; width: 100%; border-radius: 16px; border: 0; outline: none; padding: 0 0 0 .38em;
  font-family: var(--font-ui); font-weight: 900; font-size: 24px; letter-spacing: .38em; text-transform: uppercase; text-align: center;
  color: var(--ink); background: rgba(0, 0, 0, .32); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .1);
  transition: box-shadow 160ms;
}
.code-input::placeholder { color: rgba(246, 242, 232, .18); }
.code-input:focus { box-shadow: inset 0 0 0 2px var(--gold); }
.code-input.shake { animation: shakeX 380ms cubic-bezier(.36, .07, .19, .97); }
@keyframes shakeX { 20%, 80% { transform: translateX(3px); } 30%, 50%, 70% { transform: translateX(-6px); } 40%, 60% { transform: translateX(6px); } }
.code-row .btn { min-width: 96px; }
.code-row .btn:disabled { opacity: .45; }
.code-row .btn.ready { color: var(--gold-ink); background: linear-gradient(180deg, #f6dc8f, var(--gold) 45%, var(--gold-2)); box-shadow: none; }
.btn.off { opacity: .45; }
.btn.busy { pointer-events: none; opacity: .7; }
.btn.busy::after {
  content: ""; position: absolute; right: 16px; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent; animation: spin 700ms linear infinite;
}
.code-row .btn.busy::after { right: 10px; }

/* «ждём» — три точки */
.wdots { display: inline-flex; gap: 3px; margin-left: 6px; vertical-align: middle; }
.wdots i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; animation: wdot 1.2s ease-in-out infinite; }
.wdots i:nth-child(2) { animation-delay: .15s; }
.wdots i:nth-child(3) { animation-delay: .3s; }
@keyframes wdot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.btn.waiting { opacity: .85; pointer-events: none; }

/* поиск */
.search { display: grid; justify-items: center; gap: 6px; padding-top: 4px; }
.search > .btn { margin-top: 4px; }
.radar { position: relative; width: 168px; height: 168px; display: grid; place-items: center; margin: 4px 0 10px; }
.radar .rw {
  position: absolute; inset: 0; border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(233, 196, 106, .55);
  animation: ripple 2.4s cubic-bezier(.2, .6, .3, 1) infinite; opacity: 0;
}
.radar .rw:nth-child(2) { animation-delay: .8s; }
.radar .rw:nth-child(3) { animation-delay: 1.6s; }
@keyframes ripple { 0% { transform: scale(.35); opacity: .9; } 100% { transform: scale(1); opacity: 0; } }
.radar .rc { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; box-shadow: 0 0 0 3px var(--gold), 0 0 30px rgba(233, 196, 106, .5); }
.radar .rc svg { width: 100%; height: 100%; }
.seats4 { position: absolute; inset: 0; animation: spin 9s linear infinite; }
.seats4 i {
  position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px; border-radius: 50%;
  background: rgba(255, 255, 255, .14); box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .25);
  transition: background 300ms, box-shadow 300ms, transform 420ms cubic-bezier(.3, 1.6, .5, 1);
}
.seats4 .s0 { transform: translateY(-74px); }
.seats4 .s1 { transform: translateX(74px); }
.seats4 .s2 { transform: translateY(74px); }
.seats4 .s3 { transform: translateX(-74px); }
.seats4 i.on { background: var(--gold); box-shadow: 0 0 14px rgba(233, 196, 106, .9); }
.seats4 .s0.on { transform: translateY(-74px) scale(1.2); }
.seats4 .s1.on { transform: translateX(74px) scale(1.2); }
.seats4 .s2.on { transform: translateY(74px) scale(1.2); }
.seats4 .s3.on { transform: translateX(-74px) scale(1.2); }
.sr-count { font-size: 15px; font-weight: 800; color: var(--ink-2); }
.sr-count b { display: inline-block; font-size: 28px; font-weight: 900; color: var(--ink); vertical-align: -3px; margin-right: 2px; }
.sr-time { font-size: 13px; font-weight: 700; color: var(--ink-3); }
.sr-note { margin: 2px 8px 10px; text-align: center; font-size: 12.5px; color: var(--ink-3); line-height: 1.35; }

/* лобби */
#lobby .wrap { min-height: 100%; }
.code-card {
  position: relative; display: grid; justify-items: center; gap: 6px; padding: 14px 14px 16px; border-radius: 22px; margin-bottom: 8px;
  background: rgba(0, 0, 0, .24); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07);
}
.cc-lbl { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.cc-code { display: flex; gap: 6px; }
.cc-code span {
  width: 44px; height: 54px; border-radius: 12px; display: grid; place-items: center;
  font-family: var(--font-ui); font-size: 28px; font-weight: 900; color: var(--gold-ink);
  background: linear-gradient(180deg, #fbf3d8, #e7d6a6); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .12), 0 8px 16px -8px rgba(0, 0, 0, .6);
  animation: rise 460ms var(--ease-out) both;
}
.cc-copy { position: absolute; right: 10px; top: 10px; width: 38px; height: 38px; border-radius: 12px; }
.cc-copy svg { width: 18px; height: 18px; }
.cc-copy.done { color: var(--hit); }

.lb-table { position: relative; height: 300px; margin: 6px 0 14px; }
.lb-felt {
  position: absolute; left: 50%; top: 50%; width: min(56%, 230px); height: 140px; transform: translate(-50%, -50%);
  border-radius: 999px; display: grid; place-items: center;
  background: radial-gradient(100% 100% at 50% 35%, var(--felt-1), var(--felt-2));
  box-shadow: inset 0 0 0 3px rgba(233, 196, 106, .28), inset 0 0 0 9px rgba(0, 0, 0, .18), inset 0 10px 30px rgba(255, 255, 255, .08), 0 18px 40px -12px rgba(0, 0, 0, .7);
}
.lb-info { display: grid; justify-items: center; gap: 2px; text-align: center; }
.lb-info b { font-family: var(--font-display); font-weight: 900; font-size: 20px; letter-spacing: -.01em; }
.lb-info span { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.lb-info .lb-cnt { margin-top: 4px; padding: 2px 10px; border-radius: 10px; background: rgba(0, 0, 0, .25); color: var(--gold); font-weight: 900; }
.lb-seat { position: absolute; width: 92px; display: flex; flex-direction: column; align-items: center; gap: 6px; transform: translate(-50%, -50%); }
.lb-seat.p0 { left: 50%; top: calc(100% - 44px); }
.lb-seat.p1 { left: 13%; top: 50%; }
.lb-seat.p2 { left: 50%; top: 44px; }
.lb-seat.p3 { left: 87%; top: 50%; }
.lb-av { width: 58px; height: 58px; border-radius: 50%; box-shadow: 0 0 0 3px rgba(0, 0, 0, .35), 0 10px 20px -8px rgba(0, 0, 0, .7); }
.lb-av > svg, .lb-av > .av-img { border-radius: 50%; width: 100%; height: 100%; overflow: hidden; }
.lb-seat.me .lb-av { box-shadow: 0 0 0 3px var(--gold), 0 10px 20px -8px rgba(0, 0, 0, .7); }
.lb-av .dot { position: absolute; right: 1px; bottom: 1px; width: 14px; height: 14px; border-radius: 50%; background: #8a8f96; box-shadow: 0 0 0 3px var(--felt-2); }
.lb-av .dot.on { background: #3ddc84; }
.lb-av .bot-tag { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); padding: 1px 6px; border-radius: 8px; font-style: normal; font-size: 10px; font-weight: 900; color: #1b2230; background: linear-gradient(180deg, #e6ebf2, #b6c0cc); text-transform: uppercase; letter-spacing: .04em; }
.lb-av .crown { position: absolute; left: 50%; top: -16px; width: 22px; height: 22px; margin-left: -11px; color: var(--gold); filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .6)); transform: rotate(-8deg); }
.lb-av .crown svg { width: 100%; height: 100%; }
.lb-av .kick { position: absolute; right: -8px; top: -6px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: rgba(30, 30, 34, .92); box-shadow: 0 0 0 1px rgba(255, 255, 255, .2); transition: transform 120ms var(--ease-out); }
.lb-av .kick:active { transform: scale(.85); }
.lb-av .kick svg { width: 11px; height: 11px; }
.lb-name { max-width: 100%; font-size: 13px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.lb-name small { font-weight: 700; color: var(--gold); font-size: 11px; }
.lb-name.dim { color: var(--ink-3); }
.lb-seat.empty .lb-name { font-size: 11.5px; font-weight: 700; color: var(--ink-2); white-space: normal; text-align: center; line-height: 1.15; }
.lb-add {
  position: relative; width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(0, 0, 0, .18);
  transition: transform 140ms var(--ease-out), background 160ms;
}
button.lb-add:active { transform: scale(.9); background: rgba(233, 196, 106, .18); }
.lb-add::before { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, .3); animation: spin 14s linear infinite; }
.lb-add .plus { font-size: 30px; font-weight: 600; line-height: 1; color: var(--ink-2); margin-top: -2px; }
.lb-add.idle .plus { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .3); animation: breathe 1.6s ease-in-out infinite; }
.lb-add.busy { opacity: .5; pointer-events: none; }
.lb-actions { display: grid; gap: 10px; margin-top: auto; }
.lb-invite svg { width: 20px; height: 20px; }
.lb-start.off { opacity: .5; filter: saturate(.4); }
.lb-wait { display: flex; align-items: center; justify-content: center; gap: 4px; min-height: 52px; border-radius: 16px; font-weight: 700; font-size: 14px; color: var(--ink-2); background: rgba(0, 0, 0, .18); }
.lb-wait .wdots { margin: 0 6px 0 0; }
.lb-leave { min-height: 44px; font-weight: 700; font-size: 15px; color: var(--miss); border-radius: 14px; }
.lb-leave:active { background: rgba(255, 90, 90, .1); }

/* лист «против ботов» */
.bots-sheet { display: grid; gap: 14px; }
.bots-acts { display: grid; gap: 10px; margin-top: 4px; }

/* баннер связи */
.net-banner {
  position: absolute; z-index: 800; left: 50%; top: calc(var(--sat) + 8px);
  display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  font-size: 13px; font-weight: 800; color: #fff; white-space: nowrap;
  background: rgba(30, 22, 18, .84); box-shadow: inset 0 0 0 1px rgba(255, 184, 107, .4), 0 10px 26px -10px rgba(0, 0, 0, .7);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  transform: translate(-50%, -140%); opacity: 0; pointer-events: none;
  transition: transform 420ms cubic-bezier(.3, 1.2, .5, 1), opacity 260ms;
}
.net-banner.on { transform: translate(-50%, 0); opacity: 1; }
.nb-spin { width: 13px; height: 13px; flex: none; border-radius: 50%; border: 2px solid var(--warn); border-right-color: transparent; animation: spin 800ms linear infinite; }

.app-toast {
  position: absolute; z-index: 790; left: 50%; bottom: calc(var(--sab) + 24px);
  max-width: calc(100% - 32px); width: max-content; padding: 11px 16px; border-radius: 14px;
  font-weight: 800; font-size: 14px; line-height: 1.3; text-align: center; color: #fff;
  background: rgba(20, 14, 14, .88); box-shadow: inset 0 0 0 1px rgba(255, 130, 130, .35), 0 10px 26px -8px rgba(0, 0, 0, .6);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  transform: translate(-50%, 16px) scale(.96); opacity: 0; pointer-events: none;
  transition: transform 260ms var(--ease-out), opacity 200ms;
  word-break: break-word;
}
.app-toast.on { transform: translate(-50%, 0) scale(1); opacity: 1; }
.app-toast.info { box-shadow: inset 0 0 0 1px rgba(233, 196, 106, .45), 0 10px 26px -8px rgba(0, 0, 0, .6); }
.app-toast svg { display: inline-block; width: 15px; height: 15px; vertical-align: -2px; }

/* таймер хода — кольцо, убывает по --p (обновляется только у активного пода) */
.tmr {
  --p: 1; --tc: var(--gold);
  position: absolute; inset: -5px; border-radius: 50%; opacity: 0;
  background: conic-gradient(var(--tc) calc(var(--p) * 360deg), rgba(255, 255, 255, .12) 0);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3.5px), #000 calc(100% - 3px));
  transition: opacity 240ms;
}
.pod.h .tmr { inset: -4px; }
.tmr.low { --tc: #ff6b6b; }
.pod.timed .tmr { opacity: 1; }
.pod.timed .ring { opacity: 0; animation: none; }
.pod.timed .tmr.low { animation: tmrPulse 700ms ease-in-out infinite; }
@keyframes tmrPulse { 50% { opacity: .55; } }

/* офлайн / автоход на поде */
.pod-net {
  position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%); z-index: 3;
  padding: 1px 6px; border-radius: 8px; font-size: 9.5px; font-weight: 900; letter-spacing: .03em; white-space: nowrap;
  color: #fff; background: #6b6f76; box-shadow: 0 2px 6px rgba(0, 0, 0, .5);
  opacity: 0; transition: opacity 200ms;
}
.pod.off .pod-net { opacity: 1; background: #b8424c; }
.pod.auto .pod-net { opacity: 1; background: #5b6472; }
.pod.off .av { filter: grayscale(1) brightness(.7); }

/* быстрые фразы */
.phrase-btn { position: absolute; z-index: 45; }
.phrase-btn svg { width: 22px; height: 22px; }
.phrases {
  position: absolute; z-index: 460; width: 240px; padding: 8px; border-radius: 20px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
  background: rgba(24, 27, 30, .92); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 16px 40px -12px rgba(0, 0, 0, .7);
  -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%);
  transform-origin: 22px 100%; transform: scale(.6) translateY(10px); opacity: 0; pointer-events: none;
  transition: transform 260ms cubic-bezier(.3, 1.25, .5, 1), opacity 160ms;
}
.phrases.on { transform: none; opacity: 1; pointer-events: auto; }
.phrase {
  min-height: 40px; padding: 6px 8px; border-radius: 12px; font-size: 13px; font-weight: 800; line-height: 1.15;
  background: rgba(255, 255, 255, .08); transition: transform 110ms var(--ease-out), background 140ms;
}
.phrase:active { transform: scale(.94); background: rgba(233, 196, 106, .25); }
.bubble.say { font-size: 13.5px; font-weight: 800; max-width: 170px; white-space: normal; text-align: center; line-height: 1.2; }

.over-note { text-align: center; font-size: 13.5px; font-weight: 700; color: var(--ink-3); padding: 6px 0; }

@media (prefers-reduced-motion: reduce) {
  .radar .rw, .seats4, .lb-add::before, .wdots i, .nb-spin, .pod.timed .tmr.low { animation: none !important; }
  .radar .rw:first-child { opacity: .5; transform: scale(.8); }
  .hub-card, .cc-code span, .menu-profile { animation-duration: 1ms !important; animation-delay: 0ms !important; }
}

/* =====================================================================
   Аватары, профиль-кнопка, лист «Профиль», фразы с вкладками, речевой пузырь
   ===================================================================== */
.jav { display: block; width: 100%; height: 100%; }
.mini-av > svg, .rc > svg { width: 100%; height: 100%; }

/* профиль — нажимаемая карточка */
button.profile { width: 100%; text-align: left; font: inherit; color: inherit; transition: transform 140ms var(--ease-out), background 160ms; -webkit-tap-highlight-color: transparent; }
button.profile:active { transform: scale(.975); background: rgba(0, 0, 0, .3); }
.pf-av { position: relative; overflow: visible; }
.pf-av > svg, .pf-av > .av-img { clip-path: circle(50%); border-radius: 50%; }
.pf-edit {
  position: absolute; right: -4px; bottom: -3px; width: 19px; height: 19px; border-radius: 50%;
  display: grid; place-items: center; color: var(--gold-ink);
  background: linear-gradient(180deg, #f4d68a, var(--gold)); box-shadow: 0 0 0 2px var(--felt-3), 0 2px 6px rgba(0, 0, 0, .5);
}
.pf-edit svg { width: 10px; height: 10px; }

/* строка «Аватар» в настройках */
.set-av { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 14px; text-align: left; border-top: 1px solid rgba(255, 255, 255, .06); transition: background 160ms; }
.set-av:active { background: rgba(255, 255, 255, .06); }
.set-av .lbl { flex: 1; font-weight: 700; font-size: 15px; }
.set-av .lbl small { display: block; font-weight: 500; font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.set-av-pic { position: relative; width: 40px; height: 40px; border-radius: 50%; overflow: hidden; flex: none; box-shadow: 0 0 0 2px rgba(233, 196, 106, .55); }
.set-av-pic > svg { width: 100%; height: 100%; }
.set-av .chev { width: 18px; height: 18px; color: var(--ink-3); transform: rotate(180deg); }

/* лист «Профиль» */
.avs-head { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.avs-big {
  position: relative; width: 84px; height: 84px; flex: none; border-radius: 50%; overflow: hidden;
  box-shadow: 0 0 0 3px var(--gold), 0 10px 22px -12px rgba(0, 0, 0, .8);
}
.avs-big > svg { width: 100%; height: 100%; }
.avs-name { flex: 1; min-width: 0; }
.avs-name .group-title { margin-bottom: 6px; }
.avs-hint { margin: 6px 0 0 4px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.avs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 12px 10px; padding: 4px 2px 8px; }
.avs-item { position: relative; display: grid; place-items: center; aspect-ratio: 1; border-radius: 50%; -webkit-tap-highlight-color: transparent; }
.avs-pic {
  position: relative; width: 100%; height: 100%; border-radius: 50%; overflow: hidden;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .1), 0 8px 18px -10px rgba(0, 0, 0, .8);
  transition: transform 260ms cubic-bezier(.3, 1.3, .5, 1), box-shadow 200ms;
}
.avs-pic > svg { width: 100%; height: 100%; }
.avs-item:active .avs-pic { transform: scale(.9); transition-duration: 90ms; }
.avs-item.on .avs-pic { box-shadow: 0 0 0 3px var(--gold), 0 0 22px rgba(233, 196, 106, .45); transform: scale(.92); }
.avs-item.photo .avs-pic { background: rgba(255, 255, 255, .08); }
.avs-check {
  position: absolute; right: -1px; bottom: -1px; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; color: var(--gold-ink); background: var(--gold);
  box-shadow: 0 0 0 2px #1d2023, 0 2px 6px rgba(0, 0, 0, .5);
  transform: scale(0); opacity: 0; transition: transform 300ms cubic-bezier(.3, 1.5, .5, 1), opacity 140ms;
}
.avs-check svg { width: 12px; height: 12px; }
.avs-item.on .avs-check { transform: scale(1); opacity: 1; }
.avs-cap { margin: 2px 0 6px 4px; font-size: 12px; font-weight: 600; color: var(--ink-3); }

/* быстрые фразы: вкладки + список */
.phrases { display: flex; flex-direction: column; gap: 8px; overflow: hidden; }
.ph-tabs {
  position: relative; flex: none; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 13px;
  background: rgba(0, 0, 0, .35); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
}
.ph-ind {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 10px;
  background: rgba(255, 255, 255, .16); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 4px 10px -4px rgba(0, 0, 0, .5);
  transition: transform 340ms cubic-bezier(.3, 1.25, .5, 1), background 200ms;
}
.ph-tabs.r .ph-ind { transform: translateX(100%); background: rgba(232, 72, 85, .38); }
.ph-tabs button { position: relative; z-index: 1; min-height: 34px; border-radius: 10px; font-size: 13px; font-weight: 800; color: var(--ink-2); transition: color 200ms; }
.ph-tabs button[aria-selected="true"] { color: var(--ink); }
.ph-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; min-height: 0; overflow-y: auto; overscroll-behavior: contain; animation: phIn 220ms var(--ease-out); }
.ph-list.harsh .phrase { background: rgba(232, 72, 85, .14); box-shadow: inset 0 0 0 1px rgba(255, 120, 130, .12); }
.ph-list.harsh .phrase:active { background: rgba(232, 72, 85, .34); }
@keyframes phIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.phrase { text-align: center; text-wrap: balance; }

/* речевой пузырь фразы (слой сцены, над картами) */
.speech {
  position: absolute; z-index: 90; left: 0; top: 0;
  width: max-content; max-width: min(216px, calc(100% - 16px));
  padding: 8px 13px 9px; border-radius: 17px;
  font-weight: 800; font-size: 14.5px; line-height: 1.22; letter-spacing: -.005em; text-align: center; text-wrap: balance;
  color: #1d1a14; background: #fffaf0;
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .7), 0 2px 6px -2px rgba(0, 0, 0, .35);
  transform-origin: var(--tail, 50%) calc(100% + 6px);
  pointer-events: none; will-change: transform, opacity;
}
.speech::after {
  content: ""; position: absolute; left: var(--tail, 50%); bottom: -5px; width: 12px; height: 12px; margin-left: -6px;
  background: inherit; transform: rotate(45deg); border-radius: 0 0 3px 0;
}
.speech.s2 { transform-origin: var(--tail, 50%) -6px; }
.speech.s2::after { bottom: auto; top: -5px; border-radius: 3px 0 0 0; }
.speech.harsh { background: #fff1ea; color: #4a0d16; box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .7), inset 0 0 0 1.5px rgba(214, 48, 64, .35); }
.speech.harsh::after { box-shadow: 1.5px 1.5px 0 0 rgba(214, 48, 64, .35); }
.speech.s2.harsh::after { box-shadow: -1.5px -1.5px 0 0 rgba(214, 48, 64, .35); }

@media (prefers-reduced-motion: reduce) {
  .ph-list { animation: none; }
  .ph-ind, .avs-pic, .avs-check { transition-duration: 1ms; }
}
.avs { padding: 0 4px; }
.avs-row {
  display: flex; align-items: center; gap: 12px; width: 100%; aspect-ratio: auto; border-radius: 16px; margin-bottom: 18px;
  padding: 8px 12px 8px 8px; text-align: left; background: rgba(255, 255, 255, .055); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06);
  transition: background 160ms, box-shadow 200ms;
}
.avs-row .avs-pic { width: 44px; height: 44px; flex: none; }
.avs-row.on { background: rgba(233, 196, 106, .1); box-shadow: inset 0 0 0 1.5px rgba(233, 196, 106, .6); }
.avs-row.on .avs-pic { transform: none; box-shadow: 0 0 0 2px var(--gold); }
.avs-row-t { flex: 1; font-weight: 700; font-size: 15px; }
.avs-row-t small { display: block; font-weight: 500; font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.avs-row .avs-check { position: static; flex: none; box-shadow: none; }
.avs-grid { grid-template-columns: repeat(4, 1fr); gap: 14px 12px; padding: 4px 2px 12px; }
