/**
 * ============================================================================
 * cabbage塔罗抽牌网页 —— 主样式文件
 * ============================================================================
 * 
 * 配色方案：暗紫 + 金色
 *   - 主背景：深紫黑渐变 (#0d0a1f → #1a0d3d)
 *   - 强调色：金色 (#d4af37)
 *   - 副强调：淡紫 (#9d4edd)
 *   - 毛玻璃：半透明白 + blur
 * 
 * 如需修改颜色，调整下方 CSS 变量即可
 * ============================================================================
 */

/* ==================== CSS 变量（方便统一修改主题） ==================== */
:root {
  /* 背景色 */
  --bg-deep: #0d0a1f;        /* 最深的底色 */
  --bg-mid: #1a0d3d;         /* 中间紫色 */
  --bg-light: #2d1b4e;       /* 浅紫色层次 */
  
  /* 强调色 */
  --gold: #d4af37;           /* 主金色 */
  --gold-light: #f0d060;     /* 亮金色 */
  --gold-dark: #b8960f;      /* 暗金色 */
  
  /* 紫色系 */
  --purple-primary: #9d4edd; /* 主紫 */
  --purple-light: #c77dff;   /* 亮紫 */
  --purple-glass: rgba(157, 78, 221, 0.15); /* 毛玻璃紫 */
  
  /* 文字色 */
  --text-white: #f0e6ff;
  --text-muted: #a89cc0;
  --text-gold: var(--gold);
  
  /* 毛玻璃 */
  --glass-bg: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(212, 175, 55, 0.25);
  --glass-blur: 12px;
  
  /* 字体 */
  --font-serif: 'Georgia', 'Times New Roman', serif;
  --font-sans: 'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}


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

html, body {
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
}

body {
  font-family: var(--font-sans);
  color: var(--text-white);
  line-height: 1.6;
  
  /* 深色星空背景 - 多层渐变叠加 */
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(157, 78, 221, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 30%, rgba(212, 175, 55, 0.08) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 80%, rgba(100, 50, 150, 0.2) 0%, transparent 50%),
    linear-gradient(135deg, var(--bg-deep) 0%, var(--bg-mid) 50%, #0f0829 100%);
  
  /* 固定背景，不随滚动移动 */
  background-attachment: fixed;
  position: relative;
}

/* 星空层 - 使用伪元素生成星点 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  
  /* 生成星点背景（使用多个 radial-gradient） */
  background-image: 
    radial-gradient(1px 1px at 10% 15%, white, transparent),
    radial-gradient(1px 1px at 25% 35%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1.5px 1.5px at 50% 10%, white, transparent),
    radial-gradient(1px 1px at 70% 25%, rgba(212,175,55,0.8), transparent),
    radial-gradient(1px 1px at 85% 60%, white, transparent),
    radial-gradient(1.5px 1.5px at 15% 75%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 40% 85%, white, transparent),
    radial-gradient(1px 1px at 65% 70%, rgba(157,78,221,0.8), transparent),
    radial-gradient(1px 1px at 90% 90%, white, transparent),
    radial-gradient(1.5px 1.5px at 5% 50%, rgba(212,175,55,0.6), transparent),
    radial-gradient(1px 1px at 35% 55%, white, transparent),
    radial-gradient(1px 1px at 55% 45%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 75% 15%, white, transparent),
    radial-gradient(1px 1px at 95% 40%, rgba(157,78,221,0.5), transparent),
    radial-gradient(1.5px 1.5px at 30% 95%, white, transparent);
  
  /* 星星闪烁动画 */
  animation: twinkle 4s ease-in-out infinite alternate;
}

/* 第二层星点 */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  
  background-image: 
    radial-gradient(1px 1px at 20% 5%, rgba(212,175,55,0.5), transparent),
    radial-gradient(1px 1px at 60% 55%, white, transparent),
    radial-gradient(1px 1px at 80% 80%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1px 1px at 45% 25%, rgba(157,78,221,0.6), transparent),
    radial-gradient(1px 1px at 5% 85%, white, transparent),
    radial-gradient(1px 1px at 95% 10%, rgba(212,175,55,0.4), transparent);
  
  animation: twinkle 6s ease-in-out infinite alternate-reverse;
}

