/* ── Reset & base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #0e1117;
  --surface:      #1a1d24;
  --border:       #2e3140;
  --accent:       #ff4b4b;
  --accent-hover: #e03c3c;
  --text:         #fafafa;
  --muted:        #9ca3af;
  --radius:       8px;
  --sidebar-w:    260px;
}

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

.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 2rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex-shrink: 0;
}

.sidebar h2 { font-size: 1.1rem; margin-bottom: 0.5rem; }

.sidebar label {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.15rem;
  display: block;
}

.sidebar select,
.sidebar input[type="range"] { width: 100%; margin-bottom: 0.5rem; }

.sidebar select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.4rem 0.6rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.sidebar input[type="range"] { accent-color: var(--accent); cursor: pointer; }

.sidebar hr { border: none; border-top: 1px solid var(--border); margin: 0.5rem 0; }

.radio-group { display: flex; flex-direction: column; gap: 0.4rem; }

.radio-group label {
  color: var(--text);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

.radio-group input[type="radio"] { accent-color: var(--accent); }

.content {
  flex: 1;
  padding: 2.5rem 3rem;
  max-width: 900px;
  position: relative;
}

header h1 { font-size: 2rem; margin-bottom: 0.25rem; }
.subtitle  { color: var(--muted); margin-bottom: 2rem; }

.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem 2rem;
  text-align: center;
  color: var(--muted);
  margin-bottom: 2rem;
  transition: border-color 0.2s;
}

.upload-area.dragover {
  border-color: var(--accent);
  background: rgba(255,75,75,0.05);
}

.hint { font-size: 0.8rem; color: var(--muted); margin-top: 0.5rem; }

/*  Buttons  */
.btn {
  display: inline-block;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.45rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 0.75rem;
  transition: background 0.2s, border-color 0.2s;
  text-decoration: none;
}

.btn:hover { background: var(--border); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
  margin-top: 1rem;
}

.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.result-img {
  display: block;
  max-width: 480px;      /* constrain portrait images/frames */
  width: 100%;
  border-radius: var(--radius);
  margin-top: 0.75rem;
  margin-bottom: 1.5rem;
}

#videoPreview {
  display: block;
  max-height: 400px;   /* cap height — width scales automatically */
  max-width: 100%;
  border-radius: var(--radius);
  background: #000;
  margin-bottom: 0.75rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.75rem;
  font-size: 0.9rem;
}

th {
  text-align: left;
  padding: 0.6rem 1rem;
  background: var(--surface);
  border-bottom: 2px solid var(--border);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

td {
  text-align: left;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
}

tr:hover td { background: var(--surface); }

h3 { margin: 1.5rem 0 0.25rem; font-size: 1.1rem; }

#spinner {
  position: fixed;
  inset: 0;
  background: rgba(14,17,23,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

#spinner[hidden] { display: none !important; }

.spinner-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 3rem;
  text-align: center;
}

.spinner-ring {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin { to { transform: rotate(360deg); } }

/*  Responsive  */
@media (max-width: 768px) {
  body { flex-direction: column; }
  .sidebar { width: 100%; min-height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .content { padding: 1.5rem; }
}