/* ============================================================
   诡秘之主 · 序列途径大全 — 共享主题系统
   通过 <html data-theme="..."> 切换配色。所有页面共用本文件。
   主题：parchment(羊皮卷/默认) / mystic(秘典夜曲) / abyss(深渊墨绿)
        crimson(绯红之月) / aurora(极光冰川)
   ============================================================ */

/* ---------- 主题变量 ---------- */
[data-theme="mystic"] {
  color-scheme: dark;
  --bg: #080d1a;
  --bg-grad:
    radial-gradient(1100px 620px at 12% -8%, rgba(79, 172, 254, .16), transparent 60%),
    radial-gradient(900px 520px at 100% 0%, rgba(100, 255, 218, .10), transparent 55%),
    radial-gradient(700px 500px at 50% 110%, rgba(120, 90, 220, .12), transparent 60%),
    linear-gradient(160deg, #080d1a, #0d1426 55%, #090f1e);
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .075);
  --glass: rgba(13, 20, 38, .68);
  --text: #e9eefc;
  --text-2: #a8b4cf;
  --text-3: #71809e;
  --accent: #64ffda;
  --accent-2: #4facfe;
  --accent-ink: #04131a;
  --accent-glow: rgba(79, 172, 254, .38);
  --border: rgba(150, 182, 255, .16);
  --line: rgba(150, 182, 255, .10);
  --ok: #3fd6a0;
  --warn: #f3b64b;
  --danger: #ff6f80;
  --shadow: rgba(0, 0, 0, .5);
  --radius: 16px;
}

