/* ===== 全局重置 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --candy-pink: #ff6b9d;
  --candy-purple: #c44dff;
  --candy-blue: #4dabf7;
  --candy-yellow: #ffd43b;
  --candy-green: #51cf66;
  --wechat-green: #07c160;
  --qq-blue: #12b7f5;
  --apple-black: #1d1d1f;
  --text-primary: #333;
  --text-secondary: #888;
  --border-color: #e8e8e8;
  --card-bg: rgba(255, 255, 255, 0.96);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
  background: linear-gradient(135deg, #a8edea 0%, #fed6e3 50%, #ffd6e8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow: hidden;
  position: relative;
}

/* ===== 背景漂浮糖果 ===== */
.candy-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.candy {
  position: absolute;
  border-radius: 50%;
  opacity: 0.5;
  animation: float 8s ease-in-out infinite;
}

.candy::before,
.candy::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 12px;
  height: 8px;
  background: inherit;
  transform: translateY(-50%);
}

.candy::before {
  left: -10px;
  border-radius: 4px 0 0 4px;
}

.candy::after {
  right: -10px;
  border-radius: 0 4px 4px 0;
}

.c1 {
  width: 40px;
  height: 40px;
  background: var(--candy-pink);
  top: 10%;
  left: 8%;
  animation-delay: 0s;
}
.c2 {
  width: 30px;
  height: 30px;
  background: var(--candy-blue);
  top: 20%;
  right: 12%;
  animation-delay: 1.5s;
}
.c3 {
  width: 35px;
  height: 35px;
  background: var(--candy-yellow);
  bottom: 25%;
  left: 10%;
  animation-delay: 3s;
}
.c4 {
  width: 28px;
  height: 28px;
  background: var(--candy-purple);
  bottom: 15%;
  right: 15%;
  animation-delay: 2s;
}
.c5 {
  width: 24px;
  height: 24px;
  background: var(--candy-green);
  top: 50%;
  left: 5%;
  animation-delay: 4s;
}
.c6 {
  width: 32px;
  height: 32px;
  background: var(--candy-pink);
  top: 60%;
  right: 6%;
  animation-delay: 1s;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-30px) rotate(180deg);
  }
}

/* ===== 登录容器 ===== */
.login-container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ===== LOGO 区域 ===== */
.logo-section {
  text-align: center;
  margin-bottom: 28px;
}

.logo-icon {
  display: inline-block;
  filter: drop-shadow(0 6px 12px rgba(196, 77, 255, 0.3));
  animation: bounce 3s ease-in-out infinite;
}

@keyframes bounce {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

.game-title {
  font-size: 36px;
  font-weight: 800;
  margin-top: 12px;
  background: linear-gradient(135deg, var(--candy-pink), var(--candy-purple));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
}

.game-slogan {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 6px;
  letter-spacing: 1px;
}

/* ===== 登录卡片 ===== */
.login-card {
  width: 100%;
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  border-radius: 28px;
  padding: 36px 32px 28px;
  box-shadow: 0 20px 60px rgba(196, 77, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.8);
}

/* ===== 输入框组 ===== */
.input-group {
  position: relative;
  margin-bottom: 18px;
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  pointer-events: none;
  transition: color 0.3s;
}

.input-group input {
  width: 100%;
  height: 50px;
  padding: 0 48px 0 48px;
  border: 2px solid var(--border-color);
  border-radius: 14px;
  font-size: 15px;
  background: #fafafa;
  outline: none;
  transition: all 0.3s ease;
  color: var(--text-primary);
}

.input-group input::placeholder {
  color: #bbb;
}

.input-group input:focus {
  border-color: var(--candy-pink);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 107, 157, 0.1);
}

.input-group input:focus + .input-icon,
.input-group:focus-within .input-icon {
  color: var(--candy-pink);
}

/* 密码小眼睛 */
.pwd-toggle {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: color 0.3s;
}

.pwd-toggle:hover {
  color: var(--candy-pink);
}

/* ===== 表单选项（记住我 / 忘记密码） ===== */
.form-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  font-size: 13px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.checkbox-custom {
  width: 16px;
  height: 16px;
  border: 2px solid #ccc;
  border-radius: 5px;
  margin-right: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
  background: var(--candy-pink);
  border-color: var(--candy-pink);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
  content: "";
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.forgot-link {
  color: var(--candy-pink);
  text-decoration: none;
  transition: opacity 0.2s;
}

.forgot-link:hover {
  opacity: 0.7;
}

/* ===== 登录按钮 ===== */
.login-btn {
  width: 100%;
  height: 50px;
  border: none;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--candy-pink), var(--candy-purple));
  cursor: pointer;
  letter-spacing: 4px;
  box-shadow: 0 8px 20px rgba(255, 107, 157, 0.35);
  transition: all 0.3s ease;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(255, 107, 157, 0.45);
}

.login-btn:active {
  transform: translateY(0);
}

/* 登录按钮抖动动画 */
.login-btn.shake {
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

/* ===== 注册入口 ===== */
.register-hint {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-secondary);
}

.register-link {
  color: var(--candy-purple);
  text-decoration: none;
  font-weight: 600;
}

