/* ========================================
   Subto.One — Professional Design System
   Clean, Modern, Enterprise-Ready
   ======================================== */

/* ========================================
   1. GLOBAL VISUAL FOUNDATION
   ======================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400&display=swap');

:root {
  /* Color System - Professional Dark Theme */
  --bg: #09090b;
  --bg-elevated: #18181b;
  --surface: #1c1c21;
  --surface-soft: rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.06);

  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;

  --accent: #3b82f6;
  --accent-hover: #60a5fa;
  --accent-muted: #1e3a5f;

  --error: #ef4444;
  --warning: #f59e0b;
  --success: #22c55e;

  --border-subtle: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.12);

  /* Spacing System (8px base) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-section: 64px;

  /* Layout */
  --max-width: 1200px;
  --radius: 8px;
  --radius-sm: 4px;
  --radius-lg: 12px;

  /* Motion - Subtle and professional */
  --ease-smooth: cubic-bezier(0.4, 0.0, 0.2, 1);
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  --duration-slow: 400ms;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

/* ========================================
   2. RESET & TYPOGRAPHY
   ======================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Visually hidden but accessible to screen readers */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-primary);
  background: var(--bg);
  min-height: 100vh;
}

/* Headings - typography does the hierarchy */
h1 {
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.55;
}

h2 {
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.55;
  color: var(--text-primary);
}

h3 {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.55;
  color: var(--text-primary);
}

h4, h5, h6 {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
}

p {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
  color: var(--text-secondary);
}

code, pre, .code-content {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

/* ========================================
   3. MAIN LAYOUT
   ======================================== */
#app {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-lg);
}

section {
  margin-bottom: var(--space-section);
}

/* ========================================
   4. LANDING SECTION
   ======================================== */
#landing {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 48px);
  padding: 20px;
  background: radial-gradient(ellipse at 50% 30%, rgba(107, 140, 255, 0.04) 0%, transparent 60%);
}

.landing-tagline {
  font-size: 14px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-lg);
  text-align: center;
}

#url-input {
  display: block;
  width: 100%;
  max-width: 600px;
  height: 52px;
  padding: 0 20px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 400;
  color: var(--text-primary);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  outline: none;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
  
}

#url-input::placeholder {
  color: var(--text-tertiary);
}

#url-input:hover {
  border-color: var(--border-strong);
  background: var(--bg-elevated);
}

#url-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  background: var(--bg-elevated);
}

/* ========================================
   5. SCANNER SECTION
   ======================================== */
#scanner {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 48px);
}

.scan-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xl);
  max-width: 400px;
  width: 100%;
}

/* Scan Ring - SVG based, slow confident motion */
.scan-ring {
  position: relative;
  width: 160px;
  height: 160px;
}

.scan-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--surface);
  stroke-width: 2;
}

