/* TheyNigha's World — glassmorphism theme
   Dynamic accent color is injected at runtime via app.js (--accent / --accent-soft). */
:root {
  --accent: #7c5cff;
  --accent-soft: rgba(124, 92, 255, 0.35);
  --accent-strong: #5b3df0;
  --glass-bg: rgba(255, 255, 255, 0.14);
  --glass-border: rgba(255, 255, 255, 0.28);
  --glass-hi: rgba(255, 255, 255, 0.45);
  --text: #f4f4fb;
  --text-dim: rgba(244, 244, 251, 0.72);
  --ink: #1c1530;
  --radius: 18px;
  --blur: 16px;
  --shadow: 0 8px 32px rgba(20, 12, 45, 0.28);
  --maxw: 1120px;
}

/* 亮色主题：手动切换或系统偏好 light 时覆盖。
   玻璃面板改为浅色半透明、深色文字，背景遮罩变亮。 */
[data-theme="light"] {
  --glass-bg: rgba(255, 255, 255, 0.55);
  --glass-border: rgba(255, 255, 255, 0.7);
  --glass-hi: rgba(255, 255, 255, 0.9);
  --text: #1c1530;
  --text-dim: rgba(28, 21, 48, 0.66);
  --shadow: 0 8px 32px rgba(60, 50, 110, 0.18);
}
[data-theme="light"] body {
  background: linear-gradient(135deg, rgba(180, 165, 240, 0.45), rgba(220, 215, 245, 0.6)), #e9e6f6;
}
[data-theme="light"] .bg-layer::after {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.45), rgba(230, 226, 246, 0.6));
}
[data-theme="light"] .topbar { background: rgba(255, 255, 255, 0.5); }
[data-theme="light"] .footer { background: rgba(255, 255, 255, 0.45); }
[data-theme="light"] .field input,
[data-theme="light"] .field textarea,
[data-theme="light"] .field select { background: rgba(255, 255, 255, 0.6); color: var(--ink); }
[data-theme="light"] .links-list a { background: rgba(124, 92, 255, 0.1); }

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(135deg, rgba(70, 40, 150, 0.55), rgba(20, 14, 45, 0.65)),
    #2a1f52;
  background-attachment: fixed;
}

/* Background image layer + overlay */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transition: opacity 0.6s ease;
  opacity: 0;
}
.bg-layer.loaded { opacity: 1; }
.bg-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(40, 22, 90, 0.55), rgba(14, 10, 32, 0.72));
}

a { color: inherit; text-decoration: none; }
a:hover { color: #fff; }

/* ---- Glass primitive ---- */
.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  position: relative;
}
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(160deg, var(--glass-hi), transparent 45%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  opacity: 0.6;
}

/* ---- Topbar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 40px);
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(28, 18, 56, 0.45);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.brand {
  font-weight: 700;
  font-size: 1.18rem;
  letter-spacing: 0.5px;
}
.topnav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.topnav a { color: var(--text-dim); font-size: 0.95rem; transition: color 0.2s; }
.topnav a:hover { color: #fff; }
.inline-form { display: inline; margin: 0; }
.link-btn {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font: inherit; padding: 0;
}
.link-btn:hover { color: #fff; }
.btn-accent {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff !important;
  font-weight: 600;
}
.btn-accent:hover { background: var(--accent-strong); }

.lang-switcher { display: inline-flex; gap: 4px; margin-left: 4px; }
.lang-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-dim);
}
.lang-btn.active { background: var(--accent); color: #fff; }

/* ---- Flash ---- */
.flash {
  max-width: var(--maxw);
  margin: 16px auto 0;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 0.95rem;
  backdrop-filter: blur(8px);
}
.flash-error { background: rgba(220, 60, 80, 0.28); border: 1px solid rgba(255, 120, 140, 0.5); }
.flash-success { background: rgba(60, 200, 130, 0.24); border: 1px solid rgba(120, 255, 190, 0.5); }

/* ---- Layout ---- */
.main-container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 40px) 48px;
  flex: 1;
}

.card {
  padding: 22px 24px;
  margin-bottom: 22px;
}
.card-title {
  margin: 0 0 14px;
  font-size: 1.05rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-title::before {
  content: "";
  width: 4px; height: 18px;
  border-radius: 4px;
  background: var(--accent);
}

/* ---- Hero ---- */
.hero {
  padding: 40px 32px;
  margin-bottom: 26px;
  text-align: center;
}
.hero-title {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: 0.5px;
}
.hero-subtitle { margin: 0; color: var(--text-dim); font-size: 1.05rem; }

.announcement-body { color: var(--text-dim); }

/* ---- Home grid ---- */
.home-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 22px;
  align-items: start;
}
.home-col { min-width: 0; }
@media (max-width: 860px) {
  .home-grid { grid-template-columns: 1fr; }
}

.links-list { list-style: none; margin: 0; padding: 0; }
.links-list li { margin-bottom: 10px; }
.links-list a {
  display: block;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  transition: background 0.2s, transform 0.2s;
  word-break: break-all;
}
.links-list a:hover { background: var(--accent-soft); transform: translateX(3px); }

.video-wrapper {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
}
.video-wrapper iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* ---- Buttons / forms ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.btn:hover { background: rgba(255, 255, 255, 0.18); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  border-color: transparent;
}
.btn-primary:hover { background: var(--accent-strong); }
.btn-block { width: 100%; }

.field { display: block; margin-bottom: 16px; }
.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--text-dim);
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 11px 13px;
  border-radius: 11px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: inherit;
  transition: border-color 0.2s, background 0.2s;
}
.field input::placeholder,
.field textarea::placeholder { color: rgba(255, 255, 255, 0.45); }
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.16);
}
.field textarea { resize: vertical; }
.field select option { color: var(--ink); }

