/* styles.css — the Russian Mini App's visual contract.
 *
 * EVERY VALUE THAT CARRIES DESIGN INTENT IS A TOKEN. There are no literal colours, font sizes,
 * radii or weights below: they come from design/tokens.css, which is generated from
 * design/tokens.json, every entry of which is asserted by tests/ru-design-tokens.test.js to exist
 * in the owner's v3 prototype. That chain is the whole point — a colour cannot enter this
 * stylesheet without appearing in the reference first.
 *
 * Literal numbers DO appear where they are pure mechanics rather than design: 0, 1px hairlines,
 * 100%, flex ratios, and the two-column grid of the bottom bar. Those are not values the
 * screenshot comparison is about.
 *
 * ── LAYOUT MODEL ────────────────────────────────────────────────────────────────────────────
 *
 * A fixed header, a scrolling middle, and a fixed bottom navigation — the reference's shape, and
 * the reason it is `position: fixed` rather than a flex column is Telegram's WebView: the visual
 * viewport moves under the layout viewport when the keyboard opens, and a flex column drags the
 * nav up with it. `--viewport-height` is set from Telegram's own reported stable height (see
 * telegram.js) and falls back to 100dvh outside Telegram.
 */

@import "./design/tokens.css";

/* ── reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--color-page);
}

body {
  font-family: var(--font-family);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

::-webkit-scrollbar { width: 0; height: 0; }

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
button:disabled { cursor: default; }
input { font: inherit; }
code { font-family: var(--font-mono); }

/* ── keyframes: the reference's own set, with its own timings ─────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes skel { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes credAppear { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes gradFlow { 0% { background-position: 0% 0; } 100% { background-position: 200% 0; } }
@keyframes logoPulse {
  0%, 100% { filter: drop-shadow(0 0 4px var(--color-logo-glow-low)); }
  50% { filter: drop-shadow(0 0 10px var(--color-logo-glow-high)); }
}

/* Respect a user who has asked for less motion. The reference does not say this; a shipped app
 * has to, and stillness cannot break a layout. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}

/* ── the shell ───────────────────────────────────────────────────────────── */
.app {
  position: relative;
  width: 100%;
  max-width: var(--size-frame-width);
  margin: 0 auto;
  min-height: var(--viewport-height, 100dvh);
  background: var(--color-app);
  background-image: var(--gradient-backdrop);
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  flex-shrink: 0;
  height: var(--size-header-height);
  padding: 0 var(--space-8);
  padding-top: env(safe-area-inset-top);
  height: calc(var(--size-header-height) + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-header);
  backdrop-filter: blur(12px);
}

.topbar__left { display: flex; align-items: center; gap: var(--space-4); min-width: 0; }

.topbar__back { display: flex; align-items: center; padding: var(--space-2) var(--space-3) var(--space-2) 0; color: var(--color-text-muted); }

.topbar__logo { width: var(--size-logo); height: var(--size-logo); animation: var(--motion-logo-pulse); }

.topbar__brand {
  font-size: var(--font-size-brand);
  font-weight: var(--font-weight-heavy);
  letter-spacing: var(--font-letter-spacing-brand);
  color: var(--color-text);
}

.topbar__title {
  font-size: var(--font-size-bar-title);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.topbar__avatar {
  flex-shrink: 0;
  width: var(--size-avatar);
  height: var(--size-avatar);
  padding: 1.5px;
  border-radius: var(--radius-circle);
  background: var(--gradient-avatar);
}

.topbar__initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-circle);
  background: var(--color-app);
  color: var(--color-violet-pale);
  font-size: var(--font-size-xxs);
  font-weight: var(--font-weight-heavy);
}

.screen { flex: 1; overflow-y: auto; position: relative; -webkit-overflow-scrolling: touch; }

.screen__pad { padding: var(--space-9) var(--space-9); }
.screen__pad--nav { padding-bottom: var(--size-content-bottom-pad); }
.screen__pad--bar { padding-bottom: calc(var(--size-content-bottom-pad) + var(--space-9)); }

.fade-in { animation: var(--motion-fade-in); }

/* ── bottom navigation: five items, raised centre ─────────────────────────── */
.tabbar {
  position: sticky;
  bottom: 0;
  z-index: 30;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: end;
  min-height: var(--size-nav-height);
  padding-bottom: var(--safe-area-bottom);
  background: var(--color-nav-bg);
  backdrop-filter: blur(12px);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3) 0 var(--space-2);
  color: var(--color-text-disabled);
}

.tab.is-active { color: var(--color-accent); }

.tab__label { font-size: var(--font-size-tiny); font-weight: var(--font-weight-bold); }

/* The raised buy button. Lifted with a negative margin so the bar keeps its own height and the
 * four flanking labels stay on one baseline — the reference's proportions exactly. */
.tab--center { position: relative; }

.tab__fab {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-top: -18px;
  border-radius: var(--radius-circle);
  background: var(--gradient-primary);
  box-shadow: var(--shadow-fab);
}

/* ── typography helpers ──────────────────────────────────────────────────── */
.label {
  margin-bottom: var(--space-4);
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--font-letter-spacing-label);
  text-transform: uppercase;
  color: var(--color-text-label);
}

