/* ==========================================================================
   FlexFrame Pro — Premium Design System
   High-fidelity UI for professional responsive testing
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,300;0,14..32,400;0,14..32,500;0,14..32,600;0,14..32,700;0,14..32,800;1,14..32,400&family=Outfit:wght@600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ─── Design Tokens ─────────────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --surface-0: #03050e;
  --surface-1: #080c1a;
  --surface-2: #0d1326;
  --surface-3: #111930;
  --surface-glass: rgba(13, 19, 38, 0.75);
  --surface-glass-2: rgba(8, 12, 26, 0.9);

  /* Brand Gradient */
  --brand-from: #4f8fff;
  --brand-via: #8b5cf6;
  --brand-to: #06b6d4;

  /* Accent Colors */
  --accent-blue: #4f8fff;
  --accent-purple: #8b5cf6;
  --accent-cyan: #06b6d4;
  --accent-cyan-glow: rgba(6, 182, 212, 0.35);
  --accent-purple-glow: rgba(139, 92, 246, 0.35);
  --accent-blue-glow: rgba(79, 143, 255, 0.35);

  /* Semantic */
  --color-success: #22c55e;
  --color-success-muted: rgba(34, 197, 94, 0.12);
  --color-warning: #f59e0b;
  --color-warning-muted: rgba(245, 158, 11, 0.12);
  --color-danger: #f43f5e;
  --color-danger-muted: rgba(244, 63, 94, 0.12);
  --color-info: #38bdf8;
  --color-info-muted: rgba(56, 189, 248, 0.12);

  /* Text */
  --text-primary: #f0f4ff;
  --text-secondary: #8b9ec7;
  --text-tertiary: #4a5a80;
  --text-inverse: #03050e;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.18);
  --border-brand: rgba(79, 143, 255, 0.5);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5), 0 6px 20px rgba(0,0,0,0.4);
  --shadow-xl: 0 30px 80px rgba(0,0,0,0.6), 0 15px 40px rgba(0,0,0,0.5);

  /* Layout */
  --header-h: 64px;
  --toolbar-h: 52px;
  --sidebar-w: 280px;
}

/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

/* ─── Base ───────────────────────────────────────────────────────────────── */
body {
  font-family: var(--font-sans);
  background-color: var(--surface-0);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Animated Background Mesh */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 0%, rgba(79, 143, 255, 0.12) 0%, transparent 60%),
    radial-gradient(ellipse 70% 50% at 90% 100%, rgba(6, 182, 212, 0.1) 0%, transparent 55%),
    radial-gradient(ellipse 60% 40% at 50% 50%, rgba(139, 92, 246, 0.07) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

body > * { position: relative; z-index: 1; }

/* Scrollbars */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(79, 143, 255, 0.5); }

/* ─── Typography Utilities ───────────────────────────────────────────────── */
.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }

/* ─── Global App Layout ──────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER / TOP BAR
═══════════════════════════════════════════════════════════════════════════ */
.app-header {
  height: var(--header-h);
  flex-shrink: 0;
  background: var(--surface-glass-2);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  z-index: 100;
}

/* Brand */
.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
  min-width: 220px;
}

.brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border-brand);
  box-shadow: 0 0 18px rgba(79, 143, 255, 0.4);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 0%, #a5c5ff 35%, var(--accent-cyan) 70%, #c084fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.version-badge {
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, rgba(79, 143, 255, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid rgba(79, 143, 255, 0.4);
  color: var(--accent-blue);
  text-transform: uppercase;
}

/* URL Bar */
.url-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 0 var(--space-3) 0 var(--space-4);
  height: 40px;
  transition: border-color 0.2s, box-shadow 0.2s;
  max-width: 520px;
}

.url-bar:focus-within {
  border-color: rgba(79, 143, 255, 0.6);
  box-shadow: 0 0 0 3px rgba(79, 143, 255, 0.12);
}

.url-bar-icon {
  font-size: 0.95rem;
  flex-shrink: 0;
  opacity: 0.5;
}

.url-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 500;
}

.url-bar input::placeholder { color: var(--text-tertiary); font-weight: 400; }

/* Header Buttons */
.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
  margin-left: auto;
}

