* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0e0e10;
  color: #ececec;
  margin: 0;
  padding: 0;
}
header {
  background: linear-gradient(90deg, #1a1a1f 0%, #232337 100%);
  padding: 24px 32px;
  border-bottom: 1px solid #2a2a30;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
header h1 { margin: 0; font-size: 24px; }
#status-bar { font-size: 13px; color: #9aa0a6; }
#status-bar .ok { color: #4ade80; }
#status-bar .bad { color: #f87171; }
main { max-width: 760px; margin: 32px auto; padding: 0 16px; }
.card {
  background: #1a1a1f;
  border: 1px solid #2a2a30;
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 18px;
  transition: opacity 0.2s;
}
.card.disabled { opacity: 0.45; pointer-events: none; }
.card h2 {
  margin: 0 0 14px 0;
  font-size: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.num {
  background: #6366f1;
  color: white;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
input[type="text"], textarea, select, input[type="file"] {
  width: 100%;
  background: #0e0e10;
  border: 1px solid #2a2a30;
  color: #ececec;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  margin: 6px 0 12px;
}
textarea { resize: vertical; }
label { font-size: 12px; color: #9aa0a6; display: block; margin-top: 8px; }
button {
  background: #6366f1;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  margin-top: 6px;
}
button:hover { background: #5258e0; }
button:disabled { background: #444; cursor: not-allowed; }
button.secondary { background: #2a2a30; color: #d6d6d6; }
button.secondary:hover { background: #3a3a44; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.section-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: #6b7280; margin: 0 0 8px; }
.toggle-bar { display: flex; gap: 6px; }
.toggle { background: #1a1a1f; color: #9aa0a6; padding: 9px 16px; border-radius: 8px; font-size: 13px; margin: 0; border: 2px solid #2a2a30; }
.toggle.active { color: #ececec; border-color: #6366f1; background: #1a1a2e; }
.toggle:hover { background: #2a2a30; color: #ececec; }
.tab-bar { display: flex; gap: 6px; border-bottom: 1px solid #2a2a30; margin-bottom: 14px; }
.tab { background: transparent; color: #9aa0a6; padding: 8px 14px; border-radius: 6px 6px 0 0; font-size: 13px; margin: 0; }
.tab.active { color: #ececec; border-bottom: 2px solid #6366f1; }
.tab-panel.hidden { display: none; }
#clip-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
#clip-grid .clip-option { position: relative; cursor: pointer; border: 2px solid transparent; border-radius: 8px; overflow: hidden; aspect-ratio: 16/10; background: #0e0e10; }
#clip-grid .clip-option img, #clip-grid .clip-option video { width: 100%; height: 100%; object-fit: cover; }
#clip-grid .clip-option.selected { border-color: #6366f1; }
#clip-grid .clip-option.selected::after { content: "✓"; position: absolute; top: 6px; right: 8px; background: #6366f1; color: white; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
#clip-grid .clip-option .label { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,.75)); color: white; font-size: 11px; padding: 16px 6px 6px; }
#clip-grid .clip-option .badge { position: absolute; top: 6px; left: 6px; background: rgba(99,102,241,.85); color: white; font-size: 10px; padding: 2px 6px; border-radius: 4px; }
.msg { font-size: 13px; color: #9aa0a6; margin-top: 8px; min-height: 16px; }
.msg.err { color: #f87171; }
.msg.ok { color: #4ade80; }
.msg.subtle { color: #6b7280; font-size: 11px; margin-top: 4px; }
.hidden { display: none; }
#image-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}
#image-grid .img-option {
  position: relative;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 16/10;
  background: #0e0e10;
}
#image-grid .img-option img { width: 100%; height: 100%; object-fit: cover; }
#image-grid .img-option.selected { border-color: #6366f1; }
#image-grid .img-option.selected::after {
  content: "✓";
  position: absolute;
  top: 6px;
  right: 8px;
  background: #6366f1;
  color: white;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
#extract-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
#extract-grid .clip-option { position: relative; cursor: pointer; border: 2px solid transparent; border-radius: 8px; overflow: hidden; aspect-ratio: 16/10; background: #0e0e10; }
#extract-grid .clip-option img, #extract-grid .clip-option video { width: 100%; height: 100%; object-fit: cover; }
#extract-grid .clip-option.selected { border-color: #6366f1; }
#extract-grid .clip-option.selected::after { content: "✓"; position: absolute; top: 6px; right: 8px; background: #6366f1; color: white; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
#extract-grid .clip-option .label { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(transparent, rgba(0,0,0,.75)); color: white; font-size: 11px; padding: 16px 6px 6px; }
#thumb-drop-zone {
  border: 2px dashed #2a2a30;
  border-radius: 10px;
  padding: 36px 16px;
  text-align: center;
  cursor: pointer;
  margin-top: 8px;
  transition: border-color 0.15s, background 0.15s;
  color: #9aa0a6;
}
#thumb-drop-zone:hover, #thumb-drop-zone.dragover {
  border-color: #6366f1;
  background: #1a1a2e;
  color: #ececec;
}
#thumb-drop-zone p { margin: 4px 0; }
#thumb-preview-box {
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
#thumb-img-sizer {
  width: 56.25%;  /* 720/1280 — exactly the square that the backend produces */
  height: 100%;
  flex-shrink: 0;
  overflow: hidden;
}
#thumb-preview-img { width: 100%; height: 100%; object-fit: cover; display: block; }
#video-preview { width: 100%; margin-top: 12px; border-radius: 8px; }
a { color: #818cf8; }
