/* ==========================================================================
   Gefei Knowledge Base - Production Design System & Theme Styles
   Adhering to Impeccable Design & Craft Floor Standards
   ========================================================================== */

:root {
  /* Color Palette - Light Mode (Refined Slate & Indigo) */
  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-muted: #f1f5f9;
  --bg-subtle: #e2e8f0;
  
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-focus: #4f46e5;
  
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #f8fafc;
  
  --accent-primary: #4338ca;
  --accent-primary-hover: #3730a3;
  --accent-soft: #eef2ff;
  --accent-text: #3730a3;
  
  --tag-bg: #f1f5f9;
  --tag-text: #334155;
  --tag-border: #e2e8f0;
  
  --badge-article-bg: #eff6ff;
  --badge-article-text: #1d4ed8;
  --badge-pdf-bg: #fef2f2;
  --badge-pdf-text: #b91c1c;
  --badge-video-bg: #faf5ff;
  --badge-video-text: #7e22ce;
  --badge-template-bg: #ecfdf5;
  --badge-template-text: #047857;
  
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.05);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

[data-theme="dark"] {
  /* Color Palette - Dark Mode (Warm Slate/Charcoal) */
  --bg-app: #090d16;
  --bg-surface: #111827;
  --bg-surface-elevated: #1f2937;
  --bg-muted: #1e293b;
  --bg-subtle: #334155;
  
  --border-subtle: #1e293b;
  --border-strong: #334155;
  --border-focus: #6366f1;
  
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-inverse: #0f172a;
  
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-soft: rgba(99, 102, 241, 0.15);
  --accent-text: #c7d2fe;
  
  --tag-bg: #1e293b;
  --tag-text: #cbd5e1;
  --tag-border: #334155;
  
  --badge-article-bg: rgba(37, 99, 235, 0.18);
  --badge-article-text: #93c5fd;
  --badge-pdf-bg: rgba(220, 38, 38, 0.18);
  --badge-pdf-text: #fca5a5;
  --badge-video-bg: rgba(147, 51, 234, 0.18);
  --badge-video-text: #d8b4fe;
  --badge-template-bg: rgba(16, 185, 129, 0.18);
  --badge-template-text: #6ee7b7;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.55);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.65);
}

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

html {
  font-family: var(--font-sans);
  background-color: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.6;
  scroll-behavior: smooth;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-app);
  color: var(--text-primary);
}

/* Craft Floor Details */
::selection {
  background-color: var(--accent-primary);
  color: #ffffff;
}

input, textarea {
  caret-color: var(--accent-primary);
  font-family: inherit;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}
::-webkit-scrollbar-track {
  background: var(--bg-app);
}
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ==========================================================================
   Header & App Bar
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  backdrop-filter: blur(8px);
}

.header-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex-shrink: 0;
}

.brand-logo-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background-color: var(--accent-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  flex-shrink: 0;
}

.brand-logo-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.brand-logo-icon svg {
  width: 20px;
  height: 20px;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  background-color: var(--accent-soft);
  color: var(--accent-text);
  border: 1px solid var(--border-subtle);
}

.brand-subtitle {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Search Bar */
.search-wrapper {
  flex: 1;
  max-width: 580px;
  position: relative;
}

.search-icon-prefix {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 40px;
  padding: 0 5.5rem 0 2.5rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-muted);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: all 0.15s ease;
}

.search-input:focus {
  background-color: var(--bg-surface);
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--accent-soft);
  outline: none;
}

.search-kbd-hint {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

.clear-search-btn {
  position: absolute;
  right: 3rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: var(--radius-full);
}

.clear-search-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-subtle);
}

/* Header Actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-icon-action {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.btn-icon-action:hover {
  background-color: var(--bg-muted);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn-icon-action.active {
  background-color: var(--accent-soft);
  color: var(--accent-text);
  border-color: var(--accent-primary);
}

.btn-icon-action svg {
  width: 18px;
  height: 18px;
}

/* ==========================================================================
   Hero & Interactive Roadmap Section
   ========================================================================== */
.hero-section {
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  padding: 2.25rem 1.5rem 1.75rem;
}

.hero-inner {
  max-width: 1440px;
  margin: 0 auto;
}

.hero-header-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.hero-headline {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  line-height: 1.25;
  margin-bottom: 0.4rem;
}

.hero-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  max-width: 720px;
}

