/* ==========================================================================
   Gemini Watermark Remover - minimal UI
   ========================================================================== */
:root {
  --font: 'Google Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #ffffff;
  --surface: #f5f6fa;
  --card: #ffffff;
  --border: #e4e7ee;
  --border-strong: #cfd4df;
  --text: #15171d;
  --muted: #5e6574;
  --accent: #3b5bfd;
  --accent-hover: #2d4ae6;
  --accent-soft: #eef1ff;
  --on-accent: #ffffff;
  --success: #137a52;
  --success-soft: #e7f6ef;
  --warn: #9a5b00;
  --warn-soft: #fff4e0;
  --danger: #c0352b;
  --danger-soft: #fdecea;
  --checker-a: #f1f2f5;
  --checker-b: #ffffff;
  --shadow-sm: 0 .5px 1px rgba(16, 24, 40, .05), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow: 0 .5px 1px rgba(16, 24, 40, .04), 0 4px 10px -2px rgba(16, 24, 40, .05), 0 18px 36px -14px rgba(16, 24, 40, .12);
  --shadow-lg: 0 1px 2px rgba(16, 24, 40, .05), 0 12px 28px -6px rgba(16, 24, 40, .12), 0 48px 80px -24px rgba(16, 24, 40, .24);
  --ring: color-mix(in srgb, var(--accent) 30%, transparent);
  --scrim: rgba(22, 26, 35, .5);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --container: 1120px;

  /* Motion. One easing curve for everything: fast out, settles gently. */
  --ease: cubic-bezier(.32, .72, 0, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur-fast: .14s;
  --dur: .24s;
  --dur-slow: .4s;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1014;
    --surface: #13161c;
    --card: #171a21;
    --border: #262a34;
    --border-strong: #353a47;
    --text: #e9ebf1;
    --muted: #9ba2b1;
    --accent: #7c93ff;
    --accent-hover: #93a6ff;
    --accent-soft: #1d2340;
    --on-accent: #0b0d14;
    --success: #4cc38a;
    --success-soft: #122a20;
    --warn: #f0b35a;
    --warn-soft: #2d2311;
    --danger: #f2837a;
    --danger-soft: #331816;
    --checker-a: #1c1f27;
    --checker-b: #22262f;
    --shadow-sm: 0 .5px 1px rgba(0, 0, 0, .5);
    --shadow: 0 .5px 1px rgba(0, 0, 0, .4), 0 4px 12px -2px rgba(0, 0, 0, .4), 0 20px 40px -16px rgba(0, 0, 0, .6);
    --shadow-lg: 0 1px 2px rgba(0, 0, 0, .5), 0 16px 32px -8px rgba(0, 0, 0, .55), 0 56px 88px -28px rgba(0, 0, 0, .7);
    --ring: color-mix(in srgb, var(--accent) 38%, transparent);
    --scrim: rgba(0, 0, 0, .62);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1014;
  --surface: #13161c;
  --card: #171a21;
  --border: #262a34;
  --border-strong: #353a47;
  --text: #e9ebf1;
  --muted: #9ba2b1;
  --accent: #7c93ff;
  --accent-hover: #93a6ff;
  --accent-soft: #1d2340;
  --on-accent: #0b0d14;
  --success: #4cc38a;
  --success-soft: #122a20;
  --warn: #f0b35a;
  --warn-soft: #2d2311;
  --danger: #f2837a;
  --danger-soft: #331816;
  --checker-a: #1c1f27;
  --checker-b: #22262f;
  --shadow-sm: 0 .5px 1px rgba(0, 0, 0, .5);
  --shadow: 0 .5px 1px rgba(0, 0, 0, .4), 0 4px 12px -2px rgba(0, 0, 0, .4), 0 20px 40px -16px rgba(0, 0, 0, .6);
  --shadow-lg: 0 1px 2px rgba(0, 0, 0, .5), 0 16px 32px -8px rgba(0, 0, 0, .55), 0 56px 88px -28px rgba(0, 0, 0, .7);
  --ring: color-mix(in srgb, var(--accent) 38%, transparent);
  --scrim: rgba(0, 0, 0, .62);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video, svg { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.15; margin: 0 0 .5em; font-weight: 600; letter-spacing: -.022em; }
/* Balanced wrapping on section headings only. Not on h1: the hero headline is measured
   by the Images<->Video scroll-keeping script, and balancing resolves after that
   measurement, which pushed the tab bar 3px off (dev/nav-check.mjs). */
h2, h3 { text-wrap: balance; }
h1 { letter-spacing: -.032em; }
p { margin: 0 0 1em; text-wrap: pretty; }
input, select, textarea, button { accent-color: var(--accent); }
code { font-family: var(--mono); font-size: .88em; background: var(--surface); border: 1px solid var(--border); padding: .1em .4em; border-radius: 6px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 10px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  html { scroll-behavior: auto; }
}

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 16px; }
.container.narrow { max-width: 760px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.icon { width: 1em; height: 1em; flex: none; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip-link:focus { left: 8px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 600; font-size: 1.125rem; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: var(--accent); color: var(--on-accent); font-size: 16px;
}
.main-nav { display: flex; gap: 4px; margin-left: 16px; }
.nav-link {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  color: var(--muted); font-weight: 500; font-size: .95rem;
}
.nav-link { transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease); }
.nav-link:hover { color: var(--text); background: var(--surface); text-decoration: none; }
.nav-link.is-active { color: var(--text); background: var(--surface); }
.header-actions { margin-left: auto; display: flex; gap: 6px; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-size: 18px;
}
.icon-btn { transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease); -webkit-tap-highlight-color: transparent; }
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn:active:not(:disabled) { transform: scale(.92); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn.solid { background: var(--accent); color: var(--on-accent); font-size: 16px; }
.icon-btn.solid:hover:not(:disabled) { background: var(--accent-hover); }
.theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-light { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-light { display: none; }
  :root:not([data-theme="light"]) .theme-icon-dark { display: block; }
}

/* ---------- Hero ---------- */
.hero { padding: 56px 0 40px; text-align: center; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: .85rem; font-weight: 500; margin-bottom: 20px;
}
.hero h1 { font-size: clamp(2rem, 5.4vw, 3.4rem); }
.accent { color: var(--accent); }
.lead { font-size: clamp(1.02rem, 2vw, 1.15rem); color: var(--muted); max-width: 620px; margin: 0 auto 28px; }

.mode-switch {
  display: inline-flex; padding: 4px; gap: 4px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); margin-bottom: 28px;
}
.mode-tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 18px; border-radius: 999px;
  color: var(--muted); font-weight: 500;
}
.mode-tab { transition: color var(--dur-fast) var(--ease), background-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease); }
.mode-tab:hover { color: var(--text); text-decoration: none; }
.mode-tab.is-active { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }
.mode-tab:active { transform: scale(.98); }
.pill { font-size: .7rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- Tool card ---------- */
.tool-card {
  max-width: 960px; margin: 0 auto; text-align: left;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow); padding: 12px;
}
.tool-note { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: .88rem; margin: 16px auto 0; text-align: center; }

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  min-height: 300px; padding: 40px 20px; border-radius: calc(var(--radius-lg) - 8px);
  border: 1.5px dashed var(--border-strong); background: var(--surface); cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.dropzone { transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease), transform var(--dur) var(--ease); }
