/* ========== CSS Variables & Reset ========== */
:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #0f0f2a;
  --bg-card: rgba(15, 15, 42, 0.6);
  --bg-card-hover: rgba(25, 25, 60, 0.8);
  --text-primary: #e8e8f0;
  --text-secondary: #9d9db8;
  --text-muted: #6b6b8a;
  --blue: #4a90d9;
  --purple: #7c3aed;
  --red: #ef4444;
  --gradient-main: linear-gradient(135deg, #4a90d9, #7c3aed, #ef4444);
  --gradient-blue-purple: linear-gradient(135deg, #4a90d9, #7c3aed);
  --gradient-subtle: linear-gradient(135deg, rgba(74,144,217,0.15), rgba(124,58,237,0.15));
  --border-color: rgba(124, 58, 237, 0.2);
  --glow-blue: 0 0 20px rgba(74, 144, 217, 0.3);
  --glow-purple: 0 0 20px rgba(124, 58, 237, 0.3);
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --max-width: 1200px;
  --nav-height: 64px;
}

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: rgba(124, 58, 237, 0.4);
  color: #fff;
}

/* ========== Navigation ========== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 1000;
  background: rgba(10, 10, 26, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.navbar.scrolled {
  background: rgba(10, 10, 26, 0.95);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.nav-content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 1.1rem;
}

.nav-logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.nav-links {
  display: flex;
  gap: 1.8rem;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.3s ease;
  position: relative;
}

.nav-links a:hover {
  color: var(--text-primary);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-main);
  transition: width 0.3s ease;
}

.nav-links a:hover::after {
  width: 100%;
}

/* ========== Common ========== */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 2rem;
}

.section {
  padding: 6rem 0;
  position: relative;
}

.section-dark {
  background: var(--bg-secondary);
}

.section-title {
  text-align: center;
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.section-desc {
  text-align: center;
  color: var(--text-secondary);
  font-size: 1.1rem;
  max-width: 700px;
  margin: 0 auto 3rem;
}

.gradient-text {
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  transition: all 0.3s ease;
}

.glass-card:hover {
  border-color: rgba(124, 58, 237, 0.4);
  background: var(--bg-card-hover);
}

/* ========== Animations ========== */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========== Hero ========== */
.hero-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  padding-top: var(--nav-height);
}

#particle-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2rem;
}

.hero-badge {
  display: inline-block;
  padding: 0.4rem 1.2rem;
  background: var(--gradient-subtle);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--purple);
  margin-bottom: 2rem;
  letter-spacing: 0.05em;
}

.hero-logo {
  width: 220px;
  height: 220px;
  object-fit: contain;
  margin-bottom: 1.5rem;
  filter: drop-shadow(0 0 40px rgba(124, 58, 237, 0.3));
  animation: float 4s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.hero-title {
  font-size: 4.5rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 1rem;
}

.hero-subtitle {
  font-size: 1.4rem;
  color: var(--text-secondary);
  font-weight: 400;
  margin-bottom: 1rem;
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto 2.5rem;
  line-height: 1.6;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.8rem;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
}

.btn-primary {
  background: var(--gradient-blue-purple);
  color: #fff;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
  box-shadow: 0 6px 30px rgba(124, 58, 237, 0.5);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(124, 58, 237, 0.1);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: rgba(124, 58, 237, 0.2);
  border-color: rgba(124, 58, 237, 0.4);
  transform: translateY(-2px);
}

.hero-scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1;
}

.scroll-arrow {
  width: 24px;
  height: 24px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  animation: scrollBounce 2s infinite;
}

@keyframes scrollBounce {
  0%, 100% { transform: rotate(45deg) translate(0, 0); opacity: 0.3; }
  50% { transform: rotate(45deg) translate(5px, 5px); opacity: 1; }
}

/* ========== Abstract ========== */
.abstract-card {
  padding: 2.5rem;
  max-width: 900px;
  margin: 0 auto 3rem;
}

.abstract-card p {
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-size: 1.02rem;
  line-height: 1.8;
}

.abstract-card p:last-child {
  margin-bottom: 0;
}

.highlight {
  color: var(--text-primary);
  background: linear-gradient(135deg, rgba(74,144,217,0.2), rgba(124,58,237,0.2));
  padding: 0.1em 0.4em;
  border-radius: 4px;
}

.highlights-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
}

.highlight-item {
  padding: 1.8rem 1.5rem;
  text-align: center;
}

.highlight-icon {
  font-size: 2rem;
  margin-bottom: 0.8rem;
}

.highlight-label {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.highlight-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ========== Method ========== */
.method-diagram {
  text-align: center;
  margin-bottom: 3rem;
}

.method-img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: #fff;
  padding: 1rem;
}

.method-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.method-card {
  padding: 2rem;
  position: relative;
  overflow: hidden;
}

.method-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-main);
}

.method-card-number {
  font-size: 3rem;
  font-weight: 900;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0.3;
  margin-bottom: 0.5rem;
  line-height: 1;
}

.method-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
  color: var(--text-primary);
}

