/* Space Poker / Dice — Premium Dark Space Poker Terminal.
   Mobile-first. Один доминирующий акцент (изумрудный — действие),
   золото — только деньги. Рамки — только у полей ввода, деструктива и
   плавающих элементов. Анимируются только transform и opacity. */

:root {
  color-scheme: dark;

  /* поверхности */
  --bg-void: #070D18;
  --bg-base: #0B1421;
  --bg-surface: #101C2B;
  --bg-elevated: #18283A;
  --bg-active: #23384A;

  /* текст */
  --text-primary: #F0F3F5;
  --text-secondary: #A2B2C5;
  --text-muted: #8293A7;

  /* акценты */
  --accent: #3AE6C2;
  --accent-strong: #21CCAA;
  --on-accent: #04140D;
  --gold: #DCB76D;
  --gold-bright: #F0CE82;
  --gold-deep: #8A6A2E;
  --cyan: #74C8D8;
  --violet: #8178B8;

  /* состояния */
  --success: #49D28B;
  --danger: #E06C78;
  --danger-text: #F2A7AF;
  --warning: #D8AA59;
  --info: #6BA8E8;

  /* стол и игровые объекты */
  --felt: #102925;
  --felt-deep: #0A1B19;
  --table-highlight: rgba(88, 222, 170, .12);
  --card-face: #F8F5EC;
  --card-ink: #14181D;
  --card-red: #C8364A;
  --die-face: #F4F1EA;
  --die-pip: #12161B;

  --hairline: rgba(255, 255, 255, .06);
  --hairline-strong: rgba(255, 255, 255, .11);

  /* старые имена — на новые значения */
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --green: var(--success);
  --red: var(--danger);
  --gold2: var(--gold-bright);

  /* радиусы */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-pill: 999px;

  /* тени */
  --shadow-1: 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-2: 0 24px 48px -16px rgba(0, 0, 0, .75);

  /* движение */
  --motion-instant: 100ms;
  --motion-fast: 160ms;
  --motion-normal: 240ms;
  --motion-emphasis: 360ms;
  --motion-reveal: 520ms;
  --motion-celebration: 720ms;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.3, 1.25, .5, 1);

  /* безопасные зоны: env() + переменные Telegram (Bot API 8.0 fullscreen) */
  --sa-t: max(env(safe-area-inset-top, 0px), calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)));
  --sa-b: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --sa-l: max(env(safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px));
  --sa-r: max(env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px));
  --tabbar-h: 60px;
  /* Видимая часть WebView. Пока мини-апп не раскрыт, Telegram показывает только
     верх страницы: элемент с bottom:0 оказывается под краем экрана. --vb — эта
     невидимая полоса снизу, её прибавляем ко всему, что прижато к низу. */
  --app-h: var(--tg-viewport-stable-height, 100dvh);
  --vb: max(0px, calc(100vh - var(--tg-viewport-stable-height, 100vh)));

  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --brand: "Unbounded", var(--font);
}

/* ---------------------------------------------------------------- база --- */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg-void); -webkit-text-size-adjust: 100%; width: 100%; overflow-x: clip; overflow-y: auto; }
body {
  margin: 0; min-height: 100dvh; width: 100%; overflow-x: clip; overflow-y: visible; color: var(--text-primary); background: var(--bg-base);
  font: 500 15px/1.4 var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior-x: none;
  padding-left: var(--sa-l); padding-right: var(--sa-r);
}
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(70% 38% at 88% -6%, rgba(129, 120, 184, .18), transparent 65%),
    radial-gradient(60% 30% at 8% 18%, rgba(87, 221, 165, .06), transparent 60%),
    radial-gradient(80% 40% at 50% 108%, rgba(108, 94, 190, .12), transparent 62%),
    var(--bg-base);
}
html.locked, body.locked { overflow-y: hidden; }
#stars { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; transition: opacity var(--motion-reveal); }
#stars.dim { opacity: 0; }
#app { position: relative; z-index: 1; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: inherit; }
input { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.tnum { font-variant-numeric: tabular-nums; }
.grow { flex: 1; min-width: 0; }
.muted { color: var(--text-secondary); }
.pos { color: var(--success); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ico { flex: none; display: block; }

/* ----------------------------------------------------------- бренд ------- */
.brand { display: flex; align-items: center; gap: 8px; }
.brandmark { flex: none; display: block; }
.wordmark { font: 700 12px/1 var(--brand); letter-spacing: .16em; color: var(--text-primary); }
.wordmark b { font-weight: 700; color: var(--gold); margin-left: .45em; }
.wordmark.lg { font-size: 17px; }

/* ----------------------------------------------------------- каркас ------ */
.app { max-width: 560px; margin: 0 auto; }
.appbar {
  position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(var(--sa-t) + 8px) 16px 8px;
  background: linear-gradient(180deg, var(--bg-base) 72%, rgba(11, 15, 19, 0));
}
.bal-group { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: var(--r-pill); background: var(--bg-surface);
  box-shadow: inset 0 0 0 1px var(--hairline); }
.bal-widget {
  display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px 0 10px; border-radius: var(--r-pill);
  transition: background var(--motion-fast);
}
.bal-col { display: grid; line-height: 1.1; text-align: left; }
.bal-sub { font-size: 10.5px; font-weight: 700; color: var(--text-muted); letter-spacing: .02em; }
.bal-plus { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; background: var(--accent); color: var(--on-accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3); transition: transform var(--motion-instant); }
.bal-plus:active { transform: scale(.92); }
.bal-widget:active { background: var(--bg-active); }
.bal-num { font-weight: 800; font-size: 15.5px; color: var(--gold-bright); }
.bal-unit { font-size: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: .04em; }

.screen { min-height: 0; padding: 4px 16px calc(var(--tabbar-h) + 34px + var(--sa-b) + var(--vb)); touch-action: pan-y; }
/* backwards, не both: оставшийся transform сделал бы .page контейнером для position:fixed шторок */
.page { animation: pagein var(--motion-normal) var(--ease-out) backwards; }
@keyframes pagein { from { opacity: 0; transform: translateY(6px); } }

/* переключатель «Покер / Кубики» */
.mode {
  position: relative; display: grid; grid-template-columns: repeat(3, 1fr); padding: 4px; margin: 4px 0 20px;
  border-radius: 14px; background: var(--bg-surface);
}
.mode-thumb {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / 3); border-radius: 10px;
  background: var(--bg-active); transform: translateX(calc(var(--i) * 100%));
  transition: transform var(--motion-emphasis) var(--ease-spring);
}
.mode button { position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px;
  font-weight: 700; font-size: 14px; color: var(--text-secondary); transition: color var(--motion-fast); }
.mode button.on { color: var(--text-primary); }
.mode button.on .ico { color: var(--accent); }
.guide-bar { display:flex; justify-content:flex-end; margin:-10px 0 14px; }
.guide-button { display:inline-flex; align-items:center; gap:7px; min-height:38px; padding:0 12px; border-radius:var(--r-pill); background:var(--bg-surface); color:var(--text-secondary); font-size:12px; font-weight:700; }
.guide-button .ico { color:var(--accent); }
.guide-list { display:grid; gap:2px; }
.guide-list article { display:flex; gap:12px; padding:12px 0; border-top:1px solid var(--hairline-strong); }
.guide-list article>span { flex:none; font:700 12px/1.7 var(--brand); color:var(--accent); }
.guide-list b { display:block; font-size:14px; }
.guide-list p { margin:4px 0 0; color:var(--text-secondary); font-size:13px; line-height:1.55; }

/* нижняя навигация — плавающий остров */
.tabbar {
  position: fixed; z-index: 20; left: 12px; right: 12px; bottom: calc(10px + var(--sa-b) + var(--vb));
  max-width: 440px; margin: 0 auto; display: flex; padding: 6px; height: var(--tabbar-h);
  border-radius: var(--r-lg); background: rgba(17, 23, 29, .86);
  -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: var(--shadow-2), inset 0 0 0 1px var(--hairline);
}
.tab-thumb {
  position: absolute; top: 6px; bottom: 6px; left: 0; width: var(--w, 0); border-radius: 16px;
  background: var(--bg-active); transform: translateX(var(--x, 0));
  transition: transform var(--motion-emphasis) var(--ease-spring), width var(--motion-emphasis) var(--ease-spring);
}
.tab {
  position: relative; flex: 1 1 0; min-width: 0; display: flex; align-items: center; justify-content: center; gap: 6px;
  color: var(--text-muted); font-weight: 700; font-size: 12.5px; transition: color var(--motion-fast);
}
.tab.on { flex-grow: 1.9; color: var(--text-primary); }
.tab.on .ico { color: var(--accent); animation: tabnudge var(--motion-emphasis) var(--ease-spring); }
.tab-lbl { max-width: 0; opacity: 0; overflow: hidden; white-space: nowrap; transition: opacity var(--motion-normal); }
.tab.on .tab-lbl { max-width: 96px; opacity: 1; }
@keyframes tabnudge { 40% { transform: translateY(-2px) scale(1.08); } }

/* плашка соединения — поверх, без сдвига разметки */
.net {
  position: fixed; z-index: 45; left: 50%; top: calc(var(--sa-t) + 64px); transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; min-height: 40px; border-radius: var(--r-pill);
  background: rgba(23, 31, 39, .94); box-shadow: var(--shadow-1), inset 0 0 0 1px rgba(216, 170, 89, .35);
  font-size: 13px; font-weight: 700; white-space: nowrap; animation: dropin var(--motion-normal) var(--ease-out);
}
.net-retry { min-height: 32px; padding: 0 12px; border-radius: var(--r-pill); color: var(--accent); font-weight: 800; }
@keyframes dropin { from { opacity: 0; transform: translate(-50%, -8px); } }

/* ----------------------------------------------------------- кнопки ------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 18px;
  border-radius: var(--r-sm); font-weight: 700; font-size: 15px; white-space: nowrap;
  transition: transform var(--motion-instant) var(--ease-out), background var(--motion-fast), opacity var(--motion-fast);
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .38; pointer-events: none; }
.btn.block { width: 100%; }
.btn.lg { min-height: 54px; font-size: 16px; }
.btn.sm { min-height: 44px; padding: 0 14px; font-size: 14px; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .28); }
.btn-primary:active { background: var(--accent-strong); }
.btn-secondary { background: var(--bg-elevated); color: var(--text-primary); }
.btn-secondary:active { background: var(--bg-active); }
.btn-quiet { color: var(--text-secondary); }
.btn-quiet:active { background: var(--bg-surface); }
.btn-danger { color: var(--danger-text); box-shadow: inset 0 0 0 1px rgba(224, 108, 120, .45); }
.btn-danger:active { background: rgba(224, 108, 120, .1); }
.btn-fold { background: var(--bg-elevated); color: var(--danger-text); }
.btn-fold:active { background: var(--bg-active); }
.btn .spinner { border-top-color: currentColor; }

.icon-btn {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r-sm);
  color: var(--text-secondary); transition: background var(--motion-fast), color var(--motion-fast);
}
.icon-btn:active { background: var(--bg-elevated); color: var(--text-primary); }
.icon-btn[disabled] { opacity: .3; pointer-events: none; }
.icon-btn.lg { width: 52px; height: 52px; background: var(--bg-elevated); color: var(--text-primary); }
.icon-btn .pm { font-size: 26px; font-weight: 600; line-height: 1; }

/* чипы и сегменты */
.chip-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px;
  border-radius: var(--r-pill); background: var(--bg-surface); color: var(--text-secondary); font-weight: 700; font-size: 13.5px;
  transition: background var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast);
}
.chip.on { background: var(--bg-active); color: var(--text-primary); box-shadow: inset 0 0 0 1.5px rgba(87, 221, 165, .55); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--bg-surface); }
.sheet .seg { background: var(--bg-base); }
.seg button { min-height: 42px; padding: 0 8px; border-radius: 10px; font-weight: 700; font-size: 14px; color: var(--text-secondary);
  transition: background var(--motion-fast), color var(--motion-fast); }
