/* ============================================
   密特拉小站 v2 — 「墨光探险日志」
   墨底 · 琥珀光 · 纸纹 · 星辰
   ============================================ */

:root {
  --bg: #1a1410;
  --bg-card: #231e18;
  --bg-hover: #2a241e;
  --text: #e8e0d5;
  --text-muted: #9a9080;
  --accent: #d4a853;
  --accent-glow: #f0d078;
  --red: #c0392b;
  --red-soft: #e74c3c;
  --border: #3a3228;
  --ink: rgba(212,168,83,0.08);
  --ink-strong: rgba(212,168,83,0.18);
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --radius: 8px;
  --font-body: 'Georgia', 'Noto Serif SC', 'Source Han Serif SC', serif;
  --font-mono: 'SF Mono', 'Consolas', 'Courier New', monospace;
}

.light {
  --bg: #f5f0e8;
  --bg-card: #fffaf2;
  --bg-hover: #f0e8d5;
  --text: #2a2218;
  --text-muted: #8a7a60;
  --accent: #b8860b;
  --accent-glow: #daa520;
  --red: #8b0000;
  --red-soft: #c0392b;
  --border: #d8cfb8;
  --ink: rgba(139,0,0,0.04);
  --ink-strong: rgba(139,0,0,0.1);
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

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

@keyframes inkSpread {
  0% { transform: scale(0); opacity: 0.6; }
  60% { transform: scale(1.1); opacity: 0.3; }
  100% { transform: scale(1); opacity: 0; }
}

@keyframes starTwinkle {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.3); }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes constellationDraw {
  to { stroke-dashoffset: 0; }
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
  min-height: 100vh;
  transition: background 0.5s, color 0.5s;
  overflow-x: hidden;
}

/* ===== 星空背景 ===== */
.stars-canvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ===== 墨滴装饰 ===== */
.ink-splash {
  position: fixed;
  pointer-events: none;
  z-index: 0;
  opacity: 0.06;
  filter: blur(60px);
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
}

.ink-splash.s1 { width: 400px; height: 400px; top: -100px; left: -80px; }
.ink-splash.s2 { width: 300px; height: 300px; bottom: 10%; right: -60px; }
.ink-splash.s3 { width: 200px; height: 200px; top: 50%; left: 60%; animation: float 8s ease-in-out infinite; }

/* ===== 导航栏 ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.logo {
  font-weight: bold;
  font-size: 1.05rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 2px;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.logo:hover { color: var(--accent-glow); text-shadow: 0 0 20px var(--accent); }
.logo .star { font-size: 0.8rem; animation: starTwinkle 3s ease-in-out infinite; }
.logo .star:nth-child(2) { animation-delay: 1s; }
.logo .star:nth-child(3) { animation-delay: 2s; }

.nav-links { display: flex; gap: 4px; }
.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  transition: all 0.25s;
  font-size: 0.9rem;
  position: relative;
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 2px; left: 50%;
  transform: translateX(-50%);
  width: 0; height: 1px;
  background: var(--accent);
  transition: width 0.3s;
}
.nav-links a:hover { color: var(--accent); }
.nav-links a:hover::after { width: 60%; }
.nav-links a.active {
  color: var(--accent);
  background: var(--ink);
}
.nav-links a.active::after { width: 60%; }

.moon-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px; height: 36px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  color: var(--text);
}
.moon-toggle:hover { border-color: var(--accent); color: var(--accent); }

/* ===== 主内容区 ===== */
main {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

.page-title {
  font-size: 2.2rem;
  margin-bottom: 6px;
  color: var(--text);
  animation: fadeInUp 0.6s ease-out;
}
.page-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 40px;
  animation: fadeInUp 0.6s ease-out 0.1s both;
}

/* ===== 英雄区 ===== */
.hero-content {
  text-align: center;
  padding: 40px 0 60px;
}
.ink-mark {
  font-size: 5rem;
  margin-bottom: 20px;
  animation: float 4s ease-in-out infinite;
}
.hero-content h1 {
  font-size: 2.4rem;
  margin-bottom: 10px;
  line-height: 1.4;
}
.hero-content .highlight {
  color: var(--accent);
  position: relative;
}
.hero-content .highlight::after {
  content: '';
  position: absolute;
  bottom: 2px; left: 0;
  width: 100%; height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.4;
}
.hero-content .subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 6px;
  font-family: var(--font-mono);
}
.hero-content .tagline {
  color: var(--accent);
  font-size: 1.1rem;
  margin-bottom: 40px;
  letter-spacing: 2px;
}

