/* ==========================================
   Online Video Cropper - Design System & Stylesheet
   ========================================== */

:root {
  --bg-dark: #070a12;
  --bg-card: rgba(18, 26, 43, 0.75);
  --bg-card-hover: rgba(26, 36, 60, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(99, 102, 241, 0.4);

  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --primary-glow: rgba(99, 102, 241, 0.35);

  --accent-cyan: #06b6d4;
  --success-500: #10b981;
  --success-gradient: linear-gradient(135deg, #10b981 0%, #059669 100%);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --radius-lg: 20px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --transition-fast: 0.15s ease;
  --transition-normal: 0.25s ease;
}

/* Base Resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(circle at 15% 15%, rgba(99, 102, 241, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 85%, rgba(139, 92, 246, 0.08) 0%, transparent 40%);
  background-attachment: fixed;
}

/* Performance: Remove fixed background on mobile (causes repaint on scroll) */
@media (max-width: 768px) {
  body {
    background-attachment: scroll;
  }
}

/* Utilities */
.hidden {
  display: none !important;
}

/* Screen reader only - visually hidden but accessible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip to main content link (WCAG 2.1 AA) */
.skip-to-content {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  background: var(--primary-500);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-to-content:focus {
  top: 1rem;
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* Focus visible styles for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Remove outline for mouse users but keep for keyboard */
*:focus:not(:focus-visible) {
  outline: none;
}

/* Header */
.app-header {
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(7, 10, 18, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
  will-change: transform;
}

.header-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 800;
  font-size: 1.35rem;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: var(--primary-gradient);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.logo-icon svg {
  width: 20px;
  height: 20px;
}

.logo-highlight {
  color: var(--primary-500);
}

.header-badges {
  display: flex;
  gap: 0.75rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.privacy-badge {
  background: rgba(99, 102, 241, 0.12);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.zero-badge {
  background: rgba(16, 185, 129, 0.12);
  color: #6ee7b7;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

/* Main Layout */
.main-wrapper {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
  flex: 1;
}

/* Hero Section */
.hero-section {
  text-align: center;
  margin-bottom: 2.5rem;
}

.hero-content {
  max-width: 720px;
  margin: 0 auto 2rem;
}

.pill-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 0.35rem 1rem;
  border-radius: 30px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-cyan);
  margin-bottom: 1rem;
}

.hero-title {
  font-size: 2.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 1rem;
}

.gradient-text {
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 400;
}

.hero-subtitle strong {
  color: var(--text-main);
}

/* Dropzone Upload Box */
.upload-box {
  background: var(--bg-card);
  border: 2px dashed rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-lg);
  padding: 3.5rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.upload-box:hover,
.upload-box.drag-over {
  border-color: var(--primary-500);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: 0 25px 50px rgba(99, 102, 241, 0.15);
}

.file-input-hidden {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 10;
}

.select-file-btn {
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
}

.upload-box:hover .select-file-btn {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.35);
}

.upload-icon-wrapper {
  width: 72px;
  height: 72px;
  background: rgba(99, 102, 241, 0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  color: var(--primary-500);
  transition: transform var(--transition-normal);
}

.upload-box:hover .upload-icon-wrapper {
  transform: scale(1.1) rotate(-4deg);
}

.upload-icon {
  width: 36px;
  height: 36px;
}

.upload-title {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.upload-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.upload-meta {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.meta-tag {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  padding: 0.25rem 0.65rem;
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Workspace Section */
.workspace-section {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* File Metadata Header Bar */
.file-header-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(12px);
}

.file-info-group {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.file-icon-box {
  width: 40px;
  height: 40px;
  background: rgba(99, 102, 241, 0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-500);
}

.file-name {
  font-size: 1rem;
  font-weight: 700;
  max-width: 320px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-specs {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Toolbar & Presets */
.controls-toolbar {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

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

.preset-buttons-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.preset-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: all var(--transition-fast);
}

.preset-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.preset-btn.active {
  background: var(--primary-500);
  border-color: var(--primary-500);
  color: #fff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.preset-icon {
  display: inline-block;
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.ratio-16-9 {
  width: 14px;
  height: 8px;
}

.ratio-9-16 {
  width: 8px;
  height: 14px;
}

.ratio-1-1 {
  width: 11px;
  height: 11px;
}

.ratio-4-5 {
  width: 9px;
  height: 12px;
}

/* Interactive Crop Stage */
.crop-stage-card {
  background: #000;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
}

.video-container {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #05070d;
  min-height: 200px;
  max-height: 360px;
  overflow: hidden;
  user-select: none;
}

#video-preview {
  max-width: 100%;
  max-height: 360px;
  display: block;
  object-fit: contain;
}

/* Crop Box Overlay */
.crop-box {
  position: absolute;
  border: 2px solid var(--primary-500);
  background: rgba(99, 102, 241, 0.1);
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.72);
  cursor: move;
  z-index: 10;
}

.crop-tag {
  position: absolute;
  top: -24px;
  left: 0;
  background: var(--primary-500);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  pointer-events: none;
  text-transform: uppercase;
}

/* Rule of Thirds Grid Lines */
.crop-grid-lines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.grid-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.25);
}

.grid-line.horizontal {
  left: 0;
  right: 0;
  height: 1px;
}

.grid-line.horizontal.h1 {
  top: 33.333%;
}

.grid-line.horizontal.h2 {
  top: 66.666%;
}

.grid-line.vertical {
  top: 0;
  bottom: 0;
  width: 1px;
}

.grid-line.vertical.v1 {
  left: 33.333%;
}

.grid-line.vertical.v2 {
  left: 66.666%;
}

/* Handles */
.handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #ffffff;
  border: 2.5px solid var(--primary-500);
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  z-index: 20;
}

.handle.nw {
  top: -7px;
  left: -7px;
  cursor: nwse-resize;
}

.handle.n {
  top: -7px;
  left: calc(50% - 7px);
  cursor: ns-resize;
}

.handle.ne {
  top: -7px;
  right: -7px;
  cursor: nesw-resize;
}

.handle.e {
  top: calc(50% - 7px);
  right: -7px;
  cursor: ew-resize;
}

.handle.se {
  bottom: -7px;
  right: -7px;
  cursor: nwse-resize;
}

.handle.s {
  bottom: -7px;
  left: calc(50% - 7px);
  cursor: ns-resize;
}

.handle.sw {
  bottom: -7px;
  left: -7px;
  cursor: nesw-resize;
}

.handle.w {
  top: calc(50% - 7px);
  left: -7px;
  cursor: ew-resize;
}

/* Stage Footer Bar & Metrics */
.stage-footer-bar {
  background: var(--bg-card);
  border-top: 1px solid var(--border-subtle);
  padding: 0.85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.player-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn-icon {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: var(--primary-500);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-icon:hover {
  background: var(--primary-500);
  color: #fff;
}

.time-display {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  font-mono: monospace;
}

.crop-metrics-readout {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.metric-item {
  display: flex;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.metric-label {
  color: var(--text-muted);
}

.metric-value {
  font-weight: 700;
  color: var(--accent-cyan);
}

/* Action Panel & Progress */
.action-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  margin-top: 0.5rem;
}

/* Buttons System */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition-normal);
  text-decoration: none;
}

.btn-lg {
  padding: 0.95rem 2.25rem;
  font-size: 1.05rem;
}

.btn-sm {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
}

.btn-primary {
  background: var(--primary-gradient);
  color: #fff;
  box-shadow: 0 10px 25px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px var(--primary-glow);
  filter: brightness(1.1);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
}

.btn-success {
  background: var(--success-gradient);
  color: #fff;
  box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 35px rgba(16, 185, 129, 0.4);
}

/* Processing Mode: Hide all studio editor controls when Save is clicked */
.workspace-section.is-cropping .file-header-card,
.workspace-section.is-cropping .crop-stage-card,
.workspace-section.is-cropping .filmstrip-timeline-wrapper,
.workspace-section.is-cropping .studio-bottom-bar {
  display: none !important;
}

/* Progress Container Card (Exclusive Save State) */
.progress-container {
  width: 100%;
  max-width: 560px;
  margin: 3rem auto;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
  text-align: center;
  backdrop-filter: blur(16px);
  animation: fadeInScale 0.3s ease-out forwards;
}

.processing-card-header {
  margin-bottom: 1.75rem;
}

.spinner-icon-box {
  width: 64px;
  height: 64px;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-500);
  margin: 0 auto 1.25rem;
  box-shadow: 0 0 25px var(--primary-glow);
}

.animate-spin {
  animation: spin 1.2s linear infinite;
}

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

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.processing-title {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 0.4rem;
}

.processing-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.92rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.status-message {
  color: #a5b4fc;
}

.progress-percent {
  color: var(--accent-cyan);
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--primary-gradient);
  border-radius: 10px;
  transition: width 0.2s ease-out;
  box-shadow: 0 0 12px var(--primary-500);
}

/* Download Result Section */
.download-section {
  max-width: 720px;
  margin: 0 auto;
}

.download-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: center;
  backdrop-filter: blur(16px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

.success-header {
  margin-bottom: 1.75rem;
}

.success-badge-icon {
  width: 60px;
  height: 60px;
  background: rgba(16, 185, 129, 0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success-500);
  margin: 0 auto 1rem;
}

.success-header h2 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.success-header p {
  color: var(--text-muted);
}

.output-preview-wrapper {
  margin-bottom: 2rem;
  background: #000;
  border-radius: var(--radius-md);
  overflow: hidden;
  max-height: 420px;
}

#output-video {
  width: 100%;
  max-height: 420px;
  display: block;
}

.download-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Features Grid */
.features-section {
  margin-top: 5rem;
}

.section-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 2.5rem;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  transition: transform var(--transition-normal);
}

.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-glow);
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.icon-shield {
  background: rgba(99, 102, 241, 0.15);
  color: #a5b4fc;
}

.icon-bolt {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
}

.icon-star {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.icon-crop {
  background: rgba(16, 185, 129, 0.15);
  color: #6ee7b7;
}

.feature-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.feature-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* How It Works Section */
.how-it-works-section {
  margin-top: 5rem;
}

.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.step-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2rem 1.5rem;
  position: relative;
  text-align: center;
}

.step-number {
  width: 42px;
  height: 42px;
  background: var(--primary-gradient);
  color: #fff;
  font-weight: 800;
  font-size: 1.2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.step-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.step-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* FAQ Section */
.faq-section {
  margin-top: 5rem;
}

.faq-container {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

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

.faq-question {
  padding: 1.25rem 1.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  list-style: none;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-chevron {
  transition: transform var(--transition-fast);
  color: var(--text-muted);
}

.faq-item[open] .faq-chevron {
  transform: rotate(180deg);
  color: var(--primary-500);
}

.faq-answer {
  padding: 0 1.5rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
  margin-top: 0.5rem;
  padding-top: 1rem;
}

/* Footer */
.app-footer {
  border-top: 1px solid var(--border-subtle);
  background: rgba(7, 10, 18, 0.9);
  padding: 2.5rem 1.5rem;
  margin-top: 4rem;
}

.footer-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.footer-brand p {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin-top: 0.35rem;
}

.footer-copy {
  color: var(--text-dim);
  font-size: 0.85rem;
}

/* Navigation & Layout System */

/* ==========================================
   Header Navigation & Subpage Styling
   ========================================== */

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

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: color var(--transition-fast);
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary-500);
}

.header-nav-wrapper {
  display: flex;
  align-items: center;
  gap: 2rem;
}

/* Page Layout for Subpages */
.page-header {
  text-align: center;
  max-width: 800px;
  margin: 0 auto 3rem;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.page-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
}

.content-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 3rem 2.5rem;
  backdrop-filter: blur(16px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  margin-bottom: 3rem;
}

.legal-article h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.legal-article h2:first-child {
  margin-top: 0;
}

.legal-article h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: #e2e8f0;
  margin: 1.5rem 0 0.75rem;
}

.legal-article p {
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.legal-article ul,
.legal-article ol {
  color: var(--text-muted);
  font-size: 0.98rem;
  line-height: 1.7;
  margin: 0 0 1.25rem 1.5rem;
}

.legal-article li {
  margin-bottom: 0.5rem;
}

.legal-article a {
  color: var(--primary-500);
  text-decoration: underline;
}

/* Contact Grid & Forms */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
}

.contact-info-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}

.contact-info-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--accent-cyan);
}

.contact-email-box {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 0.68rem 1.2rem;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0.5rem 0 1rem;
  word-break: break-all;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.5rem;
}

.form-input,
.form-textarea,
.form-select {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
  outline: none;
  border-color: var(--primary-500);
  background: rgba(255, 255, 255, 0.07);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

/* Footer Navigation Grid */
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 2.5rem;
  margin-bottom: 2.5rem;
}

.footer-col h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1.25rem;
}

.footer-col ul {
  list-style: none;
}

.footer-col li {
  margin-bottom: 0.65rem;
}

.footer-col a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color var(--transition-fast);
}

