/* ===== Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.8;
  color: #333;
  background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 50%, #fecfef 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: #ff6b9d; text-decoration: none; }
a:hover { color: #c44569; }

/* ===== Reading progress bar ===== */
.reading-progress {
  position: fixed; top: 0; left: 0; height: 3px;
  background: linear-gradient(90deg, #ff9a9e, #c44569);
  z-index: 10002; width: 0%; transition: width 0.1s linear;
  box-shadow: 0 0 8px rgba(255,154,158,0.6);
}
body.dark-mode .reading-progress { background: linear-gradient(90deg, #667eea, #764ba2); box-shadow: 0 0 8px rgba(102,126,234,0.6); }

/* ===== Dot grid ===== */
.dot-grid {
  position: fixed; top: -15px; left: -15px; width: calc(100% + 30px); height: calc(100% + 30px);
  pointer-events: none; z-index: 0;
  background-image: radial-gradient(circle, rgba(255, 182, 193, 0.4) 1px, transparent 1px);
  background-size: 30px 30px; opacity: 0.5;
}

/* ===== Particles ===== */
.particles { position: fixed; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; overflow: hidden; }
.particle {
  position: absolute; width: 8px; height: 8px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%; opacity: 0.2; animation: float 18s infinite linear;
}
.particle:nth-child(1) { left: 8%;  animation-delay: 0s; }
.particle:nth-child(2) { left: 18%; animation-delay: 3s; }
.particle:nth-child(3) { left: 28%; animation-delay: 6s; }
.particle:nth-child(4) { left: 38%; animation-delay: 1s; }
.particle:nth-child(5) { left: 48%; animation-delay: 9s; }
.particle:nth-child(6) { left: 58%; animation-delay: 4s; }
.particle:nth-child(7) { left: 68%; animation-delay: 7s; }
.particle:nth-child(8) { left: 78%; animation-delay: 2s; }
@keyframes float {
  0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
  5% { opacity: 0.2; }
  95% { opacity: 0.2; }
  100%{ transform: translateY(-100vh) rotate(720deg); opacity: 0; }
}

/* ===== Header ===== */
.site-header {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 2px solid rgba(255, 154, 158, 0.3);
  padding: 0 40px;
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
}
.site-title { font-size: 1.4em; font-weight: 700; }
.site-title a {
  background: linear-gradient(135deg, #ff9a9e, #fecfef);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.nav-links { display: flex; gap: 30px; list-style: none; }
.nav-links a { color: #666; font-weight: 500; font-size: 0.95em; }
.nav-links a:hover { color: #ff6b9d; }

/* ===== Main content ===== */
.container { max-width: 860px; margin: 60px auto; padding: 0 30px; position: relative; z-index: 1; }

/* ===== Article ===== */
.article-card {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  border-radius: 20px;
  padding: 60px;
  margin-bottom: 40px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.08);
}
.article-header { margin-bottom: 40px; padding-bottom: 30px; border-bottom: 2px solid rgba(255, 154, 158, 0.15); }
.article-title {
  font-size: 2.2em; margin-bottom: 15px; color: #222;
  background: linear-gradient(135deg, #ff9a9e, #fecfef);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  font-weight: 800; letter-spacing: -0.02em;
}
.article-meta { color: #888; font-size: 0.9em; display: flex; gap: 20px; flex-wrap: wrap; }
.article-meta span { display: flex; align-items: center; gap: 6px; }
.tag {
  display: inline-block; padding: 3px 12px; border-radius: 20px; font-size: 0.82em;
  background: rgba(255, 154, 158, 0.15); color: #c44569; font-weight: 600;
}
.article-content h2 {
  font-size: 1.4em; margin: 40px 0 15px; padding-bottom: 10px;
  border-bottom: 2px solid rgba(255, 154, 158, 0.2); color: #333;
  font-weight: 700;
}
.article-content h3 { font-size: 1.15em; margin: 28px 0 12px; color: #444; font-weight: 700; }
.article-content p { margin: 14px 0; color: #555; line-height: 1.85; }
.article-content ul, .article-content ol { padding-left: 25px; margin: 14px 0; }
.article-content li { margin: 8px 0; color: #555; line-height: 1.7; }
.article-content table { width: 100%; border-collapse: collapse; margin: 20px 0; font-size: 0.93em; }
.article-content th, .article-content td { padding: 10px 15px; border: 1px solid #eee; text-align: left; }
.article-content th { background: rgba(255, 154, 158, 0.1); font-weight: 700; color: #333; }
.article-content tr:nth-child(even) { background: rgba(255, 154, 158, 0.04); }

/* ===== Code blocks ===== */
.article-content code {
  font-family: "SF Mono", "Fira Code", "Cascadia Code", Consolas, Monaco, monospace;
  background: rgba(255, 154, 158, 0.1);
  padding: 2px 7px; border-radius: 5px; font-size: 0.88em; color: #c44569;
}
.article-content pre {
  background: #2d2d2d; border-radius: 12px; padding: 20px 24px;
  overflow-x: auto; margin: 20px 0; position: relative;
}
.article-content pre code {
  background: none; padding: 0; font-size: 0.9em; color: #f8f8f2; line-height: 1.7;
}
.article-content pre::before {
  content: ""; display: block; height: 1px;
}

/* ===== Back link ===== */
.back-link {
  display: inline-block; margin-bottom: 20px; color: #c44569;
  font-weight: 600; transition: all 0.2s; font-size: 0.92em;
}
.back-link:hover { color: #ff6b9d; transform: translateX(-5px); }

/* ===== Like Button ===== */
.like-section { text-align: center; margin: 40px 0; padding: 20px; border-top: 1px solid rgba(255,154,158,0.2); }
.like-btn {
  background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 100%);
  color: white; border: none; border-radius: 50px; padding: 12px 30px; font-size: 1em;
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
  transition: all 0.3s ease; font-weight: 600;
  box-shadow: 0 4px 15px rgba(255, 154, 158, 0.3);
}
.like-btn:hover { transform: scale(1.05) translateY(-2px); box-shadow: 0 8px 25px rgba(255, 154, 158, 0.4); }
.like-btn.liked { background: linear-gradient(135deg, #ff6b9d, #c44569); }
.like-btn .heart { font-size: 1.2em; }

/* ===== Comments ===== */
.comments-section { margin-top: 50px; padding-top: 30px; border-top: 2px solid rgba(255,154,158,0.2); }

/* ===== Dark toggle ===== */
.dark-toggle {
  position: fixed; bottom: 24px; left: 24px; z-index: 10001;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(255, 154, 158, 0.35);
  cursor: pointer; font-size: 1.2em; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(196,69,105,0.15); transition: all 0.3s ease;
}
.dark-toggle:hover { background: linear-gradient(135deg, #ff9a9e, #fecfef); transform: scale(1.1); color: white; }

/* ===== Scroll to top ===== */
.scroll-top {
  position: fixed; bottom: 24px; right: 24px; z-index: 10001;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid rgba(255, 154, 158, 0.35);
  color: #c44569; font-size: 1.2em; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(196,69,105,0.15); opacity: 0; pointer-events: none;
  transition: all 0.3s ease;
}
.scroll-top.visible { opacity: 1; pointer-events: auto; }
.scroll-top:hover { background: linear-gradient(135deg, #ff9a9e, #fecfef); transform: scale(1.1); color: white; }

/* ===== Language Switcher ===== */
.lang-switcher { position: fixed; top: 16px; right: 20px; z-index: 1000; display: flex; gap: 6px; }
.lang-btn {
  background: rgba(255,255,255,0.9); border: 2px solid rgba(255,154,158,0.3);
  border-radius: 20px; padding: 5px 14px; font-size: 0.82em;
  font-weight: 700; cursor: pointer; color: #c44569; transition: all 0.2s;
}
.lang-btn:hover, .lang-btn.active {
  background: linear-gradient(135deg, #ff9a9e, #fecfef); color: white; border-color: transparent;
}

/* ===== Dark Mode ===== */
body.dark-mode { background: #12122a !important; color: #e8e4f0; }
body.dark-mode a { color: #ff9a9e; }
body.dark-mode a:hover { color: #ff6b9d; }
body.dark-mode .dot-grid { opacity: 0.04; }
body.dark-mode .particle { opacity: 0.08; }

body.dark-mode .site-header {
  background: rgba(20, 20, 42, 0.92) !important;
  border-bottom-color: rgba(255, 154, 158, 0.15);
}
body.dark-mode .article-card,
body.dark-mode .feature-card,
body.dark-mode .link-item,
body.dark-mode .quick-links,
body.dark-mode .profile-card,
body.dark-mode .hero {
  background: rgba(37, 37, 64, 0.92) !important;
  border: 1px solid rgba(255, 154, 158, 0.15) !important;
  color: #e8e4f0;
}
body.dark-mode .article-content { color: #e0dcf0; }
body.dark-mode .article-content h2,
body.dark-mode .article-content h3,
body.dark-mode .article-content p,
body.dark-mode .article-content li,
body.dark-mode .article-content td {
  color: #d0cce8 !important;
}
body.dark-mode .article-title {
  background: linear-gradient(135deg, #ff9a9e, #fecfef);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
body.dark-mode .article-meta { color: #9b96b0; }
body.dark-mode .tag { background: rgba(255,154,158,0.15); color: #ff9a9e; }
body.dark-mode .article-content th { background: rgba(255,154,158,0.1); color: #ff9a9e; }
body.dark-mode .article-content td { border-color: rgba(255,154,158,0.1); color: #d0cce8; }
body.dark-mode .article-content tr:nth-child(even) { background: rgba(255,154,158,0.05); }
body.dark-mode .article-content pre { background: #1a1a2e; }
body.dark-mode .article-content pre code { color: #e8e4f0; }
body.dark-mode .article-content code { background: rgba(255,154,158,0.15); color: #ff9a9e; }
body.dark-mode .dark-toggle { background: rgba(37,37,64,0.92); border-color: rgba(255,154,158,0.2); }
body.dark-mode .scroll-top { background: rgba(37,37,64,0.92); border-color: rgba(255,154,158,0.2); color: #ff9a9e; }
body.dark-mode .back-link { color: #ff9a9e; }
body.dark-mode .site-title a {
  background: linear-gradient(135deg, #ff9a9e, #fecfef);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
body.dark-mode .nav-links a { color: #9b96b0; }
body.dark-mode .nav-links a:hover { color: #ff6b9d; }
body.dark-mode .like-btn { background: linear-gradient(135deg, #ff9a9e, #fecfef); color: white; }
body.dark-mode .like-btn.liked { background: linear-gradient(135deg, #ff6b9d, #c44569); }

/* ===== Mobile Responsive ===== */
@media (max-width: 768px) {
  .site-header {
    padding: 0 16px !important;
    flex-direction: column !important;
    gap: 10px;
    position: relative !important;
  }
  .site-title { font-size: 1.2em !important; }
  .nav-links { gap: 16px !important; flex-wrap: wrap; justify-content: center; }

  .container { margin: 30px auto !important; padding: 0 16px !important; }
  .article-card { padding: 28px 20px !important; border-radius: 16px !important; }
  .article-title { font-size: 1.7em !important; }
  .article-content { font-size: 0.92em !important; line-height: 1.75 !important; }
  .article-content h2 { font-size: 1.25em !important; }
  .article-content h3 { font-size: 1.05em !important; }
  .article-content pre { font-size: 0.82em !important; padding: 14px !important; border-radius: 10px !important; overflow-x: auto; }
  .article-content table { font-size: 0.82em !important; }
  .article-header { margin-bottom: 24px !important; padding-bottom: 20px !important; }
  .article-meta { gap: 10px !important; font-size: 0.8em !important; }

  .dark-toggle, .scroll-top { width: 38px !important; height: 38px !important; font-size: 1em !important; bottom: 16px !important; }
  .dark-toggle { left: 16px !important; }
  .scroll-top { right: 16px !important; }
  .back-link { font-size: 0.85em !important; padding: 8px 16px !important; margin-bottom: 16px !important; }
  .like-btn { padding: 10px 24px !important; font-size: 0.9em !important; }
  .reading-progress { height: 2px !important; }
}
@media (max-width: 480px) {
  .article-content pre { padding: 12px !important; font-size: 0.78em !important; }
  .article-card { padding: 20px 14px !important; }
}