.intro {
  margin-bottom: var(--space-7);
  font-size: var(--font-size-xs);
  line-height: var(--font-line-height-relaxed);
  color: var(--color-text-faint);
}

.note {
  margin-top: var(--space-5);
  padding: var(--space-6) var(--space-7);
  border-radius: var(--radius-card);
  background: var(--color-surface1);
  font-size: var(--font-size-xs);
  line-height: var(--font-line-height-snug);
  color: var(--color-text-dim);
}

.note--muted { color: var(--color-text-weak); }

.section { margin-top: var(--space-13); }
.section > .label { margin-bottom: var(--space-5); }

.meta {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-9);
  font-size: var(--font-size-micro);
  color: var(--color-text-ghost);
}

.version {
  margin-top: var(--space-10);
  text-align: center;
  font-size: var(--font-size-micro);
  color: var(--color-text-ghost);
}

/* ── the balance figure ──────────────────────────────────────────────────── */
.balance { display: flex; align-items: baseline; gap: var(--space-3); }

.balance__value {
  font-size: var(--font-size-balance);
  font-weight: var(--font-weight-heavy);
  line-height: 1;
  letter-spacing: var(--font-letter-spacing-balance);
  color: var(--color-accent);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 24px var(--color-accent-glow);
}

.balance__unit {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-faint);
}

.balance__sub {
  margin-top: var(--space-4);
  font-size: var(--font-size-sm);
  color: var(--color-text-faint);
}

/* ── buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  margin-top: var(--space-9);
  padding: var(--space-7);
  border-radius: var(--radius-button);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-heavy);
  text-align: center;
}

.btn--primary { background: var(--color-accent); color: var(--color-accent-ink); }

.btn--gradient {
  background: var(--gradient-primary);
  color: var(--color-on-accent);
  box-shadow: var(--shadow-primary-button);
}

.btn--accent { background: var(--color-accent-wash); color: var(--color-accent); font-weight: var(--font-weight-bold); }

.btn--ghost {
  background: var(--color-surface3);
  color: var(--color-text-dim);
  font-size: var(--font-size-body-sm);
  font-weight: var(--font-weight-bold);
}

.btn:disabled { opacity: .55; }

.btn.is-soon { justify-content: space-between; padding-left: var(--space-8); padding-right: var(--space-7); }

.badge {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-tiny);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--font-letter-spacing-wide);
  text-transform: uppercase;
}

.badge--soon { background: var(--color-violet-wash); color: var(--color-violet-soft); }

/* ── cards and rows ──────────────────────────────────────────────────────── */
.card {
  border-radius: var(--radius-large);
  background: var(--color-surface1);
  overflow: hidden;
}

.card--rows > * + * { border-top: 1px solid var(--color-hairline); }

.card__foot { padding: 0 var(--space-7) var(--space-7); }

/* Canonical row: padding 15px 16px, gap 12px. 15px is not on the space scale because the
   reference uses it exactly once, for this row; it is stated here rather than invented as a
   token nothing else would reference. */
.row {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: 15px var(--space-8);
  color: var(--color-text);
}

/* Tools rows. The reference gives them a LARGER glyph than the home row — 40px at radius 13px,
   tinted per tool — and a 14.5px/700 title. They are live controls, so there is no dimming and
   no badge: both tools exist and open on the site (see src/app.js). */
.row--tool { gap: var(--space-7); padding: var(--space-8); }
.row--tool .row__glyph {
  width: var(--size-glyph-large);
  height: var(--size-glyph-large);
  border-radius: var(--radius-card-alt);
}
.row--tool .row__glyph--checker { background: var(--color-accent-glyph); }
.row--tool .row__glyph--parser { background: var(--color-violet-wash); }
.row--tool .row__title { font-size: var(--font-size-body-lg); font-weight: var(--font-weight-bold); }

.row__glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: var(--size-glyph-small);
  height: var(--size-glyph-small);
  border-radius: var(--radius-input);
  background: var(--color-surface3);
  overflow: hidden;
}

.row__glyph--plain { background: none; width: auto; height: auto; }

.row__text { flex: 1; min-width: 0; }

.row__title {
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-strong);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row__sub { margin-top: var(--space-hair); font-size: var(--font-size-xxs); color: var(--color-text-weak); }

.row__label { flex: 1; font-size: var(--font-size-body-sm); font-weight: var(--font-weight-regular); }

.row__value { font-size: var(--font-size-xs); color: var(--color-text-weak); }

.dot { flex-shrink: 0; width: 7px; height: 7px; border-radius: var(--radius-circle); }
.dot--ok { background: var(--color-ok); }
.dot--warn { background: var(--color-warn); }
.dot--danger { background: var(--color-danger); }
.dot--violet { background: var(--color-violet-soft); }

.chip {
  flex-shrink: 0;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-micro);
  font-weight: var(--font-weight-bold);
}

.chip--ok { background: var(--color-ok-wash); color: var(--color-ok); }
.chip--warn { background: var(--color-warn-bg); color: var(--color-warn-text); }
.chip--danger { background: var(--color-danger-wash); color: var(--color-danger); }
.chip--violet { background: var(--color-violet-wash); color: var(--color-violet-pale); }

