@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;600;700&display=swap");

@font-face {
  font-family: "myfont";
  src: url("/fonts/myfont.ttf");
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  letter-spacing: 0.2px;
}

main.article-main > *:not(:last-child, #category-list),
main.article-main > article > *:not(:last-child, #category-list) {
  margin-bottom: 1.5rem !important;
}

:root {
  --ff: "SF Mono", "JetBrains Mono", myfont, "微软雅黑", "Microsoft YaHei",
    system-ui, -apple-system;
  --ff-mono: var(--ff);
  --ff-serif: var(--ff);

  --main-width: 1200px;

  /* Premium Light Color System (2025 Design) - Warm Natural Theme */
  --bg-primary: #fefdfb; /* Warm white base */
  --bg-secondary: #faf9f7; /* Soft cream background */
  --bg-tertiary: #f5f3f0; /* Natural section background */
  --bg-card: #fefdfb; /* Elevated surfaces */

  /* Surface Colors - Natural warm surfaces */
  --surface-primary: rgba(139, 92, 246, 0.06);
  --surface-secondary: rgba(139, 92, 246, 0.09);
  --surface-tertiary: rgba(139, 92, 246, 0.12);
  --surface-hover: rgba(139, 92, 246, 0.15);
  --surface-active: rgba(139, 92, 246, 0.18);

  /* Premium Text Colors (Warm and natural) */
  --text-primary: #1a1612; /* Deep warm black */
  --text-secondary: #44403c; /* Warm gray */
  --text-tertiary: #57534e; /* Medium warm gray */
  --text-quaternary: #78716c; /* Light warm gray */
  --text-muted: #a8a29e; /* Muted warm gray */
  --text-disabled: #d6d3d1; /* Very light warm gray */

  /* Modern Accent Colors - Purple & Warm focused */
  --accent-primary: #8b5cf6; /* Violet 500 */
  --accent-secondary: #7c3aed; /* Violet 600 */
  --accent-tertiary: #6d28d9; /* Violet 700 */
  --accent-gold: #f59e0b; /* Amber 500 */
  --accent-emerald: #10b981; /* Emerald 500 */
  --accent-rose: #f43f5e; /* Rose 500 */
  --accent-cyan: #06b6d4; /* Cyan 500 */
  --accent-orange: #f97316; /* Orange 500 */

  /* Modern Gradients (warm natural theme) */
  --gradient-primary: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
  --gradient-secondary: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  --gradient-accent: linear-gradient(135deg, #6d28d9 0%, #5b21b6 100%);
  --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  --gradient-cool: linear-gradient(135deg, #06b6d4 0%, #8b5cf6 100%);
  --gradient-bg: linear-gradient(135deg, #fefdfb 0%, #faf9f7 50%, #f5f3f0 100%);

  /* Modern Glass Effects (warm theme) */
  --glass-bg: rgba(254, 253, 251, 0.85);
  --glass-border: rgba(139, 92, 246, 0.15);
  --glass-hover: rgba(250, 249, 247, 0.95);

  /* Modern Shadow System (warm natural theme) */
  --shadow-xs: 0 1px 2px rgba(26, 22, 18, 0.04);
  --shadow-sm: 0 1px 3px rgba(26, 22, 18, 0.08), 0 1px 2px rgba(26, 22, 18, 0.04);
  --shadow-md: 0 4px 6px rgba(26, 22, 18, 0.06), 0 2px 4px rgba(26, 22, 18, 0.04);
  --shadow-lg: 0 10px 15px rgba(26, 22, 18, 0.08), 0 4px 6px rgba(26, 22, 18, 0.03);
  --shadow-xl: 0 20px 25px rgba(26, 22, 18, 0.08), 0 10px 10px rgba(26, 22, 18, 0.02);
  --shadow-2xl: 0 25px 50px rgba(26, 22, 18, 0.12);
  --shadow-premium: 0 40px 60px -20px rgba(26, 22, 18, 0.15);

  /* Modern Glow Effects (violet theme) */
  --glow-subtle: 0 0 24px rgba(139, 92, 246, 0.12);
  --glow-accent: 0 0 32px rgba(139, 92, 246, 0.16);
  --glow-premium: 0 0 40px rgba(139, 92, 246, 0.2);

  /* Premium Animation Easing */
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-in-out-quart: cubic-bezier(0.76, 0, 0.24, 1);
  --ease-spring: cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* Interactive Background */
#interactive-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  background: var(--gradient-bg);
  background-attachment: fixed;
}

/* Premium Body Styles */
body {
  width: 100%;
  font-family: var(--ff);
  line-height: 1.6;
  font-size: 1rem;
  color: var(--text-secondary);
  background: var(--gradient-bg);
  background-attachment: fixed;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  position: relative;
  min-height: 100vh;
  padding: 10px;
  box-sizing: border-box;
  overflow: hidden;
}

html {
  scroll-behavior: smooth;
}

/* Premium Home Button */
.home-button {
  position: fixed;
  top: 32px;
  left: 32px;
  color: var(--text-primary);
  border: none;
  padding: 0;
  border-radius: 20px;
  cursor: pointer;
  text-decoration: none;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.6s var(--ease-out-quart);
  outline: none;
  width: 56px;
  height: 56px;
  overflow: hidden;
  background: var(--glass-bg);
  box-shadow: var(--shadow-premium);
  backdrop-filter: blur(40px);
  border: 1px solid var(--glass-border);
}

.home-button::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.12) 0%,
    rgba(124, 58, 237, 0.06) 100%
  );
  border-radius: 20px;
  opacity: 0;
  transition: opacity 0.6s var(--ease-out-quart);
  pointer-events: none;
}

.home-button::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: var(--gradient-primary);
  background-size: 400% 400%;
  border-radius: 18px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s var(--ease-out-quart);
  animation: gradientShift 4s ease-in-out infinite;
}

@keyframes gradientShift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.to-top {
  top: unset;
  bottom: 20px;
  left: unset;
  right: 20px;
}

.home-button svg {
  width: 22px;
  height: 22px;
  display: block;
  transition: transform 0.3s ease;
  filter: drop-shadow(0 0 8px rgba(102, 126, 234, 0.3));
}

.home-button:hover,
.home-button:focus {
  transform: translateY(-8px) scale(1.08);
  color: var(--text-primary);
  background: var(--glass-hover);
  box-shadow: var(--shadow-2xl), var(--glow-subtle);
}