/* 星星闪烁 keyframes */
@keyframes twinkle {
  0% { opacity: 0.4; }
  50% { opacity: 1; }
  100% { opacity: 0.6; }
}

/* 主内容容器 - 确保在星空层之上 */
.container {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}


/* ==================== 标题区 ==================== */
.header {
  text-align: center;
  margin-bottom: 40px;
}

.header h1 {
  font-family: var(--font-serif);
  font-size: 2.8rem;
  color: var(--gold);
  text-shadow: 
    0 0 20px rgba(212, 175, 55, 0.4),
    0 0 40px rgba(212, 175, 55, 0.2);
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.header .subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

/* 金色分割线 */
.divider {
  width: 80px;
  height: 2px;
  margin: 20px auto;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}


/* ==================== 通用卡片样式（毛玻璃效果） ==================== */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 24px;
  box-shadow: 
    0 4px 30px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.glass-card h2 {
  font-family: var(--font-serif);
  color: var(--gold);
  font-size: 1.3rem;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}


/* ==================== 牌阵选择区 ==================== */
.spread-selector {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.spread-btn {
  flex: 1;
  min-width: 180px;
  max-width: 250px;
  padding: 18px 20px;
  background: rgba(157, 78, 221, 0.1);
  border: 2px solid rgba(157, 78, 221, 0.3);
  border-radius: 12px;
  color: var(--text-white);
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  font-family: inherit;
}

.spread-btn:hover {
  background: rgba(157, 78, 221, 0.2);
  border-color: var(--purple-light);
  transform: translateY(-2px);
}

.spread-btn.active {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(157, 78, 221, 0.2));
  border-color: var(--gold);
  box-shadow: 
    0 0 20px rgba(212, 175, 55, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.spread-btn .icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}

.spread-btn .label {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gold-light);
}

.spread-btn .desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}


/* ==================== 问题输入区 ==================== */
.question-section textarea {
  width: 100%;
  min-height: 80px;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(212, 175, 55, 0.2);
  border-radius: 10px;
  color: var(--text-white);
  font-family: inherit;
  font-size: 0.95rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.3s ease;
}

.question-section textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.2);
}

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


/* ==================== 按钮样式 ==================== */
.btn {
  display: inline-block;
  padding: 14px 36px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-align: center;
  letter-spacing: 0.05em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: var(--bg-deep);
  box-shadow: 0 4px 15px rgba(212, 175, 55, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(212, 175, 55, 0.4);
}

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

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--gold);
  color: var(--gold);
}

.btn-secondary:hover {
  background: rgba(212, 175, 55, 0.1);
}

.btn-group {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 16px;
}


/* ==================== 抽牌区域 ==================== */
.tarot-area {
  text-align: center;
  padding: 40px 20px;
  min-height: 300px;
}