/* ─── Button System ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn-sm { height: 32px; padding: 0 var(--space-3); font-size: 0.8rem; border-radius: var(--radius-md); }
.btn-md { height: 38px; padding: 0 var(--space-4); border-radius: var(--radius-md); }
.btn-lg { height: 44px; padding: 0 var(--space-6); border-radius: var(--radius-lg); }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-md); }
.btn-icon-sm { width: 30px; height: 30px; padding: 0; border-radius: var(--radius-sm); }

/* Variants */
.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: white;
  box-shadow: 0 4px 16px rgba(79, 143, 255, 0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(79, 143, 255, 0.45);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}
.btn-ghost:hover {
  background: rgba(255,255,255,0.06);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

.btn-ghost.active {
  background: rgba(79, 143, 255, 0.15);
  color: var(--accent-blue);
  border-color: rgba(79, 143, 255, 0.3);
}

.btn-cyan {
  background: linear-gradient(135deg, var(--accent-cyan), #0284c7);
  color: var(--surface-0);
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.3);
}
.btn-cyan:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(6, 182, 212, 0.45);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.15);
  color: var(--color-danger);
  border: 1px solid rgba(244, 63, 94, 0.3);
}
.btn-danger:hover { background: rgba(244, 63, 94, 0.25); }

/* Toggle button group */
.btn-group {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 2px;
}
.btn-group .btn-ghost {
  border-radius: calc(var(--radius-md) - 2px);
  border: none;
}
.btn-group .btn-ghost.active {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
  border: none;
}

/* ═══════════════════════════════════════════════════════════════════════════
   TAB BAR
═══════════════════════════════════════════════════════════════════════════ */
.tab-bar {
  height: var(--toolbar-h);
  flex-shrink: 0;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: stretch;
  padding: 0 var(--space-6);
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-5);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-tertiary);
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
  transition: color 0.2s;
  white-space: nowrap;
}
.tab-item::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: var(--space-5);
  right: var(--space-5);
  height: 2px;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
  border-radius: 2px 2px 0 0;
  transform: scaleX(0);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.tab-item:hover { color: var(--text-secondary); }
.tab-item.active {
  color: var(--text-primary);
}
.tab-item.active::after { transform: scaleX(1); }

.tab-item .tab-icon { font-size: 0.95rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   DEVICE TOOLBAR
═══════════════════════════════════════════════════════════════════════════ */
.device-toolbar {
  flex-shrink: 0;
  background: var(--surface-glass-2);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  height: 50px;
  gap: var(--space-3);
  overflow-x: auto;
  scrollbar-width: none;
}
.device-toolbar::-webkit-scrollbar { display: none; }

.toolbar-separator {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
  flex-shrink: 0;
}

.toolbar-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  white-space: nowrap;
}

