/* ===== 基础 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --bg-0: #0a0420;
  --bg-1: #1a0b3d;
  --bg-2: #2d1457;
  --primary: #9b7bff;
  --primary-glow: #b794ff;
  --gold: #ffd166;
  --pink: #ff7eb3;
  --cyan: #21d4fd;
  --text: #e8e3ff;
  --text-dim: #a89fc9;
  --card-bg: rgba(40, 20, 80, 0.5);
  --card-border: rgba(155, 123, 255, 0.3);
  --shadow-glow: 0 0 40px rgba(155, 123, 255, 0.3);
  --radius: 18px;
  --font-cn: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}
html, body {
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-cn);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font-family: inherit; }

/* ===== 星空背景 ===== */
.cosmos {
  position: fixed; inset: 0; z-index: -1;
  background: radial-gradient(ellipse at top, #1a0b3d 0%, #0a0420 50%, #050010 100%);
  overflow: hidden;
}
.stars {
  position: absolute; inset: 0;
  background-image:
    radial-gradient(1px 1px at 20% 30%, white, transparent),
    radial-gradient(1px 1px at 60% 70%, white, transparent),
    radial-gradient(2px 2px at 40% 50%, #fff, transparent),
    radial-gradient(1px 1px at 80% 20%, #ffd166, transparent),
    radial-gradient(1px 1px at 10% 80%, #b794ff, transparent),
    radial-gradient(1px 1px at 90% 90%, #21d4fd, transparent),
    radial-gradient(1px 1px at 30% 10%, white, transparent),
    radial-gradient(2px 2px at 70% 40%, white, transparent);
  background-size: 200% 200%;
  animation: twinkle 8s ease-in-out infinite;
}
.stars-2 {
  background-image:
    radial-gradient(1px 1px at 15% 60%, white, transparent),
    radial-gradient(1px 1px at 85% 15%, #fff, transparent),
    radial-gradient(1px 1px at 50% 85%, #ffd166, transparent),
    radial-gradient(1px 1px at 25% 25%, #b794ff, transparent);
  background-size: 300% 300%;
  animation: twinkle 12s ease-in-out infinite reverse;
  opacity: 0.7;
}
.stars-3 {
  background-image:
    radial-gradient(2px 2px at 50% 50%, #fff, transparent),
    radial-gradient(1px 1px at 70% 30%, #21d4fd, transparent);
  background-size: 400% 400%;
  animation: twinkle 15s ease-in-out infinite;
  opacity: 0.5;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}
.moon {
  position: absolute; top: 8%; right: 8%;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff5d1, #ffd166 50%, #ff9a3c);
  box-shadow: 0 0 60px rgba(255, 209, 102, 0.5),
              0 0 120px rgba(255, 154, 60, 0.3);
}
.shooting-star {
  position: absolute; top: 20%; left: 0;
  width: 100px; height: 1px;
  background: linear-gradient(90deg, transparent, white, transparent);
  animation: shoot 8s linear infinite;
  animation-delay: 3s;
  opacity: 0;
}
@keyframes shoot {
  0% { transform: translateX(-100px) translateY(0); opacity: 0; }
  5% { opacity: 1; }
  15% { transform: translateX(800px) translateY(300px); opacity: 0; }
  100% { opacity: 0; }
}

/* ===== 导航 ===== */
.nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 6vw;
  background: rgba(10, 4, 32, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(155, 123, 255, 0.15);
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; }
.logo-mark {
  display: inline-block; font-size: 22px;
  color: var(--gold);
  animation: spin 8s linear infinite;
  text-shadow: 0 0 15px var(--gold);
}
@keyframes spin { to { transform: rotate(360deg); } }
.logo-text { background: linear-gradient(90deg, #fff, #b794ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav-links { display: flex; gap: 32px; }
.nav-links a { color: var(--text-dim); font-size: 14px; transition: color .3s; position: relative; }
.nav-links a:hover { color: var(--primary-glow); }
.nav-links a::after {
  content: ''; position: absolute; bottom: -6px; left: 50%;
  width: 0; height: 1px; background: var(--primary-glow);
  transition: all .3s;
}
.nav-links a:hover::after { width: 100%; left: 0; }
.menu-toggle { display: none; font-size: 22px; color: var(--text); }

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 85vh;
  display: flex; align-items: center; justify-content: space-between;
  padding: 80px 6vw 100px;
  overflow: hidden;
}
.hero-inner { max-width: 600px; z-index: 2; }
.eyebrow {
  color: var(--gold); font-size: 14px; letter-spacing: 4px;
  margin-bottom: 20px; opacity: 0;
  animation: fadeUp 1s .2s forwards;
}
.hero-title {
  font-size: clamp(40px, 6vw, 72px);
  font-weight: 800; line-height: 1.15;
  margin-bottom: 24px;
  opacity: 0;
  animation: fadeUp 1s .5s forwards;
}
.accent { color: var(--primary-glow); }
.accent-glow {
  background: linear-gradient(90deg, #b794ff, #ff7eb3, #ffd166, #21d4fd);
  background-size: 300% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: gradientFlow 6s linear infinite;
}
@keyframes gradientFlow { to { background-position: 300% 0; } }
.hero-sub {
  color: var(--text-dim); font-size: 18px;
  margin-bottom: 36px; max-width: 480px;
  opacity: 0;
  animation: fadeUp 1s .8s forwards;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.btn {
  display: inline-block; padding: 14px 28px;
  border-radius: 999px; font-size: 15px; font-weight: 600;
  transition: all .3s; position: relative;
}
.btn-primary {
  background: linear-gradient(135deg, #9b7bff, #ff7eb3);
  color: #fff;
  box-shadow: 0 8px 30px rgba(155, 123, 255, 0.4);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 12px 40px rgba(155, 123, 255, 0.6); }
.btn-ghost {
  background: rgba(155, 123, 255, 0.1);
  border: 1px solid var(--card-border);
  color: var(--text);
}
.btn-ghost:hover { background: rgba(155, 123, 255, 0.2); border-color: var(--primary-glow); }
.btn-lg { padding: 16px 36px; font-size: 16px; }
.btn-block { display: block; width: 100%; }

/* Hero 装饰 */
.hero-decor {
  position: absolute; right: 6vw; top: 50%;
  transform: translateY(-50%);
  width: 400px; height: 400px; z-index: 1;
}
.orbit {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px dashed rgba(155, 123, 255, 0.2);
}
.orbit-2 { inset: 40px; border-color: rgba(255, 126, 179, 0.2); animation: spin 30s linear infinite reverse; }
.orbit-1 { animation: spin 20s linear infinite; }
.planet {
  position: absolute; top: 50%; left: 50%;
  width: 80px; height: 80px; margin: -40px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #b794ff, #9b7bff 50%, #5a3d9c);
  box-shadow: 0 0 60px rgba(155, 123, 255, 0.6),
              inset -10px -10px 20px rgba(0, 0, 0, 0.3);
}

/* ===== Section ===== */
.section {
  padding: 80px 6vw;
  max-width: 1200px; margin: 0 auto;
}
.section-head { text-align: center; margin-bottom: 48px; }
.section-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  margin-bottom: 12px;
  background: linear-gradient(90deg, #fff, #b794ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.section-desc { color: var(--text-dim); font-size: 16px; }

/* ===== 表单 ===== */
.fortune-form-wrap { max-width: 720px; margin: 0 auto; }
.fortune-form {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 36px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-glow);
}
.field { display: flex; flex-direction: column; gap: 8px; }
.field-wide { grid-column: 1 / -1; }
.field label { font-size: 14px; color: var(--text-dim); }
.field input {
  background: rgba(10, 4, 32, 0.6);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 12px 16px;
  color: var(--text);
  font-size: 15px;
  transition: all .3s;
}
.field input:focus { outline: none; border-color: var(--primary-glow); box-shadow: 0 0 0 3px rgba(155, 123, 255, 0.2); }

.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(155, 123, 255, 0.1);
  border: 1px solid var(--card-border);
  font-size: 14px;
  transition: all .3s;
}
.chip:hover { background: rgba(155, 123, 255, 0.2); }
.chip.active {
  background: linear-gradient(135deg, #9b7bff, #ff7eb3);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 15px rgba(155, 123, 255, 0.4);
}

.fortune-form .btn-block { grid-column: 1 / -1; margin-top: 8px; }

/* ===== 运势结果 ===== */
.fortune-result { margin-top: 48px; }
.fortune-result.hidden { display: none; }
.result-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 40px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-glow);
  animation: fadeUp .8s;
}
.result-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; gap: 24px; flex-wrap: wrap; }
.result-greet { color: var(--text-dim); font-size: 14px; }
.result-head h3 { font-size: 28px; margin: 4px 0 8px; color: var(--primary-glow); }
.result-tag { color: var(--text-dim); font-size: 14px; }
.result-tag span { color: var(--gold); }

.score-ring {
  position: relative;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: conic-gradient(var(--primary) 0deg, var(--primary) 88deg, rgba(155, 123, 255, 0.15) 88deg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: background 1.5s;
}
.score-ring::before {
  content: ''; position: absolute; inset: 6px;
  border-radius: 50%;
  background: var(--bg-1);
}
.score-num { position: relative; font-size: 32px; font-weight: 800; color: var(--primary-glow); }
.score-label { position: relative; font-size: 12px; color: var(--text-dim); }

.result-poem {
  font-style: italic; color: var(--gold);
  text-align: center; padding: 20px;
  background: rgba(255, 209, 102, 0.05);
  border-left: 3px solid var(--gold);
  border-radius: 8px;
  margin: 24px 0;
}
.result-text { color: var(--text); font-size: 16px; line-height: 1.8; margin-bottom: 32px; }

.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 32px; }
.metric {
  display: flex; align-items: center; gap: 12px;
  padding: 16px;
  background: rgba(10, 4, 32, 0.4);
  border-radius: 12px;
  border: 1px solid rgba(155, 123, 255, 0.15);
}
.m-icon { font-size: 24px; }
.m-info { flex: 1; }
.m-label { font-size: 13px; color: var(--text-dim); display: block; margin-bottom: 6px; }
.m-bar { height: 4px; background: rgba(155, 123, 255, 0.15); border-radius: 2px; overflow: hidden; }
.m-bar i {
  display: block; height: 100%;
  width: var(--w, 50%);
  background: linear-gradient(90deg, var(--primary), var(--pink));
  border-radius: 2px;
  animation: grow 1.5s ease-out;
}
@keyframes grow { from { width: 0 !important; } }
.m-num { font-weight: 700; color: var(--primary-glow); font-size: 15px; min-width: 28px; text-align: right; }

.result-extras {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px; padding-top: 28px;
  border-top: 1px dashed var(--card-border);
}
.extra { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.e-label { color: var(--text-dim); }
.e-color { width: 18px; height: 18px; border-radius: 50%; box-shadow: 0 0 10px currentColor; }
.e-num { font-size: 20px; font-weight: 700; color: var(--gold); }
.e-yi { color: #55efc4; }
.e-ji { color: #ff7675; }

.result-actions { display: flex; gap: 12px; justify-content: center; margin-top: 32px; flex-wrap: wrap; }

/* ===== 塔罗 ===== */
.tarot-stage { text-align: center; }
.tarot-cards {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 14px; max-width: 800px; margin: 0 auto 24px;
}
.tarot-card {
  position: relative;
  aspect-ratio: 2/3.4;
  border-radius: 12px;
  background: linear-gradient(135deg, #2d1457, #1a0b3d);
  border: 2px solid rgba(255, 209, 102, 0.4);
  cursor: pointer;
  transition: all .4s;
  overflow: hidden;
  perspective: 1000px;
}
.tarot-card::before {
  content: '✦';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; color: var(--gold);
  opacity: 0.4;
}
.tarot-card:hover { transform: translateY(-8px) scale(1.05); border-color: var(--gold); box-shadow: 0 12px 30px rgba(255, 209, 102, 0.3); }
.tarot-card.flipped {
  background: linear-gradient(135deg, #1a0b3d, #050010);
  border-color: var(--primary-glow);
  box-shadow: 0 0 40px rgba(155, 123, 255, 0.5);
  cursor: default;
}
.tarot-card .t-front {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 12px; text-align: center;
  opacity: 0; transition: opacity .4s .2s;
}
.tarot-card.flipped::before { opacity: 0; }
.tarot-card.flipped .t-front { opacity: 1; }
.t-emoji { font-size: 36px; margin-bottom: 6px; }
.t-name { font-size: 13px; color: var(--primary-glow); font-weight: 700; margin-bottom: 4px; }
.t-key { font-size: 10px; color: var(--text-dim); }
.t-direction { position: absolute; top: 6px; right: 6px; font-size: 10px; color: var(--gold); }
.tarot-hint { color: var(--text-dim); font-size: 14px; font-style: italic; }
.tarot-result {
  margin-top: 32px; max-width: 600px; margin-left: auto; margin-right: auto;
  padding: 28px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  animation: fadeUp .8s;
}
.tarot-result.hidden { display: none; }
.tarot-result h4 { color: var(--primary-glow); font-size: 22px; margin-bottom: 12px; }
.tarot-result .t-poem { color: var(--gold); font-style: italic; margin-bottom: 16px; }
.tarot-result .t-text { color: var(--text); line-height: 1.8; margin-bottom: 20px; }
.tarot-result .t-advice {
  background: rgba(155, 123, 255, 0.1);
  border-left: 3px solid var(--primary-glow);
  padding: 14px 18px; border-radius: 8px;
  color: var(--text-dim); font-size: 14px;
}

/* ===== 历史 ===== */
.history-list { max-width: 800px; margin: 0 auto; }
.history-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  margin-bottom: 12px;
  transition: all .3s;
  gap: 16px; flex-wrap: wrap;
}
.history-item:hover { border-color: var(--primary-glow); transform: translateX(4px); }
.h-left { display: flex; align-items: center; gap: 14px; }
.h-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, #9b7bff, #ff7eb3);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff;
}
.h-info h5 { font-size: 15px; margin-bottom: 4px; }
.h-info p { font-size: 12px; color: var(--text-dim); }
.h-score {
  font-size: 24px; font-weight: 800;
  background: linear-gradient(135deg, var(--primary-glow), var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.h-score-label { font-size: 11px; color: var(--text-dim); }
.empty { text-align: center; color: var(--text-dim); padding: 40px; font-style: italic; }
.history-actions { text-align: center; margin-top: 24px; }

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 40px 6vw 30px;
  border-top: 1px solid rgba(155, 123, 255, 0.15);
  color: var(--text-dim);
  font-size: 14px;
  margin-top: 80px;
}
.disclaimer { font-size: 12px; opacity: 0.6; margin-top: 8px; }

/* ===== 响应式 ===== */
@media (max-width: 768px) {
  .nav-links {
    display: flex; flex-direction: column; gap: 0;
    position: absolute; top: 100%; left: 0; right: 0;
    max-height: 0; overflow: hidden;
    background: rgba(10, 4, 32, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--card-border);
    padding: 0 6vw;
    transition: max-height .4s ease, padding .3s ease;
  }
  .nav-links.open {
    max-height: 400px;
    padding: 16px 6vw;
  }
  .nav-links a { padding: 12px 0; border-bottom: 1px solid rgba(155, 123, 255, 0.1); }
  .nav-links a:last-child { border-bottom: none; }
  .menu-toggle { display: block; }
  .hero { flex-direction: column; text-align: center; padding-top: 40px; }
  .hero-sub { margin-left: auto; margin-right: auto; }
  .hero-decor { display: none; }
  .fortune-form { grid-template-columns: 1fr; padding: 24px; }
  .result-head { flex-direction: column; align-items: center; text-align: center; }
  .result-card { padding: 24px; }
  .tarot-cards { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .section { padding: 60px 5vw; }
}
@media (max-width: 480px) {
  .tarot-cards { grid-template-columns: repeat(3, 1fr); }
  .t-emoji { font-size: 28px; }
  .t-name { font-size: 11px; }
  .nav { padding: 14px 5vw; }
  .logo-text { font-size: 16px; }
  .result-card { padding: 20px; }
  .result-head h3 { font-size: 22px; }
}

/* 触屏优化：禁用双击缩放、点击高亮 */
* { -webkit-tap-highlight-color: transparent; }
button, .chip, .tarot-card { -webkit-user-select: none; user-select: none; }