.ring-progress {
  fill: none;
  stroke: var(--accent-muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 339.292;
  transition: stroke-dashoffset var(--duration-slow) var(--ease-smooth),
              stroke 1.5s var(--ease-smooth);
}

.ring-progress.phase-1 { stroke: var(--accent-muted); }
.ring-progress.phase-2 { stroke: var(--warning); }
.ring-progress.phase-3 { stroke: var(--success); }
.ring-progress.phase-error { stroke: var(--error); }

.ring-pulse {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1;
  stroke-opacity: 0;
  animation: ring-expand 3s ease-out infinite;
}

.ring-pulse-2 {
  animation-delay: 1.5s;
}

@keyframes ring-expand {
  0% { 
    r: 50;
    stroke-opacity: 0.3;
    stroke-width: 2;
  }
  100% { 
    r: 70;
    stroke-opacity: 0;
    stroke-width: 0;
  }
}

.scan-percentage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 28px;
  font-weight: 500;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

/* Scan Status */
.scan-info {
  text-align: center;
}

.scan-status {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.65;
  margin-bottom: var(--space-xs);
}

.scan-sub-status {
  font-size: 12px;
  color: var(--text-tertiary);
  opacity: 0.5;
}

/* Phase List */
.scan-phases {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
  padding: var(--space-md);
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
}

.phase {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 12px;
  color: var(--text-tertiary);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  transition: opacity var(--duration-normal) var(--ease-smooth),
              color var(--duration-normal) var(--ease-smooth);
}

.phase-text {
  flex: 1;
  position: relative;
}

.phase.active {
  color: var(--text-secondary);
}

.phase.active .phase-text::before {
  content: "○";
  position: absolute;
  left: -16px;
  color: var(--accent);
  animation: pulse-soft 2s ease-in-out infinite;
}

.phase.complete {
  color: var(--text-tertiary);
}

.phase.complete .phase-text::before {
  content: "✓";
  position: absolute;
  left: -16px;
  color: var(--success);
}

@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Scan Footer */
.scan-footer {
  width: 100%;
}

.scan-activity {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  font-size: 12px;
  color: var(--text-tertiary);
  opacity: 0.6;
}

.scan-dots {
  display: flex;
  gap: 4px;
}

.scan-dot {
  width: 4px;
  height: 4px;
  background: var(--text-tertiary);
  border-radius: 50%;
  animation: dot-pulse 1.8s ease-in-out infinite;
}

.scan-dot:nth-child(2) { animation-delay: 0.3s; }
.scan-dot:nth-child(3) { animation-delay: 0.6s; }

@keyframes dot-pulse {
  0%, 80%, 100% {
    transform: scale(0.8);
    opacity: 0.4;
  }
  40% {
    transform: scale(1);
    opacity: 0.8;
  }
}

.scan-timing {
  color: var(--text-tertiary);
}

.scan-skip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.skip-message {
  color: var(--text-muted);
  font-size: 13px;
}

.btn-skip {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  
}

.btn-skip:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* ========================================
   6. RESULTS SECTION — Editorial Layout
   ======================================== */
#results {
  padding-top: var(--space-xl);
}

.results-section {
  margin-bottom: var(--space-section);
}

/* Section Headers - Editorial Style */
.section-label {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--space-xs);
}

.results-section h2 {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border-subtle);
}

.results-section h3 {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: var(--space-md);
}

/* ========================================
   SYSTEM OVERVIEW
   ======================================== */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.overview-card {
  padding: var(--space-lg) 0;
}

.card-label {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-sm);
}

.card-value {
  font-size: 32px;
  font-weight: 500;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.card-value.good { color: var(--success); }
.card-value.warning { color: var(--warning); }
.card-value.poor { color: var(--error); }

.card-metrics {
  margin-top: var(--space-xs);
  font-size: 12px;
  color: var(--text-tertiary);
}

.estimation-warning {
  margin-top: var(--space-sm);
  font-size: 11px;
  color: var(--text-tertiary);
  opacity: 0.7;
}

.estimation-warning.warning-error {
  color: #ff6b6b;
  font-weight: 500;
  opacity: 1;
}

/* Core Web Vitals */
.core-vitals {
  margin-top: var(--space-xl);
}

.core-vitals h3 {
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-md);
}

.vitals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-md);
}

.vital-item {
  padding: var(--space-md);
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
}

.vital-name {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-xs);
}

.vital-value {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.vital-rating {
  font-size: 10px;
  font-weight: 400;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.vital-rating.good { 
  background: rgba(93, 211, 158, 0.15); 
  color: var(--success); 
}
.vital-rating.warning { 
  background: rgba(255, 176, 32, 0.15); 
  color: var(--warning); 
}
.vital-rating.poor { 
  background: rgba(255, 107, 107, 0.15); 
  color: var(--error); 
}

/* ========================================
   7. EXECUTION GRAPH
   ======================================== */
.graph-controls {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.graph-btn {
  padding: var(--space-sm) var(--space-md);
  font-family: inherit;
  font-size: 12px;
  color: var(--text-tertiary);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-smooth),
              background var(--duration-fast) var(--ease-smooth);
}

.graph-btn:hover {
  color: var(--text-secondary);
}

.graph-btn.active {
  color: var(--text-primary);
  background: var(--surface-soft);
}

#execution-graph {
  width: 100%;
  height: 450px;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  overflow: auto;
  position: relative;
}

#execution-graph svg {
  min-width: 100%;
  min-height: 100%;
  display: block;
}

