/* =========================================================================
   app.css — 页面皮肤：深空蓝渐变 + 玻璃拟态（移动端优先）
   ========================================================================= */

:root {
  --bg-0: #040814;
  --bg-1: #08122b;

  --ink: #eaf1ff;
  --ink-dim: rgba(226, 236, 255, 0.70);
  --ink-faint: rgba(226, 236, 255, 0.52);

  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.18);

  --brand: #4f8cff;
  --brand-2: #22d3ee;
  --ok: #34d399;
  --err: #ff6b6b;

  --card-bg: rgba(255, 255, 255, 0.055);
  --card-sh: 0 24px 60px -12px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.06);

  --r-lg: 22px;
  --r-md: 14px;
  --r-sm: 11px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  color-scheme: dark;
}

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

html,
body {
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg-0);
  /* 弹层打开时锁滚动 */
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
    "HarmonyOS Sans SC", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  position: relative;
  overscroll-behavior-y: none;
}

body.is-locked {
  position: fixed;
  inset: 0;
  width: 100%;
  overflow: hidden;
}

/* ========================= 背景 ========================= */

.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% -20%, #0e1f45 0%, #071129 42%, var(--bg-0) 78%),
    linear-gradient(180deg, #050a18, #04070f 100%);
}

.bg__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(64px);
  opacity: 0.5;
  transform: translateZ(0);
  will-change: transform;
}

.bg__orb--a {
  width: 320px;
  height: 320px;
  top: -120px;
  left: -80px;
  background: radial-gradient(circle at 35% 35%, rgba(79, 140, 255, 0.85), rgba(79, 140, 255, 0) 68%);
  animation: drift-a 18s var(--ease) infinite alternate;
}

.bg__orb--b {
  width: 300px;
  height: 300px;
  right: -110px;
  top: 24%;
  background: radial-gradient(circle at 60% 40%, rgba(34, 211, 238, 0.55), rgba(34, 211, 238, 0) 70%);
  animation: drift-b 22s var(--ease) infinite alternate;
}

.bg__orb--c {
  width: 260px;
  height: 260px;
  left: 18%;
  bottom: -140px;
  background: radial-gradient(circle at 50% 50%, rgba(124, 92, 255, 0.45), rgba(124, 92, 255, 0) 70%);
  animation: drift-a 26s var(--ease) infinite alternate-reverse;
}

@keyframes drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(22px, 18px, 0) scale(1.08); }
}

@keyframes drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.04); }
  to   { transform: translate3d(-26px, 14px, 0) scale(0.96); }
}

