/* =====================================================================
   PayGate · iOS 26 Liquid Glass 设计系统
   玻璃折射 / 弹簧物理动效 / 视差 / 触觉反馈
   ===================================================================== */

:root {
  --ios-blue: #0a84ff;
  --ios-green: #30d158;
  --ios-mint: #63e6be;
  --ios-cyan: #64d2ff;
  --ios-purple: #bf5af2;
  --ios-pink: #ff375f;
  --ios-orange: #ff9f0a;
  --ios-yellow: #ffd60a;

  --ink: #0b0b0f;
  --ink-2: #1c1c22;
  --ink-3: #2c2c34;
  --paper: #f7f7fa;
  --text: #0b0b0f;
  --text-2: #6b6b76;
  --text-3: #9a9aa5;

  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-bg-dark: rgba(28, 28, 34, 0.55);
  --glass-border: rgba(255, 255, 255, 0.68);
  --glass-border-dark: rgba(255, 255, 255, 0.12);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.10), 0 1px 2px rgba(0, 0, 0, 0.04);
  --glass-shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.06);

  --blur: 28px;
  --sat: 190%;

  --r-xs: 10px;
  --r-sm: 14px;
  --r-md: 20px;
  --r-lg: 28px;
  --r-xl: 36px;
  --r-pill: 999px;

  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --spring-soft: cubic-bezier(0.22, 1.2, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
               "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  position: relative;
}

/* ---------------- 动态背景：三团流光 ---------------- */
.aurora {
  position: fixed;
  inset: -30vmax;
  z-index: -2;
  pointer-events: none;
  filter: blur(90px) saturate(150%);
  opacity: 0.85;
  background:
    radial-gradient(38vmax 38vmax at 22% 18%, rgba(48, 209, 88, 0.42), transparent 62%),
    radial-gradient(34vmax 34vmax at 82% 26%, rgba(10, 132, 255, 0.40), transparent 64%),
    radial-gradient(40vmax 40vmax at 52% 88%, rgba(191, 90, 242, 0.34), transparent 66%),
    radial-gradient(30vmax 30vmax at 8% 78%, rgba(100, 210, 255, 0.32), transparent 64%);
  animation: aurora-drift 26s var(--ease-in-out) infinite alternate;
}

body.dark .aurora { opacity: 0.42; }

@keyframes aurora-drift {
  0%   { transform: translate3d(-2%, -1%, 0) scale(1.04) rotate(0deg); }
  50%  { transform: translate3d(3%, 2%, 0) scale(1.12) rotate(4deg); }
  100% { transform: translate3d(-1%, 3%, 0) scale(1.06) rotate(-3deg); }
}

/* 细颗粒噪点，让玻璃更有质感 */
.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.28;
  mix-blend-mode: overlay;
  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)' opacity='0.5'/%3E%3C/svg%3E");
}

/* ---------------- 玻璃基类 ---------------- */
.glass {
  position: relative;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  backdrop-filter: blur(var(--blur)) saturate(var(--sat));
  border: 0.5px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
  border-radius: var(--r-lg);
  overflow: hidden;
  isolation: isolate;
}

/* 玻璃顶部的折射高光 */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.55) 0%,
    rgba(255, 255, 255, 0.14) 26%,
    rgba(255, 255, 255, 0) 52%,
    rgba(255, 255, 255, 0.10) 100%
  );
  opacity: 0.9;
  z-index: 1;
}

/* 内描边 */
.glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow:
    inset 0 0.5px 0 rgba(255, 255, 255, 0.85),
    inset 0 -0.5px 0 rgba(255, 255, 255, 0.22);
  z-index: 2;
}

.glass > * { position: relative; z-index: 3; }

body.dark .glass {
  background: var(--glass-bg-dark);
  border-color: var(--glass-border-dark);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

/* ---------------- 按钮 ---------------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  padding: 14px 26px;
  border-radius: var(--r-pill);
  color: #fff;
  background: var(--ios-blue);
  text-decoration: none;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.32s var(--spring), box-shadow 0.32s var(--ease-out),
              filter 0.24s var(--ease-out);
  will-change: transform;
  -webkit-user-select: none;
  user-select: none;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%),
              rgba(255,255,255,0.55), transparent 58%);
  opacity: 0;
  transition: opacity 0.35s var(--ease-out);
  z-index: -1;
}

.btn:hover::after { opacity: 0.85; }
.btn:hover { transform: translateY(-1.5px) scale(1.015); filter: brightness(1.06); }
.btn:active { transform: scale(0.955); transition-duration: 0.08s; }
.btn:focus-visible { outline: 3px solid rgba(10,132,255,0.5); outline-offset: 3px; }

.btn.green  { background: linear-gradient(180deg, #3ee06b, #22b954); box-shadow: 0 8px 22px rgba(34,185,84,0.38); }
.btn.blue   { background: linear-gradient(180deg, #3d9bff, #0a6cff); box-shadow: 0 8px 22px rgba(10,108,255,0.36); }
.btn.dark   { background: linear-gradient(180deg, #3a3a44, #16161b); box-shadow: 0 8px 22px rgba(0,0,0,0.30); }
.btn.ghost  {
  background: rgba(255,255,255,0.42);
  color: var(--text);
  border: 0.5px solid rgba(255,255,255,0.7);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  backdrop-filter: blur(18px) saturate(180%);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}

.btn.block { width: 100%; display: flex; }

/* 光泽扫过 */
.btn.sheen::before {
  content: "";
  position: absolute;
  top: 0; left: -120%;
  width: 55%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,0.55), transparent);
  transform: skewX(-18deg);
  animation: sheen 3.6s var(--ease-in-out) infinite;
  z-index: 1;
  pointer-events: none;
}
@keyframes sheen {
  0%, 62% { left: -120%; }
  88%, 100% { left: 150%; }
}

