/**
 * 玄术杂货铺 · 设计系统
 * 基于 bobochi-site 变量体系，叠加当铺暖色氛围
 */

/* ========== 根变量 ========== */
:root {
  /* 复用 bobochi-site 基础色 */
  --bg: #06061a;
  --bg-deep: #020210;
  --glass: rgba(20, 20, 50, 0.45);
  --glass-strong: rgba(20, 20, 50, 0.65);
  --ink: #f0efff;
  --ink-soft: #c8c8e8;
  --muted: #7878a8;
  --rule: rgba(139, 92, 246, 0.25);
  --rule-bright: rgba(167, 139, 250, 0.5);

  /* bobochi 四色 */
  --violet: #8b5cf6;
  --violet-light: #c4b5fd;
  --violet-deep: #6d28d9;
  --cyan: #22d3ee;
  --cyan-deep: #0891b2;
  --gold: #fbbf24;
  --gold-soft: #fde68a;
  --rose: #fb7185;

  /* 玄术杂货铺专属色 */
  --shop-bg: #0a0a1e;
  --shop-bg-warm: #12102a;
  --shop-gold: #d4af37;
  --shop-gold-light: #f0d77a;
  --shop-cinnabar: #a02525;
  --shop-cream: #f5f0e8;
  --shop-turquoise: #4ecdc4;
  --shop-pink-purple: #e8b4d9;

  /* 段位色 */
  --tier-legendary: #fbbf24;
  --tier-legendary-glow: rgba(251, 191, 36, 0.3);
  --tier-elite: #c4b5fd;
  --tier-elite-glow: rgba(196, 181, 253, 0.3);
  --tier-veteran: #22d3ee;
  --tier-veteran-glow: rgba(34, 211, 238, 0.3);

  /* 尺寸 */
  --radius-sm: 12px;
  --radius-md: 20px;
  --radius-lg: 32px;
  --nav-height: 56px;
  --max-width: 480px;

  /* 字体 */
  --font-body: -apple-system, 'PingFang SC', 'Noto Sans SC', 'Noto Serif SC', sans-serif;
  --font-title: 'ZCOOL XiaoWei', 'Noto Serif SC', serif;
  --font-brush: 'Ma Shan Zheng', cursive;

  /* 字号层级 */
  --text-h1: 28px;
  --text-h2: 22px;
  --text-h3: 18px;
  --text-body: 15px;
  --text-small: 13px;
  --text-micro: 11px;

  /* 行高 */
  --lh-heading: 1.3;
  --lh-body: 1.6;
  --lh-dialogue: 1.7;
  --lh-button: 1.2;

  /* 间距系统 */
  --space-4xs: 4px;
  --space-3xs: 8px;
  --space-2xs: 12px;
  --space-xs: 16px;
  --space-sm: 20px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 48px;
  --space-2xl: 64px;

  /* 阴影系统 */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-gold: 0 0 20px rgba(212, 175, 55, 0.3);
  --shadow-violet: 0 0 20px rgba(139, 92, 246, 0.3);
  --shadow-cyan: 0 0 20px rgba(34, 211, 238, 0.3);

  /* 别名（与文档规范保持一致） */
  --accent: #d4af37;
  --accent2: #8b5cf6;
  --accent3: #22d3ee;
  --bg2: #12102a;
  --bg3: #1a1838;
}

/* ========== 加载骨架屏 ========== */
.loading-skeleton {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--shop-bg);
  transition: opacity 0.5s ease;
}

.loading-skeleton.hidden {
  opacity: 0;
  pointer-events: none;
}

.skeleton-content {
  text-align: center;
}

.skeleton-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 20px;
  border: 3px solid var(--shop-gold);
  border-top-color: transparent;
  border-radius: 50%;
  animation: skeleton-spin 1s linear infinite;
}

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

.skeleton-text {
  font-size: 14px;
  color: var(--muted);
  font-family: var(--font-body);
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

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

html { font-size: 16px; -webkit-tap-highlight-color: transparent; }

/* 防止 iOS Safari 输入框聚焦时自动放大 */
input, textarea, select, button {
  font-size: 16px;
  touch-action: manipulation;
}

body {
  font-family: var(--font-body);
  background: var(--shop-bg);
  color: var(--shop-cream);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

a { color: var(--shop-gold); text-decoration: none; }
img { max-width: 100%; display: block; }

/* ========== 背景层 ========== */
.shop-bg-layer {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 100%, rgba(212, 175, 55, 0.06) 0%, transparent 50%),
    linear-gradient(180deg, var(--shop-bg) 0%, var(--bg-deep) 100%);
}

.shop-bg-noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.03;
  pointer-events: none;
  /* SVG噪声层：降低numOctaves从3→1，减少GPU重绘开销约60% */
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  /* 提升为独立合成层，避免触发整页重绘 */
  will-change: transform;
}

/* 辅助功能：用户开启「减少动效」时移除噪声层 */
@media (prefers-reduced-motion: reduce) {
  .shop-bg-noise {
    display: none;
  }
}

/* ========== 导航栏 ========== */
.shop-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1150; /* 高于 vn-screen(900)/gender(950)/knock(1000)，低于 card-modal(1200)；固定定位保证进门即可见 */
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
  padding: 0 16px;
  background: rgba(10, 10, 30, 0.85);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  border-bottom: 1px solid var(--rule);
}

.shop-nav .nav-back {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--shop-gold);
  font-size: 14px;
  min-width: 60px;
}

.shop-nav .nav-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-brush);
  font-size: 20px;
  color: var(--shop-gold);
  text-shadow: var(--shadow-gold);
  pointer-events: none;
  white-space: nowrap;
}

.shop-nav .nav-right {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 60px;
  justify-content: flex-end;
}

.shop-nav .nav-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--shop-gold);
  opacity: 0.8;
  transition: all 0.2s;
  text-decoration: none;
}
.shop-nav .nav-icon-btn:hover,
.shop-nav .nav-icon-btn:active {
  opacity: 1;
  background: rgba(212, 175, 55, 0.1);
}

/* 导航栏内的音量开关 */
.shop-nav .audio-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--shop-gold);
  opacity: 0.8;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 16px;
}
.shop-nav .audio-toggle:hover,
.shop-nav .audio-toggle:active {
  opacity: 1;
  background: rgba(212, 175, 55, 0.1);
}
.shop-nav .audio-toggle.muted {
  opacity: 0.4;
  color: var(--muted);
}

