:root {
	--bg: #1a1a2e;
	--surface: #16213e;
	--border: #0f3460;
	--text: #e0e0e0;
	--text-muted: #8a8a9a;
	--accent: #e94560;
	--link: #53a8b6;
}

* {
	margin: 0;
	padding: 0;
	box-sizing: border-box;
}

body {
	font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
	background: var(--bg);
	color: var(--text);
	line-height: 1.6;
	max-width: 900px;
	margin: 0 auto;
	padding: 0 1rem;
}

a {
	color: var(--link);
	text-decoration: none;
}
a:hover {
	text-decoration: underline;
}

.site-nav {
	padding: 1rem 0;
	border-bottom: 1px solid var(--border);
	margin-bottom: 1.5rem;
}
.site-nav a {
	font-weight: 700;
	font-size: 1.2rem;
	color: var(--accent);
}

main {
	min-height: 80vh;
}

h1 {
	margin-bottom: 0.5rem;
}

.channel-meta {
	color: var(--text-muted);
	margin-bottom: 1rem;
}

.channel-list {
	list-style: none;
}
.channel-list li {
	padding: 0.75rem 0;
	border-bottom: 1px solid var(--border);
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.channel-list a {
	font-size: 1.1rem;
	font-weight: 600;
}
.msg-count {
	color: var(--text-muted);
	font-size: 0.85rem;
}

.messages {
	display: flex;
	flex-direction: column;
	gap: 0;
}

.message-group {
	padding: 0.4rem 0.75rem 0.2rem;
	border-radius: 4px;
}
.message-group:hover {
	background: var(--surface);
}

.message:target {
	background: rgba(83, 168, 182, 0.12);
	border-left: 3px solid var(--link);
	padding-left: calc(1.75rem - 3px);
	border-radius: 2px;
}

.group-header {
	display: flex;
	align-items: baseline;
	gap: 0.4rem;
	margin-bottom: 0.15rem;
}

.message {
	padding: 0.05rem 0 0.05rem 1.75rem;
}

.cont-time {
	color: var(--text-muted);
	font-size: 0.65rem;
	display: block;
	margin-top: 0.2rem;
}

.reply-bar {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.15rem 0.5rem 0.15rem 1.5rem;
	font-size: 0.8rem;
	color: var(--text-muted);
	text-decoration: none;
	border-left: 2px solid var(--border);
	margin-bottom: 0.1rem;
	overflow: hidden;
	white-space: nowrap;
}
.reply-bar:hover {
	color: var(--text);
}
.reply-avatar {
	border-radius: 50%;
	flex-shrink: 0;
}
.reply-author {
	font-weight: 600;
	flex-shrink: 0;
}
.reply-snippet {
	overflow: hidden;
	text-overflow: ellipsis;
}

.avatar {
	width: 20px;
	height: 20px;
	border-radius: 50%;
	vertical-align: middle;
	flex-shrink: 0;
	align-self: center;
}
.author {
	color: var(--accent);
	font-size: 0.95rem;
}
.bot-tag {
	background: var(--link);
	color: var(--bg);
	font-size: 0.6rem;
	font-weight: 700;
	padding: 0.05em 0.35em;
	border-radius: 3px;
	vertical-align: middle;
	margin-left: 0.25rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}
time {
	color: var(--text-muted);
	font-size: 0.75rem;
}

.message-body {
	word-break: break-word;
}
.message-body p {
	margin-bottom: 0.3rem;
}
.message-body ul,
.message-body ol {
	padding-left: 1.5rem;
	margin: 0.3rem 0;
}
.message-body li {
	margin-bottom: 0.15rem;
}
.message-body code {
	background: var(--surface);
	padding: 0.1em 0.3em;
	border-radius: 3px;
	font-size: 0.9em;
}
.message-body img[alt] {
	height: 1.4em;
	width: auto;
	vertical-align: middle;
	display: inline;
}
.message-body pre {
	background: var(--surface);
	padding: 0.75rem;
	border-radius: 4px;
	overflow-x: auto;
	margin: 0.4rem 0;
}
.message-body pre code {
	background: none;
	padding: 0;
}
.message-body blockquote {
	border-left: 3px solid var(--border);
	padding-left: 0.75rem;
	color: var(--text-muted);
	margin: 0.3rem 0;
}

.attachments {
	margin-top: 0.25rem;
}
.attachment {
	display: inline-block;
	background: var(--surface);
	padding: 0.2rem 0.5rem;
	border-radius: 3px;
	font-size: 0.85rem;
	margin-right: 0.5rem;
}

.embeds {
	margin-top: 0.25rem;
}
.embed {
	border-left: 3px solid var(--accent);
	padding: 0.4rem 0.75rem;
	background: var(--surface);
	border-radius: 0 4px 4px 0;
	margin-bottom: 0.3rem;
}
.embed-title {
	font-weight: 600;
	font-size: 0.9rem;
}
.embed-desc {
	font-size: 0.85rem;
	color: var(--text-muted);
}

.pagination {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 1rem 0;
	justify-content: center;
}
.pagination span {
	color: var(--text-muted);
}

/* JS-enhanced: hide pagination when infinite scroll is active */
.pagination[data-js-hidden] { display: none; }

.scroll-loading {
	text-align: center;
	padding: 1rem;
	color: var(--text-muted);
	font-size: 0.85rem;
}

.thread-list {
	display: flex;
	flex-direction: column;
	gap: 0;
}
.thread-card {
	display: block;
	padding: 0.75rem;
	border-bottom: 1px solid var(--border);
	text-decoration: none;
	color: var(--text);
}
.thread-card:hover {
	background: var(--surface);
	text-decoration: none;
}
.thread-header {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 0.5rem;
}
.thread-title {
	color: var(--link);
	font-size: 1rem;
}
.thread-meta {
	color: var(--text-muted);
	font-size: 0.8rem;
	flex-shrink: 0;
}
.thread-preview {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	margin-top: 0.3rem;
	font-size: 0.85rem;
	color: var(--text-muted);
	overflow: hidden;
	white-space: nowrap;
}
.thread-author {
	font-weight: 600;
	flex-shrink: 0;
}
.thread-snippet {
	overflow: hidden;
	text-overflow: ellipsis;
}
.thread-date {
	margin-top: 0.25rem;
	display: flex;
	align-items: center;
	gap: 0.5rem;
}
.thread-date time {
	font-size: 0.75rem;
}
.thread-tag {
	background: var(--surface);
	color: var(--text-muted);
	font-size: 0.7rem;
	padding: 0.1em 0.4em;
	border-radius: 3px;
}

footer {
	border-top: 1px solid var(--border);
	padding: 1rem 0;
	margin-top: 2rem;
	color: var(--text-muted);
	font-size: 0.8rem;
	text-align: center;
}
