:root {
  --bg: #0b0d10;
  --surface: #13161b;
  --surface-2: #1a1e25;
  --line: #252a33;
  --line-soft: #1d2129;
  --ink: #e9ecf1;
  --ink-2: #a3adbb;
  --ink-3: #6a7482;
  --accent: #5b9dff;
  --accent-dim: #2d4a7a;
  --tool: #e0a458;
  --ok: #58c07f;
  --err: #e0656f;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --r: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 50% -15%, #141a24 0%, transparent 70%),
    var(--bg);
  color: var(--ink);
  font: 15px/1.65 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 880px; margin: 0 auto; padding: 44px 20px 96px; }

/* --- header -------------------------------------------------------------- */

header { margin-bottom: 30px; }

.title-row { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }

h1 {
  font-size: 21px;
  font-weight: 600;
  margin: 0;
  letter-spacing: -0.015em;
}
h1 .dim { color: var(--ink-3); font-weight: 400; }

.pill {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  white-space: nowrap;
}
.pill.live { color: var(--ok); border-color: #26402f; }
.pill.bad { color: var(--err); border-color: #4a2429; }

.sub {
  color: var(--ink-2);
  font-size: 14.5px;
  margin: 10px 0 0;
  max-width: 62ch;
}
.sub code {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  background: #151b26;
  border-radius: 4px;
  padding: 1px 5px;
}

/* --- cards --------------------------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 18px;
  margin-bottom: 14px;
}

.card > h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  margin: 0 0 14px;
  font-weight: 600;
}

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

label {
  display: block;
  font-size: 11.5px;
  color: var(--ink-3);
  margin-bottom: 5px;
  letter-spacing: 0.02em;
}

input, select, textarea, button {
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 11px;
  width: 100%;
  transition: border-color 0.14s ease, background 0.14s ease;
}

input::placeholder, textarea::placeholder { color: #4e5765; }
input:hover, select:hover, textarea:hover { border-color: #303743; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-dim);
  background: #171c24;
}

select { cursor: pointer; }

textarea {
  resize: vertical;
  min-height: 84px;
  font-size: 15px;
  line-height: 1.6;
}

button {
  cursor: pointer;
  width: auto;
  color: var(--ink-2);
}
button:hover:not(:disabled) { border-color: #3a424f; color: var(--ink); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #0a0d12;
  font-weight: 600;
}
button.primary:hover:not(:disabled) { filter: brightness(1.1); color: #0a0d12; }

.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.spacer { flex: 1; }

.hint { font-size: 12.5px; color: var(--ink-3); margin: 12px 0 0; line-height: 1.6; }
.hint b { color: var(--ink-2); font-weight: 500; }
.hint code { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.chips button {
  font-size: 12.5px;
  padding: 6px 11px;
  border-radius: 999px;
  color: var(--ink-3);
}

.docs { display: flex; gap: 6px; flex-wrap: wrap; }
.doc {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 9px;
}

.note {
  display: flex;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--tool);
  border-radius: 0 var(--r) var(--r) 0;
  padding: 12px 15px;
  margin-bottom: 22px;
  line-height: 1.6;
}

.hidden { display: none !important; }

/* --- event stream: a timeline ------------------------------------------- */

#stream { position: relative; padding-left: 22px; }
#stream::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--line);
}
#stream.empty-state::before { display: none; }

.ev {
  position: relative;
  margin-bottom: 10px;
  animation: rise 0.18s ease-out;
}
@keyframes rise { from { opacity: 0; transform: translateY(3px); } }

.ev::before {
  content: "";
  position: absolute;
  left: -21px;
  top: 6px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--line);
}

.ev .tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--ink-3);
  display: block;
  margin-bottom: 6px;
}
.ev .tag b { font-weight: 500; }

.ev pre, .ev .answer {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 11px 14px;
}

.ev pre {
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink-2);
  max-height: 210px;
  overflow: auto;
}

.ev .answer {
  white-space: pre-wrap;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ink);
  border-color: var(--accent-dim);
  background: #121821;
}

.ev-context::before { border-color: var(--ink-3); }
.ev-tool_use::before, .ev-tool_result::before { border-color: var(--tool); }
.ev-tool_use .tag, .ev-tool_result .tag { color: var(--tool); }
.ev-token::before { border-color: var(--accent); background: var(--accent); }
.ev-token .tag { color: var(--accent); }
.ev-done::before { border-color: var(--ok); background: var(--ok); }
.ev-done .tag { color: var(--ok); }
.ev-done pre { color: var(--ink-3); }
.ev-error::before { border-color: var(--err); background: var(--err); }
.ev-error .tag { color: var(--err); }
.ev-error pre { color: #f0a6ac; border-color: #3a2429; }

.empty {
  color: var(--ink-3);
  font-size: 14px;
  padding: 26px 0;
  margin: 0;
}

footer {
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
  color: var(--ink-3);
}
footer a { color: var(--ink-2); }

@media (max-width: 560px) {
  .wrap { padding: 28px 15px 70px; }
  .grid { grid-template-columns: 1fr; }
}
