@import url('./base.css');

:root {
  --battery-purple: #8b5cf6;
  --battery-purple-deep: #5e1781;
  --battery-purple-soft: rgba(139, 92, 246, 0.12);
  --battery-pink: #ff8bcb;
  --battery-ink-soft: #666666;
  --bs-wallet-surface: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 244, 255, 0.96) 100%);
  --bs-wallet-border: rgba(139, 92, 246, 0.14);
  --bs-wallet-text: #1f1f1f;
  --bs-wallet-amount: #1f1f1f;
  --bs-surface-strong: rgba(255, 255, 255, 0.96);
  --bs-product-amount: #1f1f1f;
}

body.shell-body {
  min-height: 100dvh;
  background: var(--mp-wallpaper-bg);
  color: var(--text-color);
  font-family: var(--font-family);
}

.shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}

.shell--store {
  padding-top: 0;
}

.shell-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: calc(44px + env(safe-area-inset-top));
  margin: 0 -16px 12px;
  padding: env(safe-area-inset-top) 16px 0;
  background: color-mix(in srgb, var(--mp-surface-bg) 88%, transparent);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--mp-color-border);
}

.shell-nav__back {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-width: 64px;
  height: 44px;
  margin: 0;
  padding: 0 4px 0 0;
  border: 0;
  background: transparent;
  color: var(--text-color);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.shell-nav__back:active {
  opacity: 0.55;
}

.shell-nav__back-icon {
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
}

.shell-nav__back-label {
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}

.shell-nav__back--placeholder {
  visibility: hidden;
  pointer-events: none;
}

.shell-nav__title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shell-nav__right {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-width: 64px;
  min-height: 44px;
}

.shell-nav__action {
  color: var(--battery-purple-deep);
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.shell-nav__action--button {
  border: 0;
  background: transparent;
  padding: 0;
  cursor: pointer;
  color: var(--text-color);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.shell-nav__action--button:active {
  opacity: 0.55;
}

.shell-header {
  padding: 8px 0 16px;
}

.shell-header h1 {
  font-size: 22px;
  font-weight: 800;
}

.shell-header p {
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 14px;
}

.shell-card {
  background: var(--mp-surface-bg);
  border: 1px solid var(--mp-color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--mp-card-shadow);
  padding: 16px;
  margin-bottom: 12px;
}

.shell-card--flat {
  border-color: rgba(139, 92, 246, 0.12);
  box-shadow: 0 6px 20px rgba(109, 72, 217, 0.06);
}

.balance-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.balance-row strong {
  font-size: 28px;
  font-weight: 900;
}

.wallet-card {
  position: relative;
  overflow: hidden;
  padding: 14px 16px 13px;
  margin-bottom: 18px;
  border-radius: 22px;
  color: var(--bs-wallet-text);
  background: var(--bs-wallet-surface);
  border: 1px solid var(--bs-wallet-border);
  box-shadow: 0 12px 30px rgba(109, 72, 217, 0.1);
}

.wallet-line {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  margin: 0;
}

.wallet-line--primary {
  gap: 7px;
}

.wallet-line--secondary {
  gap: 5px;
  margin-top: 6px;
  padding-left: 2px;
  color: var(--battery-ink-soft);
  font-size: 13px;
  font-weight: 600;
}

.battery-mark {
  position: relative;
  display: inline-flex;
  width: 22px;
  height: 13px;
  border: 1.5px solid currentColor;
  border-radius: 5px;
  color: var(--battery-purple);
  background: var(--battery-purple-soft);
}

.battery-mark::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -4px;
  width: 2px;
  height: 6px;
  border-radius: 0 3px 3px 0;
  background: currentColor;
  transform: translateY(-50%);
}

.battery-mark-fill {
  position: absolute;
  left: 2px;
  top: 2px;
  bottom: 2px;
  width: 70%;
  border-radius: 2px;
  background: currentColor;
}

.wallet-amount {
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--bs-wallet-amount);
}

.wallet-unit {
  color: var(--text-color);
  font-size: 14px;
  font-weight: 700;
}

.wallet-secondary-value {
  color: var(--battery-purple-deep);
  font-size: 14px;
  font-weight: 700;
}

.battery-pack-section {
  flex: 1;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 14px;
}

.product-grid > .store-empty {
  grid-column: 1 / -1;
}

.store-empty {
  color: var(--text-secondary);
  font-size: 14px;
  text-align: center;
  padding: 24px 0;
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  padding: 18px 15px 16px;
  border: 1px solid rgba(139, 92, 246, 0.14);
  border-radius: 20px;
  background: var(--bs-surface-strong);
  box-shadow: 0 6px 20px rgba(109, 72, 217, 0.06);
}

.product-card:not(.is-voice-card) {
  min-height: 152px;
}

.product-card:not(.is-voice-card) .product-sku-line {
  flex: 1 1 auto;
  margin-top: 4px;
}

.product-card.is-voice-card {
  grid-column: 1 / -1;
  gap: 0;
  padding: 19px 17px;
}

.product-promo {
  align-self: center;
  max-width: 100%;
  margin: 0;
  padding: 5px 11px;
  border-radius: var(--radius-full);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  color: var(--battery-purple-deep);
  background: rgba(139, 92, 246, 0.1);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.product-sku-line {
  display: flex;
  align-items: baseline;
  justify-content: center;
  flex-wrap: wrap;
  gap: 5px 7px;
  margin: 0;
  text-align: center;
}

.product-amount {
  color: var(--bs-product-amount);
  font-size: 28px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.03em;
}

.product-unit {
  color: var(--battery-ink-soft);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
}

.product-icon {
  display: inline-block;
  flex: 0 0 auto;
  align-self: center;
}

.product-icon--battery {
  width: 18px;
  height: 11px;
  border: 1.5px solid var(--battery-purple);
  border-radius: 4px;
  background: var(--battery-purple-soft);
  position: relative;
}

.product-icon--battery::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -3px;
  width: 2px;
  height: 5px;
  border-radius: 0 2px 2px 0;
  background: var(--battery-purple);
  transform: translateY(-50%);
}

.product-icon--voice {
  width: 18px;
  height: 13px;
  border: 1.5px solid var(--battery-purple);
  border-radius: 3px;
  background: linear-gradient(135deg, rgba(255, 139, 203, 0.25), rgba(139, 92, 246, 0.18));
}

.product-voice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.product-voice-copy {
  min-width: 0;
  flex: 1;
}

.product-voice-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--bs-product-amount);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.product-voice-hint {
  margin: 6px 0 0;
  color: var(--battery-ink-soft);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}

