:root {
  color-scheme: light dark;
  --bg: #fff;
  --surface: #fafafa;
  --border: #e0e0e0;
  --text: #1a1a1a;
  --muted: #6a6a6a;
  --error: #b22222;
  --warn:  #aa6600;
  --accent: #0969da;
  --accent-hover: #0860c4;
  --btn-bg: #0969da;
  --btn-bg-hover: #0860c4;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b22;
    --border: #30363d;
    --text: #e6edf3;
    --muted: #8b949e;
    --error: #f85149;
    --warn:  #d29922;
    --accent: #58a6ff;
    --accent-hover: #79b8ff;
    --btn-bg: #1f6feb;
    --btn-bg-hover: #388bfd;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--surface);
}
body { display: flex; flex-direction: column; }

header, footer {
  padding: 8px 16px;
  background: var(--bg);
}
header { display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border); }
header h1 { margin: 0; font-size: 16px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
header h1 img { display: block; height: 22px; width: auto; }
header h1 span { color: var(--muted); font-weight: 500; }
footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
}

.status {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}
.status.error { color: var(--error); border-color: currentColor; }

main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--border);
  min-height: 0;
}
section { display: flex; flex-direction: column; background: var(--bg); min-height: 0; }

.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 6px 12px; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.toolbar h2 { margin: 0; font-size: 13px; font-weight: 600; }
.toolbar label { display: inline-flex; align-items: center; gap: 6px; }

select, button {
  font: inherit; font-size: 13px;
  padding: 4px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
button {
  cursor: pointer; font-weight: 600;
  background: var(--btn-bg); color: #fff; border-color: var(--btn-bg);
}
button:hover:not(:disabled) { background: var(--btn-bg-hover); border-color: var(--btn-bg-hover); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

textarea, #out {
  flex: 1; margin: 0; padding: 12px;
  font-family: var(--mono); font-size: 13px; line-height: 1.5;
  border: 0;
}
textarea { width: 100%; outline: 0; resize: none; tab-size: 4; }
#out { overflow: auto; white-space: pre-wrap; word-break: break-word; }
#out .err    { color: var(--error); }
#out .stderr { color: var(--warn); }
#out .muted  { color: var(--muted); }

#timing { color: var(--muted); font-size: 12px; }

@media (max-width: 720px) {
  main { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
}