.seg button.on { background: var(--bg-active); color: var(--text-primary); }
.sheet .seg + .field, .seg + .summary { margin-top: 20px; }

/* ----------------------------------------------------------- формы ------- */
.field { margin-bottom: 20px; }
.field-label { display: block; margin-bottom: 8px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.info-label { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:8px; }
.info-label .field-label { margin:0; }
.info-trigger { flex:none; display:grid; place-items:center; width:30px; height:30px; border-radius:9px; color:var(--text-secondary); background:var(--bg-active); }
.info-trigger[aria-expanded="true"] { color:var(--accent); }
.info-explain { margin:0 0 10px; padding:10px 12px; border-left:2px solid var(--accent); border-radius:0 10px 10px 0; background:var(--bg-active); color:var(--text-secondary); font-size:12px; line-height:1.5; }
.create-room-fields { padding-bottom:8px; }
.create-room-fields .field:last-child { margin-bottom:0; }
.field-error { margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--danger-text); }
.amount-box, .code-box {
  display: flex; align-items: center; gap: 8px; min-height: 58px; padding: 0 8px 0 16px; border-radius: var(--r-sm);
  background: var(--bg-base); box-shadow: inset 0 0 0 1px var(--hairline-strong); transition: box-shadow var(--motion-fast);
}
.amount-box:focus-within, .code-box:focus-within { box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px rgba(87, 221, 165, .12); }
.amount-box.invalid, .code-box.invalid { box-shadow: inset 0 0 0 1.5px var(--danger); }
.amount-input, .code-input { flex: 1; min-width: 0; height: 56px; border: 0; outline: 0; background: transparent;
  font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.amount-unit { padding-right: 8px; font-size: 13px; font-weight: 700; color: var(--text-muted); }
.amount-box + .chip-row, .field-error + .chip-row { margin-top: 12px; }
.code-input { letter-spacing: .2em; text-transform: uppercase; }
.code-input::placeholder { color: var(--text-muted); opacity: .6; }

.toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 4px 0 20px; cursor: pointer; }
.toggle b { display: block; font-size: 15px; font-weight: 700; }
.toggle small { display: block; margin-top: 2px; font-size: 13px; color: var(--text-secondary); }
.switch {
  appearance: none; -webkit-appearance: none; flex: none; position: relative; width: 50px; height: 30px; margin: 0;
  border-radius: var(--r-pill); background: var(--bg-active); cursor: pointer; transition: background var(--motion-fast);
}
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--text-primary); box-shadow: 0 2px 6px rgba(0, 0, 0, .4); transition: transform var(--motion-normal) var(--ease-spring); }
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }

.summary { display: grid; gap: 10px; margin: 0; padding: 14px 16px; border-radius: 14px; background: var(--bg-base); }
.summary.plain { background: var(--bg-surface); margin-top: 12px; }
.summary div { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.summary dt { color: var(--text-secondary); font-size: 14px; }
.summary dd { margin: 0; font-weight: 700; font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.summary .money { color: var(--gold-bright); font-weight: 800; }
.summary .minor dt, .summary .minor dd { color: var(--text-muted); font-weight: 600; font-size: 13px; }

.notice { display: flex; align-items: center; gap: 12px; margin-top: 20px; padding: 14px; border-radius: 14px; background: var(--bg-elevated); }
.notice > .ico { color: var(--info); }
.notice.ok > .ico { color: var(--success); }
.notice.warn > .ico { color: var(--warning); }
.notice.err > .ico { color: var(--danger); }
.notice b { display: block; font-size: 14px; }
.notice span { display: block; margin-top: 2px; font-size: 13px; color: var(--text-secondary); }
.notice.pay { flex-wrap: wrap; }
.pay-link { flex-basis: 100%; display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 10px; background: var(--bg-surface); }
.notice .pay-url { flex: 1; min-width: 0; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; user-select: all; -webkit-user-select: all; }

/* ---------------------------------------------------------- лобби -------- */
.hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0 8px; }
.eyebrow { font-size: 13px; font-weight: 600; color: var(--text-secondary); }
.hero-bal { display: flex; align-items: baseline; gap: 6px; margin-top: 4px; font-size: 38px; font-weight: 800; letter-spacing: -.02em; line-height: 1.05; }
.hero-bal small { font-size: 14px; font-weight: 700; letter-spacing: .02em; color: var(--text-muted); }
.hero-sub { margin-top: 6px; font-size: 13px; color: var(--text-secondary); }
.hero-art { flex: none; }
.art-table { position: relative; width: 112px; height: 76px; }
.art-felt { position: absolute; inset: 8px 0; border-radius: 50%;
  background: radial-gradient(70% 60% at 50% 40%, #17463F, var(--felt) 60%, var(--felt-deep));
  box-shadow: 0 0 0 5px #1B232B, 0 14px 26px -10px rgba(0, 0, 0, .8), inset 0 4px 12px rgba(0, 0, 0, .5); }
.art-cards { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -54%); display: flex; }
.art-cards .card.sm { width: 30px; height: 42px; }
.art-cards .card + .card { margin-left: -8px; }
.art-dice { display: flex; align-items: flex-end; gap: 6px; padding: 6px 4px 0 0; }

.block { margin-top: 28px; }
.page > .block:first-child { margin-top: 8px; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.block-head h2 { font-size: 17px; font-weight: 700; }
.block-head .muted { font-size: 13px; }
.count { min-width: 24px; padding: 2px 8px; border-radius: var(--r-pill); background: var(--bg-surface); font-size: 12px; font-weight: 700; color: var(--text-secondary); text-align: center; }
.hint { margin-top: 12px; font-size: 13px; line-height: 1.5; color: var(--text-muted); }
.rules { padding-top: 4px; }
.flow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; font-weight: 700; color: var(--text-secondary); }
.flow .ico { color: var(--text-muted); }

.stake-pick { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 12px; }
.stake {
  min-height: 52px; border-radius: var(--r-sm); background: var(--bg-surface); font-size: 17px; font-weight: 800;
  font-variant-numeric: tabular-nums; color: var(--text-primary); text-align: center;
  transition: background var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast), transform var(--motion-instant);
}
.stake:active { transform: scale(.95); }
.stake.on { background: rgba(87, 221, 165, .1); color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.stake.short { color: var(--text-muted); }
.stake.short.on { color: var(--warning); box-shadow: inset 0 0 0 1.5px var(--warning); background: rgba(216, 170, 89, .08); }

.toolbar { display: flex; gap: 10px; margin-bottom: 14px; }
.toolbar + .chip-row { margin-bottom: 14px; }

/* списки — сгруппированные строки на одной поверхности, без карточек */
.list { border-radius: var(--r-md); background: var(--bg-surface); overflow: hidden; }
.list.flat { background: var(--bg-base); margin-bottom: 4px; }
.list.stale { opacity: .6; transition: opacity var(--motion-fast); }
.row-item { width: 100%; display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 16px; text-align: left;
  transition: background var(--motion-fast); }
button.row-item:active { background: var(--bg-active); }
.row-item + .row-item { box-shadow: inset 0 1px 0 var(--hairline); }
.row-title { display: block; font-size: 15px; font-weight: 700; }
.row-sub { display: block; margin-top: 2px; font-size: 13px; color: var(--text-secondary); }
.row-cta { flex: none; display: flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 700; color: var(--accent); }
.live { font-style: normal; font-size: 11px; font-weight: 800; color: var(--accent); margin-left: 4px; }
.seats { display: flex; gap: 4px; margin-top: 8px; }
.seats i { width: 6px; height: 6px; border-radius: 50%; background: var(--bg-active); }
.seats i.on { background: var(--accent); }
.stake-token { flex: none; display: grid; place-content: center; width: 48px; height: 48px; border-radius: var(--r-sm);
  background: var(--bg-elevated); text-align: center; line-height: 1; }
.stake-token b { font-size: 15px; font-weight: 800; color: var(--gold-bright); }
.stake-token small { margin-top: 3px; font-size: 9.5px; font-weight: 700; color: var(--text-muted); letter-spacing: .04em; }
.stake-token.dice { background: transparent; }

/* состояния загрузки / пусто / ошибка */
.state { display: grid; justify-items: center; gap: 10px; padding: 40px 16px; text-align: center; }
.state.compact { padding: 20px 0; }
.state-ico { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--bg-surface); color: var(--text-secondary); }
.state-ico.err { color: var(--danger); }
.state-title { font-size: 16px; font-weight: 700; }
.state-text { max-width: 290px; font-size: 14px; line-height: 1.5; color: var(--text-secondary); }
.state .btn { margin-top: 6px; }
.spinner { display: inline-block; flex: none; width: 28px; height: 28px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .1); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.spinner.sm { width: 18px; height: 18px; border-width: 2px; }
.spinner.xs { width: 14px; height: 14px; border-width: 2px; border-top-color: var(--warning); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------- шторки ------- */
.sheet-back { position: fixed; inset: 0 0 var(--vb) 0; z-index: 40; background: rgba(3, 5, 8, .66);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); animation: fade var(--motion-fast) var(--ease-out); }
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed; z-index: 41; left: 0; right: 0; bottom: calc(var(--vb) + var(--kb, 0px)); max-width: 560px; margin: 0 auto;
  display: flex; flex-direction: column; max-height: calc(min(100dvh, var(--app-h)) - var(--sa-t) - 16px - var(--kb, 0px));
  border-radius: var(--r-lg) var(--r-lg) 0 0; background: var(--bg-surface); box-shadow: var(--shadow-2);
  padding-bottom: calc(16px + var(--sa-b)); outline: none; animation: sheetin var(--motion-normal) var(--ease-out);
}
@keyframes sheetin { from { transform: translateY(40%); opacity: 0; } }
.grab { flex: none; width: 36px; height: 4px; margin: 8px auto 2px; border-radius: 4px; background: var(--bg-active); }
.sheet-head { flex: none; display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px 8px 20px; }
.sheet-head h2 { padding-top: 10px; font-size: 19px; font-weight: 700; }
.sheet-sub { margin-top: 6px; font-size: 13.5px; line-height: 1.45; color: var(--text-secondary); }
.sheet-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; padding: 12px 20px 8px; }
.sheet-foot { flex: none; padding: 12px 20px 0; }
.sheet-text { font-size: 14px; line-height: 1.55; color: var(--text-secondary); margin-bottom: 16px; }
.hash { display: block; margin: 0 0 16px; padding: 10px 12px; border-radius: 10px; background: var(--bg-base);
  font: 500 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--cyan); word-break: break-all; }
