/* =========================================================================
 * MKV to MP4 Converter — styles. Animated modern UI.
 * All motion disabled under prefers-reduced-motion.
 * ========================================================================= */
:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef1f8;
  --ink: #141a2e;
  --ink-soft: #4b5573;
  --ink-faint: #8a93ad;
  --line: #e2e7f2;
  --brand: #2563eb;
  --brand-2: #1e40af;
  --brand-soft: #e8eefc;
  --ok: #0f9d58;
  --ok-soft: #e5f6ec;
  --warn: #b45309;
  --warn-soft: #fef3e2;
  --err: #dc2626;
  --err-soft: #fdecec;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(20, 26, 46, 0.08);
  --shadow-lg: 0 18px 50px rgba(37, 99, 235, 0.16);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 10px;
  text-decoration: none; font-weight: 700; transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

/* ---------------- header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 800; font-size: 1.05rem; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: var(--shadow);
}
.brand-mark svg { width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2; }
.nav { display: flex; gap: 4px; }
.nav a {
  color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: 0.92rem;
  padding: 8px 12px; border-radius: 10px; transition: background 0.18s, color 0.18s;
}
.nav a:hover, .nav a:focus-visible { background: var(--surface-2); color: var(--ink); outline: none; }

/* ---------------- hero ----------------
   Compact by design: one line of headline + one line of promise, so the
   converter itself — dropzone + settings — is on the first screen. */
.hero {
  padding: 26px 0 10px;
  background:
    radial-gradient(600px 300px at 15% 0%, rgba(37, 99, 235, 0.10), transparent 60%),
    radial-gradient(700px 320px at 90% 10%, rgba(13, 148, 136, 0.10), transparent 60%);
}
.hero h1 {
  font-size: clamp(1.65rem, 3.4vw, 2.25rem);
  line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 6px; max-width: none;
}
.hero h1 .grad {
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { font-size: 1rem; color: var(--ink-soft); max-width: none; margin: 0 0 12px; }
.trust-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.trust-row li {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 11px; font-size: 0.82rem; font-weight: 600; color: var(--ink-soft);
  box-shadow: 0 2px 8px rgba(20, 26, 46, 0.05);
}
.trust-row .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }

/* ---------------- tool card ----------------
   Two columns on desktop: the action (dropzone + results) on the left,
   settings on the right — so the dropzone is visible without scrolling.
   Single column on mobile, action first, settings after. */
.tool-section { padding: 8px 0 32px; }
.tool-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 22px; box-shadow: var(--shadow-lg);
  padding: clamp(18px, 3vw, 28px);
}
.tool-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 24px; align-items: start; }
.tool-main { min-width: 0; }
.tool-side { min-width: 0; }
.tool-side .settings {
  background: #f5f8ff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px;
}
.step-title { font-weight: 800; margin: 0 0 10px; font-size: 1rem; }