.footer-col a:hover {
  color: var(--primary-500);
}

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Use Cases & Formats Tables */
.use-cases-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.use-case-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.75rem;
  transition: all var(--transition-normal);
}

.use-case-card:hover {
  border-color: var(--border-glow);
  transform: translateY(-3px);
}

.use-case-badge {
  display: inline-block;
  background: rgba(99, 102, 241, 0.15);
  color: var(--primary-500);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.75rem;
}

.comparison-table-wrapper {
  overflow-x: auto;
  margin: 2rem 0;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.comparison-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.comparison-table th,
.comparison-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
}

.comparison-table th {
  background: rgba(255, 255, 255, 0.04);
  font-weight: 700;
  color: var(--text-main);
}

.comparison-table td {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.table-highlight {
  color: var(--success-500);
  font-weight: 700;
}

/* FAQ Filters & Category Headers */
.faq-category-header {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text-main);
  margin: 2.5rem 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
}

.faq-search-box {
  width: 100%;
  max-width: 600px;
  margin: 0 auto 2.5rem;
  position: relative;
}

.faq-search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 30px;
  padding: 0.85rem 1.5rem 0.85rem 3rem;
  color: var(--text-main);
  font-size: 1rem;
  font-family: inherit;
  backdrop-filter: blur(12px);
  transition: all var(--transition-normal);
}

