:root {
  color-scheme: dark;
  --color-body-bg: #020617;
  --color-body-bg-alt: #0f172a;
  --color-text-primary: #e2e8f0;
  --color-text-secondary: #cbd5f5;
  --color-text-muted: #94a3b8;
  --color-card-bg: rgba(255, 255, 255, 0.05);
  --color-card-border: rgba(255, 255, 255, 0.1);
  --color-card-hover: rgba(255, 255, 255, 0.1);
  --color-panel-bg: rgba(0, 0, 0, 0.3);
  --color-panel-border: rgba(255, 255, 255, 0.1);
  --color-input-bg: rgba(15, 23, 42, 0.8);
  --color-input-border: rgba(148, 163, 184, 0.4);
  --color-toast-bg: rgba(15, 23, 42, 0.92);
  --color-toast-border: rgba(255, 255, 255, 0.08);
  --color-state-card-bg: rgba(15, 23, 42, 0.8);
  --color-state-card-border: rgba(148, 163, 184, 0.25);
  --color-surface: rgba(2, 6, 23, 0.95);
  --color-gradient-1: rgba(16, 185, 129, 0.08);
  --color-gradient-2: rgba(139, 92, 246, 0.08);
  --color-terminal-bg: rgba(15, 23, 42, 0.7);
  --color-terminal-border: rgba(255, 255, 255, 0.12);
  --color-terminal-header-bg: rgba(248, 250, 252, 0.12);
}

[data-theme="light"] {
  color-scheme: light;
  --color-body-bg: #f5f7fb;
  --color-body-bg-alt: #e2e8f0;
  --color-text-primary: #0f172a;
  --color-text-secondary: #475569;
  --color-text-muted: #94a3b8;
  --color-card-bg: rgba(255, 255, 255, 0.55);
  --color-card-border: rgba(148, 163, 184, 0.35);
  --color-card-hover: rgba(255, 255, 255, 0.75);
  --color-panel-bg: rgba(255, 255, 255, 0.45);
  --color-panel-border: rgba(148, 163, 184, 0.25);
  --color-input-bg: rgba(255, 255, 255, 0.65);
  --color-input-border: rgba(148, 163, 184, 0.3);
  --color-toast-bg: rgba(255, 255, 255, 0.7);
  --color-toast-border: rgba(148, 163, 184, 0.25);
  --color-state-card-bg: rgba(255, 255, 255, 0.6);
  --color-state-card-border: rgba(148, 163, 184, 0.3);
  --color-surface: rgba(255, 255, 255, 0.7);
  --color-gradient-1: rgba(79, 70, 229, 0.08);
  --color-gradient-2: rgba(236, 72, 153, 0.08);
  --color-terminal-bg: rgba(255, 255, 255, 0.6);
  --color-terminal-border: rgba(148, 163, 184, 0.25);
  --color-terminal-header-bg: rgba(226, 232, 240, 0.5);
}

/* 优化主题切换性能 - 只对主要元素应用过渡 */
.theme-switching {
  transition: background-color 0.25s ease, color 0.25s ease;
}

