/* ── Brain · three.ws ─────────────────────────────────────────────────────── */
:root { color-scheme: dark; }
*, *::before, *::after { box-sizing: border-box; }

body {
	background: #000000;
	color: var(--ink);
	font: 14px/1.55 -apple-system, system-ui, 'Segoe UI', Roboto, sans-serif;
	margin: 0;
	display: flex;
	flex-direction: column;
	height: 100vh;
	overflow: hidden;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
.br-root {
	flex: 1;
	display: flex;
	overflow: hidden;
	min-height: 0;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.br-side {
	width: 240px;
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	border-right: 1px solid #141414;
	background: #080808;
	overflow: hidden;
}
.br-side-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 16px;
	border-bottom: 1px solid #141414;
}
.br-side-title {
	font-size: 11.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: #4a4a4a;
}
.br-side-new {
	background: #161616;
	border: 1px solid #222222;
	color: #7b7b7b;
	border-radius: 7px;
	padding: 5px 11px;
	font-size: 12px;
	cursor: pointer;
	transition: all 0.15s;
}
.br-side-new:hover { background: #1d1d1d; color: #b0b0b0; }

.br-sessions {
	flex: 1;
	overflow-y: auto;
	padding: 8px;
}
.br-sess {
	padding: 9px 12px;
	border-radius: 9px;
	cursor: pointer;
	font-size: 12.5px;
	color: #7b7b7b;
	display: flex;
	align-items: center;
	gap: 8px;
	border: 1px solid transparent;
	transition: all 0.12s;
	margin-bottom: 2px;
}
.br-sess:hover { background: #0e0e0e; color: #b0b0b0; }
.br-sess.active { background: #151515; color: #dde0f0; border-color: #222222; }
.br-sess-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.br-sess-del {
	background: none;
	border: none;
	color: #4a4a4a;
	cursor: pointer;
	padding: 2px 4px;
	font-size: 14px;
	border-radius: 4px;
	opacity: 0;
	transition: all 0.1s;
	line-height: 1;
}
.br-sess:hover .br-sess-del { opacity: 1; }
.br-sess-del:hover { color: #ff7070; }
.br-empty {
	padding: 24px 14px;
	text-align: center;
	color: #3d3d3d;
	font-size: 12.5px;
	line-height: 1.7;
}

/* ── Sidebar: persona section ────────────────────────────────────────────── */
.br-side-persona {
	border-top: 1px solid #141414;
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.br-side-persona-label {
	font-size: 10.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: #4a4a4a;
}
.br-persona-mini {
	background: #0e0e0e;
	border: 1px solid var(--bg-1);
	border-radius: 9px;
	padding: 10px;
	font-size: 12px;
	color: #8a8a8a;
	line-height: 1.5;
	display: none;
}
.br-persona-mini.has-persona { display: block; }
.br-persona-mini-tone { color: #cccccc; font-weight: 600; margin-bottom: 4px; }
.br-persona-mini-style { color: #ffffff; font-size: 11px; }
.br-persona-mini-clear {
	background: none;
	border: none;
	color: #4a4a4a;
	font-size: 11px;
	cursor: pointer;
	padding: 2px;
	margin-top: 4px;
}
.br-persona-mini-clear:hover { color: #ff7070; }

/* ── Main body ───────────────────────────────────────────────────────────── */
.br-body {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	min-width: 0;
}

/* ── Top bar with tabs ───────────────────────────────────────────────────── */
.br-topbar {
	display: flex;
	align-items: center;
	gap: 0;
	border-bottom: 1px solid #141414;
	background: #080808;
	flex-shrink: 0;
	padding: 0 16px;
}
.br-tab {
	background: none;
	border: none;
	color: #4a4a4a;
	padding: 14px 18px;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	border-bottom: 2px solid transparent;
	transition: all 0.15s;
	position: relative;
}
.br-tab:hover { color: #8a8a8a; }
.br-tab.active {
	color: var(--ink);
	border-bottom-color: #ffffff;
}
.br-tab .br-tab-badge {
	position: absolute;
	top: 10px;
	right: 4px;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #ffffff;
	display: none;
}
.br-tab .br-tab-badge.on { display: block; }

.br-topbar-right {
	margin-left: auto;
	display: flex;
	gap: 8px;
	align-items: center;
}
.br-topbar-btn {
	background: #161616;
	border: 1px solid #222222;
	color: #7b7b7b;
	padding: 6px 12px;
	border-radius: 8px;
	font: inherit;
	font-size: 12px;
	cursor: pointer;
	transition: all 0.12s;
	text-decoration: none;
}
.br-topbar-btn:hover { background: #1d1d1d; color: #b0b0b0; }

/* ── Panels ──────────────────────────────────────────────────────────────── */
.br-panel {
	flex: 1;
	display: none;
	overflow: hidden;
}
.br-panel.active { display: flex; flex-direction: column; }

/* ── PERSONA BUILDER ─────────────────────────────────────────────────────── */
.br-persona {
	flex: 1;
	overflow-y: auto;
	padding: 0;
}
.br-persona-inner {
	max-width: 960px;
	margin: 0 auto;
	padding: 32px 28px 80px;
	display: flex;
	flex-direction: column;
	gap: 24px;
}
.br-persona-hero {
	text-align: center;
	padding: 20px 0 8px;
}
.br-persona-hero h1 {
	font-size: 28px;
	font-weight: 700;
	letter-spacing: -0.02em;
	margin: 0 0 8px;
	background: linear-gradient(135deg, #ffffff 0%, #ffffff 50%, #cccccc 100%);
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
}
.br-persona-hero p {
	color: #6b70a0;
	font-size: 14.5px;
	margin: 0;
	max-width: 52ch;
	margin: 0 auto;
}

/* Archetype quick-picks */
.br-archetype-section {
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.br-archetype-label {
	font-size: 11.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: #4a4a6a;
	text-align: center;
}
.br-archetype-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 10px;
}
.br-archetype-chip {
	background: #0c0c0c;
	border: 1.5px solid #1c1c2a;
	border-radius: 12px;
	padding: 14px 16px;
	cursor: pointer;
	text-align: left;
	transition: border-color 0.15s, background 0.15s, transform 0.1s;
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.br-archetype-chip:hover {
	border-color: #3a3a5a;
	background: #101018;
	transform: translateY(-1px);
}
.br-archetype-chip.selected {
	border-color: #ffffff;
	background: #0e0e1a;
}
.br-archetype-chip-label {
	font-size: 13px;
	font-weight: 600;
	color: #dde0f0;
	display: block;
}
.br-archetype-chip-desc {
	font-size: 11.5px;
	color: #5a5a7a;
	display: block;
	line-height: 1.4;
}

/* Describe input section */
.br-describe-section {
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.br-describe-divider {
	display: flex;
	align-items: center;
	gap: 12px;
	color: #3a3a5a;
	font-size: 12px;
}
.br-describe-divider::before,
.br-describe-divider::after {
	content: '';
	flex: 1;
	height: 1px;
	background: #1c1c2a;
}
.br-describe-input {
	width: 100%;
	background: #0c0c0c;
	border: 1.5px solid #1c1c2a;
	border-radius: 14px;
	color: var(--ink);
	font: inherit;
	font-size: 14px;
	padding: 16px 18px;
	resize: vertical;
	min-height: 80px;
	outline: none;
	transition: border-color 0.15s;
	line-height: 1.55;
}
.br-describe-input:focus { border-color: #3050a0; }
.br-describe-input::placeholder { color: #3a3a4a; }

/* Action row */
.br-actions {
	display: flex;
	gap: 10px;
	justify-content: center;
	flex-wrap: wrap;
}

/* Buttons */
.br-btn {
	border: none;
	border-radius: 10px;
	padding: 12px 20px;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.15s;
	display: inline-flex;
	align-items: center;
	gap: 8px;
}
.br-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.br-btn-primary { background: #ffffff; color: #000000; }
.br-btn-primary:hover:not(:disabled) { background: #5dccff; }
.br-btn-secondary { background: #161616; color: #b0b0b0; border: 1px solid #222222; }
.br-btn-secondary:hover:not(:disabled) { background: #1d1d1d; }
.br-btn-ghost { background: transparent; color: #6b70a0; }
.br-btn-ghost:hover:not(:disabled) { color: #b0b0b0; }
.br-btn-danger { background: rgba(255,100,100,0.1); color: #ff8a8a; border: 1px solid rgba(255,100,100,0.2); }
.br-btn-danger:hover:not(:disabled) { background: rgba(255,100,100,0.18); }
.br-btn-sm { padding: 7px 12px; font-size: 12px; border-radius: 7px; }

/* ── Persona card ────────────────────────────────────────────────────────── */
.br-persona-card {
	display: none;
	background: #0c0c0c;
	border: 1.5px solid var(--bg-1);
	border-radius: 16px;
	overflow: hidden;
}
.br-persona-card.show { display: block; }

.br-pc-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 22px;
	border-bottom: 1px solid #141414;
	background: linear-gradient(135deg, rgba(255,255,255,0.04) 0%, rgba(255,255,255,0.02) 100%);
}
.br-pc-header h3 {
	font-size: 15px;
	font-weight: 700;
	margin: 0;
	color: #dde0f0;
}
.br-pc-header-actions { display: flex; gap: 6px; }

.br-pc-body {
	padding: 20px 22px;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 18px;
}

.br-pc-field { display: flex; flex-direction: column; gap: 6px; }
.br-pc-field.full { grid-column: 1 / -1; }
.br-pc-label {
	font-size: 10.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: #4a4a4a;
}
.br-pc-value { font-size: 14px; color: #c8cce0; line-height: 1.5; }

.br-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.br-chip {
	display: inline-block;
	padding: 4px 11px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 500;
}
.br-chip-blue { background: rgba(255,255,255,0.1); color: #ffffff; border: 1px solid rgba(255,255,255,0.25); }
.br-chip-purple { background: rgba(255,255,255,0.06); color: #ffffff; border: 1px solid rgba(255,255,255,0.15); }
.br-chip-red { background: rgba(255,100,100,0.08); color: #ff8a8a; border: 1px solid rgba(255,100,100,0.2); }
.br-chip-muted { background: rgba(255,255,255,0.04); color: #8a8a8a; border: 1px solid #212121; }

.br-pc-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 6px;
	font-size: 12px;
	font-weight: 600;
	background: rgba(255,255,255,0.1);
	color: #ffffff;
	border: 1px solid rgba(255,255,255,0.25);
}

.br-pc-greeting {
	font-style: italic;
	color: #a8aecc;
	padding: 8px 0 0;
	border-top: none;
	font-size: 14px;
}

.br-pc-footer {
	padding: 14px 22px;
	border-top: 1px solid #141414;
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	align-items: center;
}
.br-pc-save-wrap {
	display: flex;
	gap: 8px;
	align-items: center;
	margin-left: auto;
}
.br-agent-select {
	background: #0c0c0c;
	border: 1px solid #222222;
	border-radius: 8px;
	color: #b0b0b0;
	padding: 7px 10px;
	font: inherit;
	font-size: 12.5px;
	cursor: pointer;
	min-width: 160px;
}

/* ── Inline persona editor ───────────────────────────────────────────────── */
.br-pc-edit-body {
	padding: 20px 22px;
	display: flex;
	flex-direction: column;
	gap: 16px;
}
.br-edit-row { display: flex; flex-direction: column; gap: 6px; }
.br-edit-label {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #4a4a4a;
}
.br-edit-input {
	width: 100%;
	background: #080808;
	border: 1px solid var(--bg-1);
	border-radius: 8px;
	color: var(--ink);
	font: inherit;
	font-size: 13px;
	padding: 9px 12px;
	outline: none;
	transition: border-color 0.15s;
}
.br-edit-input:focus { border-color: #3050a0; }
.br-edit-textarea {
	width: 100%;
	background: #080808;
	border: 1px solid var(--bg-1);
	border-radius: 8px;
	color: var(--ink);
	font: inherit;
	font-size: 13px;
	padding: 9px 12px;
	outline: none;
	resize: vertical;
	min-height: 60px;
	transition: border-color 0.15s;
}
.br-edit-textarea:focus { border-color: #3050a0; }
.br-edit-hint { font-size: 11px; color: #3d3d3d; }

/* ── Raw JSON toggle ─────────────────────────────────────────────────────── */
.br-raw-json {
	display: none;
	background: #080808;
	border: 1px solid var(--bg-1);
	border-radius: 10px;
	padding: 14px 16px;
	margin: 0 22px 16px;
	font-family: ui-monospace, 'JetBrains Mono', Menlo, monospace;
	font-size: 12px;
	color: #8a8a8a;
	white-space: pre-wrap;
	word-break: break-word;
	max-height: 300px;
	overflow: auto;
}
.br-raw-json.show { display: block; }

/* ── PLAYGROUND ──────────────────────────────────────────────────────────── */
.br-play { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

/* Playground toolbar */
.br-play-bar {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 16px;
	border-bottom: 1px solid #141414;
	background: #080808;
	flex-shrink: 0;
	flex-wrap: wrap;
}

.br-mode-toggle {
	display: flex;
	border: 1px solid var(--bg-1);
	border-radius: 8px;
	overflow: hidden;
}
.br-mode-btn {
	background: none;
	border: none;
	color: #4a4a4a;
	padding: 7px 14px;
	font: inherit;
	font-size: 12.5px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.12s;
}
.br-mode-btn + .br-mode-btn { border-left: 1px solid var(--bg-1); }
.br-mode-btn.active { background: #161616; color: #dde0f0; }

.br-play-label {
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #4a4a4a;
}

.br-provider-pills { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.br-pill {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 10px;
	border-radius: 999px;
	border: 1px solid var(--bg-1);
	background: #0c0c0c;
	color: #4a4a4a;
	font-size: 12px;
	cursor: pointer;
	user-select: none;
	transition: all 0.12s;
}
.br-pill.on { border-color: var(--pc); color: var(--pc); }
.br-pill.unavailable {
	opacity: 0.38;
	cursor: not-allowed;
	pointer-events: none;
}
.br-pill-na {
	font-size: 9px;
	color: #ff4444;
	margin-left: 2px;
}
.br-pill-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--pc);
	opacity: 0.7;
}

.br-focus-sel {
	background: #0c0c0c;
	border: 1px solid var(--bg-1);
	color: #b0b0b0;
	padding: 6px 10px;
	border-radius: 8px;
	font: inherit;
	font-size: 13px;
	cursor: pointer;
}

/* Persona active banner */
.br-persona-banner {
	display: none;
	align-items: center;
	gap: 10px;
	padding: 8px 16px;
	background: linear-gradient(90deg, rgba(255,255,255,0.06) 0%, rgba(255,255,255,0.03) 100%);
	border-bottom: 1px solid rgba(255,255,255,0.15);
	font-size: 12.5px;
	color: #8a8a8a;
}
.br-persona-banner.show { display: flex; }
.br-persona-banner-dot {
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #ffffff;
	flex-shrink: 0;
}
.br-persona-banner strong { color: #c8cce0; }
.br-persona-banner-dismiss {
	margin-left: auto;
	background: none;
	border: none;
	color: #4a4a4a;
	cursor: pointer;
	font-size: 12px;
	padding: 2px 6px;
}
.br-persona-banner-dismiss:hover { color: #b0b0b0; }

/* Canvas */
.br-canvas { flex: 1; overflow: hidden; display: flex; min-height: 0; }

/* Compare columns */
.br-compare { display: flex; flex: 1; overflow-x: auto; overflow-y: hidden; }
.br-col {
	flex: 1;
	min-width: 300px;
	display: flex;
	flex-direction: column;
	border-right: 1px solid #141414;
	overflow: hidden;
}
.br-col:last-child { border-right: none; }
.br-col-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px;
	border-bottom: 1px solid #141414;
	flex-shrink: 0;
	gap: 8px;
}
.br-col-name { font-size: 13px; font-weight: 700; color: var(--pc); }
.br-col-meta { font-size: 10.5px; color: #4a4a4a; text-transform: uppercase; letter-spacing: 0.06em; }
.br-col-stats {
	font-size: 11px;
	color: #4a4a4a;
	font-family: ui-monospace, monospace;
	display: flex;
	gap: 8px;
}
.br-col-stats strong { color: #8a8a8a; }
.br-col-copy {
	background: none;
	border: none;
	color: #4a4a4a;
	cursor: pointer;
	padding: 3px 6px;
	border-radius: 5px;
	font-size: 11px;
	transition: all 0.1s;
}
.br-col-copy:hover { color: #b0b0b0; background: #161616; }
.br-col-msgs {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}
.br-col-empty {
	color: #3d3d3d;
	font-size: 13px;
	font-style: italic;
	text-align: center;
	padding: 40px 20px;
}
.br-col-user {
	font-size: 12.5px;
	color: #6b70a0;
	padding: 8px 12px;
	background: #0c0c0c;
	border-radius: 10px;
	border: 1px solid #141414;
}
.br-col-assistant {
	font-size: 13.5px;
	color: #dde0f0;
	line-height: 1.65;
}

/* Chat mode */
.br-chat {
	flex: 1;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	max-width: 840px;
	margin: 0 auto;
	width: 100%;
}
.br-chat-msgs {
	flex: 1;
	overflow-y: auto;
	padding: 24px 28px;
	display: flex;
	flex-direction: column;
	gap: 22px;
}
.br-chat-empty {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	color: #4a4a4a;
	gap: 12px;
	padding: 40px;
	text-align: center;
}
.br-chat-empty h3 { color: #8a8a8a; margin: 0; font-size: 18px; font-weight: 600; }
.br-chat-empty p { margin: 0; font-size: 13.5px; max-width: 44ch; line-height: 1.6; }

/* Messages */
.br-msg {
	display: flex;
	flex-direction: column;
	gap: 5px;
	animation: brMsgIn 0.15s ease-out;
}
@keyframes brMsgIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.br-msg-label {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: #4a4a4a;
}
.br-msg.user .br-msg-label { color: #7b7b7b; }
.br-msg.assistant .br-msg-label { color: var(--pc, #7b7b7b); }
.br-msg-body {
	font-size: 14px;
	line-height: 1.65;
	color: #dde0f0;
}
.br-msg.user .br-msg-body { color: #a0a5c8; }

/* Streaming spinner */
.br-spin {
	display: inline-block;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: #ffffff;
	animation: brBlink 0.9s ease-in-out infinite;
	vertical-align: middle;
	margin-left: 4px;
}
@keyframes brBlink { 0%,100%{ opacity:0.2 } 50%{ opacity:1 } }

/* ── Input area ──────────────────────────────────────────────────────────── */
.br-input-wrap {
	border-top: 1px solid #141414;
	padding: 12px 16px 14px;
	background: #080808;
	flex-shrink: 0;
}
.br-sys-details { margin-bottom: 8px; }
.br-sys-details summary {
	font-size: 11.5px;
	color: #4a4a4a;
	cursor: pointer;
	user-select: none;
	font-weight: 600;
	letter-spacing: 0.04em;
	padding: 2px 0;
}
.br-sys-details summary:hover { color: #7b7b7b; }
.br-sys-details[open] summary { color: #7b7b7b; margin-bottom: 6px; }
.br-sys-textarea {
	width: 100%;
	background: #0c0c0c;
	border: 1px solid var(--bg-1);
	border-radius: 9px;
	color: #b0b0b0;
	font: inherit;
	font-size: 13px;
	padding: 10px 12px;
	resize: vertical;
	min-height: 56px;
	outline: none;
}
.br-sys-textarea:focus { border-color: #2a3060; }
.br-input-row { display: flex; gap: 8px; align-items: flex-end; }
.br-prompt {
	flex: 1;
	background: #0c0c0c;
	border: 1px solid var(--bg-1);
	border-radius: 12px;
	color: var(--ink);
	font: inherit;
	font-size: 14px;
	padding: 12px 14px;
	resize: none;
	min-height: 46px;
	max-height: 160px;
	outline: none;
	transition: border-color 0.15s;
	field-sizing: content;
}
.br-prompt:focus { border-color: #2a3060; }
.br-send {
	background: #ffffff;
	color: #000000;
	border: none;
	border-radius: 12px;
	padding: 12px 18px;
	font: inherit;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	flex-shrink: 0;
	transition: all 0.12s;
}
.br-send:hover { background: #5dccff; }
.br-send:disabled { opacity: 0.35; cursor: not-allowed; }
.br-hint {
	font-size: 11px;
	color: #323232;
	margin-top: 6px;
	display: flex;
	gap: 14px;
}

/* ── Notice ──────────────────────────────────────────────────────────────── */
.br-notice {
	padding: 8px 14px;
	border-radius: 8px;
	background: rgba(255,184,77,0.08);
	border: 1px solid rgba(255,184,77,0.2);
	color: #ffb84d;
	font-size: 12.5px;
	margin-bottom: 8px;
	display: none;
}

/* ── Markdown rendered content ───────────────────────────────────────────── */
.md-p { margin: 0 0 0.7em; }
.md-p:last-child { margin-bottom: 0; }
.md-h1 { font-size: 17px; font-weight: 700; margin: 1em 0 0.4em; }
.md-h2 { font-size: 15px; font-weight: 700; margin: 0.9em 0 0.35em; }
.md-h3 { font-size: 13.5px; font-weight: 700; margin: 0.75em 0 0.3em; }
.md-ul, .md-ol { margin: 0.4em 0 0.6em 1.4em; padding: 0; }
.md-ul li, .md-ol li { margin: 0.2em 0; }
.md-code {
	background: #0c0c0c;
	border: 1px solid var(--bg-1);
	border-radius: 9px;
	padding: 12px 14px;
	overflow-x: auto;
	font-family: ui-monospace, 'JetBrains Mono', Menlo, monospace;
	font-size: 12.5px;
	line-height: 1.55;
	margin: 0.5em 0 0.75em;
	color: #b8c0e8;
}
.md-ic {
	background: rgba(255,255,255,0.06);
	border: 1px solid rgba(255,255,255,0.08);
	border-radius: 4px;
	padding: 1px 5px;
	font-family: ui-monospace, monospace;
	font-size: 12px;
	color: #b8c0e8;
}

/* ── Toast ────────────────────────────────────────────────────────────────── */
.br-toast {
	position: fixed;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%) translateY(100px);
	background: #161616;
	border: 1px solid #222222;
	color: #dde0f0;
	padding: 10px 20px;
	border-radius: 10px;
	font-size: 13px;
	font-weight: 500;
	z-index: 9999;
	opacity: 0;
	transition: all 0.3s ease;
	pointer-events: none;
}
.br-toast.show {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

/* ── Loading overlay ─────────────────────────────────────────────────────── */
.br-loading {
	display: none;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 24px;
	color: #7b7b7b;
	font-size: 14px;
}
.br-loading.show { display: flex; }
.br-loading-spinner {
	width: 20px;
	height: 20px;
	border: 2px solid var(--bg-1);
	border-top-color: #ffffff;
	border-radius: 50%;
	animation: brSpin 0.8s linear infinite;
}
@keyframes brSpin { to { transform: rotate(360deg); } }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
	.br-side { display: none; }
	.br-persona-inner { padding: 20px 16px 60px; }
	.br-archetype-grid { grid-template-columns: repeat(2, 1fr); }
	.br-pc-body { grid-template-columns: 1fr; }
	.br-play-bar { padding: 8px 12px; }
	.br-chat-msgs { padding: 16px; }
	.br-input-wrap { padding: 10px 12px 12px; }
}
@media (max-width: 640px) {
	.br-topbar { padding: 0 10px; }
	.br-tab { padding: 12px 12px; font-size: 12.5px; }
	.br-pc-footer { flex-direction: column; }
	.br-pc-save-wrap { margin-left: 0; width: 100%; }
	.br-agent-select { flex: 1; }
}
