/* build 64b5447 · main · 2026-09-13T19:36:40Z · c35904fb */
/* The config screen.
 *
 * A tech-facing screen, not an audience-facing one, so it is deliberately plain:
 * legible from arm's length on a 50" panel, with touch targets a gloved hand can
 * hit, and nothing decorative. It sits above everything else because it is
 * reached by a gesture from whatever is already on the glass.
 *
 * The four-digit setup pad specced in docs/specs/2026-09-04-setup-screen.md is
 * built below, digits only — a bare Windows panel has no keyboard AND no soft
 * numeric keypad, so touch is the only way in. The `<input>` stays alongside
 * it for a bench with a real keyboard; both write the same field, and it is
 * the same config.js underneath either way. The sixteen-emoji alphabet the
 * spec also describes is not built: it changes what a code means, which
 * reaches storage-key territory this screen does not own. */

/* A right-anchored sidebar, not a full screen.
 *
 * It is reached by swiping in from the right edge — ScreenCloud's convention,
 * which the techs running these panels already have in their hands — so it comes
 * from the side the finger came from. A panel that slides in from where you
 * pushed reads as the thing you pulled; one that replaces the whole screen reads
 * as something that went wrong. */
.cfg-screen {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(620px, 92vw);
  z-index: 100;
  overflow-y: auto;
  background: #14141a;
  color: #f4f4f6;
  font: 400 clamp(16px, 1.6vh, 26px)/1.5 system-ui, sans-serif;
  padding: 4vh 5vh;
  border-left: 1px solid #2c2c36;
  box-shadow: -24px 0 60px rgb(0 0 0 / 45%);
}

/* 🔴 NO ENTRANCE ANIMATION, and that is a decision rather than an omission.
 *
 * This panel first shipped with `animation: cfg-slide-in 180ms` sliding in from
 * `translateX(100%)`. Opened on a hidden page it rendered **entirely off-screen**:
 * measured `playState: "running"`, `currentTime: 0`, `transform: translateX(620px)`
 * — a hidden page is served no animation frames, so the clock never advanced and
 * the panel stayed parked at frame 0.
 *
 * This is finding X a second time. That one hung boot on a `requestAnimationFrame`
 * that never fired; this one hid the config screen from a tech who had just asked
 * for it. Same root cause, different symptom, and the general rule is the one
 * worth keeping: **never let an animation be responsible for where something ends
 * up.** A fade would fail the same way — frame 0 is `opacity: 0`.
 *
 * On a foreground kiosk it resolved in 180ms and would have looked fine in every
 * test that happened to be watching. */

.cfg {
  display: flex;
  flex-direction: column;
  gap: 0.9em;
}

/* Full width and taller than the paired buttons below it: this is the control a
 * tech reaches for most, and after a publish it is the only one they want. */
.cfg .reload {
  touch-action: none;   /* see .cfg .actions button */
  font: inherit;
  font-size: 1.1em;
  min-height: 88px;
  margin-top: 0.4em;
  border-radius: 10px;
  border: 1px solid #3a3a46;
  background: #2a2a34;
  color: inherit;
  cursor: pointer;
}

.cfg .reload:disabled { opacity: 0.55; cursor: default; }

.cfg h1 {
  margin: 0 0 0.4em;
  font-size: 1.7em;
  font-weight: 600;
}

/* Label left, value right, with the value in a monospace face: a tech comparing
 * two panels is reading hashes and ULIDs, where proportional digits are the
 * difference between a match and a near-match. */
.cfg .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1em;
  padding: 0.45em 0;
  border-bottom: 1px solid #2c2c36;
}

.cfg .row span { color: #a0a0ad; }

.cfg .row b {
  font-weight: 500;
  font-family: ui-monospace, "Cascadia Mono", Menlo, monospace;
  font-size: 0.92em;
  text-align: right;
  overflow-wrap: anywhere;
}

.cfg label {
  display: flex;
  flex-direction: column;
  gap: 0.35em;
  margin-top: 0.8em;
  color: #a0a0ad;
}

.cfg input {
  font: inherit;
  font-size: 1.3em;
  padding: 0.5em 0.6em;
  border-radius: 8px;
  border: 1px solid #3a3a46;
  background: #1e1e26;
  color: inherit;
}

/* The on-screen digit pad (setup-screen spec, digits half — the emoji
 * alphabet is a separate, not-yet-built piece; see config-screen.js).
 *
 * Sized for a 2160px-wide panel held by a thumb, not a mouse: targets clear
 * the 88px floor the rest of this screen uses (`.cfg .actions button`), with
 * generous gaps so a stray edge of a touch cannot land on the neighbour. */
.keypad { margin-top: 0.6em; }

.keypad-positions {
  display: flex;
  gap: 0.6em;
  justify-content: center;
  margin-bottom: 0.7em;
}

.keypad-dot {
  width: 1.1em;
  height: 1.1em;
  border-radius: 50%;
  border: 2px solid #4a4a56;
  background: transparent;
}

.keypad-dot.filled {
  background: #f4f4f6;
  border-color: #f4f4f6;
}

.keypad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6em;
}

.keypad-key {
  touch-action: none;   /* see .cfg .actions button — a held touch must not become a pan */
  font: inherit;
  font-size: 1.5em;
  min-height: 100px;
  border-radius: 10px;
  border: 1px solid #3a3a46;
  background: #2a2a34;
  color: inherit;
  cursor: pointer;
  transition: background-color 120ms ease, transform 120ms ease;
}

.keypad-key--wide { font-size: 1.1em; color: #a0a0ad; }

.keypad-key:active { background: #34343f; transform: scale(0.96); }

.keypad-key:focus-visible {
  outline: 3px solid #f4f4f6;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .keypad-key { transition: none; }
  .keypad-key:active { transform: none; }
}

.cfg details { color: #a0a0ad; }
.cfg details summary { cursor: pointer; padding: 0.5em 0; }
.cfg details input { width: 100%; box-sizing: border-box; margin-bottom: 0.5em; }

/* Errors are the point of this screen: a tech on a lobby floor cannot debug a
 * silent failure, so a bad code says why in a colour that carries across a hall. */
.cfg .err {
  margin: 0;
  color: #ff8a8a;
}

.cfg .actions {
  display: flex;
  gap: 0.8em;
  margin-top: 0.6em;
}

.cfg .actions button {
  /* `none`, not the reset's `manipulation`: `manipulation` still lets the
     browser read a held or drifting touch as a pan, and when it does it fires
     pointercancel and no click is synthesised at all. That is what stopped
     "Bind this kiosk" firing on the panel (2026-09-11). */
  touch-action: none;
  font: inherit;
  font-size: 1.1em;
  /* 88px minimum: the same thumb-target floor the board's hit areas use. */
  min-height: 88px;
  flex: 1;
  padding: 0 1.2em;
  border-radius: 10px;
  border: 1px solid #3a3a46;
  background: #2a2a34;
  color: inherit;
  cursor: pointer;
}

.cfg .actions button:first-child {
  background: #f4f4f6;
  border-color: #f4f4f6;
  color: #14141a;
  font-weight: 600;
}
