/* WePoker-inspired mobile portrait poker UI (original recreation) */
:root {
  --bg: #0b1220;
  --bg-2: #121a2b;
  --felt: #1b6b45;
  --felt-deep: #0f4a30;
  --rim: #c9a24a;
  --rim-dark: #8a6a28;
  --cream: #f4f1ea;
  --muted: #9aa3b5;
  --fold: #4a5568;
  --call: #2f80ed;
  --raise: #e67e22;
  --raise-hot: #f39c12;
  --chip: #f0c14b;
  --danger: #e74c3c;
  --ok: #27ae60;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  --app-w: min(100vw, 430px);
  --u: calc(var(--app-w) / 375);
  --vh: 1vh;
  --app-h: calc(var(--vh, 1vh) * 100);

  --font: "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --touch: max(44px, calc(44 * var(--u)));
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100%;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: calc(14 * var(--u));
  color: #1f2937;
  background: #d9e2ec;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

#app {
  position: relative;
  width: var(--app-w);
  height: var(--app-h);
  max-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: #eef3f8;
}

@media (min-width: 431px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at 50% 20%, #cfd9e6, #b8c5d4 70%);
  }
  #app {
    height: min(var(--app-h), 900px);
    border-radius: 28px;
    box-shadow: 0 0 0 1px rgba(15,23,42,0.06), 0 30px 80px rgba(15,23,42,0.18);
  }
}

.hidden { display: none !important; }

/* ========== Loading screen (GTOPoker splash) ========== */
.loading-screen {
  position: absolute;
  inset: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  background: #f5fbf8 url("../assets/bg.jpg") center / cover no-repeat;
  overflow: hidden;
}
.loading-screen.hidden { display: none !important; }
.loading-screen.leaving {
  animation: load-fade-out 0.4s ease forwards;
  pointer-events: none;
}
.loading-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 0;
  padding: calc(28 * var(--u) + var(--safe-top)) calc(20 * var(--u)) calc(22 * var(--u) + var(--safe-bottom));
}
.loading-logo {
  display: block;
  width: min(62%, calc(240 * var(--u)));
  height: auto;
  margin-top: calc(6 * var(--u));
  flex-shrink: 0;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.loading-pic {
  display: block;
  width: min(88%, calc(320 * var(--u)));
  height: auto;
  max-height: 48%;
  object-fit: contain;
  margin: calc(6 * var(--u)) auto calc(4 * var(--u));
  flex: 1 1 auto;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.loading-ui {
  width: 100%;
  flex-shrink: 0;
  padding: calc(4 * var(--u)) calc(8 * var(--u)) 0;
  text-align: center;
}
.loading-text {
  font-size: calc(16 * var(--u));
  font-weight: 800;
  color: #374151;
  margin-bottom: calc(14 * var(--u));
  letter-spacing: 0.02em;
}
.loading-bar-wrap {
  display: flex;
  align-items: center;
  gap: calc(10 * var(--u));
}
.loading-bar {
  flex: 1;
  height: calc(14 * var(--u));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.35);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04);
}
.loading-bar i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2dd4a8 0%, #5eead4 55%, #99f6e4 100%);
  box-shadow: 0 0 12px rgba(45, 212, 168, 0.55);
  transition: width 0.22s ease;
}
.loading-pct {
  min-width: calc(42 * var(--u));
  text-align: right;
  font-size: calc(14 * var(--u));
  font-weight: 700;
  color: #2dd4a8;
}
.loading-tip {
  margin-top: calc(16 * var(--u));
  font-size: calc(12 * var(--u));
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: calc(10 * var(--u));
}
.loading-tip::before,
.loading-tip::after {
  content: "";
  width: calc(28 * var(--u));
  height: 1px;
  background: #d1d5db;
}
.loading-tip span {
  white-space: nowrap;
}
@keyframes load-fade-out {
  to { opacity: 0; }
}

