/* Покер (вид #poker). Все селекторы начинаются с #stage-poker или с класса poker-. */

#stage-poker {
  display: block; min-height: 0; padding: 14px;
  border-style: solid; border-color: var(--border);
}
#stage-poker .poker-root { width: 100%; min-width: 0; }
.poker-root .btn, .poker-modal .btn { min-height: 44px; }
.poker-root .btn-lg { min-height: 48px; }
.poker-lbl { display: block; font-size: 14px; font-weight: 600; color: var(--text-2); margin-top: 2px; }
.poker-sum { font-size: 14px; }
.poker-err { font-size: 14px; color: var(--red-ink); font-weight: 600; margin: 0; }
.poker-hint { font-size: 13px; margin: 0; }
.poker-hint.is-err { color: var(--red-ink); }
.poker-btn-danger { background: var(--raised); color: var(--red-ink); border-color: rgba(247, 75, 75, .45); }
.poker-btn-danger:hover:not(:disabled) { background: rgba(247, 75, 75, .16); }

/* ===================== лобби ===================== */
.poker-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 10px; }
.poker-join { display: flex; gap: 8px; flex: 1 1 320px; min-width: 0; margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
.poker-join input {
  flex: 0 1 180px; min-width: 0; min-height: 44px;
  text-transform: uppercase; letter-spacing: .14em; font: 800 16px var(--font-h);
}
.poker-note { font-size: 14px; margin-bottom: 14px; }
.poker-empty { font-size: 15px; padding: 18px 0; }
.poker-tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.poker-tcard {
  display: flex; flex-direction: column; gap: 10px; min-width: 0;
  padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
}
.poker-tcard-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.poker-tcard-name { font: 800 17px/1.25 var(--font-h); min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; }
.poker-tcard-meta { font-size: 14px; margin: 0; }
.poker-tcard-seats { display: flex; flex-wrap: wrap; gap: 6px; }
.poker-mini {
  width: 36px; height: 36px; flex: none; border-radius: 50%; overflow: hidden;
  display: inline-grid; place-items: center;
  background: var(--raised); border: 1px solid var(--border-2);
}
.poker-mini svg { width: 100%; height: 100%; display: block; }
.poker-mini.is-free { background: transparent; border-style: dashed; border-color: var(--border); }
.poker-tcard-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: auto; font-size: 14px; }

/* ===================== шапка стола ===================== */
.poker-frozen {
  margin-bottom: 12px; padding: 10px 12px; border-radius: var(--r-btn);
  background: rgba(247, 75, 75, .14); border: 1px solid rgba(247, 75, 75, .5);
  color: var(--red-ink); font-weight: 700;
}
.poker-top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-bottom: 12px; min-width: 0; }
.poker-title { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; flex: 1 1 200px; }
.poker-title h3 { font: 800 19px/1.2 var(--font-h); min-width: 0; overflow-wrap: anywhere; }
.poker-code {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px;
  background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-btn);
  font: 800 16px/1 var(--font-h); letter-spacing: .16em;
}
.poker-code:hover { border-color: var(--blue); }
.poker-code-copy { font: 700 13px var(--font-b); letter-spacing: 0; color: var(--blue); }
.poker-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }

/* ===================== сукно ===================== */
.poker-felt {
  position: relative; width: 100%; max-width: 780px; margin: 0 auto;
  aspect-ratio: 16 / 10; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 45%, #1C9663 0%, #0F6B46 55%, #0A4A31 100%);
  border: 12px solid #2B2118;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .07), inset 0 0 60px rgba(0, 0, 0, .35), 0 18px 40px rgba(0, 0, 0, .45);
}
.poker-center {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 56%; display: flex; flex-direction: column; align-items: center; gap: 8px;
  text-align: center; pointer-events: none;
}
.poker-street { font: 800 13px/1 var(--font-h); text-transform: uppercase; letter-spacing: .08em; color: rgba(255, 255, 255, .72); }
.poker-pot { font: 900 20px/1.1 var(--font-h); color: var(--gold); text-shadow: 0 2px 0 rgba(0, 0, 0, .35); font-variant-numeric: tabular-nums; min-height: 22px; }
.poker-board { display: flex; gap: 6px; justify-content: center; flex-wrap: nowrap; }
.poker-seats { position: absolute; inset: 0; }

