/* Ensure hidden always wins */
[hidden] {
  display: none !important;
}

/* Tokens / base */
:root {
  --page-max-width: 520px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 12px;
  --shadow-card: 0 10px 28px rgba(17, 31, 44, 0.08);
  --shadow-soft: 0 6px 18px rgba(17, 31, 44, 0.06);
  --border-soft: rgba(17, 31, 44, 0.08);

  --c-bg: #ffffff;
  --c-text: #0b1220;
  --c-hint: #707579;
  --c-primary: #3390ec;
  --c-primary-contrast: #ffffff;
  --c-secondary-bg: #f4f4f5;
}

html, body {
  height: 100%;
  background: var(--c-bg);
}

body {
  margin: 0;
  color: var(--c-text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.van-icon {
  line-height: 1;
}

.app {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background:
    radial-gradient(1200px 520px at 50% -240px, rgba(51, 144, 236, 0.18), transparent 60%),
    linear-gradient(180deg, rgba(51, 144, 236, 0.06), transparent 45%),
    var(--c-bg);
}

.home {
  width: min(var(--page-max-width), calc(100vw - 28px));
  padding: 18px 0 22px;
}

.card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
}

.home-hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.user-card {
  padding: 14px 14px 10px;
}

.user-info {
  display: flex;
  gap: 12px;
  align-items: center;
}

.avatar-wrap {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
  flex: 0 0 auto;
  background: linear-gradient(135deg, rgba(51, 144, 236, 0.18), rgba(51, 144, 236, 0.06));
  border: 1px solid rgba(51, 144, 236, 0.2);
}

.avatar-wrap.is-premium::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 999px;
  background: conic-gradient(from 180deg, #f6d365, #fda085, #a18cd1, #fbc2eb, #f6d365);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
  opacity: 0.85;
  pointer-events: none;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: block;
  background: #fff;
}

.user-meta {
  min-width: 0;
  flex: 1 1 auto;
}

.user-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.user-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
  min-width: 0;
  flex: 1 1 auto;
}

.premium-badge {
  font-size: 14px;
  line-height: 1;
  filter: drop-shadow(0 2px 8px rgba(255, 210, 120, 0.35));
  flex: 0 0 auto;
}

.user-id {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--c-hint);
}

.user-id-label {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(17, 31, 44, 0.06);
  border: 1px solid rgba(17, 31, 44, 0.08);
  color: rgba(17, 31, 44, 0.65);
}

.user-id-value {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  color: var(--c-text);
  opacity: 0.75;
}

.user-actions--inline {
  margin-top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-left: auto;
}

.action-item {
  appearance: none;
  border: 1px solid rgba(17, 31, 44, 0.08);
  background: rgba(17, 31, 44, 0.03);
  border-radius: var(--radius-md);
  padding: 10px 8px;
  display: grid;
  justify-items: center;
  gap: 8px;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.user-actions--inline .action-item {
  padding: 0;
  border-radius: 999px;
  border: none;
  background: none;
  display: block;
  align-items: center;
  gap: 6px;
}

.user-actions--inline .action-item span {
  margin-bottom: 4px;
}

.user-actions--inline .action-icon-wrap {
  width: 26px;
  height: 26px;
  border-radius: 10px;
}

.user-actions--inline .action-label {
  display: inline;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

@media (hover: hover) {
  .action-item:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
    background: rgba(51, 144, 236, 0.06);
    border-color: rgba(51, 144, 236, 0.18);
  }
}

.action-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(51, 144, 236, 0.2), rgba(51, 144, 236, 0.06));
  border: 1px solid rgba(51, 144, 236, 0.18);
}

.action-label {
  font-size: 12px;
  color: rgba(17, 31, 44, 0.75);
  letter-spacing: 0.2px;
}

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

.stat-card {
  padding: 14px 14px;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  right: -40px;
  top: -60px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  opacity: 0.35;
}

.stat-free::before {
  background: radial-gradient(circle at 30% 30%, rgba(51, 144, 236, 0.55), transparent 65%);
}

.stat-balance::before {
  background: radial-gradient(circle at 30% 30%, rgba(255, 159, 67, 0.55), transparent 65%);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 22px rgba(17, 31, 44, 0.12);
}

