/* Оформление окна — тема «Obsidian Orchid» (тестовая вёрстка).

   Палитра своя, не Telegram theme. Поверхности в основном непрозрачные:
   слои через solid + border + редкую тень. Акцент — сдержанный orchid,
   золото только у денег. Анимации короткие, GPU-friendly. */

:root {
  color-scheme: dark;

  --bg: #0a0610;
  --bg-secondary: #120a1a;
  --card: #181022;
  --card-soft: #1f152c;
  --elevated: #241833;
  --text: #f6f0ff;
  --muted: #9b8fb0;
  --accent: #c084fc;
  --accent-deep: #8b5cf6;
  --accent-text: #ffffff;
  --link: #ddc4ff;
  --danger: #ff6b7a;
  --success: #5ee0a0;
  --warning: #ffc14d;
  --border: rgba(246, 240, 255, 0.07);
  --gold: #f0d18a;

  --border-strong: rgba(246, 240, 255, 0.13);
  --hairline: rgba(246, 240, 255, 0.055);
  --accent-soft: rgba(192, 132, 252, 0.16);
  --accent-softer: rgba(192, 132, 252, 0.08);
  --success-soft: rgba(94, 224, 160, 0.12);
  --success-line: rgba(94, 224, 160, 0.34);
  --danger-soft: rgba(255, 107, 122, 0.12);
  --danger-line: rgba(255, 107, 122, 0.34);
  --warning-soft: rgba(255, 193, 77, 0.12);
  --gold-soft: rgba(240, 209, 138, 0.12);
  --gold-line: rgba(240, 209, 138, 0.30);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.045) inset;
  --shadow-card: 0 10px 28px rgba(0, 0, 0, 0.28);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.2, .85, .25, 1);

  --radius: 16px;
  --radius-sm: 12px;
  --gap: 12px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 62px;

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
             "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
                  "Helvetica Neue", system-ui, sans-serif;

  --screen-h: 100vh;
}

@supports (height: 100dvh) {
  :root { --screen-h: 100dvh; }
}

/* Настоящая видимая высота окна. Telegram кладёт её в --tg-viewport-stable-height;
   если клиент старый — берём высоту вьюпорта. */
:root { --viewport-h: var(--tg-viewport-stable-height, var(--screen-h)); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* Скрытое обязано быть скрытым.
   JS прячет экраны через element.hidden, но правило браузера [hidden]
   принадлежит его собственной таблице стилей, а любое авторское `display`
   её перебивает. Из-за этого `.boot`, `.fatal`, `.app` и `.sheet` с их
   `display: flex` показывались всегда: поверх приложения постоянно висел
   экран отказа, и «Что-то пошло не так» просвечивало сквозь экскурсию. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  color: var(--text);
  font: 400 15px/1.45 var(--font-ui);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  overflow: hidden;
  background: var(--bg);
}

/* Тихая глубина без «кислотных» бликов — отдельный слой под UI. */
.atmosphere {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(80% 50% at 12% -8%, rgba(139, 92, 246, 0.18), transparent 58%),
    radial-gradient(60% 42% at 96% 4%, rgba(192, 132, 252, 0.08), transparent 52%),
    radial-gradient(70% 48% at 50% 110%, rgba(88, 40, 140, 0.16), transparent 55%),
    var(--bg);
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--link); text-decoration: none; }
::selection { background: var(--accent-soft); color: var(--text); }

.screen::-webkit-scrollbar,
.sheet__body::-webkit-scrollbar,
.tour__text::-webkit-scrollbar { width: 3px; }
.screen::-webkit-scrollbar-thumb,
.sheet__body::-webkit-scrollbar-thumb,
.tour__text::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; }

/* ---------- Загрузка и фатальная ошибка ----------
   Фон непрозрачный и слои разведены: экран отказа не должен просвечивать
   сквозь открытый лист (z-index листа — 100). */

.boot, .fatal {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 16px; padding: 32px; text-align: center;
  background-color: var(--bg);
  background-image:
    radial-gradient(100% 70% at 50% 0%, rgba(139, 92, 246, 0.16), transparent 62%);
}
.boot { z-index: 30; }
.fatal { z-index: 40; }
.boot__mark {
  width: 64px; height: 64px; border-radius: 20px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, var(--elevated), var(--card));
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-card);
}
.boot__spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2.5px solid var(--accent-softer); border-top-color: var(--accent);
  animation: spin .75s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot__text, .fatal__text { color: var(--muted); margin: 0; max-width: 32ch; font-size: 14px; }