:root,
[data-theme="parchment"] {
  color-scheme: light;
  --bg: #f3ecdc;
  --bg-grad:
    radial-gradient(1000px 520px at 8% -10%, rgba(214, 178, 106, .24), transparent 60%),
    radial-gradient(800px 460px at 100% 0%, rgba(198, 152, 84, .14), transparent 55%),
    linear-gradient(160deg, #fbf7ed, #f1e8d5 60%, #ece0c8);
  --surface: rgba(255, 255, 255, .66);
  --surface-2: #fffdf8;
  --glass: rgba(255, 252, 244, .86);
  --text: #3b3226;
  --text-2: #6d604c;
  --text-3: #9c8d75;
  --accent: #a9762f;
  --accent-2: #cf9a41;
  --accent-ink: #fffaf0;
  --accent-glow: rgba(169, 118, 47, .28);
  --border: rgba(120, 94, 54, .22);
  --line: rgba(120, 94, 54, .13);
  --ok: #3d8b62;
  --warn: #b5751a;
  --danger: #be4a42;
  --shadow: rgba(88, 68, 38, .18);
  --radius: 16px;
}

[data-theme="abyss"] {
  color-scheme: dark;
  --bg: #05120f;
  --bg-grad:
    radial-gradient(1000px 560px at 10% -8%, rgba(52, 211, 153, .16), transparent 60%),
    radial-gradient(820px 480px at 100% 0%, rgba(20, 184, 166, .12), transparent 55%),
    linear-gradient(160deg, #05120f, #08221c 55%, #061a16);
  --surface: rgba(255, 255, 255, .04);
  --surface-2: rgba(255, 255, 255, .07);
  --glass: rgba(6, 26, 22, .7);
  --text: #e6f5ef;
  --text-2: #9fc4b7;
  --text-3: #688d80;
  --accent: #6ee7b7;
  --accent-2: #34d3b0;
  --accent-ink: #04231a;
  --accent-glow: rgba(52, 211, 153, .34);
  --border: rgba(110, 231, 183, .18);
  --line: rgba(110, 231, 183, .10);
  --ok: #4ade9f;
  --warn: #e7c45b;
  --danger: #ff7d78;
  --shadow: rgba(0, 0, 0, .5);
  --radius: 16px;
}

[data-theme="crimson"] {
  color-scheme: dark;
  --bg: #13070c;
  --bg-grad:
    radial-gradient(1000px 560px at 12% -8%, rgba(233, 73, 108, .18), transparent 60%),
    radial-gradient(820px 480px at 100% 0%, rgba(180, 60, 130, .14), transparent 55%),
    linear-gradient(160deg, #13070c, #230e18 55%, #160810);
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .075);
  --glass: rgba(32, 12, 20, .7);
  --text: #fbeaf0;
  --text-2: #d3a8b8;
  --text-3: #9a7082;
  --accent: #ff8fa3;
  --accent-2: #e0526b;
  --accent-ink: #2a0710;
  --accent-glow: rgba(224, 82, 107, .38);
  --border: rgba(255, 143, 163, .2);
  --line: rgba(255, 143, 163, .11);
  --ok: #5fd0a0;
  --warn: #f0bc63;
  --danger: #ff6b7d;
  --shadow: rgba(0, 0, 0, .5);
  --radius: 16px;
}

[data-theme="aurora"] {
  color-scheme: light;
  --bg: #edf2f8;
  --bg-grad:
    radial-gradient(1000px 540px at 10% -10%, rgba(56, 189, 248, .20), transparent 60%),
    radial-gradient(840px 480px at 100% 0%, rgba(129, 140, 248, .16), transparent 55%),
    linear-gradient(160deg, #f7fafd, #e9f0f8 60%, #e3ebf5);
  --surface: rgba(255, 255, 255, .74);
  --surface-2: #ffffff;
  --glass: rgba(255, 255, 255, .86);
  --text: #1e2a3a;
  --text-2: #52637a;
  --text-3: #8593a8;
  --accent: #2276c4;
  --accent-2: #38a7dc;
  --accent-ink: #ffffff;
  --accent-glow: rgba(47, 127, 209, .26);
  --border: rgba(70, 110, 160, .2);
  --line: rgba(70, 110, 160, .12);
  --ok: #2f9e73;
  --warn: #c8861f;
  --danger: #d0505f;
  --shadow: rgba(40, 70, 110, .16);
  --radius: 16px;
}

/* ---------- 基础重置 ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg-grad) fixed;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background-color .35s ease, color .35s ease;
}
a { color: var(--accent); text-decoration: none; }
img { max-width: 100%; }
::selection { background: var(--accent-glow); color: var(--text); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-glow); }

/* ---------- 通用工具类 ---------- */
.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--text-2); }
.dim { color: var(--text-3); }
.accent { color: var(--accent); }
.text-center { text-align: center; }
.hidden { display: none !important; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grid { display: grid; gap: 18px; }

/* ---------- 卡片 / 玻璃面板 ---------- */
.card,
.glass {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 12px 36px var(--shadow);
}
.card { padding: 24px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600;
  cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 22px var(--accent-glow); }
.btn:active { transform: translateY(0); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  color: var(--accent-ink); border-color: transparent;
}
.btn.primary:hover { box-shadow: 0 10px 28px var(--accent-glow); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger); color: var(--bg); }
.btn.ok { color: var(--ok); border-color: var(--ok); }
.btn.warn { color: var(--warn); border-color: var(--warn); }
.btn.sm { padding: 7px 13px; font-size: .86rem; border-radius: 10px; }
.btn.block { width: 100%; }
.btn.icon { width: 42px; height: 42px; padding: 0; border-radius: 12px; font-size: 1.1rem; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field label { font-size: .88rem; color: var(--text-2); font-weight: 600; }
.field input,
.field textarea,
.field select,
.input {
  width: 100%; padding: 12px 14px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font: inherit; outline: none; transition: border-color .18s, box-shadow .18s;
}
.field input:focus,
.field textarea:focus,
.field select:focus,
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.field textarea { resize: vertical; min-height: 84px; }
.field select option { background: var(--bg); color: var(--text); }

/* ---------- 徽章 / 标签 ---------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .76rem; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
}
.badge.ok { color: var(--ok); border-color: var(--ok); }
.badge.warn { color: var(--warn); border-color: var(--warn); }
.badge.danger { color: var(--danger); border-color: var(--danger); }
.badge.accent { color: var(--accent); border-color: var(--accent); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
th { color: var(--accent); font-weight: 700; background: var(--surface); position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface); }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  padding: 14px 24px; background: var(--glass);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.12rem; letter-spacing: .5px; }
.brand .mark {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: var(--accent-ink); font-size: 1.15rem;
}
.topnav { display: flex; gap: 6px; flex-wrap: wrap; }
.topnav a, .topnav button {
  padding: 8px 15px; border-radius: 999px; color: var(--text-2); background: transparent;
  border: 1px solid transparent; cursor: pointer; font: inherit; font-size: .92rem; transition: all .18s;
}
.topnav a:hover, .topnav button:hover, .topnav .active { color: var(--accent); background: var(--surface); border-color: var(--border); }

/* ---------- 用户菜单 ---------- */
.user-menu { position: relative; }
.user-menu > button {
  display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); cursor: pointer; font: inherit;
}
.avatar {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: var(--accent-ink); font-weight: 800;
}
.dropdown {
  display: none; position: absolute; right: 0; top: calc(100% + 8px); min-width: 168px;
  background: var(--glass); border: 1px solid var(--border); border-radius: 13px; padding: 8px;
  box-shadow: 0 16px 40px var(--shadow); backdrop-filter: blur(20px); z-index: 60;
}
.dropdown.show { display: block; animation: pop .18s ease; }
.dropdown a, .dropdown button {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 12px; border-radius: 9px;
  color: var(--text); background: transparent; border: none; cursor: pointer; font: inherit; text-align: left;
}
.dropdown a:hover, .dropdown button:hover { background: var(--surface-2); color: var(--accent); }
.dropdown .sep { height: 1px; background: var(--line); margin: 6px 0; }

/* ---------- 主题切换器 ---------- */
.theme-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 80;
  width: 50px; height: 50px; border-radius: 16px; border: 1px solid var(--border);
  background: var(--glass); color: var(--accent); font-size: 1.35rem; cursor: pointer;
  backdrop-filter: blur(16px); box-shadow: 0 10px 28px var(--shadow);
  display: grid; place-items: center; transition: transform .2s ease, box-shadow .2s ease;
}
.theme-fab:hover { transform: translateY(-3px) rotate(-12deg); box-shadow: 0 14px 34px var(--accent-glow); }
.theme-pop {
  display: none; position: fixed; right: 22px; bottom: 84px; z-index: 80;
  width: 268px; padding: 16px; border-radius: 18px;
  background: var(--glass); border: 1px solid var(--border);
  box-shadow: 0 18px 48px var(--shadow); backdrop-filter: blur(22px);
}
.theme-pop.show { display: block; animation: pop .2s ease; }
.theme-pop h4 { font-size: .9rem; color: var(--text-2); margin-bottom: 12px; letter-spacing: .5px; }
.theme-options { display: grid; gap: 8px; }
.theme-option {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; font: inherit; text-align: left; transition: all .16s;
}
.theme-option:hover { border-color: var(--accent); transform: translateX(3px); }
.theme-option.active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.theme-option .swatch {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  border: 1px solid rgba(128, 128, 128, .3);
}
.theme-option .swatch.dots { border: 1px dashed rgba(128,128,128,.5); }
.theme-option .meta { display: flex; flex-direction: column; line-height: 1.3; }
.theme-option .meta b { font-size: .92rem; }
.theme-option .meta small { color: var(--text-3); font-size: .74rem; }
.theme-option .check { margin-left: auto; color: var(--accent); font-weight: 800; }