.sub-head { margin: 22px 0 10px; font-size: 13px; font-weight: 700; color: var(--text-secondary); }

/* ------------------------------------------------------------ тост ------- */
.toast-host { position: fixed; z-index: 60; left: 0; right: 0; top: calc(var(--sa-t) + 10px); display: flex; justify-content: center; pointer-events: none; padding: 0 16px; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 420px; padding: 12px 16px; border-radius: 14px;
  background: rgba(23, 31, 39, .94); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  box-shadow: var(--shadow-2), inset 0 0 0 1px var(--hairline); font-size: 14px; font-weight: 600;
  animation: toastin var(--motion-normal) var(--ease-spring);
}
.toast .ico { color: var(--info); }
.toast.ok .ico { color: var(--success); }
.toast.err .ico { color: var(--danger); }
@keyframes toastin { from { opacity: 0; transform: translateY(-10px) scale(.98); } }

/* ------------------------------------------------------------- стол ------ */
.table-screen {
  position: fixed; inset: 0 0 var(--vb) 0; z-index: 5; display: flex; flex-direction: column;
  padding: var(--sa-t) var(--sa-r) var(--sa-b) var(--sa-l);
  background: radial-gradient(90% 55% at 50% 42%, rgba(88, 222, 170, .06), transparent 70%), var(--bg-void);
}
.table-head { flex: none; display: flex; align-items: center; gap: 4px; width: 100%; max-width: 960px; margin: 0 auto; padding: 6px 8px; min-width: 0; }
.table-info { min-width: 0; padding: 0 4px; overflow: hidden; }
.table-info b, .table-info span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table-info b { font-size: 15px; font-weight: 800; }
.table-info span { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.table-head-tools, .table-head-actions { display: flex; align-items: center; gap: 4px; flex: none; }
.table-head-actions .btn { min-width: 0; }

.stage { position: relative; flex: 1; min-height: 0; width: 100%; max-width: 760px; margin: 0 auto; }
.felt-wrap { position: absolute; left: 6%; right: 6%; top: 11%; bottom: 17%; transform: perspective(1100px) rotateX(9deg); transform-origin: 50% 100%; }
.stage.enter .felt-wrap { animation: tablein var(--motion-emphasis) var(--ease-out) both; }
@keyframes tablein { from { opacity: 0; transform: perspective(1100px) rotateX(16deg) scale(.96); } }
.rail {
  position: absolute; inset: 0; border-radius: 48% / 36%;
  border: 1px solid #8B7450;
  background: linear-gradient(145deg, #596470, #1B2733 18%, #080F18 65%, #39434A);
  box-shadow: 0 34px 60px -24px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .08), inset 0 -3px 8px rgba(0, 0, 0, .6);
}
.felt {
  position: absolute; inset: 11px; border-radius: 48% / 36%;
  background: repeating-linear-gradient(35deg, #ffffff03 0 1px, transparent 1px 4px), radial-gradient(75% 60% at 50% 38%, #1C5149, var(--felt) 65%, var(--felt-deep));
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .45), inset 0 10px 34px rgba(0, 0, 0, .5);
}
.bet-line { position: absolute; inset: 15% 12%; border-radius: 48% / 36%; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .055); }

.center { position: absolute; left: 50%; top: 50%; z-index: 1; transform: translate(-50%, -50%); width: 84%;
  display: grid; justify-items: center; gap: 10px; text-align: center; }
.center-kicker { font-size: 12px; font-weight: 600; color: rgba(240, 243, 245, .55); }
.center-status { font-size: 17px; font-weight: 700; }
.pot { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px 6px 10px; border-radius: var(--r-pill);
  background: rgba(4, 8, 10, .58); font-size: 15px; font-weight: 800; color: var(--gold-bright); font-variant-numeric: tabular-nums;
  animation: potpulse var(--motion-emphasis) var(--ease-out); }
@keyframes potpulse { 45% { transform: scale(1.06); } }

