/* The /chat/ page around the chat client, in the clean, ChatGPT-like look
 * (2026-11-27; the client's own look is gamja/clean.css). One quiet row:
 * the site's name and sections, Inbox, sign-in, Summon help, and a "⋯" menu
 * for the profile, bug reports and the theme and holiday pickers. The
 * dot-matrix display above it is switched off for now (MATRIX.md).
 *
 * Only body.chat-page: the games page keeps chat-modern.css as it was.
 * Colours come from the visitor's site theme; the Modern theme (the default)
 * matches the chat's own white. */

body.chat-page {
	--shell-bg: var(--bg);
	--shell-fg: var(--fg);
	--shell-muted: var(--muted);
	--shell-line: var(--border);
	--shell-hover: var(--card);
	--shell-pop: var(--card);
	--shell-danger: var(--danger, #c4323a);
	--shell-font: ui-sans-serif, -apple-system, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	background: var(--shell-bg);
}
html[data-theme="modern"] body.chat-page {
	--shell-bg: #ffffff;
	--shell-fg: #0d0d0d;
	--shell-muted: #5d5d5d;
	--shell-line: #ececec;
	--shell-hover: #f2f2f2;
	--shell-pop: #ffffff;
	--shell-danger: #c4323a;
}

/* No seasonal banner strip above the chat: the chat stays calm. */
html.theme-site body.chat-page::before {
	content: none !important;
	display: none !important;
}

html body.chat-page header.chat-top {
	position: relative;
	z-index: 20;
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	gap: 4px;
	min-height: 50px;
	box-sizing: border-box;
	padding: 7px 10px 7px 14px;
	overflow: visible !important;
	border-bottom: 1px solid var(--shell-line);
	background: var(--shell-bg) !important;
	box-shadow: none !important;
	color: var(--shell-fg);
	font-family: var(--shell-font);
}
html body.chat-page .chat-top .home {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	flex: 0 0 auto;
	margin-right: 12px;
	color: var(--shell-fg);
	font-size: 15px;
	font-weight: 600;
	text-decoration: none;
}
html body.chat-page .chat-top .home:hover {
	text-decoration: none;
}
html body.chat-page .chat-top .home .logo-small {
	width: 26px;
	height: 26px;
}

/* The name at the top left opens a small ChatGPT-style menu, hidden until
 * clicked; going to the homepage is one of its options (owner, 2026-11-28). */
html body.chat-page .chat-top .chat-brand-wrap {
	position: relative;
	display: flex;
	flex: 0 0 auto;
	min-width: 0;
	margin-right: 8px;
}
html body.chat-page .chat-top button.chat-brand {
	min-width: 0;
	height: 38px;
	margin: 0;
	padding: 0 8px 0 6px;
	border: 0 !important;
	border-radius: 10px;
	background: transparent !important;
	box-shadow: none !important;
	font-family: var(--shell-font);
	line-height: 1;
	cursor: pointer;
}
html body.chat-page .chat-top button.chat-brand:hover,
html body.chat-page .chat-top button.chat-brand[aria-expanded="true"] {
	background: var(--shell-hover) !important;
}
html body.chat-page .chat-top .chat-brand-caret {
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	margin-left: -2px;
	fill: none;
	stroke: var(--shell-muted);
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}
html body.chat-page .chat-brand-menu {
	position: absolute;
	top: calc(100% + 6px);
	left: 0;
	z-index: 50;
	display: flex;
	flex-direction: column;
	gap: 2px;
	width: 300px;
	max-width: calc(100vw - 16px);
	box-sizing: border-box;
	padding: 6px;
	border: 1px solid var(--shell-line);
	border-radius: 16px;
	background: var(--shell-pop);
	box-shadow: 0 10px 32px rgba(0, 0, 0, 0.14);
	font-family: var(--shell-font);
}
html body.chat-page .chat-brand-menu[hidden] {
	display: none;
}
html body.chat-page .chat-brand-menu .chat-brand-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	border-radius: 10px;
	color: var(--shell-fg);
	text-decoration: none;
}
html body.chat-page .chat-brand-menu .chat-brand-item:hover,
html body.chat-page .chat-brand-menu .chat-brand-item:focus-visible {
	background: var(--shell-hover);
	text-decoration: none;
}
html body.chat-page .chat-brand-menu svg {
	flex: 0 0 auto;
	fill: none;
	stroke: currentColor;
	stroke-linecap: round;
	stroke-linejoin: round;
}
html body.chat-page .chat-brand-menu .chat-brand-icon {
	width: 20px;
	height: 20px;
	stroke-width: 1.7;
}
html body.chat-page .chat-brand-menu .chat-brand-check {
	width: 18px;
	height: 18px;
	stroke-width: 2.2;
}
html body.chat-page .chat-brand-menu .chat-brand-text {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}
html body.chat-page .chat-brand-menu .chat-brand-title {
	font-size: 14px;
	font-weight: 500;
	line-height: 1.3;
}
html body.chat-page .chat-brand-menu .chat-brand-sub {
	color: var(--shell-muted);
	font-size: 12.5px;
	line-height: 1.35;
}
/* The name beside the arrow says what the menu is ("Autism Forge ⌄", like
 * ChatGPT's own); chat-modern.css hid it on most laptop widths. */
