/* =========================================================
   Exodium mini app (Telegram), phone first.

   System (unslop pass):
   - one graphite ramp, three text roles, one accent used only for selection
   - 4px spacing grid
   - radii: 20 card · 12 inside a card (20 − 8 padding) · 16 option tile ·
     12 control · 6 plate; island 24 with an 18 pill (24 − 6)
   - system font, weights 400 / 500 / 600, tabular figures
   - motion: transform and opacity only, one easing curve
   ========================================================= */
:root {
  --bg: #0f0f10;
  --card: #19191b;
  --raised: #232325;
  --raised-2: #2c2c2f;
  --line: rgba(237, 237, 237, 0.08);

  --text: #ededed;
  --text-2: #a1a1a6;
  --muted: #85858b;

  --accent: #4c8dff;
  --positive: #4cc38a;
  --negative: #e5484d;
  --warn: #d9a441;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --r-card: 20px;
  --r-inner: 12px;
  --r-tile: 16px;
  --r-ctl: 12px;

  --pad: 16px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --island-h: 64px;
  --island-gap: 12px;

  /* Telegram sets --tg-viewport-stable-height; outside Telegram fall back to dvh */
  --app-h: var(--tg-viewport-stable-height, 100dvh);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; background: var(--bg); overscroll-behavior: none; }

body {
  color: var(--text);
  font: 400 15px/20px var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg { display: block; flex: none; }
img { display: block; }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); font-size: 13px; }

/* Press feedback: a tiny scale, never a layout change */
.press { transition: transform 140ms var(--ease), background-color 140ms var(--ease); }
.press:active { transform: scale(0.98); }

/* ---------- Shell ---------- */
.app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: var(--app-h);
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
}

.scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  /* the last item never sits under the island */
  padding-bottom: calc(var(--island-h) + var(--island-gap) * 2 + var(--safe-b) + 8px);
}

.scroll::-webkit-scrollbar { display: none; }

.view { padding: 0 var(--pad); }
.view.enter { animation: enter 240ms var(--ease); }

@keyframes enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* ---------- Top ---------- */
/* Flow screens: only a back button. Tab screens: no bar at all. */
.bar { flex: none; display: flex; align-items: center; height: 56px; padding: 0 var(--pad); }
.bar:empty { display: none; }
.bar-title { display: none; }

.back {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-ctl);
  background: var(--card);
  color: var(--text-2);
}

.back svg { width: 20px; height: 20px; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 64px;
}

.bar + .scroll .top { height: 48px; }

.title { font-size: 28px; line-height: 32px; font-weight: 600; letter-spacing: -0.01em; }

.balance {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-ctl);
  background: var(--card);
  font-size: 14px;
  font-weight: 500;
}

.balance svg { width: 18px; height: 18px; color: var(--muted); }

/* ---------- Labels ---------- */
.label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 24px 4px 8px;
  font-size: 13px;
  line-height: 16px;
  color: var(--muted);
}

.note { margin: 12px 4px 0; font-size: 13px; line-height: 16px; color: var(--muted); }

/* ---------- Game chips ---------- */
.chips {
  display: flex;
  gap: 8px;
  margin: 0 calc(var(--pad) * -1) 16px;
  padding: 0 var(--pad);
  overflow-x: auto;
  scrollbar-width: none;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-ctl);
  background: var(--card);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  transition: background-color 140ms var(--ease), color 140ms var(--ease);
}

.chip.is-on { background: var(--raised-2); color: var(--text); }

/* ---------- Tiles: mod logo or its letter ---------- */
.tile {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: var(--r-inner);
  background: var(--raised);
  color: var(--text-2);
  font-size: 17px;
  font-weight: 600;
  overflow: hidden;
}

.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile-lg { width: 64px; height: 64px; border-radius: var(--r-tile); font-size: 24px; }

/* ---------- Catalog: the featured mod ---------- */
.feature {
  display: block;
  width: 100%;
  padding: 8px;
  border-radius: var(--r-card);
  background: var(--card);
  text-align: left;
}

/* The moment of this screen: the mod's real logo, on the logo's own black */
.feature-art {
  display: grid;
  place-items: center;
  height: 180px;
  border-radius: var(--r-inner);
  background: #020204;
  overflow: hidden;
}

.feature-art { position: relative; }
.feature-art img { position: absolute; left: 50%; top: 50%; width: 248px; height: 248px; transform: translate(-50%, -50%); }
.art-sm { height: 148px; border-radius: var(--r-card); margin-bottom: 16px; }
.art-sm img { width: 208px; height: 208px; }
.feature-letter { font-size: 96px; line-height: 1; font-weight: 600; color: var(--text); }

.feature-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px 8px 4px;
}

/* ---------- Rows and groups ---------- */
.group { border-radius: var(--r-card); background: var(--card); overflow: hidden; }
.group + .group { margin-top: 12px; }