/* карты */
.board { display: flex; justify-content: center; gap: 5px; }
.board.static { justify-content: flex-start; margin: 4px 0 16px; }
.card {
  position: relative; flex: none; width: clamp(40px, 11.4vw, 50px); aspect-ratio: 5 / 7; border-radius: 6px;
  background: linear-gradient(135deg, #FFFFFF, var(--card-face) 65%, #E5DFD0); color: var(--card-ink); font-size: clamp(14px, 3.9vw, 17px);
  box-shadow: inset 0 0 0 1px #ffffffbb, 0 1px 0 #B8B4AB, 0 2px 0 #817F78, 0 7px 14px -4px #000a;
  transform: rotate(var(--tilt, 0deg)); transition: transform var(--motion-emphasis) var(--ease-spring), opacity var(--motion-emphasis), box-shadow var(--motion-emphasis);
}
.card.red { color: var(--card-red); }
.card-corner { position: absolute; z-index: 2; left: 7%; top: 5%; display: grid; justify-items: center; gap: 1px; line-height: .95; }
.card-corner b { font-size: 1em; font-weight: 800; letter-spacing: -.07em; }
.card-corner .suit { width: .64em; height: .7em; }
.card-corner.inverted { left: auto; top: auto; right: 7%; bottom: 5%; transform: rotate(180deg); }
.card-pips { position: absolute; inset: 19% 25%; }
.card-pips > span { position: absolute; width: 36%; }
.card-pips .suit { display: block; width: 100%; }
.card-ace { position: absolute; left: 27%; top: 27%; width: 46%; height: 46%; }
.card-court { position: absolute; inset: 17% 22%; }
.card-court > svg { width: 100%; height: 100%; }
.court-rank { position: absolute; left: 50%; top: 55%; transform: translate(-50%,-50%); font-size: .75em; font-family: Georgia, serif; font-weight: bold; }
.card-court .court-suit { position: absolute; width: 30%; bottom: 5%; left: 35%; }
.card.sm { width: 29px; height: 41px; aspect-ratio: auto; border-radius: 4px; font-size: 13px; }
.card.sm .card-corner { left: 13%; top: 8%; }
.card.lg { width: clamp(58px, 16vw, 70px); border-radius: 8px; font-size: clamp(19px, 5.4vw, 23px); }
.card.back { display: grid; place-items: center;
  background: repeating-linear-gradient(45deg, transparent 0 5px, #DCB76D0D 5px 6px), radial-gradient(circle at 50% 38%, #243B56, #091221 72%);
  box-shadow: inset 0 0 0 2px #0E1329, inset 0 0 0 3px rgba(214, 174, 98, .5), 0 6px 14px -5px rgba(0, 0, 0, .65); }
.card.back .brandmark { opacity: .85; }
.card.slot { background: rgba(0, 0, 0, .16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .05); }
.card.dealt { animation: deal var(--motion-emphasis) var(--ease-out) var(--d, 0ms) both; }
@keyframes deal { from { opacity: 0; transform: perspective(600px) translateY(-28px) rotateY(85deg) rotateZ(-9deg) scale(.82); } }
.card.win { transform: translateY(-6px) rotate(var(--tilt, 0deg)); box-shadow: 0 0 0 2px var(--gold), 0 12px 22px -8px rgba(214, 174, 98, .5); }
.card.dim { opacity: .38; }

/* места */
.seat { position: absolute; z-index: 2; width: 96px; transform: translate(-50%, -50%); display: grid; justify-items: center;
  transition: opacity var(--motion-normal), filter var(--motion-normal); }
.stage.enter .seat { animation: seatin var(--motion-emphasis) var(--ease-out) var(--d, 0ms) both; }
@keyframes seatin { from { opacity: 0; transform: translate(-50%, -40%) scale(.9); } }
.seat.acting::before { content: ""; position: absolute; left: 50%; top: 25px; z-index: -1; width: 120px; height: 120px; transform: translate(-50%, -50%);
  border-radius: 50%; background: radial-gradient(circle, rgba(87, 221, 165, .16), transparent 65%); pointer-events: none; }
.seat.folded { opacity: .45; }
.seat.out { opacity: .3; }
.stage.myturn .seat:not(.me):not(.acting) { filter: brightness(.82); }
.stage.showdown .seat:not(.winner) { filter: brightness(.7); }
.avatar-wrap { position: relative; width: 50px; height: 50px; }
.avatar { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; font-size: 16px; font-weight: 800;
  background: linear-gradient(160deg, #2A3542, #18202A); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08), 0 6px 14px -6px rgba(0, 0, 0, .8); }
.avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; }
.seat.me .avatar { background: linear-gradient(160deg, #2C4E45, #162E27); }
.seat.winner .avatar { box-shadow: 0 0 0 2px var(--gold), 0 6px 18px -4px rgba(214, 174, 98, .5); }
.seat.empty .avatar { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .14); color: var(--text-muted); }
.avatar.xl { flex: none; width: 56px; height: 56px; font-size: 18px; background: linear-gradient(160deg, #2C4E45, #162E27); }
.ring { position: absolute; inset: -5px; width: 60px; height: 60px; transform: rotate(-90deg); pointer-events: none; }
.ring circle { fill: none; stroke-width: 3; }
.ring-track { stroke: rgba(255, 255, 255, .08); }
.ring-bar { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset 200ms linear, stroke var(--motion-normal); }
.ring.low .ring-bar { stroke: var(--warning); }
.dealer { position: absolute; z-index: 1; transform: translate(-50%, -50%); display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(135deg, #FFFFFF, var(--card-face) 65%, #E5DFD0); color: var(--card-ink); font-size: 10px; font-weight: 900; box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .12), 0 2px 6px rgba(0, 0, 0, .5);
  transition: left var(--motion-emphasis) var(--ease-out), top var(--motion-emphasis) var(--ease-out); }
.plate { position: relative; z-index: 1; display: grid; justify-items: center; margin-top: -8px; padding: 3px 9px 4px; max-width: 96px;
  border-radius: 10px; background: rgba(7, 9, 12, .84); }
.seat.acting .plate { box-shadow: inset 0 0 0 1px rgba(87, 221, 165, .45); }
.pname { max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; font-weight: 700; }
.pstack { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 800; color: var(--gold-bright); }
.topup-pending { max-width: 90px; font-size: 8px; line-height: 1.1; color: var(--accent); text-align: center; }
.seat-tag { position: absolute; z-index: 2; left: 50%; top: -12px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: var(--r-pill); white-space: nowrap; background: rgba(7, 9, 12, .9);
  font-size: 10.5px; font-weight: 700; color: var(--text-secondary); box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.seat-tag.all_in { color: var(--gold-bright); box-shadow: inset 0 0 0 1px rgba(214, 174, 98, .45); }
.seat-emoji { position: absolute; z-index: 8; top: -43px; left: 62%; padding: 5px 9px; border-radius: 16px;
  background: var(--bg-elevated); font-size: 24px; box-shadow: var(--shadow-1); animation: pop .2s ease-out; }
.emoji-bar { position: fixed; z-index: 31; right: max(12px, var(--sa-r)); top: calc(var(--sa-t) + 56px);
  display: flex; gap: 2px; padding: 5px; border-radius: 16px; background: var(--bg-elevated); box-shadow: var(--shadow-2); }
.emoji-bar button { border: 0; border-radius: 10px; background: transparent; padding: 6px; font-size: 22px; }
.help-rules { display: grid; gap: 10px; margin-bottom: 20px; color: var(--text-secondary); line-height: 1.5; font-size: 13px; }
.help-rules p { margin: 0; }
.seat-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.seat-picker .chip { min-width: 37px; justify-content: center; }
.turn-tip { text-align: center; font-size: 11px; line-height: 1.25; color: var(--text-muted); }
.stage.crowded .seat { width: 72px; }
.stage.crowded .avatar, .stage.crowded .avatar-wrap { width: 36px; height: 36px; font-size: 12px; }
.stage.crowded .ring { width: 46px; height: 46px; }
.stage.crowded .plate { max-width: 72px; padding: 2px 5px; }
.stage.crowded .pname { max-width: 66px; font-size: 10px; }
.stage.crowded .pstack { font-size: 10px; }
.stage.crowded .seat-cards .card { width: 20px; height: 28px; }
.stage.crowded .bet { font-size: 10px; padding: 2px 5px; }
.table-screen { overscroll-behavior: contain; overflow-y: auto; -webkit-overflow-scrolling: touch; touch-action: pan-y; }
.stage { touch-action: pan-y; flex: 1 0 370px; }
.stage.crowded { flex-basis: 450px; }
.seat-cards { position: absolute; z-index: 1; left: calc(50% + 8px); top: -16px; display: flex; }
.seat.right .seat-cards { left: auto; right: calc(50% + 8px); flex-direction: row-reverse; }
.seat.right .seat-cards .card + .card { margin-left: 0; margin-right: -12px; }
.seat-cards .card + .card { margin-left: -12px; }
.coin { flex: none; display: block; }

.bet { position: absolute; z-index: 1; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 4px;
  padding: 3px 9px 3px 5px; border-radius: var(--r-pill); background: rgba(4, 8, 10, .62);
  font-size: 12px; font-weight: 800; color: var(--gold-bright); animation: betin var(--motion-normal) var(--ease-spring); }
@keyframes betin { from { opacity: 0; transform: translate(-50%, -50%) scale(.5); } }
.fly { position: absolute; z-index: 4; transform: translate(-50%, -50%); pointer-events: none; will-change: transform, opacity;
  animation: fly 420ms cubic-bezier(.5, 0, .3, 1) forwards; }
@keyframes fly { to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.7); opacity: .2; } }
.hand-result {
  display: grid; gap: 2px; max-width: 100%; padding: 8px 14px; border-radius: 12px; text-align: center; font-size: 13.5px;
  background: rgba(4, 8, 10, .72); animation: pop var(--motion-emphasis) var(--ease-spring);
}
.hand-result.mine { box-shadow: inset 0 0 0 1px rgba(214, 174, 98, .55); }
.hand-result.mine b { color: var(--gold-bright); }
@keyframes pop { from { opacity: 0; transform: scale(.9); } }

/* док действий */
.dock { flex: none; display: grid; gap: 10px; width: 100%; max-width: 560px; margin: 0 auto; padding: 6px 12px 12px; }
.hole { position: relative; z-index: 3; display: flex; justify-content: center; gap: 8px; margin-top: -52px; }
.turn-line { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--accent); }
.turn-line.low { color: var(--warning); }
.turn-dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .35; } }
.actions { display: grid; grid-template-columns: 1fr 1.25fr 1.25fr; gap: 8px; animation: rise2 var(--motion-fast) var(--ease-out); }
.actions .btn { min-height: 56px; font-size: 16px; padding: 0 10px; }
@keyframes rise2 { from { opacity: 0; transform: translateY(8px); } }
.dock-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dock-row .btn { padding: 0 10px; }
.dock-note { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; font-size: 13.5px; font-weight: 600; color: var(--text-secondary); text-align: center; }

/* рейз */
.raise-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 20px; }
.raise-presets .chip { padding: 0 4px; }
.raise-value { display: flex; align-items: center; justify-content: center; gap: 16px; margin-bottom: 14px; }
.raise-num { display: flex; align-items: center; justify-content: center; gap: 8px; min-width: 150px; font-size: 32px; font-weight: 800; color: var(--gold-bright); }
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; margin: 0; background: transparent; }
.range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent) var(--fill), var(--bg-active) var(--fill)); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%; background: var(--text-primary); box-shadow: 0 2px 8px rgba(0, 0, 0, .5); }
.range::-moz-range-track { height: 6px; border-radius: 3px; background: var(--bg-active); }
.range::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--accent); }
.range::-moz-range-thumb { width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--text-primary); }
.range-legend { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; color: var(--text-muted); }

