:root {
  --green: #1f8a70;
  --green-soft: #f0fdf7;
  --ink: #101827;
  --muted: #697586;
  --line: #e4e7ec;
  --bg: #f5f7fa;
  --gold: #f3b620;
  --gold-bg: #fffbf0;
  --gold-line: #f4dea0;
  --card: #ffffff;
  --shadow: 0 18px 50px rgba(16, 24, 39, 0.18);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #e8edf3;
  color: var(--ink);
}

button,
input {
  font: inherit;
}

.page {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px 20px;
}

.muted {
  color: var(--muted);
  line-height: 1.5;
}

.phone-wrap {
  display: flex;
  justify-content: center;
  height: 100%;
}

.phone {
  width: min(100%, 390px);
  height: min(760px, 100%);
  background: var(--bg);
  border-radius: 40px;
  border: 10px solid #1a2230;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.screen {
  flex: 1;
  min-height: 0;
  padding: 16px 20px 22px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#screen-intro {
  overflow-y: auto;
}

.hidden {
  display: none !important;
}

.brand-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 10px 0 18px;
}

.mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--green);
  color: #fff;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.mark-img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  background: #101827;
}

.brand {
  margin: 0;
  color: var(--green);
  font-weight: 800;
  letter-spacing: 0.3px;
}

.sim-brand {
  color: var(--ink);
}

h2 {
  margin: 0 0 8px;
  font-size: 28px;
}

.stack-cards {
  display: grid;
  gap: 10px;
  margin: 20px 0 24px;
}

.mini-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mini-card span {
  color: var(--muted);
  font-size: 14px;
}

.btn {
  border: 0;
  border-radius: 16px;
  min-height: 56px;
  padding: 0 18px;
  font-weight: 800;
  cursor: pointer;
  width: 100%;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn.primary {
  background: var(--ink);
  color: #fff;
}

.btn.ghost {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  margin-top: 10px;
}

#btn-pay + .btn.ghost {
  min-height: 48px;
}

.tiny {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.tiny.center {
  text-align: center;
}

.pay-card {
  background: #fff;
  border-radius: 24px;
  padding: 20px;
  margin: 18px 0 20px;
  border: 1px solid var(--line);
}

.pay-amount {
  margin: 4px 0 14px;
  font-size: 32px;
  font-weight: 800;
}

.pay-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.label {
  margin: 0;
  font-size: 11px;
  letter-spacing: 1.1px;
  font-weight: 800;
  color: var(--muted);
}

.label.light {
  color: rgba(255, 255, 255, 0.7);
}

.label.gold {
  color: #9a6700;
}

.app-screen {
  padding-bottom: 0;
}

.ghost-btn {
  border: 0;
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
  color: var(--ink);
}

.tab-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-anchor: none;
  padding-bottom: 108px;
  animation: fade 0.25s ease;
}

#team-tree {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.balance-card {
  background: linear-gradient(135deg, #101827, #17483e);
  color: #fff;
  border-radius: 28px;
  padding: 22px;
  box-shadow: 0 14px 24px rgba(16, 24, 39, 0.22);
}

.balance-card.compact {
  padding: 18px;
}

.balance {
  margin: 8px 0 0;
  font-size: 30px;
  font-weight: 800;
}

.total-earn {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 12px;
  font-weight: 600;
}

.balance.pop {
  animation: pop 0.45s ease;
}

.balance-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 18px;
  gap: 12px;
}

.meta-val {
  margin: 4px 0 0;
  font-weight: 700;
}

.pill {
  background: #b8f7cb;
  color: #0d3026;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 800;
}

.withdraw-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: #b8f7cb;
  color: #0d3026;
  border-radius: 14px;
  padding: 12px 15px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
}

.withdraw-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.withdraw-btn.wide {
  width: 100%;
  justify-content: center;
  margin-top: 16px;
  min-height: 52px;
  border-radius: 15px;
}

.sticky-wallet {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--bg);
  padding-bottom: 12px;
}

.bonus-card {
  background: var(--gold-bg);
  border: 1px solid var(--gold-line);
  border-radius: 24px;
  padding: 18px;
}

.bonus-title {
  margin: 4px 0 14px;
  font-weight: 800;
}

.slots {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.slot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff0c7;
  border: 1px solid #f7d77d;
}

.slot.on {
  background: #ffc857;
  border-color: #ffc857;
}

.bar {
  height: 9px;
  background: #ffe9ae;
  border-radius: 20px;
  overflow: hidden;
  margin: 16px 0 10px;
}

.bar span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gold);
  border-radius: 20px;
  transition: width 0.35s ease;
}

.bonus-copy {
  margin: 0;
  color: #5a4a19;
  font-weight: 700;
  font-size: 14px;
}

#screen-multi {
  overflow-y: auto;
}

#screen-multi .field {
  margin: 10px 0 0;
}

.multi-preview {
  background: var(--green-soft);
  border-radius: 16px;
  padding: 12px 14px;
  margin: 16px 0 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 72px;
}

.multi-preview div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.multi-preview b {
  color: var(--ink);
}

.multi-preview .placeholder {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}

.sketch-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 4px;
  border-top: 1px solid var(--line);
  font-weight: 700;
}

.sketch-row span {
  font-size: 13px;
}

.multi-preview .multi-total {
  padding-top: 8px;
  border-top: 1px solid #d1fae5;
  font-size: 15px;
  color: var(--ink);
}