.shop-nav .nav-spacer { min-width: 60px; }

/* ========== 主容器 ========== */
.shop-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 16px;
  min-height: calc(100vh - var(--nav-height) - 120px);
}

/* ========== 掌柜欢迎区 ========== */
.shopkeeper-area {
  text-align: center;
  padding: 24px 16px 16px;
  margin-bottom: 20px;
}

.shopkeeper-portrait {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  margin: 0 auto 12px;
  border: 2px solid var(--shop-gold);
  box-shadow: var(--shadow-gold);
  overflow: hidden;
  background: var(--glass);
}

.shopkeeper-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shopkeeper-greeting {
  font-family: var(--font-title);
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.8;
  max-width: 320px;
  margin: 0 auto;
}

.shopkeeper-greeting .accent {
  color: var(--shop-gold);
}

/* ========== 段位标签栏 ========== */
.tier-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.tier-tabs::-webkit-scrollbar { display: none; }

.tier-tab {
  flex-shrink: 0;
  padding: 6px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--rule);
  background: var(--glass);
  color: var(--muted);
}

.tier-tab.active {
  color: var(--shop-gold);
  border-color: var(--shop-gold);
  background: rgba(212, 175, 55, 0.1);
}

.tier-tab[data-tier="legendary"].active { color: var(--tier-legendary); border-color: var(--tier-legendary); background: var(--tier-legendary-glow); }
.tier-tab[data-tier="elite"].active { color: var(--tier-elite); border-color: var(--tier-elite); background: var(--tier-elite-glow); }
.tier-tab[data-tier="veteran"].active { color: var(--tier-veteran); border-color: var(--tier-veteran); background: var(--tier-veteran-glow); }

/* ========== 大师卡片网格 ========== */
.master-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 420px) {
  .master-grid { grid-template-columns: repeat(2, 1fr); }
}

.master-card {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  background: var(--glass-strong);
  border: 1px solid var(--rule);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.master-card:active { transform: scale(0.97); }
.master-card:hover { box-shadow: var(--shadow-lg); border-color: var(--rule-bright); }

.master-card.locked { opacity: 0.5; cursor: not-allowed; }
.master-card.locked:active { transform: none; }

/* 段位发光边框 */
.master-card[data-tier="legendary"] { border-color: rgba(251, 191, 36, 0.3); }
.master-card[data-tier="legendary"]:hover { border-color: var(--tier-legendary); box-shadow: var(--shadow-gold); }
.master-card[data-tier="elite"] { border-color: rgba(196, 181, 253, 0.25); }
.master-card[data-tier="elite"]:hover { border-color: var(--tier-elite); box-shadow: var(--shadow-violet); }
.master-card[data-tier="veteran"] { border-color: rgba(34, 211, 238, 0.25); }
.master-card[data-tier="veteran"]:hover { border-color: var(--tier-veteran); box-shadow: var(--shadow-cyan); }

/* 立绘区 - 胸像展示（胸部以上） */
.master-card .portrait-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--bg-deep);
}

.master-card .portrait-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.3s;
}

.master-card:hover .portrait-wrap img { transform: scale(1.05); }

/* 锁定遮罩 */
.master-card .lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  gap: 8px;
}

.master-card .lock-overlay .lock-icon { font-size: 32px; }
.master-card .lock-overlay .lock-text { font-size: 12px; color: var(--muted); text-align: center; padding: 0 12px; }

/* 段位徽章 */
.master-card .tier-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.master-card[data-tier="legendary"] .tier-badge { background: rgba(251, 191, 36, 0.2); color: var(--tier-legendary); border: 1px solid var(--tier-legendary); }
.master-card[data-tier="elite"] .tier-badge { background: rgba(196, 181, 253, 0.2); color: var(--tier-elite); border: 1px solid var(--tier-elite); }
.master-card[data-tier="veteran"] .tier-badge { background: rgba(34, 211, 238, 0.2); color: var(--tier-veteran); border: 1px solid var(--tier-veteran); }

/* 信息区 */
.master-card .info-area {
  padding: 12px 14px;
}

.master-card .master-name {
  font-family: var(--font-title);
  font-size: 17px;
  color: var(--shop-cream);
  margin-bottom: 2px;
}

.master-card .master-title {
  font-size: 12px;
  color: var(--shop-gold);
  margin-bottom: 6px;
}

/* 大师星级评分 */
.master-card .master-stars {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 6px;
}

.master-card .master-stars .star {
  font-size: 14px;
  line-height: 1;
}

.master-card .master-stars .star.filled {
  color: var(--shop-gold);
  text-shadow: 0 0 6px rgba(212, 175, 55, 0.5);
}

.master-card .master-stars .star.empty {
  color: rgba(120, 120, 168, 0.35);
}

.master-card .master-specialty {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.master-card .master-tool-tag {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  background: rgba(139, 92, 246, 0.15);
  color: var(--violet-light);
}

/* 解锁进度条 */
.master-card .unlock-progress {
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  margin-top: 8px;
  overflow: hidden;
}

.master-card .unlock-progress .bar {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.3s;
}

.master-card[data-tier="elite"] .unlock-progress .bar { background: var(--tier-elite); }
.master-card[data-tier="veteran"] .unlock-progress .bar { background: var(--tier-veteran); }

/* ========== 额度显示区 ========== */
.quota-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--glass);
  border: 1px solid var(--rule);
  margin-bottom: 16px;
}

.quota-bar .quota-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quota-bar .quota-dots {
  display: flex;
  gap: 4px;
}

.quota-bar .quota-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  transition: background 0.2s;
}

.quota-bar .quota-dot.used { background: var(--muted); }
.quota-bar .quota-dot.available { background: var(--shop-gold); box-shadow: var(--shadow-gold); }

.quota-bar .quota-text { font-size: 13px; color: var(--ink-soft); }
.quota-bar .quota-text .num { color: var(--shop-gold); font-weight: 600; }

/* ========== 通用按钮 ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--shop-gold);
  background: rgba(212, 175, 55, 0.08);
  color: var(--shop-gold);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
  font-family: var(--font-body);
  min-height: 44px;
}

.btn:hover { background: rgba(212, 175, 55, 0.15); }
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(212, 175, 55, 0.1));
  font-weight: 600;
}

.btn-primary:hover { background: linear-gradient(135deg, rgba(212, 175, 55, 0.35), rgba(212, 175, 55, 0.2)); }

.btn-full { width: 100%; }

/* ========== 对话页样式 ========== */
.dialogue-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - var(--nav-height));
}

