/* =========================================================
   Image2 · 液态玻璃设计系统（浅色）
   ========================================================= */
:root {
  --bg: #eef1fa;
  --ink: #14162a;
  --ink-2: #5c6484;
  --ink-3: #8b93ad;
  --brand: #6a72ff;
  --brand-2: #a06bff;
  --brand-3: #35c8ff;
  --warm: #ff9166;
  --ok: #16b981;
  --danger: #ff5c72;
  --glass: rgba(255, 255, 255, 0.58);
  --glass-2: rgba(255, 255, 255, 0.78);
  --glass-3: rgba(255, 255, 255, 0.92);
  --stroke: rgba(255, 255, 255, 0.85);
  --stroke-soft: rgba(255, 255, 255, 0.55);
  --shadow-lg: 0 24px 60px -28px rgba(60, 70, 150, 0.42), 0 2px 8px rgba(60, 70, 150, 0.06);
  --shadow-md: 0 12px 32px -18px rgba(60, 70, 150, 0.38);
  --shadow-sm: 0 4px 14px -8px rgba(60, 70, 150, 0.4);
  --r-lg: 26px;
  --r-md: 18px;
  --r-sm: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --sat: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro SC", "PingFang SC", "HarmonyOS Sans SC",
    "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  font-size: 15px;
  line-height: 1.55;
}

