:root {
  --bg: #1b1c1f;
  --panel: #232428;
  --panel-2: #2b2c31;
  --border: #38393f;
  --text: #e8e8ea;
  --text-dim: #9a9ba3;
  --accent: #d98c4a;
  --accent-text: #1b1c1f;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
}

.app { display: flex; flex-direction: column; height: 100vh; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.topbar-title { font-weight: 600; font-size: 14px; margin-right: 16px; }

#preset-select { margin-right: auto; min-width: 160px; }

.topbar-actions { display: flex; gap: 8px; }

.btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }

.main { flex: 1; display: flex; min-height: 0; }

.sidebar {
  width: 340px;
  flex: 0 0 340px;
  overflow-y: auto;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 14px;
}

.preview-pane {
  flex: 1;
  overflow: auto;
  background: #444;
  display: flex;
  justify-content: center;
  padding: 24px;
}

#preview {
  width: 8.5in;
  height: 11in;
  border: none;
  background: white;
  box-shadow: 0 4px 24px rgba(0,0,0,0.4);
  flex: 0 0 auto;
}

.section {
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.section-head {
  padding: 9px 12px;
  background: var(--panel-2);
  cursor: pointer;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.section-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.section.collapsed .section-body { display: none; }

.field label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.field input[type="text"],
.field textarea,
.field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 8px;
  border-radius: 5px;
  font-size: 12.5px;
  font-family: inherit;
}

.field textarea { resize: vertical; min-height: 50px; }

.field-row { display: flex; gap: 8px; }
.field-row .field { flex: 1; }

.range-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.range-row input[type="range"] { flex: 1; }
.range-value { width: 42px; text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.stat-row, .pack-row {
  display: flex;
  gap: 6px;
  align-items: center;
}
.stat-row input, .pack-row input { flex: 1; }
.row-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  padding: 2px 6px;
}
.row-remove:hover { color: #e0645a; }

.add-row {
  align-self: flex-start;
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-dim);
  padding: 5px 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
}
.add-row:hover { border-color: var(--accent); color: var(--text); }

.image-preview {
  width: 100%;
  height: 90px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  overflow: hidden;
  margin-bottom: 8px;
}
.image-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.image-preview.empty { color: var(--text-dim); font-size: 11px; }

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.checkbox-row label { margin: 0; text-transform: none; font-size: 12.5px; color: var(--text); }

.custom-font-row { display: flex; gap: 6px; margin-top: 6px; }
.custom-font-row input { flex: 1; }
.custom-font-row button { flex: 0 0 auto; }

.accent-item {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 14px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.accent-item:last-of-type { border-bottom: none; }

.dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.dpad-row { display: flex; gap: 4px; }
.dpad .btn { width: 32px; padding: 4px 0; text-align: center; }

.logo-thumbs {
  display: flex;
  gap: 8px;
}
.logo-thumb {
  flex: 1;
  cursor: pointer;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.logo-thumb:hover { border-color: var(--text-dim); }
.logo-thumb.selected { border-color: var(--accent); background: var(--panel-2); }
.logo-thumb-img {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
}
.logo-thumb-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-thumb span { font-size: 10px; color: var(--text-dim); line-height: 1.2; }

.color-row { display: flex; gap: 6px; align-items: center; }
.color-row input[type="color"] { width: 36px; height: 30px; padding: 2px; flex: 0 0 auto; background: var(--bg); border: 1px solid var(--border); border-radius: 5px; }
.color-row input[type="text"] { flex: 1; }

.subsection {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.subsection-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.subsection-head input[type="text"] { flex: 1; font-weight: 600; }

.density-note { font-size: 11px; color: var(--text-dim); padding: 2px 2px 6px; line-height: 1.4; }
.density-note.warn { color: #e0a04a; }

.coming-soon {
  padding: 16px 4px;
  color: var(--text-dim);
  font-size: 12.5px;
  line-height: 1.5;
}
