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

:root {
  --primary: rgba(255, 255, 255, 0.18);
  --secondary: #D1C4E9;
  --accent: #FF80AB;
  --text: #ffffff;
  --text-light: rgba(255,255,255,0.82);
  --bg: rgba(20, 20, 40, 0.55);
  --bg-card: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 2px 12px rgba(0,0,0,0.1);
  --radius: 12px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-width: 1100px;
  --navbar-bg: rgba(255, 255, 255, 0.06);
  --code-bg: rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] {
  --primary: rgba(255, 255, 255, 0.06);
  --secondary: #2d2640;
  --accent: #FF80AB;
  --text: #ffffff;
  --text-light: rgba(255,255,255,0.65);
  --bg: rgba(0, 0, 0, 0.6);
  --bg-card: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.06);
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
  --navbar-bg: rgba(0, 0, 0, 0.25);
  --code-bg: rgba(0, 0, 0, 0.35);
}

html { scroll-behavior: smooth; }
.hidden { display: none !important; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}

body.has-bg {
  background-size: cover;
  background-attachment: fixed;
  background-position: center;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Navbar - 普通导航栏，不固定 */
.navbar {
  background: var(--navbar-bg);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 0 20px;
  height: 52px;
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text) !important;
  text-decoration: none !important;
  letter-spacing: -0.5px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--text-light);
  pointer-events: none;
}

#search-input {
  width: 200px;
  padding: 5px 12px 5px 30px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s, width 0.2s;
  backdrop-filter: blur(4px);
}

#search-input:focus { border-color: var(--accent); width: 260px; }

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s;
}

.icon-btn:hover { background: var(--primary); }
.icon-btn svg { width: 17px; height: 17px; }

/* Container */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 24px 20px;
  min-height: calc(100vh - 52px);
}

/* Search Results */
.search-results {
  position: absolute;
  top: 100%;
  right: 0;
  width: 280px;
  margin-top: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 60vh;
  overflow-y: auto;
  z-index: 99;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.search-results.hidden { display: none; }

.search-result-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:hover { background: var(--primary); }
.search-result-item:last-child { border-bottom: none; }
.search-result-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 2px; }
.search-result-snippet { font-size: 0.78rem; color: var(--text-light); }
.search-no-result { padding: 20px; text-align: center; color: var(--text-light); font-size: 0.85rem; }

/* Home Layout - Three Columns */
.home-three-col { display: flex; gap: 24px; align-items: flex-start; justify-content: center; }
.col-left { width: 200px; position: fixed; left: calc(50% - 580px); top: 50vh; transform: translateY(-50%); display: flex; flex-direction: column; gap: 12px; }
.col-center { flex: 0 1 680px; min-width: 0; margin: 0 auto; }
.col-right { width: 200px; position: fixed; right: calc(50% - 580px); top: 50vh; transform: translateY(-50%); display: flex; flex-direction: column; gap: 12px; }

/* Sidebar */
.sidebar-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  text-align: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid rgba(255,128,171,0.3);
  margin-bottom: 10px;
}

.avatar-placeholder {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--secondary));
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: #fff;
}

.sidebar-name { font-size: 1.05rem; font-weight: 600; margin-bottom: 4px; }
.sidebar-desc { font-size: 0.78rem; color: var(--text-light); }

.sidebar-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.sidebar-title {
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.category-list { list-style: none; }

.category-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s;
}

.category-item:hover, .category-item.active { background: var(--primary); color: var(--accent); }
.category-count { font-size: 0.72rem; background: var(--primary); padding: 1px 7px; border-radius: 10px; color: var(--text-light); }
.category-item.active .category-count { background: var(--accent); color: #fff; }

/* Contact */
.contact-list { font-size: 0.82rem; color: var(--text-light); }
.contact-item { margin-bottom: 6px; }
.contact-item a { color: var(--accent); }

/* Contact */
.contact-list { font-size: 0.82rem; color: var(--text-light); }
.contact-item { margin-bottom: 6px; }
.contact-item a { color: var(--accent); }

.tag-cloud { display: flex; flex-wrap: wrap; gap: 5px; }

.tag-chip {
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 0.78rem;
  background: var(--primary);
  color: var(--text-light);
  cursor: pointer;
  transition: all 0.15s;
  border: 1px solid transparent;
}

.tag-chip:hover, .tag-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.section-title {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 14px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--accent);
  display: inline-block;
}

