:root {
  --bg-primary: #070a12;
  --bg-secondary: #0d1322;
  --card-bg: rgba(17, 24, 39, 0.72);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-hover-border: rgba(99, 102, 241, 0.3);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-cyan: #06b6d4;
  --accent-indigo: #6366f1;
  --accent-purple: #a855f7;
  --accent-emerald: #10b981;
  --accent-rose: #f43f5e;
  --accent-amber: #f59e0b;
  --gradient-brand: linear-gradient(135deg, #06b6d4 0%, #6366f1 50%, #a855f7 100%);
  --gradient-card: linear-gradient(180deg, rgba(30, 41, 59, 0.5) 0%, rgba(15, 23, 42, 0.7) 100%);
  --glow-cyan: 0 0 20px rgba(6, 182, 212, 0.35);
  --glow-indigo: 0 0 20px rgba(99, 102, 241, 0.35);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 10% 15%, rgba(6, 182, 212, 0.12) 0, transparent 40%),
    radial-gradient(circle at 85% 10%, rgba(99, 102, 241, 0.14) 0, transparent 45%),
    radial-gradient(circle at 50% 85%, rgba(168, 85, 247, 0.1) 0, transparent 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem 1.5rem;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 2rem;
  position: relative;
}

.patent-badge-banner {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.35);
  color: #c7d2fe;
  padding: 0.35rem 0.9rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 1rem;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

.patent-badge-banner svg {
  width: 14px;
  height: 14px;
  fill: #818cf8;
}

.brand-title {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin: 0 0 0.5rem 0;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 40px rgba(99, 102, 241, 0.25);
}

.brand-subtitle {
  color: var(--text-secondary);
  font-size: 1.15rem;
  max-width: 800px;
  margin: 0 auto 0.75rem auto;
  font-weight: 400;
}

.author-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.author-meta span {
  color: var(--accent-cyan);
  font-weight: 600;
}

/* Navigation Tabs */
.nav-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 2rem auto;
  background: rgba(15, 23, 42, 0.8);
  padding: 0.4rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(20px);
  width: fit-content;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.nav-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 0.65rem 1.25rem;
  font-size: 0.925rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-tab-btn svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s;
}

.nav-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab-btn.active {
  background: var(--gradient-brand);
  color: #ffffff;
  box-shadow: var(--glow-indigo);
}

.tab-pane {
  display: none;
}
.tab-pane.active {
  display: block;
  animation: tabFadeIn 0.35s ease-out;
}

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

/* Grid System */
.grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 980px) {
  .grid-2col {
    grid-template-columns: 1fr;
  }
}

/* Cards */
.card {
  background: var(--gradient-card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  backdrop-filter: blur(20px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  transition: border-color 0.25s, box-shadow 0.25s;
  display: flex;
  flex-direction: column;
}

.card:hover {
  border-color: var(--card-hover-border);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.card-title-group h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin: 0.35rem 0 0 0;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.15rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  text-decoration: none;
}

.btn-primary {
  background: var(--gradient-brand);
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}
.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  border: 1px solid var(--card-border);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

.btn-emerald {
  background: linear-gradient(135deg, #059669 0%, #10b981 100%);
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}
.btn-emerald:hover {
  filter: brightness(1.1);
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

/* Upload Drop Zone */
.upload-dropzone {
  border: 2px dashed rgba(99, 102, 241, 0.35);
  background: rgba(15, 23, 42, 0.4);
  border-radius: var(--radius-md);
  padding: 2.25rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.08);
}

.dropzone-icon {
  width: 44px;
  height: 44px;
  margin: 0 auto 0.75rem auto;
  color: var(--accent-cyan);
}

.dropzone-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* Canvas Area */
.canvas-wrapper {
  position: relative;
  background: #030712;
  border-radius: var(--radius-md);
  border: 1px solid #1e293b;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 1rem;
}

canvas.interactive-stage {
  cursor: crosshair;
  display: block;
}

.canvas-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.85rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-group input, .form-group select {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  color: #fff;
  font-family: inherit;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--accent-indigo);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.25);
}

.preset-selector-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border);
}

