:root {
  color-scheme: dark;
  --void: #08090d;
  --card: #0f1117;
  --cyan: #06b6d4;
  --violet: #8b5cf6;
  --amber: #f59e0b;
  --emerald: #10b981;
  --text: #e4e4e7;
  --muted: #a1a1aa;
  --faint: #71717a;
  --line: rgba(255, 255, 255, 0.08);
  --glass: rgba(15, 17, 23, 0.78);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { background: var(--void); }
html, body, button, input, select { font-family: Inter, ui-sans-serif, system-ui, sans-serif; }
body {
  margin: 0;
  color: var(--text);
  min-height: 100vh;
  background:
    radial-gradient(1100px 560px at 12% -10%, rgba(139, 92, 246, 0.16), transparent 56%),
    radial-gradient(900px 520px at 92% 6%, rgba(6, 182, 212, 0.12), transparent 54%),
    var(--void);
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--cyan); text-decoration: none; }
a:hover { color: #67e8f9; }

.grid-veil {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at 50% 0%, black 18%, transparent 74%);
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }

header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
}
.header-inner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 600;
}
.mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--cyan), var(--violet));
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
  color: var(--void);
  font-weight: 900;
}
nav { display: flex; gap: 20px; color: var(--faint); font-size: 14px; }
nav a { color: inherit; }
nav a:hover { color: #fff; }
.pill {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(6, 182, 212, 0.2);
  background: rgba(6, 182, 212, 0.1);
  color: #67e8f9;
  border-radius: 999px;
  padding: 4px 12px;
}

main { position: relative; z-index: 1; padding-bottom: 80px; }
.hero { padding: 64px 0 28px; max-width: 760px; }
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 18px;
}
.dot { width: 7px; height: 7px; border-radius: 99px; background: var(--emerald); box-shadow: 0 0 10px var(--emerald); }
h1 {
  margin: 0;
  color: #fff;
  font-size: clamp(2.1rem, 5vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  font-weight: 800;
}
.lede { margin: 18px 0 0; color: var(--muted); font-size: 1.05rem; line-height: 1.7; max-width: 640px; }
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  color: var(--muted);
}
.badge.emph {
  border-color: rgba(6, 182, 212, 0.28);
  color: #a5f3fc;
  background: rgba(6, 182, 212, 0.08);
}

.banner {
  margin: 8px 0 16px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.08);
  color: #fde68a;
  font-size: 14px;
}
.error {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(244, 63, 94, 0.28);
  background: rgba(244, 63, 94, 0.08);
  color: #fecdd3;
  font-size: 14px;
}

