:root {
  --bg-main: #090a0f;
  --bg-card: #11131c;
  --bg-elevated: #171a26;
  --bg-hover: #1e2231;
  --border: #232838;
  --border-subtle: rgba(255, 255, 255, 0.07);
  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-glow: rgba(99, 102, 241, 0.16);
  --emerald: #10b981;
  --emerald-bg: rgba(16, 185, 129, 0.14);
  --amber: #f59e0b;
  --danger: #ef4444;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(circle at 50% 0%, #131629 0%, var(--bg-main) 55%);
  color: var(--text-main);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: #818cf8;
  text-decoration: none;
}

a:hover {
  color: #a5b4fc;
}

code, pre {
  font-family: "JetBrains Mono", "Fira Code", ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Top Navigation */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(9, 10, 15, 0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.brand-mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: linear-gradient(135deg, #6366f1 0%, #10b981 100%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 0.82rem;
}

.nav-tabs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.22rem;
  border-radius: 9px;
}

.nav-tab {
  padding: 0.36rem 0.85rem;
  border-radius: 6px;
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.15s;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.04);
}

.nav-tab.active {
  background: var(--bg-elevated);
  color: var(--text-main);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.user-cluster {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-chip {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
}

/* Main Container */
.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 1.5rem;
}

/* Compact Telemetry Strip */
.metrics-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

@media (max-width: 768px) {
  .metrics-strip {
    grid-template-columns: 1fr;
  }
}

.metric-tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
}

.metric-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.12rem;
}

.metric-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Studio Workspace Grid */
.studio-grid {
  display: grid;
  grid-template-columns: 440px 1fr;
  gap: 1.25rem;
  align-items: stretch;
  margin-bottom: 1.25rem;
}

@media (max-width: 1024px) {
  .studio-grid {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}

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

.panel-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  letter-spacing: -0.01em;
}

/* Minimal Dropzone */
.dropzone {
  border: 1.5px dashed #2e364f;
  border-radius: var(--radius);
  padding: 1.65rem 1rem;
  text-align: center;
  background: rgba(23, 26, 38, 0.5);
  cursor: pointer;
  transition: all 0.18s ease;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-glow);
}

.dropzone-icon {
  width: 36px;
  height: 36px;
  margin: 0 auto 0.55rem;
  border-radius: 9px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #818cf8;
}

.dropzone-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.dropzone-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* Video Specs Chips */
.spec-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.75rem;
}

.spec-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.22rem 0.55rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.spec-chip strong {
  color: var(--text-main);
}

/* Resolution Tier Cards */
.section-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  margin: 1.1rem 0 0.5rem;
}

.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.preset-option {
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 0.65rem;
  cursor: pointer;
  text-align: left;
  color: var(--text-main);
  transition: all 0.15s ease;
  position: relative;
}

.preset-option:hover:not(.disabled) {
  border-color: #3b4461;
  background: var(--bg-hover);
}

.preset-option.active {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.25);
}

.preset-option.disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.preset-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #818cf8;
  display: block;
}

.preset-name {
  font-weight: 700;
  font-size: 1.05rem;
  display: block;
  margin-top: 0.1rem;
}

.preset-meta {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.95rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn-emerald {
  background: var(--emerald);
  color: #042f1e;
}

.btn-emerald:hover:not(:disabled) {
  filter: brightness(1.08);
}

.btn-outline {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-outline:hover:not(:disabled) {
  border-color: #3e4866;
  color: var(--text-main);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.78rem;
  border-radius: 6px;
}

/* Split-Compare Viewport */
.compare-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #06070b;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  user-select: none;
  --pos: 50%;
}

.compare-viewport .after-wrap,
.compare-viewport .before-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.compare-viewport .before-wrap {
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}

.compare-viewport img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: center center;
  transition: transform 0.12s ease-out;
}

.compare-viewport.zoomed img.layer-before {
  image-rendering: pixelated;
}

.compare-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 2px;
  background: var(--emerald);
  pointer-events: none;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
}

.compare-badge {
  position: absolute;
  top: 10px;
  padding: 0.18rem 0.5rem;
  border-radius: 5px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(9, 10, 15, 0.78);
  border: 1px solid var(--border);
  color: var(--text-secondary);
}

.compare-badge.left { left: 10px; }
.compare-badge.right { right: 10px; color: #6ee7b7; }

.compare-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  pointer-events: none;
}

/* Progress Bars */
.progress-bar-wrap {
  width: 100%;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.55rem;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--emerald));
  width: 0%;
  transition: width 0.25s ease;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

th, td {
  padding: 0.68rem 0.75rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.015);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.16rem 0.52rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
}

.status-queued { background: rgba(245, 158, 11, 0.14); color: #fcd34d; }
.status-running { background: rgba(99, 102, 241, 0.2); color: #a5b4fc; }
.status-succeeded { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; }
.status-failed, .status-canceled, .status-expired {
  background: rgba(239, 68, 68, 0.14);
  color: #fca5a5;
}

.input, select {
  background: var(--bg-elevated);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.48rem 0.7rem;
  font-size: 0.85rem;
}

.input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  font-size: 0.85rem;
}

.alert-key {
  border-color: var(--emerald);
  background: var(--emerald-bg);
}

/* Developer API Portal Layout */
.docs-layout {
  display: grid;
  grid-template-columns: 230px 1fr;
  gap: 1.75rem;
  align-items: start;
}

@media (max-width: 960px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }
}

.docs-sidebar {
  position: sticky;
  top: 78px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem;
}

.docs-nav-group {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 700;
  margin: 0.75rem 0.5rem 0.35rem;
}

.docs-nav-group:first-child {
  margin-top: 0.15rem;
}

.docs-nav-link {
  display: block;
  padding: 0.38rem 0.6rem;
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.docs-nav-link:hover {
  background: var(--bg-elevated);
  color: var(--text-main);
}

.endpoint-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.35rem;
  margin-bottom: 1.25rem;
}

.method-badge {
  display: inline-block;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.18rem 0.5rem;
  border-radius: 5px;
  margin-right: 0.5rem;
}

.method-get { background: rgba(59, 130, 246, 0.18); color: #93c5fd; }
.method-post { background: rgba(16, 185, 129, 0.18); color: #6ee7b7; }

.endpoint-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

pre.code-block {
  background: #06070b;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  overflow-x: auto;
  font-size: 0.8rem;
  line-height: 1.55;
  color: #e2e8f0;
  margin: 0.65rem 0 0;
}

.code-tabs {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.75rem;
}
