:root {
  color-scheme: dark;
  --bg: #0c0e12;
  --text: #f4f6f8;
  --hint: #8d97a6;
  --link: #9ebfff;
  --btn: #3c83f6;
  --btn-text: #ffffff;
  --secondary: #171c24;
  --line: rgba(255, 255, 255, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: #0c0e12;
  color: var(--text);
}

body {
  max-width: 480px;
  margin: 0 auto;
}

button, input {
  font: inherit;
  color: inherit;
}

header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.notices {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(0, 0, 0, 0.55);
}

.notices[hidden] {
  display: none;
}

.notice {
  display: block;
  width: min(100%, 320px);
  padding: 16px 18px;
  border-radius: 16px;
  background: #1b212b;
  border: 1px solid rgba(230, 170, 40, 0.7);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  font-size: 16px;
}

.notice strong {
  display: block;
  font-weight: 700;
}

.notice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  font-size: 14px;
}

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

.notice-row span:last-child {
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.notice.ok {
  background: rgba(46, 160, 90, 0.2);
  border-color: rgba(46, 160, 90, 0.7);
}

.notice.fail {
  background: rgba(220, 70, 70, 0.2);
  border-color: rgba(220, 70, 70, 0.7);
}

.avatar {
  position: relative;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  background: #242b36;
}

.avatar img,
.avatar span {
  position: absolute;
  inset: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar span {
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
}

.avatar img[hidden],
.avatar span[hidden] {
  display: none;
}

.hello {
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.balance {
  border: 0;
  background: var(--secondary);
  border-radius: 999px;
  padding: 8px 12px;
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}

.devbar {
  margin: 0;
  padding: 8px 16px;
  background: #3d3416;
  color: #ffe7a3;
  font-size: 13px;
}

main {
  padding: 16px 16px calc(108px + env(safe-area-inset-bottom));
}

h1 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.sub {
  margin: 0 0 16px;
  color: var(--hint);
  font-size: 14px;
  line-height: 1.4;
}

.banner {
  position: relative;
  overflow: hidden;
  height: 148px;
  margin: 0 0 14px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: #171c24;
  touch-action: pan-y;
}

.banner-track {
  display: flex;
  height: 100%;
  transition: transform 0.55s cubic-bezier(0.22, 0.8, 0.3, 1);
}

.banner-slide {
  position: relative;
  flex: 0 0 100%;
  height: 100%;
  overflow: hidden;
  border: 0;
  padding: 18px 18px 34px;
  text-align: left;
  color: #f7f8fa;
  cursor: pointer;
}

.banner-slide::before {
  content: "";
  position: absolute;
  width: 190px;
  height: 190px;
  right: -36px;
  top: -58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  animation: banner-drift 5.5s ease-in-out infinite alternate;
}

.banner-kicker,
.banner-title,
.banner-note {
  position: relative;
  display: block;
}

.banner-kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.86;
}

.banner-title {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.banner-note {
  margin-top: 6px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.86);
}

.slide-stream { background: linear-gradient(120deg, #3a1020 0%, #8b1e3f 58%, #c45c2a 100%); }
.slide-design { background: linear-gradient(120deg, #171238 0%, #3d2b92 55%, #6d4ad4 100%); }
.slide-topup { background: linear-gradient(120deg, #06243f 0%, #0d4d8c 55%, #1b7cd6 100%); }
.slide-codes { background: linear-gradient(120deg, #2a2108 0%, #6b4c12 52%, #c4922a 100%); }

.banner-dots {
  position: absolute;
  left: 16px;
  bottom: 12px;
  display: flex;
  gap: 6px;
  z-index: 1;
}

.banner-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.42);
  cursor: pointer;
  transition: width 0.55s cubic-bezier(0.22, 0.8, 0.3, 1), background-color 0.55s ease;
}

.banner-dot.on {
  width: 18px;
  background: #fff;
}

@keyframes banner-drift {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-16px, 14px, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .banner-track { transition: none; }
  .banner-slide::before { animation: none; }
  .banner-dot { transition: none; }
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tile, .card, .order, .pack {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--secondary);
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
}

.tile { min-height: 96px; }

.tile-emoji, .product-emoji { font-size: 26px; display: block; }

.tile-label, .product-name, .order-title {
  display: block;
  margin-top: 8px;
  font-weight: 650;
}

.stack { display: flex; flex-direction: column; gap: 10px; }

.offers { align-items: stretch; }

.offer {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  text-align: center;
}

.offer img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #10141b;
}

.offer .product-name {
  margin: 0;
  padding: 10px 12px 12px;
  font-size: 14px;
  line-height: 1.25;
  text-align: center;
}

.stars-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 28px;
  text-align: center;
}

.title-emoji {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.stars-lead {
  margin: 10px 0 28px;
  color: #8e98a8;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  text-align: center;
}

.recipient-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
}

.recipient-label {
  font-size: 16px;
  font-weight: 750;
}

.buy-self {
  border: 0;
  background: transparent;
  padding: 0;
  color: #4c9dff;
  font-size: 16px;
  font-weight: 650;
  cursor: pointer;
}

.username-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  margin: 0;
  padding: 8px 14px;
  border-radius: 16px;
  background: #1b212b;
}

.username-field svg {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: #8e98a8;
  stroke-width: 2;
  stroke-linecap: round;
}

.username-field input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 0;
  background: transparent;
  border-radius: 0;
  font-size: 16px;
}

.username-field input:focus { box-shadow: none; }

.username-field input::placeholder { color: #8e98a8; }

.username-field.picked { padding-right: 8px; }

.account-photo {
  position: relative;
  width: 36px;
  height: 36px;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  background: #242b36;
}

.account-photo img,
.account-photo span {
  position: absolute;
  inset: 0;
}

.account-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-photo span {
  display: grid;
  place-items: center;
  font-weight: 700;
}

.account-photo img[hidden],
.account-photo span[hidden] {
  display: none;
}

.account-name {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 650;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clear-recipient {
  width: 36px;
  height: 36px;
  flex: none;
  border: 0;
  background: transparent;
  color: #8e98a8;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.star-grid { margin-top: 12px; }

.star-pack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 76px;
  padding: 14px 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--secondary);
  text-align: center;
  cursor: pointer;
}

.star-pack.on {
  border-color: var(--btn);
  box-shadow: inset 0 0 0 1px var(--btn);
}

.star-pack:disabled,
.primary.star-topup:disabled {
  opacity: 0.4;
  cursor: default;
}

.star-amount {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.03em;
}

.star-price {
  color: var(--link);
  font-size: 13px;
  font-weight: 650;
}

.primary.star-topup { margin-top: 28px; }

.account-miss {
  margin: 4px 0 0;
  color: var(--hint);
  font-size: 13px;
}

.product-row, .order, .pack {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-row .grow, .order .grow, .pack .grow { flex: 1; min-width: 0; }

.price {
  font-variant-numeric: tabular-nums;
  color: var(--link);
  font-weight: 650;
}

.meta, .hint { color: var(--hint); font-size: 13px; }

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  background: rgba(128, 128, 128, 0.2);
}

.badge.ok { background: rgba(46, 160, 90, 0.22); }
.badge.fail { background: rgba(220, 70, 70, 0.22); }
.badge.wait { background: rgba(230, 170, 40, 0.22); }

.primary, .ghost {
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 700;
}

.primary {
  display: block;
  width: 100%;
  margin: 0;
  background: var(--btn);
  color: var(--btn-text);
}

form[data-form="deposit"].has-result .primary {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

form[data-form="deposit"].has-result + #deposit-result .card {
  margin-top: 0;
  border-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

#deposit-result .card.ok {
  background: rgba(46, 160, 90, 0.2);
  border-color: rgba(46, 160, 90, 0.7);
}

#deposit-result .card.fail {
  background: rgba(220, 70, 70, 0.2);
  border-color: rgba(220, 70, 70, 0.7);
}

.primary:disabled {
  opacity: 0.45;
  cursor: default;
}

.ghost {
  background: var(--secondary);
}

.chips { display: flex; gap: 8px; margin: 8px 0 14px; }

.chips button {
  border: 0;
  background: var(--secondary);
  border-radius: 999px;
  padding: 8px 12px;
  cursor: pointer;
}

.slip {
  position: relative;
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 132px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 16px;
  background: var(--secondary);
  color: var(--hint);
  text-align: center;
  cursor: pointer;
  overflow: hidden;
}

.slip input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

.slip input:focus { box-shadow: none; }

.slip:focus-within { box-shadow: 0 0 0 2px var(--btn); }

.slip.has-photo {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.slip img {
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
}

.pay-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--secondary);
}

.pay-kicker {
  color: var(--hint);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pay-name { font-size: 18px; letter-spacing: -0.02em; }

.pay-method { color: var(--hint); font-size: 14px; }

.pay-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 6px;
}

.pay-phone {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.pay-row .ghost {
  width: auto;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
}

.slip img[hidden] { display: none; }

.slip-label, #slip-label { font-size: 14px; font-weight: 650; }

label { display: block; margin-bottom: 12px; font-size: 14px; }

label[hidden] { display: none; }

input {
  display: block;
  width: 100%;
  margin-top: 6px;
  border: 0;
  border-radius: 12px;
  padding: 14px;
  background: var(--secondary);
  outline: none;
}

input:focus { box-shadow: 0 0 0 2px var(--btn); }

.secret {
  background: var(--secondary);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 10px;
}

.secret .k {
  display: block;
  color: var(--hint);
  font-size: 12px;
  margin-bottom: 4px;
}

code {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15px;
  word-break: break-all;
  margin-bottom: 10px;
}

.empty {
  padding: 28px 8px;
  color: var(--hint);
  text-align: center;
}

.receipt-hero {
  text-align: center;
  padding: 18px 8px 22px;
}

.receipt-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
}

.receipt-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.receipt-badge.wait { color: #f0c14a; background: rgba(230, 170, 40, 0.16); }
.receipt-badge.ok { color: #5dce86; background: rgba(46, 160, 90, 0.18); }
.receipt-badge.fail { color: #ff8d8d; background: rgba(220, 70, 70, 0.18); }

.receipt h1 {
  margin: 14px 0 4px;
  font-size: 32px;
  letter-spacing: -0.04em;
}

.receipt-price {
  margin: 0;
  color: var(--hint);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.receipt-sheet {
  background: var(--secondary);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
}

.receipt-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 16px;
  border-top: 1px solid var(--line);
}

.receipt-row:first-child { border-top: 0; }

.receipt-row span {
  color: var(--hint);
  font-size: 14px;
}

.receipt-row strong {
  font-weight: 650;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.receipt .secret,
.receipt .note { margin-top: 12px; }

.note {
  margin-top: 12px;
  color: var(--hint);
  font-size: 13px;
  line-height: 1.45;
}

nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(480px, 100%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--secondary);
  border-top: 1px solid var(--line);
}

nav button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: 0;
  background: transparent;
  border-radius: 12px;
  padding: 6px 0 4px;
  color: var(--hint);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}

nav button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

nav button.active {
  background: var(--bg);
  color: var(--text);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  background: var(--text);
  color: var(--bg);
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 650;
}
