.tool [hidden] { display: none !important; }
.tool button, .tool input { font-family: var(--font); }

.tool { --faint: #8e8e9a; padding-top: clamp(36px, 7vw, 72px); }
.tool-wrap { max-width: 780px; }
.tool .section-head p { color: var(--muted); font-size: clamp(15.5px, 1.8vw, 17px); margin: 14px 0 0; }

.steps { display: grid; gap: 14px; margin-top: 34px; }

.step {
  scroll-margin-top: 82px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
  padding: clamp(18px, 4vw, 26px); min-width: 0;
}
.step.is-current { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.step-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.step-head h3 { margin: 0; font-size: 17px; letter-spacing: -0.01em; flex: 1; min-width: 0; }
.step-num {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--ink); color: #0b0b0e; font-size: 13px; font-weight: 700; display: grid; place-items: center;
}
.step.is-done .step-num { background: rgba(61, 220, 132, 0.16); color: var(--ok); }
.step-sum { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50%; }
.step-body { margin-top: 18px; display: grid; gap: 14px; min-width: 0; }
.step-body > * { margin: 0; }

.fine { color: var(--faint); font-size: 13.5px; }
.fine a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.fine a:hover { color: var(--ink); }

.msg { padding: 12px 14px; border-radius: 12px; font-size: 14.5px; background: rgba(229, 50, 47, 0.1); color: #ffb3b0; border: 1px solid rgba(229, 50, 47, 0.32); }
.msg.ok { background: rgba(61, 220, 132, 0.08); color: var(--ok); border-color: rgba(61, 220, 132, 0.28); }
.msg a { text-decoration: underline; text-underline-offset: 2px; }
.tool .notice { margin-top: 0; }

.field-label { display: block; font-size: 13.5px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.key-box { padding: 8px 8px 8px 16px; }
.tool .key-input {
  flex: 1; min-width: 0; width: 100%; background: transparent; border: 0; outline: none; color: var(--ink);
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 17px; letter-spacing: 0.04em; padding: 10px 0;
}
.tool .key-input::placeholder { color: #4a4a55; }
.key-box:focus-within { border-color: rgba(255, 255, 255, 0.36); }
.tool .btn { min-height: 48px; justify-content: center; }
.tool .btn[disabled] { opacity: 0.5; cursor: default; }
.tool .btn[disabled]:active { transform: none; }
.btn.wide { width: 100%; }

.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  min-height: 150px; padding: 22px 16px; border: 1.5px dashed var(--line-strong); border-radius: 16px;
  background: var(--card-2); cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.drop:hover, .drop.is-over { border-color: rgba(255, 255, 255, 0.4); background: #1a1a20; }
.drop:focus-within { border-color: rgba(255, 255, 255, 0.5); }
.drop.is-off { opacity: 0.5; cursor: default; pointer-events: none; }
.drop > * { pointer-events: none; }
.drop svg { width: 30px; height: 30px; stroke: var(--muted); margin-bottom: 4px; }
.drop-main { font-weight: 600; font-size: 16px; }
.drop-sub { color: var(--faint); font-size: 13.5px; }
.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; }

.clip-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: var(--card-2); min-width: 0; }
.clip-name { font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.clip-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 12px 0 0; }
.clip-facts div { min-width: 0; }
.clip-facts dt { color: var(--faint); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.clip-facts dd { margin: 3px 0 0; font-size: 14.5px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.sizes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.size-opt {
  position: relative; display: flex; flex-direction: column; gap: 3px; padding: 14px 16px; min-height: 76px;
  border: 1px solid var(--line-strong); border-radius: 14px; background: var(--card-2); cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.size-opt input { position: absolute; opacity: 0; pointer-events: none; }
.size-opt:has(input:checked) { border-color: var(--ink); background: #1c1c23; }
.size-opt.is-on { border-color: var(--ink); background: #1c1c23; }
.size-opt:focus-within { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.14); }
.size-title { font-weight: 700; font-size: 15.5px; }
.size-dim { color: var(--muted); font-size: 13.5px; font-variant-numeric: tabular-nums; }
.size-eta { color: var(--faint); font-size: 13px; min-height: 1.2em; }

.plan { font-size: 15px; }
.notes { list-style: none; padding: 0; display: grid; gap: 6px; color: var(--muted); font-size: 14px; }
.notes li { position: relative; padding-left: 16px; }
.notes li::before { content: ""; position: absolute; left: 2px; top: 0.62em; width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }

.bar { height: 8px; border-radius: var(--pill); background: #24242c; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width 0.25s ease; }
.bar.is-busy span { width: 35% !important; animation: slide 1.3s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14.5px; }
.row span:last-child { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.loader { display: grid; gap: 9px; }
.eta { min-height: 1.55em; }

.preview { display: grid; gap: 10px; }
.preview canvas, .result-video {
  display: block; width: 100%; height: auto; border-radius: 14px; background: #000; border: 1px solid var(--line);
}
.result-video { max-height: 70vh; }
.seg { display: inline-flex; padding: 3px; gap: 3px; border-radius: var(--pill); background: var(--card-2); border: 1px solid var(--line); justify-self: start; }
.seg button {
  min-height: 44px; padding: 0 18px; border: 0; border-radius: var(--pill); background: transparent; color: var(--muted);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: #0b0b0e; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions .btn { flex: 1 1 180px; }

.compare-block { display: grid; gap: 10px; }
.compare-block h4 { margin: 0; font-size: 15px; }
.tool .compare { max-width: none; aspect-ratio: auto; }
.tool .compare canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.tool .compare .after-pane canvas { width: auto; max-width: none; }
.tool .compare .lbl { bottom: 10px; }

@media (max-width: 640px) {
  .tool-wrap { padding-left: 16px; padding-right: 16px; }
  .clip-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .key-box { flex-direction: column; align-items: stretch; padding: 10px; gap: 10px; }
  .tool .key-input { font-size: 16px; padding: 8px 6px; text-align: center; }
  .key-box .btn { width: 100%; }
  .sizes { grid-template-columns: 1fr 1fr; gap: 8px; }
  .size-opt { padding: 12px; }
  .step-sum { max-width: 40%; }
}
@media (prefers-reduced-motion: reduce) {
  .bar span { transition: none; }
  .bar.is-busy span { animation: none; width: 100% !important; opacity: 0.4; }
}
