/* ═══════════════════════════════════════════════════════════════════
   PicDriver AI Image Background Remover - Core Stylesheet
   ═══════════════════════════════════════════════════════════════════ */

:root {
  --bg-primary: #0a0d14;
  --bg-secondary: #101420;
  --bg-card: #141926;
  --bg-card-hover: #1c2438;
  --border-color: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(56, 189, 248, 0.5);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-cyan: #38bdf8;
  --accent-amber: #f59e0b;
  --accent-emerald: #10b981;
  --accent-indigo: #6366f1;
  --accent-purple: #a855f7;
  --accent-rose: #f43f5e;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: 'Space Mono', 'Fira Code', monospace;
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --radius-full: 9999px;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 25px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.75);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════ HEADER ═══════════════ */
.site-header {
  background-color: #05070a;
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(16px);
}

.header-container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-primary);
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.15rem;
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.25);
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-name span {
  color: var(--accent-cyan);
}

.nav-links {
  display: flex;
  gap: 1.25rem;
  list-style: none;
  align-items: center;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  transition: var(--transition);
  white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent-cyan);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
}

/* ═══════════════ HERO ═══════════════ */
.hero {
  width: 100%;
  max-width: 1440px;
  margin: 2rem auto 1.5rem;
  padding: 0 1.5rem;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(56, 189, 248, 0.12);
  color: var(--accent-cyan);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-full);
  border: 1px solid rgba(56, 189, 248, 0.25);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero h1 {
  font-size: 2.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.65rem;
  line-height: 1.2;
}

.hero h1 span {
  background: linear-gradient(135deg, var(--accent-cyan), #a855f7);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 820px;
  margin: 0 auto;
}

/* ═══════════════ UPLOAD & DROPZONE ═══════════════ */
.workspace-container {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto 3rem;
  padding: 0 1.5rem;
  flex: 1;
}

.dropzone-card {
  background: var(--bg-card);
  border: 2px dashed rgba(56, 189, 248, 0.3);
  border-radius: var(--radius-lg);
  padding: 3.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.dropzone-card:hover,
.dropzone-card.dragover {
  border-color: var(--accent-cyan);
  background: var(--bg-card-hover);
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.15);
  transform: translateY(-2px);
}

.dropzone-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  font-size: 2rem;
  color: var(--accent-cyan);
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.2);
}

.dropzone-title {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.dropzone-subtitle {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  color: #05070a;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.85rem 1.85rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(56, 189, 248, 0.35);
  transition: var(--transition);
}

.btn-upload:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(56, 189, 248, 0.5);
}

.sample-row {
  margin-top: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.sample-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
}

.sample-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-full);
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.sample-btn:hover {
  border-color: var(--accent-cyan);
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

/* ═══════════════ AI PROCESSING PROGRESS BAR ═══════════════ */
.ai-progress-container {
  display: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  margin-bottom: 2rem;
}

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

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

.progress-percentage {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--accent-cyan);
}

.progress-bar-bg {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-cyan), var(--accent-indigo), var(--accent-purple));
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.progress-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.65rem;
}

/* ═══════════════ MAIN AI WORKSPACE (AFTER IMAGE LOAD) ═══════════════ */
.ai-editor-workspace {
  display: none;
  grid-template-columns: 1fr 380px;
  gap: 1.5rem;
  align-items: start;
}

