/* ==========================================================
   GifWidgets – Styles
   Dark creative-tool theme with multi-color category system
   ========================================================== */

/* ── Variables ────────────────────────────── */
/* Light theme (default) */
:root {
  --bg-base: #f8fafc;
  --bg-primary: #ffffff;
  --bg-secondary: #f1f5f9;
  --bg-tertiary: #e2e8f0;
  --bg-elevated: #dde4ed;
  --border: #e2e8f0;
  --border-light: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-dim: rgba(99, 102, 241, 0.10);
  --cyan: #22d3ee;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --success: #10b981;
  --warning: #f59e0b;
  /* Category colors */
  --cat-gif: #10b981;
  --cat-gif-dim: rgba(16, 185, 129, 0.10);
  --cat-image: #0ea5e9;
  --cat-image-dim: rgba(14, 165, 233, 0.10);
  --cat-video: #8b5cf6;
  --cat-video-dim: rgba(139, 92, 246, 0.10);
  --cat-photo-conv: #f59e0b;
  --cat-photo-conv-dim: rgba(245, 158, 11, 0.10);
  --cat-video-conv: #f43f5e;
  --cat-video-conv-dim: rgba(244, 63, 94, 0.10);
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.14);
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

/* Dark theme override */
[data-theme="dark"] {
  --bg-base: #0c0c14;
  --bg-primary: #12121e;
  --bg-secondary: #1a1a2e;
  --bg-tertiary: #252540;
  --bg-elevated: #2d2d4a;
  --border: #3a3a5c;
  --border-light: #4a4a6a;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-hover: #818cf8;
  --accent-dim: rgba(99, 102, 241, 0.15);
  --danger-hover: #f87171;
  --cat-gif-dim: rgba(16, 185, 129, 0.15);
  --cat-image-dim: rgba(14, 165, 233, 0.15);
  --cat-video-dim: rgba(139, 92, 246, 0.15);
  --cat-photo-conv-dim: rgba(245, 158, 11, 0.15);
  --cat-video-conv-dim: rgba(244, 63, 94, 0.15);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,.5);
}

/* ── Reset & Base ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-sans);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Buttons ──────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: background .15s, color .15s, box-shadow .15s;
  text-decoration: none; line-height: 1.4;
}
.btn svg { flex-shrink: 0; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-accent { background: var(--accent-dim); color: var(--accent-hover); border: 1px solid var(--accent); }
.btn-accent:hover { background: var(--accent); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-full { width: 100%; justify-content: center; }
.btn-small { padding: 5px 12px; font-size: 13px; }
.btn-xs { padding: 3px 10px; font-size: 12px; }

/* ── Forms ────────────────────────────────── */
label { display: block; margin-bottom: 4px; font-size: 13px; font-weight: 600; color: var(--text-secondary); }
textarea, select, input[type="text"] {
  width: 100%; padding: 8px 10px;
  background: var(--bg-primary); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 16px; font-family: inherit; resize: vertical;
}
textarea:focus, select:focus, input[type="text"]:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim);
}
select { cursor: pointer; }
input[type="color"] {
  width: 40px; height: 32px; padding: 2px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-primary); cursor: pointer;
}
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 3px;
  background: var(--bg-tertiary); outline: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 2px solid var(--bg-secondary);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 2px solid var(--bg-secondary);
}
.form-group { margin-bottom: 12px; }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.btn-group { display: flex; gap: 0; }
.btn-group .align-btn {
  flex: 1; padding: 6px 0; font-size: 12px; font-weight: 600;
  background: var(--bg-primary); color: var(--text-secondary);
  border: 1px solid var(--border); cursor: pointer; transition: all .15s;
}
.btn-group .align-btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.btn-group .align-btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .align-btn:not(:first-child) { border-left: none; }
.btn-group .align-btn.active,
.btn-group .align-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ── Site Navigation ──────────────────────── */
.site-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 60px;
  background: var(--bg-secondary); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.site-logo {
  font-size: 20px; font-weight: 800; color: var(--text-primary);
  text-decoration: none; letter-spacing: -.5px; flex-shrink: 0;
}
.site-logo:hover { text-decoration: none; color: var(--text-primary); }
.site-logo .logo-accent { color: var(--accent); }
.site-nav-links {
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
}
.site-nav-actions {
  display: flex; align-items: center; gap: 8px; margin-left: auto;
}
.site-nav-links a {
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  padding: 6px 10px; border-radius: var(--radius-sm);
  text-decoration: none; transition: color .15s, background .15s;
  white-space: nowrap;
}
.site-nav-links a:hover { color: var(--text-primary); background: var(--bg-tertiary); }
.site-nav-links a.active { color: var(--accent); }
.site-nav-toggle {
  display: none; align-items: center; justify-content: center; flex-direction: column;
  gap: 4px; width: 38px; height: 38px;
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); cursor: pointer; transition: color .15s, background .15s, border-color .15s;
}
.site-nav-toggle:hover { background: var(--bg-tertiary); color: var(--text-primary); border-color: var(--border-light); }
.site-nav-toggle-bar {
  display: block; width: 16px; height: 2px; border-radius: 999px;
  background: currentColor; transition: transform .15s ease, opacity .15s ease;
}
.site-nav-toggle.is-open .site-nav-toggle-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.site-nav-toggle.is-open .site-nav-toggle-bar:nth-child(2) { opacity: 0; }
.site-nav-toggle.is-open .site-nav-toggle-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* Report Issue button (nav + editor header) */
.report-issue-nav-btn {
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--text-secondary); font-size: 13px; font-weight: 500;
  padding: 6px 10px; border-radius: var(--radius-sm);
  border: none; background: none; cursor: pointer;
  transition: color .15s, background .15s; white-space: nowrap;
}
.report-issue-nav-btn:hover { color: var(--text-primary); background: var(--bg-tertiary); }
@media (max-width: 768px) {
  .site-nav-links .report-issue-nav-btn {
    width: 100%; font-size: 14px; padding: 10px 12px;
  }
}