.master-portrait-area {
  position: relative;
  width: 100%;
  max-height: 40vh;
  overflow: hidden;
  display: flex;
  justify-content: center;
  background: linear-gradient(180deg, var(--glass-strong) 0%, transparent 100%);
}

.master-portrait-area img {
  max-height: 40vh;
  object-fit: contain;
  filter: drop-shadow(var(--shadow-md));
}

.master-portrait-area .master-label {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.master-portrait-area .master-label .name {
  font-family: var(--font-brush);
  font-size: 24px;
  color: var(--shop-gold);
  text-shadow: var(--shadow-sm);
}

.master-portrait-area .master-label .title {
  font-size: 12px;
  color: var(--ink-soft);
}

.dialogue-area {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 内嵌于 vn-screen 时：位于结果面板与对话框之间，z-index 高于对话框和底部渐变 */
.vn-screen .dialogue-area {
  position: relative;
  z-index: 20;
  min-height: 0; /* 防止 flex 子项溢出 */
  padding-bottom: 170px; /* 为底部对话框留出空间，避免最后一条消息被覆盖 */
  background: linear-gradient(180deg, transparent 0%, rgba(2, 2, 16, 0.6) 20%, rgba(2, 2, 16, 0.9) 100%);
  border-bottom: 1px solid rgba(212, 175, 55, 0.1);
}

.dialogue-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.7;
  animation: fadeInUp 0.3s ease;
}

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

.dialogue-bubble.master {
  align-self: flex-start;
  background: var(--glass-strong);
  border: 1px solid var(--rule);
  border-bottom-left-radius: 4px;
  color: var(--shop-cream);
}

.dialogue-bubble.user {
  align-self: flex-end;
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-bottom-right-radius: 4px;
  color: var(--shop-gold-light);
}

.dialogue-bubble.shopkeeper {
  align-self: center;
  max-width: 90%;
  background: rgba(139, 92, 246, 0.1);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: var(--radius-sm);
  color: var(--violet-light);
  font-size: 13px;
  text-align: center;
}

.dialogue-bubble .speaker-name {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 4px;
}

/* 输入区 */
.dialogue-input-area {
  position: relative;
  z-index: 20;
  padding: 12px 16px;
  border-top: 1px solid var(--rule);
  background: rgba(10, 10, 30, 1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.dialogue-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.dialogue-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--rule);
  background: var(--bg-deep);
  color: var(--shop-cream);
  font-size: 16px;
  font-family: var(--font-body);
  resize: none;
  min-height: 40px;
  max-height: 120px;
  outline: none;
  transition: border-color 0.2s;
}

.dialogue-input:focus { border-color: var(--shop-gold); }

/* 取消按钮栏 - 确保在立绘之上 */
#cancelBar {
  position: relative;
  z-index: 20;
  background: rgba(10, 10, 30, 1);
}

.dialogue-send-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--shop-gold);
  color: var(--bg-deep);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.dialogue-send-btn:active { transform: scale(0.9); }
.dialogue-send-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ========== 加载动画 ========== */
.shop-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
}

.shop-loading .spinner {
  width: 36px;
  height: 36px;
  border: 2px solid rgba(212, 175, 55, 0.15);
  border-top-color: var(--shop-gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.shop-loading .text {
  font-size: 13px;
  color: var(--muted);
}

/* ========== Toast 提示 ========== */
.shop-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0, 0, 0, 0.85);
  border: 1px solid var(--shop-gold);
  color: var(--shop-cream);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
  max-width: 90vw;
}

.shop-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ========== 返回顶部按钮 ========== */
.back-to-top {
  position: fixed;
  right: 16px;
  bottom: 96px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(20, 20, 50, 0.8);
  border: 1px solid rgba(212, 175, 55, 0.5);
  color: var(--shop-gold);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 150;
  backdrop-filter: blur(4px);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s, transform 0.3s;
}

.back-to-top.visible {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}

.back-to-top:active {
  background: rgba(212, 175, 55, 0.25);
}

@media (prefers-reduced-motion: reduce) {
  .back-to-top {
    transition: none;
  }
}

/* ========== 底部常驻免责温馨提示 ========== */
.disclaimer-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 16px auto 4px;
  padding: 10px 16px;
  max-width: 480px;
  border: 1px solid rgba(212, 175, 55, 0.3);
  border-radius: var(--radius-sm);
  background: rgba(212, 175, 55, 0.06);
  font-size: 12px;
  color: var(--shop-gold-light);
  line-height: 1.6;
  text-align: center;
}

.disclaimer-notice .disclaimer-icon {
  font-size: 14px;
  flex-shrink: 0;
}

/* ========== 游戏过程底部常驻免责声明（悬浮于 vn-screen 内） ========== */
.vn-disclaimer {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  z-index: 120; /* 提到最上层，确保不被任何按钮/选项区遮挡 */
  text-align: center;
  font-size: 10px;
  color: rgba(245, 240, 232, 0.4);
  pointer-events: none;
  padding: 0 12px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ========== 底部免责 ========== */
.shop-disclaimer {
  text-align: center;
  font-size: 11px;
  color: rgba(245, 240, 232, 0.35);
  padding: 16px;
  line-height: 1.6;
}

.shop-disclaimer a {
  color: rgba(245, 240, 232, 0.4);
  font-size: 11px;
  margin: 0 4px;
}

/* ========== AI 解读格式化内容 ========== */
.ai-formatted-content {
  font-size: 14px;
  line-height: 1.8;
  color: var(--shop-cream);
}

.ai-formatted-content .ai-section-head {
  margin: 10px 0 6px;
  padding: 6px 12px;
  border-left: 3px solid var(--shop-gold);
  background: rgba(212, 175, 55, 0.08);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--shop-gold-light);
  font-weight: 500;
  font-size: 14px;
}

.ai-formatted-content .ai-section-title {
  margin: 8px 0 4px;
  color: var(--violet-light);
  font-weight: 500;
  font-size: 13px;
}

.ai-formatted-content .ai-para {
  margin: 0 0 6px;
}

.ai-formatted-content strong {
  color: var(--shop-gold-light);
  font-weight: 500;
}

.ai-formatted-content .ai-list {
  margin: 4px 0 8px;
  padding-left: 4px;
}

.ai-formatted-content .ai-list-item {
  position: relative;
  padding: 3px 0 3px 18px;
  font-size: 13px;
}