.dropzone:hover, .dropzone.is-dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.is-dragging { transform: scale(1.005); }
.drop-icon {
  display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px; margin-bottom: 16px;
  background: var(--card); color: var(--accent); font-size: 28px; box-shadow: var(--shadow-sm);
}
.drop-title { font-size: 1.2rem; font-weight: 500; margin-bottom: 4px; }
.drop-hint { color: var(--muted); font-size: .92rem; margin-bottom: 20px; }
.link-like { color: var(--accent); }
.chips { list-style: none; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; }
.chips li {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border); font-size: .85rem; color: var(--muted);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 500; font-size: .95rem; cursor: pointer; white-space: nowrap;
  letter-spacing: -.005em;
  -webkit-tap-highlight-color: transparent;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease),
              box-shadow var(--dur) var(--ease), transform var(--dur-fast) var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled):not(.is-disabled) { transform: scale(.97); }
.btn.primary {
  background: var(--accent); color: var(--on-accent);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--accent) 30%, transparent);
}
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.secondary { background: var(--accent-soft); color: var(--accent); }
.btn.secondary:hover:not(:disabled):not(.is-disabled) { border-color: var(--accent); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn.ghost:hover:not(:disabled) { background: var(--surface); }
.btn.small { height: 36px; padding: 0 14px; font-size: .88rem; }
.btn:disabled, .btn.is-disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }

