:root {
  color-scheme: dark;
  --bg: #030807;
  --felt: #063e36;
  --felt2: #021f1d;
  --cyan: #10d7d4;
  --gold: #f4c95d;
  --red: #d2282c;
  --green: #58bd68;
  --blue: #159bd3;
  --ink: #f5f6ee;
  --muted: #9aa7a1;
  --panel: rgba(9, 21, 20, .88);
  --line: rgba(255,255,255,.14);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; overflow-x: hidden; background: var(--bg); color: var(--ink); font-family: system-ui, -apple-system, Segoe UI, sans-serif; }
button, input { font: inherit; }
button { min-height: 38px; border: 0; border-radius: 8px; background: #122623; color: var(--ink); font-weight: 800; box-shadow: inset 0 0 0 1px var(--line); }
button.primary { background: linear-gradient(180deg, #ffd870, #b98520); color: #1b1203; }
button.danger { background: #842c33; }
button.blue { background: var(--blue); }
button.green { background: var(--green); }
button.red { background: var(--red); }
button:disabled { opacity: .36; filter: grayscale(.4); }
input { width: 100%; min-height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; color: var(--ink); background: rgba(0,0,0,.28); }

.app { min-height: 100dvh; padding: 10px; background: radial-gradient(circle at 50% 25%, #095843 0, #05231f 48%, #020504 100%); }
.screen { max-width: 480px; min-height: calc(100dvh - 20px); margin: 0 auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.brand { font-size: 22px; font-weight: 950; color: var(--gold); }
.pill { padding: 5px 9px; border-radius: 999px; background: rgba(0,0,0,.28); border: 1px solid var(--line); color: var(--muted); font-size: 12px; white-space: nowrap; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px; box-shadow: 0 18px 36px rgba(0,0,0,.26); }
.nickname-panel { display: grid; grid-template-columns: 1fr 82px; gap: 10px; align-items: end; }
.stack { display: grid; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.room { display: grid; gap: 6px; padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.05); }
.room-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-weight: 800; }
.small { color: var(--muted); font-size: 12px; }

.game-screen { max-width: 520px; padding-bottom: 132px; }
.game-screen .topbar { margin-bottom: 4px; }
.table { position: relative; min-height: calc(100dvh - 72px); }
.game-hud { position: relative; z-index: 3; display: grid; grid-template-columns: 1fr auto 1fr; gap: 7px; align-items: center; margin-bottom: 6px; }
.game-hud span { min-width: 0; padding: 6px 9px; border: 1px solid rgba(16,215,212,.45); border-radius: 8px; background: rgba(2,12,11,.62); color: var(--cyan); font-size: 12px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.felt { position: relative; height: min(62dvh, 560px); min-height: 420px; border-radius: 28px; background: radial-gradient(circle, rgba(3,55,49,.28), rgba(1,20,19,.86)), url("/Images/table/Table.png") center / contain no-repeat; box-shadow: inset 0 0 0 2px rgba(255,255,255,.12), 0 18px 42px rgba(0,0,0,.42); overflow: visible; }
.center { position: absolute; left: 50%; top: 47%; transform: translate(-50%, -50%); width: 88%; text-align: center; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.pot { color: var(--gold); font-size: 25px; font-weight: 950; text-shadow: 0 2px 10px rgba(0,0,0,.5); }
.cards { display: flex; justify-content: center; gap: 5px; min-height: 58px; }
.card { width: 40px; height: 56px; border-radius: 6px; background: #f8f6ed; color: #111; display: grid; place-items: center; font-weight: 900; border: 1px solid rgba(0,0,0,.18); overflow: hidden; }
.card img { width: 100%; height: 100%; object-fit: contain; display: block; }
.card.red { color: #c82030; }
.board-cards .card { width: clamp(36px, 11vw, 50px); height: clamp(50px, 15vw, 70px); }

.seat { position: absolute; z-index: 2; width: 74px; min-height: 60px; padding: 5px; transform: translate(-50%, -50%); border-radius: 8px; background: rgba(10, 22, 21, .92); border: 1px solid rgba(255,255,255,.18); text-align: center; font-size: 11px; box-shadow: 0 8px 18px rgba(0,0,0,.35); }
.seat.acting, .hero-box.acting { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(244,201,93,.75), 0 8px 24px rgba(244,201,93,.2); }
.seat.folded { opacity: .55; }
.seat .name, .hero-box .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 850; }
.chipline { color: var(--cyan); font-weight: 900; font-size: 16px; line-height: 1.1; }
.betline { color: var(--muted); font-size: 10px; line-height: 1.1; }
.badges { display: flex; justify-content: center; gap: 3px; margin-top: 3px; min-height: 15px; }
.badge { min-width: 18px; padding: 1px 4px; border-radius: 999px; background: #d8b14b; color: #1a1100; font-size: 9px; font-weight: 900; }
.opp-cards { position: absolute; left: -15px; top: -9px; display: flex; gap: 0; transform: rotate(-8deg); }
.opp-cards .card { width: 24px; height: 34px; margin-right: -10px; border-radius: 4px; }

.hero-seat { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); z-index: 4; width: 116px; min-height: 92px; display: grid; justify-items: center; align-items: end; pointer-events: none; }
.mycards { position: absolute; left: 50%; top: -10px; z-index: 0; display: flex; gap: 0; transform: translateX(-50%) rotate(-4deg); }
.mycards .card { width: 42px; height: 58px; border-radius: 5px; box-shadow: 0 8px 14px rgba(0,0,0,.32); }
.mycards .card:nth-child(1) { transform: rotate(-8deg) translateX(7px); }
.mycards .card:nth-child(2) { transform: rotate(9deg) translateX(-7px); }
.hero-box { position: relative; z-index: 2; min-width: 96px; margin-top: 30px; padding: 9px 10px 6px; border-radius: 8px; background: rgba(10,22,21,.97); border: 2px solid rgba(16,215,212,.75); text-align: center; box-shadow: 0 10px 22px rgba(0,0,0,.38); }

.mini-log { position: absolute; left: 8px; right: 8px; top: 36px; z-index: 1; max-height: 34px; overflow: hidden; padding: 5px 8px; border-radius: 999px; background: rgba(0,0,0,.26); color: rgba(255,255,255,.45); font-size: 11px; text-align: center; pointer-events: none; }

.controls { position: fixed; left: 50%; bottom: 0; z-index: 10; transform: translateX(-50%); width: min(520px, 100vw); padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: rgba(3, 8, 7, .96); border-top: 1px solid var(--line); display: grid; gap: 7px; box-shadow: 0 -12px 28px rgba(0,0,0,.35); }
.bet-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) 1.2fr; gap: 6px; }
.bet-strip button, .bet-strip input { min-height: 34px; font-size: 13px; }
.main-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.main-actions button { min-height: 48px; font-size: 18px; }
.sub-actions { display: grid; grid-template-columns: 1fr 1fr 1.15fr; gap: 8px; }
.sub-actions button { min-height: 36px; font-size: 13px; }
.amount-row { display: grid; grid-template-columns: 1fr 92px; gap: 7px; }

.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 16px; background: rgba(0,0,0,.62); }
.modal[hidden] { display: none; }
.result { width: min(420px, 100%); }

@media (max-width: 380px) {
  .app { padding: 8px; }
  .brand { font-size: 20px; }
  .game-screen { padding-bottom: 124px; }
  .felt { min-height: 390px; height: min(60dvh, 510px); }
  .seat { width: 68px; font-size: 10px; }
  .chipline { font-size: 14px; }
  .bet-strip { grid-template-columns: repeat(4, 1fr); }
  .bet-strip input { grid-column: 1 / -1; }
  .main-actions button { min-height: 44px; font-size: 16px; }
  .sub-actions button { min-height: 34px; }
}
