:root {
  color-scheme: dark;
  font-family: Inter, Vazirmatn, Tahoma, Arial, sans-serif;
  --bg: #06120f;
  --panel: #0e1b18;
  --panel-border: #284239;
  --text: #f5f7f2;
  --muted: #a8b8b1;
  --gold: #e3bb64;
  --green: #2bb673;
  --red: #e45858;
  --blue: #3d86d8;
  --control-surface: #101d19;
  --control-raised: #1b2d27;
  --focus: #8ff0bd;
  --warning: #f1b84b;
  --card-paper: #fffdf8;
  --card-edge: #c9c6bc;
  --card-back: #123f35;
  --card-back-gold: #d8b866;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  min-width: 300px;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

body { min-height: 100vh; min-height: 100dvh; overflow: hidden; }
button, input { font: inherit; }
button { border: 0; }
[hidden] { display: none !important; }

.auth-screen {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  padding: 20px;
  place-items: center;
  background-color: #071511;
  background-image: linear-gradient(rgb(2 14 10 / 32%), rgb(2 14 10 / 74%)), url('/assets/poker-table.png');
  background-position: center;
  background-size: cover;
}

.auth-panel {
  width: min(100%, 390px);
  padding: 24px;
  border: 1px solid #465d52;
  border-radius: 8px;
  background: rgb(7 19 16 / 94%);
  box-shadow: 0 24px 80px rgb(0 0 0 / 45%);
}

.auth-brand {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto;
  place-items: center;
  border: 1px solid #92753a;
  border-radius: 50%;
  color: var(--gold);
  font-size: 28px;
}

.auth-panel h1 { margin: 10px 0 18px; font-size: 22px; text-align: center; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid #31443c; }
.auth-tab { padding: 10px; color: var(--muted); background: transparent; cursor: pointer; }
.auth-tab.active { color: var(--text); border-bottom: 2px solid var(--green); }
.auth-panel form { display: grid; gap: 8px; margin-top: 16px; }
.auth-panel form > div { display: grid; gap: 8px; }
.auth-panel label { color: var(--muted); font-size: 12px; }
.auth-panel input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #3c5148;
  border-radius: 6px;
  outline: none;
  color: var(--text);
  background: #111f1b;
}
.auth-panel input:focus { border-color: var(--green); }
.auth-error { min-height: 18px; margin: 2px 0; color: #ff8d8d; font-size: 12px; }
.telegram-identity { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid #31443c; }
.telegram-identity img, #profile-photo { width: 42px; height: 42px; border-radius: 50%; object-fit: cover; }
.telegram-identity span, .profile-heading span { display: grid; gap: 2px; }
.telegram-identity small, .profile-heading small { color: var(--muted); font-size: 10px; }
.profile-heading { display: flex; align-items: center; gap: 9px; }
.telegram-message-link { display: block; margin: 8px 0; color: #64e6a3; font-size: 12px; font-weight: 800; }

.app-shell {
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr) auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

.topbar {
  position: relative;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 0 14px;
  border-bottom: 1px solid #1d312a;
  background: #091612;
}

.brand, .topbar-actions, .lobby-count, .account-summary { display: flex; align-items: center; }
.brand { gap: 8px; flex: 0 0 auto; font-size: 14px; font-weight: 800; }
.brand-mark { display: grid; width: 30px; height: 30px; place-items: center; border: 1px solid #856e3d; border-radius: 50%; color: var(--gold); }
.topbar-actions { min-width: 0; gap: 10px; }
.lobby-count { gap: 5px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.lobby-count strong { color: #6ee5a3; font-size: 13px; }
.people-icon { color: #6ee5a3; font-size: 6px; letter-spacing: 1px; }
.account-summary { min-width: 0; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.account-summary span:first-child { max-width: 120px; overflow: hidden; font-size: 11px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.account-summary span:last-child { color: var(--gold); font-size: 9px; }
.account-toggle { display: flex; min-width: 0; align-items: center; gap: 6px; padding: 5px 7px; border: 1px solid #31473e; border-radius: 6px; color: var(--text); background: #12231d; cursor: pointer; }
.account-toggle > span:last-child { color: #94aaa1; font-size: 16px; }
.account-menu { position: absolute; z-index: 30; top: 51px; right: 70px; width: min(340px, calc(100vw - 16px)); padding: 12px; border: 1px solid #496258; border-radius: 7px; background: #0a1713; box-shadow: 0 18px 55px rgb(0 0 0 / 55%); }
.account-menu header { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #294038; padding-bottom: 8px; }
.account-menu header strong { color: #78dfa6; font-size: 11px; }
.balance-grid { display: grid; margin: 12px 0; grid-template-columns: 1fr 1fr; gap: 8px; }
.balance-grid div { padding: 8px; border-left: 2px solid #9d7d3f; background: #11221c; }
.balance-grid dt { color: #8fa49b; font-size: 8px; font-weight: 900; }
.balance-grid dd { margin: 3px 0 0; color: #f2d284; font-size: 13px; font-weight: 900; }
.buy-in-control { display: grid; gap: 8px; }
.buy-in-control output { display: flex; min-height: 34px; align-items: baseline; justify-content: center; gap: 6px; }
.buy-in-control output span, .buy-in-control output small { color: #8fa49b; font-size: 8px; font-weight: 900; }
.buy-in-control output strong { min-width: 100px; color: #ffe3a0; font-family: Georgia, 'Times New Roman', serif; font-size: 23px; text-align: center; }
.buy-in-control input { width: 100%; accent-color: #d0a64f; cursor: grab; }
.buy-in-limits { display: flex; justify-content: space-between; color: #8fa49b; font-size: 8px; font-weight: 900; }
.leave-control { display: grid; gap: 8px; }
.leave-control p { margin: 0; color: #9db0a7; font-size: 9px; line-height: 1.45; }
.logout-button { padding: 6px 8px; border-radius: 5px; color: #d8e3de; background: #263b34; font-size: 10px; cursor: pointer; }
.admin-button { height: 30px; padding: 0 9px; border: 1px solid #96763c; border-radius: 5px; color: #f5d88f; background: #251f13; font-size: 9px; font-weight: 900; cursor: pointer; }
.icon-button { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 5px; color: var(--text); background: #243a32; font-size: 19px; cursor: pointer; }
.log-toggle { display: none; }
.sound-toggle[aria-pressed="true"] { color: #ffcf76; background: #3a2b18; }
.sound-control { display: grid; margin: 0 0 12px; padding: 10px 0 12px; gap: 8px; border-bottom: 1px solid #294038; }
.sound-control > label:first-child { display: flex; align-items: center; justify-content: space-between; color: #93a89f; font-size: 8px; font-weight: 900; }
.sound-control > label strong { color: #f0ce79; font-size: 10px; font-variant-numeric: tabular-nums; }
.sound-control > input[type="range"] { width: 100%; height: 24px; margin: 0; accent-color: #d0a64f; cursor: pointer; }
.mute-control { display: flex; min-height: 32px; align-items: center; gap: 8px; color: #c9d6d0; font-size: 9px; font-weight: 800; }
.mute-control input { width: 18px; height: 18px; margin: 0; accent-color: #d0a64f; }

.game-area { min-height: 0; padding: 8px; overflow: hidden; background: #030a08; }
.game-layout { display: grid; width: min(100%, 1200px); height: 100%; margin: auto; grid-template-columns: minmax(0, 1fr) 238px; grid-template-areas: 'table log'; gap: 8px; direction: ltr; }
.poker-table {
  position: relative;
  grid-area: table;
  min-width: 0;
  min-height: 390px;
  overflow: hidden;
  margin: 4px 0;
  border: 1px solid #8d7138;
  border-radius: 46% / 18%;
  background-color: #0b3b2b;
  background-image: linear-gradient(rgb(0 0 0 / 4%), rgb(0 0 0 / 8%)), url('/assets/poker-table.png');
  background-position: center;
  background-size: 100% 100%;
  box-shadow: 0 8px 28px rgb(0 0 0 / 65%), inset 0 0 48px rgb(0 0 0 / 36%);
  direction: rtl;
}

.seats { position: absolute; inset: 0; }
.seat {
  --bet-x: 0px;
  --bet-y: 0px;
  --hand-x: 82px;
  --hand-y: -10px;
  position: absolute;
  z-index: 2;
  display: grid;
  width: 130px;
  justify-items: center;
  gap: 4px;
  transform: translate(-50%, -50%);
  transition: opacity 180ms ease, filter 180ms ease;
}
.seat.position-0 { top: 75%; left: 50%; }
.seat.position-0 { --bet-y: -94px; --hand-x: 88px; --hand-y: -52px; }
.seat.position-1 { --bet-x: 122px; --bet-y: -50px; --hand-x: 84px; --hand-y: -28px; top: 72%; left: 8%; }
.seat.position-2 { --bet-x: 132px; --bet-y: 8px; --hand-x: 86px; --hand-y: -4px; top: 34%; left: 7%; }
.seat.position-3 { --bet-x: 72px; --bet-y: 99px; --hand-x: 80px; --hand-y: 30px; top: 18%; left: 23%; }
.seat.position-4 { --bet-x: -72px; --bet-y: 99px; --hand-x: -80px; --hand-y: 30px; top: 18%; left: 77%; }
.seat.position-5 { --bet-x: -133px; --bet-y: 8px; --hand-x: -86px; --hand-y: -4px; top: 50%; left: 93%; }
.seat.position-0 .player-identity { order: 3; }
.seat.position-0 .player-summary { order: 2; }
.seat.position-0 .cards { order: 1; }
.seat.folded .player-identity, .seat.folded .player-summary, .seat.folded .cards { opacity: 0.52; filter: grayscale(0.75); }
.seat.out .player-identity, .seat.out .player-summary, .seat.out .cards { opacity: 0.28; filter: grayscale(1); }
.seat.disconnected .player-identity, .seat.disconnected .player-summary, .seat.disconnected .cards { opacity: 0.58; filter: grayscale(0.7); }
.seat.weak-connection .player-avatar { border-color: #d7a84b; }
.seat.active .player-summary { border-color: #5be29d; box-shadow: 0 0 0 2px rgb(91 226 157 / 18%), 0 7px 20px rgb(0 0 0 / 22%); }

.player-identity { position: relative; display: grid; place-items: center; }
.player-avatar-frame {
  position: relative;
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
}
.player-avatar {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  overflow: hidden;
  border: 2px solid #b9954d;
  border-radius: 50%;
  object-fit: cover;
  color: #f5e3b3;
  background: #1b342c;
  box-shadow: 0 5px 16px rgb(0 0 0 / 45%);
  font-size: 22px;
  font-weight: 900;
}
.seat.active .player-avatar { border-color: #64e6a3; box-shadow: 0 0 0 3px rgb(100 230 163 / 20%), 0 5px 18px rgb(0 0 0 / 48%); }
.player-name-badge { position: absolute; z-index: 4; top: -13px; left: 50%; display: flex; max-width: 124px; min-width: 0; padding: 4px 8px; align-items: center; gap: 5px; border: 1px solid #8d743f; border-radius: 999px; color: #fff8df; background: #0a1713; box-shadow: 0 3px 10px rgb(0 0 0 / 40%); font-size: 11px; font-weight: 900; transform: translateX(-50%); white-space: nowrap; }
.player-name-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.player-presence { display: inline-grid; width: 13px; height: 13px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: rgb(255 255 255 / 6%); }
.presence-dot { display: block; width: 7px; height: 7px; border-radius: 50%; background: #52d58d; box-shadow: 0 0 0 2px rgb(82 213 141 / 12%); }
.presence-offline .presence-dot, .connection-status.offline .presence-dot { background: #ed6464; box-shadow: 0 0 0 2px rgb(237 100 100 / 14%); }
.presence-bars { display: flex; height: 10px; align-items: end; gap: 1px; }
.presence-bars i { display: block; width: 2px; border: 1px solid #e6b95c; border-radius: 1px 1px 0 0; background: transparent; }
.presence-bars i:nth-child(1) { height: 3px; }
.presence-bars i:nth-child(2) { height: 6px; }
.presence-bars i:nth-child(3) { height: 9px; }
.turn-timer {
  --timer-progress: 360deg;
  --timer-color: #4fdb92;
  position: absolute;
  z-index: 3;
  inset: -5px;
  border-radius: 50%;
  color: #fff;
  pointer-events: none;
}
.turn-timer::before {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--timer-color) var(--timer-progress), rgb(9 22 18 / 72%) 0);
  content: '';
  filter: drop-shadow(0 2px 4px rgb(0 0 0 / 55%));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
}
.turn-timer strong {
  position: absolute;
  bottom: 1px;
  left: 50%;
  display: grid;
  min-width: 25px;
  height: 18px;
  padding: 0 5px;
  place-items: center;
  border: 1px solid rgb(143 240 189 / 68%);
  border-radius: 999px;
  background: #0b1713;
  box-shadow: 0 3px 9px rgb(0 0 0 / 55%);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  transform: translateX(-50%);
}
.turn-timer.urgent { --timer-color: #ec5d5d; animation: timer-pulse 700ms ease-in-out infinite alternate; }
.turn-timer.urgent strong { border-color: rgb(236 93 93 / 78%); color: #fff0f0; }

.player-summary {
  width: 118px;
  min-width: 0;
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid rgb(255 255 255 / 15%);
  border-radius: 7px;
  background: rgb(5 15 13 / 88%);
  display: grid;
  place-items: center;
}
.player-roles { position: absolute; right: -7px; bottom: 1px; z-index: 4; display: flex; flex: 0 0 auto; gap: 3px; }
.role-button { display: inline-grid; min-width: 20px; height: 20px; padding: 0 4px; place-items: center; border-radius: 50%; color: #17130a; background: var(--gold); font-size: 8px; font-weight: 900; }
.role-sb { color: #e9f4ff; background: #3b789b; }
.role-bb { color: #e9fff4; background: #23734d; }
.stack { color: var(--gold); font-size: 10px; font-weight: 900; direction: ltr; text-align: center; }

.cards {
  position: absolute;
  z-index: 5;
  top: var(--hand-y);
  left: calc(50% + var(--hand-x));
  display: flex;
  min-height: 0;
  gap: 0;
  direction: ltr;
  transform: translateX(-50%) rotate(-2deg);
  filter: drop-shadow(0 4px 5px rgb(0 0 0 / 34%));
}
.seat .cards .card + .card { margin-left: -3px; transform: translateY(3px) rotate(3deg); }
.card {
  position: relative;
  display: flex;
  width: 40px;
  aspect-ratio: 0.7143;
  flex: 0 0 auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--card-edge);
  border-radius: 5px;
  background-color: var(--card-paper);
  background-image: linear-gradient(120deg, rgb(255 255 255 / 55%), transparent 38%);
  box-shadow: 0 1px 1px rgb(255 255 255 / 48%) inset, 0 5px 11px rgb(0 0 0 / 38%);
  isolation: isolate;
}
.card::after { position: absolute; z-index: 2; inset: 1px; border: 1px solid rgb(42 43 39 / 7%); border-radius: 3px; content: ''; pointer-events: none; }
.seat.position-0 .card { width: 48px; }
.card-face-sprite {
  position: absolute;
  z-index: 1;
  inset: 0;
  border-radius: inherit;
  background-image: url('/assets/cards/svg-cards-2.0.svg?v=2.0.1');
  background-position: var(--face-x) var(--face-y);
  background-repeat: no-repeat;
  background-size: 1300% 500%;
  filter: contrast(1.1) saturate(1.12);
}
.card.invalid { background: #fff repeating-linear-gradient(135deg, transparent 0 5px, #f4dddd 5px 7px); }
.card.back { border: 2px solid #ead99f; background-color: var(--card-back); background-image: linear-gradient(45deg, transparent 46%, rgb(216 184 102 / 30%) 47% 53%, transparent 54%), linear-gradient(-45deg, transparent 46%, rgb(216 184 102 / 22%) 47% 53%, transparent 54%); background-position: center; background-size: 9px 9px; box-shadow: 0 0 0 2px #0b2d27 inset, 0 0 0 3px rgb(234 217 159 / 52%) inset, 0 5px 11px rgb(0 0 0 / 42%); }
.card.back::before { position: absolute; z-index: 1; top: 50%; left: 50%; display: grid; width: 44%; aspect-ratio: 1; place-items: center; border: 1px solid rgb(234 217 159 / 82%); border-radius: 2px; color: var(--card-back-gold); background: #10372f; content: '♠'; font-family: Georgia, 'Times New Roman', serif; font-size: clamp(10px, 58%, 22px); transform: translate(-50%, -50%); }
.card.back::after { border-color: rgb(234 217 159 / 54%); }
.card.empty { border: 1px dashed rgb(255 255 255 / 22%); background: rgb(1 16 11 / 20%); box-shadow: none; }
.card.empty::after { display: none; }

.table-center { position: absolute; top: 52%; left: 48%; display: grid; width: 53%; gap: 8px; place-items: center; transform: translate(-50%, -50%); }
.dealer-stage { position: absolute; z-index: 2; top: 7.5%; left: 50%; display: grid; width: 340px; justify-items: center; pointer-events: none; transform: translate(-50%, -10%); transition: transform 500ms ease, opacity 250ms ease; }
.dealer-stage::after { position: absolute; z-index: 0; bottom: 7%; left: 50%; width: 34%; height: 10%; border-radius: 50%; content: ''; background: radial-gradient(ellipse, rgb(0 0 0 / 38%) 0, rgb(0 0 0 / 18%) 48%, transparent 76%); filter: blur(4px); transform: translateX(-50%); }
.dealer-character { position: relative; z-index: 1; width: 100%; height: auto; object-fit: contain; filter: drop-shadow(0 6px 8px rgb(0 0 0 / 24%)); transform: none; }
.dealer-stage.dealing { z-index: 5; }
.dealer-stage.dealing .dealer-character { animation: dealer-character-lean 1.2s ease-in-out infinite alternate; }
.table-stats { position: absolute; z-index: 3; top: 96%; left: 50%; display: grid; width: 138px; grid-template-columns: 54px 1fr; overflow: hidden; border: 1px solid rgb(196 153 70 / 58%); border-radius: 6px; direction: ltr; background: rgb(5 18 13 / 88%); box-shadow: 0 5px 14px rgb(0 0 0 / 28%); transform: translateX(-50%); }
.table-stats span { display: grid; min-width: 0; padding: 5px 7px; justify-items: center; color: #adbbb5; font-size: 7px; font-weight: 800; line-height: 1; }
.table-stats span + span { border-left: 1px solid rgb(196 153 70 / 32%); }
.table-stats strong { display: block; margin-top: 3px; color: #f3d184; font-size: 11px; font-variant-numeric: tabular-nums; line-height: 1; white-space: nowrap; }
.deal-announcement { position: absolute; z-index: 8; top: 46%; left: 50%; display: grid; justify-items: center; pointer-events: none; transform: translate(-50%, -50%); text-shadow: 0 2px 10px #000; }
.deal-announcement strong { color: #ffe39b; font-size: 20px; }
.deal-announcement span { color: #e7f3ed; font-size: 8px; font-weight: 900; }
.flying-card { position: absolute; z-index: 9; width: 28px; aspect-ratio: .7143; border: 2px solid #ead99f; border-radius: 5px; pointer-events: none; background-color: var(--card-back); background-image: linear-gradient(45deg, transparent 46%, rgb(216 184 102 / 30%) 47% 53%, transparent 54%), linear-gradient(-45deg, transparent 46%, rgb(216 184 102 / 22%) 47% 53%, transparent 54%); background-size: 8px 8px; box-shadow: 0 0 0 2px #0b2d27 inset, 0 5px 13px rgb(0 0 0 / 50%); }
.pot-chip { min-width: 78px; padding: 5px 10px; border: 1px solid #b58c3c; border-radius: 999px; color: #fff3d5; background: rgb(20 26 18 / 82%); font-size: 11px; font-weight: 800; text-align: center; }
.pot-breakdown { display: flex; min-height: 17px; flex-wrap: wrap; justify-content: center; gap: 4px; direction: ltr; }
.pot-breakdown span { padding: 3px 6px; border: 1px solid rgb(255 255 255 / 14%); border-radius: 4px; color: #d9e8e1; background: rgb(5 18 13 / 76%); font-size: 7px; font-weight: 900; }
.board { display: flex; width: 100%; min-height: 58px; justify-content: center; gap: 4px; direction: ltr; }
.board .card { width: clamp(58px, 6vw, 70px); }
.board .card.community-reveal { animation: community-card-reveal 420ms cubic-bezier(.2,.8,.2,1); }
.street-label { color: #dce9e2; font-size: 10px; font-weight: 700; text-shadow: 0 1px 3px #000; }

.game-log { grid-area: log; min-height: 0; overflow: hidden; border: 1px solid #263c34; border-radius: 7px; background: #0b1713; direction: ltr; }
.log-header { display: flex; height: 45px; align-items: center; justify-content: space-between; padding: 0 10px; border-bottom: 1px solid #294138; font-size: 12px; }
.log-header .icon-button { display: none; }
.log-list { height: calc(100% - 45px); margin: 0; padding: 8px 10px; overflow-y: auto; list-style: none; scrollbar-width: thin; }
.log-entry { position: relative; padding: 7px 2px 7px 12px; border-left: 1px solid #355348; color: #c9d8d1; font-size: 10px; line-height: 1.45; }
.log-entry::before { position: absolute; top: 11px; left: -4px; width: 7px; height: 7px; border-radius: 50%; content: ''; background: #568a76; }
.log-entry.deal { color: #f0cd7a; font-weight: 800; }
.log-entry.system { padding: 8px 7px 8px 12px; border-left-color: #cf5f5f; color: #ffd0d0; background: rgb(112 35 35 / 16%); font-weight: 800; }
.log-entry.system::before { background: #e66565; }
.log-entry strong { color: #fff; }
.log-cards { direction: ltr; unicode-bidi: isolate; }

.showdown-result { z-index: 7; display: grid; width: min(100%, 420px); max-height: 210px; padding: 8px 10px; overflow-y: auto; border: 1px solid rgb(224 189 105 / 48%); border-radius: 6px; background: rgb(5 20 15 / 94%); box-shadow: 0 8px 24px rgb(0 0 0 / 28%); animation: showdown-in 240ms ease-out; }
.showdown-result[hidden] { display: none; }
.showdown-result > span { margin-bottom: 4px; color: #d9ba6a; font-size: 8px; font-weight: 900; text-align: center; }
.showdown-winners { display: grid; gap: 8px; }
.showdown-winner { display: grid; min-width: 0; justify-items: center; gap: 5px; }
.showdown-winner + .showdown-winner { padding-top: 8px; border-top: 1px solid rgb(224 189 105 / 20%); }
.showdown-winner-summary { display: flex; width: 100%; min-width: 0; align-items: center; justify-content: center; gap: 10px; }
.showdown-winner-summary strong { max-width: 70%; overflow: hidden; color: #fff6d7; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.showdown-winner-summary b { flex: 0 0 auto; color: #72dfa8; font-size: 10px; font-variant-numeric: tabular-nums; }
.winning-cards { display: grid; grid-template-columns: repeat(5, 38px); justify-content: center; gap: 5px; direction: ltr; }
.winning-card { display: grid; min-width: 0; justify-items: center; gap: 2px; }
.winning-card .card { width: 38px; border-radius: 4px; }
.winning-card small { width: 100%; padding: 2px 1px; border-radius: 2px; color: #b8c9c1; background: #152720; font-size: 6px; font-weight: 900; line-height: 1; text-align: center; }
.winning-card.source-hand small { color: #fff0bc; background: #4b3b17; }
.winning-category { color: #f0cd73; font-size: 11px; font-weight: 900; text-align: center; }
.pot-chip.awarding { opacity: .22; transition: opacity 160ms ease; }
.pot-award-flight { position: absolute; z-index: 12; min-width: 66px; padding: 5px 8px; border: 2px dashed #f6dd9f; border-radius: 999px; color: #fff7d8; background: #14754c; font-size: 10px; font-weight: 900; text-align: center; pointer-events: none; box-shadow: 0 5px 18px rgb(0 0 0 / 48%); }

.action-panel { position: relative; z-index: 7; min-height: 112px; padding: 8px 14px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid #385148; background: linear-gradient(180deg, #10201b, #091511); box-shadow: 0 -12px 30px rgb(0 0 0 / 30%); }
.action-status-row { display: flex; width: min(100%, 860px); min-height: 22px; margin: 0 auto; align-items: center; justify-content: space-between; gap: 12px; }
.game-message { min-width: 0; overflow: hidden; color: #d8e2dd; font-size: 11px; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.connection-status { display: flex; flex: 0 0 auto; min-width: 0; align-items: center; justify-content: flex-end; gap: 5px; color: #a8beb4; font-size: 8px; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.connection-status.weak { color: #f0c66f; }
.connection-status.offline { color: #ff8b8b; }
.connection-status.offline .presence-dot { animation: connection-pulse 900ms ease-in-out infinite alternate; }
.action-feedback { width: min(100%, 860px); min-height: 28px; margin: 3px auto 5px; padding: 6px 10px; border-left: 3px solid #e26767; color: #ffd4d4; background: #321b1b; font-size: 10px; font-weight: 800; text-align: center; }
.action-feedback.timeout { border-color: var(--warning); color: #ffe5a9; background: #332817; }
.action-feedback.reconnecting { border-color: #e2a93d; color: #ffe3a8; background: #302616; }
.action-feedback.success { border-color: #58d291; color: #caffdf; background: #153125; }
.actions { display: grid; width: min(100%, 860px); min-height: 48px; margin: 6px auto 0; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
.command-button { position: relative; display: inline-flex; min-width: 0; min-height: 48px; padding: 8px 12px; align-items: center; justify-content: center; gap: 8px; border: 1px solid #466158; border-radius: 6px; color: #f7fbf8; background: var(--control-raised); box-shadow: inset 0 1px rgb(255 255 255 / 5%); font-size: 12px; font-weight: 900; font-variant-numeric: tabular-nums; cursor: pointer; transition: border-color 120ms ease, background 120ms ease, transform 120ms ease; }
.command-button:hover:not(:disabled) { border-color: #69857a; background: #243b33; }
.command-button:active:not(:disabled) { transform: translateY(1px); }
.command-button:focus-visible, .raise-step:focus-visible, .raise-close:focus-visible, .raise-control input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.command-button.primary { border-color: #22845a; background: #176c49; }
.command-button.check { border-color: #526d63; background: #243832; }
.command-button.raise { border-color: #397bab; background: #255f8d; }
.command-button.all-in { border-color: #b58b3f; color: #fff0bd; background: #47381f; }
.command-button.danger { border-color: #8f4b4b; color: #ffd5d5; background: #552929; }
.command-button:disabled { cursor: not-allowed; opacity: .42; filter: saturate(.5); }
.command-button.loading:disabled { opacity: .88; filter: none; }
.button-spinner { width: 15px; height: 15px; border: 2px solid rgb(255 255 255 / 28%); border-top-color: #fff; border-radius: 50%; animation: button-spin 650ms linear infinite; }
.command-button.raise-confirm { line-height: 1.15; white-space: normal; }
.raise-control { display: grid; width: min(100%, 860px); margin: 3px auto 8px; padding: 10px 12px; gap: 8px; border: 1px solid #405c51; border-radius: 7px; background: #0a1713; box-shadow: 0 8px 26px rgb(0 0 0 / 30%); direction: ltr; }
.raise-heading { display: grid; grid-template-columns: 86px minmax(0, 1fr) 44px; align-items: center; gap: 8px; }
.raise-heading > span { color: #9fb2aa; font-size: 9px; font-weight: 900; }
.raise-value { display: flex; min-height: 34px; align-items: baseline; justify-content: center; gap: 8px; color: #eaf3ee; }
.raise-value small { color: #91a69c; font-size: 7px; font-weight: 900; }
.raise-value strong { min-width: 120px; color: #ffe091; font-size: 24px; font-variant-numeric: tabular-nums; line-height: 1; text-align: center; text-shadow: 0 2px 12px rgb(255 205 92 / 20%); }
.raise-value.amount-changed strong { animation: raise-amount-pop 160ms ease-out; }
.raise-close, .raise-step { display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid #466158; border-radius: 5px; color: #eef5f1; background: #20352d; font-size: 23px; cursor: pointer; }
.raise-close { color: #aebdb7; background: transparent; font-size: 20px; }
.raise-step:disabled { cursor: not-allowed; opacity: .35; }
.raise-adjuster { display: grid; grid-template-columns: 44px minmax(120px, 1fr) 44px; align-items: center; gap: 10px; }
.raise-track-group { display: grid; gap: 4px; }
.raise-limits { display: flex; justify-content: space-between; color: #91a79d; font-size: 8px; font-weight: 900; font-variant-numeric: tabular-nums; }
.raise-limits span:last-child { color: #efc96e; }
.raise-control input { width: 100%; height: 24px; margin: 0; cursor: grab; appearance: none; background: transparent; }
.raise-control input:active { cursor: grabbing; }
.raise-control input::-webkit-slider-runnable-track { height: 8px; border: 1px solid #49655a; border-radius: 4px; background: linear-gradient(90deg, #d0a64f var(--raise-progress, 0%), #263c34 var(--raise-progress, 0%)); }
.raise-control input::-webkit-slider-thumb { width: 24px; height: 24px; margin-top: -9px; border: 3px solid #ffdfa0; border-radius: 50%; appearance: none; background: #16774d; box-shadow: 0 2px 8px rgb(0 0 0 / 48%); }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.player-chips {
  position: absolute;
  z-index: 6;
  top: 40px;
  left: 50%;
  display: grid;
  width: 86px;
  height: 52px;
  justify-items: center;
  pointer-events: none;
  transform: translate(calc(-50% + var(--bet-x)), calc(-50% + var(--bet-y)));
  filter: drop-shadow(0 4px 4px rgb(0 0 0 / 42%));
}
.player-chips i { position: absolute; width: 28px; height: 9px; border: 2px dashed #f9e8b7; border-radius: 50%; background: #ba2841; box-shadow: 0 2px 0 #651525, inset 0 0 0 2px rgb(255 255 255 / 10%); }
.player-chips i:nth-child(1) { top: 13px; }
.player-chips i:nth-child(2) { top: 8px; background: #2466a6; box-shadow: 0 2px 0 #123552, inset 0 0 0 2px rgb(255 255 255 / 10%); }
.player-chips i:nth-child(3) { top: 3px; background: #238257; box-shadow: 0 2px 0 #12452f, inset 0 0 0 2px rgb(255 255 255 / 10%); }
.player-chips .chip-status {
  position: absolute;
  top: 25px;
  display: grid;
  min-width: 72px;
  min-height: 27px;
  padding: 4px 7px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 5px;
  color: #dfeae5;
  background: rgb(4 15 11 / 92%);
  box-shadow: 0 3px 8px rgb(0 0 0 / 32%);
  font-family: inherit;
  line-height: 1.05;
  text-shadow: 0 1px 2px #000;
  white-space: nowrap;
}
.player-chips .chip-status strong { font-size: 10px; font-weight: 800; letter-spacing: 0; text-transform: uppercase; }
.player-chips .chip-status small { margin-top: 3px; color: #fff0bf; font-size: 9px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.player-chips.no-chips .chip-status { top: 8px; min-height: 24px; }
.player-chips.status-raise .chip-status { border-color: rgb(91 170 231 / 55%); color: #8bc8ff; }
.player-chips.status-fold .chip-status { border-color: rgb(235 104 104 / 55%); color: #ff9b9b; }
.player-chips.status-check .chip-status { border-color: rgb(86 203 143 / 48%); color: #9be2bd; }
.player-chips.status-all-in .chip-status { border-color: rgb(226 180 76 / 62%); color: #ffdc83; }
.player-chips.status-disconnected .chip-status, .player-chips.status-out .chip-status { border-color: rgb(154 167 161 / 35%); color: #b3c0ba; background: rgb(22 28 25 / 94%); }

.admin-overlay { position: fixed; z-index: 40; inset: 0; display: grid; padding: 24px; place-items: center; background: rgb(0 8 6 / 82%); }
.admin-console { display: grid; width: min(100%, 980px); height: min(88vh, 720px); grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden; border: 1px solid #486156; border-radius: 8px; background: #0b1713; box-shadow: 0 25px 90px rgb(0 0 0 / 55%); }
.admin-header { display: flex; min-height: 62px; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid #2b4138; }
.admin-header > div { display: grid; gap: 3px; }
.admin-header span { color: #a9bbb3; font-size: 9px; font-weight: 900; }
.admin-header strong { color: #f0cc72; font-size: 16px; }
.admin-content { display: grid; min-height: 0; grid-template-columns: minmax(0, 1.2fr) minmax(260px, .8fr); }
.admin-content section { min-height: 0; padding: 12px; overflow: auto; }
.admin-content section + section { border-left: 1px solid #2b4138; }
.admin-content h2 { margin: 0 0 10px; color: #a9bbb3; font-size: 10px; }
.admin-user-list { display: grid; gap: 6px; }
.admin-user-row { display: grid; min-width: 0; padding: 9px 0; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; border-bottom: 1px solid #23382f; }
.admin-user-row > div:first-child { display: grid; min-width: 0; gap: 2px; }
.admin-user-row strong { overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.admin-user-row span { color: #9db0a7; font-size: 8px; }
.admin-grant-controls { display: flex; gap: 5px; }
.admin-grant-controls input { width: 118px; height: 34px; padding: 0 8px; border: 1px solid #3c5148; border-radius: 5px; color: #fff; background: #111f1b; }
.admin-grant-controls button { height: 34px; padding: 0 10px; border-radius: 5px; color: #fff; background: #16774d; font-size: 9px; font-weight: 900; cursor: pointer; }
.admin-grant-controls button:disabled { opacity: .5; }
.admin-grant-log { margin: 0; padding: 0; list-style: none; }
.admin-grant-log li { padding: 8px 0; border-bottom: 1px solid #23382f; color: #cbd8d2; font-size: 9px; line-height: 1.5; }
.admin-error { min-height: 20px; margin: 0; padding: 6px 14px; color: #ff9898; font-size: 10px; }

@keyframes showdown-in { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes timer-pulse { from { transform: scale(1); } to { transform: scale(1.08); } }
@keyframes dealer-character-lean { from { transform: translateY(0) scale(.99); } to { transform: translateY(4px) scale(1.02); } }
@keyframes raise-amount-pop { from { opacity: .65; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
@keyframes button-spin { to { transform: rotate(360deg); } }
@keyframes connection-pulse { from { opacity: .5; } to { opacity: 1; } }
@keyframes community-card-reveal { from { opacity: 0; transform: translateX(28px) rotateY(80deg) scale(.82); } to { opacity: 1; transform: translateX(0) rotateY(0) scale(1); } }

@media (max-width: 760px) {
  .app-shell { grid-template-rows: 52px minmax(0, 1fr) auto; }
  .topbar { padding: 0 8px; }
  .brand > span:last-child { display: none; }
  .topbar-actions { gap: 6px; }
  .account-summary span:first-child { max-width: 76px; }
  .account-menu { top: 47px; right: 8px; }
  .lobby-count span:last-child { display: none; }
  .log-toggle { display: grid; }
  .sound-toggle { display: grid; }
  .game-area { padding: 6px; }
  .game-layout { display: block; position: relative; }
  .poker-table { width: calc(100% - 4px); height: calc(100% - 8px); min-height: 405px; margin: 4px 2px; border-radius: 42% / 11%; }
  .game-log { position: fixed; z-index: 15; top: calc(52px + env(safe-area-inset-top)); right: 0; bottom: 0; width: min(82vw, 300px); border-radius: 0; transform: translateX(105%); transition: transform 180ms ease; }
  .game-log.open { transform: translateX(0); box-shadow: -18px 0 60px rgb(0 0 0 / 50%); }
  .log-header .icon-button { display: grid; }
  .seat { width: 96px; }
  .seat.position-0 { top: 77%; left: 50%; }.seat.position-1 { top: 72%; left: 9%; }.seat.position-2 { top: 35%; left: 8%; }.seat.position-3 { top: 18%; left: 22%; }.seat.position-4 { top: 18%; left: 78%; }.seat.position-5 { top: 51%; left: 92%; }
  .player-summary { width: 86px; min-height: 27px; padding: 4px; }
  .player-avatar-frame { width: 56px; height: 56px; }
  .player-avatar { font-size: 11px; }
  .player-name-badge { top: -10px; max-width: 92px; padding: 3px 6px; gap: 4px; font-size: 9px; }
  .player-presence { width: 11px; height: 11px; }
  .turn-timer { inset: -4px; }
  .turn-timer strong { bottom: -1px; min-width: 21px; height: 15px; padding: 0 4px; font-size: 8px; }
  .stack { font-size: 8px; }
  .role-button { min-width: 16px; height: 16px; padding: 0 3px; font-size: 6px; }
  .seat { --hand-x: 60px; --hand-y: -6px; }
  .seat.position-0 { --bet-y: -74px; --hand-x: 66px; --hand-y: -40px; }
  .seat.position-1 { --bet-x: 96px; --bet-y: -40px; --hand-x: 62px; --hand-y: -22px; }
  .seat.position-2 { --bet-x: 108px; --bet-y: 5px; --hand-x: 64px; --hand-y: -3px; }
  .seat.position-3 { --bet-x: 53px; --bet-y: 72px; --hand-x: 61px; --hand-y: 24px; }
  .seat.position-4 { --bet-x: -53px; --bet-y: 72px; --hand-x: -61px; --hand-y: 24px; }
  .seat.position-5 { --bet-x: -109px; --bet-y: 5px; --hand-x: -64px; --hand-y: -3px; }
  .card { width: 35px; }.seat.position-0 .card { width: 42px; }
  .table-center { top: 54%; width: 68%; }.board { min-height: 62px; gap: 3px; }.board .card { width: clamp(49px, 12vw, 59px); }
  .player-chips { top: 32px; transform: translate(calc(-50% + var(--bet-x)), calc(-50% + var(--bet-y))) scale(.82); }
  .action-panel { min-height: 112px; padding: 7px 8px calc(8px + env(safe-area-inset-bottom)); }
  .action-status-row { min-height: 20px; }
  .game-message { font-size: 10px; }
  .connection-status { font-size: 7px; }
  .actions { gap: 5px; }
  .command-button { min-height: 48px; padding: 7px 5px; font-size: 9px; }
  .raise-control { margin-bottom: 6px; padding: 8px; }
  .raise-heading { grid-template-columns: 58px minmax(0, 1fr) 44px; }
  .raise-value { display: grid; justify-items: center; gap: 1px; }
  .dealer-stage { top: 7.5%; left: 50%; width: 280px; transform: translate(-50%, -8%); }
  .table-stats { top: 96%; width: 128px; grid-template-columns: 48px 1fr; }
  .table-stats span { padding: 4px 6px; }
  .table-stats strong { font-size: 10px; }
  .raise-value strong { min-width: 86px; font-size: 21px; }
  .deal-announcement strong { font-size: 16px; }
  .showdown-result { width: min(100%, 330px); max-height: 188px; padding: 6px 8px; }
  .showdown-winner { gap: 4px; }
  .winning-cards { grid-template-columns: repeat(5, 33px); gap: 4px; }
  .winning-card .card { width: 33px; }
  .winning-category { font-size: 10px; }
  .flying-card { width: 21px; }
  .admin-overlay { padding: 0; }
  .admin-console { width: 100%; height: 100%; border: 0; border-radius: 0; }
  .admin-content { grid-template-columns: 1fr; overflow-y: auto; }
  .admin-content section { overflow: visible; }
  .admin-content section + section { border-top: 1px solid #2b4138; border-left: 0; }
  .admin-user-row { grid-template-columns: 1fr; }
  .admin-grant-controls input { width: min(170px, 50vw); }
}

@media (max-width: 370px) {
  .logout-button { display: none; }
  .seat { width: 84px; }
  .table-center { width: 58%; }
  .board .card { width: 40px; }
  .command-button { font-size: 8px; }
  .actions { gap: 3px; }
  .raise-heading { grid-template-columns: 50px minmax(0, 1fr) 44px; }
}

@media (max-height: 650px) {
  .seat.position-0 { top: 76%; }.seat.position-3, .seat.position-4 { top: 17%; }
  .action-panel { min-height: 92px; padding-top: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