.home-button:hover::before {
  opacity: 1;
}

.home-button:hover::after {
  opacity: 1;
}

.home-button:hover svg {
  transform: scale(1.3) rotate(5deg);
  filter: drop-shadow(0 0 12px rgba(102, 126, 234, 0.5));
}

.home-button:active {
  transform: translateY(-3px) scale(1.02);
  transition-duration: 0.1s;
}

.home-button:focus {
  outline: 2px solid rgba(102, 126, 234, 0.4);
  outline-offset: 4px;
}

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--accent-secondary);
  color: var(--bg-primary);
  border: none;
  padding: 10px 15px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  display: none;
  border-radius: 12px;
  box-shadow: var(--shadow-md), var(--glow-accent);
}

.theme-toggle:hover {
  background: var(--accent-primary);
  box-shadow: var(--shadow-lg), var(--glow-accent);
}

/* Header */
header {
  text-align: center;
  padding-bottom: 32px;
  margin-bottom: 40px;
  position: relative;
}

header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 2px;
  box-shadow: var(--glow-subtle);
}

header h1 {
  margin: 0 0 24px 0 !important;
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  position: relative;
  display: inline-block;
  color: var(--text-primary);
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: all 0.6s var(--ease-out-quart);
  cursor: pointer;
  user-select: none;
  max-width: 90%;
  font-family: var(--ff-serif);
}

header h1:hover {
  transform: translateY(-2px) scale(1.02);
  filter: drop-shadow(0 4px 12px rgba(34, 197, 94, 0.5));
}

header h1:active {
  transform: translateY(0) scale(0.98);
  transition-duration: 0.1s;
}

header p {
  font-size: 1rem;
  color: var(--text-tertiary);
  font-weight: 500;
  letter-spacing: 0.5px;
}

.home-articles-list .article-date {
  font-size: 0.8em;
  color: var(--text-muted);
  margin-left: 0.5em;
  font-weight: normal;
}

/* Optimized time element styling */
.home-articles-list .time {
  font-size: 0.85rem;
  color: var(--accent-primary);
  font-weight: 500;
  margin-left: 8px;
  padding: 3px 8px;
  border-radius: 12px;
  background: var(--surface-primary);
  transition: all 0.3s var(--ease-out-quart);
  display: inline-block;
  border: 1px solid transparent;
  box-shadow: var(--shadow-xs);
}

.home-articles-list .category {
  margin-left: 0;
  margin-right: 8px;
  font-weight: 500;
}

.home-articles-list li:hover .time {
  background: var(--surface-secondary);
  color: var(--accent-secondary);
  border-color: var(--glass-border);
  box-shadow: var(--shadow-sm), var(--glow-subtle);
  transform: translateY(-1px);
}

main a:not(.website-card) {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s var(--ease-out-quart);
  position: relative;
}

main blockquote {
  padding: 1.5rem 2rem;
  background: var(--glass-bg);
  border-left: 4px solid var(--accent-primary);
  border-radius: 16px;
  color: var(--text-secondary);
  position: relative;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
}

main blockquote p {
  margin-bottom: 0;
}

main hr {
  display: none;
  height: 1px;
  border: 0;
  border-top: 1px solid var(--glass-border);
  margin: 2rem 0;
  padding: 0;
  position: relative;
}

main hr::after {
  content: "§";
  display: inline-block;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(90deg);
  background: var(--bg-primary);
  padding: 0 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Premium Inline Code */
p code,
li code,
td code,
h1 code,
h2 code,
h3 code,
h4 code {
  font-family: var(--ff-mono);
  background: var(--surface-tertiary);
  padding: 0.25em 0.75em;
  margin: 0 0.125em;
  color: var(--accent-primary);
  font-weight: 500;
  border-radius: 12px;
  font-style: normal;
  font-size: 0.875em;
  transition: all 0.6s var(--ease-out-quart);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  position: relative;
  display: inline-block;
  vertical-align: middle;
  letter-spacing: 0;
  backdrop-filter: blur(20px);
}

p code:hover,
li code:hover,
td code:hover,
h1 code:hover,
h2 code:hover,
h3 code:hover,
h4 code:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-primary);
  color: var(--accent-secondary);
}

p code::before,
li code::before,
td code::before,
h1 code::before,
h2 code::before,
h3 code::before,
h4 code::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(34, 197, 94, 0.15) 0%,
    rgba(34, 197, 94, 0) 100%
  );
  border-radius: 7px;
  pointer-events: none;
}

/* Footer */
footer {
  text-align: center;
  margin-top: 40px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Article page layout */
.article-page {
  background: var(--gradient-bg);
  background-attachment: fixed;
  min-height: 100vh;
}

/* Table of Contents */

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
  background-color: transparent !important;
}

/* Premium Table Styles */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 3rem 0;
  background: var(--glass-bg);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow-premium);
  font-size: 0.95rem;
  transition: all 0.6s var(--ease-out-quart);
  backdrop-filter: blur(40px);
  border: 1px solid var(--glass-border);
}

table:hover {
  box-shadow: var(--shadow-premium), var(--glow-subtle);
  transform: translateY(-2px);
}

table th,
table td {
  padding: 20px 32px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  text-align: left;
  transition: all 0.6s var(--ease-out-quart);
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: normal;
  color: var(--text-secondary);
}

table th {
  background: var(--surface-tertiary);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.02em;
  color: var(--text-primary);
  position: relative;
}

table th::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--gradient-primary);
  opacity: 0.3;
}

table tr:last-child td {
  border-bottom: none;
}

table tr:nth-child(even) td {
  background: rgba(0, 0, 0, 0.01);
}

table tr:hover td {
  background: var(--surface-hover);
  color: var(--text-primary);
}

/* Enhanced Image Styles */
main img {
  max-width: 100%;
  max-height: 500px;
  margin: 1.5rem auto;
  display: block;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s ease;
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
}

main img:hover {
  box-shadow: var(--shadow-xl), var(--glow-subtle);
  transform: translateY(-2px);
}

/* Image preview styles */
.img-preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.9);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  padding: 5vh 5vw;
  overscroll-behavior: contain;
  touch-action: none;
}

.img-preview-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    circle at center,
    rgba(255, 255, 255, 0.06) 0%,
    rgba(255, 255, 255, 0.02) 35%,
    rgba(0, 0, 0, 0.45) 70%,
    rgba(0, 0, 0, 0.6) 100%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
}

