:root {
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-hover: #4338ca;
  --accent-soft: #eef2ff;
  --text: #0f172a;
  --text-soft: #475569;
  --muted: #94a3b8;
  --border: #e2e8f0;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --page: #f1f5f9;
  --ring: rgba(79, 70, 229, .25);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .06), 0 2px 4px rgba(15, 23, 42, .04);
}

* { box-sizing: border-box; }

html, body { background: var(--page); }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  max-width: 780px;
  margin: 0 auto;
  padding: 28px 18px 60px;
  color: var(--text);
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

/* ---------- brand ---------- */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding: 4px 2px;
}
.brand-mark {
  width: 44px; height: 44px;
  flex: 0 0 44px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
  box-shadow: 0 6px 16px -4px rgba(79, 70, 229, .45);
}
h1 {
  font-size: 22px;
  margin: 0;
  letter-spacing: -0.4px;
  font-weight: 700;
}
.tagline {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.45;
}

/* ---------- drop zone ---------- */
#drop {
  position: relative;
  border: 1.5px dashed var(--border);
  border-radius: 14px;
  padding: 26px 18px 22px;
  text-align: center;
  background: var(--surface);
  margin-bottom: 20px;
  transition: border-color .15s, background .15s, transform .15s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
}
#drop.over {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md), 0 0 0 4px var(--ring);
}
#drop.locked { opacity: .55; pointer-events: none; }
.drop-icon {
  color: var(--accent);
  margin-bottom: 8px;
  display: inline-flex;
}
#drop strong {
  display: block;
  font-size: 15px;
  margin-bottom: 2px;
  color: var(--text);
}
#drop > span {
  font-size: 13px;
  color: var(--text-soft);
}

.drop-btns {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.vh {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.fbtn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s, border-color .12s, transform .08s, box-shadow .12s;
}
.fbtn:hover { background: var(--surface-2); border-color: #cbd5e1; }
.fbtn:active { transform: translateY(1px); }
.fbtn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 4px 10px -2px rgba(79, 70, 229, .4);
}
.fbtn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

/* ---------- cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card > header {
  padding: 14px 18px 0;
}
.card > header h2 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
}
.num {
  display: inline-grid;
  place-items: center;
  width: 22px; height: 22px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}
.card > .body {
  padding: 12px 18px 18px;
}

/* ---------- form ---------- */
label {
  display: block;
  font-size: 12.5px;
  margin: 12px 0 5px;
  color: var(--text-soft);
  font-weight: 600;
}
.field-label { margin-top: 0; }

input[type=number], input[type=text], select {
  font-size: 14px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  width: 100%;
  font-family: inherit;
  transition: border-color .12s, box-shadow .12s;
}
input[type=number]:focus, input[type=text]:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--ring);
}
input[type=number] { max-width: 130px; }
input[type=number]:disabled, select:disabled, input:disabled {
  background: var(--surface-2);
  color: var(--muted);
  cursor: not-allowed;
}

input[type=range] {
  width: 100%;
  accent-color: var(--accent);
  margin-top: 4px;
}
input[type=color] {
  width: 52px; height: 38px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
}

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > div { flex: 1 1 140px; }

.radios { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 2px; }
.radios label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-weight: 500;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
}
.radios input { margin: 0; accent-color: var(--accent); }

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.5;
}

.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 700;
  margin-left: 4px;
}

/* ---------- buttons ---------- */
button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 14px;
  padding: 10px 18px;
  cursor: pointer;
  border-radius: 9px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-family: inherit;
  transition: background .12s, border-color .12s, transform .08s, box-shadow .12s;
  box-shadow: 0 4px 10px -2px rgba(79, 70, 229, .4);
}
button:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
button:active:not(:disabled) { transform: translateY(1px); }
button.secondary {
  background: #fff;
  color: var(--text-soft);
  border-color: var(--border);
  box-shadow: none;
}
button.secondary:hover:not(:disabled) {
  background: var(--surface-2);
  color: var(--text);
}
button:disabled {
  opacity: .5;
  cursor: not-allowed;
  box-shadow: none;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* ---------- progress + log ---------- */
#bar {
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 16px;
}
#fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent) 0%, #7c3aed 100%);
  transition: width .12s linear;
}
#log {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  white-space: pre-wrap;
  margin-top: 12px;
  color: var(--text-soft);
  min-height: 1.3em;
  word-break: break-word;
  background: var(--surface-2);
  padding: 10px 12px;
  border-radius: 9px;
  border: 1px solid var(--border);
}

/* ---------- estimate ---------- */
.estimate { font-size: 13.5px; color: var(--text-soft); line-height: 1.85; }
.estimate b { color: var(--text); }
.estimate .warn {
  display: inline-block;
  color: #b45309;
  background: #fffbeb;
  padding: 4px 9px;
  border-radius: 7px;
  margin-top: 6px;
  border: 1px solid #fde68a;
  font-size: 12.5px;
}

/* ---------- result ---------- */
.result-card > header h2 { color: var(--accent); }
video {
  width: 100%;
  margin-top: 4px;
  background: #000;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
}
a.dl {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 14px;
  font-weight: 600;
  color: #fff;
  font-size: 14px;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 9px;
  background: var(--accent);
  box-shadow: 0 4px 10px -2px rgba(79, 70, 229, .4);
  transition: background .12s, transform .08s;
}
a.dl:hover { background: var(--accent-hover); }
a.dl:active { transform: translateY(1px); }

.hidden { display: none !important; }

/* ---------- footer ---------- */
.foot {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin-top: 22px;
}

/* ---------- mobile ---------- */
@media (max-width: 520px) {
  body { padding: 20px 12px 40px; }
  h1 { font-size: 19px; }
  .brand-mark { width: 40px; height: 40px; flex-basis: 40px; }
  .drop-btns { flex-direction: column; }
  .fbtn { width: 100%; justify-content: center; }
  .card > header { padding: 13px 14px 0; }
  .card > .body { padding: 10px 14px 16px; }
  .actions { flex-direction: column; align-items: stretch; }
  button { width: 100%; justify-content: center; }
  a.dl { width: 100%; justify-content: center; }
}