/* ---------------------------------------------------------------------------
   noupload.tools, a cool, quiet workbench with one dark console in it.
   The console is the signature element: it always shows the real ffmpeg
   command, and during a run it turns into ffmpeg's own status line.
--------------------------------------------------------------------------- */
:root {
  --field: #f2f5f8;
  --card: #ffffff;
  --ink: #0f1419;
  --muted: #5a6673;
  --rule: #dde4ec;
  --rule-soft: #eaeff5;
  --console: #101a2b;
  --console-line: #24344d;
  --console-text: #cfe0f5;
  --signal: #ff5f1f;
  --signal-ink: #cc3d00;
  --ok: #067a55;
  --bad: #c0322b;
  --sans: ui-sans-serif, "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --wrap: 1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--field);
  color: var(--ink);
  font: 400 16px/1.6 var(--sans);
  font-variant-numeric: tabular-nums slashed-zero;
}
a { color: var(--signal-ink); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; border-radius: 3px; }

h1, h2, h3 { letter-spacing: -0.025em; line-height: 1.12; margin: 0 0 .5rem; font-weight: 700; }
h1 { font-size: clamp(1.9rem, 1.3rem + 2.4vw, 2.9rem); }
h2 { font-size: 1.45rem; margin-top: 2.4rem; }
h3 { font-size: 1.1rem; margin-top: 1.6rem; }
p { margin: 0 0 1rem; }
code, pre, .mono { font-family: var(--mono); }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 20px; }
.muted { color: var(--muted); }

