/* Foreman showcase: the office stage from styles.css, full-bleed for a phone,
   plus a status pill and the zoom button. */
:root{
  --bg: #0E1116;
  --panel: #151A21;
  --panel-2: #1B212A;
  --line: #262D38;
  --text: #EBEEF2;
  --text-dim: #8A93A3;
  --accent: #E8A33D;
  --accent-2: #5EC8B8;
  --danger: #E8615F;
  --radius: 10px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

*{ box-sizing: border-box; }
[hidden]{ display:none !important; }

html,body{
  margin:0;
  min-height:100%;
  overflow-x:hidden;
  color-scheme:dark;
  background: var(--bg);
  color: var(--text);
  font-family: "Sora", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

html,
*{
  scrollbar-width:thin;
  scrollbar-color:#465264 var(--bg);
}
*::-webkit-scrollbar{ width:10px; height:10px; }
*::-webkit-scrollbar-track{ background:var(--bg); }
*::-webkit-scrollbar-thumb{
  background:#465264;
  border:2px solid var(--bg);
  border-radius:999px;
}
*::-webkit-scrollbar-thumb:hover{ background:var(--accent-2); }
*::-webkit-scrollbar-corner{ background:var(--bg); }

/* ---------- Space backdrop (space.js) ---------- */
#pageSpace{
  position:fixed;
  inset:0;
  width:100vw;
  height:100vh;
  z-index:-1;
  pointer-events:none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  opacity:0;
  transition: opacity .5s ease;
}
body.space-on{ background:transparent; }
body.space-on #pageSpace{ opacity:1; }

/* Page city (space.js): same treatment as the space backdrop above, or an
   unstyled canvas sits in normal flow and pushes the office off-screen. */
#pageCityFx{
  position:fixed;
  inset:0;
  width:100vw;
  height:100vh;
  z-index:-1;
  pointer-events:none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  opacity:0;
  transition: opacity .5s ease;
}
body.city-on{ isolation:isolate; }
body.city-on #pageCityFx{ opacity:1; }

/* ---------- Stage ---------- */
/* The bar sits over the top; the zoom button over the bottom. The stage
   keeps clear of both, so office.js frames the base in what's left. */
.main{
  padding: calc(var(--safe-t) + 52px) calc(var(--safe-r) + 8px) calc(var(--safe-b) + 64px) calc(var(--safe-l) + 8px);
}
/* office.js never lets the card go shorter than one room (320:150), so on a
   wide, short screen cap the width to what the height left can show. */