/* Theme toggle button */
.theme-toggle {
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); cursor: pointer; padding: 6px 8px;
  display: flex; align-items: center; flex-shrink: 0;
  transition: color .15s, background .15s, border-color .15s;
  margin-left: 8px;
}
.theme-toggle:hover { background: var(--bg-tertiary); color: var(--text-primary); border-color: var(--border-light); }
.theme-icon { display: block; }
.icon-sun { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
[data-theme="dark"] .icon-moon { display: none; }

/* Site footer */
.site-footer {
  background: var(--bg-secondary); border-top: 1px solid var(--border);
  padding: 2rem 24px; margin-top: auto;
}
.site-footer-inner {
  max-width: 960px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem;
}
.site-footer p { font-size: 13px; color: var(--text-muted); }
.site-footer-links { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer-links a { font-size: 13px; color: var(--text-muted); }
.site-footer-links a:hover { color: var(--text-secondary); }

/* ── Home Page ────────────────────────────── */
.home-page { min-height: 100vh; display: flex; flex-direction: column; }

.home-hero {
  text-align: center; padding: 5rem 2rem 4rem;
  background: radial-gradient(ellipse at 50% 0%, rgba(99,102,241,.12) 0%, transparent 70%);
  border-bottom: 1px solid var(--border);
}
.home-hero-logo {
  font-size: clamp(2.8rem, 6vw, 4.5rem); font-weight: 900; letter-spacing: -2px;
  line-height: 1; margin-bottom: 1rem;
}
.home-hero-logo .logo-accent { color: var(--accent); }
.home-hero-tagline {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem); color: var(--text-secondary);
  max-width: 560px; margin: 0 auto .75rem; line-height: 1.5;
}
.home-hero-sub {
  font-size: .9rem; color: var(--text-muted);
}
.home-hero-badges {
  display: flex; justify-content: center; gap: .5rem; margin-top: 1.25rem; flex-wrap: wrap;
}
.home-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; border-radius: 999px;
  font-size: .75rem; font-weight: 600;
  background: var(--bg-tertiary); color: var(--text-muted); border: 1px solid var(--border);
}

/* Home tool sections */
.home-tools { max-width: 1060px; margin: 0 auto; padding: 3rem 24px 4rem; flex: 1; }

.home-section { margin-bottom: 3.5rem; }
.home-section-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 1.25rem;
}
.home-section-title {
  font-size: 1rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-secondary);
}
.cat-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}

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

.tool-card {
  display: flex; flex-direction: column;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
  text-decoration: none; color: inherit;
  transition: border-color .2s, background .2s, transform .15s, box-shadow .2s;
  position: relative; overflow: hidden;
}
.tool-card::before {
  content: ''; position: absolute; inset: 0;
  opacity: 0; transition: opacity .2s;
}
.tool-card:hover {
  border-color: var(--card-color, var(--accent));
  background: var(--bg-tertiary);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  text-decoration: none;
}
.tool-card-icon {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem; background: var(--card-color-dim, var(--accent-dim));
  color: var(--card-color, var(--accent));
}
.tool-card-icon svg { flex-shrink: 0; }
.tool-card-title {
  font-size: 1rem; font-weight: 700; color: var(--text-primary); margin-bottom: .4rem;
}
.tool-card-desc {
  font-size: .85rem; color: var(--text-secondary); line-height: 1.5; flex: 1;
}
.tool-card-arrow {
  margin-top: 1.25rem; font-size: .8rem; font-weight: 600;
  color: var(--card-color, var(--accent));
  display: flex; align-items: center; gap: 4px;
}
.tool-card-badge {
  position: absolute; top: 12px; right: 12px;
  font-size: .65rem; font-weight: 700; padding: 2px 7px;
  border-radius: 999px; text-transform: uppercase; letter-spacing: .05em;
  background: var(--card-color-dim, var(--accent-dim));
  color: var(--card-color, var(--accent));
  border: 1px solid var(--card-color, var(--accent));
  opacity: .7;
}

/* Category color overrides for tool cards */
.tool-card.gif    { --card-color: var(--cat-gif); --card-color-dim: var(--cat-gif-dim); }
.tool-card.image  { --card-color: var(--cat-image); --card-color-dim: var(--cat-image-dim); }
.tool-card.video  { --card-color: var(--cat-video); --card-color-dim: var(--cat-video-dim); }
.tool-card.photo-conv { --card-color: var(--cat-photo-conv); --card-color-dim: var(--cat-photo-conv-dim); }
.tool-card.video-conv { --card-color: var(--cat-video-conv); --card-color-dim: var(--cat-video-conv-dim); }

/* ── Tool Landing Pages ────────────────────── */
.tool-page { min-height: 100vh; display: flex; flex-direction: column; }

.tool-hero {
  padding: 3.5rem 2rem 3rem; text-align: center;
  border-bottom: 1px solid var(--border);
  background: radial-gradient(ellipse at 50% 0%, var(--hero-glow, rgba(99,102,241,.1)) 0%, transparent 70%);
}
.tool-hero-icon {
  width: 64px; height: 64px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 1.25rem;
  background: var(--hero-icon-bg, var(--accent-dim));
  color: var(--hero-color, var(--accent));
}
.tool-hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -.5px;
  margin-bottom: .75rem;
}
.tool-hero-tagline {
  font-size: 1.05rem; color: var(--text-secondary); max-width: 520px; margin: 0 auto 1.75rem;
  line-height: 1.6;
}
.tool-hero-cta {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 28px; border-radius: var(--radius-md);
  font-size: 15px; font-weight: 700; text-decoration: none;
  background: var(--hero-color, var(--accent)); color: #fff;
  transition: opacity .15s, transform .15s;
}
.tool-hero-cta:hover { opacity: .9; transform: translateY(-1px); text-decoration: none; color: #fff; }

.tool-content { max-width: 760px; margin: 0 auto; padding: 3rem 24px; flex: 1; }

.tool-features {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1rem;
  margin-bottom: 3rem;
}
.tool-feature {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1.1rem 1.25rem;
}
.tool-feature h3 {
  font-size: .85rem; font-weight: 700; margin-bottom: .3rem;
  color: var(--hero-color, var(--accent));
}
.tool-feature p { font-size: .8rem; color: var(--text-muted); line-height: 1.5; }

.tool-section { margin-bottom: 3rem; }
.tool-section h2 { font-size: 1.35rem; font-weight: 700; margin-bottom: 1.25rem; }
.tool-steps { list-style: none; display: flex; flex-direction: column; gap: 1rem; }
.tool-step {
  display: flex; align-items: flex-start; gap: 1rem;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1rem 1.25rem;
}
.tool-step-num {
  flex-shrink: 0; width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--hero-color, var(--accent)); color: #fff;
  font-weight: 700; font-size: .85rem; border-radius: 50%;
}
.tool-step-body h3 { font-size: .9rem; margin-bottom: .25rem; }
.tool-step-body p { font-size: .8rem; color: var(--text-muted); line-height: 1.5; }