.multi-preview .multi-total b {
  color: var(--green);
  font-size: 16px;
}

#screen-multi .btn.primary {
  margin-top: 12px;
}

.section-title {
  margin: 0;
  font-weight: 800;
}

.tight {
  margin: -6px 0 0;
  font-size: 14px;
}

.network {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 20px 12px;
  text-align: center;
}

.network-label {
  margin: 0 0 16px;
  font-size: 11px;
  font-weight: 800;
  color: #98a2b3;
  letter-spacing: 1px;
}

.person {
  border: 0;
  background: transparent;
  width: 110px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0;
  font: inherit;
  color: var(--ink);
}

.person.compact {
  width: 96px;
}

.person strong {
  font-size: 13px;
  font-weight: 800;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.person small {
  font-size: 10px;
  font-weight: 700;
}

.avatar-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  padding: 4px;
  border-radius: 50%;
  box-sizing: border-box;
}

.person.compact .avatar-wrap {
  width: 52px;
  height: 52px;
}

.avatar {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
  font-size: 16px;
  display: grid;
  place-items: center;
}

.person.compact .avatar {
  font-size: 13px;
}

.avatar-badge {
  position: absolute;
  top: -4px;
  right: -6px;
  min-width: 18px;
  padding: 2px 6px;
  border-radius: 10px;
  background: #101827;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  border: 2px solid #fff;
}

.person.just-in .avatar-wrap {
  animation: pop 0.45s ease;
}

.level-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.level-tag {
  margin: 4px 0 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
}

.level-row {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 12px;
  width: 100%;
  overflow-x: auto;
  overflow-anchor: none;
  padding: 0 8px 10px;
  -webkit-overflow-scrolling: touch;
}

.level-row .person {
  flex: 0 0 auto;
}

.stem {
  width: 2px;
  height: 14px;
  background: #d0d5dd;
  display: block;
}

.team-empty {
  text-align: center;
  padding: 28px 8px 12px;
}

.empty-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 22px;
  background: var(--green-soft);
  display: grid;
  place-items: center;
}

.empty-icon svg {
  width: 34px;
  height: 34px;
  fill: var(--green);
}

.team-empty h3 {
  margin: 0 0 8px;
  font-size: 22px;
}

.team-empty p {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.4;
}

.txns {
  display: grid;
  gap: 8px;
}

.txn {
  background: #fff;
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
}

.txn b {
  color: var(--green);
}

.txn b.down {
  color: #b42318;
}

.tabbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  background: #101827;
  border: 0;
  border-radius: 0;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  padding: 8px 6px calc(12px + env(safe-area-inset-bottom));
  box-shadow: none;
}

.tab {
  border: 0;
  background: transparent;
  min-height: 58px;
  padding: 4px 0 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #aeb8c8;
  cursor: pointer;
  border-radius: 20px;
  box-shadow: none;
}

.tab-icon {
  width: 64px;
  height: 32px;
  border-radius: 16px;
  display: grid;
  place-items: center;
}

.tab-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  display: block;
}

.tab.on {
  color: #ffffff;
  background: transparent;
  box-shadow: none;
}

.tab.on .tab-icon {
  background: #1f8a70;
}

.toast {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 96px;
  background: #0d3026;
  color: #b8f7cb;
  border-radius: 16px;
  padding: 12px 14px;
  font-weight: 800;
  text-align: center;
  z-index: 9;
  box-shadow: var(--shadow);
}

.sheet {
  position: absolute;
  inset: 0;
  z-index: 12;
  background: rgba(16, 24, 39, 0.4);
  display: flex;
  align-items: flex-end;
}

.sheet-card {
  width: 100%;
  max-height: 92%;
  overflow-y: auto;
  background: var(--bg);
  border-radius: 28px 28px 0 0;
  padding: 12px 20px 28px;
}

.sheet-handle {
  width: 40px;
  height: 4px;
  border-radius: 4px;
  background: #d0d5dd;
  margin: 4px auto 14px;
}

.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.sheet-head h2 {
  margin: 0;
  font-size: 22px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 14px 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.field input {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  background: #fff;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 800;
  cursor: pointer;
}

.fee-card {
  background: #f0fdf7;
  border: 1px solid #b7e4c7;
  border-radius: 20px;
  padding: 16px;
}

.fee-card.dimmed {
  opacity: 0.55;
}

.fee-card > p {
  margin: 0 0 12px;
  color: #17694f;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.4;
}

.fee-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 600;
}

.fee-row b {
  color: var(--ink);
}

.fee-row.receive {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #d1e7dd;
  color: var(--ink);
  font-weight: 800;
}

.fee-row.receive b {
  font-size: 16px;
}

.wd-error {
  margin: 12px 0 0;
  color: #b42318;
  font-weight: 700;
  font-size: 13px;
}

@keyframes pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.06);
  }
  100% {
    transform: scale(1);
  }
}

@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 860px) {
  .page {
    padding: 0;
  }

  .phone-wrap,
  .phone {
    width: 100%;
    height: 100%;
    min-height: 0;
    border-width: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (display-mode: standalone) {
  html,
  body {
    background: var(--bg);
  }

  .page {
    padding: 0;
  }

  .phone-wrap,
  .phone {
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .balance.pop,
  .tab-panel {
    animation: none;
  }
}