.img-preview-overlay.active {
  opacity: 1;
  visibility: visible;
}

.preview-img {
  max-width: 92vw;
  max-height: 86vh;
  object-fit: contain;
  box-shadow: var(--shadow-2xl), 0 0 40px rgba(0, 0, 0, 0.35);
  transform: scale(0.94);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.img-preview-overlay.active .preview-img {
  transform: scale(1);
  animation: previewPop 240ms var(--ease-out-quart);
}

.close-preview {
  position: absolute;
  top: 20px;
  right: 20px;
  color: var(--bg-primary);
  font-size: 2rem;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  transition: all 0.2s ease;
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.25);
}

.close-preview:hover {
  background: rgba(255, 255, 255, 0.24);
  transform: rotate(90deg);
  box-shadow: var(--glow-subtle);
}

.close-preview:focus-visible {
  outline: 3px solid rgba(255, 255, 255, 0.45);
  outline-offset: 3px;
}

.img-controls {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  display: none;
}

.img-control-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: var(--text-primary);
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 1.2rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(20px);
}

.img-control-btn:hover {
  background: rgba(255, 255, 255, 0.24);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

@keyframes previewPop {
  0% {
    transform: scale(0.96);
  }
  100% {
    transform: scale(1);
  }
}

.img-preview-overlay.active::before {
  opacity: 1;
}

/* Home layout container */
.home-main {
  display: flex;
  /* margin: 32px auto; */
  gap: 10px;
  /* padding: 0 24px; */
  align-items: flex-start;
  justify-content: center;
}

.home-main main {
  padding: 40px 35px;
  height: calc(100vh - 20px);
  overflow: auto;
}

/* Premium Sidebar Design */
.sidebar {
  width: 320px;
  position: sticky;
  top: 10px;
  height: fit-content;
  height: calc(100vh - 20px);
  background: var(--glass-bg);
  border-radius: 28px;
  /* box-shadow: var(--shadow-premium); */
  backdrop-filter: blur(40px);
  border: 1px solid var(--glass-border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.6s var(--ease-out-quart);
}

.sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.06) 0%,
    rgba(124, 58, 237, 0.02) 100%
  );
  border-radius: 28px;
  pointer-events: none;
  z-index: -1;
}

/* Premium Main Content Area */
main {
  /* width: var(--main-width); */
  flex: 1;
  position: relative;
  z-index: 1;
  padding: 64px 72px;
  border-radius: 32px;
  box-shadow: var(--shadow-premium);
  backdrop-filter: blur(40px);
  border: 1px solid var(--glass-border);
  transition: all 0.6s var(--ease-out-quart);
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.06) 0%,
    rgba(124, 58, 237, 0.02) 100%
  );
  height: calc(100vh - 20px);
  overflow: auto;
}

.other-info {
  font-size: 13px;
  color: var(--text-muted);
}

ol > li::marker {
  color: var(--accent-primary);
  font-weight: 700;
}

/* Task Lists */
.task-list-item {
  list-style-type: none;
  margin-left: -1.5em;
}

.task-list-item-checkbox {
  margin-right: 0.5em;
  position: relative;
  top: 2px;
}

/* Footnotes */
.footnotes {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--glass-border);
  font-size: 0.9rem;
  color: var(--text-tertiary);
}

.footnotes ol {
  padding-left: 1.5rem;
}

.footnote-ref a,
.footnote-backref {
  text-decoration: none;
  color: var(--accent-secondary);
  font-weight: 500;
}

/* Definition Lists */
dl {
  margin: 1.5rem 0;
}

dt {
  font-weight: 600;
  margin-top: 1rem;
  color: var(--text-primary);
}

dd {
  margin-left: 1.5rem;
  padding: 0.5rem 0;
  color: var(--text-secondary);
}

img {
  max-width: 100%;
}

/* Sidebar category list */
.sidebar #category-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 16px 24px 24px;
  background: transparent;
  backdrop-filter: none;
  z-index: auto;
  border-radius: 0;
  margin: 0;
  box-shadow: none;
  position: static;
  flex: 1;
  overflow-y: auto;
  /* max-height: calc(100vh - 200px); */
}

/* Scrollbar styles */
::-webkit-scrollbar {
  width: 8px !important;
  height: 8px !important;
}

::-webkit-scrollbar-track {
  background: transparent;
}

body::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--gradient-primary);
  border-radius: 4px;
  transition: all 0.3s ease;
  box-shadow: var(--glow-subtle);
}

.sidebar-header {
  padding: 24px 24px 16px 24px;
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: 8px;
  position: relative;
}

/* Search functionality */
.search-container {
  padding: 0 24px 16px 24px;
  margin-bottom: 8px;
  position: relative;
  display: flex;
  align-items: center;
}

#search-input {
  width: 100%;
  padding: 12px 40px 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  font-family: var(--ff);
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: all 0.3s var(--ease-out-quart);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(20px);
}

#search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: var(--glass-hover);
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2), var(--glow-subtle);
}

#search-input::placeholder {
  color: var(--text-muted);
}

#search-button {
  position: absolute;
  right: 32px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

#search-button:hover {
  color: var(--accent-primary);
  transform: scale(1.1);
}

.sidebar-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Navigation link styles */
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 15px;
  background: var(--gradient-primary);
  color: var(--bg-primary);
  text-decoration: none;
  border-radius: 0 0 0 20px;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.3s var(--ease-spring);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
  letter-spacing: 0.025em;
  position: absolute;
  top: 0;
  right: 0;
}

.nav-link::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.2),
    transparent
  );
  transition: left 0.5s ease;
}

.nav-link:hover {
  box-shadow: var(--shadow-lg), var(--glow-subtle);
  background: var(--gradient-secondary);
}

.nav-link:hover::before {
  left: 100%;
}

.nav-link:active {
  transform: translateY(0) scale(0.98);
  transition-duration: 0.1s;
}

.nav-link svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease;
  display: none;
}

.nav-link:hover svg {
  transform: scale(1.1) rotate(5deg);
}

/* Premium Sidebar Category Buttons */
.sidebar .category-btn {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: 16px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--ff);
  position: relative;
  z-index: 1;
  overflow: hidden;
  color: var(--text-tertiary);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.6s var(--ease-out-quart);
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

