/* =====================================================================
   LoadLab — Modern Landing Page Stylesheet
   Designed for zero-scroll 100vh full-width desktop experience
   ===================================================================== */

:root {
  --bg-deep: #090a0f;
  --bg-base: #0e1017;
  --bg-card: rgba(21, 24, 34, 0.78);
  --bg-card-hover: rgba(30, 34, 48, 0.95);
  --bg-input: #151821;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(255, 255, 255, 0.16);
  --border-accent: rgba(255, 108, 55, 0.45);
  
  --accent: #ff6c37;
  --accent-hover: #ff8254;
  --accent-glow: rgba(255, 108, 55, 0.3);
  
  --emerald: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.25);
  
  --blue: #3b82f6;
  --purple: #8b5cf6;
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  
  --transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Ambient Radial Glows & Grid Mesh */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
  transition: opacity 1s ease;
}

.glow-top-left {
  width: 550px;
  height: 550px;
  top: -150px;
  left: -100px;
  background: radial-gradient(circle, rgba(255, 108, 55, 0.22) 0%, rgba(139, 92, 246, 0.08) 70%, transparent 100%);
}

.glow-bottom-right {
  width: 600px;
  height: 600px;
  bottom: -200px;
  right: -100px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.16) 0%, rgba(59, 130, 246, 0.1) 60%, transparent 100%);
}

.grid-overlay {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 1;
}

/* Root Viewport - Strict Single Viewport Container */
.app-viewport {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(10px, 1.6vh, 22px) clamp(16px, 2.8vw, 36px);
  overflow: hidden;
}

/* ---------------------------------------------------------------------
   TOP NAVIGATION
   --------------------------------------------------------------------- */
.top-nav {
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-main);
}

.brand-logo {
  border-radius: var(--radius-sm);
  box-shadow: 0 0 16px var(--accent-glow);
  transition: transform 0.25s ease;
}

.brand-link:hover .brand-logo {
  transform: rotate(-6deg) scale(1.06);
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 40%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.version-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.pulse-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
  animation: pulseAnimation 2s infinite ease-in-out;
}

@keyframes pulseAnimation {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.brand-badge {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Downloads Counter Pill */
.downloads-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 13px;
  border-radius: var(--radius-full);
  background: rgba(255, 108, 55, 0.08);
  border: 1px solid rgba(255, 108, 55, 0.28);
  font-size: 0.8rem;
  cursor: default;
  transition: var(--transition);
  box-shadow: 0 0 12px rgba(255, 108, 55, 0.1);
}

.downloads-pill:hover {
  background: rgba(255, 108, 55, 0.14);
  border-color: rgba(255, 108, 55, 0.45);
  box-shadow: 0 0 18px rgba(255, 108, 55, 0.2);
}

.download-icon {
  color: var(--accent);
  display: flex;
  align-items: center;
}

.downloads-label {
  color: var(--text-muted);
  font-weight: 500;
}

.downloads-count {
  color: #fff;
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

/* Navigation Buttons */
.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  font-family: var(--font-sans);
}

.github-btn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
}

.github-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--border-highlight);
  transform: translateY(-1px);
}

/* ---------------------------------------------------------------------
   MAIN CONTENT GRID (Left Hero + Right Preview)
   --------------------------------------------------------------------- */
.main-content {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(420px, 1fr) minmax(480px, 1.15fr);
  gap: clamp(18px, 3.2vw, 42px);
  align-items: center;
  justify-content: center;
  padding: clamp(6px, 1.2vh, 18px) 0;
}

/* ---------------------------------------------------------------------
   LEFT COLUMN: HERO & 3 OS DOWNLOAD BUTTONS
   --------------------------------------------------------------------- */
.hero-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(10px, 1.8vh, 18px);
  min-height: 0;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  width: fit-content;
  border-radius: var(--radius-full);
  background: rgba(255, 108, 55, 0.09);
  border: 1px solid rgba(255, 108, 55, 0.22);
  color: #ff9166;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.hero-title {
  font-size: clamp(1.85rem, 3.3vw, 2.75rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.035em;
  color: #ffffff;
}