.faq-search-input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 20px var(--primary-glow);
}

.faq-search-icon {
  position: absolute;
  left: 1.1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

/* ==========================================
   Image SEO Showcase & Tool Preview Section
   ========================================== */

.preview-image-section {
  margin: 3.5rem auto 2rem;
  max-width: 960px;
  width: 100%;
}

.preview-image-wrapper {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4), 0 0 35px rgba(99, 102, 241, 0.12);
  backdrop-filter: blur(16px);
  overflow: hidden;
  transition: border-color var(--transition-normal);
}

.preview-image-wrapper:hover {
  border-color: var(--border-glow);
}

.preview-tool-img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* ==========================================
   Logo & Enhanced Hero Button Styles
   ========================================== */

.brand-logo-img {
  height: 42px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
}

.brand-seo-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-main);
  margin-left: 0.6rem;
  letter-spacing: -0.01em;
  display: inline-block;
  vertical-align: middle;
}

@media (max-width: 640px) {
  .brand-seo-title {
    display: none;
  }
}

.footer-col .brand-seo-title {
  display: inline-block !important;
  color: var(--text-main);
  font-size: 1.15rem;
  font-weight: 800;
  margin-left: 0.5rem;
  vertical-align: middle;
}

/* ==========================================
   Studio Single-Screen Dashboard (Image-Exact Layout)
   ========================================== */

