/* Memory explorer (the #explorer part of index.html). Builds on style.css; everything here is
   prefixed dx- and scoped to the .dx wrapper. */

.dx {
  --walked: #cdb78a;
  --water: #5aa2dc;
  --blocked: #8f8b80;
  --hazard: #d9412f;
  --lava: #ef7d1a;
  --floor: #bdb9ac;
  --placed: #9a6fdc;
  --agent: #2e7d4f;
  --agent-soft: #d9efdf;
  --match: #e0a400;
  --match-soft: #fbf1cf;
  --match-ink: #7a5a00;
  /* the map canvas reads these (demo.js) */
  --map-bg: #fbfcfd;
  --map-grid: #e8ecf1;
  --map-path: rgba(23, 37, 58, 0.3);
  --map-dot: #17253a;
  --map-dot-ring: #ffffff;
  --map-sel: #1d5fbf;
  --map-label: #7b8595;
  /* the kinds of memory take the colours of Figure 2 from style.css (--episodic and the rest) */
}
/* a kind of memory's colours, for anything drawn in them */
.k-episodic { --kind: var(--episodic); --kind-ink: var(--episodic-ink); --kind-soft: var(--episodic-soft); }
.k-spatial { --kind: var(--spatial); --kind-ink: var(--spatial-ink); --kind-soft: var(--spatial-soft); }
.k-semantic { --kind: var(--semantic); --kind-ink: var(--semantic-ink); --kind-soft: var(--semantic-soft); }
.k-procedural { --kind: var(--procedural); --kind-ink: var(--procedural-ink); --kind-soft: var(--procedural-soft); }
.k-working { --kind: var(--working); --kind-ink: var(--working-ink); --kind-soft: var(--working-soft); }

.dx-head { padding: 48px 0 22px; }
/* the heading, the text and the run picker keep to the column, as in the other sections */
.dx-head .wrap > * { max-width: var(--col); margin-left: auto; margin-right: auto; }
.dx-lede { color: var(--ink-soft); margin: 0 0 10px; }
/* what is put away until asked for: the notes on the replay, the query box */
.dx-fold > summary { cursor: pointer; width: fit-content; font-size: 0.92rem; font-weight: 600; color: var(--ink-soft); }
.dx-fold > summary:hover, .dx-fold[open] > summary { color: var(--ink); }
.dx-fold > summary .hint { font-weight: 400; color: var(--ink-faint); margin-left: 6px; }
.dx-fold[open] > summary { margin-bottom: 12px; }
.dx-about { margin: 0 0 18px; }
.dx-about p, .dx-about .limits li { font-size: 0.94rem; color: var(--ink-soft); }
.dx-runbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 0.92rem; }
.dx-runbar label { font-weight: 600; }
.dx-runbar select { max-width: 100%; }
.dx-runmeta { color: var(--ink-soft); }
.dx-runmeta b { color: var(--ink); font-weight: 600; }

.dx select, .dx input[type="text"], .dx button {
  font: inherit; font-size: 0.88rem; color: var(--ink);
}
.dx select, .dx input[type="text"] {
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel); padding: 5px 9px;
}
.dx button {
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel);
  padding: 5px 11px; cursor: pointer;
}
.dx button:hover { border-color: var(--ink-faint); background: var(--panel-2); }

.dx-status { padding: 18px 20px 60px; color: var(--ink-soft); }
.dx-status.error { color: var(--bad); }

