/* Landing Page Styles */
.landing-page {
  background: var(--white, #fff);
  min-height: calc(100vh - var(--header-height, 50px));
  color: var(--text-color, #1D2433);
  width: 100%;
}

/* Hero Section */
.landing-hero {
  padding: 4rem 2rem 2rem;
  text-align: center;
  max-width: 100%;
  margin: 0 auto;
}

.landing-hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

/* Logo + Title */
.landing-logo-title {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 5rem;
  font-weight: 400;
  letter-spacing: -0.03em;
  position: relative;
}

.landing-logo-svg {
  width: 80px;
  height: 80px;
}

.landing-title-text {
  color: var(--text-color, #1D2433);
}

.landing-tagline {
  font-size: 1.125rem;
  color: var(--light-text, #86868b);
  margin: 0;
  font-weight: 400;
}

.landing-alpha-badge {
  position: absolute;
  top: -8px;
  right: -12px;
  font-size: 0.55rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-accent, #5A7A6A);
  background: rgba(90, 122, 106, 0.1);
  border: 1px solid rgba(90, 122, 106, 0.25);
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1;
  white-space: nowrap;
}

/* Search Box */
.landing-search-container {
  width: 100%;
  max-width: 600px;
}

.landing-search-form {
  width: 100%;
}

.landing-search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: white;
  border: 1px solid var(--border-color, #d2d2d7);
  border-radius: 10px;
  transition: all 0.2s ease;
}

.landing-search-box:hover,
.landing-search-box:focus-within {
  border-color: var(--primary-color, #333);
}

.landing-search-icon {
  width: 20px;
  height: 20px;
  stroke: var(--light-text, #86868b);
  flex-shrink: 0;
}

.landing-search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--text-color, #1D2433);
  font-family: inherit;
}

.landing-search-input::placeholder {
  color: var(--light-text, #86868b);
}

.landing-search-kbd {
  padding: 0.25rem 0.5rem;
  background: var(--light-gray, #f5f5f7);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  color: var(--light-text, #86868b);
  font-family: inherit;
  border: 1px solid var(--border-color, #d2d2d7);
}

/* Landing Search Dropdown */
.landing-search-container {
  position: relative;
}

.landing-search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border-color, #d2d2d7);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
  max-height: 380px;
  overflow-y: auto;
  z-index: 100;
  padding: 0.5rem 0;
}

.landing-search-dropdown.active {
  display: block;
}

.lsd-section {
  padding: 0;
}

.lsd-section + .lsd-section {
  border-top: 1px solid var(--border-color, #e5e5e5);
  margin-top: 0.25rem;
  padding-top: 0.25rem;
}

.lsd-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--light-text, #86868b);
  padding: 0.5rem 1rem 0.25rem;
}

.lsd-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 1rem;
  text-decoration: none;
  color: var(--text-color, #1D2433);
  transition: background 0.12s;
  cursor: pointer;
}

.lsd-item:hover {
  background: var(--light-gray, #f5f5f7);
}

.lsd-item-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  background: var(--light-gray, #f5f5f7);
  color: var(--light-text, #86868b);
}

.lsd-item-icon svg {
  stroke: currentColor;
}

.lsd-item-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.lsd-item-title {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lsd-item-summary {
  font-size: 0.75rem;
  color: var(--light-text, #86868b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lsd-item-badge {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  background: var(--light-gray, #f0f0f0);
  color: var(--light-text, #86868b);
}

.lsd-empty {
  padding: 1.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--light-text, #86868b);
}

/* CTA Buttons */
.landing-cta-buttons {
  display: flex;
  gap: 1rem;
}

.landing-btn-primary {
  background: var(--primary-color, #333);
  color: var(--white, #fff);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-lg);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.landing-btn-primary:hover {
  background: var(--color-primary-hover, #1A1816);
  transform: translateY(-1px);
  text-decoration: none;
  color: var(--white, #fff);
}

.landing-btn-secondary {
  background: var(--white, #fff);
  color: var(--text-color, #1D2433);
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color, #d2d2d7);
  font-weight: 500;
  font-size: 0.9375rem;
  text-decoration: none;
  transition: all 0.2s ease;
}

.landing-btn-secondary:hover {
  background: var(--light-gray, #f5f5f7);
  text-decoration: none;
  color: var(--text-color, #1D2433);
}

/* Trusted By Section */
.landing-trusted {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding-top: 1.5rem;
  margin-top: 0.5rem;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.landing-trusted-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: nowrap;
  overflow: hidden;
  max-width: 100%;
}

.trusted-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: all 0.2s ease;
}

.trusted-item:hover {
  background: var(--light-gray, #f5f5f7);
  text-decoration: none;
}

.trusted-item:hover .trusted-logo {
  filter: grayscale(100%) opacity(0.7);
}

.trusted-item:hover .trusted-name {
  color: var(--text-color, #1D2433);
}

.trusted-logo {
  height: 24px;
  width: auto;
  object-fit: contain;
  filter: grayscale(100%) opacity(0.4);
  transition: filter 0.2s ease;
}

.trusted-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--light-text, #86868b);
  transition: color 0.2s ease;
}

.landing-trusted-text {
  font-size: 0.8125rem;
  color: var(--light-text, #86868b);
  margin: 0;
}

.landing-trusted-disclaimer {
  font-size: 0.7rem;
  color: var(--light-text, #aeaeb2);
  font-style: italic;
}

/* Features Grid - Supabase 2-row layout */
.landing-features {
  padding: 1rem 2rem 3rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.landing-features-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: auto auto;
  gap: 1rem;
  width: 100%;
}

/* Card Base Styles */
.landing-feature-card {
  background: white;
  border: 1px solid var(--border-color, #d2d2d7);
  border-radius: 16px;
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 200px;
}

.landing-feature-card:hover {
  border-color: var(--primary-color, #1D2433);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

/* Card Sizes */
.card-large {
  grid-column: span 2;
  flex-direction: row;
  gap: 1rem;
  min-height: 280px;
}

.card-large .card-content {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-large .card-visual {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-small {
  min-height: 280px;
}

.card-quarter {
  min-height: 200px;
}

/* Header */
.landing-feature-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.landing-feature-icon {
  width: 20px;
  height: 20px;
  color: var(--primary-color, #333);
}

.landing-feature-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
}

.landing-feature-header h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-color, #1D2433);
}

.landing-feature-desc {
  font-size: 0.8125rem;
  color: var(--light-text, #86868b);
  line-height: 1.5;
  margin: 0 0 auto;
}

.landing-feature-desc strong {
  color: var(--text-color, #1D2433);
}

.landing-feature-bullets {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.75rem;
  color: var(--light-text, #86868b);
  margin-top: 0.75rem;
}

.landing-feature-bullets span {
  color: var(--color-accent, #5A7A6A);
}

/* ========== VISUAL ELEMENTS ========== */

/* Pages Visual */
.visual-pages-demo {
  position: relative;
  width: 160px;
  height: 180px;
}

.visual-page-item {
  width: 130px;
  background: var(--white, #fff);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color, #d2d2d7);
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  position: relative;
  z-index: 3;
}

.page-title-bar {
  background: var(--border-color, #d2d2d7);
  padding: 6px 8px;
  display: flex;
  gap: 4px;
}

.page-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(0,0,0,0.2);
}

.page-content {
  padding: 10px;
}

.page-heading {
  width: 60%;
  height: 8px;
  background: var(--border-color, #d2d2d7);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.page-math {
  font-family: 'Times New Roman', serif;
  font-style: italic;
  font-size: 0.875rem;
  color: var(--primary-color, #333);
  margin-bottom: 8px;
}

.page-line {
  height: 5px;
  background: var(--border-color, #d2d2d7);
  border-radius: 3px;
  margin-bottom: 5px;
}

.page-line.short {
  width: 70%;
}

.visual-page-stack {
  position: absolute;
  top: 20px;
  left: 30px;
  z-index: 1;
}

.stack-page {
  width: 130px;
  height: 140px;
  background: var(--white, #fff);
  border: 1px solid var(--border-color, #d2d2d7);
  border-radius: var(--radius-lg);
  position: absolute;
}

.stack-page:nth-child(1) {
  transform: rotate(3deg) translate(10px, 10px);
  opacity: 0.6;
}

.stack-page:nth-child(2) {
  transform: rotate(6deg) translate(20px, 20px);
  opacity: 0.3;
}

/* Theorems Visual */
.card-visual-small {
  margin-top: auto;
  padding-top: 0.75rem;
}

.visual-theorem-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.theorem-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.5rem;
  background: var(--white, #fff);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color, #d2d2d7);
}

.theorem-item.dim {
  opacity: 0.5;
}

.theorem-badge {
  font-size: 0.625rem;
  font-weight: 600;
  padding: 2px 6px;
  background: var(--primary-color, #333);
  color: var(--white, #fff);
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.theorem-name {
  font-size: 0.9375rem;
  color: var(--text-color, #1D2433);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Pull Requests Visual */
.visual-pr-list {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.pr-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem;
  background: var(--white, #fff);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color, #d2d2d7);
}

.pr-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pr-status.open {
  background: #28a745;
}

.pr-status.merged {
  background: var(--color-accent, #5A7A6A);
}

.pr-title {
  font-size: 0.75rem;
  color: var(--text-color, #1D2433);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pr-meta {
  font-size: 0.625rem;
  color: var(--light-text, #86868b);
  width: 100%;
  padding-left: 16px;
}

/* Discussions Visual */
.card-visual-quarter {
  margin-top: auto;
  padding-top: 0.5rem;
}

.visual-chat {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.chat-message {
  display: flex;
  align-items: flex-end;
  gap: 0.375rem;
}

.chat-message.reply {
  justify-content: flex-end;
}

.chat-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--border-color, #d2d2d7);
  flex-shrink: 0;
}

.chat-bubble {
  font-size: 0.6875rem;
  padding: 0.375rem 0.5rem;
  background: var(--white, #fff);
  border: 1px solid var(--border-color, #d2d2d7);
  border-radius: var(--radius-lg);
  color: var(--text-color, #1D2433);
  max-width: 80%;
}

.chat-message.reply .chat-bubble {
  background: rgba(51, 51, 51, 0.1);
  border-color: transparent;
}

/* Areas Visual */
.visual-areas {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.area-tag {
  font-size: 0.6875rem;
  padding: 0.25rem 0.5rem;
  background: var(--white, #fff);
  border: 1px solid var(--border-color, #d2d2d7);
  border-radius: var(--radius-sm);
  color: var(--text-color, #1D2433);
}

.area-tag.accent {
  background: var(--color-accent, #5A7A6A);
  color: var(--white, #fff);
  border-color: var(--color-accent, #5A7A6A);
}

/* Dictionary Visual */
.visual-dict {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.dict-entry {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: var(--white, #fff);
  border-radius: var(--radius-sm);
}

.dict-symbol {
  font-size: 0.875rem;
  color: var(--primary-color, #333);
  width: 16px;
  text-align: center;
}

.dict-def {
  font-size: 0.6875rem;
  color: var(--light-text, #86868b);
}

/* Papers Visual */
.visual-papers {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.paper-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem;
  background: var(--white, #fff);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color, #d2d2d7);
}

.paper-icon {
  display: flex;
  align-items: center;
  color: var(--text-tertiary, #86868b);
}

.paper-info {
  flex: 1;
  min-width: 0;
}

.paper-title {
  font-size: 0.6875rem;
  color: var(--text-color, #1D2433);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.paper-author {
  font-size: 0.5625rem;
  color: var(--light-text, #86868b);
}

/* Features Footer */
.landing-features-footer {
  text-align: center;
  padding: 2rem 0 1rem;
  color: var(--light-text, #86868b);
  font-size: 1rem;
}

.landing-features-footer strong {
  color: var(--text-color, #1D2433);
}

/* Feature Demo Section */
.landing-demo {
  background: var(--secondary-color, #f5f5f7);
  color: var(--text-color, #1D2433);
  padding: 4rem 2rem;
}

.demo-header {
  text-align: center;
  margin-bottom: 2rem;
}

.demo-header h2 {
  font-size: 2rem;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.02em;
  color: var(--text-color, #1D2433);
}

.demo-subtitle {
  font-size: 1.5rem;
  color: var(--light-text, #86868b);
  margin: 0.25rem 0 0;
  font-weight: 400;
}

.demo-tabs {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.demo-tab {
  padding: 0.5rem 1.25rem;
  background: transparent;
  border: 1px solid var(--border-color, #d2d2d7);
  border-radius: 20px;
  color: var(--light-text, #86868b);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.demo-tab:hover {
  border-color: var(--text-color, #1D2433);
  color: var(--text-color, #1D2433);
}

.demo-tab.active {
  background: var(--text-color, #1D2433);
  color: var(--white, #fff);
  border-color: var(--text-color, #1D2433);
}

.demo-features {
  display: flex;
  justify-content: center;
  margin-bottom: 2rem;
}

.demo-feature-list {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.demo-feature-list span {
  font-size: 0.875rem;
  color: var(--color-accent, #5A7A6A);
}

.demo-window {
  max-width: 900px;
  margin: 0 auto;
  background: var(--white, #fff);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-color, #d2d2d7);
  overflow: visible;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.demo-window-bar {
  display: flex;
  gap: 6px;
  padding: 12px 16px;
  background: var(--light-gray, #f5f5f7);
  border-bottom: 1px solid var(--border-color, #d2d2d7);
}

.demo-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.demo-dot.red { background: #ff5f57; }
.demo-dot.yellow { background: #febc2e; }
.demo-dot.green { background: #28c840; }

.demo-window-content {
  min-height: 350px;
  overflow: visible;
}

.demo-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

.demo-content.active {
  display: block;
}

.demo-content[data-demo="hover"] {
  overflow: visible;
}

.demo-content[data-demo="hover"] .demo-editor {
  overflow: visible;
}

.demo-content[data-demo="prerequisites"] {
  overflow: visible;
}

.demo-content[data-demo="prerequisites"] .demo-editor {
  overflow: visible;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Demo Editor Styles */
.demo-editor {
  height: 100%;
}

.demo-editor-toolbar {
  display: flex;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--light-gray, #f5f5f7);
  border-bottom: 1px solid var(--border-color, #d2d2d7);
}

.toolbar-item {
  font-size: 0.8125rem;
  color: var(--light-text, #86868b);
}

.toolbar-item.active {
  color: var(--text-color, #1D2433);
}

.toolbar-status {
  margin-left: auto;
  font-size: 0.75rem;
  color: #ff9500;
  background: rgba(255, 149, 0, 0.15);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.demo-editor-body {
  padding: 1.5rem;
}

.demo-text {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--text-color, #1D2433);
  margin: 0 0 1rem;
}

.demo-math {
  font-family: 'Times New Roman', serif;
  font-style: italic;
  color: var(--primary-color, #333333);
}

.demo-cite {
  background: rgba(51, 51, 51, 0.1);
  color: var(--primary-color, #333333);
  padding: 0.125rem 0.375rem;
  border-radius: var(--radius-sm);
  font-family: monospace;
  font-size: 0.8125rem;
}

/* Wiki link styling for demo */
.demo-wiki-link {
  color: var(--primary-color, #333333);
  text-decoration: none;
  border-bottom: 1px dotted var(--primary-color, #333333);
  cursor: pointer;
  transition: all 0.2s ease;
}

.demo-wiki-link:hover {
  background: rgba(51, 51, 51, 0.1);
  border-bottom-style: solid;
}

/* Demo preview tooltip overrides */
.demo-preview-tooltip {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
}

.demo-preview-tooltip .definition-box {
  border-left-width: 4px;
}

/* Hover Preview Demo Animation Styles */
.hover-demo-body {
  overflow: visible;
  min-height: 280px;
  position: relative;
}

/* User-triggered hover tooltip - position inside container */
.user-hover-tooltip {
  position: absolute !important;
  top: -20px !important;
  right: 10px !important;
  max-width: 280px;
  background: var(--white, #fff);
  border: 1px solid var(--border-color, #d2d2d7);
  border-radius: var(--radius-lg);
}

/* Animated macOS cursor */
.demo-cursor-container {
  position: absolute;
  top: 80px;
  left: 40px;
  pointer-events: none;
  z-index: 10001;
  opacity: 0;
  transform: translate(0, 0);
  transition: none;
}

.demo-cursor-container.animating {
  opacity: 1;
}

.demo-cursor {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Cursor movement animation */
@keyframes cursorMoveToLink {
  0% {
    transform: translate(0, 0);
    opacity: 1;
  }
  100% {
    transform: translate(var(--cursor-target-x, 80px), var(--cursor-target-y, -30px));
    opacity: 1;
  }
}

@keyframes cursorFadeOut {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* Link highlight animation */
.demo-hover-target.highlight {
  background: rgba(51, 51, 51, 0.15);
  border-bottom-style: solid;
  box-shadow: 0 0 0 3px rgba(51, 51, 51, 0.2);
  border-radius: 2px;
}

/* Instruction text */
.hover-demo-instruction {
  animation: instructionPulse 2s ease-in-out infinite;
}

@keyframes instructionPulse {
  0%, 100% {
    background: rgba(40, 167, 69, 0.1);
  }
  50% {
    background: rgba(40, 167, 69, 0.2);
  }
}

/* Demo wiki links hover effect */
.demo-wiki-link:hover {
  background: rgba(51, 51, 51, 0.1);
}

.demo-equation {
  font-family: 'Times New Roman', serif;
  font-size: 1.25rem;
  text-align: center;
  color: var(--text-color, #1D2433);
  padding: 1rem;
  background: var(--light-gray, #f5f5f7);
  border-radius: var(--radius-lg);
  margin: 1rem 0;
}

.demo-autocomplete {
  background: var(--white, #fff);
  border: 1px solid var(--border-color, #d2d2d7);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-width: 350px;
  margin-top: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.autocomplete-header {
  font-size: 0.6875rem;
  color: var(--light-text, #86868b);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-color, #d2d2d7);
}

.autocomplete-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-color, #1D2433);
  cursor: pointer;
}

.autocomplete-item.selected {
  background: rgba(51, 51, 51, 0.1);
}

.autocomplete-badge {
  font-size: 0.625rem;
  font-weight: 600;
  padding: 2px 6px;
  background: var(--primary-color, #333333);
  color: var(--white, #fff);
  border-radius: var(--radius-sm);
}

/* ===== LaTeX Editor Demo ===== */
.latex-editor-demo {
  display: flex;
  height: 100%;
  min-height: 340px;
}

.latex-editor-source {
  flex: 1;
  border-right: 1px solid var(--border-color, #d2d2d7);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.latex-editor-preview {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.latex-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--light-gray, #f5f5f7);
  border-bottom: 1px solid var(--border-color, #d2d2d7);
  min-height: 36px;
}

.latex-toolbar-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--light-text, #86868b);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.latex-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* LaTeX / Markdown segmented toggle */
.latex-source-toggle {
  display: inline-flex;
  border: 1px solid var(--border-color, #d2d2d7);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.latex-source-btn {
  padding: 3px 10px;
  background: var(--white, #fff);
  border: none;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--light-text, #86868b);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.latex-source-btn:first-child {
  border-right: 1px solid var(--border-color, #d2d2d7);
}

.latex-source-btn.active {
  background: var(--text-color, #1D2433);
  color: var(--white, #fff);
}

.latex-source-btn:not(.active):hover {
  background: var(--light-gray, #f0f0f2);
  color: var(--text-color, #1D2433);
}

/* AI Button with Apple Intelligence rainbow glow */
.latex-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--white, #fff);
  border: 1px solid var(--border-color, #d2d2d7);
  border-radius: 5px;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--text-color, #1D2433);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  z-index: 1;
}

.latex-ai-btn::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 7px;
  background: conic-gradient(
    from var(--ai-glow-angle, 0deg),
    #ff6b6b,
    #feca57,
    #48dbfb,
    #ff9ff3,
    #54a0ff,
    #5f27cd,
    #ff6b6b
  );
  opacity: 0;
  z-index: -1;
  transition: opacity 0.3s ease;
  filter: blur(3px);
}

.latex-ai-btn::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  border-radius: 5px;
  background: var(--white, #fff);
  z-index: -1;
  transition: background 0.2s ease;
}

.latex-ai-btn:hover::before {
  opacity: 1;
  animation: aiGlowRotate 2s linear infinite;
}

.latex-ai-btn:hover::after {
  background: rgba(255, 255, 255, 0.95);
}

.latex-ai-btn:hover {
  border-color: transparent;
  color: #5f27cd;
}

.latex-ai-btn:hover svg {
  stroke: #5f27cd;
}

@keyframes aiGlowRotate {
  0% { --ai-glow-angle: 0deg; }
  100% { --ai-glow-angle: 360deg; }
}

@property --ai-glow-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}

/* LaTeX Source Code */
.latex-editor-code {
  padding: 1rem;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', 'Menlo', monospace;
  font-size: 0.78rem;
  line-height: 1.65;
  color: var(--text-color, #1D2433);
  overflow-y: auto;
  flex: 1;
  background: var(--white, #fff);
}

.latex-line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.latex-line.latex-indent {
  padding-left: 1.25rem;
}

.latex-line.latex-blank {
  height: 1.1em;
}

.latex-cmd {
  color: #8b5cf6;
  font-weight: 500;
}

.latex-env {
  color: #059669;
  font-weight: 600;
}

/* LaTeX Preview */
.latex-preview-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
}

/* Use site-consistent definition-box and theorem-box styles in preview */
.latex-preview-body .definition-box {
  border-left: 6px solid #333;
  background-color: rgb(0 0 0 / 3%);
  padding: 12px 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
  margin: 0 0 1rem;
}

.latex-preview-body .definition-box p {
  font-size: 0.875rem;
  line-height: 1.7;
  margin: 0;
  color: var(--text-color, #1D2433);
}

.latex-preview-body .theorem-box {
  padding: 14px 16px;
  margin: 0 0 1rem;
  border: 1px solid var(--border-color, #d2d2d7);
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.latex-preview-body .theorem-box .theorem-box-header {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.875rem;
  color: var(--text-color, #1D2433);
}

.latex-preview-body .theorem-box p {
  font-size: 0.875rem;
  line-height: 1.7;
  margin: 0;
  color: var(--text-color, #1D2433);
}

/* Demo figure for image demonstration */
.latex-demo-figure {
  margin: 0.75rem 0 0;
  text-align: center;
  background: var(--light-gray, #f8f9fa);
  border: 1px solid var(--border-color, #dee2e6);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.latex-demo-figure svg {
  max-width: 280px;
  margin: 0 auto;
  display: block;
}

.latex-demo-figure figcaption {
  font-size: 0.75rem;
  color: var(--light-text, #86868b);
  margin-top: 0.5rem;
  font-style: italic;
}

/* Markdown syntax highlighting */
.md-tag {
  color: #d97706;
  font-weight: 600;
}

.md-bold {
  color: var(--color-text-primary, #1D2433);
  font-weight: 700;
}

.md-img {
  color: #0891b2;
  font-weight: 500;
}

/* LaTeX Editor Responsive */
@media (max-width: 640px) {
  .latex-editor-demo {
    flex-direction: column;
    min-height: 500px;
  }
  
  .latex-editor-source {
    border-right: none;
    border-bottom: 1px solid var(--border-color, #d2d2d7);
  }
  
  .latex-editor-code {
    font-size: 0.7rem;
  }
}

/* Prerequisites Demo */
.prereq-view {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.prereq-demo-body {
  padding: 1rem 1.25rem !important;
  overflow: visible !important;
}

.demo-prereq-description {
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--light-text, #86868b);
  margin: 0 0 1rem 0;
}

.demo-prereq-description strong {
  color: var(--text-color, #1D2433);
}

.demo-theorem-box {
  font-size: 0.9rem;
}

.demo-theorem-box .theorem-box-header {
  padding: 10px 14px;
}

.demo-theorem-box .theorem-box-header b {
  font-size: 15px !important;
}

.demo-theorem-box .theorem-citation-content {
  padding: 0 14px;
  font-size: 0.85rem !important;
}

.demo-theorem-box .theorem-citation-actions {
  padding: 8px 14px;
}

.demo-theorem-box .theorem-citation-actions .btn {
  font-size: 0.75rem;
  padding: 4px 10px;
  gap: 4px;
}

.demo-theorem-box .theorem-citation-actions .btn svg {
  width: 14px;
  height: 14px;
}

.demo-theorem-box .theorem-citation-knowledge-btn {
  font-size: 0.75rem;
  padding: 4px 10px;
}

.demo-theorem-box .prerequisite-status-text {
  font-size: 0.8rem;
}

.demo-theorem-box .tags-section {
  padding: 4px 14px;
}

.demo-theorem-box .tags-section .tag {
  font-size: 0.7rem;
  padding: 2px 8px;
}

.demo-theorem-box .knowledge-gaps-tooltip {
  z-index: 100;
  /* Position above instead of below to avoid clipping */
  top: auto;
  bottom: calc(100% + 8px);
}

.demo-theorem-box .knowledge-gaps-tooltip::before {
  /* Move arrow to bottom of tooltip */
  top: auto;
  bottom: -6px;
  transform: rotate(225deg);
}

.demo-theorem-box .knowledge-gaps-tooltip::after {
  /* Bridge below tooltip */
  top: auto;
  bottom: -12px;
}

:root[data-theme="dark"] .demo-theorem-box .theorem-box-header b {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .demo-theorem-box .tags-section .tag {
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Theorem box dark mode */
:root[data-theme="dark"] .theorem-box {
  background: var(--color-bg-hover);
  border-color: var(--color-border-strong);
}

:root[data-theme="dark"] .theorem-box .theorem-box-header {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .theorem-box .theorem-box-header b {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .theorem-box p {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .latex-preview-body .theorem-box {
  background: var(--color-bg-hover);
  border-color: var(--color-border-strong);
}

:root[data-theme="dark"] .latex-preview-body .theorem-box .theorem-box-header {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .latex-preview-body .theorem-box p {
  color: var(--color-text-primary);
}

/* Chat Demo */
.demo-chat {
  display: flex;
  height: 350px;
}

.demo-chat-sidebar {
  width: 180px;
  background: var(--light-gray, #f5f5f7);
  border-right: 1px solid var(--border-color, #d2d2d7);
  padding: 1rem 0.5rem;
}

.chat-channel {
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--light-text, #86868b);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.chat-channel.active {
  background: var(--white, #fff);
  color: var(--text-color, #1D2433);
}

.chat-dm {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--light-text, #86868b);
  margin-top: 0.5rem;
}

.dm-avatar {
  width: 20px;
  height: 20px;
  border-radius: var(--radius-sm);
  background: var(--primary-color, #333333);
  color: var(--white, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6875rem;
  font-weight: 600;
}

.demo-chat-main {
  flex: 1;
  display: flex;
  flex-direction: row;
  overflow: hidden;
}

.demo-chat-messages-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: flex 0.2s ease;
}

.demo-chat-main.thread-open .demo-chat-messages-area {
  flex: 1 1 55%;
}

.chat-msg {
  display: flex;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}

.chat-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--light-gray, #f5f5f7);
  color: var(--text-color, #1D2433);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 600;
  flex-shrink: 0;
}

.chat-msg-content {
  flex: 1;
}

.chat-msg-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-color, #1D2433);
  display: block;
  margin-bottom: 0.25rem;
}

.chat-msg-content p {
  font-size: 0.875rem;
  color: var(--light-text, #86868b);
  margin: 0;
  line-height: 1.5;
}

.chat-input {
  margin-top: auto;
  padding: 1rem;
  border-top: 1px solid var(--border-color, #d2d2d7);
}

.chat-input input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--light-gray, #f5f5f7);
  border: 1px solid var(--border-color, #d2d2d7);
  border-radius: var(--radius-lg);
  color: var(--text-color, #1D2433);
  font-size: 0.875rem;
}

.chat-input input::placeholder {
  color: var(--light-text, #86868b);
}

/* Chat Channel Switching */
.chat-channel {
  transition: all 0.15s ease;
}

.chat-channel:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-color, #1D2433);
}

.chat-dm {
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.chat-dm:hover {
  background: rgba(0, 0, 0, 0.05);
}

.chat-dm.active {
  background: var(--white, #fff);
  color: var(--text-color, #1D2433);
}

.chat-channel-content {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
}

.chat-channel-content.active {
  display: flex;
}

/* Message Actions - Slack-style overlay on hover */
.chat-msg {
  position: relative;
}

.chat-msg-actions {
  position: absolute;
  top: -14px;
  right: 8px;
  background: white;
  border: 1px solid var(--border-color, #d2d2d7);
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  gap: 2px;
  padding: 4px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: all 0.15s ease;
  z-index: 10;
}

.chat-msg:hover .chat-msg-actions {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.chat-action-btn {
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  color: #616061;
  padding: 0;
}

.chat-action-btn:hover {
  background: #f8f9fa;
  color: #1264a3;
  transform: scale(1.1);
}

.chat-action-btn:active {
  transform: scale(1.05);
}

.chat-action-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Emoji Picker Popup */
.demo-emoji-picker {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: white;
  border: 1px solid var(--border-color, #d2d2d7);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  padding: 8px;
  display: none;
  z-index: 100;
  min-width: 200px;
}

.demo-emoji-picker.visible {
  display: block;
  animation: pickerFadeIn 0.15s ease;
}

@keyframes pickerFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.emoji-picker-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.emoji-picker-btn {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.emoji-picker-btn:hover {
  background: #f1f5f9;
  transform: scale(1.15);
}

/* Emoji Reactions */
.chat-reactions {
  display: flex;
  gap: 0.375rem;
  margin-top: 0.375rem;
  flex-wrap: wrap;
}

.chat-reaction {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--light-gray, #f5f5f7);
  border: 1px solid var(--border-color, #d2d2d7);
  border-radius: var(--radius-xl);
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.chat-reaction:hover {
  border-color: var(--primary-color, #333333);
  background: rgba(51, 51, 51, 0.1);
}

.chat-reaction.active {
  border-color: var(--primary-color, #333333);
  background: rgba(51, 51, 51, 0.15);
}

.reaction-count {
  font-size: 0.6875rem;
  color: var(--light-text, #86868b);
}

/* Thread Indicator */
.chat-thread-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.375rem 0.5rem;
  background: var(--light-gray, #f5f5f7);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chat-thread-indicator:hover {
  background: rgba(51, 51, 51, 0.1);
}

.thread-avatars {
  display: flex;
}

.thread-avatar {
  width: 18px;
  height: 18px;
  border-radius: var(--radius-sm);
  background: var(--border-color, #d2d2d7);
  color: var(--text-color, #1D2433);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.625rem;
  font-weight: 600;
}

.thread-count {
  font-size: 0.75rem;
  color: var(--primary-color, #333333);
  font-weight: 500;
}

.thread-preview {
  font-size: 0.75rem;
  color: var(--light-text, #86868b);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* Thread Panel - Split View */
.demo-thread-panel {
  width: 320px;
  min-width: 200px;
  max-width: 450px;
  background: var(--white, #fff);
  border-left: 1px solid var(--border-color, #d2d2d7);
  display: none;
  flex-direction: column;
  flex-shrink: 0;
}

.demo-chat-main.thread-open .demo-thread-panel {
  display: flex;
}

/* Resize Handle */
.demo-thread-resize-handle {
  width: 6px;
  cursor: col-resize;
  background: transparent;
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.demo-chat-main.thread-open .demo-thread-resize-handle {
  display: flex;
}

.demo-thread-resize-handle:hover,
.demo-thread-resize-handle.dragging {
  background: rgba(0, 113, 227, 0.1);
}

.resize-handle-line {
  width: 2px;
  height: 40px;
  background: var(--border-color, #d2d2d7);
  border-radius: 2px;
  transition: background 0.15s;
}

.demo-thread-resize-handle:hover .resize-handle-line,
.demo-thread-resize-handle.dragging .resize-handle-line {
  background: var(--color-accent, #5A7A6A);
}

/* Legacy thread panel (remove) */
.chat-thread-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 300px;
  background: var(--white, #fff);
  border-left: 1px solid var(--border-color, #d2d2d7);
  display: flex;
  flex-direction: column;
  z-index: 10;
  box-shadow: -4px 0 12px rgba(0, 0, 0, 0.08);
}

.thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color, #d2d2d7);
  background: var(--light-gray, #f5f5f7);
}

.thread-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-color, #1D2433);
}

.thread-close {
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  color: var(--light-text, #86868b);
  padding: 0.25rem;
  line-height: 1;
}

.thread-close:hover {
  color: var(--text-color, #1D2433);
}

.thread-parent {
  display: flex;
  gap: 0.75rem;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color, #d2d2d7);
  background: rgba(0, 0, 0, 0.02);
}

.thread-parent .chat-msg-avatar {
  width: 28px;
  height: 28px;
  font-size: 0.75rem;
}

.thread-parent .chat-msg-content p {
  font-size: 0.8125rem;
}

.thread-replies {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0;
}

.thread-reply {
  padding: 0.5rem 1rem;
}

.thread-reply .chat-msg-avatar {
  width: 24px;
  height: 24px;
  font-size: 0.6875rem;
}

.thread-reply .chat-msg-content p {
  font-size: 0.8125rem;
}

.thread-input {
  padding: 0.75rem;
  border-top: 1px solid var(--border-color, #d2d2d7);
}

.thread-input input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--light-gray, #f5f5f7);
  border: 1px solid var(--border-color, #d2d2d7);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
}

/* Message Time */
.chat-msg-time {
  font-size: 0.6875rem;
  font-weight: 400;
  color: var(--light-text, #86868b);
  margin-left: 0.5rem;
}

/* Self Messages (DM) */
.chat-msg-self {
  flex-direction: row-reverse;
}

.chat-msg-self .chat-msg-content {
  text-align: right;
}

.chat-msg-self .chat-msg-content p {
  background: rgba(51, 51, 51, 0.1);
  padding: 0.5rem 0.75rem;
  border-radius: 12px 12px 0 12px;
  display: inline-block;
  text-align: left;
}

/* Demo chat main needs position relative for thread panel */
.demo-chat-main {
  position: relative;
}

/* ── Collaborate / Pull Requests Demo ── */
.demo-pr {
  display: flex;
  height: 370px;
}

.demo-pr-sidebar {
  width: 210px;
  background: var(--light-gray, #f5f5f7);
  border-right: 1px solid var(--border-color, #d2d2d7);
  padding: 0;
  overflow-y: auto;
}

.demo-pr-sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0.875rem;
  border-bottom: 1px solid var(--border-color, #d2d2d7);
}

.demo-pr-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  transition: background 0.15s ease;
}

.demo-pr-item:hover {
  background: rgba(0,0,0,0.03);
}

.demo-pr-item.active {
  background: var(--white, #fff);
  box-shadow: inset 3px 0 0 var(--primary-color, #333333);
}

.demo-pr-item-status {
  flex-shrink: 0;
  margin-top: 2px;
}

.demo-pr-item-status.open {
  color: #3fb950;
}

.demo-pr-item-status.merged {
  color: #a371f7;
}

.demo-pr-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.demo-pr-item-title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-color, #1D2433);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-pr-item-meta {
  font-size: 0.6875rem;
  color: var(--light-text, #86868b);
}

/* PR Detail Panel */
.demo-pr-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.demo-pr-detail-panel {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  animation: prPanelFadeIn 0.2s ease;
}

.demo-pr-detail-panel.active {
  display: flex;
}

@keyframes prPanelFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.demo-pr-detail-header {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border-color, #d2d2d7);
}

.demo-pr-title-row {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.25rem;
}

.demo-pr-detail-title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-color, #1D2433);
}

.demo-pr-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.6875rem;
  font-weight: 600;
  border-radius: 10px;
  line-height: 1.4;
  white-space: nowrap;
}

.demo-pr-badge.open {
  background: rgba(63, 185, 80, 0.12);
  color: #3fb950;
  border: 1px solid rgba(63, 185, 80, 0.3);
}

.demo-pr-badge.merged {
  background: rgba(163, 113, 247, 0.12);
  color: #a371f7;
  border: 1px solid rgba(163, 113, 247, 0.3);
}

.demo-pr-detail-meta {
  font-size: 0.75rem;
  color: var(--light-text, #86868b);
}

.demo-pr-detail-meta code {
  padding: 0.125rem 0.375rem;
  background: rgba(0,0,0,0.05);
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
}

/* Diff View */
.demo-pr-diff {
  flex: 1;
  margin: 0.75rem 1rem;
  border: 1px solid var(--border-color, #d2d2d7);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.demo-pr-diff-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--light-gray, #f5f5f7);
  border-bottom: 1px solid var(--border-color, #d2d2d7);
  font-size: 0.8125rem;
  color: var(--text-color, #1D2433);
}

.demo-pr-diff-filename {
  font-weight: 500;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.75rem;
}

.demo-pr-diff-stats {
  margin-left: auto;
  font-size: 0.75rem;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
}

.diff-added { color: #3fb950; }
.diff-removed { color: #f85149; }

.demo-pr-diff-body {
  overflow-y: auto;
  flex: 1;
  font-family: 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.75rem;
  line-height: 1.65;
}

.diff-line {
  display: flex;
  align-items: baseline;
  padding: 0 0.625rem;
  min-height: 1.65em;
}

.diff-line.context {
  background: transparent;
}

.diff-line.added {
  background: rgba(63, 185, 80, 0.08);
}

.diff-line.removed {
  background: rgba(248, 81, 73, 0.08);
}

.diff-ln {
  display: inline-block;
  width: 28px;
  text-align: right;
  color: var(--light-text, #86868b);
  user-select: none;
  flex-shrink: 0;
  padding-right: 6px;
  font-size: 0.6875rem;
  opacity: 0.6;
}

.diff-code {
  flex: 1;
  white-space: pre;
  padding-left: 0.5rem;
}

/* Merged Banner */
.demo-pr-merged-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 1rem;
  padding: 0.625rem 0.875rem;
  background: rgba(163, 113, 247, 0.08);
  border: 1px solid rgba(163, 113, 247, 0.25);
  border-radius: var(--radius-lg);
  font-size: 0.8125rem;
  font-weight: 500;
  color: #a371f7;
  animation: prMergeFadeIn 0.3s ease;
}

@keyframes prMergeFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Action Bar */
.demo-pr-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 1rem;
  border-top: 1px solid var(--border-color, #d2d2d7);
  margin-top: auto;
}

.demo-pr-review-status {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.demo-pr-merge-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.4375rem 0.875rem;
  background: #238636;
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.demo-pr-merge-btn:hover {
  background: #2ea043;
}

.demo-pr-merge-btn:active {
  transform: scale(0.97);
}

.demo-pr-merge-btn.merged {
  background: #a371f7;
  pointer-events: none;
  cursor: default;
}

/* Open Source Section */
.landing-opensource {
  background: var(--white, #fff);
  color: var(--text-color, #1D2433);
  padding: 4rem 2rem;
  text-align: center;
}

.opensource-content {
  max-width: 700px;
  margin: 0 auto;
}

.landing-opensource h2 {
  font-size: 2rem;
  font-weight: 600;
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}

.opensource-desc {
  font-size: 1rem;
  line-height: 1.6;
  color: var(--light-text, #86868b);
  margin: 0 0 2rem;
}

.github-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--text-color, #1D2433);
  border: 1px solid var(--text-color, #1D2433);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: var(--white, #fff);
  font-size: 0.875rem;
  transition: all 0.2s ease;
}

.github-badge:hover {
  background: #333;
  border-color: #333;
  text-decoration: none;
  color: var(--white, #fff);
}

.github-icon {
  width: 20px;
  height: 20px;
}

.github-handle {
  font-weight: 500;
}

.github-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.3);
}

.github-stars {
  color: rgba(255, 255, 255, 0.7);
}

.opensource-note {
  font-size: 0.8125rem;
  color: var(--light-text, #86868b);
  margin: 1rem 0 0;
}

/* Community Section */
.landing-community {
  background: var(--light-gray, #f5f5f7);
  padding: 4rem 2rem;
}

.community-header {
  text-align: center;
  max-width: 600px;
  margin: 0 auto 3rem;
}

.landing-community h2 {
  font-size: 2rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--text-color, #1D2433);
  letter-spacing: -0.02em;
}

.community-subtitle {
  font-size: 1rem;
  color: var(--light-text, #86868b);
  margin: 0 0 1.5rem;
}

.community-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  background: var(--primary-color, #333);
  color: var(--white, #fff);
  border-radius: var(--radius-lg);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.community-cta svg {
  width: 18px;
  height: 18px;
}

.community-cta:hover {
  background: #1a1a1a;
  text-decoration: none;
  color: var(--white, #fff);
}

.community-footer {
  text-align: center;
  margin-top: 3rem;
}

.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  max-width: 1100px;
  margin: 0 auto;
}

.testimonial-card {
  background: var(--white, #fff);
  border: 1px solid var(--border-color, #d2d2d7);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
}

.testimonial-header {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 0.75rem;
}

.testimonial-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-color, #333);
  color: var(--white, #fff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
}

.testimonial-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-color, #1D2433);
}

.testimonial-card p {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--light-text, #86868b);
  margin: 0;
}

/* Final CTA Section */
.landing-final-cta {
  background: var(--white, #fff);
  padding: 4rem 2rem;
  text-align: center;
  border-top: 1px solid var(--border-color, #d2d2d7);
}

.landing-final-cta h2 {
  font-size: 2rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--text-color, #1D2433);
  letter-spacing: -0.02em;
}

.landing-final-cta > p {
  font-size: 1rem;
  color: var(--light-text, #86868b);
  margin: 0 0 2rem;
  max-width: 500px;
  margin-left: auto;
  margin-right: auto;
}

.final-cta-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
}

/* Responsive Design */
@media (max-width: 900px) {
  .landing-features-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .card-large {
    grid-column: span 2;
  }
  
  .card-small {
    grid-column: span 1;
  }
  
  .card-quarter {
    grid-column: span 1;
  }
  
  .landing-trusted-logos {
    gap: 1rem;
  }
  
  .trusted-name {
    display: none;
  }
  
  .testimonials-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .demo-chat-sidebar {
    width: 140px;
  }

  .demo-pr-sidebar {
    width: 160px;
  }
}

@media (max-width: 600px) {
  .landing-hero {
    padding: 3rem 1.5rem 1.5rem;
  }
  
  .landing-logo-title {
    font-size: 3rem;
  }
  
  .landing-alpha-badge {
    top: -10px;
    right: -8px;
    font-size: 0.45rem;
    padding: 0.12rem 0.4rem;
  }
  
  .landing-logo-svg {
    width: 60px;
    height: 60px;
  }
  
  .landing-trusted-logos {
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
  }

  .trusted-logo {
    height: 20px;
  }
  
  .demo-tabs {
    flex-wrap: wrap;
  }
  
  .demo-tab {
    font-size: 0.75rem;
    padding: 0.375rem 0.875rem;
  }
  
  .demo-feature-list {
    gap: 1rem;
  }
  
  .demo-feature-list span {
    font-size: 0.75rem;
  }
  
  .demo-chat-sidebar {
    display: none;
  }

  .demo-pr-sidebar {
    display: none;
  }

  .demo-pr-detail-title {
    font-size: 0.8125rem;
  }

  .demo-pr-diff-body {
    font-size: 0.6875rem;
  }
  
  .hover-card {
    display: none;
  }
  
  .demo-header h2 {
    font-size: 1.5rem;
  }
  
  .demo-subtitle {
    font-size: 1.125rem;
  }
  
  .landing-features {
    padding: 1rem 1rem 2rem;
  }
  
  .landing-features-grid {
    grid-template-columns: 1fr;
  }
  
  .card-large {
    grid-column: span 1;
    flex-direction: column;
  }
  
  .card-large .card-visual {
    display: none;
  }
  
  .card-quarter {
    grid-column: span 1;
  }
  
  .landing-cta-buttons,
  .final-cta-buttons {
    flex-direction: column;
    width: 100%;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
  }
  
  .landing-btn-primary,
  .landing-btn-secondary {
    text-align: center;
  }
  
  .testimonials-grid {
    grid-template-columns: 1fr;
  }
  
  .landing-opensource h2,
  .landing-community h2,
  .landing-final-cta h2 {
    font-size: 1.5rem;
  }
  
  .landing-opensource,
  .landing-community,
  .landing-final-cta {
    padding: 3rem 1.5rem;
  }
  
  .demo-pr-sidebar {
    width: 160px;
  }

  .demo-pr-item-title {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .landing-logo-title {
    font-size: 2.5rem;
  }
  
  .landing-alpha-badge {
    top: -12px;
    right: -4px;
    font-size: 0.4rem;
    padding: 0.1rem 0.35rem;
  }
  
  .landing-logo-svg {
    width: 50px;
    height: 50px;
  }
  
  .landing-search-kbd {
    display: none;
  }
}

/* ========================================
   DARK MODE STYLES FOR LANDING PAGE
   ======================================== */

:root[data-theme="dark"] .landing-hero {
  background: linear-gradient(180deg, var(--color-bg-secondary) 0%, var(--color-bg-tertiary) 100%);
}

:root[data-theme="dark"] .landing-logo-title {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .landing-subtitle {
  color: var(--color-text-medium);
}

/* Dark mode search box */
:root[data-theme="dark"] .landing-search-box {
  background: var(--color-bg-tertiary);
  border-color: var(--color-border-strong);
}

:root[data-theme="dark"] .landing-search-box:hover,
:root[data-theme="dark"] .landing-search-box:focus-within {
  border-color: var(--color-border-strong);
}

:root[data-theme="dark"] .landing-search-icon {
  stroke: var(--color-text-tertiary);
}

:root[data-theme="dark"] .landing-search-input {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .landing-search-input::placeholder {
  color: var(--color-text-tertiary);
}

:root[data-theme="dark"] .landing-search-kbd {
  background: var(--color-border-strong);
  color: var(--color-text-medium);
  border-color: var(--color-border-strong);
}

/* Dark mode search dropdown */
:root[data-theme="dark"] .landing-search-dropdown {
  background: var(--color-bg-tertiary);
  border-color: var(--color-border-strong);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.2);
}

:root[data-theme="dark"] .lsd-section + .lsd-section {
  border-color: var(--color-bg-active);
}

:root[data-theme="dark"] .lsd-section-title {
  color: var(--color-text-tertiary);
}

:root[data-theme="dark"] .lsd-item {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .lsd-item:hover {
  background: var(--color-bg-hover);
}

:root[data-theme="dark"] .lsd-item-icon {
  background: var(--color-bg-active);
  color: var(--color-text-secondary);
}

:root[data-theme="dark"] .lsd-item-summary {
  color: var(--color-text-tertiary);
}

:root[data-theme="dark"] .lsd-item-badge {
  background: var(--color-bg-active);
  color: var(--color-text-secondary);
}

:root[data-theme="dark"] .lsd-empty {
  color: var(--color-text-tertiary);
}

/* Dark mode buttons */
:root[data-theme="dark"] .landing-btn-primary {
  background-color: var(--color-text-primary) !important;
  color: var(--color-bg-secondary) !important;
}

:root[data-theme="dark"] .landing-btn-primary:hover {
  background-color: var(--color-text-secondary) !important;
  color: var(--color-bg-secondary) !important;
}

:root[data-theme="dark"] .landing-btn-secondary {
  background-color: transparent !important;
  color: var(--color-text-primary) !important;
  border-color: var(--color-border-strong) !important;
}

:root[data-theme="dark"] .landing-btn-secondary:hover {
  background-color: var(--color-bg-hover) !important;
  border-color: var(--color-border-strong) !important;
  color: var(--color-text-primary) !important;
}

/* Dark mode trusted partners */
:root[data-theme="dark"] .trusted-name,
:root[data-theme="dark"] .landing-trusted-text {
  color: var(--color-text-tertiary);
}

:root[data-theme="dark"] .landing-trusted-disclaimer {
  color: var(--color-text-tertiary);
}

:root[data-theme="dark"] .landing-alpha-badge {
  color: #f0a020;
  background: rgba(240, 160, 32, 0.12);
  border-color: rgba(240, 160, 32, 0.3);
}

:root[data-theme="dark"] .trusted-logo {
  filter: invert(1) brightness(1.5) grayscale(1);
}

/* Dark mode features section */
:root[data-theme="dark"] .landing-features {
  background-color: var(--color-bg-secondary);
}

/* Dark mode feature cards */
:root[data-theme="dark"] .landing-feature-card {
  background: var(--color-bg-tertiary) !important;
  border-color: var(--color-border-strong) !important;
}

:root[data-theme="dark"] .landing-feature-card:hover {
  border-color: var(--color-border-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

:root[data-theme="dark"] .landing-feature-header h3 {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .landing-feature-desc {
  color: var(--color-text-secondary);
}

:root[data-theme="dark"] .landing-feature-desc strong {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .landing-feature-bullets {
  color: var(--color-text-tertiary);
}

:root[data-theme="dark"] .landing-feature-icon {
  color: var(--color-text-medium);
}

/* Visual elements dark mode */
:root[data-theme="dark"] .visual-page-item {
  background: var(--color-bg-hover);
  border-color: var(--color-border-strong);
}

:root[data-theme="dark"] .page-title-bar {
  background: var(--color-border-strong);
}

:root[data-theme="dark"] .page-dot {
  background: rgba(255, 255, 255, 0.3);
}

:root[data-theme="dark"] .page-heading,
:root[data-theme="dark"] .page-line {
  background: var(--color-border-strong);
}

:root[data-theme="dark"] .page-math {
  color: var(--color-text-medium);
}

:root[data-theme="dark"] .visual-page-stack {
  background: var(--color-bg-hover);
  border-color: var(--color-border-strong);
}

/* Demo section dark mode */
:root[data-theme="dark"] .landing-demo {
  background: linear-gradient(180deg, var(--color-bg-tertiary) 0%, var(--color-bg-secondary) 100%);
}

:root[data-theme="dark"] .demo-header h2 {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .demo-subtitle {
  color: var(--color-text-secondary);
}

:root[data-theme="dark"] .demo-feature-tabs {
  background: transparent;
}

:root[data-theme="dark"] .demo-tab {
  color: var(--color-text-tertiary);
  border-color: var(--color-border-strong);
}

:root[data-theme="dark"] .demo-tab:hover {
  color: var(--color-text-medium);
  background: var(--color-bg-hover);
}

:root[data-theme="dark"] .demo-tab.active {
  color: var(--color-text-primary);
  background: var(--color-bg-hover);
  border-color: var(--color-bg-hover);
}

:root[data-theme="dark"] .demo-feature-list span {
  color: var(--color-text-tertiary);
}

:root[data-theme="dark"] .demo-preview-container {
  background: var(--color-bg-tertiary);
  border-color: var(--color-border-strong);
}

:root[data-theme="dark"] .demo-preview-bar {
  background: var(--color-bg-hover);
}

:root[data-theme="dark"] .demo-tab-btn {
  color: var(--color-text-tertiary);
}

:root[data-theme="dark"] .demo-tab-btn.active {
  color: var(--color-text-primary);
  background: rgba(255, 255, 255, 0.1);
}

:root[data-theme="dark"] .demo-editor-content,
:root[data-theme="dark"] .demo-preview-content {
  background: var(--color-bg-tertiary);
  color: var(--color-text-medium);
}

/* Theorem suggestion dropdown dark mode */
:root[data-theme="dark"] .demo-theorem-suggestions {
  background: var(--color-bg-hover);
  border-color: var(--color-border-strong);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

:root[data-theme="dark"] .demo-theorem-item {
  color: var(--color-text-medium);
}

:root[data-theme="dark"] .demo-theorem-item:hover,
:root[data-theme="dark"] .demo-theorem-item.active {
  background: #0066ff;
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .demo-theorem-type {
  background: var(--color-border-strong);
  color: var(--color-text-secondary);
}

:root[data-theme="dark"] .demo-theorem-item.active .demo-theorem-type,
:root[data-theme="dark"] .demo-theorem-item:hover .demo-theorem-type {
  background: rgba(255, 255, 255, 0.2);
  color: var(--color-text-primary);
}

/* Hover demo animation dark mode */
:root[data-theme="dark"] .demo-cursor path {
  fill: #ffffff;
  stroke: #000000;
}

:root[data-theme="dark"] .demo-hover-target.highlight {
  background: rgba(102, 178, 255, 0.2);
  box-shadow: 0 0 0 3px rgba(102, 178, 255, 0.3);
}

:root[data-theme="dark"] .hover-demo-instruction {
  color: #4ade80;
  background: rgba(74, 222, 128, 0.15);
}

:root[data-theme="dark"] .user-hover-tooltip {
  background: var(--color-bg-tertiary);
  border-color: var(--color-border-strong);
}

:root[data-theme="dark"] .user-hover-tooltip h3 {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .user-hover-tooltip .definition-box {
  background: var(--color-bg-hover);
  border-color: var(--color-border-strong);
}

/* Demo window dark mode */
:root[data-theme="dark"] .demo-window {
  background: var(--color-bg-tertiary);
  border-color: var(--color-border-strong);
}

:root[data-theme="dark"] .demo-window-bar {
  background: var(--color-bg-hover);
  border-bottom-color: var(--color-border-strong);
}

:root[data-theme="dark"] .demo-editor-toolbar {
  background: var(--color-bg-hover);
  border-bottom-color: var(--color-border-strong);
}

:root[data-theme="dark"] .toolbar-item {
  color: var(--color-text-tertiary);
}

:root[data-theme="dark"] .toolbar-item.active {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .demo-editor-body {
  background: var(--color-bg-tertiary);
}

:root[data-theme="dark"] .demo-text {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .definition-box {
  background: rgba(51, 51, 51, 0.43);
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .definition-box strong {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .definition-box p {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .demo-wiki-link {
  color: var(--color-text-primary);
  border-bottom-color: rgba(255, 255, 255, 0.5);
}

:root[data-theme="dark"] .demo-wiki-link:hover {
  background: rgba(255, 255, 255, 0.1);
  border-bottom-color: var(--color-text-primary);
}

/* Demo math and cite text dark mode */
:root[data-theme="dark"] .demo-math {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .demo-cite {
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .thread-count {
  color: var(--color-text-primary);
}

/* LaTeX editor demo dark mode */
:root[data-theme="dark"] .latex-editor-demo {
  background: var(--color-bg-tertiary);
}

:root[data-theme="dark"] .latex-editor-source {
  background: var(--color-bg-tertiary);
  border-color: var(--color-border-strong);
}

:root[data-theme="dark"] .latex-editor-toolbar {
  background: var(--color-bg-hover);
  border-bottom-color: var(--color-border-strong);
}

:root[data-theme="dark"] .latex-toolbar-label {
  color: var(--color-text-tertiary);
}

:root[data-theme="dark"] .latex-source-btn {
  color: var(--color-text-tertiary);
  background: var(--color-border-strong);
}

:root[data-theme="dark"] .latex-source-btn.active {
  color: var(--color-text-primary);
  background: var(--color-border-strong);
}

:root[data-theme="dark"] .latex-ai-btn {
  color: var(--color-text-tertiary);
  background: var(--color-border-strong);
}

:root[data-theme="dark"] .latex-ai-btn:hover {
  color: var(--color-text-primary);
  background: var(--color-border-strong);
}

:root[data-theme="dark"] .latex-editor-code {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .latex-cmd {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .latex-env {
  color: var(--color-text-medium);
}

:root[data-theme="dark"] .latex-editor-preview {
  background: var(--color-bg-tertiary);
  border-color: var(--color-border-strong);
}

:root[data-theme="dark"] .latex-preview-body {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .latex-preview-body .definition-box {
  background: var(--color-bg-hover);
  border-color: var(--color-border-strong);
}

:root[data-theme="dark"] .latex-preview-body .definition-box strong {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .user-hover-tooltip .page-preview-link {
  color: var(--color-text-primary);
}

/* Open source section dark mode */
:root[data-theme="dark"] .landing-opensource {
  background: linear-gradient(180deg, var(--color-bg-secondary) 0%, var(--color-bg-tertiary) 100%);
}

:root[data-theme="dark"] .landing-opensource h2 {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .landing-opensource p {
  color: var(--color-text-secondary);
}

:root[data-theme="dark"] .github-btn {
  background: var(--color-bg-hover);
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .github-btn:hover {
  background: var(--color-border-strong);
  border-color: var(--color-border-strong);
}

:root[data-theme="dark"] .opensource-note {
  color: var(--color-text-tertiary);
}

/* Community section dark mode */
:root[data-theme="dark"] .landing-community {
  background: var(--color-bg-secondary);
  border-color: var(--color-bg-hover);
}

:root[data-theme="dark"] .landing-community h2 {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .landing-community > p {
  color: var(--color-text-secondary);
}

/* Testimonials dark mode */
:root[data-theme="dark"] .testimonial-card {
  background: var(--color-bg-tertiary) !important;
  border-color: var(--color-border-strong) !important;
}

:root[data-theme="dark"] .testimonial-avatar {
  background: var(--color-border-strong);
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .testimonial-name {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .testimonial-card p {
  color: var(--color-text-secondary);
}

:root[data-theme="dark"] .community-footer .github-btn {
  background: transparent;
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .community-footer .github-btn:hover {
  background: var(--color-bg-hover);
}

/* Final CTA section dark mode */
:root[data-theme="dark"] .landing-final-cta {
  background: linear-gradient(180deg, var(--color-bg-tertiary) 0%, var(--color-bg-secondary) 100%);
  border-color: var(--color-bg-hover);
}

:root[data-theme="dark"] .landing-final-cta h2 {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .landing-final-cta p {
  color: var(--color-text-secondary);
}

/* Footer dark mode */
:root[data-theme="dark"] footer,
:root[data-theme="dark"] .footer,
:root[data-theme="dark"] .site-footer {
  background: var(--color-bg-secondary) !important;
  border-color: var(--color-bg-hover) !important;
}

:root[data-theme="dark"] .footer-section h4,
:root[data-theme="dark"] .footer h4 {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .footer-section a,
:root[data-theme="dark"] .footer a,
:root[data-theme="dark"] .footer-links a {
  color: var(--color-text-tertiary);
}

:root[data-theme="dark"] .footer-section a:hover,
:root[data-theme="dark"] .footer a:hover,
:root[data-theme="dark"] .footer-links a:hover {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .footer-bottom,
:root[data-theme="dark"] .footer-copyright {
  color: var(--color-text-tertiary);
  border-color: var(--color-bg-hover);
}

/* Pull Request Demo - dark mode */
:root[data-theme="dark"] .demo-pr-sidebar {
  background: var(--color-bg-secondary);
  border-color: var(--color-bg-hover);
}

:root[data-theme="dark"] .demo-pr-sidebar-header {
  border-color: var(--color-bg-hover);
}

:root[data-theme="dark"] .demo-pr-item {
  border-color: rgba(255,255,255,0.04);
}

:root[data-theme="dark"] .demo-pr-item:hover {
  background: rgba(255,255,255,0.04);
}

:root[data-theme="dark"] .demo-pr-item.active {
  background: var(--color-bg-tertiary);
}

:root[data-theme="dark"] .demo-pr-detail-meta code {
  background: rgba(255,255,255,0.08);
}

:root[data-theme="dark"] .demo-pr-diff {
  border-color: var(--color-bg-hover);
}

:root[data-theme="dark"] .demo-pr-diff-header {
  background: var(--color-bg-secondary);
  border-color: var(--color-bg-hover);
}

:root[data-theme="dark"] .demo-pr-diff-body {
  background: var(--color-bg-secondary);
}

:root[data-theme="dark"] .diff-line.added {
  background: rgba(63, 185, 80, 0.1);
}

:root[data-theme="dark"] .diff-line.removed {
  background: rgba(248, 81, 73, 0.1);
}

:root[data-theme="dark"] .demo-pr-actions {
  border-color: var(--color-bg-hover);
}

:root[data-theme="dark"] .demo-pr-merged-banner {
  background: rgba(163, 113, 247, 0.1);
  border-color: rgba(163, 113, 247, 0.2);
}

:root[data-theme="dark"] .definition-box,
:root[data-theme="dark"] .theorem-box,
:root[data-theme="dark"] .proof-environment,
:root[data-theme="dark"] .motivation-environment {
  background: var(--color-bg-hover);
  border-color: var(--color-border-strong);
}

:root[data-theme="dark"] .definition-title,
:root[data-theme="dark"] .theorem-title {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .proof-toggle-handle {
  background: var(--color-border-strong);
  border-color: var(--color-border-strong);
  color: var(--color-text-medium);
}

:root[data-theme="dark"] .proof-toggle-handle:hover {
  background: var(--color-border-strong);
}

/* Hover cards dark mode */
:root[data-theme="dark"] .hover-card {
  background: var(--color-bg-tertiary);
  border-color: var(--color-border-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

:root[data-theme="dark"] .hover-card-title {
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .hover-card-preview {
  color: var(--color-text-secondary);
}

:root[data-theme="dark"] .hover-card-footer {
  background: var(--color-bg-hover);
  border-color: var(--color-border-strong);
  color: var(--color-text-tertiary);
}

/* Chat sidebar in demo dark mode */
:root[data-theme="dark"] .demo-chat-sidebar {
  background: var(--color-bg-tertiary);
  border-color: var(--color-border-strong);
}

:root[data-theme="dark"] .demo-chat-header {
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}

:root[data-theme="dark"] .demo-chat-message {
  color: var(--color-text-medium);
}

:root[data-theme="dark"] .demo-chat-input-wrapper input {
  background: var(--color-bg-hover);
  border-color: var(--color-border-strong);
  color: var(--color-text-primary);
}