.preset-selector-bar select {
  flex: 1;
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid var(--card-border);
  color: #fff;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

/* Chart Container */
.chart-container {
  position: relative;
  height: 330px;
  width: 100%;
}

/* Metrics and Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.stat-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 0.75rem;
  text-align: center;
}

.stat-label {
  font-size: 0.725rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.stat-val {
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  font-family: 'JetBrains Mono', monospace;
}

.stat-val.cyan { color: var(--accent-cyan); }
.stat-val.purple { color: var(--accent-purple); }
.stat-val.emerald { color: var(--accent-emerald); }

/* Patent Details Card */
.patent-info-box {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.patent-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.6rem 1rem;
  font-size: 0.9rem;
}
.patent-label {
  color: var(--text-muted);
  font-weight: 600;
}
.patent-value {
  color: var(--text-primary);
}

.formula-card {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--accent-cyan);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
}
.formula-title {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-cyan);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
}

/* Citations code */
pre.bibtex-code {
  background: #020617;
  border: 1px solid #1e293b;
  border-radius: var(--radius-sm);
  padding: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.825rem;
  color: #a5f3fc;
  overflow-x: auto;
  position: relative;
}

/* Footer */
footer {
  margin-top: 4rem;
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid var(--card-border);
  color: var(--text-muted);
  font-size: 0.85rem;
}
footer a {
  color: var(--accent-cyan);
  text-decoration: none;
}
footer a:hover {
  text-decoration: underline;
}

/* Compass Needle / Rotating Field Vector */
.compass-wrapper {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

/* Benchmark Test Gel Library */
.benchmark-samples-container {
  margin-top: 1.25rem;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.benchmark-samples-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

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

.sample-count-badge {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: var(--accent-cyan);
  font-size: 0.725rem;
  padding: 0.15rem 0.55rem;
  border-radius: 9999px;
  font-weight: 600;
}

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

.benchmark-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 0.85rem;
}

.benchmark-card {
  background: rgba(30, 41, 59, 0.45);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: all 0.22s ease;
  position: relative;
}

.benchmark-card:hover {
  background: rgba(30, 41, 59, 0.75);
  border-color: rgba(99, 102, 241, 0.45);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.benchmark-card.active {
  border-color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.09);
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.28), inset 0 0 0 1px rgba(6, 182, 212, 0.2);
}

.benchmark-card-top {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.benchmark-thumb-wrap {
  position: relative;
  width: 54px;
  height: 54px;
  min-width: 54px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: #03060f;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.benchmark-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s ease;
}

.benchmark-card:hover .benchmark-thumb-wrap img {
  transform: scale(1.1);
}

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

.benchmark-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  line-height: 1.25;
}

.benchmark-specs {
  font-size: 0.725rem;
  color: var(--text-secondary);
  line-height: 1.3;
  margin-top: 0.25rem;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-emerald {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-cyan {
  background: rgba(6, 182, 212, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(6, 182, 212, 0.35);
}

.badge-amber {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-rose {
  background: rgba(244, 63, 94, 0.15);
  color: #fb7185;
  border: 1px solid rgba(244, 63, 94, 0.35);
}

.benchmark-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
}

.btn-benchmark-test {
  flex: 1;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2) 0%, rgba(99, 102, 241, 0.25) 100%);
  border: 1px solid rgba(6, 182, 212, 0.45);
  color: #a5f3fc;
  padding: 0.4rem 0.65rem;
  font-size: 0.775rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.btn-benchmark-test:hover {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.4) 0%, rgba(99, 102, 241, 0.5) 100%);
  color: #ffffff;
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.3);
}

.btn-benchmark-dl {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  color: var(--text-secondary);
  padding: 0.4rem 0.7rem;
  font-size: 0.775rem;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-benchmark-dl:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.3);
}

.active-benchmark-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.25);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  margin-top: 0.75rem;
  font-size: 0.775rem;
  color: #bae6fd;
}