.theme-switching body,
.theme-switching main,
.theme-switching .bookmark-card,
.theme-switching .modal-content,
.theme-switching .site-footer {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.theme-switching .toast-bubble {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.theme-switching .category-nav-btn {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.theme-switching .favicon img {
  transition: opacity 0.25s ease;
}

body {
  background-color: var(--color-body-bg);
  color: var(--color-text-primary);
  overflow-x: hidden;
  font-family: 'Inter', sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
  width: 100%;
  padding-bottom: clamp(80px, 8vh, 160px);
}

/* Dynamic Background */
.bg-gradient-mesh {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  background-image:
    linear-gradient(135deg, rgba(2, 6, 23, 0.65), rgba(15, 23, 42, 0.85)),
    url('assets/win.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

[data-theme="light"] .bg-gradient-mesh {
  background-image:
    linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.35)),
    url('assets/win.jpg');
}

@media (max-width: 768px) {
  .bg-gradient-mesh {
    background-image:
      linear-gradient(135deg, rgba(2, 6, 23, 0.65), rgba(15, 23, 42, 0.85)),
      url('assets/phone.png');
    background-attachment: scroll;
  }

  [data-theme="light"] .bg-gradient-mesh {
    background-image:
      linear-gradient(135deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.35)),
      url('assets/phone.png');
  }
}

.bg-noise {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.03;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  pointer-events: none;
}

#nav-header {
  background-color: var(--color-panel-bg);
  border-color: var(--color-panel-border);
  color: var(--color-text-primary);
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

.site-logo {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 20px -12px rgba(0, 0, 0, 0.8);
}

@media (max-width: 640px) {
  .site-logo {
    width: 32px;
    height: 32px;
  }
}

.nav-pill,
.theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.95rem;
  border-radius: 9999px;
  border: 1px solid var(--color-panel-border);
  background-color: var(--color-panel-bg);
  color: var(--color-text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 10px 25px -15px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px);
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, transform 0.25s ease;
  min-width: 44px;
  min-height: 44px;
}

.nav-pill:hover,
.theme-toggle-btn:hover {
  background-color: var(--color-card-hover);
  border-color: rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
  transform: translateY(-1px);
}

.theme-toggle-btn i {
  font-size: 0.85rem;
}

.theme-toggle-btn span {
  font-size: 0.75rem;
}

.section-heading {
  color: var(--color-text-primary);
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-heading-text {
  font-size: clamp(1.15rem, 1vw + 0.6rem, 1.45rem);
  line-height: 1.2;
  background: linear-gradient(120deg, #34d399, #60a5fa);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  display: inline-block;
}

[data-theme="light"] .section-heading-text {
  background: linear-gradient(120deg, #0ea5e9, #14b8a6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.section-icon {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  border: 1px solid rgba(59, 130, 246, 0.45);
  background: radial-gradient(circle at 30% 30%, rgba(52, 211, 153, 0.65), rgba(8, 47, 73, 0.75));
  box-shadow: 0 20px 38px -22px rgba(14, 165, 233, 0.9), inset 0 0 18px rgba(15, 118, 110, 0.35);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.section-icon::before {
  content: '';
  position: absolute;
  inset: 9px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  opacity: 0.8;
}

.section-icon::after {
  content: '';
  position: absolute;
  width: 150%;
  height: 150%;
  border-radius: 50%;
  border: 1px solid rgba(59, 130, 246, 0.25);
  animation: orbit-spin 7s linear infinite;
}

.section-icon-planet {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 10px;
  background: linear-gradient(150deg, #34d399, #06b6d4);
  box-shadow: 0 12px 18px -12px rgba(6, 182, 212, 0.9);
  opacity: 0.9;
  transform: translate(-8px, -8px);
}

.section-icon-orbit {
  position: absolute;
  width: 70%;
  height: 70%;
  border-radius: 9999px;
  border: 1px dashed rgba(255, 255, 255, 0.25);
  animation: orbit-spin 8s linear infinite reverse;
}

.section-icon i {
  position: relative;
  color: #ecfeff;
  font-size: 1.05rem;
  text-shadow: 0 6px 20px rgba(6, 182, 212, 0.55);
}

[data-theme="light"] .section-icon {
  border-color: rgba(14, 165, 233, 0.35);
  background: radial-gradient(circle at 20% 30%, rgba(59, 130, 246, 0.45), rgba(14, 165, 233, 0.32));
}

[data-theme="light"] .section-icon i {
  color: #0f172a;
  text-shadow: none;
}

.terminal-panel {
  background-color: var(--color-terminal-bg) !important;
  border-color: var(--color-terminal-border) !important;
}

.terminal-header {
  background-color: var(--color-terminal-header-bg) !important;
  border-color: var(--color-terminal-border) !important;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Utility to completely hide scrollbar for Terminal */
.scrollbar-hide::-webkit-scrollbar {
  display: none;
}

.scrollbar-hide {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.isolate-layer {
  isolation: isolate;
}

/* Animations */
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes pulse-slow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes skeleton-shine {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}

@keyframes orbit-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-blink {
  animation: blink 1s step-end infinite;
}

.animate-float {
  animation: float 6s ease-in-out infinite;
}

.animate-pulse-slow {
  animation: pulse-slow 4s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-fade-in {
  animation: fade-in 0.5s ease-out forwards;
}

/* Terminal cursor */
.terminal-cursor {
  display: inline-block;
  width: 8px;
  height: 16px;
  background-color: #10b981;
  vertical-align: middle;
  margin-left: 4px;
  animation: blink 1s step-end infinite;
}

/* Bookmark layout */
.bookmark-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.85rem;
}

/* Bookmark card styles */
.bookmark-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--color-card-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--color-card-border);
  border-radius: 12px;
  transition: all 0.2s ease;
  cursor: pointer;
  color: var(--color-text-primary);
  overflow: hidden !important;
  /* 强制限制所有内容不超出 */
  contain: layout;
  max-width: 100%;
}

.bookmark-card:hover {
  background: var(--color-card-hover);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 15px 30px -25px rgba(15, 23, 42, 0.8);
}

.bookmark-card.edit-mode {
  cursor: move;
  position: relative;
  border: 1px dashed rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.02), rgba(139, 92, 246, 0.02));
  transition: all 0.2s ease;
}

.bookmark-card.edit-mode::before {
  content: '⋮⋮';
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 10px;
  color: var(--color-text-muted);
  opacity: 0.6;
  letter-spacing: -2px;
  pointer-events: none;
  z-index: 1;
}

.bookmark-card.edit-mode:hover {
  border-color: rgba(16, 185, 129, 0.6);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.04), rgba(139, 92, 246, 0.04));
  transform: translateY(-2px);
  box-shadow: 0 8px 25px -15px rgba(16, 185, 129, 0.4);
}

.bookmark-card.edit-mode .favicon {
  margin-left: 12px;
}

.bookmark-card.drag-over {
  border: 2px solid #10b981;
  background: rgba(16, 185, 129, 0.08);
  transform: scale(1.02);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.3), inset 0 0 15px rgba(16, 185, 129, 0.1);
}

.bookmark-card.drag-over::after {
  content: '拖放到此处';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(16, 185, 129, 0.9);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
  z-index: 10;
  animation: pulse-drag 1.5s ease-in-out infinite;
}

@keyframes pulse-drag {
  0%, 100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
}

.bookmark-card.opacity-50 {
  opacity: 0.5;
}

.bookmark-card .favicon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.bookmark-card .favicon img {
  width: 16px;
  height: 16px;
  object-fit: contain;
}

.bookmark-card .title-container {
  display: flex;
  align-items: center;
  flex-grow: 1;
  min-width: 0; /* Allow flex item to shrink below content size */
  overflow: hidden !important;
  position: relative;
  max-width: 100%;
  /* 强制裁剪，不允许任何元素超出 */
  isolation: isolate;
}

.bookmark-card .title {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden !important;
  text-overflow: ellipsis;
  flex-grow: 1;
  position: relative;
  width: 100%;
  max-width: 100%;
  display: block;
  --marquee-duration: 10s;
  min-height: 20px; /* 确保有高度 */
}

/* 走马灯效果 */
.bookmark-card .title.marquee {
  text-overflow: clip;
}

.bookmark-card .title.marquee .marquee-track {
  display: inline-flex;
  align-items: center;
  gap: 2rem;
  white-space: nowrap;
  position: absolute;
  left: 0;
  top: 0;
  animation: marquee-scroll var(--marquee-duration, 10s) linear infinite;
  animation-play-state: paused;
  pointer-events: none;
}

.bookmark-card .title.marquee .marquee-segment {
  display: inline-block;
  white-space: nowrap;
}

.bookmark-card:hover .title.marquee .marquee-track {
  animation-play-state: running;
}

/* 手机端自动走马灯 */
@media (max-width: 768px) {
  .bookmark-card .title.marquee .marquee-track {
    animation-play-state: running;
  }
}

@keyframes marquee-scroll {
  0% {
    transform: translateX(0%);
  }
  100% {
    transform: translateX(-50%);
  }
}

.bookmark-card .edit-bookmark-btn {
  margin-left: 4px;
  padding: 2px;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.2s ease;
}

.bookmark-card .edit-bookmark-btn:hover {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.bookmark-card.has-description {
  overflow: visible !important;
}

.bookmark-card.has-description:hover,
.bookmark-card.has-description:focus-within {
  z-index: 5;
  overflow: visible !important;
}

/* 描述提示框 - 精致优雅设计 */
.bookmark-card .description-popover {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 12px);
  padding: 12px 16px;
  background: var(--color-surface);
  border: 1px solid var(--color-card-border);
  border-radius: 12px;
  color: var(--color-text-secondary);
  font-size: 13px;
  line-height: 1.6;
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 6px) scale(0.96);
  transition: opacity 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), 
              transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), 
              visibility 0.25s;
  z-index: 100;
  pointer-events: none;
  box-shadow: 
    0 0 0 1px rgba(16, 185, 129, 0.08),
    0 12px 28px -8px rgba(2, 6, 23, 0.5),
    0 4px 12px -4px rgba(16, 185, 129, 0.15);
  backdrop-filter: blur(16px);
  width: max-content;
  max-width: 300px;
  min-width: 180px;
  word-wrap: break-word;
  white-space: pre-wrap;
}

