:root { --gold: #ffc94a; --gold2: #d99a1e; --bg: #14070e; --pane: rgba(24, 9, 18, .94); --line: rgba(255, 201, 74, .28); --txt: #f6ecdc; --dim: #b9a79a; --red: #ff5a6a; --green: #5fe08a; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #07040a; color: var(--txt); font: 15px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; overscroll-behavior: none; }
body { touch-action: none; user-select: none; -webkit-user-select: none; }
canvas#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }
.dim { color: var(--dim); } .gold { color: var(--gold); }
kbd { font: 600 11px system-ui; background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .3); border-radius: 4px; padding: 1px 5px; margin-left: 4px; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { opacity: .4; cursor: default; }
input { font: inherit; color: var(--txt); background: rgba(0, 0, 0, .4); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; user-select: text; -webkit-user-select: text; outline: none; }
input:focus { border-color: var(--gold); }
.big { display: inline-block; padding: 12px 20px; border-radius: 12px; font-weight: 700; letter-spacing: .03em; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .22); min-width: 92px; }
.big.gold { background: linear-gradient(#ffd766, #e0a020); color: #2a1400; border-color: #fff0b0; box-shadow: 0 4px 18px rgba(255, 190, 60, .35); }
.big.bad { background: rgba(255, 70, 90, .22); border-color: rgba(255, 90, 106, .6); }
.big:active:not(:disabled), .chip:active:not(:disabled) { transform: translateY(1px) scale(.98); }
.chip { padding: 9px 14px; border-radius: 999px; background: rgba(255, 201, 74, .12); border: 1px solid var(--line); font-weight: 600; white-space: nowrap; }
.chip.on { background: var(--gold); color: #2a1400; }
.x { padding: 7px 12px; border-radius: 10px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .2); font-weight: 600; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }

/* title */
#title { position: fixed; inset: 0; display: grid; place-items: center; padding: 16px; background: radial-gradient(ellipse at 50% 20%, #5a1026 0, #1a0810 55%, #07040a 100%); z-index: 50; overflow: auto; }
.card0 { width: min(420px, 100%); text-align: center; display: grid; gap: 14px; }
#title h1 { margin: 0; font-size: clamp(46px, 13vw, 76px); line-height: .95; letter-spacing: .04em; font-weight: 900; color: #fff3cf; text-shadow: 0 0 18px #ffb52e, 0 0 60px rgba(255, 120, 30, .6); }
#title h1 span { display: block; color: var(--gold); }
.tag { margin: 0; color: #ff8fc0; font-weight: 600; font-size: 13px; }
#title label { text-align: left; display: grid; gap: 5px; font-weight: 600; font-size: 13px; color: var(--dim); }
#title label small { font-weight: 400; }
#title .big { padding: 15px; font-size: 17px; }

/* HUD */
#hud > * { position: fixed; z-index: 10; }
#moneywrap { top: max(10px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); }
#money { font: 800 24px system-ui; color: var(--gold); text-shadow: 0 2px 8px #000, 0 0 16px rgba(255, 180, 40, .5); padding: 4px 14px; background: rgba(10, 4, 8, .6); border: 1px solid var(--line); border-radius: 999px; display: inline-block; }
.delta { position: absolute; left: 16px; top: 34px; font-weight: 800; animation: rise 1.4s ease-out forwards; pointer-events: none; text-shadow: 0 1px 4px #000; }
.delta.up { color: var(--green); } .delta.down { color: var(--red); }
@keyframes rise { to { transform: translateY(34px); opacity: 0; } }
#buffs { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
#buffs span { font-size: 12px; background: rgba(10, 4, 8, .65); border: 1px solid rgba(255, 255, 255, .18); padding: 2px 8px; border-radius: 999px; }
#net { top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); font-size: 12px; color: var(--dim); background: rgba(10, 4, 8, .5); padding: 3px 10px; border-radius: 999px; white-space: nowrap; pointer-events: none; }
#btns { top: max(10px, env(safe-area-inset-top)); right: max(10px, env(safe-area-inset-right)); display: flex; gap: 6px; }
#btns button { width: 42px; height: 42px; border-radius: 12px; background: rgba(10, 4, 8, .6); border: 1px solid var(--line); font-size: 19px; }
#chatlog { left: max(12px, env(safe-area-inset-left)); top: 96px; width: min(360px, 62vw); pointer-events: none; font-size: 13px; }
.cl { background: rgba(10, 4, 8, .55); border-radius: 8px; padding: 3px 8px; margin-bottom: 3px; width: fit-content; max-width: 100%; transition: opacity 1.5s; text-shadow: 0 1px 2px #000; }
.cl.sys { color: #ffd98a; } .cl.old { opacity: 0; }
.cl b { color: #8fd8ff; }
#chatform { left: 50%; transform: translateX(-50%); bottom: max(78px, calc(env(safe-area-inset-bottom) + 70px)); width: min(440px, 90vw); display: none; }
#chatform.open, #chatform:focus-within { display: block; }
#prompt { left: 50%; bottom: max(26px, calc(env(safe-area-inset-bottom) + 18px)); transform: translateX(-50%); padding: 13px 22px; border-radius: 999px; font-weight: 700; color: #2a1400; background: linear-gradient(#ffd766, #e0a020); border: 1px solid #fff0b0; box-shadow: 0 6px 24px rgba(255, 180, 40, .45); white-space: nowrap; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { box-shadow: 0 6px 34px rgba(255, 200, 80, .85); } }
#stick { display: none; left: max(22px, env(safe-area-inset-left)); bottom: max(26px, calc(env(safe-area-inset-bottom) + 16px)); width: 124px; height: 124px; border-radius: 50%; background: rgba(255, 255, 255, .08); border: 2px solid rgba(255, 255, 255, .22); touch-action: none; }
#knob { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px; border-radius: 50%; background: rgba(255, 201, 74, .75); pointer-events: none; }
body.touch #stick { display: block; }
body.ui-open #stick, body.seated #stick, body.fps #stick, body.fishing #stick, body.ui-open #prompt { display: none; }
body.touch #prompt { bottom: auto; top: 58%; left: auto; right: 16px; transform: none; }
#toasts { left: 50%; top: 58px; transform: translateX(-50%); display: grid; gap: 6px; justify-items: center; pointer-events: none; width: min(92vw, 520px); z-index: 60 !important; }
.toast { background: rgba(16, 6, 12, .92); border: 1px solid var(--line); padding: 8px 16px; border-radius: 12px; font-weight: 600; text-align: center; animation: pop .25s; transition: opacity .5s; }
.toast.good { border-color: var(--green); color: #c9ffd8; } .toast.bad { border-color: var(--red); color: #ffd0d5; } .toast.out { opacity: 0; }
@keyframes pop { from { transform: scale(.8); opacity: 0; } }

/* panels */
.panel { position: fixed; z-index: 30; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, 94vw); max-height: min(88vh, 720px); display: flex; flex-direction: column; background: var(--pane); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 20px 80px #000; backdrop-filter: blur(8px); }
.panel.small { width: min(430px, 94vw); }
.panel.wide { width: min(960px, 96vw); }
.panel.side { left: auto; right: max(12px, env(safe-area-inset-right)); transform: translateY(-50%); width: min(380px, 60vw); }
.ph { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px 10px 18px; border-bottom: 1px solid var(--line); }
.ph h2 { margin: 0; font-size: 19px; color: var(--gold); }
.pb { padding: 12px 16px 16px; overflow: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; }
.pb p { margin: 6px 0; }
.pb .big { width: 100%; margin-top: 8px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; align-items: center; }
.tabs button { padding: 6px 12px; border-radius: 999px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .15); font-weight: 600; font-size: 13px; }
.tabs button.on { background: var(--gold); color: #2a1400; }
.tabs .bal { margin-left: auto; font-weight: 800; color: var(--gold); }
.list { display: grid; gap: 6px; }
.item { display: flex; align-items: center; gap: 12px; text-align: left; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .12); width: 100%; }
.item.on { border-color: var(--gold); background: rgba(255, 201, 74, .14); }
.item.locked { opacity: .5; }
.item .ic { font-size: 26px; } .item .tx { flex: 1; min-width: 0; } .item small { display: block; color: var(--dim); font-size: 12px; }
.item .pr { font-weight: 800; color: var(--gold); white-space: nowrap; }
.sw { width: 38px; height: 38px; border-radius: 50%; border: 3px solid transparent; } .sw.on { border-color: #fff; }

/* slots */
.reels { display: flex; gap: 10px; justify-content: center; padding: 14px; border-radius: 16px; background: linear-gradient(#2a0d18, #0d0408); border: 2px solid var(--gold2); box-shadow: inset 0 0 30px #000; }
.reel { width: 30%; max-width: 120px; aspect-ratio: 1; display: grid; place-items: center; font-size: clamp(40px, 13vw, 66px); background: linear-gradient(#fff, #ffeec2 50%, #fff); border-radius: 12px; box-shadow: inset 0 8px 14px rgba(0, 0, 0, .35), inset 0 -8px 14px rgba(0, 0, 0, .35); }
.reel.spin { filter: blur(1.5px); }
.slotmsg { text-align: center; min-height: 26px; margin: 10px 0 2px; color: var(--dim); font-weight: 600; }
.slotmsg.win { color: var(--gold); font-size: 20px; text-shadow: 0 0 14px rgba(255, 190, 60, .8); }
.bets { justify-content: center; }
.paytable { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 4px 10px; margin-top: 12px; font-size: 13px; color: var(--dim); }
.paytable b { color: var(--gold); }
.theme1 .reels { border-color: #b98cff; } .theme2 .reels { border-color: #55b6ff; } .theme3 .reels { border-color: #5fe08a; }

/* table sheet */
#tablep { position: fixed; z-index: 20; left: 50%; bottom: 0; transform: translateX(-50%); width: min(820px, 100vw); max-height: 62vh; overflow: auto; padding: 10px 14px max(12px, env(safe-area-inset-bottom)); background: linear-gradient(rgba(8, 40, 24, .93), rgba(4, 22, 14, .97)); border: 1px solid rgba(120, 255, 170, .25); border-bottom: 0; border-radius: 18px 18px 0 0; box-shadow: 0 -10px 50px rgba(0, 0, 0, .7); touch-action: pan-y; }
.th { display: flex; align-items: center; gap: 10px; }
.th b { font-size: 17px; color: var(--gold); } .th .x { margin-left: auto; } .th .pot { font-weight: 800; color: #fff; background: rgba(0, 0, 0, .35); padding: 2px 10px; border-radius: 999px; }
.dealer, .board { display: flex; align-items: center; gap: 6px; justify-content: center; min-height: 66px; margin: 6px 0; }
.dealer .lbl { margin-right: 8px; color: var(--dim); } .dealer .lbl b { color: #fff; font-size: 18px; }
.seats { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.seat { flex: 1 1 120px; max-width: 170px; background: rgba(0, 0, 0, .3); border: 1px solid rgba(255, 255, 255, .12); border-radius: 12px; padding: 6px 8px; text-align: center; min-height: 86px; }
.seats.pk .seat { flex-basis: 110px; }
.seat.me { border-color: var(--gold); } .seat.turn { box-shadow: 0 0 0 2px #fff, 0 0 18px rgba(255, 255, 255, .5); } .seat.out { opacity: .45; }
.seat .nm { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .nm em { font-style: normal; background: #fff; color: #000; border-radius: 50%; padding: 0 5px; margin-right: 4px; font-size: 11px; }
.seat .cards { min-height: 40px; display: flex; gap: 3px; justify-content: center; margin: 3px 0; }
.seat .info { font-size: 12px; color: var(--dim); } .seat .info b { color: #fff; } .seat .info i { color: #9fd8ff; }
.card { display: inline-grid; place-items: center; width: 44px; height: 62px; border-radius: 7px; background: #fff; color: #15151a; font-weight: 800; line-height: 1; box-shadow: 0 2px 6px rgba(0, 0, 0, .5); animation: deal .2s; }
.card b { font-size: 19px; } .card i { font-style: normal; font-size: 20px; margin-top: -8px; }
.card.red { color: #d0182c; }
.card.sm { width: 28px; height: 40px; border-radius: 5px; } .card.sm b { font-size: 13px; } .card.sm i { font-size: 13px; margin-top: -5px; }
.card.back { background: repeating-linear-gradient(45deg, #9a1226 0 5px, #c9283e 5px 10px); border: 2px solid #fff; }
@keyframes deal { from { transform: translateY(-14px) rotate(-8deg); opacity: 0; } }
.ctl { display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 10px; min-height: 48px; }
.ctl .row { justify-content: center; margin: 0; width: 100%; }
.ctl .raise input { flex: 1 1 140px; width: auto; padding: 0; }
.tl { font-weight: 700; color: #fff; background: rgba(0, 0, 0, .4); padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.res { font-weight: 800; } .res.WIN, .res.BLACKJACK { color: var(--gold); } .res.LOSE, .res.BUST { color: var(--red); } .res.PUSH { color: #cfd6e0; }
.ctl .res { font-size: 18px; text-align: center; }

/* range */
#scope { position: fixed; inset: 0; z-index: 12; pointer-events: none; background: radial-gradient(circle at 50% 50%, transparent 0, transparent min(36vh, 36vw), #000 calc(min(36vh, 36vw) + 2px)); }
#scope::before, #scope::after, #scope i { content: ''; position: absolute; background: #000; }
#scope::before { left: 50%; top: calc(50% - min(36vh, 36vw)); width: 1.5px; height: calc(min(36vh, 36vw) * 2); margin-left: -.75px; }
#scope::after { top: 50%; left: calc(50% - min(36vh, 36vw)); height: 1.5px; width: calc(min(36vh, 36vw) * 2); margin-top: -.75px; }
#scope i { left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px; border-radius: 50%; background: #e0202a; }
#rangeui > * { position: fixed; z-index: 14; }
#rInfo { top: max(64px, calc(env(safe-area-inset-top) + 54px)); left: 50%; transform: translateX(-50%); background: rgba(0, 0, 0, .55); padding: 5px 14px; border-radius: 999px; font-weight: 600; }
#rInfo b { color: var(--gold); font-size: 18px; }
.cross { left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .8); pointer-events: none; }
#rStart { left: 50%; bottom: max(26px, env(safe-area-inset-bottom)); transform: translateX(-50%); }
#rExit { left: max(12px, env(safe-area-inset-left)); bottom: max(26px, env(safe-area-inset-bottom)); }
.rb { display: none; width: 92px; height: 92px; border-radius: 50%; font-weight: 800; background: rgba(255, 255, 255, .14); border: 2px solid rgba(255, 255, 255, .5); touch-action: none; }
.rb.fire { background: rgba(255, 60, 60, .35); border-color: #ff8a8a; }
body.touch .rb { display: block; }
#rScope { right: 124px; bottom: max(30px, env(safe-area-inset-bottom)); } #rFire { right: 20px; bottom: max(86px, calc(env(safe-area-inset-bottom) + 60px)); }
body.touch #rStart { bottom: auto; top: 110px; } body.touch #rExit { bottom: auto; top: 110px; }
.rpop { left: 50%; top: 38%; transform: translateX(-50%); font-weight: 800; font-size: 20px; color: #fff; text-shadow: 0 2px 6px #000; animation: rp 1.1s ease-out forwards; pointer-events: none; white-space: nowrap; }
.rpop.qs { color: var(--gold); font-size: 26px; }
.rpop.big { top: 26%; animation: none; background: rgba(0, 0, 0, .7); padding: 10px 18px; border-radius: 12px; font-size: 16px; white-space: normal; text-align: center; width: min(92vw, 560px); }
@keyframes rp { to { transform: translate(-50%, -60px); opacity: 0; } }
body.fps #btns, body.fps #chatlog, body.fps #net { opacity: .35; }

/* fishing */
#fishui > * { position: fixed; z-index: 14; }
#fMsg { left: 50%; top: max(104px, calc(env(safe-area-inset-top) + 94px)); transform: translateX(-50%); background: rgba(0, 0, 0, .6); padding: 7px 16px; border-radius: 12px; text-align: center; width: max-content; max-width: 92vw; }
#fMsg:empty { display: none; }
#fBars { left: 50%; bottom: max(110px, calc(env(safe-area-inset-bottom) + 100px)); transform: translateX(-50%); width: min(420px, 86vw); display: grid; gap: 6px; }
.bar { position: relative; height: 20px; background: rgba(0, 0, 0, .6); border: 1px solid rgba(255, 255, 255, .3); border-radius: 999px; overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: linear-gradient(90deg, #2fb0ff, #6cff8a); }
.bar.ten i { background: #6cff8a; } .bar.ten i.hot { background: #ff4a4a; }
.bar span { position: absolute; inset: 0; text-align: center; font-size: 11px; font-weight: 700; line-height: 19px; text-shadow: 0 1px 2px #000; }
#fBars.charge .ten { display: none; } #fBars.charge .bar span { visibility: hidden; }
#fAct { left: 50%; bottom: max(30px, calc(env(safe-area-inset-bottom) + 20px)); transform: translateX(-50%); min-width: 190px; padding: 18px; font-size: 18px; touch-action: none; }
#fAct.alert { background: linear-gradient(#ff8a8a, #e02030); color: #fff; animation: pulse .4s infinite; }
#fExit { left: max(12px, env(safe-area-inset-left)); bottom: max(30px, calc(env(safe-area-inset-bottom) + 20px)); }
#fishui.shake #fBars { animation: shake .12s infinite; }
@keyframes shake { 50% { transform: translateX(calc(-50% + 4px)); } }

/* upgrade tree */
.treewrap { overflow: auto; -webkit-overflow-scrolling: touch; touch-action: pan-x pan-y; border-radius: 12px; background: rgba(0, 0, 0, .25); padding: 4px; }
.tree { position: relative; }
.tree svg { position: absolute; inset: 0; }
.tree line { stroke: rgba(255, 255, 255, .2); stroke-width: 3; } .tree line.on { stroke: var(--gold); }
.bh { position: absolute; top: 4px; width: 132px; text-align: center; font-weight: 800; color: #8fd8ff; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; }
.node { position: absolute; width: 132px; height: 84px; padding: 6px 7px; border-radius: 12px; text-align: left; background: #1d1118; border: 2px solid rgba(255, 255, 255, .16); display: flex; flex-direction: column; }
.node b { font-size: 13px; line-height: 1.15; } .node small { font-size: 10.5px; color: var(--dim); line-height: 1.2; flex: 1; } .node span { font-weight: 800; font-size: 12px; color: var(--gold); }
.node.ok { border-color: var(--gold); box-shadow: 0 0 12px rgba(255, 190, 60, .35); }
.node.own { background: #123a22; border-color: var(--green); } .node.own span { color: var(--green); }
.node.lock { opacity: .5; }

@media (max-height: 480px) {
  .panel { max-height: 96vh; } #tablep { max-height: 78vh; } .dealer, .board { min-height: 46px; margin: 2px 0; }
  .card { width: 34px; height: 48px; } .card b { font-size: 15px; } .card i { font-size: 15px; margin-top: -6px; }
  .seat { min-height: 0; padding: 4px 6px; } .ctl { margin-top: 5px; } .big { padding: 9px 14px; }
  #chatlog { top: 70px; } .reel { max-width: 84px; font-size: 40px; }
}
@media (max-width: 560px) { .panel.side { width: 94vw; left: 50%; right: auto; top: auto; bottom: 8px; transform: translateX(-50%); max-height: 52vh; } #net { font-size: 10px; top: 56px; } }
