/* Shared by the chat and devtools apps. Colors follow the figures in the Simulacra paper. */

* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, system-ui, sans-serif; background: #f4f1ea; color: #233; font-size: 14px; }
#app { display: flex; flex-direction: column; height: 100vh; }
button { font: inherit; font-size: 13px; padding: 4px 10px; cursor: pointer; }
select, input { font: inherit; font-size: 13px; }
pre { white-space: pre-wrap; word-break: break-word; font-size: 12px; background: #f6f4ef; border: 1px solid #e6e1d6; border-radius: 4px; padding: 6px 8px; margin: 4px 0 8px; }
.muted { color: #899; }
.warn { color: #9a6a1c; }
.error { color: #b03a2e; }

/* Header */
header { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 8px 14px; background: #fff; border-bottom: 1px solid #ddd; }
header .brand { font-weight: 700; color: #2c4a3a; }
header label { display: flex; gap: 6px; align-items: center; color: #567; }
header .controls { display: flex; gap: 4px; }
header .status { color: #567; margin-left: auto; }

/* Three columns: chat, diagram, inspector */
main { flex: 1; display: grid; min-height: 0; }
main > section { min-height: 0; min-width: 0; overflow: auto; }
.left { display: flex; flex-direction: column; background: #fff; }
.center { padding: 12px; }
.right { background: #fff; display: flex; flex-direction: column; }
.divider { background: #e4e0d6; cursor: col-resize; touch-action: none; }
.divider:hover, .divider:active { background: #b9c9bd; }
.right nav { display: flex; border-bottom: 1px solid #ddd; position: sticky; top: 0; background: #fff; }
.right nav button { flex: 1; border: 0; background: none; padding: 8px; color: #678; }
.right nav button.on { color: #233; font-weight: 600; box-shadow: inset 0 -2px #2f6b3f; }
.latest { margin: 6px 10px 10px; }

/* The chat app: one column */
main.talk { display: flex; justify-content: center; background: #fff; }
main.talk .chat { max-width: 760px; width: 100%; }
.chat-app .msg { font-size: 15px; }

/* Chat pane */
.chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.messages { flex: 1; overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.msg { padding: 6px 10px; border-radius: 8px; max-width: 92%; line-height: 1.4; }
.msg .who { font-size: 11px; font-weight: 600; color: #789; margin-bottom: 2px; }
.msg .text { white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: #e6eef3; }
.msg.program { align-self: flex-start; background: #e9f3e6; }
.devtools .msg.user, .devtools .msg.program { cursor: pointer; }
.msg.earlier { opacity: .65; cursor: default; }
.msg.queued { opacity: .55; }
.msg.selected { outline: 2px solid #2f6b3f; }
.msg.setup { align-self: stretch; max-width: none; background: #fbf6ea; border: 1px solid #eadfc6; font-size: 13px; }
.msg.note, .msg.thinking { align-self: center; color: #899; font-size: 12px; }
.msg.error { align-self: stretch; max-width: none; background: #fbeaea; color: #8a2e24; font-size: 13px; }
.say { display: flex; gap: 6px; padding: 10px; border-top: 1px solid #eee; }
.say input { flex: 1; padding: 6px 8px; }

/* Problems */
.problems { background: #fff; border: 1px solid #e3c9c4; border-radius: 6px; padding: 14px 18px; max-width: 760px; }
.problems h2 { margin: 0 0 6px; font-size: 16px; color: #8a2e24; }
.problems li { margin: 4px 0; }
.problems li.warning code { color: #9a6a1c; }
.problems li.error code { color: #b03a2e; }

/* Inspector and notepads */
.inspector { padding: 12px 14px; }
.inspector.empty { color: #899; }
.inspector h2 { font-size: 15px; margin: 0 0 4px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inspector h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #789; margin: 14px 0 4px; }
.inspector summary { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: #789; margin-top: 10px; cursor: pointer; }
.inspector .kv b { font-size: 12px; }
.inspector dl.wiring { display: grid; grid-template-columns: 64px 1fr; gap: 2px 8px; font-size: 12px; margin: 8px 0; }
.inspector dl.wiring dt { color: #789; }
.inspector dl.wiring dd { margin: 0; }
.badge { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 8px; background: #eee; color: #567; }
.badge.finished { background: #dcebd7; color: #2f6b3f; }
.badge.running { background: #e6eef3; color: #3d6378; }
.badge.skipped { background: #f3ead8; color: #9a6a1c; }
.badge.failed { background: #f6dcd8; color: #b03a2e; }
.took { font-size: 11px; color: #899; font-weight: 400; }
.entries { margin: 0; padding-left: 22px; }
.entries li { margin: 2px 0; }
.entries li.new pre { background: #fbeedd; border-color: #e5c7a0; }
.entries li.focus pre { border-color: #b8693e; box-shadow: 0 0 0 1px #b8693e; }
.entries .by { font-size: 11px; color: #b8693e; }
.notepad { border-bottom: 1px solid #eee; padding-bottom: 6px; }
.about .readme { white-space: pre-wrap; line-height: 1.5; }

/* Diagram */
svg.diagram { display: block; margin: 0 auto; background: #fdfbf6; border: 1px solid #e8e2d4; max-width: 100%; height: auto; }
.edge { fill: none; stroke-width: 1.6; opacity: .45; }
.edge.out { stroke: #3e5f4e; }
.edge.np { stroke: #c49a6c; stroke-dasharray: 5 4; }
.edge.write { stroke: #b8693e; }
.edge.io { stroke: #5b7f95; }
svg.dim .edge { opacity: .08; }
svg.dim .edge.lit, .edge.lit { opacity: 1; stroke-width: 2.6; }
.node { cursor: pointer; }
svg.dim .node { opacity: .35; }
svg.dim .node.on, svg.dim .node.near { opacity: 1; }
.agent circle { fill: #e9f3e6; stroke: #7aa07a; stroke-width: 1.5; }
.agent .lbl { font-size: 11.5px; font-weight: 600; fill: #2c4a3a; text-anchor: middle; }
.agent .idx { font-size: 9px; fill: #8a9a8e; text-anchor: middle; }
.agent.finished circle { fill: #d5e3d1; stroke: #6f8f72; }
svg.dim .agent.finished { opacity: .75; }
.agent.running circle { fill: #cfe8c8; stroke: #2f6b3f; stroke-width: 3; }
.agent.skipped circle { fill: #f3efe6; stroke: #b9a98a; stroke-dasharray: 4 3; }
.agent.failed circle { fill: #f6dcd8; stroke: #b03a2e; stroke-width: 2.5; }
.agent.on circle { stroke: #2f6b3f; stroke-width: 3.5; }
.np path.box { fill: #fbeedd; stroke: #d9b48a; stroke-width: 1.2; }
.np path.fold { fill: none; stroke: #d9b48a; stroke-width: 1.2; }
.np.transcript path.box { fill: #eef2f4; stroke: #a9bccb; }
.np.transcript path.fold { stroke: #a9bccb; }
.np text { font-size: 12px; font-weight: 600; fill: #7a5230; text-anchor: middle; }
.np.transcript text { fill: #3d6378; }
.np.on path.box { stroke: #b8693e; stroke-width: 2.5; }
.io rect { fill: #e6eef3; stroke: #9fb6c6; stroke-width: 1.2; }
.io text { font-size: 14px; font-weight: 600; fill: #3d6378; text-anchor: middle; }
.io.on rect { stroke: #3d6378; stroke-width: 2.5; }