.row {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 10px 16px 10px 12px;
  text-align: left;
  transition: background-color 140ms var(--ease);
}

button.row:active { background: var(--raised); }

/* Hairline between rows, inset to the text column */
.row + .row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 68px;
  right: 0;
  height: 1px;
  background: var(--line);
}

.row.is-off { opacity: 0.45; pointer-events: none; }

.row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-title { font-size: 16px; line-height: 20px; font-weight: 500; }
.row-sub { font-size: 13px; line-height: 16px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-inline { margin-left: 8px; font-size: 13px; font-weight: 400; color: var(--muted); }
.row-end { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); }
.row-end svg { width: 18px; height: 18px; }
.row-value { font-size: 15px; color: var(--text); }
.row-end .row-value { color: var(--text-2); }

.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* Line icon in a row: one size, one stroke, muted */
.ico { display: grid; place-items: center; width: 44px; height: 44px; color: var(--text-2); }
.ico svg { width: 22px; height: 22px; }

/* Key and value rows (profile) */
.group-kv .row { grid-template-columns: 1fr auto; min-height: 52px; padding: 0 16px; }
.group-kv .row + .row::before { left: 16px; }
.group-kv .row-title { font-weight: 400; color: var(--text-2); font-size: 15px; }

/* Payment method rows: name, then its marks */
.row-method { grid-template-columns: 1fr auto; padding: 12px 16px; min-height: 72px; }
.row-method + .row-method::before { left: 16px; }
.row-method .row-text { gap: 8px; }

/* ---------- Payment marks ---------- */
.plates { display: inline-flex; align-items: center; gap: 6px; }

.plate {
  display: grid;
  place-items: center;
  width: 40px;
  height: 24px;
  border-radius: 6px;
  background: var(--raised-2);
  color: var(--text);
}

.plate svg { max-width: 26px; max-height: 12px; width: auto; height: 12px; }
.plate-mastercard svg, .plate-usdt svg, .plate-ton svg, .plate-star svg, .plate-wallet svg, .plate-sbp svg { height: 16px; max-height: 16px; }
.plate-mir svg { height: 9px; max-width: 28px; }
.plate-visa svg { height: 9px; max-width: 28px; }
.plate-googlepay svg { height: 11px; max-width: 30px; }
.plate-applepay svg { height: 12px; max-width: 28px; }

.accept {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 4px 0;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Empty state ---------- */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 40px 24px 32px;
  border-radius: var(--r-card);
  background: var(--card);
  text-align: center;
}

.empty-icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 12px; border-radius: var(--r-tile); background: var(--raised); color: var(--text-2); }
.empty-icon svg { width: 28px; height: 28px; }
.empty-title { font-size: 17px; line-height: 22px; font-weight: 600; }
.empty-text { font-size: 14px; color: var(--muted); }
.empty .btn { margin-top: 20px; }

.btn {
  height: 44px;
  padding: 0 16px;
  border-radius: var(--r-ctl);
  background: var(--raised-2);
  font-size: 15px;
  font-weight: 500;
}

/* ---------- Mod page ---------- */
.product { display: flex; align-items: center; gap: 16px; padding: 4px 0 4px; }
.product .title { font-size: 24px; line-height: 28px; }

/* Options: the ring is always there (transparent), so selecting never moves anything */
.opt {
  border-radius: var(--r-tile);
  background: var(--card);
  box-shadow: inset 0 0 0 1.5px transparent;
  text-align: left;
  transition: box-shadow 140ms var(--ease), background-color 140ms var(--ease), transform 140ms var(--ease);
}

.opt:active { transform: scale(0.98); }
.opt.is-on { background: var(--raised); box-shadow: inset 0 0 0 1.5px var(--accent); }

.opts3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.opt-device {
  display: flex;
  flex-direction: column;
  gap: 2px;
  height: 96px;
  padding: 14px 12px 12px;
  color: var(--text-2);
}

.opt-device svg { width: 22px; height: 22px; margin-bottom: auto; }
.opt-device.is-on { color: var(--text); }
.opt-name { font-size: 15px; line-height: 20px; font-weight: 500; }
.opt-sub { font-size: 13px; line-height: 16px; color: var(--muted); }

.opts2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.opt-term { display: flex; flex-direction: column; gap: 2px; height: 96px; padding: 14px 16px 12px; }
.opt-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: auto; font-size: 14px; color: var(--text-2); }
.opt-price { font-size: 20px; line-height: 24px; font-weight: 600; }
.good { font-size: 12px; color: var(--positive); }

/* ---------- Receipt: a ticket with a perforation, like the bot's dashed lines ---------- */
.receipt { position: relative; padding: 16px; border-radius: var(--r-card); background: var(--card); }

.rc-product { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; }

.dash { position: relative; height: 0; margin: 16px 0; border-top: 1.5px dashed var(--raised-2); }

