* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

:root {
  --bg: #0d1117;
  --panel: #161c26;
  --panel-2: #1c2431;
  --border: #2a3444;
  --text: #e6ebf2;
  --muted: #8b98ab;
  --accent: #6d5cff;
  --accent-2: #9d8cff;
  --good: #3fcf8e;
}

body {
  background: radial-gradient(1200px 600px at 70% -10%, #1a2036 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: baseline;
  gap: 18px;
  flex-wrap: wrap;
  padding: 22px 32px;
}
.logo { font-size: 1.35rem; letter-spacing: .5px; }
.logo b { color: var(--accent-2); }
.logo-mark { color: var(--accent); }
.tagline { color: var(--muted); font-size: .85rem; }

main { flex: 1; width: 100%; max-width: 1100px; margin: 0 auto; padding: 12px 24px 48px; }

/* fullscreen studio mode once a video is loaded */
body.studio-mode main { max-width: none; padding: 4px 20px 24px; }
body.studio-mode .topbar { padding: 12px 24px; }
body.studio-mode .faq { display: none; }
body.studio-mode footer { display: none; }

/* drop zone */
#dropZone {
  margin: 8vh auto 0;
  max-width: 640px;
  border: 2px dashed var(--border);
  border-radius: 18px;
  padding: 64px 32px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .1s;
  background: rgba(255,255,255,.015);
}
#dropZone:hover, #dropZone.dragover {
  border-color: var(--accent);
  background: rgba(109,92,255,.06);
}
#dropZone.dragover { transform: scale(1.01); }
.drop-icon { font-size: 2.6rem; color: var(--accent-2); margin-bottom: 10px; }
.drop-title { font-size: 1.3rem; font-weight: 600; }
.drop-sub { color: var(--muted); margin-top: 8px; font-size: .9rem; }

/* studio layout */
.studio-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 860px) { .studio-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}
.preview-panel { display: flex; flex-direction: column; }
.controls-panel {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
}
.panel-title { font-weight: 600; margin-bottom: 14px; }
.panel-title .hint { color: var(--muted); font-weight: 400; font-size: .8rem; }

/* compare slider */
#compareWrap {
  position: relative;
  width: 100%;
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
  user-select: none;
  touch-action: none;
}
#compareWrap canvas { display: block; width: 100%; height: auto; }
#afterClip {
  position: absolute; inset: 0;
  overflow: hidden;
  width: 50%;
}
#afterClip canvas { width: auto; height: 100%; }
#compareHandle {
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: 0;
  cursor: ew-resize;
}
.handle-bar {
  position: absolute; top: 0; bottom: 0; left: -1px;
  width: 2px; background: rgba(255,255,255,.85);
}
.handle-knob {
  position: absolute; top: 50%; left: 0;
  transform: translate(-50%,-50%);
  width: 34px; height: 34px;
  border-radius: 50%;
  background: #fff; color: #222;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem;
  box-shadow: 0 2px 10px rgba(0,0,0,.5);
}
.tag {
  position: absolute; top: 10px;
  font-size: .7rem; letter-spacing: .5px;
  background: rgba(0,0,0,.55);
  padding: 3px 8px; border-radius: 6px;
  pointer-events: none;
}
.tag-left { left: 10px; }
.tag-right { right: 10px; }
.file-meta { color: var(--muted); font-size: .8rem; margin-top: 10px; }

/* controls */
.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.field-note { display: block; font-size: .75rem; color: var(--muted); margin-top: 6px; }
select {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: .9rem;
}
.sub-field { margin: -6px 0 16px 30px; }
.sub-field output { color: var(--accent-2); font-variant-numeric: tabular-nums; float: right; }

input[type="range"] {
  width: 100%;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--panel-2);
  border-radius: 4px;
  outline: none;
  margin: 8px 0 2px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--accent-2);
  cursor: pointer;
  border: none;
}
input[type="range"]::-moz-range-thumb {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--accent-2);
  cursor: pointer;
  border: none;
}

.check {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 2px 10px;
  align-items: center;
  margin-bottom: 14px;
  cursor: pointer;
}
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.check small { grid-column: 2; color: var(--muted); font-size: .75rem; }

.btn-primary {
  display: block;
  width: 100%;
  text-align: center;
  background: linear-gradient(135deg, var(--accent), #8a5cff);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  margin-top: 6px;
  transition: filter .15s, transform .1s;
}
.btn-primary:hover { filter: brightness(1.12); }
.btn-primary:active { transform: scale(.99); }
.btn-primary:disabled { filter: grayscale(.6) brightness(.7); cursor: default; }
.btn-download { background: linear-gradient(135deg, #2fae76, var(--good)); }

.btn-ghost {
  display: block;
  width: 100%;
  background: none;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  font-size: .85rem;
  cursor: pointer;
  margin-top: 10px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

/* progress */
#progressWrap { margin-top: 16px; }
.progress-track {
  height: 8px;
  background: var(--panel-2);
  border-radius: 6px;
  overflow: hidden;
}
#progressBar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .2s;
}
#progressLabel { color: var(--muted); font-size: .8rem; margin-top: 8px; }

#resultWrap { margin-top: 16px; }

#errorBox {
  max-width: 640px;
  margin: 24px auto;
  background: #2a1620;
  border: 1px solid #7c2d3e;
  color: #ffb4c0;
  border-radius: 10px;
  padding: 14px 18px;
  font-size: .9rem;
}

.faq { max-width: 720px; margin: 56px auto 0; color: var(--muted); font-size: .9rem; }
.faq h2 { color: var(--text); font-size: 1.05rem; margin-bottom: 10px; }
.faq p { margin-bottom: 10px; line-height: 1.55; }

footer {
  text-align: center;
  color: var(--muted);
  font-size: .75rem;
  padding: 20px;
}
