/* =========================================================
   台灯登录弹窗组件（独立样式）
   与主项目解耦，不依赖外部 CSS 变量
   ========================================================= */

/* 根变量：只保留组件内部使用的 easing/字体栈 */
.auth-modal {
  --ease: cubic-bezier(.16, 1, .3, 1);
  --font-display: 'PingFang SC', 'Microsoft YaHei', ui-sans-serif, system-ui, sans-serif;
  --font-body: 'PingFang SC', 'Microsoft YaHei', ui-sans-serif, system-ui, sans-serif;
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
}
.auth-modal.is-open { display: block; }

.auth-modal__scrim {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(56, 80, 120, .28) 0%, transparent 55%),
    radial-gradient(circle at 50% 35%, rgba(26, 34, 52, .55) 0%, rgba(4, 7, 13, .94) 72%),
    linear-gradient(168deg, #0a1120 0%, #060a13 45%, #04060c 100%);
  backdrop-filter: blur(10px);
  animation: authScrimIn .35s var(--ease) forwards;
}
/* 缓慢漂浮的青/紫光斑，营造深空氛围 */
.auth-modal__scrim::before {
  content: '';
  position: absolute;
  inset: -15%;
  background:
    radial-gradient(circle at 18% 28%, rgba(56, 189, 248, .09) 0%, transparent 32%),
    radial-gradient(circle at 82% 62%, rgba(167, 139, 250, .08) 0%, transparent 34%),
    radial-gradient(circle at 55% 88%, rgba(34, 211, 238, .05) 0%, transparent 38%);
  animation: scrimDrift 24s ease-in-out infinite alternate;
  pointer-events: none;
}
/* 顶部一条极淡的"天花板"光带，呼应吊灯的挂载 */
.auth-modal__scrim::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 140px;
  background: linear-gradient(to bottom, rgba(180, 200, 235, .05), transparent);
  pointer-events: none;
}
@keyframes scrimDrift {
  from { transform: translate3d(-3%, -2%, 0) scale(1); }
  to { transform: translate3d(3%, 2%, 0) scale(1.07); }
}
@keyframes authScrimIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* 顶部提示条 */
.auth-modal__toast {
  position: absolute;
  top: 28px;
  left: 50%;
  z-index: 11;
  transform: translateX(-50%) translateY(-20px);
  max-width: min(420px, calc(100vw - 40px));
  padding: 11px 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: .88rem;
  font-weight: 600;
  color: #fff;
  background: rgba(30, 16, 10, .82);
  border: 1px solid rgba(251, 146, 60, .45);
  box-shadow: 0 12px 40px -10px rgba(251, 146, 60, .35), 0 0 0 1px rgba(0,0,0,.2) inset;
  backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.auth-modal__toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.auth-modal__toast::before {
  content: '!';
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .8rem;
  font-weight: 800;
  background: rgba(251, 146, 60, .9);
  color: #1a0b00;
}

.auth-modal__stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6vw;
  padding: 24px;
  animation: authStageIn .55s var(--ease) forwards;
}
@keyframes authStageIn {
  from { opacity: 0; transform: scale(.96); }
  to { opacity: 1; transform: scale(1); }
}

.auth-modal__close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 10;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: rgba(255,255,255,.55);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.12);
  transition: color .2s, transform .2s, background .2s;
}
.auth-modal__close:hover {
  color: #fff;
  transform: rotate(90deg);
  background: rgba(255,255,255,.12);
}