/* Notches cut into both edges at each perforation */
.dash::before, .dash::after {
  content: "";
  position: absolute;
  top: -8px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--bg);
}

.dash::before { left: -23px; }
.dash::after { right: -23px; }

.kv { display: flex; flex-direction: column; gap: 12px; }
.kv-row { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.kv-row > span:first-child { flex: none; color: var(--muted); }
.kv-row > :last-child { text-align: right; }
.kv-row.total { font-size: 17px; line-height: 22px; font-weight: 600; }
.kv-row.total > span:first-child { color: var(--text); }

.money { display: inline-flex; align-items: center; gap: 4px; }
.money svg { width: 16px; height: 16px; color: #f2b84b; }

.copy { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 14px; }
.copy svg { width: 16px; height: 16px; color: var(--muted); }

/* ---------- Payment state ---------- */
.state { display: flex; flex-direction: column; gap: 4px; padding: 8px 4px 20px; }
.state-label { font-size: 15px; color: var(--text-2); }
.state-time { font: 500 44px/48px var(--mono); letter-spacing: -0.01em; }
.state-title { font-size: 28px; line-height: 32px; font-weight: 600; }
.state-icon { width: 32px; height: 32px; margin-bottom: 8px; }
.state-icon svg { width: 32px; height: 32px; }
.state-icon.ok { color: var(--positive); }
.state-icon.bad { color: var(--negative); }

.link-btn { display: block; width: 100%; height: 48px; margin-top: 8px; color: var(--text-2); font-size: 15px; }

/* ---------- Status ---------- */
.status { display: inline-flex; align-items: center; gap: 6px; flex: none; white-space: nowrap; font-size: 12px; line-height: 16px; color: var(--text-2); }
.status i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.status.s-ok i { background: var(--positive); }
.status.s-bad i { background: var(--negative); }
.status.s-wait i { background: var(--warn); }

/* ---------- Profile ---------- */
.me { display: flex; align-items: center; gap: 12px; padding: 0 4px 16px; }

.avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 50%;
  background: var(--raised);
  color: var(--text-2);
  font-size: 18px;
  font-weight: 600;
  overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.wallet { display: flex; flex-direction: column; padding: 16px; margin-bottom: 12px; border-radius: var(--r-card); background: var(--card); }
.wallet-label { font-size: 13px; line-height: 16px; color: var(--muted); }
.wallet-sum { margin: 4px 0 16px; font-size: 36px; line-height: 40px; font-weight: 600; letter-spacing: -0.01em; }

.promo { display: grid; grid-template-columns: 1fr auto; gap: 8px; }

/* 16px stops iOS from zooming into the field */
.promo input {
  min-width: 0;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-ctl);
  background: var(--raised);
  color: var(--text);
  font: 400 16px/20px var(--font);
  text-transform: lowercase;
}

.promo input::placeholder { color: var(--muted); text-transform: none; }

/* Reserved line for the promo result, so nothing below it moves */
.promo-note { min-height: 16px; margin-top: 8px; font-size: 13px; line-height: 16px; color: var(--muted); }
.promo-note.ok { color: var(--positive); }
.promo-note.bad { color: var(--negative); }

/* ---------- Islands ---------- */
.island {
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  bottom: calc(var(--island-gap) + var(--safe-b));
  z-index: 20;
  transition: transform 300ms var(--ease), opacity 200ms var(--ease);
}

.island-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  height: var(--island-h);
  padding: 6px;
  border-radius: 24px;
  background: var(--card);
  box-shadow: inset 0 0 0 1px var(--line), 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* The active pill slides between tabs with transform only; 24 − 6 = 18 */
.nav-pill {
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 6px;
  width: calc((100% - 12px) / 3);
  border-radius: 18px;
  background: var(--raised-2);
  transition: transform 300ms var(--ease);
}

.nav-tab {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: 18px;
  color: var(--muted);
  transition: color 140ms var(--ease);
}

.nav-tab.is-on { color: var(--text); }
.nav-icon { position: relative; width: 22px; height: 22px; }
.nav-icon svg { position: absolute; inset: 0; width: 22px; height: 22px; transition: opacity 140ms var(--ease); }
.nav-icon .on { opacity: 0; }
.nav-tab.is-on .nav-icon .on { opacity: 1; }
.nav-tab.is-on .nav-icon .off { opacity: 0; }
.nav-label { font-size: 11px; line-height: 12px; font-weight: 500; }

/* The one action of a flow screen, in the same spot as the tabs.
   Off-white with dark text: the accent stays for selection only. */
.island-cta { height: 56px; bottom: calc(var(--island-gap) + var(--safe-b) + 4px); transform: translateY(calc(100% + 40px)); opacity: 0; pointer-events: none; }

.cta-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  padding: 0 20px;
  border-radius: var(--r-tile);
  background: var(--text);
  color: var(--bg);
  font-size: 16px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  transition: transform 140ms var(--ease);
}

