:root{
  --bg:#0D0E10; --card:#16181B; --elev:#1E2125; --elev2:#2A2E34;
  --line:#26292E; --line2:#2E323A;
  --text:#F1F2F4; --muted:#9BA0A8; --muted2:#C9CCD1;
  --accent:#D7F25C; --accent-ink:#0D0E10;
  --danger:#E2564A;
  --display:'Orbitron', ui-sans-serif, system-ui, sans-serif;
  --body:'Onest', ui-sans-serif, system-ui, sans-serif;
  --radius:16px;
  box-sizing:border-box;
  padding-top:env(safe-area-inset-top,0px);
  padding-bottom:env(safe-area-inset-bottom,0px);
}

/* Атрибут hidden ВСЕГДА скрывает элемент — даже если у класса задан display:flex/grid.
   Без этого правила панель честности и карточка бонуса были видны постоянно. */
[hidden]{display:none !important}

*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{
  background:var(--bg); color:var(--text);
  font-family:var(--body); font-size:15px; line-height:1.4;
  -webkit-font-smoothing:antialiased;
}
.num{font-family:var(--display); font-variant-numeric:tabular-nums; letter-spacing:.01em}
.mono{font-family:ui-monospace, SFMono-Regular, Menlo, monospace}

#app{max-width:480px; margin:0 auto; min-height:100%; display:flex; flex-direction:column; padding-bottom:78px}

/* Шапка */
.topbar{display:flex; align-items:center; justify-content:space-between; gap:12px; padding:14px 20px 8px}
.brand{display:flex; align-items:center; gap:10px}
.brand-mark{width:38px; height:38px; border-radius:11px; background:var(--elev); border:1px solid var(--line2); display:flex; align-items:center; justify-content:center}
.brand-name{font-family:var(--display); font-weight:700; font-size:17px; letter-spacing:.04em}
.balance{display:flex; align-items:center; gap:8px; height:44px; padding:0 16px 0 10px; border-radius:22px; background:var(--card); border:1px solid var(--line); color:var(--text); cursor:pointer}
.balance .num{font-weight:600; font-size:15px}

/* Экраны */
.screen{flex:1; padding:8px 20px 20px}

/* Бонус */
.bonus{display:flex; align-items:center; gap:14px; padding:14px 14px 14px 16px; border-radius:18px; background:var(--card); border:1px solid var(--line); margin-top:8px}
.bonus-ico{width:44px; height:44px; flex-shrink:0; border-radius:12px; background:var(--elev); color:var(--accent); display:flex; align-items:center; justify-content:center}
.bonus-text{display:flex; flex-direction:column; gap:2px; flex:1; min-width:0}
.bonus-title{font-weight:600}
.bonus-sub{font-size:13px; color:var(--muted)}

.section-head{display:flex; align-items:baseline; justify-content:space-between; gap:12px; padding:26px 0 12px}
.section-head h1{margin:0; font-weight:700; font-size:22px}
.hint{font-size:13px; color:var(--muted)}

/* Список игр */
.games{display:flex; flex-direction:column; gap:12px}
.game-card{display:flex; align-items:center; gap:16px; padding:14px; border-radius:20px; background:var(--card); border:1px solid var(--line); color:var(--text); text-align:left; cursor:pointer; width:100%; font:inherit}
.game-card:disabled{opacity:.55; cursor:default}
.game-ico{width:80px; height:80px; flex-shrink:0; border-radius:16px; background:var(--elev); display:flex; align-items:center; justify-content:center}
.game-body{display:flex; flex-direction:column; gap:6px; flex:1; min-width:0}
.game-name{font-family:var(--display); font-weight:600; font-size:16px; letter-spacing:.02em; display:flex; align-items:center; justify-content:space-between; gap:8px}
.game-desc{font-size:14px; color:var(--muted); line-height:1.35}
.tag{display:inline-flex; align-items:center; gap:6px; font-size:12px; font-weight:600; padding:4px 8px; border-radius:8px; background:var(--elev); color:var(--muted2); width:fit-content}
.tag .dot{width:6px; height:6px; border-radius:3px; background:var(--accent)}