/* 台灯主题色 */
.auth-modal.theme-green  { --lamp-color: #a3e635; --lamp-light: #d9f99d; --lamp-dark: #65a30d; }
.auth-modal.theme-violet { --lamp-color: #a78bfa; --lamp-light: #ddd6fe; --lamp-dark: #7c3aed; }
.auth-modal.theme-blue   { --lamp-color: #38bdf8; --lamp-light: #bae6fd; --lamp-dark: #0284c7; }
.auth-modal.theme-rose   { --lamp-color: #fb7185; --lamp-light: #fecdd3; --lamp-dark: #e11d48; }
.auth-modal.theme-amber  { --lamp-color: #fbbf24; --lamp-light: #fde68a; --lamp-dark: #d97706; }
.auth-modal.theme-cyan   { --lamp-color: #22d3ee; --lamp-light: #a5f3fc; --lamp-dark: #0891b2; }
.auth-modal.is-off    { --lamp-color: #94a3b8; --lamp-light: #cbd5e1; --lamp-dark: #475569; }
.auth-modal.is-error  { --lamp-color: #fb923c; --lamp-light: #fed7aa; --lamp-dark: #c2410c; }

/* 台灯主体 */
.lamp {
  position: relative;
  width: min(34vw, 280px);
  height: min(48vw, 400px);
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateZ(0);
  will-change: transform;
}
/* 摆锤容器：transform-origin 在吊点（容器顶部中点） */
.lamp__swing {
  width: 100%;
  height: 100%;
  transform-origin: 50% 0;
  will-change: transform;
  cursor: grab;
}
.lamp__swing:active { cursor: grabbing; }

.lamp__svg { width: 100%; height: 100%; overflow: visible; }
.lamp__mount { fill: rgba(255,255,255,.16); }
.lamp__mount-ring {
  stroke: rgba(255,255,255,.32);
  stroke-width: 2.5;
}
.lamp__cap { fill: rgba(15, 20, 28, .85); stroke: rgba(255,255,255,.14); stroke-width: 1; }
.lamp__cord-line { stroke: rgba(255,255,255,.30); stroke-width: 2.5; }
.lamp__shade-shape {
  filter: url(#shadeShadow);
  transition: fill .5s var(--ease), filter .35s ease;
}
.lamp__bulb { opacity: .9; transition: opacity .5s var(--ease); }
.lamp__beam-svg { opacity: .6; transition: opacity .5s var(--ease); }
.lamp__pull-svgline {
  stroke: rgba(255,255,255,.45);
  stroke-width: 2;
  transition: stroke .3s, transform .3s var(--ease);
  transform-origin: 150px 157px;
}
.lamp__pull-svgknob {
  fill: rgba(255,255,255,.88);
  stroke: rgba(255,255,255,.25);
  stroke-width: 1;
  transition: fill .3s, transform .3s var(--ease);
  transform-origin: 150px 157px;
  cursor: grab;
  touch-action: none;
  pointer-events: auto;
}
.lamp__pull-svgknob:active { cursor: grabbing; }

.lamp__face { color: rgba(8,24,28,.82); opacity: 0; transition: opacity .35s ease; }
.lamp__eye { fill: currentColor; }
.lamp__eye-line { stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }

.lamp.is-pulled .lamp__pull-svgline,
.lamp.is-pulled .lamp__pull-svgknob { animation: pullString .35s var(--ease); }
@keyframes pullString {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(18px); }
}

.lamp__pull-svgline.is-dragging,
.lamp__pull-svgknob.is-dragging { transition: none; }

.lamp__pull {
  position: absolute;
  bottom: -30px;
  left: 68%;
  z-index: 2;
  transform: translateX(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,.42);
  font-size: .72rem;
  letter-spacing: .08em;
  transition: color .2s;
  touch-action: none;
  padding: 10px 20px;
}
.lamp__pull:hover { color: rgba(255,255,255,.78); }
.lamp__pull-text { text-shadow: 0 1px 4px rgba(0,0,0,.5); }

.lamp__theme {
  position: absolute;
  top: 6%;
  right: 2%;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.14);
  transition: transform .3s var(--ease), border-color .2s, background .2s;
}
.lamp__theme:hover {
  transform: rotate(35deg);
  border-color: var(--lamp-color);
  background: rgba(255,255,255,.12);
}
.lamp__theme-ring {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #a3e635, #22d3ee, #38bdf8, #a78bfa, #fb7185, #fbbf24, #a3e635);
  box-shadow: 0 0 8px -2px var(--lamp-color);
}

.lamp__pool {
  opacity: 0;
  transition: opacity .6s var(--ease);
  pointer-events: none;
}
.auth-modal.is-on .lamp__pool,
.auth-modal.is-error .lamp__pool { opacity: 1; }

.auth-modal.is-on .lamp__face--happy { opacity: 1; }
.auth-modal.is-on .lamp__bulb { opacity: .95; }
.auth-modal.is-on .lamp__beam-svg { opacity: .62; }

.lamp.is-peek .lamp__face--happy { opacity: 0; }
.lamp.is-peek .lamp__face--peek { opacity: 1; }
.lamp.is-peek .lamp__bulb { opacity: 1; }

.auth-modal.is-off .lamp__face--sleep { opacity: 1; }
.auth-modal.is-off .lamp__bulb { opacity: .22; }
.auth-modal.is-off .lamp__beam-svg { opacity: .14; }
.auth-modal.is-off .lamp__shade-shape { filter: url(#shadeShadow) brightness(.55) saturate(.25); }
.auth-modal.is-off .lamp__pull-svgline { stroke: rgba(255,255,255,.28); }
.auth-modal.is-off .lamp__pull-svgknob { fill: rgba(255,255,255,.55); }

.auth-modal.is-error .lamp__face--sad { opacity: 1; }
.auth-modal.is-error .lamp__face--happy,
.auth-modal.is-error .lamp__face--peek,
.auth-modal.is-error .lamp__face--surprised { opacity: 0 !important; }
.auth-modal.is-error .lamp__bulb { opacity: .85; }
.auth-modal.is-error .lamp__beam-svg { opacity: .45; }

.auth-modal.is-surprised .lamp__face--surprised { opacity: 1; }
.auth-modal.is-surprised .lamp__face--happy,
.auth-modal.is-surprised .lamp__face--peek { opacity: 0 !important; }

/* 登录卡片 */
.auth-card-slot {
  width: min(420px, calc(100vw - 40px));
  display: flex;
  justify-content: center;
  flex-shrink: 0;
  pointer-events: none;
}
.auth-card {
  position: relative;
  width: 100%;
  border-radius: 20px;
  overflow: hidden;
  color: #e6ebf3;
  background: linear-gradient(160deg, rgba(24, 30, 44, .72) 0%, rgba(11, 15, 24, .80) 100%);
  backdrop-filter: blur(20px) saturate(1.25);
  -webkit-backdrop-filter: blur(20px) saturate(1.25);
  border: 1px solid rgba(255,255,255,.10);
  box-shadow:
    0 24px 70px -18px rgba(0,0,0,.65),
    0 0 0 1px rgba(255,255,255,.04) inset,
    0 1px 0 rgba(255,255,255,.08) inset;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(24px) scale(.96);
  transition: opacity .55s var(--ease), transform .55s var(--ease), visibility .55s var(--ease), box-shadow .55s var(--ease);
}
.auth-modal.is-on .auth-card,
.auth-modal.is-error .auth-card {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
.auth-modal.is-error .auth-card {
  box-shadow:
    0 24px 70px -18px rgba(0,0,0,.65),
    0 0 0 1px rgba(251, 146, 60, .45),
    0 0 40px -10px rgba(251, 146, 60, .25);
}
.auth-modal.is-on .auth-card-slot,
.auth-modal.is-error .auth-card-slot { pointer-events: auto; }

.auth-card.is-success { animation: cardSuccess .5s var(--ease) forwards; }
@keyframes cardSuccess {
  0% { transform: scale(1); }
  40% { transform: scale(1.02); }
  100% { transform: scale(1); opacity: 0; }
}

.auth-card__inner { position: relative; z-index: 2; padding: 34px; }
.auth-card__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
}
.auth-card__title {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 800;
  margin: 0;
  color: #f3f6fb;
  letter-spacing: -.01em;
}
.auth-card__header-link { font-size: .88rem; color: rgba(230,235,243,.52); }
.auth-card__header-link .auth-card__link { font-size: .88rem; }

.auth-card__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-card__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.auth-card__field[hidden] { display: none !important; }
.auth-card__field input {
  appearance: none;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.055);
  color: #eef2f8;
  font-family: var(--font-body);
  font-size: .95rem;
  outline: none;
  transition: border-color .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
}
.auth-card__field input::placeholder { color: rgba(230,235,243,.34); }
.auth-card__field input:focus {
  border-color: var(--lamp-color);
  background: rgba(255,255,255,.09);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--lamp-color) 20%, transparent);
}
.auth-card__field input.is-error-pulse {
  animation: inputPulse .6s var(--ease);
  border-color: #ef4444 !important;
}
@keyframes inputPulse {
  0%   { box-shadow: 0 0 0 0 rgba(239,68,68,.55); }
  100% { box-shadow: 0 0 0 12px rgba(239,68,68,0); }
}

.auth-card__code-row { display: flex; gap: 10px; }
.auth-card__code-row input { flex: 1; }
.auth-card__code-btn {
  flex-shrink: 0;
  appearance: none;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.06);
  color: rgba(230,235,243,.85);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: .85rem;
  padding: 0 14px;
  border-radius: 10px;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.auth-card__code-btn:hover:not(:disabled) {
  background: rgba(255,255,255,.11);
  border-color: var(--lamp-color);
  color: #fff;
}
.auth-card__code-btn:disabled { opacity: .5; cursor: not-allowed; }

.auth-card__options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: .86rem;
}
.auth-card__remember {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  color: rgba(230,235,243,.68);
  user-select: none;
}
.auth-card__remember input[type="checkbox"] {
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.06);
  cursor: pointer;
  position: relative;
  transition: border-color .2s, background .2s;
}
.auth-card__remember input[type="checkbox"]:checked {
  background: var(--lamp-color);
  border-color: var(--lamp-color);
}
.auth-card__remember input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 5px;
  height: 9px;
  border: solid #1f2937;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.auth-card__error {
  font-size: .85rem;
  color: #fca5a5;
  background: rgba(239, 68, 68, .12);
  border: 1px solid rgba(239, 68, 68, .32);
  border-radius: 10px;
  padding: 9px 12px;
}

.auth-card__submit {
  appearance: none;
  border: none;
  width: 100%;
  padding: 13px;
  border-radius: 10px;
  background: linear-gradient(135deg, #a3e635, #d9f99d);
  color: #1f2937;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  letter-spacing: .04em;
  cursor: pointer;
  box-shadow: 0 8px 24px -8px rgba(101, 163, 13, .45);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), filter .25s var(--ease);
}
.auth-card__submit:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px -10px rgba(101, 163, 13, .55);
  filter: brightness(1.05);
}
.auth-card__submit:active { transform: translateY(0); }

.auth-card__footer {
  margin-top: 16px;
  text-align: center;
}
.auth-card__footer .auth-card__link { font-size: .86rem; }

.auth-card__divider {
  margin: 22px 0 16px;
  position: relative;
  text-align: center;
}
.auth-card__divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(255,255,255,.10);
}
.auth-card__divider span {
  position: relative;
  z-index: 1;
  display: inline-block;
  padding: 0 12px;
  background: #131a29;
  font-size: .8rem;
  color: rgba(230,235,243,.40);
}

.auth-card__social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}
.auth-card__social button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: rgba(230,235,243,.60);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color .2s, color .2s, transform .2s, box-shadow .2s;
}
.auth-card__social button:hover {
  border-color: var(--lamp-color);
  color: var(--lamp-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -6px rgba(0,0,0,.5);
}

.auth-card__link {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--lamp-color, #a3e635);
  font-family: var(--font-body);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: color .2s;
}
.auth-card__link:hover { color: var(--lamp-light, #d9f99d); text-decoration: underline; }

/* 响应式 */
@media (max-width: 900px) {
  .auth-modal__stage {
    flex-direction: column;
    gap: 18px;
    padding-top: 70px;
    overflow-y: auto;
    align-items: center;
  }
  .auth-modal__toast { top: 18px; }
  .lamp { width: min(46vw, 190px); height: min(64vw, 260px); }
  .auth-card-slot {
    width: min(420px, calc(100vw - 32px));
    display: none;
  }
  .auth-modal.is-on .auth-card-slot,
  .auth-modal.is-error .auth-card-slot { display: flex; }
  .auth-card {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    transition: none;
  }
  .auth-card__inner { padding: 26px; }
}
@media (max-width: 480px) {
  .auth-card__code-row { flex-direction: column; }
  .auth-card__code-btn { width: 100%; padding: 10px 14px; }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  .auth-modal__scrim,
  .auth-modal__scrim::before,
  .auth-modal__stage,
  .auth-card,
  .lamp__bulb,
  .lamp__beam-svg,
  .lamp__pool,
  .lamp__face,
  .lamp__shade-shape,
  .lamp__pull-svgline,
  .lamp__pull-svgknob,
  .auth-card__field input,
  .auth-card__submit,
  .auth-card__social button,
  .auth-card__code-btn,
  .auth-card__link,
  .auth-modal__close,
  .lamp__theme,
  .lamp__pull {
    animation: none !important;
    transition-duration: .001ms !important;
  }
  .auth-card__field input.is-error-pulse { animation: none; }
}