.cta-btn:active { transform: scale(0.98); }
.cta-btn:disabled { background: var(--raised-2); color: var(--muted); }
.cta-value { display: inline-flex; align-items: center; gap: 4px; }
.cta-value .money svg { color: #a8770f; }

.app.is-flow .island-nav { transform: translateY(calc(100% + 40px)); opacity: 0; pointer-events: none; }
.app.is-flow .island-cta { transform: none; opacity: 1; pointer-events: auto; }

/* ---------- Bottom sheet ---------- */
.sheet-backdrop {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms var(--ease);
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 31;
  max-height: 88%;
  display: flex;
  flex-direction: column;
  padding: 8px var(--pad) calc(16px + var(--safe-b));
  border-radius: 24px 24px 0 0;
  background: var(--bg);
  box-shadow: inset 0 1px 0 var(--line);
  transform: translateY(102%);
  transition: transform 300ms var(--ease);
}

.app.is-sheet .sheet-backdrop { opacity: 1; pointer-events: auto; }
.app.is-sheet .sheet { transform: none; }

.sheet-grip { align-self: center; width: 36px; height: 4px; margin-bottom: 16px; border-radius: 2px; background: var(--raised-2); }
.sheet-title { margin: 0 4px 12px; font-size: 20px; line-height: 24px; font-weight: 600; }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.sheet-body::-webkit-scrollbar { display: none; }

/* ---------- Toast ---------- */
.toast {
  position: absolute;
  left: 50%;
  top: 12px;
  z-index: 40;
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  border-radius: var(--r-ctl);
  background: var(--text);
  color: var(--bg);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transform: translate(-50%, -64px);
  opacity: 0;
  pointer-events: none;
  transition: transform 240ms var(--ease), opacity 200ms var(--ease);
}

.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* =========================================================
   Polish pass: rhythm, alignment, no content under the island,
   and fluid sizes for phones from 320 to 430 wide
   ========================================================= */
:root {
  --pad: clamp(12px, 4.2vw, 20px);
  --safe-b: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
  --safe-t: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px));
}

.app { padding-top: var(--safe-t); }

/* Content fades out before it reaches the island, so nothing sits under it */
.app::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 15;
  height: calc(var(--island-h) + var(--island-gap) * 2 + var(--safe-b) + 32px);
  background: linear-gradient(to top, var(--bg) 62%, rgba(15, 15, 16, 0));
  pointer-events: none;
}

.scroll { padding-bottom: calc(var(--island-h) + var(--island-gap) * 2 + var(--safe-b) + 24px); }

/* One left edge: titles, labels and notes all start at the page padding */
.top { height: auto; min-height: 40px; padding: 16px 0 16px; }
.bar + .scroll .top { height: auto; padding-top: 4px; }
.title { font-size: clamp(24px, 7.2vw, 28px); line-height: 1.15; }
.label { margin: 24px 0 8px; }
.note { margin: 12px 0 0; }
.accept { margin: 16px 0 0; flex-wrap: wrap; row-gap: 8px; }
.me { padding: 0 0 16px; }
.chips { margin-bottom: 12px; }

/* Text never wraps into the next element */
.row-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-text { flex: 1; }
.row-end, .row-side { flex: none; white-space: nowrap; }
.feature-row { padding: 12px 8px 6px; }

/* Art scales with the screen */
.feature-art { height: clamp(128px, 44vw, 200px); }
.feature-art img { width: clamp(180px, 62vw, 272px); height: clamp(180px, 62vw, 272px); }
.art-sm { height: clamp(104px, 34vw, 156px); }
.art-sm img { width: clamp(150px, 50vw, 220px); height: clamp(150px, 50vw, 220px); }
.product { padding: 0 0 4px; }
.product .title { font-size: clamp(22px, 6.4vw, 26px); }

/* Options */
.opt-device { height: auto; min-height: 92px; padding: 12px; }
.opt-device svg { margin-bottom: 12px; }
.opt-term { height: auto; min-height: 92px; padding: 12px 14px; }
.opt-top { margin-bottom: 10px; }
.opt-price { font-size: clamp(18px, 5.2vw, 20px); }

/* Payment methods: name on the left, marks on the right; marks drop to a
   second line by themselves when the row is too narrow */
.row-method { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; min-height: 56px; padding: 12px 16px; }
.row-method .row-title { display: flex; align-items: baseline; gap: 8px; overflow: visible; }
.row-inline { margin-left: 0; }
.row-method .plate { width: 36px; height: 22px; }
.sheet { max-height: 92%; }

/* Payment state: centered, with the time left drawn as a line */
.state { align-items: center; gap: 8px; padding: 12px 0 24px; text-align: center; }
.state-time { font-size: clamp(44px, 14vw, 56px); line-height: 1; }
.state-icon { margin-bottom: 4px; }