/* ---------------- 背景：流体光斑 ---------------- */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 8% 0%, #faf8ff 0%, transparent 58%),
    radial-gradient(90% 70% at 95% 5%, #f5fcff 0%, transparent 52%),
    radial-gradient(100% 90% at 50% 100%, #fffaf7 0%, transparent 62%),
    linear-gradient(170deg, #fbfcff 0%, #f4f6fc 48%, #fbf8ff 100%);
}
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(66px);
  opacity: 0.3;
  will-change: transform;
}
.blob.b1 {
  width: 46vmax; height: 46vmax;
  left: -12vmax; top: -14vmax;
  background: radial-gradient(circle at 35% 35%, #dcd8ff, #b9b0ff 62%, transparent 74%);
  animation: float1 26s var(--ease) infinite alternate;
}
.blob.b2 {
  width: 40vmax; height: 40vmax;
  right: -14vmax; top: -8vmax;
  background: radial-gradient(circle at 60% 40%, #dcf4ff, #a9e4ff 62%, transparent 74%);
  opacity: 0.34;
  animation: float2 32s var(--ease) infinite alternate;
}
.blob.b3 {
  width: 42vmax; height: 42vmax;
  left: 22vmax; bottom: -22vmax;
  background: radial-gradient(circle at 50% 50%, #ffe8da, #ffcbb0 58%, transparent 72%);
  opacity: 0.26;
  animation: float3 38s var(--ease) infinite alternate;
}
.blob.b4 {
  width: 26vmax; height: 26vmax;
  right: 8vmax; bottom: 4vmax;
  background: radial-gradient(circle at 50% 50%, #e2fff2, #b6f5d8 62%, transparent 74%);
  opacity: 0.2;
  animation: float2 44s var(--ease) infinite alternate-reverse;
}
@keyframes float1 {
  0% { transform: translate3d(0,0,0) scale(1) rotate(0deg); }
  50% { transform: translate3d(6vmax, 5vmax, 0) scale(1.09) rotate(20deg); }
  100% { transform: translate3d(-3vmax, 9vmax, 0) scale(0.96) rotate(-12deg); }
}
@keyframes float2 {
  0% { transform: translate3d(0,0,0) scale(1); }
  50% { transform: translate3d(-7vmax, 7vmax, 0) scale(1.12); }
  100% { transform: translate3d(4vmax, -5vmax, 0) scale(1.02); }
}
@keyframes float3 {
  0% { transform: translate3d(0,0,0) scale(1); }
  100% { transform: translate3d(-9vmax, -7vmax, 0) scale(1.14); }
}
.bg-noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.02;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ---------------- 玻璃 ---------------- */
.glass {
  position: relative;
  background: linear-gradient(155deg, rgba(255,255,255,0.76) 0%, rgba(255,255,255,0.46) 100%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.9), inset 0 -1px 0 rgba(255,255,255,0.35);
}
.glass-strong {
  background: linear-gradient(155deg, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0.72) 100%);
  -webkit-backdrop-filter: blur(30px) saturate(190%);
  backdrop-filter: blur(30px) saturate(190%);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.95);
}
/* 玻璃高光扫过 */
.sheen::after {
  content: "";
  position: absolute;
  inset: -40% -60%;
  background: linear-gradient(115deg, transparent 38%, rgba(255,255,255,0.55) 48%, transparent 60%);
  transform: translateX(-60%) rotate(2deg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.sheen:hover::after {
  opacity: 1;
  animation: sheen 1.1s var(--ease);
}
@keyframes sheen {
  0% { transform: translateX(-70%) rotate(2deg); }
  100% { transform: translateX(70%) rotate(2deg); }
}

/* ---------------- 按钮 ---------------- */
button, .btn {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 20px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.2px;
  transition: transform 0.22s var(--ease-spring), box-shadow 0.28s var(--ease), filter 0.2s;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}
.btn:active { transform: scale(0.955); }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 55%, #6fd0ff 120%);
  background-size: 180% 180%;
  box-shadow: 0 12px 26px -12px rgba(106, 114, 255, 0.85), inset 0 1px 0 rgba(255,255,255,0.4);
  animation: gradShift 8s ease infinite;
}
@keyframes gradShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.btn-primary:hover { filter: brightness(1.04); box-shadow: 0 18px 34px -14px rgba(106,114,255,0.9); }
.btn-ghost {
  background: rgba(255,255,255,0.62);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.9);
  color: var(--ink);
}
.btn-ghost:hover { background: rgba(255,255,255,0.85); transform: translateY(-1px); }
.btn-ghost:active { transform: scale(0.96); }
.btn-sm { height: 38px; padding: 0 14px; font-size: 13.5px; }
.btn-danger { color: #fff; background: linear-gradient(135deg, #ff7a8a, #ff5c72); box-shadow: 0 10px 22px -12px rgba(255,92,114,0.9); }

.icon-btn {
  width: 42px; height: 42px;
  border-radius: 14px;
  display: inline-grid;
  place-items: center;
  color: var(--ink-2);
  background: rgba(255,255,255,0.5);
  border: 1px solid var(--stroke-soft);
  transition: transform 0.2s var(--ease-spring), background 0.2s, color 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.9); color: var(--brand); }
.icon-btn:active { transform: scale(0.9); }

/* 波纹 */
.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255,255,255,0.55);
  animation: ripple 0.62s var(--ease) forwards;
  pointer-events: none;
}
@keyframes ripple {
  to { transform: scale(3.2); opacity: 0; }
}

/* ---------------- 表单 ---------------- */
.field { position: relative; margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 7px;
  letter-spacing: 0.3px;
}
.input {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border-radius: 15px;
  border: 1px solid rgba(255,255,255,0.9);
  background: rgba(255,255,255,0.62);
  box-shadow: inset 0 1px 2px rgba(70,80,150,0.06);
  font: inherit;
  color: var(--ink);
  transition: box-shadow 0.25s var(--ease), background 0.25s, border-color 0.25s, transform 0.25s;
  outline: none;
  -webkit-appearance: none;
}
.input::placeholder { color: var(--ink-3); }
.input:focus {
  background: #fff;
  border-color: rgba(122,132,255,0.55);
  box-shadow: 0 0 0 4px rgba(122,132,255,0.16), inset 0 1px 2px rgba(70,80,150,0.04);
  transform: translateY(-1px);
}
.input:disabled { opacity: 0.6; }

/* ---------------- 布局骨架 ---------------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  height: calc(64px + var(--sat));
  padding: var(--sat) 14px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 0 0 22px 22px;
  border-top: none;
  transition: box-shadow 0.3s;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; letter-spacing: -0.3px; font-size: 17px; }
.logo {
  width: 32px; height: 32px;
  border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand), var(--brand-2) 60%, var(--brand-3));
  box-shadow: 0 8px 18px -8px rgba(106,114,255,0.9), inset 0 1px 0 rgba(255,255,255,0.5);
  color: #fff;
  font-size: 16px;
  animation: logoPop 0.7s var(--ease-spring);
}
@keyframes logoPop {
  0% { transform: scale(0.5) rotate(-20deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.spacer { flex: 1; }

.balance-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 14.5px;
  color: #5b4bd6;
  background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(240,238,255,0.8));
  border: 1px solid rgba(255,255,255,0.95);
  box-shadow: var(--shadow-sm), inset 0 1px 0 #fff;
  transition: transform 0.25s var(--ease-spring);
}
.balance-chip:active { transform: scale(0.95); }
.balance-chip.bump { animation: bump 0.6s var(--ease-spring); }
@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.14); }
  100% { transform: scale(1); }
}
.balance-chip .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--brand-3));
  box-shadow: 0 0 0 0 rgba(106,114,255,0.5);
  animation: pulseDot 2.4s infinite;
}
@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(106,114,255,0.45); }
  70% { box-shadow: 0 0 0 8px rgba(106,114,255,0); }
  100% { box-shadow: 0 0 0 0 rgba(106,114,255,0); }
}

/* ---------------- 通用动效 ---------------- */
.enter-up { animation: enterUp 0.55s var(--ease) both; }
@keyframes enterUp {
  from { opacity: 0; transform: translateY(16px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.enter-fade { animation: enterFade 0.45s ease both; }
@keyframes enterFade { from { opacity: 0; } to { opacity: 1; } }
.stagger > * { animation: enterUp 0.5s var(--ease) both; }
.stagger > *:nth-child(1) { animation-delay: 0.03s; }
.stagger > *:nth-child(2) { animation-delay: 0.07s; }
.stagger > *:nth-child(3) { animation-delay: 0.11s; }
.stagger > *:nth-child(4) { animation-delay: 0.15s; }
.stagger > *:nth-child(5) { animation-delay: 0.19s; }
.stagger > *:nth-child(6) { animation-delay: 0.23s; }

.skeleton {
  background: linear-gradient(100deg, rgba(255,255,255,0.35) 30%, rgba(255,255,255,0.85) 50%, rgba(255,255,255,0.35) 70%);
  background-size: 220% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: 10px;
}
@keyframes shimmer {
  0% { background-position: 140% 0; }
  100% { background-position: -40% 0; }
}

/* ---------------- 提示 / 弹层 ---------------- */
#toasts {
  position: fixed;
  left: 50%;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
  width: min(92vw, 420px);
}
.toast {
  width: 100%;
  padding: 13px 18px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: rgba(255,255,255,0.86);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.95);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 0.45s var(--ease-spring);
}
.toast.out { animation: toastOut 0.32s ease forwards; }
.toast.err { color: #b3132c; }
.toast.ok { color: #067a58; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(22px) scale(0.94); }
  to { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(10px) scale(0.96); }
}

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 150;
  background: rgba(28, 32, 60, 0.28);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 18px;
  animation: enterFade 0.28s ease;
}
.modal {
  width: min(480px, 100%);
  border-radius: var(--r-lg);
  padding: 22px;
  animation: modalIn 0.44s var(--ease-spring);
  max-height: 86vh;
  overflow: auto;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(24px) scale(0.94); }
  to { opacity: 1; transform: none; }
}
.modal h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: -0.3px; }
.modal p.sub { margin: 0 0 18px; color: var(--ink-2); font-size: 13.5px; }

/* 底部抽屉（移动端） */
.sheet-mask {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(28,32,60,0.24);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: enterFade 0.25s ease;
}
.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 151;
  padding: 20px 18px calc(24px + env(safe-area-inset-bottom, 0px));
  border-radius: 26px 26px 0 0;
  animation: sheetIn 0.42s var(--ease);
  max-height: 82vh;
  overflow: auto;
}
@keyframes sheetIn {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(120,130,180,0.22); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: rgba(120,130,180,0.38); }
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
