:root {
  --bg: #150F1B;
  --bg2: #1C1224;
  --card: #241A2E;
  --card2: #2C2038;
  --line: rgba(255,255,255,0.08);
  --text: #F3EDE6;
  --muted: #A79AB3;
  --dim: #7C7089;
  --gold: #E3B23C;
  --gold2: #F3D580;
  --teal: #5DE0B8;
  --rose: #C97B95;
  --red: #E24B4A;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
button, input, select { font-family: inherit; font-size: 14px; }
a { color: var(--gold); }

#app { min-height: 100%; display: flex; flex-direction: column; max-width: 480px; margin: 0 auto; }
.screen { flex: 1; display: flex; flex-direction: column; padding: 16px; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: none;} }

.topbar { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 14px; }
.brand { font-family: Georgia, serif; font-size: 22px; letter-spacing: .5px; }
.brand small { display:block; font-size: 10px; letter-spacing: 3px; color: var(--muted); font-family: inherit; }
.back { background: none; border: none; color: var(--muted); font-size: 22px; cursor: pointer; padding: 4px 8px; }
.title { font-family: Georgia, serif; font-size: 18px; }
.sub { color: var(--muted); font-size: 13px; }

.card { background: var(--card); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px; border: 1px solid var(--line); }
.card.tap { cursor: pointer; transition: background .15s; }
.card.tap:hover { background: var(--card2); }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; }
.pill { font-size: 11px; padding: 3px 9px; border-radius: 999px; background: rgba(255,255,255,0.07); color: var(--muted); }
.pill.gold { background: rgba(227,178,60,0.16); color: var(--gold2); }
.pill.teal { background: rgba(93,224,184,0.14); color: var(--teal); }
.pill.rose { background: rgba(201,123,149,0.18); color: #F0B7C9; }

.avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: #fff; flex: none;
  box-shadow: 0 3px 8px rgba(0,0,0,.5), inset 0 1px 1px rgba(255,255,255,.35); }

input, select { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line);
  background: rgba(255,255,255,0.04); color: var(--text); outline: none; }
