/* ============================================
   量子合成器 · 五品级视觉系统
   百草出品 @ 2026-06-30
   ============================================ */

/* ---- 品级色值变量 ---- */
:root {
  /* 凡品 - 宣纸白 */
  --color-fan:        #D4C5A9;
  --color-fan-bg:     #F5F0E6;
  --color-fan-glow:   rgba(212, 197, 169, 0.25);

  /* 良品 - 青瓷绿 */
  --color-liang:      #7BC4A0;
  --color-liang-bg:   #E8F5EE;
  --color-liang-glow: rgba(123, 196, 160, 0.35);

  /* 珍品 - 紫星芒 */
  --color-zhen:       #9B6BCC;
  --color-zhen-bg:    #F0E8F8;
  --color-zhen-glow:  rgba(155, 107, 204, 0.45);

  /* 极品 - 琥珀金 */
  --color-jipin:      #E8A830;
  --color-jipin-bg:   #FDF5E6;
  --color-jipin-glow: rgba(232, 168, 48, 0.55);

  /* 传说 - 胭脂红金 */
  --color-chuanshuo:      #C43030;
  --color-chuanshuo-accent: #E8A830;
  --color-chuanshuo-bg:   #FDF0F0;
  --color-chuanshuo-glow: rgba(196, 48, 48, 0.7);
}

