:root {
  --bg: #08090c;
  --panel: #0f1116;
  --panel-2: #14171e;
  --line: #22262f;
  --line-soft: #1a1e26;
  --text: #e7e9ee;
  --muted: #8b929f;
  --dim: #5c636f;
  --accent: #b7ff3c;
  --accent-dim: #7dbb18;
  --danger: #ff5d5d;
  --warn: #ffb020;
  --ok: #3ddc97;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 20% -10%, #12200a 0%, transparent 55%), var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
}

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px; border-bottom: 1px solid var(--line-soft);
  background: rgba(8,9,12,.7); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 14px; }
.mark {
  width: 42px; height: 42px; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, var(--accent), #4f8f00);
  color: #0a0d05; font-weight: 700; font-size: 13px; letter-spacing: .5px;
  box-shadow: 0 0 24px rgba(183,255,60,.25);
}
.topbar h1 { margin: 0; font-size: 16px; letter-spacing: -.2px; }
.topbar p { margin: 1px 0 0; color: var(--muted); font-size: 11.5px; }
.badges { display: flex; gap: 8px; flex-wrap: wrap; }
.badge {
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px;
  background: var(--panel);
}
.badge.good { color: var(--accent); border-color: rgba(183,255,60,.35); }
.badge.bad { color: var(--danger); border-color: rgba(255,93,93,.35); }

/* ---------- tabs ---------- */
.tabs {
  display: flex; align-items: center; gap: 4px;
  padding: 0 24px; border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 79px; z-index: 19; background: rgba(8,9,12,.92);
}
.tab {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font: inherit; font-size: 13px; padding: 12px 14px;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs-right { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--dim); font-size: 12px; font-family: var(--mono); }
.live { width: 6px; height: 6px; border-radius: 50%; background: var(--dim); }
.live.on { background: var(--accent); box-shadow: 0 0 0 4px rgba(183,255,60,.12); animation: pulse 1.6s infinite; }
.live.err { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }

main { max-width: 1180px; margin: 0 auto; padding: 26px 24px 80px; }
.view { display: none; }
.view.active { display: block; }

/* ---------- composer ---------- */
.composer {
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel);
  padding: 18px;
}
.composer label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .9px; color: var(--dim); margin-bottom: 8px; }
textarea {
  width: 100%; resize: vertical; min-height: 74px;
  background: #0a0c10; color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; font: inherit; outline: none;
}
textarea:focus { border-color: rgba(183,255,60,.45); box-shadow: 0 0 0 3px rgba(183,255,60,.08); }
.composer-row { display: flex; gap: 14px; align-items: flex-end; justify-content: space-between; margin-top: 12px; flex-wrap: wrap; }
.examples { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 5px 11px; font: inherit; font-size: 12px; cursor: pointer;
}
.chip:hover { color: var(--text); border-color: #333a47; }
.hint { color: var(--dim); font-size: 12px; margin: 12px 0 0; }
.hint code { font-family: var(--mono); color: var(--muted); }

button.primary {
  background: var(--accent); color: #0a1002; border: none; border-radius: 10px;
  padding: 11px 18px; font: inherit; font-weight: 600; cursor: pointer;
  transition: transform .08s ease, filter .12s;
}
button.primary:hover { filter: brightness(1.08); }
button.primary:active { transform: translateY(1px); }
button.primary:disabled { opacity: .45; cursor: not-allowed; }
button.ghost {
  background: transparent; color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 14px; font: inherit; cursor: pointer;
}
button.ghost:hover { border-color: #38404d; }

/* ---------- run panel ---------- */
.run-panel { margin-top: 22px; }
.hidden { display: none !important; }
.run-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.run-id { font-family: var(--mono); font-size: 12px; color: var(--accent); }
.run-task { color: var(--text); margin-top: 4px; max-width: 820px; }
.run-state {
  font-family: var(--mono); font-size: 11px; padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.run-state.running { color: var(--accent); border-color: rgba(183,255,60,.4); }
.run-state.done { color: var(--ok); border-color: rgba(61,220,151,.4); }
.run-state.error, .run-state.unverified { color: var(--warn); border-color: rgba(255,176,32,.4); }

.containment-strip {
  display: flex; gap: 6px; flex-wrap: wrap; margin: 14px 0 18px;
}
.limit {
  font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: 3px 8px;
}
.limit b { color: var(--text); font-weight: 500; }

/* ---------- steps ---------- */
.step {
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  margin-bottom: 12px; overflow: hidden;
}
.step-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
}
.step-no {
  font-family: var(--mono); font-size: 11px; color: var(--dim);
  border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px;
}
.step-title { font-weight: 500; flex: 1; }
.step-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); display: flex; gap: 8px; }
.pill { font-family: var(--mono); font-size: 10.5px; border-radius: 999px; padding: 2px 8px; border: 1px solid var(--line); color: var(--muted); }
.pill.ok { color: var(--ok); border-color: rgba(61,220,151,.35); }
.pill.bad { color: var(--danger); border-color: rgba(255,93,93,.35); }
.pill.warn { color: var(--warn); border-color: rgba(255,176,32,.35); }

