:root {
  color-scheme: light;
  --ink: #17201b;
  --muted: #5d6862;
  --line: #d5ddd7;
  --paper: #f5f8f5;
  --panel: #ffffff;
  --green: #0d6b4f;
  --teal: #126d7b;
  --red: #9b2f2f;
  --amber: #8a5a00;
  --code: #101614;
}
* { box-sizing: border-box; }
html { min-width: 300px; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, input, select, textarea, .button { border-radius: 6px; }
button, .button {
  min-height: 40px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
button:hover, .button:hover { border-color: var(--green); }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { color: #fff; background: var(--green); border-color: var(--green); }
.danger { color: #fff; background: var(--red); border-color: var(--red); }
.topbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(14px, 3vw, 36px);
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; font-weight: 800; }
.mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 6px; color: #fff; background: var(--green); }
.topbar nav { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.topbar nav a { min-height: 36px; display: inline-flex; align-items: center; padding: 7px 10px; border: 1px solid var(--line); border-radius: 6px; color: inherit; text-decoration: none; font-size: 14px; font-weight: 700; }
.page-head { padding: 26px clamp(16px, 4vw, 48px) 20px; border-bottom: 1px solid var(--line); background: #fff; }
.page-head h1 { margin: 0; font-size: clamp(30px, 4vw, 48px); line-height: 1.05; letter-spacing: 0; }
.page-head p { margin: 10px 0 0; max-width: 780px; color: var(--muted); font-size: 17px; }
.tool-shell { display: grid; grid-template-columns: minmax(250px, 340px) minmax(0, 1fr); min-height: calc(100vh - 180px); }
.controls { padding: 22px clamp(16px, 3vw, 30px); background: #fff; border-right: 1px solid var(--line); }
.workspace { min-width: 0; padding: 22px clamp(16px, 3vw, 34px); }
.stack { display: grid; gap: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { min-width: 0; }
.grow { flex: 1 1 160px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 750; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
}
textarea { resize: vertical; min-height: 160px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; tab-size: 2; }
input[type="range"], input[type="checkbox"] { width: auto; padding: 0; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.status { min-height: 42px; padding: 10px 12px; border-left: 4px solid var(--teal); background: #edf5f5; color: #29464a; }
.status.error { border-color: var(--red); background: #faeeee; color: #6e2525; }
.status.warn { border-color: var(--amber); background: #fbf4e5; color: #654817; }
.output { border: 1px solid var(--line); background: #fff; min-height: 180px; padding: 14px; overflow: auto; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list > li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.badge { display: inline-flex; width: fit-content; padding: 2px 7px; border-radius: 999px; background: #e8f3ed; color: var(--green); font-size: 12px; font-weight: 800; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.canvas-wrap { overflow: auto; background-color: #e8ede9; background-image: linear-gradient(45deg, #d8dfda 25%, transparent 25%), linear-gradient(-45deg, #d8dfda 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d8dfda 75%), linear-gradient(-45deg, transparent 75%, #d8dfda 75%); background-size: 24px 24px; background-position: 0 0, 0 12px, 12px -12px, -12px 0; border: 1px solid var(--line); min-height: 320px; }
canvas { display: block; max-width: 100%; }
.code { color: #e5f2ea; background: var(--code); border-color: #26332d; }
footer { padding: 18px clamp(16px, 4vw, 48px); color: var(--muted); border-top: 1px solid var(--line); background: #fff; }
@media (max-width: 800px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar nav { justify-content: flex-start; }
  .tool-shell { grid-template-columns: 1fr; }
  .controls { border-right: 0; border-bottom: 1px solid var(--line); }
  .split { grid-template-columns: 1fr; }
}