/* ── the warning strip ───────────────────────────────────────────────────── */
.strip {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-top: var(--space-5);
  padding: var(--space-6) var(--space-8);
  border-radius: var(--radius-button);
}

.strip--warn { background: var(--color-warn-bg); }

.strip__text { flex: 1; font-size: var(--font-size-xs); line-height: var(--font-line-height-tight); color: var(--color-warn-text); }

/* ── ProxyData Connect ───────────────────────────────────────────────────── */
/* Two panels, both from the canonical reference and both restored after they were dropped from
   the first build. The home one is the full call to action; the access one is the short hint in
   the middle of that screen's scroll. They differ in gradient, radius, padding and type scale —
   the reference draws them differently, so they are two rules, not one with a modifier. */
.connect {
  margin-top: var(--space-7);
  padding: var(--space-8);
  border-radius: var(--radius-large);
  background: var(--gradient-connect);
}

.connect__title {
  margin-bottom: var(--space-2);
  font-size: var(--font-size-body-sm);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
}

.connect__body {
  margin-bottom: var(--space-5);
  font-size: var(--font-size-xs);
  line-height: var(--font-line-height-relaxed);
  color: var(--color-text-dim);
}

.connect__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-5);
  border-radius: var(--radius-card);
  background: var(--color-accent);
  color: var(--color-accent-ink);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
}

.connect--hint {
  margin-top: var(--space-4);
  padding: var(--space-7) var(--space-8);
  border-radius: var(--radius-button);
  background: var(--gradient-connect-hint);
}

.connect--hint .connect__title {
  margin-bottom: var(--space-1);
  font-size: var(--font-size-sm);
}

.connect--hint .connect__body {
  margin-bottom: 0;
  font-size: var(--font-size-xxs);
  line-height: var(--font-line-height-normal);
}

/* ── progress ────────────────────────────────────────────────────────────── */
.track {
  width: 100%;
  height: var(--size-progress-track);
  border-radius: var(--radius-xs);
  background: var(--color-surface4);
  overflow: hidden;
}

.track__fill { height: 100%; border-radius: var(--radius-xs); }
.track__fill--accent { background: var(--color-accent); }
.track__fill--warn { background: var(--color-warn); }
.track__fill--danger { background: var(--color-danger); }
.track__fill--violet { background: var(--gradient-bar); }
.track__fill--ok { background: var(--color-accent); }

/* ── the access hero and panel ───────────────────────────────────────────── */
.hero { display: flex; align-items: center; gap: var(--space-5); }

.hero__glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-card-alt);
  background: var(--color-accent-wash-soft);
}

.hero__text { flex: 1; min-width: 0; }
.hero__title { font-size: var(--font-size-subheading); font-weight: var(--font-weight-bold); }
.hero__sub { margin-top: var(--space-1); font-size: var(--font-size-xs); color: var(--color-text-weak); }

.panel {
  margin-top: var(--space-9);
  padding: var(--space-9);
  border-radius: var(--radius-large);
  background: var(--color-surface1);
}

.panel__figure { display: flex; align-items: baseline; gap: var(--space-3); margin-bottom: var(--space-6); }

.panel__value {
  font-size: var(--font-size-xxl);
  font-weight: var(--font-weight-heavy);
  letter-spacing: var(--font-letter-spacing-tighter);
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}

.panel__note { font-size: var(--font-size-sm); color: var(--color-text-faint); }

.panel__meta {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-4);
  font-size: var(--font-size-micro);
  color: var(--color-text-weak);
}

.rowhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: var(--space-10) 0 var(--space-4);
}

.rowhead__title { font-size: var(--font-size-body-sm); font-weight: var(--font-weight-bold); }

.segmented { display: flex; padding: var(--space-1); border-radius: var(--radius-md); background: var(--color-surface1); }

.segmented__btn {
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-micro);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-weak);
}

.segmented__btn.is-on { background: var(--color-accent-wash); color: var(--color-accent); }

/* ── copy rows ───────────────────────────────────────────────────────────── */
.crow { display: flex; align-items: center; gap: var(--space-5); padding: var(--space-6) var(--space-8); }

.crow__label { flex-shrink: 0; width: 68px; font-size: var(--font-size-micro); color: var(--color-text-weak); }

.crow__value {
  flex: 1;
  min-width: 0;
  font-size: var(--font-size-xs);
  color: var(--color-text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crow__pick { flex: 1; text-align: right; font-size: var(--font-size-xs); color: var(--color-text-dim); }

.crow__eye { display: flex; color: var(--color-text-weak); }

.crow--nav { cursor: pointer; }

.connstr {
  margin-top: var(--space-5);
  padding: var(--space-7) var(--space-8);
  border-radius: var(--radius-card);
  background: var(--color-accent-wash-soft);
}

.connstr__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-3); }

.connstr__label {
  font-size: var(--font-size-tiny);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--font-letter-spacing-label);
  color: var(--color-text-label);
}