/* 小三角箭头 */
.bookmark-card .description-popover::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 12px;
  height: 12px;
  background: var(--color-surface);
  border-right: 1px solid var(--color-card-border);
  border-bottom: 1px solid var(--color-card-border);
  transform: translateX(-50%) rotate(45deg);
  z-index: -1;
}

/* 显示状态 - 带弹性动画 */
.bookmark-card .description-popover.visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0) scale(1);
}

/* 浅色主题适配 */
[data-theme="light"] .bookmark-card .description-popover {
  box-shadow: 
    0 0 0 1px rgba(16, 185, 129, 0.12),
    0 12px 28px -8px rgba(15, 23, 42, 0.25),
    0 4px 12px -4px rgba(16, 185, 129, 0.2);
}

/* 移动端优化 */
@media (max-width: 768px) {
  .bookmark-card .description-popover {
    max-width: 260px;
    min-width: 160px;
    font-size: 12px;
    padding: 10px 14px;
  }
}

.skeleton-grid {
  gap: 1rem;
}

.skeleton-card {
  position: relative;
  overflow: hidden;
  pointer-events: none;
}

.skeleton-block,
.skeleton-line,
.skeleton-pill {
  display: inline-block;
  background: linear-gradient(90deg, rgba(148, 163, 184, 0.15), rgba(148, 163, 184, 0.35), rgba(148, 163, 184, 0.15));
  background-size: 200px 100%;
  animation: skeleton-shine 1.4s ease-in-out infinite;
}