/* Custom select */
.select-styled {
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.825rem;
  font-weight: 600;
  padding: 0 var(--space-3);
  height: 32px;
  border-radius: var(--radius-md);
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
.select-styled:focus { border-color: var(--accent-blue); }

/* Info pill */
.info-pill {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  height: 28px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.pill-dim {
  background: rgba(6, 182, 212, 0.1);
  border: 1px solid rgba(6, 182, 212, 0.25);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
}

.pill-bp {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

/* Custom dimension mini-inputs */
.dim-input-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface-3);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  padding: 0 8px;
  height: 32px;
}
.dim-input-group input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  width: 44px;
  text-align: center;
}
.dim-input-group .sep {
  color: var(--text-tertiary);
  font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   MAIN WORKSPACE
═══════════════════════════════════════════════════════════════════════════ */
.workspace {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.tab-panel {
  display: none;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
}
.tab-panel.active {
  display: flex;
}

/* ─── Studio Canvas ─────────────────────────────────────────────────────── */
.studio-panel {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.canvas-area {
  flex: 1;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  background:
    radial-gradient(circle at 50% 50%, rgba(79, 143, 255, 0.03) 0%, transparent 70%),
    repeating-linear-gradient(0deg, transparent, transparent 39px, var(--border-subtle) 39px, var(--border-subtle) 40px),
    repeating-linear-gradient(90deg, transparent, transparent 39px, var(--border-subtle) 39px, var(--border-subtle) 40px);
  background-color: var(--surface-0);
}

/* ─── Device Frame ──────────────────────────────────────────────────────── */
.device-frame-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  transform-origin: center top;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.device-shell {
  position: relative;
  background: linear-gradient(145deg, #1c2438, #141c2f);
  border-radius: 48px;
  padding: 20px;
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.07),
    0 0 0 4px #1c2438,
    0 0 0 5px rgba(255,255,255,0.04),
    0 40px 80px rgba(0,0,0,0.7),
    0 0 40px rgba(6, 182, 212, 0.08);
}

.device-shell.borderless {
  background: transparent;
  border-radius: var(--radius-lg);
  padding: 0;
  box-shadow:
    0 0 0 1px var(--border-default),
    0 20px 50px rgba(0,0,0,0.5);
}

/* Notch styles */
.device-notch {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: #000;
  z-index: 10;
}
.device-notch.pill {
  top: 28px;
  width: 118px;
  height: 34px;
  border-radius: 20px;
}
.device-notch.dot {
  top: 28px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
}
.device-notch.bar {
  top: 20px;
  width: 150px;
  height: 26px;
  border-bottom-left-radius: 14px;
  border-bottom-right-radius: 14px;
}

/* Screen container */
.device-screen {
  overflow: hidden;
  border-radius: 32px;
  background: #fff;
  position: relative;
}
.device-shell.borderless .device-screen {
  border-radius: var(--radius-md);
}

.device-iframe {
  display: block;
  border: none;
  background: #fff;
}

/* Device label */
.device-label {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--surface-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  backdrop-filter: blur(8px);
}
.device-label .dot-live {
  width: 7px;
  height: 7px;
  background: var(--color-success);
  border-radius: 50%;
  box-shadow: 0 0 6px var(--color-success);
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ─── Matrix Grid ───────────────────────────────────────────────────────── */
.matrix-area {
  flex: 1;
  overflow: auto;
  padding: var(--space-6);
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-5);
}

.matrix-card {
  background: var(--surface-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(12px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s, box-shadow 0.25s;
}
.matrix-card:hover {
  transform: translateY(-3px);
  border-color: rgba(79, 143, 255, 0.3);
  box-shadow: 0 12px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(79, 143, 255, 0.15);
}

.matrix-card-header {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.matrix-card-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.matrix-dim-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(139, 92, 246, 0.15);
  color: #c084fc;
  border: 1px solid rgba(139, 92, 246, 0.25);
}

.matrix-viewport {
  height: 460px;
  overflow: hidden;
  background: var(--surface-0);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--space-4);
}

.matrix-iframe {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: white;
  transform-origin: top center;
}

/* ─── Right Sidebar (Properties) ────────────────────────────────────────── */
.properties-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface-1);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-section {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border-subtle);
}

.sidebar-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-3);
}

/* Score ring in sidebar */
.score-ring-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-5) 0;
}

.score-ring {
  position: relative;
  width: 120px;
  height: 120px;
}

.score-ring svg {
  transform: rotate(-90deg);
}

.score-ring-value {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 900;
}

.score-label {
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  color: var(--text-secondary);
}

/* Quick stat rows in sidebar */
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--border-subtle);
}
.stat-row:last-child { border-bottom: none; }
.stat-label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }
.stat-value {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}
.stat-ok { background: var(--color-success-muted); color: var(--color-success); }
.stat-bad { background: var(--color-danger-muted); color: var(--color-danger); }
.stat-warn { background: var(--color-warning-muted); color: var(--color-warning); }

/* Device info row */
.device-info-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.device-info-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
}
.device-info-item .label { color: var(--text-tertiary); }
.device-info-item .value { font-weight: 700; color: var(--text-primary); font-family: var(--font-mono); }

/* ═══════════════════════════════════════════════════════════════════════════
   AUDIT PANEL
═══════════════════════════════════════════════════════════════════════════ */
.audit-panel {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6) var(--space-8);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.audit-hero {
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-8);
  align-items: center;
}

/* Score circle */
.score-circle {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.score-circle-bg {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(var(--color-success) calc(var(--pct, 100) * 3.6deg), rgba(255,255,255,0.07) 0);
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.score-circle-inner {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  z-index: 1;
  position: relative;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.3);
}
.score-number {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  line-height: 1;
}
.score-unit {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  font-weight: 600;
  letter-spacing: 0.05em;
}

.audit-hero-content h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: var(--space-2);
}
.audit-hero-content p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: var(--space-4);
}

/* Audit metric cards */
.audit-metrics-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}