.graph-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-tertiary);
  font-size: 12px;
}

.graph-legend {
  display: flex;
  gap: var(--space-lg);
  margin-top: var(--space-md);
  font-size: 11px;
  color: var(--text-tertiary);
}

.legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.legend-color {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  opacity: 0.7;
}

/* Graph Nodes - Soft, muted */
.node circle {
  stroke-width: 1.5;
  cursor: pointer;
  transition: opacity var(--duration-fast) var(--ease-smooth);
  opacity: 0.8;
}

.node circle:hover {
  opacity: 1;
}

.node text {
  font-size: 10px;
  fill: var(--text-tertiary);
  pointer-events: none;
}

.link {
  fill: none;
  stroke: var(--text-tertiary);
  stroke-opacity: 0.15;
  stroke-width: 1;
  transition: stroke-opacity var(--duration-fast) var(--ease-smooth);
}

.link.highlighted {
  stroke: var(--accent);
  stroke-opacity: 0.6;
  stroke-width: 1.5;
}

/* ========================================
   8. CODE SURFACE EXPLORER
   ======================================== */
.explorer-container {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: var(--space-lg);
  height: 480px;
}

.file-tree {
  background: var(--surface-soft);
  border-radius: var(--radius);
  overflow-y: auto;
  padding: var(--space-md);
}

.tree-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  color: var(--text-tertiary);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 13px;
  transition: background var(--duration-fast) var(--ease-smooth),
              color var(--duration-fast) var(--ease-smooth);
}

.tree-item:hover {
  color: var(--text-secondary);
  background: var(--surface-soft);
}

.tree-item.active {
  color: var(--text-primary);
  background: rgba(107, 140, 255, 0.1);
}

.tree-item.folder {
  color: var(--text-secondary);
}

.tree-item .icon {
  width: 14px;
  font-size: 11px;
  text-align: center;
  opacity: 0.6;
}

.tree-children {
  padding-left: var(--space-md);
}

.tree-children.collapsed {
  display: none;
}

.code-viewer {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border-radius: var(--radius);
  overflow: hidden;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-lg);
  background: var(--surface);
  border-bottom: 1px solid var(--border-subtle);
}

.code-filename {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-tertiary);
}

.code-size {
  font-size: 11px;
  color: var(--text-tertiary);
  opacity: 0.6;
}

.code-content {
  flex: 1;
  padding: var(--space-lg);
  overflow: auto;
  color: var(--text-secondary);
  white-space: pre;
  tab-size: 2;
  font-size: 13px;
  line-height: 1.6;
}

