/* ========== CSS Variables ========== */
:root {
  --primary: #6366f1;
  --primary-light: #818cf8;
  --primary-dark: #4338ca;
  --accent: #ec4899;
  --bg: #0f172a;
  --bg-secondary: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.8);
  --text: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --border: rgba(148, 163, 184, 0.15);
  --glass: rgba(255, 255, 255, 0.05);
  --glass-hover: rgba(255, 255, 255, 0.1);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);
  --gradient: linear-gradient(135deg, #6366f1, #ec4899);
  --gradient-text: linear-gradient(135deg, #818cf8, #c084fc, #f472b6);
}

/* Light Theme */
[data-theme="light"] {
  --bg: #f8fafc;
  --bg-secondary: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.9);
  --text: #1e293b;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --border: rgba(0, 0, 0, 0.1);
  --glass: rgba(0, 0, 0, 0.02);
  --glass-hover: rgba(0, 0, 0, 0.05);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
}

/* ========== Reset & Base ========== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  transition: background 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
  line-height: 1.7;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ========== Canvas Background ========== */
#bgCanvas {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  z-index: -1;
  opacity: 0.6;
}

/* ========== Navbar ========== */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  padding: 0.8rem 0;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  transition: all 0.3s ease;
}

.navbar.scrolled {
  padding: 0.5rem 0;
  box-shadow: var(--shadow);
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}

.nav-logo i {
  color: var(--primary);
  font-size: 1.5rem;
  animation: pulse 2s infinite;
}

.logo-text {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  gap: 0.3rem;
}

.nav-links a {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all 0.3s ease;
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary-light);
  background: var(--glass-hover);
}

.nav-links a i { margin-right: 0.3rem; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-toggle,
.music-toggle,
.mobile-menu {
  width: 40px; height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--glass);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.theme-toggle:hover,
.music-toggle:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  transform: scale(1.05);
}

.mobile-menu { display: none; }

/* ========== Music Player ========== */
.music-player {
  position: fixed;
  top: 80px; right: 20px;
  width: 280px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem;
  z-index: 999;
  box-shadow: var(--shadow);
  transform: translateX(calc(100% + 30px));
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.music-player.active {
  transform: translateX(0);
  opacity: 1;
}

.music-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.8rem;
  font-weight: 600;
}

.music-close {
  background: none; border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  transition: color 0.3s;
}
.music-close:hover { color: var(--accent); }

.music-visualizer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 50px;
  margin-bottom: 0.8rem;
}

.music-visualizer .bar {
  width: 4px;
  height: 20px;
  background: var(--gradient);
  border-radius: 2px;
  animation: equalizer 1s ease-in-out infinite alternate;
}

.music-visualizer .bar:nth-child(1) { animation-delay: 0s; }
.music-visualizer .bar:nth-child(2) { animation-delay: 0.2s; }
.music-visualizer .bar:nth-child(3) { animation-delay: 0.4s; }
.music-visualizer .bar:nth-child(4) { animation-delay: 0.1s; }
.music-visualizer .bar:nth-child(5) { animation-delay: 0.3s; }

.music-info { text-align: center; margin-bottom: 0.8rem; }
.music-title { font-weight: 600; font-size: 0.95rem; }
.music-artist { font-size: 0.8rem; color: var(--text-muted); }

.music-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.music-controls button {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 1rem;
  transition: color 0.3s;
}

.music-controls .play-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.music-volume {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.music-volume input[type="range"] {
  flex: 1;
  -webkit-appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none;
}

.music-volume input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
}

.music-tip {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  text-align: center;
}

/* ========== Hero Section ========== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: 80px 1.5rem 0;
}

.hero-content {
  animation: fadeInUp 1s ease;
}

.hero-avatar {
  position: relative;
  width: 120px; height: 120px;
  margin: 0 auto 1.5rem;
}

.hero-avatar img {
  width: 100%; height: 100%;
  border-radius: 50%;
  border: 3px solid var(--primary);
}

.avatar-ring {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--primary);
  border-right-color: var(--accent);
  animation: spin 3s linear infinite;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.glitch {
  position: relative;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin-bottom: 2rem;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-num {
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.hero-scroll {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  animation: bounce 2s infinite;
  color: var(--text-muted);
  font-size: 1.5rem;
}

/* ========== Main Container ========== */
.main-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

.content-wrapper {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 2rem;
}

/* ========== Section Title ========== */
.section-title {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  padding-bottom: 0.8rem;
  border-bottom: 2px solid var(--border);
}

.section-title i {
  color: var(--primary);
  margin-right: 0.5rem;
}

/* ========== Post Cards ========== */
.post-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 1.5rem;
  transition: all 0.4s ease;
  display: flex;
  flex-direction: row;
}

.post-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-glow);
  border-color: var(--primary);
}

.post-cover {
  width: 220px;
  min-height: 180px;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: flex-start;
  padding: 1rem;
}