.metric-card {
  background: var(--surface-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  backdrop-filter: blur(8px);
}
.metric-card-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}
.metric-card-value {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
}
.metric-card-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Issue cards */
.issues-section h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: var(--space-4);
}

.issue-card {
  background: var(--surface-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.issue-card:hover {
  box-shadow: var(--shadow-md);
}

.issue-card-bar {
  height: 3px;
}
.issue-card-bar.critical { background: var(--color-danger); }
.issue-card-bar.warning { background: var(--color-warning); }
.issue-card-bar.info { background: var(--color-info); }

.issue-card-body {
  padding: var(--space-5);
}

.issue-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-3);
}

.issue-card-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
}

.severity-badge {
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}
.severity-badge.critical { background: var(--color-danger-muted); color: var(--color-danger); border: 1px solid rgba(244, 63, 94, 0.3); }
.severity-badge.warning  { background: var(--color-warning-muted); color: var(--color-warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.severity-badge.info     { background: var(--color-info-muted);    color: var(--color-info);    border: 1px solid rgba(56, 189, 248, 0.3); }

.issue-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
}

.impact-pill {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  flex-shrink: 0;
}

.issue-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-4);
}

.code-block {
  background: var(--surface-0);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.code-block-header {
  padding: var(--space-2) var(--space-4);
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}
.code-block pre {
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.7;
  color: var(--accent-cyan);
  overflow-x: auto;
  white-space: pre;
}

.issue-actions {
  margin-top: var(--space-4);
  display: flex;
  gap: var(--space-2);
}

/* Success state */
.audit-success {
  background: var(--color-success-muted);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  text-align: center;
}
.audit-success h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--color-success);
  margin-bottom: var(--space-2);
}
.audit-success p { color: var(--text-secondary); font-size: 0.9rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   BREAKPOINTS PANEL
═══════════════════════════════════════════════════════════════════════════ */
.breakpoints-panel {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6) var(--space-8);
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.bp-ruler {
  background: var(--surface-2);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-8) var(--space-8) var(--space-6);
  margin-bottom: var(--space-6);
  position: relative;
}

.bp-ruler-track {
  position: relative;
  height: 6px;
  background: var(--border-subtle);
  border-radius: 3px;
  margin-bottom: var(--space-5);
}

.bp-ruler-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple), var(--accent-cyan));
  border-radius: 3px;
}

.bp-markers {
  display: flex;
  justify-content: space-between;
}

.bp-marker-item {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.bp-marker-val {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-cyan);
}
.bp-marker-label {
  font-size: 0.7rem;
  color: var(--text-tertiary);
}

.mq-list { display: flex; flex-direction: column; gap: var(--space-3); }
.mq-item {
  background: var(--surface-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-5);
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.mq-item::before {
  content: '@media';
  color: var(--text-tertiary);
  font-size: 0.78rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   CODE EDITOR PANEL
═══════════════════════════════════════════════════════════════════════════ */
.editor-panel {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.editor-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-0);
}

.editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-4);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-subtle);
  gap: var(--space-3);
}

.editor-tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.editor-tabs::-webkit-scrollbar { display: none; }

.editor-file-tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-tertiary);
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.editor-file-tab:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.editor-file-tab.active {
  color: var(--text-primary);
  background: rgba(255,255,255,0.08);
  border-color: var(--border-default);
}

.editor-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

.editor-gutter {
  width: 48px;
  background: var(--surface-0);
  border-right: 1px solid var(--border-subtle);
  padding: var(--space-4) 0;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-align: right;
  padding-right: 12px;
  user-select: none;
  overflow: hidden;
  line-height: 1.6;
  white-space: pre;
}

.editor-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  padding: var(--space-4);
  white-space: pre;
  tab-size: 2;
}

/* ═══════════════════════════════════════════════════════════════════════════
   DEMOS PANEL
═══════════════════════════════════════════════════════════════════════════ */
.demos-panel {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-8);
}

.demos-hero {
  text-align: center;
  margin-bottom: var(--space-10);
}
.demos-hero h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: var(--space-3);
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent-cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.demos-hero p { color: var(--text-secondary); font-size: 0.95rem; }

.demos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-5);
  max-width: 1100px;
  margin: 0 auto;
}

