:root {
  --bg: #081a14;
  --felt: #0f5a3f;
  --felt2: #0a3f2c;
  --rail: #3b2414;
  --gold: #f2c14e;
  --text: #f3f1ea;
  --muted: #9fb8ad;
  --red: #e04848;
  --blue: #2f7ae0;
  --green: #22a35a;
  --card: #fbfaf6;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 15px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; touch-action: manipulation; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select { font: inherit; }

/* ───── кнопки ───── */
.btn { border: 0; border-radius: 12px; padding: 12px 14px; background: #24463a; color: var(--text);
  font-weight: 600; min-height: 48px; transition: transform .05s, filter .15s; }
.btn:active { transform: scale(.97); filter: brightness(1.2); }
.btn.primary { background: var(--gold); color: #2a1d00; }
.btn.big { width: 100%; font-size: 17px; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.fold { background: #5a2626; }
.btn.call { background: #1f5f8f; }
.btn.raise { background: #b8860b; color: #1c1300; }
.btn.mini { min-height: 38px; padding: 6px 10px; font-size: 13px; border-radius: 10px; flex: 1; }
.chip-btn { border: 0; background: rgba(255,255,255,.08); border-radius: 999px; padding: 8px 12px; font-size: 14px; }
.chip-btn.icon { width: 38px; height: 38px; padding: 0; }

/* ───── главная ───── */
.screen { height: 100dvh; }
#home { display: grid; place-items: center; padding: 20px; overflow: auto;
  background: radial-gradient(ellipse at 50% 30%, #13543c 0%, var(--bg) 70%); }
.home-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.logo { font-size: 44px; text-align: center; letter-spacing: 6px; }
.logo span { color: var(--red); } .logo .dia { color: var(--blue); }
h1 { margin: 0; text-align: center; font-size: 26px; }
.sub { margin: -6px 0 6px; text-align: center; color: var(--muted); }
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 13px; }
label input, label select, .sheet input { background: #12352a; color: var(--text); border: 1px solid #2a5547;
  border-radius: 12px; padding: 12px; font-size: 16px; }
.hint { color: var(--muted); font-size: 13px; text-align: center; margin: 0; }

/* ───── экран стола ───── */
#game { display: grid; grid-template-rows: auto 1fr auto; padding-top: var(--safe-t);
  background: radial-gradient(ellipse at 50% 45%, #0f3b2c 0%, var(--bg) 75%); overflow: hidden; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.t-info { flex: 1; text-align: center; color: var(--muted); font-size: 13px; }
.conn { position: fixed; top: calc(var(--safe-t) + 52px); left: 50%; transform: translateX(-50%); z-index: 50;
  background: #8a5a00; padding: 6px 14px; border-radius: 999px; font-size: 13px; }

.felt-wrap { position: relative; padding: 46px 44px 70px; min-height: 0; display: flex; }
.felt { position: relative; flex: 1; border-radius: 48% / 34%;
  background: radial-gradient(ellipse at 50% 40%, var(--felt) 0%, var(--felt2) 80%);
  box-shadow: 0 0 0 10px var(--rail), 0 0 0 12px #5a3a20, 0 18px 40px rgba(0,0,0,.6), inset 0 0 60px rgba(0,0,0,.45); }
.felt-inner { position: absolute; inset: 14px; border-radius: inherit; border: 2px solid rgba(255,255,255,.06); }
.center { position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%); width: 92%;
  display: flex; flex-direction: column; align-items: center; gap: 8px; }
.board { display: flex; gap: 4px; justify-content: center; }
.board .card { width: min(15vw, 54px); height: min(21vw, 76px); font-size: min(5vw, 20px); }
.pot { font-size: 14px; color: #e8f5ee; min-height: 18px; }
.pot b { color: var(--gold); }
.pot small { color: var(--muted); }
.result { text-align: center; font-size: 14px; min-height: 18px; }
.result .win { background: rgba(0,0,0,.35); border-radius: 999px; padding: 4px 12px; margin-top: 2px; }
.result .win b { color: var(--gold); }
.result small { color: var(--muted); }

/* ───── карты ───── */
.card { width: 30px; height: 42px; border-radius: 5px; background: var(--card); color: #111;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  box-shadow: 0 2px 4px rgba(0,0,0,.4); font-weight: 700; font-size: 13px; position: relative; }
.card .r { font-size: 1.05em; letter-spacing: -1px; }
.card .su { font-size: 1.1em; }
.card.s-h { color: #d12b2b; } .card.s-d { color: #1f66d1; } .card.s-c { color: #138a3e; } .card.s-s { color: #111; }
.card.back { background: repeating-linear-gradient(45deg, #8b1d2c 0 4px, #a8293b 4px 8px); border: 2px solid #f1e6d0; }
.card.slot { background: rgba(255,255,255,.05); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.card.big { width: 50px; height: 70px; font-size: 21px; border-radius: 7px; }

/* ───── места ───── */
.seat { position: absolute; transform: translate(-50%, -50%); width: 84px;
  display: flex; flex-direction: column; align-items: center; z-index: 2; }
.seat.empty { width: 66px; height: 40px; border-radius: 999px; border: 1px dashed rgba(255,255,255,.35);
  background: rgba(0,0,0,.25); color: var(--muted); font-size: 13px; }
.pod { position: relative; width: 100%; background: rgba(10,20,16,.92); border: 2px solid #2b4a3f;
  border-radius: 12px; padding: 4px 4px 6px; text-align: center; overflow: hidden; }
.nm { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.st { font-size: 14px; font-weight: 700; color: var(--gold); }
.hole { display: flex; gap: 2px; margin-bottom: -4px; z-index: 1; position: relative; }
.seat.me .hole { gap: 4px; margin-bottom: -6px; }
.seat.me { width: 120px; }
.seat.turn .pod { border-color: var(--gold); box-shadow: 0 0 14px rgba(242,193,78,.55); }
.seat.folded .hole { opacity: .25; }
.seat.folded .pod { opacity: .6; }
.seat.away .pod, .seat.offline .pod { opacity: .5; }
.seat.winner .pod { border-color: #5fe08f; box-shadow: 0 0 16px rgba(95,224,143,.6); }
.dealer { position: absolute; top: 3px; right: 3px; width: 17px; height: 17px; border-radius: 50%;
  background: #fff; color: #111; font-size: 10px; font-weight: 800; line-height: 17px; }
.tag { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; }
.hn { font-size: 11px; color: #9ff0c0; white-space: nowrap; }
.timer { position: absolute; left: 0; bottom: 0; height: 4px; background: var(--gold);
  width: calc(var(--start) * 100%); animation: shrink var(--dur) linear forwards; }
@keyframes shrink { to { width: 0; } }

.bet { position: absolute; background: rgba(0,0,0,.55); border: 1px solid rgba(242,193,78,.6); color: var(--gold);
  font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.bet::before { content: "●"; color: #e04848; margin-right: 4px; font-size: 10px; }
.seat.bottom .bet { top: -30px; }
.seat.top .bet { bottom: -26px; }
.seat.left .bet { left: calc(100% + 4px); top: 40%; }
.seat.right .bet { right: calc(100% + 4px); top: 40%; }
.seat.bottom.me .bet { top: -26px; left: calc(100% + 2px); }

.bubble { position: absolute; top: -22px; left: 50%; transform: translateX(-50%); background: #fff; color: #111;
  border-radius: 12px; padding: 4px 8px; font-size: 12px; max-width: 150px; z-index: 10; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; animation: pop .25s ease-out; box-shadow: 0 4px 12px rgba(0,0,0,.4); }
.bubble.big { font-size: 34px; background: none; box-shadow: none; padding: 0; top: -36px; animation: float 2.5s ease-out forwards; }
@keyframes pop { from { transform: translateX(-50%) scale(.6); opacity: 0; } }
@keyframes float { 0% { transform: translateX(-50%) scale(.5); } 15% { transform: translateX(-50%) scale(1.2); } 100% { transform: translate(-50%, -30px); opacity: 0; } }

/* ───── действия ───── */
.actions { padding: 8px 10px calc(10px + var(--safe-b)); min-height: 76px; display: flex; flex-direction: column; justify-content: center; }
.actions .row { display: flex; gap: 8px; }
.actions .row .btn { flex: 1; font-size: 16px; }
.note { text-align: center; color: var(--muted); font-size: 14px; }
.raise-box { display: flex; flex-direction: column; gap: 8px; }
.presets { display: flex; gap: 6px; }
.slider-row { display: flex; gap: 8px; align-items: center; }
.slider-row .btn.mini { flex: 0 0 44px; font-size: 20px; }
input[type=range] { flex: 1; accent-color: var(--gold); height: 32px; }

/* ───── чат и листы ───── */
.chat-btn { position: relative; }
.badge { position: absolute; top: -2px; right: -2px; background: var(--red); border-radius: 999px; font-size: 11px;
  min-width: 18px; height: 18px; line-height: 18px; padding: 0 4px; }
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; display: flex; align-items: flex-end; }
.sheet-body { width: 100%; background: #10261e; border-radius: 18px 18px 0 0; padding: 16px 14px calc(16px + var(--safe-b));
  display: flex; flex-direction: column; gap: 10px; animation: up .2s ease-out; max-width: 560px; margin: 0 auto; }
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.chat-body { height: 70dvh; }
.chat-head { display: flex; justify-content: space-between; align-items: center; }
.chat-log { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; font-size: 14px; -webkit-user-select: text; user-select: text; }
.msg b { color: var(--gold); font-weight: 600; }
.msg.emo { font-size: 20px; }
.emoji-row { display: flex; gap: 4px; overflow-x: auto; }
.emoji { border: 0; background: rgba(255,255,255,.07); border-radius: 10px; font-size: 24px; padding: 6px 8px; }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; }
.chat-form .btn { width: 54px; }

.toast { position: fixed; left: 50%; bottom: calc(110px + var(--safe-b)); transform: translateX(-50%); z-index: 60;
  background: #f3f1ea; color: #111; padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 90vw;
  box-shadow: 0 6px 20px rgba(0,0,0,.5); }

/* широкие экраны (ПК): стол не растягиваем бесконечно */
@media (min-width: 700px) {
  #game { max-width: 560px; margin: 0 auto; }
  .chat-btn { position: relative; }
}
@media (max-height: 640px) {
  .card.big { width: 42px; height: 58px; font-size: 18px; }
  .felt-wrap { padding: 40px 42px 60px; }
}