/* settings */
.settings { border: 0; margin: 0 0 4px; padding: 0; }
.settings legend { font-weight: 800; margin-bottom: 10px; padding: 0; }
.format-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px; margin-bottom: 14px;
}
.format {
  position: relative; display: block; cursor: pointer;
  border: 2px solid var(--line); border-radius: var(--radius);
  padding: 14px 14px 12px; background: var(--surface);
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.format:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.format input { position: absolute; opacity: 0; pointer-events: none; }
.format .f-name { font-weight: 800; font-size: 1.05rem; display: block; }
.format .f-desc { font-size: 0.84rem; color: var(--ink-soft); margin-top: 2px; display: block; }
.format .f-check {
  position: absolute; top: 12px; right: 12px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--brand); display: none; place-items: center;
}
.format .f-check svg { width: 13px; height: 13px; stroke: #fff; stroke-width: 3; fill: none; }
.format:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.format:has(input:checked) .f-check { display: grid; }
.format:has(input:focus-visible) { outline: 3px solid rgba(37, 99, 235, 0.35); outline-offset: 2px; }

.setting-row { margin: 14px 0; }
.setting-row label { font-weight: 700; display: flex; justify-content: space-between; gap: 12px; }
.setting-row output { font-weight: 800; color: var(--brand); }
.setting-row input[type="range"] { width: 100%; accent-color: var(--brand); margin-top: 6px; }
.setting-note { font-size: 0.85rem; color: var(--ink-soft); margin: 4px 0 0; }
.setting-label { font-weight: 700; display: block; margin-bottom: 8px; }
.bg-choices { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.bg-choice {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
  font-weight: 600; font-size: 0.9rem; background: var(--surface);
}
.bg-choice input[type="radio"] { accent-color: var(--brand); }
.bg-choice input[type="color"] {
  width: 28px; height: 28px; padding: 0; border: 1px solid var(--line);
  border-radius: 8px; background: none; cursor: pointer;
}

/* dropzone */
.dropzone {
  border: 2px dashed #c9cfe0; border-radius: var(--radius);
  padding: 26px 20px; text-align: center; cursor: pointer;
  background: linear-gradient(180deg, #fbfbff, #f6f4ff);
  transition: border-color 0.2s, background 0.2s, transform 0.2s, box-shadow 0.2s;
}
.dropzone:hover, .dropzone:focus-visible { border-color: var(--brand); outline: none; box-shadow: var(--shadow); }
.dropzone.drag {
  border-color: var(--brand); background: var(--brand-soft);
  transform: scale(1.01); box-shadow: var(--shadow-lg);
  animation: dz-pulse 1.1s ease-in-out infinite;
}
@keyframes dz-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.22); }
  50% { box-shadow: 0 0 0 12px rgba(37, 99, 235, 0.0); }
}
.dz-icon { width: 52px; height: 52px; margin: 0 auto 8px; border-radius: 14px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.dz-icon svg { width: 28px; height: 28px; stroke: #fff; stroke-width: 2; fill: none; }
.dz-title { font-weight: 800; font-size: 1.08rem; margin: 0 0 4px; }
.dz-sub { color: var(--ink-soft); margin: 0 0 16px; font-size: 0.92rem; }
.decoder-state { font-size: 0.85rem; color: var(--ink-faint); margin: 10px 2px 0; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 12px; cursor: pointer;
  font: inherit; font-weight: 700; font-size: 0.92rem; text-decoration: none;
  padding: 10px 18px; transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35); }
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-small { padding: 7px 13px; font-size: 0.85rem; border-radius: 10px; }
.btn:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.4); outline-offset: 2px; }

/* file cards */
.file-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 12px; }
.file-card {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; background: var(--surface);
  animation: card-in 0.35s ease both;
}
.file-card:nth-child(2) { animation-delay: 0.05s; }
.file-card:nth-child(3) { animation-delay: 0.1s; }
.file-card:nth-child(4) { animation-delay: 0.15s; }
@keyframes card-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.file-card[data-status="done"] { border-color: #bfe6cd; background: linear-gradient(180deg, #f4fbf6, #fff); }
.file-card[data-status="error"] { border-color: #f3c1c1; background: linear-gradient(180deg, #fdf4f4, #fff); }
/* Converted-image preview: fixed, visible box beside the file details.
   Checkerboard behind the image so PNG transparency reads as transparent,
   not white. */
.fc-body { display: flex; gap: 16px; align-items: flex-start; margin-top: 12px; }
.fc-preview {
  margin: 0;
  position: relative; cursor: zoom-in;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #e8ebf2 25%, transparent 25%, transparent 75%, #e8ebf2 75%),
    linear-gradient(45deg, #e8ebf2 25%, transparent 25%, transparent 75%, #e8ebf2 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px;
  display: flex; flex-direction: column;
}
.fc-preview img { width: 100%; height: auto; object-fit: contain; display: block; }
.fc-preview:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.45); outline-offset: 2px; }
.fc-preview-hint {
  position: absolute; inset: 0 0 28px 0; display: grid; place-items: center;
  background: rgba(20, 26, 46, 0.55); color: #fff; font-weight: 700; font-size: 0.85rem;
  opacity: 0; transition: opacity 0.18s; pointer-events: none;
}
.fc-preview:hover .fc-preview-hint, .fc-preview:focus-visible .fc-preview-hint { opacity: 1; }
.fc-preview-cap {
  height: 28px; flex: none; display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.92); border-top: 1px solid var(--line);
  font-size: 0.78rem; font-weight: 700; color: var(--ink-soft);
}
.fc-info { flex: 1; min-width: 0; }
.fc-info .fc-result { margin-top: 2px; }
.fc-info .fc-note { margin-top: 8px; }
.fc-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.fc-name { font-weight: 700; overflow-wrap: anywhere; }
.fc-size { color: var(--ink-faint); font-size: 0.85rem; white-space: nowrap; }
.fc-wait { color: var(--ink-faint); font-size: 0.9rem; margin: 8px 0 0; }
.fc-error { color: var(--err); font-size: 0.92rem; margin: 8px 0 0; }
.fc-warn {
  background: var(--warn-soft); color: var(--warn); border-radius: 10px;
  font-size: 0.86rem; padding: 8px 11px; margin: 10px 0 0;
}
.fc-progress { display: flex; align-items: center; gap: 10px; margin-top: 10px; color: var(--ink-soft); font-weight: 600; font-size: 0.92rem; }
.fc-spinner {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  border: 3px solid var(--brand-soft); border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.fc-result { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.check {
  width: 26px; height: 26px; border-radius: 50%; background: var(--ok); color: #fff;
  display: inline-grid; place-items: center; font-weight: 800; font-size: 0.9rem; flex: none;
  animation: check-pop 0.35s ease both;
}
@keyframes check-pop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.fc-dims { color: var(--ink-soft); font-size: 0.9rem; }
.fc-after { font-weight: 800; }
.fc-pct { font-weight: 800; font-size: 0.9rem; color: var(--brand); }



 }
.fc-note { font-size: 0.86rem; color: var(--ink-soft); margin: 8px 0 0; }













/* Per-file exact-KB result line: green when met, amber best-effort when not. */


.fc-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }


.batch-bar {
  display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px;
}
.bb-text { font-weight: 700; }
.bb-text small { display: block; font-weight: 400; color: var(--ink-faint); font-size: 0.84rem; }
.bb-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* privacy */
.privacy { padding: 8px 0 44px; }
.privacy-card {
  background: linear-gradient(135deg, #171231, #2d1a63);
  color: #e8e4f7; border-radius: 22px; padding: clamp(22px, 3vw, 36px);
  box-shadow: var(--shadow-lg);
}
.privacy-card h2 { color: #fff; margin: 0 0 10px; font-size: 1.4rem; }
.privacy-card p { margin: 0 0 16px; }
.net-meter {
  display: inline-flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px; padding: 9px 16px; font-weight: 700; color: #fff;
}
.net-meter b { font-size: 1.15rem; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: #34d399; animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5); }
  50% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); }
}
.verify-steps { margin: 16px 0 0; padding-left: 20px; }
.verify-steps li { margin: 6px 0; }
kbd {
  background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 6px; padding: 1px 7px; font: inherit; font-size: 0.85em;
}
.tool-card kbd, .content kbd {
  background: var(--surface-2); border-color: var(--line); color: var(--ink);
}

/* content */
.content { padding: 20px 0 44px; }
.content h2 { font-size: 1.5rem; letter-spacing: -0.01em; margin: 0 0 12px; }
.content h3 { font-size: 1.08rem; margin: 26px 0 8px; }
.content p, .content li { color: var(--ink-soft); }
.content ol, .content ul { padding-left: 22px; }
.content li { margin: 6px 0; }
.prose-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 14px; }
.prose-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.prose-card h3 { margin: 0 0 6px; }
.prose-card p { margin: 0; font-size: 0.93rem; }

.faq details {
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 18px; margin: 10px 0;
}
.faq summary { font-weight: 700; cursor: pointer; }
.faq summary:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.35); outline-offset: 2px; border-radius: 6px; }
.faq details p { margin: 10px 0 2px; }

/* footer — one small, quiet line */
.site-footer { border-top: 1px solid var(--line); padding: 18px 0 26px; color: var(--ink-faint); font-size: 0.85rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; justify-content: space-between; }
.site-footer p { margin: 0; }
.site-footer .footer-note { color: var(--ink-faint); }

