/* ============ 塔罗解读网站 - 样式 ============ */

/* 字体引入 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;600;700;900&family=Noto+Sans+SC:wght@300;400;500;700&display=swap');

:root {
  /* 神秘暗色主题 */
  --bg-deep: #0a0715;
  --bg-main: #110d1f;
  --bg-card: rgba(25, 18, 48, 0.75);
  --bg-card-hover: rgba(40, 30, 70, 0.85);
  --bg-glass: rgba(25, 18, 48, 0.5);
  --gold: #d4a853;
  --gold-light: #f0d68a;
  --gold-glow: rgba(212, 168, 83, 0.3);
  --purple: #7c3aed;
  --purple-dark: #4c1d95;
  --purple-light: #a78bfa;
  --cyan: #22d3ee;
  --text-primary: #f0eef6;
  --text-secondary: #b8b0d0;
  --text-muted: #7a729a;
  --border-color: rgba(124, 58, 237, 0.15);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --transition: all 0.3s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Noto Sans SC', sans-serif;
  background: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============ 星空背景 ============ */
.stars {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1px 1px at 10% 20%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 60%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 50% 10%, rgba(255,255,255,0.6) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 40%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 80%, rgba(255,255,255,0.3) 0%, transparent 100%),
    radial-gradient(1.5px 1.5px at 20% 90%, rgba(255,255,255,0.5) 0%, transparent 100%),
    radial-gradient(1px 1px at 80% 15%, rgba(255,255,255,0.4) 0%, transparent 100%),
    radial-gradient(1px 1px at 45% 75%, rgba(255,255,255,0.3) 0%, transparent 100%);
  animation: twinkle 4s ease-in-out infinite alternate;
}

@keyframes twinkle {
  0% { opacity: 0.6; }
  100% { opacity: 1; }
}

/* ============ 布局 ============ */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
  position: relative;
  z-index: 1;
}

header {
  text-align: center;
  padding: 40px 0 20px;
}

header h1 {
  font-family: 'Noto Serif SC', serif;
  font-size: 2.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 40px var(--gold-glow);
  letter-spacing: 4px;
}

header p {
  color: var(--text-muted);
  margin-top: 10px;
  font-size: 0.95rem;
  letter-spacing: 2px;
}

/* ============ 输入区 ============ */
.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 30px;
  margin-bottom: 24px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.section-title {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.question-area textarea {
  width: 100%;
  min-height: 100px;
  padding: 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: var(--transition);
}

.question-area textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 20px var(--gold-glow);
}

.question-area textarea::placeholder {
  color: var(--text-muted);
}

/* ============ 抽牌按钮 ============ */
.draw-methods {
  display: flex;
  gap: 16px;
  margin-top: 20px;
}

.draw-btn {
  flex: 1;
  padding: 18px 24px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-glass);
  color: var(--text-primary);
  font-family: 'Noto Serif SC', serif;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.draw-btn:hover {
  transform: translateY(-3px);
  border-color: var(--gold);
  box-shadow: 0 8px 30px var(--gold-glow);
}

.draw-btn:active {
  transform: translateY(-1px);
}

.draw-btn .btn-icon {
  font-size: 1.8rem;
}

.draw-btn .btn-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

.btn-ai {
  border-color: rgba(124, 58, 237, 0.3);
}

.btn-ai:hover {
  border-color: var(--purple-light);
  box-shadow: 0 8px 30px rgba(124, 58, 237, 0.2);
}

.btn-self {
  border-color: rgba(212, 168, 83, 0.3);
}

.btn-self:hover {
  border-color: var(--gold);
  box-shadow: 0 8px 30px var(--gold-glow);
}

.draw-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ============ 塔罗牌 ============ */
.cards-area {
  display: none;
}

.cards-area.visible {
  display: block;
}

.card-display {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 20px 0;
}

.tarot-card {
  width: 200px;
  height: 300px;
  perspective: 1200px;
  cursor: default;
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.tarot-card:hover {
  transform: translateY(-8px);
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d;
}

.tarot-card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card-face, .card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  overflow: hidden;
}

