:root {
  color-scheme: dark;
  --bg: #050b16; --surface: #101b2e; --field: #091322;
  --line: rgba(151,180,222,.12); --line-strong: rgba(112,157,224,.26);
  --text: #f3f7ff; --muted: #a2b1ca; --faint: #71829f;
  --blue-bright: #63b2ff; --blue-soft: rgba(52,124,244,.14);
  --star: #ffc84a; --danger: #ff7188; --success: #5dd6ad;
  --r-xl: 23px; --nav-h: 78px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { color-scheme: dark; background: var(--bg); }
body {
  min-height: 100vh; min-height: 100dvh; overflow-x: hidden; position: relative;
  color: var(--text); background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
button, input { color: inherit; font: inherit; }
button { border: 0; background: none; cursor: pointer; }
a { color: inherit; }

.bg-effects { position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: radial-gradient(ellipse 760px 520px at 50% -18%, rgba(31,83,158,.19), transparent 72%),
              linear-gradient(180deg, #071020 0%, #050b16 50%, #030711 100%); }
.bg-effects::before { content: ""; position: absolute; inset: 0; opacity: .12;
  background-image: radial-gradient(rgba(178,204,245,.16) .65px, transparent .9px);
  background-size: 28px 28px; }

.app { width: 100%; max-width: 500px; margin: 0 auto; position: relative; z-index: 1;
  padding: max(12px, env(safe-area-inset-top)) 17px calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 28px); }
.screen { display: none; }
.screen.active { display: block; animation: enter .4s cubic-bezier(.2,.65,.25,1) both; }
@keyframes enter { from { opacity: 0; transform: translate3d(0,9px,0); } to { opacity: 1; transform: none; } }

.topbar-centered { min-height: 66px; display: flex; align-items: center; justify-content: center; margin: 0 0 9px; }
.logo-img { height: 48px; width: auto; max-width: 220px; object-fit: contain; display: block; }
.page-title { margin: 0 0 19px; text-align: center; color: var(--text); font-size: 24px; font-weight: 780; letter-spacing: -.75px; }

.card, .profile-head, .stat, .ref-stat, .history-card, .hero-stat, .ref-hero {
  background: linear-gradient(150deg, rgba(20,34,57,.96), rgba(14,26,45,.97));
  border: 1px solid var(--line); border-radius: var(--r-xl);
  box-shadow: 0 8px 24px rgba(0,0,0,.22);
}
.card { padding: 16px; margin-bottom: 11px; }
.field-label { display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin-bottom: 10px; color: var(--text); font-size: 13px; font-weight: 720; }
.field-label span:last-child { color: var(--faint); font-size: 11px; font-weight: 600; }

.input-box { display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 13px;
  background: var(--field); border: 1px solid var(--line); border-radius: 14px;
  transition: border-color .3s, background .3s, box-shadow .3s; }
.input-box:focus-within { border-color: rgba(99,178,255,.58); box-shadow: 0 0 0 3px rgba(52,124,244,.10); }
.input-box.error { border-color: rgba(255,113,136,.7); }
.input-box .prefix { color: var(--muted); font-size: 16px; font-weight: 700; }
.input-box input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0;
  background: transparent; color: var(--text); font-size: 16px; font-weight: 620; }
input::placeholder { color: var(--faint); font-weight: 500; opacity: .85; }
.amount-box { height: 62px; padding: 0 14px; }
.amount-box input { font-size: 26px; font-weight: 800; letter-spacing: -.8px; }
.amount-sum { color: var(--muted); font-size: 13px; font-weight: 700; white-space: nowrap; }
.star-ico { width: 24px; height: 24px; object-fit: contain; flex: none; }
.input-hint { margin: 8px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.rate-hint { margin-top: 12px; text-align: center; color: var(--muted); font-size: 12px; }
.rate-hint b { color: var(--blue-bright); font-weight: 750; }

.recipient-avatar { width: 26px; height: 26px; border-radius: 50%; background: #172943;
  color: #a8c9f4; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0; overflow: hidden; }
.recipient-avatar img { width: 100%; height: 100%; object-fit: cover; }

.product-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 5px;
  margin: 0 0 14px; border: 1px solid var(--line); border-radius: 16px;
  background: rgba(12,23,40,.92); }
.product-tab { min-height: 43px; padding: 7px 10px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: var(--muted); font-size: 13px; font-weight: 720; transition: all .3s; }
.tab-ico { width: 18px; height: 18px; object-fit: contain; }
.product-tab.active { color: #fff; background: linear-gradient(110deg, #2868d7, #368ff4); }

.packs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.pack { min-height: 68px; padding: 10px 5px 9px; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
  text-align: center; background: rgba(24,41,67,.78); border: 1px solid var(--line);
  color: var(--text); transition: all .3s; }
.pack:active { transform: scale(.96); }
.pack .p-amount { display: inline-flex; align-items: center; gap: 5px; font-size: 15px; font-weight: 800; }
.pack-star { width: 14px; height: 14px; object-fit: contain; }
.pack .p-price { color: var(--muted); font-size: 11px; font-weight: 600; }
.pack.selected { background: linear-gradient(145deg, rgba(52,124,244,.22), rgba(31,70,126,.24));
  border-color: rgba(99,178,255,.64); }
.pack.selected .p-price { color: var(--blue-bright); }

.summary-card { padding: 14px 16px 15px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 5px 0; font-size: 13px; }
.row span:first-child { color: var(--muted); }
.row span:last-child { color: var(--text); font-weight: 680; text-align: right; }
.row.total { margin-top: 6px; padding-top: 13px; border-top: 1px solid var(--line); }
.row.total span:first-child { color: var(--text); font-weight: 720; }
.row.total span:last-child { color: var(--blue-bright); font-size: 25px; font-weight: 820; }

.form-error { min-height: 16px; margin: 1px 0 8px; text-align: center;
  color: var(--danger); font-size: 12px; font-weight: 620; }

.cta { width: 100%; min-height: 54px; padding: 0 16px; border-radius: 15px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  color: #fff; background: linear-gradient(110deg, #2868d7, #347cf4, #48a4ff);
  border: 1px solid rgba(140,194,255,.28); box-shadow: 0 8px 22px rgba(43,113,224,.22);
  font-size: 14px; font-weight: 780; transition: all .3s; }
.cta:active { transform: scale(.985); }
.cta[aria-disabled="true"] { opacity: .52; box-shadow: none; cursor: not-allowed; }

.footer { display: flex; flex-direction: column; align-items: center; gap: 9px;
  margin-top: 21px; padding: 12px 8px 0; }
.footer-docs { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; }
.footer-docs a { color: var(--faint); font-size: 11px; text-decoration: none; }
.support-link { color: var(--muted); font-size: 12px; font-weight: 620; text-decoration: none; }
.footer .copyright { color: #64748e; font-size: 11px; }

.profile-head { display: flex; align-items: center; gap: 14px; padding: 16px; margin-bottom: 10px; }
.avatar { width: 60px; height: 60px; border-radius: 18px; overflow: hidden;
  display: grid; place-items: center; color: #e6f1ff;
  background: linear-gradient(145deg, #316bc2, #1a3d72); font-size: 24px; font-weight: 780; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.who .name { font-size: 18px; font-weight: 760; }
.who .uname { margin-top: 3px; color: var(--muted); font-size: 13px; }
.id-chip { display: inline-flex; align-items: center; gap: 6px; margin-top: 7px;
  padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px;
  color: var(--muted); background: rgba(25,41,66,.82); font-size: 11px; }
.id-chip b { color: var(--text); }

.hero-stat { position: relative; padding: 20px 18px 18px; margin-bottom: 10px; }
.hs-label { color: var(--muted); font-size: 12px; }
.hs-value { display: flex; align-items: center; gap: 8px; margin-top: 8px;
  color: var(--text); font-size: 36px; font-weight: 820; }
.hero-star { width: 26px; height: 26px; object-fit: contain; }
.hs-sub { margin-top: 6px; color: var(--faint); font-size: 12px; }

.history-card { padding: 15px 16px 6px; }
.history-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.history-head h3 { font-size: 15px; font-weight: 780; }
.history-list { list-style: none; }
.history-item { display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-top: 1px solid var(--line); }
.history-item:first-child { border-top: 0; }
.hi-icon { width: 35px; height: 35px; border-radius: 11px;
  display: grid; place-items: center; background: rgba(25,42,68,.92); border: 1px solid var(--line); }
.hi-star { width: 18px; height: 18px; object-fit: contain; }
.hi-body { flex: 1; min-width: 0; }
.hi-title { font-size: 13px; font-weight: 700; }
.hi-sub { margin-top: 2px; color: var(--faint); font-size: 11px; }
.hi-amount { font-size: 13px; font-weight: 780; }
.hi-amount.pos { color: var(--success); }
.history-empty { padding: 26px 0; color: var(--faint); font-size: 13px; text-align: center; }

.ref-hero { position: relative; padding: 20px 18px; margin-bottom: 10px; }
.rh-label { color: var(--muted); font-size: 12px; }
.rh-value { margin-top: 8px; color: var(--text); font-size: 36px; font-weight: 820; }
.rh-sub { margin-top: 7px; color: var(--muted); font-size: 12px; }
.ref-link { display: flex; align-items: center; gap: 9px; margin-top: 16px;
  padding: 8px 9px 8px 12px; border: 1px solid var(--line-strong);
  border-radius: 13px; background: rgba(7,17,32,.55); }
.ref-link span { flex: 1; min-width: 0; overflow: hidden; color: #c6d8f5;
  font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid rgba(99,178,255,.28); border-radius: 10px;
  color: var(--blue-bright); background: rgba(52,124,244,.12); }
.ref-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 13px; }
.ref-actions .cta { min-height: 47px; font-size: 12px; }
.ref-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.ref-stat { padding: 13px 14px; }
.rs-label { color: var(--muted); font-size: 12px; }
.rs-value { margin-top: 5px; color: var(--blue-bright); font-size: 20px; font-weight: 800; }
.ref-list-card { padding: 15px 16px 6px; }
.ref-list-head { display: flex; justify-content: space-between; margin-bottom: 10px; }
.ref-list-head h3 { font-size: 15px; font-weight: 780; }
.ref-list-head span { padding: 3px 7px; border-radius: 99px; color: var(--blue-bright);
  background: var(--blue-soft); font-size: 11px; font-weight: 700; }
.ref-list { list-style: none; }
.ref-item { display: flex; align-items: center; gap: 11px;
  padding: 11px 0; border-top: 1px solid var(--line); }
.ref-item:first-child { border-top: 0; }
.ref-avatar { width: 36px; height: 36px; border-radius: 12px; overflow: hidden;
  display: grid; place-items: center; color: #dceaff;
  background: linear-gradient(145deg, #315f9e, #1b3459); font-size: 14px; font-weight: 760; }
.ref-body { flex: 1; min-width: 0; }
.ref-title { font-size: 13px; font-weight: 700; }
.ref-sub { margin-top: 2px; color: var(--faint); font-size: 11px; }
.ref-amount { color: var(--success); font-size: 12px; font-weight: 750; }

.bottom-nav { position: fixed; z-index: 10; left: 50%; bottom: 0;
  width: min(500px, 100%); transform: translateX(-50%);
  padding: 7px 0 max(7px, env(safe-area-inset-bottom, 0px));
  background: rgba(5,11,22,.94); border: 1px solid rgba(125,160,211,.13);
  border-bottom: 0; border-radius: 22px 22px 0 0;
  box-shadow: 0 -10px 34px rgba(0,0,0,.24);
  backdrop-filter: blur(14px) saturate(125%); }
.nav-inner { height: 58px; padding: 0 12px; display: grid;
  grid-template-columns: repeat(3, 1fr); gap: 6px; }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; border-radius: 13px; color: #7d8da8; font-size: 10px; font-weight: 650; }
.nav-item svg { width: 20px; height: 20px; fill: none; stroke: currentColor;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item.active { color: #8dc5ff; background: rgba(52,124,244,.13); }

.toast { position: fixed; z-index: 20; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 13px);
  max-width: calc(100% - 32px); padding: 11px 15px; border-radius: 12px;
  color: #f3f7ff; background: rgba(19,32,53,.97); border: 1px solid var(--line-strong);
  font-size: 13px; font-weight: 620; text-align: center;
  opacity: 0; pointer-events: none; transform: translate(-50%, 9px);
  transition: opacity .3s, transform .3s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.modal { position: fixed; inset: 0; z-index: 30; display: none;
  align-items: center; justify-content: center; padding: 18px;
  background: rgba(3,7,15,.74); backdrop-filter: blur(6px); }
.modal.open { display: flex; }
.modal-sheet { position: relative; width: 100%; max-width: 440px;
  max-height: calc(100dvh - 36px); overflow-y: auto; padding: 24px 20px 20px;
  border-radius: 23px; color: var(--text);
  background: linear-gradient(155deg, #172640, #101c30 72%);
  border: 1px solid rgba(140,176,231,.18); box-shadow: 0 24px 70px rgba(0,0,0,.52); }
.modal-close { position: absolute; top: 13px; right: 13px; width: 34px; height: 34px;
  display: grid; place-items: center; border-radius: 11px; color: #a9c8f4;
  background: rgba(52,124,244,.12); border: 1px solid rgba(99,178,255,.20); font-size: 23px; }
.modal-title { margin-bottom: 6px; font-size: 19px; font-weight: 800; }
.modal-sub { margin-bottom: 16px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.pay-summary { padding: 10px 14px; margin-bottom: 14px; border-radius: 14px;
  background: rgba(7,16,30,.56); border: 1px solid var(--line); }
.pay-summary .row { font-size: 12.5px; }
.pay-summary .row.total { padding-top: 10px; margin-top: 6px; border-top: 1px solid var(--line); }
.pay-summary .row.total span:last-child { font-size: 20px; }
.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 4px; }
.method-btn { min-height: 100px; padding: 10px; border-radius: 15px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px;
  color: var(--muted); background: rgba(24,41,67,.72); border: 1px solid var(--line);
  font-size: 13px; font-weight: 680; transition: all .3s; }
.method-ico { width: 40px; height: 40px; object-fit: contain; }
.method-btn.selected { color: #eaf4ff; background: linear-gradient(145deg, rgba(52,124,244,.21), rgba(27,61,108,.30));
  border-color: rgba(99,178,255,.58); }
.modal-actions { margin-top: 14px; }

@media (max-width: 380px) {
  .app { padding-left: 13px; padding-right: 13px; }
  .card { padding: 14px; }
  .packs { gap: 7px; }
  .pack .p-amount { font-size: 14px; }
  .pack .p-price { font-size: 10px; }
  .hs-value { font-size: 30px; }
  .rh-value { font-size: 30px; }
}