/* Syntax Highlighting - Muted tones */
.code-content .keyword { color: #8a9ccc; }
.code-content .string { color: #8fbf8f; }
.code-content .number { color: #d4a574; }
.code-content .comment { color: #5a5a5a; }
.code-content .function { color: #9cb4d4; }

/* Explorer CTA */
.explorer-cta {
  margin-top: var(--space-lg);
  padding: var(--space-md);
  text-align: center;
}

.explorer-cta p {
  color: var(--text-tertiary);
  font-size: 13px;
  margin: 0;
}

/* ========================================
   AI CHAT SECTIONS
   ======================================== */
.ai-chat-section {
  margin-top: var(--space-xl);
}

.ai-chat-section h3 {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-md);
}

.ai-chat-container {
  background: var(--bg-elevated);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
}

.ai-chat-messages {
  height: 280px;
  overflow-y: auto;
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.ai-message {
  display: flex;
  gap: var(--space-sm);
  max-width: 85%;
}

.ai-message.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-message-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-muted);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 500;
  flex-shrink: 0;
  opacity: 0.8;
}

.ai-message.user .ai-message-avatar {
  background: var(--surface);
}

.ai-message-content {
  padding: var(--space-sm) var(--space-md);
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-secondary);
}

.ai-message.user .ai-message-content {
  color: var(--text-primary);
}

.ai-message-content code {
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
}

.ai-message-content pre {
  background: var(--surface);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: var(--space-sm) 0;
}

.ai-message.typing .ai-message-content::after {
  content: '...';
  animation: typing-dots 1.5s infinite;
}

@keyframes typing-dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

.ai-chat-input-container {
  display: flex;
  padding: var(--space-md);
  background: var(--surface);
  border-top: 1px solid var(--border-subtle);
}

.ai-chat-input {
  flex: 1;
  padding: var(--space-sm) var(--space-md);
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--duration-fast) var(--ease-smooth);
}

.ai-chat-input:focus {
  border-color: var(--accent-muted);
}

.ai-chat-input::placeholder {
  color: var(--text-tertiary);
}

/* Hide send button - Enter submits */
.ai-chat-send {
  display: none;
}

/* Surgeon Chat */
.surgeon-chat {
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--border-subtle);
}

/* ========================================
   9. ISSUES SECTION
   ======================================== */
.issues-tabs {
  display: flex;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.issue-tab {
  padding: var(--space-sm) var(--space-md);
  font-family: inherit;
  font-size: 12px;
  color: var(--text-tertiary);
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-smooth),
              background var(--duration-fast) var(--ease-smooth);
}

.issue-tab:hover {
  color: var(--text-secondary);
}

.issue-tab.active {
  color: var(--text-primary);
  background: var(--surface-soft);
}

.issues-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.issue-item {
  padding: var(--space-md) var(--space-lg);
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-smooth);
}

.issue-item:hover {
  background: var(--surface-soft);
}

.issue-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.issue-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.issue-dot.breaks { background: var(--error); opacity: 0.7; }
.issue-dot.security { background: var(--warning); opacity: 0.7; }
.issue-dot.seo { background: var(--accent); opacity: 0.7; }

.issue-title {
  font-size: 14px;
  font-weight: 400;
  color: var(--text-primary);
}

.issue-details {
  padding-left: calc(6px + var(--space-sm));
  margin-top: var(--space-sm);
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--duration-normal) var(--ease-smooth);
}

.issue-item.expanded .issue-details {
  max-height: 300px;
}

.issue-trigger, .issue-affected, .issue-impact {
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-xs);
}

.issue-trigger strong,
.issue-affected strong,
.issue-impact strong {
  color: var(--text-secondary);
  font-weight: 400;
}

.issue-code {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-elevated);
  border-radius: var(--radius-sm);
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-tertiary);
  overflow-x: auto;
}

/* ========================================
   SEO SECTION
   ======================================== */
.seo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-lg);
}

.seo-card {
  padding: var(--space-lg) 0;
}

.seo-card h3 {
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-subtle);
}

.seo-content {
  font-size: 13px;
  color: var(--text-secondary);
}

.seo-item {
  display: flex;
  justify-content: space-between;
  padding: var(--space-xs) 0;
}

.seo-item .label {
  color: var(--text-tertiary);
}

.seo-item .value {
  color: var(--text-primary);
}

.seo-item .value.missing {
  color: var(--error);
  opacity: 0.7;
}

.seo-item .value.present {
  color: var(--success);
  opacity: 0.8;
}

/* ========================================
   10. AI CODE SURGEON
   ======================================== */
.surgeon-container {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.drop-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-section);
  background: transparent;
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--duration-fast) var(--ease-smooth),
              background var(--duration-fast) var(--ease-smooth);
}

.drop-zone:hover,
.drop-zone:focus {
  border-color: var(--accent-muted);
  background: var(--surface-soft);
}

.drop-zone.drag-over {
  border-color: var(--accent);
  border-style: solid;
  background: rgba(107, 140, 255, 0.05);
}