/* ---------- Results ---------- */
.result { display: flex; flex-direction: column; gap: 12px; }
.result-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 14px 24px; padding: 16px 6px 4px; margin-top: 4px;
  border-top: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
}
.result-meta { min-width: 0; flex: 1 1 280px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.result-meta p { margin: 0; max-width: 100%; }
/* The status reads as one object rather than a loose line of coloured text. */
.result-meta .status {
  padding: 5px 12px 5px 11px; border-radius: 999px; font-size: .86rem;
  background: color-mix(in srgb, currentColor 10%, transparent);
}
.result-meta .status[data-tone="info"] { background: color-mix(in srgb, var(--text) 6%, transparent); }
.file-name {
  font-weight: 600; font-size: .98rem; letter-spacing: -.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 0;
}
.meta-line { font-size: .82rem; color: var(--muted); margin: 0; font-variant-numeric: tabular-nums; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.result-actions.stack { flex-direction: column; }
.result-actions.stack .btn { width: 100%; }

.status { display: flex; align-items: flex-start; gap: 8px; font-size: .92rem; font-weight: 500; line-height: 1.45; margin: 0; }
.status::before {
  content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor;
  flex: none; margin-top: .42em; /* aligns with the first line, not the middle of a wrapped block */
}
.status[data-tone="info"] { color: var(--muted); }
.status[data-tone="success"] { color: var(--success); }
.status[data-tone="warn"] { color: var(--warn); }
.status[data-tone="error"] { color: var(--danger); }
.status[data-tone="busy"] { color: var(--accent); }
.status[data-tone="busy"]::before { animation: pulse 1s ease-in-out infinite; }

/* Before/after comparison */
.compare {
  position: relative; overflow: hidden; border-radius: calc(var(--radius-lg) - 8px);
  background-color: var(--checker-b);
  background-image:
    linear-gradient(45deg, var(--checker-a) 25%, transparent 25%),
    linear-gradient(-45deg, var(--checker-a) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--checker-a) 75%),
    linear-gradient(-45deg, transparent 75%, var(--checker-a) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  user-select: none; touch-action: pan-y;
}
.compare { width: fit-content; max-width: 100%; margin: 0 auto; }
.compare-img { display: block; width: auto; height: auto; max-width: 100%; max-height: 70vh; }
.compare-after {
  position: absolute; inset: 0;
  clip-path: inset(0 0 0 var(--pos));
}
.compare-after .compare-img { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: fill; }
.compare.video { width: 100%; background: #000; }
.compare.video .compare-img { width: 100%; aspect-ratio: 16 / 9; max-height: 64vh; object-fit: contain; background: #000; }
.compare.video .compare-after .compare-img { height: 100%; max-height: none; }
.compare-label {
  position: absolute; top: 12px; padding: 4px 10px; border-radius: 999px; font-size: .78rem; font-weight: 500;
  background: rgba(0, 0, 0, .55); color: #fff; pointer-events: none;
}
.compare-label.left { left: 12px; }
.compare-label.right { right: 12px; }
.compare-handle {
  position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px;
  background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); pointer-events: none;
}
.compare-handle span {
  position: absolute; top: 50%; left: 50%; width: 36px; height: 36px; transform: translate(-50%, -50%);
  border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .25);
}
.compare-handle span::before, .compare-handle span::after {
  content: ''; position: absolute; top: 50%; width: 0; height: 0; border: 5px solid transparent; transform: translateY(-50%);
}
.compare-handle span::before { left: 6px; border-right-color: #444; }
.compare-handle span::after { right: 6px; border-left-color: #444; }
.compare-range {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize;
}
.compare-range:disabled { cursor: default; pointer-events: none; }
.processing-overlay {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: color-mix(in srgb, var(--card) 55%, transparent); backdrop-filter: blur(2px);
  color: var(--text); font-weight: 500;
}
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
.spinner.small { width: 18px; height: 18px; border-width: 2px; }

/* Progress */
.progress { height: 6px; border-radius: 999px; background: var(--surface); overflow: hidden; margin-top: 8px; }
.progress.big { height: 8px; margin: 0 0 10px; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width var(--dur) var(--ease); }

/* Batch */
.batch-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 8px 4px; }
.batch-head > div:first-child { flex: 1 1 220px; }
.batch-title { font-weight: 500; margin: 0; }
.batch-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px;
}
.batch-item {
  display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--card);
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.batch-item:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); border-color: var(--border-strong); }
.batch-thumb {
  position: relative; display: block; width: 100%; height: 0; padding: 75% 0 0; margin: 0;
  border: 0; background: var(--surface); cursor: zoom-in; overflow: hidden;
}
.batch-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.batch-thumb .spinner { position: absolute; top: 50%; left: 50%; margin: -18px 0 0 -18px; }
.batch-info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 8px; }
.batch-info .file-name { font-size: .9rem; }
.batch-info .status { font-size: .82rem; }
.batch-actions { display: flex; gap: 6px; }
.batch-actions .btn { flex: 1; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px;
  background: var(--scrim);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  animation: scrimIn var(--dur) var(--ease-out);
}
.lightbox-inner {
  width: min(1000px, 100%); background: var(--card); border-radius: var(--radius-lg); padding: 14px;
  box-shadow: var(--shadow-lg);
  border: 1px solid color-mix(in srgb, var(--border) 60%, transparent);
  animation: sheetIn var(--dur-slow) var(--ease-out);
}
/* The dialog header keeps its buttons on one line; the file name is what shrinks. */
.lightbox-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 4px 4px 12px; }
.lightbox-bar .file-name { min-width: 0; flex: 1 1 auto; }
.lightbox-bar .result-actions { flex: 0 0 auto; flex-wrap: nowrap; }
@keyframes scrimIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheetIn { from { opacity: 0; transform: scale(.97) translateY(10px); } to { opacity: 1; transform: none; } }