.dropzone {
  margin-top: 12px;
  min-height: 280px;
  border-radius: 28px;
  padding: 36px 28px;
  text-align: center;
  background:
    linear-gradient(#0f1117, #0f1117) padding-box,
    linear-gradient(120deg, rgba(139,92,246,.55), rgba(6,182,212,.7), rgba(139,92,246,.4)) border-box;
  border: 1px solid transparent;
  box-shadow: 0 24px 80px rgba(0,0,0,.35);
}
.dropzone.hot {
  box-shadow: 0 0 0 1px rgba(6,182,212,.7), 0 0 48px rgba(139,92,246,.28), inset 0 0 48px rgba(6,182,212,.08);
  transform: scale(1.005);
}
.dropzone.disabled { opacity: 0.55; pointer-events: none; }
.drop-ico {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(139,92,246,.2), rgba(6,182,212,.12));
  color: #a5f3fc;
  font-size: 22px;
}
.dropzone h2 { margin: 0; color: #fff; font-size: 1.45rem; }
.dropzone p { color: var(--faint); margin: 8px 0 18px; }
.ghost, .primary, .danger, .quiet {
  border-radius: 999px;
  padding: 10px 16px;
  border: 1px solid transparent;
}
.ghost {
  background: rgba(255,255,255,.05);
  border-color: var(--line);
  color: #fff;
}
.primary {
  background: linear-gradient(90deg, var(--cyan), #22d3ee);
  color: var(--void);
  font-weight: 700;
  box-shadow: 0 0 24px rgba(6, 182, 212, 0.28);
}
.danger {
  background: rgba(244, 63, 94, 0.12);
  border-color: rgba(244, 63, 94, 0.28);
  color: #fecdd3;
}
.quiet {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
}
.primary:disabled, .danger:disabled, .quiet:disabled { opacity: 0.45; cursor: not-allowed; }

.workstation {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 16px;
  margin-top: 8px;
}
.panel {
  border: 1px solid var(--line);
  background: rgba(15, 17, 23, 0.72);
  border-radius: 24px;
  padding: 18px;
  backdrop-filter: blur(16px);
}
.file-head { display: flex; gap: 14px; align-items: flex-start; }
.thumb-wrap {
  width: 148px;
  height: 84px;
  border-radius: 14px;
  overflow: hidden;
  background: #090b10;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.thumb-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-fallback { width: 100%; height: 100%; display: grid; place-items: center; color: var(--faint); font-size: 12px; }
.file-copy h3 { margin: 0; color: #fff; font-size: 16px; word-break: break-word; }
.file-copy p { margin: 6px 0 0; color: var(--faint); font-size: 13px; }
.file-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin-top: 16px;
}
.meta-grid div { min-width: 0; }
.meta-grid dt { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.meta-grid dd { margin: 3px 0 0; color: #fff; font-size: 14px; }

.presets { display: grid; grid-template-columns: 1fr; gap: 8px; }
.preset {
  display: block;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255,255,255,.02);
}
.preset:has(input:checked) {
  border-color: rgba(6, 182, 212, 0.4);
  background: rgba(6, 182, 212, 0.07);
  box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.15);
}
.preset input { accent-color: var(--cyan); margin-right: 8px; }
.preset b { color: #fff; }
.preset span { display: block; color: var(--faint); font-size: 12px; margin-top: 4px; margin-left: 22px; }

.row { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin: 12px 0; }
.row label { color: var(--muted); font-size: 13px; }
.row strong, .path { color: #fff; font-size: 13px; text-align: right; }
.path { font-variant-numeric: tabular-nums; }
.note { color: #fde68a; font-size: 12px; line-height: 1.5; margin: 0 0 10px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.adv-toggle, .caps-toggle {
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 10px 0 0;
}
.fields { display: grid; gap: 10px; margin-top: 10px; }
.field label { display: block; color: var(--faint); font-size: 12px; margin-bottom: 4px; }
.field select, .field input[type="number"], .field input[type="range"] {
  width: 100%;
  background: #090b10;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 10px;
}
.inline { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }

.progress {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.bar {
  height: 8px;
  border-radius: 99px;
  background: rgba(255,255,255,.06);
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  box-shadow: 0 0 16px rgba(6, 182, 212, 0.45);
}
.progress-top { display: flex; justify-content: space-between; margin-bottom: 8px; color: #fff; font-weight: 600; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 12px; font-size: 13px; }
.stats dt { color: var(--faint); }
.stats dd { margin: 2px 0 0; color: #fff; }

.result {
  margin-top: 16px;
  border: 1px solid rgba(16, 185, 129, 0.28);
  background: linear-gradient(180deg, rgba(16,185,129,.08), rgba(15,17,23,.6));
  border-radius: 22px;
  padding: 18px;
}
.result h3 { margin: 0 0 12px; color: #fff; }
.result-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.result-grid dt { color: var(--faint); font-size: 12px; }
.result-grid dd { margin: 2px 0 0; color: #fff; font-size: 18px; font-weight: 650; }
.result-grid dd.small { font-size: 14px; font-weight: 500; }
.privacy-chip {
  display: inline-flex;
  margin-top: 12px;
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.28);
  color: #6ee7b7;
  font-size: 12px;
  padding: 5px 10px;
}
.saved-directly {
  margin: 12px 0 0;
  color: #6ee7b7;
  font-size: 14px;
  font-weight: 600;
}

.capability { margin-top: 28px; }
.capability dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.capability dl div {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,.02);
}
.capability dt { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.capability dd { margin: 4px 0 0; color: #fff; }
.capability dd[data-yes="0"] { color: var(--muted); }

footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  color: var(--faint);
  font-size: 12px;
}
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

body[data-phase="empty"] .workstation,
body[data-phase="probing"] .workstation { display: none; }
body[data-phase="ready"] .hero,
body[data-phase="running"] .hero,
body[data-phase="done"] .hero { padding: 18px 0 8px; }
body[data-phase="ready"] .hero .lede,
body[data-phase="running"] .hero .lede,
body[data-phase="done"] .hero .lede,
body[data-phase="ready"] .dropzone,
body[data-phase="running"] .dropzone,
body[data-phase="done"] .dropzone { display: none; }
body[data-phase="ready"] h1,
body[data-phase="running"] h1,
body[data-phase="done"] h1 { font-size: 1.55rem; }
body[data-phase="empty"] .progress,
body[data-phase="ready"] .progress { display: none; }
body[data-phase="empty"] .result,
body[data-phase="ready"] .result,
body[data-phase="running"] .result { display: none; }
body[data-phase="running"] .presets,
body[data-phase="running"] .fields,
body[data-phase="done"] .presets { pointer-events: none; opacity: 0.55; }
body[data-phase="done"] #start { display: none; }
body[data-phase="done"] #save[hidden] { display: none !important; }

@media (max-width: 860px) {
  nav { display: none; }
  .workstation { grid-template-columns: 1fr; }
  .hero { padding-top: 36px; }
  .dropzone { min-height: 220px; padding: 28px 18px; }
  .file-head { flex-direction: column; }
  .thumb-wrap { width: 100%; height: 160px; }
  .result-grid dd { font-size: 16px; }
}
