:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f0f0f0);
  --text: var(--tg-theme-text-color, #1a1a1a);
  --hint: var(--tg-theme-hint-color, #999999);
  --link: var(--tg-theme-link-color, #2481cc);
  --btn: var(--tg-theme-button-color, #2481cc);
  --btn-text: var(--tg-theme-button-text-color, #ffffff);
  --danger: #e53935;
  --success: #43a047;
  --radius: 12px;
}

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

body {
  font-family: -apple-system, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 76px;
  -webkit-font-smoothing: antialiased;
}

/* ===== Tabs ===== */
.tabs-wrap {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--bg2);
  border-top: .5px solid rgba(0,0,0,.08);
  padding-bottom: env(safe-area-inset-bottom, 0);
  z-index: 100;
}
.tabs-scroll {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2px;
  padding: 4px 8px 6px;
  overflow: hidden;
}
.tabs-scroll::-webkit-scrollbar { display: none; }
.tab {
  min-width: 0;
  max-width: none;
  text-align: center;
  padding: 6px 6px 4px;
  font-size: 9px; font-weight: 600;
  color: var(--hint);
  cursor: pointer;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
  line-height: 1.15;
}
.tab.active { color: var(--link); }
.tab-icon { display: block; font-size: 20px; margin-bottom: 2px; }
.tab-label { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ===== Screens ===== */
.screen { display: none; padding: 16px; animation: fadeIn .2s ease; }
.screen.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ===== Loading / Empty ===== */
.loading { text-align: center; padding: 60px 20px; color: var(--hint); font-size: 15px; }
.spinner { display: inline-block; width: 24px; height: 24px; border: 2.5px solid var(--bg2); border-top-color: var(--link); border-radius: 50%; animation: spin .6s linear infinite; margin-bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { text-align: center; padding: 48px 20px; }
.empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-title { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.empty-text { font-size: 14px; color: var(--hint); line-height: 1.4; }
.error-retry { margin-top: 16px; }

/* ===== Header ===== */
.header { margin-bottom: 16px; }
.greeting { font-size: 22px; font-weight: 700; }
.hint { font-size: 13px; color: var(--hint); margin-top: 2px; }

/* ===== Cards ===== */
.card {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.card-label { font-size: 13px; font-weight: 600; color: var(--hint); text-transform: uppercase; letter-spacing: .3px; margin-bottom: 8px; }
.card-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 15px; }
.card-row span:last-child { font-weight: 600; }

/* ===== Status badges ===== */
.status-badge { display: inline-block; font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.status-badge.active { color: var(--success); }
.status-badge.expired { color: var(--accent-2); }
.status-badge.none { color: var(--danger); }

/* ===== Pending banner ===== */
.pending-banner {
  display: flex; align-items: center; gap: 8px;
  border-radius: var(--radius); padding: 10px 14px;
  font-size: 14px; font-weight: 500; margin-bottom: 10px;
}
.pending-banner .btn-link { margin-left: auto; }

/* ===== Buttons ===== */
.actions { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.btn {
  display: block; width: 100%;
  padding: 13px 16px;
  border: none; border-radius: var(--radius);
  font-size: 15px; font-weight: 600;
  cursor: pointer; text-align: center;
  transition: opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { opacity: .7; }
.btn.primary { background: var(--btn); color: var(--btn-text); }
.btn.secondary { background: var(--bg2); color: var(--link); }
.btn.danger { background: transparent; color: var(--danger); font-weight: 500; font-size: 14px; }
.btn.small { padding: 10px 14px; font-size: 14px; }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn-link {
  background: none; border: none; color: var(--link);
  font-size: 14px; font-weight: 600; cursor: pointer;
  padding: 0; text-decoration: none;
}

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

.slot-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.slot-chip {
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  border-radius: 14px;
  min-height: 46px;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.slot-chip.active {
  background: linear-gradient(135deg, rgba(140, 109, 255, .34), rgba(67, 214, 255, .18));
  border-color: rgba(121, 215, 255, .26);
  box-shadow: inset 0 0 0 1px rgba(121, 215, 255, .14);
}

.slot-custom-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 12px;
}

.slot-input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  font-size: 15px;
}

.slot-input::placeholder {
  color: var(--hint);
}

.slot-summary {
  margin-top: 12px;
}

/* ===== Connect screen ===== */
.sub-url-box {
  background: var(--bg); border: 1px solid rgba(0,0,0,.08);
  border-radius: 8px; padding: 10px 12px;
  font-size: 13px; font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  word-break: break-all; color: var(--text);
  margin-bottom: 10px; line-height: 1.45;
}
.qr-wrap { text-align: center; margin: 16px 0; }
.qr-wrap img { width: 200px; height: 200px; border-radius: 8px; }
.copy-ok { color: var(--success); font-size: 13px; font-weight: 500; text-align: center; margin-top: 6px; min-height: 20px; }

/* ===== Plans ===== */
.plan-card {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; transition: opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.plan-card:active { opacity: .7; }
.plan-info { flex: 1; }
.plan-label { font-size: 16px; font-weight: 600; }
.plan-devices { font-size: 12px; color: var(--hint); margin-top: 2px; }
.plan-price { text-align: right; }
.plan-amount { font-size: 17px; font-weight: 700; }
.plan-discount {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  margin-top: 3px;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--link);
  background: rgba(36, 129, 204, 0.12);
  border: 1px solid rgba(36, 129, 204, 0.28);
}

/* ===== Payment screen ===== */
.pay-summary { text-align: center; padding: 12px 0; }
.pay-amount { font-size: 32px; font-weight: 700; }
.pay-plan { font-size: 15px; color: var(--hint); margin-top: 4px; }
.pay-legal {
  font-size: 13px; line-height: 1.45;
  text-align: center; margin: 12px 12px 8px;
  color: var(--text);
}
.pay-legal a { color: var(--accent, #2481cc); text-decoration: underline; }
.pay-legal-cta {
  font-size: 13px; color: var(--hint); line-height: 1.45;
  text-align: center; margin: 0 12px 8px;
}
.pay-hint {
  font-size: 13px; color: var(--hint); line-height: 1.45;
  text-align: center; margin: 0 8px 12px;
}
.pay-status { text-align: center; padding: 20px 0; }
.pay-status .status-icon { font-size: 36px; margin-bottom: 8px; }
.pay-status .status-text { font-size: 16px; font-weight: 600; }
.pay-status .status-hint { font-size: 14px; color: var(--hint); margin-top: 4px; line-height: 1.4; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 10px 20px; border-radius: 20px;
  font-size: 14px; font-weight: 500;
  opacity: 0; transition: opacity .3s;
  z-index: 200; pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ===== Referral ===== */
.ref-link-box {
  background: var(--bg); border: 1px solid rgba(0,0,0,.08);
  border-radius: 8px; padding: 10px 12px;
  font-size: 13px; word-break: break-all;
  margin-bottom: 10px; line-height: 1.45;
}
.ref-rules { font-size: 14px; line-height: 1.5; color: var(--text); margin-bottom: 12px; }
.ref-rules li { margin-left: 18px; margin-top: 4px; }
.fallback-html { font-size: 14px; line-height: 1.5; }
.fallback-html b { font-weight: 600; }

/* ===== Instructions (HTML from API, Telegram-style) ===== */
.instr-html {
  font-size: 14px; line-height: 1.55;
  color: var(--text);
}
.instr-html b { font-weight: 600; }
.instr-html code {
  display: block;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 8px;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
  white-space: pre-wrap;
}
.platform-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
.platform-tile {
  background: var(--bg2);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: opacity .15s;
  -webkit-tap-highlight-color: transparent;
}
.platform-tile:active { opacity: .7; }
.platform-tile:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}
.platform-tile .p-icon { font-size: 28px; display: block; margin-bottom: 6px; }
.platform-tile .p-name { font-size: 14px; font-weight: 600; }

.screen-toolbar {
  display: flex; align-items: center; gap: 8px;
  margin: -4px 0 12px;
}
.screen-toolbar .btn-back {
  flex: 0 0 auto;
  background: var(--bg2); color: var(--link);
  border: none; border-radius: 8px;
  padding: 8px 12px; font-size: 14px; font-weight: 600;
  cursor: pointer;
}
.screen-toolbar .toolbar-title {
  font-size: 17px; font-weight: 700;
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.divider {
  height: 1px;
  background: var(--bg2);
  margin: 20px 0;
}

/* Location load bars */
.locations-section { margin-top: 16px; }
.locations-section h3 {
  font-size: 14px; font-weight: 600; color: var(--hint);
  margin: 0 0 8px; text-transform: uppercase; letter-spacing: .5px;
}
.loc-hint {
  font-size: 12px; color: var(--hint); line-height: 1.45;
  margin: 0 0 10px; font-weight: 400; text-transform: none; letter-spacing: 0;
}
.loc-item {
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px 0; align-items: stretch;
}
.loc-top {
  display: flex; align-items: center; gap: 10px;
}
.loc-flag { font-size: 20px; flex-shrink: 0; }
.loc-name { font-size: 14px; font-weight: 500; min-width: 90px; }
.loc-bar {
  flex: 1; height: 8px; background: var(--bg2);
  border-radius: 4px; overflow: hidden; min-width: 60px;
}
.loc-detail {
  font-size: 12px; color: var(--hint); padding-left: 30px;
}
.loc-warn {
  font-size: 14px; color: var(--danger); font-weight: 700; padding-left: 30px;
}
.loc-bar-fill {
  height: 100%; border-radius: 4px;
  transition: width .4s ease;
}
.loc-pct { font-size: 13px; font-weight: 600; min-width: 36px; text-align: right; }

/* Cosmic refresh */
:root {
  --bg: #070b18;
  --bg2: #0f1630;
  --card: rgba(13, 19, 40, .78);
  --line: rgba(150, 171, 255, .18);
  --text: #f5f7ff;
  --hint: #a8b3da;
  --link: #79d7ff;
  --accent: #8c6dff;
  --accent-2: #43d6ff;
  --success: #72f0b5;
  --danger: #ff7399;
  --shadow: 0 24px 60px rgba(0, 0, 0, .38);
}

html, body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  background:
    radial-gradient(circle at top left, rgba(67, 214, 255, .18), transparent 34%),
    radial-gradient(circle at top right, rgba(140, 109, 255, .22), transparent 38%),
    radial-gradient(circle at bottom center, rgba(16, 24, 53, .96), rgba(5, 8, 19, 1) 72%);
  padding-bottom: calc(112px + env(safe-area-inset-bottom, 0px));
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

body::before {
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, .22) 0 1px, transparent 1.2px),
    radial-gradient(circle, rgba(121, 215, 255, .15) 0 1px, transparent 1.2px);
  background-size: 160px 160px, 220px 220px;
  background-position: 24px 16px, 72px 108px;
  opacity: .32;
}

body::after {
  background:
    radial-gradient(circle at 30% 18%, rgba(104, 92, 255, .18), transparent 20%),
    radial-gradient(circle at 78% 72%, rgba(67, 214, 255, .12), transparent 18%);
  filter: blur(40px);
  opacity: .85;
}

#app.app-shell {
  position: relative;
  width: min(980px, 100%);
  margin: 0 auto;
  z-index: 1;
}

.screen {
  display: none;
  min-height: calc(100dvh - 100px);
  padding: 22px 14px 8px;
  box-sizing: border-box;
}

.screen.active {
  display: block;
}

.header {
  margin-bottom: 16px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 8px;
}

.greeting {
  font-size: 28px;
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--text);
}

.hint,
.section-copy,
.metric-label,
.loc-meta,
.pay-hint,
.pay-legal,
.pay-legal-cta,
.status-hint,
.empty-text {
  color: var(--hint);
}

.hint {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.card,
.note-card,
.plan-card,
.pay-summary,
.pay-status,
.sub-url-box,
.ref-link-box,
.pending-banner,
.qr-card,
.empty,
.loading {
  position: relative;
  background: linear-gradient(180deg, rgba(18, 26, 52, .88), rgba(10, 15, 32, .92));
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.card,
.plan-card,
.pay-summary,
.pay-status,
.qr-card {
  padding: 18px;
}

.note-card {
  padding: 16px 18px;
  line-height: 1.5;
}

.pay-bot-only-banner {
  margin-top: 4px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: 0.01em;
  color: var(--text);
}

.pay-bot-only-banner strong {
  font-weight: 800;
}

.hero-card {
  overflow: hidden;
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.soft-badge,
.status-chip,
.card-label {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
}

.soft-badge {
  background: rgba(255, 255, 255, .05);
  border: 1px solid rgba(255, 255, 255, .08);
  color: var(--hint);
}

.status-chip,
.card-label {
  border: 1px solid transparent;
}

.card-label {
  background: rgba(121, 215, 255, .08);
  border-color: rgba(121, 215, 255, .18);
  color: var(--accent-2);
}

.status-chip.active {
  background: rgba(114, 240, 181, .12);
  border-color: rgba(114, 240, 181, .28);
  color: var(--success);
}

.status-chip.expired {
  background: rgba(140, 109, 255, .12);
  border-color: rgba(140, 109, 255, .28);
  color: var(--accent);
}

.status-chip.none {
  background: rgba(255, 115, 153, .12);
  border-color: rgba(255, 115, 153, .28);
  color: var(--danger);
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .07);
}

.metric-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.metric-label {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.35;
}

.hero-copy {
  font-size: 15px;
  line-height: 1.6;
  color: var(--hint);
}

.action-grid,
.actions,
.btn-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.action-grid-single {
  grid-template-columns: 1fr;
}

.action-grid .btn,
.actions .btn,
.btn-row .btn {
  width: 100%;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 18px;
  min-height: 52px;
  padding: 14px 16px;
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.btn:active {
  transform: translateY(1px) scale(.99);
}

.btn.primary {
  color: var(--text);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 18px 34px rgba(93, 90, 255, .28);
}

.btn.secondary {
  color: var(--text);
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .1);
}

.btn.ghost {
  color: var(--accent-2);
  background: rgba(121, 215, 255, .08);
  border: 1px solid rgba(121, 215, 255, .18);
}

.btn.danger {
  color: var(--text);
  background: linear-gradient(135deg, rgba(255, 115, 153, .95), rgba(255, 83, 83, .95));
}

.btn.small {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 14px;
}

.btn-link {
  border: none;
  background: transparent;
  color: var(--accent-2);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.pending-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding: 14px 18px;
  color: var(--text);
}

.divider {
  height: 1px;
  margin: 22px 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .16), transparent);
}

.section-head {
  margin-bottom: 12px;
}

.section-title {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 800;
  color: var(--text);
}

.locations-section {
  margin-top: 18px;
}

.loc-list {
  display: grid;
  gap: 12px;
}

.loc-item {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
}

.loc-top,
.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.loc-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.loc-flag {
  font-size: 20px;
}

.loc-name,
.card-row span:last-child,
.status-text,
.empty-title,
.pay-plan,
.plan-label {
  color: var(--text);
}

.loc-name {
  font-weight: 700;
}

.loc-pct {
  font-size: 13px;
  font-weight: 800;
}

.loc-bar {
  margin-top: 10px;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, .06);
}

.loc-bar-fill {
  height: 100%;
  border-radius: inherit;
}

.loc-bar-fill.green { background: linear-gradient(90deg, #39d98a, #72f0b5); }
.loc-bar-fill.yellow {
  background: linear-gradient(90deg, rgba(67, 214, 255, .85), rgba(140, 109, 255, .75));
}
.loc-bar-fill.red { background: linear-gradient(90deg, #ff6a87, #ff9a73); }
.loc-item.green { border-color: rgba(114, 240, 181, .16); }
.loc-item.yellow { border-color: rgba(121, 215, 255, .22); }
.loc-item.red { border-color: rgba(255, 115, 153, .18); }

.loc-warn {
  margin-top: 8px;
  font-size: 14px;
  color: var(--danger);
  font-weight: 700;
  line-height: 1.45;
}

.platform-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.platform-chip {
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .04);
  color: var(--text);
  border-radius: 18px;
  min-height: 64px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  cursor: pointer;
}

.platform-chip.active {
  background: linear-gradient(135deg, rgba(140, 109, 255, .34), rgba(67, 214, 255, .18));
  border-color: rgba(121, 215, 255, .26);
  box-shadow: inset 0 0 0 1px rgba(121, 215, 255, .14);
}

.platform-icon {
  font-size: 18px;
}

.platform-name {
  font-size: 12px;
  font-weight: 700;
}

.guide-stack {
  display: grid;
  gap: 14px;
}

.guide-step {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 14px;
}

.step-index {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.step-content {
  min-width: 0;
}

.sub-url-box,
.ref-link-box {
  margin-top: 12px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.55;
  word-break: break-all;
  color: var(--text);
}

.guide-visual-wrap,
.qr-wrap,
.qr-card {
  margin-top: 14px;
}

.guide-visual,
.qr-wrap img,
.qr-card img {
  display: block;
  width: 100%;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(3, 6, 18, .45);
}

.qr-wrap,
.qr-card {
  text-align: center;
}

.qr-wrap img,
.qr-card img {
  max-width: 280px;
  margin: 0 auto;
}

.guide-checklist {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: var(--hint);
  line-height: 1.5;
}

.guide-inline-title {
  margin-top: 18px;
  font-size: 16px;
  line-height: 1.3;
  font-weight: 800;
  color: var(--text);
}

.guide-important {
  margin-top: 16px;
  color: var(--hint);
  line-height: 1.6;
}

.guide-important b {
  color: var(--text);
}

.guide-help-title {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 800;
  color: var(--text);
}

.guide-help-card .section-copy {
  margin-top: 12px;
}

.guide-help-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  color: var(--hint);
  line-height: 1.55;
}

.guide-help-list b {
  color: var(--text);
  font-weight: 800;
}

.guide-help-footnote {
  margin-top: 16px;
  color: var(--hint);
  line-height: 1.6;
}

.home-anchor-section {
  scroll-margin-top: 20px;
}

.support-section .section-copy {
  margin-top: 6px;
}

.support-checks {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  color: var(--hint);
  line-height: 1.55;
}

.location-hint-card .rich-html {
  margin-top: 0;
}

.ref-section {
  overflow: hidden;
}

.ref-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.ref-tiers {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(150px, 1fr);
  gap: 12px;
  margin-top: 16px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.ref-tier-card {
  position: relative;
  min-height: 148px;
  padding: 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
}

.ref-tier-card.active {
  background: linear-gradient(180deg, rgba(140, 109, 255, .24), rgba(67, 214, 255, .12));
  border-color: rgba(121, 215, 255, .28);
  box-shadow: inset 0 0 0 1px rgba(121, 215, 255, .16);
}

.ref-tier-icon {
  font-size: 24px;
  line-height: 1;
}

.ref-tier-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(121, 215, 255, .1);
  border: 1px solid rgba(121, 215, 255, .18);
}

.ref-tier-range {
  margin-top: 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.ref-tier-bonus {
  margin-top: 12px;
  font-size: 30px;
  line-height: 1;
  font-weight: 900;
  color: var(--text);
}

.ref-tier-copy {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--hint);
}

.ref-hint {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--hint);
}

.ref-link-title {
  margin-top: 16px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent-2);
}

.ref-link-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.ref-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.ref-stat {
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .04);
  border: 1px solid rgba(255, 255, 255, .08);
}

.ref-stat-value {
  display: block;
  font-size: 22px;
  line-height: 1.1;
  font-weight: 900;
  color: var(--text);
}

.ref-stat-label {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--hint);
}

.instr-html,
.fallback-html {
  margin-top: 10px;
}

.instr-html,
.rich-html {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}

.instr-html p,
.rich-html p {
  margin: 0 0 10px;
}

.instr-html b,
.rich-html b {
  color: var(--text);
}

.card-row {
  padding: 10px 0;
}

.card-row + .card-row {
  border-top: 1px solid rgba(255, 255, 255, .06);
}

.card-row span:first-child {
  color: var(--hint);
}

.ref-rules {
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--hint);
  line-height: 1.6;
}

.plan-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  cursor: pointer;
}

.plan-info {
  min-width: 0;
}

.plan-label {
  font-size: 18px;
  font-weight: 800;
}

.plan-devices {
  margin-top: 4px;
  color: var(--hint);
}

.plan-discount {
  margin-top: 4px;
}

.plan-price {
  text-align: right;
}

.plan-amount,
.pay-amount {
  font-size: 28px;
  line-height: 1;
  font-weight: 900;
  color: var(--text);
}

.pay-summary {
  margin-top: 10px;
  text-align: center;
}

.pay-plan {
  margin-top: 8px;
  font-size: 16px;
  font-weight: 700;
}

.pay-hint,
.pay-legal,
.pay-legal-cta {
  margin: 14px 2px 0;
  font-size: 13px;
  line-height: 1.55;
}

.pay-bot-note {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(121, 215, 255, .08);
  border: 1px solid rgba(121, 215, 255, .16);
  color: var(--text);
  line-height: 1.55;
}

.pay-manual {
  margin-top: 16px;
  padding: 16px 18px;
  text-align: left;
}

.pay-manual-title {
  font-weight: 700;
  font-size: 15px;
  margin-bottom: 12px;
}

.pay-manual-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.45;
}

.pay-manual-label {
  min-width: 88px;
  color: var(--hint);
  font-size: 13px;
}

.pay-manual-value {
  flex: 1 1 auto;
  word-break: break-all;
}

.pay-manual-order {
  margin: 12px 0 14px;
  font-size: 14px;
}

.pay-manual-bot {
  width: 100%;
  margin-top: 4px;
}

.pay-manual-warn {
  margin-top: 8px;
  font-size: 13px;
  color: var(--hint);
}

.pay-legal a {
  color: var(--accent-2);
}

.pay-status {
  margin-top: 18px;
  text-align: center;
}

.status-icon {
  font-size: 36px;
  line-height: 1;
  margin-bottom: 10px;
}

.status-text {
  font-size: 18px;
  font-weight: 800;
}

.status-hint {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--link);
}

.loading,
.empty {
  padding: 28px 22px;
  text-align: center;
}

.loading {
  margin-top: 12px;
}

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  margin: 0 auto 10px;
  border: 3px solid rgba(255, 255, 255, .16);
  border-top-color: var(--accent-2);
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.empty-title {
  font-size: 20px;
  font-weight: 800;
}

.error-retry {
  margin-top: 14px;
}

.toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  bottom: calc(100px + env(safe-area-inset-bottom, 0px));
  min-width: 160px;
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  border-radius: 16px;
  color: var(--text);
  text-align: center;
  background: rgba(12, 18, 37, .92);
  border: 1px solid rgba(121, 215, 255, .18);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  z-index: 140;
}

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