/* Video */
.video-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; align-items: start; }
/* Video + transport are one grid item so they can stick together while the taller
   settings panel scrolls past. align-items:start keeps the stage from being stretched:
   the before video is in normal flow and the after video is absolutely positioned over
   it, so a stretched box would line the two halves up differently. */
.video-stage {
  grid-column: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px;
  position: sticky; top: 76px; /* sticky header is 64px */
}
.player-bar { display: flex; align-items: center; gap: 12px; padding: 0 4px; }
.i-pause { display: none; }
.player-bar [data-playing="true"] .i-play { display: none; }
.player-bar [data-playing="true"] .i-pause { display: block; }
.scrubber { flex: 1; accent-color: var(--accent); }
.time { font-variant-numeric: tabular-nums; font-size: .88rem; color: var(--muted); min-width: 88px; text-align: right; }
/* Progress + message block in the video side panel */
.panel-block .status {
  padding: 10px 12px; border-radius: 10px;
  background: color-mix(in srgb, currentColor 9%, transparent);
  border: 1px solid color-mix(in srgb, currentColor 20%, transparent);
}
.panel-block .status[data-tone="info"] {
  background: color-mix(in srgb, var(--text) 5%, transparent);
  border-color: var(--border);
}
.panel-block .status + .meta-line { margin-top: 8px; padding: 0 2px; }

