/* The Kamer Casino's game tables (ui/tables-ui.js) and Kamer Bet (ui/kamer-bet.js): full-screen, phone first. Upright:
   the players, the board as big as fits, the buttons under it. Sideways: the board on the left, the rest on the right. */
#tblUI, #kbUI { position: fixed; inset: 0; z-index: 60; display: none; flex-direction: column; color: #f6efe0; font-family: inherit;
  background: radial-gradient(120% 80% at 50% 30%, #1d4d34 0%, #0f2a1d 55%, #0a1611 100%); padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
#tblUI.open, #kbUI.open { display: flex; }
#kbUI { background: linear-gradient(180deg, #0b1f14, #0c1410 60%); }
.tb-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px 6px; }
.tb-x { width: 40px; height: 40px; border-radius: 12px; border: 0; background: rgba(255,255,255,.1); color: #fff; font-size: 18px; flex: none; }
.tb-title { flex: 1; font-weight: 800; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-pot { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; padding: 4px 10px; border-radius: 10px; background: linear-gradient(180deg, #e2b44c, #a8761c); color: #241500; }
.tb-pot b { font-size: 15px; } .tb-pot span { font-size: 10px; font-weight: 700; text-transform: uppercase; opacity: .75; }
.tb-pot:empty { display: none; }
.tb-seats { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 12px 6px; }
.tb-seat { flex: 1 1 40%; min-width: 0; position: relative; display: flex; align-items: center; padding: 7px 10px; border-radius: 10px; background: rgba(0,0,0,.28); border: 2px solid transparent; font-size: 13px; overflow: hidden; }
.tb-seat b { display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.tb-seat em { opacity: .5; font-weight: 600; }
.tb-seat .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--c); flex: none; box-shadow: 0 0 0 2px #fff; }
.tb-seat.turn { border-color: #f2c94c; background: rgba(242,201,76,.16); }
.tb-seat.me b::after { content: ''; }
.tb-seat.gone { opacity: .4; text-decoration: line-through; }
.tb-seat .clock { margin-left: auto; padding-left: 8px; font-style: normal; font-weight: 800; font-size: 12px; text-decoration: none; position: relative; z-index: 1; }
.tb-seat .clock::before { content: ''; position: absolute; left: -400px; right: 0; bottom: -8px; height: 3px; background: #f2c94c; transform-origin: right; transform: scaleX(var(--k, 1)); }
.tb-seat .clock.low { color: #ff6b5b; } .tb-seat .clock.low::before { background: #ff6b5b; }
.tb-stage { flex: 1; min-height: 160px; display: flex; align-items: center; justify-content: center; position: relative; padding: 4px; }
#tbBoard { border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.55), 0 0 0 4px #5a3a1a, 0 0 0 6px #d4a23a; touch-action: none; }
.tb-banner { position: absolute; top: 12px; left: 50%; transform: translateX(-50%) scale(.8); padding: 6px 16px; border-radius: 20px; background: #c0262d; font-weight: 900; letter-spacing: .1em; opacity: 0; transition: .2s; pointer-events: none; }
.tb-banner.on { opacity: 1; transform: translateX(-50%) scale(1); }
.tb-panel { padding: 8px 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.tb-note { margin: 0; font-size: 13px; opacity: .85; text-align: center; line-height: 1.35; }
.tb-note.hot { color: #ffd76a; font-weight: 800; opacity: 1; font-size: 15px; }
.tb-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.tb-go { flex: 1 1 auto; min-height: 48px; border: 0; border-radius: 14px; padding: 0 18px; font-weight: 800; font-size: 16px; color: #241500; background: linear-gradient(180deg, #f6cf62, #c8901f); box-shadow: 0 4px 0 #7a5410; }
.tb-go:active { transform: translateY(2px); box-shadow: 0 2px 0 #7a5410; }
.tb-go.alt { color: #fff; background: linear-gradient(180deg, #2f9e5e, #1d6b3e); box-shadow: 0 4px 0 #0f3d22; }
.tb-go[disabled] { opacity: .5; }
.tb-ghost { min-height: 42px; border-radius: 12px; border: 1px solid rgba(255,255,255,.25); background: transparent; color: #fff; padding: 0 16px; font-weight: 700; }
.tb-ghost.danger { border-color: rgba(255,107,91,.5); color: #ffb0a6; align-self: center; }
.tb-chips { display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; }
.tb-chip { width: 44px; height: 44px; border-radius: 50%; border: 3px dashed rgba(255,255,255,.7); background: #2d6cdf; color: #fff; font-weight: 800; font-size: 13px; }
.tb-chip:nth-child(1) { background: #5b6577; } .tb-chip:nth-child(3) { background: #d4242b; } .tb-chip:nth-child(4) { background: #118a3e; } .tb-chip:nth-child(5) { background: #111827; } .tb-chip:nth-child(6) { background: #8b3fd9; } .tb-chip:nth-child(7) { background: #c98a00; }
.tb-chip.on { outline: 3px solid #ffd76a; outline-offset: 2px; transform: scale(1.06); }
.tb-live { display: flex; align-items: center; gap: 12px; justify-content: center; }
.tb-dice { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 78px; height: 78px; border-radius: 18px; border: 0; background: #fff; color: #111; box-shadow: 0 5px 0 #b7aa90; flex: none; }
.tb-dice i { font-style: normal; font-size: 46px; line-height: 1; }
.tb-dice span { font-size: 11px; font-weight: 900; letter-spacing: .08em; }
.tb-dice.go { animation: tbPulse 1s infinite; background: #ffe48a; }
.tb-dice[disabled] { opacity: .75; }
@keyframes tbPulse { 50% { transform: scale(1.07); box-shadow: 0 5px 0 #b7aa90, 0 0 0 8px rgba(255,215,90,.35); } }
.tb-promo { display: flex; gap: 8px; justify-content: center; }
.tb-promo button { width: 56px; height: 56px; border-radius: 12px; border: 0; background: #fff; font-size: 38px; line-height: 1; }
.tb-result { text-align: center; padding: 12px; border-radius: 14px; background: rgba(0,0,0,.3); display: flex; flex-direction: column; gap: 4px; }
.tb-result strong { font-size: 22px; } .tb-result span { font-size: 13px; opacity: .85; }
.tb-result.win { background: linear-gradient(180deg, rgba(246,207,98,.35), rgba(0,0,0,.3)); } .tb-result.lose { background: rgba(120,20,20,.35); }
#tblBack { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom)); z-index: 40; display: none; padding: 12px 18px; border-radius: 24px; border: 0; font-weight: 800; color: #241500; background: linear-gradient(180deg, #f6cf62, #c8901f); box-shadow: 0 6px 18px rgba(0,0,0,.45); }
#tblBack.show { display: block; }

/* sideways: the board left, the players and buttons right */
@media (orientation: landscape) and (max-height: 600px) {
  #tblUI { display: none; }
  #tblUI.open { display: grid; grid-template-columns: auto minmax(220px, 1fr); grid-template-rows: auto auto 1fr; }
  #tblUI .tb-top { grid-column: 2; grid-row: 1; } #tblUI .tb-seats { grid-column: 2; grid-row: 2; }
  #tblUI .tb-stage { grid-column: 1; grid-row: 1 / 4; width: 100vh; max-width: 62vw; height: 100vh; }
  #tblUI .tb-panel { grid-column: 2; grid-row: 3; overflow-y: auto; }
  .tb-go { min-height: 42px; }
}

/* Kamer Bet */
.kb-tabs { display: flex; gap: 6px; padding: 0 12px 8px; }
.kb-tabs button { flex: 1; min-height: 38px; border-radius: 10px; border: 0; background: rgba(255,255,255,.08); color: #fff; font-weight: 700; }
.kb-tabs button.on { background: #f2c12e; color: #1a1300; }
.kb-body { flex: 1; overflow-y: auto; padding: 0 12px 12px; -webkit-overflow-scrolling: touch; }
#kbUI.has-slip .kb-body { padding-bottom: 8px; }
.kb-live { background: #06120c; border: 1px solid #1d4d34; border-radius: 12px; padding: 8px 10px; margin-bottom: 10px; font-size: 13px; }
.kb-live.idle { text-align: center; font-size: 14px; }
.kb-lh { display: flex; align-items: center; gap: 6px; font-weight: 800; margin-bottom: 4px; } .kb-lh b { margin-left: auto; color: #6dffb0; font-size: 15px; }
.kb-dot { width: 9px; height: 9px; border-radius: 50%; background: #ff3b3b; animation: kbBlink 1s infinite; }
@keyframes kbBlink { 50% { opacity: .25; } }
.kb-lm { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; padding: 2px 0; } .kb-lm span:last-child { text-align: right; } .kb-lm b { color: #ffd76a; min-width: 44px; text-align: center; }
.kb-rounds { display: flex; gap: 6px; margin-bottom: 8px; }
.kb-rounds button { flex: 1; border-radius: 10px; border: 1px solid rgba(255,255,255,.2); background: transparent; color: #fff; padding: 6px; font-weight: 800; display: flex; flex-direction: column; }
.kb-rounds button small { font-weight: 600; opacity: .75; } .kb-rounds button.on { border-color: #f2c12e; background: rgba(242,193,46,.15); }
.kb-head, .kb-m { display: grid; grid-template-columns: minmax(0, 1fr) repeat(5, 46px); gap: 4px; align-items: center; }
.kb-head { font-size: 11px; font-weight: 800; opacity: .7; text-align: center; padding: 0 0 4px; }
.kb-m { padding: 6px 0; border-top: 1px solid rgba(255,255,255,.08); }
.kb-teams { display: flex; flex-direction: column; min-width: 0; font-size: 13px; } .kb-teams b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700; }
.kb-teams b + b { opacity: .8; font-weight: 600; }
.kb-odd { height: 40px; border-radius: 8px; border: 0; background: #183a28; color: #f2f7ef; font-weight: 800; font-size: 13px; }
.kb-odd.on { background: #f2c12e; color: #1a1300; } .kb-odd[disabled] { opacity: .4; }
.kb-slip { padding: 0 12px; background: #0a1a12; border-top: 2px solid #f2c12e; display: none; }
#kbUI.has-slip .kb-slip { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; }
.kb-sl { display: flex; justify-content: space-between; font-size: 14px; } .kb-sl span b { color: #6dffb0; }
.kb-s { background: rgba(255,255,255,.05); border-radius: 12px; padding: 8px 10px; margin-bottom: 8px; font-size: 13px; }
.kb-s.won { border: 1px solid #2f9e5e; } .kb-s.lost { opacity: .7; }
.kb-sh { display: flex; flex-direction: column; margin-bottom: 4px; } .kb-sh span { opacity: .75; font-size: 12px; }
.kb-sp { display: grid; grid-template-columns: 1fr auto 40px; gap: 8px; padding: 2px 0; } .kb-sp b { text-align: right; } .kb-sp.w span:first-child::before { content: '✅ '; } .kb-sp.l span:first-child::before { content: '❌ '; }
