/* Lord of Mysteries Wiki — 样式
 * 纯 CSS，GitHub Pages 直接加载。暗金玄学主题 + 明亮主题切换。 */

:root {
  --bg: #1c1a14;
  --bg-2: #24211a;
  --panel: rgba(48, 44, 33, 0.96);
  --panel-2: rgba(40, 37, 29, 0.98);
  --line: rgba(212, 175, 55, 0.30);
  --line-solid: #4d4635;
  --text: #fbf9f4;
  --muted: #d3c9b7;
  --gold: #d4af37;
  --gold-soft: rgba(212, 175, 55, 0.14);
  --violet: #8b5cf6;
  --green: #74b86f;
  --red: #cc5b4d;
  --cyan: #6bcad0;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.45);
  --radius: 12px;
  --maxw: 1200px;
}

html[data-theme="light"] {
  --bg: #f4efe4;
  --bg-2: #eae2d1;
  --panel: rgba(255, 253, 248, 0.94);
  --panel-2: rgba(250, 246, 237, 0.96);
  --line: rgba(139, 106, 20, 0.22);
  --line-solid: #d8cba8;
  --text: #241f16;
  --muted: #6a6152;
  --gold: #a9820f;
  --gold-soft: rgba(169, 130, 15, 0.12);
  --shadow: 0 16px 44px rgba(120, 100, 50, 0.18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 78px; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  font-family: "Inter", "Noto Sans SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  line-height: 1.65;
  background:
    radial-gradient(1200px 700px at 78% -8%, rgba(139, 92, 246, 0.20), transparent 60%),
    radial-gradient(900px 620px at 12% 4%, rgba(212, 175, 55, 0.16), transparent 60%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
  background-attachment: fixed;
  transition: color .3s, background .3s;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }

#fog-canvas {
  position: fixed; inset: 0; z-index: 0;
  width: 100%; height: 100%;
  pointer-events: none; opacity: .35;
}

main { position: relative; z-index: 1; width: min(var(--maxw), calc(100% - 36px)); margin: 0 auto; }

/* ── Topbar ── */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px;
  padding: 12px clamp(16px, 4vw, 48px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { width: 88px; height: 30px; object-fit: contain; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }
.brand-text strong { display: block; font-size: 15px; letter-spacing: .02em; }
.brand-text small { display: block; color: var(--muted); font-size: 11.5px; }
.topnav { display: flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.topnav a {
  padding: 7px 11px; color: var(--muted); font-size: 14px; border-radius: 8px;
  transition: .2s;
}
.topnav a:hover { color: var(--text); background: var(--gold-soft); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.nav-burger { display: none; font-size: 19px; }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid var(--line-solid); border-radius: 9px;
  background: var(--panel); color: var(--gold); cursor: pointer;
  font-size: 17px; transition: .2s;
}
.icon-btn:hover { border-color: var(--gold); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(0,0,0,.3); }

/* ── Hero ── */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(290px, .5fr);
  gap: 30px; padding: clamp(48px, 8vw, 92px) 0 30px;
}
.hero-copy { min-width: 0; }
.eyebrow { margin: 0 0 12px; color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; line-height: 1.14; }
.glow-title {
  font-size: clamp(40px, 8vw, 92px); font-weight: 900; letter-spacing: -.01em;
  color: #fdfbf5;
  text-shadow: 0 0 40px rgba(212, 175, 55, 0.30);
}
.glow-title .accent {
  color: var(--gold); /* fallback 纯亮金 */
  background: linear-gradient(120deg, #f0cf5c, var(--violet));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
@supports not ((-webkit-background-clip: text) or (background-clip: text)) {
  .glow-title .accent { color: var(--gold); -webkit-text-fill-color: var(--gold); }
}
.lead { max-width: 640px; margin: 22px 0 0; color: var(--muted); font-size: 17px; }
.lead b { color: var(--text); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px; font-weight: 700; font-size: 15px;
  border: 1px solid var(--line-solid); border-radius: 10px;
  background: var(--panel); color: var(--text); cursor: pointer; transition: .2s;
}
.button:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.32); }
.button.primary { border-color: var(--gold); background: linear-gradient(120deg, var(--gold), #e6c65a); color: #17130a; }
.button.ghost { background: transparent; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 26px; }

.hero-panel {
  position: relative; align-self: start; overflow: hidden;
  padding: 24px; border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), var(--panel-2)); box-shadow: var(--shadow);
}
.panel-glow {
  position: absolute; top: -40%; right: -30%; width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(139,92,246,.35), transparent 70%);
  filter: blur(8px); animation: float 9s ease-in-out infinite;
}
@keyframes float { 0%,100%{ transform: translateY(0) } 50%{ transform: translateY(18px) } }
.panel-title { position: relative; font-size: 13px; color: var(--gold); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 14px; }
.hero-panel dl { position: relative; display: grid; gap: 12px; margin: 0; }
.hero-panel dl > div { display: flex; justify-content: space-between; gap: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--line-solid); }
.hero-panel dl > div:last-child { border-bottom: 0; padding-bottom: 0; }
.hero-panel dt { white-space: nowrap; }
dt { color: var(--muted); font-size: 13px; }
dd { margin: 0; font-weight: 800; text-align: right; font-size: 14px; }

