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

:root {
  --bg:         #111113;
  --surface:    #1c1c20;
  --surface2:   #242428;
  --border:     #2e2e34;
  --text:       #d0d0d8;
  --text-dim:   #6b6b78;
  --text-faint: #3e3e48;
  --green:      #4ade80;
  --green-dim:  #166534;
  --red:        #f87171;
  --red-dim:    #7f1d1d;
  --yellow:     #fbbf24;
  --blue:       #60a5fa;
  --mono: 'Cascadia Code', 'Fira Code', 'JetBrains Mono', Consolas, 'Courier New', monospace;
  --ui:   -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

html, body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Header ── */

header {
  padding: 18px 24px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.banner-label {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  text-transform: lowercase;
}

.tagline {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 5px;
}

/* ── Main split ── */

main {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  min-height: 0;
  overflow: hidden;
}

@media (max-width: 720px) {
  main {
    grid-template-columns: 1fr;
    grid-template-rows: 300px 1fr;
  }
}

/* ── Panes ── */

.pane {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

.output-pane {
  border-right: none;
}

.pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 38px;
}

.pane-title {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.filename {
  font-family: var(--mono);
}

.pane-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Buttons ── */

button {
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 5px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: var(--surface2);
  color: var(--text);
  transition: background 0.12s, border-color 0.12s, opacity 0.12s;
  white-space: nowrap;
  line-height: 1.4;
}

button:hover:not(:disabled) {
  background: var(--border);
}

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

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#run-btn {
  background: #0f2a1a;
  color: var(--green);
  border-color: #1e4a2e;
}

#run-btn:hover:not(:disabled) {
  background: #142e1e;
  border-color: #2a6040;
}

.secondary {
  color: var(--text-dim);
}

/* ── Example dropdown ── */

.example-wrap {
  position: relative;
}

.example-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  z-index: 100;
  min-width: 170px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}

.example-menu[hidden] {
  display: none;
}

.example-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-radius: 0;
  padding: 8px 14px;
  font-size: 12px;
  color: var(--text);
  background: transparent;
}

.example-item:hover {
  background: var(--border);
}

/* ── Editor ── */

#editor {
  flex: 1;
  background: var(--surface);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  padding: 16px 18px;
  border: none;
  resize: none;
  outline: none;
  tab-size: 2;
  min-height: 0;
  overflow-y: auto;
}

#editor::selection {
  background: #2a4a6a;
}

/* ── Terminal output ── */

.terminal {
  flex: 1;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
  padding: 14px 16px;
  overflow-y: auto;
  overflow-x: auto;
  min-height: 0;
}

.idle-state {
  font-family: var(--ui);
  font-size: 13px;
  color: var(--text-dim);
  padding: 8px 0;
}

.idle-state p + p {
  margin-top: 5px;
}

.idle-note {
  font-size: 12px;
  color: var(--text-faint);
}

kbd {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--text);
}

/* ── Terminal lines ── */

.ln {
  white-space: pre;
  min-height: 1.65em;
}

.dim   { color: var(--text-dim); }
.faint { color: var(--text-faint); }

.clr-yellow { color: var(--yellow); }

.badge-pass { color: var(--green);  font-weight: 700; }
.badge-fail { color: var(--red);    font-weight: 700; }

.suite-name { color: var(--text); font-weight: 600; }

.test-pass { color: var(--green); }
.test-fail { color: var(--red);   }

.err-header { color: var(--red); font-weight: 600; }
.err-body   { color: #8a8a96; }

.sum-pass { color: var(--green); }
.sum-fail { color: var(--red);   }

.divider {
  color: var(--text-faint);
  user-select: none;
}

/* ── Footer ── */

footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-dim);
  flex-shrink: 0;
}

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

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

/* ── Watch mode ── */

#watch-btn.watch-active {
  background: #1a1400;
  color: var(--yellow);
  border-color: #3a3000;
}

#watch-btn.watch-active:hover:not(:disabled) {
  background: #222000;
  border-color: #5a4a00;
}

.watch-change {
  color: var(--yellow);
  padding-bottom: 4px;
}

.watch-menu {
  color: var(--text-faint);
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 6px;
}

.watch-warn {
  color: #7a6020;
}