.skeleton-block {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.skeleton-line {
  height: 10px;
  border-radius: 9999px;
  display: block;
  margin-top: 4px;
}

.skeleton-pill {
  height: 24px;
  width: 82px;
  border-radius: 9999px;
}

.category-nav-skeleton {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.state-card {
  border: 1px solid var(--color-state-card-border);
  border-radius: 24px;
  padding: 2.5rem 2rem;
  background: var(--color-state-card-bg);
  text-align: center;
  color: var(--color-text-primary);
  backdrop-filter: blur(16px);
  box-shadow: 0 40px 80px -40px rgba(2, 6, 23, 0.5);
}

.state-card .state-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: #c7d2fe;
}

.state-card.error .state-icon {
  color: #fb7185;
  background: rgba(251, 113, 133, 0.12);
  border-color: rgba(251, 113, 133, 0.35);
}

.state-message {
  font-size: 0.95rem;
  color: var(--color-text-secondary);
  margin: 0;
  line-height: 1.6;
}

.state-actions {
  margin-top: 1.25rem;
  display: flex;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.state-actions .btn {
  pointer-events: auto;
}

.btn-compact {
  padding: 0.55rem 1.25rem;
  font-size: 0.9rem;
  gap: 0.4rem;
}

.site-footer {
  width: min(520px, calc(100% - 2.5rem));
  max-width: 100%;
  margin: clamp(32px, 6vh, 56px) auto clamp(16px, 3vh, 32px);
  padding-top: 1rem;
  text-align: center;
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  color: var(--color-text-secondary);
  font-size: 0.82rem;
  line-height: 1.4;
  background: transparent;
  border-radius: 0;
  backdrop-filter: none;
}

.site-footer p {
  margin: 0;
  color: inherit;
}

.site-footer a {
  color: var(--color-text-muted);
  transition: color 0.2s ease;
}

.site-footer a:hover {
  color: #10b981;
}

@media (max-width: 640px) {
  .site-footer {
    padding-top: 0.75rem;
    font-size: 0.78rem;
    margin: 24px auto 20px;
  }
}

.bookmark-card.edit-mode .delete-bookmark-btn {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  background: #ef4444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 10px;
  cursor: pointer !important;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.bookmark-card.edit-mode:hover .delete-bookmark-btn {
  opacity: 1;
}

/* Category header */
.category-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.category-title-container {
  display: flex;
  align-items: center;
}

.category-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-left: 2px solid #10b981;
  padding-left: 8px;
}

.edit-category-btn {
  margin-left: 4px;
  padding: 2px;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 2px;
  transition: all 0.2s ease;
}

.edit-category-btn:hover {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
}

.delete-category-btn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.2s ease;
}

.delete-category-btn:hover {
  color: #ef4444;
}

/* Add button */
.add-bookmark-btn {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 10px 18px;
  border: 1px dashed rgba(148, 163, 184, 0.5);
  border-radius: 9999px;
  color: var(--color-text-muted);
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  cursor: pointer;
  min-height: unset;
  width: auto;
  min-width: 190px;
}

.add-bookmark-btn:hover {
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.3);
  background: rgba(16, 185, 129, 0.08);
}