/* 牌堆 - 洗牌时显示 */
.deck-area {
  position: relative;
  height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

.deck-card {
  width: 100px;
  height: 160px;
  position: absolute;
  border-radius: 8px;
  /* 牌背图案 - 使用渐变 + SVG样式 */
  background: 
    linear-gradient(135deg, #1a0d3d, #0d0a1f),
    repeating-linear-gradient(45deg, 
      transparent, transparent 8px, 
      rgba(212, 175, 55, 0.1) 8px, rgba(212, 175, 55, 0.1) 10px);
  background-blend-mode: overlay;
  border: 2px solid var(--gold);
  box-shadow: 
    0 4px 15px rgba(0, 0, 0, 0.5),
    inset 0 0 20px rgba(212, 175, 55, 0.1);
}

/* 牌背图案上的装饰 */
.deck-card::before {
  content: '✦';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  color: var(--gold);
  text-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

.deck-card::after {
  content: '';
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  bottom: 8px;
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 4px;
}

/* 牌堆中每张牌的偏移 */
.deck-card:nth-child(1) { transform: translateX(-8px) rotate(-2deg); }
.deck-card:nth-child(2) { transform: translateX(-4px) rotate(-1deg); }
.deck-card:nth-child(3) { transform: translateX(0) rotate(0deg); }
.deck-card:nth-child(4) { transform: translateX(4px) rotate(1deg); }
.deck-card:nth-child(5) { transform: translateX(8px) rotate(2deg); }


/* ==================== 洗牌动画 ==================== */
@keyframes shuffle {
  0% { transform: translateX(0) rotate(0deg); }
  10% { transform: translateX(-60px) rotate(-8deg); }
  25% { transform: translateX(60px) rotate(6deg); }
  40% { transform: translateX(-40px) rotate(-4deg); }
  55% { transform: translateX(40px) rotate(5deg); }
  70% { transform: translateX(-20px) rotate(-2deg); }
  85% { transform: translateX(20px) rotate(2deg); }
  100% { transform: translateX(0) rotate(0deg); }
}

.shuffling .deck-card:nth-child(1) { animation: shuffle 0.6s ease-in-out infinite; }
.shuffling .deck-card:nth-child(2) { animation: shuffle 0.6s ease-in-out infinite 0.05s; }
.shuffling .deck-card:nth-child(3) { animation: shuffle 0.6s ease-in-out infinite 0.1s; }
.shuffling .deck-card:nth-child(4) { animation: shuffle 0.6s ease-in-out infinite 0.15s; }
.shuffling .deck-card:nth-child(5) { animation: shuffle 0.6s ease-in-out infinite 0.2s; }


/* ==================== 卡牌3D容器 ==================== */
.cards-display {
  display: flex;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
  perspective: 1000px; /* 3D视角距离 */
  margin: 20px 0;
}

/* 每张卡的3D翻转容器 */
.card-3d {
  width: 160px;
  height: 260px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 1s cubic-bezier(0.4, 0.2, 0.2, 1);
  cursor: pointer;
}

.card-3d.flipped {
  transform: rotateY(180deg);
}

/* 牌面/牌背 共有样式 */
.card-face {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 10px;
  backface-visibility: hidden; /* 翻转时隐藏背面 */
  -webkit-backface-visibility: hidden;
  overflow: hidden;
  box-shadow: 
    0 8px 30px rgba(0, 0, 0, 0.4),
    0 0 15px rgba(212, 175, 55, 0.15);
}

/* 牌背 */
.card-back {
  /* 牌背图案 */
  background: 
    linear-gradient(135deg, #1a0d3d 0%, #2d1b4e 50%, #0d0a1f 100%),
    repeating-linear-gradient(45deg, 
      transparent, transparent 8px, 
      rgba(212, 175, 55, 0.08) 8px, rgba(212, 175, 55, 0.08) 10px);
  background-blend-mode: overlay;
  border: 2px solid var(--gold);
  
  display: flex;
  justify-content: center;
  align-items: center;
}

.card-back::before {
  content: '✦';
  font-size: 3.5rem;
  color: var(--gold);
  text-shadow: 
    0 0 10px rgba(212, 175, 55, 0.6),
    0 0 20px rgba(212, 175, 55, 0.3);
}

.card-back::after {
  content: '';
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: 6px;
}

/* 牌面（图片） */
.card-front {
  background: var(--bg-light);
  border: 2px solid var(--gold);
  transform: rotateY(180deg); /* 初始翻转，隐藏 */
  
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
}

.card-front img {
  width: 100%;
  height: 75%;
  object-fit: contain;
  border-radius: 4px;
}

.card-front .card-name-cn {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--gold);
  text-align: center;
}

.card-front .card-name-en {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  font-style: italic;
}

/* 逆位卡牌 - 牌面上下翻转 */
.card-3d.reversed .card-front img {
  transform: rotate(180deg);
}

.card-3d.reversed .card-name-cn::after {
  content: ' (逆)';
  font-size: 0.7rem;
  color: var(--purple-light);
}


/* ==================== 结果解读区 ==================== */
.reading-result {
  animation: fadeIn 0.6s ease-out;
}

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

.reading-card {
  padding: 16px;
  margin-bottom: 14px;
  background: rgba(157, 78, 221, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.15);
  border-radius: 10px;
}

.reading-card .position-label {
  font-size: 0.85rem;
  color: var(--purple-light);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.reading-card .card-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--gold);
  margin-bottom: 10px;
}

.reading-card .orientation-tag {
  display: inline-block;
  padding: 2px 8px;
  margin-left: 8px;
  font-size: 0.75rem;
  border-radius: 4px;
  vertical-align: middle;
}

.orientation-upright {
  background: rgba(212, 175, 55, 0.2);
  color: var(--gold);
  border: 1px solid rgba(212, 175, 55, 0.3);
}

.orientation-reversed {
  background: rgba(157, 78, 221, 0.2);
  color: var(--purple-light);
  border: 1px solid rgba(157, 78, 221, 0.3);
}

.reading-card .meaning {
  font-size: 0.9rem;
  color: var(--text-white);
  line-height: 1.7;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.25);
  border-left: 2px solid var(--gold);
  border-radius: 0 6px 6px 0;
}


/* ==================== 状态显示 ==================== */
.status-message {
  text-align: center;
  padding: 16px;
  color: var(--gold-light);
  font-size: 1.05rem;
  animation: pulse 2s ease-in-out infinite;
}

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


/* ==================== 响应式 - 移动端适配 ==================== */
@media (max-width: 768px) {
  
  .container {
    padding: 24px 16px 40px;
  }
  
  .header h1 {
    font-size: 2rem;
  }
  
  .glass-card {
    padding: 20px;
  }
  
  /* 卡牌尺寸缩小 */
  .card-3d {
    width: 130px;
    height: 210px;
  }
  
  .cards-display {
    gap: 16px;
  }
  
  .spread-btn {
    min-width: 140px;
    padding: 14px 12px;
  }
  
  .spread-btn .icon {
    font-size: 1.5rem;
  }
  
  .spread-btn .label {
    font-size: 1rem;
  }
  
  .spread-btn .desc {
    font-size: 0.75rem;
  }
  
  /* 三牌阵在移动端缩小间距 */
  .cards-display.three-spread {
    gap: 12px;
  }
  
  /* 结果解读字体缩小 */
  .reading-card .meaning {
    font-size: 0.85rem;
  }
  
  .reading-card .card-title {
    font-size: 1rem;
  }
  
  /* 牌堆缩小 */
  .deck-card {
    width: 80px;
    height: 128px;
  }
  
  /* 按钮全宽 */
  .btn-group {
    flex-direction: column;
  }
  
  .btn-group .btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  
  .header h1 {
    font-size: 1.6rem;
  }
  
  .header .subtitle {
    font-size: 0.85rem;
  }
  
  .card-3d {
    width: 110px;
    height: 178px;
  }
  
  .card-front .card-name-cn {
    font-size: 0.8rem;
  }
  
  .card-front .card-name-en {
    font-size: 0.6rem;
  }
}


/* ==================== 隐藏类 ==================== */
.hidden {
  display: none !important;
}


/* ==================== 加载状态 ==================== */
.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* 图片加载失败时的 fallback */
.card-front img[src=""] {
  display: none;
}

.card-front img:not([src]), 
.card-front img.broken {
  display: none;
}

/* ==========================================================================
 * cabbage塔罗  v2 新增样式 —— 3 套主题 + 新组件
 * 注意：所有样式都追加在末尾，不改动已有
 * ========================================================================== */

/* ==========================================================================
 * 液态玻璃主题 —— 严格对标 iOS 26 Liquid Glass（WWDC 2025）
 * 核心技术：
 *   1. 极低 blur(2px) + 高饱和度(180%) + 亮度提升(1.08) —— 背景几乎清晰透出
 *   2. SVG feTurbulence + feDisplacementMap —— 真正的折射扭曲（Chrome only）
 *   3. 菲涅尔边缘光 —— 多层 inset box-shadow 模拟玻璃边缘光线
 *   4. 镜面反射光带 —— ::before 斜向高光 + ::after 负偏移 inset 反射
 *   5. conic-gradient 扫描光泽 —— 伪元素动态旋转
 * ========================================================================== */

/* ---------- 液态玻璃核心 CSS 变量 ---------- */
body[data-theme="liquid"] {
  --bg-deep: #07060f;
  --bg-mid: #0e0b1a;
  --bg-light: #161227;
  --gold: #64d8cb;
  --gold-light: #a7f5ea;
  --gold-dark: #2dd4bf;
  --purple-primary: #8b7cf7;
  --purple-light: #c4b8ff;
  --text-white: #eef0ff;
  --text-muted: #8a8fb0;

  /* 真正透明的玻璃底色 —— alpha 0.08-0.12，让背景清晰透过来 */
  --glass-alpha: 0.10;
  --glass-border-alpha: 0.30;
  --glass-blur: 2px;          /* 极低 blur！不是毛玻璃 */
  --glass-saturate: 180%;
  --glass-brightness: 1.08;
}

/* ---------- 液态玻璃底图：高对比度动态光晕（让折射效果明显） ---------- */
body[data-theme="liquid"]::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    /* 左上青光球 */
    radial-gradient(ellipse 55% 45% at 18% 12%,
      rgba(100, 216, 203, 0.22), transparent 60%),
    /* 右上紫光球 */
    radial-gradient(ellipse 45% 38% at 88% 22%,
      rgba(139, 124, 247, 0.22), transparent 55%),
    /* 右下金光球 */
    radial-gradient(ellipse 50% 40% at 82% 88%,
      rgba(212, 175, 55, 0.18), transparent 60%),
    /* 左下深红光球 —— 增加背景色彩变化让折射可视化 */
    radial-gradient(ellipse 40% 35% at 12% 82%,
      rgba(231, 93, 135, 0.15), transparent 55%),
    linear-gradient(180deg, #06050d 0%, #0a0818 40%, #06050d 100%);
  background-attachment: fixed;
}

/* ---------- 液态玻璃卡片 —— 核心实现 ---------- */
body[data-theme="liquid"] .glass-card {
  position: relative;
  isolation: isolate;

  /* ① 极轻底色 + 几乎不糊的 blur + 高饱和度 + 亮度提升 */
  background: rgba(255, 255, 255, var(--glass-alpha));
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate)) brightness(var(--glass-brightness));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-saturate)) brightness(var(--glass-brightness));
  /* 注意：不在 .glass-card 本体加 url(#liquid-distort) —— 避免扭曲卡片内文字 */

  /* ② 亮边框 = 玻璃边缘（高 alpha 让边缘有实体感） */
  border: 1px solid rgba(255, 255, 255, var(--glass-border-alpha));
  border-radius: 22px;

  /* ③ 菲涅尔边缘光 —— 多层 inset shadow 模拟玻璃各面的光线 */
  box-shadow:
    /* 外部投影 —— 玻璃离背景的悬浮感 */
    0 8px 40px rgba(0, 0, 0, 0.55),
    0 2px 8px rgba(0, 0, 0, 0.35),
    /* 顶部亮边 —— 玻璃上表面反射光 */
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    /* 左侧微亮边 —— 侧面入射光 */
    inset 1px 0 0 rgba(255, 255, 255, 0.12),
    /* 右侧微暗边 —— 光线离开 */
    inset -1px 0 0 rgba(0, 0, 0, 0.12),
    /* 底部暗边 —— 玻璃底部阴影 */
    inset 0 -1px 0 rgba(0, 0, 0, 0.15),
    /* 整体内阴影增加厚度感 */
    inset 0 -30px 50px rgba(0, 0, 0, 0.12);

  overflow: hidden;

  /* 默认鼠标坐标（JS 会覆盖） */
  --mx: 50%;
  --my: 50%;
}

