:root {
  --bg: #101216;
  --surface: #1a1d23;
  --surface-2: #22262e;
  --border: #303540;
  --text: #f4f5f7;
  --muted: #8c939e;
  --accent: #4fd1c5;
  --danger: #e86a5c;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100vh;
  background: linear-gradient(180deg, #1b1e25, var(--bg));
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.topbar {
  max-width: 1120px;
  margin: 0 auto;
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 40px; height: 40px; display: grid; place-items: center;
  border: 1px solid var(--accent); border-radius: 10px;
  color: var(--accent); font-weight: 700; font-size: 12px;
}
h1, h2, p { margin: 0; }
h1 { font-size: 20px; }
.brand p { color: var(--muted); font-size: 11px; margin-top: 2px; }
.status, .eyebrow, .badge {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.status { color: var(--accent); font-size: 11px; }
.app-shell { width: min(100% - 32px, 920px); margin: 20px auto 60px; }
.tabs { display: flex; gap: 7px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }
.tab, .secondary-btn, .text-btn {
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); border-radius: 9px; padding: 9px 15px;
}
.tab.active { border-color: var(--accent); color: var(--accent); background: rgba(79,209,197,.08); }
.panel {
  border: 1px solid var(--border); border-radius: 14px;
  background: rgba(26,29,35,.88); padding: 18px;
  box-shadow: 0 12px 32px -20px #000;
}
.upload-panel { margin-bottom: 16px; }
.dropzone {
  width: 100%; min-height: 82px; display: flex; align-items: center;
  justify-content: center; gap: 12px; border: 1.5px dashed var(--border);
  border-radius: 11px; background: var(--surface-2); color: var(--text);
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); }
.dropzone strong, .dropzone small { display: block; }
.dropzone strong { font-size: 14px; }
.dropzone small { color: var(--muted); font-size: 11px; margin-top: 3px; }
.plus { color: var(--accent); font-size: 24px; }
#fileInput { display: none; }
.workspace { display: grid; gap: 16px; }
.hidden { display: none !important; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-head.compact { margin-bottom: 12px; }
.eyebrow { color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.panel-head h2 { font-size: 16px; margin-top: 3px; }
.badge { color: var(--muted); font-size: 10px; }
.canvas-wrap {
  min-height: 300px; display: grid; place-items: center; overflow: hidden;
  border: 1px solid var(--border); border-radius: 10px; background: #0d0f12;
}
#previewCanvas { max-width: 100%; max-height: 520px; display: block; }
.empty-preview { text-align: center; color: var(--muted); }
.empty-preview span { color: var(--accent); font-weight: 700; }
.empty-preview p { font-size: 11px; margin-top: 5px; }
.preview-controls { display: flex; gap: 8px; margin-top: 12px; }
.primary-btn {
  border: 0; border-radius: 9px; padding: 10px 15px;
  background: var(--accent); color: #08110f; font-weight: 700;
}
.primary-btn:disabled { opacity: .35; cursor: not-allowed; }
.secondary-btn:hover, .text-btn:hover { color: var(--text); border-color: var(--accent); }
.control-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.control-grid label { display: grid; gap: 7px; }
.control-grid label > span, .section-title { color: var(--muted); font-size: 11px; }
.control-grid b { float: right; color: var(--accent); font-weight: 500; }
select {
  width: 100%; padding: 9px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
input[type=range] { width: 100%; accent-color: var(--accent); }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.export-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 9px; }
.hint { color: var(--muted); font-size: 11px; line-height: 1.5; margin-top: 10px; }
.queue-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.queue-item {
  display: flex; align-items: center; gap: 10px; padding: 7px;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface-2);
}
.queue-item img { width: 46px; height: 46px; object-fit: cover; border-radius: 6px; }
.queue-info { min-width: 0; flex: 1; }
.queue-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.queue-meta { color: var(--muted); font-size: 10px; margin-top: 3px; }
.queue-item button { border: 0; background: transparent; color: var(--muted); }
footer {
  width: min(100% - 32px, 920px); margin: 0 auto 28px;
  display: flex; justify-content: space-between; color: var(--muted);
  font-size: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (max-width: 640px) {
  .topbar { padding: 16px; }
  .app-shell { width: min(100% - 20px, 920px); margin-top: 8px; }
  .control-grid { grid-template-columns: 1fr; }
  .canvas-wrap { min-height: 230px; }
}