/* ---------------- 输入 ---------------- */
.field {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 16px; /* 防止 iOS 聚焦缩放 */
  padding: 14px 16px;
  border-radius: var(--r-sm);
  border: 0.5px solid rgba(255,255,255,0.75);
  background: rgba(255,255,255,0.6);
  -webkit-backdrop-filter: blur(14px) saturate(170%);
  backdrop-filter: blur(14px) saturate(170%);
  color: var(--text);
  transition: box-shadow 0.28s var(--ease-out), border-color 0.24s, transform 0.28s var(--spring);
  outline: none;
}
.field::placeholder { color: var(--text-3); }
.field:focus {
  border-color: rgba(10,132,255,0.55);
  box-shadow: 0 0 0 4px rgba(10,132,255,0.16), 0 6px 20px rgba(10,132,255,0.14);
  transform: translateY(-1px);
}

.label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-2);
  margin: 0 0 7px 4px;
  text-transform: uppercase;
}

/* ---------------- 进场动画 ---------------- */
.rise { animation: rise 0.75s var(--spring-soft) both; }
@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 26px, 0) scale(0.985); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}

.pop { animation: pop 0.55s var(--spring) both; }
@keyframes pop {
  0%   { opacity: 0; transform: scale(0.86); }
  100% { opacity: 1; transform: scale(1); }
}

.stagger > * { animation: rise 0.7s var(--spring-soft) both; }
.stagger > *:nth-child(1) { animation-delay: 0.02s; }
.stagger > *:nth-child(2) { animation-delay: 0.07s; }
.stagger > *:nth-child(3) { animation-delay: 0.12s; }
.stagger > *:nth-child(4) { animation-delay: 0.17s; }
.stagger > *:nth-child(5) { animation-delay: 0.22s; }
.stagger > *:nth-child(6) { animation-delay: 0.27s; }
.stagger > *:nth-child(7) { animation-delay: 0.32s; }
.stagger > *:nth-child(8) { animation-delay: 0.37s; }

/* ---------------- 滚动显现 ---------------- */
.reveal {
  opacity: 0;
  transform: translate3d(0, 34px, 0);
  transition: opacity 0.85s var(--ease-out), transform 0.85s var(--spring-soft);
  will-change: opacity, transform;
}
.reveal.in {
  opacity: 1;
  transform: none;
}

/* ---------------- 提示条 ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(28px + var(--safe-bottom));
  transform: translate(-50%, 24px) scale(0.94);
  opacity: 0;
  padding: 13px 22px;
  border-radius: var(--r-pill);
  background: rgba(28, 28, 34, 0.88);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  color: #fff;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.01em;
  box-shadow: 0 14px 40px rgba(0,0,0,0.28);
  pointer-events: none;
  z-index: 9999;
  max-width: min(86vw, 480px);
  text-align: center;
  transition: opacity 0.4s var(--ease-out), transform 0.5s var(--spring);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.toast.ok  { background: rgba(26, 140, 70, 0.94); }
.toast.err { background: rgba(180, 30, 50, 0.94); }

/* ---------------- 骨架 ---------------- */
.skel {
  background: linear-gradient(100deg, rgba(0,0,0,0.06) 30%, rgba(0,0,0,0.11) 50%, rgba(0,0,0,0.06) 70%);
  background-size: 220% 100%;
  animation: skel 1.5s var(--ease-in-out) infinite;
  border-radius: 8px;
}
@keyframes skel { to { background-position: -220% 0; } }

/* ---------------- 无障碍 ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* ---------------- 暗色 ---------------- */
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #08080b;
    --text: #f5f5f7;
    --text-2: #a1a1ab;
    --text-3: #6e6e78;
    --glass-bg: rgba(255, 255, 255, 0.09);
    --glass-border: rgba(255, 255, 255, 0.16);
  }
  body { background: var(--paper); }
  .field {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.16);
    color: var(--text);
  }
  .btn.ghost {
    background: rgba(255,255,255,0.10);
    color: var(--text);
    border-color: rgba(255,255,255,0.18);
  }
}