.ai-formatted-content .ai-list-item::before {
  content: '';
  position: absolute;
  left: 4px;
  top: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--shop-gold);
  opacity: 0.7;
}

/* ========== 底部落款 ========== */
.shop-footer {
  text-align: center;
  padding: 12px 16px 20px;
  font-size: 11px;
  color: var(--muted);
}

.shop-footer .powered {
  color: rgba(245, 240, 232, 0.5);
}

.shop-footer .powered .brand {
  color: var(--shop-gold);
}

/* ========== 工具选择区 ========== */
.tool-select-area {
  padding: 16px 0;
}

.tool-select-area .section-label {
  font-size: 14px;
  color: var(--shop-gold);
  margin-bottom: 12px;
  font-family: var(--font-title);
}

.tool-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.tool-card-mini {
  padding: 14px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rule);
  background: var(--glass);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.tool-card-mini:active { transform: scale(0.96); }
.tool-card-mini:hover { border-color: var(--rule-bright); }

.tool-card-mini.selected {
  border-color: var(--shop-gold);
  background: rgba(212, 175, 55, 0.1);
}

.tool-card-mini .icon { font-size: 28px; margin-bottom: 6px; }
.tool-card-mini .name { font-size: 13px; color: var(--shop-cream); }
.tool-card-mini .desc { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* ========== 响应式 ========== */
@media (max-width: 360px) {
  .master-card .info-area { padding: 10px 12px; }
  .master-card .master-name { font-size: 15px; }
  .tool-cards { grid-template-columns: 1fr; }
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--rule); border-radius: var(--radius-sm); }


/* ================================================================
   视觉小说风格追加样式 · Visual Novel Extension
   ================================================================ */

/* ========== 1. 开场敲门界面 ========== */
.knock-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg-deep);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.knock-screen .door-bg {
  position: absolute;
  inset: 0;
  background: url('../assets/img/bg/door.webp') center / cover no-repeat;
  opacity: 0.7;
}

/* 敲门提示文字 - 呼吸闪烁 */
.knock-screen .door-knock-hint {
  position: absolute;
  bottom: 15%;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-brush);
  font-size: 18px;
  color: var(--shop-gold);
  text-shadow: 0 0 16px rgba(212, 175, 55, 0.5);
  animation: hintBreath 2.5s ease-in-out infinite;
  white-space: nowrap;
  z-index: 2;
}

@keyframes hintBreath {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* 可点击的门区域 */
.knock-screen .door-area {
  position: relative;
  z-index: 1;
  width: 260px;
  height: 380px;
  cursor: pointer;
  transition: transform 0.1s;
}

/* 敲门震动动画 */
.knock-screen .door-area.knocking {
  animation: doorKnock 0.15s ease-in-out 4;
}

@keyframes doorKnock {
  0% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  50% { transform: translateX(4px); }
  75% { transform: translateX(-3px); }
  100% { transform: translateX(0); }
}

/* 门缝透光效果 */
.knock-screen .door-light {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 200px;
  background: linear-gradient(180deg,
    rgba(212, 175, 55, 0.6) 0%,
    rgba(251, 191, 36, 0.3) 40%,
    rgba(245, 240, 232, 0.1) 100%);
  filter: blur(20px);
  opacity: 0;
  transition: width 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              opacity 0.8s ease;
  pointer-events: none;
  z-index: 0;
}

.knock-screen .door-light.opening {
  width: 300px;
  opacity: 1;
}


/* ========== 2. 性别选择界面 ========== */
.gender-select-screen {
  position: fixed;
  inset: 0;
  z-index: 950;
  background: url('../assets/img/bg/door.webp') center / cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

/* 暗色遮罩 - 降低背景明度，保留透出感 */
.gender-select-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(2, 2, 16, 0.55) 0%, rgba(2, 2, 16, 0.7) 100%);
  z-index: 0;
}

.gender-select-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  padding: 36px 28px;
  border-radius: var(--radius-md);
  background: rgba(10, 10, 30, 0.3);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid rgba(212, 175, 55, 0.3);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  text-align: center;
}

.gender-select-card .title {
  font-family: var(--font-brush);
  font-size: 22px;
  color: var(--shop-gold);
  text-shadow: 0 0 12px rgba(212, 175, 55, 0.3);
  margin-bottom: 24px;
}

/* 选项容器 */
.gender-options {
  display: flex;
  gap: 16px;
  justify-content: center;
}

.gender-option {
  flex: 1;
  max-width: 160px;
  padding: 16px 12px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.gender-option img {
  width: 80px;
  height: 110px;
  object-fit: cover;
  object-position: top center;
  margin: 0 auto 10px;
  border-radius: var(--radius-sm);
}

.gender-option .label {
  font-size: 14px;
  font-family: var(--font-title);
  color: var(--shop-cream);
}

/* 男性主题 */
.gender-option.male {
  border-color: rgba(34, 211, 238, 0.2);
  background: rgba(34, 211, 238, 0.05);
}

.gender-option.male .label {
  color: var(--cyan);
}

/* 女性主题 */
.gender-option.female {
  border-color: rgba(232, 180, 217, 0.2);
  background: rgba(232, 180, 217, 0.05);
}

.gender-option.female .label {
  color: var(--shop-pink-purple);
}

.gender-option:hover {
  border-color: rgba(212, 175, 55, 0.35);
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.gender-option:active {
  transform: scale(0.97);
}

/* 选中状态 - 金色发光 */
.gender-option.selected {
  border-color: var(--shop-gold);
  box-shadow: var(--shadow-gold),
              inset 0 0 20px rgba(212, 175, 55, 0.05);
  transform: scale(1.03);
}

.gender-option.selected .label {
  color: var(--shop-gold);
}


/* ========== 3. 视觉小说对话界面（核心） ========== */
.vn-screen {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  overflow: hidden;
  max-width: 100vw;
  /* 移动端 Safari 动态高度兼容 */
  height: 100dvh;
  /* 顶部导航栏固定高度占位，避免内容被导航栏遮挡 */
  padding-top: var(--nav-height, 56px);
  /* 底部留出空间放置免责声明，避免与对话框内容重叠 */
  padding-bottom: 24px;
}

/* 带面板标签栏的 vn-screen（八字排盘页） - 顶部额外留出Tab栏空间 */
.vn-screen.with-panel-tabs {
  padding-top: calc(var(--nav-height, 56px) + 44px);
}

/* 底部渐变遮罩 - 防止立绘视觉上覆盖输入区和按钮，但不对 dialogue-area 区域产生视觉遮挡 */
.vn-screen::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 380px;
  z-index: 2;
  background: linear-gradient(180deg, transparent 0%, rgba(2, 2, 16, 0.4) 10%, rgba(2, 2, 16, 0.85) 25%, rgba(2, 2, 16, 1) 40%);
  pointer-events: none;
}

/* 全屏背景图 */
.vn-screen .vn-background {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.5;
  filter: brightness(0.4);
  z-index: 0;
  transition: opacity 0.6s ease, filter 0.6s ease;
}

/* 立绘舞台 */
.vn-screen .vn-characters-stage {
  position: absolute;
  bottom: 260px;
  left: 0;
  right: 0;
  height: 55vh;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
  /* clip-path 确保 filter:drop-shadow 不会溢出到对话框区域 */
  clip-path: inset(0 0 0 0);
}

/* 单个立绘容器 */
.vn-screen .vn-character {
  position: absolute;
  bottom: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  animation: charFadeIn 0.5s ease-out forwards;
}

/* 立绘图片 - 胸像裁剪 */
.vn-screen .vn-character img {
  height: 45vh;
  width: auto;
  max-width: 45vw;
  object-fit: cover;
  object-position: top center;
  filter: drop-shadow(0 4px 24px rgba(0, 0, 0, 0.5));
  -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 55%, rgba(0,0,0,0) 100%);
  mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 55%, rgba(0,0,0,0) 100%);
  pointer-events: none;
}