.drop-icon {
  width: 40px;
  height: 40px;
  margin-bottom: var(--space-md);
  color: var(--text-tertiary);
  opacity: 0.5;
}

.drop-text {
  text-align: center;
  color: var(--text-tertiary);
  line-height: 1.6;
  font-size: 13px;
}

.drop-subtext {
  font-size: 11px;
  color: var(--text-tertiary);
  opacity: 0.6;
}

.drop-limits {
  margin-top: var(--space-md);
  font-size: 11px;
  color: var(--text-tertiary);
  opacity: 0.4;
}

/* Upload Summary */
.upload-summary {
  padding: var(--space-lg);
  background: var(--surface-soft);
  border-radius: var(--radius);
}

.upload-summary h3 {
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-md);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.summary-label {
  font-size: 11px;
  color: var(--text-tertiary);
}

.summary-value {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
}

.file-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.file-type-badge {
  font-size: 11px;
  padding: var(--space-xs) var(--space-sm);
  background: var(--surface);
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
}

.upload-actions {
  display: flex;
  gap: var(--space-md);
  justify-content: flex-end;
}

/* Buttons - Minimal */
.btn-primary, .btn-secondary {
  padding: var(--space-sm) var(--space-lg);
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity var(--duration-fast) var(--ease-smooth);
}

.btn-primary {
  color: var(--text-primary);
  background: var(--accent-muted);
  border: none;
}

.btn-primary:hover {
  opacity: 0.85;
}

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

.btn-secondary {
  color: var(--text-tertiary);
  background: transparent;
  border: 1px solid var(--border-subtle);
}

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

/* AI Analysis */
.ai-analysis {
  padding: var(--space-lg);
  background: var(--surface-soft);
  border-radius: var(--radius);
}

.ai-loading {
  padding: var(--space-lg);
}

/* Analysis Progress UI */
.analysis-progress {
  width: 100%;
}

.analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-md);
}

.analysis-status {
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.btn-stop {
  padding: var(--space-xs) var(--space-md);
  font-family: inherit;
  font-size: 11px;
  color: var(--error);
  background: transparent;
  border: 1px solid var(--error);
  border-radius: var(--radius-sm);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity var(--duration-fast) var(--ease-smooth);
}

.btn-stop:hover {
  opacity: 1;
}

.analysis-file-progress {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: var(--space-sm);
}

.analysis-current {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.analysis-label {
  font-size: 11px;
  color: var(--text-tertiary);
}

.analysis-filename {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text-primary);
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analysis-counter {
  font-size: 13px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.analysis-bar-container {
  height: 2px;
  background: var(--surface);
  border-radius: 1px;
  overflow: hidden;
  margin-bottom: var(--space-lg);
}

.analysis-bar {
  height: 100%;
  width: 0%;
  background: var(--accent-muted);
  border-radius: 1px;
  transition: width var(--duration-normal) var(--ease-smooth);
}

.analysis-files-list {
  max-height: 200px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.analysis-file-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  font-size: 12px;
  transition: background var(--duration-fast) var(--ease-smooth);
}

.analysis-file-item.pending {
  color: var(--text-tertiary);
}

.analysis-file-item.analyzing {
  color: var(--text-primary);
  background: rgba(107, 140, 255, 0.1);
}

.analysis-file-item.complete {
  color: var(--text-tertiary);
}

.analysis-file-item.stopped {
  color: var(--text-tertiary);
  opacity: 0.5;
}

.analysis-file-icon {
  width: 14px;
  font-size: 10px;
  text-align: center;
  flex-shrink: 0;
}

.analysis-file-item.pending .analysis-file-icon::before {
  content: "○";
  color: var(--text-tertiary);
}

.analysis-file-item.analyzing .analysis-file-icon::before {
  content: "◐";
  color: var(--accent);
  animation: spin 1s linear infinite;
}

.analysis-file-item.complete .analysis-file-icon::before {
  content: "✓";
  color: var(--success);
}

.analysis-file-item.stopped .analysis-file-icon::before {
  content: "—";
  color: var(--text-tertiary);
}

.analysis-file-name {
  font-family: 'JetBrains Mono', monospace;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-spinner {
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--surface);
  border-top-color: var(--accent-muted);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.ai-results {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.ai-section {
  margin-bottom: var(--space-lg);
}

.ai-section h4 {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-sm);
}

/* AI Results Enhanced */
.ai-summary {
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: var(--space-lg);
}

.ai-score {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.ai-score strong {
  color: var(--accent);
}

.ai-files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-md);
}

.ai-file-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--space-md);
  transition: border-color var(--duration-fast) var(--ease-smooth);
}

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

.ai-file-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xs);
}