/* ── Stats ── */
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin: 12px 0 40px; }
.stats .stat {
  padding: 20px 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), var(--panel-2)); box-shadow: var(--shadow);
  transition: .25s;
}
.stats .stat:hover { transform: translateY(-3px); border-color: var(--gold); }
.stats .stat strong { display: block; font-size: 34px; line-height: 1; color: var(--gold); background: linear-gradient(120deg, #f0cf5c, var(--violet)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.stats .stat span { color: var(--muted); font-size: 14px; }

/* ── Section shared ── */
.block-section { padding: 40px 0; }
.section-heading { margin-bottom: 26px; }
.section-heading h2 { font-size: clamp(26px, 4vw, 38px); }
.section-heading .sub { margin: 8px 0 0; color: var(--muted); max-width: 720px; }

/* ── Roadmap ── */
.roadmap { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.rm-card {
  position: relative; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), var(--panel-2)); box-shadow: var(--shadow);
  transition: .25s;
}
.rm-card:hover { transform: translateY(-4px); }
.rm-card.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), var(--shadow); }
.rm-card.done { opacity: .96; }
.rm-badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 900; font-size: 20px; }
.rm-state { font-size: 11px; padding: 3px 9px; border-radius: 999px; margin-left: 8px; vertical-align: middle; font-weight: 700; }
.state-done { background: rgba(116,184,111,.18); color: var(--green); }
.state-active { background: var(--gold-soft); color: var(--gold); }
.state-planned { background: rgba(139,92,246,.16); color: var(--violet); }
.state-future { background: rgba(179,170,154,.14); color: var(--muted); }
.rm-title { display: block; margin: 10px 0 12px; font-weight: 700; }
.rm-points { margin: 0; padding-left: 18px; color: var(--muted); font-size: 13.5px; display: grid; gap: 5px; }

