:root {
  --bg: #0f1115;
  --panel: #1a1d24;
  --border: #2a2e38;
  --text: #e6e8ec;
  --muted: #9aa0ac;
  --accent: #6c8cff;
  --accent-h: #5a7bff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
header {
  padding: 24px 20px 8px;
  text-align: center;
}
header h1 { margin: 0; font-size: 26px; }
header .sub { color: var(--muted); margin: 4px 0 0; font-size: 14px; }
main {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
}
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.dropzone {
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone.drag { border-color: var(--accent); background: rgba(108,140,255,.08); }
.dropzone p { margin: 0; }
.thumbs { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.thumb {
  position: relative; width: 84px; height: 84px;
  border-radius: 8px; overflow: hidden; border: 1px solid var(--border);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .rm {
  position: absolute; top: 2px; right: 2px;
  background: rgba(0,0,0,.6); color: #fff; border: none;
  border-radius: 50%; width: 20px; height: 20px; cursor: pointer; font-size: 12px;
}
.thumb .spin {
  position: absolute; inset: 0; display: flex; align-items: center;
  justify-content: center; background: rgba(0,0,0,.5); font-size: 11px; color: #fff;
}
.grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px; margin-bottom: 12px;
}
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.full { margin-top: 4px; }
select, input, textarea {
  background: #11141a; color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font-size: 14px; font-family: inherit;
}
textarea { resize: vertical; }
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
.hidden { display: none !important; }
button.primary {
  background: var(--accent); color: #fff; border: none;
  border-radius: 8px; padding: 10px 22px; font-size: 15px;
  cursor: pointer; font-weight: 600;
}
button.primary:hover { background: var(--accent-h); }
button.primary:disabled { opacity: .5; cursor: not-allowed; }
.status { margin-left: 12px; color: var(--muted); font-size: 13px; }
.results { display: flex; flex-wrap: wrap; gap: 14px; }
.result-card {
  border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; width: 220px; background: #11141a;
}
.result-card img, .result-card video { width: 100%; display: block; }
.result-card .meta { padding: 8px 10px; display: flex; gap: 10px; font-size: 13px; }
.result-card a { color: var(--accent); text-decoration: none; }
.err { color: #ff7a7a; }

.tabs { display: flex; gap: 8px; margin-bottom: 4px; }
.tab {
  background: var(--panel); color: var(--muted);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 20px; font-size: 14px; cursor: pointer; font-weight: 600;
}
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.checks { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 4px; }
.chk { flex-direction: row; align-items: center; gap: 6px; color: var(--text); }
.chk input { width: auto; }

.hist-head { display: flex; align-items: center; justify-content: space-between; }
.hist-head h2 { margin: 0; }
button.ghost {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 12px; font-size: 12px; cursor: pointer;
}
button.ghost:hover { color: var(--text); border-color: var(--accent); }
.history { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
.hist-item {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 12px; background: #11141a;
}
.hist-top { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.hist-top .badge { font-weight: 600; }
.hist-top .time { margin-left: auto; }
.hist-prompt { font-size: 13px; margin: 8px 0; color: var(--text); word-break: break-word; }
.hist-media { display: flex; flex-wrap: wrap; gap: 8px; }
.hist-media img, .hist-media video { width: 140px; border-radius: 8px; display: block; }
.hist-actions { display: flex; gap: 8px; margin-top: 8px; }