.studio-workspace {
  margin-top: 0.5rem;
  margin-bottom: 2rem;
}

.studio-single-canvas {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 1080px;
  margin: 0 auto;
}

/* High-Visibility Filmstrip Timeline (52px Height) */
.filmstrip-timeline-wrapper {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.filmstrip-timeline-track {
  position: relative;
  height: 52px;
  background: #090d16;
  border-radius: 8px;
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  overflow: visible;
  display: flex;
  align-items: center;
}

.filmstrip-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  gap: 3px;
  padding: 3px;
  overflow: hidden;
  border-radius: 6px;
  pointer-events: none;
  z-index: 1;
}

.filmstrip-thumb {
  height: 100%;
  object-fit: cover;
  object-position: center;
  flex: 1;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.timeline-range-slider {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 10;
  margin: 0;
}

.timeline-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: transparent !important;
  border-right: 2.5px solid #ffffff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
  pointer-events: none;
  z-index: 5;
}

.playhead-badge {
  position: absolute;
  top: -26px;
  left: 0%;
  transform: translateX(-50%);
  background: #ffffff;
  color: #0f172a;
  font-family: monospace, sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.15rem 0.55rem;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  z-index: 12;
  white-space: nowrap;
}

.playhead-badge::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid #ffffff;
}

.timeline-hover-tooltip {
  position: absolute;
  top: -28px;
  transform: translateX(-50%);
  background: #0f172a;
  border: 1px solid #38bdf8;
  color: #38bdf8;
  font-family: monospace;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  pointer-events: none;
  z-index: 20;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}