.method-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ========== Results / Tabs ========== */
.tabs {
  max-width: 1000px;
  margin: 0 auto;
}

.tab-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.tab-btn {
  padding: 0.6rem 1.4rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tab-btn:hover {
  color: var(--text-primary);
  border-color: rgba(124, 58, 237, 0.4);
}

.tab-btn.active {
  background: var(--gradient-blue-purple);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.3);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeTab 0.4s ease forwards;
}

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

.tab-desc {
  text-align: center;
  margin-bottom: 2rem;
}

.tab-desc h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.tab-desc p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 650px;
  margin: 0 auto;
}

.video-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.video-card {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
}

.video-card video {
  width: 100%;
  display: block;
  border-radius: 15px;
}

.video-label {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 0.3rem 0.8rem;
  background: rgba(10, 10, 26, 0.8);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  z-index: 2;
}

/* ========== Streaming ========== */
.streaming-card {
  padding: 2rem;
  max-width: 900px;
  margin: 0 auto;
}

.streaming-badge {
  display: inline-block;
  padding: 0.3rem 1rem;
  background: var(--gradient-subtle);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--purple);
  margin-bottom: 1.5rem;
}

.streaming-video {
  width: 100%;
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.streaming-info {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.streaming-stat {
  text-align: center;
  padding: 1rem;
  background: rgba(124, 58, 237, 0.08);
  border-radius: 12px;
  border: 1px solid rgba(124, 58, 237, 0.15);
}

.stat-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 800;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.streaming-caption {
  color: var(--text-secondary);
  font-size: 0.9rem;
  text-align: center;
  line-height: 1.6;
}

/* ========== Comparison ========== */
.comparison-block {
  margin-bottom: 4rem;
}

.comparison-block:last-child {
  margin-bottom: 0;
}

.comparison-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
  color: var(--text-primary);
}

.comparison-desc {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 650px;
  margin: 0 auto 2rem;
}

.video-compare {
  display: flex;
  gap: 1.5rem;
  align-items: center;
  justify-content: center;
}

.video-compare .video-card {
  flex: 1;
  max-width: 450px;
}

.vs-badge {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--purple);
  background: rgba(124, 58, 237, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.label-ours {
  background: rgba(74, 144, 217, 0.8) !important;
  border-color: rgba(74, 144, 217, 0.6) !important;
}

.label-baseline {
  background: rgba(239, 68, 68, 0.6) !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
}

/* ========== Table ========== */
.table-wrapper {
  padding: 1.5rem;
  overflow-x: auto;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.results-table th {
  padding: 0.8rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.results-table td {
  padding: 0.7rem 1rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(124, 58, 237, 0.08);
}

.results-table .row-ours {
  background: rgba(124, 58, 237, 0.08);
}

.results-table .row-ours td {
  color: var(--text-primary);
}

.results-table strong {
  color: #7c3aed;
}

/* ========== Visualization ========== */
.viz-selector {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.viz-btn {
  padding: 0.5rem 1.2rem;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.viz-btn:hover {
  color: var(--text-primary);
  border-color: rgba(124, 58, 237, 0.4);
}

.viz-btn.active {
  background: var(--gradient-blue-purple);
  color: #fff;
  border-color: transparent;
}

.viz-frame-wrapper {
  padding: 0.5rem;
  overflow: hidden;
}

.viz-iframe {
  width: 100%;
  height: 600px;
  border: none;
  border-radius: 12px;
  background: #111;
}

/* ========== Citation / BibTeX ========== */
.bibtex-card {
  max-width: 700px;
  margin: 0 auto;
  overflow: hidden;
}

.bibtex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 0.95rem;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.copy-btn:hover {
  background: rgba(124, 58, 237, 0.3);
  color: var(--text-primary);
}

.copy-btn.copied {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.3);
  color: #22c55e;
}

.bibtex-code {
  padding: 1.5rem;
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--text-secondary);
  overflow-x: auto;
}

/* ========== Footer ========== */
.footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border-color);
  background: var(--bg-primary);
}

.footer-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
}

.footer-logo img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.footer-text {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .hero-title {
    font-size: 2.8rem;
  }

  .hero-subtitle {
    font-size: 1.1rem;
  }

  .hero-logo {
    width: 160px;
    height: 160px;
  }

  .section-title {
    font-size: 2rem;
  }

  .highlights-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .method-cards {
    grid-template-columns: 1fr;
  }

  .video-grid-2 {
    grid-template-columns: 1fr;
  }

  .video-compare {
    flex-direction: column;
  }

  .vs-badge {
    margin: 0.5rem 0;
  }

  .streaming-info {
    grid-template-columns: repeat(2, 1fr);
  }

  .tab-buttons {
    gap: 0.4rem;
  }

  .tab-btn {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
  }

  .viz-iframe {
    height: 400px;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2.2rem;
  }

  .highlights-grid {
    grid-template-columns: 1fr;
  }

  .hero-buttons {
    flex-direction: column;
    align-items: center;
  }

  .container {
    padding: 0 1rem;
  }

  .section {
    padding: 4rem 0;
  }
}