/* ---------- Office layout & side column ---------- */
.office-layout{
  display:grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  gap:16px 12px;
  align-items:start;
}
.office-main{ min-width:0; display:flex; align-items:flex-start; gap:6px; }
.office-main > .office{ flex:1; width:100%; }
@media (max-width: 900px){
  .office-layout{ grid-template-columns: 1fr; }
}
.office-side{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:10px;
}
@media (min-width: 901px){
  .office-side{
    position: sticky;
    top: calc(var(--safe-t) + 52px);
    max-height: calc(100dvh - var(--safe-t) - var(--safe-b) - 64px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}
.office{
  min-width:0;
  margin:0 auto;
  max-width: calc((100vh - var(--safe-t) - var(--safe-b) - 116px) * 2.1333);
  max-width: calc((100dvh - var(--safe-t) - var(--safe-b) - 116px) * 2.1333);
}
.office-stage{ position:relative; display:flex; flex-direction:column; align-items:center; }
#officeCanvas{
  display:block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius:6px;
  border:1px solid var(--line);
  background: var(--bg);
  touch-action: manipulation;
}
.plates{ position:absolute; top:0; left:0; }
.plate{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  border:0;
  overflow:hidden;
  clip-path:inset(50%);
  white-space:nowrap;
}
.plates.is-hidden{ display:none; }

.rooms{
  position:absolute;
  top:0;
  left:50%;
  transform:translateX(-50%);
  overflow:hidden;
  pointer-events:none;
  opacity:0;
  transition: opacity .18s;
}
.rooms.is-on{ opacity:1; }
.room-label{
  position:absolute;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  padding:4px 5px;
  background:transparent;
  border:1px solid transparent;
  border-radius:3px;
  color:var(--text);
  font-family:"Sora", sans-serif;
  text-align:center;
  overflow:hidden;
  cursor:pointer;
  pointer-events:none;
  touch-action: manipulation;
  transition: background .15s, border-color .15s;
}
.rooms.is-on .room-label{ pointer-events:auto; }
.room-label:focus-visible{
  background:rgba(232,163,61,0.10);
  border-color:var(--accent);
  outline:none;
}
/* No hover on a phone: the division names stay up in base view. */
.room-name{
  max-width:100%;
  font-size:.5rem;
  font-weight:600;
  letter-spacing:.3px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  text-shadow:0 1px 3px rgba(0,0,0,.85);
  opacity:.8;
}
.room-label.is-empty .room-name{ color:var(--text-dim); }
.rooms.is-on .room-label.is-lounge{ pointer-events:none; cursor:default; }
.room-label.is-lifted{ background:rgba(232,163,61,0.06); border:1px dashed var(--accent); }
.room-label.is-drop{ background:rgba(232,163,61,0.18); border-color:var(--accent); }

/* No arcade and no desk monitors here: those live on the Mac. */
.arcade-hit,
.desk-links{ display:none !important; }

/* ---------- Live bar ---------- */
.live-bar{
  position:fixed;
  top:0;
  left:0;
  right:0;
  z-index:10;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  padding: calc(var(--safe-t) + 10px) calc(var(--safe-r) + 12px) 8px calc(var(--safe-l) + 12px);
  pointer-events:none;
}
.live-bar > *{ pointer-events:auto; }
.live-pill{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-width:0;
  padding:6px 12px;
  border-radius:999px;
  background:rgba(21,26,33,.88);
  border:1px solid var(--line);
  font-size:.72rem;
  font-weight:500;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.live-dot{ flex:none; width:7px; height:7px; border-radius:50%; background:var(--text-dim); }
.live-pill[data-state="live"] .live-dot{ background:var(--accent-2); box-shadow:0 0 8px var(--accent-2); }
.live-pill[data-state="waiting"] .live-dot{ background:var(--accent); box-shadow:0 0 8px var(--accent); }
.live-signout{
  flex:none;
  padding:6px 12px;
  border-radius:999px;
  background:rgba(21,26,33,.88);
  border:1px solid var(--line);
  color:var(--text-dim);
  font:inherit;
  font-size:.72rem;
  font-weight:500;
  cursor:pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.live-signout:hover{ color:var(--text); border-color:var(--text-dim); }

/* ---------- Zoom button (driven by office.js) ---------- */
.office-zoom{
  position:fixed;
  left:50%;
  bottom: calc(var(--safe-b) + 14px);
  transform:translateX(-50%);
  z-index:10;
  display:inline-flex;
  align-items:center;
  gap:8px;
  max-width: calc(100vw - 32px);
  padding:9px 16px;
  border-radius:999px;
  background:rgba(27,33,42,.92);
  border:1px solid var(--line);
  color:var(--text);
  font-family:"Sora", sans-serif;
  font-size:.74rem;
  font-weight:500;
  white-space:nowrap;
  cursor:pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.office-zoom svg{ flex:none; }
.office-zoom [data-zoom-label]{ overflow:hidden; text-overflow:ellipsis; }
.office-zoom[aria-pressed="false"]{ border-color:var(--accent); }

/* ---------- Info panel (companion-panel.js) ---------- */
/* Under the stage on a phone; beside it on a wide screen in office-side. */
.info{
  width: 100%;
  max-width: 960px;
  margin: 12px auto 0;
  display:flex;
  flex-direction:column;
  gap:10px;
  scroll-margin-top:calc(var(--safe-t) + 54px);
}
.office-side .info{
  max-width: none;
  margin: 0;
}
.agent-config{
  background: var(--panel);
  border:1px solid var(--line);
  border-radius: var(--radius);
  min-width:0;
}
.cfg-head{
  display:flex;
  align-items:center;
  flex-wrap:wrap;
  gap:8px 10px;
  padding-bottom:12px;
  margin-bottom:6px;
  border-bottom:1px solid var(--line);
}
.cfg-title-row{ display:flex; align-items:center; gap:8px; width:100%; }
.cfg-dot{ width:9px; height:9px; border-radius:50%; flex:none; }
.office-dot{ background:#4B5262; opacity:.6; transition: background .2s, opacity .2s, box-shadow .2s; }
.office-dot.is-active{ background:var(--accent-2); opacity:1; box-shadow:0 0 6px rgba(94,200,184,.55); }
.cfg-name{ font-size:.95rem; font-weight:600; color:var(--text); }
.cfg-role{ font-size:.72rem; color:var(--text-dim); margin-right:auto; }

.cfg-modes{ display:flex; flex-wrap:wrap; align-items:center; gap:5px; flex-basis:100%; margin-top:2px; }
.cfg-mode{
  border:1px solid #2B3440;
  border-radius:20px;
  background:transparent;
  color:#727E8E;
  padding:4px 10px;
  font:.62rem "JetBrains Mono", monospace;
  letter-spacing:.4px;
  text-transform:uppercase;
  cursor:pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.cfg-mode:hover{ color:#C7D0DC; border-color:#3A4552; }
.cfg-mode.is-active{ color:var(--accent-2); border-color:var(--accent-2); background:rgba(94,200,184,.1); }

.office-panels{ display:flex; flex-direction:column; gap:12px; }
.office-panel{ display:none; flex-direction:column; gap:12px; }
.office-panel.is-active{ display:flex; }

.info-body{
  display:flex;
  flex-direction:column;
  gap:14px;
  padding:16px;
  border-radius:var(--radius);
  background:rgba(21,26,33,.92);
  border:1px solid var(--line);
}
.info.agent-config .info-body{
  background:transparent;
  border:none;
  padding:0;
}
.info-body > *{ min-width:0; }
.world-grid{ display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.world-panel{ padding:18px; border:1px solid var(--line); border-radius:12px; background:linear-gradient(145deg,rgba(27,33,42,.9),rgba(21,26,33,.8)); gap:12px; }
.world-panel > .info-h{ color:var(--text); font-size:.94rem; letter-spacing:0; text-transform:none; }
.world-panel > .kicker{ font-size:.58rem; }
.world-panel .prose, .world-goals, .world-empty{ overflow-wrap:anywhere; }
.world-tags{ display:flex; flex-wrap:wrap; gap:6px; }
.world-tag{ display:inline-block; padding:4px 8px; border:1px solid var(--line); border-radius:6px; color:var(--accent-2); font-size:.64rem; line-height:1.4; overflow-wrap:anywhere; }
.world-empty{ margin:0; color:var(--text-dim); font-size:.76rem; line-height:1.6; }
.world-goals{ display:flex; flex-direction:column; gap:12px; margin:0; padding-left:22px; font-size:.8rem; line-height:1.65; }
.world-goals li::marker{ color:var(--accent); font-family:"JetBrains Mono",monospace; }
.world-goals li{ padding-left:5px; }
.world-metrics{ display:grid; grid-template-columns:repeat(auto-fit,minmax(90px,1fr)); border:1px solid var(--line); border-radius:10px; background:var(--bg); padding:12px; gap:16px; }
.world-metrics > div{ display:flex; flex-direction:column; gap:4px; }
.world-metrics b{ color:var(--accent); font:500 1.2rem "JetBrains Mono",monospace; }
.world-metrics span{ color:var(--text-dim); font-size:.64rem; }
.world-skills, .world-relations{ display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,230px),1fr)); gap:10px; }
.world-skill{ display:flex; flex-direction:column; gap:8px; padding:14px; border:1px solid var(--line); border-radius:8px; background:var(--bg); min-width:0; }
.world-skill h4{ margin:0; font-size:.8rem; font-weight:500; overflow-wrap:anywhere; }
.world-text-link{ align-self:flex-start; margin-top:auto; padding:4px 0; border:0; background:none; color:var(--accent-2) !important; font-size:.72rem; text-decoration:underline; text-underline-offset:3px; }
.world-room-links{ display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,230px),1fr)); gap:8px; }
.world-room-link{ position:relative; display:flex; flex-direction:column; gap:6px; padding:14px 36px 14px 14px; background:var(--bg); border:1px solid var(--line); border-radius:8px; text-align:left; min-width:0; overflow-wrap:anywhere; }
.world-room-link b{ font-size:.8rem; font-weight:500; }
.world-room-link > span:not(.world-arrow){ color:var(--text-dim); font-size:.68rem; }
.world-arrow{ color:var(--accent-2); margin-left:auto; }
.world-room-link .world-arrow{ position:absolute; right:14px; top:14px; }
.world-relation{ display:flex; flex-direction:column; gap:10px; padding:14px; border:1px solid var(--line); border-top:2px solid var(--accent-2); border-radius:8px; background:var(--bg); min-width:0; }
.world-relation[data-kind="rival"], .world-relation[data-kind="tension"]{ border-top-color:var(--accent); }
.world-person{ display:flex; align-items:center; gap:10px; width:100%; padding:0; border:0; background:none; text-align:left; }
.world-person b{ font-size:.8rem; overflow-wrap:anywhere; }
.world-perspective{ margin:0; color:var(--text-dim); font-size:.64rem; }
.world-filters{ display:flex; flex-wrap:wrap; gap:6px; }
.world-filter{ padding:9px 12px; border:1px solid var(--line); border-radius:7px; background:var(--bg); font-size:.7rem; }
.world-filter[aria-pressed="true"]{ border-color:var(--accent-2); background:rgba(94,200,184,.08); }
.world-room-link:hover, .world-person:hover{ border-color:var(--accent-2); color:var(--accent-2); }
@media (max-width:600px){
  .world-grid{ grid-template-columns:1fr; }
  .info-body{ padding:12px; }
  .world-panel{ padding:14px; }
}
.info-body.is-swap{ animation: infoIn .22s ease-out; }
@keyframes infoIn{ from{ opacity:0; transform:translateY(4px); } }
@media (prefers-reduced-motion: reduce){ .info-body.is-swap{ animation:none; } }

.info-head{ display:flex; flex-direction:column; gap:4px; }
.kicker{
  margin:0;
  font-size:.62rem;
  font-weight:600;
  letter-spacing:.8px;
  text-transform:uppercase;
  color:var(--accent);
}
.info-title{ margin:0; font-size:1.15rem; font-weight:600; line-height:1.25; }
.tagline{ margin:0; font-size:.86rem; line-height:1.5; color:var(--text); }
.prose{ margin:0; font-size:.8rem; line-height:1.6; color:var(--text-dim); }
.prose + .prose{ margin-top:8px; }
.hint{ margin:0; font-size:.72rem; color:var(--text-dim); }
.info-section{ display:flex; flex-direction:column; gap:8px; }
.info-h{
  margin:0;
  font-size:.66rem;
  font-weight:600;
  letter-spacing:.6px;
  text-transform:uppercase;
  color:var(--text-dim);
}

.info button{ font-family:"Sora", sans-serif; color:var(--text); cursor:pointer; touch-action:manipulation; }
.info button:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }

/* Room header with prev/next */
.info-nav{ flex-direction:row; align-items:center; gap:10px; }
.info-nav-title{ flex:1; min-width:0; display:flex; flex-direction:column; gap:4px; text-align:center; }
.nav-btn{
  flex:none;
  width:36px; height:36px;
  border-radius:50%;
  background:var(--panel-2);
  border:1px solid var(--line);
  font-size:1.1rem;
  line-height:1;
}

/* Stats */
.stats{ display:grid; grid-template-columns:repeat(4, minmax(0,1fr)); gap:6px; }
.stat{
  display:flex; flex-direction:column; gap:2px;
  padding:8px;
  border-radius:8px;
  background:var(--panel-2);
  border:1px solid var(--line);
  min-width:0;
}
.stat b{ font-size:1.05rem; font-weight:600; font-family:"JetBrains Mono", monospace; }
.stat span{ font-size:.6rem; color:var(--text-dim); line-height:1.3; }
@media (max-width: 380px){ .stats{ grid-template-columns:repeat(2, minmax(0,1fr)); } }

.tour-start{
  align-self:flex-start;
  padding:9px 16px;
  border-radius:999px;
  background:var(--accent);
  border:1px solid var(--accent);
  color:#1A1206 !important;
  font-size:.78rem;
  font-weight:600;
}

/* Status dots, shared by chips, the division list and the legend */
.status-dot{
  flex:none;
  display:inline-block;
  width:8px; height:8px;
  border-radius:50%;
  background:var(--text-dim);
}
.status-dot[data-status="working"]{ background:var(--accent-2); box-shadow:0 0 6px var(--accent-2); }
.status-dot[data-status="idle"]{ background:#C9D1DC; }
.status-dot[data-status="blocked"]{ background:var(--accent); box-shadow:0 0 6px var(--accent); }
.status-dot[data-status="error"]{ background:var(--danger); }
.status-dot[data-status="offline"]{ background:#4A5361; }
.status-dot[data-status="bubble"]{ border-radius:3px 3px 3px 0; background:var(--text); }

/* Division list */
.div-list{ display:flex; flex-direction:column; gap:4px; }
.div-row{
  display:flex; align-items:center; gap:10px;
  padding:9px 10px;
  border-radius:8px;
  background:var(--panel-2);
  border:1px solid var(--line);
  text-align:left;
}
.div-name{ flex:1; min-width:0; font-size:.8rem; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.div-dots{ display:flex; gap:3px; }
.div-count{ font:500 .7rem "JetBrains Mono", monospace; color:var(--text-dim); min-width:1.2em; text-align:right; }

/* Roster chips */
.roster{ display:grid; grid-template-columns:repeat(auto-fill, minmax(190px, 1fr)); gap:6px; }
.chip{
  display:flex; align-items:center; gap:10px;
  padding:6px 10px 6px 6px;
  border-radius:10px;
  background:var(--panel-2);
  border:1px solid var(--line);
  border-left:3px solid var(--agent);
  text-align:left;
  min-width:0;
}
.portrait{
  flex:none;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border-radius:6px;
  background:var(--bg);
}
.chip-text{ display:flex; flex-direction:column; gap:1px; min-width:0; }
.chip-name{ font-size:.82rem; font-weight:600; }
.chip-role{ font-size:.66rem; color:var(--text-dim); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.chip-status{ display:flex; align-items:center; gap:6px; margin:2px 0 0; font-size:.66rem; color:var(--text-dim); }

/* Agent */
.back{
  align-self:flex-start;
  padding:4px 0;
  background:none;
  border:0;
  color:var(--text-dim) !important;
  font-size:.74rem;
}
.agent-hero{ display:flex; align-items:center; gap:14px; }
.agent-hero .portrait{ border:2px solid var(--agent); }
.agent-who{ display:flex; flex-direction:column; gap:2px; min-width:0; }
.agent-name{ color:var(--agent); }
.agent-role{ margin:0; font-size:.74rem; color:var(--text-dim); }
.now-line{ color:var(--text); }

/* Activity */
.ticker{ display:flex; flex-direction:column; gap:2px; }
.ticker-row{
  display:flex; align-items:baseline; gap:8px;
  padding:5px 0 5px 10px;
  border-left:2px solid var(--agent);
  font-size:.74rem;
}
.ticker-line{ flex:1; min-width:0; color:var(--text-dim); }
.ticker-line b{ color:var(--text); font-weight:600; }
.ticker-time{ flex:none; font:500 .66rem "JetBrains Mono", monospace; color:var(--text-dim); }
.ticker-empty{ margin:0; font-size:.72rem; color:var(--text-dim); font-style:italic; }

/* Legend */
.legend summary{ font-size:.76rem; font-weight:500; cursor:pointer; color:var(--text); }
.legend ul{ margin:10px 0 0; padding:0; list-style:none; display:flex; flex-direction:column; gap:7px; }
.legend li{ display:flex; align-items:center; gap:8px; font-size:.74rem; color:var(--text-dim); }
.legend li b{ color:var(--text); font-weight:500; }

/* Tour bar */
.tour-bar{
  position:relative;
  display:flex; flex-wrap:wrap; align-items:center; gap:6px;
  padding:8px 8px 11px 12px;
  border-radius:var(--radius);
  background:rgba(27,33,42,.95);
  border:1px solid var(--accent);
  overflow:hidden;
}
.tour-text{ flex:1 1 100%; min-width:0; font-size:.74rem; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.tour-btn{
  flex:none;
  padding:6px 10px;
  border-radius:999px;
  background:var(--panel-2);
  border:1px solid var(--line);
  font-size:.7rem;
}
.tour-track{ position:absolute; left:0; right:0; bottom:0; height:3px; background:var(--line); }
.tour-fill{ display:block; height:100%; width:0; background:var(--accent); }
@keyframes tourfill{ from{ width:0; } to{ width:100%; } }