.tool-faq { display: flex; flex-direction: column; gap: .75rem; }
.tool-faq-item {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1rem 1.25rem;
}
.tool-faq-item dt { font-size: .9rem; font-weight: 600; margin-bottom: .4rem; }
.tool-faq-item dd { font-size: .85rem; color: var(--text-secondary); line-height: 1.6; margin: 0; }

.related-tools { display: flex; flex-wrap: wrap; gap: .75rem; }
.related-tool-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-md);
  font-size: .85rem; font-weight: 600; text-decoration: none;
  background: var(--bg-secondary); border: 1px solid var(--border);
  color: var(--text-secondary); transition: border-color .15s, color .15s, background .15s;
}
.related-tool-link:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); text-decoration: none; }

/* ── Converter Tool UI ────────────────────── */
.converter-app { min-height: 100vh; display: flex; flex-direction: column; }

.converter-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; height: 52px;
  background: var(--bg-secondary); border-bottom: 1px solid var(--border);
}
.converter-title {
  font-size: 15px; font-weight: 700; color: var(--text-primary);
}

.converter-main {
  max-width: 640px; margin: 0 auto; padding: 2.5rem 24px; flex: 1; width: 100%;
}

.conv-drop-zone {
  width: 100%; border: 2px dashed var(--border);
  border-radius: var(--radius-lg); padding: 3rem 2rem; text-align: center;
  cursor: pointer; transition: border-color .2s, background .2s; margin-bottom: 1.5rem;
  background: var(--bg-secondary);
}
.conv-drop-zone:hover, .conv-drop-zone.dragover {
  border-color: var(--conv-color, var(--accent)); background: var(--conv-color-dim, var(--accent-dim));
}
.conv-drop-zone svg { color: var(--text-muted); margin-bottom: .75rem; }
.conv-drop-zone h2 { font-size: 1.1rem; margin-bottom: .4rem; }
.conv-drop-zone p { font-size: .9rem; color: var(--text-secondary); }
.conv-drop-zone .conv-hint { font-size: .8rem; color: var(--text-muted); margin-top: .4rem; }

.conv-controls { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }

.conv-file-info {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 10px 14px;
}
.conv-file-name { flex: 1; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-file-size { font-size: 12px; color: var(--text-muted); }
.conv-file-clear { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 18px; line-height: 1; padding: 2px 4px; }
.conv-file-clear:hover { color: var(--danger); }

.conv-options { display: flex; flex-direction: column; gap: .75rem; }
.conv-option-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.conv-option-row label { margin: 0; font-size: 13px; color: var(--text-secondary); }
.conv-option-row select {
  width: auto; padding: 5px 8px; font-size: 13px;
  background: var(--bg-tertiary); border-color: var(--border); border-radius: var(--radius-sm);
}
.conv-option-row input[type="range"] { width: 140px; }

.conv-convert-btn {
  width: 100%; padding: 14px; border: none; border-radius: var(--radius-md);
  font-size: 15px; font-weight: 700; cursor: pointer;
  background: var(--conv-color, var(--accent)); color: #fff;
  transition: opacity .15s; margin-bottom: 1rem;
}
.conv-convert-btn:hover { opacity: .9; }
.conv-convert-btn:disabled { opacity: .4; cursor: not-allowed; }

.conv-progress {
  display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem;
}
.conv-progress-label { font-size: 13px; color: var(--text-secondary); text-align: center; }
.conv-progress-bar {
  height: 6px; background: var(--bg-tertiary); border-radius: 3px; overflow: hidden;
}
.conv-progress-fill {
  height: 100%; background: var(--conv-color, var(--accent));
  border-radius: 3px; transition: width .2s; width: 0%;
}

.conv-result {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1.25rem; text-align: center;
  margin-bottom: 1.5rem;
}
.conv-result-preview { max-width: 100%; max-height: 240px; border-radius: var(--radius-sm); margin-bottom: 1rem; }
.conv-result-info { font-size: 13px; color: var(--text-muted); margin-bottom: 1rem; }
.conv-download-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 24px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 700; text-decoration: none;
  background: var(--success); color: #fff; cursor: pointer; border: none;
  transition: opacity .15s;
}
.conv-download-btn:hover { opacity: .9; text-decoration: none; color: #fff; }

/* ── Image Editor ─────────────────────────── */
.image-editor-app {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh; overflow: hidden;
}
.image-editor-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: 48px; min-height: 48px;
  background: var(--bg-secondary); border-bottom: 1px solid var(--border);
}
.image-editor-workspace {
  display: flex; flex: 1; overflow: hidden;
}
.image-editor-canvas-area {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background:
    linear-gradient(45deg, #151520 25%, transparent 25%),
    linear-gradient(-45deg, #151520 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #151520 75%),
    linear-gradient(-45deg, transparent 75%, #151520 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-color: #0e0e1a;
  overflow: hidden; padding: 16px;
}
.image-editor-canvas-area canvas {
  max-width: 100%; max-height: 100%; display: block;
  box-shadow: var(--shadow-lg); border-radius: 2px;
}
.image-editor-sidebar {
  width: 280px; min-width: 280px;
  display: flex; flex-direction: column;
  background: var(--bg-secondary); border-left: 1px solid var(--border);
  overflow-y: auto;
}
.image-editor-upload-zone {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem;
}

/* ── Video Editor ─────────────────────────── */
.video-editor-app {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh; overflow: hidden;
}
.video-editor-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: 48px; min-height: 48px;
  background: var(--bg-secondary); border-bottom: 1px solid var(--border);
}
.video-editor-workspace {
  display: flex; flex-direction: column; flex: 1; overflow: hidden;
}
.video-preview-area {
  flex: 1; display: flex; align-items: center; justify-content: center;
  background: #000; overflow: hidden; position: relative; min-height: 0;
}
.video-preview-area video {
  max-width: 100%; max-height: 100%; display: block;
}
.video-controls-panel {
  background: var(--bg-secondary); border-top: 1px solid var(--border);
  padding: 1.25rem 1.5rem; display: flex; flex-direction: column; gap: 1rem;
  flex-shrink: 0;
}
.video-trim-bar {
  display: flex; flex-direction: column; gap: .5rem;
}
.video-trim-label {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-muted);
}
.video-trim-track {
  position: relative; height: 32px;
  background: var(--bg-tertiary); border-radius: 4px; overflow: visible;
}
.video-trim-range { /* styled range input spanning the track */ }
.video-actions { display: flex; gap: .75rem; flex-wrap: wrap; }
.video-info { font-size: 12px; color: var(--text-muted); }

/* ── Legacy Landing Page (kept for compatibility) ─── */
.landing {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2rem;
}
.landing-header { text-align: center; margin-bottom: 2.5rem; }
.landing-header h1 { font-size: 3rem; font-weight: 800; letter-spacing: -1px; }
.landing-header .tagline { font-size: 1.15rem; color: var(--text-secondary); margin-top: .5rem; }
.landing-header .sub { font-size: .9rem; color: var(--text-muted); margin-top: .4rem; }

.landing-upload {
  width: 100%; max-width: 520px;
  background: var(--bg-secondary); border: 2px dashed var(--border);
  border-radius: var(--radius-lg); padding: 3rem 2rem; text-align: center;
  cursor: pointer; transition: border-color .2s, background .2s;
}
.landing-upload:hover, .landing-upload.dragover {
  border-color: var(--accent); background: var(--accent-dim);
}
.landing-upload svg { color: var(--text-muted); margin-bottom: 1rem; }
.landing-upload h2 { font-size: 1.3rem; margin-bottom: .5rem; }
.landing-upload p { color: var(--text-secondary); font-size: .95rem; }

.landing-features {
  max-width: 520px; width: 100%; margin-top: 2.5rem;
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem;
}
.feature-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1rem 1.2rem;
}
.feature-card h3 { font-size: .85rem; color: var(--accent-hover); margin-bottom: .3rem; }
.feature-card p { font-size: .8rem; color: var(--text-muted); line-height: 1.4; }

