/* ===================================================================
   ResizeKit - Core Design System & Stylesheet
   Modern, accessible, responsive CSS with CSS custom properties
   Supports Light & Dark Modes with zero flash of unstyled theme
   =================================================================== */

:root {
  /* Color Palette - Light Theme */
  --bg-primary: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-card-hover: #f8fafc;
  
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-focus: #6366f1;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --accent-primary: #4f46e5;
  --accent-primary-hover: #4338ca;
  --accent-secondary: #06b6d4;
  --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #06b6d4 100%);
  --accent-gradient-text: linear-gradient(135deg, #4338ca 0%, #6d28d9 50%, #0891b2 100%);
  --accent-glow: rgba(79, 70, 229, 0.15);

  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --safe-zone: #10b981;
  --danger-zone: #ef4444;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.09), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --header-height: 4.25rem;
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-primary: #090d16;
  --bg-surface: #111827;
  --bg-surface-elevated: #1e293b;
  --bg-subtle: #172033;
  --bg-card-hover: #1f2d47;

  --border-subtle: #1e293b;
  --border-strong: #334155;
  --border-focus: #818cf8;

  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;
  --text-inverse: #090d16;

  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-secondary: #22d3ee;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #22d3ee 100%);
  --accent-gradient-text: linear-gradient(135deg, #818cf8 0%, #a78bfa 50%, #38bdf8 100%);
  --accent-glow: rgba(99, 102, 241, 0.25);

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
}

/* CSS Reset & Global Standards */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  scroll-behavior: smooth;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

img, svg, video, canvas {
  display: block;
  max-width: 100%;
}

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-primary-hover);
}

/* Accessibility Focus States */
:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--accent-primary);
  color: var(--text-inverse);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  z-index: 99999;
  font-weight: 600;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: 1rem;
}

/* Layout Container */
.container {
  width: 100%;
  max-width: 1240px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

.container-narrow {
  max-width: 860px;
}

.container-wide {
  max-width: 1400px;
}

/* ===================================================================
   HEADER & NAVIGATION
   =================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
  background-color: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color var(--transition-normal), border-color var(--transition-normal);
}

[data-theme="dark"] .site-header {
  background-color: rgba(17, 24, 39, 0.85);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.025em;
  color: var(--text-primary);
}

.logo-icon {
  width: 2.25rem;
  height: 2.25rem;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 2px 8px var(--accent-glow);
}

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

.nav-desktop {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

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

.nav-link {
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-secondary);
  padding: 0.375rem 0.625rem;
  border-radius: var(--radius-md);
  transition: color var(--transition-fast), background-color var(--transition-fast);
}

.nav-link:hover {
  color: var(--text-primary);
  background-color: var(--bg-subtle);
}

.nav-link[aria-current="page"] {
  color: var(--accent-primary);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle-btn {
  width: 2.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  transition: background-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.theme-toggle-btn:hover {
  background-color: var(--bg-surface-elevated);
  color: var(--text-primary);
  transform: scale(1.04);
}

.theme-icon-sun {
  display: none;
}
.theme-icon-moon {
  display: block;
}

[data-theme="dark"] .theme-icon-sun {
  display: block;
}
[data-theme="dark"] .theme-icon-moon {
  display: none;
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  width: 2.5rem;
  height: 2.5rem;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
}

/* Mobile Drawer */
.mobile-drawer {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 999;
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
  transition: transform var(--transition-normal), opacity var(--transition-normal);
  overflow-y: auto;
}

.mobile-drawer.is-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.mobile-nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mobile-nav-links .nav-link {
  display: flex;
  align-items: center;
  padding: 0.875rem 1rem;
  font-size: 1.0625rem;
  border-radius: var(--radius-md);
}

/* ===================================================================
   HERO SECTION & ANIMATIONS
   =================================================================== */
.hero-section {
  position: relative;
  padding: 3.5rem 0 2.5rem;
  text-align: center;
  overflow: hidden;
}

.hero-bg-orbs {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 1200px;
  height: 100%;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  animation: orbFloat 14s ease-in-out infinite alternate;
}

[data-theme="dark"] .orb {
  opacity: 0.28;
}

.orb-1 {
  width: 420px;
  height: 420px;
  background: #6366f1;
  top: -60px;
  left: 10%;
}

.orb-2 {
  width: 380px;
  height: 380px;
  background: #06b6d4;
  top: 20px;
  right: 15%;
  animation-delay: -6s;
}

.orb-3 {
  width: 320px;
  height: 320px;
  background: #ec4899;
  bottom: 0;
  left: 40%;
  animation-delay: -10s;
}

@keyframes orbFloat {
  0% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-30px) scale(1.08); }
  100% { transform: translateY(20px) scale(0.95); }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.375rem 0.875rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent-primary);
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}