.progress { width: 100%; max-width: 220px; height: 4px; margin-top: 8px; border-radius: 2px; background: var(--raised); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 2px; background: var(--text-2); transform-origin: left; transition: transform 1000ms linear; }

.link-btn { margin-top: 4px; }

/* Receipt figures line up on the right edge */
.kv-row > :last-child { min-width: 0; overflow-wrap: anywhere; }
.rc-product .mono { align-self: start; padding-top: 2px; }

/* Short phones (iPhone SE and similar): tighter, and no art on the mod page */
@media (max-height: 680px) {
  .art-sm { display: none; }
  .feature-art { height: 128px; }
  .feature-art img { width: 184px; height: 184px; }
  .label { margin-top: 20px; }
  .top { padding: 12px 0 12px; }
}

/* Narrow phones */
@media (max-width: 350px) {
  .row { padding-left: 10px; padding-right: 12px; gap: 10px; }
  .row + .row::before { left: 64px; }
  .group-kv .row { padding: 0 12px; }
  .group-kv .row + .row::before { left: 12px; }
  .row-method { padding: 12px; }
  .row-method + .row-method::before { left: 12px; }
  .opt-device { padding: 10px; }
  .opt-name { font-size: 14px; }
  .nav-label { font-size: 10px; }
  .accept .plate { width: 34px; }
}

/* =========================================================
   Fixed header, directional transitions, method picker, promo
   ========================================================= */

/* Header: same height and the same slots on every screen, never animated */
.bar { height: 60px; gap: 12px; justify-content: space-between; }
.bar-h { flex: 1; min-width: 0; font-size: clamp(18px, 5.3vw, 20px); line-height: 26px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-h-sm { font-size: 17px; line-height: 22px; letter-spacing: 0; }
.bar .balance { flex: none; }

/* Only the content moves: a short slide from the side we go to */
.view.enter-up { animation: enter 240ms var(--ease); }
.view.enter-right { animation: enter-right 260ms var(--ease); }
.view.enter-left { animation: enter-left 260ms var(--ease); }

@keyframes enter-right {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: none; }
}

@keyframes enter-left {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: none; }
}

.view { padding-top: 4px; }
.view > .label:first-child { margin-top: 8px; }
.chips { margin-top: 4px; }

/* Sub screens without an action button (promo): no island at all */
.app.is-sub .island-nav { transform: translateY(calc(100% + 40px)); opacity: 0; pointer-events: none; }
.app.is-sub::after { display: none; }

/* Payment method: radio rows */
.row-method { display: grid; grid-template-columns: 1fr 22px; flex-wrap: nowrap; }
.method-main { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; min-width: 0; }
.row-method .row-title { display: flex; align-items: baseline; gap: 8px; }

.dot { width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--raised-2); transition: box-shadow 140ms var(--ease); }
.is-on > .dot { box-shadow: inset 0 0 0 7px var(--accent); }
.row-method.is-on { background: var(--raised); }

/* Apple Pay mark */
.plate-applepay svg { height: 11px; max-width: 28px; }

/* Profile: balance and promo in one block */
.balance-block { display: flex; flex-direction: column; gap: 4px; padding: 16px 16px 14px; }
.wallet-sum { margin: 0; font-size: clamp(30px, 9vw, 36px); line-height: 40px; }
.balance-block + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; height: 1px; background: var(--line); }

/* Promo screen: the field sits at the top, so the keyboard never covers it */
.lead { margin: 4px 0 16px; color: var(--text-2); }
.promo { grid-template-columns: 1fr; gap: 12px; }
.promo input { height: 52px; padding: 0 16px; font-size: 17px; }
.promo input:focus { outline: none; box-shadow: inset 0 0 0 1.5px var(--accent); }
.promo .btn { height: 52px; font-size: 16px; }
.btn-primary { background: var(--text); color: var(--bg); font-weight: 600; }
.promo-note { min-height: 20px; margin-top: 12px; font-size: 14px; line-height: 20px; }

/* Toast sits above the island, so it never covers the header */
.toast { top: auto; bottom: calc(var(--island-h) + var(--island-gap) * 2 + var(--safe-b) + 4px); transform: translate(-50%, 12px); }
.toast.show { transform: translate(-50%, 0); }

/* =========================================================
   Pass 4: user chip, game switch, payment marks at one scale,
   profile wallet and promo screen
   ========================================================= */

