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

html[data-theme="dark"] {
  --bg: #000000;
  --surface: #000000;
  --code: #151515;
  --line: rgba(255, 255, 255, .16);
  --text: #e5e7eb;
  --sub: #d9b8a0;
  --topbar: #000000;
  --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);
}

button,
input,
select {
  font: inherit;
}

.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;
  min-width: 0;
}

.dt-logo {
  display: block;
  min-width: 0;
}

.dt-logotop {
  width: 500px;
  max-width: 100%;
  height: auto;
  display: block;
}

.dt-title {
  color: var(--sub);
  font-weight: 700;
  white-space: nowrap;
}

.dt-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
}

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:not(:disabled),
.dt-secondary-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

button.primary {
  border-color: var(--primary);
  color: #ffffff;
  background: var(--primary);
}

button.primary:hover:not(:disabled) {
  border-color: var(--primary-dark);
  color: #ffffff;
  background: var(--primary-dark);
}

button:disabled {
  color: var(--muted);
  background: var(--code);
  cursor: not-allowed;
  opacity: .72;
}

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

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

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

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

.wf-panel {
  flex: 0 0 430px;
  width: 430px;
  order: 2;
}

.wf-stage-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.wf-stage-head h1,
.wf-panel h2,
.wf-code-block h2 {
  margin: 0 0 10px;
  color: var(--sub);
  font-weight: 600;
}

.wf-stage-head h1 {
  font-size: 28px;
  line-height: 1.1;
}

.wf-stage-head p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

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

.wf-panel h2:first-child {
  margin-top: 0;
}

.wf-code-block h2 {
  font-size: 16px;
}

.wf-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 11px;
  color: var(--primary);
  background: var(--surface);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.preview-toolbar {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--surface);
}

label,
.preview-toolbar label {
  display: block;
  font-size: 12px;
  font-weight: 700;
}

.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 156px;
  margin-bottom: 12px;
  padding: 20px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background:
    linear-gradient(to right, rgba(127, 127, 127, .08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(127, 127, 127, .08) 1px, transparent 1px),
    var(--code);
  background-size: 24px 24px, 24px 24px, auto;
  color: var(--text);
  text-align: center;
  cursor: pointer;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--primary);
  color: var(--primary);
}

.drop-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.drop-title {
  display: block;
  font-size: 20px;
  font-weight: 800;
}

.drop-meta {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.settings {
  display: grid;
  gap: 12px;
}

.settings label,
.preview-toolbar label {
  color: var(--text);
}

.settings label span {
  display: block;
}

.settings input,
.settings select,
.preview-toolbar input {
  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;
}

.settings input:focus,
.settings select:focus,
.preview-toolbar input:focus {
  outline: 2px solid rgba(250, 148, 3, .24);
  border-color: var(--primary);
}

.inline-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

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

.status.is-error {
  color: var(--danger);
}

.specimen {
  min-height: 600px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 34px;
  overflow: hidden;
  background:
    linear-gradient(to right, rgba(127, 127, 127, .08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(127, 127, 127, .08) 1px, transparent 1px),
    var(--surface);
  background-size: 24px 24px, 24px 24px, auto;
}

.sample-xl {
  margin: 0;
  font-size: 132px;
  line-height: .82;
  letter-spacing: 0;
}

.sample-title {
  margin: 30px 0 0;
  font-size: 46px;
  line-height: 1;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.sample-body {
  max-width: 760px;
  margin: 22px 0 0;
  color: var(--text);
  font-size: 28px;
  line-height: 1.25;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.glyph-row {
  display: grid;
  grid-template-columns: repeat(8, minmax(42px, 1fr));
  gap: 8px;
  margin-top: 30px;
}

.glyph-row span {
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 38px;
  line-height: 1;
}

.wf-code-block {
  margin-top: 14px;
}

.css-output {
  min-height: 176px;
  max-height: 280px;
  margin: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: var(--code);
  color: var(--text);
  font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@media (max-width: 1200px) {
  .wf-shell {
    display: block;
  }

  .wf-panel {
    width: auto;
    margin-top: 16px;
  }

  .specimen {
    min-height: 480px;
  }
}

@media (max-width: 720px) {
  .dt-title {
    display: none;
  }

  .dt-logotop {
    width: 320px;
  }

  .wf-stage-head,
  .preview-toolbar {
    display: block;
  }

  .wf-badge {
    margin-top: 12px;
  }

  .preview-toolbar label {
    margin-bottom: 8px;
  }

  .inline-fields,
  .actions {
    grid-template-columns: 1fr;
  }

  .specimen {
    min-height: 420px;
    padding: 20px;
  }

  .sample-xl {
    font-size: 82px;
  }

  .sample-title {
    font-size: 32px;
  }

  .sample-body {
    font-size: 22px;
  }

  .glyph-row {
    grid-template-columns: repeat(4, minmax(42px, 1fr));
  }
}

@media (max-width: 480px) {
  .dt-topbar {
    height: auto;
    min-height: 86px;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
  }

  .dt-logotop {
    width: 280px;
  }

  .dt-actions {
    width: 100%;
  }

  .dt-actions button {
    width: 100%;
  }
}