.product-voice-copy .product-promo {
  align-self: flex-start;
  margin-top: 6px;
}

.product-price-cta {
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius-full);
  padding: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--battery-pink) 0%, var(--battery-purple) 100%);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--transition-fast), filter var(--transition-fast);
}

.product-price-cta--compact {
  width: auto;
  flex: 0 0 auto;
  min-width: 100px;
  padding: 11px 16px;
}

.product-price-cta:active:not(:disabled) {
  transform: scale(0.99);
  filter: brightness(0.96);
}

.product-price-cta:disabled {
  opacity: 0.55;
  cursor: wait;
}

.store-support-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 14px 2px 0;
  color: var(--battery-purple-deep);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
  text-align: center;
}

.store-support-note button {
  border: 0;
  border-radius: var(--radius-full);
  padding: 3px 8px;
  background: rgba(139, 92, 246, 0.1);
  color: var(--battery-purple-deep);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.store-support-note button:active {
  transform: scale(0.94);
}

.shell-float-toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  max-width: 448px;
  margin: 0 auto;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  z-index: 30;
  box-shadow: var(--mp-card-shadow);
  background: rgba(30, 30, 30, 0.92);
  color: #fff;
}

.shell-float-toast[hidden] {
  display: none !important;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.field label {
  font-size: 13px;
  color: var(--text-secondary);
}

.field input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--mp-color-border);
  border-radius: var(--radius-md);
  padding: 0 14px;
  font-size: 16px;
}

.btn-primary,
.btn-secondary,
.btn-wechat {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: var(--radius-full);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.btn-primary {
  background: var(--app-primary);
  color: var(--mp-color-on-primary);
  box-shadow: var(--mp-action-primary-shadow);
}

.btn-secondary {
  background: #fff;
  color: var(--text-color);
  border: 1px solid var(--mp-color-border);
}

.btn-wechat {
  background: #07c160;
  color: #fff;
}

.btn-pay {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: var(--radius-full);
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, var(--battery-pink) 0%, var(--battery-purple) 100%);
  box-shadow: 0 12px 26px rgba(139, 92, 246, 0.2);
}

.btn-pay:active:not(:disabled) {
  transform: scale(0.99);
  filter: brightness(0.96);
}

.btn-pay:disabled {
  opacity: 0.55;
  cursor: wait;
}

.result-hero {
  margin-bottom: 12px;
}

.result-hero__title {
  margin: 0;
  font-size: 24px;
  font-weight: 900;
}