input:focus { border-color: var(--gold); }
label { font-size: 12px; color: var(--muted); display: block; margin: 0 0 6px 2px; }
.field { margin-bottom: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(255,255,255,0.06); color: var(--text); cursor: pointer; font-weight: 500; }
.btn:hover { background: rgba(255,255,255,0.1); }
.btn.primary { background: linear-gradient(160deg, #F3D580, #E3B23C 60%, #B98A25); color: #3A2606; border: none;
  box-shadow: 0 4px 12px rgba(227,178,60,.3); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: transparent; }
.btn.danger { color: #F7A5A5; border-color: rgba(226,75,74,.35); }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .4; cursor: default; }
.btn-row { display: flex; gap: 8px; }
.btn-row .btn { flex: 1; }

.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tabs button { flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.tabs button.active { background: var(--card); color: var(--text); border-color: rgba(227,178,60,.4); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #2C2038; color: var(--text);
  padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line); font-size: 13px; z-index: 50; max-width: 90vw;
  box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.toast.err { border-color: rgba(226,75,74,.5); }

.empty { text-align: center; color: var(--dim); padding: 30px 10px; font-size: 14px; }
.hint { color: var(--dim); font-size: 12px; margin-top: 8px; }
.divider { height: 1px; background: var(--line); margin: 14px 0; }
.mono { font-family: ui-monospace, Menlo, monospace; letter-spacing: .5px; }
.code-big { font-family: ui-monospace, Menlo, monospace; font-size: 22px; letter-spacing: 2px; color: var(--gold2); }

/* ---------- table ---------- */
.table-screen { padding: 10px 10px 14px; }
.table-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 8px; font-size: 13px; }
.table-wrap { position: relative; width: 100%; height: 360px; margin: 8px 0 6px; }
.table-shadow { position: absolute; top: 120px; left: 8px; right: 8px; height: 200px; border-radius: 100px;
  background: radial-gradient(ellipse at 50% 60%, rgba(0,0,0,.65) 0%, rgba(0,0,0,0) 70%); filter: blur(6px); }
.rail { position: absolute; top: 70px; left: 0; right: 0; height: 210px; border-radius: 105px;
  background: radial-gradient(ellipse at 50% 20%, #7A5730 0%, #4A3018 50%, #26160A 100%);
  box-shadow: 0 22px 34px rgba(0,0,0,.6), inset 0 5px 8px rgba(255,225,180,.18), inset 0 -14px 22px rgba(0,0,0,.6),
    inset 6px 0 14px rgba(0,0,0,.35), inset -6px 0 14px rgba(0,0,0,.35); }
.rail-trim { position: absolute; top: 80px; left: 10px; right: 10px; height: 190px; border-radius: 95px;
  background: linear-gradient(160deg, #FBE29A 0%, #E3B23C 40%, #A87D28 75%, #6E5217 100%);
  box-shadow: inset 0 3px 5px rgba(255,255,255,.65), inset 0 -5px 8px rgba(0,0,0,.5), inset 4px 0 8px rgba(0,0,0,.25), inset -4px 0 8px rgba(0,0,0,.25); }
.felt { position: absolute; top: 88px; left: 18px; right: 18px; height: 174px; border-radius: 87px;
  background: radial-gradient(ellipse at 50% 25%, #5A4478 0%, #3E2E56 35%, #241A34 75%, #170F22 100%);
  box-shadow: inset 0 14px 34px rgba(0,0,0,.6), inset 0 -8px 20px rgba(0,0,0,.5); }
.felt-spot { position: absolute; top: 88px; left: 18px; right: 18px; height: 174px; border-radius: 87px;
  background: radial-gradient(ellipse at 50% 18%, rgba(255,244,214,.16) 0%, rgba(255,244,214,0) 55%); }
.felt-ring { position: absolute; top: 118px; left: 50px; right: 50px; height: 114px; border-radius: 57px; border: 1px solid rgba(230,210,255,.14); }
.felt-logo { position: absolute; top: 112px; left: 50%; transform: translateX(-50%); font-family: Georgia, serif; font-size: 13px;
  letter-spacing: 3px; color: rgba(243,213,128,.22); pointer-events: none; white-space: nowrap; text-align: center; }
.felt-logo small { display: block; font-size: 8px; letter-spacing: 2px; color: rgba(243,213,128,.16); margin-top: 2px; }

.center { position: absolute; top: 180px; left: 50%; transform: translate(-50%, -50%); text-align: center; width: 200px; }
.pot { font-family: Georgia, serif; color: var(--gold2); font-size: 15px; margin-bottom: 8px; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.pot.bump { animation: bump .25s ease; }
@keyframes bump { 50% { transform: scale(1.15); } }
.board { display: flex; gap: 5px; justify-content: center; min-height: 38px; }
.pcard { width: 27px; height: 38px; border-radius: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 11px; line-height: 1; font-weight: 600; box-shadow: 0 3px 6px rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.6);
  background: linear-gradient(160deg, #FFFDF8 0%, #EDE7D8 100%); animation: deal .3s ease; }
@keyframes deal { from { opacity: 0; transform: translateY(-6px) rotate(-4deg);} }
.pcard span:last-child { font-size: 14px; margin-top: 1px; }
.pcard.blk { color: #1A1220; } .pcard.rd { color: #B12A45; }
.pcard.back { background: linear-gradient(150deg, #4A3763, #2E2246); border: 1px solid rgba(255,255,255,.12); }
.street-label { font-size: 10px; letter-spacing: 2px; color: rgba(243,213,128,.6); margin-top: 6px; text-transform: uppercase; }

.seat { position: absolute; width: 84px; text-align: center; transform: translate(-50%, -50%); }
.seat.folded { filter: grayscale(1) opacity(.4); }
.seat .av { width: 40px; height: 40px; border-radius: 50%; margin: 0 auto; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600; color: #fff; border: 2px solid rgba(0,0,0,.25);
  box-shadow: 0 3px 8px rgba(0,0,0,.5), inset 0 1px 1px rgba(255,255,255,.35); position: relative; transition: box-shadow .25s; }
.seat.active .av { box-shadow: 0 0 0 3px var(--gold), 0 0 14px rgba(227,178,60,.6); }
.seat.winner .av { box-shadow: 0 0 0 3px var(--teal), 0 0 16px rgba(93,224,184,.7); }
.seat.me .av { border-color: #F3EDE6; }
.seat .dealer { position: absolute; right: -6px; bottom: -4px; width: 16px; height: 16px; border-radius: 50%; background: #F3EDE6; color: #1A1220;
  font-size: 9px; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 3px rgba(0,0,0,.5); }
.seat .nm { font-size: 10px; color: var(--text); margin-top: 4px; font-family: Georgia, serif; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .st { display: flex; align-items: center; justify-content: center; gap: 4px; font-size: 10px; color: #C6B8D4; }
.chip { width: 12px; height: 12px; border-radius: 50%; background: repeating-conic-gradient(#F8F0DC 0deg 15deg, #C0304A 15deg 30deg);
  box-shadow: 0 1px 2px rgba(0,0,0,.55), inset 0 0 0 2px #1A1220; position: relative; flex: none; }
.chip::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #FFFDF6, #E9E1CE 65%, #C9BFA6 100%); }
.seat .bet { position: absolute; font-size: 10px; color: var(--gold2); background: rgba(20,12,28,.85); padding: 2px 7px; border-radius: 8px;
  border: 1px solid rgba(227,178,60,.5); white-space: nowrap; }
.seat .hole { display: flex; gap: 3px; justify-content: center; margin-top: 3px; }
.seat .hole .pcard { width: 18px; height: 25px; font-size: 8px; }
.seat .hole .pcard span:last-child { font-size: 10px; }
.seat.empty .av { background: rgba(255,255,255,.05); border: 1px dashed rgba(255,255,255,.2); color: var(--dim); font-size: 10px; cursor: pointer; box-shadow: none; }
.seat.empty .av:hover { border-color: var(--gold); color: var(--gold); }
.seat .timer { position: absolute; left: 50%; top: -6px; transform: translateX(-50%); width: 44px; height: 3px; background: rgba(255,255,255,.12); border-radius: 2px; overflow: hidden; }
.seat .timer i { display: block; height: 100%; background: var(--gold); animation: shrink 20s linear forwards; }
@keyframes shrink { from { width: 100%; } to { width: 0; } }

.actions { display: flex; gap: 7px; margin-top: 8px; }
.actions .btn { flex: 1; padding: 13px 0; }
.raise-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; background: var(--card); padding: 10px 12px; border-radius: 12px; }
.raise-row input[type=range] { flex: 1; padding: 0; background: transparent; border: none; }
.raise-row .amt { min-width: 64px; text-align: right; font-family: ui-monospace, Menlo, monospace; color: var(--gold2); }
.result { text-align: center; color: var(--teal); font-family: Georgia, serif; font-size: 14px; padding: 8px 0 2px; min-height: 22px; }
.you-strip { display: flex; align-items: center; justify-content: space-between; background: var(--card); border-radius: 12px; padding: 10px 14px; margin-top: 8px; font-size: 13px; }
.you-strip .hole { display: flex; gap: 4px; }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; z-index: 40; }
.modal { background: var(--bg2); border-radius: 20px 20px 0 0; padding: 20px; width: 100%; max-width: 480px; border-top: 1px solid var(--line); }

.stat { background: var(--card); border-radius: 12px; padding: 12px 14px; }
.stat .v { font-size: 22px; font-family: Georgia, serif; color: var(--gold2); }
.stat .k { font-size: 12px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
table.data { width: 100%; border-collapse: collapse; font-size: 12px; }
table.data th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.data td { padding: 8px 6px; border-bottom: 1px solid var(--line); }
.nav { display: flex; justify-content: space-around; padding: 12px 0 4px; border-top: 1px solid var(--line); margin-top: auto; }
.nav button { background: none; border: none; color: var(--dim); font-size: 12px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.nav button.active { color: var(--gold); }
.nav svg { width: 22px; height: 22px; }