/* ===== 卡片 ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 28px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 0;
  background: linear-gradient(180deg, var(--accent), var(--red));
  transition: height 0.4s;
  border-radius: 0 0 3px 0;
}
.card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.card:hover::before { height: 100%; }

.card h3 { 
  color: var(--accent); 
  font-size: 1.1rem; 
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card .date {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 12px;
  font-family: var(--font-mono);
}
.card p { font-size: 0.95rem; line-height: 1.8; }

.card-link { display: block; text-decoration: none; color: inherit; }

/* ===== 快捷链接卡片 ===== */
.quick-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 32px;
}
.quick-links .card-link .card {
  text-align: center;
  padding: 28px 20px;
}
.quick-links .icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}
.quick-links .label {
  display: block;
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 4px;
}
.quick-links .hint {
  display: block;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ===== 冒险者档案 ===== */
.about-card { text-align: left; margin-bottom: 32px; }
.about-card h2 { color: var(--accent); font-size: 1.2rem; margin-bottom: 14px; }
.about-card p { margin-bottom: 6px; }
.about-card a { color: var(--accent); text-decoration: none; border-bottom: 1px dashed var(--accent); }
.about-card a:hover { color: var(--accent-glow); }
.about-card .cta {
  margin-top: 12px;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

/* ===== 冒险记录文章展开 ===== */
.diary-entry { cursor: pointer; }
.diary-entry .expand-hint { 
  font-size: 0.8rem; 
  color: var(--accent); 
  margin-top: 10px;
  font-family: var(--font-mono);
}
.diary-entry .full-text { 
  display: none; 
  margin-top: 16px; 
  padding-top: 16px; 
  border-top: 1px dashed var(--border); 
  line-height: 1.9; 
}
.diary-entry.open .full-text { display: block; }
.diary-entry .expand-hint::after { content: '▼ 展开全文'; }
.diary-entry.open .expand-hint::after { content: '▲ 收起'; }

/* ===== 小说页 ===== */
.novel-text { font-size: 1.05rem; line-height: 2.1; text-align: justify; }
.novel-text p { margin-bottom: 1.3em; text-indent: 2em; }
.novel-text hr { 
  border: none; 
  border-top: 1px dashed var(--border); 
  margin: 2.5em 0;
  position: relative;
}
.novel-text hr::after {
  content: '✦';
  position: absolute;
  top: -0.7em; left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  padding: 0 8px;
  color: var(--accent);
  font-size: 0.8rem;
}
.novel-text code { 
  background: var(--ink); 
  padding: 2px 8px; 
  border-radius: 4px; 
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: var(--accent);
}
.chapter-nav { 
  display: flex; 
  justify-content: space-between; 
  margin-top: 32px; 
  padding-top: 16px; 
  border-top: 1px solid var(--border); 
}
.chapter-nav a { color: var(--accent); text-decoration: none; }
.chapter-nav span { color: var(--text-muted); }

/* ===== 伙伴页 ===== */
.friend-card {
  display: flex;
  align-items: center;
  gap: 20px;
}
.friend-avatar {
  font-size: 3rem;
  min-width: 72px;
  text-align: center;
  animation: float 5s ease-in-out infinite;
}
.friend-card:nth-child(2) .friend-avatar { animation-delay: 1s; }
.friend-card:nth-child(3) .friend-avatar { animation-delay: 2s; }
.friend-info h3 { margin-bottom: 4px; }
.friend-info .role { color: var(--accent); font-size: 0.88rem; }
.friend-info p { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }
.friend-info a { color: var(--accent); text-decoration: none; border-bottom: 1px dashed var(--accent); }

/* ===== 酒馆 ===== */
#guestbook-form-card {
  border-color: var(--accent);
}
#guestbook-form input,
#guestbook-form textarea {
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.3s;
}
#guestbook-form input:focus,
#guestbook-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(212,168,83,0.15);
}
#guestbook-form textarea { min-height: 80px; resize: vertical; }
#gb-submit {
  background: var(--accent);
  color: #1a1410;
  border: none;
  padding: 10px 28px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: bold;
  transition: all 0.3s;
}
#gb-submit:hover { background: var(--accent-glow); transform: translateY(-1px); }
#gb-submit:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
#gb-status { margin-left: 12px; color: var(--text-muted); font-size: 0.85rem; }

/* ===== 回复提示 ===== */
#gb-reply-hint {
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 8px;
  padding: 6px 10px;
  background: var(--ink);
  border-radius: 4px;
}
#gb-cancel-reply {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 10px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  margin-left: 8px;
  transition: all 0.3s;
}
#gb-cancel-reply:hover { border-color: var(--red-soft); color: var(--red-soft); }

/* ===== 留言条目操作栏 ===== */
.gb-entry { }
.gb-actions {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.gb-reply-btn {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  cursor: pointer;
  transition: color 0.2s;
}
.gb-reply-btn:hover { color: var(--accent-glow); }
.gb-reply-count {
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ===== 回复列表 ===== */
.gb-replies {
  margin-top: 12px;
  padding-left: 16px;
  border-left: 2px solid var(--border);
}
.gb-reply-item {
  padding: 10px 14px;
  margin-bottom: 8px;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
  transition: border-color 0.3s;
}
.gb-reply-item:last-child { margin-bottom: 0; }
.gb-reply-item:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.gb-reply-author { color: var(--text); }
.gb-reply-to {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin: 0 4px;
}

/* ===== 旧留言条目样式（保留兼容） ===== */
.guestbook-entry {
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.guestbook-entry:last-child { border-bottom: none; }
.guestbook-entry .author { font-weight: bold; color: var(--accent); }
.guestbook-entry .time { color: var(--text-muted); font-size: 0.8rem; margin-left: 8px; }
.guestbook-entry .msg { margin-top: 6px; line-height: 1.7; }

/* ===== 页脚 ===== */
footer {
  text-align: center;
  padding: 32px 20px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
  position: relative;
  z-index: 1;
  background: var(--bg);
}
footer .footnote { color: var(--accent); }
footer .small { font-size: 0.78rem; margin-top: 4px; }

/* ===== 星座线条装饰 ===== */
.constellation-line {
  position: fixed;
  pointer-events: none;
  z-index: 0;
}
.constellation-line line {
  stroke: var(--accent);
  stroke-width: 0.5;
  opacity: 0.25;
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: constellationDraw 4s ease-out forwards;
}

/* ===== 响应式 ===== */
@media (max-width: 600px) {
  .topbar { padding: 10px 14px; }
  .nav-links a { padding: 4px 8px; font-size: 0.8rem; }
  .hero-content h1 { font-size: 1.6rem; }
  .page-title { font-size: 1.5rem; }
  .friend-card { flex-direction: column; text-align: center; }
  .quick-links { grid-template-columns: 1fr; }
  .ink-mark { font-size: 3.5rem; }
}