.ai-file-name {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-file-score {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.ai-file-score.good {
  color: var(--success);
  background: rgba(93, 211, 158, 0.1);
}

.ai-file-score.warning {
  color: var(--warning);
  background: rgba(255, 176, 32, 0.1);
}

.ai-file-score.bad {
  color: var(--error);
  background: rgba(255, 107, 107, 0.1);
}

.ai-file-summary {
  font-size: 12px;
  color: var(--text-tertiary);
  margin: var(--space-xs) 0;
  line-height: 1.4;
}

.ai-file-issues {
  font-size: 11px;
  color: var(--text-tertiary);
}

.ai-file-issues.clean {
  color: var(--success);
}

.ai-issues-group {
  margin-bottom: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
}

.ai-issues-group.high {
  background: rgba(255, 107, 107, 0.05);
  border-left: 3px solid var(--error);
}

.ai-issues-group.medium {
  background: rgba(255, 176, 32, 0.05);
  border-left: 3px solid var(--warning);
}

.ai-issues-group.low {
  background: rgba(107, 140, 255, 0.05);
  border-left: 3px solid var(--accent-muted);
}

.ai-issues-group h5 {
  font-size: 12px;
  font-weight: 500;
  margin-bottom: var(--space-sm);
  color: var(--text-secondary);
}

.ai-issue-item {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-subtle);
}

.ai-issue-item:last-child {
  border-bottom: none;
}

.ai-issue-item .issue-type {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  background: var(--surface);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  margin-right: var(--space-sm);
}

.ai-issue-item p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: var(--space-xs);
  line-height: 1.5;
}

.ai-issue-item .issue-suggestion {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
  padding-left: var(--space-sm);
  border-left: 2px solid var(--success);
}

/* Mini Spinner for analysis */
.spinner-mini {
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--surface);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

/* Patch Viewer */
.patch-viewer {
  padding: var(--space-lg);
  background: var(--surface-soft);
  border-radius: var(--radius);
}

.patch-viewer h3 {
  font-size: 12px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: var(--space-md);
}

.diff-container {
  margin: var(--space-lg) 0;
  max-height: 400px;
  overflow: auto;
}

.diff-file {
  margin-bottom: var(--space-lg);
}

.diff-header {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-tertiary);
  padding: var(--space-sm) var(--space-md);
  background: var(--surface);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.diff-content {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: var(--space-md);
  background: var(--bg-elevated);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  overflow-x: auto;
}

.diff-line {
  white-space: pre;
  line-height: 1.5;
}

.diff-line.add {
  background: rgba(93, 211, 158, 0.1);
  color: var(--success);
}

.diff-line.remove {
  background: rgba(255, 107, 107, 0.1);
  color: var(--error);
}

.diff-line.context {
  color: var(--text-tertiary);
}

.patch-actions {
  display: flex;
  gap: var(--space-md);
}

/* ========================================
   11. UTILITY & ANIMATIONS
   ======================================== */
[hidden] {
  display: none !important;
}

/* Section enter animation */
.fade-in {
  animation: fadeIn var(--duration-normal) var(--ease-smooth);
}

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

/* Scrollbar - Minimal */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--text-tertiary);
  border-radius: 3px;
  opacity: 0.3;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Error Messages */
