/* ============ Токены ============ */
:root{
  --bg: #0b1f1b;
  --bg-2: #0e2621;
  --panel: #123028;
  --panel-2: #16382e;
  --rail: #c9a227;
  --rail-bright: #e7c34b;
  --wine: #8c2f39;
  --wine-bright: #b23a46;
  --win: #4e8b63;
  --win-bright: #6bab80;
  --ink: #f2e9d8;
  --ink-muted: #93a79c;
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0,0,0,.35);
}

*{ box-sizing: border-box; }

html,body{
  margin:0; padding:0; min-height:100vh;
  background:
    radial-gradient(ellipse at 50% -10%, #143b31 0%, transparent 60%),
    repeating-linear-gradient(135deg, rgba(255,255,255,.015) 0 2px, transparent 2px 6px),
    var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

h1,h2{ font-family:'Fraunces', Georgia, serif; margin:0; }

button{ font-family: inherit; }
input{ font-family: inherit; }

/* ============ Topbar ============ */
.topbar{
  position: sticky; top:0; z-index: 20;
  display:flex; align-items:center; justify-content:space-between;
  padding: 14px 18px;
  background: linear-gradient(180deg, var(--bg-2), transparent);
  backdrop-filter: blur(6px);
}
.topbar__brand{ display:flex; align-items:center; gap:8px; font-family:'Fraunces', serif; font-weight:600; letter-spacing:.02em; }
.topbar__crest{ color: var(--rail); font-size: 20px; }
.topbar__name{ font-size: 16px; color: var(--ink); }
.topbar__balance{
  display:flex; align-items:center; gap:6px;
  background: var(--panel); border: 1px solid var(--rail);
  border-radius: 999px; padding: 6px 14px;
  font-weight:700; font-variant-numeric: tabular-nums;
}
.coin{ font-size: 14px; }

/* ============ Layout ============ */
main{ padding: 8px 18px 100px; max-width: 480px; margin: 0 auto; }
.view__title{ font-size: 30px; font-weight:600; margin-bottom: 2px; }
.view__subtitle{ color: var(--ink-muted); font-size: 13px; margin: 4px 0 18px; }
.section-title{ font-size: 18px; margin: 22px 0 10px; font-weight:600; }
.field-label{ font-size: 13px; color: var(--ink-muted); margin: 14px 0 8px; display:block; }
.field-hint{ font-size: 12px; color: var(--ink-muted); margin-top: 6px; }

/* ============ Buttons & chips ============ */
.btn{
  border:none; border-radius: 999px; cursor:pointer;
  font-weight:600; font-size: 14px; padding: 12px 18px;
  transition: transform .12s ease, filter .12s ease;
}
.btn:active{ transform: scale(.96); }
.btn--primary{ background: linear-gradient(180deg, var(--rail-bright), var(--rail)); color:#241b04; width:100%; box-shadow: var(--shadow); }
.btn--big{ font-size:16px; padding:16px; }
.btn--gold{ background: var(--rail); color:#241b04; width:100%; }
.btn--ghost{ background: transparent; border:1px solid var(--rail); color: var(--rail-bright); }
.btn--link{ background:none; color: var(--ink-muted); text-decoration: underline; padding: 8px; display:block; margin:8px auto 0; }
.btn:disabled{ opacity:.45; cursor:default; }

.chip-row{ display:flex; flex-wrap:wrap; gap:8px; }
.chip{
  background: var(--panel-2); border: 1px solid rgba(201,162,39,.35);
  color: var(--ink); border-radius: 999px; padding: 9px 16px;
  font-weight:600; font-size:13px; cursor:pointer;
}
.chip.is-selected{ background: var(--rail); color:#241b04; border-color: var(--rail); }

.bet-panel{ background: var(--panel); border-radius: var(--radius); padding: 16px; margin-top: 14px; }
.bet-panel__row{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:10px; }
.bet-panel__custom{ display:flex; gap:8px; margin-bottom: 14px; }
.bet-panel__custom input{
  flex:1; background: var(--bg-2); border:1px solid rgba(201,162,39,.3); border-radius: 10px;
  color: var(--ink); padding: 10px 12px; font-size:14px;
}

/* ============ Slot machine ============ */
.machine{
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid rgba(201,162,39,.4);
  border-radius: 20px; padding: 22px 16px; box-shadow: var(--shadow);
}
.machine__window{ display:flex; justify-content:center; gap:10px; }
.reel{
  width: 84px; height: 84px; overflow:hidden; position:relative;
  background: var(--bg-2); border-radius: 12px;
  border: 2px solid var(--rail); box-shadow: inset 0 0 14px rgba(0,0,0,.5);
}
.reel__strip{ display:flex; flex-direction:column; will-change: transform; }
.reel__strip span{
  width:84px; height:84px; display:flex; align-items:center; justify-content:center;
  font-size: 42px; line-height:1;
}
.machine__result{ text-align:center; min-height: 60px; margin-top: 16px; font-size: 15px; }
.machine__result .win{ color: var(--win-bright); font-weight:700; font-family:'Fraunces',serif; font-size:18px; }
.machine__result .lose{ color: var(--ink-muted); }
.machine__result .jackpot{ color: var(--rail-bright); font-size:20px; animation: pulse 1s ease-in-out infinite; }

@keyframes pulse{ 0%,100%{ transform:scale(1); } 50%{ transform:scale(1.06); } }

.paytable{ background: var(--panel); border-radius: var(--radius); padding: 14px 16px; margin-top: 12px; font-size: 13px; }
.paytable__row{ display:flex; justify-content:space-between; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.paytable__row:last-child{ border-bottom:none; }

/* ============ Mines ============ */
.mines-grid{
  display:grid; grid-template-columns: repeat(5, 1fr); gap: 8px;
  margin: 14px 0;
}
.mines-tile{ aspect-ratio: 1; perspective: 500px; background:none; border:none; padding:0; cursor:pointer; }
.mines-tile__inner{
  position:relative; width:100%; height:100%;
  transform-style: preserve-3d; transition: transform .45s cubic-bezier(.2,.8,.2,1);
}
.mines-tile.is-flipped .mines-tile__inner{ transform: rotateY(180deg); }
.mines-tile__face{
  position:absolute; inset:0; backface-visibility:hidden;
  border-radius: 10px; display:flex; align-items:center; justify-content:center;
  font-size: 26px;
}
.mines-tile__front{
  background: var(--panel-2); border: 1px solid rgba(201,162,39,.4);
  color: var(--rail); font-family:'Fraunces',serif;
}
.mines-tile__back{ transform: rotateY(180deg); }
.mines-tile__back.safe{ background: var(--win); }
.mines-tile__back.mine{ background: var(--wine); }
.mines-tile.is-disabled{ pointer-events:none; }

.mines-status{ background: var(--panel); border-radius: var(--radius); padding: 14px 16px; }
.progress{ height:8px; background: var(--bg-2); border-radius:999px; overflow:hidden; }
.progress__fill{ height:100%; background: linear-gradient(90deg, var(--rail), var(--rail-bright)); width:0%; transition: width .3s ease; }
.mines-status__row{ display:flex; justify-content:space-between; margin-top:10px; font-size:14px; }
.mines-actions{ display:flex; gap:10px; margin-top: 14px; }
.mines-actions .btn{ flex:1; }

/* ============ Dice ============ */
.dice-face{
  width: 120px; height:120px; margin: 10px auto 20px; border-radius: 24px;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 2px solid var(--rail); display:flex; align-items:center; justify-content:center;
  box-shadow: var(--shadow);
}
.dice-face span{ font-family:'Fraunces', serif; font-size: 42px; font-weight:600; font-variant-numeric: tabular-nums; }
.dice-panel{ background: var(--panel); border-radius: var(--radius); padding: 16px; }
.dice-panel input[type=range]{ width:100%; accent-color: var(--rail); }

/* ============ Profile ============ */
.profile-card{
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid rgba(201,162,39,.4); border-radius: var(--radius);
  padding: 20px; text-align:center;
}
.profile-card__balance{ font-family:'Fraunces',serif; font-size: 30px; font-weight:600; margin-bottom: 14px; }
.stat-grid{ display:grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.stat-card{ background: var(--panel); border-radius: 12px; padding: 12px 14px; }
.stat-card__value{ font-size: 18px; font-weight:700; font-family:'Fraunces',serif; }
.stat-card__label{ font-size: 11px; color: var(--ink-muted); margin-top:2px; }

.leaderboard{ list-style:none; padding:0; margin:0; display:flex; flex-direction:column; gap:8px; }
.leaderboard li{
  display:flex; justify-content:space-between; background: var(--panel);
  border-radius: 10px; padding: 10px 14px; font-size:14px;
}
.leaderboard li .rank{ color: var(--rail); font-weight:700; margin-right:8px; }

/* ============ Tabbar ============ */
.tabbar{
  position: fixed; bottom:0; left:0; right:0; z-index: 30;
  display:flex; background: var(--bg-2); border-top: 1px solid rgba(201,162,39,.25);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
}
.tabbar__item{
  flex:1; background:none; border:none; color: var(--ink-muted);
  display:flex; flex-direction:column; align-items:center; gap:2px;
  padding: 8px 0; font-size: 11px; border-radius: 12px;
}
.tabbar__item.is-active{ color: var(--rail-bright); }
.tabbar__icon{ font-size: 20px; }

/* ============ Toast ============ */
.toast{
  position: fixed; top: 70px; left:50%; transform: translateX(-50%) translateY(-20px);
  background: var(--wine); color: var(--ink); padding: 10px 18px; border-radius: 999px;
  font-size: 13px; font-weight:600; opacity:0; pointer-events:none; transition: all .25s ease;
  z-index: 50; white-space: nowrap; box-shadow: var(--shadow);
}
.toast.is-visible{ opacity:1; transform: translateX(-50%) translateY(0); }

/* ============ Misc ============ */
.view[hidden]{ display:none; }
::-webkit-scrollbar{ display:none; }