.connstr__action { font-size: var(--font-size-micro); font-weight: var(--font-weight-bold); color: var(--color-accent); }

.connstr__value { display: block; font-size: var(--font-size-micro); line-height: var(--font-line-height-normal); color: var(--color-text-body); word-break: break-all; }

/* ── pool settings ───────────────────────────────────────────────────────── */
/* The reference's «Настройки пула» card: one rounded 18px surface, rows divided by a hairline,
   14px/16px padding, a 13.5px label in --color-text-muted and an 11.5px explanation beneath it.
   Every metric below is read from the reference; none is chosen. */
.set { display: flex; align-items: center; gap: var(--space-5); padding: var(--space-7) var(--space-8); }
.set--stack { display: block; }
.set__label { flex: 1; font-size: var(--font-size-body-sm); color: var(--color-text-muted); }
.set__note {
  margin-top: var(--space-hair);
  font-size: var(--font-size-micro);
  line-height: var(--font-line-height-tight);
  color: var(--color-text-weak);
}
.set--stack .set__label { margin-bottom: var(--space-hair); }
.set--stack .set__note { margin-bottom: var(--space-5); }
.set__value {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--font-size-sm);
  color: var(--color-text-dim);
}
.set__flag { width: 18px; height: 13px; border-radius: var(--radius-hair); background-size: cover; background-position: center; }

/* The mode switch. The reference draws two buttons in a 10px pill with 3px padding; the product
   has THREE modes, so the same pill carries three. Nothing else changes — same radius, same
   type, same active wash — because a third option is not a reason to redraw a control. */
.seg {
  display: flex;
  flex-shrink: 0;
  gap: var(--space-hair);
  padding: var(--radius-xs);
  border-radius: var(--radius-input);
  background: var(--color-surface3);
}
.seg__btn {
  padding: 7px var(--space-5);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-micro);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-weak);
  white-space: nowrap;
}
.seg__btn.is-on { background: var(--color-accent-wash); color: var(--color-accent); }
.seg__btn.is-on--violet { background: var(--color-violet-wash); color: var(--color-violet-pale); }
.seg__btn:disabled { opacity: .5; }

/* The N stepper, shown only in "every N requests" mode. */
.stepper { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-5); }
.stepper__btn {
  width: var(--size-glyph-small);
  height: var(--size-glyph-small);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-input);
  background: var(--color-surface3);
  color: var(--color-accent);
  font-size: var(--font-size-subheading);
  font-weight: var(--font-weight-bold);
}
.stepper__btn:disabled { opacity: .4; color: var(--color-text-weak); }
.stepper__value {
  min-width: 62px;
  text-align: center;
  font-size: var(--font-size-body-lg);
  font-weight: var(--font-weight-heavy);
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}
.stepper__unit { font-size: var(--font-size-micro); color: var(--color-text-weak); }

/* Fraud presets: the reference's three equal buttons, violet-tinted. */
.presets { display: flex; gap: var(--space-2); }
.preset {
  flex: 1;
  padding: 9px var(--space-1);
  border-radius: var(--radius-input);
  border: 1px solid var(--color-violet-wash-soft);
  background: var(--color-violet-wash-soft);
  color: var(--color-violet-soft);
  font-size: var(--font-size-micro);
  font-weight: var(--font-weight-regular);
}
.preset.is-on { border-color: var(--color-violet-border); background: var(--color-violet-wash); color: var(--color-violet-pale); }
.preset:disabled { opacity: .5; }

/* The full-range control the reference does not have. The presets are a shortcut; the product
   accepts 0..100, so the exact value must be reachable or the Mini App would be a subset of the
   cabinet. Styled from the same tokens rather than a browser default slider. */
.range { display: flex; align-items: center; gap: var(--space-5); margin-top: var(--space-5); }
.range__input { flex: 1; min-width: 0; accent-color: var(--color-violet-soft); background: transparent; }
.range__value {
  min-width: 46px;
  text-align: right;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  color: var(--color-violet-pale);
  font-variant-numeric: tabular-nums;
}
.range__off {
  font-size: var(--font-size-micro);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-weak);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface3);
}

/* Target input + button, verbatim metrics from the reference. */
.target { display: flex; gap: var(--space-3); }
.target__input {
  flex: 1;
  min-width: 0;
  padding: 11px var(--space-6);
  border: 0;
  border-radius: var(--radius-chip);
  background: var(--color-input-bg);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  outline: none;
}
.target__input::placeholder { color: var(--color-text-weak); }
.target__btn {
  flex-shrink: 0;
  padding: 11px var(--space-8);
  border-radius: var(--radius-chip);
  background: var(--color-violet);
  color: var(--color-text);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
}
.target__btn:disabled { background: var(--color-surface3); color: var(--color-text-weak); }

.scanning { display: flex; align-items: center; gap: 9px; margin-top: 11px; }
.scanning__spinner {
  flex-shrink: 0;
  width: 13px;
  height: 13px;
  border: 2px solid var(--color-violet-spinner);
  border-top-color: var(--color-violet-soft);
  border-radius: var(--radius-circle);
  animation: var(--motion-spinner);
}
.scanning__text { font-size: var(--font-size-xxs); color: var(--color-text-dim); }