.hero-badge svg {
  color: var(--success);
}

.hero-title {
  font-size: clamp(2.1rem, 5vw, 3.75rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

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

.hero-subtitle {
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 2rem;
}

.hero-features-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.75rem;
  margin-bottom: 2rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.hero-feature-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface);
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.hero-feature-item svg {
  color: var(--success);
}

/* ===================================================================
   INTERACTIVE RESIZER TOOL
   =================================================================== */
.tool-wrapper {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: 1.5rem;
  margin-bottom: 3.5rem;
  transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

@media (min-width: 768px) {
  .tool-wrapper {
    padding: 2rem;
  }
}

/* Upload Dropzone */
.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 3rem 1.5rem;
  text-align: center;
  background-color: var(--bg-subtle);
  cursor: pointer;
  transition: border-color var(--transition-fast), background-color var(--transition-fast), transform var(--transition-fast);
  position: relative;
}

.dropzone:hover, .dropzone.drag-active {
  border-color: var(--accent-primary);
  background-color: var(--accent-glow);
  transform: translateY(-2px);
}

.dropzone-icon-circle {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-primary);
  box-shadow: var(--shadow-md);
}

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

.dropzone-subtext {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.dropzone-browse-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-gradient);
  color: white;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 0.9375rem;
  box-shadow: 0 4px 14px var(--accent-glow);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.dropzone-browse-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.dropzone-file-input {
  display: none;
}

.dropzone-formats {
  margin-top: 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Tool Main Workspace */
.tool-workspace {
  display: none;
  grid-template-columns: 1fr;
  gap: 1.75rem;
}

@media (min-width: 1024px) {
  .tool-workspace {
    grid-template-columns: 360px 1fr;
  }
}

.tool-workspace.is-active {
  display: grid;
}

/* Controls Panel (Left / Sidebar) */
.tool-sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.tool-card {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.tool-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.875rem;
}

.tool-card-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Platform Filter Tabs */
.platform-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 0.875rem;
}

.platform-tab-btn {
  padding: 0.35rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-fast);
}

.platform-tab-btn:hover {
  color: var(--text-primary);
  background-color: var(--bg-surface);
}

.platform-tab-btn.is-active {
  background-color: var(--accent-primary);
  color: white;
  border-color: var(--accent-primary);
}

/* Preset Select Dropdown & Grid */
.preset-select {
  width: 100%;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-weight: 500;
  font-size: 0.9375rem;
  margin-bottom: 0.75rem;
}

.preset-info-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

/* Custom Dimensions inputs */
.custom-dimensions-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.input-with-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.input-with-label label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.dimension-input {
  width: 100%;
  padding: 0.5rem 0.625rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-weight: 600;
}

