/* ===== Палитра и база ===== */
:root {
  --bg: #0c1424;
  --bg-glow: #182a4d;
  --card: #15213a;
  --card-2: #1b2a46;
  --card-3: #22345a;
  --border: rgba(140, 170, 230, 0.10);
  --text: #eaf0fb;
  --muted: #8b99b8;
  --blue: #3f7cff;
  --blue-2: #5e93ff;
  --blue-glow: rgba(63, 124, 255, 0.45);
  --gold: #f4b640;
  --gold-2: #ffd672;
  --gold-3: #c98b17;
  --green: #2fe08a;
  --red: #ff5a6e;
  --usdt: #26a17b;
  --radius: 18px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
  background: var(--bg) radial-gradient(900px 520px at 50% -180px, var(--bg-glow) 0%, var(--bg) 65%) no-repeat;
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
svg { display: block; }

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 12px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ===== Шапка ===== */
.top {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0 2px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 11px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.pill.online {
  flex: 0 0 auto;
  gap: 7px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
}
.online-label { overflow: hidden; text-overflow: ellipsis; }
.online-right { display: inline-flex; align-items: center; gap: 6px; color: var(--text); font-weight: 700; font-size: 13px; }
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(47, 224, 138, 0.6);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(47, 224, 138, 0.55); }
  70%  { box-shadow: 0 0 0 7px rgba(47, 224, 138, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 224, 138, 0); }
}
#online { display: inline-block; min-width: 4.5ch; text-align: right; font-variant-numeric: tabular-nums; }

.pill svg { flex: 0 0 auto; }
.pill.balance { flex: 1 1 auto; min-width: 0; justify-content: center; font-weight: 700; font-size: 14px; gap: 7px; padding: 0 10px; }
.pill.balance b { overflow: hidden; text-overflow: ellipsis; }
.pill.balance .coin { width: 19px; height: 19px; }
.pill.balance { cursor: pointer; user-select: none; }
.pill.balance:active { transform: scale(.97); }
.pill.balance.loading .coin { animation: coinFlip .7s ease-in-out infinite; }
.pill.balance.loading b { opacity: .6; }
@keyframes coinFlip { 0% { transform: rotateY(0); } 100% { transform: rotateY(360deg); } }
.pill.balance .caret { width: 10px; height: 10px; color: var(--muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 38px; padding: 0 14px;
  border-radius: 12px;
  font-weight: 700; font-size: 13px;
  transition: transform .08s, filter .15s;
  user-select: none;
}
.btn:active { transform: scale(.97); }
.btn-primary {
  background: linear-gradient(180deg, var(--blue-2), var(--blue));
  color: #fff;
  box-shadow: 0 6px 18px -6px var(--blue-glow), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-primary:hover { filter: brightness(1.07); }
.btn-ghost { background: var(--card); border: 1px solid var(--border); color: var(--text); }
.btn-lg { height: 50px; padding: 0 24px; font-size: 16px; border-radius: 14px; }

.icon-btn {
  flex: 0 0 38px; width: 38px; height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: var(--card); border: 1px solid var(--border);
  color: var(--muted);
}
.icon-btn svg { width: 18px; height: 18px; }

/* ===== Карточка игрока ===== */
.player {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 14px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--card-2), var(--card));
  border: 1px solid var(--border);
}
.avatar {
  position: relative;
  width: 46px; height: 46px; flex: 0 0 46px;
  border-radius: 50%;
  overflow: hidden;
  background: #28406e;
  display: grid; place-items: center;
  box-shadow: 0 0 0 2px var(--card), 0 0 0 3px rgba(63,124,255,.35);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: none; }
