:root {
  color-scheme: dark;
  --background: #070b14;
  --surface: #111a28;
  --surface-elevated: #132033;
  --stroke: rgba(255,255,255,.08);
  --stroke-strong: rgba(255,255,255,.14);
  --text: #f3f7ff;
  --muted: rgba(243,247,255,.64);
  --muted-strong: rgba(243,247,255,.82);
  --blue: #4f8df6;
  --blue-dark: #203e69;
  --red: #ff5d78;
  --card-radius: 28px;
  --shadow: 0 28px 60px rgba(0,0,0,.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--background); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
button { border: 0; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }

.app-shell {
  min-height: 100vh;
  background: radial-gradient(circle at 50% -20%, rgba(79,141,246,.12), transparent 40%), var(--background);
}

.page {
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(18px + env(safe-area-inset-top)) 28px 16px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -.04em;
}

.logo-badge {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff, #dce5f8);
  color: #0b1322;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.balance-chip {
  text-align: right;
  line-height: 1.05;
}
.balance-chip small { display: block; color: var(--muted); font-size: 22px; font-weight: 500; }
.balance-chip strong { font-size: 34px; font-weight: 700; }
.balance-chip .negative { color: var(--red); }

.kebab {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 2px solid #256ef7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4f8df6;
  font-size: 24px;
}

.content { padding: 30px 28px 0; }
.hero-center { text-align: center; padding-top: 18px; }
.hero-emoji { font-size: 74px; margin-bottom: 10px; }
.hero-brand { font-size: clamp(52px, 8vw, 72px); font-weight: 800; letter-spacing: -.06em; margin: 0; }
.hero-title { margin: 28px 0 8px; font-size: clamp(42px, 6vw, 58px); font-weight: 800; letter-spacing: -.05em; line-height: 1.02; }
.hero-subtitle { margin: 0 0 30px; font-size: 26px; color: var(--muted-strong); }

.card {
  background: linear-gradient(180deg, rgba(20,31,50,.95), rgba(17,26,40,.95));
  border: 1px solid var(--stroke);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
}

.features-card, .refer-card, .device-card, .platforms-card, .tile-button, .amount-card, .payment-card, .setup-box, .faq-card {
  background: linear-gradient(180deg, rgba(20,31,50,.95), rgba(17,26,40,.95));
  border: 1px solid var(--stroke);
  border-radius: var(--card-radius);
  box-shadow: var(--shadow);
}

.features-card { padding: 26px 28px; display: grid; gap: 22px; margin-bottom: 26px; }
.feature-row { display: flex; gap: 18px; align-items: center; font-size: 22px; color: var(--text); }
.feature-row .emoji { font-size: 32px; width: 42px; text-align: center; }

.refer-card { padding: 26px 28px 28px; margin-bottom: 22px; }
.refer-card.small { padding: 20px 26px; }
.refer-punch { text-align: center; font-size: 62px; margin-bottom: 8px; }
.refer-title { font-size: 32px; line-height: 1.14; font-weight: 800; text-align: center; margin-bottom: 14px; letter-spacing: -.03em; }
.refer-description { text-align: center; color: var(--muted); font-size: 22px; line-height: 1.3; margin-bottom: 22px; }
.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.app-button {
  width: 100%;
  min-height: 88px;
  border-radius: 26px;
  background: var(--blue);
  color: white;
  font-size: 26px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
}
.app-button.secondary {
  background: linear-gradient(180deg, rgba(20,31,50,.95), rgba(17,26,40,.95));
  color: var(--blue);
  border: 1px solid var(--stroke);
}
.app-button.dark-disabled {
  background: #24416a;
  color: rgba(255,255,255,.35);
}
.app-button.compact { min-height: 82px; }
.app-button .circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.92);
  color: var(--blue);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  line-height: 1;
}

.tariff-label, .section-label {
  text-align: center;
  color: rgba(255,255,255,.4);
  font-size: 24px;
  margin: 28px 0 18px;
}
.section-label.upper { text-transform: uppercase; letter-spacing: .04em; text-align: left; }

.balance-section { text-align: center; padding-top: 20px; }
.balance-section h1 { margin: 0; font-size: 48px; font-weight: 800; letter-spacing: -.03em; }
.balance-value { margin-top: 18px; font-size: 96px; font-weight: 800; letter-spacing: -.08em; color: white; }
.balance-value.negative { color: var(--red); }
.balance-caption { margin-top: 10px; font-size: 22px; color: var(--muted); }
.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 28px; }
.tile-button { padding: 24px 20px; min-height: 140px; color: var(--blue); display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 14px; font-size: 24px; font-weight: 700; text-align: center; }
.tile-button .icon { font-size: 40px; }

