:root { --fleet-w: clamp(220px, 18vw, 340px); }   /* the agents column (0.6: the play page no longer has a fleet column) */
/* /live and /live/embed: a bot's site watched read-only. The map fills the screen under one bar (who, where, the money, the picker,
   the rotation's countdown); the tasks and the machines float over the map, docked top-right, as the hub's panels (Feedback #359:
   a full-height column left the map narrow and itself mostly empty). In the yard phase the board takes the map's place and the
   side panels go. The embed is the map and the caption alone. Colours from tokens.css only. */
#app.live { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "top" "stage"; }
body[data-phase="yard"] #app.live #view { visibility: hidden; }
body[data-phase="yard"] #app.live .l-side, body[data-phase="yard"] #app.live #p-tasks, body[data-phase="yard"] #app.live #p-crew,
body[data-phase="yard"] #app.live .side-tools { display: none; }
/* The drop-in's phone tab strip hangs off <body>: only the full-size site view shows it. */
body[data-phase="yard"] .tn-panel-strip, body[data-view="wall"] .tn-panel-strip, body[data-mode="embed"] .tn-panel-strip { display: none; }
#app.live #stage { grid-template-rows: minmax(0, 1fr); }
#app.live #view { cursor: grab; }
#app.live #view:active { cursor: grabbing; }

#l-top { grid-area: top; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 6px 10px; flex-direction: row; }
.l-who b { max-width: 28ch; }
#l-conn { font-size: max(12px, 0.9em); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; white-space: nowrap; font-weight: 700; }
#l-conn[data-s="live"]::before { content: "\25CF  "; color: var(--good); }
#l-conn[data-s="wait"]::before, #l-conn[data-s="down"]::before { content: "\25B2  "; color: var(--bad); }
.l-pick { display: flex; align-items: center; gap: 6px; }
.l-pick .k { color: var(--dim); font-size: max(12px, 0.8em); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
#l-agent { max-width: 30ch; }
.l-watch { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
#l-next { text-align: right; white-space: nowrap; }

/* The caption: what the bot is doing, in a sentence, on the map's top edge; on /live it keeps left of the side panels. */
.l-cap { align-self: start; justify-self: center; z-index: 3; margin: 8px 8px 0; padding: 6px 12px; max-width: min(64ch, calc(100% - 2 * var(--tap) - 32px));
  background: var(--panel); color: var(--ink); border: 2px solid var(--hazard); border-radius: var(--radius);
  font-weight: 700; text-align: center; pointer-events: none; }
.l-cap[hidden] { display: none; }
body[data-mode="live"] .l-cap { justify-self: start; max-width: min(64ch, calc(100% - var(--fleet-w) - 32px)); }
/* The zoom buttons go to the bottom-right corner, out from under the side panels. */
#app.live .side-tools { align-self: end; }

/* The yard: the bot's board and its bid, over the map's place. */
#l-yard { align-self: stretch; justify-self: stretch; z-index: 2; margin: calc(var(--tap) + 24px) 8px 8px; gap: 6px; }
#l-yard[hidden] { display: none; }
#l-bid { font-weight: 700; }
#l-board { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 26ch), 1fr)); gap: 6px; align-content: start; }
.l-listing { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel2); min-width: 0; }
.l-listing[data-bid="1"] { border-color: var(--accent); background: var(--sel-bg); }
.l-listing-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.l-mark { font-size: max(12px, 0.85em); font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent); }

/* The side: tasks as on /play (their order buttons are not on this page), and each machine's state line, in the fleet's floating
   panels (tenshin_panels.css; website/dropins), docked top-right over the map. The page sets their width and keeps them off its bars
   (--tn-panels-*, live.js); the stack around them takes no box, so they are not the map's grid items. */
.l-side { display: contents; }
#app.live .tn-panel { padding: 0; gap: 0; }
:root:not(.tn-panels-narrow) #app.live .tn-panel { width: var(--fleet-w); }   /* a phone's sheet is the screen's width */
/* Docked, the two share the height between the bar and the zoom buttons (the drop-in lets each take all of it, so the second slid
   up over the first); with one folded the other may take it all. The drop-in's gap is 12 px above, between and below. */
:root:not(.tn-panels-narrow) #app.live:not(:has(.tn-panel-collapsed)) .tn-panel {
  max-height: calc((100vh - var(--tn-panels-top, 0px) - var(--tn-panels-bottom, 0px) - 36px) / 2); }
/* A phone's sheet stops under the bar. */
.tn-panels-narrow #app.live .tn-panel.tn-panel-open {
  max-height: min(60vh, calc(100vh - var(--tn-panels-top, 0px) - var(--tn-panels-bottom, 0px) - var(--tn-panels-strip, 44px) - 8px)); }