.video-panel {
  grid-column: 2; grid-row: 1 / -1; display: flex; flex-direction: column; gap: 16px;
  padding: 12px; border-radius: calc(var(--radius-lg) - 8px); background: var(--surface);
}
.panel-block { min-width: 0; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 8px 0 0; font-size: .88rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.advanced {
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card); padding: 0 12px;
  transition: border-color var(--dur-fast) var(--ease);
}
.advanced:hover { border-color: var(--border-strong); }
.advanced summary { display: flex; align-items: center; gap: 8px; padding: 10px 0; cursor: pointer; list-style: none; font-weight: 500; font-size: .92rem; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.advanced .chevron { margin-left: auto; transition: transform .2s; }
.advanced[open] .chevron { transform: rotate(180deg); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: .88rem; margin-bottom: 12px; }
.field select {
  font: inherit; height: 38px; padding: 0 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.field select:hover { border-color: var(--border-strong); }
.field select:focus-visible { border-color: var(--accent); }
.check { display: flex; align-items: flex-start; gap: 8px; font-size: .88rem; margin-bottom: 12px; cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--accent); }

.notice {
  display: flex; align-items: flex-start; gap: 10px; max-width: 960px; margin: 0 auto 16px; padding: 12px 16px;
  border-radius: var(--radius); text-align: left; font-size: .92rem;
}
.notice p { margin: 0; }
.notice .icon { margin-top: 4px; }
.notice.warn { background: var(--warn-soft); color: var(--warn); }

/* ---------- Sections ---------- */
.section { padding: 72px 0; }
.section.alt { background: var(--surface); }
.section-title { font-size: clamp(1.6rem, 3.4vw, 2.2rem); text-align: center; margin-bottom: 40px; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: step; }
.steps li { position: relative; padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.steps li::after {
  counter-increment: step; content: counter(step);
  position: absolute; top: 20px; right: 22px; font-size: 2rem; font-weight: 600; color: var(--border-strong);
}
.steps h3, .feature h3 { font-size: 1.1rem; margin: 16px 0 6px; }
.steps p, .feature p { color: var(--muted); margin: 0; font-size: .95rem; }
.step-icon, .feature-icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent); font-size: 20px;
}
.features { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.feature { padding: 24px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--border); }

.faq { display: flex; flex-direction: column; gap: 10px; }
.faq details { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); padding: 0 20px; }
.faq summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 0; cursor: pointer; font-weight: 500; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq .chevron { color: var(--muted); transition: transform .2s; }
.faq details[open] .chevron { transform: rotate(180deg); }
.faq details p { color: var(--muted); padding-bottom: 18px; margin: 0; }

.prose-section { padding-top: 56px; }
.prose h1 { font-size: clamp(2rem, 4vw, 2.6rem); }
.prose h2 { font-size: 1.25rem; margin-top: 2em; }
.prose p, .prose li { color: var(--muted); }
.big-code { font-size: 5rem; font-weight: 700; color: var(--accent); margin: 0; line-height: 1; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 40px 0 24px; font-size: .92rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
.footer-brand p { margin: 10px 0 0; max-width: 320px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: flex-start; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--text); }
.footer-legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: .82rem; }
.footer-legal p { margin: 0; }
.footer-legal a { color: inherit; text-decoration: underline; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100;
  padding: 10px 18px; border-radius: 999px; background: var(--text); color: var(--bg);
  font-size: .92rem; box-shadow: var(--shadow); max-width: calc(100% - 32px);
}

/* Model switch (Model One / Model Two) */
.model-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 10px; }
.model-option { position: relative; display: block; cursor: pointer; }
.model-option input { position: absolute; opacity: 0; pointer-events: none; }
.model-option span {
  display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--card); transition: border-color .15s, background .15s;
}
.model-option strong { font-weight: 600; font-size: .95rem; }
.model-option small { color: var(--muted); font-size: .8rem; }
.model-option:hover span { border-color: var(--border-strong); }
.model-option input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.model-option input:checked + span strong { color: var(--accent); }
.model-option input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.model-switch.is-disabled { opacity: .55; pointer-events: none; }
.model-switch.compact { margin: 0; }
.model-switch.compact .model-option span { padding: 8px 10px; }