.stat-icon--blue {
  background: linear-gradient(135deg, #4aa3ff, #2b7cff);
}

.stat-icon--orange {
  background: linear-gradient(135deg, #ffb45e, #ff8f3f);
}

.stat-text {
  min-width: 0;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0.2px;
}

.stat-label {
  margin-top: 4px;
  font-size: 12px;
  color: var(--c-hint);
}

.recharge-btn {
  position: absolute;
  right: 6px;
  bottom: 9px;
  border: 0;
  padding: 7px 8px;
  border-radius: 998px;
  background: rgba(255, 159, 67, 0.18);
  color: #c35a12;
  font-weight: 700;
  font-size: 10px;
  cursor: pointer;
}

.form-card {
  margin-top: 14px;
  padding: 16px 14px;
}

.form-group + .form-group {
  margin-top: 14px;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--c-hint);
  letter-spacing: 0.2px;
}

.input-wrap {
  border-radius: var(--radius-md);
  background: rgba(17, 31, 44, 0.03);
  border: 1px solid rgba(17, 31, 44, 0.08);
  padding: 10px 12px;
  display: flex;
  align-items: center;
}

.input-wrap.is-disabled {
  opacity: 0.55;
}

.form-input {
  width: 100%;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--c-text);
}

.form-input::placeholder {
  color: rgba(112, 117, 121, 0.9);
}

.pay-options {
  display: grid;
  gap: 10px;
}