.register-link:hover {
  text-decoration: underline;
}

/* ===== 分割线 ===== */
.divider {
  display: flex;
  align-items: center;
  margin: 24px 0 20px;
  color: var(--text-secondary);
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-color);
}

.divider span {
  padding: 0 14px;
}

/* ===== 第三方登录 ===== */
.social-login {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 24px;
}

.social-btn {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.social-btn:hover {
  transform: translateY(-4px) scale(1.08);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.social-btn.wechat {
  background: var(--wechat-green);
}

.social-btn.qq {
  background: var(--qq-blue);
}

.social-btn.apple {
  background: var(--apple-black);
}

/* ===== 用户协议 ===== */
.agreement {
  display: flex;
  align-items: flex-start;
}

.agreement .checkbox-label {
  align-items: flex-start;
  font-size: 12px;
  line-height: 1.5;
}

.agreement .checkbox-custom {
  margin-top: 1px;
}

.agreement-text a {
  color: var(--candy-pink);
  text-decoration: none;
}

.agreement-text a:hover {
  text-decoration: underline;
}

/* ===== 版本号 ===== */
.version {
  margin-top: 24px;
  font-size: 12px;
  color: rgba(90, 58, 110, 0.7);
  letter-spacing: 1px;
}

/* ===== 响应式 ===== */
@media (max-width: 480px) {
  .login-card {
    padding: 28px 24px 20px;
    border-radius: 24px;
  }

  .game-title {
    font-size: 30px;
  }

  .input-group input,
  .login-btn {
    height: 46px;
  }
}

@media (max-height: 700px) {
  .logo-section {
    margin-bottom: 18px;
  }

  .game-title {
    font-size: 28px;
  }

  .login-card {
    padding: 24px 24px 18px;
  }
}

/* ===== AB 测试：V1 协议勾选框前置（order 重排，无 DOM 移动，无闪烁） ===== */
html[data-ab-variant="v1"] #loginForm {
  display: flex;
  flex-direction: column;
}

/* 源序 1: 账号输入框 */
html[data-ab-variant="v1"] #loginForm > :nth-child(1) { order: 1; }
/* 源序 2: 密码输入框 */
html[data-ab-variant="v1"] #loginForm > :nth-child(2) { order: 2; }
/* 源序 3: 记住我/忘记密码 */
html[data-ab-variant="v1"] #loginForm > :nth-child(3) { order: 3; }
/* 源序 8: 协议勾选框 → 前置到登录按钮上方 */
html[data-ab-variant="v1"] #loginForm > :nth-child(8) {
  order: 4;
  margin: -6px 0 14px;
}
/* 源序 4: 登录按钮 → 协议之后 */
html[data-ab-variant="v1"] #loginForm > :nth-child(4) { order: 5; }
/* 源序 5: 注册入口 */
html[data-ab-variant="v1"] #loginForm > :nth-child(5) { order: 6; }
/* 源序 6: 分割线 */
html[data-ab-variant="v1"] #loginForm > :nth-child(6) { order: 7; }
/* 源序 7: 第三方登录 */
html[data-ab-variant="v1"] #loginForm > :nth-child(7) { order: 8; }

/* ===== AB 测试：V2 一步确认弹窗 ===== */
.ab-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.ab-modal.open {
  display: flex;
}

.ab-modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
}

.ab-modal-card {
  position: relative;
  width: 100%;
  max-width: 340px;
  background: #fff;
  border-radius: 20px;
  padding: 26px 24px 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  animation: modalPop 0.25s ease;
}

@keyframes modalPop {
  from {
    transform: scale(0.92) translateY(10px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.ab-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  color: #bbb;
  cursor: pointer;
  padding: 4px;
}

.ab-modal-close:hover {
  color: #888;
}

.ab-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 12px;
}

.ab-modal-summary {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 18px;
}

.ab-modal-link {
  color: var(--candy-pink);
  text-decoration: none;
}

.ab-modal-link:hover {
  text-decoration: underline;
}

.ab-modal-accept {
  width: 100%;
  height: 46px;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  cursor: pointer;
  letter-spacing: 2px;
  background: linear-gradient(135deg, var(--candy-pink), var(--candy-purple));
  box-shadow: 0 8px 20px rgba(255, 107, 157, 0.35);
  transition: all 0.3s ease;
}

.ab-modal-accept:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(255, 107, 157, 0.45);
}

/* ===== R1 修订：记住我协议确认弹窗（双按钮行） ===== */
.ab-modal-actions {
  display: flex;
  gap: 10px;
}

.ab-modal-btn {
  flex: 1;
  height: 44px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.3s ease;
}

.ab-modal-btn-cancel {
  border: 2px solid #eee;
  background: #fafafa;
  color: var(--text-secondary);
}

.ab-modal-btn-cancel:hover {
  background: #f0f0f0;
}

.ab-modal-btn-accept {
  border: none;
  color: #fff;
  background: linear-gradient(135deg, var(--candy-pink), var(--candy-purple));
  box-shadow: 0 8px 20px rgba(255, 107, 157, 0.35);
}

.ab-modal-btn-accept:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(255, 107, 157, 0.45);
}
