:root {
  color-scheme: dark;
  --bg: #14161a;
  --panel: #1c1f25;
  --panel-2: #23272f;
  --line: #2e333c;
  --text: #e6e9ef;
  --muted: #8b93a1;
  --accent: #3b82f6;
  --ok: #34d399;
  --bad: #f87171;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Segoe UI", "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand { display: flex; align-items: baseline; gap: 10px; }
.brand strong { font-size: 16px; }
.tag { color: var(--muted); font-size: 12px; }
.top-actions { display: flex; gap: 8px; }

.layout {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  align-items: start;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

.panel { display: flex; flex-direction: column; gap: 12px; }

.group {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.group h2, .preview-head h2, .log-head h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: .4px;
  color: var(--muted);
  font-weight: 600;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

label.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 13px;
}

input[type="text"], input[type="number"], input[type="color"], select {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
  width: 100%;
}

input[type="color"] { padding: 2px; height: 32px; }
input[type="range"] { width: 100%; }
input[type="file"] { font-size: 12px; color: var(--muted); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }

.row { display: flex; gap: 8px; flex-wrap: wrap; }

button {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 12px;
  font: inherit;
  cursor: pointer;
}

button:hover { border-color: #3d4450; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.big { padding: 10px 22px; font-size: 15px; }
button.ghost { background: transparent; }

.desc { margin: 0; color: var(--muted); font-size: 12px; }

.work { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

.preview-wrap, .runbar, .log-head {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.preview-wrap { padding: 12px; display: flex; flex-direction: column; gap: 10px; }

.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.preview-head select { width: 260px; }

.canvas-box {
  background:
    linear-gradient(45deg, #1a1d23 25%, transparent 25%, transparent 75%, #1a1d23 75%),
    linear-gradient(45deg, #1a1d23 25%, #171a1f 25%, #171a1f 75%, #1a1d23 75%);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
  border-radius: 8px;
  padding: 10px;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

#preview { max-width: 100%; max-height: 60vh; }

.runbar { display: flex; align-items: center; gap: 14px; padding: 12px; }
.progress { flex: 1; height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
#bar { height: 100%; width: 0; background: var(--accent); transition: width .15s ease; }
#progressText { color: var(--muted); font-size: 12px; white-space: nowrap; }

.log-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; }
#okCount { color: var(--ok); }
#failCount { color: var(--bad); }

#log {
  margin: 0;
  height: 220px;
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font: 12px/1.6 ui-monospace, Consolas, "Cascadia Mono", monospace;
  white-space: pre-wrap;
  color: #c8cedb;
}