/* ----------------------------------------------------------- кубики ------ */
.die { flex: none; display: block; transform: rotate(var(--tilt, 0deg)); filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .5)); }
.die.rolling { animation: roll 520ms linear infinite; }
@keyframes roll {
  0% { transform: rotate(0) translateY(0); } 25% { transform: rotate(90deg) translateY(-10px); }
  50% { transform: rotate(180deg) translateY(0); } 75% { transform: rotate(270deg) translateY(-6px); } 100% { transform: rotate(360deg) translateY(0); }
}
.die.settle { animation: settle var(--motion-reveal) var(--ease-spring) both; }
@keyframes settle { from { opacity: 0; transform: rotate(-60deg) scale(.6); } }
.dice-stage { flex: 1; display: grid; place-content: center; justify-items: center; gap: 18px; padding: 0 20px; text-align: center; }
.dice-pair { display: flex; gap: 20px; margin-bottom: 6px; }
.duel { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; }
.duel-side { display: grid; justify-items: center; gap: 10px; padding: 16px 14px 14px; border-radius: var(--r-md); background: var(--bg-surface); opacity: .72; }
.duel-side.win { opacity: 1; box-shadow: inset 0 0 0 1.5px rgba(87, 221, 165, .5); }
.duel-dice { display: flex; gap: 6px; }
.duel-sum { display: grid; justify-items: center; line-height: 1.1; }
.duel-sum span { font-size: 26px; font-weight: 800; }
.duel-sum small { margin-top: 2px; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.duel-side.win .duel-sum span { color: var(--accent); }
.duel-vs { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }

/* ------------------------------------------------------------- итог ------ */
.outcome {
  position: fixed; inset: 0 0 var(--vb) 0; z-index: 30; display: flex; flex-direction: column; overflow: hidden;
  padding: calc(var(--sa-t) + 20px) 20px calc(var(--sa-b) + 20px);
  background: radial-gradient(70% 45% at 50% 34%, rgba(255, 255, 255, .04), transparent 70%), var(--bg-void);
  animation: fade var(--motion-normal) var(--ease-out);
}
.outcome.won { background: radial-gradient(70% 45% at 50% 34%, rgba(214, 174, 98, .16), transparent 70%), var(--bg-void); }
.outcome-body { flex: 1; display: grid; place-content: center; justify-items: center; gap: 10px; text-align: center;
  animation: rise3 var(--motion-reveal) var(--ease-out) both; }
@keyframes rise3 { from { opacity: 0; transform: translateY(14px); } }
.outcome-ico { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 6px; border-radius: 50%; background: var(--bg-surface); color: var(--text-secondary); }
.outcome.won .outcome-ico { color: var(--gold-bright); background: rgba(214, 174, 98, .12); }
.outcome-title { font: 700 24px/1.2 var(--brand); letter-spacing: .01em; }
.outcome-amt { display: flex; align-items: baseline; gap: 8px; font-size: 46px; font-weight: 800; letter-spacing: -.02em; color: var(--text-secondary); }
.outcome.won .outcome-amt { color: var(--gold-bright); }
.outcome-amt small { font-size: 16px; font-weight: 700; color: var(--text-muted); letter-spacing: .02em; }
.outcome-sub { font-size: 14px; color: var(--text-secondary); }
.outcome-actions { display: grid; gap: 10px; width: 100%; max-width: 380px; margin: 0 auto; animation: rise3 var(--motion-reveal) var(--ease-out) 120ms both; }
.wave { position: absolute; left: 50%; top: 34%; width: 180px; height: 180px; margin: -90px 0 0 -90px; border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(214, 174, 98, .6); animation: wave 1.2s var(--ease-out) forwards; pointer-events: none; }
.wave::after { content: ""; position: absolute; inset: 0; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(214, 174, 98, .4); animation: wave 1.2s var(--ease-out) .22s both; }
@keyframes wave { from { transform: scale(.25); opacity: .9; } to { transform: scale(3.2); opacity: 0; } }

/* ----------------------------------------------------------- кошелёк ----- */
.wallet-head { padding: 12px 0 4px; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; margin: 18px 0 20px; }
.metrics.three { grid-template-columns: repeat(3, 1fr); margin: 20px 0 4px; }
.metrics > div { padding: 0 14px; box-shadow: inset 1px 0 0 var(--hairline-strong); }
.metrics > div:first-child { padding-left: 0; box-shadow: none; }
.metrics span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.metrics b { display: block; margin-top: 4px; font-size: 18px; font-weight: 800; }
.metrics b.pos { color: var(--success); }
.tx-ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--bg-elevated); color: var(--text-secondary); }
.tx-ico.in { color: var(--success); background: rgba(73, 210, 139, .1); }
.tx-amt { flex: none; font-size: 15px; font-weight: 800; }
.tx-amount { display: flex; align-items: baseline; gap: 6px; margin: 4px 0 18px; font-size: 34px; font-weight: 800; letter-spacing: -.02em; }
.tx-amount.pos { color: var(--success); }
.tx-amount small { font-size: 14px; color: var(--text-muted); }

/* ----------------------------------------------------------- профиль ----- */
.profile-head { display: flex; align-items: center; gap: 14px; padding: 12px 0 20px; }
.profile-name { font-size: 18px; font-weight: 700; }
.profile-head + .seg { margin-bottom: 4px; }
.ach { display: flex; flex-wrap: wrap; gap: 8px; }
.ach-item { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: var(--r-pill);
  background: var(--bg-surface); font-size: 13px; font-weight: 600; color: var(--text-muted); }
.ach-item .ico { opacity: .5; }
.ach-item.done { color: var(--gold-bright); background: rgba(214, 174, 98, .1); }
.ach-item.done .ico { opacity: 1; }
.rank { flex: none; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--bg-elevated); font-size: 13px; font-weight: 800; color: var(--text-secondary); }
.rank.r1 { background: var(--gold); color: #2A1E07; }
.rank.r2 { background: #B8C0CA; color: #1A2028; }
.rank.r3 { background: #B07A4F; color: #24150A; }
.pill-win { flex: none; font-size: 12px; font-weight: 700; color: var(--success); }
.mini-hand { flex: none; display: flex; gap: 3px; }
.seg + .chip-row, .seg + .list, .seg + .state, .chip-row + .list { margin-top: 16px; }
.log { display: grid; gap: 6px; margin: 0; padding: 12px 14px; list-style: none; max-height: 240px; overflow-y: auto; border-radius: var(--r-sm); background: var(--bg-base); font-size: 13px; }
.win-line { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 14px; }
.win-line .ico { color: var(--gold-bright); }
.win-line .tnum { color: var(--gold-bright); font-weight: 800; }
.hash + .btn { margin-top: 2px; }
.btn + .notice { margin-top: 14px; }

/* ------------------------------------------------------------ старт ------ */
.boot { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 18px; padding: calc(var(--sa-t) + 24px) 24px calc(var(--sa-b) + 24px); }
.boot-mark { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 22px; background: var(--bg-surface); }
.login-form { width: min(360px, 100%); margin-top: 12px; }
.login-form h1 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.login-form p { font-size: 14px; line-height: 1.5; color: var(--text-secondary); margin-bottom: 20px; }
.login-form .btn { margin-top: 16px; }

/* ============================================= v2: объём, космос, управление */

/* плотные кнопки шапки стола — видны на любом фоне */
.icon-btn.solid { background: var(--bg-elevated); color: var(--text-primary); box-shadow: inset 0 0 0 1px var(--hairline); }
.icon-btn.solid:active { background: var(--bg-active); }
.btn.pill { border-radius: var(--r-pill); }
.btn-gold { background: linear-gradient(180deg, var(--gold-bright), var(--gold)); color: #2A1E07; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .4); }
.btn-gold:active { filter: brightness(.94); }
.table-head .btn.sm { min-height: 40px; }

/* шторка на весь экран */
.sheet.full {
  top: 0; bottom: var(--vb); max-height: none; max-width: none; border-radius: 0;
  padding: var(--sa-t) var(--sa-r) calc(16px + var(--sa-b) + var(--kb, 0px)) var(--sa-l); background: var(--bg-base);
  animation: pagein-x var(--motion-normal) var(--ease-out);
}
.sheet.full .sheet-head { align-items: center; padding: 8px 12px 4px; max-width: 560px; width: 100%; margin: 0 auto; }
.sheet.full .sheet-head h2 { padding-top: 0; }
.sheet.full .sheet-body, .sheet.full .sheet-foot { max-width: 560px; width: 100%; margin: 0 auto; }
.sheet.full .sheet-body { padding-top: 16px; }
.sheet.full .summary, .sheet.full .amount-box, .sheet.full .code-box { background: var(--bg-surface); }
.sheet.full .seg { background: var(--bg-surface); }
@keyframes pagein-x { from { opacity: 0; transform: translateX(24px); } }

/* иллюстрации: появление по частям */
.art { display: block; overflow: visible; }
.art-in { animation: artin var(--motion-reveal) var(--ease-spring) var(--d, 0ms) both; transform-box: fill-box; }
.card-in { animation-name: cardin; transform-origin: 50% 100%; }
.chip-in { animation-name: chipin; animation-timing-function: cubic-bezier(.3, 1.5, .5, 1); }
.die-in { animation-name: diein; animation-duration: 760ms; }
@keyframes artin { from { opacity: 0; } }
@keyframes cardin { from { opacity: 0; transform: translateY(24px) rotate(calc(var(--r) * -1)) scale(.8); } }
@keyframes chipin { from { opacity: 0; transform: translateY(-40px); } 70% { opacity: 1; } }
@keyframes diein { 0% { opacity: 0; transform: translateY(-46px) rotate(var(--spin)); } 60% { opacity: 1; transform: translateY(4px) rotate(0); } 80% { transform: translateY(-4px); } }
.planet .moon { transform-origin: 60px 60px; animation: orbit 16s linear infinite; }
@keyframes orbit { to { transform: rotate(360deg); } }
.sparkles { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.spark { opacity: 0; transform-box: fill-box; transform-origin: center; animation: twinkle 3.2s ease-in-out var(--d) infinite; }
@keyframes twinkle { 0%, 100% { opacity: 0; } 40% { opacity: .9; } 60% { opacity: .3; } }

.hero { position: relative; }
.art-scene, .art-dice-scene { position: relative; width: 150px; height: 118px; }
.art-scene .planet.bg, .art-dice-scene .planet.bg { position: absolute; right: -14px; top: -18px; opacity: .8; }
.art-scene .art:not(.planet), .art-dice-scene .art:not(.planet) { position: absolute; left: 0; bottom: 0; }
.art-chips { position: absolute; right: -6px; bottom: -6px; }
.wallet-head { position: relative; }
.wallet-art { position: absolute; right: -4px; top: 0; pointer-events: none; }
.outcome-art { position: relative; margin-bottom: 4px; }

/* космос за игровыми сценами кубиков */
.space-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.space-bg .planet.far { position: absolute; right: -96px; top: 2%; opacity: .4; }
.space-bg .sparkles { transform: scale(.9); }
.spark { transform-box: fill-box; }
.dice-screen { background:
  radial-gradient(60% 40% at 30% 30%, rgba(129, 120, 184, .16), transparent 70%),
  radial-gradient(70% 45% at 70% 80%, rgba(87, 221, 165, .08), transparent 70%), var(--bg-void); }
.dice-screen > .table-head, .dice-screen > .dice-stage, .dice-screen > .dock,
.dice-screen > .duel-lane, .dice-screen > .scoreboard { position: relative; }
.float-dice { display: flex; gap: 34px; padding: 18px 0 30px; }
.pot.big { font-size: 17px; padding: 8px 18px; }
.hint.centered { text-align: center; margin-top: 4px; }
.live-dot { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--accent); }
.live-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: blink 1.4s infinite; }

/* 3D-кубик */
.die3d { position: relative; width: var(--s); height: var(--s); perspective: 700px; flex: none; }
.die3d-hop { position: absolute; inset: 0; transform-style: preserve-3d; }
.cube { position: absolute; inset: 0; transform-style: preserve-3d;
  transition: transform var(--dur) cubic-bezier(.12, .78, .16, 1); }
.face {
  position: absolute; inset: 0; display: grid; grid-template: repeat(3, 1fr) / repeat(3, 1fr); padding: 15%;
  border-radius: 20%; background: radial-gradient(circle at 30% 25%, #FFFFFF, #EFE9DC 62%, #D9D1C0);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08), inset -3px -5px 10px rgba(0, 0, 0, .13), inset 2px 3px 6px rgba(255, 255, 255, .8);
  backface-visibility: hidden;
}
.face i { place-self: center; width: 72%; aspect-ratio: 1; border-radius: 50%; }
.face i.on { background: radial-gradient(circle at 38% 34%, #454B55, #0E1115 70%); box-shadow: inset 0 1px 1px rgba(0, 0, 0, .6), 0 1px 0 rgba(255, 255, 255, .6); }
.die3d-shadow { position: absolute; left: 12%; right: 12%; bottom: -16%; height: 16%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .55), transparent); }
.die3d.rolling .die3d-hop { animation: hop var(--dur) cubic-bezier(.3, .7, .4, 1) both; }
.die3d.rolling .die3d-shadow { animation: hopshadow var(--dur) cubic-bezier(.3, .7, .4, 1) both; }
.die3d.landed .die3d-hop { animation: land 320ms var(--ease-spring); }
.die3d.float .cube { animation: floaty 9s ease-in-out infinite; transition: none; }
.die3d.float:nth-child(2) .cube { animation-delay: -4s; animation-direction: reverse; }
@keyframes hop { 0% { transform: translateY(0); } 18% { transform: translateY(-46%); } 42% { transform: translateY(0); }
  56% { transform: translateY(-26%); } 70% { transform: translateY(0); } 82% { transform: translateY(-7%); } 100% { transform: translateY(0); } }
@keyframes hopshadow { 18% { transform: scale(.55); opacity: .4; } 42% { transform: none; opacity: 1; } 56% { transform: scale(.8); } 70% { transform: none; } }
@keyframes land { 40% { transform: scale(1.08, .92); } }
@keyframes floaty { 0% { transform: rotateX(-24deg) rotateY(32deg) translateY(0); } 50% { transform: rotateX(-34deg) rotateY(212deg) translateY(-8px); }
  100% { transform: rotateX(-24deg) rotateY(392deg) translateY(0); } }

/* матч в кубики */
.match { justify-content: space-between; }
.duel-lane { display: grid; justify-items: center; gap: 14px; padding: 8px 16px; transition: opacity var(--motion-normal); }
.duel-lane.lost .lane-dice, .duel-lane.lost .lane-head { filter: brightness(.55) saturate(.6); transition: filter var(--motion-normal); }
.lane-head { display: flex; align-items: center; gap: 12px; font-size: 15px; }
.lane-dice { display: flex; gap: 30px; padding: 24px 0 18px; }
.lane-sum { min-width: 64px; padding: 4px 14px; border-radius: var(--r-pill); background: var(--bg-surface); text-align: center;
  font-size: 22px; font-weight: 800; color: var(--text-muted); transition: color var(--motion-fast), transform var(--motion-emphasis) var(--ease-spring); }
.lane-sum.on { color: var(--text-primary); }
.duel-lane.won .lane-sum { color: var(--on-accent); background: var(--accent); transform: scale(1.12); }
.round-dots { display: flex; gap: 5px; }
.round-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--bg-active); transition: background var(--motion-normal), transform var(--motion-normal) var(--ease-spring); }
.round-dots i.win { background: var(--accent); transform: scale(1.15); }
.round-dots i.lose { background: rgba(224, 108, 120, .55); }
.round-dots i.draw { background: var(--text-muted); }
.scoreboard { position: relative; display: flex; align-items: center; justify-content: center; gap: 14px;
  font-size: 44px; font-weight: 800; letter-spacing: -.02em; }
.scoreboard i { font-style: normal; color: var(--text-muted); font-size: 32px; }
.decider { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); white-space: nowrap; font-style: normal; font-size: 12px;
  font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-bright); animation: blink 1s ease-in-out infinite; }
