:root {
  --bg: #0b1220;
  --card: #141e2e;
  --border: #243044;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --success: #22c55e;
  --error: #ef4444;
}

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

body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

header {
  padding: 2rem 1.5rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

header h1 { font-size: 1.75rem; font-weight: 700; }
.subtitle { color: var(--muted); margin-top: 0.25rem; }

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
}

.card h2 { font-size: 1.1rem; margin-bottom: 1rem; }
.card.error { border-color: var(--error); }

.hidden { display: none !important; }

.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  border: 2px dashed var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  transition: border-color 0.2s;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  color: var(--text);
}

.dropzone input { display: none; }

.options {
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.options label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; }

details { margin-bottom: 1rem; font-size: 0.875rem; color: var(--muted); }
details input { margin-top: 0.5rem; width: 100%; }

button, .btn {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
}

button:hover, .btn:hover { background: var(--accent-hover); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn.secondary:hover { border-color: var(--accent); }

.status-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.progress-bar {
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.3s;
}

#progress-text { font-size: 0.875rem; color: var(--muted); }

.downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

#preview {
  display: block;
  width: 100%;
  max-height: 540px;
  border-radius: 8px;
  background: #000;
  object-fit: contain;
}

.preview-block {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.preview-block h3 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.preview-block .hint {
  margin-bottom: 0.75rem;
}

.preview-error {
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: var(--error);
}

footer {
  text-align: center;
  padding: 1rem;
  font-size: 0.75rem;
  color: var(--muted);
}

.hint {
  font-size: 0.875rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.video-wrap {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1rem;
}

.video-wrap video {
  display: block;
  width: 100%;
  max-height: 480px;
  object-fit: contain;
}

#zone-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.video-wrap.zone-mode #zone-canvas {
  pointer-events: auto;
  cursor: crosshair;
}

.zone-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.zone-toolbar button {
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
}

.zone-toolbar button.active {
  background: #f59e0b;
}

.zone-toolbar button.active:hover {
  background: #d97706;
}

.zone-status {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--muted);
}

#start-btn {
  width: 100%;
}
