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

html[data-theme="dark"] {
  --bg: #000;
  --surface: #000;
  --code: #202020;
  --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;
  gap: 16px;
  padding: 0 16px;
  background: var(--topbar);
  border-bottom: 1px solid var(--line);
}

.dt-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.dt-logo { display: block; min-width: 0; }
.dt-logotop {
  width: 500px;
  max-width: 100%;
  height: auto !important;
  display: block;
}
.dt-title { color: var(--sub); font-weight: 700; white-space: nowrap; }
.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);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

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

.bc-shell {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

.bc-stage {
  flex: 1 1 auto;
  min-width: 0;
  order: 1;
}

.bc-panel {
  flex: 0 0 450px;
  width: 450px;
  order: 2;
}

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

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

.bc-panel h2 { margin-top: 16px; }

.bc-row {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.bc-row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.bc-row.compact { gap: 2px 10px; margin-top: 8px; }

label {
  display: block;
  font-size: 12px;
  font-weight: 700;
}

input[type="text"],
input[type="url"],
input[type="email"],
input[type="number"],
input[type="file"],
select,
textarea {
  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"] {
  width: 100%;
  margin-top: 6px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  padding: 2px;
}

input[type="range"] {
  width: 100%;
  margin-top: 6px;
}

textarea {
  min-height: 78px;
  resize: vertical;
  line-height: 1.35;
}

.bc-check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-weight: 600;
}

.bc-check input { margin: 0; flex: 0 0 auto; }
.bc-check span { min-width: 0; }

.bc-mini {
  display: inline-block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.bc-note {
  margin: 8px 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.bc-presets,
.bc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 12px;
}

.bc-presets button {
  padding: 7px 10px;
  font-size: 12px;
}

.bc-status {
  min-height: 22px;
  color: var(--good);
  font-weight: 700;
  margin: 10px 0 0;
}

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

.bc-preview-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.bc-preview-head p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

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

.bc-checker {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(45deg, rgba(127, 127, 127, .16) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(127, 127, 127, .16) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(127, 127, 127, .16) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(127, 127, 127, .16) 75%);
  background-size: 28px 28px;
  background-position: 0 0, 0 14px, 14px -14px, -14px 0;
}

.bc-preview-canvas {
  position: relative;
  z-index: 1;
  display: block;
  max-width: min(100%, 900px);
  max-height: 610px;
  width: auto;
  height: auto;
  image-rendering: auto;
}

.bc-checklist {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.bc-checklist ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 6px;
}

.bc-checklist li { color: var(--muted); }
.bc-checklist li.ok { color: var(--primary); }
.bc-checklist li.warn { color: var(--warn); }
.bc-checklist li.bad { color: var(--bad); }

@media (max-width: 980px) {
  .bc-shell { display: block; }
  .bc-panel {
    width: auto;
    margin-top: 16px;
  }
  .bc-preview-head {
    display: block;
  }
  .bc-preview-head p {
    text-align: left;
  }
}

@media (max-width: 720px) {
  .dt-topbar {
    height: auto;
    min-height: 88px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
  }
  .dt-title { white-space: normal; }
  .bc-row.two { grid-template-columns: 1fr; }
  .bc-preview-wrap { min-height: 420px; }
}