.category-nav-btn {
  border: 1px solid rgba(148, 163, 184, 0.35);
  color: var(--color-text-muted);
  background: var(--color-panel-bg);
  border-radius: 9999px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all 0.2s ease;
}

.category-nav-btn:hover {
  color: var(--color-text-primary);
  border-color: rgba(16, 185, 129, 0.4);
}

.category-nav-btn.active {
  color: #10b981;
  border-color: rgba(16, 185, 129, 0.6);
  background: rgba(16, 185, 129, 0.2);
}

/* Modal styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: var(--color-card-bg);
  border: 1px solid var(--color-card-border);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  animation: fade-in 0.2s ease-out;
}

.modal-header {
  margin-bottom: 16px;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: #f1f5f9;
  margin: 0;
}

.modal-body {
  margin-bottom: 20px;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--color-input-bg);
  border: 1px solid var(--color-input-border);
  border-radius: 8px;
  color: var(--color-text-primary);
  font-size: 14px;
  margin-bottom: 12px;
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: #10b981;
}

/* Edit title input */
.edit-title-input {
  width: 100%;
  padding: 4px 8px;
  background: var(--color-input-bg);
  border: 1px solid #10b981;
  border-radius: 4px;
  color: var(--color-text-primary);
  font-size: 14px;
  font-weight: 500;
  outline: none;
}

/* Custom password input container */
.password-input-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 50px;
  background: var(--color-input-bg);
  border: 1px solid var(--color-input-border);
  border-radius: 0.5rem; /* rounded-lg */
  transition: all 0.2s ease;
}

.password-input-container:focus-within {
  border-color: rgba(16, 185, 129, 0.5); /* emerald-500/50 */
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.3); /* emerald-500/30 */
}

/* Custom password input */
.password-input {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--color-text-primary);
  text-align: center;
  font-size: 1rem;
  font-weight: 400;
}

.password-input::placeholder {
  color: var(--color-text-muted);
}

