/* ===== 赫卡忒守望枢纽 - 新拟态 (Neumorphism) ===== */

:root {
  --bg: #e3e7ee;
  --surface: #e3e7ee;
  --shadow-dark: #b6bcc9;
  --shadow-light: #ffffff;
  --text: #3a4050;
  --text-muted: #6b7385;
  --accent: #4a7c6f;
  --accent-soft: rgba(74, 124, 111, 0.12);
  --radius: 22px;
  --radius-sm: 14px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --serif: "Songti SC", "STSong", "Noto Serif SC", "SimSun", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", "Helvetica Neue", sans-serif;
}

html[data-theme="dark"] {
  --bg: #2a2e38;
  --surface: #2a2e38;
  --shadow-dark: #1d2029;
  --shadow-light: #373c48;
  --text: #d9dde6;
  --text-muted: #9aa1b0;
  --accent-soft: rgba(120, 170, 160, 0.16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ===== 顶栏 ===== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px;
  background: var(--bg);
  border-bottom: 1px solid rgba(0,0,0,0.03);
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); font-size: 20px; letter-spacing: 2px; }
.brand-mark { color: var(--accent); font-size: 24px; }
.topbar-back {
  font-size: 13px; letter-spacing: 2px; color: var(--text-muted);
  padding: 6px 14px; border-radius: 999px;
  margin-right: 8px;
  transition: color 0.2s var(--ease);
}
.topbar-back:hover { color: var(--accent); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.auth-chip {
  font-size: 12px; padding: 4px 12px; border-radius: 999px;
  color: var(--accent); background: var(--accent-soft);
}

/* ===== 按钮（新拟态） ===== */
.ghost-btn, .solid-btn, .back-btn {
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 14px;
  transition: box-shadow 0.25s var(--ease), transform 0.15s var(--ease), background 0.25s var(--ease);
}
.ghost-btn, .back-btn {
  background: var(--surface);
  box-shadow: 5px 5px 12px var(--shadow-dark), -5px -5px 12px var(--shadow-light);
}
.solid-btn {
  background: var(--accent);
  color: #f2f5f4;
  box-shadow: 5px 5px 12px var(--shadow-dark), -5px -5px 12px var(--shadow-light);
}
.ghost-btn:active, .solid-btn:active, .back-btn:active {
  box-shadow: inset 4px 4px 9px var(--shadow-dark), inset -4px -4px 9px var(--shadow-light);
  transform: translateY(1px);
}
.danger { color: #b0544f; }

/* ===== 首页 ===== */
.view { max-width: 1080px; margin: 0 auto; padding: 34px 26px 80px; }
.view[hidden] { display: none; }

.hero { text-align: center; padding: 46px 0 40px; }
.hero-title {
  font-family: var(--serif); font-size: 46px; letter-spacing: 6px;
  color: var(--text);
  text-shadow: 3px 3px 6px var(--shadow-dark), -3px -3px 6px var(--shadow-light);
}
.hero-tagline { margin-top: 14px; color: var(--text-muted); letter-spacing: 3px; font-size: 15px; }

.worlds-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 30px; margin-top: 26px;
}
.world-card {
  position: relative; border-radius: var(--radius); padding: 30px 28px;
  background: var(--surface);
  box-shadow: 8px 8px 18px var(--shadow-dark), -8px -8px 18px var(--shadow-light);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
  overflow: hidden; display: block; text-align: left;
}
.world-card:hover {
  transform: translateY(-4px);
  box-shadow: 12px 12px 24px var(--shadow-dark), -12px -12px 24px var(--shadow-light);
}
.world-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 5px;
  background: linear-gradient(90deg, var(--accent), transparent 70%);
}
.world-card-mark { font-size: 30px; color: var(--accent); }
.world-card-name { font-family: var(--serif); font-size: 26px; letter-spacing: 3px; margin: 14px 0 6px; }
.world-card-tagline { color: var(--accent); font-size: 13px; letter-spacing: 1px; }
.world-card-desc { color: var(--text-muted); font-size: 14px; margin-top: 12px; }
.world-card.empty {
  opacity: 0.72;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 200px; text-align: center;
}
.world-card.empty .world-card-name { color: var(--text-muted); }
.placeholder-hint {
  font-size: 12px; letter-spacing: 4px; color: var(--text-muted); margin-top: 8px;
}

/* ===== 详情页 ===== */
.back-btn { margin-bottom: 26px; }
.world-head { display: flex; align-items: center; gap: 20px; margin-bottom: 24px; }
.world-head[hidden] { display: none; }
.world-head-mark {
  width: 64px; height: 64px; border-radius: 20px; flex: none;
  display: grid; place-items: center; font-size: 30px; color: #fff;
  background: var(--accent);
  box-shadow: 6px 6px 14px var(--shadow-dark), -6px -6px 14px var(--shadow-light);
}
.world-title { font-family: var(--serif); font-size: 34px; letter-spacing: 4px; }
.world-tagline { color: var(--text-muted); letter-spacing: 2px; font-size: 14px; margin-top: 4px; }

.doc-tabs { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 22px; }
.doc-tab {
  border-radius: var(--radius-sm); padding: 9px 20px; font-size: 14px;
  background: var(--surface);
  box-shadow: 5px 5px 12px var(--shadow-dark), -5px -5px 12px var(--shadow-light);
  transition: all 0.25s var(--ease);
}
.doc-tab.active {
  background: var(--accent); color: #f2f5f4;
  box-shadow: inset 4px 4px 9px rgba(0,0,0,0.18), inset -4px -4px 9px rgba(255,255,255,0.18);
}