/* Non-sidebar category buttons */
.category-btn:not(.sidebar .category-btn) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border: none;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  font-family: var(--ff);
  position: relative;
  z-index: 1;
  overflow: hidden;
  color: var(--text-secondary);
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  transition: all 0.3s var(--ease-spring);
  letter-spacing: 0.025em;
}

.category-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: var(--bg-primary);
  background: var(--accent-primary);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  margin-left: 6px;
  font-weight: 700;
  transition: all 0.3s ease;
  transform: scale(0.95);
  box-shadow: var(--glow-subtle);
}

.category-count.active {
  transform: scale(1.05);
}

.category-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(
    circle,
    rgba(139, 92, 246, 0.15) 0%,
    transparent 70%
  );
  transform: translate(-50%, -50%) scale(0);
  border-radius: 999px;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 0;
}

.category-btn:not(.active):hover::before {
  transform: translate(-50%, -50%) scale(1.5);
  opacity: 1;
}

/* Sidebar button hover effects */
.sidebar .category-btn:not(.active, [data-category="special"]):hover {
  transform: translateX(8px);
  color: var(--text-primary);
  border-color: var(--glass-border);
  background: var(--glass-hover);
}

.sidebar .category-btn:not(.active, [data-category="special"]):hover::before {
  opacity: 1;
}

/* Non-sidebar button hover effects */
.category-btn:not(.sidebar .category-btn):hover {
  transform: translateY(-4px);
  background: var(--glass-hover);
  border-color: var(--glass-border);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
}

.category-btn:active::before {
  transform: translate(-50%, -50%) scale(0.8);
  opacity: 1;
}

/* Premium Active & Focus States for Category Buttons */
.category-btn.active,
.category-btn:focus {
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.15) 0%,
    rgba(124, 58, 237, 0.12) 50%,
    rgba(109, 40, 217, 0.08) 100%
  );
  color: var(--accent-primary);
  font-weight: 700;
  box-shadow: var(--shadow-lg), 0 0 0 2px rgba(139, 92, 246, 0.25),
    0 8px 32px rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  transform: translateX(6px) scale(1.02);
  backdrop-filter: blur(20px) saturate(120%);
  position: relative;
  overflow: hidden;
}

/* Enhanced gradient overlay for active state */
.category-btn.active::before,
.category-btn:focus::before {
  background: radial-gradient(
    circle at center,
    rgba(139, 92, 246, 0.2) 0%,
    rgba(124, 58, 237, 0.15) 40%,
    transparent 70%
  );
  transform: translate(-50%, -50%) scale(1.5);
  opacity: 1;
}

/* Animated accent bar for active state */
/* .category-btn.active::after,
.category-btn:focus::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--gradient-primary);
  border-radius: 0 2px 2px 0;
  box-shadow: var(--glow-subtle);
  animation: activeBarPulse 2s ease-in-out infinite;
} */

/* Premium category count styling for active state */
.category-btn.active .category-count,
.category-btn:focus .category-count {
  background: var(--gradient-primary);
  color: #ffffff;
  box-shadow: var(--shadow-md), 0 0 16px rgba(99, 102, 241, 0.4);
  font-weight: 800;
  transform: scale(1.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(10px);
  letter-spacing: 0.02em;
}

/* Subtle pulse animation for active accent bar */
@keyframes activeBarPulse {
  0%,
  100% {
    opacity: 1;
    transform: scaleY(1);
  }
  50% {
    opacity: 0.8;
    transform: scaleY(0.95);
  }
}

/* Enhanced focus ring for accessibility */
.category-btn:focus-visible {
  outline: 3px solid rgba(139, 92, 246, 0.4);
  outline-offset: 3px;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.18) 0%,
    rgba(124, 58, 237, 0.15) 50%,
    rgba(109, 40, 217, 0.12) 100%
  );
}

/* Smooth transition for all states */
.category-btn {
  transition: all 0.4s var(--ease-out-quart), transform 0.3s var(--ease-spring),
    box-shadow 0.4s var(--ease-out-quart);
}

/* Distinct focus ring for non-special buttons */
.category-btn:focus-visible:not([data-category="special"]) {
  outline: 2px solid rgba(79, 70, 229, 0.25);
  outline-offset: 2px;
}

/* Special category button styles */
.category-btn[data-category="special"] {
  background: var(--gradient-primary);
  color: #fff;
  font-weight: 600;
  border: 2px solid rgba(139, 92, 246, 0.4);
  box-shadow: 
    var(--shadow-md), 
    0 8px 24px rgba(139, 92, 246, 0.15),
    0 0 0 1px rgba(139, 92, 246, 0.1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px) saturate(130%);
  transition: all 0.45s var(--ease-out-quart);
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.category-btn[data-category="special"]::before {
  content: "";
  position: absolute;
  inset: -2px;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.2) 0%,
    rgba(124, 58, 237, 0.2) 60%,
    rgba(109, 40, 217, 0.15) 100%
  );
  filter: blur(12px);
  opacity: 0;
  transition: opacity 0.45s var(--ease-out-quart);
  z-index: 0;
}

.category-btn[data-category="special"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.12) 0%,
    rgba(255, 255, 255, 0.06) 100%
  );
  border-radius: inherit;
  opacity: 0;
  transition: opacity 0.45s var(--ease-out-quart);
  pointer-events: none;
  z-index: 1;
}

.category-btn[data-category="special"] .category-count {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.9);
  color: var(--accent-primary);
  border: 1px solid rgba(139, 92, 246, 0.4);
  box-shadow: 
    0 2px 8px rgba(139, 92, 246, 0.3), 
    0 0 0 1px rgba(139, 92, 246, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(8px) saturate(130%);
  transform: translateZ(0) scale(0.98);
  transition: all 0.35s var(--ease-out-quart);
}

.category-btn[data-category="special"]:hover {
  background: var(--gradient-secondary);
  border-color: rgba(124, 58, 237, 0.6);
  box-shadow: 
    var(--shadow-lg), 
    0 12px 36px rgba(139, 92, 246, 0.25),
    0 0 0 2px rgba(139, 92, 246, 0.2), 
    var(--glow-accent);
  transform: translateX(8px) scale(1.03);
}

.category-btn[data-category="special"]:hover::before {
  opacity: 1;
}
.category-btn[data-category="special"]:hover::after {
  opacity: 1;
  background: linear-gradient(
    120deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.35) 20%,
    rgba(255, 255, 255, 0) 40%
  );
  background-size: 200% 100%;
  animation: specialShine 1.8s var(--ease-in-out-quart) infinite;
}