/* Model Two tuner */
.panel-title { margin: 0 0 8px; font-weight: 600; font-size: .92rem; }
.tuner { display: flex; flex-direction: column; gap: 10px; }
.tuner-badge { margin: 0; font-size: .85rem; color: var(--muted); }
.tuner-previews { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.tuner-previews figure { margin: 0; }
.tuner-previews canvas {
  display: block; width: 100%; height: auto; aspect-ratio: 1; border-radius: var(--radius-sm);
  border: 1px solid var(--border); image-rendering: pixelated;
  background: repeating-conic-gradient(var(--checker-a) 0% 25%, var(--checker-b) 0% 50%) 0 0 / 16px 16px;
}
.tuner-previews figcaption { font-size: .78rem; color: var(--muted); text-align: center; margin-top: 4px; }
.tuner-row { display: grid; grid-template-columns: 72px 1fr 64px; align-items: center; gap: 8px; font-size: .86rem; }
.tuner-label { color: var(--muted); }
.tuner-row input { width: 100%; accent-color: var(--accent); }
.tuner-row output { text-align: right; font-variant-numeric: tabular-nums; }
.tuner .btn { align-self: flex-start; }
.tuner-dialog { width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow: auto; }
.tuner-dialog .tuner { padding: 4px; }

/* Heal brush editor */
.heal-open, .heal-open body { overflow: hidden; }
.heal-editor {
  position: fixed; inset: 0; z-index: 95; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text);
}
.heal-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--card);
}
.heal-title { min-width: 0; }
.heal-title .file-name { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heal-note { margin: 2px 0 0; font-size: .8rem; }
.heal-actions { display: flex; gap: 8px; flex: none; }
.heal-stage {
  position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; touch-action: none;
  background: repeating-conic-gradient(var(--checker-a) 0% 25%, var(--checker-b) 0% 50%) 0 0 / 24px 24px;
}
.heal-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: none; touch-action: none; }
.heal-stage[data-mode="pan"] .heal-canvas { cursor: grab; }
.heal-busy {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 999px; background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow); font-weight: 500; pointer-events: none;
}
.heal-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 18px;
  padding: 10px 16px; padding-bottom: max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--card);
}
.heal-size { display: flex; align-items: center; gap: 8px; font-size: .88rem; color: var(--muted); }
.heal-size input { width: 160px; accent-color: var(--accent); }
.heal-size output { min-width: 48px; color: var(--text); font-variant-numeric: tabular-nums; }
.heal-group { display: flex; gap: 6px; }
.heal-zoom { min-width: 72px; font-variant-numeric: tabular-nums; }
.heal-toolbar .btn.is-active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.batch-actions .btn.icon-only { flex: 0 0 auto; padding: 0 10px; }

/* Images ⇄ Video: cross-document view transition. Header and tab bar stay put; only the page body fades.
   Browsers without support simply navigate. */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
.mode-switch { view-transition-name: tool-tabs; }
::view-transition-old(root) { animation: 140ms ease-in both vt-fade-out; }
::view-transition-new(root) { animation: 220ms ease-out both vt-fade-in; }
::view-transition-group(site-header),
::view-transition-group(tool-tabs) { animation-duration: 180ms; }
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; transform: translateY(6px); } }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .features { grid-template-columns: repeat(2, 1fr); }
  .video-workspace { grid-template-columns: 1fr; }
  .video-panel { grid-column: 1; grid-row: auto; }
  /* Stacked layout: a sticky video would eat most of a phone screen. */
  .video-stage { position: static; }
}
@media (max-width: 720px) {
  .main-nav { margin-left: 0; }
  .nav-link span { display: none; }
  .nav-link { padding: 10px; }
  /* Keep the brand on one line next to the icon-only nav. */
  .header-inner { gap: 10px; }
  .brand { gap: 8px; min-width: 0; }
  .brand-name { font-size: .95rem; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .brand-mark { width: 28px; height: 28px; font-size: 14px; }
  .hero { padding: 36px 0 28px; }
  .steps, .features { grid-template-columns: 1fr; }
  .section { padding: 52px 0; }
  .dropzone { min-height: 240px; padding: 28px 16px; }
  .result-actions { width: 100%; }
  .result-actions .btn { flex: 1 1 auto; }
  .tool-card { padding: 8px; border-radius: 20px; }
  .heal-note { display: none; }
  .heal-top, .heal-toolbar { padding-left: 10px; padding-right: 10px; }
  .heal-toolbar { gap: 8px; }
  .heal-size { width: 100%; justify-content: center; }
  .heal-size input { flex: 1; width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