/* 各主题色板（用于切换器预览） */
.sw-mystic { background: linear-gradient(135deg, #0d1426 45%, #4facfe 75%, #64ffda); }
.sw-parchment { background: linear-gradient(135deg, #f3ecdc 45%, #cf9a41 78%, #a9762f); }
.sw-abyss { background: linear-gradient(135deg, #08221c 45%, #34d3b0 78%, #6ee7b7); }
.sw-crimson { background: linear-gradient(135deg, #230e18 45%, #e0526b 78%, #ff8fa3); }
.sw-aurora { background: linear-gradient(135deg, #e9f0f8 45%, #38a7dc 78%, #2276c4); }

/* ---------- 提示 toast ---------- */
.toast {
  position: fixed; top: 22px; left: 50%; transform: translate(-50%, -20px); z-index: 120;
  padding: 13px 26px; border-radius: 999px; background: var(--glass);
  border: 1px solid var(--accent); color: var(--text); font-weight: 600;
  box-shadow: 0 12px 32px var(--shadow); backdrop-filter: blur(16px);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 回到顶部 ---------- */
.to-top {
  position: fixed; right: 22px; bottom: 84px; z-index: 70;
  width: 44px; height: 44px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--glass); color: var(--accent); font-size: 1.2rem; cursor: pointer;
  display: grid; place-items: center; backdrop-filter: blur(14px); box-shadow: 0 8px 24px var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .2s;
}
.to-top.show { opacity: 1; pointer-events: auto; }
.to-top:hover { transform: translateY(-3px); }

/* ---------- 动画 ---------- */
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.fade-up { animation: fade-up .5s ease both; }

/* ---------- 响应式 ---------- */
@media (max-width: 720px) {
  .container { padding: 0 16px; }
  .topbar { padding: 12px 16px; gap: 10px; }
  .topnav { display: none; }
  .theme-pop { right: 12px; width: calc(100vw - 24px); }
}
