/* Coding kit: editor, test results, console; weighted-graph routes. */
.cx { width: 100%; display: grid; gap: 10px; text-align: left; }
.cx-ed { --lh: 22px; --pad: 10px; --fs: 14.5px; border-radius: var(--r-sm); background: var(--surface); border: 1.5px solid var(--line); overflow: hidden; }
.cx-ed:focus-within { border-color: var(--accent); }
.cx-scroll { display: flex; max-height: min(60vh, 520px); overflow: auto; overscroll-behavior: contain; }
.cx-gut, .cx-hl, .cx-ta { font: 500 var(--fs)/var(--lh) ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace; tab-size: 2; letter-spacing: 0; }
.cx-gut { position: sticky; left: 0; z-index: 1; flex: none; min-width: 2.6em; padding: var(--pad) 8px var(--pad) 6px; text-align: right; white-space: pre; color: var(--ink-3); background: var(--surface-2); user-select: none; font-variant-numeric: tabular-nums; }
.cx-stack { display: grid; flex: 1 0 auto; min-width: 0; }
.cx-hl, .cx-ta { grid-area: 1 / 1; margin: 0; padding: var(--pad) 12px; white-space: pre; overflow-wrap: normal; border: 0; min-width: 100%;
  width: calc(var(--cols, 40) * 1ch + 24px); height: calc(var(--rows, 6) * var(--lh) + 2 * var(--pad)); }
.cx-hl { color: var(--ink); pointer-events: none; background: transparent; overflow: hidden; }
.cx-ta { color: transparent; caret-color: var(--ink); background: transparent; resize: none; outline: none; overflow: hidden; -webkit-text-fill-color: transparent; }
.cx-ta::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); -webkit-text-fill-color: transparent; }
.cx-ed.ro .cx-ta { caret-color: transparent; }
.cx-kw { color: var(--berry); font-weight: 650; }
.cx-str { color: var(--good); }
.cx-num { color: var(--sky); }
.cx-com { color: var(--ink-3); font-style: italic; }
.cx-fn { color: var(--accent); }
:root[data-theme="dark"] .cx-kw { color: #E79AB6; }
:root[data-theme="dark"] .cx-num { color: #8DB9E6; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cx-kw { color: #E79AB6; } :root:not([data-theme="light"]) .cx-num { color: #8DB9E6; } }
/* symbol row for touch keyboards */
.cx-keys { display: flex; gap: 6px; padding: 6px; overflow-x: auto; overscroll-behavior-x: contain; border-top: 1.5px solid var(--line); background: var(--surface-2); scrollbar-width: none; }
.cx-keys::-webkit-scrollbar { display: none; }
.cx-key { flex: none; min-width: 44px; height: 44px; padding: 0 6px; border: 0; border-radius: 10px; background: var(--surface); color: var(--ink); font: 650 18px ui-monospace, "SF Mono", Menlo, Consolas, monospace; touch-action: manipulation; }
.cx-key:active { background: var(--accent-soft); }
.cx-key:disabled { opacity: .45; }
.cx-key.tab { font-family: var(--font); }
@media (hover: hover) and (pointer: fine) { .cx-keys { display: none; } }
/* run bar, results, console */
.cx-bar { display: flex; align-items: center; gap: 10px; }
.cx-run { min-height: 44px; padding: 0 18px; background: var(--accent-soft); color: var(--accent); }
.cx-run .ic { width: 18px; height: 18px; fill: currentColor; }
.cx-run:disabled { opacity: .5; }
.cx-sum { flex: 1; font-size: 15px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.cx-sum b { font-size: 17px; }
.cx-sum.good b { color: var(--good); }
.cx-sum.bad b { color: var(--soft-red); }
.cx-tests { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.cx-t { display: grid; grid-template-columns: 14px minmax(0, auto) minmax(0, 1fr); align-items: baseline; gap: 4px 10px; padding: 7px 2px; border-bottom: 1px solid var(--line); font-size: 15px; }
.cx-t:last-child { border-bottom: 0; }
.cx-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--line); align-self: center; }
.cx-t.pass .cx-dot { background: var(--good); }
.cx-t.fail .cx-dot { background: var(--soft-red); }
.cx-lab code, .cx-kv code { background: none; padding: 0; font-weight: 600; word-break: break-word; white-space: pre-wrap; }
.cx-det { display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--ink-2); min-width: 0; }
.cx-kv i { font-style: normal; color: var(--ink-3); font-size: 13px; margin-right: 2px; }
.cx-t.fail .cx-kv:last-child code { color: var(--soft-red); }
.cx-err { color: var(--soft-red); }
.cx-out { margin: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink); font: 500 14px/1.5 ui-monospace, "SF Mono", Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow: auto; }
.cx-out.err { color: var(--soft-red); }
.cx-play { max-width: 640px; }
.model .cx { justify-items: stretch; }
@media (max-width: 600px) {
  .cx-ed { --fs: 16px; --lh: 24px; }
  .cx-t { grid-template-columns: 14px minmax(0, 1fr); }
  .cx-det { grid-column: 2; }
}

/* weighted graph: tap the route */
.gpw { display: grid; gap: 8px; width: 100%; max-width: 520px; margin: 0 auto; }
.gp { width: 100%; height: auto; color: var(--ink); touch-action: manipulation; }
.gp .gp-e { stroke: var(--ink-3); stroke-opacity: .55; stroke-width: 3; stroke-linecap: round; }
.gp .gp-e.on { stroke: var(--accent); stroke-opacity: 1; stroke-width: 6; }
.gp .gp-w rect { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.gp .gp-w text { font: 700 14px var(--font); fill: var(--ink-2); }
.gp .gp-w.on rect { stroke: var(--accent); }
.gp .gp-w.on text { fill: var(--accent); }
.gp .gp-hit { fill: transparent; }
.gp .gp-c { fill: var(--surface-2); stroke: var(--ink-3); stroke-width: 2; transition: fill .15s; }
.gp .gp-n text { font: 750 16px var(--font); fill: var(--ink); pointer-events: none; }
.gp .gp-n.start .gp-c, .gp .gp-n.end .gp-c { stroke: var(--accent); stroke-width: 3; }
.gp .gp-n.on .gp-c { fill: var(--accent); stroke: var(--accent); }
.gp .gp-n.on text { fill: var(--accent-ink); }
.gp .gp-n[role="button"] { cursor: pointer; outline: none; }
.gp .gp-n[role="button"]:focus-visible .gp-c { stroke: var(--sun); stroke-width: 4; }
.gp .gp-n.nope .gp-c { animation: gp-nope .35s; }
@keyframes gp-nope { 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
.gp .gp-n.nope { transform-box: fill-box; }
.gp-bar { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.gp-read { flex: 1; font: 650 17px var(--font); color: var(--ink); font-variant-numeric: tabular-nums; }
.gp-read b { color: var(--accent); }
.gpw.locked .gp-n { pointer-events: none; }
.gg-in { max-width: 120px; }
.gg-bar { width: min(100%, 420px); }
.gg-bar .vis { width: 100%; height: auto; color: var(--ink); }
