:root {
  --bg: #1e1e1e;
  --panel: #252526;
  --border: #3c3c3c;
  --text: #d4d4d4;
  --muted: #8a8a8a;
  --accent: #0e639c;
  --accent-hover: #1177bb;
  --warn-bg: #332b00;
  --warn: #e9c46a;
  --err-bg: #3a1d1d;
  --err: #f48771;
  --ok: #89d185;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}
.toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.logo { margin-right: 8px; }
.spacer { flex: 1; }
.hint { color: var(--muted); font-size: 12px; }
code { font-family: Menlo, Consolas, monospace; }
button, select {
  background: #3a3d41;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 12px;
  font: inherit;
  cursor: pointer;
}
button:hover { background: #45494e; }
button.danger:hover { background: #5a1d1d; border-color: #be1100; }
input {
  background: #3c3c3c;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 5px 8px;
  font: inherit;
}
input:focus { outline: 1px solid var(--accent); }
.task-title { font-weight: 600; }
.dirty::after { content: " •"; color: var(--warn); }

/* режимы: body.mode-admin / mode-candidate / mode-sandbox */
.admin-only, .candidate-only, .sandbox-only { display: none; }
.mode-admin .admin-only,
.mode-candidate .candidate-only,
.mode-sandbox .sandbox-only { display: inline-block; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: var(--accent-hover); }
.layout {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  min-height: 0;
}
.editor { min-height: 0; border-right: 1px solid var(--border); }
.output { display: flex; flex-direction: column; min-height: 0; }
.output-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}
.output-head span { flex: 1; text-transform: uppercase; letter-spacing: .05em; }
.output-head button { padding: 2px 8px; font-size: 12px; }
.console {
  flex: 1;
  overflow: auto;
  font: 13px/1.5 Menlo, Consolas, monospace;
  padding: 4px 0;
}
.line {
  padding: 2px 12px;
  border-bottom: 1px solid #2d2d2d;
  white-space: pre-wrap;
  word-break: break-word;
}
.line.warn { background: var(--warn-bg); color: var(--warn); }
.line.error { background: var(--err-bg); color: var(--err); }
.line.system { color: var(--muted); font-style: italic; }
.line .ok { color: var(--ok); }
.line .fail { color: var(--err); font-weight: bold; }
.line a { color: inherit; text-decoration: underline; cursor: pointer; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 60vh auto; }
  .editor { border-right: 0; border-bottom: 1px solid var(--border); }
  .hint { display: none; }
}
