/* ============================================================
   落秋阁 V14.2 — 8色主题 + 8字体系统
   ============================================================ */

/* ===== 默认主题：暖色（和当前一致，无需额外CSS变量） ===== */

/* 主题1：暖色 (warm) — 默认 */
[data-theme="warm"] {
  --t-bg: linear-gradient(160deg,#fdfcf9,#f7f4ee 46%,#faf8f3);
  --t-body-bg: radial-gradient(1200px 620px at 16% -8%,rgba(214,182,106,.06),transparent 60%),radial-gradient(1000px 540px at 94% -4%,rgba(180,150,100,.04),transparent 58%),linear-gradient(160deg,#fdfcf9,#f7f4ee 46%,#faf8f3);
  --t-text: #3a2e1a;
  --t-text-muted: #7a6a4a;
  --t-card-bg: linear-gradient(135deg,rgba(255,255,255,.72),rgba(250,245,235,.68));
  --t-card-border: rgba(236,208,137,.25);
  --t-gold: #c9a227;
}

/* 主题2：蓝色 (blue) */
[data-theme="blue"] {
  --t-bg: linear-gradient(160deg,#f0f4fa,#e8eef6 46%,#f5f7fb);
  --t-body-bg: radial-gradient(1200px 620px at 16% -8%,rgba(100,149,237,.06),transparent 60%),linear-gradient(160deg,#f0f4fa,#e8eef6 46%,#f5f7fb);
  --t-text: #1a2a3a;
  --t-text-muted: #4a6a8a;
  --t-card-bg: linear-gradient(135deg,rgba(255,255,255,.72),rgba(235,240,248,.68));
  --t-card-border: rgba(100,149,237,.25);
  --t-gold: #4a80d4;
}

/* 主题3：黑金 (dark-gold) */
[data-theme="dark-gold"] {
  --t-bg: linear-gradient(160deg,#0a0a0a,#111 46%,#0d0d0d);
  --t-body-bg: radial-gradient(1200px 620px at 16% -8%,rgba(214,182,106,.04),transparent 60%),linear-gradient(160deg,#0a0a0a,#111 46%,#0d0d0d);
  --t-text: #d6c090;
  --t-text-muted: #8a7850;
  --t-card-bg: linear-gradient(135deg,rgba(30,28,22,.88),rgba(24,22,18,.8));
  --t-card-border: rgba(184,148,47,.3);
  --t-gold: #c9a227;
}

/* 主题4：暗夜 (dark) */
[data-theme="dark"] {
  --t-bg: linear-gradient(160deg,#10151a,#151a22 46%,#10151a);
  --t-body-bg: radial-gradient(1200px 620px at 16% -8%,rgba(80,120,200,.04),transparent 60%),linear-gradient(160deg,#10151a,#151a22 46%,#10151a);
  --t-text: #c8d6e5;
  --t-text-muted: #7a8ea8;
  --t-card-bg: linear-gradient(135deg,rgba(26,32,40,.88),rgba(20,26,34,.8));
  --t-card-border: rgba(100,150,200,.25);
  --t-gold: #6ea8fe;
}

/* 主题5：翡翠 (emerald) */
[data-theme="emerald"] {
  --t-bg: linear-gradient(160deg,#f2faf6,#ecf7f0 46%,#f5faf7);
  --t-body-bg: radial-gradient(1200px 620px at 16% -8%,rgba(80,180,120,.06),transparent 60%),linear-gradient(160deg,#f2faf6,#ecf7f0 46%,#f5faf7);
  --t-text: #1a2a20;
  --t-text-muted: #4a6a50;
  --t-card-bg: linear-gradient(135deg,rgba(255,255,255,.72),rgba(238,248,240,.68));
  --t-card-border: rgba(80,180,120,.25);
  --t-gold: #3a9060;
}

/* 主题6：紫韵 (purple) */
[data-theme="purple"] {
  --t-bg: linear-gradient(160deg,#f8f6fa,#f2eef6 46%,#faf8fc);
  --t-body-bg: radial-gradient(1200px 620px at 16% -8%,rgba(140,100,200,.06),transparent 60%),linear-gradient(160deg,#f8f6fa,#f2eef6 46%,#faf8fc);
  --t-text: #2a1a3a;
  --t-text-muted: #5a3a6a;
  --t-card-bg: linear-gradient(135deg,rgba(255,255,255,.72),rgba(242,238,248,.68));
  --t-card-border: rgba(160,120,220,.25);
  --t-gold: #8b5cf6;
}

/* 主题7：极简白 (minimal-white) */
[data-theme="minimal-white"] {
  --t-bg: linear-gradient(160deg,#ffffff,#fcfcfc 46%,#f8f8f8);
  --t-body-bg: linear-gradient(160deg,#ffffff,#fcfcfc 46%,#f8f8f8);
  --t-text: #1a1a1a;
  --t-text-muted: #6a6a6a;
  --t-card-bg: rgba(255,255,255,.92);
  --t-card-border: rgba(0,0,0,.08);
  --t-gold: #333;
}

/* 主题8：墨绿 (forest) */
[data-theme="forest"] {
  --t-bg: linear-gradient(160deg,#0d1410,#101a15 46%,#0d1410);
  --t-body-bg: radial-gradient(1200px 620px at 16% -8%,rgba(60,180,100,.04),transparent 60%),linear-gradient(160deg,#0d1410,#101a15 46%,#0d1410);
  --t-text: #c0d8c8;
  --t-text-muted: #609070;
  --t-card-bg: linear-gradient(135deg,rgba(20,32,26,.88),rgba(16,28,22,.8));
  --t-card-border: rgba(60,160,90,.25);
  --t-gold: #50b870;
}

/* ===== 字体主题 ===== */
[data-font="stxingkai"]  { --t-font-title: 'STXingkai','KaiTi',serif; --t-font-body: 'Microsoft YaHei',sans-serif; }
[data-font="yahei"]      { --t-font-title: 'Microsoft YaHei',sans-serif; --t-font-body: 'Microsoft YaHei',sans-serif; }
[data-font="songti"]     { --t-font-title: 'SimSun','宋体',serif; --t-font-body: 'Microsoft YaHei',sans-serif; }
[data-font="kaiti"]      { --t-font-title: 'KaiTi','楷体',serif; --t-font-body: 'KaiTi','楷体',serif; }
[data-font="dengxian"]   { --t-font-title: 'DengXian','等线',sans-serif; --t-font-body: 'DengXian','等线',sans-serif; }
[data-font="wenkai"]     { --t-font-title: 'LXGW WenKai','霞鹜文楷',serif; --t-font-body: 'Microsoft YaHei',sans-serif; }
[data-font="siyuan"]     { --t-font-title: 'Source Han Sans CN','思源黑体',sans-serif; --t-font-body: 'Source Han Sans CN','思源黑体',sans-serif; }
[data-font="system"]     { --t-font-title: system-ui,-apple-system,sans-serif; --t-font-body: system-ui,-apple-system,sans-serif; }

/* ===== 应用主题变量到全站 ===== */

/* 背景和文字 */
body {
  background: var(--t-body-bg, linear-gradient(160deg,#fdfcf9,#f7f4ee 46%,#faf8f3));
}

/* 卡片样式 */
.card, .auth-card, .modal-card, .welcome-strip,
.account-card, .tool-card, .zone-card, .func-card {
  background: var(--t-card-bg, linear-gradient(135deg,rgba(255,255,255,.72),rgba(250,245,235,.68)));
  border-color: var(--t-card-border, rgba(236,208,137,.25));
}

/* 文字颜色 */
body, .page, .main-station {
  color: var(--t-text, #3a2e1a);
}
.muted { color: var(--t-text-muted, #7a6a4a); }

/* 金色元素（按钮/高亮）用主题金色 */
.gold-btn {
  background: linear-gradient(135deg, var(--t-gold, #c9a227), color-mix(in srgb, var(--t-gold, #c9a227) 70%, #000)) !important;
}
.official-seal {
  border-color: var(--t-gold, #c9a227);
  color: var(--t-gold, #c9a227);
}

/* ===== 主题切换按钮 ===== */
.theme-toggle-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(255,255,255,.85), rgba(248,240,230,.75));
  backdrop-filter: blur(16px);
  border: 1px solid rgba(184,148,47,.25);
  color: #c9a227;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 999;
  box-shadow: 0 4px 20px rgba(80,50,10,.1);
  transition: transform .25s cubic-bezier(.16,1,.3,1);
}
.theme-toggle-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 28px rgba(184,148,47,.18);
}

/* ===== 主题面板 ===== */
.theme-panel {
  position: fixed;
  bottom: 90px;
  right: 28px;
  width: 320px;
  max-height: 500px;
  overflow-y: auto;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(24px);
  border-radius: 18px;
  border: 1px solid rgba(184,148,47,.2);
  box-shadow: 0 12px 48px rgba(80,50,10,.12);
  z-index: 999;
  padding: 20px;
  font-size: 13px;
}
.theme-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.theme-panel-head h4 { margin: 0; font-size: 15px; color: #3a2e1a; }
.theme-panel-head .close-x {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #8a754e;
  padding: 0 4px;
}
.theme-section { margin-bottom: 14px; }
.theme-section h5 { margin: 0 0 8px; font-size: 13px; color: #5a4a2a; }
.theme-swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.theme-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform .2s, border-color .2s;
  position: relative;
  overflow: hidden;
}
.theme-swatch:hover { transform: scale(1.08); }
.theme-swatch.active { border-color: #333; }
.theme-swatch.active::after {
  content: "✓";
  position: absolute;
  bottom: 2px; right: 4px;
  font-size: 11px;
  font-weight: bold;
  color: #fff;
  text-shadow: 0 0 3px rgba(0,0,0,.5);
}
.font-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.font-option {
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .2s, border-color .2s;
  font-size: 13px;
  color: #3a2e1a;
}
.font-option:hover { background: rgba(184,148,47,.08); }
.font-option.active {
  background: linear-gradient(135deg, rgba(184,148,47,.15), rgba(156,113,48,.08));
  border-color: rgba(184,148,47,.25);
  font-weight: 700;
}

@media (max-width: 600px) {
  .theme-panel { width: 280px; right: 10px; }
  .theme-toggle-btn { right: 10px; bottom: 20px; }
}

/* ===== 自定义微调面板 ===== */
.custom-colors { border-top: 1px solid rgba(184,148,47,.15); padding-top: 14px; }
.custom-row {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
  font-size: 12px;
}
.custom-row label { min-width: 60px; color: #5a4a2a; font-weight: 600; }
.custom-row input[type="color"] {
  width: 36px; height: 28px; border: 1px solid rgba(184,148,47,.2);
  border-radius: 6px; cursor: pointer; padding: 0; background: none;
}
.custom-row input[type="range"] {
  flex: 1; accent-color: #c9a227; height: 4px;
}
.custom-row span { min-width: 20px; text-align: right; color: #8a754e; font-size: 11px; }

/* ===== 自定义CSS变量应用到全站 ===== */
:root {
  --cust-glow: 10px;
  --cust-blur: 24px;
}
/* 背景覆写（仅有自定义时才生效） */
body.cust-active {
  background: var(--cust-bg, #fdfcf9) !important;
}
/* 卡片玻璃覆写 */
.card, .welcome-strip, .account-card, .tool-card, .zone-card, .zone-3d .z3d-inner, .feat-card {
  backdrop-filter: blur(var(--cust-blur, 24px)) saturate(1.15);
  -webkit-backdrop-filter: blur(var(--cust-blur, 24px)) saturate(1.15);
}
/* 发光应用到卡片hover */
.card:hover, .zone-3d.enabled:hover .z3d-inner, .feat-card:hover, .account-card:hover {
  box-shadow: 0 8px calc(var(--cust-glow, 10px) * 3) rgba(184,148,47,.18);
}
/* 强调色应用到金色按钮 */
.gold-btn {
  background: linear-gradient(135deg, var(--cust-accent, #c9a227), color-mix(in srgb, var(--cust-accent, #c9a227) 60%, #000)) !important;
}