/* ---- Auth ---- */
.auth-wrap {
  max-width: 420px;
  margin: 24px auto;
}
.auth-card { padding: 32px 30px; }
.auth-title { margin: 0 0 22px; text-align: center; font-size: 1.5rem; }
.auth-divider, .oauth-divider {
  text-align: center;
  margin: 22px 0 16px;
  position: relative;
  color: var(--text-dim);
  font-size: 0.85rem;
}
.auth-divider::before, .oauth-divider::before {
  content: "";
  position: absolute;
  top: 50%; left: 0; right: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.18);
}
.auth-divider span, .oauth-divider span {
  position: relative;
  padding: 0 12px;
  background: transparent;
}
.oauth-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.oauth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--glass-border);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.2s;
}
.oauth-btn:hover { background: rgba(255, 255, 255, 0.2); }
.oauth-google:hover { background: rgba(219, 68, 55, 0.4); }
.oauth-microsoft:hover { background: rgba(0, 120, 215, 0.4); }
.oauth-wechat:hover { background: rgba(7, 193, 96, 0.4); }
.oauth-qq:hover { background: rgba(18, 183, 245, 0.4); }
.auth-alt { text-align: center; margin-top: 18px; color: var(--text-dim); font-size: 0.92rem; }
.auth-alt a { color: var(--accent); font-weight: 600; }
.auth-disabled { text-align: center; color: var(--text-dim); padding: 16px 0; }
.captcha-field { display: flex; justify-content: center; }

/* ---- Guestbook ---- */
.guestbook-hero { padding: 30px; }
.guestbook-form-card .guestbook-form { margin: 0; }
.guestbook-login-hint { color: var(--text-dim); }
.guestbook-login-hint a { color: var(--accent); font-weight: 600; }
.guestbook-list { margin-top: 4px; }
.message-item { padding: 18px 22px; }
.message-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.message-author { font-weight: 600; }
.message-date { font-size: 0.8rem; color: var(--text-dim); }
.message-body { color: var(--text); word-break: break-word; }
.empty-state { text-align: center; color: var(--text-dim); padding: 30px; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 10px;
}
.page-btn {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 11px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--blur));
}
.page-btn:hover { background: var(--accent-soft); }
.page-info { color: var(--text-dim); font-size: 0.92rem; }

/* ---- Error page ---- */
.error-page {
  text-align: center;
  padding: 70px 30px;
  max-width: 480px;
  margin: 40px auto;
}
.error-code {
  font-size: 5rem;
  font-weight: 800;
  margin: 0;
  background: linear-gradient(120deg, #fff, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.error-msg { color: var(--text-dim); margin: 8px 0 24px; }

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: 26px 16px;
  color: var(--text-dim);
  font-size: 0.85rem;
  background: rgba(20, 13, 42, 0.4);
  backdrop-filter: blur(10px);
}
.footer p { margin: 3px 0; }

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .bg-layer { transition: none; }
}

/* ============================================================
   第二期新增组件
   ============================================================ */

/* ---- 通知铃铛 / 主题切换 ---- */
.nav-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  font-size: 1.1rem;
  text-decoration: none;
  line-height: 1;
}
.bell-badge {
  position: absolute;
  top: -8px;
  right: -10px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #ff4d6d;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px rgba(20, 13, 42, 0.6);
}
.theme-toggle { cursor: pointer; }

/* ---- Markdown 正文 ---- */
.markdown-body { line-height: 1.7; word-break: break-word; }
.markdown-body h1,
.markdown-body h2,
.markdown-body h3 { margin: 0.6em 0 0.3em; line-height: 1.3; }
.markdown-body h1 { font-size: 1.35rem; }
.markdown-body h2 { font-size: 1.18rem; }
.markdown-body h3 { font-size: 1.05rem; }
.markdown-body p { margin: 0.5em 0; }
.markdown-body ul,
.markdown-body ol { margin: 0.5em 0; padding-left: 1.5em; }
.markdown-body li { margin: 0.2em 0; }
.markdown-body a { color: var(--accent, #b794f6); text-decoration: underline; }
.markdown-body code {
  padding: 1px 5px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.88em;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.markdown-body pre {
  margin: 0.6em 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.35);
  overflow-x: auto;
}
.markdown-body pre code { padding: 0; background: none; }
.markdown-body blockquote {
  margin: 0.6em 0;
  padding: 4px 14px;
  border-left: 3px solid var(--accent, #b794f6);
  color: var(--text-dim);
}

/* ---- 楼中楼回复 ---- */
.reply-list {
  margin: 0 0 18px 26px;
  padding-left: 14px;
  border-left: 2px solid rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.message-reply { background: rgba(255, 255, 255, 0.04); }
.reply-toggle {
  margin-top: 8px;
  background: none;
  border: none;
  color: var(--accent, #b794f6);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
}
.reply-form {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.reply-form textarea {
  width: 100%;
  resize: vertical;
}
.link-btn {
  background: none;
  border: none;
  color: var(--accent, #b794f6);
  cursor: pointer;
  padding: 0;
}
.badge-admin {
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--accent, #b794f6);
  color: #fff;
  font-size: 0.68rem;
  vertical-align: middle;
}
.btn-sm { padding: 5px 12px; font-size: 0.82rem; }

/* ---- 通知列表 ---- */
.notif-item { display: flex; flex-direction: column; gap: 4px; }
.notif-item.unread { border-left: 3px solid var(--accent, #b794f6); }
.notif-item.read { opacity: 0.7; }
.notif-title { font-weight: 600; }
.notif-meta { font-size: 0.78rem; color: var(--text-dim); }