/* Header: round Telegram avatar and nickname */
.user { flex: none; display: inline-flex; align-items: center; gap: 8px; max-width: 52%; height: 36px; padding: 0 12px 0 4px; border-radius: 18px; background: var(--card); }
.user .avatar { width: 28px; height: 28px; font-size: 13px; }
.user-name { min-width: 0; font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Game switch: equal segments, the thumb slides with transform only (12 − 4 = 8) */
.seg { position: relative; display: grid; grid-template-columns: repeat(var(--n), 1fr); height: 40px; padding: 4px; margin: 4px 0 0; border-radius: 12px; background: var(--card); }
.seg-thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / var(--n)); border-radius: 8px; background: var(--raised-2); transition: transform 280ms var(--ease); }
.seg-btn { position: relative; z-index: 1; min-width: 0; padding: 0 4px; font-size: clamp(12px, 3.6vw, 14px); font-weight: 500; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 160ms var(--ease); }
.seg-btn.is-on { color: var(--text); }

/* Only the list under the switch cross-fades; its height is reserved so nothing below jumps */
#gameBody { min-height: 328px; }
.swap { animation: fade 220ms var(--ease); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
#gameBody .empty { min-height: 272px; justify-content: center; }
.row { min-height: 68px; }
.group-kv .row { min-height: 52px; }

/* Payment marks: one plate size, each logo tuned to the same visual weight */
.plate { width: 40px; height: 26px; border-radius: 7px; }
.row-method .plate { width: 40px; height: 26px; }
.plate svg { max-width: none; max-height: none; }
.plate-visa svg { width: 26px; height: 9.5px; }
.plate-mir svg { width: 26px; height: 9.3px; }
.plate-applepay svg { width: 28px; height: 11.9px; }
.plate-googlepay svg { width: 28px; height: 11.2px; }
.plate-mastercard svg { width: 19px; height: 12px; }
.plate-sbp svg { width: 12px; height: 14.7px; }
.plate-usdt svg { width: 15px; height: 15px; }
.plate-ton svg { width: 17px; height: 17px; }
.plate-star svg { width: 15px; height: 15px; }
.plate-wallet svg { width: 16px; height: 16px; }

.accept { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; margin: 0; }
.accept .plate { width: 100%; }

/* Profile wallet */
.wallet { align-items: center; gap: 2px; padding: 24px 16px 16px; margin: 4px 0 0; text-align: center; }
.wallet-sum { margin: 2px 0; font-size: clamp(36px, 11vw, 44px); line-height: 1.1; }
.wallet-hint { font-size: 13px; line-height: 16px; color: var(--muted); }
.btn-wide { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px; }
.wallet .btn-wide { margin-top: 20px; }
.btn-wide svg { width: 20px; height: 20px; color: var(--text-2); }

/* Promo: one centered column, the field at the top of the screen */
.promo-wrap { display: flex; flex-direction: column; align-items: center; padding-top: 24px; text-align: center; }
.promo-icon { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 16px; border-radius: var(--r-card); background: var(--card); color: var(--text-2); }
.promo-icon svg { width: 30px; height: 30px; }
.promo-icon.is-ok { color: var(--positive); }
.promo-title { font-size: 22px; line-height: 28px; font-weight: 600; }
.promo-text { margin-top: 4px; color: var(--text-2); }
.promo-wrap .promo { width: 100%; margin-top: 24px; gap: 0; }
.promo-wrap .promo input { height: 56px; border-radius: 14px; background: var(--card); font-size: 20px; font-weight: 500; text-align: center; letter-spacing: 0.04em; }
.promo-wrap .promo input::placeholder { font-weight: 400; letter-spacing: 0; }
.promo-wrap .promo input.is-bad { box-shadow: inset 0 0 0 1.5px var(--negative); animation: shake 300ms var(--ease); }
.promo-wrap .promo-note { min-height: 20px; margin: 8px 0 12px; color: var(--negative); text-align: center; }
.promo-wrap .btn-primary { width: 100%; height: 52px; border-radius: 14px; }
.promo-wrap .btn-primary:disabled { background: var(--raised); color: var(--muted); }
.promo-wrap > .btn-wide { margin-top: 28px; height: 52px; }

@keyframes shake {
  25% { transform: translateX(-5px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-2px); }
}

.toast { bottom: calc(var(--island-h) + var(--island-gap) * 2 + var(--safe-b) + 12px); }

@media (max-width: 350px) {
  .accept { grid-template-columns: repeat(4, 1fr); }
  .user { max-width: 46%; }
}

/* =========================================================
   Pass 5: one top edge on every screen, centered flow titles,
   game list, two-line payment rows, cancel sheet
   ========================================================= */

/* Every screen starts its first block at the same distance under the header */
.view { padding-top: 8px; }
.view > :first-child { margin-top: 0 !important; }
.state { padding-top: 0; }
.promo-wrap { padding-top: 0; }

/* Flow header: back | title in the middle of the screen | same-width spacer */
.bar.is-flow { display: grid; grid-template-columns: 40px 1fr 40px; justify-content: stretch; }
.bar.is-flow .bar-h { text-align: center; }

/* Game tiles: a short mark on a raised square */
.tile-game { font-size: 15px; letter-spacing: 0.02em; color: var(--text); }
.tile-game svg { width: 24px; height: 24px; color: var(--text-2); }

/* A logo sits inside its tile with room around it, on the logo's own black */
.tile-logo { background: #040406; }
.tile-logo img { width: 74%; height: 74%; object-fit: contain; }

/* Payment rows: name on the left, marks on the right, one line */
.method-main { flex-wrap: nowrap; }
.row-method { min-height: 64px; padding: 12px 16px; }
.row-method .row-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row-method .plates { flex: none; }
.plate-more { font-size: 11px; line-height: 1; font-weight: 600; color: var(--text-2); }

/* USDT amount */
.money-usdt svg { width: 16px; height: 16px; }

/* CTA label with an icon (the pay button leads out to the payment page) */
.cta-label { display: inline-flex; align-items: center; gap: 6px; }
.cta-label svg { width: 18px; height: 18px; }

/* The shell itself can never be scrolled (focus or the keyboard used to shift it
   and hide the header); only .scroll scrolls */
.app { overflow: clip; }

/* Cancel sheet: fully hidden until opened */
.sheet { visibility: hidden; transition: transform 300ms var(--ease), visibility 0s 300ms; }
.app.is-sheet .sheet { visibility: visible; transition: transform 300ms var(--ease), visibility 0s; }
.sheet-title { margin: 0 0 8px; text-align: center; }
.sheet-text { margin: 0 8px 20px; color: var(--text-2); text-align: center; }
.sheet-actions { display: grid; gap: 8px; }
.sheet-actions .btn { width: 100%; height: 52px; border-radius: 14px; font-size: 16px; }
.btn-danger { background: rgba(229, 72, 77, 0.14); color: var(--negative); font-weight: 600; }

@media (max-width: 374px) {
  .row-method { padding: 12px; column-gap: 8px; }
  .row-method .method-main { column-gap: 6px; }
  .row-method .row-title { font-size: 13px; }
  .row-method .plates { gap: 4px; }
  .row-method .plate { width: 34px; height: 24px; }
}

/* =========================================================
   Pass 6: game icons, promo spacing, access lock
   ========================================================= */

/* Game tiles: the game's own app icon fills the tile */
.tile-game { background: var(--raised); }
.empty-game { width: 64px; height: 64px; margin-bottom: 12px; border-radius: var(--r-tile); }

/* Promo: the button sits right under the field; an error line opens between them */
.promo-wrap .promo-note { min-height: 0; margin: 0 0 12px; }
.promo-wrap .promo-note:not(:empty) { margin: 8px 0 12px; }
.promo-wrap .promo input::placeholder { font-size: 18px; color: var(--text-2); }

/* Until access is checked, and on the lock screen, there is no chrome */
.app.is-loading .island, .app.is-locked .island { display: none; }
.app.is-locked::after, .app.is-loading::after { display: none; }
.app.is-locked .bar { visibility: hidden; }

.lock { display: flex; flex-direction: column; align-items: center; padding: 15vh 8px 0; text-align: center; }
.lock-icon { display: grid; place-items: center; width: 72px; height: 72px; margin-bottom: 20px; border-radius: 50%; background: #2aabee; color: #fff; }
.lock-icon svg { width: 36px; height: 36px; margin-left: -3px; }
.lock-title { font-size: 22px; line-height: 28px; font-weight: 600; }
.lock-text { max-width: 280px; margin: 8px 0 28px; color: var(--text-2); }
.lock .btn-wide { height: 52px; border-radius: 14px; font-size: 16px; }

/* =========================================================
   Pass 7: the header floats over the content and blurs it
   ========================================================= */
.bar {
  position: absolute;
  top: var(--safe-t);
  left: 0;
  right: 0;
  z-index: 18;
  background: rgba(15, 15, 16, 0);
  box-shadow: 0 1px 0 rgba(237, 237, 237, 0);
  transition: background-color 200ms var(--ease), box-shadow 200ms var(--ease), -webkit-backdrop-filter 200ms var(--ease), backdrop-filter 200ms var(--ease);
}

.bar.is-scrolled {
  background: rgba(15, 15, 16, 0.72);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  box-shadow: 0 1px 0 var(--line);
}

/* Content starts under the header and can scroll beneath it */
.scroll { padding-top: 60px; }
.app.is-loading .scroll, .app.is-locked .scroll { padding-top: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
.group-alert .ico { color: var(--warn); }
.state-text { max-width: 300px; margin: 4px auto 0; font-size: 15px; line-height: 22px; color: var(--text-2); }
.island-cta.is-center .cta-btn { justify-content: center; }
.cta-label .money svg { color: #a8770f; }

/* ---------- History: search and filter ---------- */
.hist-tools { display: grid; grid-template-columns: 1fr 44px 44px; gap: 8px; margin-bottom: 12px; }
.search { position: relative; display: block; -webkit-tap-highlight-color: transparent; }
.search input {
  width: 100%; height: 44px; padding: 0 12px 0 40px;
  border: 0; border-radius: var(--r-ctl);
  background: var(--card); color: var(--text);
  font: 400 16px/20px var(--font);
  outline: none; box-shadow: none; -webkit-appearance: none; appearance: none;
  caret-color: var(--accent); -webkit-tap-highlight-color: transparent;
}
.search input:focus, .search input:focus-visible { outline: none; box-shadow: none; background: var(--card); }
.search input:-webkit-autofill { -webkit-box-shadow: 0 0 0 100px var(--card) inset; -webkit-text-fill-color: var(--text); }
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-ico { position: absolute; top: 0; bottom: 0; left: 12px; display: grid; place-items: center; color: var(--muted); pointer-events: none; }
.search-ico svg { width: 18px; height: 18px; }
.sortbtn { display: grid; place-items: center; height: 44px; border-radius: var(--r-ctl); background: var(--card); color: var(--text-2); outline: none; -webkit-tap-highlight-color: transparent; }
.sortbtn svg { width: 20px; height: 20px; }
.sortbtn.is-set { color: var(--accent); }
.sortbtn[aria-expanded="true"] { background: var(--raised); color: var(--text); }
.sortbtn.is-set[aria-expanded="true"] { color: var(--accent); }

/* Sort and filter sheets (slide up from the bottom, like the payment sheet) */
.filter-label { margin: 0 4px 8px; font-size: 13px; line-height: 16px; color: var(--muted); }
.filter-label:not(:first-child) { margin-top: 20px; }
.chipwrap { display: flex; flex-wrap: wrap; gap: 8px; }
.sheet .chip { height: 36px; padding: 0 14px; }
.sheet .chip.is-on { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--accent); }
.filter-actions { display: flex; gap: 8px; margin-top: 24px; }
.filter-actions .btn-primary { flex: 1; width: auto; }
.filter-actions .btn-icon { flex: none; display: grid; place-items: center; width: 52px; padding: 0; background: var(--card); color: var(--text-2); }
.filter-actions .btn-icon svg { width: 22px; height: 22px; }
.row-sort { display: grid; grid-template-columns: 1fr 22px; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 0 16px; }
.row-sort.is-on { background: var(--raised); }
.row-sort + .row-sort::before { left: 16px; }

/* Payment method names, a little smaller */
.row-method .row-title { font-size: 14px; }
@media (max-width: 374px) { .row-method .row-title { font-size: 13px; } }

/* Profile link rows (promo, channel, support): shorter than the catalog rows */
.group-links .row { min-height: 52px; padding-top: 4px; padding-bottom: 4px; }
.group-links .ico { height: 36px; }

/* Payment method: tighter rows, provider icons */
.row-method { min-height: 54px; padding: 9px 16px; }
.row-method .plate-i2328, .row-method .plate-icryptobot, .row-method .plate-ixrocket { width: 28px; height: 28px; padding: 0; background: none; box-shadow: none; border-radius: 8px; overflow: hidden; }
.plate-i2328 img, .plate-icryptobot img, .plate-ixrocket img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 8px; }
@media (max-width: 374px) { .row-method { padding: 9px 12px; } }

/* Promo screen: calmer sizes */
.promo-wrap { padding-top: 32px; }
.promo-icon { width: 52px; height: 52px; margin-bottom: 14px; }
.promo-icon svg { width: 24px; height: 24px; }
.promo-title { font-size: 17px; line-height: 22px; font-weight: 600; }
.promo-wrap .promo { margin-top: 20px; }
.promo-wrap .promo input { height: 48px; font-size: 16px; font-weight: 500; letter-spacing: 0.02em; }
.promo-wrap .promo input::placeholder { font-size: 15px; }
.promo-wrap .promo-note { font-size: 13px; line-height: 18px; }
.promo-wrap .btn-primary { height: 46px; font-size: 15px; }

/* Grey notes under a list or receipt: centred */
.note { margin: 16px 0 0; text-align: center; color: var(--muted); }

/* 4 to 6 types: compact tiles, no icon, so the screen does not grow much */
.opts3.n4 { grid-template-columns: repeat(2, 1fr); }
.opts3.n5, .opts3.n6 { grid-template-columns: repeat(3, 1fr); }
.opts3.n4 .opt-device, .opts3.n5 .opt-device, .opts3.n6 .opt-device { min-height: 0; height: auto; padding: 10px 12px; }
.opts3.n4 .opt-device svg, .opts3.n5 .opt-device svg, .opts3.n6 .opt-device svg { display: none; }
.opts3.n5 .opt-name, .opts3.n6 .opt-name { font-size: 14px; }
.opts3.n5 .opt-sub, .opts3.n6 .opt-sub { font-size: 12px; }