.hero-stats-strip {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.85rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.stat-pill strong {
  color: var(--text-primary);
  font-weight: 700;
}

/* Roadmap Track */
.roadmap-box {
  background-color: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
}

.roadmap-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.roadmap-title {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.roadmap-title svg {
  width: 16px;
  height: 16px;
  color: var(--accent-primary);
}

.roadmap-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.roadmap-steps-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
}

.roadmap-step-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
}

.roadmap-step-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.roadmap-step-card.active {
  border-color: var(--accent-primary);
  background-color: var(--accent-soft);
  box-shadow: 0 0 0 2px var(--accent-primary);
}

.step-num-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-full);
  background-color: var(--bg-muted);
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.roadmap-step-card.active .step-num-badge {
  background-color: var(--accent-primary);
  color: #ffffff;
}

.step-card-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 0.35rem;
}

.step-card-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ==========================================================================
   Main Layout Container
   ========================================================================== */
.main-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 3.5rem;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
  flex: 1;
  width: 100%;
}

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

.sidebar-panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.sidebar-title {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.category-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cat-item-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.cat-item-btn:hover {
  background-color: var(--bg-muted);
  color: var(--text-primary);
}

.cat-item-btn.active {
  background-color: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}

.cat-btn-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.cat-btn-left svg {
  width: 16px;
  height: 16px;
  color: var(--text-muted);
}

.cat-item-btn.active .cat-btn-left svg {
  color: var(--accent-primary);
}

.cat-count-badge {
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
  background-color: var(--bg-muted);
  color: var(--text-muted);
  font-weight: 600;
}

.cat-item-btn.active .cat-count-badge {
  background-color: var(--bg-surface);
  color: var(--accent-primary);
}

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

.tag-btn {
  font-size: 0.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-full);
  background-color: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid var(--tag-border);
  transition: all 0.15s ease;
}

.tag-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.tag-btn.active {
  background-color: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

/* Quick Tools Box in Sidebar */
.sidebar-info-card {
  background-color: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.sidebar-info-title {
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ==========================================================================
   Content Stream Area
   ========================================================================== */
.content-area {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Filter Toolbar */
.toolbar-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.filter-left-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.current-view-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.result-count-label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.active-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  padding: 0.15rem 0.5rem;
  background-color: var(--accent-soft);
  color: var(--accent-text);
  border-radius: var(--radius-full);
}

.clear-filter-x {
  cursor: pointer;
  display: flex;
  align-items: center;
}

.toolbar-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.select-dropdown {
  height: 34px;
  padding: 0 1.75rem 0 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  color: var(--text-primary);
  font-size: 0.8rem;
  font-weight: 500;
  outline: none;
  cursor: pointer;
}

.view-mode-toggle {
  display: flex;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--bg-surface);
}

.view-mode-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.view-mode-btn:hover {
  color: var(--text-primary);
}

.view-mode-btn.active {
  background-color: var(--bg-muted);
  color: var(--accent-primary);
}

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

/* ==========================================================================
   Resource Cards Grid (Cards View)
   ========================================================================== */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.card-item {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  position: relative;
}

.card-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

/* Cover Image for Articles */
.card-cover-wrap {
  width: 100%;
  height: 160px;
  background-color: var(--bg-muted);
  position: relative;
  overflow: hidden;
}

.card-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.card-item:hover .card-cover-img {
  transform: scale(1.03);
}

.card-cover-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--bg-muted) 0%, var(--bg-subtle) 100%);
  color: var(--text-muted);
}

.card-cover-fallback svg {
  width: 48px;
  height: 48px;
  opacity: 0.4;
}

/* Card Badges */
.card-top-badges {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  display: flex;
  gap: 0.4rem;
  z-index: 2;
}

.type-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.type-badge.article {
  background-color: var(--badge-article-bg);
  color: var(--badge-article-text);
}
.type-badge.pdf {
  background-color: var(--badge-pdf-bg);
  color: var(--badge-pdf-text);
}
.type-badge.conference {
  background-color: var(--badge-video-bg);
  color: var(--badge-video-text);
}
.type-badge.template {
  background-color: var(--badge-template-bg);
  color: var(--badge-template-text);
}

/* Star Bookmark Button */
.star-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: all 0.15s ease;
}

[data-theme="dark"] .star-btn {
  background-color: rgba(17, 24, 39, 0.85);
}