.aspect-lock-btn {
  margin-top: 1.15rem;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.aspect-lock-btn.is-locked {
  background: var(--accent-glow);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* Fit Modes Buttons */
.fit-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.fit-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  padding: 0.625rem 0.375rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

.fit-mode-btn:hover {
  background-color: var(--bg-surface);
  color: var(--text-primary);
}

.fit-mode-btn.is-active {
  background-color: var(--accent-glow);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* Background Color / Fill Options */
.bg-fill-options {
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.color-picker-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.color-input {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  cursor: pointer;
  background: none;
  padding: 0;
}

.color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}
.color-input::-webkit-color-swatch {
  border: none;
  border-radius: var(--radius-md);
}

.gradient-preset-btn {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition-fast);
}

.gradient-preset-btn:hover {
  transform: scale(1.15);
}

/* Crop & Position Controls */
.slider-control-group {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  margin-bottom: 0.75rem;
}

.slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.range-slider {
  width: 100%;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.transform-buttons-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.tool-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.tool-icon-btn:hover {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
}

/* Safe Zone Card */
.safe-zone-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.switch-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
}

.switch-input {
  position: relative;
  width: 2.75rem;
  height: 1.5rem;
  appearance: none;
  background-color: var(--border-strong);
  border-radius: var(--radius-full);
  transition: background-color var(--transition-fast);
  cursor: pointer;
}

.switch-input:checked {
  background-color: var(--accent-primary);
}

.switch-input::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 1.25rem;
  height: 1.25rem;
  background-color: white;
  border-radius: 50%;
  transition: transform var(--transition-fast);
}

.switch-input:checked::before {
  transform: translateX(1.25rem);
}

.safe-zone-legend {
  margin-top: 0.75rem;
  padding: 0.625rem;
  background-color: var(--bg-subtle);
  border-radius: var(--radius-md);
  font-size: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.legend-color {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 2px;
}

.legend-color.danger {
  background-color: rgba(239, 68, 68, 0.7);
}

.legend-color.safe {
  background-color: rgba(16, 185, 129, 0.5);
}

/* Canvas Viewport (Right Area) */
.tool-viewport-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.viewport-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.viewport-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.viewport-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Canvas Stage */
.canvas-stage-wrapper {
  position: relative;
  width: 100%;
  min-height: 440px;
  max-height: 640px;
  background-color: #0b0f19;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  background-image: 
    linear-gradient(45deg, #151b28 25%, transparent 25%), 
    linear-gradient(-45deg, #151b28 25%, transparent 25%), 
    linear-gradient(45deg, transparent 75%, #151b28 75%), 
    linear-gradient(-45deg, transparent 75%, #151b28 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
  user-select: none;
}

.canvas-interactive {
  max-width: 94%;
  max-height: 90%;
  object-fit: contain;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
  cursor: grab;
  border-radius: 4px;
}

.canvas-interactive:active {
  cursor: grabbing;
}

/* Phone Mockup Frame Mode */
.phone-mockup-frame {
  display: none;
  width: 290px;
  height: 580px;
  border: 10px solid #1e293b;
  border-radius: 40px;
  background: #000;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
  margin: 0 auto;
}

.phone-mockup-notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 22px;
  background: #1e293b;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  z-index: 10;
}

.phone-mockup-screen {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Export Panel */
.export-panel {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem;
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.export-options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .export-options-grid {
    grid-template-columns: 180px 1fr auto;
    align-items: center;
  }
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--accent-gradient);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 0.9375rem;
  box-shadow: 0 4px 12px var(--accent-glow);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--accent-glow);
  color: white;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background-color: var(--bg-subtle);
  color: var(--text-primary);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9375rem;
  border: 1px solid var(--border-subtle);
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
}

.btn-secondary:hover {
  background-color: var(--bg-surface);
  border-color: var(--border-strong);
}

/* Batch Export Modal & Checkboxes */
.batch-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1.25rem;
}

.batch-modal.is-open {
  display: flex;
}

.batch-modal-box {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
}

.batch-modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.batch-modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.preset-checklist {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

@media (min-width: 480px) {
  .preset-checklist {
    grid-template-columns: 1fr 1fr;
  }
}

.checkbox-card {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.625rem 0.875rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: background-color var(--transition-fast);
}

.checkbox-card:hover {
  background-color: var(--bg-surface-elevated);
}

.checkbox-card input[type="checkbox"] {
  accent-color: var(--accent-primary);
  width: 1.125rem;
  height: 1.125rem;
}

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

/* ===================================================================
   GOOGLE ADSENSE CONTAINERS (Policy Compliant)
   =================================================================== */
.ad-slot-container {
  margin: 2.5rem auto;
  text-align: center;
  width: 100%;
  max-width: 970px;
  clear: both;
}

.ad-label {
  display: block;
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.375rem;
  font-weight: 600;
}

.ad-slot-box {
  min-height: 100px;
  background-color: var(--bg-subtle);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 0.5rem;
}

.ad-slot-box.leaderboard {
  min-height: 90px;
}

.ad-slot-box.rectangle {
  min-height: 250px;
  max-width: 336px;
  margin: 0 auto;
}

/* ===================================================================
   LONG-FORM CONTENT, SEO SECTIONS & GUIDES
   =================================================================== */
.content-section {
  padding: 4rem 0;
  border-top: 1px solid var(--border-subtle);
}

.section-header {
  text-align: center;
  max-width: 760px;
  margin: 0 auto 3rem;
}

.section-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-primary);
  margin-bottom: 0.5rem;
}

.section-title {
  font-size: clamp(1.75rem, 3.5vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 0.875rem;
  color: var(--text-primary);
}

.section-desc {
  font-size: 1.0625rem;
  color: var(--text-secondary);
}

/* Grid Cards (Features / Use Cases) */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.feature-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.feature-card-icon {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-md);
  background: var(--accent-glow);
  color: var(--accent-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.feature-card h3 {
  font-size: 1.1875rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.feature-card p {
  font-size: 0.9375rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Platform Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background-color: var(--bg-surface);
  box-shadow: var(--shadow-sm);
  margin: 2rem 0;
}

.platform-size-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.875rem;
}

.platform-size-table th {
  background-color: var(--bg-subtle);
  padding: 1rem 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.platform-size-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.platform-size-table tr:last-child td {
  border-bottom: none;
}

.platform-size-table tr:hover td {
  background-color: var(--bg-subtle);
}

.tag-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

/* FAQ Accordion */
.faq-list {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.faq-item {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.faq-item:hover {
  border-color: var(--border-strong);
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
  text-align: left;
  gap: 1rem;
}

.faq-icon {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
  color: var(--accent-primary);
}

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

.faq-answer {
  display: none;
  padding: 0 1.5rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  line-height: 1.7;
}

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

/* ===================================================================
   ARTICLE & GUIDE TEMPLATE
   =================================================================== */
.article-header {
  padding: 3rem 0 2rem;
  text-align: center;
  max-width: 840px;
  margin: 0 auto;
}

.article-breadcrumbs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.article-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.article-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.article-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.article-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  padding-bottom: 4rem;
}

@media (min-width: 1024px) {
  .article-layout {
    grid-template-columns: 240px 1fr;
  }
}

.article-toc {
  display: none;
}

@media (min-width: 1024px) {
  .article-toc {
    display: block;
    position: sticky;
    top: 5.5rem;
    height: fit-content;
    padding: 1.25rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
  }
}

.toc-title {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin-bottom: 0.875rem;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.8125rem;
}

.toc-list a {
  color: var(--text-secondary);
}

.toc-list a:hover {
  color: var(--accent-primary);
}

.article-body {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.article-body h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  margin: 2.5rem 0 1rem;
  letter-spacing: -0.02em;
}

.article-body h3 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 1.75rem 0 0.75rem;
}

.article-body p {
  margin-bottom: 1.25rem;
}

.article-body ul, .article-body ol {
  margin: 1.25rem 0;
  padding-left: 1.5rem;
}

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

.callout-box {
  background-color: var(--bg-subtle);
  border-left: 4px solid var(--accent-primary);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  padding: 1.25rem 1.5rem;
  margin: 1.75rem 0;
}

.callout-box.tip {
  border-left-color: var(--success);
}

.callout-box.warning {
  border-left-color: var(--warning);
}

.author-box {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-top: 3rem;
}

.author-avatar {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: var(--accent-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  flex-shrink: 0;
}

/* Related Guides */
.related-guides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.guide-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.guide-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.guide-card-tag {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent-primary);
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}

.guide-card h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.guide-card p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

/* ===================================================================
   FOOTER
   =================================================================== */
.site-footer {
  margin-top: auto;
  background-color: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  padding: 4rem 0 2rem;
  transition: background-color var(--transition-normal);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  margin-bottom: 3rem;
}

@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .footer-grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

.footer-brand p {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin: 1rem 0 1.25rem;
  max-width: 340px;
}

.privacy-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0.35rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--success);
}

.footer-column-title {
  font-size: 0.875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.footer-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.footer-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.footer-links a:hover {
  color: var(--accent-primary);
}

.footer-bottom {
  border-top: 1px solid var(--border-subtle);
  padding-top: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  text-align: center;
}

@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
    text-align: left;
  }
}

/* ===================================================================
   COOKIE CONSENT BANNER
   =================================================================== */
.cookie-banner {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  right: 1.25rem;
  max-width: 480px;
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-xl);
  z-index: 9999;
  display: none;
  flex-direction: column;
  gap: 0.875rem;
  animation: slideUp 0.3s ease-out;
}

.cookie-banner.is-visible {
  display: flex;
}

@keyframes slideUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.cookie-banner-text {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.cookie-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-cookie-accept {
  padding: 0.45rem 1rem;
  font-size: 0.8125rem;
  font-weight: 600;
  background-color: var(--accent-primary);
  color: white;
  border-radius: var(--radius-md);
}

.btn-cookie-reject {
  padding: 0.45rem 0.875rem;
  font-size: 0.8125rem;
  font-weight: 600;
  background-color: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 10000;
  pointer-events: none;
}

.toast {
  background-color: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  animation: toastIn 0.25s ease-out;
  pointer-events: auto;
}

@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
