/* web/hud/room_box.css
   The room box (web/hud/room_box.js): the room you are in, in the game window's font, size,
   colour and Line width, above the game window or beside it, the input line and the bar running
   under both. Settings' Room box topic sets data-roombox (off, top, left, right),
   data-roombox-size and data-roombox-window on the page (web/hud/display_options.js). Small,
   Medium or Large is its height on top, a share of the column, or its width at a side, in
   letters. At a side, and on top while the chat box shows too, it sits in the centre's grid
   (web/hud/centre_grid.css), with the chat box's own rules beside it (web/hud/chat_box.css).
   A room longer than the box scrolls inside it. A box at a side tucks away while the
   Stage is open and while it slides, so the game window re-wraps once rather than all through
   the slide; a box on top stays, narrowed with the game window. A phone layout never shows
   it, and then the game window prints every room in full. Its lines are laid out as the game
   window's are (web/screen.css), its names marked as theirs are (web/hud/tap.css). */

:root { --rbx-h: 40%; --rbx-fr: 40fr; --rbx-cols: 56; }
:root[data-roombox-size="small"] { --rbx-h: 28%; --rbx-fr: 28fr; --rbx-cols: 44; }
:root[data-roombox-size="large"] { --rbx-h: 55%; --rbx-fr: 55fr; --rbx-cols: 70; }

#roombox {
  font-family: var(--mono); font-size: var(--mono-size);
  --line-height: 1.5; line-height: var(--line-height);
  white-space: pre-wrap; word-break: break-word;
  color: var(--ink); background: var(--bg);
  overflow-y: auto; padding: 12px 18px; box-sizing: border-box;
  min-height: 0; min-width: 0; scrollbar-color: #444 transparent;
}
#roombox[hidden], :root[data-phone] #roombox, :root[data-roombox="off"] #roombox { display: none; }
#roombox > .col { max-width: var(--wrap); }

/* On top: a split above the game window, as tall as its size. In the centre's grid
   (web/hud/centre_grid.css), while a chat box is in it too, its row takes its size's share of the
   height instead, and it spans the game window and a chat box beside it. */
:root:not([data-phone])[data-roombox="top"] #centre > #roombox {
  flex: none; height: var(--rbx-h);
  border-bottom: 1px solid var(--line);
  margin-left: var(--beside-left, 0px); margin-right: var(--beside-right, 0px);
}
#centre.sliding > #roombox { transition: margin var(--stage-ms) var(--stage-ease); }
:root:not([data-phone])[data-roombox="top"] #centre:has(> #roombox:not([hidden])) { --grid-top: minmax(0, var(--rbx-fr)); }
:root:not([data-phone])[data-roombox="top"][data-chat-at="box"] #centre > #roombox {
  grid-row: 1; grid-column: 2 / 4; height: auto;
}

/* At a side: a column of the centre's grid, beside the game window's tabs, the game window and
   a chat box under it, the input line and the bar under all of them. */
:root:not([data-phone]):is([data-roombox="left"], [data-roombox="right"]) #centre > #roombox {
  grid-row: 2 / 5;
  width: calc(var(--rbx-cols) * 1ch + 36px);
}
:root:not([data-phone])[data-roombox="left"] #centre > #roombox { grid-column: 1; border-right: 1px solid var(--line); }
:root:not([data-phone])[data-roombox="right"] #centre > #roombox { grid-column: 4; border-left: 1px solid var(--line); }
:root:not([data-phone]):is([data-roombox="left"], [data-roombox="right"]) #centre:is(.staged, .sliding) > #roombox { display: none; }

/* What the game window still prints of a room you arrive in while the box holds it: its name
   alone, between the blank lines either side of it, or nothing but one blank line. A look you
   type is never marked arrived, so it always prints in full. */
:root:not([data-phone]):not([data-roombox="off"])[data-roombox-window="name"] #screen .line[data-who="arrived"]:not([data-line="room_title"]),
:root:not([data-phone]):not([data-roombox="off"])[data-roombox-window="none"] #screen .line[data-who="arrived"],
:root:not([data-phone]):not([data-roombox="off"])[data-roombox-window="none"] #screen .line:empty:not([data-line]):has(+ .line[data-line="room_title"][data-who="arrived"]) {
  display: none;
}
