:root {
  --bg: #0a0f0d;
  --bg2: #101915;
  --panel: #16211c;
  --panel2: #1d2b24;
  --line: #2a3a31;
  --felt: #0e5c3a;
  --felt2: #0a4a2f;
  --gold: #f6c945;
  --gold2: #e0a92e;
  --red: #ff4d6d;
  --green: #3ddc84;
  --blue: #4cc3ff;
  --text: #eef3ef;
  --muted: #93a89b;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --r: 16px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, #143024 0%, var(--bg) 55%);
  color: var(--text);
  overscroll-behavior: none;
}
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; max-width: 560px; margin: 0 auto; }
#view { flex: 1; overflow-y: auto; padding: 14px 14px 90px; -webkit-overflow-scrolling: touch; }
.hidden { display: none !important; }
h1, h2, h3 { margin: 0 0 10px; }
h2 { font-size: 20px; }
h3 { font-size: 15px; color: var(--gold); }
p { margin: 6px 0; line-height: 1.45; }
small { color: var(--muted); }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.center { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grow { flex: 1; }

/* topbar */
#topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: linear-gradient(180deg, rgba(20,40,30,.9), rgba(10,15,13,.6));
  border-bottom: 1px solid var(--line); backdrop-filter: blur(8px);
}
#topbar .ava { font-size: 26px; width: 42px; height: 42px; display: grid; place-items: center;
  background: var(--panel2); border-radius: 12px; border: 1px solid var(--line); }
#topbar .who { flex: 1; min-width: 0; }
#topbar .nick { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#topbar .lvl { font-size: 11px; color: var(--muted); }
.balance-pill { display: flex; align-items: center; gap: 6px; background: linear-gradient(135deg, #2a2410, #3a3012);
  border: 1px solid var(--gold2); color: var(--gold); font-weight: 800; padding: 7px 12px; border-radius: 999px; font-size: 14px; }
.xpbar { height: 5px; background: #0c1410; border-radius: 4px; overflow: hidden; margin-top: 4px; }
.xpbar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold2), var(--gold)); }

/* tabbar */
#tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 560px;
  display: flex; background: rgba(12,18,15,.96); border-top: 1px solid var(--line); backdrop-filter: blur(10px);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 30; }
#tabbar button { flex: 1; background: none; border: 0; color: var(--muted); font-size: 10px; padding: 6px 2px;
  display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; border-radius: 10px; }
#tabbar button .ic { font-size: 20px; }
#tabbar button.active { color: var(--gold); }

/* buttons */
.btn { appearance: none; border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 700; cursor: pointer; transition: .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold2)); color: #231a02; border-color: transparent;
  box-shadow: 0 6px 18px rgba(246,201,69,.28); }