/* ④ 伪元素 ::before —— 菲涅尔上沿高光 + 鼠标跟随的镜面反射 */
body[data-theme="liquid"] .glass-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;

  background:
    /* 鼠标跟随镜面反射 —— 像真实玻璃对着光源的反光 */
    radial-gradient(
      circle at var(--mx) var(--my),
      rgba(255, 255, 255, 0.22) 0%,
      rgba(255, 255, 255, 0.08) 12%,
      transparent 28%
    );

  transition: background 0.12s ease-out;
}

/* ⑤ 伪元素 ::after —— 曲面反射光带 + conic 扫描光泽 */
body[data-theme="liquid"] .glass-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;

  /* inset 负偏移制造曲面反射 —— Apple 液态玻璃的签名 */
  box-shadow:
    /* 顶部外侧高光（菲涅尔反射） */
    inset 0 2px 0 rgba(255, 255, 255, 0.35),
    /* 底部内侧暗条（玻璃厚度） */
    inset 0 -2px 4px rgba(0, 0, 0, 0.15),
    /* 左下斜向反射光带（曲面镜面） */
    inset -10px -8px 0 -11px rgba(255, 255, 255, 0.55),
    inset 0px -9px 0px -8px rgba(255, 255, 255, 0.35);

  /* conic 扫描光泽 —— 22s 缓慢旋转 */
  background: conic-gradient(
    from 180deg at 50% 50%,
    transparent 0deg,
    rgba(255, 255, 255, 0.04) 40deg,
    transparent 80deg,
    rgba(100, 216, 203, 0.03) 180deg,
    transparent 220deg,
    rgba(255, 255, 255, 0.03) 310deg,
    transparent 360deg
  );
  animation: liquidSheen 22s linear infinite;
  opacity: 0.5;
}

