:root {
  --bg: #0f1220;
  --panel: #171b2e;
  --panel2: #1e2338;
  --border: #2c3252;
  --text: #e8eaf5;
  --muted: #9aa2c3;
  --accent: #5b8cff;
  --accent2: #31c48d;
  --danger: #ff5b6a;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding: 16px;
}
h1 {
  font-size: 1.3rem;
  margin: 0 0 4px;
}
h3 {
  font-size: 0.95rem;
  margin: 0 0 8px;
  color: var(--muted);
  font-weight: 600;
}
p.sub {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}
.app {
  max-width: 1100px;
  margin: 0 auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.file-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}
.file-btn input {
  display: none;
}
button {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  font-weight: 600;
}
button.secondary {
  background: var(--panel2);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 500;
}
button.danger {
  background: var(--danger);
}
button.tiny {
  padding: 4px 9px;
  font-size: 0.78rem;
  border-radius: 6px;
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.status {
  font-size: 0.82rem;
  padding: 8px 10px;
  background: var(--panel2);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  color: var(--text);
  margin: 12px 0px;
}

.canvases-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.canvas-box {
  flex: 1 1 300px;
  min-width: 260px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.canvas-box.drag-over {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.35);
  background: #232a48;
}
.canvas-box canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  background: repeating-conic-gradient(#20243a 0% 25%, #191d30 0% 50%) 50% / 20px 20px;
  border-radius: 6px;
  cursor: grab;
  display: block;
  margin: 0 auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.hint {
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 6px;
  line-height: 1.5;
}

.zoom-toolbar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.zoom-label {
  font-size: 0.72rem;
  color: var(--muted);
  min-width: 46px;
  text-align: center;
}

.points-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}
.point-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 8px 4px 4px;
  font-size: 0.75rem;
}
.swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.point-chip button {
  background: transparent;
  color: var(--danger);
  border: none;
  padding: 0 4px;
  font-size: 0.85rem;
  line-height: 1;
  font-weight: 700;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}
input[type='range'] {
  flex: 1;
  max-width: 260px;
}

.result-box {
  text-align: center;
}
.result-box canvas {
  width: 100%;
  max-width: 900px;
  height: auto;
  background: #000;
  border-radius: 10px;
  border: 1px solid var(--border);
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
/* the full-resolution canvas is only used internally for compositing/export */
#resultCanvas {
  display: none;
}
.result-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.legend-steps {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
  padding-left: 18px;
}