:root { color-scheme: dark; --ink: #eef3fb; --dim: #a9b6c9; --panel: rgba(10, 16, 28, 0.72); --line: rgba(255, 255, 255, 0.14); --lime: #b7f34a; --cyan: #54d7e8; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0a101c; color: var(--ink); }
a { color: var(--cyan); }
[hidden] { display: none !important; }

/* Spectator view */
body.watch { overflow: hidden; }
#view { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#top { position: fixed; top: 0; left: 0; right: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: max(8px, env(safe-area-inset-top)) 10px 8px; pointer-events: none; z-index: 3; }
#top > * { pointer-events: auto; }
.grow { flex: 1; }
.brand { font-weight: 800; letter-spacing: 0.02em; padding: 4px 8px; text-shadow: 0 1px 4px #000; }
.pill { font: inherit; font-size: 13px; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 11px; text-decoration: none; backdrop-filter: blur(6px); white-space: nowrap; }
button.pill { cursor: pointer; }
.pill.link:hover { border-color: var(--cyan); color: #fff; }
.pill.live::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--lime); margin-right: 6px; }
.pill.live.off::before { background: #e86a5c; }
.pill.mode { color: var(--lime); }

aside { position: fixed; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(8px); z-index: 2; }
aside h2 { margin: 0; padding: 9px 12px 7px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--dim); }
#agents { top: 56px; right: 10px; width: 228px; max-height: 42vh; display: flex; flex-direction: column; }
#agent-list { overflow-y: auto; padding: 0 6px 6px; }
#no-agents { margin: 0; padding: 0 12px 12px; font-size: 13px; color: var(--dim); }
.agent-row { display: flex; width: 100%; flex-direction: column; gap: 4px; align-items: stretch; text-align: left; font: inherit; font-size: 14px; color: var(--ink); background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.agent-row:hover { background: rgba(255, 255, 255, 0.07); }
.agent-row.on { border-color: var(--lime); background: rgba(183, 243, 74, 0.1); }
.agent-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-bars { display: flex; gap: 4px; }
.bar { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.bar > span { display: block; height: 100%; }
.bar.hp > span { background: #ef6a6a; }
.bar.food > span { background: #e8b54a; }

#chat { left: 10px; bottom: 44px; width: min(380px, calc(100vw - 20px)); height: 30vh; min-height: 130px; display: flex; flex-direction: column; }
#chat-log { flex: 1; overflow-y: auto; padding: 0 12px 10px; font-size: 13.5px; line-height: 1.4; overflow-wrap: anywhere; }
.chat-row { padding: 2px 0; }
.chat-from { color: var(--cyan); font-weight: 600; margin-right: 6px; }
.chat-row.notice { color: var(--dim); font-style: italic; }
body.hide-chat #chat, body.hide-agents #agents, body.hide-ui #top, body.hide-ui #agents, body.hide-ui #chat, body.hide-ui #hints { display: none; }

#hints { position: fixed; left: 10px; bottom: max(8px, env(safe-area-inset-bottom)); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12.5px; color: var(--ink); text-shadow: 0 1px 3px #000; z-index: 2; }
.badge { background: var(--lime); color: #101a06; font-weight: 800; border-radius: 6px; padding: 2px 8px; text-shadow: none; }
kbd { font: inherit; font-size: 11.5px; background: rgba(10, 16, 28, 0.75); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }

#intro { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(6, 10, 18, 0.45); z-index: 5; overflow-y: auto; }
.card { width: min(480px, 100%); background: rgba(10, 16, 28, 0.9); border: 1px solid var(--line); border-radius: 16px; padding: 24px 26px; }
.card h1 { margin: 0 0 8px; font-size: 32px; letter-spacing: -0.01em; }
.card .lead { margin: 0 0 12px; line-height: 1.5; }
.card ul { margin: 0 0 18px; padding-left: 20px; color: var(--dim); line-height: 1.6; }
#start { width: 100%; font: inherit; font-weight: 800; font-size: 16px; color: #101a06; background: var(--lime); border: 0; border-radius: 10px; padding: 12px; cursor: pointer; }
#start:hover { filter: brightness(1.08); }
.small { margin: 12px 0 0; font-size: 13px; color: var(--dim); }

@media (max-width: 720px) {
  #agents { top: auto; bottom: 44px; right: 10px; width: 150px; max-height: 24vh; }
  #chat { width: calc(100vw - 180px); height: 24vh; min-height: 100px; }
  .brand, #mode, #clock { display: none; }
  #hint-fly, #hint-follow { display: none; }
}