.device-card { margin-top: 20px; overflow: hidden; }
.device-card-header { display: flex; align-items: center; justify-content: space-between; padding: 24px 24px 18px; }
.device-card-title { font-size: 26px; line-height: 1.1; }
.device-card-title span { display: block; color: var(--muted); font-size: 20px; margin-top: 8px; }
.device-add { background: rgba(79,141,246,.18); color: var(--blue); border-radius: 999px; padding: 12px 22px; font-weight: 700; font-size: 22px; }
.device-row { border-top: 1px solid var(--stroke); padding: 22px 24px; display: flex; align-items: center; gap: 18px; }
.device-badge { width: 74px; height: 74px; border-radius: 24px; background: var(--blue); display: inline-flex; align-items: center; justify-content: center; font-size: 40px; }
.device-info { flex: 1; min-width: 0; }
.device-name { font-size: 22px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-date { color: var(--muted); font-size: 18px; margin-top: 6px; text-align: right; }

.platforms-card { overflow: hidden; margin-bottom: 20px; }
.platform-row { display: flex; align-items: center; gap: 18px; padding: 24px; font-size: 24px; }
.platform-row + .platform-row { border-top: 1px solid var(--stroke); }
.platform-row .platform-icon { width: 42px; text-align: center; font-size: 34px; }
.platform-row .chevron { margin-left: auto; color: rgba(255,255,255,.38); font-size: 34px; }

.bottom-cta { position: sticky; bottom: 0; padding: 18px 28px calc(18px + env(safe-area-inset-bottom)); background: linear-gradient(180deg, rgba(7,11,20,0), rgba(7,11,20,.82) 34%, rgba(7,11,20,1)); }

.backbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(18px + env(safe-area-inset-top)) 28px 16px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.backbutton { color: var(--blue); font-size: 28px; display: inline-flex; align-items: center; gap: 10px; }
.backbutton .arrow { font-size: 48px; line-height: .75; }

.amount-card { margin-top: 32px; padding: 34px 28px 28px; text-align: center; }
.amount-current { font-size: 92px; font-weight: 800; letter-spacing: -.08em; color: rgba(255,255,255,.55); margin-bottom: 16px; }
.amount-card-title { font-size: 24px; color: var(--muted); margin-bottom: 22px; }
.amount-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; }
.amount-option { border: 1px solid var(--stroke-strong); border-radius: 18px; min-height: 72px; display: flex; align-items: center; justify-content: center; font-size: 24px; font-weight: 700; }
.amount-option.active { border-color: var(--blue); box-shadow: 0 0 0 1px rgba(79,141,246,.25) inset; }
.page-note { margin: auto 28px 18px; text-align: center; color: rgba(255,255,255,.42); font-size: 18px; line-height: 1.25; }

.payment-layout { padding: 30px 28px 0; }
.payment-title { text-align: center; font-size: 54px; font-weight: 800; letter-spacing: -.06em; margin: 12px 0 38px; }
.payment-card { overflow: hidden; }
.payment-option { display: flex; align-items: center; gap: 18px; padding: 24px; font-size: 24px; }
.payment-option + .payment-option { border-top: 1px solid var(--stroke); }
.payment-option.selected { background: rgba(79,141,246,.05); }
.radio { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.24); position: relative; }
.radio.selected { border-color: var(--blue); }
.radio.selected::after { content: ''; position: absolute; inset: 6px; border-radius: 50%; background: var(--blue); }

.center-stack { text-align: center; padding-top: 34px; }
.helper-overline { color: var(--muted); font-size: 26px; margin-bottom: 8px; }
.big-title { font-size: 58px; line-height: 1.08; font-weight: 800; letter-spacing: -.05em; margin: 0 0 28px; }
.select-card { overflow: hidden; margin-top: 24px; }
.select-row { display: flex; align-items: center; gap: 18px; padding: 24px 22px; font-size: 24px; }
.select-row + .select-row { border-top: 1px solid var(--stroke); }
.select-row .option-radio { margin-left: auto; width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.22); }
.select-row.active .option-radio { border-color: rgba(79,141,246,.42); box-shadow: inset 0 0 0 8px #0f1826, 0 0 0 6px rgba(79,141,246,.2); }

.store-card { display: flex; align-items: center; gap: 18px; padding: 20px; margin-top: 24px; }
.store-icon { width: 76px; height: 76px; border-radius: 22px; background: #0b1320; display: flex; align-items: center; justify-content: center; font-size: 38px; }
.store-copy { flex: 1; }
.store-copy strong { display: block; font-size: 22px; }
.store-copy span { display: block; color: var(--muted); margin-top: 6px; font-size: 20px; }
.text-link { color: var(--blue); }
.setup-box { padding: 20px; margin-top: 22px; font-size: 20px; word-break: break-all; color: rgba(255,255,255,.9); }
.copy-button { margin-top: 18px; }
.faq-card { overflow: hidden; margin-top: 18px; }
.faq-header { display: flex; align-items: center; gap: 16px; padding: 20px 22px; font-size: 24px; }
.faq-header .chevron { margin-left: auto; color: rgba(255,255,255,.55); }
.faq-body { border-top: 1px solid var(--stroke); color: var(--muted-strong); padding: 18px 22px 22px; font-size: 18px; line-height: 1.45; }

.loading, .error-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.loading-card, .error-card {
  width: min(100%, 560px);
  padding: 28px;
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(20,31,50,.95), rgba(17,26,40,.95));
  border: 1px solid var(--stroke);
  text-align: center;
  box-shadow: var(--shadow);
}
.loading-spinner {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,.1);
  border-top-color: var(--blue);
  margin: 0 auto 18px;
  animation: spin 1s linear infinite;
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: rgba(16,24,37,.96);
  border: 1px solid var(--stroke);
  border-radius: 18px;
  padding: 14px 18px;
  color: white;
  font-size: 16px;
  box-shadow: var(--shadow);
}

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

@media (max-width: 680px) {
  .page { max-width: 100%; }
  .topbar, .backbar { padding-left: 16px; padding-right: 16px; }
  .content, .payment-layout { padding-left: 16px; padding-right: 16px; }
  .bottom-cta { padding-left: 16px; padding-right: 16px; }
  .hero-brand { font-size: 48px; }
  .hero-title { font-size: 34px; }
  .hero-subtitle { font-size: 18px; }
  .balance-value, .payment-title, .big-title { font-size: 66px; }
  .action-grid, .action-row { grid-template-columns: 1fr; }
  .feature-row, .platform-row, .select-row, .payment-option { font-size: 20px; }
  .refer-title { font-size: 26px; }
  .amount-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