.target__result {
  margin-top: 11px;
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-input);
  background: var(--color-violet-wash-soft);
  font-size: var(--font-size-xxs);
  color: var(--color-violet-soft);
}
.target__result b { font-family: var(--font-mono); }
.target__result--error { background: var(--color-danger-wash); color: var(--color-danger); }

/* Active-filter chips + reset, exactly as the reference lays them out. */
.chips { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-7); }
.chip--filter {
  padding: 5px 11px;
  border-radius: var(--radius-input);
  font-size: var(--font-size-micro);
  font-weight: var(--font-weight-regular);
  background: var(--color-violet-wash);
  color: var(--color-violet-pale);
}
.chips__reset {
  margin-left: auto;
  padding: 5px 0;
  font-size: var(--font-size-micro);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-weak);
}
.chips__reset:disabled { opacity: .5; }

/* A row that is mid-save. The control stays visible and readable — it is not replaced by a
   spinner — because a screen that swaps its content while saving loses the value it was showing. */
.is-saving { opacity: .55; pointer-events: none; }

/* ── weekly chart ────────────────────────────────────────────────────────── */
.chart { padding: var(--space-9); border-radius: var(--radius-large); background: var(--color-surface1); }

.chart__bars { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-2); }

.chart__col { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); flex: 1; }

.chart__bar { width: 100%; border-radius: var(--radius-xs); background: var(--color-accent-bar); }

.chart__label { font-size: var(--font-size-nano); color: var(--color-text-ghost); }

.chart--empty { text-align: center; }

/* The forecast line under the chart, in the reference's own footnote type. */
.forecast {
  margin-top: var(--space-5);
  font-size: var(--font-size-micro);
  line-height: var(--font-line-height-snug);
  color: var(--color-text-weak);
}

.chart__note { font-size: var(--font-size-xs); line-height: var(--font-line-height-relaxed); color: var(--color-text-weak); }

/* ── history ─────────────────────────────────────────────────────────────── */
.hrow { display: flex; align-items: center; gap: var(--space-5); padding: var(--space-7) var(--space-8); }
.hrow__text { flex: 1; min-width: 0; }
.hrow__title { font-size: var(--font-size-body-sm); font-weight: var(--font-weight-medium); color: var(--color-text-strong); }
.hrow__sub { margin-top: var(--space-hair); font-size: var(--font-size-micro); color: var(--color-text-weak); }
.hrow__right { flex-shrink: 0; text-align: right; }
.hrow__amount { font-size: var(--font-size-xs); font-weight: var(--font-weight-bold); color: var(--color-text); font-variant-numeric: tabular-nums; }
.hrow__at { margin-top: var(--space-hair); font-size: var(--font-size-tiny); color: var(--color-text-ghost); }

/* ── checker ─────────────────────────────────────────────────────────────── */
.ta {
  width: 100%;
  padding: var(--space-6);
  border: 0;
  border-radius: var(--radius-card);
  background: var(--color-input-bg);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: var(--font-size-xxs);
  line-height: var(--font-line-height-normal);
  outline: none;
  resize: vertical;
}
.ta::placeholder { color: var(--color-text-weak); }
.ta__foot { display: flex; align-items: center; gap: var(--space-4); margin-top: var(--space-3); }
.ta__count { margin-left: auto; font-size: var(--font-size-micro); color: var(--color-text-weak); }
.ta__warn { font-size: var(--font-size-micro); color: var(--color-warn); }

.btn--inline { width: auto; margin-top: 0; padding: var(--space-5) var(--space-8); font-size: var(--font-size-xs); }

.csum { display: flex; align-items: center; gap: var(--space-5); margin: var(--space-9) 0 var(--space-5); flex-wrap: wrap; }
.csum__alive { font-size: var(--font-size-xs); font-weight: var(--font-weight-bold); color: var(--color-ok); }
.csum__dead { font-size: var(--font-size-xs); font-weight: var(--font-weight-bold); color: var(--color-danger); }
.csum__actions { margin-left: auto; display: flex; gap: var(--space-3); }
.csum__btn {
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-md);
  background: var(--color-surface3);
  color: var(--color-accent);
  font-size: var(--font-size-micro);
  font-weight: var(--font-weight-bold);
}
.csum__btn:disabled { opacity: .45; color: var(--color-text-weak); }