@media (min-width: 1024px) {
	html body.chat-page .chat-top .home-label {
		display: inline;
	}
}
html body.chat-page .chat-top .community-nav {
	display: flex;
	flex: 0 1 auto;
	gap: 2px;
	min-width: 0;
	padding: 0;
	border: 0;
	background: transparent;
}
html body.chat-page .chat-top .community-nav a {
	padding: 6px 10px;
	border-radius: 8px;
	background: transparent;
	color: var(--shell-muted);
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
}
html body.chat-page .chat-top .community-nav a:hover,
html body.chat-page .chat-top .community-nav a[aria-current="page"] {
	background: var(--shell-hover);
	color: var(--shell-fg);
}
html body.chat-page .chat-top .grow {
	flex: 1 1 auto;
}
html body.chat-page .chat-top .btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	height: 34px;
	box-sizing: border-box;
	min-height: 0;
	margin: 0;
	padding: 0 12px;
	border: 0 !important;
	border-radius: 8px;
	background: transparent !important;
	box-shadow: none !important;
	color: var(--shell-fg);
	font-family: var(--shell-font);
	font-size: 14px;
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
}
html body.chat-page .chat-top .btn:hover {
	background: var(--shell-hover) !important;
	color: var(--shell-fg);
}
html body.chat-page .chat-top .btn-login {
	padding: 0 16px;
	border-radius: 999px;
	background: var(--shell-fg) !important;
	color: var(--shell-bg);
}
html body.chat-page .chat-top .btn-login:hover {
	background: var(--shell-fg) !important;
	color: var(--shell-bg);
	opacity: 0.85;
}
html body.chat-page .chat-top .btn-help {
	border: 1px solid color-mix(in srgb, var(--shell-danger) 45%, transparent) !important;
	border-radius: 999px;
	background: transparent !important;
	color: var(--shell-danger);
}
html body.chat-page .chat-top .btn-help:hover {
	background: color-mix(in srgb, var(--shell-danger) 10%, transparent) !important;
	color: var(--shell-danger);
}
html body.chat-page .chat-top .btn:focus:not(:focus-visible) {
	outline: none;
}
html body.chat-page .chat-top .btn:focus-visible,
html body.chat-page .chat-top a:focus-visible {
	outline: 2px solid var(--shell-fg);
	outline-offset: 2px;
}
html body.chat-page #chat-auth {
	display: inline-flex;
	align-items: center;
	gap: 4px;
}
html body.chat-page #summon-status {
	color: var(--shell-muted);
	font-size: 13px;
}
html body.chat-page #summon-status:empty {
	display: none;
}