/* 牌背 */
.card-back {
  background: linear-gradient(135deg, #1a1040, #2d1b69);
  border: 2px solid var(--gold);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(212, 168, 83, 0.2);
  z-index: 2;
}

.card-back-pattern {
  width: 85%;
  height: 92%;
  border: 1.5px solid rgba(212, 168, 83, 0.25);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 30%, rgba(212, 168, 83, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 30% 70%, rgba(212, 168, 83, 0.04) 0%, transparent 40%),
    radial-gradient(circle at 70% 60%, rgba(212, 168, 83, 0.04) 0%, transparent 40%);
  position: relative;
}

.card-back-pattern::before {
  content: '✦';
  font-size: 3rem;
  color: var(--gold);
  text-shadow: 0 0 25px var(--gold-glow);
}

.card-back-pattern::after {
  content: '';
  position: absolute;
  top: 8px; left: 8px; right: 8px; bottom: 8px;
  border: 1px solid rgba(212, 168, 83, 0.12);
  border-radius: 4px;
}

/* ============ 牌面 ============ */
.card-face {
  border: 2px solid var(--gold);
  box-shadow: 0 4px 20px rgba(212, 168, 83, 0.15);
  transform: rotateY(180deg);
  display: flex;
  flex-direction: column;
  position: relative;
}

/* 牌面背景按花色 */
.card-face-suit-major {
  background: linear-gradient(180deg, #1a1040 0%, #0d0725 100%);
}

.card-face-suit-wands {
  background: linear-gradient(180deg, #1a0d06 0%, #120903 100%);
}

.card-face-suit-cups {
  background: linear-gradient(180deg, #06121a 0%, #030b12 100%);
}

.card-face-suit-swords {
  background: linear-gradient(180deg, #0d061a 0%, #080312 100%);
}

.card-face-suit-coins {
  background: linear-gradient(180deg, #061a0d 0%, #031208 100%);
}

/* 牌面装饰框 */
.card-face::before {
  content: '';
  position: absolute;
  top: 6px; left: 6px; right: 6px; bottom: 6px;
  border: 1px solid rgba(212, 168, 83, 0.15);
  border-radius: 8px;
  pointer-events: none;
  z-index: 0;
}

/* 四角装饰 */
.card-face::after {
  content: '◆';
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.5rem;
  color: var(--gold);
  opacity: 0.4;
  z-index: 0;
}

/* 牌面内容容器 */
.card-face-content {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
  text-align: center;
}

/* 顶部数字 */
.card-top-number {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: rgba(212, 168, 83, 0.4);
  letter-spacing: 2px;
  margin-bottom: 4px;
}

/* 中心符号 */
.card-center-symbol {
  font-size: 3.5rem;
  margin: 6px 0;
  line-height: 1;
  filter: drop-shadow(0 0 10px rgba(212, 168, 83, 0.2));
}

/* 牌名 */
.card-center-name {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold-light);
  margin: 4px 0;
  letter-spacing: 1px;
}

/* 底部花色 */
.card-bottom-suit {
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 3px;
  margin-top: 2px;
}

/* 正逆位标记 */
.card-position {
  font-size: 0.75rem;
  padding: 3px 14px;
  border-radius: 12px;
  font-weight: 600;
  margin-top: 8px;
  display: inline-block;
  letter-spacing: 1px;
}

.card-position.pos-upright {
  background: rgba(34, 211, 238, 0.12);
  color: var(--cyan);
  border: 1px solid rgba(34, 211, 238, 0.2);
}

.card-position.pos-reversed {
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
  border: 1px solid rgba(248, 113, 113, 0.2);
}

/* 底部小装饰 */
.card-face-footer {
  padding: 8px 0;
  text-align: center;
  position: relative;
  z-index: 1;
}

.card-face-footer::before {
  content: '';
  display: block;
  width: 60%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 168, 83, 0.2), transparent);
  margin: 0 auto 6px;
}

.card-face-footer span {
  font-size: 0.6rem;
  color: rgba(212, 168, 83, 0.25);
  letter-spacing: 4px;
}

/* 牌标签 */
.card-label {
  text-align: center;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ============ 按钮样式 ============ */
.glow-btn {
  padding: 12px 32px;
  border: 1px solid var(--gold);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(212,168,83,0.1), rgba(124,58,237,0.1));
  color: var(--gold-light);
  font-family: 'Noto Serif SC', serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.glow-btn:hover {
  background: linear-gradient(135deg, rgba(212,168,83,0.2), rgba(124,58,237,0.2));
  box-shadow: 0 0 30px var(--gold-glow);
  transform: translateY(-2px);
}

.glow-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ============ 解读区域 ============ */
.interpretation-area {
  display: none;
  animation: fadeInUp 0.6s ease;
}

.interpretation-area.visible {
  display: block;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.interpretation-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.interpretation-header .icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--gold), var(--purple));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.interpretation-header h2 {
  font-family: 'Noto Serif SC', serif;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gold);
}

.interpretation-content {
  line-height: 1.9;
  color: var(--text-secondary);
  font-size: 0.95rem;
  white-space: pre-wrap;
}

.interpretation-content h3, 
.interpretation-content strong {
  color: var(--gold-light);
}

/* ============ 加载状态 ============ */
.loading-overlay {
  display: none;
  text-align: center;
  padding: 40px;
}

.loading-overlay.visible {
  display: block;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 3px solid var(--border-color);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ============ 牌阵选择 ============ */
.spread-selector {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.spread-option {
  padding: 8px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.85rem;
}

.spread-option:hover {
  border-color: var(--gold);
  color: var(--gold-light);
}

.spread-option.active {
  border-color: var(--gold);
  background: rgba(212, 168, 83, 0.1);
  color: var(--gold);
}

/* ============ 用户交互 ============ */
.interaction-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 16px 0;
}

.action-btn {
  padding: 10px 24px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.action-btn:hover {
  border-color: var(--purple-light);
  color: var(--purple-light);
}

/* ============ 用户抽牌交互 ============ */
.user-draw-hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 10px;
  display: none;
}

.user-draw-hint.visible {
  display: block;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ============ 底部 ============ */
footer {
  text-align: center;
  padding: 30px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

footer a {
  color: var(--gold);
  text-decoration: none;
}

/* ============ 下载下拉菜单 ============ */
.download-group {
  position: relative;
}

.download-trigger {
  padding: 10px 24px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-glass);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.9rem;
}

.download-trigger:hover {
  border-color: var(--purple-light);
  color: var(--purple-light);
}

.download-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  min-width: 180px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
  margin-top: 6px;
}

.download-group:hover .download-menu,
.download-menu.open {
  display: block;
}

.download-menu button {
  display: block;
  width: 100%;
  padding: 12px 18px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}

.download-menu button:hover {
  background: rgba(124, 58, 237, 0.1);
  color: var(--purple-light);
}

.download-menu button:not(:last-child) {
  border-bottom: 1px solid var(--border-color);
}

/* ============ Toast 提示 ============ */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--gold);
  border-radius: var(--radius-md);
  padding: 12px 24px;
  color: var(--gold-light);
  font-size: 0.9rem;
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s ease;
  pointer-events: none;
  backdrop-filter: blur(12px);
}

.toast.visible {
  opacity: 1;
  animation: toastIn 0.3s ease;
}

/* ============ 选牌弹窗 ============ */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(5, 3, 15, 0.85);
  z-index: 5000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.modal-overlay.visible {
  display: flex;
}

.modal-box {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 700px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-family: 'Noto Serif SC', serif;
  color: var(--gold);
  font-size: 1.15rem;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: var(--transition);
  padding: 4px 8px;
}

.modal-close:hover {
  color: var(--gold);
}

.modal-body {
  padding: 16px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.search-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
  margin-bottom: 12px;
}

.search-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 15px var(--gold-glow);
}