/* 立绘出现动画 */
@keyframes charFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 说话者 - 全亮度 */
.vn-screen .vn-character.speaking {
  opacity: 1;
}

/* 非说话者 - 高透明度，更暗 */
.vn-screen .vn-character.dimmed {
  opacity: 0.18;
}

/* 左侧立绘 */
.vn-screen .vn-character.left {
  left: 5%;
}

/* 右侧立绘 - 镜像 */
.vn-screen .vn-character.right {
  right: 5%;
}

.vn-screen .vn-character.right img {
  transform: scaleX(-1);
}

/* 中间立绘（掌柜） */
.vn-screen .vn-character.center {
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
}

.vn-screen .vn-character.center img {
  height: 45vh;
  max-width: 40vw;
}

/* 隐藏状态 */
.vn-screen .vn-character.hidden {
  display: none;
}

/* 说话者名称标签 - 完全悬浮在对话框上方，不占用对话内容空间 */
.vn-screen .vn-speaker-name {
  position: absolute;
  bottom: 100%;
  left: 20px;
  z-index: 11;
  padding: 4px 16px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.85), rgba(212, 175, 55, 0.65));
  color: var(--bg-deep);
  font-family: var(--font-brush);
  font-size: 16px;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: left 0.3s ease, right 0.3s ease;
  pointer-events: none;
}
.vn-screen .vn-speaker-name.align-right {
  left: auto;
  right: 20px;
}
.vn-screen .vn-speaker-name.align-left {
  left: 20px;
  right: auto;
}

/* 对话框 - 固定全宽，不随内容变化 */
.vn-screen .vn-dialogue-box {
  position: relative;
  z-index: 10;
  margin-top: auto;
  padding: 20px 20px 48px; /* 名称卡已悬浮在外部，顶部padding减少；底部留出继续按钮空间 */
  min-height: 120px;
  width: 100vw;
  max-width: 100vw;
  left: 50%;
  margin-left: -50vw;
  background: rgba(10, 10, 20, 1);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-top: 1px solid rgba(212, 175, 55, 0.2);
}

/* 打字机文字 */
.vn-screen .vn-dialogue-box .vn-typing-text {
  font-size: 15px;
  line-height: 1.8;
  color: var(--shop-cream);
  min-height: 3.6em;
  padding-bottom: 8px; /* 文字底部与继续按钮之间增加间距 */
}

/* 点击继续区域 */
.vn-screen .vn-dialogue-box.clickable {
  cursor: pointer;
}

/* 对话框点击提示三角 - 已移除，改用 vn-continue-hint 按钮提示 */
.vn-screen .vn-dialogue-box.clickable::after {
  display: none;
}

/* 继续按钮提示 */
.vn-screen .vn-continue-hint {
  position: absolute;
  bottom: 8px;
  right: 12px;
  z-index: 15;
  display: none;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: rgba(212, 175, 55, 0.2);
  border: 1px solid rgba(212, 175, 55, 0.5);
  pointer-events: auto;
  cursor: pointer;
  animation: continueHintPulse 1.5s ease-in-out infinite;
}

/* 显示状态 - 通过 .visible 类控制 */
.vn-screen .vn-continue-hint.visible {
  display: flex !important;
  pointer-events: auto !important;
}

.vn-screen .vn-continue-text {
  font-size: 11px;
  color: var(--shop-gold);
  opacity: 0.9;
}

.vn-screen .vn-continue-arrow {
  font-size: 10px;
  color: var(--shop-gold);
  opacity: 0.8;
  animation: continueArrowBounce 1s ease-in-out infinite;
}

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

@keyframes continueArrowBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(2px); }
}

/* 选择按钮区域 - 绝对定位于对话框上方（说话者名字之上） */
.vn-screen .vn-choices {
  position: absolute;
  bottom: calc(240px + 24px + 8px + 36px + 10px); /* 对话框(240+24) + speaker间距(8) + speaker高度(~36px含padding+font) + choices间距(10) */
  left: 0;
  right: 0;
  z-index: 10;
  padding: 12px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(0deg, rgba(10, 10, 20, 0.98) 0%, rgba(10, 10, 20, 0.92) 70%, rgba(10, 10, 20, 0.7) 100%);
  pointer-events: auto;
  /* 防止内容超高时向上/向下溢出遮挡排盘面板与底部免责声明 */
  max-height: calc(100vh - 380px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.vn-screen .vn-choice-btn {
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--shop-gold);
  background: rgba(10, 10, 20, 0.92);
  color: var(--shop-gold-light);
  font-size: 14px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow-md);
}

.vn-screen .vn-choice-btn:hover,
.vn-screen .vn-choice-btn:active {
  background: rgba(212, 175, 55, 0.18);
  border-color: var(--shop-gold);
  box-shadow: var(--shadow-gold);
}

/* 自动 / 跳过控制按钮 */
.vn-screen .vn-controls {
  position: absolute;
  top: 12px;
  right: 16px;
  z-index: 20;
  display: flex;
  gap: 8px;
}