.landing-footer {
  margin-top: 2.5rem; font-size: .8rem; color: var(--text-muted); text-align: center;
}
.landing-footer kbd {
  display: inline-block; padding: 1px 6px; background: var(--bg-tertiary);
  border: 1px solid var(--border); border-radius: 3px; font-size: .75rem;
}
.footer-byline { margin-top: .5rem; }

/* Landing – About section */
.landing-about {
  max-width: 600px; width: 100%; margin-top: 3rem; text-align: center;
}
.landing-about h2 { font-size: 1.4rem; font-weight: 700; margin-bottom: 1rem; }
.landing-about p { font-size: .95rem; color: var(--text-secondary); line-height: 1.7; margin-bottom: .75rem; }
.landing-about strong { color: var(--text-primary); }

/* Landing – How it works */
.landing-steps { max-width: 600px; width: 100%; margin-top: 3rem; }
.landing-steps h2 { font-size: 1.4rem; font-weight: 700; text-align: center; margin-bottom: 1.5rem; }
.steps-list { list-style: none; display: flex; flex-direction: column; gap: 1.25rem; }
.step-item {
  display: flex; align-items: flex-start; gap: 1rem;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1rem 1.25rem;
}
.step-number {
  flex-shrink: 0; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-weight: 700; font-size: .9rem;
  border-radius: 50%;
}
.step-item h3 { font-size: .9rem; margin-bottom: .25rem; }
.step-item p { font-size: .8rem; color: var(--text-muted); line-height: 1.5; }

/* Landing – Use cases */
.landing-usecases { max-width: 600px; width: 100%; margin-top: 3rem; }
.landing-usecases h2 { font-size: 1.4rem; font-weight: 700; text-align: center; margin-bottom: 1.25rem; }
.usecases-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.usecase-card {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1rem 1.2rem;
}
.usecase-card h3 { font-size: .85rem; color: var(--accent-hover); margin-bottom: .3rem; }
.usecase-card p { font-size: .8rem; color: var(--text-muted); line-height: 1.4; }

/* Landing – FAQ */
.landing-faq { max-width: 600px; width: 100%; margin-top: 3rem; }
.landing-faq h2 { font-size: 1.4rem; font-weight: 700; text-align: center; margin-bottom: 1.25rem; }
.faq-list { display: flex; flex-direction: column; gap: .75rem; }
.faq-item {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 1rem 1.25rem;
}
.faq-item dt { font-size: .9rem; font-weight: 600; color: var(--text-primary); margin-bottom: .4rem; }
.faq-item dd { font-size: .85rem; color: var(--text-secondary); line-height: 1.6; margin: 0; }

/* Landing responsive */
@media (max-width: 520px) {
  .landing-features,
  .usecases-grid { grid-template-columns: 1fr; }
  .landing-header h1 { font-size: 2.2rem; }
}

/* ── Editor Layout ────────────────────────── */
.editor-body { overflow: hidden; }

.editor-app {
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  overflow: hidden;
}