.result-hero__desc {
  margin: 8px 0 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.45;
}

.shell-actions {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding-top: 16px;
}

.error-banner {
  background: #fff1f0;
  color: #cf1322;
  border: 1px solid #ffa39e;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 12px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--mp-color-divider);
  font-size: 14px;
}

.info-row:last-child {
  border-bottom: 0;
}

.info-row span:last-child {
  font-weight: 700;
  text-align: right;
  word-break: break-all;
}

.ledger-item {
  padding: 12px 0;
  border-bottom: 1px solid var(--mp-color-divider);
}

.ledger-item:last-child {
  border-bottom: 0;
}

.ledger-item__title {
  font-weight: 800;
}

.ledger-item__meta {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 13px;
}

.link-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.link-row a {
  color: var(--accent-romantic);
  font-size: 14px;
  font-weight: 700;
}

.tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tab {
  flex: 1;
  min-height: 40px;
  border-radius: var(--radius-full);
  border: 1px solid var(--mp-color-border);
  background: #fff;
  font-weight: 700;
}

.tab.is-active {
  background: var(--app-primary);
  border-color: transparent;
}

/* ── Auth（对标 App 登录） ── */
.auth-body .auth-shell {
  padding-top: calc(24px + env(safe-area-inset-top));
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.auth-brand-icon {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  box-shadow: var(--mp-card-shadow);
}

.auth-title {
  font-size: 24px;
  font-weight: 900;
}

.auth-view {
  flex: 1;
  flex-direction: column;
}

.auth-view:not([hidden]) {
  display: flex;
}

.auth-view[hidden],
.sheet-mask[hidden] {
  display: none !important;
}

.auth-card {
  width: 100%;
}

.auth-back {
  align-self: flex-start;
  border: 0;
  background: transparent;
  color: var(--text-color);
  font-size: 32px;
  line-height: 1;
  font-weight: 300;
  margin: 0 0 12px;
  padding: 0;
  cursor: pointer;
}

.auth-headline {
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 8px;
}

.auth-hint {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.phone-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  border: 1px solid var(--mp-color-border);
  border-radius: var(--radius-md);
  padding: 0 14px;
  background: #fff;
  margin-bottom: 16px;
}

.phone-prefix {
  color: var(--text-color);
  font-weight: 800;
  flex-shrink: 0;
}

.phone-field input {
  flex: 1;
  border: 0;
  min-height: 48px;
  font-size: 17px;
  outline: none;
  background: transparent;
}

.phone-clear {
  border: 0;
  background: rgba(0, 0, 0, 0.06);
  width: 24px;
  height: 24px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.auth-methods {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 32px;
}

.method-btn {
  width: 48px;
  height: 48px;
  border-radius: 999px;
  border: 1px solid var(--mp-color-border);
  background: #fff;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}

.code-hidden-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  height: 1px;
}

.code-boxes {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  margin-bottom: 20px;
  cursor: text;
}

.code-box {
  aspect-ratio: 1;
  border: 1px solid var(--mp-color-border);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 900;
  background: #fff;
}

.code-box.is-filled,
.code-box.is-active {
  border-color: var(--app-primary);
}

.code-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
}

.text-link {
  border: 0;
  background: transparent;
  color: var(--accent-romantic);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.text-link:disabled {
  color: var(--text-tertiary);
  cursor: default;
}

.auth-toast {
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 12px;
}

.auth-toast--error {
  background: #fff1f0;
  color: #cf1322;
  border: 1px solid #ffa39e;
}

.auth-toast--info {
  background: #f6ffed;
  color: #389e0d;
  border: 1px solid #b7eb8f;
}

.auth-toast--dev {
  background: #fffbe6;
  color: #ad6800;
  border: 1px solid #ffe58f;
}

.auth-float-toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  max-width: 448px;
  margin: 0 auto;
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  z-index: 30;
  box-shadow: var(--mp-card-shadow);
}

.auth-float-toast--error {
  background: rgba(30, 30, 30, 0.92);
  color: #fff;
}

.auth-float-toast--dev {
  background: rgba(255, 251, 230, 0.96);
  color: #ad6800;
  border: 1px solid #ffe58f;
}

.sheet-mask:not([hidden]) {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
}

.sheet-panel {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 20px 20px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
}

.sheet-option {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--mp-page-muted-bg);
  font-size: 16px;
  font-weight: 700;
  margin-top: 10px;
  cursor: pointer;
}

.sheet-option--muted {
  background: transparent;
  color: var(--text-secondary);
}