.filter-info {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-clear { font-size: 0.78rem; color: var(--accent); cursor: pointer; }

/* Article Cards */
.article-list { display: grid; gap: 12px; }

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.article-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.article-card-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 6px; color: var(--text); }

.article-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-light);
}

.article-card-meta .tag {
  background: var(--primary);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.72rem;
}

/* Article Detail */
.article-header { margin-bottom: 28px; }
.article-header h1 { font-size: 1.6rem; font-weight: 700; margin-bottom: 10px; }
.article-meta { display: flex; flex-wrap: wrap; gap: 14px; font-size: 0.82rem; color: var(--text-light); }
.article-content {
  line-height: 1.9;
  background: #ffffff;
  color: #2c2c2c;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: var(--radius);
  padding: 36px 40px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
  font-size: 1.02rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* --- Typography --- */
.article-content h1, .article-content h2, .article-content h3 {
  margin-top: 2em;
  margin-bottom: 0.6em;
  font-weight: 700;
  color: #1a1a1a;
  position: relative;
}
.article-content h1 { font-size: 1.7rem; padding-bottom: 0.3em; border-bottom: 2px solid #f0f0f0; }
.article-content h2 {
  font-size: 1.35rem;
  padding-left: 14px;
  border-left: 4px solid #FF80AB;
}
.article-content h3 {
  font-size: 1.1rem;
  color: #444;
}
.article-content p { margin-bottom: 1.1em; }

/* --- Links --- */
.article-content a {
  color: #d81b60;
  text-decoration: none;
  background-image: linear-gradient(#FF80AB, #FF80AB);
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0% 2px;
  transition: background-size 0.3s ease, color 0.3s ease;
  padding-bottom: 2px;
}
.article-content a:hover {
  background-size: 100% 2px;
  color: #c2185b;
}

/* --- Images --- */
.article-content img {
  max-width: 100%;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  margin: 1.2em 0;
  display: block;
  transition: transform 0.3s ease;
}
.article-content img:hover { transform: scale(1.01); }

/* --- Blockquotes --- */
.article-content blockquote {
  border-left: 4px solid #FF80AB;
  padding: 16px 20px;
  margin: 1.5em 0;
  color: #555;
  background: linear-gradient(135deg, #fff5f8 0%, #fce4ec 100%);
  border-radius: 0 10px 10px 0;
  position: relative;
  font-style: italic;
}
.article-content blockquote::before {
  content: '\201C';
  font-size: 3rem;
  color: #FF80AB;
  opacity: 0.3;
  position: absolute;
  top: -8px;
  left: 10px;
  font-style: normal;
  line-height: 1;
}
.article-content blockquote p { margin-bottom: 0.5em; }
.article-content blockquote p:last-child { margin-bottom: 0; }

/* --- Code --- */
.article-content code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 0.85em;
}
.article-content :not(pre) > code {
  background: #fce4ec;
  color: #c2185b;
  padding: 2px 7px;
  border-radius: 5px;
  font-weight: 500;
  border: 1px solid rgba(255,128,171,0.2);
}
.article-content pre {
  background: #1e1e2e;
  border-radius: 10px;
  padding: 0;
  overflow-x: auto;
  margin: 1.5em 0;
  font-size: 0.85rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  border: 1px solid rgba(255,255,255,0.06);
  position: relative;
}
.article-content pre::before {
  content: '';
  display: block;
  height: 6px;
  background: linear-gradient(90deg, #FF80AB, #ce93d8, #90caf9);
  border-radius: 10px 10px 0 0;
}
.article-content pre code {
  display: block;
  padding: 16px 20px;
  color: #e0e0e0;
  background: transparent;
  line-height: 1.6;
}

/* --- Tables --- */
.article-content table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 1.5em 0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}
.article-content th, .article-content td {
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
}
.article-content th {
  background: linear-gradient(135deg, #FF80AB 0%, #f48fb1 100%);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.article-content tr:last-child td { border-bottom: none; }
.article-content tr:nth-child(even) { background: #fafafa; }
.article-content tr:hover td { background: #fff5f8; transition: background 0.2s; }

/* --- Lists --- */
.article-content ul, .article-content ol {
  padding-left: 1.5em;
  margin: 1em 0;
}
.article-content li { margin-bottom: 0.4em; }
.article-content ul > li::marker { color: #FF80AB; font-size: 1.1em; }
.article-content ol > li::marker { color: #FF80AB; font-weight: 700; }

/* --- Horizontal Rules --- */
.article-content hr {
  border: none;
  height: 2px;
  background: linear-gradient(90deg, transparent, #FF80AB, #ce93d8, #FF80AB, transparent);
  margin: 2.5em 0;
}

/* --- Dark Mode Article --- */
[data-theme="dark"] .article-content {
  background: rgba(30, 30, 46, 0.95);
  color: #d4d4d8;
  border-color: rgba(255,255,255,0.06);
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}
[data-theme="dark"] .article-content h1,
[data-theme="dark"] .article-content h2,
[data-theme="dark"] .article-content h3 { color: #f0f0f0; }
[data-theme="dark"] .article-content h1 { border-bottom-color: rgba(255,255,255,0.1); }
[data-theme="dark"] .article-content h3 { color: #bbb; }
[data-theme="dark"] .article-content blockquote {
  background: linear-gradient(135deg, rgba(255,128,171,0.08) 0%, rgba(206,147,216,0.08) 100%);
  color: #a0a0a8;
}
[data-theme="dark"] .article-content :not(pre) > code {
  background: rgba(255,128,171,0.15);
  color: #FF80AB;
  border-color: rgba(255,128,171,0.15);
}
[data-theme="dark"] .article-content pre {
  background: #0d0d1a;
  border-color: rgba(255,255,255,0.04);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
[data-theme="dark"] .article-content th {
  background: linear-gradient(135deg, #c2185b 0%, #ad1457 100%);
}
[data-theme="dark"] .article-content tr:nth-child(even) { background: rgba(255,255,255,0.03); }
[data-theme="dark"] .article-content tr:hover td { background: rgba(255,128,171,0.08); }
[data-theme="dark"] .article-content th, [data-theme="dark"] .article-content td { border-bottom-color: rgba(255,255,255,0.06); }
[data-theme="dark"] .article-content img { box-shadow: 0 4px 20px rgba(0,0,0,0.4); }

/* Zen Mode */
body.zen-mode { overflow: hidden; }
body.zen-mode #zen-toggle {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Article Layout */
.article-layout { display: flex; gap: 28px; }
.article-main { flex: 1; min-width: 0; }

.toc-sidebar {
  width: 200px;
  flex-shrink: 0;
  position: sticky;
  top: 60px;
  align-self: flex-start;
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: var(--radius);
  padding: 10px 12px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}

.toc-title { font-size: 0.82rem; font-weight: 600; color: #666; margin-bottom: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.toc-list { list-style: none; font-size: 0.78rem; }
.toc-list li { margin-bottom: 3px; }

.toc-list a {
  color: #666;
  display: block;
  padding: 2px 0 2px 10px;
  border-left: 2px solid transparent;
  transition: all 0.15s;
  text-decoration: none !important;
}

.toc-list a:hover, .toc-list a.active { color: #d81b60; border-left-color: #d81b60; }
.toc-list .toc-h3 { padding-left: 20px; }

/* TOC Dark Mode */
[data-theme="dark"] .toc-sidebar {
  background: rgba(30, 30, 46, 0.95);
  border-color: rgba(255,255,255,0.06);
}
[data-theme="dark"] .toc-title { color: #aaa; }
[data-theme="dark"] .toc-list a { color: #888; }
[data-theme="dark"] .toc-list a:hover, [data-theme="dark"] .toc-list a.active { color: #FF80AB; border-left-color: #FF80AB; }

/* Admin */
.admin-login { max-width: 380px; margin: 60px auto; text-align: center; }
.admin-login h2 { margin-bottom: 20px; }
.form-group { margin-bottom: 14px; text-align: left; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 500; margin-bottom: 5px; color: var(--text-light); }

.form-input {
  width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s;
  backdrop-filter: blur(4px);
}

.form-input:focus { border-color: var(--accent); }

select.form-input {
  appearance: auto;
  background: #1a1a2e;
  color: #fff;
}

select.form-input option {
  background: #1a1a2e;
  color: #fff;
  padding: 6px;
}

textarea.form-input {
  min-height: 400px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  resize: vertical;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 18px;
  border: none;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none !important;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-danger { background: #EF4444; color: #fff; }
.btn-danger:hover { opacity: 0.9; }
.btn-ghost { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--primary); }
.btn-sm { padding: 4px 11px; font-size: 0.78rem; }

.admin-panel h2 { margin-bottom: 20px; }

.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.admin-tab {
  padding: 8px 16px;
  border: none;
  background: transparent;
  color: var(--text-light);
  font-size: 0.85rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  margin-bottom: -1px;
}

.admin-tab:hover { color: var(--text); }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }

.admin-article-info { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.admin-tag { font-size: 0.68rem; background: var(--primary); color: var(--text-light); padding: 1px 7px; border-radius: 10px; }

.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}

.modal-overlay.hidden { display: none; }

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  min-width: 340px;
  max-width: 90vw;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.modal-box h3 { margin-bottom: 16px; font-size: 1rem; }
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }

.meta-tags-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.meta-tag-check { font-size: 0.82rem; color: var(--text); cursor: pointer; }
.meta-tag-check input { margin-right: 4px; }

/* Category/Tag management */
.cat-tag-section { margin-bottom: 24px; }
.cat-tag-section h3 { font-size: 0.95rem; margin-bottom: 10px; }
.cat-tag-add { display: flex; gap: 8px; margin-bottom: 10px; }
.cat-tag-add .form-input { flex: 1; }
.cat-tag-list { display: flex; flex-direction: column; gap: 6px; }
.cat-tag-item { display: flex; align-items: center; justify-content: space-between; padding: 6px 12px; background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; font-size: 0.85rem; }

/* Background manager */
.bg-manager h3 { font-size: 0.95rem; margin-bottom: 12px; }
.bg-slots { display: flex; gap: 12px; flex-wrap: wrap; }
.bg-slot { width: 140px; border: 2px solid var(--border); border-radius: 8px; overflow: hidden; position: relative; }
.bg-slot.active { border-color: var(--accent); }
.bg-slot-preview { width: 100%; height: 90px; object-fit: cover; display: block; }
.bg-slot-empty { width: 100%; height: 90px; display: flex; align-items: center; justify-content: center; background: var(--primary); color: var(--text-light); font-size: 0.78rem; }
.bg-slot-actions { display: flex; gap: 4px; padding: 6px; justify-content: center; }
.bg-slot-num { position: absolute; top: 4px; right: 4px; background: rgba(0,0,0,0.5); color: #fff; font-size: 0.68rem; width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }

.admin-tools { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }

.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  transition: border-color 0.2s;
  cursor: pointer;
  background: var(--bg-card);
  backdrop-filter: blur(4px);
}

.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); }
.upload-zone input[type="file"] { display: none; }

.admin-article-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  background: var(--bg-card);
  backdrop-filter: blur(4px);
}

.admin-article-item .title { font-weight: 500; font-size: 0.9rem; }
.admin-article-actions { display: flex; gap: 6px; }
.editor-actions { display: flex; gap: 8px; margin-top: 10px; }

.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.setting-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  background: var(--bg-card);
  text-align: center;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.setting-card h3 { font-size: 0.9rem; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; }

.setting-preview {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  margin: 0 auto 10px;
}

.setting-preview-bg {
  width: 100%;
  height: 500px;
  border-radius: 8px;
  object-fit: cover;
  border: 2px solid var(--border);
  margin-bottom: 10px;
}

.setting-placeholder {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--primary);
  margin: 0 auto 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 0.78rem;
}

.setting-placeholder-bg {
  width: 100%;
  height: 300px;
  border-radius: 8px;
  background: var(--primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 0.78rem;
}

.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 0.82rem; color: var(--text-light); margin-bottom: 20px; }
.back-link:hover { color: var(--accent); }

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-light); }
.empty-state svg { width: 56px; height: 56px; margin-bottom: 12px; opacity: 0.4; }

.footer {
  text-align: center;
  padding: 28px 20px 16px;
  font-size: 0.78rem;
  color: var(--text-light);
}

.footer a { color: var(--text-light); }
.footer a:hover { color: var(--accent); }
.footer .icp { margin-top: 5px; }

.toast {
  position: fixed;
  bottom: 80px;
  right: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 18px;
  box-shadow: var(--shadow);
  font-size: 0.82rem;
  z-index: 200;
  animation: slideIn 0.3s ease;
  backdrop-filter: blur(6px);
}

.toast.success { border-left: 3px solid #10B981; }
.toast.error { border-left: 3px solid #EF4444; }

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

/* Video Background */
.bg-video {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
}

.bg-video.hidden { display: none; }

/* Music Player */
.music-player {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 150;
  transition: all 0.3s ease;
}

.music-player.hidden { display: none; }

/* 展开状态 */
.music-player.expanded {
  width: 160px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
}

/* 缩小状态 */
.music-player.mini {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 4px 20px rgba(255,128,171,0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.music-player.mini:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(255,128,171,0.5);
}

.music-player.mini .music-expanded-view { display: none; }
.music-player.mini .music-mini-view { display: flex; }
.music-player.expanded .music-expanded-view { display: block; }
.music-player.expanded .music-mini-view { display: none; }

.music-mini-view {
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.music-mini-view svg {
  color: #fff;
  width: 18px;
  height: 18px;
}

.music-mini-view.playing svg {
  animation: music-spin 3s linear infinite;
}

@keyframes music-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.music-expanded-view { padding: 0; }

.music-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 10px 6px;
}

.music-cover {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.music-cover.playing { animation: pulse 2s ease-in-out infinite; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.music-cover svg { color: #fff; width: 16px; height: 16px; }

.music-meta { flex: 1; min-width: 0; }

.music-title {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.music-artist {
  font-size: 0.65rem;
  color: var(--text-light);
}

.music-minimize-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
}

.music-minimize-btn:hover { background: var(--primary); color: var(--text); }
.music-minimize-btn svg { width: 12px; height: 12px; }

.music-progress { padding: 0 10px; margin-bottom: 2px; }

.progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,0.15);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0%;
  transition: width 0.2s linear;
}

.progress-bar:hover { height: 5px; }
.progress-bar:hover .progress-fill { height: 5px; }

.music-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 10px 10px;
}

.music-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s;
}

.music-btn:hover { background: var(--primary); color: var(--accent); }

.music-btn-play {
  width: 30px;
  height: 30px;
  background: var(--accent);
  color: #fff !important;
  margin: 0 4px;
}

.music-btn-play:hover { opacity: 0.85; background: var(--accent); }

.music-btn-list { margin-left: auto; }

.music-playlist {
  max-height: 140px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.music-playlist.hidden { display: none; }

.playlist-item {
  padding: 6px 10px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
}

.playlist-item:hover { background: var(--primary); }
.playlist-item.active { color: var(--accent); font-weight: 600; }
.playlist-item .play-icon { width: 12px; height: 12px; flex-shrink: 0; }

/* Music admin */
.music-upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
  margin-bottom: 10px;
  background: var(--bg-card);
}

.music-upload-zone:hover { border-color: var(--accent); }

.music-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-bottom: 5px;
  background: var(--bg-card);
  font-size: 0.82rem;
}

/* Image Gallery */
.image-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.image-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card);
  backdrop-filter: blur(4px);
  transition: transform 0.2s;
}

.image-item:hover { transform: translateY(-2px); }

.image-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.image-actions {
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  justify-content: center;
}

.image-name {
  padding: 0 8px 6px;
  font-size: 0.7rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
}

.btn-xs { padding: 2px 8px; font-size: 0.72rem; }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  flex-wrap: wrap;
}

.pagination .page-btn { min-width: 34px; }
.pagination .page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 768px) {
  .home-layout { flex-direction: column; }
  .home-sidebar { width: 100%; display: flex; gap: 12px; flex-wrap: wrap; }
  .home-sidebar .sidebar-card { flex: 1; min-width: 180px; }
  .home-sidebar .sidebar-section { flex: 1; min-width: 180px; }
  .toc-sidebar { display: none; }
  .article-layout { flex-direction: column; }
  #search-input { width: 140px; }
  #search-input:focus { width: 180px; }
  .container { padding: 16px; }
  .search-results { width: 240px; }
}

@media (max-width: 480px) {
  .home-sidebar { flex-direction: column; }
  .admin-tools { flex-direction: column; }
  .settings-grid { grid-template-columns: 1fr; }
  .music-player { width: calc(100% - 32px); right: 16px; bottom: 16px; }
}

/* 163 Music Player */
.music-player.netease-mode {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 150;
  background: transparent;
  border: none;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  width: 330px;
  height: auto;
}

.music-163-container {
  position: relative;
  display: block;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

.music-163-close {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 10;
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.music-163-container:hover .music-163-close {
  opacity: 1;
}

.music-163-close:hover {
  background: rgba(0,0,0,0.8);
}

.music-163-close svg {
  width: 12px;
  height: 12px;
}

.music-163-container iframe,
.music-163-container embed {
  border: none;
  display: block;
  width: 330px;
  height: 450px;
}

/* 163 re-open toggle */
.music-163-toggle {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 150;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 4px 20px rgba(255,128,171,0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  color: #fff;
  transition: all 0.3s ease;
}

.music-163-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(255,128,171,0.5);
}

.music-163-toggle svg {
  width: 18px;
  height: 18px;
}

@media (max-width: 480px) {
  .music-player.netease-mode {
    left: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
  }
  .music-163-container iframe {
    width: 100%;
  }
}

/* ===== Custom 163 API Player ===== */
.nc-player {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 160;
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
  transition: opacity 0.3s, transform 0.3s;
}

.nc-player.nc-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
}

.nc-player-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 8px;
}

.nc-cover-wrap {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #7c3aed);
  position: relative;
}

.nc-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.nc-cover.nc-spinning {
  animation: nc-spin 8s linear infinite;
}

@keyframes nc-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.nc-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.nc-cover-placeholder svg {
  width: 20px;
  height: 20px;
}

.nc-info {
  flex: 1;
  min-width: 0;
}

.nc-title {
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}

.nc-artist {
  font-size: 0.72rem;
  color: var(--text-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.nc-close {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-light);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.nc-close:hover {
  background: var(--primary);
  color: var(--text);
}

.nc-close svg {
  width: 13px;
  height: 13px;
}

/* Progress */
.nc-progress {
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nc-progress-bar {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.nc-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  width: 0;
  transition: width 0.1s linear;
}

.nc-time {
  font-size: 0.65rem;
  color: var(--text-light);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Controls */
.nc-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px 10px;
}

.nc-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.nc-btn:hover {
  background: var(--primary);
  color: var(--accent);
}

.nc-btn svg {
  width: 16px;
  height: 16px;
}

.nc-play-btn {
  width: 36px;
  height: 36px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
}

.nc-play-btn:hover {
  opacity: 0.85;
  background: var(--accent);
  color: #fff;
}

.nc-play-btn svg {
  width: 18px;
  height: 18px;
}

.nc-list-btn {
  margin-left: auto;
}

.nc-volume-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nc-volume {
  width: 48px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

.nc-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

/* Playlist */
.nc-playlist {
  max-height: 240px;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
}

.nc-playlist.hidden { display: none; }

.nc-playlist::-webkit-scrollbar { width: 4px; }
.nc-playlist::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.nc-pl-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background 0.15s;
  font-size: 0.78rem;
}

.nc-pl-item:hover {
  background: var(--primary);
}

.nc-pl-item.active {
  background: var(--primary);
  color: var(--accent);
}

.nc-pl-num {
  width: 20px;
  text-align: center;
  color: var(--text-light);
  font-size: 0.7rem;
  flex-shrink: 0;
}

.nc-pl-item.active .nc-pl-num {
  color: var(--accent);
}

.nc-pl-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nc-pl-artist {
  color: var(--text-light);
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 80px;
  flex-shrink: 0;
}

.nc-pl-dur {
  color: var(--text-light);
  font-size: 0.7rem;
  flex-shrink: 0;
}

/* Mobile */
@media (max-width: 480px) {
  .nc-player {
    left: 8px;
    right: 8px;
    bottom: 8px;
    width: auto;
  }
  .nc-volume-wrap { display: none; }
}
