/* ============================================
   神秘星空童话 · 主题 CSS
   深色背景 + 发光元素 + 星星/流星动画
   ============================================ */

/* ===== 星空主题 CSS 变量 ===== */
:root {
  --galaxy-purple: #2B1B54;
  --galaxy-purple-light: #3D2A6E;
  --star-gold: #FFD700;
  --nebula-pink: #FF6B9D;
  --moon-white: #E0E7FF;
  --star-gold-glow: rgba(255, 215, 0, 0.35);
  --nebula-pink-glow: rgba(255, 107, 157, 0.3);
  --moon-white-glow: rgba(224, 231, 255, 0.2);
  --glass-bg: rgba(43, 27, 84, 0.65);
  --glass-border: rgba(224, 231, 255, 0.15);
}

/* ===== 背景星空 ===== */
.starry-bg {
  position: fixed;
  inset: 0;
  background: var(--galaxy-purple);
  overflow: hidden;
  z-index: 0;
}

/* 星星由 JS 生成，这里放备用 CSS 星星 */
.star {
  position: absolute;
  background: var(--star-gold);
  border-radius: 50%;
  animation: twinkle var(--dur, 3s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

@keyframes twinkle {
  0%, 100% { opacity: var(--min-op, 0.3); transform: scale(1); }
  50% { opacity: var(--max-op, 1); transform: scale(1.3); }
}

/* ===== 流星动画 ===== */
.shooting-star {
  position: fixed;
  width: 3px;
  height: 3px;
  background: var(--moon-white);
  border-radius: 50%;
  box-shadow: 0 0 6px 2px var(--moon-white), 0 0 12px 4px rgba(224, 231, 255, 0.3);
  z-index: 1;
  pointer-events: none;
  animation: shoot var(--fly-dur, 1.2s) ease-out forwards;
  animation-delay: var(--fly-delay, 0s);
}

.shooting-star::after {
  content: '';
  position: absolute;
  top: 50%;
  right: 100%;
  width: 80px;
  height: 2px;
  background: linear-gradient(to left, var(--moon-white), transparent);
  transform: translateY(-50%);
  border-radius: 1px;
}

.shooting-star::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  background: var(--moon-white);
  border-radius: 50%;
  box-shadow: 0 0 8px 4px var(--moon-white);
  transform: translate(-50%, -50%);
  opacity: 0;
  animation: sparkle-burst 0.6s ease-out forwards;
  animation-delay: calc(var(--fly-dur, 1.2s) - 0.3s);
}

@keyframes shoot {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  70% {
    opacity: 1;
  }
  100% {
    transform: translate(var(--fly-x, -300px), var(--fly-y, 200px)) scale(0.2);
    opacity: 0;
  }
}

@keyframes sparkle-burst {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(2); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
}

/* ===== 流星划过时页面变亮 ===== */
.starry-bg.flash::after {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(224, 231, 255, 0.06);
  pointer-events: none;
  animation: flash-fade 0.5s ease-out forwards;
  z-index: 2;
}

@keyframes flash-fade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

/* ===== 卡片 ===== */
.starry-card {
  background: var(--glass-bg) !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--glass-border) !important;
  box-shadow: 0 0 15px var(--moon-white-glow), 0 4px 20px rgba(0,0,0,0.3) !important;
  border-radius: 18px !important;
  position: relative;
  overflow: hidden;
  animation: card-fall 0.6s cubic-bezier(0.2, 0.8, 0.3, 1) both;
}

.starry-card::before {
  content: '';
  position: absolute;
  top: 10%;
  left: 15%;
  width: 3px;
  height: 3px;
  background: var(--star-gold);
  border-radius: 50%;
  box-shadow: 0 0 4px 1px var(--star-gold);
  animation: twinkle 2.5s ease-in-out infinite;
  animation-delay: 0.2s;
}

.starry-card::after {
  content: '';
  position: absolute;
  bottom: 20%;
  right: 20%;
  width: 2px;
  height: 2px;
  background: var(--moon-white);
  border-radius: 50%;
  box-shadow: 0 0 3px 1px var(--moon-white);
  animation: twinkle 3s ease-in-out infinite;
  animation-delay: 1s;
}

@keyframes card-fall {
  0% { opacity: 0; transform: translateY(-30px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* ===== 按钮 ===== */
.starry-btn {
  border: none !important;
  cursor: pointer;
  font-weight: 800 !important;
  padding: 13px 22px !important;
  border-radius: 40px !important;
  background: rgba(255, 215, 0, 0.2) !important;
  color: var(--star-gold) !important;
  font-size: 16px !important;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.3s ease,
              background 0.3s ease !important;
  box-shadow: 0 0 12px var(--nebula-pink-glow), inset 0 0 8px rgba(255, 215, 0, 0.1) !important;
  border: 1px solid rgba(255, 107, 157, 0.3) !important;
  min-height: 48px;
}

.starry-btn:hover {
  transform: translateY(-3px) scale(1.04) !important;
  box-shadow: 0 0 20px var(--star-gold-glow), 0 0 30px var(--nebula-pink-glow), inset 0 0 12px rgba(255, 215, 0, 0.15) !important;
  background: rgba(255, 215, 0, 0.28) !important;
}

.starry-btn:active {
  transform: scale(0.94) !important;
  transition-duration: 0.08s !important;
}

/* 主按钮（实心金色） */
.starry-btn-primary {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.35), rgba(255, 107, 157, 0.25)) !important;
  color: var(--star-gold) !important;
  box-shadow: 0 0 16px var(--star-gold-glow), 0 0 24px var(--nebula-pink-glow) !important;
  border: 1px solid rgba(255, 215, 0, 0.4) !important;
}

.starry-btn-primary:hover {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.45), rgba(255, 107, 157, 0.35)) !important;
  box-shadow: 0 0 24px var(--star-gold-glow), 0 0 36px var(--nebula-pink-glow) !important;
}