/* Кнопки */
.btn-accent{border:0; border-radius:var(--radius); background:var(--accent); color:var(--accent-ink); font:inherit; font-weight:700; cursor:pointer}
.btn-accent.sm{height:44px; padding:0 18px; font-size:15px; flex-shrink:0}
.btn-accent.big{height:56px; width:100%; font-size:16px; margin-top:14px}
.btn-accent:disabled{background:var(--elev); color:var(--muted); cursor:default}
.btn-ghost{height:48px; width:100%; border-radius:14px; background:transparent; border:1px solid var(--line2); color:var(--text); font:inherit; font-weight:600; cursor:pointer; margin-top:12px}
.btn-danger{background:var(--danger); color:#fff}
.icon-btn{width:40px; height:40px; border-radius:12px; background:var(--card); border:1px solid var(--line); color:var(--text); display:flex; align-items:center; justify-content:center; cursor:pointer}

/* Экран игры */
.game-head{display:flex; align-items:center; justify-content:space-between; gap:12px; padding:6px 0 14px}
.game-title{font-family:var(--display); font-weight:600; font-size:18px; letter-spacing:.02em}

.mines-status{display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin-bottom:14px}
.status-cell{background:var(--card); border:1px solid var(--line); border-radius:14px; padding:12px; display:flex; flex-direction:column; gap:4px; align-items:center}
.status-cell .k{font-size:12px; color:var(--muted)}
.status-cell .v{font-size:18px; font-weight:600}
.status-cell .v.win{color:var(--accent)}

/* Поле Mines */
.mines-grid{display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px; margin-bottom:16px}
.cell{aspect-ratio:1/1; border-radius:14px; background:var(--elev); border:1px solid var(--line2); display:flex; align-items:center; justify-content:center; cursor:pointer; transition:transform .08s ease, background .12s ease; padding:0}
.cell:active{transform:scale(.96)}
.cell:disabled{cursor:default}
.cell.safe{background:rgba(215,242,92,.14); border-color:var(--accent)}
.cell.safe svg{color:var(--accent)}
.cell.mine{background:rgba(226,86,74,.16); border-color:var(--danger)}
.cell.mine svg{color:var(--danger)}
.cell.dim{opacity:.4}
.cell .gem, .cell .bomb{width:26px; height:26px}

/* Панель управления */
.panel{background:transparent}
.row-between{display:flex; align-items:baseline; justify-content:space-between; gap:12px}
.row-between.mt{margin-top:16px}
.lbl{font-size:14px; font-weight:600}
.chips{display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin-top:10px}
.chip{height:44px; border-radius:12px; background:var(--card); border:1px solid var(--line); color:var(--muted2); font:inherit; font-weight:600; cursor:pointer}
.chip.active{background:var(--accent); border-color:var(--accent); color:var(--accent-ink); font-weight:700}
.chip .num{font-weight:inherit}

.stepper{display:flex; align-items:center; gap:6px; height:56px; padding:0 6px; border-radius:16px; background:var(--card); border:1px solid var(--line); margin-top:10px}
.stepper.tight{height:48px; margin-top:6px}
.stepper input{flex:1; min-width:0; height:44px; border:0; background:transparent; color:var(--text); font-size:20px; font-weight:600; text-align:center}
.stepper input.mono{font-size:14px}
.step{width:44px; height:44px; flex-shrink:0; border:0; border-radius:12px; background:var(--elev); color:var(--text); font-size:22px; line-height:1; cursor:pointer}
.step.wide{width:auto; padding:0 16px; font-size:15px; font-weight:600}
.quick{display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin-top:8px}
.quick button{height:44px; border-radius:12px; background:var(--card); border:1px solid var(--line); color:var(--text); font:inherit; font-weight:600; cursor:pointer}

/* Нижняя навигация */
.tabbar{position:fixed; left:0; right:0; bottom:0; max-width:480px; margin:0 auto; display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:4px; padding:8px 12px calc(12px + env(safe-area-inset-bottom,0px)); background:var(--bg); border-top:1px solid var(--line)}
.tab{display:flex; flex-direction:column; align-items:center; justify-content:center; gap:4px; min-height:52px; background:none; border:0; color:var(--muted); font:inherit; font-size:12px; font-weight:600; cursor:pointer}
.tab.active{color:var(--accent)}

/* Нижняя шторка */
.sheet{position:fixed; inset:0; max-width:480px; margin:0 auto; background:rgba(0,0,0,.55); display:flex; align-items:flex-end; z-index:20; cursor:pointer}
.sheet-body{width:100%; background:var(--card); border-radius:22px 22px 0 0; border:1px solid var(--line); border-bottom:0; padding:20px 20px calc(24px + env(safe-area-inset-bottom,0px)); display:flex; flex-direction:column; gap:8px; max-height:82vh; overflow-y:auto; cursor:default; position:relative; z-index:21}
.sheet-body h2{margin:0; font-size:18px; font-weight:700}
.sheet-body .lbl{margin-top:10px}
.muted{color:var(--muted); font-size:14px; line-height:1.5}
.muted.small{font-size:12px}
.code{display:block; background:var(--bg); border:1px solid var(--line); border-radius:10px; padding:10px 12px; font-family:ui-monospace, Menlo, monospace; font-size:12px; word-break:break-all; color:var(--muted2)}

/* Тост */
.toast{position:fixed; left:50%; transform:translateX(-50%); bottom:96px; max-width:88%; background:var(--elev2); color:var(--text); border:1px solid var(--line2); border-radius:12px; padding:12px 16px; font-size:14px; z-index:30; text-align:center}

/* Crash */
.hist-row{display:flex; gap:6px; overflow:hidden; margin-bottom:10px; min-height:28px}
.hist-chip{height:28px; padding:0 9px; border-radius:8px; background:var(--card); border:1px solid var(--line); display:flex; align-items:center; font-size:12px; font-weight:600; flex-shrink:0}
.graph-card{position:relative; height:200px; border-radius:16px; background:var(--card); border:1px solid var(--line); overflow:hidden}
.graph-svg{position:absolute; inset:0; width:100%; height:100%}
.graph-center{position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; pointer-events:none}
#crashMult{font-size:46px; font-weight:700; color:var(--text)}
.graph-state{font-size:12px; color:var(--muted); margin-top:2px; letter-spacing:.03em}
.feed{display:flex; flex-direction:column; gap:6px; min-height:44px}
.feed-row{display:flex; align-items:center; justify-content:space-between; gap:8px; padding:8px 10px; border-radius:10px; background:var(--card); border:1px solid var(--line)}
.feed-name{font-size:13px; color:var(--muted2)}
.feed-right{display:flex; align-items:center; gap:10px}
.feed-bet{font-size:12px; color:var(--muted)}
.feed-cash{color:var(--accent); font-size:13px; font-weight:600}
.feed-lost{color:var(--muted); font-size:13px}
.feed-empty{color:var(--muted); font-size:13px; padding:6px 2px}

/* Coinflip */
:root{--steel:#8A93A3}
.coinwrap{perspective:800px; display:flex; justify-content:center; padding:8px 0 2px}
.coin{width:140px; height:140px; position:relative; transform-style:preserve-3d; transition:transform 1s cubic-bezier(.4,.15,.2,1)}
.coin .face{position:absolute; inset:0; border-radius:50%; backface-visibility:hidden; display:flex; align-items:center; justify-content:center; border:3px solid}
.coin .heads{background:rgba(215,242,92,.14); border-color:var(--accent)}
.coin .tails{background:var(--elev); border-color:#5B6270; transform:rotateY(180deg)}
.coin-info{text-align:center; margin:8px 0 14px}
#cfMult{font-size:28px; font-weight:700; color:var(--text); font-family:var(--display); font-variant-numeric:tabular-nums}
.sides{display:grid; grid-template-columns:1fr 1fr; gap:8px}
.side-btn{height:56px; border-radius:15px; background:var(--card); border:1px solid var(--line); color:var(--text); font:inherit; font-weight:700; font-size:16px; display:flex; align-items:center; justify-content:center; gap:9px; cursor:pointer}
.side-btn.pick{background:var(--accent); border-color:var(--accent); color:var(--accent-ink)}
.side-btn:disabled{opacity:.5; cursor:default}
#cfCashout{margin-top:10px}

/* Plinko */
.board-wrap{border-radius:16px; background:var(--card); border:1px solid var(--line); padding:6px 4px 4px}
#pkBoard{width:100%; height:auto; display:block}
.mt2{margin-top:16px; display:block}
#pkAction{margin-top:16px}

/* Dice */
.dice-nums{display:flex; justify-content:space-between; align-items:flex-start; padding:4px 4px 8px}
.dice-cell{text-align:center; flex:1}
.dice-cell .num{font-size:40px; font-weight:700; color:var(--text)}
.dice-lbl{font-size:12px; color:var(--muted); margin-top:2px}
.dice-stats{display:grid; grid-template-columns:repeat(3,1fr); gap:8px; margin:6px 0 4px}
.dice-stat{background:var(--card); border:1px solid var(--line); border-radius:12px; padding:10px 6px; text-align:center}
.dice-stat .num{font-size:16px; font-weight:700; color:var(--text)}
.dice-slider{position:relative; height:44px; margin:8px 2px 2px}
.dice-track{position:absolute; top:19px; left:0; right:0; height:6px; border-radius:3px; display:flex; overflow:hidden}
.dice-bar{height:100%}
.dice-slider input[type=range]{position:absolute; inset:0; width:100%; height:44px; -webkit-appearance:none; appearance:none; background:transparent; margin:0}
.dice-slider input[type=range]::-webkit-slider-runnable-track{height:44px; background:transparent}
.dice-slider input[type=range]::-webkit-slider-thumb{-webkit-appearance:none; width:26px; height:26px; border-radius:50%; background:var(--text); border:3px solid var(--bg); cursor:pointer; margin-top:9px; box-sizing:border-box}
.dice-slider input[type=range]::-moz-range-thumb{width:26px; height:26px; border-radius:50%; background:var(--text); border:3px solid var(--bg); cursor:pointer}
.dice-slider input[type=range]::-moz-range-track{height:44px; background:transparent}
.dice-result-line{text-align:center; min-height:20px; margin:8px 0 12px}
.dice-result-line .num{font-size:14px; font-weight:600; color:var(--muted)}
#dcAction{margin-top:12px}

/* Limbo */
.limbo-display{height:150px; border-radius:16px; background:var(--card); border:1px solid var(--line); display:flex; flex-direction:column; align-items:center; justify-content:center}
#lbBig{font-size:52px; font-weight:700; color:var(--text); font-family:var(--display); font-variant-numeric:tabular-nums}
#lbAction{margin-top:12px}

/* Бонусы */
.bonus-block{background:var(--card); border:1px solid var(--line); border-radius:18px; padding:16px; margin-bottom:12px}
.bonus-row{display:flex; align-items:center; gap:14px}
.bonus-row .bonus-ico{width:44px; height:44px; flex-shrink:0; border-radius:12px; background:var(--elev); color:var(--accent); display:flex; align-items:center; justify-content:center}
.bonus-row .bonus-text{display:flex; flex-direction:column; gap:2px; flex:1; min-width:0}
.bonus-block .btn-accent.big{margin-top:14px}
.bonus-note{font-size:13px; line-height:1.5; color:var(--muted); margin:12px 0 0}
.bonus-note b{color:var(--muted2)}
.pbar{height:8px; background:var(--elev); border-radius:4px; overflow:hidden; margin-top:12px}
.pbar>i{display:block; height:100%; background:var(--accent); border-radius:4px; transition:width .3s ease}

/* HiLo */
.hcard{width:118px; height:158px; border-radius:14px; background:#F1F2F4; position:relative; display:flex; align-items:center; justify-content:center; box-sizing:border-box; transition:transform .13s ease}
.hcard.back{background:var(--elev); border:1px solid var(--line2)}
.hrank{position:absolute; font-family:var(--body); font-weight:700; font-size:17px; line-height:1}
.hrank.tl{top:9px; left:11px}
.hrank.br{bottom:9px; right:11px; transform:rotate(180deg)}
.hsuit{font-size:52px; line-height:1}
.hcard .hmini{}
.mini-card{width:30px; height:40px; border-radius:6px; background:#F1F2F4; display:flex; align-items:center; justify-content:center; font-weight:700; font-size:13px; flex-shrink:0}
#hlCash{margin-top:10px}
#hlStart{margin-top:10px}