.view {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ========== Light lobby (hall) ========== */
.lobby-light {
  background: linear-gradient(180deg, #f5f8fc 0%, #e8eef5 55%, #e3eaf2 100%);
  color: #1f2937;
}

.hall-top {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: calc(10 * var(--u) + var(--safe-top)) calc(16 * var(--u)) calc(8 * var(--u));
  flex-shrink: 0;
}
.pill {
  display: flex;
  align-items: center;
  gap: calc(8 * var(--u));
  background: #fff;
  border-radius: 999px;
  padding: calc(8 * var(--u)) calc(12 * var(--u));
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}
.chip-pill b {
  font-size: calc(15 * var(--u));
  font-weight: 800;
  color: #111827;
}
.gem {
  width: calc(18 * var(--u));
  height: calc(18 * var(--u));
  border-radius: 4px;
  background: linear-gradient(135deg, #60a5fa, #2563eb);
  transform: rotate(45deg);
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}
.hall-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 calc(14 * var(--u)) calc(78 * var(--u) + var(--safe-bottom));
}

.duo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(10 * var(--u));
}
.hall-card {
  position: relative;
  border: none;
  text-align: left;
  border-radius: calc(18 * var(--u));
  padding: calc(16 * var(--u)) calc(14 * var(--u));
  min-height: calc(118 * var(--u));
  overflow: hidden;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  font: inherit;
  color: inherit;
}
.hall-card.create {
  background: linear-gradient(145deg, #dff8ef, #c8f0e0);
}
.hall-card.join {
  background: linear-gradient(145deg, #e0f2fe, #c7e8fb);
}
.hall-card.join .illus.pad {
  background: linear-gradient(160deg, #7dd3fc, #0ea5e9);
  box-shadow: 0 8px 16px rgba(14, 165, 233, 0.25);
}
.hall-card-text {
  position: relative;
  z-index: 2;
  max-width: 70%;
}
.hall-card-text strong {
  display: block;
  font-size: calc(17 * var(--u));
  font-weight: 800;
  color: #111827;
}
.hall-card-text span {
  display: block;
  margin-top: calc(6 * var(--u));
  font-size: calc(11 * var(--u));
  color: #6b7280;
  line-height: 1.4;
}

.practice-card {
  position: relative;
  width: 100%;
  margin-top: calc(12 * var(--u));
  border: none;
  text-align: left;
  border-radius: calc(18 * var(--u));
  padding: calc(16 * var(--u)) calc(16 * var(--u)) calc(16 * var(--u)) calc(16 * var(--u));
  min-height: calc(128 * var(--u));
  overflow: hidden;
  cursor: pointer;
  font: inherit;
  color: inherit;
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 45%, #fed7aa 100%);
  box-shadow: 0 10px 24px rgba(234, 88, 12, 0.12);
}
.practice-badge {
  display: inline-block;
  position: relative;
  z-index: 2;
  padding: calc(4 * var(--u)) calc(10 * var(--u));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: #ea580c;
  font-size: calc(11 * var(--u));
  font-weight: 800;
  letter-spacing: 0.04em;
}
.practice-body {
  position: relative;
  z-index: 2;
  margin-top: calc(10 * var(--u));
  max-width: 72%;
}
.practice-body strong {
  display: block;
  font-size: calc(17 * var(--u));
  font-weight: 800;
  color: #9a3412;
}
.practice-body p {
  margin-top: calc(6 * var(--u));
  font-size: calc(12 * var(--u));
  line-height: 1.45;
  color: #9a3412;
  opacity: 0.82;
}
.practice-cta {
  position: relative;
  z-index: 2;
  display: inline-flex;
  margin-top: calc(12 * var(--u));
  padding: calc(7 * var(--u)) calc(14 * var(--u));
  border-radius: 999px;
  background: #f97316;
  color: #fff;
  font-size: calc(12 * var(--u));
  font-weight: 800;
}
.practice-illus {
  right: calc(-2 * var(--u)) !important;
  top: 18% !important;
  bottom: auto !important;
  opacity: 0.92;
}

/* CSS illustrations */
.illus {
  position: absolute;
  right: calc(8 * var(--u));
  bottom: calc(6 * var(--u));
  width: calc(64 * var(--u));
  height: calc(64 * var(--u));
  z-index: 1;
  pointer-events: none;
}
.illus.clock {
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #86efac 0 38%, transparent 39%),
    linear-gradient(145deg, #4ade80, #16a34a);
  box-shadow: 0 8px 16px rgba(22, 163, 74, 0.28);
}
.illus.clock::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 22%;
  width: 3px;
  height: 28%;
  background: #14532d;
  transform: translateX(-50%);
  border-radius: 2px;
}
.illus.clock::after {
  content: "";
  position: absolute;
  right: 10%;
  bottom: 12%;
  width: 22%;
  height: 34%;
  background: #facc15;
  clip-path: polygon(50% 0, 100% 40%, 70% 40%, 70% 100%, 30% 100%, 30% 55%, 0 55%);
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.15));
}
.illus.pad {
  border-radius: calc(12 * var(--u));
  background: linear-gradient(160deg, #86efac, #22c55e);
  box-shadow: 0 8px 16px rgba(22, 163, 74, 0.25);
}
.illus.pad::before {
  content: "";
  position: absolute;
  inset: 18%;
  border-radius: 8px;
  background:
    linear-gradient(#fff3, #fff0),
    repeating-linear-gradient(90deg, #16653433 0 8px, transparent 8px 16px),
    repeating-linear-gradient(#16653433 0 8px, transparent 8px 16px);
}
.illus.spade {
  width: calc(88 * var(--u));
  height: calc(88 * var(--u));
  right: calc(-4 * var(--u));
  top: 28%;
  bottom: auto;
  background: radial-gradient(circle at 40% 35%, #fde68a, #f59e0b 55%, #b45309);
  border-radius: 42% 42% 48% 48%;
  clip-path: polygon(50% 8%, 90% 48%, 72% 78%, 50% 68%, 28% 78%, 10% 48%);
  box-shadow: 0 12px 24px rgba(180, 83, 9, 0.28);
  filter: drop-shadow(0 6px 10px rgba(180, 83, 9, 0.25));
}
.illus.spade::after {
  content: "♛";
  position: absolute;
  left: 50%;
  top: -2%;
  transform: translateX(-50%);
  font-size: calc(20 * var(--u));
  color: #fbbf24;
  text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.empty-area {
  margin-top: calc(22 * var(--u));
  text-align: center;
  padding: calc(16 * var(--u)) 0;
}
.empty-logo {
  font-size: calc(34 * var(--u));
  font-weight: 900;
  letter-spacing: 0.02em;
  color: rgba(148, 163, 184, 0.35);
  user-select: none;
}
#empty-hint {
  margin-top: calc(8 * var(--u));
  color: #94a3b8;
  font-size: calc(14 * var(--u));
}

.bottom-nav {
  position: absolute;
  left: 50%;
  bottom: calc(12 * var(--u) + var(--safe-bottom));
  transform: translateX(-50%);
  width: calc(100% - 28 * var(--u));
  max-width: calc(360 * var(--u));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: calc(2 * var(--u));
  padding: calc(8 * var(--u));
  border-radius: 999px;
  background: #2b303b;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.28);
  z-index: 20;
}
.nav-item {
  flex: 1;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.78);
  font: inherit;
  font-size: calc(12 * var(--u));
  font-weight: 600;
  padding: calc(8 * var(--u)) 0;
  cursor: pointer;
}
.nav-item.active { color: #111827; }
.nav-active-pill {
  display: inline-flex;
  align-items: center;
  gap: calc(4 * var(--u));
  background: #b8f0cf;
  border-radius: 999px;
  padding: calc(7 * var(--u)) calc(10 * var(--u));
  font-weight: 800;
  color: #111827;
}
.card-ico {
  width: calc(12 * var(--u));
  height: calc(16 * var(--u));
  border-radius: 2px;
  background: linear-gradient(180deg, #fff, #e2e8f0);
  border: 1px solid #94a3b8;
  display: inline-block;
}

/* Sheets */
.sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 60;
}
.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  background: #fff;
  border-radius: calc(22 * var(--u)) calc(22 * var(--u)) 0 0;
  padding: calc(10 * var(--u)) calc(18 * var(--u)) calc(20 * var(--u) + var(--safe-bottom));
  box-shadow: 0 -10px 40px rgba(15, 23, 42, 0.12);
  display: flex;
  flex-direction: column;
  gap: calc(12 * var(--u));
  animation: sheet-up 0.28s ease;
}
.sheet-handle {
  width: calc(40 * var(--u));
  height: 4px;
  border-radius: 999px;
  background: #d1d5db;
  margin: 0 auto calc(4 * var(--u));
}
.sheet h3 {
  font-size: calc(18 * var(--u));
  font-weight: 800;
  text-align: center;
  color: #111827;
}
.sheet label {
  display: flex;
  flex-direction: column;
  gap: calc(6 * var(--u));
  font-size: calc(12 * var(--u));
  color: #6b7280;
}
.sheet input,
.sheet select {
  font: inherit;
  font-size: calc(16 * var(--u));
  min-height: var(--touch);
  padding: calc(10 * var(--u)) calc(14 * var(--u));
  border: 1px solid #e5e7eb;
  border-radius: calc(12 * var(--u));
  background: #f8fafc;
  color: #111827;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
.code-input {
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-align: center;
  font-weight: 700;
}
.lobby-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: calc(10 * var(--u));
}
@keyframes sheet-up {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}

.btn {
  font: inherit;
  font-weight: 700;
  font-size: calc(15 * var(--u));
  border: none;
  border-radius: calc(12 * var(--u));
  min-height: var(--touch);
  padding: calc(10 * var(--u)) calc(14 * var(--u));
  background: #e5e7eb;
  color: #111827;
  cursor: pointer;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; }
.btn.primary {
  background: linear-gradient(180deg, #4ade80, #16a34a);
  color: #052e16;
}
.btn.ghost {
  background: #fff;
  border: 1px solid #d1d5db;
}
.btn.wide { width: 100%; }
.status-line {
  text-align: center;
  font-size: calc(12 * var(--u));
  color: #64748b;
  min-height: 1.2em;
  margin-top: calc(8 * var(--u));
}
.welcome-line {
  text-align: center;
  font-size: calc(14 * var(--u));
  color: #0f172a;
  font-weight: 700;
  margin-bottom: calc(8 * var(--u));
}
.profile-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(8 * var(--u));
  margin-bottom: calc(12 * var(--u));
}
.my-avatar-preview .seat-avatar,
.seat-avatar.preview {
  width: calc(72 * var(--u));
  height: calc(72 * var(--u));
  font-size: calc(32 * var(--u));
}
#btn-change-avatar { margin-bottom: calc(8 * var(--u)); }

.avatar-section {
  margin: calc(10 * var(--u)) 0;
}
.avatar-section-title {
  font-size: calc(12 * var(--u));
  color: #64748b;
  margin-bottom: calc(8 * var(--u));
}
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: calc(8 * var(--u));
  max-height: calc(220 * var(--u));
  overflow-y: auto;
  padding: 2px;
  margin-bottom: calc(12 * var(--u));
}
.avatar-pick {
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}
.avatar-pick .av-emoji {
  font-size: calc(20 * var(--u));
  line-height: 1;
}
.avatar-pick.selected {
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.28);
}

/* ========== Table (WePoker felt) ========== */
#view-table.table-wpk {
  color: #fff;
  background:
    radial-gradient(ellipse 70% 55% at 50% 45%, #1f7a4d 0%, #156b40 42%, #0d4f2e 72%, #0a3a24 100%);
}

.wpk-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: calc(10 * var(--u) + var(--safe-top)) calc(14 * var(--u) + var(--safe-right)) calc(6 * var(--u)) calc(14 * var(--u) + var(--safe-left));
  pointer-events: none;
}
.wpk-top > * { pointer-events: auto; }

.wpk-menu {
  width: calc(40 * var(--u));
  height: calc(40 * var(--u));
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: calc(8 * var(--u));
  cursor: pointer;
}
.wpk-menu span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: rgba(255,255,255,0.92);
  box-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.wpk-top-tools {
  display: flex;
  gap: calc(8 * var(--u));
}
.wpk-tool {
  border: none;
  border-radius: 999px;
  padding: calc(7 * var(--u)) calc(12 * var(--u));
  font: inherit;
  font-size: calc(12 * var(--u));
  font-weight: 700;
  background: rgba(0,0,0,0.35);
  color: #fff;
  backdrop-filter: blur(6px);
}
.wpk-tool.primary {
  background: linear-gradient(180deg, #3dd68c, #1faa63);
  color: #06361f;
}

.wpk-felt {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.wpk-oval {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 12%;
  bottom: 14%;
  border-radius: 50% / 46%;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(55, 170, 105, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 50%, transparent 58%, rgba(0,0,0,0.18) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,0.06),
    inset 0 0 40px rgba(0,0,0,0.12);
  pointer-events: none;
}

.wpk-center {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  width: min(78%, calc(280 * var(--u)));
  text-align: center;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(8 * var(--u));
  pointer-events: none;
}
.wpk-center .invite-btn,
.wpk-center .hero-cards { pointer-events: auto; }

.pot-ribbon {
  display: inline-flex;
  align-items: center;
  gap: calc(8 * var(--u));
  padding: calc(5 * var(--u)) calc(18 * var(--u));
  border-radius: 4px;
  background: linear-gradient(180deg, #1a6b45, #0f5234);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.12);
  clip-path: polygon(6% 0, 94% 0, 100% 50%, 94% 100%, 6% 100%, 0 50%);
  min-width: calc(120 * var(--u));
  justify-content: center;
}
.pot-ribbon-txt {
  font-size: calc(13 * var(--u));
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.95);
}
.pot-ribbon-val {
  font-size: calc(14 * var(--u));
  font-weight: 800;
  color: #ffe08a;
}

.invite-btn {
  border: none;
  border-radius: 999px;
  padding: calc(11 * var(--u)) calc(36 * var(--u));
  font: inherit;
  font-size: calc(16 * var(--u));
  font-weight: 700;
  color: #fff;
  background: rgba(40, 120, 90, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.18), 0 6px 16px rgba(0,0,0,0.2);
  backdrop-filter: blur(4px);
  cursor: pointer;
}
.invite-btn:active { transform: scale(0.98); }

.table-info {
  margin-top: calc(2 * var(--u));
  color: rgba(255,255,255,0.78);
  font-size: calc(11 * var(--u));
  line-height: 1.45;
}
.info-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: calc(10 * var(--u));
}
.info-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.info-item b { font-weight: 700; color: rgba(255,255,255,0.92); letter-spacing: 0.04em; }
.info-name {
  margin-top: 4px;
  font-size: calc(12 * var(--u));
  color: rgba(255,255,255,0.88);
}
.info-sub {
  margin-top: 2px;
  font-size: calc(10 * var(--u));
  color: rgba(255,255,255,0.55);
}
.info-sub .dot { margin: 0 3px; opacity: 0.6; }

.ico-chip, .ico-lock, .ico-clock {
  width: calc(12 * var(--u));
  height: calc(12 * var(--u));
  display: inline-block;
  border-radius: 2px;
  opacity: 0.85;
  background: currentColor;
}
.ico-chip {
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.25);
  background: #f0c14b;
}
.ico-lock {
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M17 8h-1V6a4 4 0 10-8 0v2H7a2 2 0 00-2 2v8a2 2 0 002 2h10a2 2 0 002-2v-8a2 2 0 00-2-2zM9 6a3 3 0 116 0v2H9V6zm8 12H7v-8h10v8z'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M17 8h-1V6a4 4 0 10-8 0v2H7a2 2 0 00-2 2v8a2 2 0 002 2h10a2 2 0 002-2v-8a2 2 0 00-2-2zM9 6a3 3 0 116 0v2H9V6zm8 12H7v-8h10v8z'/%3E%3C/svg%3E") center/contain no-repeat;
  background: #fff;
}
.ico-clock {
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 2a10 10 0 100 20 10 10 0 000-20zm1 11H7v-2h4V6h2v7z'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 2a10 10 0 100 20 10 10 0 000-20zm1 11H7v-2h4V6h2v7z'/%3E%3C/svg%3E") center/contain no-repeat;
  background: #fff;
}

.board {
  display: flex;
  gap: calc(4 * var(--u));
  min-height: 0;
  justify-content: center;
  z-index: 2;
}
.board:empty { display: none; }

/* Cards — poker asset pack */
.card {
  width: calc(34 * var(--u));
  height: calc(48 * var(--u));
  border-radius: calc(4 * var(--u));
  box-shadow: 0 3px 8px rgba(0,0,0,0.35);
  flex-shrink: 0;
  animation: deal 0.28s ease;
  object-fit: contain;
  display: block;
  background: transparent;
  border: none;
  padding: 0;
}
img.card.face { background: transparent; }
.card.back {
  background:
    linear-gradient(135deg, #1e3a8a 25%, #1d4ed8 25%, #1d4ed8 50%, #1e3a8a 50%, #1e3a8a 75%, #1d4ed8 75%);
  background-size: 10px 10px;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: calc(4 * var(--u));
  box-shadow: 0 3px 8px rgba(0,0,0,0.35);
}
@keyframes deal {
  from { opacity: 0; transform: translateY(-12px) scale(0.92); }
  to { opacity: 1; transform: none; }
}

.seats {
  position: absolute;
  inset: calc(8 * var(--u)) calc(2 * var(--u)) calc(56 * var(--u)) calc(2 * var(--u));
  z-index: 5;
}

.seat {
  position: absolute;
  width: calc(72 * var(--u));
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(4 * var(--u));
}
.seat.empty .seat-avatar {
  background: transparent !important;
  border: 2px dashed rgba(255,255,255,0.38);
  color: rgba(255,255,255,0.45);
  font-size: calc(22 * var(--u));
  font-weight: 400;
  box-shadow: none;
}
.seat-avatar {
  position: relative;
  width: calc(52 * var(--u));
  height: calc(52 * var(--u));
  border-radius: 50%;
  background: #64748b;
  border: 2px solid rgba(255,255,255,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(16 * var(--u));
  font-weight: 800;
  color: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  overflow: visible;
}
.seat-avatar .av-emoji {
  font-size: calc(24 * var(--u));
  line-height: 1;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25));
}
.seat.bot .seat-avatar {
  border-color: rgba(56, 189, 248, 0.85);
}
.seat.hero .seat-avatar {
  border-color: rgba(255,255,255,0.75);
  box-shadow: 0 0 0 2px rgba(255,255,255,0.15), 0 6px 16px rgba(0,0,0,0.4);
}
.seat.active .seat-avatar {
  box-shadow: 0 0 0 3px #fbbf24, 0 0 16px rgba(251, 191, 36, 0.55);
  animation: turn-glow 1.1s ease-in-out infinite;
}
@keyframes turn-glow {
  0%, 100% { box-shadow: 0 0 0 2px #fbbf24, 0 0 8px rgba(251,191,36,0.4); }
  50% { box-shadow: 0 0 0 4px #fde68a, 0 0 18px rgba(251,191,36,0.7); }
}

.dealer-btn {
  position: absolute;
  top: -2px;
  right: -2px;
  width: calc(16 * var(--u));
  height: calc(16 * var(--u));
  border-radius: 50%;
  background: #fbbf24;
  color: #422006;
  font-size: calc(9 * var(--u));
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.seat-name {
  font-size: calc(11 * var(--u));
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(72 * var(--u));
  color: rgba(255,255,255,0.95);
  text-shadow: 0 1px 3px rgba(0,0,0,0.55);
  order: -1;
}
.seat.empty .seat-name { display: none; }
.seat-stack {
  min-width: calc(44 * var(--u));
  padding: calc(2 * var(--u)) calc(10 * var(--u));
  border-radius: 999px;
  background: rgba(0,0,0,0.72);
  font-size: calc(12 * var(--u));
  font-weight: 700;
  color: #fff;
  line-height: 1.35;
}
.seat-bet {
  position: absolute;
  left: 50%;
  top: calc(-14 * var(--u));
  transform: translateX(-50%);
  min-width: calc(28 * var(--u));
  padding: 1px calc(6 * var(--u));
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(251, 191, 36, 0.45);
  color: #fde68a;
  font-size: calc(10 * var(--u));
  font-weight: 700;
  white-space: nowrap;
}
.seat-bet:empty { display: none; }
.seat.folded { opacity: 0.42; }
.seat.folded .seat-avatar { filter: grayscale(0.6); }

.seat-cards {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-10%, -70%);
  display: flex;
  gap: 2px;
  pointer-events: none;
  z-index: -1;
}
.seat-cards .card {
  width: calc(18 * var(--u));
  height: calc(26 * var(--u));
  border-radius: 2px;
}

.hero-cards {
  display: flex;
  gap: calc(6 * var(--u));
  margin-top: calc(4 * var(--u));
  justify-content: center;
}
.hero-cards.hidden { display: none; }
.hero-cards .card {
  width: calc(48 * var(--u));
  height: calc(68 * var(--u));
  border-radius: calc(5 * var(--u));
  box-shadow: 0 8px 20px rgba(0,0,0,0.45);
}

.wpk-dock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: calc(14 * var(--u));
  padding: calc(8 * var(--u)) calc(18 * var(--u) + var(--safe-right)) calc(10 * var(--u) + var(--safe-bottom)) calc(18 * var(--u) + var(--safe-left));
  pointer-events: none;
}
.wpk-dock .dock-btn { pointer-events: auto; }
.dock-spacer { flex: 1; }
.dock-btn {
  width: calc(36 * var(--u));
  height: calc(36 * var(--u));
  border: none;
  border-radius: 50%;
  background: transparent;
  color: rgba(255,255,255,0.85);
  font-size: calc(20 * var(--u));
  cursor: pointer;
  text-shadow: 0 1px 3px rgba(0,0,0,0.4);
}

/* Action bar — fold / call / raise */
.action-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 25;
  flex-shrink: 0;
  padding: calc(6 * var(--u)) calc(12 * var(--u) + var(--safe-right)) calc(12 * var(--u) + var(--safe-bottom)) calc(12 * var(--u) + var(--safe-left));
  background: linear-gradient(180deg, transparent, rgba(0,0,0,0.55) 28%);
  pointer-events: none;
}
.action-bar .quick-bets,
.action-bar .raise-row,
.action-bar .action-btns,
.action-bar .turn-hint { pointer-events: auto; }
#view-table.table-wpk .wpk-dock { opacity: 0.9; }
#view-table.acting .wpk-dock { opacity: 0.2; pointer-events: none; }
#action-bar:not(.my-turn) .action-btns,
#action-bar:not(.my-turn) .quick-bets,
#action-bar:not(.my-turn) .raise-row {
  opacity: 0;
  pointer-events: none;
  height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
}
#action-bar:not(.my-turn) .turn-hint {
  text-align: center;
  opacity: 0.55;
  font-size: calc(11 * var(--u));
}
.quick-bets {
  display: flex;
  gap: calc(6 * var(--u));
  margin-bottom: calc(8 * var(--u));
}
.qbet {
  flex: 1;
  min-height: calc(30 * var(--u));
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--cream);
  font: inherit;
  font-size: calc(11 * var(--u));
  font-weight: 700;
}
.qbet:active { background: rgba(255,255,255,0.14); }

.raise-row {
  display: flex;
  align-items: center;
  gap: calc(10 * var(--u));
  margin-bottom: calc(8 * var(--u));
}
.raise-row input[type=range] {
  flex: 1;
  height: var(--touch);
  accent-color: var(--raise);
}
#raise-label {
  min-width: calc(42 * var(--u));
  text-align: right;
  font-weight: 800;
  color: #fde68a;
  font-size: calc(14 * var(--u));
}

.action-btns {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: calc(8 * var(--u));
}
.act-btn {
  border: none;
  border-radius: calc(12 * var(--u));
  min-height: calc(50 * var(--u));
  font: inherit;
  font-size: calc(16 * var(--u));
  font-weight: 800;
  color: #fff;
  letter-spacing: 0.06em;
  box-shadow: 0 4px 0 rgba(0,0,0,0.25);
}
.act-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0,0,0,0.25);
}
.act-btn:disabled {
  opacity: 0.35;
  filter: grayscale(0.3);
  box-shadow: none;
}
.act-btn.fold {
  background: linear-gradient(180deg, #64748b, #475569);
}
.act-btn.call {
  background: linear-gradient(180deg, #3b9eff, #1d6fd8);
}
.act-btn.raise {
  background: linear-gradient(180deg, #f5a623, #e67e22);
  color: #1a1205;
}

.turn-hint {
  margin-top: calc(8 * var(--u));
  text-align: center;
  font-size: calc(11 * var(--u));
  color: var(--muted);
}

.toast {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--cream);
  padding: calc(10 * var(--u)) calc(16 * var(--u));
  border-radius: calc(12 * var(--u));
  font-size: calc(13 * var(--u));
  z-index: 50;
  max-width: 80%;
  text-align: center;
  pointer-events: none;
}

.orient-tip {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #0b1220;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--cream);
  font-size: calc(16 * var(--u));
}

@media (orientation: landscape) and (max-height: 500px) {
  .orient-tip { display: flex !important; }
  #app { visibility: hidden; }
}
@media (orientation: portrait) {
  .orient-tip { display: none !important; }
}

@media (max-height: 700px) and (orientation: portrait) {
  .hero-cards .card {
    width: calc(42 * var(--u));
    height: calc(58 * var(--u));
  }
  .seat-avatar {
    width: calc(46 * var(--u));
    height: calc(46 * var(--u));
  }
  .act-btn { min-height: calc(44 * var(--u)); font-size: calc(14 * var(--u)); }
}
