/* ============================================================
   微信地球登录页 + 微信分身授权弹窗
   ============================================================ */
:root {
  --wx:      #07C160;
  --wx-d:    #06AD56;
  --wx-ink:  #05974A;
  --wx-soft: #F1FBF6;
  --ink:     #1A1A1A;
  --muted:   #8A8A8A;
  --muted-2: #A8A8A8;
  --line:    #EFEFEF;
  --border:  #E5E5E5;
  --danger:  #FA5151;
  --paper:   #F7F7F7;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: #000;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body.locked { overflow: hidden; }
button { font-family: inherit; }
svg { display: block; }
.wx-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* ============================================================
   一、微信地球登录页
   ============================================================ */
body.landing-body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  background: #000;
}

.earth {
  position: relative;
  width: 100%;
  max-width: 440px;              /* 官方 iPhone 逻辑宽度 440pt */
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  /* 上纯黑、下 #010B17，正好衔接官方图顶部 #000 与底部 #010B17，无接缝 */
  background: linear-gradient(180deg, #000000 0%, #000000 50%, #010B17 80%, #010B17 100%);
}

/*
   官方背景图 825×1467（微信 Android 安装包 r/a1/btu.webp），
   原图地球直径占画幅 65%，官方登录页地球占屏宽 65.3%，两者一致，
   所以这里按「宽度铺满」等比缩放，用地球圆心锁定在屏高 46.9% 处。
*/
.earth-bg {
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-size: 100% auto;
  background-position: 50% 46.9vh;
  background-position: 50% calc(46.9dvh - .886 * min(100vw, 440px));
}

/* 右上角语言 */
.earth-lang {
  position: absolute;
  z-index: 2;
  top: calc(10px + env(safe-area-inset-top));
  right: 18px;
  padding: 6px 2px;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, .52);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: .01em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.earth-lang:active { color: rgba(255, 255, 255, .85); }

/* 底部双按钮：按官方 1320×2868 截图 3 倍图实测
   按钮 570×137px → 190×45.7pt，间距 63px → 21pt，左右边距 59px → 20pt，
   圆角 23.5px → 8pt，文字 17pt/500，距屏底 50.7pt（16pt + 34pt 安全区） */
.earth-actions {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: max(50px, calc(16px + env(safe-area-inset-bottom)));
  display: flex;
  gap: 21px;
  padding: 0 20px;
}

.earth-btn {
  flex: 1 1 0;
  min-width: 0;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-size: 17px;
  font-weight: 500;
  line-height: 46px;
  letter-spacing: .02em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .15s ease, transform .07s ease;
}
a.earth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.earth-btn:active { transform: scale(.985); }
.earth-btn:focus-visible { outline: 2px solid rgba(255, 255, 255, .7); outline-offset: 3px; }

.earth-btn-ghost {
  /* 实测 #161E29 叠在 #010B17 上 = 8% 白，官方用的是半透明白而不是灰 */
  background: rgba(255, 255, 255, .08);
}
.earth-btn-ghost:hover { background: rgba(255, 255, 255, .13); }
.earth-btn-ghost:active { background: rgba(255, 255, 255, .16); }

.earth-btn-main {
  background: var(--wx);
}
.earth-btn-main:hover { background: var(--wx-d); }
.earth-btn-main:active { background: #06A24F; }

/* ============================================================
   二、微信分身授权弹窗
   ============================================================ */
.gate-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, .52);
  opacity: 0;
  transition: opacity .22s ease;
}
.gate-mask[hidden] { display: none; }
.gate-mask.on { opacity: 1; }

.ticket {
  position: relative;
  width: min(430px, 100%);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #ffffff;
  border-radius: 22px;
  padding: 28px 30px 26px;
  box-shadow:
    0 1px 4px rgba(0, 0, 0, .08),
    0 36px 80px -30px rgba(0, 0, 0, .5);
  transform: translateY(15px) scale(.978);
  transition: transform .3s cubic-bezier(.2, .85, .25, 1);
  will-change: transform;
}
.gate-mask.on .ticket { transform: none; }