.post-category {
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  color: #fff;
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.post-body {
  padding: 1.2rem 1.5rem;
  flex: 1;
}

.post-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.post-title a {
  color: var(--text);
  transition: color 0.3s;
}

.post-title a:hover { color: var(--primary-light); }

.post-meta {
  display: flex;
  gap: 1.2rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
}

.post-meta span { display: flex; align-items: center; gap: 0.3rem; }

.post-excerpt {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 0.8rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-tags { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.tag {
  background: var(--glass);
  border: 1px solid var(--border);
  padding: 0.2rem 0.7rem;
  border-radius: 6px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  transition: all 0.3s;
  cursor: pointer;
}

.tag:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* ========== Pagination ========== */
.pagination {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 2rem;
}

.page-btn {
  width: 38px; height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.85rem;
  transition: all 0.3s;
}

.page-btn:hover,
.page-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.page-ellipsis { color: var(--text-muted); align-self: center; }

/* ========== Sidebar ========== */
.sidebar { display: flex; flex-direction: column; gap: 1.5rem; }

.side-card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.2rem;
  transition: all 0.3s;
}

.side-card:hover { border-color: var(--primary); }

.side-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.side-title i { color: var(--primary); margin-right: 0.4rem; }

/* Profile Card */
.profile-card {
  text-align: center;
  position: relative;
  overflow: hidden;
}

.profile-bg {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 70px;
  background: var(--gradient);
  opacity: 0.8;
}

.profile-avatar {
  width: 70px; height: 70px;
  border-radius: 50%;
  border: 3px solid var(--bg);
  margin: 1rem auto 0.5rem;
  position: relative;
  z-index: 1;
}

.profile-name { font-weight: 700; font-size: 1rem; }
.profile-bio { font-size: 0.8rem; color: var(--text-muted); margin: 0.3rem 0 0.8rem; }

.profile-social {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
}

.profile-social a {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--glass);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  transition: all 0.3s;
}

.profile-social a:hover {
  background: var(--primary);
  color: #fff;
  transform: translateY(-2px);
}

/* Category List */
.category-list li a {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0.7rem;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  transition: all 0.3s;
}

.category-list li a:hover {
  background: var(--glass-hover);
  color: var(--primary-light);
  padding-left: 1rem;
}

.category-list .count {
  background: var(--glass);
  padding: 0.1rem 0.5rem;
  border-radius: 10px;
  font-size: 0.72rem;
}

/* Tag Cloud */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.cloud-tag {
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
  opacity: 0.8;
}

.cloud-tag:hover {
  opacity: 1;
  transform: scale(1.15);
}

/* Recent List */
.recent-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.83rem;
}

.recent-list li:last-child { border-bottom: none; }

.recent-list a {
  color: var(--text-secondary);
  transition: color 0.3s;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.recent-list a:hover { color: var(--primary-light); }

.recent-list time {
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Comments */
.comment-item {
  display: flex;
  gap: 0.7rem;
  margin-bottom: 1rem;
}

.comment-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
}

.comment-content { flex: 1; }

.comment-author {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--primary-light);
}

.comment-content p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0.2rem 0;
}

.comment-content time {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.comment-form { margin-top: 1rem; }

.comment-form textarea {
  width: 100%;
  padding: 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--glass);
  color: var(--text);
  font-size: 0.85rem;
  resize: vertical;
  font-family: inherit;
  margin-bottom: 0.5rem;
}

.comment-form textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.comment-submit {
  width: 100%;
  padding: 0.6rem;
  border: none;
  border-radius: 8px;
  background: var(--gradient);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
}

.comment-submit:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

.comment-tip {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 0.5rem;
}

/* ========== Footer ========== */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 3rem 1.5rem 1rem;
  margin-top: 3rem;
}

.footer-container {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-col h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.footer-col h4 i { color: var(--primary); margin-right: 0.4rem; }

.footer-col p {
  font-size: 0.83rem;
  color: var(--text-muted);
}

.footer-col ul { display: flex; flex-direction: column; gap: 0.5rem; }

.footer-col ul a {
  font-size: 0.83rem;
  color: var(--text-muted);
  transition: color 0.3s;
}

.footer-col ul a:hover { color: var(--primary-light); }

.footer-col ul a i { margin-right: 0.4rem; }

.footer-bottom {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-tech { margin-top: 0.3rem; }

/* ========== Animations ========== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

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

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

@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateX(-50%) translateY(0); }
  40% { transform: translateX(-50%) translateY(-10px); }
  60% { transform: translateY(-5px); }
}

@keyframes equalizer {
  from { height: 10px; }
  to { height: 40px; }
}

/* ========== Responsive ========== */
@media (max-width: 900px) {
  .content-wrapper { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
  .post-card { flex-direction: column; }
  .post-cover { width: 100%; min-height: 120px; }
  .footer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .nav-links {
    position: fixed;
    top: 60px; left: 0; right: 0;
    flex-direction: column;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    transform: translateY(-150%);
    transition: transform 0.3s;
  }
  .nav-links.active { transform: translateY(0); }
  .mobile-menu { display: flex; }
  .hero-stats { gap: 1.5rem; }
  .music-player { right: 10px; left: 10px; width: auto; }
}
