:root {
  color-scheme: light dark;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2330;
  --muted: #5d6675;
  --border: #d7dbe2;
  --accent: #2a62d6;
  --accent-text: #ffffff;
  --code-bg: #fbfbfc;
  --console-bg: #121722;
  --console-text: #e4e8ef;
  --value: #8fd18f;
  --echo: #9db4e6;
  --error: #ff8a80;
  --radius: 8px;
  --mono: ui-monospace, 'SFMono-Regular', 'Cascadia Code', Menlo, Consolas, monospace;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Armenian', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f131a;
    --surface: #161c26;
    --text: #e4e8ef;
    --muted: #9aa4b2;
    --border: #2a3342;
    --accent: #6e9bf5;
    --accent-text: #0f131a;
    --code-bg: #121822;
    --console-bg: #0b0f15;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.header,
.footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  font-weight: 650;
  font-size: 1.15rem;
  text-decoration: none;
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
}

.main {
  flex: 1;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px 16px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

select,
.input {
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
}

select {
  max-width: 100%;
}

.actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.button {
  min-height: 40px;
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

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

.panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.pane-title {
  margin: 0 0 6px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.code,
.console {
  min-height: 420px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  tab-size: 4;
}

.code {
  flex: 1;
  width: 100%;
  resize: vertical;
  background: var(--code-bg);
  color: var(--text);
  white-space: pre;
  overflow: auto;
}

.console {
  flex: 1;
  overflow: auto;
  background: var(--console-bg);
  color: var(--console-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.console:empty::before {
  content: 'Run the program to see its output here.';
  color: #7d8796;
}

.console .value {
  color: var(--value);
  font-weight: 600;
}

.console .echo {
  color: var(--echo);
}

.console .error {
  color: var(--error);
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.input-form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.input-form[hidden] {
  display: none;
}

.input {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
}

.hint,
.status {
  margin: 6px 0 0;
  min-height: 1.5em;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer {
  justify-content: center;
  font-size: 0.85rem;
  color: var(--muted);
}

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

  .code,
  .console {
    min-height: 260px;
  }

  .actions {
    margin-left: 0;
    width: 100%;
  }

  .actions .button {
    flex: 1;
  }

  .field {
    flex: 1 1 140px;
  }
}