.fatal__icon { font-size: 0; display: flex; justify-content: center; }
.fatal__icon .ico-svg { width: 48px; height: 48px; }
.fatal__title {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 700; letter-spacing: -.02em; margin: 0;
}
.fatal__actions { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 320px; }

/* ---------- Каркас ---------- */

.app { display: flex; flex-direction: column; height: 100%; min-height: 0; position: relative; z-index: 2; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: calc(var(--safe-top) + 10px) 16px 10px;
  background: rgba(10, 6, 16, 0.82);
  border-bottom: 1px solid var(--hairline);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  flex: 0 0 auto;
}
.topbar__user {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  max-width: calc(100% - 7.5rem);
  padding: 4px 10px 4px 4px; margin: -4px 0 -4px -4px;
  border-radius: 999px;
  text-align: left;
  transition: background .18s var(--ease-out), transform .12s ease;
}
.topbar__user:active { background: var(--accent-softer); transform: scale(.985); }
.topbar__who { min-width: 0; }
.topbar__name {
  font-weight: 650; font-size: 15px; letter-spacing: -.015em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 36vw;
}
.topbar__sub {
  color: var(--muted); font-size: 11.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 36vw;
}
.topbar__chevron {
  color: #7a6b90; font-size: 18px; line-height: 1;
  flex: 0 0 auto; margin-left: 2px; opacity: .65;
}

.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--card-soft) center/cover no-repeat;
  border: 1px solid var(--border-strong);
  box-shadow: 0 0 0 2px rgba(192, 132, 252, 0.08);
  display: grid; place-items: center;
  font-size: 14px; font-weight: 650; color: var(--link);
  flex: 0 0 auto;
}
.avatar--lg {
  width: 52px; height: 52px; font-size: 20px;
}
.profile-head__row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px; text-align: left;
}
.profile-head__who { min-width: 0; flex: 1 1 auto; }
.profile-head__name {
  font-weight: 600; font-size: 18px; letter-spacing: -.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.profile-head__sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.profile-head__money { text-align: center; padding-top: 12px; border-top: 1px solid var(--hairline); }
.hero__value--sm { font-size: clamp(20px, 7vw, 28px); margin: 4px 0 2px; }

.streak-card {
  display: flex; align-items: center; gap: 12px;
  margin: 12px 0; padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(192, 132, 252, 0.14), rgba(192, 132, 252, 0.04));
  border: 1px solid var(--border-strong);
  text-align: left;
  box-shadow: var(--shadow);
}
.streak-card__icon { flex: 0 0 auto; display: grid; place-items: center; }
.streak-card__icon .ico-svg { width: 26px; height: 26px; }
.streak-card__body { min-width: 0; flex: 1 1 auto; }
.streak-card__value { font-weight: 600; font-size: 14.5px; letter-spacing: -.01em; }
.streak-card__sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* Кошелёк — золотой чип баланса. */
.wallet {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 12px; border-radius: 999px;
  background: linear-gradient(180deg, #2a1f18, #1a1410);
  border: 1px solid var(--gold-line);
  box-shadow: var(--shadow), 0 6px 16px rgba(0, 0, 0, 0.22);
  font-family: var(--font-display);
  font-weight: 700; font-variant-numeric: tabular-nums;
  font-size: 13.5px; letter-spacing: -.025em;
  color: var(--gold);
  transition: transform .12s var(--ease-out), opacity .12s ease;
  flex: 0 0 auto; max-width: 46vw;
}
.wallet__value {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.wallet__icon { font-size: 0; line-height: 0; display: flex; align-items: center; }
.wallet:active { transform: scale(.96); opacity: .92; }
.wallet.is-pulse { animation: wallet-pulse .55s var(--ease-spring); }
@keyframes wallet-pulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.06); border-color: rgba(240, 209, 138, 0.55); }
  100% { transform: scale(1); }
}