#app.live .tn-panel-head h2 { display: block; padding: 0; border: 0; }   /* the game's h2 rule and the play layout's phone rule */
.tn-panel-body, .tn-panels-narrow .tn-panel.tn-panel-open .tn-panel-body { display: flex; flex-direction: column; gap: 6px; }   /* the list scrolls, not the body */
.tn-panel-body > :not(.scroll) { flex: none; }
#app.live .task-dig, #app.live .task-haul, #app.live .task-fill, #app.live .task-strip { display: none; }
#l-crew { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
#l-crew-none[hidden] { display: none; }
.l-m { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--radius); }
.l-m b { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.l-m-state { font-weight: 600; white-space: nowrap; }
.l-m[data-state="stuck"] .l-m-state, .l-m[data-state="broken"] .l-m-state { color: var(--bad); }
.l-m-line { grid-column: 1 / -1; min-width: 0; overflow-wrap: anywhere; }
.l-m-line:empty { display: none; }

/* A phone: the bar wraps to a few short rows and the map takes the rest; the panels are the drop-in's tab strip above the zoom
   buttons. The caption moves to the foot, beside the zoom buttons, under neither. */
@media (max-width: 600px) {
  #l-top { gap: 2px 10px; padding: 4px 8px; }
  #l-top .grow { display: none; }
  .l-who b { max-width: 20ch; }
  .l-where { display: none; }
  .l-watch { flex: 1 1 100%; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; }
  .l-pick { min-width: 0; }
  .l-pick .k { display: none; }
  #l-agent { flex: 1; min-width: 0; max-width: none; }
  body[data-mode="live"] .l-cap { align-self: end; margin: 0 8px 8px; max-width: calc(100% - var(--tap) - 32px); }
  #app.live #p-tasks #task-list { flex-direction: column; overflow-x: hidden; overflow-y: auto; }
  #app.live #task-list .task { width: auto; grid-template-columns: minmax(0, 1fr) auto; }
  #app.live #task-list .task .task-head { grid-column: 1 / -1; }
  #l-yard { margin: calc(var(--tap) + 32px) 4px 4px; }
}
/* A short screen (a phone on its side): the bar packs tighter. */
@media (max-height: 500px) and (min-width: 601px) {
  #l-top { gap: 2px 10px; padding: 2px 8px; }
}

/* The embed: the map and the caption, edge to edge. */
body[data-mode="embed"] #app.live { padding: 0; gap: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); grid-template-areas: "stage"; }
body[data-mode="embed"] #app.live #stage { border: 0; border-radius: 0; }
body[data-mode="embed"] #tn-nav-host, body[data-mode="embed"] #l-top, body[data-mode="embed"] #p-tasks, body[data-mode="embed"] #p-crew,
body[data-mode="embed"] #l-yard, body[data-mode="embed"] .side-tools { display: none; }

/* The wall (/live's front): every company at work at once, a tile each, and the latest wins, losses and payouts under them. It
   scrolls on its own (the body never does). A tile is one big button: its map, what the company does, how much of the job is
   done and its money; it opens the company full size. Colours from tokens.css only. */
.l-wall { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: var(--gap); padding: var(--gap) max(var(--gap), 2vw) calc(var(--gap) * 2); }
.l-wall[hidden], #app.live[hidden] { display: none; }
.l-wall-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.l-wall-head h1 { margin: 0; font-size: clamp(20px, 1.2vw + 14px, 34px); font-weight: 900; letter-spacing: 0.01em; }
.l-wall-head h1::before { content: "\25CF  "; color: var(--bad); font-size: 0.6em; vertical-align: middle; }
.l-wall-head p { margin: 0; }
.l-tiles { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--gap);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); }
.l-tile { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 10px; min-width: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }   /* the chip names the phase */
.l-tile:hover, .l-tile:focus-within { border-color: var(--accent); }
.l-tile-open { position: absolute; inset: 0; z-index: 2; margin: 0; padding: 0; border: 0; background: transparent; cursor: pointer; border-radius: var(--radius); }
.l-tile-open:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.l-tile-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.l-tile-name { font-size: 1.15em; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.l-chip { margin-left: auto; font-size: max(12px, 0.8em); font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); white-space: nowrap; }
.l-tile[data-phase="site"] .l-chip { color: var(--good); border-color: var(--good); }
.l-tile[data-phase="yard"] .l-chip { color: var(--accent); border-color: var(--accent); }
.l-tile[data-conn="down"] .l-chip, .l-tile[data-conn="wait"] .l-chip { color: var(--dim); }
.l-tile-stage { position: relative; aspect-ratio: 4 / 3; min-height: 0; border-radius: var(--radius); overflow: hidden; background: var(--void, var(--bg)); border: 1px solid var(--line); }
.l-tile-map { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.l-tile[data-phase="yard"] .l-tile-map { visibility: hidden; }
.l-tile-yard { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; overflow: hidden; background: var(--panel2); }
.l-tile-board { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.l-tile-board li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 8px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.l-tile-board li[data-bid="1"] { border-color: var(--accent); background: var(--sel-bg); }
.l-tile-yard:empty { display: none; }
.l-tile-cap { margin: 0; min-height: 2.8em; font-weight: 700; padding: 4px 8px; background: color-mix(in srgb, var(--hazard) 14%, var(--panel)); border-radius: var(--radius); }
.l-tile-job { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.l-tile-job:empty, .l-tile-cap:empty { display: none; }
.l-meter { width: 100%; height: 10px; accent-color: var(--good); }
.l-meter[hidden] { display: none; }
.l-tile-nums { margin: 0; }

.l-feed { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.l-feed-row { display: flex; flex-wrap: wrap; gap: 2px 10px; padding: 4px 8px; border: 1px solid var(--line); border-radius: var(--radius); }
.l-feed-row b { min-width: 14ch; }
.l-feed-row[data-step="won"], .l-feed-row[data-step="paid"] { border-color: var(--good); }
.l-feed-row[data-step="lost"] { border-color: var(--bad); }
.l-feed-row[data-step="moving_region"] { border-color: var(--accent); }
#l-feed-box { flex: none; overflow: visible; }
#l-back { white-space: nowrap; }
body[data-mode="embed"] #l-wall, body[data-mode="embed"] #l-back { display: none; }