.category-btn[data-category="special"]:hover .category-count {
  background: var(--gradient-warm);
  color: var(--bg-primary);
  border-color: rgba(255, 255, 255, 0.75);
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.45),
    0 0 0 1px rgba(245, 158, 11, 0.35);
  transform: translateZ(0) scale(1.08);
}

.category-btn[data-category="special"].active {
  background: linear-gradient(
    135deg,
    #8b5cf6 0%,
    #7c3aed 50%,
    #6d28d9 100%
  );
  color: #ffffff;
  font-weight: 800;
  border: 2px solid rgba(139, 92, 246, 0.6);
  box-shadow: 
    var(--shadow-premium), 
    0 16px 48px rgba(139, 92, 246, 0.4),
    0 0 0 3px rgba(139, 92, 246, 0.2), 
    inset 0 2px 0 rgba(255, 255, 255, 0.4),
    inset 0 -12px 32px rgba(109, 40, 217, 0.15),
    0 0 40px rgba(139, 92, 246, 0.3);
  transform: translateX(4px) scale(1.03);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(20px) saturate(160%);
  transition: all 0.4s var(--ease-out-quart);
  letter-spacing: 0.03em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  z-index: 10;
}

.category-btn[data-category="special"].active::before {
  opacity: 1;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.4) 0%,
    rgba(124, 58, 237, 0.3) 50%,
    rgba(109, 40, 217, 0.2) 100%
  );
  filter: blur(20px);
  transform: scale(1.1);
  animation: pulseGlow 3s ease-in-out infinite;
}
.category-btn[data-category="special"].active::after {
  opacity: 1;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.25) 0%,
    rgba(255, 255, 255, 0.1) 50%,
    rgba(139, 92, 246, 0.1) 100%
  );
  border-radius: inherit;
  animation: shimmer 2s ease-in-out infinite;
}

.category-btn[data-category="special"].active .category-count {
  background: linear-gradient(
    135deg,
    #fef3c7 0%,
    #fcd34d 100%
  );
  color: #92400e;
  font-weight: 900;
  border: 2px solid rgba(252, 211, 77, 0.8);
  box-shadow: 
    0 0 0 3px rgba(255, 255, 255, 0.9),
    0 0 20px rgba(252, 211, 77, 0.6),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transform: translateZ(0) scale(1.1);
  backdrop-filter: blur(8px) saturate(180%);
  letter-spacing: 0.05em;
  text-shadow: 0 1px 2px rgba(146, 64, 14, 0.3);
}

/* Focus ring for accessibility & distinction */
.category-btn[data-category="special"]:focus-visible {
  outline: 3px solid rgba(79, 70, 229, 0.25);
  outline-offset: 3px;
}

@keyframes specialShine {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* 新增动画：脉冲发光效果 */
@keyframes pulseGlow {
  0%, 100% {
    opacity: 1;
    transform: scale(1.1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.15);
  }
}

/* 新增动画：光泽闪烁效果 */
@keyframes shimmer {
  0% {
    background-position: -100% 0;
    opacity: 0.8;
  }
  50% {
    background-position: 100% 0;
    opacity: 1;
  }
  100% {
    background-position: 200% 0;
    opacity: 0.8;
  }
}

ul > li:has(ul),
ul > li:has(ol),
ol > li:has(ul),
ol > li:has(ol) {
  border-bottom: 0;
}

/* Premium Advanced Code Blocks */
pre[class*="language-"] {
  position: relative !important;
  padding: 0 !important;
  background: var(--bg-card) !important;
  border-radius: 24px !important;
  overflow: hidden !important;
  /* box-shadow: var(--shadow-premium) !important; */
  transition: all 0.6s var(--ease-out-quart) !important;
  border: 1px solid var(--glass-border) !important;
}

pre[class*="language-"] > code {
  font-family: var(--ff-mono) !important;
  font-size: 0.975rem !important;
  line-height: 1.7 !important;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 2rem 2.5rem !important;
  display: block !important;
  overflow-x: auto !important;
  position: relative !important;
  z-index: 2 !important;
  font-weight: 500 !important;
  letter-spacing: 0 !important;
  color: var(--text-secondary) !important;
}

/* Improve readability and UX */
pre[class*="language-"] > code {
  -moz-tab-size: 2 !important;
  tab-size: 2 !important;
  text-shadow: none !important;
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 12px,
    #000 calc(100% - 12px),
    transparent 100%
  ) !important;
  mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 12px,
    #000 calc(100% - 12px),
    transparent 100%
  ) !important;
}

/* Code block scrollbar styling */
pre[class*="language-"] > code::-webkit-scrollbar {
  height: 10px !important;
}
pre[class*="language-"] > code::-webkit-scrollbar-track {
  background: transparent !important;
}
pre[class*="language-"] > code::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #4f46e5, #7c3aed) !important;
  border-radius: 6px !important;
}

/* Selection color inside code */
pre[class*="language-"] code::selection {
  background: rgba(79, 70, 229, 0.16) !important;
}

/* Diff-like tokens */
pre[class*="language-"] .token.inserted {
  background: rgba(16, 185, 129, 0.12) !important;
  color: #047857 !important;
  border-radius: 4px !important;
}
pre[class*="language-"] .token.deleted {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #b91c1c !important;
  border-radius: 4px !important;
}

/* Line numbers plugin support (if present) */
pre.line-numbers[class*="language-"] {
  padding-left: 3.25rem !important;
}
pre.line-numbers[class*="language-"] .line-numbers-rows {
  border-right: 1px solid rgba(15, 23, 42, 0.06) !important;
}
pre.line-numbers[class*="language-"] .line-numbers-rows > span:before {
  color: var(--text-muted) !important;
}

.toc-container:not(:has(a)) {
  display: none;
}

strong {
  color: var(--accent-primary);
  position: relative;
  display: inline-block;
  font-weight: 700;
  transition: all 0.3s ease;
}

strong::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--gradient-primary);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform 0.3s ease;
  box-shadow: var(--glow-subtle);
}

main iframe {
  width: 100%;
  min-height: 200px;
  border: none;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--glass-border);
  box-sizing: border-box;
  padding: 20px;
  background: var(--glass-bg);
}

.my-inline-img {
  margin: initial;
  display: inline-flex;
  height: 20px;
  transform: translateY(25%);
  border: 1px dashed var(--accent-primary);
  box-shadow: var(--glow-subtle);
}