.gradient-text {
  background: linear-gradient(135deg, #ff6c37 20%, #ff9e7a 60%, #5cb87a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: clamp(0.86rem, 1.05vw, 0.98rem);
  line-height: 1.5;
  color: var(--text-muted);
  max-width: 540px;
}

.hero-subtitle code {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  color: #fed7aa;
  font-size: 0.88em;
}

/* Feature Quad Chips */
.features-quad {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  max-width: 540px;
}

.feature-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.feature-chip:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-highlight);
  transform: translateY(-1px);
}

.chip-icon {
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chip-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.chip-text strong {
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-main);
}

.chip-text span {
  font-size: 0.68rem;
  color: var(--text-dim);
}

/* DOWNLOAD SECTION */
.download-block {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-width: 560px;
  margin-top: 2px;
}

.download-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.download-heading {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-dim);
}

.detected-os-badge {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.25);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.detected-os-badge.visible {
  opacity: 1;
}

/* 3 OS Download Cards Grid */
.download-buttons-grid {
  display: flex;
  gap: 14px;
  align-items: center;
}

.download-card.os-icon-btn {
  position: relative;
  width: 76px;
  height: 64px;
  min-height: 64px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  backdrop-filter: blur(14px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  overflow: hidden;
}

.os-icon-img {
  width: 34px;
  height: 34px;
  object-fit: contain;
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), filter 0.22s ease;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.45));
}

.download-card.os-icon-btn:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

.download-card.os-icon-btn:hover .os-icon-img {
  transform: scale(1.15);
}

.win-card:hover {
  border-color: rgba(0, 173, 239, 0.55);
  box-shadow: 0 8px 22px rgba(0, 173, 239, 0.25);
}

.mac-card:hover {
  border-color: rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 22px rgba(255, 255, 255, 0.2);
}

.linux-card:hover {
  border-color: rgba(250, 204, 21, 0.55);
  box-shadow: 0 8px 22px rgba(250, 204, 21, 0.25);
}

/* Recommended / Detected styling */
.download-card.recommended {
  border-color: rgba(255, 108, 55, 0.6);
  box-shadow: 0 0 16px rgba(255, 108, 55, 0.22);
  background: rgba(30, 33, 44, 0.95);
}

.download-card.recommended::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

/* Download Footnote */
.download-footnote {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-dim);
  padding: 2px 2px;
}

.footnote-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.footnote-item svg {
  color: var(--emerald);
}

.footnote-separator {
  color: rgba(255, 255, 255, 0.2);
}

/* ---------------------------------------------------------------------
   RIGHT COLUMN: LOADLAB DESKTOP SIMULATOR
   --------------------------------------------------------------------- */
.preview-section {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  height: 100%;
}