.cres { padding: var(--space-6) var(--space-8); }
.cres__head { display: flex; align-items: center; gap: var(--space-5); }
.cres__line { flex: 1; min-width: 0; font-size: var(--font-size-micro); color: var(--color-text-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cres__status { flex-shrink: 0; display: flex; align-items: center; gap: var(--space-2); font-size: var(--font-size-micro); font-weight: var(--font-weight-bold); }
.cres__status--ok { color: var(--color-ok); }
.cres__status--dead { color: var(--color-danger); }
.cres__meta { display: flex; justify-content: space-between; gap: var(--space-4); margin-top: var(--space-hair); font-size: var(--font-size-tiny); color: var(--color-text-weak); }

/* ── packages ────────────────────────────────────────────────────────────── */
.packages { display: flex; flex-direction: column; gap: var(--space-4); }

.pkg {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  width: 100%;
  padding: var(--space-7) var(--space-8);
  border: 1px solid transparent;
  border-radius: var(--radius-button);
  background: var(--color-surface1);
  text-align: left;
}

.pkg.is-on { background: var(--color-accent-selected); border-color: var(--color-accent-border); }
.pkg--unlimited.is-on { background: var(--color-violet-wash); border-color: var(--color-violet-border); }
.pkg.is-disabled { opacity: .45; }

.pkg__radio {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-text-ghost);
  border-radius: var(--radius-circle);
}

.pkg.is-on .pkg__radio { border-color: var(--color-accent); }
.pkg--unlimited.is-on .pkg__radio { border-color: var(--color-violet-soft); }

.pkg__dot { width: 10px; height: 10px; border-radius: var(--radius-circle); background: var(--color-accent); }
.pkg--unlimited .pkg__dot { background: var(--color-violet-soft); }

.pkg__text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); }

.pkg__title { font-size: var(--font-size-body-lg); font-weight: var(--font-weight-heavy); color: var(--color-text); }

.pkg.is-on .pkg__title { color: var(--color-accent); }
.pkg--unlimited.is-on .pkg__title { color: var(--color-violet-pale); }

.pkg__sub { font-size: var(--font-size-micro); color: var(--color-text-weak); }

.pkg__price { flex-shrink: 0; font-size: var(--font-size-subheading); font-weight: var(--font-weight-heavy); font-variant-numeric: tabular-nums; }

.paynote {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-top: var(--space-7);
  padding: var(--space-6) var(--space-7);
  border-radius: var(--radius-card);
  background: var(--color-surface1);
}

.paynote__text { font-size: var(--font-size-micro); line-height: var(--font-line-height-snug); color: var(--color-text-dim); }
.paynote__balance { font-size: var(--font-size-micro); font-weight: var(--font-weight-bold); color: var(--color-text-faint); }

/* ── the pay bar ─────────────────────────────────────────────────────────── */
.paybar {
  position: sticky;
  bottom: 0;
  z-index: 30;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: var(--space-7);
  padding: var(--space-6) var(--space-9);
  padding-bottom: var(--safe-area-bottom);
  background: var(--color-bar-bg);
  backdrop-filter: blur(12px);
}

.paybar__total { flex-shrink: 0; }
.paybar__label { font-size: var(--font-size-tiny); letter-spacing: var(--font-letter-spacing-label); text-transform: uppercase; color: var(--color-text-label); }
.paybar__value { font-size: var(--font-size-title); font-weight: var(--font-weight-heavy); font-variant-numeric: tabular-nums; }
.paybar__cta { flex: 1; margin-top: 0; padding: var(--space-6); font-size: var(--font-size-body-sm); }

/* ── state screens: loading, empty, error, payment ───────────────────────── */
/* THE CANONICAL ERROR/EMPTY LAYOUT: `min-height:100%` inside the scroller, centred on both
   axes, `padding:40px 32px`. The first build padded the bottom by the nav height even when the
   nav is hidden — which is exactly when these screens appear — so the content sat visibly above
   centre with a large void beneath it. The nav-sized inset now belongs to the variant that
   actually renders under a nav. */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100%;
  padding: var(--space-14) var(--space-13);
  padding-bottom: calc(var(--space-14) + env(safe-area-inset-bottom));
  text-align: center;
}

/* Shown while the bottom navigation is on screen (the empty-home state), so it needs the inset. */
.state--under-nav { padding-bottom: var(--size-content-bottom-pad); }

.state--inline { min-height: 0; padding: var(--space-14) var(--space-5) 0; }
.state--pay { animation: var(--motion-fade-in); }

/* The canonical empty-state glyph is a 56px ROUNDED SQUARE at radius 18, not a circle. */
.state__glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--size-state-glyph);
  height: var(--size-state-glyph);
  margin-bottom: var(--space-8);
  border-radius: var(--radius-large);
  background: var(--color-accent-glyph);
}

.state__glyph--accent { background: var(--color-accent-wash); }
.state__glyph--ok { background: var(--color-ok-wash); }
.state__glyph--danger { background: var(--color-danger-wash); }

.state__title {
  margin: 0 0 var(--space-3);
  font-size: var(--font-size-heading);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
}

/* The inline empty state on Home uses the reference's 16px title, not the 17px error title. */
.state--inline .state__title { font-size: var(--font-size-subheading); }

.state__body {
  max-width: 280px;
  font-size: var(--font-size-sm);
  line-height: var(--font-line-height-relaxed);
  color: var(--color-text-faint);
}

.state__meta { margin-top: var(--space-4); font-size: var(--font-size-xs); color: var(--color-text-weak); }

.state__actions { display: flex; flex-direction: column; gap: var(--space-4); width: 100%; max-width: 280px; margin-top: var(--space-10); }

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--color-surface5);
  border-top-color: var(--color-accent);
  border-radius: var(--radius-circle);
  animation: var(--motion-spinner);
}