.final-score { display: flex; align-items: center; gap: 12px; margin-top: 8px; font-size: 40px; font-weight: 800; color: var(--text-secondary); }
.final-score .win { color: var(--accent); }
.final-score i { font-style: normal; color: var(--text-muted); font-size: 28px; }
.round-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 4px; }
.round-list span { padding: 4px 10px; border-radius: var(--r-pill); background: var(--bg-surface); font-size: 13px; font-weight: 700; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.round-list span.me { color: var(--accent); box-shadow: inset 0 0 0 1px rgba(87, 221, 165, .4); }
.round-list i { font-style: normal; opacity: .5; margin: 0 2px; }

/* приглашение */
.invite-row, .invite-direct { width: 100%; display: grid; gap: 12px; padding: 14px; border-radius: 14px; background: var(--bg-base); margin-bottom: 10px; }
.invite-row { display: flex; align-items: center; gap: 12px; text-align: left; transition: background var(--motion-fast); }
.invite-row:active { background: var(--bg-active); }
.invite-row b, .invite-head b { display: block; font-size: 15px; }
.invite-row small, .invite-head small { display: block; margin-top: 2px; font-size: 13px; color: var(--text-secondary); }
.invite-head { display: flex; align-items: center; gap: 12px; }
.invite-ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; }
.invite-ico.chat { background: rgba(87, 221, 165, .12); color: var(--accent); }
.invite-ico.user { background: rgba(129, 120, 184, .16); color: #B9B2EA; }
.invite-direct .code-box { background: var(--bg-surface); padding-right: 6px; }
.code-input.plain { letter-spacing: 0; text-transform: none; font-size: 16px; font-weight: 700; height: 52px; }
.invite-share { margin-top: 6px; }

/* стол: метка на сукне, раздача из центра, баннеры, заставка */
.deal-in { display: inline-block; animation: dealseat 460ms cubic-bezier(.2, .8, .2, 1) var(--dd, 0ms) both; }
.seat-cards .deal-in + .deal-in { margin-left: -12px; }
.seat.right .seat-cards .deal-in + .deal-in { margin-left: 0; margin-right: -12px; }
.seat.right .seat-cards .card + .card, .seat-cards .card + .card { margin: 0; }
@keyframes dealseat { from { opacity: 0; transform: translate(var(--fx), var(--fy)) rotate(-90deg) scale(.6); } 30% { opacity: 1; } }
.flash { position: absolute; z-index: 5; left: 50%; top: 6%; transform: translateX(-50%); padding: 7px 14px; border-radius: var(--r-pill);
  background: rgba(11, 15, 19, .9); box-shadow: inset 0 0 0 1px var(--hairline-strong); font-size: 13px; font-weight: 700; white-space: nowrap;
  animation: flash 1.6s var(--ease-out) both; pointer-events: none; }
@keyframes flash { 0% { opacity: 0; transform: translate(-50%, -8px); } 15%, 80% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; } }
.intro { position: absolute; z-index: 6; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center;
  background: radial-gradient(60% 45% at 50% 50%, rgba(7, 9, 12, .94), rgba(7, 9, 12, .55) 70%, rgba(7, 9, 12, 0)); pointer-events: none;
  animation: introfade 2.2s var(--ease-out) both; }
