:root {
  --bg: #17141c;
  --panel: #241f2c;
  --panel-2: #2e2838;
  --line: #4a3f58;
  --text: #f1ead8;
  --muted: #b3a88f;
  --accent: #f0b429;
  --led: #ffb000;
  --ok: #52c47a;
  --bad: #e5604f;
  --font: "VT323", ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 20px; }
body { display: flex; flex-direction: column; overflow: hidden; }

#hud {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 14px; background: var(--panel); border-bottom: 3px solid #000; box-shadow: 0 3px 0 var(--line);
  position: relative; z-index: 2;
}
.brand { font-size: 26px; color: var(--accent); letter-spacing: 1px; white-space: nowrap; }
.spacer { flex: 1; }
#floors { display: flex; gap: 6px; }
.pill { background: var(--panel-2); border: 2px solid var(--line); padding: 2px 10px; white-space: nowrap; }
.pill.live { border-color: var(--accent); color: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: .55; } }
.toggle { cursor: pointer; user-select: none; }
.toggle input { accent-color: var(--accent); vertical-align: middle; }

.btn {
  font: inherit; color: var(--text); background: #3b3248; border: 2px solid #000; box-shadow: inset -2px -2px 0 #2a2333, inset 2px 2px 0 #5a4d6b;
  padding: 2px 12px; cursor: pointer;
}
.btn:hover { background: #4a3f5a; }
.btn:active { box-shadow: inset 2px 2px 0 #2a2333; }
.btn.on { background: var(--accent); color: #1b1408; box-shadow: inset -2px -2px 0 #b07d10, inset 2px 2px 0 #ffd36a; }
.btn.ghost { background: transparent; box-shadow: none; border-color: transparent; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

#stage { flex: 1; position: relative; min-height: 0; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; image-rendering: pixelated; display: block; }
#tooltip { position: absolute; pointer-events: none; background: #000c; border: 2px solid var(--accent); padding: 2px 8px; font-size: 18px; white-space: nowrap; z-index: 3; }

#modal { position: fixed; inset: 0; background: #000a; display: flex; align-items: center; justify-content: center; z-index: 10; padding: 16px; }
#modal[hidden] { display: none; }
.modal-card { background: var(--panel); border: 3px solid #000; box-shadow: 0 0 0 3px var(--line), 8px 8px 0 #000; width: min(980px, 100%); max-height: min(86vh, 900px); display: flex; flex-direction: column; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; border-bottom: 2px solid var(--line); background: var(--panel-2); }
.modal-head h2 { margin: 0; font-weight: normal; font-size: 28px; color: var(--accent); }
#modal-body { padding: 12px 14px; overflow: auto; }

.split { display: grid; grid-template-columns: 280px 1fr; gap: 12px; min-height: 360px; }
@media (max-width: 720px) { .split { grid-template-columns: 1fr; } }
.list { display: flex; flex-direction: column; gap: 4px; max-height: 64vh; overflow: auto; }
.list button { text-align: left; font: inherit; color: var(--text); background: var(--panel-2); border: 2px solid transparent; padding: 4px 8px; cursor: pointer; }
.list button:hover { border-color: var(--line); }
.list button.sel { border-color: var(--accent); }
.list small, .muted { color: var(--muted); }
.doc { background: #15121a; border: 2px solid var(--line); padding: 10px 12px; white-space: pre-wrap; line-height: 1.15; max-height: 64vh; overflow: auto; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; align-items: center; }
.ann { border-left: 4px solid var(--led); background: #15121a; padding: 6px 10px; margin-bottom: 6px; }
.ann.meeting { border-color: #5dade2; }
.ann.report { border-color: var(--ok); }
.ann time { color: var(--muted); font-size: 17px; margin-right: 6px; }
.line { margin: 6px 0; }
.line b { color: var(--accent); font-weight: normal; }
.task { color: var(--ok); }
.status-done { color: var(--ok); } .status-partial, .status-running { color: var(--accent); } .status-failed { color: var(--bad); }

.agent-head { display: flex; gap: 14px; align-items: center; margin-bottom: 10px; }
.agent-head canvas { width: 80px; height: 112px; image-rendering: pixelated; background: var(--panel-2); border: 2px solid var(--line); }
.field { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; }
.field input, .field textarea { font: inherit; font-size: 19px; color: var(--text); background: #15121a; border: 2px solid var(--line); padding: 4px 8px; }
.field textarea { min-height: 110px; resize: vertical; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.chat { background: #15121a; border: 2px solid var(--line); padding: 8px; max-height: 260px; overflow: auto; }
.chat .q { color: var(--muted); } .chat .a { margin-bottom: 8px; white-space: pre-wrap; }

#account { gap: 6px; }
a.btn { text-decoration: none; display: inline-block; }
#focus-bar { position: absolute; left: 14px; top: 12px; z-index: 3; display: flex; gap: 8px; align-items: center; background: #241f2cdd; }
#toast { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); background: #000d; border: 2px solid var(--accent); padding: 6px 14px; z-index: 5; max-width: 90%; }
#music-player { position: absolute; right: 14px; bottom: 14px; z-index: 4; background: var(--panel); border: 3px solid #000; box-shadow: 0 0 0 2px var(--line); padding: 6px; width: 272px; }
#music-player[hidden] { display: none; }
.mp-head { font-size: 17px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.mp-ctl { margin-top: 6px; }
#yt-player { width: 256px; height: 200px; background: #000; }
.input, select.input { font: inherit; font-size: 19px; color: var(--text); background: #15121a; border: 2px solid var(--line); padding: 4px 8px; }
#modal-body h3 { font-weight: normal; color: var(--accent); margin: 12px 0 4px; }
.taskcard { background: #15121a; border-left: 4px solid var(--line); padding: 6px 10px; margin-bottom: 6px; }
.taskcard.status-done { border-color: var(--ok); } .taskcard.status-working, .taskcard.status-ready { border-color: var(--accent); }
.taskcard.status-waiting { border-color: #5dade2; } .taskcard.status-failed, .taskcard.status-blocked { border-color: var(--bad); }
.taskcard .result { white-space: pre-wrap; margin-top: 4px; }
.handoff { color: #7fc4ff; margin-top: 4px; }
.status-waiting { color: #7fc4ff; } .status-ready, .status-working { color: var(--accent); } .status-blocked { color: var(--bad); }
.mem { border-bottom: 1px dashed var(--line); padding: 4px 0; }
.chatlog { background: #15121a; border-left: 4px solid #c27a4a; padding: 6px 10px; margin-bottom: 8px; }
.agentform { border: 2px solid var(--line); margin: 8px 0; padding: 6px 10px; }
.agentform textarea { width: 100%; font: inherit; font-size: 18px; color: var(--text); background: #15121a; border: 2px solid var(--line); min-height: 60px; margin-top: 6px; }
.chk { white-space: nowrap; } .chk input { accent-color: var(--accent); }
input[type=color] { width: 36px; height: 26px; border: 2px solid var(--line); background: none; padding: 0; vertical-align: middle; }
#focus-bar[hidden] { display: none; }

#modal-body a { color: var(--accent); }

.badge { background: var(--bad); color: #fff; padding: 0 5px; }
/* live-stream view */
body.stream #hud, body.stream #focus-bar, body.stream #toast, body.stream #music-player { display: none !important; }
#captions { display: none; }
body.stream #captions { display: block; position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); max-width: 80%; background: #000c; border: 3px solid var(--accent);
  padding: 8px 16px; font-size: 28px; line-height: 1.15; color: var(--text); z-index: 5; text-align: center; }
.field[hidden] { display: none; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.kpis > div { background: #15121a; border: 2px solid var(--line); padding: 6px 10px; display: flex; flex-direction: column; }
.kpis b { font-size: 28px; color: var(--text); font-weight: normal; }
.kpis small { color: var(--muted); }
.tbl { width: 100%; border-collapse: collapse; font-size: 18px; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 3px 6px; text-align: left; vertical-align: top; }