/* 幽灵按钮（透明边框） */
.starry-btn-ghost {
  background: rgba(224, 231, 255, 0.06) !important;
  color: var(--moon-white) !important;
  box-shadow: none !important;
  border: 1px solid rgba(224, 231, 255, 0.2) !important;
}

.starry-btn-ghost:hover {
  background: rgba(224, 231, 255, 0.12) !important;
  box-shadow: 0 0 12px var(--moon-white-glow) !important;
  transform: translateY(-2px) scale(1.02) !important;
}

/* ===== 输入框 ===== */
.starry-field {
  width: 100% !important;
  padding: 14px 16px !important;
  border-radius: 14px !important;
  border: 1px solid rgba(224, 231, 255, 0.2) !important;
  background: rgba(43, 27, 84, 0.5) !important;
  color: var(--moon-white) !important;
  font-size: 16px !important;
  outline: none !important;
  transition: border 0.2s, box-shadow 0.2s !important;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.starry-field::placeholder {
  color: rgba(224, 231, 255, 0.4) !important;
}

.starry-field:focus {
  border-color: var(--star-gold) !important;
  box-shadow: 0 0 12px var(--star-gold-glow) !important;
}

/* ===== 文字 ===== */
.starry-text {
  color: var(--moon-white);
  text-shadow: 0 0 8px rgba(224, 231, 255, 0.3);
}

.starry-title {
  color: var(--star-gold);
  text-shadow: 0 0 12px var(--star-gold-glow), 0 0 24px rgba(255, 215, 0, 0.15);
  font-weight: 800;
  letter-spacing: 0.02em;
}

/* ===== 徽章 / 标签 ===== */
.starry-chip {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(255, 215, 0, 0.15);
  color: var(--star-gold);
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(255, 215, 0, 0.2);
  box-shadow: 0 0 6px var(--star-gold-glow);
}

.starry-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--nebula-pink);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 0 8px var(--nebula-pink-glow);
}

/* ===== 列表项 ===== */
.starry-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 4px;
  border-bottom: 1px solid rgba(224, 231, 255, 0.08);
  color: var(--moon-white);
}

/* ===== Tab 栏 ===== */
.starry-tabbar {
  background: rgba(43, 27, 84, 0.85) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid rgba(224, 231, 255, 0.08) !important;
}

.starry-tab {
  color: rgba(224, 231, 255, 0.5) !important;
  transition: color 0.2s, background 0.2s !important;
}

.starry-tab.active {
  color: var(--star-gold) !important;
  background: rgba(255, 215, 0, 0.1) !important;
}

/* ===== Header ===== */
.starry-header {
  background: rgba(43, 27, 84, 0.7) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(224, 231, 255, 0.06) !important;
  color: var(--star-gold) !important;
}

/* ===== 空状态 ===== */
.starry-empty {
  text-align: center;
  padding: 46px 20px;
  color: rgba(224, 231, 255, 0.5);
}

/* ===== 聊天气泡 ===== */
.starry-bubble-them {
  background: rgba(43, 27, 84, 0.7) !important;
  border: 1px solid rgba(224, 231, 255, 0.1) !important;
  color: var(--moon-white) !important;
}

.starry-bubble-me {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.25), rgba(255, 107, 157, 0.2)) !important;
  border: 1px solid rgba(255, 215, 0, 0.2) !important;
  color: var(--star-gold) !important;
}

/* ===== Toast ===== */
.starry-toast {
  background: rgba(43, 27, 84, 0.9) !important;
  border: 1px solid rgba(255, 215, 0, 0.2) !important;
  color: var(--star-gold) !important;
  box-shadow: 0 0 20px var(--star-gold-glow) !important;
}

/* ===== 进度环 ===== */
.starry-ring text {
  fill: var(--star-gold) !important;
}

/* ===== 登录页专用 ===== */
.starry-login-wrap {
  max-width: 430px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 28px;
  position: relative;
  z-index: 1;
}

.starry-login-title {
  text-align: center;
  font-size: 28px;
  font-weight: 800;
  color: var(--star-gold);
  text-shadow: 0 0 16px var(--star-gold-glow), 0 0 32px rgba(255, 215, 0, 0.2);
  margin-bottom: 4px;
}

.starry-login-subtitle {
  text-align: center;
  color: rgba(224, 231, 255, 0.6);
  font-size: 14px;
  margin-bottom: 32px;
}

.starry-login-tip {
  text-align: center;
  color: rgba(224, 231, 255, 0.4);
  font-size: 13px;
  margin-top: 16px;
}

.starry-login-tip a {
  color: var(--star-gold);
  text-decoration: none;
}

/* ===== 错误/成功消息 ===== */
.starry-error {
  color: var(--nebula-pink) !important;
  text-shadow: 0 0 8px var(--nebula-pink-glow);
  font-size: 14px;
  text-align: center;
  margin-bottom: 12px;
  min-height: 20px;
}

.starry-success {
  color: var(--star-gold) !important;
  text-shadow: 0 0 8px var(--star-gold-glow);
  font-size: 14px;
  text-align: center;
  margin-bottom: 12px;
  min-height: 20px;
}

/* ===== 功能图标区 ===== */
.starry-features {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 28px;
  font-size: 13px;
  color: rgba(224, 231, 255, 0.6);
}

.starry-features span {
  text-align: center;
}

.starry-features .ico {
  font-size: 26px;
  display: block;
  margin-bottom: 4px;
}

/* ===== 响应式 ===== */
@media (max-width: 430px) {
  .starry-login-wrap { padding: 30px 20px; }
}