.bg__grid {
  position: absolute;
  inset: -1px;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(85% 60% at 50% 28%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(85% 60% at 50% 28%, #000 0%, transparent 78%);
}

.bg__noise {
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="140" height="140"><filter id="n"><feTurbulence type="fractalNoise" baseFrequency="0.85" numOctaves="3" stitchTiles="stitch"/></filter><rect width="140" height="140" filter="url(%23n)"/></svg>');
}

/* ========================= 布局 ========================= */

.shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 430px;
  margin: 0 auto;
  padding:
    calc(22px + env(safe-area-inset-top, 0px))
    20px
    calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

/* ========================= 品牌区 ========================= */

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 4px;
  animation: rise 0.7s var(--ease) both;
}

.brand__mark {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #4f8cff 0%, #2f6bff 46%, #22d3ee 100%);
  box-shadow:
    0 8px 22px -6px rgba(79, 140, 255, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.brand__mark svg {
  width: 22px;
  height: 22px;
  display: block;
}

.brand__text {
  min-width: 0;
}

.brand__title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.25;
}

.brand__sub {
  margin: 2px 0 0;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========================= 卡片 ========================= */

.card {
  position: relative;
  padding: 24px 20px 20px;
  border-radius: var(--r-lg);
  background: var(--card-bg);
  border: 1px solid var(--line);
  box-shadow: var(--card-sh);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  animation: rise 0.7s var(--ease) 0.06s both;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
}

.card::after {
  content: "";
  position: absolute;
  top: -40%;
  right: -30%;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(79, 140, 255, 0.16), transparent 70%);
  pointer-events: none;
}

.card__head {
  position: relative;
  margin-bottom: 20px;
}

.card__title {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.card__desc {
  margin: 7px 0 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-dim);
}

/* ========================= 表单 ========================= */

.field {
  position: relative;
  margin-bottom: 15px;
}

.field__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 8px;
}

.field__head .field__label {
  margin: 0 0 0 2px;
}

.link-btn {
  margin: 0 2px 0 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: rgba(126, 172, 255, 0.92);
  cursor: pointer;
  transition: color 0.2s ease;
}

.link-btn:active {
  color: #a9c8ff;
}

.nowrap {
  white-space: nowrap;
}

.field__label {
  display: block;
  margin: 0 0 8px 2px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.control {
  width: 100%;
  height: 50px;
  padding: 0 14px;
  font-family: inherit;
  font-size: 16px; /* ≥16px 防止 iOS 聚焦放大 */
  color: var(--ink);
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  outline: none;
  appearance: none;
  transition:
    border-color 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.control::placeholder {
  color: rgba(226, 236, 255, 0.52);
  letter-spacing: normal;
}

.control:focus {
  background: rgba(255, 255, 255, 0.075);
  border-color: rgba(79, 140, 255, 0.75);
  box-shadow: 0 0 0 3px rgba(79, 140, 255, 0.18);
}

.control--phone {
  font-size: 19px;
  font-weight: 500;
  letter-spacing: 0.42em;
  padding-right: 6px;
  font-variant-numeric: tabular-nums;
}

.control--cap {
  flex: 1 1 auto;
  min-width: 0;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-weight: 500;
}

.control.is-error {
  border-color: rgba(255, 107, 107, 0.8);
  box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.16);
  animation: shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}

.cap-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cap-canvas {
  flex: 0 0 auto;
  width: 110px;
  height: 50px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  display: block;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.cap-canvas:active {
  transform: scale(0.97);
}

/* ========================= 主按钮 ========================= */

.btn {
  position: relative;
  width: 100%;
  height: 50px;
  margin-top: 8px;
  border: 0;
  border-radius: var(--r-md);
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: #fff;
  background: linear-gradient(135deg, #4f8cff 0%, #3a6df0 45%, #1e9fe0 100%);
  box-shadow:
    0 10px 26px -10px rgba(79, 140, 255, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
  cursor: pointer;
  overflow: hidden;
  transition:
    transform 0.15s var(--ease),
    box-shadow 0.25s ease,
    filter 0.2s ease,
    opacity 0.2s ease;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 55%);
  pointer-events: none;
}

.btn:active:not(:disabled) {
  transform: scale(0.985);
  box-shadow:
    0 6px 18px -10px rgba(79, 140, 255, 0.9),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
  filter: saturate(0.55);
}

.btn.is-busy {
  pointer-events: none;
  color: transparent;
}

.btn.is-busy::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

/* ========================= 页脚提示 ========================= */

.foot-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 16px 0 0;
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--ink-faint);
  text-align: center;
}

.foot-hint svg {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  opacity: 0.9;
}

.page-foot {
  text-align: center;
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: rgba(226, 236, 255, 0.42);
  animation: rise 0.7s var(--ease) 0.12s both;
}

/* ========================= 滑块验证弹层 ========================= */

.sheet-mask {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(3, 7, 18, 0.66);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.28s var(--ease), visibility 0.28s;
}

.sheet-mask.is-open {
  opacity: 1;
  visibility: visible;
}

.sheet {
  position: relative;
  width: 100%;
  max-width: 430px;
  padding: 10px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  border-radius: 26px 26px 0 0;
  border-top: 1px solid var(--line-strong);
  background: linear-gradient(180deg, rgba(16, 24, 46, 0.97), rgba(8, 14, 30, 0.99));
  box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.6);
  transform: translateY(102%);
  transition: transform 0.36s var(--ease);
}

.sheet-mask.is-open .sheet {
  transform: translateY(0);
}

.sheet__handle {
  width: 38px;
  height: 4px;
  margin: 0 auto 14px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.2);
}

.sheet__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.sheet__title {
  margin: 0;
  font-size: 16.5px;
  font-weight: 600;
}

.sheet__desc {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--ink-dim);
}

.sheet__close {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-dim);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.sheet__close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
}

.sheet__close svg {
  width: 14px;
  height: 14px;
}

.sheet__body {
  position: relative;
  display: flex;
  justify-content: center;
  border-radius: 16px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.sheet__foot {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px 2px 0;
  font-size: 11px;
  color: var(--ink-faint);
}

.sheet__foot svg {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}

/* ---------- 滑块校验中 / 校验失败遮罩 ---------- */
.cap-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  border-radius: 16px;
  background: rgba(6, 12, 28, 0.9);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s;
}