.pay-option {
  display: grid;
  grid-template-columns: 18px 38px 1fr 22px;
  gap: 10px;
  align-items: center;
  padding: 12px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(17, 31, 44, 0.08);
  background: rgba(17, 31, 44, 0.03);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.pay-option.active {
  border-color: rgba(51, 144, 236, 0.35);
  background: rgba(51, 144, 236, 0.06);
  box-shadow: var(--shadow-soft);
}

.pay-radio {
  width: 18px;
  height: 18px;
  accent-color: var(--c-primary);
}

.pay-icon {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 20px rgba(17, 31, 44, 0.1);
}

.pay-icon--blue {
  background: linear-gradient(135deg, #4aa3ff, #2b7cff);
}

.pay-icon--orange {
  background: linear-gradient(135deg, #ffb45e, #ff8f3f);
}

.pay-title {
  font-weight: 800;
  font-size: 14px;
  line-height: 1.1;
}

.pay-desc {
  margin-top: 4px;
  font-size: 12px;
  color: var(--c-hint);
}

.pay-check .van-icon-success {
  color: #2ecc71;
  font-size: 18px;
}

.submit-btn {
  margin-top: 16px;
  width: 100%;
  border: 0;
  border-radius: 16px;
  padding: 13px 14px;
  font-size: 15px;
  font-weight: 800;
  color: var(--c-primary-contrast);
  background: linear-gradient(135deg, #3a7afe, #2b7cff);
  box-shadow: 0 14px 28px rgba(51, 144, 236, 0.28);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.submit-btn--ghost {
  background: rgba(51, 144, 236, 0.08);
  color: var(--c-primary);
  box-shadow: none;
}

@media (hover: hover) {
  .submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 36px rgba(51, 144, 236, 0.32);
  }
  .submit-btn--ghost:hover {
    box-shadow: none;
  }
}

.submit-btn:active {
  transform: translateY(0);
}

.page[hidden] {
  display: none !important;
}

.page-header {
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  padding: 6px 6px;
}

.page-back {
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: var(--c-text);
  border-radius: 12px;
  cursor: pointer;
}

.page-title {
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.page-header-spacer {
  width: 40px;
  height: 40px;
}

.recharge-card {
  margin-top: 10px;
  padding: 14px;
}

.orders-card {
  margin-top: 10px;
  padding: 14px;
}

.orders-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.tab {
  border: 1px solid rgba(17, 31, 44, 0.1);
  background: rgba(17, 31, 44, 0.03);
  border-radius: 14px;
  padding: 10px 10px;
  font-weight: 900;
  cursor: pointer;
  color: rgba(17, 31, 44, 0.85);
}

.tab.is-active {
  border-color: rgba(51, 144, 236, 0.35);
  background: rgba(51, 144, 236, 0.08);
  color: var(--c-primary);
}

.orders-list {
  margin-top: 12px;
  display: grid;
  gap: 10px;
}

.order-item {
  padding: 12px;
  border-radius: 16px;
  background: rgba(17, 31, 44, 0.03);
  border: 1px solid rgba(17, 31, 44, 0.08);
}

.order-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
}

.order-title {
  font-weight: 1000;
}

.order-status {
  font-size: 12px;
  font-weight: 900;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(17, 31, 44, 0.1);
  background: rgba(17, 31, 44, 0.03);
}

.order-status.is-processing {
  border-color: rgba(255, 159, 67, 0.3);
  background: rgba(255, 159, 67, 0.12);
  color: #c35a12;
}

.order-status.is-done {
  border-color: rgba(46, 204, 113, 0.3);
  background: rgba(46, 204, 113, 0.12);
  color: #1e9b51;
}

.order-meta {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 13px;
  color: rgba(17, 31, 44, 0.75);
}

.order-time {
  margin-top: 8px;
  font-size: 12px;
  color: var(--c-hint);
}

.orders-empty {
  padding: 22px 12px;
  text-align: center;
  border-radius: 16px;
  background: rgba(17, 31, 44, 0.03);
  border: 1px solid rgba(17, 31, 44, 0.08);
}

.orders-empty-title {
  font-weight: 1000;
}

.orders-empty-desc {
  margin-top: 6px;
  font-size: 12px;
  color: var(--c-hint);
}

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

.amount-chip {
  border: 1px solid rgba(17, 31, 44, 0.1);
  background: rgba(17, 31, 44, 0.03);
  border-radius: 14px;
  padding: 10px 10px;
  font-weight: 800;
  cursor: pointer;
}

.amount-chip.is-active {
  border-color: rgba(51, 144, 236, 0.35);
  background: rgba(51, 144, 236, 0.08);
}

.recharge-summary {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(17, 31, 44, 0.03);
  border: 1px solid rgba(17, 31, 44, 0.08);
}

.recharge-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: rgba(17, 31, 44, 0.75);
}

.recharge-summary-row + .recharge-summary-row {
  margin-top: 8px;
}

.recharge-summary-row strong {
  color: var(--c-text);
}

.recharge-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--c-hint);
  text-align: center;
}

.recharge-info-block {
  padding: 12px;
  border-radius: 14px;
  background: rgba(17, 31, 44, 0.03);
  border: 1px solid rgba(17, 31, 44, 0.08);
}

.recharge-info-label {
  font-size: 12px;
  color: var(--c-hint);
  margin-bottom: 6px;
}

.recharge-info-value {
  font-size: 13px;
  font-weight: 800;
  word-break: break-all;
  color: var(--c-text);
}

.recharge-info-amount {
  font-size: 22px;
  font-weight: 900;
  color: var(--c-primary);
}

.modal[hidden] {
  display: none !important;
  pointer-events: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 14px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(4px);
}

.modal-sheet {
  position: relative;
  width: min(var(--page-max-width), calc(100vw - 20px));
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(17, 31, 44, 0.12);
  box-shadow: 0 18px 48px rgba(17, 31, 44, 0.22);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(17, 31, 44, 0.08);
}

.modal-title {
  font-weight: 900;
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  border: 1px solid rgba(17, 31, 44, 0.1);
  background: rgba(17, 31, 44, 0.03);
  cursor: pointer;
}

.modal-body {
  padding: 14px;
}

.invite-card {
  padding: 12px;
  border-radius: 16px;
  background: rgba(17, 31, 44, 0.03);
  border: 1px solid rgba(17, 31, 44, 0.08);
}

.invite-row {
  display: grid;
  grid-template-columns: 84px 1fr auto;
  gap: 10px;
  align-items: center;
}

.invite-label {
  font-size: 12px;
  color: var(--c-hint);
}

.invite-value {
  font-size: 13px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-btn {
  border: 1px solid rgba(51, 144, 236, 0.22);
  background: rgba(51, 144, 236, 0.08);
  color: var(--c-primary);
  border-radius: 12px;
  padding: 8px 10px;
  font-weight: 800;
  cursor: pointer;
}

.invite-actions {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.invite-tip {
  margin-top: 10px;
  font-size: 12px;
  color: var(--c-hint);
  text-align: center;
}

.cs-card {
  padding: 20px 16px;
  border-radius: 16px;
  background: rgba(17, 31, 44, 0.03);
  border: 1px solid rgba(17, 31, 44, 0.08);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.cs-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(51, 144, 236, 0.15), rgba(51, 144, 236, 0.05));
  border: 2px solid rgba(51, 144, 236, 0.2);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}

.cs-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--c-text);
}

.cs-handle {
  font-size: 14px;
  color: var(--c-primary);
  font-weight: 700;
}

.cs-tip {
  font-size: 12px;
  color: var(--c-hint);
  text-align: center;
  margin-top: 4px;
}

.cs-btn {
  margin-top: 8px;
  text-align: center;
  text-decoration: none;
  display: block;
}

/* ── Success Modal ──────────────────────────────── */

.success-modal {
  padding: 8px 4px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.success-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(56, 161, 105, 0.12), rgba(56, 161, 105, 0.04));
  border: 2px solid rgba(56, 161, 105, 0.2);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}

.success-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--c-text);
}

.success-desc {
  font-size: 13px;
  color: var(--c-hint);
  text-align: center;
  line-height: 1.5;
}

/* ── Error Modal ────────────────────────────────── */

.error-modal {
  padding: 8px 4px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.error-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(229, 62, 62, 0.12), rgba(229, 62, 62, 0.04));
  border: 2px solid rgba(229, 62, 62, 0.2);
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}

.error-title {
  font-size: 20px;
  font-weight: 900;
  color: var(--c-text);
}

.error-desc {
  font-size: 13px;
  color: var(--c-hint);
  text-align: center;
  line-height: 1.5;
}