.doc-toolbar { display: flex; gap: 10px; margin-bottom: 20px; }
.doc-toolbar[hidden] { display: none; }

/* ===== 文档正文 ===== */
.doc-body {
  border-radius: var(--radius); padding: 40px 44px;
  background: var(--surface);
  box-shadow: inset 6px 6px 16px var(--shadow-dark), inset -6px -6px 16px var(--shadow-light);
  min-height: 320px;
}
.doc-body h1 { font-family: var(--serif); font-size: 30px; letter-spacing: 3px; margin: 12px 0 18px; }
.doc-body h2 { font-family: var(--serif); font-size: 24px; letter-spacing: 2px; margin: 30px 0 12px; padding-bottom: 8px; border-bottom: 1px solid rgba(0,0,0,0.06); }
.doc-body h3 { font-family: var(--serif); font-size: 19px; margin: 22px 0 10px; color: var(--accent); }
.doc-body h4 { font-size: 16px; margin: 16px 0 8px; }
.doc-body p { margin: 10px 0; }
.doc-body ul { margin: 8px 0 8px 6px; padding-left: 22px; list-style: none; }
.doc-body ul ul { margin: 4px 0; }
.doc-body li { position: relative; padding-left: 16px; margin: 5px 0; }
.doc-body li::before {
  content: "·"; position: absolute; left: 0; color: var(--accent); font-weight: bold;
}
.doc-body ul ul li::before { content: "◦"; }
.doc-body ul ul ul li::before { content: "·"; opacity: 0.6; }
.doc-body strong { color: var(--accent); font-weight: 700; }
.doc-body hr { border: none; height: 1px; margin: 26px 0; background: rgba(0,0,0,0.06); }
.doc-body blockquote { border-left: 3px solid var(--accent); padding-left: 16px; margin: 14px 0; color: var(--text-muted); }

.doc-image { text-align: center; margin: 0 0 22px; }
.doc-image img {
  max-width: 220px; border-radius: var(--radius-sm);
  box-shadow: 6px 6px 14px var(--shadow-dark), -6px -6px 14px var(--shadow-light);
  background: #fff; padding: 10px;
}

/* 纯文本档案样式 */
.doc-body.pre {
  font-family: "Cascadia Mono", "Consolas", "Sarasa Mono SC", monospace;
  font-size: 14px; line-height: 1.8; white-space: pre-wrap; word-break: break-word;
}
.doc-body.pre .pre-line { display: block; }
.doc-body.pre .pre-line.is-head { color: var(--accent); font-weight: 700; margin-top: 4px; }
.doc-body.pre .pre-line.is-rule { color: var(--text-muted); letter-spacing: 2px; }

/* 留白文档 */
.blank-note {
  display: grid; place-items: center; min-height: 320px; text-align: center;
  color: var(--text-muted);
}
.blank-note .big { font-family: var(--serif); font-size: 40px; letter-spacing: 10px; margin-bottom: 12px; }
.blank-note .sub { letter-spacing: 4px; font-size: 13px; }

/* ===== 弹窗 ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(20, 24, 34, 0.35);
  backdrop-filter: blur(4px);
  padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  width: min(420px, 94vw); border-radius: var(--radius); padding: 34px 30px;
  background: var(--surface);
  box-shadow: 10px 10px 26px rgba(0,0,0,0.28), -4px -4px 16px var(--shadow-light);
}
.modal-title { font-family: var(--serif); font-size: 22px; letter-spacing: 2px; text-align: center; }
.modal-sub { text-align: center; color: var(--text-muted); font-size: 13px; margin: 8px 0 18px; letter-spacing: 2px; }
.welcome-mark { text-align: center; font-size: 42px; color: var(--accent); margin-bottom: 10px; }
.modal-actions { display: flex; gap: 12px; margin-top: 22px; justify-content: flex-end; }
.modal-actions.center { justify-content: center; }
.modal-err { color: #b0544f; font-size: 13px; min-height: 18px; margin-top: 8px; }

.input, .editor {
  width: 100%; border: none; border-radius: var(--radius-sm);
  padding: 13px 16px; font-size: 15px; color: var(--text);
  background: var(--surface);
  box-shadow: inset 5px 5px 10px var(--shadow-dark), inset -5px -5px 10px var(--shadow-light);
  outline: none; margin-top: 14px; font-family: inherit;
}
.input:focus, .editor:focus {
  box-shadow: inset 6px 6px 12px var(--shadow-dark), inset -6px -6px 12px var(--shadow-light);
}

.editor-overlay .editor-modal { width: min(760px, 96vw); }
.editor {
  min-height: 46vh; resize: vertical; margin-top: 18px;
  font-family: "Cascadia Mono", "Consolas", "Sarasa Mono SC", monospace;
  font-size: 14px; line-height: 1.7;
}

/* ===== 页脚 ===== */
.foot {
  text-align: center; padding: 26px; color: var(--text-muted);
  font-size: 12px; letter-spacing: 3px;
}

/* ===== 响应式 ===== */
@media (max-width: 640px) {
  .hero-title { font-size: 32px; letter-spacing: 3px; }
  .worlds-grid { grid-template-columns: 1fr; }
  .doc-body { padding: 26px 22px; }
  .brand-text { display: none; }
}
