 :root {
	color-scheme: light dark;
	font-family: Arial, Helvetica, sans-serif;
}

.mod-section--ai {
	margin: 1rem auto;
	max-width: 72rem;
}

.mod-ai-list {
	max-height: 18rem;
	overflow: auto;
}

/* Make the page occupy the full viewport */
html, body {
	width: 100%;
	min-height: 100%;
	margin: 0;
	padding: 0;
}

.ascii-video-layer {
	position: fixed;
	inset: 0;
	display: grid;
	place-items: center;
	overflow: hidden;
	pointer-events: none;
	background: #000;
	color: #fff;
	opacity: 0;
	transition: opacity 700ms ease;
}

.ascii-video-layer--intro {
	z-index: 1000;
	opacity: 1;
}

.ascii-video-layer--background {
	z-index: 0;
	opacity: 0.075;
}

.ascii-video-output {
	width: max-content;
	min-width: 100vw;
	min-height: 100vh;
	margin: 0;
	font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
	font-size: max(
		calc(100vw / var(--ascii-columns) / var(--ascii-cell-ratio, 0.6)),
		calc(100vh / var(--ascii-rows))
	);
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0;
	white-space: pre;
	text-align: center;
	text-shadow: 0 0 0.35em currentColor;
}

.ascii-video-source {
	position: fixed;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

body > :not(.ascii-video-layer):not(.ascii-video-source):not(.site-shell-header):not(.site-shell-footer) {
	position: relative;
	z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
	.ascii-video-layer {
		transition: none;
	}
}

@media (prefers-color-scheme: light) {
	.ascii-video-layer {
		filter: invert(1);
	}
}

/* Shared site chrome remains pinned while page content scrolls. */
.site-shell-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: flex-start;
	padding: 5px 0;
	z-index: 10;
	background: rgba(255, 255, 255, 0.08);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

/* Unified header nav: links and buttons share the same retro-modern style */
header a,
.header-button {
	background: none;
	border: none;
	padding: 0;
	margin-left: 0.9rem;
	cursor: pointer;
	font: inherit;
	font-size: 0.85rem;
	letter-spacing: 0.06em;
	color: #fff;
	text-decoration: none;
	white-space: nowrap;
}

button {
	text-transform: lowercase;
}

.header-refresh-button {
	margin-left: 0.75rem;
	margin-right: 4px;
	font-size: 1.1rem;
	line-height: 1;
}

header a:hover,
.header-button:hover {
	color: #fff;
	text-decoration: none;
}

header li {
	/* spacing handled by gap on the flex container */
	margin-right: 0;
}

.header-spacer {
    flex: 1 1 auto;
}

@keyframes rgb-wave {
    0%   { background-position: 0% 50%; }
    100% { background-position: 200% 50%; }
}

header .motd {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
	white-space: nowrap;
    font-size: 0.9rem;
    background: linear-gradient(
        90deg,
        #ff9999, #ffbb88, #ffff99, #99ffaa,
        #99ffff, #99aaff, #cc99ff, #ff99ff,
        #ff9999, #ffbb88, #ffff99, #99ffaa,
        #99ffff, #99aaff, #cc99ff, #ff99ff,
        #ff9999
    );
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: rgb-wave 18s linear infinite;
}

.site-shell-footer {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	height: 1.5rem;
	display: flex;
	flex-direction: row;
	align-items: center;
	justify-content: flex-start;
	padding: 0;
	background: rgba(0, 0, 0, 0.2);
	border-top: 1px solid rgba(255, 255, 255, 0.15);
	z-index: 10;
	background-color: black;
}

footer p {
	margin: 0;
	font-size: 0.75rem;
	line-height: 1;
}

.footer-ticker {
	flex: 1 1 auto;
	height: 100%;
	overflow: hidden;
	display: flex;
	align-items: center;
	mask-image: linear-gradient(to right, transparent 0, black 1rem, black calc(100% - 1rem), transparent 100%);
}

.footer-ticker__track {
	display: inline-flex;
	align-items: center;
	white-space: nowrap;
	min-width: max-content;
	will-change: transform;
	animation: footer-marquee 28s linear infinite;
}

.footer-ticker__track span {
	font-size: 0.72rem;
	letter-spacing: 0.05em;
	text-transform: lowercase;
	opacity: 0.9;
	padding-right: 3rem;
}

.footer-copyright {
	flex: 0 0 auto;
	padding: 0 0.6rem;
	white-space: nowrap;
	border-left: 1px solid rgba(255, 255, 255, 0.2);
	background-color: rgba(0, 0, 0, 0.45);
	height: 100%;
	display: flex;
	align-items: center;
}

@keyframes footer-marquee {
	to { transform: translateX(var(--marquee-shift, -50%)); }
}

.login-page {
	min-height: 100vh;
	display: grid;
	place-items: center;
	padding: 4rem 1rem;
	box-sizing: border-box;
}

.login-form {
	display: flex;
	flex-direction: column;
	gap: 0.85rem;
	width: min(100%, 22rem);
	box-sizing: border-box;
}

.auth-title {
	margin: 0 0 0.4rem;
	font: inherit;
	font-size: 1.4rem;
	font-weight: 600;
}

.login-form label {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	font-size: 0.88rem;
}

.login-form input {
	min-height: 2.25rem;
	padding: 0.45rem 0.55rem;
	border: 1px solid #aaa;
	border-radius: 0;
	box-sizing: border-box;
	font: inherit;
	background: none;
	color: inherit;
}

.login-form input:focus {
	outline: 1px solid currentColor;
	outline-offset: 1px;
}

.login-form button {
	min-height: 2.25rem;
	margin-top: 0.25rem;
	border: 1px solid #888;
	border-radius: 0;
	background: rgba(128, 128, 128, 0.08);
	color: inherit;
	font: inherit;
	cursor: pointer;
}

.login-form button:hover {
	background: rgba(128, 128, 128, 0.16);
}

.login-form p {
	margin: 0;
	font-size: 0.82rem;
	opacity: 0.75;
}

.auth-status {
	min-height: 1.2em;
	font-size: 0.85rem;
	color: #b00020;
	max-width: 100%;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.login-form label,
.login-form input,
.login-form button {
	width: 100%;
	box-sizing: border-box;
}

.center-page {
	min-height: 100vh;
}

.post-page {
	min-height: 100vh;
	display: grid;
	place-items: center;
	box-sizing: border-box;
}

.purpose-page {
	min-height: 100vh;
	display: grid;
	place-items: center;
	padding: 4rem 1.5rem;
	box-sizing: border-box;
}

.purpose-copy {
	max-width: 44rem;
	margin: 0;
	font-size: clamp(1rem, 2vw, 1.25rem);
	font-style: italic;
	line-height: 1.65;
	text-align: center;
}

.post-form {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	width: min(100%, 32rem);
}

.post-form label {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.post-form input,
.post-form textarea {
	font: inherit;
	padding: 0.5rem;
	border: 1px solid #ccc;
	box-sizing: border-box;
}

.post-form textarea {
	min-height: 12rem;
	resize: vertical;
}

/* If content sits under the fixed header, add top padding to body content as needed
	 (adjust the value to match header height) */
/* main, .content {
	padding-top: 2rem;
} */

#posts {
	padding: 2.5rem 1rem;
}

.header-status {
	margin-left: 1rem;
	color: #90EE90;
}

/* Remove default list numbers/bullets for all lists */
ol, ul {
	list-style: none;
	margin: 0;
	padding-left: 0;
}

.post {
    padding: 0.5rem;
    border: 1px solid #ccc;
	display: flex;
	flex-direction: column;
	width: fit-content;
	max-width: 75vw;
	align-self: flex-start;
    margin-bottom: 1rem;
}

.post__body {
	display: flex;
	align-items: flex-start;
}

.post__meta {
	min-width: 120px;
	flex: 0 0 90px;
	display: flex;
	flex-direction: column;
}

.post__title-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.75rem;
	padding-bottom: 0.3rem;
	margin-bottom: 0.35rem;
	border-bottom: 1px solid rgba(128, 128, 128, 0.25);
}

.post__title {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.post__thread-link {
	font-size: 0.72rem;
	opacity: 0.45;
	color: inherit;
	white-space: nowrap;
	flex-shrink: 0;
}

.post__thread-link:hover {
	opacity: 0.95;
}

.post__date {
	font-size: 0.82rem;
	color: #999;
}

.post__author-banned {
	font-size: 0.72rem;
	color: #e22;
}

.post__content {
	flex: 0 1 auto;
}

.post__text--clamped {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 32;
	line-clamp: 32;
	overflow: hidden;
}

.post__read-more {
	margin-top: 0.45rem;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	font-size: 0.82rem;
	font-weight: 700;
	cursor: pointer;
	opacity: 0.65;
}

.post__read-more:hover,
.post__read-more:focus-visible {
	opacity: 1;
	text-decoration: underline;
}

.post--nested {
	border: none;
	padding: 0.3rem 0;
	margin-bottom: 0;
	font-size: 1rem;
}

.post--pinned:not(.post--nested) {
	border-color: rgba(100, 220, 100, 0.7);
}

.post__pin-indicator {
	margin-left: auto;
	align-self: flex-start;
	font-size: 0.7rem;
	flex-shrink: 0;
	padding-left: 0.4rem;
	color: rgba(100, 220, 100, 0.85);
}

.post__replies {
	margin-top: 0.5rem;
	padding-top: 0.4rem;
	border-top: 1px solid rgba(128, 128, 128, 0.25);
}

.post__replies-controls {
	display: flex;
	align-items: center;
	gap: 0.6rem;
}

.post__replies-toggle {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 0.8rem;
	opacity: 0.65;
	padding: 0;
	color: inherit;
}

.post__replies-toggle:hover {
	opacity: 1;
}

.post__reply-btn {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 0.8rem;
	opacity: 0.65;
	padding: 0;
	color: inherit;
}

.post__reply-btn:hover {
	opacity: 1;
}

.post__pin-btn {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 0.8rem;
	opacity: 0.55;
	padding: 0;
	color: inherit;
}

.post__pin-btn:hover {
	opacity: 1;
}

.post__reply-list {
	margin-top: 0.4rem;
	padding-left: 1rem;
	border-left: 2px solid rgba(128, 128, 128, 0.2);
}

.reply-form {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	margin-top: 0.5rem;
}

.reply-form[hidden] {
	display: none;
}

.reply-form textarea {
	font: inherit;
	font-size: 0.9rem;
	padding: 0.3rem;
	resize: vertical;
	min-height: 3rem;
	border: 1px solid #ccc;
	box-sizing: border-box;
	width: 100%;
}

.reply-form button {
	align-self: flex-start;
	font-size: 0.8rem;
}

.reply-form__error {
	font-size: 0.8rem;
	color: #b00020;
}

.char-counter {
	font-size: 0.72rem;
	opacity: 0.45;
	text-align: right;
	align-self: flex-end;
}

.char-counter--near { opacity: 0.75; color: #e07000; }
.char-counter--full { opacity: 1; color: #b00020; }

/* Clickable author name */
.post__author {
	font-weight: bold;
	color: inherit;
	text-decoration: none;
}

.post__author:hover {
	text-decoration: underline;
}

/* Administrators have a soft, drifting red highlight wherever their name appears. */
.post__author--admin,
.profile-name--admin {
	color: #ff9a9a;
	text-shadow: 0 0 0.18em rgba(255, 138, 138, 0.55);
	animation: admin-username-glow 2.8s ease-in-out infinite alternate;
}

@keyframes admin-username-glow {
	from {
		color: #ffb0b0;
		text-shadow: -0.16em 0 0.25em rgba(255, 140, 140, 0.35);
	}
	to {
		color: #ff7777;
		text-shadow: 0.16em 0 0.5em rgba(255, 90, 90, 0.75);
	}
}

@media (prefers-reduced-motion: reduce) {
	.post__author--admin,
	.profile-name--admin {
		animation: none;
	}
}

/* Post ID chip, pushed to the right of the reply controls; click to copy */
.post__id {
	margin-left: auto;
	background: none;
	border: none;
	cursor: pointer;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.72rem;
	opacity: 0.45;
	padding: 0 0.1rem;
	color: inherit;
}

.post__id:hover {
	opacity: 0.95;
	text-decoration: underline;
}

/* Toast notification */
.toast {
	position: fixed;
	left: 50%;
	bottom: 2.5rem;
	transform: translate(-50%, 1rem);
	background: rgba(20, 20, 20, 0.92);
	color: #fff;
	padding: 0.5rem 0.9rem;
	border-radius: 6px;
	font-size: 0.85rem;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.18s ease, transform 0.18s ease;
	z-index: 100;
}

.toast--visible {
	opacity: 1;
	transform: translate(-50%, 0);
}

/* Settings page */
.settings-page {
	box-sizing: border-box;
	max-width: 480px;
	padding: 4rem 1rem 2.5rem;
}

.settings-heading {
	margin: 0 0 1.75rem;
	font-size: 1.4rem;
}

.settings-section {
	margin-bottom: 2rem;
}

.settings-section__heading {
	font-size: 1rem;
	border-bottom: 1px solid rgba(128, 128, 128, 0.3);
	padding-bottom: 0.3rem;
	margin: 0 0 0.75rem;
}

.settings-username {
	margin: 0 0 0.25rem;
	font-weight: bold;
	font-size: 1rem;
}

.settings-form {
	display: flex;
	flex-direction: column;
	gap: 0.65rem;
}

.settings-form label {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	font-size: 0.9rem;
}

.settings-form input[type="password"] {
	font: inherit;
	padding: 0.45rem 0.5rem;
	border: 1px solid #ccc;
	box-sizing: border-box;
}

.settings-form button[type="submit"] {
	align-self: flex-start;
	margin-top: 0.25rem;
}

.settings-status {
	font-size: 0.85rem;
	min-height: 1.2em;
}

.settings-status--error {
	color: #b00020;
}

.settings-status--ok {
	color: #4caf78;
}

/* Single-thread page */
.thread-page {
	box-sizing: border-box;
	padding: 3rem 1rem 2.5rem;
	max-width: 900px;
}

.thread-page__back {
	display: inline-block;
	margin-bottom: 1rem;
	font-size: 0.85rem;
	opacity: 0.75;
	color: inherit;
}

.thread-page__back:hover {
	opacity: 1;
}

/* User profile page */
.profile-page {
	box-sizing: border-box;
	display: flex;
	align-items: flex-start;
	gap: 2rem;
	padding: 3rem 1rem 2.5rem;
}

.profile-sidebar {
	position: sticky;
	top: 3rem;
	flex: 0 0 231px;
	border: 1px solid #ccc;
	padding: 1rem;
	box-sizing: border-box;
}

.profile-name {
	margin: 0 0 0.75rem;
	font-size: 1.4rem;
	overflow-wrap: anywhere;
}

.profile-stats {
	margin: 0;
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0.25rem 0.75rem;
	font-size: 0.9rem;
}

.profile-stats dt {
	opacity: 0.65;
}

.profile-stats dd {
	margin: 0;
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.profile-content {
	flex: 1 1 auto;
	min-width: 0;
}

.profile-section {
	margin-bottom: 2rem;
}

.profile-section__heading {
	font-size: 1rem;
	border-bottom: 1px solid rgba(128, 128, 128, 0.3);
	padding-bottom: 0.3rem;
	margin: 0 0 0.75rem;
}

.profile-empty {
	opacity: 0.6;
	font-size: 0.9rem;
}

.profile-ban-status {
	font-size: 0.85rem;
	color: #c00;
	min-height: 1.2em;
	margin: 0.5rem 0 0.25rem;
}

.profile-ban-form {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	margin-top: 0.5rem;
}

.profile-ban-reason {
	font: inherit;
	font-size: 0.85rem;
	padding: 0.25rem 0.4rem;
	border: 1px solid #ccc;
	box-sizing: border-box;
	width: 100%;
}

.profile-ban-controls {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.profile-ban-duration-num {
	font: inherit;
	font-size: 0.82rem;
	padding: 0.2rem 0.3rem;
	width: 4.5rem;
	border: 1px solid #ccc;
}

.profile-ban-duration-unit {
	font: inherit;
	font-size: 0.82rem;
	padding: 0.2rem 0.3rem;
	cursor: pointer;
}

.profile-ban-btn {
	padding: 0.3rem 0.75rem;
	font-size: 0.85rem;
	cursor: pointer;
	margin-top: 0.4rem;
}

.profile-ban-history {
	margin-top: 1rem;
}

.profile-ban-history__heading {
	font-size: 0.8rem;
	opacity: 0.6;
	margin: 0 0 0.3rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.profile-ban-history__list {
	font-size: 0.8rem;
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	opacity: 0.75;
}

.profile-comments {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.comment-card {
	border: 1px solid #ccc;
	padding: 0.5rem 0.6rem;
}

.comment-card__parent {
	border-left: 2px solid rgba(128, 128, 128, 0.4);
	padding: 0.2rem 0.5rem;
	margin-bottom: 0.5rem;
	font-size: 0.82rem;
	opacity: 0.65;
}

.comment-card__parent-meta {
	font-weight: bold;
	margin-bottom: 0.15rem;
}

.comment-card__parent-body {
	max-height: 3.6em;
	overflow: hidden;
	-webkit-mask-image: linear-gradient(to bottom, black 55%, transparent 100%);
	mask-image: linear-gradient(to bottom, black 55%, transparent 100%);
}

.comment-card__body {
	font-size: 0.9rem;
}

.comment-card__footer {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	margin-top: 0.4rem;
	font-size: 0.75rem;
	opacity: 0.7;
}

.comment-card__link {
	color: inherit;
}

/* ============================================================
   Invite code UI — settings page
   ============================================================ */
.settings-invite-status {
	font-size: 0.85rem;
	opacity: 0.75;
	margin: 0 0 0.5rem;
	min-height: 1.2em;
}

.invite-list {
	margin-top: 0.75rem;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
}

.invite-item {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.85rem;
}

.invite-item--empty {
	opacity: 0.5;
	font-size: 0.85rem;
}

.invite-code {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.82rem;
	letter-spacing: 0.04em;
	opacity: 0.9;
}

.invite-copy-btn {
	background: none;
	border: 1px solid currentColor;
	cursor: pointer;
	font: inherit;
	font-size: 0.72rem;
	padding: 0.05rem 0.35rem;
	opacity: 0.6;
	color: inherit;
}

.invite-copy-btn:hover { opacity: 1; }

.invite-meta {
	opacity: 0.6;
	font-size: 0.8rem;
}

.invite-badge {
	font-size: 0.68rem;
	padding: 0.05rem 0.3rem;
	border: 1px solid;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-left: auto;
}

.invite-badge--active  { color: #4caf78; border-color: #4caf78; }
.invite-badge--used    { opacity: 0.45; }
.invite-badge--expired { opacity: 0.35; }

/* ============================================================
   Invite history — mod profile sidebar
   ============================================================ */
.profile-invite-history {
	margin-top: 1.25rem;
}

.profile-invite-history__heading {
	font-size: 0.8rem;
	opacity: 0.6;
	margin: 0 0 0.3rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.profile-invite-history__empty {
	font-size: 0.8rem;
	opacity: 0.5;
	margin: 0;
}

.profile-invite-history__list {
	font-size: 0.8rem;
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
}

.profile-invite-item {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	opacity: 0.8;
}

.profile-invite-item--expired { opacity: 0.45; }

.profile-invite-revoke-btn {
	background: none;
	border: none;
	cursor: pointer;
	font: inherit;
	font-size: 0.75rem;
	color: #c00;
	padding: 0;
	opacity: 0.7;
}

.profile-invite-revoke-btn:hover { opacity: 1; text-decoration: underline; }

/* ============================================================
   Account standing — settings page
   ============================================================ */
.standing-status {
	font-size: 0.9rem;
	margin: 0 0 0.35rem;
	font-weight: 500;
}

.standing-status--active { color: #4caf78; }
.standing-status--banned { color: #b00020; }

.standing-reason {
	font-size: 0.85rem;
	opacity: 0.75;
	margin: 0 0 0.5rem;
}

.standing-history {
	margin-top: 0.5rem;
}

.standing-history__heading {
	font-size: 0.8rem;
	opacity: 0.6;
	margin: 0 0 0.3rem;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.standing-history__list {
	font-size: 0.8rem;
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	opacity: 0.75;
}

/* ============================================================
   Mod panel
   ============================================================ */
.mod-page,
.admin-page {
	box-sizing: border-box;
	padding: 4rem 1rem 2.5rem;
}

.admin-page {
	margin: 0 auto;
	max-width: 78rem;
}

.admin-password-reset__form {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.75rem;
	max-width: 48rem;
}

.admin-password-reset__form .mod-label {
	display: grid;
	gap: 0.3rem;
}

.admin-password-reset__actions {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	grid-column: 1 / -1;
}

.mod-section--personas {
	margin: 1rem auto 2.5rem;
	max-width: 60rem;
}

.mod-personas-header {
	display: grid;
	gap: 0.85rem;
	margin-bottom: 1rem;
}

.mod-personas-header .mod-section__heading {
	border-bottom: 0;
	margin-bottom: 0.25rem;
	padding-bottom: 0;
}

.mod-personas-header .settings-help {
	margin: 0;
}

.mod-persona-create {
	border: 1px solid rgba(128, 128, 128, 0.35);
	border-radius: 0.35rem;
	padding: 0.6rem 0.75rem;
}

.mod-persona-create summary {
	cursor: pointer;
	font-size: 0.85rem;
	font-weight: 700;
	letter-spacing: 0.03em;
}

.mod-persona-create[open] summary {
	margin-bottom: 0.85rem;
}

.mod-persona-form {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.75rem;
}

.mod-persona-form .mod-label,
.mod-persona-panel .mod-label {
	display: grid;
	gap: 0.3rem;
}

.mod-persona-form__wide,
.mod-persona-form__actions {
	grid-column: 1 / -1;
}

.mod-persona-form__actions {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.mod-persona-list {
	display: grid;
	gap: 1rem;
}

.mod-persona-card {
	border: 1px solid rgba(128, 128, 128, 0.4);
	border-radius: 0.45rem;
	background: rgba(128, 128, 128, 0.05);
	overflow: hidden;
}

.mod-persona-card--archived {
	opacity: 0.7;
}

.mod-persona-card__header {
	appearance: none;
	background: transparent;
	border: 0;
	color: inherit;
	cursor: pointer;
	display: flex;
	font: inherit;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.8rem 1rem;
	text-align: left;
	width: 100%;
}

.mod-persona-card__header:hover {
	background: rgba(128, 128, 128, 0.1);
}

.mod-persona-card__header:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: -2px;
}

.mod-persona-card__header[aria-expanded="true"] {
	border-bottom: 1px solid rgba(128, 128, 128, 0.3);
}

.mod-persona-card__identity {
	display: flex;
	align-items: baseline;
	gap: 0.65rem;
	min-width: 0;
}

.mod-persona-card__identity h3 {
	font-size: 1rem;
	margin: 0;
}

.mod-persona-card__slug {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.75rem;
	opacity: 0.55;
}

.mod-persona-state {
	border: 1px solid currentColor;
	border-radius: 999px;
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	padding: 0.15rem 0.45rem;
	text-transform: uppercase;
}

.mod-persona-state--enabled {
	color: #4caf78;
}

.mod-persona-state--disabled,
.mod-persona-state--archived {
	opacity: 0.6;
}

.mod-persona-card__toggle {
	font-size: 0.75rem;
	opacity: 0.65;
}

.mod-persona-card__grid {
	display: grid;
	grid-template-columns: minmax(15rem, 0.8fr) minmax(19rem, 1.2fr);
}

.mod-persona-panel {
	box-sizing: border-box;
	display: grid;
	align-content: start;
	gap: 0.7rem;
	padding: 1rem;
}

.mod-persona-card__grid .mod-persona-panel + .mod-persona-panel {
	border-left: 1px solid rgba(128, 128, 128, 0.25);
}

.mod-persona-panel__heading {
	font-size: 0.75rem;
	letter-spacing: 0.08em;
	margin: 0 0 0.1rem;
	opacity: 0.65;
	text-transform: uppercase;
}

.mod-persona-panel .mod-textarea {
	min-height: 5.5rem;
}

.mod-persona-panel--knowledge {
	border-top: 1px solid rgba(128, 128, 128, 0.25);
}

.mod-persona-panel--knowledge .settings-help {
	margin: 0;
	max-width: 48rem;
}

.mod-persona-source-editor {
	display: grid;
	grid-template-columns: minmax(14rem, 1fr) auto minmax(0, 1fr);
	align-items: end;
	gap: 0.65rem;
}

.mod-persona-sources {
	display: grid;
	gap: 0.45rem;
	margin-top: 0.15rem;
}

.mod-persona-source {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	border-top: 1px solid rgba(128, 128, 128, 0.2);
	padding-top: 0.5rem;
	font-size: 0.82rem;
}

.mod-persona-source__actions {
	display: flex;
	gap: 0.35rem;
	flex-shrink: 0;
}

.mod-persona-style-summary {
	font-variant-numeric: tabular-nums;
}

.mod-persona-style-guide {
	box-sizing: border-box;
	max-height: 18rem;
	overflow: auto;
	white-space: pre-wrap;
	word-break: break-word;
	border: 1px solid rgba(128, 128, 128, 0.25);
	padding: 0.75rem;
	font: inherit;
	font-size: 0.78rem;
}

.mod-persona-style-history {
	margin-bottom: 0;
}

.mod-persona-card > .mod-save-row {
	justify-content: flex-end;
	border-top: 1px solid rgba(128, 128, 128, 0.25);
	padding: 0.7rem 1rem;
}

.admin-memory-filters {
	display: flex;
	gap: 0.75rem;
	align-items: center;
	flex-wrap: wrap;
	margin-bottom: 1rem;
}

.admin-memory-filters select,
.admin-memory-filters input,
.admin-memory-row input {
	font: inherit;
	padding: 0.4rem 0.5rem;
}

.admin-memory-count,
.admin-memory-meta {
	font-size: 0.78rem;
	opacity: 0.7;
}

.admin-memory-groups {
	border: 1px solid rgba(128, 128, 128, 0.35);
	box-sizing: border-box;
	max-height: 21rem;
	overflow-y: auto;
	padding: 0 0.75rem;
}

.admin-memory-group {
	border-top: 1px solid rgba(128, 128, 128, 0.3);
	padding: 0.75rem 0;
}

.admin-memory-group:first-child {
	border-top: none;
}

.admin-memory-group h3 {
	font-size: 0.95rem;
	margin: 0 0 0.6rem;
}

.admin-memory-row {
	display: grid;
	grid-template-columns: minmax(15rem, 1fr) minmax(14rem, auto) auto auto auto;
	gap: 0.6rem;
	align-items: center;
	margin: 0.45rem 0;
}

.admin-memory-pager {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	justify-content: flex-end;
	margin-top: 0.75rem;
}

.admin-memory-page {
	font-size: 0.82rem;
	opacity: 0.75;
}

.mod-columns {
	display: flex;
	align-items: flex-start;
	gap: 2.5rem;
}

.mod-columns .mod-section {
	flex: 1 1 0;
	min-width: 0;
}

.mod-heading {
	font-size: 1.4rem;
	margin: 0 0 1.75rem;
}

.mod-section {
	margin-bottom: 2.5rem;
}

.mod-section__heading {
	font-size: 1rem;
	border-bottom: 1px solid rgba(128, 128, 128, 0.3);
	padding-bottom: 0.3rem;
	margin: 0 0 1rem;
}

.mod-subsection__heading {
	font-size: 0.85rem;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	opacity: 0.6;
	margin: 1rem 0 0.4rem;
}

.mod-field-group {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	margin-bottom: 1rem;
}

.mod-label {
	font-size: 0.85rem;
	opacity: 0.75;
}

.mod-input {
	font: inherit;
	padding: 0.4rem 0.5rem;
	border: 1px solid #ccc;
	box-sizing: border-box;
	width: 100%;
}

.mod-textarea {
	font: inherit;
	font-size: 0.85rem;
	padding: 0.4rem 0.5rem;
	border: 1px solid #ccc;
	box-sizing: border-box;
	width: 100%;
	min-height: 4.5rem;
	resize: vertical;
}

.mod-save-row {
	display: flex;
	align-items: center;
	gap: 0.75rem;
}

.mod-save-btn {
	font: inherit;
	font-size: 0.82rem;
	padding: 0.25rem 0.6rem;
	cursor: pointer;
}

.mod-status {
	font-size: 0.82rem;
	min-height: 1em;
}

.mod-status--ok  { color: #4caf78; }
.mod-status--err { color: #b00020; }

.mod-log-filters {
	display: flex;
	gap: 0.4rem;
	flex-wrap: wrap;
	margin-bottom: 0.6rem;
}

.mod-log-filter-btn {
	font: inherit;
	font-size: 0.78rem;
	padding: 0.1rem 0.5rem;
	cursor: pointer;
	border: 1px solid rgba(128, 128, 128, 0.35);
	background: none;
	color: inherit;
	opacity: 0.5;
	letter-spacing: 0.04em;
}

.mod-log-filter-btn:hover,
.mod-log-filter-btn--active {
	opacity: 1;
	border-color: rgba(255, 255, 255, 0.6);
}

.mod-log-scroll {
	max-height: 22rem;
	overflow-y: auto;
	border: 1px solid rgba(128, 128, 128, 0.2);
	padding: 0.4rem 0.6rem;
}

.mod-log-scroll[data-filter="ban"]  .mod-log-item:not([data-type="ban"])  { display: none; }
.mod-log-scroll[data-filter="join"] .mod-log-item:not([data-type="join"]) { display: none; }
.mod-log-scroll[data-filter="pin"]  .mod-log-item:not([data-type="pin"])  { display: none; }

.mod-log-list {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	font-size: 0.85rem;
}

.mod-log-item {
	display: flex;
	align-items: baseline;
	gap: 0.5em;
	opacity: 0.85;
	line-height: 1.5;
}

.mod-log-item--active-ban {
	color: #e22;
	opacity: 1;
}

.mod-log-time {
	flex: 0 0 8.5rem;
	font-size: 0.78rem;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	opacity: 0.45;
}

.mod-log-tag {
	flex: 0 0 2.6rem;
	text-align: center;
	font-size: 0.68rem;
	padding: 0.05em 0.35em;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	border: 1px solid;
	border-radius: 2px;
	opacity: 0.8;
}

.mod-log-body {
	flex: 1 1 auto;
	min-width: 0;
	word-break: break-word;
}

.mod-log-tag--ban  { color: #e22; }
.mod-log-tag--join { color: #4caf78; }
.mod-log-tag--pin  { color: cyan; }
.mod-log-tag--run  { color: cyan; }
.mod-log-tag--candidate { color: #f0b429; }

.mod-log-link {
	color: inherit;
	font-weight: bold;
}

.mod-log-link:hover {
	text-decoration: underline;
}

.mod-empty {
	font-size: 0.85rem;
	opacity: 0.5;
	margin: 0;
}

.mod-forbidden,
.mod-error {
	font-size: 0.9rem;
	opacity: 0.75;
}

.header-button--mod {
	color: cyan;
}

.header-button--admin {
	color: red;
}

/* ============================================================
   RESPONSIVE — mobile (≤ 640 px)
   ============================================================ */
@media (max-width: 640px) {
	.admin-password-reset__form {
		grid-template-columns: 1fr;
	}

	/* ---- Header ------------------------------------------ */
	header {
		flex-wrap: wrap;
		padding: 4px 0;
		/* items wrap naturally; the spacer is hidden below */
	}

	/* Hide decorative animated MOTD — it overlaps wrapped items */
	header .motd {
		display: none;
	}

	/* Spacer only makes sense in a single-row layout */
	.header-spacer {
		display: none;
	}

	header a,
	.header-button {
		margin-left: 0.55rem;
		font-size: 0.78rem;
	}

	.header-status {
		margin-left: 0.55rem;
		font-size: 0.78rem;
	}

	/* ---- Main posts list ---------------------------------- */
	/* Extra top padding so a potentially two-row header is cleared */
	#posts {
		padding-top: 5.5rem;
		padding-left: 0.5rem;
		padding-right: 0.5rem;
	}

	/* Posts: fill most of the screen width */
	.post {
		max-width: calc(100vw - 1rem);
		box-sizing: border-box;
	}

	/* Stack meta (author/date) above content instead of side-by-side.
	   Fixes long usernames overflowing the fixed-width column and
	   running into the title text. */
	.post__body {
		flex-direction: column;
	}

	.post__meta {
		flex: none;
		width: 100%;
		min-width: unset;
		flex-direction: row;     /* username · date · banned badge in one row */
		align-items: center;
		flex-wrap: wrap;
		gap: 0.35rem 0.5rem;
		margin-bottom: 0.2rem;
	}

	/* ---- Profile page ------------------------------------- */
	.profile-page {
		flex-direction: column;   /* stack sidebar above content */
		padding-top: 5.5rem;
		padding-left: 0.5rem;
		padding-right: 0.5rem;
		gap: 1rem;
	}

	.profile-sidebar {
		position: static;
		flex: 1 1 auto;
		width: 100%;
		box-sizing: border-box;
	}

	/* ---- Thread page -------------------------------------- */
	.thread-page {
		padding-top: 5.5rem;
		padding-left: 0.5rem;
		padding-right: 0.5rem;
	}

	/* ---- Settings page ------------------------------------ */
	.settings-page {
		padding-top: 5.5rem;
		padding-left: 0.75rem;
		padding-right: 0.75rem;
		max-width: 100%;
	}

	/* ---- New-post form ------------------------------------ */
	.post-page {
		align-items: start;       /* don't vertically center — start below header */
		padding-top: 5.5rem;
		padding-left: 1rem;
		padding-right: 1rem;
		box-sizing: border-box;
	}

	/* ---- Login / register --------------------------------- */
	/* These pages are always accessed logged-out (1-row header),
	   so the existing padding: 4rem 1rem is sufficient. Just
	   ensure they handle very narrow widths cleanly. */
	.login-page {
		padding-left: 1rem;
		padding-right: 1rem;
		box-sizing: border-box;
	}

	/* ---- Mod panel --------------------------------------- */
	.mod-page,
	.admin-page {
		padding-top: 5.5rem;
		padding-left: 0.75rem;
		padding-right: 0.75rem;
		max-width: 100%;
	}

	.mod-columns {
		flex-direction: column;
	}

	.admin-memory-row {
		grid-template-columns: 1fr auto auto;
	}

	.admin-memory-row input,
	.admin-memory-row .admin-memory-meta {
		grid-column: 1 / -1;
	}

	.mod-persona-form,
	.mod-persona-card__grid,
	.mod-persona-source-editor {
		grid-template-columns: 1fr;
	}

	.mod-persona-form__wide,
	.mod-persona-form__actions {
		grid-column: auto;
	}

	.mod-persona-card__grid .mod-persona-panel + .mod-persona-panel {
		border-top: 1px solid rgba(128, 128, 128, 0.25);
		border-left: 0;
	}

	.mod-persona-source-editor {
		align-items: stretch;
	}

	.mod-persona-source-editor button {
		justify-self: start;
	}

	.mod-persona-source {
		align-items: flex-start;
		flex-direction: column;
	}

	.mod-persona-source__actions {
		flex-wrap: wrap;
	}
}
.admin-worker__summary {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	flex-wrap: wrap;
}

.admin-worker__status {
	border: 1px solid currentColor;
	border-radius: 999px;
	padding: 0.15rem 0.55rem;
	font-weight: 700;
	text-transform: uppercase;
}

.admin-worker__status--online { color: #237a3b; }
.admin-worker__status--offline,
.admin-worker__status--error { color: #a12622; }
.admin-worker__status--stopping,
.admin-worker__status--stopped { color: #8a5b00; }

.admin-worker__metrics {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
	gap: 0.25rem 1rem;
	margin: 1rem 0;
}

.admin-worker__metrics dt { opacity: 0.72; }
.admin-worker__metrics dd { margin: 0; font-weight: 700; }
.admin-worker__controls { margin: 0.75rem 0; }
.admin-worker__events { max-height: 24rem; overflow: auto; }
.admin-worker-event--error { border-left: 3px solid #a12622; }
.admin-worker-event--warn { border-left: 3px solid #8a5b00; }