.timeline-markers-row {
  display: flex;
  justify-content: space-between;
  padding: 0 0.25rem;
  font-family: monospace, sans-serif;
  font-size: 0.78rem;
  color: #38bdf8;
  font-weight: 600;
}

/* Studio Bottom Horizontal Control Bar (Matching Image) */
.studio-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: #0d1527;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 0.75rem 1.25rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.studio-bar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.studio-bar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.btn-studio-play {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.btn-studio-play:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.04);
}

.bottom-bar-presets {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.35rem 0.5rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  min-width: 0;
  max-width: 100%;
}

.preset-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid transparent;
  color: #94a3b8;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-pill:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.preset-pill.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: #38bdf8;
  color: #38bdf8;
  font-weight: 700;
}

.ratio-readout-pill {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.bottom-bar-pixels {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 0.35rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.pixel-field {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.inline-pixel-input {
  width: 62px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
  border-radius: 6px;
  padding: 0.35rem 0.25rem;
  outline: none;
}

.inline-pixel-input:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}

.px-suffix {
  font-size: 0.82rem;
  color: #94a3b8;
  font-weight: 600;
}

.px-times {
  color: #64748b;
  font-weight: 700;
}

.btn-save-studio {
  background: #ffffff !important;
  color: #0f172a !important;
  font-weight: 800 !important;
  font-size: 1rem !important;
  padding: 0.65rem 2.2rem !important;
  border-radius: 30px !important;
  border: none !important;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.2) !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.btn-save-studio:hover {
  transform: translateY(-2px) scale(1.04) !important;
  box-shadow: 0 10px 25px rgba(255, 255, 255, 0.35) !important;
  background: #f8fafc !important;
}

.btn-hero-lg {
  padding: 1.15rem 2.5rem !important;
  font-size: 1.2rem !important;
  font-weight: 700 !important;
  border-radius: 50px !important;
  letter-spacing: 0.02em;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.5), 0 0 20px rgba(139, 92, 246, 0.3) !important;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.upload-box:hover .btn-hero-lg {
  transform: translateY(-2px) scale(1.03) !important;
  box-shadow: 0 15px 35px rgba(99, 102, 241, 0.65), 0 0 30px rgba(139, 92, 246, 0.4) !important;
}

/* 21:9 Aspect Ratio Icon */
.preset-icon.ratio-21-9 {
  width: 22px;
  height: 9px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  display: inline-block;
}

/* ==========================================
   Studio Video Timeline & Scrubber Bar
   ========================================== */

.timeline-editor-box {
  background: rgba(15, 23, 42, 0.85);
  border-top: 1px solid var(--border-subtle);
  padding: 1rem 1.25rem;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  margin-top: 0.5rem;
}

.timeline-toolbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
  gap: 1rem;
}

.timeline-playback-btns {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-timeline-step {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.btn-timeline-step:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: var(--primary-500);
  color: #fff;
}

.btn-timeline-play {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary-500);
  border: none;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.btn-timeline-play:hover {
  transform: scale(1.08);
  background: var(--primary-600);
}

.time-code-pill {
  font-family: monospace;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary-400);
  background: rgba(99, 102, 241, 0.12);
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  border: 1px solid rgba(99, 102, 241, 0.25);
}

.timeline-scrubber-track {
  position: relative;
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  overflow: hidden;
  cursor: pointer;
}

.timeline-range-slider {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  z-index: 5;
}

.timeline-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: transparent !important;
  border-right: 2.5px solid #ffffff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
  pointer-events: none;
  transition: width 0.05s linear;
  z-index: 5;
}