.cap-overlay.is-show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.cap-spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.16);
  border-top-color: #4f8cff;
  border-right-color: rgba(79, 140, 255, 0.45);
  animation: spin 0.75s linear infinite;
}

.cap-fail-icon {
  display: none;
  width: 30px;
  height: 30px;
  color: #ff8080;
}

.cap-overlay__text {
  margin: 0;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--ink-dim);
}

.cap-overlay.is-fail .cap-spinner {
  display: none;
}

.cap-overlay.is-fail .cap-fail-icon {
  display: block;
}

.cap-overlay.is-fail .cap-overlay__text {
  color: #ffb4b4;
}

/* 宽屏时改为居中卡片 */
@media (min-width: 640px) {
  .sheet-mask {
    align-items: center;
  }

  .sheet {
    border-radius: 24px;
    padding: 18px 22px 22px;
    border: 1px solid var(--line-strong);
    transform: translateY(14px) scale(0.98);
    opacity: 0;
    transition: transform 0.3s var(--ease), opacity 0.3s ease;
  }

  .sheet-mask.is-open .sheet {
    transform: translateY(0) scale(1);
    opacity: 1;
  }

  .sheet__handle {
    display: none;
  }
}

/* ========================= 成功页 ========================= */

.success {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 32px 24px calc(32px + env(safe-area-inset-bottom, 0px));
  background:
    radial-gradient(90% 60% at 50% 32%, rgba(34, 211, 153, 0.14), transparent 70%),
    rgba(4, 8, 20, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s var(--ease), visibility 0.4s;
}

.success.is-open {
  opacity: 1;
  visibility: visible;
}

.success__ring {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 40%, rgba(52, 211, 153, 0.22), rgba(52, 211, 153, 0.04));
  border: 1px solid rgba(52, 211, 153, 0.4);
  box-shadow: 0 0 40px -6px rgba(52, 211, 153, 0.5);
  transform: scale(0.86);
  opacity: 0;
  transition: transform 0.5s var(--ease) 0.1s, opacity 0.5s ease 0.1s;
}

.success.is-open .success__ring {
  transform: scale(1);
  opacity: 1;
}

.success__ring svg {
  width: 40px;
  height: 40px;
}

.success__ring path {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  transition: stroke-dashoffset 0.55s var(--ease) 0.3s;
}

.success.is-open .success__ring path {
  stroke-dashoffset: 0;
}

.success__title {
  margin: 4px 0 0;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 8px 0 0;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.45s ease 0.24s, transform 0.45s var(--ease) 0.24s;
}

.success__desc {
  margin: 0;
  font-size: 13px;
  color: var(--ink-dim);
  text-align: center;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.45s ease 0.32s, transform 0.45s var(--ease) 0.32s;
}

.success.is-open .success__title,
.success.is-open .success__desc {
  opacity: 1;
  transform: translateY(0);
}

.success__meta {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgba(52, 211, 153, 0.95);
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.25);
  font-variant-numeric: tabular-nums;
  opacity: 0;
  transition: opacity 0.45s ease 0.4s;
}

.success.is-open .success__meta {
  opacity: 1;
}

.success__btn {
  width: auto;
  min-width: 176px;
  max-width: none;
  height: 44px;
  margin-top: 26px;
  padding: 0 28px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.45s ease 0.48s, transform 0.45s var(--ease) 0.48s;
}

.success.is-open .success__btn {
  opacity: 1;
  transform: translateY(0);
}

.success__btn::after {
  display: none;
}

.success__btn:active:not(:disabled) {
  transform: scale(0.985);
  box-shadow: none;
  background: rgba(255, 255, 255, 0.1);
}

/* ========================= Toast ========================= */

.toast {
  position: fixed;
  left: 50%;
  top: calc(14px + env(safe-area-inset-top, 0px));
  z-index: 90;
  transform: translate(-50%, -12px);
  max-width: calc(100vw - 40px);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink);
  background: rgba(20, 28, 52, 0.95);
  border: 1px solid var(--line-strong);
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, transform 0.25s var(--ease), visibility 0.25s;
  pointer-events: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toast.is-show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

.toast.is-err {
  border-color: rgba(255, 107, 107, 0.45);
  color: #ffc9c9;
}

/* ========================= 动画 ========================= */

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

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

/* ========================= 小屏微调 ========================= */

@media (max-height: 640px) {
  .shell { gap: 16px; }
  .card { padding: 20px 18px 16px; }
  .card__head { margin-bottom: 16px; }
  .brand__mark { width: 40px; height: 40px; }
}