.editor-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: 48px; min-height: 48px;
  background: var(--bg-secondary); border-bottom: 1px solid var(--border);
}
.logo {
  font-size: 18px; font-weight: 800; color: var(--text-primary);
  text-decoration: none; letter-spacing: -.5px;
}
.logo:hover { text-decoration: none; color: var(--text-primary); }
.logo-accent { color: var(--accent); }
.header-actions { display: flex; gap: 8px; }
.editor-header-mobile-actions {
  display: none; align-items: center; gap: 6px; margin-left: auto;
}
.editor-shortcut-btn {
  width: 38px; height: 38px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.editor-shortcut-btn svg { display: block; }
.editor-header-toggle {
  display: none; align-items: center; justify-content: center; flex-direction: column;
  gap: 4px; width: 38px; height: 38px;
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-secondary); cursor: pointer; transition: color .15s, background .15s, border-color .15s;
}
.editor-header-toggle:hover { background: var(--bg-tertiary); color: var(--text-primary); border-color: var(--border-light); }
.editor-header-toggle-bar {
  display: block; width: 16px; height: 2px; border-radius: 999px;
  background: currentColor; transition: transform .15s ease, opacity .15s ease;
}
.editor-header-toggle.is-open .editor-header-toggle-bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.editor-header-toggle.is-open .editor-header-toggle-bar:nth-child(2) { opacity: 0; }
.editor-header-toggle.is-open .editor-header-toggle-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.editor-mobile-menu-item {
  display: none;
}

/* Upload zone */
.upload-zone {
  flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem;
}
.drop-zone {
  width: 100%; max-width: 500px;
  background: var(--bg-secondary); border: 2px dashed var(--border);
  border-radius: var(--radius-lg); padding: 3rem 2rem; text-align: center;
  cursor: pointer; transition: border-color .2s, background .2s;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--accent); background: var(--accent-dim);
}
.drop-icon { color: var(--text-muted); margin-bottom: 1rem; }
.drop-zone h2 { font-size: 1.25rem; margin-bottom: .4rem; }
.drop-zone p { color: var(--text-secondary); }
.drop-hint { font-size: .8rem; color: var(--text-muted); margin-top: .5rem; }

/* Editor workspace */
.editor-workspace { display: flex; flex-direction: column; flex: 1; overflow: hidden; }

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

/* Preview panel */
.editor-preview {
  flex: 1; display: flex; flex-direction: column;
  background: var(--bg-base);
  min-width: 0;
}
.canvas-container {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 12px; overflow: hidden; position: relative;
  background:
    linear-gradient(45deg, #151520 25%, transparent 25%),
    linear-gradient(-45deg, #151520 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #151520 75%),
    linear-gradient(-45deg, transparent 75%, #151520 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-color: #0e0e1a;
}
#preview-canvas {
  max-width: 100%; max-height: 100%;
  display: block; border-radius: 2px;
  box-shadow: var(--shadow-lg);
  touch-action: none;
}

/* Playback controls */
.playback-controls {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--bg-secondary); border-top: 1px solid var(--border);
}
.ctrl-btn {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary); cursor: pointer;
  transition: background .15s;
}
.ctrl-btn:hover { background: var(--bg-elevated); }
.ctrl-btn svg { pointer-events: none; }
.ctrl-btn-play { width: 40px; height: 40px; background: var(--accent); border-color: var(--accent); }
.ctrl-btn-play:hover { background: var(--accent-hover); }

.frame-scrubber { flex: 1; min-width: 60px; }
.frame-counter {
  font-size: 12px; color: var(--text-muted); font-variant-numeric: tabular-nums;
  min-width: 70px; text-align: center;
}
.speed-control { display: flex; align-items: center; gap: 4px; }
.speed-control input[type="range"] { width: 60px; }
.speed-label { font-size: 12px; color: var(--text-muted); min-width: 24px; }
.zoom-controls { display: flex; align-items: center; gap: 4px; margin-left: 4px; border-left: 1px solid var(--border); padding-left: 8px; }
.zoom-btn { width: 28px; height: 28px; font-size: 16px; line-height: 1; padding: 0; }
.zoom-label { font-size: 12px; color: var(--text-muted); min-width: 28px; text-align: center; font-variant-numeric: tabular-nums; }

/* Sidebar */
.editor-sidebar {
  width: 280px; min-width: 280px;
  display: flex; flex-direction: column;
  background: var(--bg-secondary); border-left: 1px solid var(--border);
  overflow-y: auto;
}
.sidebar-section { padding: 12px; border-bottom: 1px solid var(--border); }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.section-header h3 { font-size: 14px; font-weight: 700; }

/* Other Options section */
.other-options-section.collapsed .other-options-body { display: none; }
.option-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-secondary); cursor: pointer;
  padding: 6px 0;
}
.option-label input { margin: 0; accent-color: var(--accent); }
.sub-settings { padding: 8px 0 4px 24px; }
.sub-settings.hidden { display: none; }
.sub-hint { font-size: 11px; color: var(--text-muted); margin-bottom: 8px; line-height: 1.4; }
.range-labels { display: flex; justify-content: space-between; font-size: 10px; color: var(--text-muted); margin-top: 2px; }
.crop-inputs { gap: 6px; }
.crop-inputs .form-group { flex: 1; min-width: 0; }
.input-sm {
  width: 100%; padding: 4px 6px; font-size: 12px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-base); color: var(--text);
}
.input-sm:focus { border-color: var(--accent); outline: none; }

/* Crop overlay on canvas */
.crop-overlay {
  position: absolute; border: 2px dashed var(--accent);
  pointer-events: none; box-sizing: border-box;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.45);
}

.quick-actions { display: flex; gap: 6px; margin-bottom: 10px; }
.quick-actions .btn { flex: 1; justify-content: center; }