/* ==========================================
   Direct Pixel Editing Input Controls
   ========================================== */

.pixel-controls-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.25rem;
  backdrop-filter: blur(12px);
}

.pixel-controls-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary-400);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.pixel-inputs-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

@media (max-width: 768px) {
  .pixel-inputs-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.pixel-input-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pixel-input-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pixel-input-box {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 0.55rem 0.75rem;
  font-size: 1rem;
  font-weight: 700;
  font-family: monospace;
  width: 100%;
  transition: all 0.2s ease;
}

.pixel-input-box:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.35);
  background: rgba(15, 23, 42, 1);
}

/* ==========================================
   User Rating Widget Section
   ========================================== */

.user-rating-section {
  margin: 3.5rem auto 2rem;
  max-width: 800px;
  width: 100%;
}

.rating-box-card {
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.9) 100%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2rem;
  text-align: center;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(16px);
}

.rating-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.35rem;
}

.rating-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

.rating-interactive-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.star-rating-buttons {
  display: flex;
  gap: 0.35rem;
}

.star-btn {
  background: none;
  border: none;
  font-size: 2.2rem;
  color: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: transform 0.15s ease, color 0.15s ease;
  line-height: 1;
  padding: 0 0.15rem;
}

.star-btn:hover,
.star-btn.active,
.star-btn.hovered {
  color: #fbbf24;
  transform: scale(1.2);
  text-shadow: 0 0 15px rgba(251, 191, 36, 0.6);
}