em {
  color: var(--accent-secondary);
}

#category-list:has([data-category="special"].active)
  + .home-articles-list
  [data-category="special"] {
  display: block;
}

/* Code copy button styles */
.code-copy-btn {
  position: absolute !important;
  top: 8px !important;
  right: 8px !important;
  background: var(--accent-primary) !important;
  color: var(--bg-primary) !important;
  border: none !important;
  border-radius: 6px !important;
  padding: 4px 8px !important;
  font-size: 0.7rem !important;
  cursor: pointer !important;
  opacity: 0 !important;
  transition: all 0.3s ease !important;
  z-index: 4 !important;
  font-family: var(--ff) !important;
  box-shadow: var(--glow-subtle) !important;
}

.code-copy-btn:hover {
  background: var(--accent-secondary) !important;
  transform: scale(1.05) !important;
  box-shadow: var(--glow-subtle) !important;
}

.home-articles-list [data-category="special"] {
  display: none;
}

#category-list:has([data-category="special"].active)
  + .home-articles-list
  [data-category="special"] {
  display: block;
}

.home-main
  .sidebar:has(.category-btn[data-category="special"].active)
  + main
  li[data-category="special"] {
  display: block;
}

.home-page .home-button {
  display: none;
}

/* Ultra-Modern Floating Widget System */
.floating-widget {
  position: fixed;
  top: 50%;
  right: 32px;
  transform: translateY(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 16px;
  transition: all 0.8s var(--ease-out-quart);
  user-select: none;
}

.widget-toggle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--glass-bg);
  backdrop-filter: blur(60px) saturate(180%);
  border: 2px solid var(--glass-border);
  box-shadow: var(--shadow-premium), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.6s var(--ease-out-quart);
  color: var(--text-primary);
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.widget-toggle::before {
  content: "";
  position: absolute;
  inset: -3px;
  background: conic-gradient(
    from 0deg,
    var(--accent-primary) 0deg,
    var(--accent-secondary) 120deg,
    var(--accent-tertiary) 240deg,
    var(--accent-primary) 360deg
  );
  border-radius: 50%;
  z-index: -1;
  opacity: 0;
  transition: all 0.6s var(--ease-out-quart);
  animation: rotateBorder 8s linear infinite;
}

.widget-toggle::after {
  content: "";
  position: absolute;
  inset: 4px;
  background: radial-gradient(
    circle at 30% 30%,
    rgba(255, 255, 255, 0.3) 0%,
    rgba(255, 255, 255, 0.1) 40%,
    transparent 70%
  );
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.6s var(--ease-out-quart);
  pointer-events: none;
}

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

.widget-toggle:hover {
  transform: translateY(-4px) scale(1.1);
  background: var(--glass-hover);
  box-shadow: 
    var(--shadow-2xl), 
    var(--glow-premium),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border-color: var(--accent-primary);
}

.widget-toggle:hover::before {
  opacity: 1;
  animation-duration: 3s;
}

.widget-toggle:hover::after {
  opacity: 1;
}

.widget-toggle:active {
  transform: translateY(-2px) scale(1.05);
  transition-duration: 0.15s;
}

.widget-toggle svg {
  width: 24px;
  height: 24px;
  transition: all 0.6s var(--ease-out-quart);
  filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.4));
  z-index: 1;
}

.widget-toggle:hover svg {
  transform: scale(1.2) rotate(135deg);
  filter: drop-shadow(0 0 16px rgba(239, 68, 68, 0.6));
}

.floating-widget.active .widget-toggle svg {
  transform: scale(1.1) rotate(45deg);
  filter: drop-shadow(0 0 12px rgba(239, 68, 68, 0.5));
}

.widget-menu {
  position: absolute;
  top: 50%;
  right: calc(100% + 20px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-50%) translateX(40px) scale(0.85);
  transition: all 0.8s var(--ease-out-quart);
  pointer-events: none;
  filter: blur(8px);
}

.floating-widget.active .widget-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) translateX(0) scale(1);
  pointer-events: all;
  filter: blur(0px);
}

.widget-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--glass-bg);
  backdrop-filter: blur(60px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: 24px;
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.7s var(--ease-out-quart);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  min-width: 180px;
  isolation: isolate;
  letter-spacing: 0.02em;
}

.widget-item::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(239, 68, 68, 0.1) 50%,
    transparent 100%
  );
  transition: left 0.8s var(--ease-out-quart);
  pointer-events: none;
}

.widget-item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at center,
    rgba(239, 68, 68, 0.1) 0%,
    transparent 70%
  );
  border-radius: 24px;
  opacity: 0;
  transition: opacity 0.7s var(--ease-out-quart);
  pointer-events: none;
}

.widget-item:hover {
  transform: translateX(-12px) scale(1.05);
  background: var(--glass-hover);
  color: var(--text-primary);
  box-shadow: 
    var(--shadow-2xl), 
    var(--glow-subtle),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  border-color: var(--accent-primary);
}

.widget-item:hover::before {
  left: 100%;
}

.widget-item:hover::after {
  opacity: 1;
}

.widget-item svg {
  width: 20px;
  height: 20px;
  transition: all 0.7s var(--ease-out-quart);
  flex-shrink: 0;
  filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.3));
  z-index: 1;
}

.widget-item:hover svg {
  transform: scale(1.2) rotate(5deg);
  filter: drop-shadow(0 0 12px rgba(239, 68, 68, 0.6));
}

/* Sophisticated Animation System for Widget Items */
.floating-widget:not(.active) .widget-item {
  transform: translateX(60px) scale(0.8);
  opacity: 0;
  filter: blur(10px);
}

.floating-widget.active .widget-item:nth-child(1) {
  transition-delay: 0.1s;
  animation: slideInWidget 0.8s var(--ease-out-quart) 0.1s forwards;
}

.floating-widget.active .widget-item:nth-child(2) {
  transition-delay: 0.2s;
  animation: slideInWidget 0.8s var(--ease-out-quart) 0.2s forwards;
}

.floating-widget.active .widget-item:nth-child(3) {
  transition-delay: 0.3s;
  animation: slideInWidget 0.8s var(--ease-out-quart) 0.3s forwards;
}

.floating-widget.active .widget-item:nth-child(4) {
  transition-delay: 0.4s;
  animation: slideInWidget 0.8s var(--ease-out-quart) 0.4s forwards;
}

