:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --surface-subtle: #f5f3ef;
  --border: #e5e3df;
  --text: #0a0a0a;
  --muted: #5c6068;
  --blue: #1d4ed8;
  --accent: #c2410c;
  --accent-hover: #9a3412;
  --ok: #15803d;
  --err: #b91c1c;
}

:root[data-theme="dark"] {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface-subtle: #1a1a1a;
  --border: #27272a;
  --text: #fafafa;
  --muted: #a1a1aa;
  --blue: #60a5fa;
  --accent: #f97316;
  --accent-hover: #ea580c;
  --ok: #4ade80;
  --err: #f87171;
}

* { box-sizing: border-box; }

html {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 15% 0%, rgba(29, 78, 216, 0.09), transparent 28rem),
    var(--bg);
  color: var(--text);
}

a { color: inherit; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: rgba(250, 250, 248, 0.92);
  backdrop-filter: blur(12px);
}

.header-inner {
  width: min(100% - 2rem, 72rem);
  min-height: 4rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  font-size: 1.05rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.brand span { color: var(--blue); }

nav {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

nav a {
  padding: 0.5rem 0.7rem;
  border-radius: 0.5rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

nav a:hover {
  background: var(--surface-subtle);
  color: var(--text);
}

main {
  width: min(100% - 2rem, 72rem);
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.intro {
  max-width: 48rem;
  margin-bottom: 2rem;
}

.eyebrow {
  display: inline-flex;
  padding: 0.3rem 0.65rem;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--border));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1 {
  margin: 1rem 0 0;
  font-size: clamp(2.1rem, 7vw, 4rem);
  line-height: 1.03;
  letter-spacing: -0.045em;
}

.intro p {
  max-width: 42rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.workspace {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface);
  box-shadow: 0 18px 48px rgba(10, 10, 10, 0.06);
}

.toolbar {
  min-height: 4rem;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.toolbar label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

select,
button {
  min-height: 2.5rem;
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--surface);
  color: var(--text);
  padding: 0.45rem 0.8rem;
  font: inherit;
  font-size: 0.9rem;
}

select:focus-visible,
button:focus-visible,
textarea:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 30%, transparent);
  outline-offset: 2px;
}

button {
  cursor: pointer;
  font-weight: 700;
}

button:disabled {
  cursor: default;
  opacity: 0.5;
}

#run {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

#run:not(:disabled):hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

#status {
  margin-left: auto;
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
}

#status.ok { color: var(--ok); }
#status.err { color: var(--err); }

.panes {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.pane {
  min-width: 0;
  padding: 1rem;
}

.pane + .pane {
  border-left: 1px solid var(--border);
}

.pane-heading {
  min-height: 2rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.pane-heading h2 {
  margin: 0;
  color: var(--text);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pane-heading span {
  color: var(--muted);
  font-size: 0.72rem;
}

textarea,
pre {
  width: 100%;
  min-height: 27rem;
  margin: 0.45rem 0 0;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: #111318;
  color: #f4f4f5;
  padding: 1rem;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.86rem;
  line-height: 1.55;
  tab-size: 4;
}

textarea {
  resize: vertical;
}

pre {
  overflow: auto;
  white-space: pre-wrap;
}

pre.err {
  border-color: color-mix(in srgb, var(--err) 65%, #111318);
  color: #fca5a5;
}

.scope-note,
.about {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  padding: 1rem 1.1rem;
  color: var(--muted);
  line-height: 1.65;
}

.scope-note strong { color: var(--text); }
.scope-note p { margin: 0.35rem 0 0; }

.about summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
}

.about p { margin-bottom: 0; }

.about a {
  color: var(--accent);
  font-weight: 650;
}

code {
  padding: 0.1rem 0.3rem;
  border-radius: 0.3rem;
  background: var(--surface-subtle);
  color: var(--text);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

footer {
  width: min(100% - 2rem, 72rem);
  margin: 0 auto;
  padding: 1.5rem 0 2rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.8rem;
}

footer a {
  color: var(--text);
  text-decoration: none;
}

@media (max-width: 800px) {
  main { padding-top: 2rem; }

  .panes {
    grid-template-columns: 1fr;
  }

  .pane + .pane {
    border-left: 0;
    border-top: 1px solid var(--border);
  }

  #status {
    width: 100%;
    margin-left: 0;
  }

  textarea,
  pre {
    min-height: 20rem;
  }
}


:root[data-theme="dark"] {
  color-scheme: dark;
}

:root[data-theme="dark"] body {
  background:
    radial-gradient(circle at 15% 0%, rgba(59, 130, 246, 0.12), transparent 28rem),
    var(--bg);
}

:root[data-theme="dark"] .site-header {
  background: rgba(10, 10, 10, 0.92);
}

:root[data-theme="dark"] .workspace {
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}
