:root {
  --bg: var(--tg-theme-bg-color, #191919);
  --section: var(--tg-theme-section-bg-color, var(--tg-theme-secondary-bg-color, #202020));
  --text: var(--tg-theme-text-color, #ffffff);
  --hint: var(--tg-theme-hint-color, rgba(255, 255, 255, 0.65));
  --link: var(--tg-theme-link-color, #5e9fe8);
  --button: var(--tg-theme-button-color, #2783de);
  --button-text: var(--tg-theme-button-text-color, #ffffff);
  --border: color-mix(in srgb, var(--text) 14%, transparent);
  --soft: color-mix(in srgb, var(--text) 7%, transparent);
  --green: #46a171;
  --red: #e56458;
  --orange: #d5803b;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h2 { font-size: 18px; line-height: 1.3; margin: 0 0 12px; }
p { margin: 0 0 12px; }
.app { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); display: grid; gap: 12px; }
.hint { color: var(--hint); }
.small { font-size: 14px; }
.center { text-align: center; }

.top { display: flex; align-items: center; gap: 12px; padding: 4px 4px 8px; }
.top img { border-radius: 10px; }
.top__brand { font-weight: 700; font-size: 18px; line-height: 1.2; }

.card { background: var(--section); border-radius: 12px; padding: 16px; }
.card.empty { text-align: center; padding: 24px 16px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row h2 { margin: 0; }

.chip { font-size: 14px; font-weight: 600; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.chip--ok { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }
.chip--bad { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); }

.big { font-size: 32px; font-weight: 700; line-height: 1.2; margin-top: 12px; letter-spacing: -0.01em; }
.traffic { margin: 16px 0 8px; }
.traffic .row { margin-bottom: 6px; }
.bar { height: 8px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--button); border-radius: 999px; transition: width .4s ease; }
.bar span.warn { background: var(--orange); }

.key {
  font: 13px/1.4 Menlo, Consolas, monospace; word-break: break-all; color: var(--hint);
  background: var(--soft); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px;
  max-height: 64px; overflow: hidden;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .btn { flex: 1 1 0; }
.qr { width: 200px; margin: 16px auto 0; padding: 10px; background: #fff; border-radius: 12px; }
.qr svg { display: block; width: 100%; height: auto; }

.btn {
  min-height: 44px; padding: 0 16px; border-radius: 10px; border: 0; cursor: pointer;
  font: inherit; font-weight: 600; font-size: 15px; color: var(--link); background: var(--soft);
}
.btn--primary { background: var(--button); color: var(--button-text); }
.btn--ghost { background: transparent; color: var(--link); }
.btn--block { width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.btn:focus-visible, .opt:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.plans { display: grid; gap: 8px; margin-bottom: 16px; }
.methods { display: grid; gap: 8px; margin-bottom: 16px; }
.opt {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  min-height: 52px; padding: 10px 14px; border-radius: 10px; text-align: left; cursor: pointer;
  font: inherit; color: var(--text); background: transparent; border: 1.5px solid var(--border);
}
.opt[aria-checked="true"] { border-color: var(--button); background: color-mix(in srgb, var(--button) 10%, transparent); }
.opt__title { font-weight: 600; }
.opt__sub { display: block; font-size: 14px; color: var(--hint); }
.opt__price { font-weight: 700; white-space: nowrap; text-align: right; }
.badge { display: inline-block; margin-left: 6px; font-size: 12px; font-weight: 600; color: var(--green); }
.methods .opt { min-height: 44px; }

.steps { margin: 0 0 16px; padding-left: 20px; display: grid; gap: 8px; }
.notice { background: color-mix(in srgb, var(--orange) 14%, transparent); color: var(--text); border-radius: 12px; padding: 12px 16px; }

.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); max-width: 528px; margin: 0 auto;
  background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: 10px; font-size: 15px; text-align: center;
}
@media (prefers-reduced-motion: reduce) { .bar span { transition: none; } }