/* The "⋯" menu. */
html body.chat-page .chat-more-wrap {
	position: relative;
	flex: 0 0 auto;
}
html body.chat-page .chat-top .chat-menu-toggle {
	display: inline-flex;
	width: 34px;
	padding: 0;
	font-size: 20px;
	line-height: 1;
}
html body.chat-page .chat-more {
	position: absolute;
	top: calc(100% + 6px);
	right: 0;
	z-index: 50;
	display: flex;
	flex-direction: column;
	gap: 1px;
	min-width: 250px;
	padding: 6px;
	border: 1px solid var(--shell-line);
	border-radius: 14px;
	background: var(--shell-pop);
	box-shadow: 0 10px 32px rgba(0, 0, 0, 0.14);
	font-family: var(--shell-font);
}
html body.chat-page .chat-more[hidden] {
	display: none;
}
html body.chat-page .chat-more .chat-more-item,
html body.chat-page .chat-more .chat-bug-report {
	display: flex;
	align-items: center;
	width: 100%;
	box-sizing: border-box;
	margin: 0;
	padding: 9px 10px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	color: var(--shell-fg);
	font: inherit;
	font-size: 14px;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
}
html body.chat-page .chat-more .chat-more-item:hover,
html body.chat-page .chat-more .chat-bug-report:hover {
	background: var(--shell-hover);
}
html body.chat-page .chat-more .chat-more-nav {
	display: none;
}
html body.chat-page .chat-more .theme-picker {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	align-items: center;
	gap: 6px 10px;
	margin-top: 4px;
	padding: 10px 10px 6px;
	border-top: 1px solid var(--shell-line);
	color: var(--shell-muted);
	font-size: 13px;
}
html body.chat-page .chat-more .theme-picker label {
	display: block !important;
	color: var(--shell-muted);
}
html body.chat-page .chat-more .theme-picker select {
	min-height: 0 !important;
	max-width: none !important;
	width: 100%;
	padding: 6px 8px;
	border: 1px solid var(--shell-line);
	border-radius: 8px;
	background: var(--shell-bg);
	color: var(--shell-fg);
	font: inherit;
	font-size: 13px;
}
html body.chat-page .chat-more .spacer {
	display: none;
}
html body.chat-page .visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

html body.chat-page #chat-frame {
	background: var(--shell-bg);
}
html body.chat-page #chat-entry {
	border-radius: 18px;
}

/* Phones and narrow windows: one row; the sections and Inbox move into
 * the menu. Summon help always stays in view. */
@media (max-width: 820px) {
	html body.chat-page header.chat-top {
		flex-wrap: nowrap;
		gap: 2px;
		padding: max(6px, env(safe-area-inset-top)) 6px 6px 10px;
		row-gap: 0;
	}
	html body.chat-page .chat-top .community-nav,
	html body.chat-page .chat-top #chat-inbox-link {
		display: none !important;
	}
	html body.chat-page .chat-top .chat-brand-wrap { order: 0; flex: 0 1 auto; margin-right: 4px; }
	html body.chat-page .chat-top .grow { order: 1; }
	html body.chat-page .chat-top #chat-auth { order: 2; }
	html body.chat-page .chat-top #summon-status { order: 3; flex-basis: auto; }
	html body.chat-page .chat-top #summon { order: 4; }
	html body.chat-page .chat-top .chat-more-wrap { order: 5; }
	html body.chat-page .chat-top .home {
		flex: 0 1 auto;
		min-width: 0;
		margin-right: 4px;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	html body.chat-page .chat-more .chat-more-nav {
		display: flex;
		flex-direction: column;
		gap: 1px;
		margin-bottom: 4px;
		padding-bottom: 4px;
		border-bottom: 1px solid var(--shell-line);
	}
	html body.chat-page .chat-top .btn {
		height: 34px;
		padding: 0 10px;
		font-size: 13.5px;
	}
	html body.chat-page .chat-more {
		position: fixed;
		top: calc(max(6px, env(safe-area-inset-top)) + 46px);
		right: 8px;
		max-width: calc(100vw - 16px);
		max-height: calc(100dvh - 70px);
		overflow-y: auto;
	}
}
@media (max-width: 440px) {
	html body.chat-page .chat-top .home-label {
		display: none;
	}
}
