/* ================== Сундучки: мультяшный стиль ================== */
:root {
  --ink: #2d1b0e;
  --font: 'Rubik', 'Arial Rounded MT Bold', 'Trebuchet MS', system-ui, sans-serif;
  --cw: 78px;          /* ширина карты в руке (меняется из JS) */
  --red: #e5303f;
  --black: #1f2433;
  --panel: #fffdf6;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #2f9e55;
  user-select: none; -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button { font-family: inherit; }
input { font-family: inherit; user-select: text; -webkit-user-select: text; }

#app, .screen { position: fixed; inset: 0; }

/* ---------- фоны меню ---------- */
.menu-screen { overflow-y: auto; overflow-x: hidden; }
.menu-bg {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 20% 15%, rgba(255,255,255,.25) 0 60px, transparent 61px),
    radial-gradient(circle at 85% 25%, rgba(255,255,255,.18) 0 90px, transparent 91px),
    radial-gradient(circle at 70% 90%, rgba(255,255,255,.15) 0 120px, transparent 121px),
    radial-gradient(circle at 50% 120%, #ffd36e 0, transparent 55%),
    linear-gradient(180deg, #36b4ff 0%, #6a7bff 55%, #9d5cff 100%);
}
.menu-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.22) 2px, transparent 2.5px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, #000, transparent 70%);
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 70%);
}

.home-wrap, .lobby-wrap {
  min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px 14px 30px; gap: 16px;
}

/* ---------- логотип ---------- */
.logo { text-align: center; position: relative; }
.logo-chest { width: 110px; height: 100px; display: block; margin: 0 auto -18px; animation: bob 2.6s ease-in-out infinite; filter: drop-shadow(0 6px 0 rgba(0,0,0,.15)); }
.title {
  margin: 0; font-weight: 900; font-size: clamp(48px, 12vw, 84px); line-height: 1; letter-spacing: 1px;
  color: #ffde3b;
  -webkit-text-stroke: 3px #7a2e00;
  paint-order: stroke fill;
  text-shadow: 0 5px 0 #7a2e00, 0 10px 18px rgba(60, 0, 90, .35);
  position: relative;
}
.title.small { font-size: clamp(30px, 7vw, 46px); }
.title.small span { color: #fff; }
@keyframes bob { 0%,100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-8px) rotate(3deg); } }