/* Caption list */
.caption-list-empty {
  padding: 1.5rem 1rem; text-align: center; color: var(--text-muted); font-size: 13px; line-height: 1.6;
}
.caption-list-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .1s;
  border: 1px solid transparent; margin-bottom: 4px;
}
.caption-list-item:hover { background: var(--bg-tertiary); }
.caption-list-item.selected { background: var(--accent-dim); border-color: var(--accent); }
.caption-color-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.caption-item-text {
  flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.caption-item-remove {
  background: none; border: none; color: #e05555; font-size: 18px; line-height: 1;
  cursor: pointer; padding: 2px 4px; flex-shrink: 0; border-radius: var(--radius-sm);
}
.caption-item-remove:hover { color: #ff4444; background: rgba(255,68,68,.15); }

/* Caption editor */
.caption-editor h3 { font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.delete-caption-btn { margin-top: 20px; }

/* Section toggle (collapsible sections in sidebar) */
.section-toggle {
  display: flex; align-items: center; width: 100%; padding: 10px 12px;
  background: var(--bg-tertiary); border: none; color: var(--text);
  font-size: 13px; font-weight: 700; cursor: pointer; text-transform: uppercase;
  letter-spacing: .04em;
}
.section-toggle::before {
  content: '▾'; margin-right: 6px; transition: transform .15s;
}
.section-toggle.collapsed::before { transform: rotate(-90deg); }
.box-caption-section.collapsed .box-caption-body { display: none; }
.on-image-caption-section.collapsed .on-image-caption-body { display: none; }
#adj-section.collapsed > div { display: none; }

/* Box caption toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 38px; height: 20px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--border); border-radius: 999px;
  cursor: pointer; transition: background .2s;
}
.toggle-slider::before {
  content: ''; position: absolute; left: 2px; bottom: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: #fff;
  transition: transform .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Box caption add buttons */
.btn-add-box {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg-secondary); border: 1px dashed var(--border);
  color: var(--text-secondary); padding: 6px 12px; border-radius: 6px;
  cursor: pointer; font-size: 12px; margin-bottom: 6px; transition: border-color .2s, color .2s;
}
.btn-add-box:hover { border-color: var(--accent); color: var(--accent); }

/* Box caption editor panel */
.box-editor {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px; margin-bottom: 8px; background: var(--bg-secondary);
}
.box-editor-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.box-editor-label { font-size: 12px; font-weight: 700; color: var(--text-primary); }
.btn-remove-box {
  background: none; border: none; color: var(--text-muted);
  cursor: pointer; font-size: 11px; padding: 2px 6px; border-radius: 4px;
  transition: color .2s, background .2s;
}
.btn-remove-box:hover { color: #e74c3c; background: rgba(231,76,60,.1); }
.box-editor .form-group { margin-bottom: 8px; }

/* Timeline */
.editor-timeline {
  background: var(--bg-secondary); border-top: 1px solid var(--border);
  padding: 0 0 4px;
}
.timeline-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px 4px;
}
.timeline-header h3 { font-size: 13px; font-weight: 700; color: var(--text-secondary); }
.timeline-hint { font-size: 11px; color: var(--text-muted); }

#timeline { overflow-x: auto; touch-action: none; }
#timeline svg { display: block; }

/* D3 brush overrides */
.caption-brush .overlay { fill: transparent; }
.caption-brush .selection { cursor: grab; }
.caption-brush .selection:active { cursor: grabbing; }
.caption-brush .handle { cursor: ew-resize; }

/* ── Overlays ─────────────────────────────── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.overlay-content { text-align: center; }
.spinner {
  width: 40px; height: 40px; margin: 0 auto 1rem;
  border: 3px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text, .progress-text {
  font-size: 15px; color: var(--text-secondary);
}
.progress-bar {
  width: 240px; height: 6px; background: var(--bg-tertiary);
  border-radius: 3px; margin-top: 12px; overflow: hidden;
}
.progress-bar-fill {
  height: 100%; width: 0; background: var(--accent);
  border-radius: 3px; transition: width .15s;
}

/* ── Legacy pages (create, gif viewer) ────── */
.container {
  max-width: 640px; margin: 3rem auto; padding: 2rem;
  background: var(--bg-secondary); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.container h1 { margin-bottom: 1rem; }
.container nav { margin-top: 1.5rem; }
.container form { margin-top: 1.5rem; }
.container input[type="file"] { display: block; margin-bottom: 1rem; color: var(--text-secondary); }

.result {
  margin-top: 1.5rem; padding: 1rem;
  background: rgba(16, 185, 129, .12); border: 1px solid var(--success);
  border-radius: var(--radius-sm); color: var(--success);
}
.error {
  margin-top: 1.5rem; padding: 1rem;
  background: rgba(239, 68, 68, .12); border: 1px solid var(--danger);
  border-radius: var(--radius-sm); color: var(--danger);
}

#gif-container { margin-top: 1.5rem; text-align: center; }
#gif-image { max-width: 100%; border-radius: var(--radius-sm); margin-bottom: 1rem; }

/* ── Mobile sidebar toggle ────────────────── */
.sidebar-toggle,
.timeline-toggle {
  display: none;
  width: 100%; padding: 10px 16px;
  background: var(--bg-tertiary); color: var(--text-primary);
  border: none; border-bottom: 1px solid var(--border);
  font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; text-align: left;
  align-items: center; gap: 6px;
}
.sidebar-toggle::after,
.timeline-toggle::after {
  content: '\25BC'; font-size: 10px; margin-left: auto; transition: transform .2s;
}
.sidebar-toggle.collapsed::after,
.timeline-toggle.collapsed::after { transform: rotate(-90deg); }

/* ── Share Modal ─────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 12px; padding: 1.5rem; width: 100%; max-width: 480px;
  position: relative; animation: modalIn .2s ease-out;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.modal-close {
  position: absolute; top: 12px; right: 12px; background: none; border: none;
  color: var(--text-muted); font-size: 1.5rem; cursor: pointer; line-height: 1;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
}
.modal-close:hover { color: var(--text); background: var(--bg-base); }
.modal-title { font-size: 1.25rem; margin-bottom: 1rem; }
.modal-sm { max-width: 340px; text-align: center; }
.modal-body-text { font-size: .9rem; color: var(--text-secondary); margin-bottom: 1.25rem; line-height: 1.5; }
.modal-skip-label { display: flex; align-items: center; gap: .4rem; justify-content: center; font-size: .8rem; color: var(--text-secondary); margin-bottom: 1.25rem; cursor: pointer; }
.modal-actions { display: flex; gap: .75rem; justify-content: center; }
.modal-actions .btn { min-width: 100px; justify-content: center; }
.share-preview {
  border-radius: 8px; overflow: hidden; margin-bottom: 1rem;
  background: var(--bg-base); display: flex; justify-content: center;
}
.share-preview img { max-width: 100%; max-height: 260px; display: block; }
.dl-size-info {
  text-align: center; font-size: .8125rem; color: var(--text-secondary);
  margin: -.5rem 0 .75rem; padding: .35rem .5rem;
  background: var(--bg-tertiary); border-radius: 6px;
}
.dl-size-orig { color: var(--text-muted); }
.dl-size-arrow { color: var(--text-muted); margin: 0 .2em; }
.dl-size-new { font-weight: 600; color: var(--text-primary); }
.dl-size-pct { color: var(--text-muted); }
.dl-size-pct.dl-size-savings { color: #10b981; font-weight: 600; }
.dl-size-note { color: var(--text-muted); font-style: italic; }
.share-link-row { display: flex; gap: .5rem; margin-bottom: 1rem; }
.share-url-input {
  flex: 1; padding: .5rem .75rem; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-base);
  color: var(--text); font-size: .875rem; outline: none;
}
.share-url-input:focus { border-color: var(--accent); }
.share-buttons { display: flex; flex-direction: column; gap: .5rem; }
.share-social { display: flex; gap: .5rem; justify-content: center; }
.share-status {
  margin-top: .75rem; font-size: .85rem; text-align: center;
  color: var(--text-muted); min-height: 1.2em;
}
.share-status.success { color: #22c55e; }
.share-status.error { color: #ef4444; }

/* Skeleton loader */
@keyframes skeleton-shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  border-radius: 6px;
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border) 50%, var(--bg-secondary) 75%);
  background-size: 800px 100%;
  animation: skeleton-shimmer 1.4s infinite linear;
}
.skeleton-row { display: flex; gap: .5rem; margin-bottom: 1rem; }
.skeleton-input { flex: 1; height: 38px; }
.skeleton-btn { width: 100px; height: 38px; flex-shrink: 0; }
.skeleton-social { display: flex; gap: .5rem; justify-content: center; }
.skeleton-social-btn { width: 140px; height: 36px; }