/* 顶部微信绿渐变条 */
.ticket-ribbon {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 4px;
  border-radius: 22px 22px 0 0;
  background: linear-gradient(90deg, #07C160 0%, #2BD97C 50%, #8FE8B4 100%);
}

.ticket-x {
  position: absolute;
  top: 13px;
  right: 13px;
  width: 32px; height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #A3A3A3;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.ticket-x svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.1; stroke-linecap: round; }
.ticket-x:hover { background: #F1F1F1; color: var(--ink); }
.ticket-x:active { background: #E7E7E7; }

.ticket-body { display: block; }

/* 眉标 */
.ticket-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  padding-right: 34px;
}
.ticket-mark { color: var(--wx); }
.ticket-mark .ticket-wx { width: 22px; height: 20px; fill: currentColor; }
.ticket-eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: #B0B0B0;
}

/* 标题区 */
.ticket-h1 {
  margin: 0;
  font-size: 25px;
  line-height: 1.32;
  font-weight: 700;
  letter-spacing: -.5px;
  color: var(--ink);
}
.ticket-sub {
  margin: 9px 0 0;
  font-size: 14px;
  line-height: 1.6;
  color: #7B7B7B;
}

/* 标题行：右侧「获取授权码」绿色小按钮 */
.ticket-title-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.ticket-title-row .ticket-h1 { flex: 1 1 auto; min-width: 0; }

.ticket-buy {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border: 1.5px solid rgba(250, 81, 81, .45);
  border-radius: 10px;
  background: linear-gradient(180deg, #FFF6F6 0%, #FDEDED 100%);
  color: #D6362F;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .16s ease, border-color .16s ease,
              box-shadow .16s ease, transform .07s ease;
}
.ticket-buy svg {
  width: 15px; height: 15px;
  flex: 0 0 auto;
  stroke: currentColor; fill: none;
  stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round;
}
.ticket-buy:hover {
  background: #FFE9E9;
  border-color: var(--danger);
  box-shadow: 0 4px 12px -4px rgba(250, 81, 81, .45);
}
.ticket-buy:active { transform: scale(.97); background: #FFDEDE; }
.ticket-buy:focus-visible { outline: 2px solid var(--danger); outline-offset: 3px; }

/* 授权码输入 */
.ticket-form { margin-top: 24px; }

.keybox {
  display: flex;
  align-items: center;
  height: 58px;
  padding: 0 6px;
  border: 1.5px solid #E6E6E6;
  border-radius: 13px;
  background: var(--paper);
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}
.keybox-pre {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 9px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  background: #EAF9F1;
  color: var(--wx-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
}
.keybox input {
  flex: 1 1 auto;
  min-width: 0;
  height: 100%;
  padding: 0 10px;
  border: 0;
  background: transparent;
  outline: none;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  text-align: left;
}
.keybox input::placeholder {
  color: #BBBBBB;
  font-weight: 400;
  font-size: 13.5px;
  letter-spacing: .02em;
  text-transform: none;
}
.keybox:focus-within {
  border-color: var(--wx);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(7, 193, 96, .12);
}
.keybox.is-bad {
  border-color: var(--danger);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(250, 81, 81, .10);
}

/* 输入进度 */
.keybar {
  height: 2px;
  margin: 9px 2px 0;
  border-radius: 2px;
  background: #EFEFEF;
  overflow: hidden;
}
.keybar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--wx), #4FE08C);
  transition: width .15s ease;
}

.msg {
  min-height: 16px;
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--danger);
}

/* 主按钮 */
.ticket-go {
  width: 100%;
  height: 54px;
  margin-top: 18px;
  border: 0;
  border-radius: 13px;
  background: var(--wx);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .01em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .15s ease, transform .07s ease;
}
.ticket-go svg {
  width: 17px; height: 17px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  transition: transform .18s ease;
}
.ticket-go:hover { background: var(--wx-d); }
.ticket-go:hover svg { transform: translateX(3px); }
.ticket-go:active { transform: scale(.99); }
.ticket-go:focus-visible { outline: 2px solid var(--wx); outline-offset: 3px; }
.ticket-go[disabled] { opacity: .6; cursor: default; }

/* 次级入口 */
.ticket-alt {
  margin-top: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #8A8A8A;
}
.ticket-link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--wx-ink);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ticket-link:hover { text-decoration: underline; }

/* 条款 */
.ticket-legal {
  margin: 20px 0 0;
  padding-top: 16px;
  border-top: 1px dashed #EDEDED;
  font-size: 11.5px;
  line-height: 1.7;
  color: #A0A0A0;
  text-wrap: balance;
}
.ticket-legal a { color: var(--wx-ink); text-decoration: none; }
.ticket-legal a:hover { text-decoration: underline; }

/* 校验失败：抖一下 */
.shake { animation: shake .42s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

/* 成功态 */
.ticket-body.is-done .ticket-head,
.ticket-body.is-done #intro,
.ticket-body.is-done .ticket-form,
.ticket-body.is-done .ticket-alt,
.ticket-body.is-done .ticket-legal { display: none; }

.ticket-done {
  text-align: center;
  padding: 26px 0 10px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .38s ease, transform .38s ease;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.ticket-done[hidden] { display: none; }
.ticket-done.in { opacity: 1; transform: none; }

.tick svg { width: 62px; height: 62px; display: inline-block; }
.tick-c {
  fill: none; stroke: var(--wx); stroke-width: 2.4;
  stroke-dasharray: 150; stroke-dashoffset: 150;
  animation: draw .62s ease forwards;
}
.tick-p {
  fill: none; stroke: var(--wx); stroke-width: 3;
  stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 40; stroke-dashoffset: 40;
  animation: draw .42s .42s ease forwards;
}
@keyframes draw { to { stroke-dashoffset: 0; } }

.done-t { margin: 16px 0 0; font-size: 22px; font-weight: 700; letter-spacing: -.4px; color: var(--ink); }
.done-s { margin: 8px 0 0; font-size: 13.5px; line-height: 1.6; color: #7B7B7B; }
.done-go {
  margin: 20px auto 0;
  height: 50px;
  padding: 0 26px;
  border-radius: 13px;
  border: 0;
  background: var(--wx);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .15s ease, transform .07s ease;
}
.done-go:hover { background: var(--wx-d); }
.done-go:active { transform: scale(.98); }
.done-go svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.done-note { margin: 13px 0 0; font-size: 11.5px; color: #ABABAB; }

/* 跳转提醒：琥珀色 */
.done-vpn {
  margin: 14px auto 0;
  max-width: 260px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 14px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #b45309;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
}
.done-vpn[hidden] { display: none; }
.done-vpn svg { width: 15px; height: 15px; flex-shrink: 0; fill: #f59e0b; }
.done-vpn span { word-break: break-word; }

/* 自动跳转被打断时：呼吸光圈 */
.ticket-done.is-stuck .done-go {
  background: var(--wx);
  animation: goPulse 1.5s ease-in-out infinite;
}
@keyframes goPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(7, 193, 96, .5); }
  55%      { box-shadow: 0 0 0 13px rgba(7, 193, 96, 0); }
}
.ticket-done.is-stuck .done-note {
  color: var(--wx-ink);
  font-weight: 600;
  font-size: 12.5px;
}

.bar { height: 3px; width: 120px; margin: 20px auto 0; background: #EFEFEF; border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--wx); border-radius: 99px; animation: fill 2.9s .15s linear forwards; }
@keyframes fill { to { width: 100%; } }

/* ============================================================
   三、获取授权码 弹层
   ============================================================ */
.mini {
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(0, 0, 0, .42);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade .2s ease;
}
.mini[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.mini-card {
  width: min(380px, 100%);
  background: #fff;
  border-radius: 20px;
  padding: 26px 24px 20px;
  text-align: center;
  box-shadow: 0 30px 70px -24px rgba(0, 0, 0, .45);
  animation: pop .3s cubic-bezier(.2, .85, .25, 1) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }

.mini-card h3 { margin: 0 0 12px; font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
.mini-body { color: #7B7B7B; font-size: 14px; line-height: 1.75; word-break: break-word; user-select: all; }
.mini-go {
  width: 100%; height: 48px; margin-top: 18px;
  border-radius: 12px; background: var(--wx); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 600; text-decoration: none;
}
.mini-close {
  width: 100%; height: 48px; margin-top: 10px;
  border-radius: 12px; border: 1px solid var(--border); background: #fff;
  color: var(--ink); font-size: 15px; font-weight: 600; cursor: pointer;
}

/* 客服弹窗 */
.mini-kefu { padding-top: 30px; }
.kefu-avatar {
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: linear-gradient(160deg, #2BD97C, #07C160);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700;
  box-shadow: 0 8px 20px -8px rgba(7, 193, 96, .7);
}
.mini-kefu h3 { margin-bottom: 10px; }
.kefu-qr {
  width: 168px; max-width: 62%;
  margin: 16px auto 0;
}
.kefu-qr img {
  width: 100%; height: auto; display: block;
  border-radius: 10px; border: 1px solid var(--border);
}

/* ============================================================
   四、响应式
   ============================================================ */
@media (max-width: 520px) {
  .earth-lang { top: calc(10px + env(safe-area-inset-top)); right: 18px; }
  /* 按钮尺寸/间距不做响应式缩放：官方就是固定 pt，改了就不是 1:1 了 */

  .gate-mask { padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); }
  .ticket { border-radius: 20px; max-height: calc(100dvh - 24px); padding: 24px 20px 22px; }
  .ticket-ribbon { border-radius: 20px 20px 0 0; }
  .ticket-head { margin-bottom: 20px; }
  .ticket-h1 { font-size: 21px; }
  .ticket-sub { font-size: 13.5px; margin-top: 8px; }
  .ticket-form { margin-top: 20px; }
  .keybox { height: 54px; border-radius: 12px; }
  .keybox input { font-size: 15px; letter-spacing: .05em; }
  .ticket-go { height: 50px; margin-top: 16px; border-radius: 12px; }
  .ticket-title-row { gap: 8px; }
  .ticket-buy { height: 34px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
  .ticket-buy svg { width: 14px; height: 14px; }
  .ticket-legal { margin-top: 17px; padding-top: 14px; font-size: 11px; }
  .ticket-done { padding-top: 18px; }
}

@media (min-width: 441px) {
  .earth { box-shadow: 0 0 0 1px rgba(255, 255, 255, .06); }
}

@media (max-height: 700px) {
  .ticket { padding-top: 22px; padding-bottom: 18px; }
  .ticket-head { margin-bottom: 16px; }
  .ticket-form { margin-top: 16px; }
  .ticket-go { margin-top: 14px; }
  .ticket-legal { margin-top: 14px; padding-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
