/* 记忆方舟 · 前端样式（复刻 life-legacy「人类记忆库」整体架构）
   温暖传承风：暖米白底 + 深海军蓝 + 青绿强调 + 鼠尾草绿 */
:root {
  --primary: #3a506b;
  --primary-dark: #1c2541;
  --accent: #5bc0be;
  --accent-dark: #4aa9a7;
  --light: #f8f5f0;
  --dark: #222222;
  --text: #444444;
  --gray: #7a7a7a;
  --sage: #d4e6b5;
  --light-sage: #f0f7e6;
  --border: #e8e2d8;
  --surface: #ffffff;
  --surface-2: #fbf9f5;
  --ok: #5aa469;
  --err: #c0564a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--light);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ---------- 顶部导航 ---------- */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  transition: all .3s;
  background: transparent;
}
.topbar.scrolled { background: var(--primary); box-shadow: 0 2px 14px rgba(28,37,65,.3); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo { font-size: 24px; }
.brand .brand-name { font-size: 20px; font-weight: 700; color: #fff; letter-spacing: .5px; }
.brand .brand-name em { font-style: normal; font-weight: 400; color: var(--accent); font-size: 13px; margin-left: 2px; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-link { color: rgba(255,255,255,.9); font-size: 15px; font-weight: 500; position: relative; padding: 4px 0; cursor: pointer; }
.nav-link::after { content:''; position: absolute; bottom: 0; left: 0; width: 0; height: 2px; background: var(--accent); transition: width .3s; }
.nav-link:hover::after, .nav-link.active::after { width: 100%; }
.nav-link:hover { color: #fff; }

/* ---------- 按钮（胶囊） ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; padding: 12px 28px; border-radius: 999px; font-weight: 600; font-size: 16px; transition: all .3s; cursor: pointer; border: none; transform: translateY(0); }
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--accent); color: var(--primary-dark); }
.btn-primary:hover { background: #fff; box-shadow: 0 6px 20px rgba(91,192,190,.4); }
.btn-outline { border: 2px solid #fff; color: #fff; background: transparent; }
.btn-outline:hover { background: var(--primary-dark); border-color: var(--accent); }
.btn-sm { padding: 8px 18px; font-size: 14px; }
.btn-ghost { background: transparent; color: var(--gray); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--accent-dark); border-color: var(--accent); }

/* ---------- Hero ---------- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  background: linear-gradient(180deg, rgba(28,37,65,.92), var(--primary-dark)), var(--primary-dark);
}
.hero-content { max-width: 820px; padding: 0 24px; }
.hero h1 { font-size: 44px; font-weight: 700; margin: 0 0 18px; letter-spacing: 1px; }
.hero p { font-size: 20px; margin: 0 0 36px; color: rgba(255,255,255,.85); max-width: 640px; margin-left: auto; margin-right: auto; }
.hero-actions { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }

/* ---------- 区块标题 ---------- */
.section { padding: 80px 0; }
.section-title { text-align: center; font-size: 32px; font-weight: 700; color: var(--primary-dark); margin: 0 0 12px; }
.section-subtitle { text-align: center; font-size: 17px; color: var(--gray); max-width: 640px; margin: 0 auto 48px; }
.section-light { background: var(--light); }
.section-sage { background: var(--light-sage); }

/* ---------- 故事卡片 ---------- */
.story-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.story-card {
  background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 2px 8px rgba(28,37,65,.06);
  transition: all .3s; cursor: pointer; border: 1px solid var(--border);
}
.story-card:hover { transform: translateY(-6px); box-shadow: 0 14px 34px rgba(28,37,65,.14); }
.card-img { position: relative; height: 180px; overflow: hidden; }
.card-img .ph { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 44px; color: rgba(255,255,255,.9); }
.age-tag { position: absolute; top: 14px; right: 14px; background: var(--accent); color: var(--primary-dark); padding: 3px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; }
.card-body { padding: 22px; }
.card-title { font-size: 18px; font-weight: 700; color: var(--primary-dark); margin: 0 0 8px; }
.card-excerpt { color: var(--gray); font-size: 14px; margin: 0 0 16px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; justify-content: space-between; padding-top: 14px; border-top: 1px solid #f0ece4; color: var(--gray); font-size: 13px; }
.card-meta .stat { display: flex; align-items: center; gap: 6px; color: var(--primary); }

/* ---------- 排行榜 ---------- */
.ranking-section { background: var(--light-sage); position: relative; overflow: hidden; padding: 90px 0; }
.ranking-section::before { content:''; position: absolute; width: 300px; height: 300px; border-radius: 50%; background: var(--sage); top: -150px; right: -100px; opacity: .3; }
.ranking-container { display: flex; gap: 32px; margin-top: 44px; }
.ranking-box { flex: 1; background: #fff; border-radius: 15px; padding: 30px; box-shadow: 0 5px 25px rgba(0,0,0,.05); }
.ranking-title { font-size: 20px; margin: 0 0 22px; color: var(--primary-dark); font-weight: 700; }
.ranking-list { display: flex; flex-direction: column; gap: 14px; }
.ranking-item { display: flex; align-items: center; padding: 14px; border-radius: 10px; border: 1px solid rgba(0,0,0,.05); transition: all .3s; }
.ranking-item:hover { background: rgba(212,230,181,.25); transform: translateX(5px); }
.rank { width: 36px; height: 36px; background: var(--primary); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; margin-right: 14px; flex-shrink: 0; }
.rank-1 { background: linear-gradient(45deg, #FFD700, #f1c40f); color: #5a4400; }
.rank-2 { background: linear-gradient(45deg, #bdc3c7, #95a5a6); color: #333; }
.rank-3 { background: linear-gradient(45deg, #cd7f32, #e67e22); color: #fff; }
.item-content { flex: 1; }
.item-title { font-weight: 600; color: var(--dark); }
.item-subtitle { font-size: 13px; color: var(--gray); margin-top: 2px; }
.item-stats { font-weight: 600; color: var(--primary); }

/* ---------- 表单卡片 ---------- */
.form-card { background: #fff; border-radius: 16px; box-shadow: 0 2px 8px rgba(28,37,65,.06); padding: 40px; border: 1px solid var(--border); max-width: 720px; margin: 0 auto; }
textarea, input {
  width: 100%; border: 1px solid var(--border); border-radius: 12px; padding: 13px 16px;
  font-size: 16px; font-family: inherit; color: var(--text); background: #fff; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; line-height: 1.7; }
textarea:focus, input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91,192,190,.15); }
.field { margin-top: 18px; }
.field label { display: block; font-size: 13px; color: var(--gray); margin-bottom: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 7px 16px; border: 1px solid var(--border); border-radius: 999px; cursor: pointer; font-size: 14px; color: var(--gray); background: #fff; transition: all .15s; user-select: none; }
.chip:hover { border-color: var(--accent); color: var(--accent-dark); }
.chip.active { background: var(--accent); color: #fff; border-color: transparent; font-weight: 600; }

/* ---------- 页面通用 ---------- */
.page { padding: 120px 0 80px; min-height: 70vh; }
.page.hidden { display: none; }
.page-head { text-align: center; margin-bottom: 40px; }
.page-head h1 { font-size: 34px; font-weight: 700; color: var(--primary-dark); margin: 0 0 8px; }
.page-head p { color: var(--gray); font-size: 16px; }

.mem-text { white-space: pre-wrap; background: var(--light-sage); border: 1px solid var(--sage); border-left: 4px solid var(--accent); border-radius: 12px; padding: 24px; font-size: 17px; line-height: 1.9; color: var(--dark); }
.meta-line { color: var(--gray); font-size: 13px; margin: 14px 0; }
.result { margin-top: 14px; text-align: center; font-size: 14px; }
.ok { color: var(--ok); font-weight: 600; }
.err { color: var(--err); }
.ticket { width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; font-family: ui-monospace, monospace; font-size: 12px; color: var(--gray); word-break: break-all; resize: vertical; }

/* ---------- 登录遮罩 ---------- */
.auth-overlay { position: fixed; inset: 0; z-index: 100; background: linear-gradient(160deg, var(--primary-dark), var(--primary)); display: flex; align-items: center; justify-content: center; padding: 20px; }
.auth-overlay.hidden { display: none; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 40px 34px; box-shadow: 0 30px 80px rgba(28,37,65,.4); display: grid; gap: 14px; }
.auth-brand { justify-content: center; display: flex; align-items: center; gap: 10px; }
.auth-brand .brand-name { color: var(--primary-dark); font-size: 20px; font-weight: 700; }
.auth-brand .brand-name em { color: var(--accent-dark); }
.auth-sub { text-align: center; color: var(--gray); margin: -6px 0 0; font-size: 14px; }
.auth-card h2 { text-align: center; margin: 0; font-size: 22px; color: var(--primary-dark); }
.auth-card button.primary, .auth-card .btn-primary { margin-top: 0; width: 100%; }
.auth-switch { text-align: center; font-size: 13px; color: var(--gray); margin: 0; }
.auth-switch a { color: var(--accent-dark); cursor: pointer; font-weight: 600; }

/* ---------- 页脚 ---------- */
.footer { background: var(--dark); color: #fff; padding: 56px 0 28px; margin-top: 0; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.2fr; gap: 32px; }
.footer h3 { color: var(--accent); font-size: 16px; margin: 0 0 16px; font-weight: 600; }
.footer .f-brand { font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.footer p, .footer li { color: #9ca3af; font-size: 14px; }
.footer ul { list-style: none; padding: 0; margin: 0; }
.footer ul li { margin-bottom: 10px; cursor: pointer; }
.footer ul li:hover { color: var(--accent); }
.footer-bottom { margin-top: 40px; padding-top: 20px; border-top: 1px solid #333; text-align: center; color: #6b7280; font-size: 13px; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .story-grid { grid-template-columns: 1fr; }
  .ranking-container { flex-direction: column; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 30px; }
  .nav-links { gap: 16px; }
}