/* responsive */
@media (max-width: 860px) {
  .tool-layout { grid-template-columns: 1fr; }
  .tool-side .settings { padding: 14px 16px; }
}
@media (max-width: 640px) {
  .nav { display: none; }
  .hero { padding: 20px 0 8px; }
  .batch-bar { flex-direction: column; align-items: stretch; }
  .bb-actions { display: grid; grid-template-columns: 1fr; }
  .bb-actions .btn { width: 100%; }
  .fc-head { flex-direction: column; gap: 2px; }
  .fc-body { flex-direction: column; }
  .fc-preview { flex: none; width: 100%; height: auto; }
  .site-footer .wrap { flex-direction: column; gap: 2px; }
}

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

/* ---------------- mkv-to-mp4 additions (carried over) ---------------- */
/* Trim controls: two number inputs side by side, wrapping on narrow cards. */




/* Custom target-size slider row (hidden unless "Custom" is picked). */




/* File-card stage line + progress bar (HEIC cards use a spinner instead). */
.fc-stage { color: var(--ink-soft); font-weight: 600; font-size: 0.92rem; margin-top: 10px; }
.fc-stage[data-stage="done"] { color: var(--ok); }
.fc-stage[data-stage="error"] { color: var(--err); }
.progress-track { height: 8px; border-radius: 99px; background: var(--surface-2); margin-top: 8px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width 0.25s ease; }
.file-card[data-status="done"] .progress-fill { background: var(--ok); }
/* Converted-video preview: the MP4 plays natively in the card. */
/* File-card meta line + remove button (HEIC uses .fc-size instead of .fc-meta). */
.fc-meta { color: var(--ink-soft); font-size: 0.9rem; margin-top: 4px; overflow-wrap: anywhere; }
.fc-remove {
  flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-soft); font-size: 1.1rem; line-height: 1;
  cursor: pointer;
}
.fc-remove:hover { background: var(--err-soft); color: var(--err); border-color: #f3c1c1; }
@media (max-width: 640px) {  .fc-preview { max-width: none; }
}

/* ---------------- mkv-to-mp4 additions ---------------- */
/* Mode + quality choices: pill radios, wrapping on narrow cards. */
.mode-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.mode-choice { display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px;
  font-weight: 600; font-size: 0.9rem; background: var(--surface); }
.mode-choice input[type="radio"] { accent-color: var(--brand); }
.quality-choices { display: flex; flex-direction: column; gap: 6px; }
.quality-choice { font-weight: 600; cursor: pointer; display: flex; gap: 8px; align-items: baseline; }
.quality-choice input { accent-color: var(--brand); }
.quality-choice small { font-weight: 400; color: var(--ink-soft); }
/* Path badge shown on each done card (remux vs transcode). */
.fc-path { display: inline-block; font-weight: 800; font-size: 0.82rem; border-radius: 999px;
  padding: 3px 10px; background: var(--brand-soft); color: var(--brand-2); }
.fc-path.transcode { background: var(--warn-soft); color: var(--warn); }
/* File-card stage line + progress bar. */
.fc-stage { color: var(--ink-soft); font-weight: 600; font-size: 0.92rem; margin-top: 10px; }
.fc-stage[data-stage="done"] { color: var(--ok); }
.fc-stage[data-stage="error"] { color: var(--err); }
.progress-track { height: 8px; border-radius: 99px; background: var(--surface-2); margin-top: 8px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width 0.25s ease; }
.file-card[data-status="done"] .progress-fill { background: var(--ok); }
/* Converted-video preview: native <video> element, plays in the card. */
.fc-preview { flex: none; width: auto; height: auto; display: block;
  margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  background: #111; max-width: 480px; }
.fc-preview video { display: block; width: 100%; height: auto; max-height: 270px; background: #111; }
/* File-card meta line + remove button. */
.fc-meta { color: var(--ink-soft); font-size: 0.9rem; margin-top: 4px; overflow-wrap: anywhere; }
.fc-remove { flex: none; width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-soft); font-size: 1.1rem; line-height: 1; cursor: pointer; }
.fc-remove:hover { background: var(--err-soft); color: var(--err); border-color: #f3c1c1; }
@media (max-width: 640px) {
  .fc-preview { max-width: none; }
}