.btn-red { background: linear-gradient(135deg, #ff5d78, #e23a57); color: #fff; border-color: transparent; }
.btn-green { background: linear-gradient(135deg, #43e08a, #22b566); color: #04230f; border-color: transparent; }
.btn-ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }

/* panels & cards */
.panel { background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line);
  border-radius: var(--r); padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.game-card { position: relative; border-radius: 18px; padding: 18px 16px; min-height: 120px; cursor: pointer;
  border: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end;
  transition: .15s; box-shadow: var(--shadow); }
.game-card:active { transform: scale(.97); }
.game-card .big { position: absolute; top: 8px; right: 12px; font-size: 52px; opacity: .9; filter: drop-shadow(0 6px 10px rgba(0,0,0,.4)); }
.game-card h3 { color: #fff; font-size: 18px; margin: 0; }
.game-card p { margin: 2px 0 0; font-size: 12px; color: rgba(255,255,255,.8); }
.gc-rl { background: linear-gradient(135deg, #7a1f2b, #b3243c); }
.gc-bj { background: linear-gradient(135deg, #0d5c3a, #12805a); }
.gc-pk { background: linear-gradient(135deg, #2b3a8f, #4353c9); }
.tile { background: var(--panel2); border: 1px solid var(--line); border-radius: 14px; padding: 12px; cursor: pointer; transition: .15s; }
.tile:active { transform: scale(.97); }
.tile .ic { font-size: 24px; }
.tile .t { font-weight: 700; font-size: 13px; margin-top: 6px; }
.tile .d { font-size: 11px; color: var(--muted); }

/* chips */
.chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.chip { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 12px;
  cursor: pointer; border: 3px dashed rgba(255,255,255,.7); color: #fff; box-shadow: 0 4px 10px rgba(0,0,0,.4); transition: .12s; }
.chip:active { transform: scale(.9); }
.chip.sel { outline: 3px solid var(--gold); outline-offset: 2px; transform: translateY(-3px); }
.chip.c10 { background: radial-gradient(circle at 35% 30%, #6fb1ff, #2b6cb0); }
.chip.c50 { background: radial-gradient(circle at 35% 30%, #6ee7a0, #1f9d57); }
.chip.c100 { background: radial-gradient(circle at 35% 30%, #ff8fa3, #d63357); }
.chip.c500 { background: radial-gradient(circle at 35% 30%, #c9a3ff, #7b3ff2); }
.chip.c1000 { background: radial-gradient(circle at 35% 30%, #ffd97a, #d99a1b); color: #231a02; }

/* felt table */
.felt { background: radial-gradient(120% 120% at 50% 0%, var(--felt) 0%, var(--felt2) 70%);
  border: 6px solid #3a2a17; border-radius: 22px; padding: 16px; box-shadow: inset 0 0 40px rgba(0,0,0,.4), var(--shadow);
  position: relative; }
.felt::before { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(255,255,255,.12); border-radius: 16px; pointer-events: none; }
.table-label { text-align: center; color: rgba(255,255,255,.55); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 8px; }
.hand { display: flex; gap: 8px; justify-content: center; min-height: 92px; flex-wrap: wrap; }
.hand-label { text-align: center; font-size: 12px; color: rgba(255,255,255,.8); margin: 6px 0; }
.score-badge { display: inline-block; background: rgba(0,0,0,.45); color: var(--gold); font-weight: 800; padding: 2px 10px; border-radius: 999px; font-size: 13px; }

/* playing cards */
.pcard { width: 62px; height: 90px; border-radius: 9px; background: linear-gradient(160deg, #fff, #e9e9e9);
  color: #1a1a1a; position: relative; box-shadow: 0 5px 12px rgba(0,0,0,.45); font-weight: 800;
  animation: deal .35s ease both; flex: 0 0 auto; }
.pcard.red { color: #d6283c; }
.pcard .tl { position: absolute; top: 5px; left: 6px; font-size: 15px; line-height: 1; text-align: center; }
.pcard .br { position: absolute; bottom: 5px; right: 6px; font-size: 15px; line-height: 1; transform: rotate(180deg); text-align: center; }
.pcard .mid { position: absolute; inset: 0; display: grid; place-items: center; font-size: 30px; }
.pcard.back { background: repeating-linear-gradient(45deg, #b3243c, #b3243c 6px, #8f1c30 6px, #8f1c30 12px);
  border: 3px solid #fff; }
.pcard.back .mid { color: rgba(255,255,255,.85); font-size: 26px; }
.pcard.held { outline: 3px solid var(--gold); outline-offset: 2px; }
.pcard .hold-tag { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); background: var(--gold);
  color: #231a02; font-size: 9px; font-weight: 800; padding: 1px 6px; border-radius: 6px; }
@keyframes deal { from { opacity: 0; transform: translateY(-26px) rotate(-8deg) scale(.8); } to { opacity: 1; transform: none; } }

/* roulette */
.wheel-wrap { position: relative; width: 280px; height: 280px; margin: 6px auto 14px; }
.wheel-pointer { position: absolute; top: -4px; left: 50%; transform: translateX(-50%); z-index: 5;
  width: 0; height: 0; border-left: 11px solid transparent; border-right: 11px solid transparent; border-top: 20px solid var(--gold);
  filter: drop-shadow(0 3px 4px rgba(0,0,0,.5)); }
#wheel { width: 280px; height: 280px; transition: transform 4.6s cubic-bezier(.12,.72,.12,1); }
.wheel-hub { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); width: 74px; height: 74px;
  border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe9a8, var(--gold2)); display: grid; place-items: center;
  font-size: 30px; box-shadow: 0 4px 12px rgba(0,0,0,.5); z-index: 4; border: 3px solid #7a5a12; }
.rl-board { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; }
.rl-num { aspect-ratio: 1; border-radius: 7px; display: grid; place-items: center; font-weight: 800; font-size: 13px;
  cursor: pointer; border: 1px solid rgba(255,255,255,.15); color: #fff; transition: .1s; }
.rl-num:active { transform: scale(.9); }
.rl-num.red { background: #c0273f; } .rl-num.black { background: #1c1c1c; } .rl-num.green { background: #1f9d57; }
.rl-num.sel { outline: 2px solid var(--gold); outline-offset: 1px; }
.rl-out { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 6px; }
.rl-out button { padding: 9px 4px; font-size: 12px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel2); color: var(--text); font-weight: 700; cursor: pointer; }
.rl-out button.sel { outline: 2px solid var(--gold); }
.rl-result { text-align: center; font-size: 15px; margin-top: 10px; min-height: 24px; }

/* lists */
.list-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; background: var(--panel2);
  border: 1px solid var(--line); margin-bottom: 8px; }
.list-item .ava { font-size: 22px; width: 38px; height: 38px; display: grid; place-items: center; background: #0e1712; border-radius: 10px; }
.list-item .nm { font-weight: 700; font-size: 14px; }
.list-item .sub { font-size: 11px; color: var(--muted); }
.rank { font-weight: 800; color: var(--gold); width: 26px; text-align: center; }

/* shop */
.upg { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); margin-bottom: 8px; }
.upg .info { flex: 1; }
.upg .nm { font-weight: 700; font-size: 14px; }
.upg .ds { font-size: 11px; color: var(--muted); }
.pips { letter-spacing: 2px; color: var(--gold); font-size: 12px; }
.ava-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ava-cell { aspect-ratio: 1; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); display: grid;
  place-items: center; font-size: 28px; cursor: pointer; position: relative; }
.ava-cell.sel { outline: 2px solid var(--gold); }
.ava-cell .lock { position: absolute; bottom: 3px; right: 5px; font-size: 11px; }
.ava-cell .price { position: absolute; bottom: 2px; left: 0; right: 0; text-align: center; font-size: 9px; color: var(--gold); }

/* jobs */
.clicker { text-align: center; padding: 10px; }
.click-btn { width: 150px; height: 150px; border-radius: 50%; border: 5px solid var(--gold2); cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, var(--gold2)); font-size: 56px; box-shadow: 0 10px 30px rgba(246,201,69,.3);
  transition: .08s; display: grid; place-items: center; margin: 10px auto; }
.click-btn:active { transform: scale(.92); }
.energy { height: 12px; background: #0c1410; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.energy > i { display: block; height: 100%; background: linear-gradient(90deg, var(--blue), var(--green)); transition: width .2s; }
.float-pay { position: fixed; font-weight: 800; color: var(--gold); pointer-events: none; animation: floatUp .8s ease forwards; z-index: 60; }
@keyframes floatUp { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-50px); } }

/* misc */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stat { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.stat .v { font-size: 18px; font-weight: 800; color: var(--gold); }
.stat .k { font-size: 11px; color: var(--muted); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.gold { background: rgba(246,201,69,.15); color: var(--gold); }
.badge.green { background: rgba(61,220,132,.15); color: var(--green); }
.badge.red { background: rgba(255,77,109,.15); color: var(--red); }
.ach { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 12px; background: var(--panel2); border: 1px solid var(--line); margin-bottom: 8px; opacity: .55; }
.ach.done { opacity: 1; border-color: var(--gold2); }
.ach .ic { font-size: 24px; }
input.field { width: 100%; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: #0e1712; color: var(--text); font-size: 15px; }
.seg { display: flex; background: #0e1712; border: 1px solid var(--line); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: none; color: var(--muted); padding: 8px; border-radius: 9px; font-weight: 700; cursor: pointer; font-size: 13px; }
.seg button.active { background: var(--panel2); color: var(--gold); }

/* toast & overlay */
#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px); background: #1d2b24;
  border: 1px solid var(--line); color: var(--text); padding: 11px 18px; border-radius: 12px; font-size: 14px; font-weight: 600;
  opacity: 0; transition: .25s; z-index: 80; max-width: 90%; text-align: center; box-shadow: var(--shadow); pointer-events: none; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#overlay { position: fixed; inset: 0; background: rgba(4,8,6,.72); backdrop-filter: blur(4px); z-index: 70;
  display: grid; place-items: center; padding: 20px; }
.modal { background: linear-gradient(180deg, var(--panel), var(--bg2)); border: 1px solid var(--line); border-radius: 20px;
  padding: 22px; max-width: 360px; width: 100%; text-align: center; box-shadow: var(--shadow); animation: pop .25s ease; }
@keyframes pop { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal .big-ic { font-size: 52px; }
.win-amount { font-size: 30px; font-weight: 900; color: var(--gold); margin: 8px 0; }
.loader { text-align: center; padding: 60px 0; color: var(--muted); }
.spin { width: 38px; height: 38px; border: 4px solid var(--line); border-top-color: var(--gold); border-radius: 50%; margin: 0 auto 14px; animation: rot 1s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.conf { position: absolute; width: 9px; height: 14px; top: -20px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(720deg); opacity: .9; } }
.fade-in { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
