* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0b0710; color: #fff3dd; font-family: system-ui, sans-serif; touch-action: none; user-select: none; -webkit-user-select: none; }
canvas { display: block; width: 100vw; height: 100vh; }
.overlay { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; text-align: center; background: radial-gradient(#2a0f2acc, #000e); padding: 1rem; }
.overlay h1 { font-size: clamp(2rem, 8vw, 4rem); margin: 0; color: #ffd54f; text-shadow: 0 0 18px #ff4fa8, 0 3px 0 #7a1f4a; }
.small { font-size: .9rem; opacity: .8; }
.btn { font: inherit; font-size: 1.3rem; font-weight: 800; padding: .7rem 2rem; border: 0; border-radius: 12px; background: linear-gradient(#ffd54f, #e09a00); color: #2a1600; cursor: pointer; box-shadow: 0 4px 0 #7a4b00; }
.btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #7a4b00; }
.btn:disabled { opacity: .4; cursor: default; }
.btn2 { background: linear-gradient(#8fd3ff, #3a8ad6); color: #021; box-shadow: 0 4px 0 #1b4a7a; }
.btn.red { background: linear-gradient(#ff7b7b, #c62828); color: #fff; box-shadow: 0 4px 0 #6d0f0f; }
.btn.green { background: linear-gradient(#7dff9a, #1f9e45); color: #021; box-shadow: 0 4px 0 #0d5a24; }
.hud { position: fixed; top: 10px; left: 12px; font-weight: 800; text-shadow: 0 2px 4px #000; pointer-events: none; }
.hud .cash { font-size: 1.6rem; color: #9dff9d; }
.hud .debt { font-size: 1.05rem; color: #ff8a8a; }
.hud .goal { font-size: .85rem; opacity: .75; }
.cross { position: fixed; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: #fff9; pointer-events: none; }
.prompt { position: fixed; left: 50%; bottom: 14%; transform: translateX(-50%); font: inherit; font-size: 1.2rem; font-weight: 800; padding: .7rem 1.6rem; border-radius: 14px; border: 2px solid #ffd54f; background: #1a0b1fdd; color: #ffd54f; cursor: pointer; }
.joy { position: fixed; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; border: 2px solid #fff5; background: #fff1; pointer-events: none; }
.knob { position: absolute; left: 50%; top: 50%; width: 50px; height: 50px; margin: -25px; border-radius: 50%; background: #fff6; }
.toast { position: fixed; top: 18%; left: 50%; transform: translateX(-50%); padding: .6rem 1.2rem; border-radius: 10px; background: #000c; font-weight: 700; text-align: center; pointer-events: none; max-width: 90vw; z-index: 60; }
.hidden { display: none !important; }

/* game panel */
.panel { background: #000a; justify-content: center; }
.panel .box { width: min(560px, 96vw); max-height: 96vh; overflow-y: auto; background: linear-gradient(#2b1233, #160a1b); border: 3px solid #ffd54f; border-radius: 18px; padding: .8rem 1rem 1rem; box-shadow: 0 0 40px #ff4fa855; touch-action: pan-y; }
.phead { display: flex; align-items: center; justify-content: space-between; }
.phead h2 { margin: 0; color: #ffd54f; font-size: 1.5rem; }
.x { font: inherit; font-size: 1.3rem; width: 2.4rem; height: 2.4rem; border-radius: 50%; border: 0; background: #fff2; color: #fff; cursor: pointer; }
.x:disabled { opacity: .3; }
.pmoney { font-weight: 800; color: #9dff9d; font-size: 1.1rem; margin-bottom: .4rem; text-align: left; }
#pbody { display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.msg { min-height: 1.6em; font-weight: 800; font-size: 1.2rem; }
.msg.win { color: #7dff9a; } .msg.lose { color: #ff7b7b; }
.row { display: flex; flex-wrap: wrap; gap: .35rem; justify-content: center; align-items: center; }
.chip { font: inherit; font-weight: 800; font-size: .9rem; padding: .45rem .6rem; min-width: 2.8rem; border-radius: 999px; border: 2px dashed #fff8; background: #c62828; color: #fff; cursor: pointer; }
.chip:nth-child(3n) { background: #1565c0; } .chip:nth-child(3n+1) { background: #2e7d32; }
.betv { font-size: 1.3rem; font-weight: 900; color: #ffd54f; min-width: 6rem; }
.betv.bad { color: #ff7b7b; }
.opt { font: inherit; font-weight: 700; padding: .45rem .7rem; border-radius: 8px; border: 2px solid #fff3; background: #3a1d44; color: #fff; cursor: pointer; }
.opt.sel { border-color: #ffd54f; background: #6a3a00; }
.opt.r { background: #b71c1c; } .opt.b { background: #222; } .opt.r.sel, .opt.b.sel { border-color: #ffd54f; box-shadow: 0 0 0 2px #ffd54f; }
.pay { font-size: .8rem; opacity: .8; }
/* slots */
.reels { display: flex; gap: .4rem; background: #000; padding: .5rem; border-radius: 12px; border: 3px solid #c62828; }
.reel { width: 4.4rem; height: 4.4rem; display: flex; align-items: center; justify-content: center; font-size: 3rem; background: #fff; border-radius: 8px; }
/* cards */
.hand { display: flex; gap: .3rem; min-height: 4.6rem; }
.card { width: 3.2rem; height: 4.5rem; border-radius: 6px; background: #fff; color: #111; font-weight: 900; font-size: 1.15rem; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 2px 4px #0008; animation: deal .25s; }
.card.red { color: #c62828; } .card.back { background: repeating-linear-gradient(45deg, #b71c1c 0 6px, #7f0000 6px 12px); }
@keyframes deal { from { transform: translateY(-20px); opacity: 0; } }
.lbl { font-size: .85rem; opacity: .8; }
/* coin */
.coinwrap { perspective: 600px; height: 8rem; display: flex; align-items: center; }
.coin { width: 7rem; height: 7rem; position: relative; transform-style: preserve-3d; }
.coin div { position: absolute; inset: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; font-weight: 900; color: #5a3a00; background: radial-gradient(#ffe680, #d49b00); border: 5px solid #b07d00; backface-visibility: hidden; }
.coin .t { transform: rotateY(180deg); }
canvas.mini { width: min(300px, 80vw); height: auto; display: block; }
.hud .items { font-size: 1.3rem; }
.hud .work { font-size: .95rem; color: #ffcc80; max-width: 70vw; }
.hud .drunk { font-size: .95rem; color: #ffd54f; }
.blackout { position: fixed; inset: 0; background: #000; z-index: 70; transition: opacity 1s; pointer-events: none; }
.dice { display: flex; gap: 1rem; }
.die { font-size: 5rem; line-height: 1; color: #fff; transition: transform .07s; }
.scratch { position: relative; width: min(300px, 86vw); aspect-ratio: 300 / 160; }
.cells { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); background: #fff8e1; border-radius: 8px; }
.cell { display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 1.1rem; color: #4e342e; border: 1px dashed #d7ccc8; }
.cell.hit { background: #ffd54f; color: #b71c1c; }
.cover { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; border-radius: 8px; cursor: crosshair; }
.plate { touch-action: none; cursor: grab; border-radius: 12px; }
.shop { display: flex; flex-direction: column; gap: .35rem; width: 100%; }
.shoprow { display: flex; align-items: center; gap: .5rem; background: #ffffff10; padding: .35rem .5rem; border-radius: 8px; text-align: left; }
.shoprow.own { background: #ffd54f22; }
.shoprow .em { font-size: 1.6rem; width: 2rem; text-align: center; }
.shoprow .nm { flex: 1; font-weight: 700; }
.shoprow .pr { color: #9dff9d; font-weight: 800; }
.amount { font: inherit; font-size: 1.3rem; font-weight: 800; width: 12rem; padding: .5rem .7rem; border-radius: 10px; border: 2px solid #ffd54f; background: #000a; color: #fff; text-align: center; user-select: text; -webkit-user-select: text; }
.cases { display: flex; gap: .4rem; flex-wrap: wrap; justify-content: center; }
.case { font: inherit; width: 4.2rem; height: 4.6rem; border-radius: 10px; border: 2px solid #ffd54f55; background: #2b2233; color: #fff; font-size: 2rem; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; }
.case span { font-size: .75rem; font-weight: 800; }
.case.ready:hover { border-color: #ffd54f; }
.case.mine { border-color: #ffd54f; box-shadow: 0 0 12px #ffd54f; }
.case.open { font-size: 1.1rem; font-weight: 900; background: #3a2a14; animation: deal .3s; }
.btn.black { background: linear-gradient(#555, #111); color: #fff; box-shadow: 0 4px 0 #000; }
.cine { position: fixed; inset: 0; z-index: 65; pointer-events: none; }
.cine .bar { position: absolute; left: 0; right: 0; height: 11vh; background: #000; }
.cine .bar.top { top: 0; } .cine .bar.bottom { bottom: 0; }
.cinefade { position: absolute; inset: 0; background: #000; opacity: 1; }
.caption { position: absolute; left: 0; right: 0; bottom: 13vh; text-align: center; font-size: clamp(1.1rem, 3.5vw, 1.8rem); font-weight: 700; color: #fff; text-shadow: 0 2px 6px #000; opacity: 0; transition: opacity .5s; padding: 0 1rem; }