.screen {
  flex: 1 1 auto; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 22px);
  outline: none;
}
.screen.is-enter { animation: screen-in .32s var(--ease-out); }
@keyframes screen-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; align-items: stretch;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 6px var(--safe-bottom);
  background: rgba(12, 7, 18, 0.92);
  border-top: 1px solid var(--hairline);
  box-shadow: 0 -12px 32px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  z-index: 20;
}
.tab {
  position: relative;
  flex: 1 1 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
  color: var(--muted); font-size: 10px; font-weight: 550; letter-spacing: .02em;
  padding: 8px 2px; min-width: 0;
  transition: color .2s var(--ease-out), transform .12s ease;
}
.tab__icon {
  font-size: 0; line-height: 0; display: grid; place-items: center;
  width: 40px; height: 28px; border-radius: 999px;
  transition: background .2s var(--ease-out), transform .16s var(--ease-spring);
}
.tab__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.tab.is-active { color: var(--link); }
.tab.is-active .tab__icon {
  background: var(--accent-soft);
  transform: translateY(-1px);
}
.tab.is-active::before { display: none; }
.tab:active { transform: scale(.94); }

/* Нарисованные штампы вместо системных эмодзи. Размер задаёт
   хозяин (вкладка, плитка, строка) — сам SVG масштабируется в нём. */
.ico {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 auto; line-height: 0; font-size: 0;
}
.ico-svg { display: block; width: 24px; height: 24px; overflow: visible; }
.tab__icon .ico-svg { width: 22px; height: 22px; }
.tile__icon .ico-svg { width: 26px; height: 26px; }
.row__icon .ico-svg { width: 22px; height: 22px; }
.wallet__icon .ico-svg { width: 16px; height: 16px; }
.empty__icon .ico-svg { width: 42px; height: 42px; }
.tour__icon .ico-svg { width: 44px; height: 44px; }
.coin .ico-svg { width: 62px; height: 62px; }
.die .ico-svg { width: 42px; height: 42px; }
.mine-cell .ico-svg { width: 28px; height: 28px; }
.result__value .ico-svg { width: 36px; height: 36px; }
.hero__value .ico-svg { width: 28px; height: 28px; }
.reel .ico-svg { width: 44px; height: 44px; }
.hero__label { display: flex; align-items: center; justify-content: center; gap: 6px; }
.hero__label .ico-svg { width: 16px; height: 16px; }

/* ---------- Блоки ---------- */

.card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 28%),
    var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: var(--gap);
  box-shadow: var(--shadow);
}
.card--flat { background: transparent; border: none; padding: 0; box-shadow: none; }

.section-title {
  font-size: 12px; letter-spacing: .04em;
  color: var(--muted); margin: 18px 6px 10px; font-weight: 650;
  text-transform: uppercase;
}
.section-title:first-child { margin-top: 2px; }