/* ---------- time ---------- */
.dx-time {
  position: sticky; top: 53px; z-index: 15;
  background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: 12px 0 10px;
}
.dx-time-row { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
.dx-transport { display: flex; gap: 6px; align-items: stretch; }
.dx-transport button { min-width: 36px; }
.dx .dx-transport select { padding: 3px 6px; font-variant-numeric: tabular-nums; }
.dx .dx-playbtn { min-width: 64px; font-weight: 600; }
.dx .dx-playbtn[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* two lanes over the slider: labels on top, ticks and hatching below, so text never sits on a mark */
.dx-scrub { position: relative; padding-top: 32px; }
.dx-scrub input[type="range"] { width: 100%; margin: 0; display: block; accent-color: var(--accent); }
.dx-track { position: absolute; left: 8px; right: 8px; top: 0; height: 32px; pointer-events: none; }
.dx-mark { position: absolute; bottom: 2px; width: 2px; height: 7px; background: #b8c0cb; transform: translateX(-1px); }
.dx-mark.q { background: var(--episodic); height: 10px; }
.dx-mark.w { height: 13px; width: 3px; }
.dx-mark.w.semantic { background: var(--semantic); }
.dx-mark.w.procedural { background: var(--procedural); }
.dx-mark.w.working { background: var(--working); }
.dx-mark.m { background: var(--navy); height: 15px; }
.dx-lab { position: absolute; font-style: normal; font-size: 0.68rem; line-height: 13px; white-space: nowrap; }
.dx-mark.m .dx-lab { bottom: calc(100% + 2px); left: 50%; transform: translateX(-50%); font-weight: 700; color: var(--navy); }
/* the part of the recording after the memory's last write: hatching below, its note above, one rule down the left */
.dx-hold { position: absolute; right: 0; bottom: 2px; height: 13px; border-left: 2px solid var(--ink-faint);
  background: repeating-linear-gradient(135deg, rgba(123, 122, 114, 0.28) 0 3px, transparent 3px 7px); }
.dx-hold-note { position: absolute; right: 0; top: 0; height: 17px; border-left: 2px solid var(--ink-faint);
  overflow: hidden; }
.dx-hold-note .dx-lab { top: 0; left: 6px; font-size: 0.66rem; color: var(--ink-faint); }

.dx-time-end { display: flex; gap: 14px; align-items: center; }
.dx .dx-time-end button { color: var(--ink-soft); }
.dx .dx-time-end button[aria-expanded="true"] { background: var(--panel-2); border-color: var(--ink-faint); color: var(--ink); }
.dx-readout { font-size: 0.88rem; color: var(--ink-soft); text-align: right; min-width: 250px;
  font-variant-numeric: tabular-nums; line-height: 1.35; }
.dx-readout b { color: var(--ink); font-size: 1.15rem; font-weight: 600; }

.dx-stats { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font-size: 0.8rem;
  color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.dx-stats span b { color: var(--ink); font-weight: 600; }
.dx-stats code { font-size: 0.95em; }
.dx-stats .dx-legend { margin-left: auto; display: flex; gap: 12px; }
.dx-key::before { content: ""; display: inline-block; width: 3px; height: 10px; margin-right: 5px;
  vertical-align: -1px; background: #b8c0cb; }
.dx-key.q::before { background: var(--episodic); }
.dx-key.w.semantic::before { background: var(--semantic); }
.dx-key.w.procedural::before { background: var(--procedural); }
.dx-key.w.working::before { background: var(--working); }
.dx-key.m::before { background: var(--navy); }
.dx-stats .dx-legend .dx-key.w { margin-right: -6px; }

/* ---------- query ---------- */
.dx-query { padding: 14px 0 0; }
.dx-cmd { display: flex; gap: 8px; align-items: stretch; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 7px 7px 7px 14px; }
.dx-cmd-prompt { font-family: var(--mono); font-size: 0.85rem; color: var(--code-ink); align-self: center;
  white-space: nowrap; }
.dx .dx-cmd input[type="text"] { flex: 1; min-width: 0; font-family: var(--mono); font-size: 0.85rem;
  background: var(--panel-2); border-color: transparent; }
.dx .dx-cmd input::placeholder { color: var(--ink-faint); }
.dx .dx-cmd .dx-run-btn { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 600; }
.dx .dx-cmd .dx-run-btn:hover { background: #000; }
.dx-helpers { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 11px 0 0; font-size: 0.82rem; }
.dx-helpers-label, .dx-hint { color: var(--ink-faint); }
.dx .dx-helpers button, .dx .dx-helpers select { font-family: var(--mono); font-size: 0.78rem; padding: 3px 8px; }
/* a run without the query tool: the box is off and says why */
.dx #dx-form :disabled, .dx .dx-helpers :disabled { opacity: 0.45; cursor: not-allowed; }
.dx-notool { margin: 10px 0 0; max-width: 820px; font-size: 0.86rem; color: var(--ink-soft);
  border-left: 3px solid var(--pink); padding: 2px 0 2px 10px; }

.dx-result { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel); overflow: hidden; }
.dx-trace { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; padding: 10px 14px;
  border-bottom: 1px solid var(--line); background: var(--match-soft); font-size: 0.84rem; }
.dx-trace .st { font-family: var(--mono); font-size: 0.78rem; background: var(--panel); border: 1px solid #e3cf86;
  border-radius: 4px; padding: 1px 7px; }
.dx-trace .st b { font-family: var(--sans); color: var(--match-ink); }
.dx-trace .arrow { color: var(--ink-faint); }
.dx-trace .asof { margin-left: auto; color: var(--ink-soft); font-size: 0.8rem; }
.dx-trace.err { background: var(--bad-soft); }
.dx-out { margin: 0; border: 0; border-radius: 0; max-height: 210px; overflow: auto; font-size: 0.74rem; white-space: pre; }
.dx-out .e { color: var(--bad); }
.dx-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 6px; padding: 10px;
  max-height: 250px; overflow: auto; border-top: 1px solid var(--line); background: var(--panel-2); }
.dx .dx-thumb { padding: 0; border: 2px solid transparent; border-radius: var(--radius-sm);
  overflow: hidden; background: #000; text-align: left; position: relative; }
.dx-thumb img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.dx-thumb span { display: block; font-family: var(--mono); font-size: 0.66rem; color: #fff; padding: 2px 5px; }
.dx .dx-thumb.sel { border-color: var(--accent); }
.dx-sheet-note { grid-column: 1 / -1; font-size: 0.8rem; color: var(--ink-soft); margin: 0; }

/* ---------- panels ---------- */
.dx-main { padding: 14px 0 56px; }
.dx-cols { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 20px; align-items: start; }
/* with a recording, the right column is the video over the detail tabs, as tall as the left */
.dx-cols.has-video { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: stretch; }
.dx-cols.has-video #dx-right { display: flex; flex-direction: column; }
.dx-cols.has-video #dx-right .dx-body { height: 0; flex: 1 1 0; min-height: 0; }
.dx-cols.has-video .dx-index .sum { min-width: 200px; }
.dx-video { position: relative; background: #000; flex: none; }
.dx-video video { display: block; width: 100%; aspect-ratio: 16 / 9; background: #000; cursor: pointer; }
.dx-vidcap { position: absolute; left: 8px; bottom: 8px; max-width: calc(100% - 16px); pointer-events: none;
  font-family: var(--mono); font-size: 0.72rem; line-height: 1.4; color: #fff; background: rgba(20, 18, 14, 0.78);
  border-radius: 4px; padding: 2px 7px; font-variant-numeric: tabular-nums; }
.dx-vidcap:empty { display: none; }
.dx-vidcap.bad { top: 50%; bottom: auto; transform: translateY(-50%); color: #ffb4a8; }
/* rows and log sections written while playing arrive with a short flash */
/* the episode's own first frame, smaller beside its details: the video is above it */
.dx-cols.has-video .dx-frame { float: right; width: 36%; margin: 14px 16px 8px 12px; }
.dx-cols.has-video #dx-right .dx-h, .dx-cols.has-video #dx-right details { clear: right; }
@keyframes dx-arrive { from { background: var(--accent-soft); } to { background: transparent; } }
.dx-index tr.just td, .dx-log-sec.just { animation: dx-arrive 1.4s ease-out; }
@media (prefers-reduced-motion: reduce) { .dx-index tr.just td, .dx-log-sec.just { animation: none; } }
.dx-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden;
  box-shadow: var(--shadow); }
/* the memory as Figure 2 draws it: a navy frame, the harness's records and the agent's files in two
   dashed groups, and a box for each kind listing the files that hold it. A box's title opens its view
   below; a file opens itself. */
.dx-mem { border-bottom: 1px solid var(--line); background: #f8fafc; padding-bottom: 2px; }
.dx-mem-top { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; justify-content: space-between;
  padding: 6px 12px; background: var(--navy); }
.dx-mem-title { font-size: 0.86rem; font-weight: 700; color: #fff; }
.dx-mem-title code { background: none; padding: 0; color: inherit; font-size: 0.95em; }
.dx-mem-also { font-size: 0.78rem; color: var(--on-dark-soft); }
.dx .dx-mem-also button { font-family: var(--mono); font-size: 0.74rem; padding: 1px 8px; margin-left: 4px;
  color: #fff; background: transparent; border-color: rgba(255, 255, 255, 0.35); }
.dx .dx-mem-also button:hover { background: rgba(255, 255, 255, 0.12); border-color: #fff; }
.dx .dx-mem-also button[aria-selected="true"] { background: #fff; border-color: #fff; color: var(--navy); }
.dx-mem-group { margin: 8px 10px; padding: 5px 8px 8px; border: 1.5px dashed #c3cbd6; border-radius: 8px; }
.dx-mem-cap { margin: 0 0 5px; font-size: 0.72rem; line-height: 1.4; color: var(--ink-faint); }
.dx-mem-cap b { font-weight: 600; color: var(--ink-soft); margin-right: 6px; }
.dx-mem-row { display: flex; gap: 8px; }
/* the agent's three: two side by side and the plan under them, as in the method figure */
.dx-mem-row.agent { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dx-mem-row.agent .working { grid-column: 1 / -1; }
.dx-box { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column;
  border: 1.5px solid var(--kind); border-radius: var(--radius-sm); background: var(--kind-soft); }
.dx-box.episodic { flex-grow: 1.5; }
.dx-box.episodic { --kind: var(--episodic); --kind-ink: var(--episodic-ink); --kind-soft: var(--episodic-soft); }
.dx-box.spatial { --kind: var(--spatial); --kind-ink: var(--spatial-ink); --kind-soft: var(--spatial-soft); }
.dx-box.semantic { --kind: var(--semantic); --kind-ink: var(--semantic-ink); --kind-soft: var(--semantic-soft); }
.dx-box.procedural { --kind: var(--procedural); --kind-ink: var(--procedural-ink); --kind-soft: var(--procedural-soft); }
.dx-box.working { --kind: var(--working); --kind-ink: var(--working-ink); --kind-soft: var(--working-soft); }
.dx-box.sel { box-shadow: 0 0 0 1.5px var(--kind); }
/* an open box (the map is the view to come back to) closes on a second click: say so */
.dx-box.sel:not(.spatial) .dx-box-h::after,
.dx .dx-mem-also button[aria-selected="true"]::after { content: "\2715"; margin-left: auto; font-size: 0.7rem; color: var(--kind-ink, inherit); }
.dx .dx-mem-also button[aria-selected="true"]::after { margin-left: 6px; }
.dx .dx-box-h { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 7px; width: 100%; text-align: left;
  padding: 5px 9px 3px; border: 0; border-radius: var(--radius-sm) var(--radius-sm) 0 0; background: none; line-height: 1.35; }
.dx .dx-box-h:hover { background: rgba(255, 255, 255, 0.55); }
.dx-box .t { font-size: 0.84rem; font-weight: 700; color: var(--kind-ink); }
.dx-box .d { font-size: 0.74rem; font-style: italic; color: var(--ink-soft); }
.dx-box .v { display: flex; flex-direction: column; gap: 1px; padding: 0 5px 6px; }
.dx .dx-fe { display: flex; align-items: baseline; gap: 6px; width: 100%; min-width: 0; text-align: left;
  padding: 1px 5px; border: 0; border-radius: 4px; background: none; font-size: 0.74rem; line-height: 1.5; }
.dx .dx-fe:hover { background: rgba(255, 255, 255, 0.8); }
/* the name keeps its width (up to three quarters of the row); the note beside it gives way first */
.dx .dx-fe code { flex: 0 0 auto; max-width: 75%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 0.72rem; background: none; padding: 0; color: var(--ink); }
.dx .dx-fe span { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.dx .dx-fe.cur { background: #fff; box-shadow: inset 2px 0 0 var(--kind); }
.dx .dx-fe.absent code { color: var(--ink-faint); }
.dx .dx-fe.more span { color: var(--kind-ink); }
.dx-fe-note { padding: 1px 5px; font-size: 0.72rem; line-height: 1.5; color: var(--ink-faint); }
.dx-box.none .dx-fe-note { font-style: italic; }
@keyframes dx-wrote { from { box-shadow: 0 0 0 2px var(--kind); } to { box-shadow: 0 0 0 2px transparent; } }
.dx .dx-box.just:not(.sel) { animation: dx-wrote 1.2s ease-out; }
@media (prefers-reduced-motion: reduce) { .dx .dx-box.just { animation: none; } }
/* the view below the boxes wears the colour of the kind on show */
.dx-body[class*="k-"] { box-shadow: inset 0 3px 0 var(--kind); }
.dx-kind { display: inline-block; margin: 0 0 6px; padding: 0 9px; border: 1px solid var(--kind); border-radius: 999px;
  background: var(--kind-soft); color: var(--kind-ink); font-size: 0.72rem; font-weight: 600; line-height: 1.6; }
.dx-mem + .dx-body { height: 560px; }
.dx-kindnote { font-size: 0.82rem; line-height: 1.5; color: var(--ink-soft); margin: 0 0 12px; padding: 2px 0 2px 10px;
  border-left: 3px solid var(--kind, var(--line)); }
.dx-files.one { grid-template-columns: 1fr; }
.dx-patch span.add, .dx-patch span.del { display: block; font-size: 0.8rem; overflow-wrap: anywhere; padding-left: 1.1em;
  text-indent: -1.1em; }
.dx-patch span.del { color: var(--ink-faint); text-decoration: line-through; }
.dx-body .dx-patch details { margin: 6px 0 0; background: none; border: 0; }
.dx-body .dx-patch details > summary { padding: 0; font-size: 0.74rem; font-weight: 500; color: var(--ink-faint); }
.dx-body .dx-patch details > *:not(summary) { margin-left: 0; margin-right: 0; }

.dx-tabs { display: flex; gap: 2px; padding: 0 8px; background: var(--panel); border-bottom: 1px solid var(--line);
  overflow-x: auto; }
.dx .dx-tabs button { border: 0; border-radius: 0; background: none;
  padding: 10px 12px; color: var(--ink-soft); font-weight: 500; white-space: nowrap; }
.dx .dx-tabs button:hover { color: var(--ink); background: none; }
.dx .dx-tabs button[aria-selected="true"] { color: var(--ink); font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.dx-tabs .n { color: var(--ink-faint); font-weight: 400; font-size: 0.8em; margin-left: 4px; }
.dx-body { height: 640px; overflow: auto; scrollbar-color: var(--line) var(--panel); }
.dx-pad { padding: 14px 16px; }
.dx-bar { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 8px 12px;
  border-bottom: 1px solid var(--line); font-size: 0.82rem; color: var(--ink-soft); position: sticky; top: 0;
  background: var(--panel); z-index: 2; }
.dx-bar label { display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
.dx-bar input[type="checkbox"] { accent-color: var(--accent); }
.dx-bar .grow { flex: 1; }
.dx-empty { color: var(--ink-faint); font-size: 0.9rem; padding: 26px 16px; text-align: center; }

/* index table */
table.dx-index { width: 100%; border-collapse: collapse; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
.dx-index th { position: sticky; top: 37px; background: var(--panel-2); text-align: left; font-weight: 600;
  color: var(--ink-soft); padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; z-index: 1; }
.dx-index td { padding: 5px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.dx-index tr { cursor: pointer; }
.dx-index tbody tr:hover td { background: var(--panel-2); }
.dx-index tr.match td { background: var(--match-soft); }
.dx-index tr.match td:first-child { box-shadow: inset 3px 0 0 var(--match); }
.dx-index tr.sel td { background: var(--accent-soft) !important; }
.dx-index tr.fresh td:first-child::after { content: "new"; margin-left: 5px; font-family: var(--sans);
  font-size: 0.64rem; font-weight: 700; color: #fff; background: var(--accent);
  border-radius: 3px; padding: 0 5px; }
.dx-index tr.open td { color: var(--ink-faint); font-style: italic; border-bottom-style: dashed; }
.dx-index tr.dx-more { cursor: default; }
.dx-cut { color: var(--ink-faint); font-style: italic; }
.dx-logmore { margin: 0; padding: 8px 14px; font-size: 0.78rem; text-align: center; }
.dx-logmore:empty { display: none; }
.dx-index tr.dx-more td { color: var(--ink-faint); font-style: italic; text-align: center; background: none !important; }
.dx-index .id, .dx-index .act { font-family: var(--mono); font-size: 0.74rem; white-space: nowrap; }
.dx-index .id { color: var(--accent-ink); }
.dx-index .sum { color: var(--ink-soft); overflow-wrap: anywhere; min-width: 260px; }
.dx-index td:nth-child(3) { max-width: 130px; }
.dx-index .num { white-space: nowrap; }

.dx-tagchip { display: inline-block; font-size: 0.66rem; font-weight: 600; line-height: 1.6; padding: 0 6px;
  border-radius: 4px; background: #eceff3; color: #4b5667; margin: 0 3px 2px 0; white-space: nowrap; }
.dx-tagchip.milestone { background: var(--good-soft); color: var(--good-ink); }
.dx-tagchip.damage, .dx-tagchip.stuck { background: var(--bad-soft); color: var(--bad-ink); }
.dx-tagchip.inventory_changed, .dx-tagchip.broke { background: var(--accent-soft); color: var(--accent-ink); }
.dx-tagchip.kind-episodes { background: var(--accent-soft); color: var(--accent-ink); }
.dx-tagchip.kind-log { background: #e8e0f5; color: #55389a; }
.dx-tagchip.kind-mine { background: var(--good-soft); color: var(--good-ink); }
.dx-tagchip.kind-reference { background: var(--match-soft); color: var(--match-ink); }

/* map */
.dx-mapwrap { position: relative; }
.dx-mapwrap canvas { display: block; width: 100%; cursor: crosshair; background: var(--map-bg);
  touch-action: pan-x pan-y; }
/* zoomed in, a drag moves the map rather than the page */
.dx-mapwrap canvas.zoomed { cursor: grab; touch-action: none; }
.dx-mapwrap canvas.dragging { cursor: grabbing; }
.dx-zoom { display: inline-flex; gap: 4px; margin-left: auto; }
.dx .dx-zoom button { min-width: 30px; padding: 0 7px; font-size: 0.95rem; line-height: 1.5; }
.dx .dx-zoom button:disabled { opacity: 0.45; cursor: default; border-color: var(--line); background: var(--panel); }
.dx-body details.dx-maplegend { margin: 0; border: 0; border-top: 1px solid var(--line); border-radius: 0;
  background: none; font-size: 0.78rem; color: var(--ink-soft); }
.dx-body details.dx-maplegend > summary { padding: 7px 12px; font-size: 0.78rem; font-weight: 500; }
.dx-maplegend .dx-keys { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.dx-maplegend p { margin-top: 6px; margin-bottom: 8px; }
.dx-sw { display: inline-block; width: 10px; height: 10px; margin-right: 5px; vertical-align: -1px; border-radius: 2px; }
.dx-sw.dot { border-radius: 50%; }

/* files */
.dx-files { display: grid; grid-template-columns: minmax(200px, 250px) 1fr; height: 100%; }
.dx-tree { border-right: 1px solid var(--line); overflow: auto; padding: 8px 0; font-family: var(--mono);
  font-size: 0.76rem; background: var(--panel-2); }
.dx .dx-tree button { display: block; width: 100%; text-align: left; border: 0; border-radius: 0; background: none;
  padding: 3px 10px; font-family: var(--mono); font-size: 0.76rem; line-height: 1.45; }
.dx .dx-tree button:hover { background: var(--line-soft); }
.dx .dx-tree button.sel { background: var(--kind-soft, var(--accent-soft)); color: var(--kind-ink, var(--accent-ink));
  box-shadow: inset 3px 0 0 var(--kind, var(--accent)); }
.dx .dx-tree button[class*="k-"] { box-shadow: inset 3px 0 0 var(--kind-soft); }
.dx .dx-tree button.sel[class*="k-"] { box-shadow: inset 3px 0 0 var(--kind); }
.dx-tree .dir { padding: 9px 10px 3px; color: var(--ink-faint); font-family: var(--sans); font-size: 0.72rem; font-weight: 600; }
.dx-tree .dir:first-child { padding-top: 2px; }
.dx-tree .dir[class*="k-"] { color: var(--kind-ink); }
.dx-tree .dir[class*="k-"]::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 6px;
  border-radius: 2px; background: var(--kind); vertical-align: -0.5px; }
.dx-tree .meta { display: block; font-family: var(--sans); font-size: 0.7rem; color: var(--ink-faint); }
.dx-tree .absent { color: var(--ink-faint); font-style: italic; }
.dx-view { overflow: auto; min-width: 0; }
.dx-view h4 { font-family: var(--mono); font-size: 0.86rem; margin: 0 0 2px; }
.dx-view .who { font-size: 0.8rem; color: var(--ink-soft); margin: 0 0 10px; }
.dx-view pre, .dx-body pre { margin: 8px 0; font-size: 0.72rem; line-height: 1.5; padding: 10px 12px;
  border-radius: var(--radius-sm); white-space: pre-wrap; overflow-wrap: anywhere; }
.dx-note-line { border-left: 3px solid var(--kind, var(--agent)); background: var(--kind-soft, #eef6f0); padding: 7px 10px;
  margin: 0 0 8px; font-size: 0.84rem; line-height: 1.5; }
.dx-note-line .when { display: block; font-size: 0.72rem; color: var(--kind-ink, var(--agent)); font-weight: 600; margin-bottom: 1px; }
.dx-note-line.fresh { background: color-mix(in srgb, var(--kind, var(--agent)) 18%, #fff); }
.dx-note-line.later { border-left-color: var(--line); background: none; color: var(--ink-faint); }
.dx-note-line.later .when { color: var(--ink-faint); }

/* log */
.dx-log-sec { border-bottom: 1px solid var(--line-soft); padding: 8px 14px; font-family: var(--mono); font-size: 0.72rem;
  line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.dx-log-sec .h { font-weight: 700; color: var(--ink); display: block; }
.dx-log-sec .k-PLAN { color: #55389a; }
.dx-log-sec .k-NOTE { color: var(--match-ink); }
.dx-log-sec .k-EVENT, .dx-log-sec .k-INV { color: var(--accent-ink); }
.dx-log-sec .k-ACTION { color: var(--ink); font-weight: 600; }
.dx-log-sec .k-STATE, .dx-log-sec .k-GUI { color: var(--ink-faint); }
.dx-log-sec mark { background: #ffe27a; color: #000; }
.dx .dx-bar input[type="text"] { font-family: var(--mono); font-size: 0.78rem; padding: 3px 8px; min-width: 190px; }

/* episode + turn */
.dx-frame { width: 100%; aspect-ratio: 16 / 9; background: #000; image-rendering: auto;
  border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 12px; }
.dx-eph { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: baseline; margin: 0 0 6px; }
.dx-eph h3 { margin: 0; font-family: var(--mono); font-size: 1rem; }
.dx-eph .sub { color: var(--ink-soft); font-size: 0.84rem; }
.dx-kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 0.82rem; margin: 10px 0; }
.dx-kv dt { color: var(--ink-faint); white-space: nowrap; }
.dx-kv dd { margin: 0; overflow-wrap: anywhere; }
.dx-body details { border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 8px 0; background: var(--panel-2); }
.dx-body details > summary { cursor: pointer; padding: 7px 11px; font-size: 0.84rem; font-weight: 600; }
.dx-body details > summary .hint { font-weight: 400; color: var(--ink-faint); margin-left: 6px; font-size: 0.92em; }
.dx-body details > *:not(summary) { margin-left: 11px; margin-right: 11px; }
.dx-body details pre { background: var(--panel); color: var(--code-ink); border: 1px solid var(--line); max-height: 300px;
  overflow: auto; }
.dx-body pre.term-like { background: var(--code-bg); color: var(--code-ink); border: 1px solid var(--line); }
.dx-searchable b { background: var(--match-soft); font-weight: 400; border-bottom: 1px solid var(--match); }
.dx-h { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink-faint); margin: 18px 0 6px; }
.dx-h:first-child { margin-top: 0; }
.dx-usedby { list-style: none; margin: 0; padding: 0; font-size: 0.82rem; }
.dx-usedby li { padding: 4px 0; border-bottom: 1px solid var(--line-soft); display: flex; gap: 8px; align-items: baseline; }
.dx-usedby code { flex: 1; min-width: 0; }
.dx .dx-link { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline;
  font-size: inherit; cursor: pointer; white-space: nowrap; }
.dx .dx-link:hover { background: none; color: var(--accent-ink); }
.dx-cmdcard { border: 1px solid var(--line); border-radius: var(--radius-sm); margin: 0 0 10px; overflow: hidden; }
.dx-cmdcard .top { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; padding: 6px 10px;
  background: var(--panel-2); border-bottom: 1px solid var(--line); font-size: 0.78rem; color: var(--ink-soft); }
.dx-cmdcard .top .grow { flex: 1; }
.dx-cmdcard pre { margin: 0; border: 0; border-radius: 0; }
.dx-cmdcard pre.script { background: var(--code-bg); color: var(--code-ink); border: 0; }
.dx-cmdcard pre.script b { color: var(--accent-ink); font-weight: 600; }
.dx-cmdcard details { border: 0; border-top: 1px solid var(--line); border-radius: 0; margin: 0; }
.dx-cmdcard details pre { margin: 0 0 8px; }
.dx-msg { font-size: 0.86rem; line-height: 1.55; color: var(--ink-soft); border-left: 3px solid var(--line);
  padding: 2px 0 2px 10px; margin: 0 0 8px; }
.dx-asked { width: 100%; border-collapse: collapse; font-size: 0.8rem; }
.dx-asked td { padding: 6px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.dx-asked tr { cursor: pointer; }
.dx-asked tr:hover td { background: var(--panel-2); }
.dx-asked tr.future td { color: var(--ink-faint); }
.dx-asked tr.now td { background: var(--accent-soft); }
.dx-asked code { font-size: 0.76rem; background: none; padding: 0; }
.dx-asked .num { white-space: nowrap; font-variant-numeric: tabular-nums; }

.dx-tip { position: fixed; z-index: 60; pointer-events: none; background: var(--ink); color: #fff;
  border-radius: var(--radius-sm); box-shadow: 0 6px 18px -6px rgba(20, 18, 14, 0.5);
  font-size: 0.74rem; line-height: 1.4; padding: 5px 8px; max-width: 320px; }


@media (max-width: 1000px) {
  .dx-cols, .dx-cols.has-video { grid-template-columns: 1fr; }
  .dx-body, .dx-cols.has-video #dx-right .dx-body { height: 540px; flex: none; }
  .dx-cols.has-video #dx-right { order: -1; }
  .dx-time-row { grid-template-columns: auto 1fr; }
  .dx-time-end { grid-column: 1 / -1; justify-content: space-between; }
  .dx-readout { text-align: left; min-width: 0; }
  .dx-stats .dx-legend { margin-left: 0; }
}
@media (max-width: 640px) {
  .dx-mem-row { flex-wrap: wrap; }
  .dx-box, .dx-box.episodic { flex: 1 1 40%; }
  .dx-box .d { display: none; }
  .dx-time { position: static; }
  .dx-cmd { flex-wrap: wrap; }
  .dx-cmd-prompt { width: 100%; }
  .dx-files { grid-template-columns: 1fr; height: auto; }
  .dx-tree { border-right: 0; border-bottom: 1px solid var(--line); max-height: 220px; }
}
