/* ============================================================
   Needsofnature CN · 双模式主题（简约 / 液态玻璃）
   - 简约模式（默认）：style.css 原始 Catppuccin 设计，背景色可自定义
   - 液态玻璃：glass.css 收拢于 html[data-theme="glass"] 下生效，网格背景可替换
   ============================================================ */

/* ---------- 主题切换过渡 ---------- */
body, .card, .nav, .btn, .tag-chip, .empty, .msg-bubble, .convo-item, .stat-card, .tl-item, .profile-cover {
  transition: background-color .35s ease, background .35s ease, border-color .35s ease, color .35s ease;
}

/* ---------- 简约模式：背景色可自定义 ---------- */
html[data-theme="simple"] body {
  background-color: var(--user-bg, #11111b);
  background-image: none;
}

/* 简约模式下隐藏玻璃专属装饰元素（兜底，防止 JS 未清理） */
html[data-theme="simple"] .spec,
html[data-theme="simple"] .sheen,
html[data-theme="simple"] .nav-ind {
  display: none !important;
}
html[data-theme="simple"] .glass[data-lg],
html[data-theme="simple"] [data-lg] {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* ---------- 液态玻璃：自定义背景（替换网格） ----------
   JS 设置 --glass-bg-image / --glass-bg-size 覆盖默认网格 */
html[data-theme="glass"] body::after {
  background-image: var(--glass-bg-image,
    linear-gradient(rgba(255, 255, 255, 0.115) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.115) 1px, transparent 1px));
  background-size: var(--glass-bg-size, 32px 32px, 32px 32px);
  background-repeat: var(--glass-bg-repeat, repeat);
}

/* 自定义背景为图片时去掉径向遮罩，让图片完整呈现 */
html[data-theme="glass"] body.has-custom-bg::after {
  mask-image: none;
  -webkit-mask-image: none;
}

/* ---------- 简约模式细节打磨 ---------- */
html[data-theme="simple"] .card { backdrop-filter: none; }
html[data-theme="simple"] .nav { backdrop-filter: none; background: var(--bg-soft); }

/* ---------- 主题设置 UI（个人中心-设置 Tab） ---------- */
.theme-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0 18px; }
.theme-option {
  position: relative; border: 2px solid var(--border); border-radius: 14px;
  padding: 16px 14px; cursor: pointer; background: var(--bg-soft);
  transition: border-color .2s, transform .15s;
}
.theme-option:hover { transform: translateY(-2px); border-color: var(--border-soft); }
.theme-option.active { border-color: var(--accent); }
.theme-option .to-name { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.theme-option .to-desc { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.theme-option .to-check {
  position: absolute; top: 10px; right: 10px; width: 20px; height: 20px;
  border-radius: 50%; border: 2px solid var(--border-soft);
}
.theme-option.active .to-check { border-color: var(--accent); background: var(--accent); }
.theme-option .to-preview { height: 44px; border-radius: 10px; margin-bottom: 10px; border: 1px solid var(--border); }
.to-preview.simple { background: #11111b; }
.to-preview.glass {
  background:
    radial-gradient(38% 30% at 18% 12%, rgba(142, 241, 255, 0.20), transparent 70%),
    radial-gradient(34% 28% at 84% 22%, rgba(201, 166, 255, 0.18), transparent 70%),
    #0b0b14;
}

.bg-editor { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-top: 10px; background: var(--bg-soft); }
.bg-editor h4 { margin: 0 0 10px; font-size: 13.5px; color: var(--muted); }
.bg-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.bg-row:last-child { margin-bottom: 0; }
.bg-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.bg-swatch {
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer;
  border: 2px solid var(--border); transition: transform .15s;
}
.bg-swatch:hover { transform: scale(1.12); }
.bg-swatch.active { border-color: var(--accent); }
.bg-swatch input[type="color"] { position: absolute; opacity: 0; width: 0; height: 0; }
.bg-preview-strip { height: 40px; border-radius: 9px; border: 1px solid var(--border); flex: 1; min-width: 120px; }

/* ---------- 引导页（onboarding） ---------- */
.ob-page {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; overflow-y: auto;
  background: var(--bg);
}
.ob-hidden { display: none !important; }
.ob-card {
  width: min(680px, 100%); text-align: center;
  animation: obIn .7s cubic-bezier(.2, .9, .25, 1) both;
}
@keyframes obIn {
  from { opacity: 0; transform: translateY(34px) scale(.96); filter: blur(6px); }
  to   { opacity: 1; transform: none; filter: none; }
}
.ob-logo {
  font-size: clamp(34px, 7vw, 58px); font-weight: 800; letter-spacing: -0.02em;
  background: linear-gradient(100deg, var(--accent), var(--accent-2) 55%, var(--accent-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 6px;
}
.ob-sub { color: var(--muted); font-size: clamp(14px, 2.4vw, 17px); margin-bottom: 30px; }
.ob-chips { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 34px; }
.ob-chip {
  border: 1px solid var(--border); border-radius: 999px; padding: 7px 16px;
  font-size: 13px; color: var(--muted); background: var(--card);
  animation: obChip .6s both;
}
.ob-chip:nth-child(2) { animation-delay: .12s; }
.ob-chip:nth-child(3) { animation-delay: .24s; }
.ob-chip:nth-child(4) { animation-delay: .36s; }
@keyframes obChip { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.ob-orb {
  width: 120px; height: 120px; border-radius: 50%; margin: 0 auto 26px;
  background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--accent-3), var(--accent));
  filter: blur(2px); opacity: .85;
  animation: obSpin 9s linear infinite;
  box-shadow: 0 0 80px rgba(137, 180, 250, .35);
}
@keyframes obSpin { to { transform: rotate(360deg); } }
.ob-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.ob-steps { display: flex; gap: 8px; justify-content: center; margin-bottom: 26px; }
.ob-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-soft); transition: all .3s; }
.ob-dot.active { background: var(--accent); width: 26px; border-radius: 4px; }

/* 模式轮盘 */
.ob-wheel { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-bottom: 28px; }
.ob-mode {
  width: 230px; border: 2px solid var(--border); border-radius: 20px; padding: 18px;
  cursor: pointer; background: var(--card); text-align: left;
  transition: transform .25s cubic-bezier(.2, .9, .3, 1.4), border-color .25s, box-shadow .25s;
}
.ob-mode:hover { transform: translateY(-6px) scale(1.03); }
.ob-mode.active { border-color: var(--accent); box-shadow: 0 12px 44px rgba(137, 180, 250, .25); transform: translateY(-6px) scale(1.04); }
.ob-mode .om-preview { height: 86px; border-radius: 12px; margin-bottom: 12px; border: 1px solid var(--border); position: relative; overflow: hidden; }
.ob-mode .om-name { font-weight: 700; font-size: 16px; }
.ob-mode .om-desc { font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.55; }
.ob-mode .om-tag {
  position: absolute; top: 8px; right: 8px; font-size: 10.5px; padding: 3px 9px;
  border-radius: 999px; background: var(--accent); color: #0b0b14; font-weight: 700;
  opacity: 0; transform: translateY(-4px); transition: all .25s;
}
.ob-mode.active .om-tag { opacity: 1; transform: none; }

/* 标签选择 */
.ob-tags { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; max-width: 640px; margin: 0 auto 26px; max-height: 46vh; overflow-y: auto; padding: 4px; }
.ob-tag {
  border: 1px solid var(--border); border-radius: 999px; padding: 7px 15px;
  font-size: 13px; color: var(--muted); cursor: pointer; background: var(--card);
  transition: all .18s; user-select: none;
}
.ob-tag:hover { border-color: var(--border-soft); color: var(--text); }
.ob-tag.on { background: var(--accent); border-color: var(--accent); color: #0b0b14; font-weight: 600; }

@media (max-width: 640px) {
  .theme-picker { grid-template-columns: 1fr; }
  .ob-mode { width: 100%; max-width: 320px; }
}