.hero {
  position: relative;
  text-align: center; padding: 22px 16px 18px;
  border-color: var(--border-strong);
  background:
    linear-gradient(165deg, rgba(192, 132, 252, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 40%),
    var(--card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.hero::after {
  content: '';
  position: absolute; inset: auto -20% -40% -20%; height: 70%;
  background: radial-gradient(50% 60% at 50% 100%, rgba(139, 92, 246, 0.18), transparent 70%);
  pointer-events: none;
}
.hero__label {
  position: relative; z-index: 1;
  color: var(--muted); font-size: 11.5px; font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.hero__value {
  position: relative; z-index: 1;
  font-family: var(--font-display);
  font-size: clamp(26px, 9vw, 38px); font-weight: 750; line-height: 1.08;
  margin: 8px 0 4px;
  font-variant-numeric: tabular-nums; letter-spacing: -.035em;
  color: var(--text);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  word-break: break-word;
}
.hero__sub { position: relative; z-index: 1; color: var(--muted); font-size: 13px; }

.rows { display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--hairline);
  text-align: left; width: 100%;
  transition: opacity .14s ease, transform .12s ease;
}
.row:last-child { border-bottom: none; }
.row__icon {
  font-size: 0; width: 36px; height: 36px;
  display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 11px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
}
.row__body { flex: 1 1 auto; min-width: 0; }
.row__title { font-weight: 650; letter-spacing: -.015em; font-size: 14.5px; }
.row__sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.row__value {
  font-family: var(--font-display);
  font-weight: 700; font-variant-numeric: tabular-nums;
  flex: 0 0 auto; text-align: right; letter-spacing: -.02em;
}
.row__chevron { color: #7a6b90; flex: 0 0 auto; font-size: 18px; opacity: .7; }
button.row:active { opacity: .7; transform: scale(.995); }
.row.is-disabled { opacity: .42; pointer-events: none; }

.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid--3 .tile { min-height: 80px; padding: 12px 10px; }

.tile {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 36%),
    var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  display: flex; flex-direction: column; gap: 6px;
  align-items: flex-start; text-align: left; min-height: 92px;
  justify-content: center;
  transition: transform .14s var(--ease-out), border-color .18s ease, background .18s ease;
  box-shadow: var(--shadow);
}
.tile:active { transform: scale(.975); }
.tile__icon {
  font-size: 0; line-height: 0; display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 11px;
  background: var(--bg-secondary); border: 1px solid var(--border);
}
.tile__title { font-weight: 650; font-size: 13.5px; letter-spacing: -.01em; }
.tile__sub { color: var(--muted); font-size: 11.5px; line-height: 1.35; }

.tile.is-ready {
  border-color: var(--success-line);
  background:
    linear-gradient(180deg, rgba(94, 224, 160, 0.12), transparent 55%),
    var(--card);
  box-shadow: var(--shadow), 0 0 0 1px rgba(94, 224, 160, 0.08);
}
.tile.is-ready .tile__sub { color: var(--success); }
.tile.is-disabled { opacity: .42; animation: none; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { text-align: center; }
.stat__value {
  font-family: var(--font-display);
  font-weight: 700; font-size: 17px;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.stat__label { color: var(--muted); font-size: 11px; margin-top: 2px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 48px; padding: 13px 16px; border-radius: 14px;
  background: linear-gradient(180deg, #b07aff 0%, var(--accent-deep) 100%);
  color: var(--accent-text);
  font-weight: 650; font-size: 15px; letter-spacing: -.01em;
  box-shadow: var(--shadow), 0 8px 20px rgba(139, 92, 246, 0.28);
  transition: transform .12s var(--ease-out), opacity .15s ease, filter .15s ease;
}
.btn:active:not(:disabled) { transform: scale(.975); filter: brightness(.96); }
.btn:disabled { opacity: .42; cursor: default; box-shadow: none; }
.btn--ghost {
  background-image: none; background-color: transparent;
  color: var(--text); border: 1px solid var(--border-strong);
  box-shadow: none;
}
.btn--ghost:active:not(:disabled) { background: var(--accent-softer); }
.btn--danger {
  background-image: none;
  background: linear-gradient(180deg, #e25568, #bf3346);
  color: #fff; box-shadow: 0 8px 18px rgba(191, 51, 70, 0.28);
}
.btn--sm { min-height: 40px; padding: 9px 12px; font-size: 13.5px; border-radius: 12px; box-shadow: none; }
.btn + .btn { margin-top: 8px; }
.btn__spin {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: currentColor;
  animation: spin .7s linear infinite;
}

.btn-row { display: flex; gap: 8px; }
.btn-row .btn { margin-top: 0; }

.field { margin-bottom: 12px; }
.field__label {
  display: block; color: var(--muted); font-size: 11.5px; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; margin-bottom: 7px;
}
.input {
  width: 100%; padding: 14px 14px; border-radius: var(--radius-sm);
  background: var(--bg-secondary); border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.input::placeholder { color: #6f5f84; }
.input:focus {
  outline: none; border-color: rgba(192, 132, 252, 0.55);
  background: #15101f;
  box-shadow: 0 0 0 3px var(--accent-softer);
}
select.input { appearance: none; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 9px 14px; border-radius: 999px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  font-size: 13.5px; font-weight: 600;
  transition: transform .12s var(--ease-out), background .18s ease, border-color .18s ease;
}
.chip.is-active {
  background: linear-gradient(180deg, #b07aff, var(--accent-deep));
  color: var(--accent-text); border-color: transparent;
  box-shadow: 0 6px 14px rgba(139, 92, 246, 0.28);
}
.chip--zero {
  border-color: rgba(94, 224, 160, 0.35);
  color: var(--success);
}
.chip--zero.is-active {
  background: linear-gradient(180deg, #6ee7b0, #1f8a4c);
  color: #fff;
  box-shadow: 0 6px 14px rgba(31, 138, 76, 0.32);
}
.chip:active { transform: scale(.95); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 650;
  background: var(--accent-soft); color: var(--link);
}
.badge--ok { background: var(--success-soft); color: var(--success); }
.badge--warn { background: var(--warning-soft); color: var(--warning); }
.badge--muted { background: rgba(154, 138, 175, .12); color: var(--muted); }

.progress {
  height: 7px; border-radius: 999px;
  background: rgba(192, 132, 252, .10); overflow: hidden; margin-top: 10px;
}
.progress__bar {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  transition: width .35s var(--ease-out);
}

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty__icon {
  font-size: 0; margin: 0 auto 12px; display: flex; justify-content: center; align-items: center;
  width: 64px; height: 64px;
  border-radius: 20px;
  background: var(--card); border: 1px solid var(--border);
}
.empty__title {
  color: var(--text); font-weight: 700; font-size: 16px;
  letter-spacing: -.015em; margin-bottom: 6px;
}

.skeleton {
  background: linear-gradient(90deg, var(--card) 22%, #2a1c3c 38%, var(--card) 54%);
  background-size: 400% 100%;
  animation: shimmer 1.25s ease infinite;
  border-radius: var(--radius);
  border: 1px solid var(--hairline);
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.skeleton--hero { height: 124px; margin-bottom: var(--gap); }
.skeleton--row { height: 66px; margin-bottom: 10px; }

.note { color: var(--muted); font-size: 12.5px; margin-top: 8px; }
.note--tight { margin-top: 4px; }
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; word-break: break-all; color: var(--link);
}

.win { color: var(--success); }
.lose { color: var(--danger); }

/* ---------- Игры ---------- */

.reels {
  display: flex; justify-content: center; gap: 12px;
  font-size: 38px; padding: 20px 12px 14px; min-height: 96px;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(192, 132, 252, .10), rgba(192, 132, 252, 0) 78%),
    var(--bg-secondary);
  border: 1px solid var(--border);
}
.reel {
  width: 74px; height: 74px; text-align: center;
  display: grid; place-items: center;
  border-radius: 16px;
  background: linear-gradient(180deg, #2f1b44, #160b1f);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow), 0 8px 18px rgba(0, 0, 0, 0.22);
  transition: transform .28s var(--ease-out), box-shadow .28s ease, border-color .2s ease;
}
.reel.is-spinning {
  animation: roll .18s linear infinite;
  border-color: rgba(181, 107, 255, .35);
}
.reel.is-land {
  animation: reel-land .42s cubic-bezier(.2, .85, .25, 1);
  border-color: rgba(232, 196, 122, .45);
  box-shadow: 0 0 0 1px rgba(232, 196, 122, .18);
}
@keyframes roll {
  0% { transform: translateY(-7px); opacity: .5; }
  50% { opacity: 1; }
  100% { transform: translateY(7px); opacity: .75; }
}
@keyframes reel-land {
  0% { transform: scale(.86) translateY(8px); opacity: .55; }
  60% { transform: scale(1.06) translateY(0); opacity: 1; }
  100% { transform: scale(1) translateY(0); }
}
.slots-out {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .35s ease, transform .35s cubic-bezier(.2, .8, .2, 1);
}
.slots-out--show { opacity: 1; transform: translateY(0); }

.coin, .die, .wheel {
  display: grid; place-items: center; margin: 6px auto 12px;
  font-weight: 700;
}
.coin {
  width: 100px; height: 100px; border-radius: 50%;
  background: linear-gradient(160deg, #3a2a1a, #1a1210 55%, #120c0a);
  font-size: 0; border: 2px solid var(--gold-line); color: var(--gold);
  box-shadow: var(--shadow), 0 12px 28px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 230, 180, 0.18);
}
.die {
  width: 88px; height: 88px; border-radius: 22px;
  background: linear-gradient(160deg, #2f1b44, #160b1f);
  font-size: 40px; border: 2px solid var(--border-strong);
  box-shadow: var(--shadow-card);
}
.wheel {
  width: 100px; height: 100px; border-radius: 50%; font-size: 30px; color: #fff;
  box-shadow: var(--shadow-card);
  display: grid; place-items: center;
}
.wheel--red { background: #d1364a; }
.wheel--black { background: #1a1024; border: 2px solid var(--border-strong); }
.wheel--green { background: #1f8a4c; }
.is-flip { animation: flip .5s ease; }
@keyframes flip { 0% { transform: rotateY(0) scale(.9); } 100% { transform: rotateY(720deg) scale(1); } }

.mines-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 7px; margin: 12px 0; }
.mine-cell {
  aspect-ratio: 1; border-radius: var(--radius-sm);
  background: var(--bg-secondary); border: 1px solid var(--border);
  display: grid; place-items: center; font-size: 21px;
  transition: transform .14s cubic-bezier(.2, .8, .2, 1), background-color .22s ease, border-color .22s ease, box-shadow .22s ease;
}
.mine-cell:active:not(:disabled) { transform: scale(.94); }
.mine-cell:disabled { cursor: default; }
.mine-cell.is-open {
  background: rgba(94, 224, 160, .18); border-color: var(--success-line);
  animation: mine-pop .32s cubic-bezier(.2, .85, .25, 1);
}
.mine-cell.is-bomb { background: rgba(255, 107, 122, .18); border-color: var(--danger-line); }
.mine-cell.is-boom {
  background: var(--danger); border-color: transparent;
  animation: mine-boom .38s cubic-bezier(.2, .85, .25, 1);
}
@keyframes mine-pop {
  0% { transform: scale(.82); opacity: .55; }
  70% { transform: scale(1.06); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes mine-boom {
  0% { transform: scale(.9); }
  40% { transform: scale(1.08); }
  100% { transform: scale(1); }
}

.hand { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 2px; }
.pcard {
  min-width: 44px; padding: 10px 8px; border-radius: 12px;
  background: linear-gradient(180deg, #fffaf6, #efe6ff);
  color: #1b1026;
  font-weight: 750; font-size: 15px; text-align: center;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}
.pcard--red { color: #cf2f45; }
.pcard--hidden { background: var(--bg-secondary); color: #6f5f84; border: 1px solid var(--border); }
.hand-label { color: var(--muted); font-size: 12px; }
.hand-score { font-weight: 700; font-variant-numeric: tabular-nums; }

.result {
  border-radius: var(--radius); padding: 18px 16px; margin-bottom: var(--gap);
  border: 1px solid var(--border); background: var(--card); text-align: center;
  animation: result-in .35s var(--ease-out);
}
@keyframes result-in {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.result--win {
  background: linear-gradient(180deg, rgba(94, 224, 160, 0.14), transparent 72%), var(--card);
  border-color: var(--success-line);
}
.result--lose {
  background: linear-gradient(180deg, rgba(255, 107, 122, 0.12), transparent 72%), var(--card);
  border-color: var(--danger-line);
}
.result__value {
  font-family: var(--font-display); font-optical-sizing: auto;
  font-size: 26px; font-weight: 750; font-variant-numeric: tabular-nums; letter-spacing: -.02em;
}
.result__text { color: var(--muted); font-size: 13px; margin-top: 4px; }

/* ---------- Уведомления ---------- */

.toasts {
  position: fixed; left: 12px; right: 12px;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
  display: flex; flex-direction: column; gap: 8px;
  z-index: 140; pointer-events: none;
}
.toast {
  background: linear-gradient(180deg, #2c1b3d, #221531);
  border: 1px solid var(--border-strong);
  border-radius: 14px; padding: 13px 15px;
  font-size: 13.5px; font-weight: 550;
  box-shadow: var(--shadow-card);
  max-height: 120px;
  animation: toast-in .3s var(--ease-out);
  transition: opacity .3s ease, transform .3s var(--ease-out), max-height .3s ease, margin .3s ease, padding .3s ease;
}
.toast--error { border-color: var(--danger-line); }
.toast--ok { border-color: var(--success-line); }
.toast--out {
  opacity: 0;
  transform: translateY(8px) scale(.98);
  max-height: 0;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
  overflow: hidden;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

.row__actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 104px;
}
.row__actions .btn { width: 100%; justify-content: center; }

.sheet-fade { animation: sheet-body-in .28s cubic-bezier(.2, .8, .2, 1); }
@keyframes sheet-body-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Лист снизу ----------

   Высота считается от --viewport-h, а не от 100vh: в Telegram видимая часть
   бывает заметно ниже окна, и лист на 88vh уезжал кнопками за край экрана.
   Прокручивается только .sheet__body — шапка и нижний край панели на месте. */

.sheet { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; }
.sheet__backdrop {
  position: absolute; inset: 0;
  background: rgba(4, 1, 8, .78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade .22s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet__panel {
  position: relative; width: 100%;
  display: flex; flex-direction: column;
  max-height: min(88vh, max(50vh, calc(var(--viewport-h) - 18px)));
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 18%),
    linear-gradient(180deg, #241833 0%, #140c1c 48%);
  border-top: 1px solid var(--border-strong);
  border-radius: 24px 24px 0 0;
  padding: 8px 16px calc(var(--safe-bottom) + 16px);
  box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.45);
  animation: rise .32s var(--ease-out);
}
@keyframes rise { from { transform: translateY(16%); opacity: 0; } }
.sheet__grip {
  width: 36px; height: 4px; border-radius: 999px;
  background: rgba(246, 240, 255, 0.18); margin: 6px auto 12px;
  flex: 0 0 auto;
}
.sheet__title {
  font-size: 18px; font-weight: 700; letter-spacing: -.02em;
  margin: 0 0 14px; flex: 0 0 auto;
}
.sheet__title:empty { display: none; }
.sheet__body {
  flex: 1 1 auto; min-height: 0;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding-bottom: 4px;
}

.list-num { color: var(--muted); width: 20px; flex: 0 0 auto; font-variant-numeric: tabular-nums; }

/* ---------- Знакомство ----------

   Экскурсия обязана помещаться целиком: точки и кнопки «Далее»/«Пропустить»
   закреплены внизу панели, прокручивается при нехватке места только текст. */

.sheet--tour .sheet__panel {
  min-height: min(48vh, 372px);
  padding-bottom: calc(var(--safe-bottom) + 14px);
}
.sheet--tour .sheet__body {
  display: flex; flex-direction: column;
  overflow: hidden; padding-bottom: 0;
}

.tour-wrap {
  display: flex; flex-direction: column;
  flex: 1 1 auto; min-height: 0; width: 100%;
}
.tour {
  display: flex; flex-direction: column; justify-content: center;
  flex: 1 1 auto; min-height: 0;
  text-align: center; padding: 2px 2px 0;
}
.tour__icon { font-size: 0; line-height: 0; margin-bottom: 10px; flex: 0 0 auto; display: flex; justify-content: center; }
.tour__title {
  font-size: 16.5px; font-weight: 650; line-height: 1.25;
  letter-spacing: -.01em; margin-bottom: 7px; flex: 0 0 auto;
}
.tour__text {
  color: var(--muted); font-size: 13.5px; line-height: 1.5;
  flex: 0 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
}

.tour__foot { flex: 0 0 auto; padding-top: 4px; }
.tour__dots { display: flex; justify-content: center; gap: 6px; margin: 14px 0 12px; }
.tour__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(181, 107, 255, .22);
  transition: background-color .22s ease, width .22s cubic-bezier(.2, .8, .2, 1);
}
.tour__dot.is-active { background: var(--accent); width: 18px; border-radius: 999px; }

/* ---------- Карточка боя ---------- */

.battle-card {
  display: block; width: 100%; height: auto;
  border-radius: var(--radius); margin-bottom: var(--gap);
  border: 1px solid var(--border);
}
.battle-card--loading {
  aspect-ratio: 4 / 3;
  background: linear-gradient(90deg, var(--card) 25%, #2a1a3a 37%, var(--card) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s ease infinite;
}

/* ---------- Экономия движения ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (max-width: 360px) {
  .row__actions { min-width: 92px; }
  .grid--3 { gap: 6px; }
  .topbar__name, .topbar__sub { max-width: 30vw; }
  .wallet { max-width: 42vw; padding: 7px 10px; font-size: 12.5px; }
  .hero__value { font-size: clamp(22px, 8vw, 32px); }
}

@media (max-height: 620px) {
  .sheet--tour .sheet__panel { min-height: 0; }
  .tour__icon { font-size: 0; margin-bottom: 7px; }
  .tour__icon .ico-svg { width: 34px; height: 34px; }
  .tour__title { font-size: 15.5px; }
  .tour__text { font-size: 13px; }
  .tour__dots { margin: 10px 0 9px; }
  .btn { padding: 12px 16px; min-height: 44px; }
  .hero { padding: 16px 14px 14px; }
  .hero__value { font-size: 32px; }
}
