:root {
  color-scheme: dark;
  --ink: #f4f3ed;
  --muted: #989a9d;
  --line: rgba(255, 255, 255, 0.11);
  --panel: rgba(20, 22, 24, 0.76);
  --panel-strong: #17191b;
  --lime: #c9ff58;
  --lime-soft: rgba(201, 255, 88, 0.12);
  --orange: #ff8a4c;
  --danger: #ff6b6b;
  --bg: #0d0f10;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 76% 4%, rgba(145, 184, 65, 0.13), transparent 27rem),
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 40px 40px, 40px 40px, auto;
}

button, textarea, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell { width: min(1480px, 100%); margin: 0 auto; padding: 0 32px 48px; }

.topbar {
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: .04em; }
.brand small { margin-top: 2px; color: var(--muted); font: 10px/1.2 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .12em; }
.brand-mark { width: 32px; height: 32px; border: 1px solid var(--line); display: flex; align-items: end; gap: 3px; padding: 7px; }
.brand-mark span { flex: 1; background: var(--lime); }
.brand-mark span:nth-child(1) { height: 45%; }
.brand-mark span:nth-child(2) { height: 100%; }
.brand-mark span:nth-child(3) { height: 70%; }

.status-wrap { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12px; }
.status-wrap a { color: var(--ink); text-decoration: none; margin-left: 18px; padding-left: 27px; border-left: 1px solid var(--line); }
.status-wrap a:hover { color: var(--lime); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #777; box-shadow: 0 0 0 4px rgba(255,255,255,.05); }
.status-dot.online { background: var(--lime); box-shadow: 0 0 0 4px var(--lime-soft); }
.status-dot.offline { background: var(--danger); }

main { padding-top: 54px; }
.hero { display: grid; grid-template-columns: 1.6fr 1fr; align-items: end; gap: 48px; margin-bottom: 44px; }
.eyebrow { margin: 0 0 15px; color: var(--lime); font: 11px/1.2 ui-monospace, monospace; letter-spacing: .18em; }
h1 { margin: 0; font-size: clamp(44px, 5.4vw, 82px); line-height: .92; letter-spacing: -.06em; font-weight: 550; }
h1 em { color: var(--muted); font-style: normal; font-weight: 350; }
.hero-copy { max-width: 520px; margin: 0 0 3px; color: #b5b6b5; font-size: 14px; line-height: 1.8; border-left: 2px solid var(--lime); padding-left: 18px; }

.workspace { display: grid; grid-template-columns: minmax(320px, 430px) minmax(0, 1fr); gap: 18px; }
.panel { background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(18px); }
.request-panel { padding: 26px; }
.result-panel { min-height: 650px; padding: 26px 30px; }
.panel-heading { min-height: 38px; display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 27px; }
.panel-heading > div:first-child { display: flex; align-items: center; gap: 12px; }
.panel-heading h2 { font-size: 17px; margin: 0; font-weight: 560; }
.step { color: var(--lime); font: 10px/1 ui-monospace, monospace; border: 1px solid rgba(201, 255, 88, .35); padding: 6px; }
.text-button, .section-label button { background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 11px; }
.text-button:hover, .section-label button:hover { color: var(--ink); }

form > label, legend { display: block; margin: 20px 0 9px; color: #cecfc9; font-size: 12px; font-weight: 600; }
form > label:first-child { margin-top: 0; }
.optional { font-weight: 400; color: var(--muted); margin-left: 4px; }
textarea, input[type="text"] {
  width: 100%;
  color: var(--ink);
  background: rgba(5, 6, 7, .58);
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
textarea { padding: 14px; resize: vertical; line-height: 1.55; }
input[type="text"] { height: 44px; padding: 0 13px; }
textarea:focus, input[type="text"]:focus { border-color: rgba(201, 255, 88, .7); box-shadow: 0 0 0 3px rgba(201, 255, 88, .07); }
textarea::placeholder, input::placeholder { color: #606265; }
.code-input { color: #c7d7ad; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
.field-meta { display: flex; justify-content: space-between; margin-top: 7px; color: #6f7173; font: 9px/1.2 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .1em; }
.input-with-action { display: flex; }
.input-with-action input { border-right: 0; }
.input-with-action button { width: 46px; flex: 0 0 46px; color: var(--muted); background: rgba(5, 6, 7, .58); border: 1px solid var(--line); cursor: pointer; font-size: 18px; }
.input-with-action button:hover { color: var(--lime); }
.field-error { min-height: 15px; margin: 5px 0 0; color: var(--danger); font-size: 11px; }

fieldset { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border: 0; padding: 0; margin: 0; }
legend { grid-column: 1 / -1; width: 100%; padding: 0; }
.mode-option { position: relative; cursor: pointer; }
.mode-option input { position: absolute; opacity: 0; }
.mode-option span { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); padding: 12px; transition: .15s; }
.mode-option strong { font-size: 12px; }
.mode-option small { color: var(--muted); font-size: 10px; }
.mode-option input:checked + span { border-color: var(--lime); background: var(--lime-soft); }
.mode-option input:checked + span strong { color: var(--lime); }

.run-button { width: 100%; height: 50px; margin-top: 24px; display: flex; align-items: center; justify-content: space-between; padding: 0 18px; border: 0; background: var(--lime); color: #111; cursor: pointer; font-weight: 750; transition: transform .12s, filter .12s; }
.run-button:hover { filter: brightness(1.06); transform: translateY(-1px); }
.run-button:disabled { cursor: not-allowed; opacity: .72; transform: none; }
.run-button.running { background: var(--orange); }
.arrow { font-size: 20px; }

.request-badge { color: var(--muted); background: rgba(255,255,255,.04); border: 1px solid var(--line); padding: 7px 10px; font: 9px/1 ui-monospace, monospace; letter-spacing: .05em; }
.empty-state { min-height: 535px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); }
.empty-state h3 { margin: 25px 0 8px; color: var(--ink); font-size: 17px; }
.empty-state p { max-width: 360px; margin: 0 0 23px; font-size: 12px; line-height: 1.7; }
.empty-state kbd { padding: 3px 7px; color: #bfc0bd; background: #242628; border: 1px solid var(--line); box-shadow: 0 2px 0 #050606; font: 10px/1.3 ui-monospace, monospace; }
.empty-state > span { font-size: 10px; }
.orb { width: 72px; height: 72px; position: relative; border: 1px solid rgba(201,255,88,.35); border-radius: 50%; display: grid; place-items: center; animation: drift 5s ease-in-out infinite; }
.orb::before, .orb::after { content: ""; position: absolute; border: 1px solid var(--line); border-radius: 50%; }
.orb::before { inset: 8px; }
.orb::after { inset: -10px; border-style: dashed; animation: spin 12s linear infinite; }
.orb span { width: 12px; height: 12px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 24px var(--lime); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift { 50% { transform: translateY(-7px); } }

.hidden { display: none !important; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); margin-bottom: 20px; }
.metrics div { padding: 14px 16px; border-right: 1px solid var(--line); }
.metrics div:last-child { border-right: 0; }
.metrics span, .section-label { color: var(--muted); font: 9px/1.2 ui-monospace, monospace; letter-spacing: .12em; }
.metrics strong { display: block; margin-top: 7px; font: 14px/1.2 ui-monospace, monospace; color: var(--ink); }
.output-block, .event-block { margin-top: 22px; }
.section-label { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; }
.section-label button { font-family: inherit; letter-spacing: .08em; }
#liveLabel { color: var(--lime); }
#agentOutput, #rawResponse { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: #e4e5df; background: #0a0b0c; border: 1px solid var(--line); padding: 18px; min-height: 112px; font: 12px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace; }
.timeline { max-height: 210px; overflow: auto; list-style: none; padding: 4px 0 0 4px; margin: 0; border-left: 1px solid var(--line); }
.timeline li { position: relative; display: grid; grid-template-columns: 74px 1fr auto; gap: 12px; align-items: baseline; padding: 7px 9px 7px 18px; color: #c6c7c3; font: 10px/1.4 ui-monospace, monospace; }
.timeline li::before { content: ""; position: absolute; left: -4px; top: 12px; width: 7px; height: 7px; border-radius: 50%; background: #535658; }
.timeline li:last-child::before { background: var(--lime); box-shadow: 0 0 8px var(--lime); }
.timeline .event-name { color: var(--lime); }
.timeline .event-data { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.timeline time { color: #626466; }
details { margin-top: 21px; border-top: 1px solid var(--line); padding-top: 15px; }
summary { cursor: pointer; color: var(--muted); font-size: 11px; }
#rawResponse { margin-top: 12px; min-height: 60px; max-height: 240px; overflow: auto; color: #9ea1a3; }

.toast { position: fixed; right: 25px; bottom: 25px; padding: 11px 15px; color: #111; background: var(--lime); font-size: 12px; font-weight: 700; transform: translateY(80px); opacity: 0; transition: .2s; pointer-events: none; }
.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 900px) {
  .app-shell { padding: 0 18px 32px; }
  .hero { grid-template-columns: 1fr; gap: 24px; }
  .workspace { grid-template-columns: 1fr; }
  .result-panel { min-height: 540px; }
  .empty-state { min-height: 420px; }
}

@media (max-width: 560px) {
  .topbar { height: 66px; }
  .status-wrap #serverStatus, .status-wrap a { display: none; }
  main { padding-top: 38px; }
  .hero { margin-bottom: 30px; }
  h1 { font-size: 46px; }
  .request-panel, .result-panel { padding: 20px; }
  .metrics { grid-template-columns: 1fr; }
  .metrics div { border-right: 0; border-bottom: 1px solid var(--line); }
  .metrics div:last-child { border-bottom: 0; }
  .timeline li { grid-template-columns: 62px 1fr; }
  .timeline time { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}

