:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --code: #ffffff;
  --line: rgba(0, 0, 0, .12);
  --text: #111827;
  --sub: #856259;
  --topbar: #ffffff;
  --primary: #fa9403;
  --muted: #667085;
}

html[data-theme="dark"] {
  --bg: #000;
  --surface: #000;
  --code: #444;
  --line: rgba(255, 255, 255, .16);
  --text: #e5e7eb;
  --sub: #d9b8a0;
  --topbar: #000;
  --muted: #9ca3af;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; color: var(--text); background: var(--bg); }

.dt-topbar {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  background: var(--topbar);
  border-bottom: 1px solid var(--line);
}
.dt-brand { display: flex; align-items: center; gap: 12px; }
.dt-logotop { width: 500px; max-width: 100%; height: auto; display: block; }
.dt-title { color: var(--sub); font-weight: 700; }
.dt-actions { display: flex; gap: 8px; align-items: center; }

button,
.dt-secondary-btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 12px;
  font-weight: 700;
  cursor: pointer;
}
button:hover,
.dt-secondary-btn:hover { border-color: var(--primary); color: var(--primary); }

.dt-main { width: 100%; margin: 18px 0; padding: 0 14px 40px; }

.dl-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 16px;
  align-items: start;
}

.dl-stage,
.dl-panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  background: var(--surface);
}

.dl-panel {
  max-height: calc(100vh - 140px);
  overflow-y: auto;
}

.dl-panel h1,
.dl-panel h2 {
  margin: 0 0 10px;
  color: var(--sub);
  font-weight: 600;
}

.dl-stage h2 {
  margin: 0 0 10px;
  color: var(--sub);
  font-weight: 600;
}

.dl-preview-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  min-height: 600px;
}

.dl-line-host {
  width: 100%;
  height: 600px;
}

.dl-line-host svg {
  width: 100%;
  height: 100%;
  display: block;
}

.dl-row { display: grid; gap: 10px; margin-bottom: 12px; }
.dl-row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

label { display: block; font-size: 12px; font-weight: 700; }
input[type="range"] { width: 100%; margin-top: 6px; }
input[type="color"],
textarea,
select {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: var(--code);
  color: var(--text);
  font-size: 13px;
}
input[type="color"] { height: 38px; padding: 2px; }

textarea {
  min-height: 120px;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.dl-mini { display: inline-block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.dl-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 12px; }
.dl-feedback { min-height: 20px; color: #22c55e; font-weight: 700; margin: 8px 0 0; }

.dl-layers {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.dl-layer {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.dl-layer h3 {
  margin: 0 0 8px;
  color: var(--sub);
  font-size: 13px;
  font-weight: 700;
}

.dl-layer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.dl-layer-head h3 {
  margin: 0;
}

.dl-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  cursor: grab;
  user-select: none;
}

.dl-drag-handle:active {
  cursor: grabbing;
}

.dl-layer.dragging { opacity: .45; }
.dl-layer.drag-over { outline: 2px dashed var(--primary); outline-offset: 2px; }

.dl-presets-box { margin-top: 8px; }
.dl-preset-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.dl-preset {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 8px;
  text-align: left;
}
.dl-preset .swatch {
	width: 100%;
	height: auto;
	border-radius: 8px;
	border: 1px solid var(--line);
	overflow: hidden;
	margin-bottom: 6px;
}
.dl-preset .swatch svg { width: 100%; height: 100%; display: block; }
.dl-preset .name { font-size: 11px; font-weight: 700; }

@media (max-width: 1200px) {
  .dl-shell { grid-template-columns: 1fr; }
  .dl-panel { max-height: none; overflow: visible; }
}

@media (max-width: 760px) {
  .dl-row.two { grid-template-columns: 1fr; }
  .dl-preset-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dl-preview-wrap,
  .dl-line-host { min-height: 420px; height: 420px; }
}