/* ---------- панели ---------- */
.panel {
  background: var(--panel);
  border-radius: 26px;
  border: 4px solid #fff;
  box-shadow: 0 8px 0 rgba(40, 20, 90, .25), 0 18px 40px rgba(30, 10, 80, .25);
  padding: 18px;
}
.profile { width: min(460px, 100%); }
.field-label { display: block; font-weight: 800; font-size: 15px; color: #7a5c3a; margin: 4px 4px 8px; text-transform: uppercase; letter-spacing: .5px; }
.invite {
  background: linear-gradient(180deg, #fff3b0, #ffe066); border: 3px solid #f2b705; border-radius: 16px;
  padding: 10px 12px; text-align: center; font-weight: 700; margin-bottom: 12px; color: #6b4300;
}
.nick-row { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.nick-row input, .join-row input {
  flex: 1; min-width: 0; height: 52px; border-radius: 16px; border: 3px solid #e3d5bf; background: #fff;
  padding: 0 14px; font-size: 20px; font-weight: 700; color: var(--ink); outline: none;
  box-shadow: inset 0 3px 0 rgba(0,0,0,.06);
  transition: border-color .15s;
}
.nick-row input:focus { border-color: #ffa31a; }

/* ---------- аватарки ---------- */
.avatar {
  --s: 56px;
  width: var(--s); height: var(--s); border-radius: 50%; flex: none;
  background: var(--bg, #6ec6ff);
  border: 3px solid #fff;
  box-shadow: 0 3px 0 rgba(0,0,0,.18);
  overflow: hidden; position: relative;
}
.avatar svg { width: 100%; height: 100%; display: block; }
.avatar.big { --s: 64px; }
.avatar-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin-bottom: 16px; }
.avatar-opt {
  aspect-ratio: 1; border-radius: 50%; border: 3px solid #fff; padding: 0; cursor: pointer; overflow: hidden;
  background: var(--bg); box-shadow: 0 3px 0 rgba(0,0,0,.15);
  transition: transform .15s cubic-bezier(.3,1.6,.5,1), box-shadow .15s;
}
.avatar-opt svg { width: 100%; height: 100%; display: block; }
.avatar-opt:hover { transform: scale(1.08); }
.avatar-opt.sel { box-shadow: 0 0 0 4px #ffa31a, 0 3px 0 rgba(0,0,0,.15); transform: scale(1.1); }

/* ---------- кнопки ---------- */
.btn {
  --c1: #ffd23a; --c2: #ffa31a; --sh: #c96a00;
  border: 0; cursor: pointer; color: #fff; font-weight: 800; font-size: 18px;
  padding: 12px 20px; border-radius: 18px; min-height: 52px;
  background: linear-gradient(180deg, var(--c1), var(--c2));
  box-shadow: 0 5px 0 var(--sh), 0 8px 14px rgba(0,0,0,.18), inset 0 2px 0 rgba(255,255,255,.45);
  text-shadow: 0 2px 0 rgba(0,0,0,.25);
  transition: transform .08s, box-shadow .08s, filter .15s;
  position: relative; white-space: nowrap;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--sh), 0 3px 6px rgba(0,0,0,.18), inset 0 2px 0 rgba(255,255,255,.45); }
.btn:disabled { filter: grayscale(.85) brightness(.95); opacity: .65; cursor: default; transform: none; }
.btn-orange { --c1: #ffd23a; --c2: #ff9d00; --sh: #c25e00; }
.btn-green  { --c1: #8ef05a; --c2: #3cc43c; --sh: #23861f; }
.btn-blue   { --c1: #5fd0ff; --c2: #2e8fff; --sh: #1b58b8; }
.btn-gray   { --c1: #d9dbe6; --c2: #aab0c4; --sh: #7a8099; color: #fff; }
.btn-red    { --c1: #ff8a8a; --c2: #f0434e; --sh: #a8202a; }
.btn-big { font-size: 22px; min-height: 60px; padding: 14px 26px; }
.icon-btn { width: 52px; padding: 0; font-size: 24px; }
.icon-btn.small { width: 42px; min-height: 42px; height: 42px; font-size: 18px; border-radius: 14px; --c1: #ffffff; --c2: #e9e3ff; --sh: #9d8fd6; color: #5b3cc4; text-shadow: none; }
.home-actions { display: flex; flex-direction: column; gap: 14px; }
.link-btn { background: rgba(255,255,255,.85); border: 0; border-radius: 999px; padding: 8px 18px; font-weight: 800; color: #5b3cc4; cursor: pointer; font-size: 15px; box-shadow: 0 3px 0 rgba(60,0,120,.25); }

/* ---------- главное меню ---------- */
.home-top { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 14px; z-index: 2; display: flex; align-items: center; gap: 10px; }
.home-top .icon-btn.small { width: 44px; height: 44px; min-height: 44px; }
.account-btn { min-height: 44px; padding: 8px 18px; font-size: 16px; border-radius: 14px; }
.account-chip {
  display: flex; align-items: center; gap: 8px; border: 0; cursor: pointer; font: inherit; font-weight: 800; font-size: 16px;
  background: rgba(255,255,255,.92); color: #5b3cc4; padding: 5px 16px 5px 5px; border-radius: 999px;
  box-shadow: 0 4px 0 rgba(60,0,120,.25); max-width: 220px;
}
.account-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-chip:hover { filter: brightness(1.04); }
.avatar.mini { --s: 34px; border-width: 2px; box-shadow: none; }
.menu-panel { width: min(420px, 100%); display: flex; flex-direction: column; gap: 14px; }
/* вход по коду: поле раскрывается на месте кнопки */
.join-form { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 8px; border-radius: 20px; background: #eafbe0; border: 3px solid #8ee06a; }
.join-head { display: flex; align-items: center; justify-content: space-between; margin: -2px -4px 0 0; }
.join-form .field-label { margin: 0 4px; color: #2f7a1f; }
.join-close { border: 0; background: none; width: 34px; height: 34px; border-radius: 10px; font-size: 18px; font-weight: 900; color: #6f8a5c; cursor: pointer; }
.join-close:hover { background: rgba(47, 122, 31, .1); }
.join-row { display: flex; gap: 8px; }
.join-row input {
  height: 56px; font-size: 28px; font-weight: 900; letter-spacing: .3em; text-align: center; text-transform: uppercase;
  padding: 0 0 0 .3em; color: #2e6bd8;
}
.join-row input::placeholder { color: #d6cbb8; }
.join-row input:focus { border-color: #3cc43c; }
.join-row .btn { min-height: 56px; padding: 0 22px; }
.join-hint { font-size: 13.5px; font-weight: 700; color: #6f8a5c; text-align: center; min-height: 1.3em; }
.join-hint.err { color: #c0392b; }
@media (max-width: 380px) { /* узкий телефон: поле с кодом не должно сжиматься до двух букв */
  .join-row input { font-size: 24px; letter-spacing: .18em; padding-left: .18em; }
  .join-row .btn { padding: 0 14px; }
  .share-actions .btn { font-size: 16px; }
}
.home-foot { font-size: 13px; font-weight: 700; color: rgba(255,255,255,.85); text-align: center; }
.home-foot a { color: #fff; }

/* ---------- окна аккаунта ---------- */
.tabs { display: flex; gap: 6px; background: #f1ecff; padding: 5px; border-radius: 16px; margin-bottom: 14px; }
.tab { flex: 1; border: 0; background: transparent; font: inherit; font-weight: 800; font-size: 17px; color: #7a6aa8; padding: 9px; border-radius: 12px; cursor: pointer; }
.tab.on { background: #fff; color: #5b3cc4; box-shadow: 0 2px 0 rgba(60,0,120,.15); }
.auth-form { display: flex; flex-direction: column; gap: 8px; }
.auth-form .field-label { margin: 6px 4px 0; }
.auth-form .field-label .hint { text-transform: none; font-weight: 600; letter-spacing: 0; color: #a8957a; }
.auth-form > input, .pw-box input, .captcha input, .auth-form .nick-row input, .pw-field input {
  height: 48px; border-radius: 14px; border: 3px solid #e3d5bf; background: #fff; padding: 0 14px;
  font-size: 17px; font-weight: 700; color: var(--ink); outline: none; width: 100%; min-width: 0;
}
.auth-form > input:focus, .pw-box input:focus, .captcha input:focus, .auth-form .nick-row input:focus, .pw-field input:focus { border-color: #8f7bff; }
/* глазок в поле пароля: посмотреть набранное */
.pw-field { position: relative; display: flex; }
.pw-field input { flex: 1; min-width: 0; padding-right: 50px !important; }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 40px; height: 36px; border: 0; border-radius: 10px;
  background: transparent; cursor: pointer; font-size: 18px; opacity: .55; filter: grayscale(1);
}
.pw-eye:hover, .pw-eye[aria-pressed="true"] { opacity: 1; filter: none; }
.auth-form .nick-row { margin: 0; }
.auth-form .avatar-grid { margin-bottom: 4px; }
.auth-form > .btn { margin-top: 6px; }
.modal-sub { text-align: center; font-weight: 600; color: #7a5c3a; margin: -4px 0 12px; }
.captcha { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.cap-row { display: flex; align-items: center; gap: 8px; justify-content: center; }
.cap-row img { width: 200px; height: 70px; border-radius: 12px; border: 3px solid #e3d5bf; background: #f4eddf; image-rendering: auto; }
.cap-refresh { width: 44px; height: 44px; border: 0; border-radius: 12px; background: #f4eddf; font-size: 22px; font-weight: 900; cursor: pointer; color: #7a5c3a; }
.captcha input { text-align: center; letter-spacing: 6px; }
.accept { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; font-weight: 600; line-height: 1.4; margin: 6px 2px; cursor: pointer; user-select: text; }
.accept input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: #3cc43c; }
.accept a { color: #5b3cc4; }
.auth-or { display: flex; align-items: center; gap: 10px; color: #a8957a; font-weight: 700; font-size: 14px; margin: 8px 0 2px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; height: 2px; background: #efe6d4; }
.g-btn { display: flex; justify-content: center; min-height: 44px; }
.g-note, .auth-alt { text-align: center; font-size: 12.5px; font-weight: 600; color: #a8957a; }
.auth-alt { font-size: 14px; margin-top: 4px; }
.g-fail { font-size: 13px; color: #c0392b; font-weight: 700; }
.link { background: none; border: 0; padding: 0; font: inherit; font-weight: 800; color: #5b3cc4; cursor: pointer; text-decoration: underline; }
.link.danger { color: #c0392b; display: block; margin: 14px auto 0; font-size: 14px; }
.stats { display: flex; gap: 8px; margin: 14px 0 10px; }
.stats div { flex: 1; background: #f4eddf; border-radius: 14px; padding: 8px; text-align: center; font-size: 13px; font-weight: 700; color: #8a7a66; }
.stats b { display: block; font-size: 24px; color: var(--ink); }
.acc-info { font-size: 14px; font-weight: 600; display: flex; flex-direction: column; gap: 3px; margin-bottom: 10px; overflow-wrap: anywhere; }
.acc-info .muted { color: #a8957a; }
.pw-box { margin: 8px 0; }
.pw-box summary { cursor: pointer; font-weight: 800; color: #5b3cc4; }
.pw-box .auth-form { margin-top: 8px; }

/* ---------- страницы документов ---------- */
.doc-page { position: static; height: auto; overflow: auto; }
html:has(.doc-page), body.doc-page { overflow: auto; height: auto; }
body.doc-page { background: linear-gradient(180deg, #36b4ff 0%, #6a7bff 55%, #9d5cff 100%) fixed; padding: 24px 14px 40px; }
.doc { width: min(820px, 100%); margin: 0 auto; user-select: text; -webkit-user-select: text; line-height: 1.55; font-weight: 500; }
.doc h1 { font-weight: 900; color: #5b3cc4; margin: 0 0 4px; font-size: clamp(26px, 5vw, 36px); }
.doc h2 { font-weight: 900; color: #5b3cc4; font-size: 20px; margin: 22px 0 6px; }
.doc .meta { color: #8a7a66; font-weight: 700; font-size: 14px; margin-bottom: 14px; }
.doc a { color: #2e6bd8; }
.doc li { margin-bottom: 4px; }
.doc .back { display: inline-block; margin-bottom: 14px; font-weight: 800; }
.doc table { border-collapse: collapse; width: 100%; font-size: 14px; }
.doc td, .doc th { border: 2px solid #efe6d4; padding: 6px 8px; text-align: left; vertical-align: top; }

/* ---------- лобби ---------- */
.share, .seats-panel { width: min(560px, 100%); }
.share { text-align: center; }
.share-label { font-weight: 800; font-size: 15px; color: #7a5c3a; text-transform: uppercase; letter-spacing: .5px; }
/* код — главное в приглашении: крупно, чтобы продиктовать или переписать с экрана */
.room-code {
  font-weight: 900; font-size: clamp(54px, 15vw, 76px); line-height: 1.05; letter-spacing: .14em; padding-left: .14em; margin: 2px 0 4px;
  color: #ffde3b; -webkit-text-stroke: 3px #7a2e00; paint-order: stroke fill; text-shadow: 0 4px 0 #7a2e00;
  font-variant-numeric: tabular-nums; user-select: text; -webkit-user-select: text;
}
.share-site { font-weight: 700; color: #7a5c3a; overflow-wrap: anywhere; user-select: text; -webkit-user-select: text; }
.share-site b { color: #2e6bd8; }
.share-actions { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }
.share-actions .btn { flex: 1 1 0; min-width: 0; max-width: 220px; padding-left: 10px; padding-right: 10px; }
.share-tip { font-size: 13.5px; font-weight: 600; color: #a8957a; margin-top: 10px; }
.lobby-seats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.lobby-seat {
  border-radius: 22px; background: #f4eddf; border: 3px dashed #d9c9ab; min-height: 170px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 10px 4px;
  text-align: center; font-weight: 700; color: #a8957a; position: relative;
}
.lobby-seat.filled { background: linear-gradient(180deg, #fff, #fff4dc); border: 3px solid #ffcf6b; color: var(--ink); animation: popIn .45s cubic-bezier(.3,1.6,.5,1); }
.lobby-seat .avatar { --s: 84px; }
.lobby-seat .nm { font-size: 19px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 4px; }
.lobby-seat .crown-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); width: 30px; height: 22px; }
.lobby-seat .offline { font-size: 11px; color: #c0392b; }
.wait-dots::after { content: ''; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ''; } 25% { content: '.'; } 50% { content: '..'; } 75% { content: '...'; } }
.lobby-hint { text-align: center; font-weight: 700; color: #7a5c3a; margin: 14px 0 6px; }
.lobby-hint:empty { margin: 0 0 14px; }
.lobby-actions { display: flex; gap: 12px; justify-content: center; margin-top: 8px; }
.lobby-actions .btn-big { flex: 1; max-width: 300px; }
.lobby-seat .avatar.tappable { cursor: pointer; }

/* ================== ИГРОВОЙ СТОЛ ================== */
.table {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: stretch;
  padding: max(14px, env(safe-area-inset-top)) 18px max(16px, env(safe-area-inset-bottom));
  gap: 8px;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255,255,255,.16), transparent 60%),
    radial-gradient(ellipse at 50% 50%, #3fbf66 0%, #2c9d50 55%, #1f7a3c 100%);
  overflow: hidden;
  --dw: clamp(56px, calc((100vh - 520px) * .5), 110px);
  --dw: clamp(56px, calc((100dvh - 520px) * .5), 110px);
}
.table::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,.07) 1.5px, transparent 2px);
  background-size: 22px 22px;
}
.table::after { /* деревянный бортик */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 0 7px #a0582a, inset 0 0 0 10px #6e3512, inset 0 0 40px 12px rgba(0,0,0,.25);
}
.table > * { position: relative; z-index: 1; flex-shrink: 0; }
.table > .center { flex: 1 1 0; min-height: 0; overflow: hidden; }

.topbar { display: flex; align-items: center; gap: 10px; padding: 0 2px; }
.topbar .icon-btn.small { width: 48px; height: 48px; min-height: 48px; font-size: 21px;; flex-shrink: 0; }
.room-pill, .goal-pill {
  background: rgba(0,0,0,.22); color: #fff; font-weight: 700; padding: 10px 16px; border-radius: 999px; font-size: 17px;
  display: flex; align-items: center; gap: 6px;
}
.room-pill { margin-right: auto; }
.mini-chest { width: 28px; height: 25px; }

/* ---------- места игроков ---------- */
.opponents { display: flex; justify-content: center; }
.seat {
  display: grid; grid-template-columns: auto auto auto; grid-template-areas: "av info fan";
  align-items: center; column-gap: 14px; row-gap: 6px; position: relative;
  padding: 10px 16px; border-radius: 26px;
  background: rgba(0, 40, 10, .22);
  transition: background .3s, box-shadow .3s;
}
.seat > .avatar { grid-area: av; }
.seat > .info { grid-area: info; }
.seat > .fan { grid-area: fan; }
.seat.turn { background: rgba(255, 230, 120, .28); box-shadow: 0 0 0 4px #ffe066, 0 0 28px rgba(255, 224, 102, .6); }
.seat .avatar { --s: 84px; border-width: 4px; }
.seat.turn .avatar { animation: turnPulse 1.4s ease-in-out infinite; }
@keyframes turnPulse { 0%,100% { box-shadow: 0 3px 0 rgba(0,0,0,.18), 0 0 0 0 rgba(255,224,102,.9); } 50% { box-shadow: 0 3px 0 rgba(0,0,0,.18), 0 0 0 10px rgba(255,224,102,0); } }
.seat .info { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; min-width: 0; }
.nameplate {
  background: #fff; color: var(--ink); font-weight: 800; font-size: 20px; padding: 4px 14px; border-radius: 999px;
  box-shadow: 0 3px 0 rgba(0,0,0,.18); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.badge-row { display: flex; gap: 6px; align-items: center; }
.cnt-badge { font-size: 14px; font-weight: 800; color: #fff; background: rgba(0,0,0,.3); padding: 3px 10px; border-radius: 999px; }
.ai-badge { font-size: 13px; font-weight: 800; color: #fff; background: #7c4dff; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.ai-levels { display: flex; flex-direction: column; gap: 12px; margin-top: 6px; }
.ai-levels .btn { white-space: normal; }
.ai-levels .lvl-sub { display: block; font-size: 14px; font-weight: 600; opacity: .9; }
.off-badge { font-size: 13px; font-weight: 800; color: #fff; background: #e5303f; padding: 3px 9px; border-radius: 999px; }
.fan { display: flex; justify-content: center; align-items: center; min-width: 100px; }
.fan .card-back { --cw: 46px; margin-left: -30px; box-shadow: 0 2px 0 rgba(0,0,0,.2); }
.fan .card-back:first-child { margin-left: 0; }
.fan-empty { height: 64px; font-size: 14px; color: rgba(255,255,255,.75); font-weight: 700; }
.chests { display: flex; gap: 5px; }
.chest-slot {
  width: 50px; height: 46px; border-radius: 12px; position: relative; flex: none;
  border: 2px dashed rgba(255,255,255,.4);
}
.chest-slot.full { border: 0; }
.chest-slot svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chest-slot .rk {
  position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%);
  background: #fff; color: var(--ink); font-size: 13px; font-weight: 900; line-height: 1; padding: 2px 5px; border-radius: 7px;
  box-shadow: 0 1px 0 rgba(0,0,0,.25); white-space: nowrap;
}
.chest-slot.pop { animation: chestPop .7s cubic-bezier(.3,1.8,.5,1); }
@keyframes chestPop { 0% { transform: scale(.2); } 60% { transform: scale(1.35); } 100% { transform: scale(1); } }

/* ---------- центр стола ---------- */
.center { display: flex; align-items: center; justify-content: center; gap: clamp(16px, 4vw, 48px); }
.deck-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.deck { position: relative; width: var(--dw); height: calc(var(--dw) * 1.4); }
.deck .card-back { --cw: var(--dw); position: absolute; left: 0; top: 0; }
.deck-empty { width: var(--dw); height: calc(var(--dw) * 1.4); border: 3px dashed rgba(255,255,255,.4); border-radius: 12px; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.8); font-weight: 800; font-size: 13px; text-align: center; }
.deck-count { background: #fff; font-weight: 900; font-size: 18px; padding: 3px 14px; border-radius: 999px; box-shadow: 0 3px 0 rgba(0,0,0,.2); }
/* ---------- подсказка хода ---------- */
.turn-hint {
  align-self: center; height: 40px; line-height: 40px; padding: 0 22px; border-radius: 999px;
  background: rgba(0, 40, 10, .35); color: #fff; font-weight: 800; font-size: 19px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.turn-hint.mine {
  background: linear-gradient(180deg, #fff27a, #ffc21a); color: #6b3b00;
  box-shadow: 0 4px 0 #c47a00, 0 8px 18px rgba(0,0,0,.2);
  animation: hintPulse 1.6s ease-in-out infinite;
}
@keyframes hintPulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }

/* ---------- моя зона ---------- */
.me-area { display: flex; align-items: flex-end; gap: 14px; padding: 0 4px 2px; }
/* относительно .me-side раскрывается панель истории: на телефоне она во всю ширину над рукой */
.me-side { display: flex; align-items: flex-end; gap: 12px; flex: none; position: relative; }
/* История ходов: свёрнута — серая и полупрозрачная, чтобы не отвлекать от игры; нажатие — вся партия */
.history { width: 250px; flex: none; }
.h-toggle {
  display: flex; flex-direction: column; justify-content: flex-end; gap: 3px; width: 100%;
  position: relative; padding: 8px 24px 8px 12px; border: 0; border-radius: 16px; background: rgba(0, 30, 10, .14);
  color: rgba(255, 255, 255, .45); font: inherit; font-size: 12.5px; font-weight: 600; line-height: 1.3;
  text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.h-toggle::after { content: '▴'; position: absolute; right: 9px; top: 6px; font-size: 12px; color: rgba(255, 255, 255, .7); }
.history.open .h-toggle::after { content: '▾'; }
.h-toggle:focus-visible, .h-close:focus-visible { outline: 3px solid rgba(255, 255, 255, .8); outline-offset: 2px; }
.history.open .h-toggle { background: rgba(0, 30, 10, .26); }
@media (hover: hover) { .h-toggle:hover { background: rgba(0, 30, 10, .24); } }
.h-line { display: block; overflow-wrap: anywhere; }
.h-toggle .h-line { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-line b { font-weight: 800; }
.h-line.last { color: rgba(255, 255, 255, .75); }
.h-panel {
  position: absolute; left: 0; bottom: calc(100% + 8px); z-index: 30;
  width: min(360px, calc(100vw - 16px)); max-height: 45vh; display: flex; flex-direction: column;
  border-radius: 18px; background: rgba(16, 44, 24, .94); color: #fff; box-shadow: 0 10px 30px rgba(0, 0, 0, .35);
  overflow: hidden; animation: popIn .25s ease-out both; transform-origin: 20% 100%;
}
.h-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 8px 6px 14px; font-weight: 800; font-size: 14px; }
.h-close {
  flex: none; width: 32px; height: 32px; border: 0; border-radius: 50%; padding: 0;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: 15px; font-weight: 800; cursor: pointer;
}
.h-list {
  display: flex; flex-direction: column; gap: 4px; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  padding: 0 14px 12px; font-size: 13.5px; font-weight: 600; line-height: 1.35; color: rgba(255, 255, 255, .78);
}
.h-list .h-line.sys { color: rgba(255, 236, 160, .85); }
.h-list .h-line.last { color: #fff; background: rgba(255, 255, 255, .12); border-radius: 8px; padding: 2px 6px; margin: 0 -6px; }
.seat.me { flex: none; grid-template-columns: auto auto; grid-template-areas: "av info"; }
.hand {
  flex: 1; min-width: 0; height: calc(var(--cw) * 1.4 + 2 * var(--offy) + 40px);
  display: flex; align-items: flex-end; justify-content: center; padding-top: 40px;
}
/* Стопка одинаковых карт: карты поднимаются вверх, верхняя (последняя) лежит внизу целиком.
   Приподнимаем стопку через top, а не transform: transform создаёт отдельный слой,
   и тогда соседняя стопка может перекрыть число-счётчик. */
.stack {
  position: relative; top: 0; flex: none;
  width: var(--cw); height: calc(var(--cw) * 1.4 + (var(--k) - 1) * var(--offy));
  transition: top .2s cubic-bezier(.3,1.5,.5,1);
}
.stack .card { position: absolute; left: 0; top: calc(var(--i) * var(--offy)); }
/* Счётчик висит над стопкой, по центру её видимой части, и не закрывает карты */
.stack-count {
  position: absolute; z-index: 20; top: -34px; left: calc(var(--vis, var(--cw)) / 2 - 15px);
  width: 30px; height: 30px; border-radius: 15px;
  background: #ff9d00; color: #fff; border: 3px solid #fff;
  font-weight: 900; font-size: 16px; line-height: 24px; text-align: center;
  box-shadow: 0 3px 0 rgba(0,0,0,.25);
}
.hand.selectable .stack { cursor: pointer; }
@media (hover: hover) {
  .hand.selectable .stack:hover { top: -14px; }
}
.stack.asking { top: -28px; }
.stack.asking .card { box-shadow: 0 0 0 4px #ff9d00, 0 10px 18px rgba(0,0,0,.3); }
.hand-empty { color: rgba(255,255,255,.85); font-weight: 800; font-size: 18px; align-self: center; }

input.shake { animation: shake .45s; border-color: #f0434e !important; }
@keyframes shake { 0%,100% { transform: translateX(0); } 20%,60% { transform: translateX(-8px); } 40%,80% { transform: translateX(8px); } }

/* ---------- своя аватарка: нажми — стикеры ---------- */
.avatar.tappable { cursor: pointer; transition: transform .15s cubic-bezier(.3,1.6,.5,1); }
@media (hover: hover) { .avatar.tappable:hover { transform: scale(1.08) rotate(-4deg); } }
.avatar.tappable:active { transform: scale(.94); }

/* ================== ЧАТ ================== */
.chat-toggle .unread {
  position: absolute; top: -7px; right: -7px; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 11px;
  background: #f0434e; color: #fff; border: 2px solid #fff; font-size: 12px; font-weight: 900; line-height: 18px;
  text-shadow: none; box-shadow: 0 2px 0 rgba(0,0,0,.2); animation: popIn .3s cubic-bezier(.3,1.6,.5,1) both;
}
.icon-btn.small.chat-toggle.on { --c1: #ffe9a8; --c2: #ffd36e; --sh: #c98a1a; }
.btn-blue.chat-toggle.on { --c1: #4fb8f0; --c2: #1f6fd6; }

.chat {
  position: fixed; z-index: 46; right: 14px; top: max(74px, calc(env(safe-area-inset-top) + 60px));
  width: min(360px, calc(100vw - 24px)); height: min(440px, calc(100vh - 220px)); min-height: 260px;
  display: flex; flex-direction: column;
  background: var(--panel); border: 4px solid #fff; border-radius: 24px;
  box-shadow: 0 8px 0 rgba(40, 20, 90, .25), 0 18px 40px rgba(30, 10, 80, .3);
  animation: popIn .3s cubic-bezier(.3,1.6,.5,1) both; transform-origin: 100% 0;
  overflow: hidden;
}
.chat-head {
  display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 8px 16px;
  background: linear-gradient(180deg, #8f7bff, #5b3cc4); color: #fff; font-weight: 900; font-size: 18px;
}
.chat-close {
  width: 32px; height: 32px; border: 0; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,.2); color: #fff; font-size: 16px; font-weight: 900;
}
.chat-close:hover { background: rgba(255,255,255,.32); }
.chat-log {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 8px; padding: 12px 10px;
}
.chat-empty { margin: auto; text-align: center; color: #a8957a; font-weight: 700; font-size: 14px; line-height: 1.4; padding: 0 10px; }
.msg { display: flex; align-items: flex-end; gap: 6px; max-width: 88%; animation: popIn .25s ease both; }
.msg.mine { align-self: flex-end; }
.msg .avatar.mini { --s: 30px; border-width: 2px; box-shadow: 0 2px 0 rgba(0,0,0,.15); }
.msg-body { display: flex; flex-direction: column; min-width: 0; }
.msg-name { font-size: 12px; font-weight: 800; color: #8a7a66; margin: 0 0 2px 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-text {
  background: #ece7ff; color: var(--ink); padding: 7px 12px; border-radius: 16px 16px 16px 5px;
  font-weight: 600; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere;
  user-select: text; -webkit-user-select: text;
}
.msg.mine .msg-text { background: linear-gradient(180deg, #fff3b0, #ffe066); border-radius: 16px 16px 5px 16px; }
.msg.stk .msg-text { background: none; padding: 0; }
.chat-sticker { width: 90px; height: 90px; object-fit: contain; display: block; filter: drop-shadow(0 3px 3px rgba(0,0,0,.18)); }
.chat-form { display: flex; gap: 6px; padding: 8px; border-top: 2px solid #efe6d4; background: #fff; }
.chat-form input {
  flex: 1; min-width: 0; height: 44px; border-radius: 14px; border: 3px solid #e3d5bf; background: #fff;
  padding: 0 12px; font-size: 16px; font-weight: 600; color: var(--ink); outline: none;
}
.chat-form input:focus { border-color: #8f7bff; }
.chat-stk {
  width: 44px; height: 44px; flex: none; border: 0; border-radius: 14px; cursor: pointer; font-size: 22px;
  background: #f4eddf; transition: transform .12s;
}
.chat-stk:hover { transform: scale(1.08); }
.chat-send { min-height: 44px; height: 44px; width: 48px; padding: 0; font-size: 18px; border-radius: 14px; }

/* ---------- выбор стикера ---------- */
.sticker-picker {
  position: fixed; z-index: 58; left: 0; top: 0;
  width: max-content; max-width: min(336px, calc(100vw - 16px)); max-height: min(420px, 60vh); overflow-y: auto; overscroll-behavior: contain;
  background: var(--panel); border: 4px solid #fff; border-radius: 22px; padding: 10px;
  box-shadow: 0 8px 0 rgba(40, 20, 90, .25), 0 18px 40px rgba(30, 10, 80, .3);
  animation: popIn .25s cubic-bezier(.3,1.6,.5,1) both;
}
.sp-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.sp-item {
  width: 72px; height: 72px; flex: none; border: 0; border-radius: 16px; padding: 6px; cursor: pointer; background: transparent;
  transition: transform .15s cubic-bezier(.3,1.6,.5,1), background .15s;
}
.sp-item:hover { background: #f4eddf; transform: scale(1.1); }
.sp-item:active { transform: scale(.92); }
.sp-item img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; }
.sp-empty { width: 250px; max-width: 100%; text-align: center; color: #8a7a66; font-weight: 700; font-size: 14px; line-height: 1.4; padding: 10px 6px; }

/* ---------- стикер у аватарки ---------- */
.sticker-pop { position: absolute; left: 0; top: 0; width: var(--sz); height: var(--sz); transform: translate(var(--x), var(--y)); }
.sticker-pop img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  filter: drop-shadow(0 6px 10px rgba(0,0,0,.3));
  transform-origin: 50% 100%; animation: stickerIn 3s cubic-bezier(.3,1.4,.5,1) both;
}
.sticker-pop.below img { transform-origin: 50% 0; }
@keyframes stickerIn {
  0%   { opacity: 0; transform: scale(.2) rotate(-18deg); }
  10%  { opacity: 1; transform: scale(1.18) rotate(7deg); }
  17%  { transform: scale(1) rotate(0); }
  26%  { transform: rotate(-5deg); }
  35%  { transform: rotate(4deg); }
  44%  { transform: rotate(0); }
  86%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(.7) translateY(-14px); }
}

/* пузырь с сообщением из чата */
.bubble.say { white-space: normal; max-width: min(280px, 72vw); font-size: 16px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; background: #f4f0ff; }
.bubble.say::after { background: #f4f0ff; }

/* ================== КАРТЫ ================== */
.card, .card-back {
  width: var(--cw); height: calc(var(--cw) * 1.4); flex: none;
  border-radius: calc(var(--cw) * .12);
  position: relative;
}
.card {
  background: linear-gradient(160deg, #ffffff 0%, #fbf6ea 100%);
  border: max(1.5px, calc(var(--cw) * .025)) solid #d8cdb6;
  box-shadow: 0 3px 0 rgba(0,0,0,.18), 0 5px 10px rgba(0,0,0,.15);
  font-size: calc(var(--cw) * .26);
  overflow: hidden;
}
.card.red { color: var(--red); fill: var(--red); }
.card.black { color: var(--black); fill: var(--black); }
.card .corner {
  position: absolute; display: flex; flex-direction: column; align-items: center; line-height: 1;
  font-weight: 900; font-size: 1em; letter-spacing: -.04em;
}
.card .corner svg { width: .7em; height: .7em; margin-top: .06em; }
.card .tl { left: .2em; top: .22em; }
.card .br { right: .2em; bottom: .22em; transform: rotate(180deg); }
.card .pip { position: absolute; left: 50%; top: 52%; width: 1.9em; height: 1.9em; transform: translate(-50%, -50%); }
.card .pip svg { width: 100%; height: 100%; display: block; filter: drop-shadow(0 .06em 0 rgba(0,0,0,.15)); }
.card .face-art { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); width: 2.3em; display: flex; flex-direction: column; align-items: center; }
.card .face-art .hat { width: 2em; height: 1.4em; }
.card .face-art .suit { width: 1.15em; height: 1.15em; margin-top: -.1em; }
.card.ace .pip { width: 2.3em; height: 2.3em; }
.card.ace .pip::before {
  content: ''; position: absolute; inset: -18%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 215, 64, .45), transparent 65%);
}

.card-back {
  border: max(1.5px, calc(var(--cw) * .04)) solid #fff;
  background:
    radial-gradient(circle at 50% 50%, #ffd23a 0 calc(var(--cw) * .13), #c96a00 calc(var(--cw) * .13) calc(var(--cw) * .16), transparent calc(var(--cw) * .165)),
    repeating-linear-gradient(45deg, rgba(255,255,255,.16) 0 calc(var(--cw) * .06), transparent calc(var(--cw) * .06) calc(var(--cw) * .12)),
    linear-gradient(160deg, #7a5cff, #4b2fd1);
  box-shadow: 0 3px 0 rgba(0,0,0,.2), 0 4px 8px rgba(0,0,0,.18);
}

/* ================== ЭФФЕКТЫ ================== */
#fx { position: fixed; inset: 0; pointer-events: none; z-index: 50; overflow: hidden; contain: strict; }
.fly { position: absolute; left: 0; top: 0; will-change: transform; perspective: 700px; }
.fly .flip { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; -webkit-transform-style: preserve-3d; }
.fly .flip > * { position: absolute; left: 0; top: 0; width: 100%; height: 100%; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.fly .flip > .card-back { transform: rotateY(180deg); }
.fly .flip > .card { transform: rotateY(0deg); }
.fly.flat .flip { transform-style: flat; }

.bubble {
  position: absolute; left: 0; top: 0; transform-origin: 50% 100%;
  background: #fff; color: var(--ink); font-weight: 900; font-size: 19px; padding: 10px 16px; border-radius: 20px;
  border: 3px solid var(--ink); box-shadow: 0 5px 0 rgba(0,0,0,.2);
  white-space: nowrap; display: flex; align-items: center; gap: 6px;
  animation: bubbleIn .35s cubic-bezier(.3,1.7,.5,1) both;
}
.bubble.below { transform-origin: 50% 0%; }
.bubble::after {
  content: ''; position: absolute; left: var(--tail, 50%); bottom: -13px; width: 18px; height: 18px; margin-left: -9px;
  background: #fff; border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink);
  transform: rotate(45deg) skew(8deg, 8deg); border-bottom-right-radius: 4px;
}
.bubble.below::after { bottom: auto; top: -13px; transform: rotate(225deg) skew(8deg, 8deg); }
.bubble.good { background: #d9ffc9; } .bubble.good::after { background: #d9ffc9; }
.bubble.bad { background: #ffd9d9; } .bubble.bad::after { background: #ffd9d9; }
.bubble svg { width: 22px; height: 22px; }
.bubble .red { fill: var(--red); } .bubble .black { fill: var(--black); }
.bubble.out { animation: bubbleOut .22s ease-in both; }
@keyframes bubbleIn { from { opacity: 0; transform: translate(var(--x), var(--y)) scale(.3); } to { opacity: 1; transform: translate(var(--x), var(--y)) scale(1); } }
@keyframes bubbleOut { from { opacity: 1; transform: translate(var(--x), var(--y)) scale(1); } to { opacity: 0; transform: translate(var(--x), var(--y)) scale(.6); } }

.banner {
  position: absolute; left: 50%; top: 44%; transform: translate(-50%, -50%);
  font-weight: 900; font-size: clamp(34px, 8vw, 60px); color: #ffde3b; white-space: nowrap;
  -webkit-text-stroke: 3px #7a2e00; paint-order: stroke fill;
  text-shadow: 0 5px 0 #7a2e00, 0 10px 24px rgba(0,0,0,.35);
  animation: bannerIn 1.2s cubic-bezier(.3,1.5,.5,1) both;
}
.banner.green { color: #b6ff6b; -webkit-text-stroke-color: #1e5e12; text-shadow: 0 5px 0 #1e5e12, 0 10px 24px rgba(0,0,0,.35); }
@keyframes bannerIn {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(-8deg); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1.12) rotate(2deg); }
  40% { transform: translate(-50%, -50%) scale(1) rotate(0); }
  80% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(.95); }
}
.spark {
  position: absolute; left: 0; top: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px;
  background: #ffe066; border-radius: 2px; transform: rotate(45deg);
}
.confetti { position: absolute; top: -20px; width: 10px; height: 16px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate3d(var(--dx), 110vh, 0) rotate(var(--rot)); } }

@keyframes popIn { 0% { transform: scale(.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ---------- модалки ---------- */
.modal {
  position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(20, 10, 50, .55);
  animation: fadeIn .25s ease both;
}
.modal .panel { width: min(520px, 100%); max-height: 90vh; overflow-y: auto; animation: popIn .4s cubic-bezier(.3,1.6,.5,1) both; position: relative; }
.modal h2 { margin: 0 0 10px; font-weight: 900; font-size: 28px; text-align: center; color: #5b3cc4; }
.rules ol { padding-left: 22px; margin: 0; line-height: 1.45; font-weight: 500; }
.rules li { margin-bottom: 8px; }
.rules b { color: #e06a00; }
.modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.over-panel { text-align: center; }
.over-panel .win-title { font-size: clamp(36px, 9vw, 54px); margin-bottom: 6px; }
.over-panel .win-sub { font-weight: 800; font-size: 18px; color: #7a5c3a; }
.over-panel .win-avatar { margin: 6px auto 10px; --s: 110px; border-width: 5px; animation: bob 2s ease-in-out infinite; }
.standings { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.standing { display: flex; align-items: center; gap: 10px; background: #f4eddf; border-radius: 16px; padding: 6px 12px; font-weight: 800; }
.standing.win { background: linear-gradient(180deg, #fff3b0, #ffe066); }
.standing .avatar { --s: 40px; }
.standing .nm { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.standing .sc { display: flex; align-items: center; gap: 4px; font-size: 20px; }
.standing .sc svg { width: 28px; height: 26px; }

#toasts { position: fixed; left: 50%; top: 14px; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: #fff; border: 3px solid var(--ink); border-radius: 16px; padding: 8px 16px; font-weight: 800; box-shadow: 0 4px 0 rgba(0,0,0,.2); animation: popIn .3s cubic-bezier(.3,1.6,.5,1) both; max-width: 90vw; text-align: center; }
.toast.err { background: #ffe1e1; }

/* ---------- настройки: озвучка ---------- */
.settings-sub { margin-top: -4px; }
.voice-list { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 14px; }
.voice-opt {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "name play" "tags play"; align-items: center; column-gap: 12px;
  text-align: left; font: inherit; cursor: pointer; padding: 10px 14px; border-radius: 16px; border: 3px solid #e3dcff;
  background: #faf8ff; color: var(--ink); transition: transform .12s, border-color .12s;
}
.voice-opt:hover { transform: translateY(-1px); }
.voice-opt.sel { border-color: #7c4dff; background: #efe8ff; box-shadow: 0 3px 0 #b9a6f5; }
.v-name { grid-area: name; font-weight: 900; font-size: 18px; }
.v-tags { grid-area: tags; font-size: 13px; font-weight: 600; opacity: .7; }
.v-play { grid-area: play; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: #7c4dff; color: #fff; font-size: 14px; }
.setting-row { display: flex; align-items: center; gap: 10px; font-weight: 800; cursor: pointer; margin-bottom: 4px; }
.setting-row input { width: 22px; height: 22px; accent-color: #7c4dff; }

/* ================== АДАПТИВ ================== */
@media (max-width: 760px) {
  .avatar-grid { grid-template-columns: repeat(4, 1fr); }
  .home-top { position: static; display: flex; justify-content: flex-end; padding: 12px 12px 0; }
  .home-wrap { padding-top: 8px; }
  .account-btn { font-size: 15px; }
  .goal-pill { display: none; }
  .table { padding-left: 14px; padding-right: 14px; gap: 6px; }
  .topbar .icon-btn.small { width: 44px; height: 44px; min-height: 44px; font-size: 19px; }
  /* на телефоне звук включается в ⚙️ Настройках — кнопкам хватает места */
  #btn-sound { display: none; }
  .topbar { gap: 6px; }
  .room-pill { font-size: 15px; padding: 8px 14px; }
  .seat { column-gap: 8px; padding: 8px 10px; border-radius: 22px; }
  .seat .avatar { --s: 54px; border-width: 3px; }
  .seat .info { gap: 5px; }
  .nameplate { font-size: 16px; max-width: 140px; padding: 3px 11px; }
  .cnt-badge { font-size: 12px; padding: 2px 8px; }
  .ai-badge { font-size: 11px; padding: 2px 7px; }
  .fan { min-width: 0; }
  .fan .card-back { --cw: 28px; margin-left: -20px; }
  .fan-empty { height: 40px; font-size: 12px; }
  .chests { gap: 4px; }
  .chest-slot { width: 32px; height: 30px; border-radius: 9px; }
  .chest-slot .rk { font-size: 10px; padding: 1px 4px; bottom: -5px; }
  .seat.me .badge-row { display: none; }
  .seat.me .avatar { --s: 48px; }
  .me-area { flex-direction: column; align-items: center; gap: 4px; }
  .me-area .hand { align-self: stretch; width: 100%; flex: none; }
  .me-side { align-self: stretch; justify-content: center; gap: 8px; }
  .history { flex: 0 1 170px; width: auto; min-width: 0; }
  .h-toggle { padding: 5px 20px 5px 8px; border-radius: 12px; font-size: 10.5px; gap: 1px; }
  .h-toggle::after { right: 7px; top: 4px; font-size: 10px; }
  /* узко: строка переносится, но не больше двух строк — ответ не обрезается */
  .h-toggle .h-line { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; }
  .h-panel { left: 0; right: 0; width: auto; }
  .seat.me { padding: 6px 12px; }
  .bubble { font-size: 18px; padding: 9px 14px; }
  .turn-hint { font-size: 16px; height: 34px; line-height: 34px; padding: 0 16px; }
  .chat { right: 10px; top: 64px; height: min(420px, calc(100vh - 200px)); }
  .lobby-actions { flex-wrap: wrap; }
  .stack-count { width: 26px; height: 26px; border-radius: 13px; font-size: 14px; line-height: 20px; top: -29px; left: calc(var(--vis, var(--cw)) / 2 - 13px); }
}
@media (max-height: 600px) and (orientation: landscape) {
  .seat .avatar { --s: 54px; }
  .chest-slot { width: 36px; height: 33px; }
}
@media (prefers-reduced-motion: reduce) {
  .logo-chest, .seat.turn .avatar, .over-panel .win-avatar, .turn-hint.mine { animation: none; }
  .sticker-pop img { animation-name: fadeIn; }
}
.doc .todo { background: #fff3a0; color: #8a4b00; padding: 0 4px; border-radius: 4px; }
.captcha input:placeholder-shown { letter-spacing: 1px; }
.link.forgot { align-self: flex-end; font-size: 14px; margin-top: -2px; }
.modal-sub.warn { background: #fff3b0; border-radius: 12px; padding: 8px 10px; color: #8a4b00; }
.stats-sub { text-align: center; font-size: 13px; font-weight: 700; color: #8a7a66; margin: -4px 0 10px; }

/* ---------- поиск соперника ---------- */
/* главная кнопка меню: крупнее и ярче остальных */
.btn-play { font-size: 30px; letter-spacing: .5px; min-height: 76px; border-radius: 22px; --c1: #a6ff6a; --c2: #2fb52f; --sh: #1c7a19; }
.btn-play { box-shadow: 0 6px 0 var(--sh), 0 10px 22px rgba(47,181,47,.45), inset 0 2px 0 rgba(255,255,255,.5); }
.auth-note { margin: 0 0 12px; font-size: 15px; }
.search-panel { text-align: center; }
.search-chest { width: 110px; height: 100px; display: block; margin: 4px auto 6px; animation: searchBob 1.1s ease-in-out infinite; }
@keyframes searchBob { 0%, 100% { transform: translateY(0) rotate(-6deg); } 50% { transform: translateY(-10px) rotate(6deg); } }
.search-time { font-weight: 900; font-size: 34px; color: #5b3cc4; font-variant-numeric: tabular-nums; }
.search-stats { font-weight: 700; font-size: 14px; color: #8a7a66; min-height: 20px; margin-top: 4px; }
@media (prefers-reduced-motion: reduce) { .search-chest { animation: none; } }
.chat-mute { margin-left: auto; margin-right: 8px; border: 0; border-radius: 10px; padding: 6px 10px; cursor: pointer;
  background: rgba(255,255,255,.2); color: #fff; font: inherit; font-size: 13px; font-weight: 800; }
.chat-mute:hover { background: rgba(255,255,255,.32); }