.demo-card {
  background: var(--surface-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(12px);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.demo-card:hover {
  transform: translateY(-5px);
  border-color: rgba(79, 143, 255, 0.35);
  box-shadow: 0 16px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(79, 143, 255, 0.15);
}

.demo-card-preview {
  height: 160px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3.5rem;
  overflow: hidden;
}
.demo-card-preview-responsive {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.1), rgba(6, 182, 212, 0.1));
}
.demo-card-preview-legacy {
  background: linear-gradient(135deg, rgba(244, 63, 94, 0.1), rgba(245, 158, 11, 0.08));
}
.demo-card-preview-ecommerce {
  background: linear-gradient(135deg, rgba(79, 143, 255, 0.1), rgba(139, 92, 246, 0.1));
}
.demo-card-preview-portfolio {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(236, 72, 153, 0.1));
}

.demo-score-badge {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}
.demo-score-badge.good { background: var(--color-success-muted); color: var(--color-success); border: 1px solid rgba(34, 197, 94, 0.3); }
.demo-score-badge.bad  { background: var(--color-danger-muted); color: var(--color-danger); border: 1px solid rgba(244, 63, 94, 0.3); }

.demo-card-info {
  padding: var(--space-5);
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.demo-card-info h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 800;
}
.demo-card-info p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
  flex: 1;
}

.demo-card-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.demo-tags { display: flex; gap: var(--space-2); }
.demo-tag {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.06);
  color: var(--text-tertiary);
}

/* ═══════════════════════════════════════════════════════════════════════════
   UPLOAD MODAL
═══════════════════════════════════════════════════════════════════════════ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 14, 0.85);
  backdrop-filter: blur(16px);
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open { display: flex; }

.modal-box {
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 540px;
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  animation: modalIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
}

.modal-body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.upload-option {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all 0.2s;
  background: var(--surface-3);
}
.upload-option:hover {
  border-color: rgba(79, 143, 255, 0.5);
  background: rgba(79, 143, 255, 0.05);
}
.upload-option-icon { font-size: 1.75rem; flex-shrink: 0; }
.upload-option-info { flex: 1; }
.upload-option-title { font-weight: 700; font-size: 0.9rem; }
.upload-option-desc { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }

.upload-option.primary {
  border-color: rgba(79, 143, 255, 0.4);
  background: linear-gradient(135deg, rgba(79, 143, 255, 0.08), rgba(139, 92, 246, 0.08));
}

/* ═══════════════════════════════════════════════════════════════════════════
   DRAG OVERLAY
═══════════════════════════════════════════════════════════════════════════ */
.drag-overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 14, 0.9);
  backdrop-filter: blur(16px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.drag-overlay.active { opacity: 1; pointer-events: all; }

.drag-box {
  border: 2px dashed rgba(79, 143, 255, 0.6);
  border-radius: var(--radius-xl);
  padding: var(--space-10);
  text-align: center;
  max-width: 460px;
}
.drag-box-icon { font-size: 4rem; margin-bottom: var(--space-4); }
.drag-box h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent-blue);
  margin-bottom: var(--space-2);
}
.drag-box p { color: var(--text-secondary); font-size: 0.9rem; }

/* ═══════════════════════════════════════════════════════════════════════════
   TOAST
═══════════════════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}

.toast {
  background: var(--surface-2);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-5);
  font-size: 0.875rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  box-shadow: var(--shadow-lg);
  transform: translateX(120%);
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: all;
}
.toast.show { transform: translateX(0); }
.toast.success { border-left: 3px solid var(--color-success); }
.toast.error   { border-left: 3px solid var(--color-danger); }
.toast.info    { border-left: 3px solid var(--accent-blue); }

/* ═══════════════════════════════════════════════════════════════════════════
   STATUS BAR
═══════════════════════════════════════════════════════════════════════════ */
.status-bar {
  height: 28px;
  flex-shrink: 0;
  background: var(--surface-1);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-5);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-tertiary);
  gap: var(--space-4);
}

.status-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 6px var(--color-success);
}

/* ═══════════════════════════════════════════════════════════════════════════
   EMPTY STATE
═══════════════════════════════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-10);
  text-align: center;
  flex: 1;
  min-height: 400px;
}
.empty-state-icon { font-size: 4rem; opacity: 0.4; }
.empty-state h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-secondary);
}
.empty-state p { color: var(--text-tertiary); font-size: 0.88rem; max-width: 340px; }

/* Misc */
.no-files-tag { font-size: 0.8rem; color: var(--text-tertiary); padding: var(--space-2); }