.vn-screen .vn-controls button {
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(0, 0, 0, 0.4);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.vn-screen .vn-controls button.active {
  color: var(--shop-gold);
  border-color: rgba(212, 175, 55, 0.4);
}


/* ========== 4. 掌柜沟通界面 ========== */
.shopkeeper-talk-screen {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  overflow: hidden;
}

/* 掌柜界面覆盖：名称标签悬浮在对话框上方，与通用样式保持一致 */
.shopkeeper-talk-screen .vn-speaker-name {
  bottom: 100%;
  top: auto;
  left: 20px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.shopkeeper-talk-screen .vn-dialogue-box {
  position: relative;
  z-index: 10;
  margin-top: auto;
}

.shopkeeper-talk-screen .vn-choices {
  bottom: calc(220px + 24px + 8px + 36px + 10px); /* 掌柜对话框略矮，保持一致 */
  max-height: calc(100vh - 340px); /* 确保不超出屏幕顶部 */
  overflow-y: auto; /* 内容过多时允许滚动 */
  -webkit-overflow-scrolling: touch;
}

/* 分类卡片在选项容器内使用2列网格布局，节省纵向空间 */
.shopkeeper-talk-screen .vn-choices .category-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
}

/* 选项容器内的网格布局（通过JS添加grid-mode类触发） */
.shopkeeper-talk-screen .vn-choices.grid-mode {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 10px 16px;
}

/* 非分类按钮（自由输入、选大师）占满整行 */
.shopkeeper-talk-screen .vn-choices.grid-mode .free-input-btn,
.shopkeeper-talk-screen .vn-choices.grid-mode .list-btn,
.shopkeeper-talk-screen .vn-choices.grid-mode .accept-btn,
.shopkeeper-talk-screen .vn-choices.grid-mode .chat-btn {
  grid-column: 1 / -1;
}

/* 掌柜界面继续按钮提示 - 确保可见 */
.shopkeeper-talk-screen .vn-continue-hint {
  position: absolute;
  bottom: 8px;
  right: 12px;
  z-index: 15;
}

.shopkeeper-talk-screen .vn-continue-hint.visible {
  display: flex !important;
  pointer-events: auto !important;
}

/* 掌柜立绘（已由 vn-character left 覆盖，保留兼容） */
.shopkeeper-talk-screen .sk-portrait {
  display: none;
}

/* 分类选项网格 - 2列3行 */
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 0 24px 16px;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}

/* 单个分类卡片 */
.category-card {
  padding: 16px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--rule);
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.category-card:hover,
.category-card:active {
  border-color: var(--shop-gold);
  background: rgba(212, 175, 55, 0.08);
  transform: scale(0.97);
}

.category-card .icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.category-card .label {
  font-size: 13px;
  font-family: var(--font-title);
  color: var(--shop-cream);
  margin-bottom: 4px;
}

.category-card .desc {
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
}

/* 自由输入区域 */
.free-input-area {
  padding: 12px 20px 16px;
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}

.free-input-area textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rule);
  background: var(--bg-deep);
  color: var(--shop-cream);
  font-size: 16px;
  font-family: var(--font-body);
  resize: none;
  min-height: 64px;
  outline: none;
  transition: border-color 0.2s;
  line-height: 1.6;
}

.free-input-area textarea:focus {
  border-color: var(--shop-gold);
  box-shadow: var(--shadow-gold);
}

.free-input-area .send-btn {
  margin-top: 10px;
  width: 100%;
}

/* 自由输入区按钮组 - 横排布局 */
.free-input-buttons {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.free-input-buttons .btn {
  flex: 1;
  border-radius: var(--radius-sm);
  font-size: 13px;
  padding: 10px 12px;
  min-height: 40px;
  transition: all 0.2s ease;
}

.free-input-buttons .btn-primary {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.28), rgba(212, 175, 55, 0.12));
  border: 1px solid rgba(212, 175, 55, 0.5);
  color: var(--shop-gold-light);
  font-weight: 600;
}

.free-input-buttons .btn-primary:hover {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.4), rgba(212, 175, 55, 0.2));
  box-shadow: var(--shadow-gold);
}

.free-input-buttons .btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--muted);
}

.free-input-buttons .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--shop-cream);
}

/* 推荐提示区（掌柜推荐大师时，融入自由输入区上方） */
.recommendation-hint {
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 10px;
  text-align: center;
  animation: recHintFadeIn 0.4s ease;
}

@keyframes recHintFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.recommendation-hint .btn {
  min-height: 38px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.recommendation-hint .btn:active {
  transform: scale(0.96);
}

/* 自由输入区快捷选项按钮（快速选择分类/直接选大师） */
.free-input-quick-options {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(212, 175, 55, 0.15);
}

.quick-option-btn {
  flex: 1;
  padding: 12px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(212, 175, 55, 0.25);
  background: rgba(212, 175, 55, 0.08);
  color: var(--shop-gold-light);
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.quick-option-btn:active {
  background: rgba(212, 175, 55, 0.2);
  border-color: var(--shop-gold);
  transform: scale(0.97);
}

/* 推荐大师按钮（请大师解惑/自己选大师/再聊聊） - 移动端人机工程学优化 */
.vn-choice-btn.accept-btn,
.vn-choice-btn.list-btn,
.vn-choice-btn.chat-btn {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.5px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* 推荐大师按钮 - 接受按钮金色显眼 */
.vn-choice-btn.accept-btn {
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.35), rgba(212, 175, 55, 0.15));
  border-color: var(--shop-gold);
  box-shadow: var(--shadow-gold);
}

/* 推荐大师按钮 - 列表按钮 */
.vn-choice-btn.list-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--ink-soft);
}

/* 继续聊天按钮 - 柔和风格 */
.vn-choice-btn.chat-btn {
  background: rgba(139, 92, 246, 0.1);
  border-color: rgba(139, 92, 246, 0.3);
  color: var(--violet-light);
  font-weight: 500;
}

/* 自由输入区"告诉掌柜"按钮 - 增大高度 */
.free-input-buttons .btn-primary {
  min-height: 48px;
  font-size: 15px;
  letter-spacing: 0.5px;
}