.floating-widget.active .widget-item:nth-child(5) {
  transition-delay: 0.5s;
  animation: slideInWidget 0.8s var(--ease-out-quart) 0.5s forwards;
}

@keyframes slideInWidget {
  0% {
    transform: translateX(60px) scale(0.8);
    opacity: 0;
    filter: blur(10px);
  }
  60% {
    transform: translateX(-8px) scale(1.05);
    opacity: 0.8;
    filter: blur(2px);
  }
  100% {
    transform: translateX(0) scale(1);
    opacity: 1;
    filter: blur(0px);
  }
}

/* Floating Animation for the Widget */
.floating-widget {
  animation: floatGently 6s ease-in-out infinite;
}

@keyframes floatGently {
  0%, 100% {
    transform: translateY(-50%);
  }
  50% {
    transform: translateY(calc(-50% - 8px));
  }
}

/* Enhanced Focus States for Accessibility */
.widget-toggle:focus-visible {
  outline: 3px solid rgba(239, 68, 68, 0.4);
  outline-offset: 4px;
}

.widget-item:focus-visible {
  outline: 2px solid rgba(239, 68, 68, 0.4);
  outline-offset: 2px;
  background: var(--glass-hover);
  color: var(--text-primary);
}

/* Responsive Design for Mobile */
@media (max-width: 768px) {
  .floating-widget {
    right: 16px;
    scale: 0.9;
  }
  
  .widget-toggle {
    width: 56px;
    height: 56px;
  }
  
  .widget-item {
    min-width: 160px;
    padding: 14px 18px;
    font-size: 0.85rem;
  }
  
  .widget-menu {
    right: calc(100% + 16px);
  }
}

/* Interactive Background */
#interactive-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
  background: var(--gradient-bg);
  background-attachment: fixed;
}

/* Premium Body Styles */
body {
  width: 100%;
  font-family: var(--ff);
  line-height: 1.6;
  font-size: 1rem;
  color: var(--text-secondary);
  background: var(--gradient-bg);
  background-attachment: fixed;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  position: relative;
  overflow-x: hidden;
  min-height: 100vh;
  letter-spacing: -0.01em;
}

html {
  scroll-behavior: smooth;
}

/* Premium Home Button */
.home-button {
  position: fixed;
  top: 32px;
  left: 32px;
  color: var(--text-primary);
  border: none;
  padding: 0;
  border-radius: 20px;
  cursor: pointer;
  text-decoration: none;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.6s var(--ease-out-quart);
  outline: none;
  width: 56px;
  height: 56px;
  overflow: hidden;
  background: var(--glass-bg);
  box-shadow: var(--shadow-premium);
  backdrop-filter: blur(40px);
  border: 1px solid var(--glass-border);
}

.home-button::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(239, 68, 68, 0.12) 0%,
    rgba(220, 38, 38, 0.06) 100%
  );
  border-radius: 20px;
  opacity: 0;
  transition: opacity 0.6s var(--ease-out-quart);
  pointer-events: none;
}

.home-button::before {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: var(--gradient-primary);
  background-size: 400% 400%;
  border-radius: 18px;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.4s var(--ease-out-quart);
  animation: gradientShift 4s ease-in-out infinite;
}

@keyframes gradientShift {
  0%,
  100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.to-top {
  top: unset;
  bottom: 20px;
  left: unset;
  right: 20px;
}

.home-button svg {
  width: 22px;
  height: 22px;
  display: block;
  transition: transform 0.3s ease;
  filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.3));
}

.home-button:hover,
.home-button:focus {
  transform: translateY(-8px) scale(1.08);
  color: var(--text-primary);
  background: var(--glass-hover);
  box-shadow: var(--shadow-2xl), var(--glow-subtle);
  color: #fff;
}

.home-button:hover::before {
  opacity: 1;
}

.home-button:hover::after {
  opacity: 1;
}

.home-button:hover svg {
  transform: scale(1.3) rotate(5deg);
  filter: drop-shadow(0 0 12px rgba(239, 68, 68, 0.5));
}

.home-button:active {
  transform: translateY(-3px) scale(1.02);
  transition-duration: 0.1s;
}

.home-button:focus {
  outline: 2px solid rgba(239, 68, 68, 0.4);
  outline-offset: 4px;
}

/* Theme toggle button */
.theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  background: var(--accent-secondary);
  color: var(--bg-primary);
  border: none;
  padding: 10px 15px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.3s ease;
  display: none;
  border-radius: 12px;
  box-shadow: var(--shadow-md), var(--glow-accent);
}

.theme-toggle:hover {
  background: var(--accent-primary);
  box-shadow: var(--shadow-lg), var(--glow-accent);
}

/* Header */
header {
  text-align: center;
  padding-bottom: 32px;
  margin-bottom: 40px;
  position: relative;
}

header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 3px;
  background: var(--gradient-primary);
  border-radius: 2px;
  box-shadow: var(--glow-subtle);
}

header h1 {
  margin: 0 0 24px 0 !important;
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  position: relative;
  display: inline-block;
  color: var(--text-primary);
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: all 0.6s var(--ease-out-quart);
  cursor: pointer;
  user-select: none;
  max-width: 90%;
  font-family: var(--ff-serif);
}

header h1:hover {
  transform: translateY(-2px) scale(1.02);
  filter: drop-shadow(0 4px 12px rgba(102, 126, 234, 0.3));
}

header h1:active {
  transform: translateY(0) scale(0.98);
  transition-duration: 0.1s;
}

header p {
  font-size: 1rem;
  color: var(--text-tertiary);
  font-weight: 500;
  letter-spacing: 0.5px;
}

/* Premium Typography Hierarchy */
main h1 {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--text-primary);
  position: relative;
  line-height: 1.2;
  background: var(--gradient-primary);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.03em;
  font-family: var(--ff-serif);
}

main h2 {
  font-size: 2rem;
  font-weight: 600;
  color: var(--text-primary);
  position: relative;
  line-height: 1.3;
  letter-spacing: -0.02em;
  font-family: var(--ff-serif);
}

main h2::before {
  content: "";
  position: absolute;
  left: -15px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 32px;
  background: var(--gradient-primary);
  border-radius: 2px;
  opacity: 0.6;
}

main h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-secondary);
  position: relative;
  letter-spacing: -0.01em;
}