.rating-stats-badge {
  font-size: 1.05rem;
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.4rem 1.25rem;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.rating-score-num {
  font-weight: 800;
  color: #fbbf24;
  font-size: 1.15rem;
}

.rating-thanks-banner {
  margin-top: 1rem;
  padding: 0.75rem 1.25rem;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
}

.preview-caption {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

.preview-caption strong {
  color: var(--text-main);
}

/* ==========================================
   Comprehensive Mobile & Tablet Responsiveness System
   ========================================== */

/* Touch Device Target Optimization & Touch-Action */
.crop-box {
  touch-action: none !important;
}

.handle {
  touch-action: none !important;
  width: 18px !important;
  height: 18px !important;
}

.handle::after {
  content: '';
  position: absolute;
  top: -14px;
  left: -14px;
  right: -14px;
  bottom: -14px;
  background: transparent;
  touch-action: none;
}

.handle.nw {
  top: -9px !important;
  left: -9px !important;
}

.handle.n {
  top: -9px !important;
  left: calc(50% - 9px) !important;
}

.handle.ne {
  top: -9px !important;
  right: -9px !important;
}

.handle.e {
  top: calc(50% - 9px) !important;
  right: -9px !important;
}

.handle.se {
  bottom: -9px !important;
  right: -9px !important;
}

.handle.s {
  bottom: -9px !important;
  left: calc(50% - 9px) !important;
}

.handle.sw {
  bottom: -9px !important;
  left: -9px !important;
}

.handle.w {
  top: calc(50% - 9px) !important;
  left: -9px !important;
}

/* ------------------------------------------
   Tablet Breakpoint (max-width: 1024px)
   ------------------------------------------ */
@media (max-width: 1024px) {
  .main-wrapper {
    padding: 2rem 1.25rem 3.5rem;
  }

  .header-container {
    padding: 0.85rem 1.25rem;
  }

  .studio-bottom-bar {
    gap: 0.75rem;
  }
}

/* ------------------------------------------
   Medium Mobile & Tablet (max-width: 900px)
   ------------------------------------------ */
@media (max-width: 900px) {

  /* Prevent horizontal overflow across the entire page */
  html,
  body {
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden !important;
  }

  .main-wrapper {
    width: 100%;
    max-width: 100vw;
    padding: 1.25rem 0.75rem 3rem;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .studio-workspace,
  .studio-single-canvas {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  /* Header Layout */
  .header-container {
    flex-direction: column;
    gap: 0.85rem;
    padding: 0.75rem 0.75rem;
  }

  .header-nav-wrapper {
    width: 100%;
    justify-content: space-between;
    gap: 0.5rem;
  }

  .brand-logo {
    font-size: 1.1rem;
    gap: 0.5rem;
  }

  .brand-logo-img {
    height: 28px;
    width: auto;
  }

  .nav-links {
    display: flex !important;
    gap: 0.5rem;
  }

  .nav-link {
    font-size: 0.82rem;
    padding: 0.2rem 0.35rem;
  }

  .header-badges {
    width: 100%;
    justify-content: center;
    gap: 0.5rem;
  }

  .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.65rem;
  }

  /* Hero & Upload */
  .hero-title {
    font-size: 1.95rem;
    line-height: 1.25;
  }

  .hero-subtitle {
    font-size: 0.95rem;
  }

  .upload-box {
    padding: 2.25rem 1rem;
    border-radius: var(--radius-md);
  }

  .upload-title {
    font-size: 1.15rem;
  }

  .upload-subtitle {
    font-size: 0.85rem;
  }

  .btn-hero-lg {
    padding: 0.9rem 1.8rem !important;
    font-size: 1.05rem !important;
    width: 100%;
  }

  .upload-meta {
    gap: 0.35rem;
  }

  .meta-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
  }

  /* Workspace Studio Layout */
  .file-header-card {
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.75rem 0.85rem;
    width: 100%;
    box-sizing: border-box;
  }

  .file-info-group {
    width: 100%;
    min-width: 0;
  }

  .file-details {
    min-width: 0;
    flex: 1;
  }

  .file-name {
    max-width: 100%;
    font-size: 0.95rem;
  }

  #change-video-btn {
    width: 100%;
    justify-content: center;
  }

  .crop-stage-card {
    border-radius: var(--radius-md);
    width: 100%;
    box-sizing: border-box;
  }

  .video-container {
    width: 100%;
    min-height: 160px;
    max-height: 280px;
    box-sizing: border-box;
  }

  #video-preview {
    max-width: 100%;
    max-height: 280px;
  }

  /* Studio Bottom Horizontal Control Bar Mobile Stack */
  .studio-bottom-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 0.65rem;
    padding: 0.75rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .studio-bar-left {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }

  .bottom-bar-play {
    flex-shrink: 0;
  }

  .bottom-bar-presets {
    flex: 1;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 0.35rem 0.4rem;
  }

  .bottom-bar-presets::-webkit-scrollbar {
    display: none;
  }

  .preset-pill {
    flex-shrink: 0;
    font-size: 0.8rem;
    padding: 0.35rem 0.65rem;
  }

  .ratio-readout-pill {
    flex-shrink: 0;
    font-size: 0.8rem;
    padding: 0.35rem 0.6rem;
  }

  .studio-bar-right {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
  }

  .bottom-bar-pixels {
    flex: 1;
    justify-content: center;
    min-width: 0;
  }

  .bottom-bar-action {
    flex-shrink: 0;
  }

  .btn-save-studio {
    padding: 0.6rem 1.5rem !important;
    font-size: 0.95rem !important;
  }

  /* Filmstrip Timeline Scrubber */
  .filmstrip-timeline-track {
    height: 44px;
    width: 100%;
    box-sizing: border-box;
  }

  .timeline-hover-tooltip {
    font-size: 0.75rem;
  }

  .playhead-badge {
    font-size: 0.75rem;
    padding: 2px 6px;
  }

  /* Download Result Card */
  .download-card {
    padding: 1.75rem 1.25rem;
    width: 100%;
    box-sizing: border-box;
  }

  .output-preview-wrapper video {
    max-height: 45vh;
  }

  .download-actions {
    flex-direction: column;
    gap: 0.75rem;
  }

  .download-actions .btn {
    width: 100%;
  }

  /* Content Cards & Section Grids */
  .features-grid,
  .steps-grid,
  .use-cases-grid,
  .contact-grid,
  .footer-grid,
  .pixel-inputs-grid {
    grid-template-columns: 1fr !important;
    gap: 1.25rem !important;
  }

  .content-card {
    padding: 1.75rem 1.25rem;
  }

  .page-title {
    font-size: 1.85rem;
  }

  .page-subtitle {
    font-size: 0.95rem;
  }

  .preview-tool-img {
    width: 100%;
    height: auto;
  }

  /* Footer */
  .footer-container {
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
  }
}

