:root {
  --bg: #17201b;
  --panel: #223328;
  --panel2: #2b4033;
  --wood: linear-gradient(180deg, #6b3f1f 0%, #4a2a13 60%, #3a1f0d 100%);
  --wood-edge: #2c1508;
  --felt: radial-gradient(ellipse at 50% 40%, #2f8a4d 0%, #1f6b3a 55%, #145028 100%);
  --gold: #f2c14e;
  --gold2: #c9962a;
  --text: #f1efe6;
  --muted: #9fb3a5;
  --red: #d9483b;
  --green: #3fa35a;
  --blue: #3b82f6;
  --card-w: 56px;
  --card-h: 80px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; overflow: hidden; }
body { user-select: none; -webkit-user-select: none; }
#app { display: flex; flex-direction: column; height: 100dvh; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input, textarea { font: inherit; }
h3 { margin: 14px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.hidden { display: none !important; }

/* ---------- верхняя панель ---------- */
#topbar { display: flex; align-items: center; justify-content: space-between; padding: calc(6px + var(--safe-top)) 10px 6px; background: var(--wood); border-bottom: 2px solid var(--wood-edge); box-shadow: 0 2px 8px rgba(0,0,0,.4); z-index: 5; }
.tb-user { display: flex; align-items: center; gap: 8px; }
.tb-name { line-height: 1.15; }
#tb-nick { font-weight: 700; font-size: 15px; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-lvl { font-size: 11px; color: #e9d7b0; }
.tb-right { display: flex; align-items: center; gap: 8px; }
.coins { display: flex; align-items: center; gap: 5px; background: rgba(0,0,0,.35); border: 1px solid var(--gold2); border-radius: 20px; padding: 4px 8px 4px 5px; font-size: 14px; }
.coins .plus { background: var(--gold); color: #3a1f0d; border-radius: 50%; width: 18px; height: 18px; display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: 15px; line-height: 1; }
.coin { width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle, #f4fff8 0 28%, transparent 30% 42%, #1f8a4a 44% 70%, #0d5a30 72%); box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3px #0d5a30; display: inline-block; flex: 0 0 auto; }
.coin.big { width: 22px; height: 22px; }
.online { font-size: 12px; color: #8ee08e; }

/* ---------- аватары ---------- */
.avatar { width: 44px; height: 44px; border-radius: 50%; background: #2b4033 center/cover no-repeat; display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; font-size: 16px; position: relative; flex: 0 0 auto; border: 2px solid #55705f; }
.avatar.sm { width: 36px; height: 36px; font-size: 14px; }
.avatar.lg { width: 84px; height: 84px; font-size: 32px; }
.avatar.frame-silver { border: 3px solid #cfd8dc; box-shadow: 0 0 0 1px #7a8a90, 0 0 8px #cfd8dc88; }
.avatar.frame-gold { border: 3px solid var(--gold); box-shadow: 0 0 0 1px #8a6a1f, 0 0 10px #f2c14e88; }
.avatar.frame-fire { border: 3px solid #ff7a1a; box-shadow: 0 0 0 1px #7a2a00, 0 0 14px #ff5a00aa; }

/* ---------- экраны ---------- */
#screens { flex: 1; position: relative; overflow: hidden; }
.screen { position: absolute; inset: 0; overflow-y: auto; padding: 10px 12px 16px; display: none; -webkit-overflow-scrolling: touch; }
.screen.active { display: block; }
#s-game { padding: 0; overflow: hidden; }

/* ---------- кнопки ---------- */
.btn { border-radius: 12px; padding: 10px 14px; font-weight: 700; background: var(--panel2); color: var(--text); box-shadow: 0 3px 0 rgba(0,0,0,.35); transition: transform .08s; font-size: 14px; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,.35); }
.btn.big { padding: 14px; font-size: 16px; flex: 1; }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.gold { background: linear-gradient(180deg, #ffd977, #e0a92e); color: #3a1f0d; }
.btn.green { background: linear-gradient(180deg, #4dbb6c, #2e8b48); }
.btn.red { background: linear-gradient(180deg, #e46a5e, #b93a2e); }
.btn.blue { background: linear-gradient(180deg, #5b9cff, #2c6fd6); }
.btn.ghost { background: transparent; box-shadow: inset 0 0 0 1.5px #55705f; }
.btn:disabled { opacity: .45; }
.link { color: var(--gold); font-size: 13px; }

/* ---------- лобби ---------- */
.lobby-actions { display: flex; gap: 10px; margin-bottom: 10px; }
.filters { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; background: var(--panel); border: 1px solid #3a5544; border-radius: 20px; padding: 6px 11px; font-size: 12px; white-space: nowrap; color: #d9e4dc; }
.chip.on { background: #3a6b4a; border-color: #6fcf8a; color: #fff; }
.chip.reset { border-color: #7a4a3a; color: #f0a090; }
.list-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin: 4px 0 8px; }
.rooms { display: flex; flex-direction: column; gap: 8px; }
.room { background: var(--panel); border-radius: 14px; padding: 10px 12px; display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; border: 1px solid #2f4a3a; position: relative; }
.room.full { opacity: .6; }
.room .r-title { font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.room .r-bet { display: flex; align-items: center; gap: 5px; font-weight: 800; color: var(--gold); font-size: 15px; justify-content: flex-end; }
.room .r-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { background: rgba(0,0,0,.3); border-radius: 6px; padding: 2px 6px; font-size: 11px; color: #cfe0d4; }
.tag.t { background: #4a3a70; color: #e0d0ff; }
.tag.c { background: #6b2f2f; color: #ffd0d0; }
.room .r-seats { display: flex; gap: 3px; justify-content: flex-end; align-items: center; }
.seat { width: 22px; height: 22px; border-radius: 50%; background: rgba(0,0,0,.35); border: 1.5px dashed #5f7d6a; }
.seat.busy { border: 1.5px solid #8ee08e; background: #3a6b4a center/cover; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; font-size: 14px; }

/* ---------- модальные окна ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; z-index: 50; animation: fade .15s; }
.modal-bg.center { align-items: center; padding: 16px; }
.modal { background: var(--panel); width: 100%; max-width: 520px; max-height: 88dvh; overflow-y: auto; border-radius: 18px 18px 0 0; padding: 14px 14px calc(14px + var(--safe-bottom)); border-top: 3px solid var(--gold2); }
.modal-bg.center .modal { border-radius: 18px; border: 2px solid var(--gold2); }
.modal h2 { margin: 0 0 12px; font-size: 18px; display: flex; justify-content: space-between; align-items: center; }
.modal h2 .x { font-size: 22px; color: var(--muted); padding: 0 6px; }
.frow { margin-bottom: 12px; }
.frow label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.seg { display: flex; gap: 4px; background: rgba(0,0,0,.3); border-radius: 10px; padding: 3px; flex-wrap: wrap; }
.seg button { flex: 1; padding: 8px 6px; border-radius: 8px; font-size: 13px; font-weight: 600; color: #bcd; min-width: 44px; }
.seg button.on { background: var(--green); color: #fff; }
.seg button.on.gold { background: var(--gold); color: #3a1f0d; }
.toggle { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid #2f4a3a; font-size: 14px; }
.toggle small { display: block; color: var(--muted); font-size: 11px; }
.sw { width: 44px; height: 26px; border-radius: 13px; background: #3a4d42; position: relative; transition: .15s; flex: 0 0 auto; }
.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .15s; }
.sw.on { background: var(--green); }
.sw.on::after { left: 21px; }
.inp { width: 100%; background: rgba(0,0,0,.3); border: 1px solid #3a5544; border-radius: 10px; padding: 10px; color: var(--text); outline: none; }
.mrow { display: flex; gap: 8px; margin-top: 10px; }
.mrow .btn { flex: 1; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }

/* ---------- тосты ---------- */
#toasts { position: fixed; top: calc(60px + var(--safe-top)); left: 0; right: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; z-index: 100; pointer-events: none; }
.toast { background: rgba(20,30,25,.95); border: 1px solid var(--gold2); color: #fff; padding: 8px 14px; border-radius: 12px; font-size: 13px; max-width: 90%; animation: fade .2s; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.toast.err { border-color: var(--red); }
#connecting { position: fixed; inset: 0; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; z-index: 200; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 4px solid #2f4a3a; border-top-color: var(--gold); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg) } }

/* ---------- навигация ---------- */
#nav { display: flex; background: var(--wood); border-top: 2px solid var(--wood-edge); padding-bottom: var(--safe-bottom); }
.nav-btn { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 7px 0 5px; gap: 1px; color: #cbb08a; font-size: 10px; position: relative; }
.nav-btn i { font-style: normal; font-size: 20px; }
.nav-btn.active { color: var(--gold); }
.badge { position: absolute; top: 4px; right: calc(50% - 20px); background: var(--red); color: #fff; border-radius: 10px; font-size: 10px; padding: 1px 5px; font-style: normal; }

/* ---------- списки игроков ---------- */
.plist { display: flex; flex-direction: column; gap: 6px; }
.prow { display: flex; align-items: center; gap: 10px; background: var(--panel); border-radius: 12px; padding: 8px 10px; }
.prow .pn { flex: 1; min-width: 0; }
.prow .pn b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .pn small { color: var(--muted); font-size: 11px; }
.prow .rank { width: 26px; text-align: center; font-weight: 800; color: var(--gold); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #666; display: inline-block; margin-right: 4px; }
.dot.on { background: #4ade80; }
.search-row { display: flex; gap: 6px; margin-bottom: 8px; }
.search-row input { flex: 1; background: rgba(0,0,0,.3); border: 1px solid #3a5544; border-radius: 10px; padding: 9px; color: var(--text); outline: none; }

/* ---------- профиль ---------- */
.prof-head { display: flex; gap: 14px; align-items: center; background: var(--panel); border-radius: 16px; padding: 14px; margin-bottom: 10px; }
.prof-head .pi { flex: 1; min-width: 0; }
.prof-head .pi h1 { margin: 0; font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prof-head .pi .st { color: var(--muted); font-size: 12px; margin: 2px 0 6px; }
.lvl-bar { height: 8px; background: rgba(0,0,0,.4); border-radius: 4px; overflow: hidden; margin-top: 4px; }
.lvl-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold2), var(--gold)); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.stat { background: var(--panel); border-radius: 12px; padding: 8px 4px; text-align: center; }
.stat b { display: block; font-size: 18px; }
.stat small { color: var(--muted); font-size: 10px; }
.ach-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ach { background: var(--panel); border-radius: 12px; padding: 8px 4px; text-align: center; font-size: 10px; color: var(--muted); }
.ach i { display: block; font-size: 26px; font-style: normal; filter: grayscale(1); opacity: .35; }
.ach.got { border: 1px solid var(--gold2); color: var(--text); }
.ach.got i { filter: none; opacity: 1; }
.gifts { display: flex; gap: 6px; flex-wrap: wrap; }
.gift { font-size: 26px; background: var(--panel); border-radius: 10px; padding: 4px 6px; }
.prof-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.prof-actions .btn { flex: 1; min-width: 100px; }

/* ---------- магазин ---------- */
.tabs { display: flex; background: rgba(0,0,0,.3); border-radius: 12px; padding: 3px; margin-bottom: 10px; }
.tab { flex: 1; padding: 8px; border-radius: 9px; font-size: 13px; color: #bcd; font-weight: 600; }
.tab.active { background: var(--panel2); color: #fff; }
.shop-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.shop-item { background: var(--panel); border-radius: 14px; padding: 10px 6px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; border: 1px solid transparent; }
.shop-item.eq { border-color: var(--gold); }
.shop-item .nm { font-size: 12px; font-weight: 600; }
.shop-item .pr { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--gold); }
.shop-item .btn { width: 100%; padding: 6px; font-size: 12px; }
.coin-pack { display: flex; align-items: center; gap: 12px; background: var(--panel); border-radius: 14px; padding: 12px; margin-bottom: 8px; }
.coin-pack .cp-n { flex: 1; font-weight: 800; font-size: 17px; display: flex; align-items: center; gap: 6px; }
.coin-pack .cp-b { color: #8ee08e; font-size: 11px; }

/* ---------- карты ---------- */
.card { width: var(--card-w); height: var(--card-h); border-radius: 7px; background: #fff; position: relative; box-shadow: 0 2px 5px rgba(0,0,0,.45); color: #111; font-weight: 800; flex: 0 0 auto; transition: transform .12s; overflow: hidden; }
.card.red { color: #d0202a; }
.card .tl, .card .br { position: absolute; font-size: 13px; line-height: 1; text-align: center; }
.card .tl { top: 4px; left: 4px; }
.card .br { bottom: 4px; right: 4px; transform: rotate(180deg); }
.card .ctr { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 30px; }
.card .tl small, .card .br small { display: block; font-size: 11px; }
/* лицевые стили */
.face-large .card .ctr { font-size: 26px; }
.face-large .card .tl, .face-large .card .br { font-size: 16px; }
.face-vintage .card { background: #f4ecd6; font-family: Georgia, serif; border: 1px solid #c8b78a; }
.face-vintage .card .ctr { opacity: .75; }
.face-minimal .card .ctr { display: none; }
.face-minimal .card .tl { font-size: 22px; top: 8px; left: 8px; }
.face-minimal .card .br { font-size: 22px; bottom: 8px; right: 8px; }
/* рубашки */
.card.back { background: #fff; padding: 4px; }
.card.back::before { content: ''; position: absolute; inset: 4px; border-radius: 4px; }
.back-classic::before { background: repeating-linear-gradient(45deg, #b83a2e 0 4px, #8e2a20 4px 8px), #b83a2e; border: 2px solid #f0e2c8; }
.back-blue::before { background: repeating-linear-gradient(-45deg, #2f5fd3 0 4px, #1f3f95 4px 8px); border: 2px solid #dfe8ff; }
.back-red::before { background: radial-gradient(circle, #ff8c7a 1px, transparent 1.5px) 0 0/8px 8px, #c0392b; border: 2px solid #ffe0d8; }
.back-gold::before { background: repeating-conic-gradient(#e5b740 0 25%, #b9871b 0 50%) 0 0/12px 12px; border: 2px solid #fff3c4; }
.back-emerald::before { background: linear-gradient(135deg, #0f7a4a 25%, #0b5c37 25% 50%, #0f7a4a 50% 75%, #0b5c37 75%) 0 0/14px 14px; border: 2px solid #c9f5dc; }
.back-night::before { background: radial-gradient(circle at 30% 30%, #fff 1px, transparent 1.5px) 0 0/10px 10px, radial-gradient(circle at 70% 60%, #fff 0.8px, transparent 1.3px) 0 0/14px 14px, #101a3a; border: 2px solid #8da0e0; }
.back-royal::before { background: repeating-linear-gradient(0deg, #4a1c6b 0 3px, #6a2b93 3px 6px), #4a1c6b; border: 2px solid var(--gold); box-shadow: inset 0 0 0 4px #4a1c6b, inset 0 0 0 5px var(--gold); }
.back-ornament::before { background: radial-gradient(circle, transparent 60%, #7a4a1a 61%) 0 0/12px 12px, #c98a3c; border: 2px solid #f5e0b8; }

/* ---------- игровой стол ---------- */
#game-root { position: absolute; inset: 0; background: var(--felt); display: flex; flex-direction: column; overflow: hidden; }
.g-top { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; background: rgba(0,0,0,.35); font-size: 12px; }
.g-top .g-info { display: flex; gap: 8px; align-items: center; }
.g-top .g-bank { color: var(--gold); font-weight: 800; display: flex; align-items: center; gap: 4px; }
.g-opps { display: flex; justify-content: space-around; align-items: flex-start; padding: 8px 6px 0; min-height: 88px; flex-wrap: wrap; gap: 4px; }
.opp { display: flex; flex-direction: column; align-items: center; width: 82px; position: relative; }
.opp .avatar { width: 46px; height: 46px; }
.opp .on { font-size: 11px; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 3px; text-align: center; }
.opp .oc { position: absolute; top: -4px; right: 8px; background: #fff; color: #111; font-size: 11px; font-weight: 800; border-radius: 6px; padding: 1px 5px; border: 1px solid #999; }
.opp .role { font-size: 9px; padding: 1px 6px; border-radius: 6px; margin-top: 2px; background: rgba(0,0,0,.4); color: #ddd; }
.opp .role.att { background: var(--red); color: #fff; }
.opp .role.def { background: var(--blue); color: #fff; }
.opp.out .avatar { opacity: .45; }
.opp .mini-hand { display: flex; margin-top: -8px; height: 14px; }
.opp .mini-hand i { width: 10px; height: 14px; background: #fff; border-radius: 2px; border: 1px solid #aaa; margin-left: -4px; display: block; }
.opp.turn .avatar { box-shadow: 0 0 0 3px var(--gold), 0 0 14px var(--gold); }
.timer-ring { position: absolute; top: -3px; left: 50%; transform: translateX(-50%); width: 52px; height: 52px; border-radius: 50%; pointer-events: none; }
.g-mid { flex: 1; display: flex; align-items: center; padding: 6px 8px; gap: 8px; min-height: 0; }
.g-deck { width: 74px; position: relative; height: 96px; flex: 0 0 auto; }
.g-deck .trump { position: absolute; left: 14px; top: 8px; transform: rotate(90deg) translate(0, -10px); }
.g-deck .pile { position: absolute; left: 0; top: 0; }
.g-deck .pile.p2 { transform: translate(2px, -2px); }
.g-deck .pile.p3 { transform: translate(4px, -4px); }
.g-deck .cnt { position: absolute; bottom: -18px; left: 0; width: 60px; text-align: center; font-size: 12px; color: #dfe; }
.g-deck .trumpsuit { position: absolute; top: -22px; left: 0; width: 56px; text-align: center; font-size: 20px; }
.g-table { flex: 1; display: flex; flex-wrap: wrap; gap: 8px 14px; justify-content: center; align-content: center; min-height: 100px; }
.pair { position: relative; width: calc(var(--card-w) + 18px); height: calc(var(--card-h) + 18px); }
.pair .card { position: absolute; }
.pair .a { top: 0; left: 0; }
.pair .d { top: 16px; left: 18px; }
.pair.target .a { box-shadow: 0 0 0 3px var(--gold), 0 0 12px var(--gold); }
.pair .cheat-q { position: absolute; top: -8px; right: -4px; background: var(--red); color: #fff; border-radius: 50%; width: 20px; height: 20px; font-size: 12px; display: flex; align-items: center; justify-content: center; }
.g-discard { width: 60px; position: relative; height: 96px; flex: 0 0 auto; }
.g-discard .card { position: absolute; left: 0; top: 4px; }
.g-discard .cnt { position: absolute; bottom: -18px; left: 0; width: 56px; text-align: center; font-size: 12px; color: #dfe; }
.g-status { text-align: center; font-size: 13px; padding: 4px; color: #fff; text-shadow: 0 1px 2px #000; min-height: 24px; }
.g-status b { color: var(--gold); }
.g-actions { display: flex; gap: 8px; justify-content: center; padding: 4px 10px; min-height: 48px; align-items: center; }
.g-actions .btn { padding: 9px 16px; font-size: 14px; }
.g-me { display: flex; align-items: flex-end; padding: 4px 8px calc(6px + var(--safe-bottom)); gap: 6px; background: linear-gradient(180deg, transparent, rgba(0,0,0,.35)); }
.g-me .me-info { display: flex; flex-direction: column; align-items: center; width: 56px; flex: 0 0 auto; font-size: 10px; gap: 2px; position: relative; }
.g-me .me-info .avatar { width: 40px; height: 40px; }
.me-timer { font-size: 13px; font-weight: 800; color: var(--gold); }
.me-timer.low { color: #ff6b5b; }
.hand { flex: 1; display: flex; justify-content: center; min-height: calc(var(--card-h) + 16px); align-items: flex-end; padding: 0 10px; overflow: visible; }
.hand .card { margin-left: var(--overlap, -18px); cursor: pointer; }
.hand .card:first-child { margin-left: 0; }
.hand .card.sel { transform: translateY(-16px); box-shadow: 0 0 0 3px var(--gold), 0 6px 14px rgba(0,0,0,.5); z-index: 2; }
.hand .card.can { box-shadow: 0 0 0 2px #8ee08e, 0 2px 5px rgba(0,0,0,.45); }
.hand .card.dim { opacity: .55; }
.hand .card.trump-mark::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--gold); }
.g-chat-btn { position: absolute; right: 8px; bottom: calc(130px + var(--safe-bottom)); background: rgba(0,0,0,.5); border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 18px; z-index: 3; }
.g-chat-btn .badge { top: -2px; right: -2px; }
.g-emo { position: absolute; left: 8px; bottom: calc(130px + var(--safe-bottom)); background: rgba(0,0,0,.5); border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 18px; z-index: 3; }
.bubble { position: absolute; top: 44px; left: 50%; transform: translateX(-50%); background: #fff; color: #111; border-radius: 10px; padding: 4px 8px; font-size: 12px; white-space: nowrap; max-width: 140px; overflow: hidden; text-overflow: ellipsis; z-index: 4; animation: fade .2s; }
.bubble::before { content: ''; position: absolute; top: -6px; left: 50%; margin-left: -6px; border: 6px solid transparent; border-top: 0; border-bottom-color: #fff; }

/* ожидание */
.wait { flex: 1; display: flex; flex-direction: column; padding: 14px; gap: 10px; overflow-y: auto; }
.wait .w-head { background: rgba(0,0,0,.35); border-radius: 14px; padding: 12px; }
.wait .w-head h2 { margin: 0 0 6px; font-size: 18px; }
.wait .w-seats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.wait .w-seat { background: rgba(0,0,0,.3); border-radius: 14px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; min-height: 96px; justify-content: center; border: 1.5px dashed #6fa982; }
.wait .w-seat.busy { border-style: solid; border-color: #8ee08e; }
.wait .w-seat .nm { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.wait .w-seat small { color: #bfe; }
.wait .w-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.wait .w-actions .btn { flex: 1; }
.chat-box { background: rgba(0,0,0,.35); border-radius: 12px; padding: 8px; font-size: 13px; max-height: 140px; overflow-y: auto; }
.chat-box .cm b { color: var(--gold); }
.chat-box .cm.sys { color: #bfe; font-style: italic; }
.chat-in { display: flex; gap: 6px; }
.chat-in input { flex: 1; background: rgba(0,0,0,.35); border: 1px solid #3a5544; border-radius: 10px; padding: 8px; color: #fff; outline: none; }

/* результаты */
.res-title { font-size: 22px; text-align: center; margin: 6px 0 10px; }
.res-row { display: flex; justify-content: space-between; padding: 8px 4px; border-bottom: 1px solid #2f4a3a; font-size: 14px; }
.res-row.me { color: var(--gold); font-weight: 700; }
.res-delta.pos { color: #8ee08e; } .res-delta.neg { color: #ff8b7b; }
.emo-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.emo-grid button { font-size: 26px; padding: 6px; background: rgba(0,0,0,.3); border-radius: 10px; }
.quick-phrases { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.quick-phrases button { background: rgba(0,0,0,.3); border-radius: 10px; padding: 6px 10px; font-size: 13px; }

@media (min-width: 480px) { :root { --card-w: 64px; --card-h: 92px; } }
@media (max-height: 640px) { :root { --card-w: 48px; --card-h: 70px; } .g-opps { min-height: 76px; } }