/* ── skeleton ────────────────────────────────────────────────────────────── */
.skel { border-radius: var(--radius-sm); background: var(--color-surface4); animation: var(--motion-skeleton); }
.skel + .skel { margin-top: var(--space-7); }
.skel--balance { border-radius: var(--radius-input); background: var(--color-surface5); }
.skel--cta { margin-top: var(--space-11); border-radius: var(--radius-button); background: var(--color-surface5); }
.skel--card { margin-top: var(--space-11); border-radius: var(--radius-large); background: var(--color-surface3); }

/* ── provisioning steps and credentials ──────────────────────────────────── */
.steps { width: 100%; max-width: 280px; margin-top: var(--space-9); display: flex; flex-direction: column; gap: var(--space-5); }

.steps__row { display: flex; align-items: center; gap: var(--space-5); text-align: left; }

.steps__mark {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-circle);
  background: var(--color-surface2);
  font-size: var(--font-size-micro);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-disabled);
}

.steps__mark.is-active { background: var(--color-accent-wash); color: var(--color-accent); }
.steps__mark.is-done { background: var(--color-ok-wash-strong); color: var(--color-ok); }

.steps__label { flex: 1; font-size: var(--font-size-xs); color: var(--color-text-disabled); }
.steps__label.is-lit { color: var(--color-text-strong); }

.creds {
  width: 100%;
  max-width: 280px;
  margin-top: var(--space-9);
  padding: var(--space-7);
  border-radius: var(--radius-card);
  background: var(--color-surface1);
  animation: var(--motion-cred-appear);
  text-align: left;
}

.creds__title {
  margin-bottom: var(--space-5);
  font-size: var(--font-size-tiny);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--font-letter-spacing-label);
  text-transform: uppercase;
  color: var(--color-text-label);
}

.creds__row { display: flex; align-items: center; gap: var(--space-5); }
.creds__row + .creds__row { margin-top: var(--space-4); }
.creds__label { flex-shrink: 0; width: 68px; font-size: var(--font-size-micro); color: var(--color-text-weak); }
.creds__value { flex: 1; font-size: var(--font-size-xs); color: var(--color-text-strong); word-break: break-all; }

/* ── profile ─────────────────────────────────────────────────────────────── */
.profile { display: flex; align-items: center; gap: var(--space-7); margin-bottom: var(--space-12); }

.profile__avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: var(--size-avatar-large);
  height: var(--size-avatar-large);
  padding: var(--space-hair);
  border-radius: var(--radius-circle);
  background: var(--gradient-avatar);
}

.profile__initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-circle);
  background: var(--color-avatar-inner);
  font-size: var(--font-size-xl20);
  font-weight: var(--font-weight-heavy);
  color: var(--color-violet-pale);
}

.profile__name { font-size: var(--font-size-heading); font-weight: var(--font-weight-bold); }
.profile__sub { margin-top: var(--space-hair); font-size: var(--font-size-xs); color: var(--color-text-weak); }

/* Profile list rows: 13px gap, 15px/16px padding, 14px label, 12px trailing value. */
.row--profile { gap: var(--space-6); padding: 15px var(--space-8); }
.row--profile .row__label { font-size: var(--font-size-body); color: var(--color-text-strong); }
.row--profile .row__value { font-size: var(--font-size-xxs); color: var(--color-text-weak); }

.legal { display: flex; justify-content: center; gap: var(--space-7); margin-top: var(--space-12); }

.legal__link { font-size: var(--font-size-micro); color: var(--color-text-ghost); text-decoration: underline; }

.card + .card { margin-top: var(--space-7); }

/* ── guide accordion ─────────────────────────────────────────────────────── */
.accordion { display: flex; flex-direction: column; gap: var(--space-4); }

.acc { border-radius: var(--radius-card); background: var(--color-surface1); overflow: hidden; }

.acc__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  width: 100%;
  padding: var(--space-7) var(--space-8);
  text-align: left;
}

.acc__title { font-size: var(--font-size-body-sm); font-weight: var(--font-weight-bold); color: var(--color-text-muted); }
.acc.is-open .acc__title { color: var(--color-accent); }

.acc__chevron { display: flex; flex-shrink: 0; transition: transform .2s ease; }
.acc.is-open .acc__chevron { transform: rotate(180deg); }

.acc__body { max-height: 0; overflow: hidden; transition: max-height .25s ease; }
.acc.is-open .acc__body { max-height: 300px; }

.acc__text {
  padding: 0 var(--space-8) var(--space-7);
  font-size: var(--font-size-xs);
  line-height: var(--font-line-height-relaxed);
  color: var(--color-text-faint);
}

/* ── toasts ──────────────────────────────────────────────────────────────── */
.toasts {
  position: fixed;
  top: calc(var(--size-header-height) + env(safe-area-inset-top) + var(--space-3));
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  max-width: 84%;
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-pill);
  background: var(--color-sheet);
  color: var(--color-text-strong);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  box-shadow: var(--shadow-sheet);
  animation: var(--motion-toast-in);
}

/* ── bottom sheet ────────────────────────────────────────────────────────── */
.sheet__scrim {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: var(--color-scrim);
}