/* --- header --------------------------------------------------------------- */
.site {
  position: sticky; top: 0; z-index: 20;
  background: rgba(242, 245, 248, .88);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.site .wrap { display: flex; align-items: center; gap: 16px; min-height: 62px; flex-wrap: wrap; padding-top: 9px; padding-bottom: 9px; }
.brand {
  font: 700 1.05rem/1 var(--mono);
  letter-spacing: -.03em; color: var(--ink); text-decoration: none;
  display: flex; align-items: center; gap: 8px;
}
.brand .rec { width: 9px; height: 9px; border-radius: 50%; background: var(--signal); }
.site nav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.site nav a {
  font: 500 .9rem/1 var(--sans); color: var(--muted); text-decoration: none;
  padding: 8px 11px; border-radius: 7px;
}
.site nav a:hover, .site nav a[aria-current] { background: #e5ecf4; color: var(--ink); }
@media (max-width: 560px) {
  .site nav { margin-left: 0; width: 100%; gap: 2px; }
  .site nav a { padding: 7px 9px; font-size: .85rem; }
  .sticky { position: static; }
}

/* --- hero ----------------------------------------------------------------- */
.hero { padding: 56px 0 8px; }
.hero .eyebrow {
  font: 600 .74rem/1 var(--mono); letter-spacing: .13em; text-transform: uppercase;
  color: var(--signal-ink); margin-bottom: 18px;
}
.hero h1 { max-width: 21ch; font-size: clamp(2.2rem, 1.2rem + 4vw, 4rem); }
.hero p.lede { font-size: 1.15rem; color: var(--muted); max-width: 56ch; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 44px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; gap: 28px; } }

.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.badge {
  font: 500 .8rem/1 var(--mono); color: var(--muted);
  border: 1px solid var(--rule); background: var(--card);
  padding: 7px 10px; border-radius: 999px;
}

/* --- the console (signature element) -------------------------------------- */
.console {
  background: var(--console); color: var(--console-text);
  border-radius: 12px; overflow: hidden;
  box-shadow: 0 18px 40px -24px rgba(16, 26, 43, .8), 0 1px 0 rgba(255, 255, 255, .04) inset;
}
.console-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--console-line);
  font: 600 .72rem/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: #7b93b5;
}
.console-head .rec { width: 8px; height: 8px; border-radius: 50%; background: var(--signal); }
.console-head button {
  margin-left: auto; background: transparent; color: #7b93b5;
  border: 1px solid var(--console-line); border-radius: 6px;
  font: 600 .72rem/1 var(--mono); letter-spacing: .06em; padding: 6px 9px; cursor: pointer;
}
.console-head button:hover { color: #fff; border-color: #3d5a86; }
.console pre {
  margin: 0; padding: 14px 14px 16px;
  font: 400 12.5px/1.65 var(--mono);
  white-space: pre-wrap; word-break: break-word;
  max-height: 168px; overflow: auto;
}
.console pre::after {
  content: "▍"; color: var(--signal); margin-left: 2px;
  animation: blink 1.15s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.statline {
  display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap;
  padding: 10px 14px; border-top: 1px solid var(--console-line);
  font: 400 12.5px/1.5 var(--mono); color: #8fa7c6; min-height: 40px;
}
.statline .status.ok { color: #4ade9b; }
.statline .status.bad { color: #ff8a6a; }
.statline #stat { margin-left: auto; color: #6b83a5; }

.progress { height: 3px; background: var(--console-line); display: none; }
.progress.on { display: block; }
.progress .bar { height: 100%; width: 0; background: var(--signal); transition: width .25s linear; }

/* --- buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 .95rem/1 var(--sans); letter-spacing: -.01em;
  padding: 13px 20px; border-radius: 9px; border: 1px solid var(--rule);
  background: var(--card); color: var(--ink); text-decoration: none; cursor: pointer;
}
.btn:hover { border-color: #c6d2e0; color: var(--ink); }
.btn.primary { background: var(--signal); border-color: var(--signal); color: #fff; }
.btn.primary:hover { background: #e6500f; border-color: #e6500f; color: #fff; }
.btn.primary:disabled { background: #d8dfe8; border-color: #d8dfe8; color: #8b97a5; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.big { padding: 15px 26px; font-size: 1.02rem; }

/* --- tool page ------------------------------------------------------------ */
.tool { display: grid; grid-template-columns: 1fr 420px; gap: 32px; align-items: start; padding: 34px 0 8px; }
@media (max-width: 940px) { .tool { grid-template-columns: 1fr; gap: 24px; } }
.tool h1 { margin-bottom: .35rem; }
.tool .lede { color: var(--muted); font-size: 1.05rem; max-width: 60ch; }

.panel { background: var(--card); border: 1px solid var(--rule); border-radius: 12px; padding: 20px; }
.panel + .panel { margin-top: 16px; }
.panel-title {
  font: 600 .72rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 14px;
}

.drop {
  border: 2px dashed #c3d0e0; border-radius: 12px; background: #fbfcfe;
  padding: 34px 20px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--signal); background: #fff7f3; }
.drop.has-files { padding: 18px 20px; }
.drop .dropmsg { font-weight: 600; }
.drop .dropsub { color: var(--muted); font-size: .88rem; margin: 6px 0 0; }
.filelist { list-style: none; margin: 14px 0 0; padding: 0; text-align: left; }
.filerow {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--card);
  font-size: .88rem;
}
.filerow + .filerow { margin-top: 6px; }
.fname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fsize { margin-left: auto; color: var(--muted); font: 400 .8rem/1 var(--mono); white-space: nowrap; }
.iconbtn {
  border: 1px solid var(--rule); background: var(--card); color: var(--muted);
  width: 26px; height: 26px; border-radius: 6px; cursor: pointer; line-height: 1;
}
.iconbtn:hover { color: var(--ink); border-color: #c6d2e0; }

.extra { margin-top: 14px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.extra label.file { font-weight: 600; font-size: .92rem; }
.extra input[type=file] { font-size: .85rem; }
#extraname { font: 400 .8rem/1 var(--mono); color: var(--muted); }

.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.field .flag {
  font: 400 .72rem/1 var(--mono); color: var(--muted);
  background: var(--rule-soft); border-radius: 4px; padding: 3px 5px; margin-left: 6px;
}
.field input[type=text], .field input[type=number], .field select {
  width: 100%; padding: 10px 11px; font: 400 .95rem/1.2 var(--sans);
  border: 1px solid var(--rule); border-radius: 8px; background: var(--card); color: var(--ink);
}
.field input:focus, .field select:focus { border-color: var(--signal); outline: none; box-shadow: 0 0 0 3px rgba(255, 95, 31, .16); }
.field input[type=color] { width: 100%; height: 40px; padding: 3px; border: 1px solid var(--rule); border-radius: 8px; background: var(--card); }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type=range] { flex: 1; accent-color: var(--signal); }
.rangeval { font: 500 .85rem/1 var(--mono); min-width: 4ch; text-align: right; color: var(--muted); }
.field .hint { font-size: .8rem; color: var(--muted); margin: 6px 0 0; line-height: 1.45; }
.field-check { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; grid-column: 1 / -1; }
.field-check input { width: 17px; height: 17px; accent-color: var(--signal); margin: 0; }
.field-check label { margin: 0; font-weight: 500; }
.field-check .hint { flex-basis: 100%; margin: 0; }

.runbox { margin-top: 16px; }
.runnote { font-size: .84rem; color: var(--muted); margin: 8px 0 0; text-align: center; }
.sticky { position: sticky; top: 82px; }

.result { margin-top: 16px; }
.result:empty { margin: 0; }
.outhead { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.outhead strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
.preview { display: block; width: 100%; margin-top: 14px; border-radius: 9px; background: #000; }
img.preview { background: repeating-conic-gradient(#eef2f7 0 25%, #fff 0 50%) 50% / 18px 18px; }
audio.preview { background: none; }
.failnote { font-size: .88rem; color: var(--bad); margin: 0; }
.infoout pre {
  font: 400 12px/1.6 var(--mono); white-space: pre-wrap; word-break: break-word;
  background: var(--rule-soft); border-radius: 8px; padding: 12px; margin: 0; max-height: 420px; overflow: auto;
}

details.logwrap { margin-top: 14px; }
details.logwrap summary {
  cursor: pointer; font: 500 .82rem/1 var(--mono); color: var(--muted); padding: 6px 0;
}
details.logwrap pre {
  font: 400 11.5px/1.55 var(--mono); background: var(--console); color: #a9c0dd;
  padding: 12px; border-radius: 8px; max-height: 300px; overflow: auto;
  white-space: pre-wrap; word-break: break-word; margin: 8px 0 0;
}

.warnbar {
  display: flex; gap: 10px; align-items: flex-start;
  background: #fff4ec; border: 1px solid #ffd9c2; color: #8a3b12;
  border-radius: 9px; padding: 11px 13px; font-size: .88rem; margin-bottom: 16px;
}

/* --- tool grid ------------------------------------------------------------ */
.cat-head { display: flex; align-items: baseline; gap: 14px; margin: 46px 0 16px; }
.cat-head h2 { margin: 0; }
.cat-head p { margin: 0; color: var(--muted); font-size: .95rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 14px; }
.card {
  display: block; background: var(--card); border: 1px solid var(--rule); border-radius: 11px;
  padding: 17px 18px; text-decoration: none; color: var(--ink);
  transition: border-color .14s, transform .14s;
}
.card:hover { border-color: var(--signal); transform: translateY(-2px); color: var(--ink); }
.card strong { display: block; font-size: 1rem; letter-spacing: -.015em; }
.card p { margin: 6px 0 0; font-size: .87rem; color: var(--muted); line-height: 1.5; }

/* --- prose ---------------------------------------------------------------- */
.prose { max-width: 68ch; padding: 18px 0 10px; }
.prose ul, .prose ol { padding-left: 1.15rem; }
.prose li { margin-bottom: .45rem; }
.prose table { width: 100%; border-collapse: collapse; font-size: .92rem; margin: 1rem 0; }
.prose th, .prose td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--rule); }
.prose th { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); }
.prose code { background: var(--rule-soft); border-radius: 4px; padding: 2px 5px; font-size: .87em; }
.prose pre {
  background: var(--console); color: var(--console-text); padding: 14px; border-radius: 9px;
  overflow: auto; font-size: 12.5px; line-height: 1.6;
}
.prose pre code { background: none; padding: 0; color: inherit; }

.faq details {
  background: var(--card); border: 1px solid var(--rule); border-radius: 9px;
  padding: 13px 16px; margin-bottom: 9px;
}
.faq summary { cursor: pointer; font-weight: 600; font-size: .96rem; }
.faq details[open] summary { margin-bottom: .6rem; }
.faq p { margin: 0; color: var(--muted); font-size: .93rem; }

.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin: 14px 0 0; }
.related a {
  background: var(--card); border: 1px solid var(--rule); border-radius: 9px;
  padding: 12px 14px; text-decoration: none; color: var(--ink); font-size: .92rem; font-weight: 500;
}
.related a:hover { border-color: var(--signal); }

/* --- steps (how it works) -------------------------------------------------- */
.steps { list-style: none; counter-reset: s; padding: 0; margin: 22px 0 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.steps li { counter-increment: s; background: var(--card); border: 1px solid var(--rule); border-radius: 11px; padding: 17px 18px; }
.steps li::before {
  content: counter(s, decimal-leading-zero);
  display: block; font: 600 .74rem/1 var(--mono); color: var(--signal-ink); letter-spacing: .1em; margin-bottom: 9px;
}
.steps strong { display: block; margin-bottom: 4px; }
.steps p { margin: 0; font-size: .89rem; color: var(--muted); }

/* --- footer --------------------------------------------------------------- */
.site-foot { border-top: 1px solid var(--rule); margin-top: 64px; padding: 30px 0 44px; font-size: .88rem; color: var(--muted); }
.site-foot .cols { display: flex; gap: 34px; flex-wrap: wrap; justify-content: space-between; }
.site-foot a { color: var(--muted); text-decoration: none; }
.site-foot a:hover { color: var(--ink); text-decoration: underline; }
.site-foot nav { display: flex; gap: 16px; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
  .console pre::after { animation: none; }
}

/* --- caption editor -------------------------------------------------------- */
.editor { margin-top: 18px; }
.ed-stage { position: relative; background: #000; border-radius: 11px; overflow: hidden; }
.ed-media { display: block; width: 100%; max-height: 46vh; background: #000; }
.ed-overlay {
  position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center;
  padding: 0 6% 7%; pointer-events: none; text-align: center;
}
.ed-cap {
  font: 800 clamp(15px, 2.5vw, 30px)/1.25 var(--sans);
  color: #fff; letter-spacing: -.01em;
  text-shadow: 0 0 5px #000, 0 2px 5px #000, 0 0 2px #000;
}
.ed-cap b { font-weight: 800; }

.ed-bar { display: flex; align-items: center; gap: 12px; margin: 12px 0 8px; flex-wrap: wrap; }
.ed-play {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--rule);
  background: var(--card); color: var(--ink); cursor: pointer; font-size: .8rem; line-height: 1;
}
.ed-play:hover { border-color: var(--signal); }
.ed-time { font: 500 .85rem/1 var(--mono); color: var(--muted); min-width: 7ch; }
.ed-hint { font-size: .8rem; color: var(--muted); margin-left: auto; }

.ed-track {
  position: relative; height: 54px; background: var(--rule-soft);
  border: 1px solid var(--rule); border-radius: 9px; overflow: hidden; touch-action: none;
}
.ed-block {
  position: absolute; top: 7px; bottom: 7px;
  background: #dfe7f1; border: 1px solid #c2d0e2; border-radius: 6px;
  cursor: grab; overflow: hidden; touch-action: none; min-width: 6px;
}
.ed-block.on { background: #ffe3d3; border-color: var(--signal); }
.ed-block:active { cursor: grabbing; }
.ed-block-text {
  display: block; padding: 6px 9px; font: 500 .74rem/1.25 var(--sans);
  color: #3c4a5e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  pointer-events: none;
}
.ed-grip { position: absolute; top: 0; bottom: 0; width: 9px; cursor: ew-resize; }
.ed-grip.l { left: 0; } .ed-grip.r { right: 0; }
.ed-grip:hover { background: rgba(255, 95, 31, .35); }
.ed-playhead { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--signal); left: 0; pointer-events: none; z-index: 3; }

.ed-list { margin-top: 12px; max-height: 340px; overflow-y: auto; }
.ed-row {
  display: flex; align-items: center; gap: 7px; padding: 5px 6px;
  border-radius: 7px; border: 1px solid transparent;
}
.ed-row.on { background: #fff5ef; border-color: #ffd9c2; }
.ed-jump {
  font: 500 .74rem/1 var(--mono); color: var(--signal-ink); background: none;
  border: 0; cursor: pointer; padding: 5px 4px; min-width: 7ch; text-align: left;
}
.ed-jump:hover { text-decoration: underline; }
.ed-text {
  flex: 1; min-width: 0; padding: 7px 9px; font: 400 .9rem/1.2 var(--sans);
  border: 1px solid var(--rule); border-radius: 7px; background: var(--card); color: var(--ink);
}
.ed-text:focus { border-color: var(--signal); outline: none; box-shadow: 0 0 0 3px rgba(255, 95, 31, .14); }
.ed-stamp {
  width: 8ch; padding: 7px 6px; font: 400 .74rem/1.2 var(--mono); text-align: center;
  border: 1px solid var(--rule); border-radius: 7px; background: var(--card); color: var(--muted);
}
.ed-stamp:focus { border-color: var(--signal); outline: none; color: var(--ink); }
.ed-foot { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.ed-foot .btn { padding: 9px 14px; font-size: .85rem; }
.ed-count { font: 400 .8rem/1 var(--mono); color: var(--muted); margin-left: auto; }

@media (max-width: 620px) {
  .ed-hint { display: none; }
  .ed-row { flex-wrap: wrap; }
  .ed-text { flex-basis: 100%; order: 3; }
}

/* multi-select, rubber band, shortcut sheet */
.ed-small { padding: 6px 11px; font-size: .78rem; }
.ed-small:disabled { opacity: .45; cursor: not-allowed; }
.ed-band {
  position: absolute; top: 0; bottom: 0; z-index: 2; pointer-events: none;
  background: rgba(255, 95, 31, .16); border: 1px solid var(--signal); border-radius: 3px;
}
.ed-track:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.ed-block.on { background: #ffe3d3; border-color: var(--signal); box-shadow: 0 0 0 1px var(--signal) inset; }
.ed-keys {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 5px 18px;
  background: var(--card); border: 1px solid var(--rule); border-radius: 9px;
  padding: 13px 15px; margin-bottom: 10px;
}
.ed-keys div { display: flex; align-items: baseline; gap: 9px; font-size: .82rem; color: var(--muted); }
.ed-keys kbd {
  font: 600 .72rem/1 var(--mono); color: var(--ink);
  background: var(--rule-soft); border: 1px solid var(--rule); border-bottom-width: 2px;
  border-radius: 5px; padding: 4px 6px; white-space: nowrap; min-width: 5.5ch; text-align: center;
}