.picker-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.picker-rev-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ============ 分组 Tab ============ */
.group-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.group-tab {
  padding: 7px 14px;
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--bg-glass);
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.82rem;
  white-space: nowrap;
}

.group-tab:hover {
  border-color: var(--gold);
  color: var(--gold-light);
}

.group-tab.active {
  border-color: var(--gold);
  background: rgba(212, 168, 83, 0.12);
  color: var(--gold);
  box-shadow: 0 0 12px var(--gold-glow);
}

/* ============ 卡牌网格 ============ */
.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
  padding: 4px;
}

.picker-card {
  background: var(--bg-glass);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.picker-card:hover {
  border-color: rgba(212, 168, 83, 0.3);
  background: rgba(212, 168, 83, 0.05);
  transform: translateY(-2px);
}

/* 选中 - 正位 */
.picker-card.selected {
  border-color: var(--gold);
  background: rgba(212, 168, 83, 0.1);
  box-shadow: 0 0 12px var(--gold-glow);
}

/* 选中 - 逆位 */
.picker-card.selected.reversed {
  border-color: #f87171;
  background: rgba(248, 113, 113, 0.08);
  box-shadow: 0 0 12px rgba(248, 113, 113, 0.2);
}

.picker-symbol {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.picker-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.picker-arcana {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.picker-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.picker-num {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.picker-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 4px;
  background: rgba(212, 168, 83, 0.2);
  color: var(--gold);
}

.picker-card.selected.reversed .picker-badge {
  background: rgba(248, 113, 113, 0.2);
  color: #f87171;
}

.picker-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  background: var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: #000;
  font-weight: 700;
  opacity: 0;
  transition: var(--transition);
}

/* ============ 响应式 ============ */
@media (max-width: 768px) {
  .container { padding: 12px; }
  header h1 { font-size: 1.8rem; }
  .section-card { padding: 20px; }
  .draw-methods { flex-direction: column; }
  .tarot-card { width: 140px; height: 220px; }
  .card-display { gap: 12px; }
  .picker-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .modal-box { width: 95%; max-height: 90vh; }
}

@media (max-width: 480px) {
  .tarot-card { width: 110px; height: 175px; }
  .draw-btn { padding: 14px; font-size: 0.95rem; }
  .card-display { gap: 8px; }
}
