/* =========================================================
   🧊 主容器（Grid 居中 + 全平台安全区适配）
========================================================= */
html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  display: grid;
  place-items: center;
  overflow-x: hidden; /* ✅ 仅禁水平滚动，不影响 safe-area */
  overflow-y: visible;
}

/* ✅ iOS Safari 高度修正（防止地址栏挤压） */
@supports (-webkit-touch-callout: none) {
  html, body {
    height: -webkit-fill-available;
  }
}

/* ========================== 主体浮层 ========================== */
main {
  margin-top: 10vh; /* ✅ 页面顶部下移 10% 视窗高度 */
  position: relative; /* ✅ 让伪元素以内层为锚点 */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  width: clamp(300px, 90%, 420px);
  padding: 38px 32px;
  border-radius: 22px;

  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow:
    0 0 25px rgba(0, 255, 255, 0.25),
    inset 0 0 20px rgba(255, 215, 0, 0.12);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  text-align: center;
  z-index: 2;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

/* 🌈 电光描边 */
main::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    145deg,
    rgba(0, 255, 255, 0.25),
    rgba(155, 77, 255, 0.15),
    rgba(255, 215, 0, 0.1)
  );
  opacity: 0.22;
  animation: flowGlow 8s linear infinite;
  filter: blur(0.5px);
  z-index: -1;
}
@keyframes flowGlow {
  0% { filter: hue-rotate(0deg); opacity: 0.25; }
  50% { filter: hue-rotate(60deg); opacity: 0.35; }
  100% { filter: hue-rotate(360deg); opacity: 0.25; }
}

/* =========================================================
   📱 手机端自适应
========================================================= */
@media (max-width: 768px) {
  main {
    padding: 34px 24px;
    width: 88%;
    border-radius: 18px;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
}

/* =========================================================
   ✨ 标题（蓝→紫→金 渐变 + 流光扫过）
========================================================= */
h1 {
  font-family: var(--font-title);
  font-size: 2.4rem;
  letter-spacing: 6px;
  margin-bottom: 48px;
  background: linear-gradient(
    90deg,
    var(--blue-light),
    var(--purple-electric),
    var(--gold)
  );
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 25px rgba(0, 255, 255, 0.3);
  position: relative;
  overflow: hidden;
}

/* ✨ 改良版流光扫过动画 */
h1::after {
  content: "";
  position: absolute;
  top: 0;
  left: -150%;
  width: 60%;
  height: 100%;
  background: linear-gradient(
    115deg,
    transparent,
    rgba(255,255,255,0.45),
    transparent
  );
  opacity: 0;
  mix-blend-mode: screen;
  border-radius: inherit;
  animation: titleSweep 4.5s ease-in-out infinite;
}

/* 🌠 动画：扫光 → 消失 → 再出现 */
@keyframes titleSweep {
  0% {
    left: -150%;
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  45% {
    left: 150%;
    opacity: 0.9;
  }
  60% {
    opacity: 0;
  }
  100% {
    left: 150%;
    opacity: 0;
  }
}

/* =========================================================
   💡 输入框与按钮比例优化
========================================================= */
input[type="text"] {
  width: 100%;
  max-width: 320px;
  height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(0,255,255,0.25);
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-size: 1rem;
  text-align: center;
  outline: none;
  margin-bottom: 24px;
  backdrop-filter: blur(10px);
}

/* ======= 按钮样式 ======= */
button {
  display: inline-block;
  min-width: 160px;
  max-width: 80%;
  height: auto;
  padding: 10px 28px;
  border-radius: 12px;
  border: none;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  margin: 10px auto;
  transition: 0.3s;
  white-space: nowrap;
  text-align: center;
  box-sizing: border-box;
}
button.primary {
  background: linear-gradient(90deg, #00ffff, #0077ff);
  color: #fff;
  box-shadow: 0 0 18px rgba(0,255,255,0.4);
}
button.primary:hover {
  filter: brightness(1.1);
}
button.secondary {
  background: rgba(255,255,255,0.1);
  color: #ccc;
  border: 1px solid rgba(255,255,255,0.15);
}
button.secondary:hover {
  background: rgba(255,255,255,0.12);
  color: #fff;
}

/* =========================================================
   🌐 右上角语言切换按钮（安全区 + 视觉距离优化）
========================================================= */
#langToggle {
  position: fixed;
  /* ✅ 双保险：安全区 + 最小固定距离 */
  top: max(calc(env(safe-area-inset-top, 0px) + 28px), 40px);
  right: max(calc(env(safe-area-inset-right, 0px) + 20px), 24px);

  padding: 8px 16px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(90deg, #00ffff, #0077ff);
  color: #fff;
  font-weight: 500;
  cursor: pointer;
  z-index: 1000;
  box-shadow: 0 0 12px rgba(0,255,255,0.4);
  backdrop-filter: blur(6px);
  transition: all 0.3s ease;
}
#langToggle:hover {
  filter: brightness(1.15);
  transform: scale(1.03);
}

/* ✅ 手机端：略微放大、再多留空间 */
@media (max-width: 768px) {
  #langToggle {
    padding: 9px 17px;
    font-size: 0.95rem;
    top: max(calc(env(safe-area-inset-top, 0px) + 32px), 44px);
    right: max(calc(env(safe-area-inset-right, 0px) + 22px), 26px);
  }
}