/* место */
.poker-seat {
  position: absolute; transform: translate(-50%, -50%);
  width: 124px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 2px 4px 4px; border-radius: var(--r-card);
}
.poker-seat.is-empty { justify-content: center; min-height: 52px; }
.poker-holes { display: flex; gap: 3px; }
.poker-av {
  position: relative; width: 52px; height: 52px; flex: none; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--border-2); overflow: hidden;
  display: grid; place-items: center;
}
.poker-av svg { width: 100%; height: 100%; display: block; }
.poker-seat.is-me .poker-av { border-color: var(--blue); }
.poker-seat.is-turn .poker-av { border-color: var(--green-hi); box-shadow: 0 0 0 3px rgba(0, 192, 125, .35); animation: poker-pulse 1.4s ease-in-out infinite; }
.poker-seat.is-fold .poker-av, .poker-seat.is-fold .poker-nm { opacity: .5; }
.poker-seat.is-out { opacity: .65; }
.poker-dealer {
  position: absolute; top: 24px; left: 50%; margin-left: 24px;
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--gold); color: #241A00; font: 900 12px/1 var(--font-h);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .5);
}
.poker-nm {
  max-width: 100%; padding: 2px 8px; border-radius: 6px;
  background: rgba(8, 22, 16, .78); color: var(--text);
  font: 800 13px/1.25 var(--font-h); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.poker-stk {
  padding: 1px 8px; border-radius: 6px; background: rgba(8, 22, 16, .7);
  color: var(--gold); font: 700 13px/1.25 var(--font-b); font-variant-numeric: tabular-nums;
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.poker-tag {
  padding: 2px 6px; border-radius: 4px; background: var(--raised); color: var(--text-2);
  font: 800 11px/1.2 var(--font-h); text-transform: uppercase; letter-spacing: .04em; white-space: nowrap;
}
.poker-tag.is-allin { background: var(--gold); color: #241A00; }
.poker-tag.is-fold { background: var(--border); color: var(--text-3); }
.poker-tag.is-warn { background: rgba(245, 197, 24, .2); color: #FFD35C; }
.poker-tag.is-wait { background: var(--border); color: var(--text-2); }
.poker-tbar { width: 100%; height: 4px; border-radius: 2px; overflow: hidden; background: rgba(0, 0, 0, .45); }
.poker-tbar i { display: block; height: 100%; width: 100%; background: var(--green-hi); }
.poker-sit {
  min-height: 44px; padding: 0 18px; border: 0; border-radius: 999px;
  background: var(--green); color: var(--ink); font: 800 15px/1 var(--font-h);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .35);
}
.poker-sit:hover:not(:disabled) { background: var(--green-hi); }
.poker-sit:disabled { opacity: .5; cursor: not-allowed; }
.poker-empty-lbl {
  padding: 4px 10px; border-radius: 999px; background: rgba(0, 0, 0, .25);
  color: var(--text-3); font: 700 12px/1.2 var(--font-b);
}

/* фишки ставок */
.poker-bet {
  position: absolute; transform: translate(-50%, -50%);
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 4px;
  border-radius: 999px; background: rgba(8, 22, 16, .72); color: var(--text);
  font: 700 13px/1.2 var(--font-b); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.poker-coin {
  width: 14px; height: 14px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 35%, #FFE58A, #F5C518 55%, #B7850A);
  border: 2px dashed rgba(36, 26, 0, .45);
}

/* карты */
.poker-pcard {
  position: relative; display: inline-flex; flex-direction: column; justify-content: space-between;
  flex: none; padding: 3px 4px; border-radius: 6px;
  background: #F7F7F5; border: 1px solid #C9CCCE; color: #171A1C;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .35);
  font-family: var(--font-h); font-weight: 900; line-height: 1; user-select: none;
}
.poker-pcard.is-red { color: #D6373B; }
.poker-pc-r { font-size: 15px; }
.poker-pc-s { align-self: flex-end; font-size: 16px; }
.poker-pcard-xl { width: 74px; height: 104px; }
.poker-pcard-xl .poker-pc-r { font-size: 24px; }
.poker-pcard-xl .poker-pc-s { font-size: 28px; }
.poker-pcard-md { width: 40px; height: 56px; }
.poker-pcard-md .poker-pc-r { font-size: 15px; }
.poker-pcard-md .poker-pc-s { font-size: 16px; }
.poker-pcard-sm { width: 26px; height: 36px; padding: 2px 3px; }
.poker-pcard-sm .poker-pc-r { font-size: 11px; }
.poker-pcard-sm .poker-pc-s { font-size: 12px; }
.poker-pcard.is-back {
  background: repeating-linear-gradient(45deg, #1D4E89 0 6px, #2663AD 6px 12px);
  border-color: #0F3260;
}
.poker-pcard.is-slot { background: rgba(0, 0, 0, .12); border: 1px dashed rgba(255, 255, 255, .25); box-shadow: none; }

/* вскрытие */
.poker-sd {
  margin-top: 14px; padding: 14px; border-radius: var(--r-card);
  background: var(--surface); border: 1px solid var(--border);
}
.poker-sd-title { font: 800 16px/1.2 var(--font-h); margin-bottom: 6px; }
.poker-sd-list { list-style: none; margin: 0; padding: 0; }
.poker-sd-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  padding: 8px 0; border-top: 1px solid var(--border);
}
.poker-sd-who { font: 800 15px/1.2 var(--font-h); flex: 1 1 120px; min-width: 0; overflow-wrap: anywhere; }
.poker-sd-row.is-me .poker-sd-who { color: var(--gold); }
.poker-sd-cards { display: flex; gap: 4px; }
.poker-sd-hand { font-size: 14px; flex: 1 1 140px; min-width: 0; }
.poker-sd-amt { margin-left: auto; font: 900 17px/1.2 var(--font-h); color: var(--green-ink); font-variant-numeric: tabular-nums; }

/* док: мои карты и панель хода */
.poker-dock { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 14px; margin-top: 14px; align-items: start; }
.poker-mine { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.poker-status { font: 800 17px/1.3 var(--font-h); margin: 0; }
.poker-status.is-you { color: var(--green-ink); }
.poker-sec { font: 700 14px/1.2 var(--font-b); color: var(--text-2); font-variant-numeric: tabular-nums; }
.poker-mycards { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-height: 104px; }
.poker-myempty { margin: 0; font-size: 14px; }
.poker-myhand { margin: 0; font-size: 14px; }

.poker-actions {
  display: flex; flex-direction: column; gap: 12px; min-width: 0;
  padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-card);
}
.poker-actions.is-busy { opacity: .75; }
.poker-btnrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }
.poker-btnrow .btn { width: 100%; min-height: 48px; }
.poker-fold { background: var(--raised); color: var(--red-ink); border-color: rgba(247, 75, 75, .4); }
.poker-fold:hover:not(:disabled) { background: rgba(247, 75, 75, .16); }
.poker-raise { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.poker-raise-top { display: flex; gap: 10px; align-items: flex-end; min-width: 0; }
.poker-raise-top .field { flex: 1 1 160px; min-width: 0; }
.poker-raise-top input { font-variant-numeric: tabular-nums; }
.poker-raise-go { min-height: 44px; flex: 0 0 auto; background: var(--gold); color: #241A00; white-space: nowrap; }
.poker-raise-go:hover:not(:disabled) { background: #FFD35C; }
.poker-raise input[type="range"] { width: 100%; }
.poker-quick button { min-height: 40px; }
.poker-opts button.is-on { background: var(--blue); border-color: var(--blue); color: #001A2E; font-weight: 800; }
.poker-opts button.is-on:hover { color: #001A2E; }
.poker-logbox {
  margin-top: 14px; padding: 12px 14px; border-radius: var(--r-card);
  background: var(--surface); border: 1px solid var(--border);
}
.poker-log-title { font: 800 14px/1.2 var(--font-h); margin-bottom: 6px; color: var(--text-2); }
.poker-log { list-style: none; margin: 0; padding: 0; max-height: 170px; overflow: auto; font-size: 14px; color: var(--text-2); }
.poker-log li + li { margin-top: 3px; }

/* ===================== анимация ===================== */
@keyframes poker-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(0, 192, 125, .35); }
  50% { box-shadow: 0 0 0 7px rgba(0, 192, 125, .12); }
}
#stage-poker .poker-root.is-calm *, .poker-modal.is-calm * { animation: none !important; transition: none !important; }

/* ===================== телефон (360–640) ===================== */
@media (max-width: 640px) {
  #stage-poker { padding: 10px; }
  .poker-join { margin-left: 0; justify-content: stretch; }
  .poker-join input { flex: 1 1 140px; }
  .poker-tables { grid-template-columns: 1fr; }
  .poker-bar > .btn { width: 100%; }
  .poker-tools { margin-left: 0; width: 100%; }
  .poker-tools .btn { flex: 1 1 0; padding: 0 10px; }
  .poker-felt { aspect-ratio: 4 / 5; border-width: 8px; }
  .poker-center { width: 58%; gap: 6px; }
  .poker-board { gap: 4px; }
  .poker-board .poker-pcard { width: 28px; height: 40px; }
  .poker-board .poker-pc-r { font-size: 12px; }
  .poker-board .poker-pc-s { font-size: 13px; }
  .poker-pot { font-size: 17px; }
  .poker-seat { width: 84px; gap: 2px; padding: 1px 2px 2px; }
  .poker-av { width: 40px; height: 40px; }
  .poker-dealer { top: 16px; margin-left: 18px; width: 18px; height: 18px; font-size: 10px; }
  .poker-nm, .poker-stk { font-size: 12px; }
  .poker-tag { font-size: 10px; }
  .poker-pcard-sm { width: 22px; height: 31px; }
  .poker-pcard-xl { width: 60px; height: 84px; }
  .poker-pcard-xl .poker-pc-r { font-size: 19px; }
  .poker-pcard-xl .poker-pc-s { font-size: 22px; }
  .poker-bet { font-size: 12px; padding: 2px 6px 2px 3px; }
  .poker-dock { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .poker-mycards { min-height: 84px; }
  .poker-raise-top { flex-wrap: wrap; }
  .poker-raise-top .field { flex: 1 1 100%; }
  .poker-raise-go { width: 100%; }
  .poker-sd-amt { margin-left: 0; }
}