/* ------------------------------------------
   Small Mobile Devices (max-width: 520px)
   ------------------------------------------ */
@media (max-width: 520px) {
  .main-wrapper {
    padding: 1rem 0.5rem 2rem;
  }

  .brand-seo-title {
    font-size: 0.95rem;
  }

  .nav-links {
    gap: 0.4rem;
  }

  .nav-link {
    font-size: 0.78rem;
  }

  .header-badges {
    flex-wrap: wrap;
  }

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

  .pill-tag {
    font-size: 0.78rem;
    padding: 0.25rem 0.65rem;
  }

  .upload-title {
    font-size: 1.05rem;
  }

  .upload-subtitle {
    font-size: 0.78rem;
  }

  .file-name {
    max-width: 140px;
  }

  .video-container {
    min-height: 140px;
    max-height: 220px;
  }

  #video-preview {
    max-height: 220px;
  }

  .studio-bar-right {
    flex-direction: column;
    align-items: stretch;
    gap: 0.55rem;
  }

  .bottom-bar-pixels {
    width: 100%;
    justify-content: center;
  }

  .bottom-bar-action {
    width: 100%;
  }

  .btn-save-studio {
    width: 100% !important;
    padding: 0.65rem 1.25rem !important;
    font-size: 0.95rem !important;
  }

  .inline-pixel-input {
    width: 54px;
    font-size: 0.82rem;
    padding: 0.3rem 0.2rem;
  }

  .star-btn {
    font-size: 1.75rem;
  }

  .rating-box-card {
    padding: 1.25rem 0.85rem;
  }
}

/* ==========================================
   Performance: Content Visibility Optimization
   Reduces rendering cost for below-fold sections
   ========================================== */

.preview-image-section,
.how-it-works-section,
.user-rating-section {
  content-visibility: auto;
  contain-intrinsic-size: 0 400px;
}

/* ==========================================
   Print Styles
   ========================================== */

@media print {
  .app-header,
  .app-footer,
  .skip-to-content,
  .header-badges,
  #workspace-section,
  #download-section,
  .user-rating-section {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #555;
  }
}

/* ==========================================
   Error Pages Styling (404.html & 500.html)
   ========================================== */
.error-card-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60vh;
  padding: 2rem 1rem;
}

.error-card {
  max-width: 650px;
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 3.5rem 2.5rem;
  text-align: center;
  backdrop-filter: blur(16px);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.error-card::before {
  content: '';
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, var(--primary-glow) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.6;
}

.error-badge {
  font-size: 6rem;
  font-weight: 800;
  line-height: 1;
  background: var(--primary-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1.25rem;
  letter-spacing: -0.04em;
  text-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
}

.error-badge-500 {
  background: linear-gradient(135deg, #ef4444 0%, #f97316 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.error-title {
  font-size: 2.1rem;
  font-weight: 800;
  margin: 0.75rem 0 1rem;
  letter-spacing: -0.02em;
}

.error-description {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 500px;
  margin: 0 auto 2.5rem;
}

.error-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

@media (max-width: 640px) {
  .error-card {
    padding: 2.5rem 1.5rem;
  }

  .error-badge {
    font-size: 4.5rem;
  }

  .error-title {
    font-size: 1.6rem;
  }

  .error-actions {
    flex-direction: column;
  }

  .error-actions .btn {
    width: 100%;
  }
}