/* ---- 品级标签（圆形徽章/品级标识） ---- */
.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.grade-badge-fan {
  background: linear-gradient(135deg, #D4C5A9, #B8A88A);
  color: #6B5D45;
}
.grade-badge-liang {
  background: linear-gradient(135deg, #7BC4A0, #5DA880);
}
.grade-badge-zhen {
  background: linear-gradient(135deg, #9B6BCC, #7A4DB0);
}
.grade-badge-jipin {
  background: linear-gradient(135deg, #E8A830, #D09020);
}
.grade-badge-chuanshuo {
  background: linear-gradient(135deg, #C43030, #E8A830);
  animation: badge-chuanshuo-glow 2s ease-in-out infinite;
}

@keyframes badge-chuanshuo-glow {
  0%, 100% { box-shadow: 0 0 8px var(--color-chuanshuo-glow); }
  50%      { box-shadow: 0 0 20px var(--color-chuanshuo-glow), 0 0 40px rgba(232,168,48,0.3); }
}

/* ---- 药材/卡片品级边框 ---- */
.grade-border {
  border-width: 2px;
  border-style: solid;
  border-radius: 8px;
  transition: border-color 0.3s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
}

.grade-border-fan {
  border-color: var(--color-fan);
  background: var(--color-fan-bg);
}
.grade-border-liang {
  border-color: var(--color-liang);
  background: var(--color-liang-bg);
  box-shadow: 0 0 8px var(--color-liang-glow);
}
.grade-border-zhen {
  border-color: var(--color-zhen);
  background: var(--color-zhen-bg);
  box-shadow: 0 0 12px var(--color-zhen-glow);
}
.grade-border-jipin {
  border-color: var(--color-jipin);
  background: var(--color-jipin-bg);
  box-shadow: 0 0 16px var(--color-jipin-glow);
}
.grade-border-chuanshuo {
  border-color: var(--color-chuanshuo);
  background: linear-gradient(135deg, var(--color-chuanshuo-bg), #FFF8E8);
  box-shadow: 0 0 20px var(--color-chuanshuo-glow);
  animation: border-chuanshuo-breath 3s ease-in-out infinite;
}

@keyframes border-chuanshuo-breath {
  0%, 100% { box-shadow: 0 0 15px var(--color-chuanshuo-glow); }
  50%      { box-shadow: 0 0 30px var(--color-chuanshuo-glow), 0 0 60px rgba(232,168,48,0.2); }
}

/* 传说级火焰边角装饰 */
.grade-border-chuanshuo::before {
  content: '';
  position: absolute;
  top: -2px; left: -2px; right: -2px; bottom: -2px;
  border-radius: 10px;
  background: linear-gradient(45deg, #C43030, #E8A830, #C43030, #E8A830);
  background-size: 400% 400%;
  z-index: -1;
  animation: border-fire-dance 4s linear infinite;
  opacity: 0.6;
}

@keyframes border-fire-dance {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ---- 品级光晕粒子层（用于丹药周围） ---- */
.grade-glow {
  position: relative;
}

.grade-glow::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 120%; height: 120%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s;
}

.grade-glow:hover::after,
.grade-glow.active::after {
  opacity: 1;
}

.grade-glow-fan::after {
  background: radial-gradient(circle, var(--color-fan-glow) 0%, transparent 70%);
}
.grade-glow-liang::after {
  background: radial-gradient(circle, var(--color-liang-glow) 0%, transparent 70%);
}
.grade-glow-zhen::after {
  background: radial-gradient(circle, var(--color-zhen-glow) 0%, transparent 70%);
}
.grade-glow-jipin::after {
  background: radial-gradient(circle, var(--color-jipin-glow) 0%, transparent 70%);
}
.grade-glow-chuanshuo::after {
  background: radial-gradient(circle, var(--color-chuanshuo-glow) 0%, rgba(232,168,48,0.2) 50%, transparent 70%);
  animation: glow-chuanshuo-pulse 2s ease-in-out infinite;
}

@keyframes glow-chuanshuo-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
  50%      { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
}

/* ---- 品级文字标签（用在列表/卡片左上角） ---- */
.grade-label {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
}

.grade-label-fan {
  background: var(--color-fan);
  color: #6B5D45;
}
.grade-label-liang {
  background: var(--color-liang);
  color: #fff;
}
.grade-label-zhen {
  background: var(--color-zhen);
  color: #fff;
}
.grade-label-jipin {
  background: var(--color-jipin);
  color: #fff;
}
.grade-label-chuanshuo {
  background: linear-gradient(90deg, #C43030, #E8A830);
  color: #fff;
}

/* ---- 采药结果弹出品级动画 ---- */
@keyframes grade-reveal {
  0%   { transform: scale(0) rotate(-180deg); opacity: 0; }
  60%  { transform: scale(1.2) rotate(10deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.grade-reveal-fan    { animation: grade-reveal 0.4s ease-out; }
.grade-reveal-liang  { animation: grade-reveal 0.5s ease-out; }
.grade-reveal-zhen   { animation: grade-reveal 0.6s ease-out; }
.grade-reveal-jipin  { animation: grade-reveal 0.7s ease-out; }
.grade-reveal-chuanshuo { animation: grade-reveal 0.8s ease-out; }

/* ---- 残渣UI ---- */
.slag-piece {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #3D3A35;
  color: #B8A88A;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid #5A5548;
}

.slag-piece-icon {
  width: 18px;
  height: 18px;
  background: radial-gradient(circle, #6B5D45, #3D3A35);
  border-radius: 50%;
  border: 1px solid #8A7D65;
}

/* ---- 矿铲图标 ---- */
.mining-shovel {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: #2A2520;
  color: #D4C5A9;
  border-radius: 6px;
  font-size: 13px;
  border: 1px solid #6B5D45;
}

/* ============================================
   量子合成器 · 核心UI布局
   ============================================ */

#page-quantum { background: linear-gradient(180deg, #1A1A2E 0%, #16213E 50%, #0F3460 100%); color: #E8D5B7; }
#page-quantum .btn-back { color: #E8D5B7 !important; border-color: rgba(232,213,183,0.3) !important; }

.quantum-bg-anim {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at 30% 20%, rgba(232,168,48,0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 70% 80%, rgba(155,107,204,0.05) 0%, transparent 50%);
  pointer-events: none; z-index: 0;
}

.quantum-dashboard { position: relative; z-index: 1; }

/* 统计栏 */
.quantum-stats-bar {
  display: flex; gap: 8px; padding: 8px 12px; justify-content: center;
  background: rgba(255,255,255,0.04); border-bottom: 1px solid rgba(232,213,183,0.08);
}
.qstat-item {
  display: flex; align-items: center; gap: 4px; padding: 4px 12px;
  background: rgba(255,255,255,0.06); border-radius: 20px; cursor: pointer;
  transition: all .2s;
}
.qstat-item:active { transform: scale(.95); background: rgba(255,255,255,0.1); }
.qstat-icon { font-size: 16px; }
.qstat-val { font-size: 16px; font-weight: 700; color: #FFF8E1; min-width: 20px; text-align: center; }
.qstat-label { font-size: 11px; color: rgba(232,213,183,0.6); }

/* Tab切换 */
.quantum-tabs {
  display: flex; gap: 2px; padding: 8px 8px 0; overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.quantum-tab {
  flex: 1; min-width: 0; padding: 10px 4px; border: none; border-radius: 10px 10px 0 0;
  background: rgba(255,255,255,0.04); color: rgba(232,213,183,0.5);
  font-size: 12px; font-weight: 600; cursor: pointer; transition: all .3s;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  white-space: nowrap;
}
.quantum-tab .qt-icon { font-size: 16px; }
.quantum-tab.active { background: rgba(232,213,183,0.1); color: #E8D5B7; }
.quantum-tab:active { background: rgba(232,213,183,0.15); }

/* 面板 */
.quantum-panels { padding: 0 8px 8px; }
.quantum-panel { display: none; background: rgba(232,213,183,0.06); border-radius: 0 0 16px 16px; padding: 16px 12px; }
.quantum-panel.active { display: block; }

.panel-title { text-align: center; font-size: 18px; font-weight: 700; color: #FFF8E1; margin: 0 0 4px; }
.panel-subtitle { text-align: center; font-size: 12px; color: rgba(232,213,183,0.6); margin: 0 0 14px; }
.panel-hint { text-align: center; font-size: 11px; color: rgba(232,213,183,0.35); margin: 8px 0 0; }

/* 合成槽位 */
.quantum-slots {
  display: flex; align-items: center; justify-content: center; gap: 6px; margin: 12px 0;
}
.quantum-slot {
  width: 100px; height: 90px; border-radius: 14px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; cursor: pointer; transition: all .3s;
  position: relative;
}
.quantum-slot.empty { background: rgba(255,255,255,0.06); border: 2px dashed rgba(232,213,183,0.2); }
.quantum-slot.filled { background: rgba(255,255,255,0.1); border: 2px solid rgba(232,213,183,0.35); }
.quantum-slot:active { transform: scale(.95); }
.slot-placeholder { font-size: 12px; color: rgba(232,213,183,0.35); }
.slot-herb-img { width: 36px; height: 36px; object-fit: cover; border-radius: 50%; }
.slot-herb { font-size: 24px; }
.slot-herb-name { font-size: 12px; color: #FFF8E1; font-weight: 600; margin-top: 2px; }
.slot-tier { font-size: 10px; margin-top: 1px; }
.slot-plus { font-size: 20px; color: rgba(232,213,183,0.3); }

/* 状态提示 */
.quantum-status { text-align: center; font-size: 12px; margin: 8px 0; min-height: 18px; }
.status-ready { color: rgba(232,213,183,0.6); }
.status-warn { color: #FFB74D; }

/* 主按钮 */
.quantum-btn-primary {
  display: block; width: 80%; margin: 10px auto 0; padding: 14px; border: none;
  border-radius: 28px; background: linear-gradient(135deg, #D4A74A, #B8860B);
  color: #3E2723; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: all .2s; box-shadow: 0 4px 12px rgba(180,130,0,0.3);
}
.quantum-btn-primary:disabled { opacity: .35; box-shadow: none; cursor: not-allowed; }
.quantum-btn-primary:active:not(:disabled) { transform: scale(.96); }

/* 矿物选择区 */
.mineral-select-area { padding: 4px 0; min-height: 32px; }
.mineral-item { cursor: pointer; padding: 4px 10px; border-radius: 12px; border: 1px solid rgba(232,213,183,0.2); background: rgba(255,255,255,0.06); font-size: 13px; color: #E8D5B7; display: inline-block; margin: 2px; transition: all .2s; }
.mineral-item.active { border-color: #FF6F00; background: rgba(255,111,0,0.15); color: #FFB74D; }
.mineral-item:active { transform: scale(.95); }

/* 药材库存面板 */
.quantum-inv-panel {
  margin: 8px; border-radius: 14px; background: rgba(0,0,0,0.2);
  border: 1px solid rgba(232,213,183,0.08); overflow: hidden;
}
.inv-panel-title {
  padding: 10px 14px; font-size: 14px; font-weight: 600; color: #E8D5B7;
  cursor: pointer; user-select: none; display: flex; justify-content: space-between;
  background: rgba(232,213,183,0.04);
}
.inv-panel-title:active { background: rgba(232,213,183,0.08); }
.quantum-inv-grid { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px; }
.inv-item {
  display: flex; align-items: center; gap: 4px; padding: 4px 10px 4px 6px;
  border-radius: 20px; font-size: 12px; min-width: 0;
}
.inv-item img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.inv-item-name { font-size: 12px; font-weight: 500; }
.inv-item-tier { font-size: 10px; }
.inv-item-count { font-size: 10px; color: rgba(255,255,255,0.5); margin-left: auto; }

/* 证书墙 */
.cert-wall-grid { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; justify-content: center; }
.cert-card {
  width: 120px; padding: 12px 8px; border-radius: 12px; background: linear-gradient(135deg, rgba(232,213,183,0.08), rgba(255,255,255,0.04));
  border: 1px solid rgba(232,213,183,0.15); text-align: center; cursor: pointer;
  transition: all .2s;
}
.cert-card:active { transform: scale(.95); background: rgba(232,213,183,0.12); }
.cert-card-header { font-size: 11px; font-weight: 700; margin-bottom: 4px; color: #D4A74A; }
.cert-card-name { font-size: 14px; font-weight: 600; color: #FFF8E1; margin: 4px 0; }
.cert-card-id { font-size: 10px; color: rgba(232,213,183,0.4); }
.cert-card-date { font-size: 10px; color: rgba(232,213,183,0.3); }

/* 弹窗覆写 */
.quantum-result-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7); z-index: 3000; display: flex;
  align-items: center; justify-content: center; backdrop-filter: blur(4px);
}
.quantum-result-card {
  background: #1A1A2E; border-radius: 20px; padding: 20px; width: 88%; max-width: 380px;
  color: #E8D5B7; text-align: center; animation: pop-in .3s ease-out;
  border: 1px solid rgba(232,213,183,0.15);
}
.quantum-result-card .result-btn {
  display: inline-block; padding: 8px 20px; border-radius: 16px; border: 1px solid rgba(232,213,183,0.2);
  background: transparent; color: #E8D5B7; font-size: 13px; cursor: pointer;
  transition: all .2s;
}
.quantum-result-card .result-btn:active { background: rgba(232,213,183,0.1); }
.quantum-result-card .result-btn-primary { background: #D4A74A; color: #3E2723; border: none; }
.quantum-result-card .result-btn-primary:active { background: #B8860B; }
.quantum-result-card h3 { color: #FFF8E1; }

/* 药材选择 */
.herb-picker-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 8px; background: rgba(255,255,255,0.06); cursor: pointer; border: 1px solid rgba(232,213,183,0.1); transition: all .2s; }
.herb-picker-item:active { background: rgba(232,213,183,0.12); }
.herb-picker-item img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.herb-picker-item span { font-size: 14px; color: #E8D5B7; }
