/* The debug overlay (2026-10-21; debug-sheet.ts, at `?test=true` only, in play): a sheet of the
   visit's state at the right, 400px wide and the screen's height, scrolling on its own, beside
   play rather than over it; the whole screen on a phone (under 640px). The play page's palette:
   the sky, its ink and soft ink, the faint rules. Ochre only as a ring, once, round a value that
   just changed. Its own family, the system's sans (the player's page's Alegreya is a book's face,
   not an instrument's): headings wide (125%), identifiers narrow (75%) where the face has the
   widths, figures tabular; monospace only for the director's own text. */
.play { --sheet: 400px; }

/* Debug: a link in the soft ink, as End Crossing is. */
.top-actions .debug-open { color: var(--soft); }
.top-actions .debug-open:hover { color: var(--ink); }
.debug-open:focus-visible { outline-color: var(--ink); }

.debug {
  position: absolute; z-index: 5; top: 0; right: 0; bottom: 0; width: var(--sheet);
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  padding: 22px 24px calc(28px + env(safe-area-inset-bottom, 0px));
  background: var(--w-unlit); color: var(--w-ink); border-left: 1px solid var(--side-line);
  --soft: var(--w-unlit-soft);
  font: 400 15px/1.4 system-ui, sans-serif;
}
/* Open on a wide screen, the spread narrows into the room left of it (the gutter at that room's
   middle), so play, the writing line and End Crossing go on whole. */
@media (min-width: 1024px) {
  .play.debugging { padding-right: var(--sheet); }
  .play.debugging::after { left: calc((100% - var(--sheet)) / 2); }
}
.debug-close { float: right; width: 40px; min-height: 40px; padding: 0; margin: -4px -8px 0 12px; box-shadow: none; color: var(--w-ink); }
.debug-close svg { width: 20px; height: 20px; }
.debug-waiting { margin: 8px 0 0; color: var(--soft); font-style: italic; }

.debug-part { padding: 0 0 20px; }
.debug-part + .debug-part { padding-top: 18px; border-top: 1px solid var(--side-line); }
.debug h2 { margin: 6px 0 14px; font-size: 18px; font-weight: 700; font-stretch: 125%; line-height: 1.2; }
.debug h3 { margin: 18px 0 8px; font-size: 15px; font-weight: 700; font-stretch: 125%; }
.debug .ident, .debug-flags .flag, .debug-list li { font-stretch: 75%; }
.debug .figure { font-variant-numeric: tabular-nums; }
.debug .empty { color: var(--soft); font-style: italic; }

/* The switchboard, the one bold thing: a tile a flag, filled in the ink while true, a soft
   outline while false. */
.debug-flags { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; margin: 0 0 18px; padding: 0; list-style: none; }
.debug-flags .flag { min-height: 34px; padding: 7px 9px; border-radius: var(--r); box-shadow: inset 0 0 0 1px var(--soft); color: var(--soft); font-size: 14px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.debug-flags .flag.on { background: var(--w-ink); color: var(--w-unlit); box-shadow: none; }
.debug-flags .empty { grid-column: 1 / -1; }

.debug-facts { display: grid; grid-template-columns: 8.2em minmax(0, 1fr); gap: 7px 12px; margin: 0; }
.debug-facts dt { color: var(--soft); }
.debug-facts dd { justify-self: start; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.debug-list { margin: 0; padding: 0; list-style: none; }
.debug-list li + li { margin-top: 3px; }
ol.debug-list { padding-left: 1.6em; list-style: decimal; }
ol.debug-list li::marker { color: var(--soft); font-variant-numeric: tabular-nums; font-stretch: 100%; }
/* A Way's note under its place, in the field's own soft words. */
#debug-ways li + li { margin-top: 8px; }
#debug-ways .note { display: block; color: var(--w-unlit-ink); font-stretch: 100%; font-size: 14px; }
.debug-place { margin: 0 0 14px; font-size: 26px; font-weight: 650; line-height: 1.15; }

/* The director's last turn, closed by default; its prompt's Now: and its reply as the model wrote them. */
.debug-director summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; border-radius: var(--r); }
.debug-director summary::-webkit-details-marker { display: none; }
.debug-director summary::after { content: ""; width: 8px; height: 8px; margin-top: -4px; border: solid currentColor; border-width: 0 2px 2px 0; rotate: 45deg; transition: rotate .2s var(--settle); }
.debug-director[open] summary::after { rotate: 225deg; margin-top: 4px; }
.debug-director summary:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
.debug-director summary h2 { margin: 6px 0; }
.debug .turn-meta { display: block; margin: 8px 0 10px; color: var(--w-unlit-ink); }
.debug .turn-label { margin: 14px 0 6px; color: var(--soft); }
.debug pre { margin: 0; padding: 10px 12px; border-radius: var(--r); background: var(--side); color: var(--w-ink); font: 12.5px/1.45 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

/* A value just changed: an ochre ring, once, 1.2 s (none under reduced motion, play.css's rule). */
.debug .changed { border-radius: var(--r); outline: 2px solid transparent; outline-offset: 3px; animation: debug-ring 1.2s var(--settle) both; }
@keyframes debug-ring { from { outline-color: var(--y-lit); } }

/* A phone: the whole screen, the 16px gutter. */
@media (max-width: 639px) {
  .debug { width: 100%; border-left: 0; padding: 16px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
}