.password-input:focus {
  outline: none;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary {
  background: transparent;
  border: 1px solid #64748b;
  color: #94a3b8;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #f1f5f9;
  border-color: #94a3b8;
}

.btn-primary {
  background: #10b981;
  border: 1px solid #10b981;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  background: #059669;
  border-color: #059669;
}

/* Notification Stack */
.toast-stack {
  position: fixed;
  top: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(420px, calc(100% - 2.5rem));
  z-index: 200;
  pointer-events: none;
}

.toast-bubble {
  background: var(--color-toast-bg);
  border: 1px solid var(--color-toast-border);
  border-radius: 9999px;
  padding: 0.85rem 1.25rem;
  color: var(--color-text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  display: inline-flex;
  pointer-events: auto;
  align-items: center;
  gap: 0.6rem;
  box-shadow: 0 25px 40px -20px rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(10px);
  opacity: 0;
  transform: translateY(-12px) scale(0.98);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast-bubble::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: #60a5fa;
  box-shadow: 0 0 10px rgba(96, 165, 250, 0.7);
}

.toast-bubble.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.toast-bubble.success::before {
  background: #34d399;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.7);
}

.toast-bubble.error::before {
  background: #fb7185;
  box-shadow: 0 0 10px rgba(251, 113, 133, 0.7);
}

.toast-bubble.warning::before {
  background: #fbbf24;
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.7);
}

.toast-bubble.info::before {
  background: #60a5fa;
}

/* Auth Modal Redesign */
.auth-modal-content {
  background: linear-gradient(145deg, var(--color-card-bg), var(--color-surface));
  border: 1px solid var(--color-card-border);
  border-radius: 16px;
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

.auth-modal-content::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, #10b981, #8b5cf6, #10b981);
  background-size: 200% 100%;
  animation: gradient 3s linear infinite;
}

@keyframes gradient {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.auth-header {
  text-align: center;
  margin-bottom: 2rem;
}

.auth-icon {
  width: 60px;
  height: 60px;
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.auth-icon svg {
  color: #10b981;
  width: 28px;
  height: 28px;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: 0.5rem;
}

.auth-subtitle {
  font-size: 0.875rem;
  color: #94a3b8;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.input-group {
  text-align: left;
}

.input-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: 0.5rem;
}

.password-input-wrapper {
  position: relative;
}

.auth-input {
  width: 100%;
  padding: 0.75rem 1rem 0.75rem 3rem;
  background: var(--color-input-bg);
  border: 1px solid var(--color-input-border);
  border-radius: 0.5rem;
  color: var(--color-text-primary);
  font-size: 1rem;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.auth-input:focus {
  outline: none;
  border-color: rgba(16, 185, 129, 0.5);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.auth-input::placeholder {
  color: var(--color-text-muted);
}

.input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
}

.auth-hint {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.auth-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.auth-actions .btn {
  flex: 1;
  padding: 0.75rem;
  font-weight: 600;
  border-radius: 0.5rem;
}

/* Admin mode indicator */
.admin-mode-indicator {
  display: none;
  align-items: center;
  gap: 6px;
  background: rgba(249, 115, 22, 0.2);
  color: #f97316;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid rgba(249, 115, 22, 0.3);
  font-size: 10px;
  font-weight: 500;
}

.admin-mode .admin-mode-indicator {
  display: flex;
}

[data-theme="light"] .text-white,
[data-theme="light"] .text-slate-200,
[data-theme="light"] .text-slate-300 {
  color: #0f172a !important;
}

[data-theme="light"] .text-slate-400,
[data-theme="light"] .text-slate-500,
[data-theme="light"] .text-slate-600,
[data-theme="light"] .text-slate-700 {
  color: #475569 !important;
}

/* 浅色模式 - 书签标题更清晰 */
[data-theme="light"] .bookmark-card .title {
  color: #1e293b !important;
  font-weight: 600;
}

/* 浅色模式 - 走马灯文本颜色 */
[data-theme="light"] .bookmark-card:hover .title.marquee::before,
[data-theme="light"] .bookmark-card .title.marquee::before {
  color: #1e293b !important;
}

/* 浅色模式 - 添加书签按钮更清晰 */
[data-theme="light"] .add-bookmark-btn {
  color: #334155 !important;
  border-color: rgba(100, 116, 139, 0.4) !important;
  font-weight: 700;
}

[data-theme="light"] .add-bookmark-btn:hover {
  color: #059669 !important;
  border-color: rgba(16, 185, 129, 0.5) !important;
}

/* 浅色模式 - 页脚和备案号更清晰 */
[data-theme="light"] .site-footer {
  color: #475569 !important;
  border-top-color: rgba(100, 116, 139, 0.3) !important;
}

[data-theme="light"] .site-footer p {
  color: #475569 !important;
}

[data-theme="light"] .site-footer a {
  color: #334155 !important;
  font-weight: 500;
}

[data-theme="light"] .site-footer a:hover {
  color: #059669 !important;
}

/* 浅色模式 - 分类标题更清晰 */
[data-theme="light"] .category-title {
  color: #334155 !important;
  font-weight: 700;
}

[data-theme="light"] .bg-white\/5 {
  background-color: rgba(255, 255, 255, 0.45) !important;
}

[data-theme="light"] .border-white\/10,
[data-theme="light"] .border-white\/5 {
  border-color: rgba(148, 163, 184, 0.2) !important;
}

[data-theme="light"] .bookmark-card {
  border-color: rgba(148, 163, 184, 0.25) !important;
}

[data-theme="light"] .bookmark-card:hover {
  border-color: rgba(148, 163, 184, 0.4) !important;
  box-shadow: 0 15px 30px -25px rgba(15, 23, 42, 0.25) !important;
}

[data-theme="light"] .category-nav-btn {
  background: rgba(255, 255, 255, 0.5) !important;
  border-color: rgba(148, 163, 184, 0.25) !important;
}

[data-theme="light"] .category-nav-btn:hover {
  background: rgba(255, 255, 255, 0.65) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}

[data-theme="light"] .category-nav-btn.active {
  background: rgba(16, 185, 129, 0.12) !important;
  border-color: rgba(16, 185, 129, 0.35) !important;
}

/* Enhanced Responsive Design */
@media (max-width: 1024px) {
  .bookmark-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.9rem;
  }
  
  .section-heading {
    margin-bottom: 1.5rem;
  }
}

@media (max-width: 768px) {
  .bookmark-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.8rem;
  }
  
  .site-header {
    padding: clamp(16px, 4vw, 24px) 0 clamp(12px, 3vw, 20px);
  }
  
  .bookmark-card {
    padding: clamp(12px, 3vw, 16px) clamp(12px, 3vw, 20px);
    min-height: 88px;
  }
  
  .section-heading {
    margin-bottom: 1.2rem;
  }
  
  .auth-modal-content {
    padding: 1.5rem;
    margin: 1rem;
  }
  
  .modal-content {
    margin: 1rem;
    max-height: calc(100vh - 2rem);
  }
  
  .category-nav {
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
  }
  
  .category-nav-btn {
    font-size: 11px;
    padding: 5px 14px;
  }
  
  .nav-pill,
  .theme-toggle-btn {
    padding: 0.45rem 0.8rem;
    font-size: 0.8rem;
    gap: 0.3rem;
  }
  
  .nav-pill i,
  .theme-toggle-btn i {
    font-size: 0.8rem;
  }
  
  .nav-pill span,
  .theme-toggle-btn span {
    font-size: 0.7rem;
  }
}

@media (max-width: 640px) {
  .bookmark-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.7rem;
  }
  
  .site-header {
    padding: 14px 0 10px;
  }
  
  .bookmark-card {
    padding: 10px 12px;
    min-height: 80px;
    gap: 10px;
  }
  
  .bookmark-card .title {
    font-size: 13px;
    line-height: 1.4;
  }
  
  .bookmark-card .description {
    font-size: 10px;
    margin-top: 4px;
    display: none;
  }
  
  .favicon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
  }
  
  .section-heading-text {
    font-size: clamp(1rem, 5vw, 1.25rem);
  }
  
  .auth-modal-content {
    padding: 1.25rem;
    margin: 0.75rem;
  }
  
  .modal-content {
    margin: 0.75rem;
    max-height: calc(100vh - 1.5rem);
  }
  
  .auth-title {
    font-size: 1.2rem;
    margin-bottom: 1.2rem;
  }
  
  .auth-actions {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .theme-toggle-btn {
    width: 44px;
    height: 44px;
    padding: 0.5rem;
    touch-action: manipulation;
    justify-content: center;
    gap: 0.25rem;
  }
  
  .theme-toggle-btn i {
    font-size: 0.9rem;
  }
  
  .theme-toggle-btn span {
    display: none;
  }
  
  .site-footer {
    padding-top: 0.6rem;
    font-size: 0.76rem;
    margin: 20px auto 16px;
  }
  
  .form-actions {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .form-actions button {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .bookmark-grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
    padding: 0 0.5rem;
  }
  
  .bookmark-card {
    padding: 12px 16px;
    min-height: 72px;
    display: flex;
    align-items: center;
    gap: 12px;
  }
  
  .bookmark-card .description {
    display: none;
  }
  
  .bookmark-card .title-container {
    flex: 1;
    min-width: 0;
    overflow: hidden;
  }
  
  .bookmark-card .title {
    font-size: 14px;
    line-height: 1.4;
  }
  
  .category-nav {
    padding: 0 0.5rem;
    gap: 0.4rem;
  }
  
  .category-nav-btn {
    font-size: 12px;
    padding: 6px 12px;
  }
  
  .modal-content {
    margin: 0.5rem;
    padding: 1rem;
    max-height: calc(100vh - 1rem);
  }
  
  .auth-modal-content {
    margin: 0.5rem;
    padding: 1rem;
  }
  
  .site-footer {
    padding: 0 1rem 0.6rem;
    font-size: 0.74rem;
  }
  
  .theme-toggle-btn,
  .nav-pill {
    width: 40px;
    height: 40px;
    padding: 0.4rem;
    justify-content: center;
  }
  
  .theme-toggle-btn span,
  .nav-pill span {
    display: none;
  }
  
  .theme-toggle-btn i,
  .nav-pill i {
    font-size: 0.85rem;
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
  .bookmark-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
  }
  
  .bookmark-card:hover {
    transform: scale(1.02);
  }
  
  .bookmark-card:active {
    transform: scale(0.98);
  }
  
  .category-nav-btn {
    transition: transform 0.15s ease;
  }
  
  .category-nav-btn:hover {
    transform: scale(1.05);
  }
  
  .category-nav-btn:active {
    transform: scale(0.95);
  }
}

/* Mobile device specific styles */
.mobile-device {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.mobile-device .bookmark-card {
  cursor: pointer;
}

.mobile-device .bookmark-card .title,
.mobile-device .bookmark-card .description,
.mobile-device .category-title {
  -webkit-user-select: text;
  user-select: text;
}

/* Swipe delete gesture */
.bookmark-card.swipe-delete {
  transform: translateX(-60px);
  transition: transform 0.3s ease;
}

.bookmark-card.swipe-delete::after {
  content: '删除';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: #ef4444;
  color: white;
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  z-index: 10;
}

/* Long press effect */
.bookmark-card.long-press {
  animation: pulse 0.5s ease-in-out;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(0.95); }
}

/* Mobile drag indicators */
.mobile-device .bookmark-card.drag-over {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
}

/* Mobile modal improvements */
.mobile-device .modal-content {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  max-height: calc(100vh - 2rem);
  margin: 1rem;
}

.mobile-device .modal-content .form-group {
  margin-bottom: 1.2rem;
}

.mobile-device .modal-content input,
.mobile-device .modal-content textarea {
  font-size: 16px; /* Prevent zoom on focus */
  padding: 14px 16px;
  border-radius: 12px;
}

.mobile-device .modal-content button {
  min-height: 48px;
  touch-action: manipulation;
  border-radius: 12px;
}

.mobile-device .modal-overlay {
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Mobile form improvements */
.mobile-device .form-actions {
  position: sticky;
  bottom: 0;
  background: inherit;
  padding-top: 1rem;
  margin: 0 -1rem -1rem;
  padding: 1rem;
  border-top: 1px solid var(--color-input-border);
}

.mobile-device .form-group label {
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: block;
}

.mobile-device .form-group input:focus,
.mobile-device .form-group textarea:focus {
  outline: none;
  border-color: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Mobile keyboard optimization */
@media (max-height: 500px) and (orientation: landscape) {
  .modal-content {
    max-height: 90vh;
    margin: 0.5rem;
  }
  
  .modal-content h2 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
  }
  
  .form-group {
    margin-bottom: 0.8rem;
  }
  
  .form-group label {
    font-size: 0.9rem;
  }
}

/* Mobile navigation scroll */
.mobile-device .category-nav {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.mobile-device .category-nav::-webkit-scrollbar {
  display: none;
}

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, 
    rgba(148, 163, 184, 0.1) 25%, 
    rgba(148, 163, 184, 0.2) 50%, 
    rgba(148, 163, 184, 0.1) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-card {
  /* Inherit from bookmark-card base styles */
  border: 1px solid var(--color-card-border);
  border-radius: 16px;
  padding: 12px 16px;
  background: var(--color-card-bg);
  backdrop-filter: blur(6px);
  transition: all 0.2s ease;
  cursor: default;
  pointer-events: none;
  opacity: 0.6;
}

.skeleton-card .favicon,
.skeleton-card .title,
.skeleton-card .description {
  visibility: hidden;
}

.skeleton-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 16px;
  background: linear-gradient(90deg, 
    rgba(148, 163, 184, 0.1) 25%, 
    rgba(148, 163, 184, 0.2) 50%, 
    rgba(148, 163, 184, 0.1) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}

/* Performance optimizations */
.bookmark-card {
  will-change: transform;
}

.bookmark-card.has-description {
  overflow: visible !important;
}

.bookmark-card.has-description:hover {
  overflow: visible !important;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Loading states */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, 
    transparent, 
    rgba(255, 255, 255, 0.2), 
    transparent
  );
  animation: loading-shimmer 1.5s infinite;
}

@keyframes loading-shimmer {
  0% { left: -100%; }
  100% { left: 100%; }
}

/* Fade in animation for better UX */
.fade-in {
  animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Staggered animation for cards */
.bookmark-grid > * {
  animation: fadeInUp 0.4s ease-out forwards;
  animation-delay: calc(var(--card-index, 0) * 0.05s);
  opacity: 0;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