.avatar img.loaded { display: block; }
.avatar img.loaded + .initials { display: none; }
.avatar .initials {
  font-size: 17px; font-weight: 800; letter-spacing: 1px;
  color: #cfe0ff;
  background: linear-gradient(135deg, #3f7cff 0%, #2a4f9e 100%);
  width: 100%; height: 100%; display: grid; place-items: center;
}
.player-info { flex: 1 1 auto; min-width: 0; }
.player-name { font-size: 16px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-id { color: var(--muted); font-size: 12px; margin-top: 2px; }
.chev { width: 22px; height: 22px; color: var(--muted); flex: 0 0 auto; }

/* ===== Баннер бонуса ===== */
.banner {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  container-type: inline-size;
  background:
    radial-gradient(420px 260px at 85% 55%, rgba(244,182,64,.28) 0%, rgba(244,182,64,0) 70%),
    radial-gradient(300px 220px at 70% 20%, rgba(63,124,255,.35) 0%, rgba(63,124,255,0) 70%),
    linear-gradient(120deg, #0f1a31 0%, #142443 55%, #1a2f55 100%);
  border: 1px solid var(--border);
  box-shadow: 0 18px 40px -24px rgba(0,0,0,.8);
}
.banner-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover; object-position: 72% center;
  display: none;
}
.banner-img.loaded { display: block; }
.banner-img.loaded ~ .banner-art { display: none; }
.banner-art { position: absolute; inset: 0; pointer-events: none; }
.banner-art svg { position: absolute; }
.banner-shade {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(10,17,33,.96) 0%, rgba(10,17,33,.85) 36%, rgba(10,17,33,.3) 58%, rgba(10,17,33,0) 72%);
}
/* Все размеры внутри баннера заданы в процентах от его ширины (cqw),
   поэтому текст стоит на одних и тех же местах картинки на любом экране. */
.banner-content {
  position: absolute; inset: 0;
  padding: 4.2cqw 4.5cqw 4.5cqw;
  display: flex; flex-direction: column; justify-content: space-between;
  width: 60%;
}
.banner-content > * { flex-shrink: 0; }
.banner-mid { display: flex; flex-direction: column; gap: 1.6cqw; }
.chip {
  display: inline-flex; align-items: center; gap: 1.5cqw;
  align-self: flex-start;
  height: 6.8cqw; padding: 0 2.6cqw;
  border-radius: 2.2cqw;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.12);
  font-size: 3.2cqw; font-weight: 600; color: #dbe5ff;
  white-space: nowrap;
}
.chip svg { width: 3.6cqw; height: 3.6cqw; color: var(--gold-2); }
.banner-title { font-size: 6.6cqw; font-weight: 900; line-height: 1.05; letter-spacing: -0.02em; margin: 0; }
.banner-title span { color: var(--gold-2); text-shadow: 0 0 18px rgba(255,214,114,.45); }
.banner-sub { color: #c3cfe8; font-size: 3.5cqw; line-height: 1.25; margin: 0; }
.promo {
  position: relative;
  display: inline-flex; align-items: center; gap: 2cqw;
  align-self: flex-start;
  height: 10cqw; min-height: 10cqw; padding: 0 3cqw 0 3.6cqw;
  border-radius: 3cqw;
  background: linear-gradient(180deg, rgba(255,214,114,.22), rgba(255,214,114,.1));
  border: 1px dashed rgba(255,214,114,.6);
  color: var(--gold-2);
  font-weight: 900; font-size: 4.3cqw; letter-spacing: .12em;
  box-shadow: 0 8px 24px -10px rgba(255,214,114,.5);
  transition: transform .08s, border-color .2s, background .2s;
  overflow: hidden;
}
.promo:active { transform: scale(.97); }
.promo-ico { width: 4.6cqw; height: 4.6cqw; opacity: .8; }
.promo-done {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: var(--green);
  color: #06331c;
  font-size: 3.6cqw; letter-spacing: .03em;
  transform: translateY(100%);
  transition: transform .25s ease;
}
.promo.copied { border-style: solid; border-color: var(--green); }
.promo.copied .promo-done { transform: translateY(0); }
.banner .btn { align-self: flex-start; margin-top: 4px; }
.dots {
  position: absolute; left: 0; right: 0; bottom: 10px;
  display: flex; justify-content: center; gap: 5px;
}
.dots i { width: 6px; height: 6px; border-radius: 3px; background: rgba(255,255,255,.25); transition: all .3s; }
.dots i.active { width: 18px; background: #fff; }

/* ===== Карточка игры DICE ===== */
.game-card {
  position: relative;
  display: block;
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 6;
  min-height: 130px;
  background:
    radial-gradient(260px 200px at 20% 110%, rgba(63,124,255,.45) 0%, rgba(63,124,255,0) 70%),
    radial-gradient(240px 180px at 85% -10%, rgba(94,147,255,.35) 0%, rgba(94,147,255,0) 70%),
    linear-gradient(160deg, #142649 0%, #0f1c38 60%, #0b162c 100%);
  border: 1px solid rgba(94,147,255,.22);
  box-shadow: 0 0 0 1px rgba(63,124,255,.08), 0 22px 48px -26px rgba(63,124,255,.55);
  transition: transform .15s, box-shadow .2s;
}
.game-card:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(63,124,255,.2), 0 26px 52px -24px rgba(63,124,255,.7); }
.game-card:active { transform: scale(.99); }
.game-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  display: none;
}
.game-img.loaded { display: block; }
.game-img.loaded ~ .game-art { display: none; }
.game-art { position: absolute; inset: 0; pointer-events: none; }
.game-art svg { position: absolute; filter: drop-shadow(0 14px 18px rgba(0,0,0,.45)); }
.game-art .die-1 { width: 34%; left: 6%; top: 8%; transform: rotate(-16deg); animation: float 5s ease-in-out infinite; }
.game-art .die-2 { width: 26%; left: 36%; bottom: -6%; transform: rotate(14deg); animation: float 6s ease-in-out infinite reverse; }
.game-art .die-3 { width: 36%; right: 4%; top: 4%; transform: rotate(22deg); animation: float 5.5s ease-in-out .5s infinite; }
.game-art .coin-a { width: 12%; left: 30%; top: 8%; animation: float 4s ease-in-out .3s infinite; }
.game-art .coin-b { width: 10%; right: 34%; bottom: 18%; animation: float 4.5s ease-in-out .9s infinite reverse; }
.game-art .coin-c { width: 8%; left: 10%; bottom: 10%; animation: float 5s ease-in-out .6s infinite; }
@keyframes float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -6px; }
}
.game-label {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  padding: 6px 20px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(20,34,66,.95), rgba(12,22,44,.95));
  border: 1px solid rgba(94,147,255,.35);
  box-shadow: 0 0 24px -4px var(--blue-glow), inset 0 1px 0 rgba(255,255,255,.1);
  font-size: 22px; font-weight: 900; letter-spacing: 2px;
  color: #fff; text-shadow: 0 0 14px rgba(94,147,255,.8);
}

