fix(client): usable GM column and phone HUD (#89)

This commit is contained in:
2026-11-21 23:39:09 +01:00
parent f170b9c91a
commit e2295aa416
23 changed files with 521 additions and 75 deletions
+43 -5
View File
@@ -11,9 +11,35 @@ import type { Stage } from './render/stage.ts'
import { createStage } from './render/stage.ts'
import type { RootState } from './reducer.ts'
import { setIntentSender } from './intents.ts'
import { viewport } from './viewport.ts'
const KEY_REFUSED = 'Key not recognised.'
/**
* A non-secret marker that this browser signed in once. The session cookie is HttpOnly, so the
* client cannot read it; without the marker every cold boot opened `/ws` before a session existed
* and the browser logged the refused upgrade on a perfectly healthy first load (M4 dry-run). The
* marker only decides whether to dial on boot; a stale marker still lands on sign-in as before.
*/
const SESSION_MARKER = 'fff-vtt.session'
function hadSession(): boolean {
try {
return localStorage.getItem(SESSION_MARKER) === '1'
} catch {
return true // storage blocked: keep the old probe rather than break returning sessions
}
}
function markSession(present: boolean): void {
try {
if (present) localStorage.setItem(SESSION_MARKER, '1')
else localStorage.removeItem(SESSION_MARKER)
} catch {
// A blocked localStorage is not worth breaking sign-in over.
}
}
/** Story 6: a refused name is shown with a reason, next to the prompt. */
const NAME_REFUSALS: Record<string, string> = {
'name-taken': 'That name is taken. Choose another.',
@@ -79,6 +105,7 @@ async function signIn(key: string): Promise<void> {
store.dispatch({ type: 'signin-failed', message: KEY_REFUSED })
return
}
markSession(true)
client?.close()
store.dispatch({ type: 'connecting' })
connect()
@@ -152,12 +179,18 @@ function syncStage(state: RootState): void {
}
store.subscribe(state => {
// A session the server ended (revoked, evicted) must not make the next cold boot dial `/ws`.
if (state.connection.phase === 'signin') markSession(false)
shell.render(state)
syncStage(state)
adminPanel.render(state)
castPanel.render(state)
})
// The HUD's read-only zoom readout; `viewport` already publishes on every camera change.
shell.setZoom(viewport.state.camera.zoom)
viewport.subscribe(view => shell.setZoom(view.camera.zoom))
// Story 7: the badge distinguishes "no network at all" from "socket is reconnecting". The socket
// retries by itself, but a browser `online` event is the moment to skip the rest of the backoff.
window.addEventListener('offline', () => {
@@ -168,9 +201,14 @@ window.addEventListener('online', () => {
client?.retryNow()
})
// Boot: show the neutral connecting screen and probe for a session. A visitor without a session
// gets a refused `/ws` upgrade and lands on the sign-in page; no map data is ever created.
// Boot: dial only when this browser may still hold a session; otherwise go straight to the door.
// A visitor without a session is never probed with a WS upgrade, so a healthy fresh load has no
// refused-connection noise in the console. No map data is ever created before a session.
store.dispatch({ type: 'network', online: navigator.onLine })
store.dispatch({ type: 'connecting' })
shell.render(store.state)
connect()
if (hadSession()) {
store.dispatch({ type: 'connecting' })
shell.render(store.state)
connect()
} else {
store.dispatch({ type: 'signed-out' })
}
+29 -10
View File
@@ -18,6 +18,7 @@ import type { AdminToken } from '../slices/admin.ts'
import { adminTokens, selectedTokenId } from '../slices/admin.ts'
import { createVisionFields, updateVisionFields } from '../tokenPanel.ts'
import { viewport, viewportCentre } from '../viewport.ts'
import { panelSection, revealInColumn, setSectionTitle } from './section.ts'
export interface AdminPanelHandlers {
send(t: string, fields?: Record<string, unknown>): Promise<AckFrame>
@@ -71,20 +72,24 @@ export function mountAdminPanel(host: HTMLElement, handlers: AdminPanelHandlers)
root.append(heading)
// ---- roster and keys -----------------------------------------------------------------------
const rosterSection = element('section', 'gm-roster')
const rosterTitle = element('h3', undefined, 'Roster')
// Collapsible, open by default: at most six players, so it stays short, but a GM can fold it.
const roster = panelSection('gm-roster', 'Roster', true)
const rosterList = element('ul', 'gm-roster-list')
const keyCreate = element('button', 'gm-key-create', 'Create player key')
keyCreate.type = 'button'
const keyStatus = element('p', 'gm-key-status')
keyStatus.hidden = true
keyStatus.setAttribute('role', 'status')
rosterSection.append(rosterTitle, rosterList, keyCreate, keyStatus)
roster.body.append(rosterList, keyCreate, keyStatus)
// ---- token panel ---------------------------------------------------------------------------
// Layout: the selected token's editor first (selection-driven, see refresh), then the create
// form and the long token list, both collapsed. That keeps the editor near the top of the column
// instead of underneath 50 rows.
const tokenSection = element('section', 'gm-tokens')
const tokenTitle = element('h3', undefined, 'Tokens')
const createForm = element('form', 'gm-token-create')
const createSection = panelSection('gm-token-create-section', 'New token')
createSection.body.append(createForm)
const kindInput = field('input', 'token-kind', 'Kind')
kindInput.node.value = 'npc'
@@ -145,6 +150,8 @@ export function mountAdminPanel(host: HTMLElement, handlers: AdminPanelHandlers)
)
const tokenList = element('ul', 'gm-token-list')
const listSection = panelSection('gm-token-list-section', 'Tokens')
listSection.body.append(tokenList)
const editor = element('section', 'gm-token-editor')
editor.hidden = true
@@ -224,8 +231,8 @@ export function mountAdminPanel(host: HTMLElement, handlers: AdminPanelHandlers)
resize,
)
tokenSection.append(tokenTitle, createForm, tokenList, editor, tokenError)
root.append(rosterSection, tokenSection)
tokenSection.append(editor, createSection.details, listSection.details, tokenError)
root.append(roster.details, tokenSection)
host.append(root)
// Secrets and local UI state. Never dispatched, never logged.
@@ -236,6 +243,7 @@ export function mountAdminPanel(host: HTMLElement, handlers: AdminPanelHandlers)
let rosterSig = ''
let tokenSig = ''
let populatedFor: string | null = null
let lastSelected: string | null = null
let current: RootState | null = null
// The create form follows the viewport centre (#82) until the GM types a position: `autoPos` is
// the pair this module last wrote, so a value the GM edited is never overwritten by a pan.
@@ -298,8 +306,10 @@ export function mountAdminPanel(host: HTMLElement, handlers: AdminPanelHandlers)
...players.map(entry => {
const item = element('li')
item.dataset['player'] = String(entry.id)
const name = element('span', 'gm-roster-name', playerLabel(entry))
const state = element('span', 'gm-roster-state', entry.connected ? 'connected' : 'offline')
const name = element('span', undefined, playerLabel(entry))
name.className = 'gm-roster-name'
const state = element('span', undefined, entry.connected ? 'connected' : 'offline')
state.className = 'gm-roster-state'
item.append(name, state)
if (entry.role !== 'gm') {
const keyCode = element('code', `gm-key-${entry.id}`)
@@ -358,8 +368,10 @@ export function mountAdminPanel(host: HTMLElement, handlers: AdminPanelHandlers)
const item = element('li')
item.dataset['token'] = token.id
if (token.id === selected) item.dataset['selected'] = 'true'
const name = element('span', 'gm-token-name', token.name)
const meta = element('span', 'gm-token-meta', tokenMeta(token, players))
const name = element('span', undefined, token.name)
name.className = 'gm-token-name'
const meta = element('span', undefined, tokenMeta(token, players))
meta.className = 'gm-token-meta'
const pick = element('button', `gm-token-select-${token.id}`, 'Select')
pick.type = 'button'
pick.addEventListener('click', () => handlers.select(token.id))
@@ -412,10 +424,13 @@ export function mountAdminPanel(host: HTMLElement, handlers: AdminPanelHandlers)
renderRoster(players)
}
const token = tokens.find(entry => entry.id === selected) ?? null
const selectionChanged = selected !== lastSelected
lastSelected = selected
const nextTokenSig = JSON.stringify(tokens) + selected
if (nextTokenSig !== tokenSig) {
tokenSig = nextTokenSig
renderTokenList(tokens, players, selected)
setSectionTitle(listSection, `Tokens (${tokens.length})`)
populateEditor(token, players)
if (token) {
statusTitle.textContent =
@@ -429,6 +444,9 @@ export function mountAdminPanel(host: HTMLElement, handlers: AdminPanelHandlers)
}
renderControllerOptions(createController.node, players, createController.node.value || '')
applyPositionDefault()
// Selecting a token (in the list or on the board) brings its editor into the column's view;
// the list itself may be collapsed or scrolled far down.
if (token && selectionChanged) revealInColumn(editor)
}
function setError(text: string | null): void {
@@ -688,6 +706,7 @@ export function mountAdminPanel(host: HTMLElement, handlers: AdminPanelHandlers)
rosterSig = ''
tokenSig = ''
populatedFor = null
lastSelected = null
root.hidden = true
rosterList.replaceChildren()
tokenList.replaceChildren()
+10 -7
View File
@@ -14,6 +14,7 @@ import type { AdminToken } from '../slices/admin.ts'
import { adminTokens } from '../slices/admin.ts'
import type { CastCharacter } from '../slices/cast.ts'
import { castCharacters, encounteredOf, seenByOf } from '../slices/cast.ts'
import { panelSection } from './section.ts'
export interface CastPanelHandlers {
send(t: string, fields?: Record<string, unknown>): Promise<AckFrame>
@@ -69,8 +70,8 @@ export function mountCastPanel(host: HTMLElement, handlers: CastPanelHandlers):
root.hidden = true
// ---- characters ----------------------------------------------------------------------------
const characterSection = element('section', 'gm-characters')
characterSection.append(element('h3', undefined, 'Characters'))
// Long (one editable block per character), so collapsed by default; the list gets its own scroll.
const characters = panelSection('gm-characters', 'Characters')
const createForm = element('form', 'gm-character-create')
const createName = field('input', 'character-name', 'Descriptive name')
@@ -94,25 +95,27 @@ export function mountCastPanel(host: HTMLElement, handlers: CastPanelHandlers):
const characterStatus = element('p', 'gm-character-status')
characterStatus.hidden = true
characterStatus.setAttribute('role', 'status')
characterSection.append(createForm, characterList, characterStatus)
characters.body.append(createForm, characterList, characterStatus)
// ---- encountered ---------------------------------------------------------------------------
const encounteredSection = element('section', 'gm-encountered-section')
encounteredSection.append(element('h3', undefined, 'Encountered'))
// One list per player; collapsed and capped so a busy table cannot bury the rest of the column.
const encountered = panelSection('gm-encountered-section', 'Encountered')
const encounteredBox = element('div', 'gm-encountered')
const encounteredStatus = element('p', 'gm-encountered-status')
encounteredStatus.hidden = true
encounteredStatus.setAttribute('role', 'status')
encounteredSection.append(encounteredBox, encounteredStatus)
encountered.body.append(encounteredBox, encounteredStatus)
// ---- who sees it ---------------------------------------------------------------------------
// Open near the top: it is the answer the GM checks most while moving tokens; its own list is
// capped (50 tokens) so it stays a glance, not a wall.
const seenSection = element('section', 'gm-seen')
seenSection.append(element('h3', undefined, 'Who sees it'))
const seenHint = element('p', 'gm-seen-hint', 'M4 is binary per player: 100 % in sight, 0 % not.')
const seenList = element('ul', 'gm-seen-list')
seenSection.append(seenHint, seenList)
root.append(characterSection, encounteredSection, seenSection)
root.append(seenSection, characters.details, encountered.details)
host.append(root)
let active = false
+10 -9
View File
@@ -12,6 +12,7 @@ import { ownCharactersOf } from '../slices/characters.ts'
import type { CharacterView } from '../slices/characters.ts'
import { encounteredOf } from '../slices/encountered.ts'
import type { EncounteredEntry } from '../slices/encountered.ts'
import { panelSection } from './section.ts'
const NAME_FALLBACK = '(unnamed)'
@@ -85,23 +86,23 @@ export function mountListsPanel(host: HTMLElement, store: Store): () => void {
section.id = 'lists'
section.hidden = true
const charactersSection = document.createElement('section')
charactersSection.id = 'characters-panel'
const charactersTitle = text('h2', 'panel-title', 'My characters')
// On a phone the HUD column is narrow and tall: both lists start folded so the map stays
// visible, and each list is height-capped with its own scroll when opened. A wide screen has the
// room, so the lists stay open there (the pre-M4 behaviour).
const wide = window.innerWidth >= 640
const charactersSection = panelSection('characters-panel', 'My characters', wide)
const charactersList = document.createElement('ul')
charactersList.id = 'characters'
const charactersEmpty = text('p', 'empty', 'No characters yet.')
charactersSection.append(charactersTitle, charactersEmpty, charactersList)
charactersSection.body.append(charactersEmpty, charactersList)
const encounteredSection = document.createElement('section')
encounteredSection.id = 'encountered-panel'
const encounteredTitle = text('h2', 'panel-title', 'Encountered')
const encounteredSection = panelSection('encountered-panel', 'Encountered', wide)
const encounteredList = document.createElement('ul')
encounteredList.id = 'encountered'
const encounteredEmpty = text('p', 'empty', 'Nobody met yet.')
encounteredSection.append(encounteredTitle, encounteredEmpty, encounteredList)
encounteredSection.body.append(encounteredEmpty, encounteredList)
section.append(charactersSection, encounteredSection)
section.append(charactersSection.details, encounteredSection.details)
host.append(section)
let signature = ''
+35
View File
@@ -0,0 +1,35 @@
// A collapsible GM/player panel section (M4 UX): native <details>/<summary>, so a long column
// collapses without custom state, keyboard handling or ARIA. Every string still goes through
// `textContent` (spec #63 decision 15).
//
// The section id stays on the <details> element, so existing selectors (`#gm-roster`, ...) keep
// working and tests can read `.open` or click the summary to toggle.
export interface PanelSection {
details: HTMLDetailsElement
summary: HTMLElement
body: HTMLDivElement
}
export function panelSection(id: string, title: string, open = false): PanelSection {
const details = document.createElement('details')
details.id = id
details.open = open
details.className = 'panel-section'
const summary = document.createElement('summary')
summary.textContent = title
const body = document.createElement('div')
body.className = 'panel-body'
details.append(summary, body)
return { details, summary, body }
}
/** Update a summary without touching the body (the count in "Tokens (50)"). */
export function setSectionTitle(section: PanelSection, title: string): void {
if (section.summary.textContent !== title) section.summary.textContent = title
}
/** The nearest scrollable ancestor's viewport; `scrollIntoView` would also scroll the page. */
export function revealInColumn(node: HTMLElement): void {
node.scrollIntoView({ block: 'nearest', inline: 'nearest' })
}
+8 -2
View File
@@ -19,6 +19,7 @@ import { restoreOf, selectedWallOf, undoOf, wallsOf } from '../slices/walls.ts'
import type { SightDir, WallPreset, WallSwitches, WallUndo } from '../wallEditor.ts'
import type { PopulatedWall } from './wallSync.ts'
import { shouldPopulate, wallFieldsSignature } from './wallSync.ts'
import { revealInColumn } from './section.ts'
import {
PRESETS,
buildAddFields,
@@ -219,7 +220,9 @@ export function mountWallPanel(
undoButton.type = 'button'
root.append(drawSection, selected, undoButton)
host.append(root)
// Walls sit at the top of the column: drawing is the GM's most frequent action and the selected
// wall's editor must be reachable without scrolling past the token/cast lists.
host.prepend(root)
let active = false
let current: RootState | null = null
@@ -617,7 +620,8 @@ export function mountWallPanel(
}
selected.hidden = false
selectedTitle.textContent = `${wall.kind}`
if (populated?.id !== wall.id) {
const newlySelected = populated?.id !== wall.id
if (newlySelected) {
populated = null
advancedOpen = false
advanced.hidden = true
@@ -625,6 +629,8 @@ export function mountWallPanel(
hintLocked.hidden = true
unlockButton.hidden = true
setError(null)
// A click on the board (or a freshly drawn wall) selects it; bring its editor to the top.
revealInColumn(selected)
}
// Repopulate only when the server record changed: an ack dispatch carries the previous record
// and must not undo the switch the GM just made while the authoritative frame is in flight.
+14 -3
View File
@@ -92,13 +92,24 @@ function number(value: number | null, digits: number): string {
return value === null ? '—' : value.toFixed(digits)
}
/** The overlay's one line of text. Everything here is a number or a fixed label. */
export function formatSnapshot(snapshot: PerfSnapshot, tokens: number, zoom: number): string {
/**
* The overlay's one line of text. Everything here is a number or a fixed label.
*
* `tokens visible`/`total` say what the number counts: a player only receives tokens inside their
* sight (the total is then what that client knows), while the GM receives every token. The old bare
* `tokens 50` read as "the scene has 50" even when only two were drawn (M4 dry-run).
*/
export function formatSnapshot(
snapshot: PerfSnapshot,
visibleTokens: number,
totalTokens: number,
zoom: number,
): string {
return [
`fps ${number(snapshot.fps, 1)}`,
`frame p50 ${number(snapshot.frameP50, 1)} p95 ${number(snapshot.frameP95, 1)} ms`,
`JS p50 ${number(snapshot.jsP50, 2)} p95 ${number(snapshot.jsP95, 2)} ms`,
`tokens ${tokens}`,
`tokens visible ${visibleTokens} / total ${totalTokens}`,
`zoom ${zoom.toFixed(2)}`,
].join(' · ')
}
+11
View File
@@ -185,6 +185,17 @@ function onFrame(state: RootState, frame: ServerFrame): void {
state.connection.nameError = null
state.connection.attempt = 0
state.connection.retryDelayMs = null
} else if (frame.t === 'roster') {
// The HUD names this connection from `session.me`; a rename arrives as a roster broadcast, so
// keep `me.name` in step or the one visible name goes stale (the roster no longer repeats it).
const players = frame['players']
const me = state.session.me
if (me !== null && Array.isArray(players)) {
const self = (players as RosterEntry[]).find(entry => entry.id === me.id)
if (self && typeof self.name === 'string' && self.name !== me.name) {
state.session.me = { ...me, name: self.name }
}
}
} else if (isClosing(frame)) {
// DESIGN 6.5: the closing frame is the reason a browser cannot read from the close code.
const outcome = closeOutcome(frame.reason)
+6 -1
View File
@@ -11,6 +11,7 @@ import { UPDATE_PRIORITY } from 'pixi.js'
import type { Ticker } from 'pixi.js'
import type { RenderModule } from '../stage.ts'
import { viewport } from '../../viewport.ts'
import { adminTokens } from '../../slices/admin.ts'
import { tokensOf } from '../../slices/tokens.ts'
import { formatSnapshot, PerfWindow, perfEnabled } from '../../perf.ts'
@@ -49,7 +50,11 @@ export const renderModule: RenderModule = {
if (now - lastUpdate < UPDATE_EVERY_MS) return
lastUpdate = now
const snapshot = windowStats.snapshot(now)
node.textContent = formatSnapshot(snapshot, tokensOf(store.state).length, viewport.state.camera.zoom)
const visible = tokensOf(store.state).length
// A player only ever receives tokens in sight, so its total is what it knows. The GM sees
// the whole table in the admin slice, which is the meaningful total there.
const total = store.state.session.role === 'gm' ? adminTokens(store.state).length : visible
node.textContent = formatSnapshot(snapshot, visible, total, viewport.state.camera.zoom)
}
app.ticker.add(begin, undefined, UPDATE_PRIORITY.INTERACTION)
+36 -16
View File
@@ -23,15 +23,17 @@ export interface Shell {
render(state: RootState): void
setBusy(busy: boolean): void
setNameBusy(busy: boolean): void
/** The read-only zoom readout in the HUD (M4 dry-run: no visible zoom level otherwise). */
setZoom(zoom: number): void
}
function element<K extends keyof HTMLElementTagNameMap>(
tag: K,
id: string,
id?: string,
text?: string,
): HTMLElementTagNameMap[K] {
const node = document.createElement(tag)
node.id = id
if (id !== undefined) node.id = id
if (text !== undefined) node.textContent = text
return node
}
@@ -109,8 +111,11 @@ export function mountShell(root: HTMLElement, handlers: ShellHandlers): Shell {
const me = element('span', 'me')
const badge = element('span', 'badge', BADGE_TEXT.connected)
badge.dataset['state'] = 'connected'
const zoom = element('span', 'zoom')
const roster = element('ul', 'roster')
hud.append(role, scene, me, badge, roster)
// One line: role, scene, own name, then the other players, then the connection state and zoom.
// The own roster row is omitted (see renderRoster): #me already names this connection.
hud.append(role, scene, me, roster, badge, zoom)
const fatal = element('section', 'fatal')
fatal.hidden = true
@@ -160,13 +165,18 @@ export function mountShell(root: HTMLElement, handlers: ShellHandlers): Shell {
for (const node of [boot, signin, hud, namePanel, fatal]) node.hidden = node !== active
}
function renderRoster(players: RosterEntry[]): void {
function renderRoster(players: RosterEntry[], meId: number | null): void {
// A roster row for the connection itself duplicated the role/name line on a phone
// ("GM Scene GM Connected GM connected"); the HUD names the viewer once and lists the others.
const others = meId === null ? players : players.filter(entry => entry.id !== meId)
roster.replaceChildren(
...players.map(entry => {
...others.map(entry => {
const item = document.createElement('li')
item.dataset['player'] = String(entry.id)
const name = element('span', 'roster-name', rosterName(entry))
const state = element('span', 'roster-state', entry.connected ? 'connected' : 'offline')
const name = element('span', undefined, rosterName(entry))
name.className = 'roster-name'
const state = element('span', undefined, entry.connected ? 'connected' : 'offline')
state.className = 'roster-state'
item.append(name, state)
return item
}),
@@ -195,6 +205,22 @@ export function mountShell(root: HTMLElement, handlers: ShellHandlers): Shell {
roster.replaceChildren()
}
function setZoom(value: number): void {
zoom.textContent = `zoom ${value.toFixed(2)}`
}
/** One row: role, scene, this connection's name (once), the other players, badge, zoom. */
function renderHudLine(state: RootState): void {
const roleText = state.session.role === 'gm' ? 'GM' : 'Player'
const name = state.session.me?.name ?? ''
role.textContent = roleText
scene.textContent = state.session.scene?.name ?? ''
me.textContent = name
// "GM … GM" and a player literally named "Player" would say the same thing twice.
me.hidden = name === '' || name === roleText
renderRoster(rosterOf(state), state.session.me?.id ?? null)
}
function render(state: RootState): void {
const phase = state.connection.phase
const phaseChanged = phase !== prevPhase
@@ -242,18 +268,12 @@ export function mountShell(root: HTMLElement, handlers: ShellHandlers): Shell {
}
setNameBusy(false)
showOnly(hud)
role.textContent = state.session.role === 'gm' ? 'GM' : 'Player'
scene.textContent = state.session.scene?.name ?? ''
me.textContent = state.session.me?.name ?? ''
renderRoster(rosterOf(state))
renderHudLine(state)
break
case 'reconnecting':
// Keep the HUD (and the stale map) visible; only the badge changes.
showOnly(hud)
role.textContent = state.session.role === 'gm' ? 'GM' : 'Player'
scene.textContent = state.session.scene?.name ?? ''
me.textContent = state.session.me?.name ?? ''
renderRoster(rosterOf(state))
renderHudLine(state)
break
case 'reload':
showOnly(fatal)
@@ -266,5 +286,5 @@ export function mountShell(root: HTMLElement, handlers: ShellHandlers): Shell {
}
}
return { render, setBusy, setNameBusy }
return { render, setBusy, setNameBusy, setZoom }
}
+107 -7
View File
@@ -88,28 +88,52 @@ body {
left: 0;
right: 0;
display: flex;
gap: 16px;
flex-wrap: wrap;
column-gap: 16px;
row-gap: 2px;
align-items: baseline;
padding: 6px 12px;
background: rgb(0 0 0 / 65%);
pointer-events: none;
font: 12px/1.4 ui-monospace, monospace;
box-sizing: border-box;
}
/* The phone dry-run clipped "…Pl…" because the row could not wrap; these children may shrink and
the scene name ellipsises instead of pushing the badge off-screen. */
#hud > * {
min-width: 0;
}
#scene {
max-width: 40vw;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
#zoom {
opacity: 0.7;
white-space: nowrap;
}
#roster {
display: flex;
gap: 12px;
flex-wrap: wrap;
gap: 2px 12px;
margin: 0;
padding: 0;
list-style: none;
min-width: 0;
}
#roster li {
display: flex;
gap: 4px;
min-width: 0;
}
#roster-state {
.roster-state {
opacity: 0.6;
}
@@ -182,6 +206,25 @@ body {
opacity: 0.8;
}
/* Collapsible sections (M4 UX): native <details>; the summary is the section's only click target,
and an open section's body keeps the column's normal flow. */
.panel-section > summary {
cursor: pointer;
font-weight: 600;
opacity: 0.85;
padding: 2px 0;
}
.panel-section[open] > summary {
margin-bottom: 4px;
}
.panel-section > .panel-body {
display: flex;
flex-direction: column;
gap: 4px;
}
#gm-roster-list,
#gm-token-list {
display: flex;
@@ -192,6 +235,27 @@ body {
list-style: none;
}
/* A long list gets its own scroll instead of stretching the column (50 tokens, a busy cast). */
#gm-token-list {
max-height: 220px;
overflow: auto;
}
#gm-character-list {
max-height: 360px;
overflow: auto;
}
#gm-seen-list {
max-height: 160px;
overflow: auto;
}
#gm-encountered {
max-height: 220px;
overflow: auto;
}
#gm-roster-list li,
#gm-token-list li {
display: flex;
@@ -207,7 +271,7 @@ body {
outline: 1px solid #7ee787;
}
#gm-roster-state {
.gm-roster-state {
opacity: 0.6;
}
@@ -266,7 +330,7 @@ body {
color: #ff8a8a;
}
#gm-token-meta {
.gm-token-meta {
flex-basis: 100%;
opacity: 0.7;
word-break: break-word;
@@ -286,14 +350,25 @@ body {
pointer-events: none;
}
#lists .panel-title {
margin: 0 0 2px;
#lists summary {
cursor: pointer;
pointer-events: auto;
font: 600 11px/1.2 system-ui, sans-serif;
letter-spacing: 0.08em;
text-transform: uppercase;
opacity: 0.65;
}
/* The list itself stays pointer-transparent so it never eats a pan; the body takes pointers only
while open (to scroll a capped list). */
#lists details > .panel-body {
pointer-events: none;
}
#lists details[open] > .panel-body {
pointer-events: auto;
}
#lists ul {
display: flex;
flex-direction: column;
@@ -301,6 +376,8 @@ body {
margin: 0 0 6px;
padding: 0;
list-style: none;
max-height: 200px;
overflow: auto;
}
#lists li {
@@ -531,3 +608,26 @@ body {
color: #ff8a8a;
word-break: break-word;
}
/* Phone (M4 dry-run, 390 px): the HUD wraps instead of clipping, and the player list column folds
to two summary rows so the map stays visible. The lists are capped and scroll when opened. */
@media (max-width: 640px) {
#hud {
column-gap: 8px;
padding: 4px 8px;
font-size: 11px;
}
#scene {
max-width: 38vw;
}
#panels {
top: 48px;
width: min(300px, 46vw);
}
#lists ul {
max-height: 28vh;
}
}