:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #18201d;
  --muted: #65716c;
  --line: #d8dedb;
  --paper: #f5f7f5;
  --surface: #ffffff;
  --accent: #087f5b;
  --accent-dark: #056647;
  --terminal: #18201d;
  --terminal-muted: #9eaaa5;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
}

button, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }

.app-header {
  min-height: 76px;
  padding: 14px clamp(18px, 4vw, 54px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: white;
  border-radius: 6px;
  font: 700 16px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.brand h1 { margin: 0; font-size: 20px; line-height: 1.1; letter-spacing: 0; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.privacy-indicator { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.privacy-indicator span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

main { width: min(1180px, calc(100% - 36px)); margin: 30px auto 24px; }
.workspace { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; overflow: hidden; }
.workspace-bar { min-height: 62px; padding: 10px 14px 10px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.status { color: var(--muted); font-size: 13px; }
.actions { display: flex; gap: 8px; }
.actions .button { min-width: 0; }
.button { min-height: 38px; padding: 0 15px; border: 1px solid var(--line); border-radius: 5px; font-weight: 650; font-size: 13px; }
.button-quiet { color: var(--ink); background: var(--surface); }
.button-primary { border-color: var(--accent); color: white; background: var(--accent); }
.button-primary:hover { background: var(--accent-dark); }

.editors { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.editor-panel + .editor-panel { border-left: 1px solid var(--line); }
.editor-heading { height: 48px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.editor-heading label { font-size: 13px; font-weight: 700; }
.editor-heading > span { color: var(--muted); font-size: 12px; }
.copy-button, .terminal-bar button { min-width: 56px; min-height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink); background: var(--surface); font-size: 12px; font-weight: 650; }
textarea { display: block; width: 100%; height: clamp(300px, 46vh, 540px); padding: 20px; resize: vertical; border: 0; outline: 0; color: var(--ink); background: var(--surface); font: 14px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0; tab-size: 4; }
textarea:focus { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
textarea::placeholder { color: #9ba49f; }
.output-panel textarea { background: #fafbfa; }

.results { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); background: #fafbfa; }
.results > div { padding: 14px 20px; display: flex; align-items: baseline; gap: 8px; }
.results > div + div { border-left: 1px solid var(--line); }
.results strong { font: 700 18px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.results span { color: var(--muted); font-size: 12px; }

.terminal { margin-top: 18px; overflow: hidden; border-radius: 7px; background: var(--terminal); color: #ecf2ef; }
.terminal-bar { height: 44px; padding: 0 12px 0 16px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-bottom: 1px solid #303936; }
.terminal-bar h2 { margin: 0; color: var(--terminal-muted); font-size: 11px; font-weight: 600; letter-spacing: 0; text-transform: uppercase; }
.terminal-dots { display: flex; gap: 6px; }
.terminal-dots i { width: 8px; height: 8px; border-radius: 50%; background: #4f5b57; }
.terminal-bar button { justify-self: end; border-color: #46504d; color: #d9e2de; background: transparent; }
pre { margin: 0; padding: 20px; overflow-x: auto; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.prompt { color: #55d6a6; }
.boundary-note { margin: 13px 2px 0; color: var(--muted); font-size: 11px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (max-width: 720px) {
  .app-header { min-height: 68px; padding: 12px 18px; }
  .brand-mark { width: 38px; height: 38px; }
  .privacy-indicator { font-size: 0; gap: 0; }
  main { width: calc(100% - 24px); max-width: 620px; margin-top: 18px; }
  .workspace-bar { align-items: flex-start; flex-direction: column; padding: 14px; }
  .actions { width: 100%; }
  .button { flex: 1; }
  .editors { grid-template-columns: 1fr; }
  .editor-panel + .editor-panel { border-left: 0; border-top: 1px solid var(--line); }
  textarea { height: 260px; min-height: 180px; }
  .results { grid-template-columns: 1fr; }
  .results > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .terminal-bar { grid-template-columns: 1fr 1fr; }
  .terminal-bar h2 { display: none; }
}

@media (prefers-reduced-motion: no-preference) {
  button { transition: background-color 120ms ease, border-color 120ms ease; }
}