/* ===== Лента ставок (место) ===== */
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 15px; font-weight: 800;
  padding: 4px 4px 0;
}
.section-title small { color: var(--muted); font-weight: 500; font-size: 12px; }
.bets {
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--border);
  overflow: hidden;
}
.bets-head {
  display: grid;
  grid-template-columns: 1.3fr .7fr 1fr .9fr 1fr;
  gap: 6px;
  padding: 12px 14px;
  font-size: 11px; color: var(--muted); font-weight: 600;
  background: var(--card-2);
}
.bets-head span:not(:first-child) { text-align: right; }
.bets-body {
  min-height: 220px;
  display: grid; place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--muted); font-size: 13px;
  background:
    repeating-linear-gradient(180deg, transparent 0 52px, rgba(255,255,255,.025) 52px 53px);
}
.bets-body b { display: block; color: var(--text); font-size: 14px; margin-bottom: 4px; }
.bets-body.has-rows { display: block; place-items: stretch; min-height: 0; padding: 0; background: none; text-align: left; color: var(--text); }
.bet-row { width: auto; justify-self: stretch; }
.bet-row {
  display: grid;
  grid-template-columns: 1.3fr .7fr 1fr .9fr 1fr;
  gap: 6px; align-items: center;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  font-size: 12.5px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  transition: opacity .45s ease, transform .45s ease, background .6s ease;
}
.bet-row:first-child { border-top: 0; }
.bet-row.new { opacity: 0; transform: translateY(-10px); }
.bet-row > span:not(:first-child) { text-align: right; white-space: nowrap; }
.c-user { display: flex; align-items: center; justify-content: flex-start; gap: 6px; color: var(--muted); min-width: 0; text-align: left; }
.c-user span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-ico { width: 14px; height: 14px; flex: 0 0 auto; opacity: .8; }
.c-time { color: var(--muted); }
.c-bet { display: inline-flex; justify-content: flex-end; align-items: center; gap: 4px; }
.coin-xs { width: 13px; height: 13px; flex: 0 0 auto; }
.bet-row.win .c-pay { color: var(--green); font-weight: 800; }
.bet-row.lose .c-pay { color: #aeb9d3; }
.c-user b { font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Своя выигрышная ставка: подсветка, пометка «Вы», пульс на пару секунд */
.bet-row.own-win {
  position: relative;
  background: linear-gradient(90deg, rgba(63,124,255,.28), rgba(47,224,138,.14));
  box-shadow: inset 3px 0 0 var(--blue-2), inset 0 0 0 1px rgba(94,147,255,.35);
}
.bet-row.own-win .c-user b { font-weight: 900; color: #fff; }
.bet-row.own-win .c-pay { font-size: 14px; font-weight: 900; text-shadow: 0 0 10px rgba(47,224,138,.6); }
.bet-row.own-win .you {
  font-style: normal; font-size: 10px; font-weight: 800; letter-spacing: .5px;
  padding: 1px 6px; border-radius: 6px;
  background: var(--blue); color: #fff; flex: 0 0 auto;
}
.bet-row.own-win.pulse { animation: ownPulse 1.1s ease-in-out 3; }
@keyframes ownPulse {
  0%, 100% { box-shadow: inset 3px 0 0 var(--blue-2), inset 0 0 0 1px rgba(94,147,255,.35); }
  50% { box-shadow: inset 3px 0 0 var(--green), inset 0 0 0 1px rgba(47,224,138,.8), 0 0 22px rgba(47,224,138,.45); background-color: rgba(47,224,138,.22); }
}
@media (max-width: 380px) {
  .bet-row, .bets-head { grid-template-columns: 1.2fr .6fr 1fr .8fr 1fr; gap: 4px; padding-left: 10px; padding-right: 10px; }
  .bet-row { font-size: 11.5px; }
}

/* ===== Общее для внутренних страниц ===== */
.page-title { display: flex; align-items: center; gap: 10px; font-size: 20px; font-weight: 800; padding: 6px 4px 0; }
.back { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; background: var(--card); border: 1px solid var(--border); color: var(--muted); }
.back svg { width: 18px; height: 18px; }
.placeholder {
  border-radius: var(--radius);
  background: var(--card);
  border: 1px dashed rgba(140,170,230,.25);
  min-height: 320px;
  display: grid; place-items: center;
  text-align: center; padding: 24px; color: var(--muted);
}
.placeholder b { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }

/* ===== Мобильные ===== */
@media (max-width: 420px) {
  .pill.online { gap: 6px; padding: 0 9px; font-size: 11px; }
  .pill.balance { padding: 0 8px; font-size: 13px; }
  .pill.balance .caret { display: none; }
  .btn-topup { padding: 0 11px; }
  .app { gap: 10px; }
  .game-card { min-height: 128px; }
  .game-label { font-size: 17px; padding: 5px 16px; }
}
@media (max-width: 360px) {
  .icon-btn.bell { display: none; }
}