/* STAGE DISPLAY */
.stage-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.stage-title {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.stage-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

.canvas-viewport {
  width: 100%;
  min-height: 480px;
  background-image: 
    linear-gradient(45deg, #182030 25%, transparent 25%), 
    linear-gradient(-45deg, #182030 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #182030 75%), 
    linear-gradient(-45deg, transparent 75%, #182030 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  background-color: #0f1523;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

#remover-canvas {
  max-width: 100%;
  max-height: 520px;
  object-fit: contain;
  display: block;
}

/* BEFORE / AFTER SPLIT SLIDER */
.split-slider-wrapper {
  position: relative;
  width: 100%;
  height: 480px;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  cursor: col-resize;
  background-image: 
    linear-gradient(45deg, #182030 25%, transparent 25%), 
    linear-gradient(-45deg, #182030 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #182030 75%), 
    linear-gradient(-45deg, transparent 75%, #182030 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  background-color: #0f1523;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.split-slider-wrapper:focus-visible {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.4);
}

.split-layer,
.split-layer-after,
.split-before-clip {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.split-layer canvas,
.split-layer-after canvas,
.split-before-clip canvas {
  max-width: 100%;
  max-height: 480px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* Perfect alignment via polygon/inset clipping (zero distortion) */
.split-before-clip {
  clip-path: polygon(0 0, var(--split-pos, 50%) 0, var(--split-pos, 50%) 100%, 0 100%);
  -webkit-clip-path: polygon(0 0, var(--split-pos, 50%) 0, var(--split-pos, 50%) 100%, 0 100%);
  z-index: 2;
  border-right: none;
}

/* Floating Badges */
.split-badge {
  position: absolute;
  top: 14px;
  padding: 0.35rem 0.8rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 4;
}

.split-badge-before {
  left: 14px;
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.2);
}

.split-badge-after {
  right: 14px;
  color: var(--accent-cyan);
  border-color: rgba(56, 189, 248, 0.35);
  z-index: 1;
}

/* Neon Vertical Divider Line */
.split-divider-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--split-pos, 50%);
  width: 2px;
  background: var(--accent-cyan);
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.85);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 6;
}

/* Floating Circular Grabber Handle */
.split-handle {
  position: absolute;
  top: 50%;
  left: var(--split-pos, 50%);
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  border: 2.5px solid #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  cursor: col-resize;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6), 0 0 20px rgba(56, 189, 248, 0.7);
  z-index: 10;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  touch-action: none;
}

.split-handle:hover,
.split-slider-wrapper.is-dragging .split-handle {
  transform: translate(-50%, -50%) scale(1.12);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.75), 0 0 28px rgba(56, 189, 248, 0.95);
}

.split-handle-icon {
  font-size: 0.76rem;
  letter-spacing: -1px;
  line-height: 1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  user-select: none;
}

/* ═══════════════ SIDEBAR CONTROLS ═══════════════ */
.controls-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.control-section-title {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.preset-chip-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.mode-btn {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.5rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: center;
  transition: var(--transition);
}

.mode-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: rgba(56, 189, 248, 0.3);
}

.mode-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* COLOR SWATCHES */
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.color-dot {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}

.color-dot:hover {
  transform: scale(1.1);
}

.color-dot.active {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

/* GRADIENTS GRID */
.gradient-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.grad-dot {
  width: 100%;
  height: 36px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 2px solid transparent;
  transition: var(--transition);
}

.grad-dot:hover {
  transform: scale(1.05);
}

.grad-dot.active {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

/* EXPORT BUTTONS */
.export-group {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.5rem;
}

.btn-action {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  font-weight: 700;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.btn-download-primary {
  background: linear-gradient(135deg, var(--accent-cyan), var(--accent-indigo));
  color: #05070a;
  box-shadow: 0 4px 16px rgba(56, 189, 248, 0.35);
}

.btn-download-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(56, 189, 248, 0.5);
}

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

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.15);
}

/* ═══════════════ PRO STRATEGY & EDUCATIONAL ═══════════════ */
.info-section {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto 3rem;
  padding: 0 1.5rem;
}

.section-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 2rem;
}

.section-title {
  font-size: 1.45rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-subtitle {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.tips-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

.tip-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  border-left: 3px solid var(--accent-cyan);
}

.tip-card.amber { border-left-color: var(--accent-amber); }
.tip-card.emerald { border-left-color: var(--accent-emerald); }
.tip-card.purple { border-left-color: var(--accent-purple); }

.tip-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}

.tip-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ═══════════════ FAQ ═══════════════ */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.faq-question {
  width: 100%;
  padding: 1.15rem 1.25rem;
  text-align: left;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: var(--transition);
}

.faq-question:hover { color: var(--accent-cyan); }

.faq-icon {
  font-size: 1.1rem;
  color: var(--accent-cyan);
  transition: transform 0.3s ease;
}

.faq-item.open .faq-icon {
  transform: rotate(180deg);
}

.faq-answer {
  display: none;
  padding: 0 1.25rem 1.25rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.6;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  padding-top: 0.85rem;
}

.faq-item.open .faq-answer {
  display: block;
}

/* ═══════════════ FOOTER ═══════════════ */
.site-footer {
  background-color: #05070a;
  border-top: 1px solid var(--border-color);
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: auto;
}

/* ═══════════════ RESPONSIVE BREAKPOINTS ═══════════════ */
@media (max-width: 1024px) {
  .ai-editor-workspace {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .menu-toggle { display: block; }
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #05070a;
    flex-direction: column;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.85);
    z-index: 1001;
  }
  .nav-links.open,
  .nav-links.show {
    display: flex;
  }
  .hero h1 { font-size: 1.75rem; }
  .dropzone-card { padding: 2.5rem 1.25rem; }
  .canvas-viewport,
  .split-slider-wrapper { height: 350px; min-height: 350px; }
  .split-layer canvas,
  .split-layer-after canvas,
  .split-before-clip canvas { max-height: 350px; }
}


/* ==========================================================================
   Universal Mobile & Tablet Responsiveness Suite (320px - 1040px)
   ========================================================================== */

/* 1. Fluid Media & Canvas Scaling */
img, canvas, svg, video {
  max-width: 100% !important;
  height: auto !important;
}

/* 2. Responsive Touch-Scroll Tables */
table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
}

.table-responsive,
.table-container,
.table-wrap,
.table-wrapper,
.matrix-container,
.data-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* 3. Tablet Breakpoint (<= 1040px) */
@media (max-width: 1040px) {
  .workspace,
  .studio-layout,
  .finder-workspace,
  .simulator-grid,
  .layout-grid,
  .remover-workspace {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }

  .sidebar-panel,
  .controls-sidebar {
    border-left: none !important;
    border-top: 1px solid var(--border, rgba(255,255,255,0.1));
  }
}

/* 4. Mobile Portrait & Landscape (<= 768px) */
@media (max-width: 768px) {
  .site-header {
    height: auto !important;
    padding: 10px 16px !important;
  }

  .header-inner,
  .header-container {
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
    width: 100%;
  }

  .logo,
  .brand-logo,
  .logo-wrap {
    font-size: 1.15rem !important;
  }

  .menu-toggle {
    display: block !important;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: #0a0d14;
    flex-direction: column;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border, rgba(255,255,255,0.1));
    z-index: 1000;
  }

  .nav-links.open {
    display: flex !important;
  }

  .hero {
    padding: 28px 16px 20px !important;
  }

  .hero h1 {
    font-size: clamp(1.6rem, 5.5vw, 2.3rem) !important;
    line-height: 1.2 !important;
  }

  .hero p {
    font-size: 0.92rem !important;
  }

  .page-wrapper,
  .portal-main,
  .container {
    padding: 16px 12px 40px !important;
  }

  .workspace,
  .studio-layout,
  .finder-workspace,
  .remover-workspace {
    padding: 0 !important;
    gap: 16px !important;
  }

  .panel-card,
  .results-card,
  .sidebar-panel,
  .stage-area,
  .card {
    padding: 16px 14px !important;
    border-radius: 12px !important;
  }

  .metrics-grid,
  .data-grid,
  .grid-2,
  .grid-3,
  .grid-4,
  .calc-grid,
  .features-grid,
  .steps-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .tool-chips-grid,
  .chips-bar,
  .preset-chip-group,
  .mode-tabs {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .tool-chip,
  .preset-btn,
  .mode-tab-btn {
    padding: 6px 12px !important;
    font-size: 0.78rem !important;
  }

  .btn-primary,
  .btn-secondary,
  .action-btn,
  .btn-action {
    min-height: 44px;
    width: 100%;
    justify-content: center;
  }

  .btn-group,
  .action-btns,
  .download-row {
    flex-direction: column !important;
    width: 100% !important;
    gap: 8px !important;
  }

  table {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    white-space: nowrap !important;
  }

  th, td {
    padding: 8px 10px !important;
    font-size: 0.8rem !important;
  }
}

/* 5. Small Handsets (<= 480px) */
@media (max-width: 480px) {
  .hero-pill,
  .hero-badge {
    font-size: 0.72rem !important;
    padding: 3px 10px !important;
  }

  .form-group {
    margin-bottom: 14px !important;
  }

  .form-control,
  .form-select,
  .control-input,
  .control-select,
  input[type="text"],
  input[type="number"],
  select {
    font-size: 16px !important; /* Prevents auto-zoom in iOS Safari */
    min-height: 42px;
  }

  .info-section,
  .guide-section,
  .faq-section {
    padding: 24px 12px !important;
  }
}