/* 封面选项按钮 - 我想自己说 */
.vn-choice-btn.free-input-btn {
  min-height: 48px;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 推荐大师卡片弹窗 */
.recommend-card {
  position: fixed;
  inset: 0;
  z-index: 960;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(2, 2, 16, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: fadeInUp 0.3s ease;
}

.recommend-card .card-inner {
  width: 100%;
  max-width: 320px;
  padding: 24px;
  border-radius: var(--radius-md);
  background: var(--glass-strong);
  border: 1px solid rgba(212, 175, 55, 0.3);
  text-align: center;
}

.recommend-card .card-inner .master-preview {
  width: 100px;
  height: 140px;
  object-fit: cover;
  object-position: top center;
  margin: 0 auto 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--rule);
}

.recommend-card .card-inner .master-info .name {
  font-family: var(--font-brush);
  font-size: 20px;
  color: var(--shop-gold);
}

.recommend-card .card-inner .master-info .title {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.recommend-card .card-inner .action-btn {
  margin-top: 16px;
}


/* ========== 5. 大师卡片立绘裁剪修正（胸像展示） ========== */
/* 胸像展示：横向比例 + 顶部裁剪，只显示胸部以上 */
.master-card .portrait-wrap {
  aspect-ratio: 4/3;
}

.master-card .portrait-wrap img {
  object-position: top center;
  object-fit: cover;
}


/* ========== 6. 音量控制按钮 ========== */
.audio-controls {
  position: fixed;
  top: calc(var(--nav-height) + 8px);
  right: 16px;
  z-index: 1001;
  display: flex;
  gap: 8px;
}

.audio-toggle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--shop-gold);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.audio-toggle:hover {
  background: rgba(0, 0, 0, 0.7);
  border-color: rgba(212, 175, 55, 0.4);
}

/* 静音状态 */
.audio-toggle.muted {
  color: var(--muted);
  border-color: rgba(255, 255, 255, 0.1);
  opacity: 0.6;
}

/* 音频控制按钮在响应式下的调整 */
@media (max-width: 360px) {
  .audio-controls { top: calc(var(--nav-height) + 4px); right: 12px; gap: 6px; }
  .audio-toggle { width: 32px; height: 32px; }
}

/* ========== 6.5 浮动锦囊入口按钮 ========== */
.floating-pouch-btn {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1002;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 55, 0.3);
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--shop-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.floating-pouch-btn:hover {
  background: rgba(0, 0, 0, 0.7);
  border-color: rgba(212, 175, 55, 0.6);
  color: var(--shop-gold-light);
}

.floating-pouch-btn:active {
  transform: scale(0.92);
}

@media (max-width: 360px) {
  .floating-pouch-btn { top: 12px; right: 12px; width: 32px; height: 32px; }
}


/* ========== 7. 工具按钮音效样式（交互增强） ========== */
/* 确保所有可交互元素具有明确的点击反馈 */
.btn {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s ease, transform 0.1s ease;
}

.tier-tab {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.gender-option {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.category-card {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* 按下音效视觉反馈 - 统一的 active 状态 */
.btn:active,
.tier-tab:active,
.gender-option:active,
.category-card:active {
  transform: scale(0.96);
  transition: transform 0.08s ease;
}


/* ========== 8. 步骤指示器 ========== */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 16px 0;
  margin: 0 auto;
  max-width: 240px;
}

/* 步骤圆点 */
.step-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

/* 当前步骤 */
.step-dot.active {
  background: var(--shop-gold);
  border-color: var(--shop-gold);
  box-shadow: var(--shadow-gold),
              0 0 20px rgba(212, 175, 55, 0.2);
  transform: scale(1.2);
}

/* 已完成步骤 */
.step-dot.done {
  background: var(--shop-gold);
  border-color: var(--shop-gold);
  opacity: 0.7;
}

/* 连接线 */
.step-line {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  transition: background 0.3s ease;
  min-width: 20px;
}

.step-line.done {
  background: rgba(212, 175, 55, 0.5);
}


/* ========== 视觉小说 - 移动端适配 ========== */
@media (max-width: 480px) {
  /* 立绘舞台 - 移动端上移避免遮挡输入区 */
  .vn-screen .vn-characters-stage {
    bottom: 200px;
    height: 50vh;
  }

  /* 立绘尺寸微调 */
  .vn-screen .vn-character img {
    height: 42vh;
    max-width: 42vw;
  }

  .vn-screen .vn-character.left {
    left: 2%;
  }

  .vn-screen .vn-character.right {
    right: 2%;
  }

  /* 对话框内边距 */
  .vn-screen .vn-dialogue-box {
    padding: 16px 16px 40px; /* 名称卡已悬浮在外部，顶部padding减少 */
    min-height: 110px;
  }

  /* 说话者名称标签 - 移动端（同样悬浮在对话框上方） */
  .vn-screen .vn-speaker-name {
    bottom: 100%;
    top: auto;
    left: 16px;
    font-size: 14px;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  }
  .vn-screen .vn-speaker-name.align-right {
    left: auto;
    right: 16px;
  }
  .vn-screen .vn-speaker-name.align-left {
    left: 16px;
    right: auto;
  }

  /* 选择按钮 */
  .vn-screen .vn-choice-btn {
    padding: 10px 16px;
    font-size: 13px;
  }

  /* 选择按钮区域 - 移动端适配 */
  .vn-screen .vn-choices {
    bottom: calc(200px + 20px + 8px + 32px + 10px); /* 对话框(200+20) + speaker间距(8) + speaker高度(~32px) + choices间距(10) */
    padding: 0 16px;
  }

  /* 性别选择卡片 */
  .gender-select-card {
    padding: 24px 16px;
  }

  .gender-option img {
    width: 60px;
    height: 85px;
  }

  /* 门区域 */
  .knock-screen .door-area {
    width: 200px;
    height: 300px;
  }

  .knock-screen .door-knock-hint {
    font-size: 15px;
    bottom: 12%;
  }

  /* 掌柜沟通 */
  .shopkeeper-talk-screen .sk-portrait {
    width: 140px;
    height: 190px;
    margin-top: 32px;
  }

  .category-grid {
    gap: 8px;
    padding: 0 16px 12px;
  }

  .category-card {
    padding: 12px 8px;
  }

  .category-card .icon {
    font-size: 24px;
  }

  .category-card .label {
    font-size: 12px;
  }

  .category-card .desc {
    font-size: 9px;
  }

  .free-input-area {
    padding: 10px 16px 14px;
  }

  .free-input-buttons {
    gap: 8px;
  }

  .free-input-buttons .btn {
    font-size: 12px;
    padding: 8px 10px;
    min-height: 44px;
  }

  /* 移动端快捷选项按钮 */
  .quick-option-btn {
    min-height: 44px;
    font-size: 12px;
    padding: 10px 8px;
  }

  /* 推荐大师按钮 */
  .vn-choice-btn.accept-btn,
  .vn-choice-btn.list-btn,
  .vn-choice-btn.chat-btn {
    min-height: 44px;
    font-size: 14px;
  }

  /* 推荐卡片 */
  .recommend-card .card-inner {
    padding: 20px;
  }

  .recommend-card .card-inner .master-preview {
    width: 80px;
    height: 112px;
  }

  /* 音量按钮 */
  .audio-toggle {
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  /* 步骤指示器 */
  .step-indicator {
    max-width: 200px;
  }

  .step-dot {
    width: 8px;
    height: 8px;
  }
}

/* 极小屏幕适配 */
@media (max-width: 360px) {
  .vn-screen .vn-character img {
    height: 48vh;
    max-width: 40vw;
  }

  .vn-screen .vn-dialogue-box .vn-typing-text {
    font-size: 14px;
  }

  .gender-options {
    flex-direction: column;
    align-items: center;
  }

  .gender-option {
    max-width: 200px;
    flex: none;
    width: 100%;
  }
}

/* ========== 平板适配 ========== */
@media (min-width: 768px) {
  .shop-container {
    padding: 24px 32px;
  }
  .master-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 640px;
    margin: 0 auto;
  }
  .tier-tabs {
    justify-content: center;
  }
  .shopkeeper-portrait {
    width: 150px;
    height: 150px;
  }
  .shopkeeper-greeting {
    font-size: 17px;
    max-width: 420px;
  }
  .category-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 600px;
    margin: 0 auto;
  }
  .tool-cards {
    grid-template-columns: repeat(3, 1fr);
    max-width: 600px;
    margin: 0 auto;
  }
  .vn-dialogue-box {
    max-width: 640px;
    margin: 0 auto;
  }
  .shop-nav .nav-title {
    font-size: 22px;
  }
}

/* 排盘结果常驻面板 - 使用相对定位，在正常流中排列，避免与对话区重叠 */
.vn-result-panel {
  position: relative;
  z-index: 100;
  max-height: 55vh;
  display: flex;
  flex-direction: column;
  pointer-events: auto;
  flex-shrink: 0;
}
.vn-result-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 16px;
  background: rgba(10, 10, 20, 0.92);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-left: none;
  border-right: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--shop-gold);
  backdrop-filter: blur(8px);
  user-select: none;
}
.vn-result-toggle:active {
  background: rgba(212, 175, 55, 0.1);
}
.vn-result-body {
  overflow-y: auto;
  padding: 12px 16px;
  background: rgba(10, 10, 30, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  -webkit-overflow-scrolling: touch;
}
.vn-result-body .result-card {
  margin: 0;
}
.vn-result-body .tarot-cards-display {
  margin: 8px 0;
}
/* 结果面板内对话气泡样式 */
.vn-result-body .dialogue-bubble {
  max-width: 100%;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  animation: none;
}
.vn-result-body .dialogue-bubble .speaker-name {
  font-size: 12px;
  color: var(--shop-gold);
  margin-bottom: 8px;
  font-weight: 600;
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  padding-bottom: 6px;
}
.vn-result-body .result-title {
  font-size: 14px;
  color: var(--shop-gold);
  font-weight: 600;
  margin-bottom: 8px;
  padding: 8px 12px;
  background: rgba(212, 175, 55, 0.1);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--shop-gold);
}
.vn-result-body .result-desc {
  font-size: 13px;
  color: var(--shop-cream);
  line-height: 1.8;
  padding: 0 4px;
  white-space: pre-wrap;
}
.vn-result-body .result-card {
  background: var(--glass-strong);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 0 0 8px 0;
}
.vn-result-body .tarot-card-item {
  padding: 8px;
  border-radius: var(--radius-sm);
  background: rgba(20, 20, 50, 0.5);
  margin-bottom: 6px;
  text-align: center;
}
.vn-result-body .tarot-card-item .card-num {
  font-size: 11px;
  color: var(--muted);
}
.vn-result-body .tarot-card-item .card-suit {
  font-size: 20px;
  margin: 4px 0;
}
.vn-result-body .tarot-card-item .card-name {
  font-size: 14px;
  font-weight: 600;
}
.vn-result-body .tarot-card-item .card-orient {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* ========== 移动端性能优化（Safari/iOS） ========== */
/* 核心策略：禁用所有 backdrop-filter（GPU重绘头号杀手），用不透明背景替代 */
@media (max-width: 768px) {
  /* 导航栏：用不透明背景替代 blur */
  .shop-nav {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(10, 10, 30, 0.95) !important;
  }

  /* 大师卡片：移除 blur */
  .master-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(20, 20, 50, 0.85) !important;
  }

  /* 段位徽章 */
  .master-card .tier-badge {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* 对话框：用高不透明度背景替代 blur */
  .vn-dialogue-box,
  .vn-dialogue-box * {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .vn-dialogue-box {
    background: rgba(6, 6, 26, 0.92) !important;
  }

  /* 结果面板 */
  .vn-result-toggle,
  .vn-result-body {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .vn-result-body {
    background: rgba(10, 10, 30, 0.98) !important;
  }

  /* 浮动按钮区域 */
  .vn-floating-controls,
  .vn-floating-controls * {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* 星运卡弹窗 */
  .card-modal,
  .card-modal * {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* 性别选择 */
  .gender-overlay,
  .gender-overlay * {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* 敲门动画 */
  .knock-overlay,
  .knock-overlay * {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  /* 排盘面板标签栏 */
  .panel-tabs {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(10, 10, 30, 0.95) !important;
  }

  /* 玻璃质感通用类 */
  .glass-panel {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: rgba(20, 20, 50, 0.88) !important;
  }

  /* CSS containment：隔离重绘区域，减少合成开销 */
  .shop-container,
  .vn-screen,
  .vn-characters-stage {
    contain: layout style paint;
  }

  /* 离屏内容延迟渲染 */
  .tab-content[style*="display:none"],
  .vn-result-body {
    content-visibility: auto;
    contain-intrinsic-size: auto 300px;
  }

  /* 禁用非必要动画（保留交互动画） */
  .fc-float-pulse,
  .ns-float-pulse {
    animation: none !important;
  }

  /* 减小噪声层开销 */
  .shop-bg-noise {
    opacity: 0.015;
  }
}

/* 用户开启「减少动效」时的全局优化 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