.step-body { padding: 0; }
.explain { color: var(--muted); font-size: 12.5px; padding: 10px 14px 0; }
details { border-top: 1px solid var(--line-soft); }
summary {
  cursor: pointer; padding: 9px 14px; color: var(--dim); font-size: 11.5px;
  text-transform: uppercase; letter-spacing: .7px; user-select: none;
}
summary:hover { color: var(--muted); }
pre {
  margin: 0; padding: 12px 14px; background: #07080b;
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  white-space: pre-wrap; word-break: break-word; color: #c8cedb;
  max-height: 340px; overflow: auto;
}
pre.err { color: #ff9d9d; }
.artifacts { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px 14px; }
.artifact {
  font-family: var(--mono); font-size: 11px; color: var(--accent);
  text-decoration: none; border: 1px solid rgba(183,255,60,.3);
  border-radius: 6px; padding: 3px 8px; background: rgba(183,255,60,.05);
}
.artifact:hover { background: rgba(183,255,60,.12); }

/* ---------- answer ---------- */
.answer { margin-top: 18px; border: 1px solid rgba(183,255,60,.25); border-radius: 12px; background: linear-gradient(180deg, rgba(183,255,60,.05), transparent 40%), var(--panel); }
.answer-head { display: flex; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line-soft); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.answer-body { padding: 14px 16px; white-space: pre-wrap; }
.answer-meta { padding: 0 16px 14px; color: var(--dim); font-size: 12px; }

/* ---------- lab ---------- */
.lab-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.lab-head h2 { margin: 0 0 4px; font-size: 18px; letter-spacing: -.3px; }
.lab-head p { margin: 0; color: var(--muted); font-size: 13px; }
.probe-summary { border: 1px solid rgba(61,220,151,.3); background: rgba(61,220,151,.06); border-radius: 10px; padding: 12px 16px; margin-bottom: 16px; font-family: var(--mono); font-size: 12.5px; }
.probe-summary.bad { border-color: rgba(255,93,93,.35); background: rgba(255,93,93,.06); }
.probe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.probe { border: 1px solid var(--line); border-radius: 12px; background: var(--panel); padding: 14px; }
.probe-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.probe h3 { margin: 0; font-size: 14px; font-weight: 600; }
.probe .attack { color: var(--muted); font-size: 12.5px; margin: 8px 0 0; }
.probe .expect { color: var(--dim); font-size: 11.5px; margin: 4px 0 10px; }
.probe .evidence { font-family: var(--mono); font-size: 11.5px; color: #c8cedb; background: #07080b; border: 1px solid var(--line-soft); border-radius: 8px; padding: 8px 10px; }
.probe details { border-top: 1px solid var(--line-soft); margin-top: 10px; }
.probe.failed { border-color: rgba(255,93,93,.4); }

/* ---------- ledger ---------- */
.table-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { text-align: left; padding: 10px 12px; color: var(--dim); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .7px; border-bottom: 1px solid var(--line); }
td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.015); cursor: pointer; }
td.mono { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
td.truncate { max-width: 380px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--dim); text-align: center; padding: 34px; }

@media (max-width: 720px) {
  .topbar, .tabs { padding-left: 14px; padding-right: 14px; }
  main { padding: 18px 14px 60px; }
  .tabs { top: 78px; overflow-x: auto; }
  .badges { display: none; }
  .run-head { flex-direction: column; }
}
