:root {
  color-scheme: dark;
  --bg: #1b1b1f;
  --panel: #242429;
  --border: #333338;
  --text: #e4e4ea;
  --muted: #9a9aa5;
  --accent: #3b6fd4;
  --accent-hover: #4c7ee0;
  --warning: #e8b339;
  --control-bg: #2a2a30;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, sans-serif;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

footer.toolbar {
  border-bottom: none;
  border-top: 1px solid var(--border);
}

.spacer {
  flex: 1;
}

.muted {
  color: var(--muted);
}

button,
select {
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--control-bg);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: #34343b;
}

button:disabled {
  color: var(--muted);
  cursor: default;
  opacity: 0.7;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 10px;
  min-height: 0;
}

.info-panel {
  background: var(--panel);
  border-radius: 8px;
  padding: 12px 16px;
}

.preview {
  flex: 1;
  min-height: 0;
  background: #101014;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
}

#previewCanvas {
  image-rendering: pixelated;
  max-width: 100%;
  max-height: 100%;
}

#statusText {
  max-width: 50vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#statusText.warning {
  color: var(--warning);
}

dialog {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px;
  width: 440px;
  max-width: calc(100vw - 32px);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

.dialog-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.dialog-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  width: 100%;
  margin: 0;
}