/* ── Pathways ── */
.pathway-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(255px, 1fr)); gap: 16px; }
.pw-card {
  position: relative; overflow: hidden; padding: 22px; border-radius: var(--radius);
  border: 1px solid var(--line); background: linear-gradient(180deg, var(--panel), var(--panel-2));
  box-shadow: var(--shadow); transition: .25s;
}
.pw-card:hover { transform: translateY(-4px); border-color: var(--accent, var(--gold)); }
.pw-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: var(--accent, var(--gold));
}
.pw-head { display: flex; align-items: baseline; gap: 10px; }
.pw-head h3 { font-size: 22px; }
.pw-head .en { color: var(--muted); font-size: 13px; }
.pw-status { display: inline-block; margin-top: 8px; font-size: 11px; padding: 3px 9px; border-radius: 999px; background: var(--gold-soft); color: var(--gold); font-weight: 700; }
.pw-desc { color: var(--muted); font-size: 14px; margin: 12px 0; }
.pw-traits { display: flex; flex-wrap: wrap; gap: 6px; }
.pw-spirit { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.pw-spirit b { color: var(--text); }

/* ── Sequence ladder ── */
.seq-ladder { display: grid; gap: 8px; }
.seq-row {
  display: grid; grid-template-columns: 62px 1fr auto; align-items: center; gap: 16px;
  padding: 12px 16px; border: 1px solid var(--line); border-radius: 10px;
  background: linear-gradient(90deg, var(--panel), var(--panel-2)); transition: .2s;
}
.seq-row:hover { border-color: var(--gold); transform: translateX(4px); }
.seq-row.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.seq-num {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 12px;
  font-weight: 900; font-size: 22px; color: #17130a;
  background: linear-gradient(135deg, var(--gold), var(--violet));
}
.seq-row.future .seq-num { background: linear-gradient(135deg, #6a6152, #3d372b); color: var(--text); opacity: .7; }
.seq-info h4 { margin: 0; font-size: 16px; }
.seq-info .abil { color: var(--muted); font-size: 13px; }
.seq-spirit { text-align: right; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.seq-spirit b { display: block; color: var(--gold); font-size: 17px; }

/* ── Catalog ── */
.catalog { padding: 40px 0 20px; }
.section-heading.full { text-align: left; }
.catalog-body { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; align-items: start; }
.filters {
  position: sticky; top: 86px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), var(--panel-2)); box-shadow: var(--shadow);
}
.search-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
input[type="search"] {
  width: 100%; min-height: 44px; padding: 11px 13px; font: inherit;
  border: 1px solid var(--line-solid); border-radius: 10px; outline: none;
  background: color-mix(in srgb, var(--bg) 70%, transparent); color: var(--text);
}
input[type="search"]:focus { border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.filter-group { display: grid; gap: 7px; margin-top: 16px; }
.filter {
  min-height: 38px; padding: 8px 12px; cursor: pointer; text-align: left; font: inherit;
  border: 1px solid var(--line-solid); border-radius: 9px; background: transparent; color: var(--muted);
  display: flex; justify-content: space-between; align-items: center; transition: .18s;
}
.filter:hover { color: var(--text); border-color: var(--gold); }
.filter.active { border-color: var(--gold); background: var(--gold-soft); color: var(--text); font-weight: 700; }
.filter .cnt { font-size: 11px; opacity: .7; }
.result-count { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.card {
  display: grid; gap: 12px; padding: 18px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--line); background: linear-gradient(180deg, var(--panel), var(--panel-2));
  box-shadow: var(--shadow); transition: .22s; animation: fadeUp .4s both;
}
.card:hover { transform: translateY(-4px); border-color: var(--gold); }
.card-head { display: flex; gap: 12px; align-items: center; }
.icon {
  display: grid; place-items: center; width: 46px; height: 46px; flex: 0 0 auto; border-radius: 11px;
  font-weight: 900; color: #16130d; font-size: 20px; box-shadow: inset 0 0 0 2px rgba(0,0,0,.25);
}
.icon.lg { width: 58px; height: 58px; font-size: 26px; border-radius: 14px; }
.icon.ability { background: linear-gradient(135deg, #8b5cf6, #cbb0ff); }
.icon.system  { background: linear-gradient(135deg, #d4af37, #f0e2a3); }
.icon.potion  { background: linear-gradient(135deg, #76c7d4, #f0e2a3); }
.icon.block   { background: linear-gradient(135deg, #77716a, #b7b0a4); }
.icon.item    { background: linear-gradient(135deg, #88a858, #d2c17a); }
.icon.artifact{ background: linear-gradient(135deg, #cc5b4d, #f1c15f); }
.icon.ritual  { background: linear-gradient(135deg, #2f2a23, #d4af37); color:#f1eee7; }
.icon.org     { background: linear-gradient(135deg, #4c6fff, #8b5cf6); color:#fff; }
.icon.world   { background: linear-gradient(135deg, #6a6152, #b3aa9a); }
.icon.status  { background: linear-gradient(135deg, #74b86f, #6bcad0); }
.card h3 { font-size: 17px; }
.tagline { margin: 2px 0 0; color: var(--muted); font-size: 12px; word-break: break-all; }
.card > p { margin: 0; color: var(--muted); font-size: 14px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; min-height: 24px; padding: 2px 9px; border: 1px solid var(--line-solid); border-radius: 999px; color: var(--muted); font-size: 11.5px; }
.pill.type { border-color: var(--gold); color: var(--gold); }
.details { display: grid; gap: 7px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 13.5px; }
.details li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--line-solid); padding-bottom: 6px; }
.details li:last-child { border-bottom: 0; }
.details strong { color: var(--text); font-weight: 600; }
.empty { grid-column: 1/-1; padding: 32px; border: 1px dashed var(--line-solid); border-radius: 10px; color: var(--muted); text-align: center; }

/* ── Loop ── */
.loop { counter-reset: step; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px,1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.loop li {
  position: relative; padding: 22px 18px 18px; border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(180deg, var(--panel), var(--panel-2)); box-shadow: var(--shadow);
}
.loop li::before {
  counter-increment: step; content: counter(step);
  position: absolute; top: -16px; left: 18px; width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center; font-weight: 900; color: #17130a;
  background: linear-gradient(135deg, var(--gold), var(--violet));
}
.loop h4 { margin: 6px 0 8px; }
.loop p { margin: 0; color: var(--muted); font-size: 14px; }

/* ── About ── */
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.about-card { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(180deg, var(--panel), var(--panel-2)); box-shadow: var(--shadow); }
.about-card.warn { border-color: rgba(204,91,77,.4); }
.about-card h3 { margin-bottom: 12px; }
.about-card p { margin: 0; color: var(--muted); font-size: 14px; }
.tech-list, .team-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.tech-list li, .team-list li { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 14px; border-bottom: 1px dashed var(--line-solid); padding-bottom: 8px; }
.tech-list b, .team-list b { color: var(--text); }

/* ── Footer ── */
.footer { position: relative; z-index: 1; border-top: 1px solid var(--line); margin-top: 30px; }
.footer-inner { width: min(var(--maxw), calc(100% - 36px)); margin: 0 auto; padding: 32px 0 44px; display: flex; flex-wrap: wrap; gap: 24px; justify-content: space-between; }
.foot-logo { width: 100px; margin-bottom: 8px; }
.footer p { margin: 2px 0; color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.foot-links { display: grid; gap: 8px; align-content: start; }
.foot-links a { color: var(--muted); font-size: 14px; }
.foot-links a:hover { color: var(--gold); }

/* ── Modal ── */
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(6,5,4,.66); backdrop-filter: blur(6px); }
.modal-card {
  position: relative; width: min(560px, 100%); max-height: 86vh; overflow: auto;
  padding: 26px; border: 1px solid var(--gold); border-radius: 16px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2)); box-shadow: 0 30px 80px rgba(0,0,0,.6);
  animation: pop .28s both;
}
.modal-close { position: absolute; top: 14px; right: 16px; width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line-solid); background: transparent; color: var(--muted); font-size: 20px; cursor: pointer; }
.modal-close:hover { color: var(--text); border-color: var(--gold); }
.modal-head { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.modal-long { color: var(--muted); font-size: 14.5px; line-height: 1.75; margin: 12px 0 16px; }
.modal-long b { color: var(--text); }

/* ── Animations ── */
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } .panel-glow { animation: none; } #fog-canvas { display: none; } }

/* ── Responsive ── */
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 22px; padding-top: clamp(32px, 7vw, 56px); }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .catalog-body { grid-template-columns: 1fr; }
  .filters { position: static; }
  .filter-group { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }

  /* 汉堡菜单：窄屏收起为下拉抽屉 */
  .nav-burger { display: grid; }
  .topnav {
    position: absolute; top: calc(100% + 1px); left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 2px; margin: 0;
    padding: 10px clamp(16px, 4vw, 48px) 16px;
    background: color-mix(in srgb, var(--bg) 96%, transparent);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 20px 40px rgba(0,0,0,.4);
    max-height: 0; overflow: hidden; opacity: 0; pointer-events: none;
    transition: max-height .3s ease, opacity .25s ease, padding .3s ease;
  }
  .topnav.open { max-height: 70vh; opacity: 1; pointer-events: auto; }
  .topnav a { padding: 13px 12px; font-size: 15.5px; border-radius: 10px; min-height: 48px; display: flex; align-items: center; }
}
@media (max-width: 620px) {
  main { width: calc(100% - 24px); }
  .glow-title { font-size: clamp(34px, 11vw, 48px); }
  .lead { font-size: 15.5px; }
  .hero-actions .button { flex: 1 1 auto; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 30px; }
  .stats .stat { padding: 15px 14px; }
  .stats .stat strong { font-size: 28px; }
  .block-section { padding: 30px 0; }
  .cards { grid-template-columns: 1fr; }
  /* 版本表格窄屏改上下堆叠 */
  .hero-panel dl > div { flex-direction: column; gap: 2px; }
  dd { text-align: left; }
  .seq-row { grid-template-columns: 44px 1fr; padding: 11px 13px; }
  .seq-spirit { grid-column: 2; text-align: left; }
  .tech-list li, .team-list li, .details li { gap: 8px; }
  .icon-btn { width: 42px; height: 42px; }
  .modal { padding: 0; align-items: flex-end; }
  .modal-card { width: 100%; max-height: 90vh; border-radius: 18px 18px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); animation: slideUp .3s both; }
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 380px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .hero-actions { flex-direction: column; }
  .hero-actions .button { width: 100%; }
}
