/* clankery web: a chat filling the screen, its project's name at the top, the projects and the menu on a bottom bar
   (as Firefox for Android has its toolbar). Light or dark as the phone is. */
:root {
	--bg: #f9f9fb;
	--fg: #15141a;
	--muted: #5b5b66;
	--bar: #ffffff;
	--line: #e0e0e6;
	--user: #e0f0ff;
	--agent: #ffffff;
	--asks: #e8f7ec;
	--accent: #0061e0;
	--warn: #ffa436;
	--runs: #2ac3a2;
	--failed: #e22850;
	color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
	:root {
		--bg: #1c1b22;
		--fg: #fbfbfe;
		--muted: #a8a8b3;
		--bar: #2b2a33;
		--line: #3a3944;
		--user: #23364d;
		--agent: #2b2a33;
		--asks: #1f3a2c;
		--accent: #80ebff;
		--runs: #54ffbd;
		--failed: #ff848b;
	}
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
	background: var(--bg);
	color: var(--fg);
	font: 16px/1.4 system-ui, sans-serif;
	display: flex;
	flex-direction: column;
	height: 100dvh;
	overflow: hidden;
}
button { font: inherit; color: inherit; background: var(--bar); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; }
button.primary { background: var(--accent); color: var(--bg); border: none; }
input, textarea { font: inherit; color: inherit; background: var(--bar); border: 1px solid var(--line); border-radius: 20px; padding: 8px 14px; }
pre { white-space: pre-wrap; word-break: break-word; font-size: 13px; margin: 0; }
h1, h2 { margin: 0 0 12px; font-weight: 600; }
h2 { font-size: 17px; }

.center { margin: auto; color: var(--muted); }
.gate { margin: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; max-width: 420px; width: 100%; }
.hint { color: var(--muted); font-size: 14px; }

.top { display: flex; align-items: center; gap: 8px; padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); background: var(--bar); border-bottom: 1px solid var(--line); }
.titles { flex: 1; min-width: 0; }
.title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.standing { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.warned { color: var(--warn); border: none; font-size: 22px; padding: 2px 8px; display: flex; align-items: center; gap: 4px; }
.warned .count { font-size: 13px; }

.chat { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.said { background: var(--agent); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; max-width: 92%; }
.said .name { color: var(--muted); font-size: 12px; }
.said .text { white-space: pre-wrap; word-break: break-word; }
.said.user { background: var(--user); align-self: flex-end; border: none; }
.said.asks { background: var(--asks); }
.said.clankery, .said.called { background: transparent; border-style: dashed; }
.said.called .text, .said.changed .text { font-family: ui-monospace, monospace; font-size: 13px; }

.answers { display: flex; gap: 8px; padding: 0 12px 8px; }
.answers button { flex: 1; }
.answers .yes { background: var(--runs); color: #15141a; border: none; }

.input { display: flex; gap: 8px; padding: 8px 12px; background: var(--bar); border-top: 1px solid var(--line); }
.input textarea { flex: 1; resize: none; max-height: 40vh; field-sizing: content; }
.send { border-radius: 50%; width: 42px; height: 42px; padding: 0; background: var(--accent); color: var(--bg); border: none; }

.bottom { display: flex; align-items: center; gap: 4px; padding: 6px 8px; padding-bottom: max(6px, env(safe-area-inset-bottom)); background: var(--bar); border-top: 1px solid var(--line); }
.chips { flex: 1; display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.chip { white-space: nowrap; border-radius: 18px; padding: 6px 12px; border-left: 4px solid var(--line); }
.chip.chosen { background: var(--bg); font-weight: 600; outline: 2px solid var(--accent); }
.chip.runs { border-left-color: var(--runs); }
.chip.asks { border-left-color: var(--accent); }
.chip.waits { opacity: .7; }
.chip.blocked { border-left-color: var(--warn); }
.chip.failed { border-left-color: var(--failed); }
.menu { border: none; font-size: 22px; padding: 2px 12px; }

.shade { position: fixed; inset: 0; background: rgba(0, 0, 0, .4); }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 85dvh; overflow-y: auto; background: var(--bar); border-radius: 16px 16px 0 0; padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.entries { display: flex; flex-direction: column; }
.entry { text-align: left; border: none; border-radius: 0; border-bottom: 1px solid var(--line); padding: 12px 4px; background: transparent; }
.warning { border-bottom: 1px solid var(--line); padding: 8px 0; }
.warning .name { color: var(--muted); font-size: 12px; }
.acts { display: flex; gap: 8px; margin-top: 6px; }
.row { display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); }
.row span { min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.row input { flex: 1; }

.toast { position: fixed; left: 12px; right: 12px; bottom: 120px; background: var(--fg); color: var(--bg); border-radius: 10px; padding: 10px 14px; white-space: pre-wrap; max-height: 40vh; overflow-y: auto; }