.sheet__panel {
  width: 100%;
  max-width: var(--size-frame-width);
  max-height: 76%;
  display: flex;
  flex-direction: column;
  padding: var(--space-4) var(--space-9) var(--safe-area-bottom);
  border-radius: var(--radius-sheet);
  background: var(--color-sheet);
  box-shadow: var(--shadow-sheet);
  animation: var(--motion-sheet-up);
}

.sheet__grip { width: 36px; height: 4px; margin: 0 auto var(--space-5); border-radius: var(--radius-xs); background: var(--color-surface5); }

.sheet__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-5); margin-bottom: var(--space-5); }

.sheet__title { display: flex; flex-direction: column; gap: var(--space-1); font-size: var(--font-size-body-lg); font-weight: var(--font-weight-bold); }

.sheet__subtitle { font-size: var(--font-size-tiny); font-weight: var(--font-weight-regular); color: var(--color-text-weak); }

.sheet__close { display: flex; flex-shrink: 0; padding: var(--space-1); color: var(--color-text-weak); }

.sheet__body { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--space-5); overflow: hidden; }

.input {
  width: 100%;
  padding: var(--space-6) var(--space-7);
  border: 0;
  border-radius: var(--radius-card);
  background: var(--color-surface3);
  color: var(--color-text);
  font-size: var(--font-size-xs);
}

.input::placeholder { color: var(--color-text-weak); }

.geolist { flex: 1; min-height: 0; overflow-y: auto; margin: 0 calc(-1 * var(--space-9)); padding: 0 var(--space-9) var(--space-7); }

.georow { display: flex; align-items: center; gap: var(--space-5); padding: var(--space-6) var(--space-4); border-radius: var(--radius-card); }

.georow.is-on { background: var(--color-accent-wash); }

.georow__flag { flex-shrink: 0; display: flex; align-items: center; justify-content: center; width: 22px; }

.georow__text { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: var(--space-3); }
.georow__name { font-size: var(--font-size-body-sm); }

/* The ISO code, as the small secondary text it is allowed to be — never the primary marker. */
.georow__code { font-size: var(--font-size-tiny); color: var(--color-text-ghost); letter-spacing: var(--font-letter-spacing-wide); }

.georow__count { flex-shrink: 0; font-size: var(--font-size-micro); color: var(--color-text-weak); }
.georow__count--none { color: var(--color-warn); }

/* A country the pool cannot currently serve: visible, explained, and not selectable. */
.georow.is-unavailable { opacity: .45; }
.georow.is-unavailable .georow__flag { filter: grayscale(1); }

.geolist__empty { padding: var(--space-9) var(--space-4); text-align: center; font-size: var(--font-size-xs); color: var(--color-text-weak); }

/* The flag itself. A fixed box so a 3:2 flag and the 1:1 globe sit on the same baseline. */
.flag { display: block; border-radius: var(--radius-hair); object-fit: cover; }
/* The neutral assets paint their own fill (see _any-v2/_unknown-v2), so no colour is inherited and
   nothing here may dim them: no filter, no opacity, no currentColor. object-fit keeps the 3:2 box. */
.flag--any, .flag--unknown { border-radius: 0; opacity: 1; filter: none; }

/* ── narrow: the Telegram WebView, which is what this is actually for ─────── */
@media (max-width: 480px) {
  .app { max-width: var(--size-frame-narrow-width); }
}

/* ── current-IP diagnostic ──────────────────────────────────────────────────
   Reuses .scanning (busy) and .target__result (result/error); only layout is bespoke. The panel
   shows the exit address, its region and the round-trip time — never a credential. */
.ipcheck { display: flex; flex-direction: column; gap: 8px; }
.ipcheck__result { display: flex; flex-direction: column; gap: 6px; }
.ipcheck__row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ipcheck__label { font-size: var(--font-size-micro); letter-spacing: var(--font-letter-spacing-label); text-transform: uppercase; color: var(--color-text-label); }
.ipcheck__ip { font-family: var(--font-mono); font-size: var(--font-size-sm); color: var(--color-text-strong); }
.ipcheck__meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--font-size-micro); color: var(--color-text-dim); }

/* ── parser ─────────────────────────────────────────────────────────────────
   Reuses .ta, .seg, .scanning, .csum, .card and .target__result; the extract-type row wraps and
   the result rows are a thin list. No colour here decides money — the parser spends traffic. */
.seg--wrap { flex-wrap: wrap; gap: 6px; }
.parser__estimate { display: flex; flex-direction: column; gap: 4px; }
.parser__cost { font-size: var(--font-size-sm); color: var(--color-text); }
.parser__ok { font-size: var(--font-size-micro); color: var(--color-ok); }
.parser__warn { font-size: var(--font-size-micro); color: var(--color-warn-text); }
.parser__done { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.pres { display: flex; flex-direction: column; gap: 3px; padding: 9px 12px; }
.pres + .pres { border-top: 1px solid var(--color-hairline); }
.pres__url { font-family: var(--font-mono); font-size: var(--font-size-micro); color: var(--color-accent); word-break: break-all; }
.pres__val { font-size: var(--font-size-sm); color: var(--color-text-body); word-break: break-word; }