/* ── Ad Containers ────────────────────────── */
.ad-container {
  display: flex; justify-content: center; align-items: center;
  overflow: hidden; background: transparent;
}
.ad-container ins { max-width: 100%; }
.ad-landing { max-width: 600px; width: 100%; margin: 2rem auto 0; min-height: 90px; }
.ad-editor-upload { max-width: 520px; width: 100%; margin: 1.5rem auto 0; min-height: 90px; }
.ad-editor-bottom { max-width: 728px; width: 100%; margin: 0 auto; padding: 8px 16px; min-height: 90px; background: var(--bg-secondary); border-top: 1px solid var(--border); }
.ad-utility { margin-top: 1.5rem; min-height: 90px; }
@media (max-width: 400px) { .ad-editor-bottom { display: none; } }

/* ── Box Bold ─────────────────────────────── */
.box-bold-group { margin-bottom: 8px; }

/* ── Responsive ──────────────────────────── */
@media (max-width: 1024px) {
  .site-nav-links a { font-size: 12px; padding: 5px 8px; }
}
@media (max-width: 900px) {
  .editor-sidebar { width: 240px; min-width: 240px; }
}
@media (max-width: 768px) {
  .site-nav {
    height: auto; min-height: 60px;
    padding: 10px 16px; flex-wrap: wrap; row-gap: 12px;
  }
  .site-nav-actions { gap: 6px; }
  .site-nav-toggle { display: flex; }
  .site-nav-links {
    display: none; order: 3; width: 100%;
    flex-direction: column; align-items: stretch; gap: 6px;
    padding-bottom: 8px;
  }
  .site-nav.is-open .site-nav-links { display: flex; }
  .site-nav-links a {
    width: 100%; font-size: 14px; padding: 10px 12px;
  }
  .theme-toggle { margin-left: 0; }

  /* Home page */
  .home-hero { padding: 3rem 1.5rem 2.5rem; }
  .tool-grid { grid-template-columns: 1fr 1fr; }

  /* Landing */
  .landing-features { grid-template-columns: 1fr; }
  .landing-header h1 { font-size: 2rem; }
  .landing-upload { padding: 2rem 1.5rem; }
  .landing-footer { display: none; }

  /* Editor layout: vertical stack */
  .editor-main { flex-direction: column; }
  .editor-sidebar {
    width: 100%; min-width: 0;
    border-left: none; border-top: 1px solid var(--border);
    max-height: 45vh;
  }
  .sidebar-toggle { display: flex; }
  .timeline-toggle { display: flex; }
  .editor-sidebar.mobile-collapsed .sidebar-section,
  .editor-sidebar.mobile-collapsed .caption-editor,
  .editor-sidebar.mobile-collapsed .box-caption-section,
  .editor-sidebar.mobile-collapsed .other-options-section { display: none; }
  .editor-timeline.mobile-collapsed .timeline-header,
  .editor-timeline.mobile-collapsed #timeline { display: none; }
  .playback-controls { flex-wrap: wrap; gap: 6px; padding: 6px 10px; }
  .speed-control { display: none; }
  .zoom-controls { display: none; }
  .frame-counter { font-size: 11px; min-width: 50px; }
  .ctrl-btn { width: 44px; height: 44px; }
  .ctrl-btn-play { width: 48px; height: 48px; }
  .editor-timeline { padding: 0 0 8px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .caption-brush .handle { width: 12px !important; }
  .canvas-container { padding: 8px; min-height: 180px; }
  .btn { padding: 10px 16px; font-size: 14px; }
  .btn-xs { padding: 6px 12px; font-size: 13px; }
  .btn-small { padding: 8px 14px; }
  .editor-header,
  .video-editor-header,
  .vtg-header {
    padding: 6px 10px;
    height: auto; min-height: 44px;
    flex-wrap: wrap; row-gap: 8px;
  }
  .editor-header .btn,
  .video-editor-header .btn,
  .vtg-header .btn { padding: 6px 10px; font-size: 13px; }
  .editor-header-mobile-actions { display: flex; }
  .editor-header-toggle { display: flex; }
  .header-actions {
    display: none; order: 3; width: 100%;
    flex-direction: column; gap: 6px;
  }
  .editor-header.is-open .header-actions,
  .video-editor-header.is-open .header-actions,
  .vtg-header.is-open .header-actions { display: flex; }
  .header-actions .btn,
  .header-actions a {
    width: 100%; justify-content: flex-start; margin-left: 0;
  }
  .editor-mobile-menu-item { display: inline-flex; }
  input[type="range"]::-webkit-slider-thumb { width: 24px; height: 24px; }
  input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; }

  /* Image/video editors */
  .image-editor-workspace { flex-direction: column; }
  .image-editor-sidebar { width: 100%; min-width: 0; border-left: none; border-top: 1px solid var(--border); max-height: 50vh; }
  .video-editor-workspace { flex-direction: column; }
  .video-preview-area {
    min-height: 240px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .video-controls-panel {
    width: 100%;
    min-width: 0;
    max-height: 45vh;
  }
  .vtg-body { flex-direction: column; }
  .vtg-preview {
    min-width: 0;
    min-height: 240px;
  }
  .vtg-sidebar {
    width: 100%;
    min-width: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 45vh;
  }
}

@media (max-width: 520px) {
  .tool-grid { grid-template-columns: 1fr; }
  .home-hero-logo { font-size: 2.4rem; }
  .tool-features { grid-template-columns: 1fr; }
  .ve-time-inputs {
    flex-wrap: wrap;
    gap: 8px;
  }
  .ve-time-input {
    width: calc(50% - 32px);
    min-width: 110px;
  }
  #ve-status-text {
    width: 100%;
    margin-left: 0 !important;
  }
}