.star-btn:hover {
  transform: scale(1.1);
  color: #f59e0b;
}

.star-btn.starred {
  color: #f59e0b;
}

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

/* Card Body */
.card-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.card-category-text {
  font-weight: 600;
  color: var(--accent-text);
}

.card-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 0.6rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 0.875rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
  max-height: 52px;
  overflow: hidden;
}

.mini-tag {
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  background-color: var(--tag-bg);
  color: var(--tag-text);
  border: 1px solid var(--tag-border);
  white-space: nowrap;
  line-height: 1.4;
  transition: all 0.15s ease;
}

.mini-tag:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

/* Card Footer Actions */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.85rem;
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
  gap: 0.625rem;
  width: 100%;
  box-sizing: border-box;
}

.read-btn {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 0.85rem;
  border-radius: var(--radius-md);
  background-color: var(--accent-primary);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  white-space: nowrap;
  box-shadow: 0 1px 2px rgba(67, 56, 202, 0.2);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  border: 1px solid transparent;
}

.read-btn:hover {
  background-color: var(--accent-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(67, 56, 202, 0.3);
}

.read-btn:active {
  transform: translateY(0);
  box-shadow: 0 1px 2px rgba(67, 56, 202, 0.2);
}

.read-btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.read-btn svg {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  flex-shrink: 0;
  display: block;
}

.read-btn span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  line-height: 1;
}