.simulator-window {
  width: 100%;
  max-width: 640px;
  background: #14161f;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  box-shadow: 
    0 24px 60px rgba(0, 0, 0, 0.65),
    0 0 40px rgba(255, 108, 55, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  backdrop-filter: blur(20px);
}

/* Titlebar */
.window-titlebar {
  height: 38px;
  background: #1a1d28;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
}

.window-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

.win-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.dot-close { background: #ff5f56; }
.dot-min { background: #ffbd2e; }
.dot-max { background: #27c93f; }

.window-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #14161f;
  padding: 5px 12px;
  border-radius: 6px 6px 0 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-bottom: none;
}

.status-live-pill {
  font-size: 0.58rem;
  font-weight: 800;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(16, 185, 129, 0.2);
  color: var(--emerald);
}

.engine-indicator {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

/* Simulator Config Bar */
.simulator-config-bar {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #10121a;
  border-bottom: 1px solid var(--border-subtle);
}

.method-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 800;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  padding: 4px 7px;
  border-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.url-input-mock {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: #f1f5f9;
  background: #181b26;
  padding: 5px 10px;
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.config-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  background: #181b26;
  padding: 4px 8px;
  border-radius: 5px;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.config-val {
  color: #fff;
  font-weight: 700;
  font-family: var(--font-mono);
}

.sim-run-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #ffffff;
  border: none;
  border-radius: 5px;
  padding: 5px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 0 10px var(--accent-glow);
}

.sim-run-btn:hover {
  background: var(--accent-hover);
  box-shadow: 0 0 16px var(--accent-glow);
}

.sim-run-btn.paused {
  background: #252936;
  color: var(--text-muted);
  box-shadow: none;
}

.btn-indicator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
  animation: pulseAnimation 1.4s infinite ease-in-out;
}

.sim-run-btn.paused .btn-indicator-dot {
  background: var(--text-dim);
  animation: none;
}

/* Simulator Metrics Grid */
.simulator-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 10px 14px;
  background: #141620;
  border-bottom: 1px solid var(--border-subtle);
}

.metric-card {
  background: #1b1e2a;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.metric-name {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
}

.metric-spark-label {
  font-size: 0.6rem;
  color: var(--emerald);
  font-family: var(--font-mono);
}

.metric-badge-ok {
  font-size: 0.58rem;
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
  padding: 1px 4px;
  border-radius: 3px;
}

.metric-badge-engine {
  font-size: 0.58rem;
  background: rgba(255, 108, 55, 0.15);
  color: var(--accent);
  padding: 1px 4px;
  border-radius: 3px;
}

.metric-badge-200 {
  font-size: 0.58rem;
  background: rgba(16, 185, 129, 0.15);
  color: var(--emerald);
  padding: 1px 4px;
  border-radius: 3px;
}

.metric-val {
  font-family: var(--font-mono);
  font-size: 1.18rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.metric-unit {
  font-size: 0.75rem;
  color: var(--text-dim);
  font-weight: 400;
}

.metric-sub {
  font-size: 0.62rem;
  color: var(--text-dim);
  margin-top: 3px;
}

.percentile-rows {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-family: var(--font-mono);
  font-size: 0.64rem;
}

.p-row {
  display: flex;
  justify-content: space-between;
  color: var(--text-dim);
}

.p-row strong {
  color: #f1f5f9;
}

.success-rate {
  color: var(--emerald);
  font-weight: 600;
}

/* Simulator Live Canvas Chart */
.simulator-chart-container {
  padding: 10px 14px 6px 14px;
  background: #11131c;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.68rem;
  color: var(--text-dim);
}

.chart-legend {
  display: flex;
  align-items: center;
  gap: 8px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.rps-dot {
  background: var(--accent);
  box-shadow: 0 0 6px var(--accent);
}

.latency-dot {
  background: var(--emerald);
  box-shadow: 0 0 6px var(--emerald);
}

.canvas-wrapper {
  width: 100%;
  height: 120px;
  position: relative;
}

#liveTelemetryCanvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.25);
}

/* Simulator Footer & Engine Selector */
.simulator-footer {
  padding: 8px 14px;
  background: #161824;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  width: 100%;
}

.engine-tabs-group {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.engine-group-label {
  font-size: 0.7rem;
  color: var(--text-dim);
  font-weight: 600;
  margin-right: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}

.engine-tab {
  flex: 1;
  text-align: center;
  background: #1f2231;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  border-radius: 5px;
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.engine-tab:hover {
  color: #fff;
  border-color: var(--border-highlight);
  background: #252a3d;
}

.engine-tab.active {
  background: rgba(255, 108, 55, 0.18);
  color: #ff9166;
  border-color: rgba(255, 108, 55, 0.4);
  box-shadow: 0 0 10px rgba(255, 108, 55, 0.15);
}

/* ---------------------------------------------------------------------
   FOOTER (Fixed Bottom Status Bar, No Scroll)
   --------------------------------------------------------------------- */
.app-footer {
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
  padding-top: 4px;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

.footer-center {
  color: var(--text-muted);
}

.footer-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: #ffffff;
}

.footer-divider {
  color: rgba(255, 255, 255, 0.2);
}

/* ---------------------------------------------------------------------
   MODAL & TOAST COMPONENTS
   --------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #181b26;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 108, 55, 0.35);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 108, 55, 0.2);
  font-size: 0.82rem;
  font-weight: 500;
  pointer-events: auto;
  animation: toastSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.toast-icon {
  color: var(--accent);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  width: 90%;
  max-width: 480px;
  background: #141722;
  border: 1px solid var(--border-highlight);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateY(10px) scale(0.98);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-backdrop.active .modal-box {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ffffff;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-close-btn:hover {
  color: #fff;
}

.modal-body {
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.modal-action-btn {
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
}

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

.modal-action-btn.primary:hover {
  background: var(--accent-hover);
}

.modal-action-btn.secondary {
  background: #1f2332;
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
}

.modal-action-btn.secondary:hover {
  color: #fff;
}

/* ---------------------------------------------------------------------
   RESPONSIVENESS (Preserving no-scroll on desktop, fallback for mobile)
   --------------------------------------------------------------------- */
@media (max-width: 980px) {
  html, body {
    overflow-x: hidden;
    overflow-y: auto;
    height: auto;
    min-height: 100%;
    width: 100%;
  }

  .app-viewport {
    height: auto;
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    overflow: visible;
    padding: 16px 16px 24px 16px;
  }

  .main-content {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 12px 0 20px 0;
    width: 100%;
    max-width: 100%;
  }

  .hero-section {
    width: 100%;
    max-width: 100%;
  }

  .preview-section {
    width: 100%;
    max-width: 100%;
  }

  .simulator-window {
    width: 100%;
    max-width: 100%;
  }

  .app-footer {
    flex-direction: column;
    height: auto;
    gap: 8px;
    padding: 16px 0;
    text-align: center;
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 640px) {
  .top-nav {
    height: auto;
    padding: 4px 0 10px 0;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .downloads-label {
    display: none;
  }

  .github-btn span {
    display: none;
  }

  .github-btn {
    padding: 6px 10px;
  }

  .version-tag {
    font-size: 0.7rem;
    padding: 2px 7px;
  }

  .hero-title {
    font-size: clamp(1.75rem, 6.5vw, 2.2rem);
    line-height: 1.15;
  }

  .hero-subtitle {
    font-size: 0.88rem;
    line-height: 1.48;
    max-width: 100%;
  }

  .features-quad {
    grid-template-columns: 1fr;
    gap: 6px;
    max-width: 100%;
  }

  .download-buttons-grid {
    gap: 12px;
  }

  .download-card.os-icon-btn {
    width: 68px;
    height: 58px;
    min-height: 58px;
  }

  .os-icon-img {
    width: 28px;
    height: 28px;
  }

  .download-footnote {
    flex-wrap: wrap;
    gap: 6px;
  }

  .window-titlebar {
    padding: 0 10px;
    height: 34px;
  }

  .engine-indicator {
    display: none;
  }

  .window-tab {
    padding: 3px 8px;
    font-size: 0.68rem;
  }

  .simulator-config-bar {
    padding: 8px 10px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .url-input-mock {
    font-size: 0.72rem;
    padding: 4px 8px;
    min-width: 120px;
  }

  .config-pill {
    padding: 3px 6px;
    font-size: 0.65rem;
  }

  .sim-run-btn {
    padding: 4px 10px;
    font-size: 0.68rem;
    margin-left: auto;
  }

  .simulator-metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    padding: 8px 10px;
  }

  .metric-card {
    padding: 6px 8px;
  }

  .metric-val {
    font-size: 1.1rem;
  }

  .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .chart-rate {
    font-size: 0.62rem;
  }

  .canvas-wrapper {
    height: 105px;
  }

  .simulator-footer {
    padding: 8px 10px;
  }

  .engine-tabs-group {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
    width: 100%;
  }

  .engine-group-label {
    grid-column: 1 / -1;
    margin-bottom: 2px;
  }

  .engine-tab {
    padding: 6px 8px;
    font-size: 0.7rem;
    white-space: normal;
  }

  .footer-left span {
    font-size: 0.68rem;
  }
}

@media (max-height: 720px) and (min-width: 981px) {
  /* Ultra-dense desktop compact mode */
  .app-viewport {
    padding: 6px 20px;
  }
  
  .top-nav {
    height: 42px;
  }

  .hero-section {
    gap: 8px;
  }

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

  .hero-subtitle {
    font-size: 0.82rem;
    line-height: 1.35;
  }

  .features-quad {
    gap: 6px;
  }

  .feature-chip {
    padding: 5px 8px;
  }

  .download-card {
    min-height: 80px;
    padding: 8px 10px;
  }

  .canvas-wrapper {
    height: 90px;
  }

  .metric-card {
    padding: 5px 8px;
  }

  .metric-val {
    font-size: 1rem;
  }

  .app-footer {
    height: 30px;
    font-size: 0.65rem;
  }
}