.error-message {
  color: var(--error);
  font-size: 13px;
  padding: var(--space-md);
  background: rgba(255, 107, 107, 0.08);
  border-radius: var(--radius-sm);
  margin-top: var(--space-md);
}

/* ========================================
   12. RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  :root {
    --space-section: 48px;
  }

  .explorer-container {
    grid-template-columns: 1fr;
    height: auto;
  }
  
  .file-tree {
    max-height: 200px;
  }
  
  .code-viewer {
    height: 360px;
  }
  
  .overview-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .ai-chat-messages {
    height: 220px;
  }
}

/* ========================================
   COMPREHENSIVE TESTING STYLES
   ======================================== */
.comprehensive-container,
.comprehensive-bottom-container {
  display: grid;
  gap: var(--space-lg);
  grid-template-columns: repeat(2, 1fr);
}

.session-video {
  background: var(--surface);
  padding: var(--space-lg);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
  /* Make the session video block span the full width of the results grid */
  grid-column: 1 / -1;
}

/* Ensure the native video element uses available space nicely */
#sessionVideo {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 16 / 9;
  max-height: 560px; /* generous preview height */
  display: none;
  background: #000; /* fallback background for unloaded video */
  border-radius: 8px;
}

/* Video loading skeleton */
.video-skeleton {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 aspect ratio */
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(0,0,0,0.04));
  border-radius: 8px;
  overflow: hidden;
  display: none;
  align-items: center;
  justify-content: center;
}

.video-skeleton.visible { display: flex; }

.video-skeleton::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0.02) 0%, rgba(255,255,255,0.04) 50%, rgba(255,255,255,0.02) 100%);
  animation: shimmer 1.6s linear infinite;
}

.skeleton-spinner {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid rgba(255,255,255,0.06);
  border-top-color: var(--accent, #00d4aa);
  box-sizing: border-box;
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: translate(-50%, -50%) rotate(360deg); } }
@keyframes shimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.view-video-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.view-video-link[hidden] { display: none; }

.validation-results,
.api-checks-results,
.no-js-results,
.interaction-results,
.test-results {
  background: var(--surface);
  padding: var(--space-lg);
  border-radius: var(--radius);
  border: 1px solid var(--border-subtle);
}

.validation-item,
.api-check-item,
.no-js-item {
  margin-bottom: var(--space-md);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
}

.validation-item h4,
.api-check-item,
.no-js-item {
  margin: 0 0 var(--space-sm) 0;
  font-size: 16px;
  font-weight: 500;
}

.api-check-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.api-check-item.configured {
  background: rgba(93, 211, 158, 0.1);
  border-left: 3px solid var(--success);
}

.api-check-item.not-configured {
  background: rgba(255, 107, 107, 0.1);
  border-left: 3px solid var(--error);
}

.api-name {
  font-weight: 500;
}

.api-status {
  font-size: 14px;
}

.interaction-item,
.test-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm);
  margin-bottom: var(--space-sm);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 14px;
}

.interaction-item.success {
  background: rgba(93, 211, 158, 0.1);
  border-left: 3px solid var(--success);
}

.interaction-item.error {
  background: rgba(255, 107, 107, 0.1);
  border-left: 3px solid var(--error);
}

.test-item.success {
  background: rgba(93, 211, 158, 0.1);
  border-left: 3px solid var(--success);
}

.test-item.error {
  background: rgba(255, 107, 107, 0.1);
  border-left: 3px solid var(--error);
}

.interaction-type,
.test-type {
  font-weight: 500;
  min-width: 120px;
}

.test-details {
  flex: 1;
  opacity: 0.8;
}

.test-status {
  font-weight: bold;
  min-width: 20px;
  text-align: center;
}

.test-item.success .test-status {
  color: var(--success);
}

.test-item.error .test-status {
  color: var(--error);
}

.interaction-element {
  color: var(--accent);
  min-width: 40px;
}

.interaction-text {
  flex: 1;
  opacity: 0.8;
  font-style: italic;
}
