:root {
	--bg: #1e1f22;
	--surface: #2b2d31;
	--surface-elevated: #313338;
	--header: #1e1f22;
	--text: #dbdee1;
	--muted: #949ba4;
	--accent: #5865f2;
	--link: #00a8fc;
	--border: #3f4147;
	--hover: #35373c;
	--radius: 0.5rem;
	--max-width: 52rem;
	--avatar-size: 2.5rem;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
	background: var(--bg);
	color: var(--text);
	line-height: 1.375;
	font-size: 1rem;
}

a {
	color: var(--link);
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

a:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.site-header {
	background: var(--header);
	border-bottom: 1px solid var(--border);
	padding: 1rem 1.5rem;
}

.site-header h1 {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
}

.site-header p {
	margin: 0.25rem 0 0;
	color: var(--muted);
	font-size: 0.8125rem;
}

.privacy-notice {
	margin: 0 0 1.25rem;
	padding: 0.75rem 1rem;
	font-size: 0.8125rem;
	line-height: 1.5;
	color: var(--muted);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

.search-bar {
	margin-bottom: 1.25rem;
}

.search-bar__label {
	display: block;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--muted);
	margin-bottom: 0.375rem;
}

.search-bar__input {
	width: 100%;
	padding: 0.625rem 0.75rem;
	font-size: 1rem;
	font-family: inherit;
	color: var(--text);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

.search-bar__input:focus {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
	border-color: var(--accent);
}

.search-bar__status {
	margin: 0.375rem 0 0;
	font-size: 0.8125rem;
	color: var(--muted);
}

main {
	max-width: var(--max-width);
	margin: 0 auto;
	padding: 1rem 1rem 2rem;
}

body[data-page='topic'] main {
	max-width: none;
	padding: 0;
}

.topic-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

.topic-card {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1rem 1.125rem;
	transition: background 0.15s ease;
}

.topic-card:hover {
	background: var(--hover);
}

.topic-card h2 {
	margin: 0 0 0.375rem;
	font-size: 1rem;
	font-weight: 600;
}

.topic-card h2 a {
	color: inherit;
	text-decoration: none;
}

.topic-card h2 a:hover {
	color: var(--link);
	text-decoration: none;
}

.topic-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.375rem 0.75rem;
	font-size: 0.75rem;
	color: var(--muted);
	margin-bottom: 0.5rem;
}

.tag {
	background: #404249;
	color: var(--text);
	padding: 0.125rem 0.5rem;
	border-radius: 0.25rem;
	font-size: 0.6875rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.badge {
	display: inline-flex;
	align-items: center;
	padding: 0.125rem 0.5rem;
	border-radius: 0.25rem;
	font-size: 0.6875rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

.badge--muted {
	background: #404249;
	color: var(--muted);
}

.topic-excerpt {
	margin: 0;
	color: var(--muted);
	font-size: 0.875rem;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.thread-view {
	min-height: 100%;
}

.thread-toolbar {
	padding: 0.75rem 1rem;
	background: var(--header);
	border-bottom: 1px solid var(--border);
}

.back-link {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	font-size: 0.875rem;
	color: var(--muted);
}

.back-link:hover {
	color: var(--text);
	text-decoration: none;
}

.thread-header {
	display: flex;
	gap: 0.75rem;
	padding: 1rem 1.25rem;
	background: var(--surface-elevated);
	border-bottom: 1px solid var(--border);
}

.thread-header__icon {
	flex-shrink: 0;
	width: 2.25rem;
	height: 2.25rem;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--accent);
	color: #fff;
	border-radius: 50%;
	font-size: 1.125rem;
	font-weight: 700;
}

.thread-header__content {
	min-width: 0;
}

.thread-header h1 {
	margin: 0 0 0.375rem;
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.3;
}

.thread-header__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.375rem 0.75rem;
}

.thread-header__stat {
	font-size: 0.75rem;
	color: var(--muted);
}

.thread-panel {
	background: var(--surface);
}

.thread-panel--starter {
	padding: 1rem 0 0.5rem;
}

.thread-panel--replies {
	padding: 0.25rem 0 1.5rem;
}

.thread-divider {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.5rem 1.25rem;
	background: var(--surface-elevated);
	border-top: 1px solid var(--border);
	border-bottom: 1px solid var(--border);
	color: var(--muted);
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.thread-divider::before,
.thread-divider::after {
	content: '';
	flex: 1;
	height: 1px;
	background: var(--border);
}

.thread-empty {
	margin: 0;
	padding: 1.5rem 1.25rem;
	color: var(--muted);
	font-size: 0.875rem;
	text-align: center;
}

.discord-message {
	display: grid;
	grid-template-columns: var(--avatar-size) 1fr;
	gap: 0 1rem;
	padding: 0.125rem 1rem;
	margin: 0;
}

.discord-message--starter {
	padding-top: 0.5rem;
	padding-bottom: 0.75rem;
}

.discord-message--reply {
	padding-top: 0.375rem;
	padding-bottom: 0.375rem;
}

.discord-message--reply:hover,
.discord-message--starter:hover {
	background: var(--hover);
}

.avatar {
	width: var(--avatar-size);
	height: var(--avatar-size);
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 0.875rem;
	font-weight: 600;
	color: #fff;
	background: hsl(var(--avatar-hue) 45% 45%);
	flex-shrink: 0;
	margin-top: 0.125rem;
}

.avatar--generic {
	background: var(--border);
	color: var(--muted);
}

.avatar__icon {
	width: 1.125rem;
	height: 1.125rem;
}

.discord-message__main {
	min-width: 0;
}

.discord-message__header {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.375rem 0.5rem;
	margin-bottom: 0.25rem;
	line-height: 1.375;
}

.discord-message__author {
	font-weight: 600;
	font-size: 1rem;
	color: var(--text);
}

.discord-message__timestamp {
	font-size: 0.75rem;
	color: var(--muted);
}

.discord-message__timestamp--inline {
	display: block;
	margin-bottom: 0.125rem;
	font-size: 0.625rem;
	opacity: 0;
	transition: opacity 0.15s ease;
}

.discord-message:hover .discord-message__timestamp--inline,
.discord-message__continuation:hover .discord-message__timestamp--inline {
	opacity: 1;
}

.discord-message__badge {
	font-size: 0.625rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--accent);
	background: rgb(88 101 242 / 15%);
	padding: 0.125rem 0.375rem;
	border-radius: 0.25rem;
}

.discord-message__continuation {
	margin-top: 0.5rem;
	padding-top: 0.125rem;
}

.message-content__text {
	font-size: 1rem;
	word-wrap: break-word;
}

.message-content__text p {
	margin: 0 0 0.5rem;
}

.message-content__text p:last-child {
	margin-bottom: 0;
}

.message-content__text a {
	color: var(--link);
}

.message-content__text code {
	font-family: Consolas, 'Courier New', monospace;
	font-size: 0.875em;
	background: var(--bg);
	padding: 0.125rem 0.25rem;
	border-radius: 0.25rem;
}

.message-content__text pre {
	overflow-x: auto;
	padding: 0.75rem;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 0.25rem;
	margin: 0.5rem 0;
}

.message-content__text pre code {
	background: none;
	padding: 0;
}

.message-content__text blockquote {
	margin: 0.5rem 0;
	padding: 0 0 0 0.75rem;
	border-left: 4px solid var(--border);
	color: var(--muted);
}

.message-content__text img {
	max-width: min(100%, 26rem);
	height: auto;
	border-radius: 0.25rem;
	margin-top: 0.25rem;
}

.message-content__text ul,
.message-content__text ol {
	margin: 0.25rem 0;
	padding-left: 1.25rem;
}

.message-attachments {
	list-style: none;
	margin: 0.5rem 0 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.375rem;
}

.attachment-chip {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.375rem 0.5rem;
	padding: 0.5rem 0.75rem;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: 0.25rem;
	max-width: 26rem;
	font-size: 0.875rem;
}

.attachment-chip__icon {
	flex-shrink: 0;
}

.attachment-chip__name {
	font-weight: 600;
	color: var(--link);
}

.attachment-chip__note {
	color: var(--muted);
	font-size: 0.75rem;
}

.status-message {
	color: var(--muted);
	text-align: center;
	padding: 2rem;
}

.status-message.error {
	color: #f23f43;
}

@media (min-width: 48rem) {
	.thread-view {
		max-width: 56rem;
		margin: 0 auto;
		border-left: 1px solid var(--border);
		border-right: 1px solid var(--border);
	}

	.thread-toolbar,
	.thread-header,
	.thread-panel,
	.thread-divider {
		padding-left: 1.5rem;
		padding-right: 1.5rem;
	}

	.discord-message {
		padding-left: 1.5rem;
		padding-right: 1.5rem;
	}
}