@keyframes liquidSheen {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* ---------- 液态玻璃按钮 —— 透明化 + 边缘光 ---------- */
body[data-theme="liquid"] .btn-primary {
  background: linear-gradient(
    135deg,
    rgba(100, 216, 203, 0.75) 0%,
    rgba(139, 124, 247, 0.75) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow:
    0 4px 20px rgba(100, 216, 203, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
  backdrop-filter: blur(2px) saturate(180%) brightness(1.08);
  color: #fff;
  transition: transform 0.2s ease, box-shadow 0.3s ease;
}
body[data-theme="liquid"] .btn-primary:hover {
  transform: translateY(-2px);
  box-shadow:
    0 6px 28px rgba(100, 216, 203, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}

body[data-theme="liquid"] .btn-secondary {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: var(--text-white);
  backdrop-filter: blur(2px) saturate(180%) brightness(1.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}
body[data-theme="liquid"] .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* ---------- 液态玻璃牌阵按钮 ---------- */
body[data-theme="liquid"] .spread-btn {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(2px) saturate(180%) brightness(1.08);
  -webkit-backdrop-filter: blur(2px) saturate(180%) brightness(1.08);
  border-radius: 16px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
body[data-theme="liquid"] .spread-btn:hover {
  transform: translateY(-3px) scale(1.01);
  border-color: rgba(100, 216, 203, 0.55);
  background: rgba(255, 255, 255, 0.14);
  box-shadow:
    0 10px 30px rgba(100, 216, 203, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}
body[data-theme="liquid"] .spread-btn.active {
  background: linear-gradient(
    145deg,
    rgba(100, 216, 203, 0.32),
    rgba(139, 124, 247, 0.26)
  );
  border-color: rgba(100, 216, 203, 0.75);
  box-shadow:
    0 8px 24px rgba(100, 216, 203, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 0 20px rgba(100, 216, 203, 0.18);
}

/* ---------- 液态玻璃 Header ---------- */
body[data-theme="liquid"] .header h1 {
  background: linear-gradient(135deg,
    #a7f5ea 0%,
    #64d8cb 30%,
    #c4b8ff 65%,
    #64d8cb 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
  letter-spacing: 0.03em;
  filter: drop-shadow(0 2px 12px rgba(100, 216, 203, 0.25));
}
body[data-theme="liquid"] .divider {
  background: linear-gradient(90deg,
    transparent,
    rgba(100, 216, 203, 0.5),
    rgba(139, 124, 247, 0.5),
    transparent);
}

/* ---------- 液态玻璃输入框 ---------- */
body[data-theme="liquid"] textarea,
body[data-theme="liquid"] input[type="text"],
body[data-theme="liquid"] input[type="number"],
body[data-theme="liquid"] input[type="password"],
body[data-theme="liquid"] select {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 14px;
  backdrop-filter: blur(2px) saturate(180%) brightness(1.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08);
}
body[data-theme="liquid"] textarea:focus,
body[data-theme="liquid"] input:focus {
  border-color: rgba(100, 216, 203, 0.6);
  box-shadow:
    0 0 0 3px rgba(100, 216, 203, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

/* ---------- 液态玻璃 FAB + 设置面板 + 历史抽屉 ---------- */
body[data-theme="liquid"] .settings-fab,
body[data-theme="liquid"] .theme-fab {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(2px) saturate(180%) brightness(1.08);
  -webkit-backdrop-filter: blur(2px) saturate(180%) brightness(1.08);
  box-shadow:
    0 4px 18px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  color: var(--gold);
}
body[data-theme="liquid"] .settings-panel {
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(2px) saturate(180%) brightness(1.08) url(#liquid-distort);
  -webkit-backdrop-filter: blur(2px) saturate(180%) brightness(1.08);
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
  border-radius: 20px;
}
body[data-theme="liquid"] .history-drawer {
  background: rgba(20, 15, 40, 0.72);
  backdrop-filter: blur(4px) saturate(180%) brightness(1.08) url(#liquid-distort);
  border-left: 1px solid rgba(100, 216, 203, 0.3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}
body[data-theme="liquid"] .theme-btn.active {
  background: linear-gradient(135deg,
    rgba(100, 216, 203, 0.32),
    rgba(139, 124, 247, 0.32));
  border-color: rgba(100, 216, 203, 0.65);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

/* ---------- 液态玻璃 Toast ---------- */
body[data-theme="liquid"] .toast {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(100, 216, 203, 0.5);
  backdrop-filter: blur(2px) saturate(180%) brightness(1.08);
  box-shadow:
    0 12px 40px rgba(100, 216, 203, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  color: var(--gold);
  border-radius: 16px;
}

/* ---------- 液态玻璃塔罗牌面 ---------- */
body[data-theme="liquid"] .card-3d {
  filter: drop-shadow(0 6px 18px rgba(100, 216, 203, 0.22));
}
body[data-theme="liquid"] .card-back {
  background:
    radial-gradient(circle at 30% 30%, rgba(100, 216, 203, 0.35), transparent 60%),
    radial-gradient(circle at 70% 70%, rgba(139, 124, 247, 0.35), transparent 60%),
    linear-gradient(135deg, #1a1733, #0f0d20);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow:
    inset 0 0 30px rgba(100, 216, 203, 0.15),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* ---------- 液态玻璃库/胶囊页小卡片 ---------- */
body[data-theme="liquid"] .lib-card,
body[data-theme="liquid"] .history-item {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(2px) saturate(180%) brightness(1.08);
  border-radius: 16px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
body[data-theme="liquid"] .lib-card:hover,
body[data-theme="liquid"] .history-item:hover {
  transform: translateY(-4px);
  border-color: rgba(100, 216, 203, 0.55);
  box-shadow:
    0 14px 40px rgba(100, 216, 203, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.1);
}

/* ---------- 液态玻璃开关 ---------- */
body[data-theme="liquid"] .switch .slider {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
body[data-theme="liquid"] .switch input:checked + .slider {
  background: linear-gradient(135deg, #64d8cb, #8b7cf7);
  border-color: transparent;
  box-shadow: 0 2px 10px rgba(100, 216, 203, 0.5);
}

/* ---------- 液态玻璃 Modal ---------- */
body[data-theme="liquid"] .lib-modal .lib-modal-card,
body[data-theme="liquid"] .capsule-item {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(2px) saturate(180%) brightness(1.08) url(#liquid-distort);
  -webkit-backdrop-filter: blur(2px) saturate(180%) brightness(1.08);
  border-radius: 20px;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    inset 0 -1px 0 rgba(0, 0, 0, 0.15);
}

/* ---------- 液态玻璃星星更清透 ---------- */
body[data-theme="liquid"] body::before,
body[data-theme="liquid"] body::after { opacity: 0.35; }

/* ---------- 液态玻璃通用鼠标跟随高光（大面板） ---------- */
body[data-theme="liquid"] .settings-panel,
body[data-theme="liquid"] .history-drawer,
body[data-theme="liquid"] .lib-modal-card,
body[data-theme="liquid"] .capsule-item {
  --mx: 50%;
  --my: 50%;
}
body[data-theme="liquid"] .settings-panel::before,
body[data-theme="liquid"] .history-drawer::before,
body[data-theme="liquid"] .lib-modal-card::before,
body[data-theme="liquid"] .capsule-item::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(
      circle at var(--mx) var(--my),
      rgba(255, 255, 255, 0.14) 0%,
      rgba(255, 255, 255, 0.04) 15%,
      transparent 35%
    );
  transition: background 0.12s ease-out;
}

/* ---------- 液态玻璃滚动条 ---------- */
body[data-theme="liquid"] ::-webkit-scrollbar-thumb {
  background: rgba(100, 216, 203, 0.35);
  border-radius: 10px;
}
body[data-theme="liquid"] ::-webkit-scrollbar-track {
  background: transparent;
}

/* ---------- 设置面板 ---------- */
.settings-fab {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  color: var(--gold);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s;
}
.settings-fab:hover { transform: rotate(90deg); }

.settings-panel {
  position: fixed;
  top: 70px;
  right: 20px;
  width: 300px;
  max-height: 80vh;
  overflow-y: auto;
  z-index: 999;
  padding: 18px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
  transition: all 0.25s ease;
}
.settings-panel.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.settings-panel h3 {
  color: var(--gold);
  font-size: 0.95rem;
  margin: 0 0 12px 0;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--glass-border);
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.settings-row .theme-btns {
  display: flex;
  gap: 6px;
}
.theme-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--glass-border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}
.theme-btn.active {
  border-color: var(--gold);
  color: var(--gold);
  background: var(--purple-glass);
}

/* ---------- Switch 开关 ---------- */
.switch {
  position: relative;
  width: 38px;
  height: 20px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
  transition: 0.2s;
}
.switch .slider::before {
  content: "";
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: 0.2s;
}
.switch input:checked + .slider { background: var(--gold); }
.switch input:checked + .slider::before { transform: translateX(18px); background: #fff; }

/* ---------- 历史抽屉 ---------- */
.history-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 360px;
  max-width: 85vw;
  z-index: 999;
  transform: translateX(100%);
  transition: transform 0.35s ease;
  background: var(--bg-deep);
  border-left: 1px solid var(--glass-border);
  padding: 20px;
  overflow-y: auto;
}
.history-drawer.open { transform: translateX(0); }
.history-drawer h3 {
  color: var(--gold);
  margin: 0 0 16px 0;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.history-drawer .close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.2rem;
}
.history-item {
  padding: 12px;
  margin-bottom: 10px;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  cursor: pointer;
  transition: border-color 0.2s;
}
.history-item:hover { border-color: var(--gold); }
.history-item .h-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.history-item .h-q {
  font-size: 0.85rem;
  color: var(--text-white);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item .h-cards {
  font-size: 0.75rem;
  color: var(--gold);
}
.history-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 40px 20px;
}

/* ---------- 牌阵按钮组（4 种） ---------- */
.spread-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
  filter: grayscale(1);
}

/* ---------- 牌意联想展开 ---------- */
.meaning-expand {
  margin-top: 8px;
  font-size: 0.82rem;
  line-height: 1.7;
  border-top: 1px dashed var(--glass-border);
  padding-top: 10px;
}
.meaning-expand .expand-item {
  margin-bottom: 4px;
}
.meaning-expand .expand-label {
  color: var(--gold);
  font-weight: 600;
  margin-right: 6px;
}
.meaning-expand .expand-label.red { color: #f87171; }
.meaning-expand .expand-label.blue { color: #60a5fa; }

/* ---------- 敏感词转译标注 ---------- */
.keyword-translated {
  border-bottom: 2px dashed var(--gold);
  cursor: help;
}
.translate-tag {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--gold);
  background: rgba(212,175,55,0.1);
  padding: 2px 6px;
  border-radius: 4px;
  margin-top: 4px;
}

/* ---------- 主题切换浮动按钮 ---------- */
.theme-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  color: var(--gold);
  font-size: 1.1rem;
  cursor: pointer;
}

/* ---------- 分享图按钮 ---------- */
.share-btn-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* ---------- 敏感词替换提示 ---------- */
.keyword-warning {
  font-size: 0.72rem;
  color: var(--gold);
  margin-top: 4px;
}

/* ---------- 移动端 ---------- */
@media (max-width: 768px) {
  .settings-panel {
    width: calc(100% - 40px);
    right: 20px;
  }
  .history-drawer {
    width: 100%;
    max-width: 100%;
  }
}