@media (max-width: 400px) {
  .header-actions { gap: 4px; }
  .editor-header .btn svg,
  .video-editor-header .btn svg,
  .vtg-header .btn svg { display: none; }
  .editor-shortcut-btn svg { display: block !important; }
  .landing-header h1 { font-size: 1.7rem; }
  .editor-sidebar { max-height: 50vh; }
  .quick-actions { flex-direction: column; }
}

/* ── Tracking UI ──────────────────────────── */
.tracking-bar {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: rgba(20, 20, 42, 0.92); border: 1px solid var(--accent);
  border-radius: 8px; padding: 8px 14px; z-index: 50;
  backdrop-filter: blur(4px); white-space: nowrap;
}
.tracking-bar-text { font-size: 13px; color: var(--text-primary); }
.tracking-loading {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px;
  background: rgba(10, 10, 20, 0.82); backdrop-filter: blur(3px); z-index: 60; border-radius: 2px;
}
.tracking-loading.hidden { display: none; }
@keyframes tracking-spin { to { transform: rotate(360deg); } }
.tracking-loading-spinner {
  width: 44px; height: 44px;
  border: 3px solid rgba(167, 139, 250, 0.2); border-top-color: #a78bfa;
  border-radius: 50%; animation: tracking-spin 0.8s linear infinite;
}
.tracking-loading-label { font-size: 13px; font-weight: 500; color: #e2e8f0; letter-spacing: 0.02em; }
.tracking-overlay {
  position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5);
  pointer-events: none; z-index: 40;
}
@keyframes tracking-ripple {
  from { transform: translate(-50%, -50%) scale(0); opacity: 0.9; }
  to   { transform: translate(-50%, -50%) scale(5); opacity: 0; }
}
.tracking-ripple {
  position: absolute; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid #a78bfa; background: rgba(167, 139, 250, 0.25);
  animation: tracking-ripple 1.2s ease-out forwards; pointer-events: none; z-index: 55;
}

/* ── Keyframe Context Menu ────────────────── */
.kf-context-menu {
  position: fixed; z-index: 200;
  background: #1e1e2e; border: 1px solid #3a3a5c;
  border-radius: 6px; padding: 4px; box-shadow: 0 4px 16px rgba(0,0,0,.5);
  min-width: 148px;
}
.kf-context-menu button {
  display: block; width: 100%; padding: 7px 12px;
  background: none; border: none; border-radius: 4px;
  color: #ef4444; font-size: .85rem; text-align: left; cursor: pointer;
}
.kf-context-menu button:hover { background: rgba(239,68,68,.12); }

/* ── Shared Photo-Adjustment UI (used by image-editor, GIF editor, image-caption tool) ── */
.ie-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-muted); padding: 10px 12px 6px;
}
.ie-section { padding: 8px 12px 12px; border-bottom: 1px solid var(--border); }
.ie-filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ie-filter-btn {
  padding: 7px 4px; font-size: 12px; font-weight: 600; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-primary); color: var(--text-secondary);
  cursor: pointer; transition: all .15s; text-align: center;
}
.ie-filter-btn:hover, .ie-filter-btn.active { background: var(--cat-image); color: #fff; border-color: var(--cat-image); }
.ie-transform-row { display: flex; gap: 6px; flex-wrap: wrap; }
.ie-transform-btn {
  flex: 1; min-width: 0; padding: 7px 4px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-primary); color: var(--text-secondary); cursor: pointer;
  transition: all .15s; text-align: center;
}
.ie-transform-btn:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.ie-resize-row { display: flex; gap: 8px; align-items: flex-end; }
.ie-resize-row .form-group { flex: 1; margin: 0; }
.ie-resize-row input[type="number"] {
  width: 100%; padding: 6px 8px; font-size: 13px;
  background: var(--bg-primary); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.ie-lock-btn {
  padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-primary); color: var(--text-secondary); cursor: pointer; font-size: 16px; line-height: 1;
}
.ie-lock-btn.locked { color: var(--cat-image); border-color: var(--cat-image); }
.ie-reset-btn {
  padding: 5px 10px; font-size: 12px; background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer;
}
.ie-reset-btn:hover { color: var(--danger); border-color: var(--danger); }
.ie-export-row { display: flex; gap: 8px; }
.ie-export-row select {
  flex: 1; padding: 7px 8px; font-size: 13px;
  background: var(--bg-primary); color: var(--text-primary);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}

/* ── Cookie Consent ───────────────────────── */
.cookie-consent {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: center;
  gap: 1rem; padding: 12px 20px;
  background: var(--bg-elevated); border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-secondary); z-index: 9999;
}
.cookie-consent p { margin: 0; }
@media (max-width: 520px) {
  .cookie-consent { flex-direction: column; text-align: center; gap: .5rem; }
}