.intro b { font: 700 20px/1.2 var(--brand); letter-spacing: .02em; }
.intro span.tnum { font-size: 13px; color: var(--text-secondary); }
/* пока идёт заставка, центр стола скрыт — текст не наслаивается */
.stage.intro .center { opacity: 0; transition: opacity var(--motion-emphasis); }
@keyframes introfade { 0% { opacity: 0; } 12%, 78% { opacity: 1; } 100% { opacity: 0; } }
.shuffle { position: relative; width: 120px; height: 70px; margin-bottom: 6px; }
.sh { position: absolute; left: 50%; top: 0; width: 46px; height: 64px; margin-left: -23px; border-radius: 6px; display: grid; place-items: center;
  background: repeating-linear-gradient(45deg, transparent 0 5px, #DCB76D0D 5px 6px), radial-gradient(circle at 50% 38%, #243B56, #091221 72%);
  box-shadow: inset 0 0 0 2px #0E1329, inset 0 0 0 3px rgba(214, 174, 98, .5), 0 8px 16px -6px rgba(0, 0, 0, .7);
  animation: riffle 1.1s cubic-bezier(.4, 0, .2, 1) calc(var(--k) * 90ms) 2 alternate both; }
@keyframes riffle { 0% { transform: translateX(0) rotate(0); } 50% { transform: translateX(calc((var(--k) - 1.5) * 26px)) rotate(calc((var(--k) - 1.5) * 9deg)); }
  100% { transform: translateX(0) rotate(0) translateY(calc(var(--k) * -2px)); } }

/* предходы — не мой ход */
.pre { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pre-btn { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; border-radius: var(--r-sm);
  background: var(--bg-surface); color: var(--text-secondary); font-weight: 700; font-size: 14px;
  transition: background var(--motion-fast), color var(--motion-fast), box-shadow var(--motion-fast); }
.pre-btn i { width: 18px; height: 18px; border-radius: 5px; box-shadow: inset 0 0 0 1.5px var(--text-muted); transition: background var(--motion-fast), box-shadow var(--motion-fast); }
.pre-btn.on { color: var(--text-primary); background: var(--bg-active); box-shadow: inset 0 0 0 1.5px rgba(87, 221, 165, .6); }
.pre-btn.on i { background: var(--accent); box-shadow: none; }
.turn-call { margin-left: 6px; padding: 2px 8px; border-radius: var(--r-pill); background: rgba(214, 174, 98, .12); color: var(--gold-bright); font-size: 12.5px; }
.actions .btn .ico { margin-right: -2px; }

/* панель рейза в доке: пресеты, колесо, ползунок */
.raise-panel { display: grid; gap: 12px; padding: 12px; border-radius: 18px; background: var(--bg-surface);
  box-shadow: inset 0 0 0 1px var(--hairline); animation: rise2 var(--motion-normal) var(--ease-spring); }
.raise-panel .raise-presets { margin: 0; }
.raise-dial { display: flex; align-items: center; gap: 10px; }
.scrub {
  position: relative; flex: 1; min-width: 0; height: 60px; border-radius: 14px; overflow: hidden; touch-action: none; cursor: ew-resize;
  display: grid; place-items: center; background: var(--bg-base); box-shadow: inset 0 0 0 1px var(--hairline-strong);
}
.scrub:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.scrub-tape { position: absolute; left: -90px; right: -90px; bottom: 0; height: 18px; transform: translateX(var(--off));
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .28) 0 1.5px, transparent 1.5px 9px),
              repeating-linear-gradient(90deg, rgba(214, 174, 98, .7) 0 2px, transparent 2px 45px);
  -webkit-mask: linear-gradient(0deg, #000, transparent); mask: linear-gradient(0deg, #000, transparent); }
.scrub-val { position: relative; display: flex; align-items: center; gap: 8px; margin-top: -10px; font-size: 26px; font-weight: 800; color: var(--gold-bright); }
.scrub-edge { position: absolute; top: 0; bottom: 0; width: 40px; pointer-events: none; }
.scrub-edge.l { left: 0; background: linear-gradient(90deg, var(--bg-base), transparent); }
.scrub-edge.r { right: 0; background: linear-gradient(-90deg, var(--bg-base), transparent); }
.scrub::after { content: ""; position: absolute; left: 50%; bottom: 0; width: 2px; height: 22px; margin-left: -1px; border-radius: 2px; background: var(--accent); }

html.lite .art-in, html.lite .deal-in, html.lite .intro, html.lite .sh, html.lite .spark, html.lite .planet .moon { animation: none; }
html.lite .spark { opacity: .5; }
html.lite .die3d.float .cube { animation: none; transform: rotateX(-24deg) rotateY(32deg); }

/* ============================================== дурак: тот же язык, что покер */
.link-btn { display: inline; padding: 0; color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.seg.fixed button { pointer-events: none; text-align: center; }
.durak-screen .turn-line:not(.mine) { color: var(--text-secondary); }
.durak-screen { background: radial-gradient(90% 55% at 50% 42%, rgba(88, 222, 170, .07), transparent 70%), var(--bg-void); }

.dk-opps { flex: none; display: flex; justify-content: center; gap: 14px; padding: 16px 12px 4px; }
.dk-opp { position: relative; display: grid; justify-items: center; width: 92px; transition: opacity var(--motion-normal), filter var(--motion-normal); }
.dk-opp.out { opacity: .45; }
.dk-opp.acting::before { content: ""; position: absolute; left: 50%; top: 44px; z-index: -1; width: 120px; height: 120px; transform: translate(-50%, -50%);
  border-radius: 50%; background: radial-gradient(circle, rgba(87, 221, 165, .16), transparent 65%); }
.dk-opp.acting .plate { box-shadow: inset 0 0 0 1px rgba(87, 221, 165, .45); }
.dk-opp .seat-tag { top: auto; bottom: -22px; }
.seat-tag.dk-def { color: var(--warning); box-shadow: inset 0 0 0 1px rgba(216, 170, 89, .4); }
.dk-backs { position: relative; height: 30px; width: 74px; margin-bottom: 2px; }
.dk-backs i { position: absolute; left: 50%; bottom: 0; width: 20px; height: 28px; border-radius: 3px;
  background: repeating-linear-gradient(45deg, transparent 0 5px, #DCB76D0D 5px 6px), radial-gradient(circle at 50% 38%, #243B56, #091221 72%); box-shadow: inset 0 0 0 1px rgba(214, 174, 98, .5), 0 3px 6px rgba(0, 0, 0, .5);
  transform-origin: 50% 120%; transform: translateX(-50%) rotate(calc((var(--i) - (var(--n) - 1) / 2) * 9deg));
  transition: transform var(--motion-emphasis) var(--ease-spring); }

.dk-stage { flex: 1 0 auto; min-height: 272px; display: flex; align-items: center; width: 100%; max-width: 680px; margin: 0 auto; padding: 30px 18px 18px; }
.dk-felt {
  position: relative; flex: 1; min-width: 0; min-height: 228px; border-radius: 28px;
  display: grid; grid-template-columns: 62px minmax(0, 1fr); align-items: center; gap: 12px; padding: 24px 12px;
  background: radial-gradient(75% 60% at 55% 40%, #17463F, var(--felt) 58%, var(--felt-deep));
  box-shadow: 0 0 0 10px #151c23, 0 0 0 11px rgba(220, 183, 109, .4), 0 30px 50px -24px rgba(0, 0, 0, .9), inset 0 10px 34px rgba(0, 0, 0, .5);
}
.dk-deck { display: grid; justify-items: center; gap: 8px; }
.dk-deck-cards { position: relative; width: 62px; height: 72px; }
.dk-trump-card { position: absolute; left: 16px; top: 12px; transform: rotate(90deg); transform-origin: 50% 50%; }
.dk-trump-card .card, .dk-stock .card { width: 40px; }
.dk-stock { position: absolute; left: 0; top: 0; }
.dk-stock::after { content: ""; position: absolute; inset: 0; border-radius: 6px; transform: translate(3px, 3px); z-index: -1;
  background: #131A36; box-shadow: inset 0 0 0 1px rgba(214, 174, 98, .35); }
.dk-trump-only { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: rgba(0, 0, 0, .3); color: var(--text-primary); }
.dk-trump-only .suit { width: 22px; }
.dk-deck-label { text-align: center; font-size: 11px; font-weight: 600; line-height: 1.4; color: rgba(240, 243, 245, .7); }
.dk-deck-label b { color: var(--text-primary); }
.dk-suit { display: inline-flex; align-items: center; gap: 3px; }
.dk-suit .suit { width: 11px; }
.dk-suit.red { color: #F08E9A; }
.dk-board { display: grid; grid-template-columns: repeat(auto-fit, 58px); align-content: center; justify-content: center; gap: 12px 4px; min-width: 0; min-height: 160px; }
.dk-empty { grid-column: 1 / -1; }
.dk-empty { font-size: 13px; font-weight: 600; color: rgba(240, 243, 245, .5); text-align: center; }
.dk-pair { position: relative; width: 58px; height: 92px; padding: 0; border-radius: 8px; transition: transform var(--motion-fast); }
.dk-pair .card.md { width: 50px; }
.dk-att { position: absolute; left: 0; top: 0; }
.dk-defc { position: absolute; left: 12px; top: 16px; transform: rotate(10deg); }
.dk-pair.open .dk-att .card { box-shadow: 0 0 0 2px rgba(216, 170, 89, .7), 0 6px 14px -5px rgba(0, 0, 0, .65); }
.dk-pair.target { transform: translateY(-4px); }
.dk-pair.target .dk-att .card { box-shadow: 0 0 0 2.5px var(--accent), 0 10px 20px -6px rgba(87, 221, 165, .5); }
.dk-limit { position: absolute; right: 16px; bottom: 8px; padding: 2px 9px; border-radius: var(--r-pill); background: rgba(0, 0, 0, .35);
  font-size: 11px; font-weight: 700; color: rgba(240, 243, 245, .7); }

.dk-hand { display: grid; grid-template-columns: repeat(auto-fit, minmax(46px, 1fr)); align-content: start; justify-items: center; gap: 10px 6px; max-height: clamp(120px, 27dvh, 250px); min-height: 90px; overflow-y: auto; overscroll-behavior: contain; padding: 14px 4px 12px; scrollbar-width: thin; scrollbar-color: var(--gold-deep) transparent; }
.dk-card { position: relative; width: 100%; max-width: 64px; padding: 0; touch-action: none; transform: translateY(3px); filter: brightness(.8) saturate(.75); transition: transform var(--motion-fast) var(--ease-out), filter var(--motion-fast); }
.dk-card .card.lg { width: 100%; font-size: clamp(17px, 4.7vw, 21px); }
.dk-hand:not(.live) .dk-card { filter: none; transform: none; }
.dk-card.legal { filter: none; transform: translateY(0); }
.dk-card.legal:active, .dk-card.selected { transform: translateY(-8px) rotateX(6deg); }
.dk-card.selected .card { box-shadow: 0 0 0 2.5px var(--accent), 0 12px 22px -8px rgba(87, 221, 165, .55); }
.dk-card.trump .card::after { content: ""; position: absolute; right: 5px; top: 5px; width: 6px; height: 6px; transform: rotate(45deg); background: #AD7A24; box-shadow: 0 0 0 1px #F0CE82; }
.dk-card.dragging { opacity: .3; }
.dk-card[disabled] { cursor: default; }
.dk-drag { position: fixed; z-index: 70; transform: translate(-50%, -60%) rotate(-6deg); pointer-events: none; filter: drop-shadow(0 16px 20px rgba(0, 0, 0, .6)); }

.dk-wait { flex: 1; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 0 20px; text-align: center; position: relative; }
.dk-wait-fan { margin-bottom: -6px; }
.dk-seats { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }
.dk-seat { display: grid; justify-items: center; gap: 6px; width: 72px; font-size: 12px; font-weight: 700; animation: seatin var(--motion-emphasis) var(--ease-out) both; }
.dk-seat span { max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-seat.empty .avatar { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, .16); color: var(--text-muted); }
.dk-seat.empty span { color: var(--text-muted); }

.dk-places { display: grid; gap: 8px; width: min(340px, 86vw); margin: 16px 0 0; padding: 0; list-style: none; }
.dk-places li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: var(--bg-surface); text-align: left; }
.dk-places li.me { box-shadow: inset 0 0 0 1.5px rgba(87, 221, 165, .5); }
.dk-places .avatar { width: 34px; height: 34px; font-size: 13px; }
.dk-places b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.dk-places em { font-style: normal; font-size: 11px; font-weight: 800; color: var(--danger-text); }
.dk-places .tnum { font-weight: 800; color: var(--gold-bright); }
.dk-place { width: 20px; font-weight: 800; color: var(--text-secondary); text-align: center; }

@media (max-width: 360px) {
  .dk-opp { width: 80px; }
  .dk-felt { padding: 16px 12px; }
}

/* ------------------------------------------------------- адаптивность ---- */
@media (max-width: 360px) {
  .screen { padding-left: 12px; padding-right: 12px; }
  .chip-row { margin: 0 -12px; padding: 0 12px 2px; }
  .hero-bal { font-size: 32px; }
  .art-table { width: 92px; }
  .stake { font-size: 15px; min-height: 48px; }
  .seat { width: 84px; }
  .actions .btn { font-size: 15px; }
  .tab { font-size: 12px; gap: 5px; }
}
@media (max-width: 430px) {
  .table-head { flex-wrap: wrap; gap: 2px; padding-left: 4px; padding-right: 4px; }
  .table-head .icon-btn { width: 40px; height: 40px; }
  .table-head .table-info { flex: 1 1 90px; }
  .table-head .table-head-tools { margin-left: auto; }
  .table-head .table-head-actions { order: 3; width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; padding: 2px 42px 0; }
  .table-head-actions:empty { display: none; }
  .table-head-actions .btn { width: 100%; min-height: 40px; padding-left: 8px; padding-right: 8px; font-size: 13px; }
}
@media (max-height: 700px) {
  .card.lg { width: 54px; }
  .hole { margin-top: -40px; }
  .avatar, .avatar-wrap { width: 44px; height: 44px; }
  .ring { width: 54px; height: 54px; }
  .actions .btn { min-height: 52px; }
}
@media (min-width: 768px) {
  .app { max-width: 640px; }
  .felt-wrap { left: 10%; right: 10%; top: 13%; bottom: 15%; }
  .card { width: 54px; font-size: 18px; }
  .card.lg { width: 74px; font-size: 24px; }
  .seat { width: 110px; }
  .pname { max-width: 96px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .table-screen { overflow-y: auto; }
  .table-head { padding-top: 2px; padding-bottom: 2px; }
  .stage { min-height: 300px; }
  .felt-wrap { top: 5%; bottom: 10%; }
  .dock { gap: 5px; padding-top: 2px; padding-bottom: 2px; }
  .actions .btn { min-height: 42px; }
  .turn-tip { display: none; }
  .hole { margin-top: -24px; }
}

/* Space Games: table materials and compact mobile controls. */
.btn-primary { background: linear-gradient(170deg, #6AEFD3, var(--accent) 60%, var(--accent-strong)); box-shadow: inset 0 1px 0 #FFFFFF65, 0 5px 18px -12px #3AE6C299; }
.hero { position: relative; isolation: isolate; border-radius: 22px; padding: 20px 16px; background: radial-gradient(ellipse at 100% 10%, #21436370, transparent 65%), linear-gradient(135deg, #15273B, #0D1927); box-shadow: inset 0 1px 0 #FFFFFF0F; }
.hero-text { min-width: 0; }
.hero-bal { font-size: clamp(25px, 7.8vw, 38px); flex-wrap: wrap; overflow-wrap: anywhere; }
.hero-art { width: clamp(90px, 29vw, 132px); }
.hero-art .art-scene { max-width: 100%; }
.block-head { flex-wrap: wrap; row-gap: 3px; }
.btn { min-width: 0; white-space: normal; text-align: center; line-height: 1.25; padding-top: 10px; padding-bottom: 10px; }
.icon-btn, .chip, .info-trigger, .hand-sort { touch-action: manipulation; }
.info-trigger { width: 40px; height: 40px; }
.seg button:disabled { opacity: .42; cursor: not-allowed; }
.sheet { border: 1px solid #FFFFFF14; border-bottom: 0; }
.sheet-head { align-items: center; }
.sheet-head h2 { padding-top: 0; }
.sheet-foot { background: var(--bg-surface); box-shadow: 0 -12px 18px -14px #000; }
.sheet-body { scroll-padding: 20px; }
.sheet .summary dd { overflow-wrap: anywhere; }
.create-game-heading { display: flex; align-items: center; gap: 12px; padding: 4px 0 20px; margin-bottom: 14px; border-bottom: 1px solid var(--hairline-strong); color: var(--gold-bright); }
.create-game-heading > .ico { width: 46px; height: 46px; padding: 11px; border-radius: 14px; background: #DCB76D12; }
.create-game-heading b { display: block; font: 700 11px/1.5 var(--brand); letter-spacing: .06em; }
.create-game-heading small { display: block; margin-top: 4px; color: var(--text-secondary); font-size: 12px; }
.invite-banner { display: block; width: 100%; height: auto; border-radius: 14px; margin-bottom: 16px; background: #07111F; }
.invite-row:disabled { opacity: .85; cursor: default; }
.invite-timer { position: relative; flex: none; width: 48px; height: 48px; display: grid; place-items: center; color: var(--gold-bright); }
.invite-timer svg { position: absolute; inset: 0; width: 100%; transform: rotate(-90deg); fill: none; stroke-width: 2.5; }
.timer-track { stroke: #DCB76D22; }
.timer-progress { stroke: currentColor; stroke-linecap: round; transition: stroke-dashoffset 250ms linear; }
.invite-timer b { font-size: 13px; }
.invite-wait { display: flex; align-items: center; gap: 12px; margin: -6px 0 16px; font-size: 12px; color: var(--text-secondary); }
.space-loader { width: 88px; height: 88px; color: var(--gold); }
.loader-orbit { transform-origin: 48px 48px; animation: spin 2s linear infinite; }
.table-head { background: linear-gradient(180deg, #070D18EE, #070D1800); }
.felt::after { content: 'SPACE'; position: absolute; top: 28%; left: 50%; transform: translateX(-50%); font: 700 clamp(12px, 3.5vw, 24px)/1 var(--brand); letter-spacing: .3em; color: #DCF5E916; }
.rail::after { content: ''; position: absolute; inset: 5px; border-radius: inherit; border: 1px solid #DCB76D40; pointer-events: none; }
.card { transform-style: preserve-3d; user-select: none; }
.card.back::before { content: ''; position: absolute; inset: 12%; border: 1px solid #DCB76D55; border-radius: 35% 5%; pointer-events: none; }
.stage.crowded .seat { width: 62px; }
.stage.crowded .plate { max-width: 62px; }
.stage.crowded .pname { max-width: 56px; }
.stage.crowded .board .card { width: clamp(29px, 8.5vw, 46px); font-size: clamp(12px, 3.4vw, 16px); }
.stage.crowded .board { gap: 4px; }
.stage.crowded .hand-result { max-width: 66%; max-height: 86px; overflow-y: auto; font-size: 11px; }
.dock { position: relative; padding-bottom: 16px; background: linear-gradient(180deg, #070D1800, #070D18 28%); }
.hand-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 0 4px; color: var(--text-secondary); font-size: 12px; }
.hand-sort { min-height: 36px; padding: 0 12px; border-radius: 10px; color: var(--gold-bright); background: var(--bg-surface); font-size: 12px; }
.dk-hand { perspective: 800px; }
.dk-hand .dock-note { grid-column: 1 / -1; }
.dk-suit { padding: 4px 7px; border-radius: 8px; background: #060D18AA; color: #F8F5EC; }
.dk-suit .suit { width: 16px; }
.dk-card.legal .card { box-shadow: 0 1px 0 #BBB7AD, 0 2px 0 #817F78, 0 0 0 1px #3AE6C280, 0 7px 14px -4px #000A; }
.face { background: radial-gradient(circle at 25% 15%, #3C5265, #172633 55%, #08101B); border: 1px solid #D6B77680; box-shadow: inset 0 1px 3px #FFFFFF60, inset -3px -5px 12px #0009, inset 0 0 0 3px #080F1890; }
.face i.on { background: radial-gradient(circle at 35% 28%, #FFF3CC, #DCB76D 45%, #8A602C); box-shadow: inset 0 1px 3px #0009, 0 1px 0 #FFF3CC80; }
.dice-screen.match .lane-dice { perspective: 900px; }
@media (max-width: 360px) {
  .hero { padding: 16px 12px; gap: 4px; }
  .wordmark { font-size: 10px; letter-spacing: .09em; }
  .brand { gap: 5px; }
  .bal-widget { padding-right: 6px; padding-left: 6px; }
  .sheet-body { padding-left: 14px; padding-right: 14px; }
  .sheet-foot { padding-left: 14px; padding-right: 14px; }
  .actions { gap: 5px; }
  .actions .btn { padding-left: 6px; padding-right: 6px; font-size: 13px; }
  .dk-felt { padding: 22px 9px; grid-template-columns: 52px minmax(0, 1fr); gap: 6px; }
  .dk-board { grid-template-columns: repeat(auto-fit, 54px); }
}
@media (orientation: landscape) and (max-height: 600px) and (min-width: 600px) {
  .table-screen:not(.dice-screen):not(.durak-screen) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(230px, 31%); grid-template-rows: auto minmax(300px, 1fr); align-content: start; }
  .table-screen:not(.dice-screen):not(.durak-screen) > .table-head { grid-column: 1 / -1; }
  .table-screen:not(.dice-screen):not(.durak-screen) > .stage { min-height: 310px; height: 100%; }
  .table-screen:not(.dice-screen):not(.durak-screen) > .dock { align-self: center; padding: 10px; }
  .table-screen:not(.dice-screen):not(.durak-screen) .hole { margin-top: 0; margin-bottom: 8px; }
  .table-screen:not(.dice-screen):not(.durak-screen) .actions { grid-template-columns: 1fr; }
  .durak-screen .dk-stage { min-height: 240px; }
}

/* ------------------------------------------- доступность и слабые устройства */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .spinner { animation-duration: 1.2s !important; animation-iteration-count: infinite !important; }
}
html.lite .tabbar, html.lite .toast, html.lite .sheet-back { -webkit-backdrop-filter: none; backdrop-filter: none; }
html.lite .tabbar { background: rgba(17, 23, 29, .98); }
html.lite .toast { background: rgba(23, 31, 39, .99); }
html.lite .stage.enter .seat, html.lite .stage.enter .felt-wrap, html.lite .page, html.lite .wave { animation: none; }
html.lite .felt-wrap { transform: none; }

/* Подкидной дурак */
.durak-rules article {display:flex; gap:12px; padding:12px 0; border-bottom:1px solid var(--border, #ffffff20)}.durak-rules article>span {display:grid; place-items:center; flex:0 0 24px; height:24px; border-radius:50%; background:var(--bg-active); color:var(--accent); font-weight:800}.durak-rules b {display:block}.durak-rules p {font-size:13px; line-height:1.5; margin:4px 0 0; color:var(--text-secondary)}