main h3::before {
  content: "";
  position: absolute;
  left: -15px;
  top: 50%;
  transform: translateY(-50%);
  width: 2px;
  height: 24px;
  background: var(--gradient-secondary);
  border-radius: 1px;
  opacity: 0.5;
}

main h4 {
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: -0.005em;
}

main ul,
main ol {
  margin: 1.5rem 0;
  padding-left: 2rem;
}

main li {
  margin-bottom: 0.8rem;
  position: relative;
  line-height: 1.7;
  color: var(--text-secondary);
  padding-left: 15px;
}

.home-articles-list {
  margin-bottom: 0;
  margin-top: 0;
}

main ul:not(.home-articles-list) li::before {
  content: "•";
  color: var(--accent-primary);
  font-weight: bold;
  display: inline-block;
  width: 1em;
  margin-left: -1em;
  position: absolute;
}

main ul:not(.home-articles-list) li ul li::before {
  content: "○";
}

main ul:not(.home-articles-list) li ul li ul li::before {
  content: "◆";
}

.home-articles-list li {
  padding-left: 0;
}

.home-articles-list li:last-child {
  border: 0;
  margin-bottom: 0;
}

.home-articles-list .article-date {
  font-size: 0.8em;
  color: var(--text-muted);
  margin-left: 0.5em;
  font-weight: normal;
}

main a:not(.website-card) {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.3s var(--ease-out-quart);
  position: relative;
}

main blockquote {
  padding: 1.5rem 2rem;
  background: var(--glass-bg);
  border-left: 4px solid var(--accent-primary);
  border-radius: 16px;
  color: var(--text-secondary);
  position: relative;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
}

main blockquote p {
  margin-bottom: 0;
}

main hr {
  display: none;
  height: 1px;
  border: 0;
  border-top: 1px solid var(--glass-border);
  margin: 2rem 0;
  padding: 0;
  position: relative;
}

main hr::after {
  content: "§";
  display: inline-block;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(90deg);
  background: var(--bg-primary);
  padding: 0 10px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Premium Inline Code */
p code,
li code,
td code,
h1 code,
h2 code,
h3 code,
h4 code {
  font-family: var(--ff-mono);
  background: var(--surface-tertiary);
  padding: 0.25em 0.75em;
  margin: 0 0.125em;
  color: var(--accent-primary);
  font-weight: 500;
  border-radius: 12px;
  font-style: normal;
  font-size: 0.875em;
  transition: all 0.6s var(--ease-out-quart);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  position: relative;
  display: inline-block;
  vertical-align: middle;
  letter-spacing: 0;
  backdrop-filter: blur(20px);
}

p code:hover,
li code:hover,
td code:hover,
h1 code:hover,
h2 code:hover,
h3 code:hover,
h4 code:hover {
  background: var(--surface-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
  border-color: var(--accent-primary);
  color: var(--accent-secondary);
}

p code::before,
li code::before,
td code::before,
h1 code::before,
h2 code::before,
h3 code::before,
h4 code::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(102, 126, 234, 0.1) 0%,
    rgba(102, 126, 234, 0) 100%
  );
  border-radius: 7px;
  pointer-events: none;
}

pre:not([class*="language-"]) {
  padding: 2rem;
  background: var(--bg-card);
  border-radius: 20px;
  border: 1px solid var(--glass-border);
  margin: 2.5rem 0;
  overflow: auto;
  transition: all 0.6s var(--ease-out-quart);
  backdrop-filter: blur(40px);
  position: relative;
}

pre:not([class*="language-"]) code {
  background: transparent;
  padding: 0;
  border: none;
  font-family: var(--ff-mono);
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* Footer */
footer {
  text-align: center;
  margin-top: 40px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Index page specific styles */
main ul {
  list-style: none;
  padding: 0;
}

.home-articles-list li {
  /* padding: 24px 32px 24px 48px; */
  border-bottom: none;
  transition: all 0.6s var(--ease-out-quart);
  border-radius: 20px;
  background: transparent;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
  margin-bottom: 0;
}

.home-articles-list li[data-category="special"]::before {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

/* Hover effect for category indicators */
.home-articles-list li:hover::before {
  transform: translateY(-50%) scale(1.5);
}

.home-articles-list li:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-premium);
  border-color: var(--glass-border);
  background: var(--glass-bg);
}

.home-articles-list li:hover::before {
  opacity: 1;
}

pre[class*="language-"]:after,
pre[class*="language-"]:before {
  content: none !important;
}

.home-articles-list li a {
  font-size: 1.125rem;
  font-weight: 500;
  color: var(--text-tertiary);
  transition: all 0.6s var(--ease-out-quart);
  display: block;
  line-height: 1.5;
  letter-spacing: -0.01em;
  padding: 24px 32px 24px 32px;
}

/* Article page layout */
.article-page {
  background: var(--gradient-bg);
  background-attachment: fixed;
  min-height: 100vh;
}

.article-container {
  display: flex;
  /* margin: 0 auto; */
  gap: 10px;
  /* padding: 0 24px; */
  /* padding-top: 32px;
  padding-bottom: 32px; */
  align-items: flex-start;
  justify-content: center;
  flex-direction: row-reverse;
}

/* Table of Contents */
.toc-container {
  width: 320px;
  padding: 28px;
  position: sticky;
  top: 10px;
  transition: all 0.6s var(--ease-out-quart);
  z-index: 99;
  overflow: hidden;
  background: var(--glass-bg);
  border-radius: 28px;
  /* box-shadow: var(--shadow-premium); */
  backdrop-filter: blur(40px);
  border: 1px solid var(--glass-border);
  box-sizing: border-box;
}

.toc-container::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.04) 0%,
    rgba(124, 58, 237, 0.02) 100%
  );
  border-radius: 28px;
  pointer-events: none;
  z-index: -1;
}

.toc-container h3 {
  margin-bottom: 16px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: 0.02em;
  position: relative;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--glass-border);
}

.toc {
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 8px;
}

.toc a {
  display: block;
  padding: 8px 12px;
  margin-bottom: 8px;
  color: var(--text-tertiary);
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
  padding-right: 20px;
  padding-left: 18px;
  line-height: 1.5;
}

.toc a:hover,
.toc a.active {
  color: var(--accent-primary);
  font-weight: 600;
  text-decoration: none;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 0;
}

.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
  background-color: transparent !important;
}

.home-button:not(.to-top) {
  display: none;
}
