:root {
  --lime: #A4CD39;
  --lime-d: #86ab27;
  --ink: #252525;
  --bg: #0f110f;
  --panel: #181b18;
  --panel2: #202420;
  --line: rgba(255,255,255,.09);
  --text: #f3f5f0;
  --muted: #98a094;
  --felt1: #0f5a32;
  --felt2: #07351d;
  --red: #c1121f;
  --cw: 64px;
  --ch: 57.6px;
  font-family: Arial, Helvetica, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { overflow-x: hidden; -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--lime); }

/* ---------- brand bits ---------- */
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo { height: 34px; width: auto; display: block; }
.brand-text { font-weight: 800; letter-spacing: .02em; font-size: 18px; }
.brand-text span { color: var(--lime); }
.brand.big .logo { height: 54px; }
.brand.big .brand-text { font-size: 26px; }
.logo-fallback { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--lime); color: var(--ink); font-weight: 900; }

.icon { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel2); display: grid; place-items: center; font-size: 17px; transition: .15s; }
.icon:hover { border-color: var(--lime); color: var(--lime); }
.icon.info { font-family: Georgia, serif; font-style: italic; font-weight: 700; font-size: 19px; background: var(--lime); color: var(--ink); border-color: var(--lime); }
.icon.info:hover { background: #fff; color: var(--ink); }
.pill { border: 1px solid var(--line); background: var(--panel2); border-radius: 999px; padding: 9px 16px; font-size: 14px; color: var(--muted); }
.pill b { color: var(--lime); letter-spacing: .12em; margin: 0 4px; }
.pill:hover { border-color: var(--lime); }

.btn { border: 1px solid var(--line); background: var(--panel2); border-radius: 999px; padding: 12px 20px; font-weight: 700; font-size: 14px; letter-spacing: .03em; transition: .15s; }
.btn:hover:not(:disabled) { border-color: var(--lime); color: var(--lime); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn.primary { background: var(--lime); color: var(--ink); border-color: var(--lime); }
.btn.primary:hover:not(:disabled) { background: #fff; color: var(--ink); border-color: #fff; }
.btn.primary.on { background: #fff; box-shadow: 0 0 0 3px rgba(164,205,57,.45); }
.link { background: none; border: 0; color: var(--lime); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 0; }

/* ---------- lobby ---------- */
.screen { min-height: 100%; }
#lobby { display: grid; place-items: center; padding: 24px 16px; position: relative;
  background: radial-gradient(1000px 600px at 50% -10%, rgba(164,205,57,.16), transparent 60%), radial-gradient(700px 500px at 100% 100%, rgba(15,90,50,.5), transparent 60%), var(--bg); }
.lobby-card { width: min(440px, 100%); background: rgba(24,27,24,.9); border: 1px solid var(--line); border-radius: 28px; padding: 34px 30px 26px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.lobby-card h1 { margin: 22px 0 4px; font-size: clamp(44px, 9vw, 64px); line-height: .95; font-weight: 900; text-transform: uppercase; letter-spacing: -.01em; }
.lobby-card h1 .dot { color: var(--lime); }
.tag { margin: 0 0 22px; color: var(--muted); }
.tag b { color: var(--text); }
label { display: block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
label small { text-transform: none; letter-spacing: 0; opacity: .8; }
input { display: block; width: 100%; margin-top: 6px; padding: 14px 18px; background: #0c0e0c; border: 1px solid var(--line); border-radius: 999px; color: var(--text); font-size: 17px; outline: none; }
input:focus { border-color: var(--lime); box-shadow: 0 0 0 3px rgba(164,205,57,.18); }
.row { display: flex; gap: 10px; margin-top: 6px; }
.row .btn { flex: 1; padding: 15px 20px; font-size: 16px; }
.err { color: #ff7a85; min-height: 18px; margin: 10px 0 0; font-size: 14px; }
.fine { color: var(--muted); font-size: 12px; margin: 10px 0 0; line-height: 1.5; }
.floating { position: absolute; top: 16px; right: 16px; }

/* ---------- game layout ---------- */
.top { display: flex; align-items: center; gap: 16px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: rgba(15,17,15,.92); position: sticky; top: 0; z-index: 30; backdrop-filter: blur(8px); }
.top .title { font-weight: 900; text-transform: uppercase; letter-spacing: .18em; font-size: 14px; color: var(--muted); flex: 1; text-align: center; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 16px; padding: 14px 18px 8px; max-width: 1500px; margin: 0 auto; }
.stage { min-width: 0; }
.side { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; }
.panel.grow { flex: 1; min-height: 180px; display: flex; flex-direction: column; }
.panel h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); display: flex; justify-content: space-between; align-items: center; }
.foot { text-align: center; padding: 14px; color: var(--muted); font-size: 12px; }

.banner { text-align: center; font-size: clamp(26px, 4.2vw, 46px); font-weight: 900; line-height: 1.1; letter-spacing: .01em;
  text-shadow: 0 3px 0 rgba(0,0,0,.6), 0 0 22px rgba(0,0,0,.4); padding: 4px 0 8px; min-height: 1.3em; }
.banner.go { color: #fff; }
.banner.lock { color: #ff6b75; }
.banner.spin { color: var(--lime); }
.banner.res { color: #ffd23a; }
.timer { display: inline-block; margin-left: 14px; padding: 2px 14px; border-radius: 999px; background: var(--lime); color: var(--ink); font-size: .5em; vertical-align: middle; text-shadow: none; font-variant-numeric: tabular-nums; }
.timer:empty { display: none; }
.timer.low { background: #ff4d5a; color: #fff; animation: pulse .5s infinite alternate; }
@keyframes pulse { to { transform: scale(1.12); } }

.history { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; min-height: 32px; margin-bottom: 10px; }
.hball { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; border: 2px solid rgba(255,255,255,.35); }
.hball:first-child { width: 36px; height: 36px; font-size: 14px; border-color: var(--lime); box-shadow: 0 0 12px rgba(164,205,57,.5); }
.hball.red { background: var(--red); } .hball.black { background: #141517; } .hball.green { background: #0a7a3a; }
.hempty { color: var(--muted); font-size: 13px; align-self: center; }

/* ---------- table ---------- */
.tablewrap { overflow-x: auto; padding: 4px 0 6px; }
.table { position: relative; margin: 0 auto; width: calc(var(--cw) * 14.4); height: calc(var(--ch) * 5);
  font-family: Georgia, 'Times New Roman', serif; user-select: none; -webkit-user-select: none; touch-action: manipulation;
  background: radial-gradient(120% 120% at 50% 40%, var(--felt1), var(--felt2)); border-radius: 18px;
  box-shadow: 0 0 0 4px #1a1a1a, 0 0 0 6px var(--lime), 0 24px 50px rgba(0,0,0,.55); }
.spot { position: absolute; display: grid; place-items: center; cursor: pointer; transform: translate(-50%, -50%); }
.spot.k-n, .spot.k-out { box-shadow: inset 0 0 0 1px rgba(255,255,255,.7); }
.spot.k-n:hover, .spot.k-out:hover { background: rgba(255,255,255,.08); }
.spot.k-n[data-key="n:37"] { border-top-left-radius: calc(var(--cw) * .55); }
.spot.k-n[data-key="n:0"] { border-bottom-left-radius: calc(var(--cw) * .55); }
.spot.hot { z-index: 20; border-radius: 6px; }
.spot.hot.k-co, .spot.hot.k-sx, .spot.hot.k-tr, .spot.hot.k-bk { z-index: 30; border-radius: 50%; }
.spot.hot:hover { background: rgba(164,205,57,.55); box-shadow: 0 0 0 2px var(--lime); }
.spot.hl-cell { background: rgba(164,205,57,.28) !important; }
.num { display: grid; place-items: center; width: 72%; height: 80%; border-radius: 50%; color: #fff; font-weight: 700; font-size: calc(var(--cw) * .38); pointer-events: none; box-shadow: inset 0 -3px 6px rgba(0,0,0,.35); }
.num.red { background: radial-gradient(circle at 40% 30%, #e0282f, var(--red)); }
.num.black { background: radial-gradient(circle at 40% 30%, #34363a, #0e0f11); }
.num.green { background: radial-gradient(circle at 40% 30%, #12a054, #0a6b36); }
.k-n[data-key="n:0"] .num, .k-n[data-key="n:37"] .num { width: 62%; height: 52%; font-size: calc(var(--cw) * .34); }
.olabel { color: #fff; font-weight: 700; font-size: calc(var(--cw) * .32); pointer-events: none; text-align: center; line-height: 1.1; }
.k-out[data-key^="col"] .olabel { font-size: calc(var(--cw) * .24); letter-spacing: .02em; }
.diamond { width: calc(var(--cw) * .85); height: calc(var(--ch) * .5); background: var(--c); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); pointer-events: none; box-shadow: inset 0 0 0 2px #fff; filter: drop-shadow(0 0 1px #fff); }
.spot.winning { z-index: 5; animation: win 1s ease-in-out infinite alternate; }
@keyframes win { from { box-shadow: inset 0 0 0 3px var(--lime), 0 0 6px rgba(164,205,57,.4); background: rgba(164,205,57,.18); } to { box-shadow: inset 0 0 0 3px #fff, 0 0 26px rgba(164,205,57,.95); background: rgba(164,205,57,.38); } }

#chipLayer { position: absolute; inset: 0; pointer-events: none; z-index: 40; }
.bchip { position: absolute; width: calc(var(--cw) * .5); height: calc(var(--cw) * .5); border-radius: 50%; transform: translate(-50%, -50%);
  background: repeating-conic-gradient(#fff 0 14deg, var(--c) 14deg 45deg); box-shadow: 0 3px 5px rgba(0,0,0,.55); display: grid; place-items: center; }
.bchip i { position: absolute; inset: 11%; border-radius: 50%; background: var(--c); border: 1.5px dashed rgba(255,255,255,.85); }
.bchip b { position: relative; width: 56%; height: 56%; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; font-family: Arial, sans-serif; font-weight: 900; font-size: calc(var(--cw) * .15); letter-spacing: -.03em; }
.bchip.mine { box-shadow: 0 0 0 2px #fff, 0 3px 6px rgba(0,0,0,.6); }
.bchip.pop { animation: pop .25s ease-out; }
@keyframes pop { 0% { transform: translate(-50%, -150%) scale(1.5); opacity: 0; } 70% { transform: translate(-50%, -45%) scale(1.05); opacity: 1; } 100% { transform: translate(-50%, -50%) scale(1); } }
.bchip.won { animation: chipwin .7s ease-in-out infinite alternate; }
@keyframes chipwin { to { transform: translate(-50%, -60%) scale(1.18); filter: brightness(1.25); } }
.bchip.lost { opacity: .45; filter: grayscale(.6); }

.tip { text-align: center; color: var(--muted); font-size: 13px; min-height: 22px; margin: 6px 0 10px; }
.tip b { color: var(--lime); }

/* ---------- controls ---------- */
.controls { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; justify-content: center; background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 14px 18px; }
.rack { display: flex; gap: 10px; align-items: center; }
.chip { --c: #888; --e: #fff; width: 64px; height: 64px; border-radius: 50%; border: 0; padding: 0; position: relative; display: grid; place-items: center;
  background: repeating-conic-gradient(var(--e) 0 13deg, var(--c) 13deg 45deg); box-shadow: 0 5px 10px rgba(0,0,0,.55); transition: transform .15s, box-shadow .15s, filter .15s; }
.chip i { position: absolute; inset: 7px; border-radius: 50%; background: var(--c); border: 2px dashed rgba(255,255,255,.85); }
.chip b { position: relative; width: 36px; height: 36px; border-radius: 50%; background: #fff; color: #111; display: grid; place-items: center; font-weight: 900; font-size: 15px; letter-spacing: -.03em; }
.chip:hover { transform: translateY(-3px); }
.chip.sel { transform: translateY(-8px) scale(1.1); box-shadow: 0 0 0 3px var(--lime), 0 12px 18px rgba(0,0,0,.6); }
.chip.dim { filter: grayscale(.8) brightness(.6); }
.money { display: flex; gap: 22px; }
.money div { display: flex; flex-direction: column; }
.money span { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.money b { font-size: 24px; font-variant-numeric: tabular-nums; }
#balance { color: var(--lime); }
.btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* ---------- side panels ---------- */
.players, .feed { list-style: none; margin: 0; padding: 0; }
.players li { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.players li:last-child { border: 0; }
.players .dotc { width: 14px; height: 14px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px rgba(255,255,255,.18); }
.players .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.players .nm em { color: var(--lime); font-style: normal; font-size: 11px; margin-left: 6px; text-transform: uppercase; letter-spacing: .08em; }
.players .sub { color: var(--muted); font-size: 12px; display: block; }
.players .bal { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.players .rdy { color: var(--lime); font-size: 12px; display: block; }
.players li.off { opacity: .4; }
.feed { overflow-y: auto; flex: 1; max-height: 260px; font-size: 13px; color: var(--muted); }
.feed li { padding: 5px 0; border-bottom: 1px dashed var(--line); }
.feed li.win { color: var(--lime); font-weight: 700; }
.feed li.res { color: var(--text); }

/* ---------- wheel overlay ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: radial-gradient(circle at 50% 50%, rgba(0,0,0,.72), rgba(0,0,0,.92)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; cursor: pointer; animation: fade .3s; }
@keyframes fade { from { opacity: 0; } }
.fx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.wheel-title { font-size: clamp(30px, 6vw, 54px); font-weight: 900; color: var(--lime); text-shadow: 0 4px 0 #000, 0 0 30px rgba(0,0,0,.6); min-height: 1.2em; text-align: center; z-index: 1; padding: 0 10px; }
.wheel-title.red { color: #ff5560; } .wheel-title.black { color: #fff; } .wheel-title.green { color: var(--lime); }
.wheel-canvas { width: min(70vh, 92vw, 640px); height: min(70vh, 92vw, 640px); z-index: 1; filter: drop-shadow(0 20px 40px rgba(0,0,0,.6)); }
.wheel-sub { font-size: clamp(16px, 2.6vw, 22px); font-weight: 700; min-height: 1.4em; text-align: center; z-index: 1; padding: 0 10px; }
.wheel-sub.win { color: var(--lime); } .wheel-sub.lose { color: #ff8b94; } .wheel-sub.idle { color: var(--muted); }
.wheel-hint { color: var(--muted); font-size: 12px; min-height: 16px; z-index: 1; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.7); display: grid; place-items: center; padding: 16px; backdrop-filter: blur(4px); animation: fade .2s; }
.modal-card { width: min(640px, 100%); max-height: min(86vh, 760px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 26px; box-shadow: 0 30px 90px rgba(0,0,0,.6); overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 18px 20px 8px; }
.modal-head h2 { flex: 1; margin: 0; font-size: 22px; text-transform: uppercase; letter-spacing: .08em; }
.tabs { display: flex; gap: 6px; padding: 8px 20px 0; flex-wrap: wrap; }
.tab { background: none; border: 1px solid var(--line); border-radius: 999px; padding: 8px 16px; font-size: 13px; font-weight: 700; color: var(--muted); }
.tab.active { background: var(--lime); border-color: var(--lime); color: var(--ink); }
.modal-body { padding: 16px 20px 22px; overflow-y: auto; line-height: 1.55; font-size: 14.5px; }
.gcard { display: flex; gap: 16px; align-items: center; padding: 16px; border: 1px solid var(--lime); border-radius: 20px; background: linear-gradient(135deg, rgba(164,205,57,.14), rgba(15,90,50,.25)); margin-bottom: 12px; }
.gcard.soon { border-style: dashed; border-color: var(--line); background: none; color: var(--muted); }
.gthumb { flex: none; width: 76px; height: 76px; border-radius: 18px; background: radial-gradient(circle at 35% 30%, #d9622a, #5e1c08); display: grid; place-items: center; box-shadow: inset 0 0 0 3px #d9b45a; }
.gthumb svg { width: 52px; height: 52px; }
.gcard h4 { margin: 0 0 2px; font-size: 18px; }
.gcard p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
.badge { display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 10px; border-radius: 999px; background: var(--lime); color: var(--ink); text-transform: uppercase; letter-spacing: .08em; margin-left: 8px; vertical-align: middle; }
.modal-body ol, .modal-body ul { padding-left: 20px; margin: 8px 0; }
.modal-body li { margin: 5px 0; }
.modal-body h4 { margin: 14px 0 4px; color: var(--lime); text-transform: uppercase; letter-spacing: .1em; font-size: 12px; }
table.pay { width: 100%; border-collapse: collapse; font-size: 14px; }
table.pay td, table.pay th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
table.pay th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
table.pay td:last-child { text-align: right; color: var(--lime); font-weight: 700; }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #fff; color: var(--ink); font-weight: 700; padding: 12px 22px; border-radius: 999px; z-index: 90; box-shadow: 0 10px 30px rgba(0,0,0,.5); max-width: 90vw; text-align: center; }
.reconnect { position: fixed; top: 0; left: 0; right: 0; background: #ff4d5a; color: #fff; text-align: center; padding: 8px; z-index: 100; font-weight: 700; font-size: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .side { flex-direction: row; flex-wrap: wrap; }
  .side .panel { flex: 1 1 280px; }
}
@media (max-width: 640px) {
  .top { padding: 8px 12px; gap: 8px; }
  .top .title, .brand-text { display: none; }
  .layout { padding: 10px 8px; }
  .chip { width: 52px; height: 52px; } .chip i { inset: 6px; } .chip b { width: 28px; height: 28px; font-size: 12px; }
  .controls { gap: 12px; padding: 12px; }
  .money b { font-size: 20px; }
  .btn { padding: 11px 15px; }
}
