/* /demos/agent-swarm-lab page chrome.
 *
 * Loaded only by this page, through Tags.PageCSS. Not a shell asset, so the ?v=
 * in PageCSSHref is the whole cache-busting story.
 *
 * THE CANVASES READ THEIR COLORS FROM THESE CUSTOM PROPERTIES, so a theme flip
 * recolors them without a second palette in the script. The shared sheet's
 * tokens (--ink, --ink-muted, --hairline, --surface-alt, --accent) are reused
 * for chrome; the page's own vocabulary — the two designs, the swarm, the
 * target and the shot outcomes — is declared here, under the same three-way
 * discipline as the shared sheet: system preference, then an explicit toggle
 * overriding it in BOTH directions.
 */

.asl-stage,
.asl-section {
  --asl-ink: var(--ink);
  --asl-ink-muted: var(--ink-muted);
  --asl-hairline: var(--hairline);
  --asl-central: #b35900;
  --asl-mesh: #0a66c2;
  --asl-red: #c62828;
  --asl-ctrl: #6a1b9a;
  --asl-killed: #8a8a8e;
  --asl-arrived: #1a7f37;
  --asl-target: #1a7f37;
  --asl-hit: #c62828;
  --asl-miss: #8a8a8e;
}

@media (prefers-color-scheme: dark) {
  .asl-stage,
  .asl-section {
    --asl-central: #f0883e;
    --asl-mesh: #58a6ff;
    --asl-red: #ff6b6b;
    --asl-ctrl: #d2a8ff;
    --asl-killed: #8e8e93;
    --asl-arrived: #3fb950;
    --asl-target: #3fb950;
    --asl-hit: #ff6b6b;
    --asl-miss: #8e8e93;
  }
}

[data-theme="dark"] .asl-stage,
[data-theme="dark"] .asl-section {
  --asl-central: #f0883e;
  --asl-mesh: #58a6ff;
  --asl-red: #ff6b6b;
  --asl-ctrl: #d2a8ff;
  --asl-killed: #8e8e93;
  --asl-arrived: #3fb950;
  --asl-target: #3fb950;
  --asl-hit: #ff6b6b;
  --asl-miss: #8e8e93;
}

[data-theme="light"] .asl-stage,
[data-theme="light"] .asl-section {
  --asl-central: #b35900;
  --asl-mesh: #0a66c2;
  --asl-red: #c62828;
  --asl-ctrl: #6a1b9a;
  --asl-killed: #8a8a8e;
  --asl-arrived: #1a7f37;
  --asl-target: #1a7f37;
  --asl-hit: #c62828;
  --asl-miss: #8a8a8e;
}

.asl-stage__label {
  margin: 1.5rem 0 0.5rem;
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--accent);
  border-radius: 0 6px 6px 0;
  background: var(--surface-alt);
}

.asl-status {
  color: var(--ink-muted);
  font-size: 0.95rem;
  min-height: 1.4em;
}

.asl-section {
  margin: 2rem 0;
}

.asl-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* On a phone the two panels stack, Central above Mesh, so each keeps enough
 * width for its lanes to stay readable. */
@media (max-width: 720px) {
  .asl-panels {
    grid-template-columns: 1fr;
  }
}

.asl-panel {
  margin: 0;
  padding: 0.5rem;
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface-alt);
}

.asl-panel figcaption {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.asl-panel__tally {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.asl-canvas {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
}

.asl-canvas--wide {
  border: 1px solid var(--hairline);
  border-radius: 8px;
  background: var(--surface-alt);
}

.asl-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  list-style: none;
  padding: 0;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

.asl-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: middle;
}

.asl-dot--flying { background: var(--asl-red); }
.asl-dot--holding { border: 2px solid var(--asl-red); }
.asl-dot--killed { background: var(--asl-killed); border-radius: 0; }
.asl-dot--arrived { background: var(--asl-arrived); }

.asl-line {
  display: inline-block;
  width: 18px;
  height: 0;
  vertical-align: middle;
  border-top: 2px solid var(--asl-hit);
}

.asl-line--miss { border-top: 2px dashed var(--asl-miss); }

.asl-key--ctrl {
  border-bottom: 2px solid var(--asl-ctrl);
}

.asl-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem 1.5rem;
}

.asl-control label {
  display: block;
  margin-bottom: 0.25rem;
}

.asl-control input[type="range"],
.asl-control input[type="number"] {
  width: 100%;
}

.asl-control--check label {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.asl-finding {
  font-weight: 600;
  font-size: 1.05rem;
}

.asl-table-wrap {
  overflow-x: auto;
}

.asl-table {
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
}

.asl-table th,
.asl-table td {
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid var(--hairline);
  text-align: left;
}

.asl-table tr[data-result="miss"] td:last-child {
  color: var(--error);
  font-weight: 600;
}

.asl-score {
  font-size: 1.1rem;
}

.asl-limit {
  padding: 0.75rem 1rem;
  border-left: 4px solid var(--ink-muted);
  background: var(--surface-alt);
}

.asl-prompt {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.85rem;
  padding: 0.75rem;
  background: var(--surface-alt);
  border-radius: 6px;
}

.asl-method ul {
  padding-left: 1.2rem;
}
