:root {
  --bg: #111413; --panel: #191e1c; --panel-2: #202724;
  --text: #e5e9e7; --muted: #a1aaa6; --line: #2c3531;
  --accent: #76c7ad; --accent-2: #d18484; --code-bg: #0d1110;
  --mono: "Consolas","Courier New",ui-monospace,SFMono-Regular,Menlo,monospace;
  --ui: "Inter",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

body { display: flex; flex-direction: column; }

/* Blazor mounts into #app — make it a flex passthrough so .runner fills 100% */
#app {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ── runner widget ── */
.runner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,0.02) inset, 0 20px 40px -20px rgba(0,0,0,0.6);
}

/* 1. Toolbar */
.toolbar {
  height: 36px;
  flex: 0 0 36px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 10px;
  gap: 8px;
  user-select: none;
}

.badge {
  color: var(--accent);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel-2);
  font-family: var(--mono);
}

.btn {
  height: 24px;
  padding: 0 10px;
  font: 500 12px/1 var(--ui);
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: background 120ms, border-color 120ms, color 120ms, opacity 120ms;
  text-decoration: none;
}
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.btn-primary { background: var(--accent); color: #0b1311; font-weight: 600; border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: #88d4bb; border-color: #88d4bb; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-ghost { border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: #3a4641; }

.spacer { flex: 1; }

.status {
  font: 500 12px/1 var(--mono);
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.01em;
}
.status.ok  { color: var(--accent); }
.status.err { color: var(--accent-2); }

.status .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}
.status.idle .dot { background: var(--muted); }
.status.run  .dot { background: var(--accent); animation: pulse 1.2s ease-in-out infinite; }

.ico { width: 12px; height: 12px; flex: 0 0 12px; }

.spinner {
  width: 12px; height: 12px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
  flex: 0 0 12px;
}

@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.3; } }

/* 2. Editor */
.editor-wrap {
  flex: 1;
  min-height: 100px;
  display: flex;
  background: var(--code-bg);
  overflow: hidden;
}

.gutter {
  flex: 0 0 auto;
  padding: 14px 10px 14px 14px;
  color: #3f4a45;
  text-align: right;
  user-select: none;
  border-right: 1px solid #161b19;
  white-space: pre;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  min-width: 42px;
  overflow: hidden;
  pointer-events: none;
}

.code-area {
  flex: 1;
  background: transparent;
  color: var(--text);
  border: none;
  resize: none;
  padding: 14px 16px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  outline: none;
  tab-size: 4;
  -moz-tab-size: 4;
  white-space: pre;
  overflow-x: auto;
  overflow-y: auto;
  caret-color: var(--accent);
}
.code-area::placeholder { color: #3f4a45; }

/* 3. Draggable splitter */
.resizer {
  flex: 0 0 5px;
  background: var(--line);
  cursor: ns-resize;
  transition: background 120ms;
}
.resizer:hover,
.resizer.dragging { background: var(--accent); }

/* 4. Output */
.output {
  flex: 0 0 auto;
  max-height: 480px;
  background: #080b0a;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.output-head {
  padding: 10px 14px 4px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--ui);
  flex-shrink: 0;
}

.output-head .clear {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--muted);
  font: 500 11px/1 var(--ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 2px 4px;
}
.output-head .clear:hover { color: var(--text); }

.output-body {
  margin: 0;
  padding: 6px 14px 14px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 440px;
  overflow: auto;
}
.output-body.err   { color: var(--accent-2); }
.output-body .ghost { color: var(--muted); font-style: italic; }

/* Scrollbars */
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: #4a5c56; border-radius: 4px; }
*::-webkit-scrollbar-thumb:hover { background: #607a72; }
*::-webkit-scrollbar-track { background: #161b19; }