.tabs-wrap {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: min(980px, calc(100vw - 20px));
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  padding: 10px;
  border-radius: 28px;
  background: rgba(8, 12, 29, .84);
  border: 1px solid rgba(121, 215, 255, .12);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45);
  backdrop-filter: blur(22px);
  z-index: 120;
}

.tabs-scroll {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  padding: 0;
  overflow: hidden;
}

.tab {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--hint);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 64px;
  padding: 10px 6px;
  border-radius: 20px;
  min-width: 0;
  cursor: pointer;
}

.tab.active {
  color: var(--text);
  background: linear-gradient(135deg, rgba(140, 109, 255, .34), rgba(67, 214, 255, .18));
  box-shadow: inset 0 0 0 1px rgba(121, 215, 255, .12);
}

.tab-icon {
  font-size: 18px;
  line-height: 1;
}

.tab-label {
  font-size: 11px;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 720px) {
  .hero-grid,
  .action-grid,
  .actions,
  .btn-row {
    grid-template-columns: 1fr;
  }

  .slot-custom-row {
    grid-template-columns: 1fr;
  }

  .platform-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .ref-header {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .screen {
    padding-left: 12px;
    padding-right: 12px;
  }

  .greeting {
    font-size: 24px;
  }

  .guide-step {
    grid-template-columns: 1fr;
  }

  .step-index {
    width: 40px;
    height: 40px;
  }

  .tabs-wrap {
    width: calc(100vw - 12px);
    bottom: calc(6px + env(safe-area-inset-bottom, 0px));
    padding: 8px;
  }

  .tab {
    min-height: 58px;
    padding: 8px 4px;
  }

  .tab-label {
    font-size: 10px;
  }
}
