/* Hero agent console (js/console.js). The hero band is dark in both themes, so the console uses the
   --tech-* tokens. The page's status tokens are tuned for a light or dark page, not for a near-black
   panel, so the console keeps its own bright status colors here. */

#agent-console {
  --cl-ok: #4ade80;
  --cl-warn: #fbbf24;
  --cl-stop: #f87171;
  --cl-accent: var(--tech-accent);
  --cl-dim: rgba(243, 245, 248, 0.42);
  --cl-font: 12.5px;
  position: relative;
  min-width: 0;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 120px), var(--tech-panel);
  border: 1px solid var(--tech-line);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.6),
    0 40px 90px rgba(0, 0, 0, 0.55),
    0 0 80px -20px var(--tech-glow),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  font-family: var(--mono);
  color: var(--tech-ink);
  overflow: hidden;
}

.cl-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Window bar */
.cl-bar { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px; border-bottom: 1px solid var(--tech-line); background: rgba(255, 255, 255, 0.025); }
.cl-dots { display: flex; gap: 7px; flex: none; }
.cl-dots i { width: 11px; height: 11px; border-radius: 50%; background: rgba(255, 255, 255, 0.14); }
.cl-dots i:nth-child(1) { background: #ff5f57; opacity: 0.85; }
.cl-dots i:nth-child(2) { background: #febc2e; opacity: 0.85; }
.cl-dots i:nth-child(3) { background: #28c840; opacity: 0.85; }
.cl-title { flex: 1; min-width: 0; font-size: 11px; color: var(--tech-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: 0.01em; }
.cl-title b { color: var(--tech-ink); font-weight: 600; }
.cl-badges { display: flex; gap: 8px; flex: none; align-items: center; }
.cl-sample { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; color: var(--cl-warn); border: 1px solid rgba(251, 191, 36, 0.35); background: rgba(251, 191, 36, 0.08); padding: 3px 7px; border-radius: 999px; }
.cl-live { display: grid; place-items: center; width: 14px; height: 14px; }
.cl-live i { width: 7px; height: 7px; border-radius: 50%; background: var(--cl-ok); box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.6); animation: cl-pulse 2s ease-out infinite; }
#agent-console.is-paused .cl-live i { animation-play-state: paused; background: var(--cl-dim); }

/* Log body: fixed height; once full, it keeps the newest line in view and older lines fade out at the top. */
.cl-body {
  position: relative;
  height: 376px;
  padding: 14px 18px 12px;
  overflow: hidden;
  font-size: var(--cl-font);
  line-height: 1.6;
}
.cl-body.is-full { mask-image: linear-gradient(180deg, transparent 0, #000 72px); -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 72px); }

.cl-line { display: grid; grid-template-columns: 8.5ch 1fr; column-gap: 12px; padding: 3px 0; animation: cl-in 0.28s ease-out both; }
.cl-ts { color: var(--cl-dim); font-variant-numeric: tabular-nums; }
.cl-main { display: grid; grid-template-columns: 13.5ch 1fr; column-gap: 8px; min-width: 0; }
.cl-tag { color: var(--cl-accent); font-weight: 600; white-space: nowrap; }
.cl-tag::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 2px; background: currentColor; margin-right: 7px; vertical-align: 1px; opacity: 0.85; }
.cl-msg { color: var(--tech-soft); overflow-wrap: anywhere; min-width: 0; }
.cl-msg b { color: var(--tech-ink); font-weight: 600; }
.cl-ok { color: var(--cl-ok); }
.cl-warn { color: var(--cl-warn); }
.cl-stop { color: var(--cl-stop); }
.cl-acc { color: var(--cl-accent); }
.cl-q { color: var(--tech-ink); font-style: italic; }

/* The human signer gets a full-width row: name and role, then the decision. */
.cl-line.is-human .cl-main { grid-template-columns: 1fr; row-gap: 2px; }
.cl-line.is-human .cl-tag { color: var(--tech-ink); }
.cl-line.is-human .cl-tag span { display: inline-block; padding: 1px 8px; border-radius: 6px; background: rgba(196, 168, 234, 0.16); border: 1px solid rgba(196, 168, 234, 0.4); }
.cl-line.is-human .cl-tag::before { display: none; }
.cl-line.is-human .cl-tag em { font-style: normal; color: var(--tech-soft); font-weight: 400; }
.cl-line.is-human { margin: 4px 0; padding: 6px 0 6px 10px; border-left: 2px solid var(--cl-accent); background: linear-gradient(90deg, rgba(196, 168, 234, 0.08), transparent 70%); }

/* Story divider */
.cl-div { display: flex; align-items: center; gap: 12px; margin: 10px 0 8px; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--cl-dim); animation: cl-in 0.4s ease-out both; }
.cl-div::before, .cl-div::after { content: ""; flex: 1; height: 1px; background: var(--tech-line); }

/* Cursor */
.cl-cursor { display: inline-block; width: 0.6em; height: 1.15em; margin-left: 2px; vertical-align: -0.2em; background: var(--cl-accent); animation: cl-blink 1s steps(1) infinite; }

/* Status bar */
.cl-foot { display: flex; justify-content: space-between; gap: 12px; padding: 0 16px; height: 34px; align-items: center; border-top: 1px solid var(--tech-line); font-size: 10.5px; color: var(--cl-dim); letter-spacing: 0.04em; }
.cl-foot > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cl-foot b { color: var(--tech-soft); font-weight: 600; }
.cl-foot .cl-sample { display: none; }
.cl-steps { display: flex; gap: 5px; flex: none; }
.cl-steps i { width: 18px; height: 3px; border-radius: 2px; background: var(--tech-line); transition: background 0.3s ease; }
.cl-steps i.on { background: var(--cl-accent); }

@keyframes cl-blink { 50% { opacity: 0; } }
@keyframes cl-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes cl-pulse { 0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.55); } 70% { box-shadow: 0 0 0 7px rgba(74, 222, 128, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); } }

@media (max-width: 520px) {
  #agent-console { --cl-font: 11.5px; border-radius: 14px; }
  .cl-bar { padding: 0 12px; gap: 10px; }
  .cl-title .cl-brand, .cl-badges, .cl-steps, .cl-foot .cl-word { display: none; }
  .cl-foot .cl-sample { display: inline-block; flex: none; }
  .cl-body { height: 360px; padding: 12px 12px 10px; }
  .cl-line { grid-template-columns: 1fr; row-gap: 0; }
  .cl-ts { font-size: 10.5px; }
  .cl-main { display: block; }
  .cl-tag { display: inline; margin-right: 8px; }
  .cl-line.is-human .cl-tag { display: block; margin: 0 0 3px; }
  .cl-foot { padding: 0 12px; }
}
