: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; }

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

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

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

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

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

.tg-preview-wrap {
  position: relative;
  min-height: 600px;
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
}

.tg-preview-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to right, rgba(127, 127, 127, .12) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(127, 127, 127, .12) 1px, transparent 1px);
  background-size: 24px 24px;
}

.tg-preview-shape {
  position: relative;
  width: 260px;
  height: 180px;
  border-radius: 24px;
  background: #fa9403;
  box-shadow: 0 14px 40px -10px rgba(0, 0, 0, .24);
  transform-style: preserve-3d;
}

.tg-row { display: grid; gap: 10px; margin-bottom: 12px; }
.tg-row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tg-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
label { display: block; font-size: 12px; font-weight: 700; }
input[type="range"] { width: 100%; margin-top: 6px; }
select,
input[type="text"] {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
}
input[type="color"] {
  width: 100%;
  margin-top: 6px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 2px;
}

textarea {
  width: 100%;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 10px;
  min-height: 128px;
  resize: vertical;
  background: var(--code);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

.tg-preset-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.tg-preset {
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--surface);
	color: var(--text);
	padding: 29px 8px;
	text-align: left;
}
.tg-preset .swatch {
	height: 120px;
	border-radius: 10px;
	margin-bottom: 8px;
	background: #fa9403;
	width: 70%;
	margin: 0 auto 20px;
}
.tg-preset .name { font-size: 11px; font-weight: 700; }

.is-hidden { display: none !important; }

.tg-dropzone {
  width: 100%;
  margin-top: 6px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 14px 12px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  cursor: pointer;
}
.tg-dropzone:hover,
.tg-dropzone.dragover {
  border-color: var(--primary);
  color: var(--text);
}

@media (max-width: 1200px) {
  .tg-shell { grid-template-columns: 1fr; }
  .tg-preset-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .tg-row.two,
  .tg-grid,
  .tg-preset-list { grid-template-columns: 1fr; }
}