.secondary-action-btn {
  width: 38px;
  height: 38px;
  min-width: 38px;
  flex-shrink: 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.secondary-action-btn:hover {
  background-color: var(--bg-muted);
  color: var(--text-primary);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.secondary-action-btn:active {
  transform: translateY(0);
}

.secondary-action-btn:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 2px;
}

.secondary-action-btn svg {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  flex-shrink: 0;
  display: block;
}

/* ==========================================================================
   List View Mode (Alternative compact layout)
   ========================================================================== */
.resource-grid.list-view {
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

.resource-grid.list-view .card-item {
  flex-direction: row;
  align-items: center;
  padding: 0.75rem 1.25rem;
}

.resource-grid.list-view .card-cover-wrap {
  display: none;
}

.resource-grid.list-view .card-top-badges {
  position: static;
  margin-right: 0.75rem;
}

.resource-grid.list-view .star-btn {
  position: static;
  margin-left: 0.5rem;
}

.resource-grid.list-view .card-body {
  padding: 0;
  flex: 1;
}

.resource-grid.list-view .card-title {
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
  -webkit-line-clamp: 1;
}

.resource-grid.list-view .card-desc {
  display: none;
}

.resource-grid.list-view .card-tags {
  margin-bottom: 0;
}

.resource-grid.list-view .card-footer {
  padding-top: 0;
  border-top: none;
  margin-left: 1rem;
  margin-top: 0;
  width: auto;
  flex-shrink: 0;
  gap: 0.5rem;
}

.resource-grid.list-view .read-btn {
  padding: 0 1rem;
  height: 34px;
}

.resource-grid.list-view .secondary-action-btn {
  width: 34px;
  height: 34px;
  min-width: 34px;
}

/* ==========================================================================
   Empty States
   ========================================================================== */
.empty-state {
  grid-column: 1 / -1;
  background-color: var(--bg-surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 4rem 2rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.empty-state-icon {
  width: 56px;
  height: 56px;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.empty-state-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.empty-state-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  max-width: 420px;
  margin-bottom: 1.5rem;
}

.btn-reset-filters {
  padding: 0.55rem 1.25rem;
  border-radius: var(--radius-md);
  background-color: var(--accent-primary);
  color: #ffffff;
  font-size: 0.85rem;
  font-weight: 600;
}

/* ==========================================================================
   Immersive Reader Modal
   ========================================================================== */
.reader-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.reader-modal-overlay.active {
  display: flex;
}

.reader-modal-window {
  width: 100%;
  max-width: 1200px;
  height: 90vh;
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalEnter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalEnter {
  from {
    opacity: 0;
    transform: scale(0.97) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.reader-modal-header {
  height: 58px;
  padding: 0 1.25rem;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.modal-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: hidden;
}

.modal-item-badge {
  flex-shrink: 0;
}

.modal-doc-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-modal-action {
  height: 34px;
  padding: 0 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
}

.btn-modal-action:hover {
  background-color: var(--bg-muted);
  color: var(--text-primary);
}

.btn-modal-action svg {
  width: 15px;
  height: 15px;
}

.btn-modal-close {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.btn-modal-close:hover {
  background-color: var(--bg-muted);
  color: var(--text-primary);
}

.reader-modal-body {
  flex: 1;
  background-color: var(--bg-muted);
  overflow: hidden;
  position: relative;
}

.reader-iframe {
  width: 100%;
  height: 100%;
  border: none;
  background-color: #ffffff;
}

/* Conference detail view in Modal */
.conf-modal-content {
  padding: 2.5rem;
  overflow-y: auto;
  height: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.conf-meta-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.conf-path-copy-box {
  background-color: var(--bg-muted);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent-text);
  word-break: break-all;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 2rem 1.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.footer-inner {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1.25rem;
}

.footer-link {
  color: var(--text-secondary);
}

.footer-link:hover {
  color: var(--accent-primary);
}

/* ==========================================================================
   Distilled TL;DR Mode & Fast Playbook Styles
   ========================================================================== */
.btn-header-playbook {
  height: 38px;
  padding: 0 0.95rem;
  border-radius: var(--radius-md);
  background-color: var(--accent-primary);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-header-playbook:hover {
  background-color: var(--accent-primary-hover);
  color: #ffffff;
}

.mode-toggle-group {
  display: flex;
  background-color: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2px;
}

.mode-btn {
  height: 30px;
  padding: 0 0.75rem;
  border-radius: calc(var(--radius-md) - 2px);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.mode-btn:hover {
  color: var(--text-primary);
}

.mode-btn.active {
  background-color: var(--bg-surface);
  color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
}

/* Card Distilled Presentation */
.card-distilled-box {
  background-color: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 0.85rem;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card-distilled-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--accent-text);
  background-color: var(--accent-soft);
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-full);
  align-self: flex-start;
}

.card-distilled-tldr {
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.45;
}

.card-distilled-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: var(--text-secondary);
  font-size: 0.76rem;
}

.card-distilled-steps li {
  position: relative;
  padding-left: 1rem;
  line-height: 1.45;
}

.card-distilled-steps li::before {
  content: "•";
  position: absolute;
  left: 0.25rem;
  color: var(--accent-primary);
  font-weight: bold;
}

.card-distilled-outdated {
  font-size: 0.74rem;
  color: #b91c1c;
  background-color: #fef2f2;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  line-height: 1.4;
  border: 1px solid #fecaca;
}

[data-theme="dark"] .card-distilled-outdated {
  color: #fca5a5;
  background-color: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.3);
}

.card-distilled-valid {
  font-size: 0.74rem;
  color: #047857;
  background-color: #ecfdf5;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  line-height: 1.4;
  border: 1px solid #a7f3d0;
}

[data-theme="dark"] .card-distilled-valid {
  color: #6ee7b7;
  background-color: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
}

/* Reader Modal Tabs */
.reader-modal-tabs {
  height: 42px;
  background-color: var(--bg-muted);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  padding: 0 1.25rem;
  gap: 0.5rem;
}

.reader-tab-btn {
  height: 100%;
  padding: 0 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
}

.reader-tab-btn:hover {
  color: var(--text-primary);
}

.reader-tab-btn.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
  background-color: var(--bg-surface);
}

/* Modal Distilled View */
.modal-distilled-view {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 2.25rem;
  background-color: var(--bg-surface);
}

.modal-distilled-view.active {
  display: block;
}

.mdv-container {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.mdv-tldr-box {
  background-color: var(--accent-soft);
  border: 1px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
}

.mdv-tldr-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-primary);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.mdv-tldr-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
}

.mdv-section {
  background-color: var(--bg-muted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
}

.mdv-section-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.mdv-steps-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.mdv-steps-list li {
  position: relative;
  padding-left: 1.5rem;
  line-height: 1.55;
}

.mdv-steps-list li::before {
  content: "✓";
  position: absolute;
  left: 0.25rem;
  color: #10b981;
  font-weight: 800;
}

.mdv-outdated-box {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  font-size: 0.85rem;
  color: #991b1b;
  line-height: 1.55;
}

[data-theme="dark"] .mdv-outdated-box {
  background-color: rgba(220, 38, 38, 0.12);
  border-color: rgba(220, 38, 38, 0.3);
  color: #fca5a5;
}

.mdv-valid-box {
  background-color: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  font-size: 0.85rem;
  color: #065f46;
  line-height: 1.55;
}

[data-theme="dark"] .mdv-valid-box {
  background-color: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
}

.mdv-formula-box {
  background-color: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-text);
  font-family: var(--font-mono);
}

.mdv-footer-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-width: 1024px) {
  .main-wrapper {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    display: none; /* Can be toggled or folded */
  }
  
  .roadmap-steps-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .roadmap-steps-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .resource-grid {
    grid-template-columns: 1fr;
  }
  
  .hero-headline {
    font-size: 1.45rem;
  }
  
  .search-wrapper {
    max-width: 100%;
  }
}

/* ==========================================================================
   Bedtime Floating Audio Player (催眠听书浮窗播放器)
   ========================================================================== */
.btn-modal-tts {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.22));
  color: var(--accent-primary);
  border-color: rgba(16, 185, 129, 0.35);
  font-weight: 600;
}

.btn-modal-tts:hover {
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

.btn-modal-tts.speaking {
  background: var(--accent-primary);
  color: #ffffff;
  animation: pulseBedtime 2s infinite ease-in-out;
}

@keyframes pulseBedtime {
  0% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  70% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0); }
  100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.bedtime-player-bar {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  width: min(920px, calc(100% - 2rem));
  background: rgba(var(--bg-card-rgb, 255, 255, 255), 0.88);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(255, 255, 255, 0.15) inset;
  z-index: 9999;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
}

[data-theme="dark"] .bedtime-player-bar {
  background: rgba(24, 28, 36, 0.88);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 48px -8px rgba(0, 0, 0, 0.6);
}

.bedtime-player-bar.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.bap-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 0.85rem 1.25rem;
}

.bap-left {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex: 1;
  min-width: 0;
}

.bap-icon-wave {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 24px;
  flex-shrink: 0;
}

.bap-icon-wave span {
  display: block;
  width: 3.5px;
  height: 6px;
  background: var(--accent-primary);
  border-radius: 2px;
  transition: height 0.2s ease;
}

.bap-icon-wave.playing span:nth-child(1) { animation: waveAnim 1.2s ease-in-out infinite 0.1s; }
.bap-icon-wave.playing span:nth-child(2) { animation: waveAnim 1.2s ease-in-out infinite 0.3s; }
.bap-icon-wave.playing span:nth-child(3) { animation: waveAnim 1.2s ease-in-out infinite 0.2s; }
.bap-icon-wave.playing span:nth-child(4) { animation: waveAnim 1.2s ease-in-out infinite 0.4s; }

@keyframes waveAnim {
  0%, 100% { height: 6px; }
  50% { height: 22px; }
}

.bap-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.bap-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bap-sentence {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.bap-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.bap-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.bap-btn svg {
  width: 15px;
  height: 15px;
}

.bap-btn:hover {
  background: var(--bg-surface-hover);
  border-color: var(--border-hover);
}

.bap-btn-primary {
  width: 40px;
  height: 40px;
  background: var(--accent-primary);
  color: #ffffff;
  border-color: var(--accent-primary);
}

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

.bap-btn-primary svg {
  width: 17px;
  height: 17px;
}

.bap-settings {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  flex-shrink: 0;
}

.bap-pill-group {
  display: inline-flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 2px 4px;
  gap: 2px;
}

.bap-pill-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 4px 0 6px;
}

.bap-pill-opt {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  border: none;
  background: transparent;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.bap-pill-opt.active {
  background: var(--bg-surface);
  color: var(--accent-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.bap-select {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: none;
  border-radius: var(--radius-full);
  padding: 3px 8px;
  cursor: pointer;
  outline: none;
}

.bap-timer-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-primary);
  padding: 0 6px;
  font-variant-numeric: tabular-nums;
}

.bap-btn-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-full);
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.bap-btn-close:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.bap-btn-close svg {
  width: 14px;
  height: 14px;
}

@media (max-width: 768px) {
  .bedtime-player-bar {
    bottom: 0.75rem;
    width: calc(100% - 1.25rem);
  }
  .bap-inner {
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 0.75rem;
  }
  .bap-left {
    width: 100%;
    flex: none;
  }
  .bap-controls {
    order: 2;
  }
  .bap-settings {
    order: 3;
    margin-left: auto;
    gap: 0.5rem;
  }
}
