:root {
  --bg: #0f0f12; --card: #1b1b20; --card2: #24242b; --line: #2c2c35; --text: #f4f4f6; --muted: #8b8b98;
  --ton: #0098ea; --accent1: #ffab00; --accent2: #ffd740; --good: #34d399; --bad: #f87171;
  --nav-h: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select { font: inherit; color: var(--text); background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; width: 100%; outline: none; }
input:focus, select:focus { border-color: var(--ton); }
#app { max-width: 440px; margin: 0 auto; min-height: 100dvh; padding: 12px 16px calc(var(--nav-h) + 24px); }
h2 { margin: 8px 0 6px; font-size: 22px; } h3 { margin: 0 0 10px; font-size: 16px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; word-break: break-all; }

.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.icon-btn { width: 42px; height: 42px; border-radius: 12px; background: var(--card); display: grid; place-items: center; }
.icon-btn.sm { width: 36px; height: 36px; border-radius: 50%; }
.balance { display: flex; align-items: center; gap: 8px; background: var(--card); border-radius: 999px; padding: 6px 6px 6px 12px; }
.balance b { font-size: 16px; min-width: 48px; }
.plus { width: 28px; height: 28px; border-radius: 50%; background: var(--card2); font-size: 18px; line-height: 1; }
.ton-dot { width: 22px; height: 22px; border-radius: 50%; background: var(--ton) url("/icon.svg") center/150% no-repeat; display: inline-block; flex: none; }
.ton-dot.sm { width: 18px; height: 18px; }

.view { display: none; } .view.active { display: block; }

.stats { display: grid; grid-template-columns: 1fr 1px 1fr; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.stats .sep { background: var(--line); }
.s-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-val { color: var(--ton); font-weight: 700; min-height: 18px; }
.s-cap { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }

.stage { position: relative; height: 215px; margin-top: 6px; }
.arc { position: absolute; inset: 0; }
.slot { position: absolute; width: 66px; height: 66px; margin: -33px 0 0 -33px; border-radius: 20px; background: var(--card); display: grid; place-items: center; text-align: center; box-shadow: inset 0 0 0 1px #ffffff08; }
.slot.empty { color: #ffffff22; font-weight: 800; font-size: 9px; letter-spacing: .08em; background: #17171b; }
.slot.full { background: var(--card2); border: 2px solid var(--c, var(--line)); animation: pop .25s ease-out; }
.slot .amt { position: absolute; bottom: 4px; font-size: 12px; font-weight: 700; }
.slot .ico { margin-top: -8px; width: 32px; height: 32px; border-radius: 50%; background: var(--ton) url("/icon.svg") center/150% no-repeat; }
.slot .nft { margin-top: -8px; width: 38px; height: 38px; border-radius: 10px; background: linear-gradient(135deg, #8b5cf6, #ec4899); display: grid; place-items: center; font-size: 20px; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } }
.center { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); text-align: center; }
.timer { display: inline-block; padding: 4px 16px; border-radius: 999px; background: var(--card2); border: 1px solid var(--line); font-weight: 800; letter-spacing: .06em; }
.timer.live { color: var(--good); } .timer.hot { color: var(--accent1); }
.pool-cap { margin-top: 8px; font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .08em; }
.pool { display: flex; gap: 6px; justify-content: center; align-items: center; font-size: 24px; }
.game-no { font-size: 11px; color: var(--muted); }

.reel-wrap { position: relative; margin: 12px -16px 0; height: 150px; background: #17171b; overflow: hidden; display: flex; align-items: center; }
.reel { display: flex; gap: 10px; padding: 0 16px; will-change: transform; margin: 0 auto; }
.reel.spin { margin: 0; }
.marker { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--ton); z-index: 2; opacity: 0; transition: opacity .2s; box-shadow: 0 0 10px var(--ton); }
.marker.on { opacity: 1; }
.pcard { flex: none; width: 92px; height: 118px; border-radius: 18px; background: var(--card2); border-top: 4px solid var(--c, var(--line)); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px; }
.pcard .nm { font-size: 12px; font-weight: 700; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .pc { font-size: 13px; font-weight: 800; }
.pcard.win { box-shadow: 0 0 0 2px var(--accent1), 0 0 24px #ffab0066; }
.avatar { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 18px; background-size: cover; background-position: center; border: 2px solid var(--c, transparent); flex: none; }
.empty-reel { color: var(--muted); }

.cta { width: 100%; margin-top: 16px; padding: 16px; border-radius: 16px; font-weight: 800; font-size: 17px; color: #1a1300; background: linear-gradient(90deg, var(--accent1), var(--accent2)); }
.cta:disabled { background: #2a3140; color: #6b7384; }
.btn { width: 100%; margin-top: 10px; padding: 13px; border-radius: 12px; background: var(--ton); font-weight: 700; }
.btn.ghost { background: var(--card2); } .btn:disabled { opacity: .5; }

.list-head { display: flex; justify-content: space-between; margin: 18px 4px 8px; font-weight: 700; font-size: 14px; }
.prow { display: flex; align-items: center; gap: 12px; background: var(--card); border-left: 4px solid var(--c, var(--line)); border-radius: 14px; padding: 12px; margin-bottom: 8px; }
.prow .who { flex: 1; min-width: 0; } .prow .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .parts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 8px; background: #0098ea22; border: 1px solid #0098ea55; }
.tag.nft { background: #8b5cf622; border-color: #8b5cf666; }
.prow .pct { text-align: right; font-size: 18px; font-weight: 800; } .prow .pct small { display: block; font-size: 12px; color: var(--muted); font-weight: 600; }

.card { background: var(--card); border-radius: 16px; padding: 14px; margin: 12px 0; }
.card input { margin-top: 8px; } .card summary { cursor: pointer; font-weight: 700; }
.chips { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.chips button { background: var(--card2); border-radius: 10px; padding: 8px 14px; font-weight: 600; flex: 1; }
.row { display: flex; gap: 8px; align-items: center; margin: 12px 0; } .row .btn { margin-top: 0; }
.tabs { display: flex; gap: 8px; margin: 10px 0; } .tabs button { padding: 8px 16px; border-radius: 12px; background: var(--card2); font-weight: 600; } .tabs .on { background: linear-gradient(90deg, var(--accent1), var(--accent2)); color: #1a1300; }

.item { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 14px; padding: 12px; margin-bottom: 8px; }
.item .thumb { width: 46px; height: 46px; border-radius: 12px; background: linear-gradient(135deg, #8b5cf6, #ec4899); display: grid; place-items: center; font-size: 22px; flex: none; }
.item .info { flex: 1; min-width: 0; } .item .nm { font-weight: 700; } .item button { font-size: 12px; padding: 6px 10px; border-radius: 8px; background: var(--card2); }
.hrow { background: var(--card); border-radius: 14px; padding: 12px; margin-bottom: 8px; }
.hrow .l1 { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.hrow .l2 { display: flex; align-items: center; gap: 10px; margin-top: 8px; } .hrow .win { margin-left: auto; text-align: right; color: var(--ton); font-weight: 800; font-size: 17px; }
.hrow .win small { display: block; color: var(--accent1); font-size: 12px; }
.lrow { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; } .lrow:last-child { border: 0; }
.plus-v { color: var(--good); } .minus-v { color: var(--bad); }
.ok { color: var(--good); } .no { color: var(--bad); }

.bottom { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 440px; height: var(--nav-h); display: grid; grid-template-columns: repeat(5, 1fr); background: #18181c; border-top: 1px solid var(--line); z-index: 5; }
.bottom button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 11px; }
.bottom svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bottom .active { color: var(--text); }

.sheet-bg { position: fixed; inset: 0; background: #000a; display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet-bg[hidden] { display: none; }
.sheet { width: 100%; max-width: 440px; background: #1f1f24; border-radius: 24px 24px 0 0; padding: 18px 16px 24px; max-height: 88dvh; overflow: auto; animation: up .2s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.nft-pick { display: grid; gap: 8px; margin: 8px 0; }
.nft-pick label { display: flex; align-items: center; gap: 10px; background: var(--card2); border-radius: 12px; padding: 10px; cursor: pointer; border: 1px solid transparent; }
.nft-pick label:has(input:checked) { border-color: var(--accent1); }
.nft-pick input { width: auto; margin: 0; accent-color: var(--accent1); }
.summary { margin: 12px 0 0; padding: 12px; border-radius: 12px; background: var(--card2); font-size: 14px; }
.summary b { color: var(--accent2); }
.err { color: var(--bad); font-size: 13px; min-height: 18px; margin-top: 8px; }
.toast { position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%); background: #2d2d36; padding: 10px 16px; border-radius: 12px; z-index: 20; max-width: 90%; }
.toast[hidden] { display: none; }
.win-box { text-align: center; }
.win-box .big { font-size: 28px; font-weight: 800; color: var(--ton); margin: 8px 0; }
.win-box .you { color: var(--accent1); font-weight: 800; font-size: 18px; }

/* bot label, scrolling tab bar and admin panel */
.botbadge { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: .06em; padding: 1px 6px; border-radius: 6px; background: #8b5cf633; color: #c4b5fd; border: 1px solid #8b5cf666; vertical-align: middle; margin-left: 4px; }
.tabs.scroll { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
.tabs.scroll button { flex: none; white-space: nowrap; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.kpi { background: var(--card); border-radius: 14px; padding: 12px; }
.kpi .k { color: var(--muted); font-size: 12px; } .kpi .v { font-size: 20px; font-weight: 800; margin-top: 2px; }
.kpi.wide { grid-column: 1 / -1; } .kpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.arow { background: var(--card); border-radius: 14px; padding: 12px; margin-bottom: 8px; }
.arow .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.arow .nm { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arow .sub { color: var(--muted); font-size: 12px; margin-top: 2px; word-break: break-all; }
.arow .acts { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.arow .acts button, .mini { background: var(--card2); border-radius: 10px; padding: 7px 12px; font-size: 13px; font-weight: 600; }
.mini.good { background: #34d39933; color: var(--good); } .mini.bad { background: #f8717133; color: var(--bad); }
.st { font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 8px; background: var(--card2); }
.st.ok { background: #34d39933; color: var(--good); } .st.warn { background: #ffab0033; color: var(--accent1); } .st.bad { background: #f8717133; color: var(--bad); }
.setrow { display: grid; gap: 6px; background: var(--card); border-radius: 14px; padding: 12px; margin-bottom: 8px; }
.setrow .lab { font-weight: 600; font-size: 14px; } .setrow .meta { font-size: 11px; color: var(--muted); }
.setrow .line { display: flex; gap: 8px; } .setrow input { padding: 10px 12px; }
.toggle { width: 52px; height: 30px; border-radius: 999px; background: var(--card2); position: relative; flex: none; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #888; transition: .15s; }
.toggle.on { background: #34d39955; } .toggle.on::after { left: 25px; background: var(--good); }
.logrow { background: var(--card); border-radius: 12px; padding: 10px; margin-bottom: 6px; font-size: 13px; }
.logrow .m { word-break: break-word; } .logrow .t { color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.logrow pre { margin: 6px 0 0; font-size: 10px; color: var(--muted); white-space: pre-wrap; max-height: 120px; overflow: auto; }
.row-gap { display: flex; gap: 8px; margin: 10px 0; flex-wrap: wrap; }
.field label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }
