/* ── IBM Plex Sans (locally hosted) ────────────────────────────── */
@font-face {
	font-family: 'IBM Plex Sans';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('/fonts/IBMPlexSans-Regular.woff') format('woff');
}
@font-face {
	font-family: 'IBM Plex Sans';
	font-style: italic;
	font-weight: 400;
	font-display: swap;
	src: url('/fonts/IBMPlexSans-Italic.woff') format('woff');
}
@font-face {
	font-family: 'IBM Plex Sans';
	font-style: normal;
	font-weight: 500;
	font-display: swap;
	src: url('/fonts/IBMPlexSans-Medium.woff') format('woff');
}
@font-face {
	font-family: 'IBM Plex Sans';
	font-style: normal;
	font-weight: 600;
	font-display: swap;
	src: url('/fonts/IBMPlexSans-SemiBold.woff') format('woff');
}
@font-face {
	font-family: 'IBM Plex Sans';
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url('/fonts/IBMPlexSans-Bold.woff') format('woff');
}

/* ── IBM Plex Mono (locally hosted) ────────────────────────────── */
@font-face {
	font-family: 'IBM Plex Mono';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('/fonts/IBMPlexMono-Regular.otf') format('opentype');
}
@font-face {
	font-family: 'IBM Plex Mono';
	font-style: italic;
	font-weight: 400;
	font-display: swap;
	src: url('/fonts/IBMPlexMono-Italic.otf') format('opentype');
}
@font-face {
	font-family: 'IBM Plex Mono';
	font-style: normal;
	font-weight: 700;
	font-display: swap;
	src: url('/fonts/IBMPlexMono-Bold.otf') format('opentype');
}

/* ── Reset ─────────────────────────────────────────────────────── */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

/* ── Design Tokens ─────────────────────────────────────────────── */
:root {
	--bg: #f5f7fa;
	--bg-alt: #eaeff5;
	--bg-hover: #dfe5ed;
	--bg-subtle: #f0f3f8;
	--fg: #1e2a3a;
	--fg-muted: #5a6a7e;
	--fg-faint: #8e9bae;
	--primary: #1a4a96;
	--primary-hover: #153d7d;
	--accent: #b07d3a;
	--link: #1a4a96;
	--link-visited: #556899;
	--border: #c4ccd8;
	--border-light: #dce1ec;
	--danger: #b91c1c;
	--success: #15803d;
	--tag-bg: #dde4f0;
	--tag-fg: #2d3a4d;
	--input-bg: #fff;
	--flash-bg: #fef3c7;
	--flash-border: #f59e0b;
	--flash-fg: #92400e;
	--error-bg: #fef2f2;
	--error-border: #fecaca;
	--mark-bg: #fef3c7;
	--header-accent-border: #0e2648;
	--radius: 3px;
	--font: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
	--mono: 'IBM Plex Mono', 'SF Mono', SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
	--max-w: 52rem;
}

/* Non-default themes live in public/themes/<id>.css and are loaded by layout. */

/* ── Base ──────────────────────────────────────────────────────── */
html { overflow-x: hidden; }
body {
	font-family: var(--font);
	font-size: 14px;
	line-height: 1.5;
	color: var(--fg);
	background: var(--bg);
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	overflow-x: hidden;
	overflow-wrap: break-word;
}
a { color: var(--link); text-decoration: none; }
a:visited { color: var(--link-visited); }
a:hover { text-decoration: underline; }

.container {
	max-width: var(--max-w);
	margin: 0 auto;
	padding: 0 1rem;
	width: 100%;
}

/* ── Header ────────────────────────────────────────────────────── */
.site-header {
	background: var(--header-bg, var(--primary));
	color: #fff;
	padding: 0.5rem 0;
	border-bottom: 3px solid var(--header-accent-border);
}
.header-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 0.5rem;
}
.header-left {
	display: flex;
	align-items: baseline;
	gap: 0.6rem;
}
.site-logo {
	color: #fff !important;
	font-weight: 700;
	font-size: 1.1rem;
	letter-spacing: -0.02em;
}
.site-logo:hover { text-decoration: none; opacity: 0.9; }
.site-tagline {
	color: rgba(255,255,255,0.6);
	font-size: 0.8rem;
	font-style: italic;
}
.header-links {
	display: flex;
	align-items: center;
	gap: 0.35rem;
	flex-wrap: wrap;
}
.header-links a,
.header-links .link-btn {
	color: rgba(255,255,255,0.92);
	font-size: 0.85rem;
	font-weight: 500;
	padding: 0.2rem 0.55rem;
	border-radius: 6px;
	/* Pills follow link color so they work on default (dark) and custom (light) headers */
	background: color-mix(in srgb, currentColor 14%, transparent);
	border: 1px solid color-mix(in srgb, currentColor 32%, transparent);
	text-decoration: none !important;
	line-height: 1.2;
}
.header-links a:visited { color: rgba(255,255,255,0.92); }
.header-links a:hover,
.header-links .link-btn:hover {
	color: #fff;
	background: color-mix(in srgb, currentColor 26%, transparent);
	border-color: color-mix(in srgb, currentColor 48%, transparent);
	text-decoration: none !important;
}
.header-links a:focus-visible,
.header-links .link-btn:focus-visible {
	outline: 2px solid color-mix(in srgb, currentColor 65%, transparent);
	outline-offset: 2px;
}
.clout {
	color: rgba(255,255,255,0.5);
	font-size: 0.8rem;
}
/* Clout shown inline next to usernames (feed, thread, comments) */
.story-meta .clout,
.comment-header .clout {
	color: var(--fg-muted);
	font-size: 0.75rem;
	font-weight: 500;
}
.story-meta .clout:hover,
.comment-header .clout:hover { color: var(--fg-muted); }

/* ── Footer ────────────────────────────────────────────────────── */
.site-footer {
	margin-top: auto;
	padding: 1.5rem 0;
	border-top: 1px solid var(--border);
	font-size: 0.8rem;
	color: var(--fg-muted);
}
.footer-inner {
	display: flex;
	gap: 1rem;
	flex-wrap: wrap;
	align-items: center;
}
.footer-copy {
	margin-left: auto;
	font-style: italic;
	color: var(--fg-faint);
}

/* ── Flash Messages ────────────────────────────────────────────── */
.flash-message {
	background: var(--flash-bg);
	border: 1px solid var(--flash-border);
	border-radius: var(--radius);
	padding: 0.5rem 1rem;
	margin-top: 0.75rem;
	font-size: 0.9rem;
	color: var(--flash-fg);
}

/* ── Main ──────────────────────────────────────────────────────── */
main.container { padding: 1.25rem 1rem 2rem; flex: 1; }

/* ── Story List ────────────────────────────────────────────────── */
.story-list {
	list-style: none;
}
.story-item {
	display: flex;
	gap: 0.45rem;
	padding: 0.2rem 0;
	border-bottom: 1px solid var(--border-light);
}
.story-item:last-child { border-bottom: none; }

.story-rank {
	color: var(--fg-faint);
	font-size: 0.85rem;
	min-width: 1.8rem;
	text-align: right;
	padding-top: 0.1rem;
	flex-shrink: 0;
}
.story-vote {
	display: flex;
	flex-direction: column;
	align-items: center;
	flex-shrink: 0;
	padding-top: 0.1rem;
}
.vote-btn {
	background: none;
	border: none;
	cursor: pointer;
	color: var(--fg-faint);
	font-size: 0.7rem;
	padding: 0;
	line-height: 1;
}
.vote-btn:hover { color: var(--primary); }
.vote-btn.voted { color: var(--primary); font-weight: bold; }
.vote-btn-lg { font-size: 1rem; }

.story-content { flex: 1; min-width: 0; }
.story-title {
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.3;
}
.story-title a { color: var(--fg); }
.story-title a:visited { color: var(--fg-muted); }
.story-title a:hover { color: var(--primary); }
.story-domain {
	font-size: 0.75rem;
	color: var(--fg-faint);
	font-weight: 400;
	margin-left: 0.3rem;
}
/* Discuss link: visible call-to-action to join the thread (replaces tiny "replies" link) */
.story-discuss {
	font-weight: 600;
	color: var(--primary) !important;
	display: inline-flex;
	align-items: center;
	line-height: 1.25;
	background: color-mix(in srgb, var(--primary) 13%, transparent);
	padding: 0.12em 0.45em;
	border-radius: 4px;
	text-decoration: none !important;
	box-decoration-break: clone;
	-webkit-box-decoration-break: clone;
}
.story-discuss:visited { color: var(--primary) !important; }
.story-discuss:hover {
	color: var(--primary-hover) !important;
	text-decoration: underline !important;
	background: color-mix(in srgb, var(--primary) 20%, transparent);
}
.story-discuss:focus-visible {
	outline: 2px solid var(--primary);
	outline-offset: 2px;
}
.story-meta {
	font-size: 0.75rem;
	/* Slightly darker than fg-muted for small-text contrast without shouting */
	color: color-mix(in srgb, var(--fg) 38%, var(--fg-muted) 62%);
	margin-top: 0.2rem;
	line-height: 1.45;
	display: flex;
	flex-wrap: wrap;
	gap: 0.2rem 0.45rem;
	align-items: center;
}
/* Feed rows: primary meta line + optional tag row (avoids wrapping discuss / author / tags into many lines) */
.story-item .story-meta {
	flex-direction: column;
	align-items: stretch;
	flex-wrap: nowrap;
	gap: 0.18rem;
	margin-top: 0.12rem;
	line-height: 1.35;
}
.story-item .story-meta > * + *::before {
	content: none;
}
.story-meta-main {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.1rem 0.3rem;
	min-width: 0;
}
/* Mid-dot separators between chunks on one meta line */
.story-meta-main > * + *::before {
	content: '\00b7';
	color: var(--fg-faint);
	font-weight: 400;
	margin-right: 0.25rem;
	opacity: 0.85;
}
.story-meta-tags {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.25rem 0.35rem;
	padding-top: 0;
}
.story-meta time {
	font-variant-numeric: tabular-nums;
}
/* Mid-dot separators between flat meta rows (thread, search, profile — not feed items) */
.story-meta > * + *::before {
	content: '\00b7';
	color: var(--fg-faint);
	font-weight: 400;
	margin-right: 0.45rem;
	opacity: 0.85;
}
.story-meta a { color: color-mix(in srgb, var(--fg) 28%, var(--fg-muted) 72%); }
.story-meta a:hover { color: var(--primary); }
.story-meta .story-discuss { color: var(--primary) !important; }

.permalink-link {
	display: inline-flex;
	align-items: center;
	gap: 0.15rem;
	color: var(--fg-faint);
	font-size: inherit;
	text-decoration: none;
}
.permalink-link:hover { color: var(--fg-muted); text-decoration: none; }
.permalink-link:focus-visible {
	outline: 2px solid var(--primary);
	outline-offset: 2px;
	border-radius: 2px;
}
.permalink-icon { flex-shrink: 0; opacity: 0.75; }
.permalink-text { text-decoration: underline; text-underline-offset: 2px; }
.story-meta .permalink-link {
	color: color-mix(in srgb, var(--fg-muted) 55%, var(--fg-faint) 45%);
	background: color-mix(in srgb, var(--fg) 5.5%, transparent);
	padding: 0.15em 0.4em;
	border-radius: 4px;
	min-height: 1.75em;
	box-sizing: border-box;
}
.story-meta .permalink-link:hover {
	color: var(--fg-muted);
	background: color-mix(in srgb, var(--fg) 9%, transparent);
}
.comment-actions .permalink-link { margin-left: 0.15rem; }

/* ── Tags ──────────────────────────────────────────────────────── */
.tag {
	display: inline-block;
	background: var(--tag-bg);
	color: var(--tag-fg) !important;
	padding: 0.1rem 0.4rem;
	border-radius: var(--radius);
	font-size: 0.7rem;
	font-weight: 500;
	text-decoration: none !important;
}
/* Feed row: clearer edge and tap target without growing line height much */
.story-meta .tag {
	padding: 0.16rem 0.42rem;
	border: 1px solid color-mix(in srgb, var(--tag-fg) 18%, transparent);
}
.tag:visited { color: var(--tag-fg) !important; }
.tag:hover { background: var(--tag-hover, var(--bg-hover)); }

/* ── Comments ──────────────────────────────────────────────────── */
.comment-thread { margin-top: 0.75rem; }
.comment {
	border-left: 2px solid var(--border);
	padding: 0.35rem 0 0.35rem 0.65rem;
	margin-top: 0.35rem;
}
.comment-header {
	font-size: 0.75rem;
	color: var(--fg-muted);
	display: flex;
	gap: 0.35rem;
	align-items: center;
	flex-wrap: wrap;
}
.comment-author {
	font-weight: 600;
	color: var(--fg) !important;
}
.comment-body {
	margin-top: 0.2rem;
	font-size: 0.9rem;
	line-height: 1.55;
}
.comment-body p { margin-bottom: 0.35rem; }
.comment-body p:last-child { margin-bottom: 0; }
.comment-body pre {
	background: var(--bg-alt);
	padding: 0.5rem;
	border-radius: var(--radius);
	overflow-x: auto;
	font-size: 0.8rem;
}
.comment-body code {
	font-family: var(--mono);
	font-size: 0.85em;
	background: var(--bg-alt);
	padding: 0.1rem 0.3rem;
	border-radius: 2px;
}
.comment-body pre code {
	background: none;
	padding: 0;
}
.comment-body blockquote {
	border-left: 3px solid var(--border);
	padding-left: 0.75rem;
	color: var(--fg-muted);
	margin: 0.5rem 0;
}
.comment-body a { text-decoration: underline; }
.comment-body img {
	max-width: 100%;
	height: auto;
	vertical-align: middle;
}
.comment-actions {
	font-size: 0.75rem;
	margin-top: 0.25rem;
	display: flex;
	gap: 0.5rem;
}
.comment-actions a { color: var(--fg-faint); }
.comment-actions a:hover { color: var(--primary); }
.comment-children {
	margin-left: 0.75rem;
}
.edited-badge {
	font-size: 0.72rem;
	color: var(--fg-faint);
	border: 1px solid var(--border-light);
	border-radius: var(--radius);
	padding: 0.05rem 0.35rem;
}
.edit-history {
	margin-top: 0.55rem;
	padding: 0.45rem 0.55rem;
	background: var(--bg-subtle);
	border: 1px solid var(--border-light);
	border-radius: var(--radius);
}
.edit-history summary {
	cursor: pointer;
	font-size: 0.78rem;
	color: var(--fg-muted);
}
.edit-history-list {
	margin: 0.65rem 0 0 1.1rem;
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
}
.edit-history-item {
	font-size: 0.82rem;
}
.edit-history-meta {
	display: flex;
	gap: 0.4rem;
	align-items: center;
	color: var(--fg-muted);
}
.edit-history-title {
	margin-top: 0.3rem;
}

/* Reply form (shown via :target) */
.reply-form { display: none; margin-top: 0.5rem; }
.reply-form:target { display: block; }
.reply-form-markdown-hint {
	font-size: 0.75rem;
	color: var(--fg-muted);
	margin-bottom: 0.35rem;
	display: block;
}

/* Markdown help icon + tooltip */
.markdown-help {
	display: inline-flex;
	align-items: center;
	vertical-align: middle;
	position: relative;
	margin-left: 0.25rem;
	cursor: help;
}
.markdown-help-icon {
	font-size: 1rem;
	line-height: 1;
	color: var(--fg-muted);
	font-style: normal;
	font-weight: 600;
}
.markdown-help:hover .markdown-help-icon { color: var(--primary); }
.markdown-help-tooltip {
	visibility: hidden;
	opacity: 0;
	position: absolute;
	left: 0;
	bottom: 100%;
	margin-bottom: 0.35rem;
	padding: 0.5rem 0.65rem;
	max-width: 20rem;
	font-size: 0.75rem;
	line-height: 1.4;
	color: var(--fg);
	background: var(--bg-subtle);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: 0 2px 8px rgba(0,0,0,0.15);
	white-space: normal;
	z-index: 10;
	pointer-events: none;
	transition: opacity 0.15s ease, visibility 0.15s ease;
}
.markdown-help:hover .markdown-help-tooltip {
	visibility: visible;
	opacity: 1;
}

/* ── Forms ─────────────────────────────────────────────────────── */
.form-page { max-width: 28rem; }

/* Onboarding banner: theme-aware so it fits default, white, dark, and black themes */
.onboarding-banner {
	margin-bottom: 1.5rem;
	padding: 1rem 1.25rem;
	background: var(--bg-subtle);
	border: 2px solid var(--border);
	border-radius: 6px;
	font-size: 1.1rem;
	font-weight: 600;
	color: var(--fg);
}
.onboarding-banner a {
	color: var(--link);
}
.onboarding-banner a:visited {
	color: var(--link-visited);
}
.onboarding-banner a:hover {
	color: var(--primary-hover);
	text-decoration: underline;
}

/* Onboarding page: larger text and more space between steps */
.onboarding-page {
	font-size: 1.125rem;
}
.onboarding-page .onboarding-steps {
	margin: 1.5rem 0;
	padding-left: 1.5rem;
	line-height: 1.65;
}
.onboarding-page .onboarding-steps li {
	margin-bottom: 1.5rem;
}
.onboarding-page .onboarding-steps li:last-child {
	margin-bottom: 0;
}

.form-group { margin-bottom: 1rem; }
.form-group label {
	display: block;
	font-weight: 600;
	font-size: 0.85rem;
	margin-bottom: 0.25rem;
	color: var(--fg);
}
.form-group .hint {
	font-size: 0.75rem;
	color: var(--fg-muted);
	margin-top: 0.15rem;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
textarea,
select {
	width: 100%;
	padding: 0.4rem 0.5rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	font-family: var(--font);
	font-size: 0.9rem;
	background: var(--input-bg);
	color: var(--fg);
}
input:focus, textarea:focus, select:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 15%, transparent);
}
textarea { min-height: 6rem; resize: vertical; }

/* Space between last form field and submit button */
form > .btn,
.form-group + .btn {
	margin-top: 0.5rem;
}

.btn {
	display: inline-block;
	padding: 0.4rem 1rem;
	border: none;
	border-radius: var(--radius);
	font-family: var(--font);
	font-size: 0.85rem;
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
}
.btn-primary {
	background: var(--primary);
	color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
	background: var(--bg-alt);
	color: var(--fg);
	border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger {
	background: var(--danger);
	color: #fff;
}
.btn-small {
	padding: 0.2rem 0.6rem;
	font-size: 0.75rem;
}

/* ── Form actions row (submit + preview) ─────────────────────── */
.form-actions-row {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
	margin-top: 0.5rem;
}
.markdown-preview-section {
	margin-top: 1rem;
	margin-bottom: 1rem;
	padding: 1rem;
	background: var(--bg-subtle);
	border: 1px solid var(--border-light);
	border-radius: var(--radius);
}
.markdown-preview-section .preview-heading {
	margin: 0 0 0.5rem 0;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--fg-muted);
}
.reply-form-actions .form-actions-row { margin-top: 0.35rem; }

/* ── Inline form (for logout, vote buttons in nav) ─────────── */
.inline-form {
	display: inline;
}
.link-btn {
	background: none;
	border: none;
	cursor: pointer;
	font-family: var(--font);
	font-size: inherit;
	padding: 0;
	text-decoration: none;
}
.link-btn:hover { text-decoration: underline; }

/* SQL Explorer: query history row buttons must be visible in all themes */
.sql-history-query { color: var(--link); }
.sql-history-query:hover { color: var(--primary-hover, var(--link)); }

/* ── User Profile ──────────────────────────────────────────────── */
.profile-header {
	margin-bottom: 1.5rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid var(--border);
}
.profile-username {
	font-size: 1.3rem;
	font-weight: 700;
	color: var(--fg);
	display: flex;
	align-items: center;
	gap: 0.5rem;
	flex-wrap: wrap;
}
.profile-clout-badge {
	display: inline-block;
	font-size: 0.85rem;
	font-weight: 600;
	padding: 0.2rem 0.6rem;
	border-radius: var(--radius);
	background: var(--primary);
	color: #fff !important;
	text-decoration: none;
}
.profile-clout-badge:hover { color: #fff !important; opacity: 0.95; }
.profile-meta {
	font-size: 0.85rem;
	color: var(--fg-muted);
	margin-top: 0.25rem;
}
/* Prominent bio: directly under meta, before links/keys */
.profile-about-block {
	margin-top: 0.85rem;
	margin-bottom: 0.75rem;
	padding: 0.85rem 1rem;
	border-radius: var(--radius);
	border: 1px solid var(--border-light, var(--border));
	border-left: 4px solid var(--primary);
	background: var(--bg-alt);
}
.profile-about-kicker {
	font-weight: 600;
	color: var(--fg-muted);
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.02em;
	margin-bottom: 0.4rem;
}
.profile-about {
	font-size: 1rem;
	line-height: 1.55;
	color: var(--fg);
}

/* ── Profile Links ─────────────────────────────────────────────── */
.profile-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 0.75rem;
	margin-top: 0.5rem;
	font-size: 0.85rem;
}
/* Bio block already provides spacing above links */
.profile-about-block + .profile-links {
	margin-top: 0;
}
.profile-link {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
}
.profile-link-label {
	font-weight: 600;
	color: var(--fg-muted);
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

/* ── Profile Description (markdown) ────────────────────────────── */
.profile-description {
	line-height: 1.6;
}
.profile-description p { margin-bottom: 0.5rem; }
.profile-description p:last-child { margin-bottom: 0; }
.profile-description pre {
	background: var(--bg-alt);
	padding: 0.5rem;
	border-radius: var(--radius);
	overflow-x: auto;
	font-size: 0.8rem;
}
.profile-description code {
	font-family: var(--mono);
	font-size: 0.85em;
	background: var(--bg-alt);
	padding: 0.1rem 0.3rem;
	border-radius: 2px;
}
.profile-description pre code {
	background: none;
	padding: 0;
}
.profile-description blockquote {
	border-left: 3px solid var(--border);
	padding-left: 0.75rem;
	color: var(--fg-muted);
	margin: 0.5rem 0;
}
.profile-description a { text-decoration: underline; }
.profile-description ul, .profile-description ol {
	margin: 0.5rem 0 0.5rem 1.25rem;
}

/* ── Profile Roles ────────────────────────────────────────────── */
.profile-roles {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.35rem;
	margin-top: 0.35rem;
	font-size: 0.85rem;
}
.profile-roles-label {
	font-weight: 600;
	color: var(--fg-muted);
	font-size: 0.7rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin-right: 0.1rem;
}
.profile-role-pill {
	position: relative;
	display: inline-block;
	padding: 0.15rem 0.55rem;
	border-radius: 999px;
	background: color-mix(in srgb, var(--primary) 18%, transparent);
	color: var(--primary);
	font-size: 0.78rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	cursor: default;
	transition: background 0.15s;
}
.profile-role-pill:hover {
	background: color-mix(in srgb, var(--primary) 30%, transparent);
}
.profile-role-pill[data-tooltip]:hover::after {
	content: attr(data-tooltip);
	position: absolute;
	left: 0;
	top: calc(100% + 6px);
	padding: 0.4rem 0.65rem;
	border-radius: var(--radius, 4px);
	background: var(--bg-alt, #222);
	color: var(--fg, #eee);
	font-size: 0.75rem;
	font-weight: 400;
	line-height: 1.45;
	width: max-content;
	max-width: 300px;
	box-shadow: 0 2px 8px rgba(0,0,0,0.25);
	z-index: 10;
	pointer-events: none;
}

/* ── Public Key Blocks ─────────────────────────────────────────── */
.profile-key {
	margin-top: 0.75rem;
	font-size: 0.85rem;
}
.profile-key summary {
	cursor: pointer;
	color: var(--fg-muted);
	font-weight: 600;
	user-select: none;
}
.profile-key summary:hover { color: var(--primary); }
.key-block {
	background: var(--bg-alt);
	border: 1px solid var(--border-light);
	border-radius: var(--radius);
	padding: 0.75rem;
	margin-top: 0.35rem;
	font-family: var(--mono);
	font-size: 0.75rem;
	line-height: 1.4;
	white-space: pre-wrap;
	word-break: break-all;
	overflow-x: auto;
	max-height: 16rem;
	overflow-y: auto;
}

/* ── Profile Tabs (Posts / Replies) ───────────────────────────────────────── */
.profile-tabs {
	display: flex;
	gap: 0;
	margin: 1.25rem 0 0;
	border-bottom: 1px solid var(--border);
}
.profile-tab {
	display: inline-block;
	padding: 0.5rem 1rem;
	font-size: 0.9rem;
	font-weight: 500;
	color: var(--fg-muted);
	background: none;
	border: none;
	border-bottom: 2px solid transparent;
	margin-bottom: -1px;
	cursor: pointer;
	font-family: inherit;
	text-decoration: none;
}
.profile-tab:hover {
	color: var(--fg);
}
.profile-tab.active {
	color: var(--primary);
	border-bottom-color: var(--primary);
}
.profile-panel {
	display: none;
}
.profile-panel.active {
	display: block;
}

/* ── Profile Reply List ───────────────────────────────────────────────────── */
.profile-reply-list {
	list-style: none;
	padding: 0;
	margin: 0;
}
.profile-reply-item {
	border-bottom: 1px solid var(--border);
	padding: 0.75rem 0;
}
.profile-reply-item:last-child { border-bottom: none; }
.profile-reply-snippet {
	font-size: 0.9rem;
	line-height: 1.5;
	color: var(--fg);
	margin-bottom: 0.35rem;
}
.profile-reply-content .story-meta {
	font-size: 0.8rem;
	color: var(--fg-muted);
}
.profile-reply-content .story-meta a { color: var(--primary); }

/* ── Settings Page (profile links, keys) ───────────────────────── */
.settings-page {
	max-width: 36rem;
}
.settings-fieldset {
	border: 1px solid var(--border-light);
	border-radius: var(--radius);
	padding: 1rem;
	margin-bottom: 1.25rem;
}
.settings-fieldset legend {
	font-weight: 600;
	font-size: 0.9rem;
	padding: 0 0.4rem;
	color: var(--fg);
}
.settings-checkbox {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	cursor: pointer;
	font-size: 0.95rem;
	margin-bottom: 0.25rem;
}
.settings-checkbox input[type="checkbox"] { width: auto; }
.settings-links-list {
	margin-bottom: 0.75rem;
}
.settings-link-row {
	padding: 0.25rem 0;
	font-size: 0.85rem;
}
.settings-link-remove {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	cursor: pointer;
	font-weight: 400 !important;
}
.settings-link-remove input[type="checkbox"] {
	width: auto;
}
.settings-link-value {
	color: var(--fg-muted);
}
.settings-add-link {
	margin-top: 0.5rem;
}
.settings-add-link-row {
	display: flex;
	gap: 0.5rem;
}
.settings-add-link-row select {
	flex: 0 0 auto;
	width: auto;
	min-width: 10rem;
}
.settings-add-link-row input {
	flex: 1;
}
.key-textarea {
	font-family: var(--mono);
	font-size: 0.8rem;
}

/* ── Invite Tree ───────────────────────────────────────────────── */
.invite-tree ul {
	list-style: none;
	padding-left: 1.25rem;
}
.invite-tree > ul { padding-left: 0; }
.invite-tree li {
	padding: 0.15rem 0;
	font-size: 0.85rem;
}

/* ── Moderation Log ────────────────────────────────────────────── */
.mod-log-item {
	padding: 0.5rem 0;
	border-bottom: 1px solid var(--border-light);
	font-size: 0.85rem;
}
.mod-action { font-weight: 600; color: var(--accent); }
.mod-section {
	margin-bottom: 2rem;
	padding-bottom: 1.5rem;
	border-bottom: 1px solid var(--border-light);
}
.mod-section h2 {
	font-size: 1rem;
	margin-bottom: 0.5rem;
}
.mod-tags-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.85rem;
}
.mod-tags-table th,
.mod-tags-table td {
	padding: 0.35rem 0.5rem;
	text-align: left;
	border-bottom: 1px solid var(--border-light);
}
.mod-tags-table th {
	font-weight: 600;
	color: var(--fg-muted);
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.03em;
}
.btn-sm {
	padding: 0.15rem 0.5rem;
	font-size: 0.75rem;
}
.btn-danger {
	background: var(--bg);
	color: var(--danger);
	border: 1px solid var(--danger);
}
.btn-danger:hover {
	background: var(--danger);
	color: #fff;
}

/* ── Role Directory (mod panel) ────────────────────────────────── */
.role-dir-toolbar {
	display: flex;
	gap: 0.5rem;
	margin-bottom: 0.75rem;
	flex-wrap: wrap;
}
.role-dir-toolbar input[type="text"] {
	flex: 1;
	min-width: 10rem;
}
.role-dir-list {
	max-height: 28rem;
	overflow-y: auto;
	border: 1px solid var(--border-light, var(--border));
	border-radius: var(--radius, 4px);
}
.role-dir-card {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	padding: 0.45rem 0.65rem;
	border-bottom: 1px solid var(--border-light, var(--border));
	font-size: 0.85rem;
}
.role-dir-card:last-child { border-bottom: none; }
.role-dir-card:hover { background: var(--bg-alt); }
.role-dir-card-main {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-width: 0;
	flex-shrink: 1;
}
.role-dir-pills {
	display: inline-flex;
	gap: 0.25rem;
	flex-wrap: wrap;
}
.role-dir-pill {
	display: inline-block;
	padding: 0.05rem 0.4rem;
	border-radius: 999px;
	background: color-mix(in srgb, var(--primary) 15%, transparent);
	color: var(--primary);
	font-size: 0.72rem;
	font-weight: 600;
}
.role-dir-actions {
	display: flex;
	gap: 0.35rem;
	flex-shrink: 0;
}
.role-dir-form {
	display: flex;
	gap: 0.2rem;
	align-items: center;
}
.form-input-sm {
	font-size: 0.78rem !important;
	padding: 0.15rem 0.3rem !important;
	width: auto !important;
}

/* ── Tags Page ─────────────────────────────────────────────────── */
.tag-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}
a.tag-list-item {
	display: block;
	background: var(--bg-alt);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 0.4rem 0.75rem;
	text-decoration: none;
	color: inherit;
	transition: border-color 0.15s, box-shadow 0.15s;
}
a.tag-list-item:visited {
	color: inherit;
}
a.tag-list-item:hover {
	border-color: var(--primary);
	box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.tag-list-item .tag-name {
	font-weight: 600;
	font-size: 0.9rem;
	color: var(--primary);
}
.tag-list-item .tag-desc {
	font-size: 0.75rem;
	color: var(--fg-muted);
	margin-top: 0.15rem;
}

/* ── Checkbox Tags (submit form) ───────────────────────────────── */
.tag-checkboxes {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem 0.6rem;
}
.tag-checkboxes label {
	font-weight: 400;
	font-size: 0.85rem;
	display: flex;
	align-items: center;
	gap: 0.25rem;
	cursor: pointer;
}
.new-tag-input {
	max-width: 20rem;
}
.post-position {
	font-size: 0.75rem;
	color: var(--fg-muted);
	font-weight: 600;
}
.new-tag-input input {
	width: 100%;
	font-size: 0.85rem;
	cursor: pointer;
}

/* ── Pagination ────────────────────────────────────────────────── */
.pagination {
	display: flex;
	gap: 0.5rem;
	margin-top: 1.5rem;
	font-size: 0.85rem;
}
.pagination a, .pagination span {
	padding: 0.3rem 0.6rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
}
.pagination .current {
	background: var(--primary);
	color: #fff;
	border-color: var(--primary);
}

/* ── Error ─────────────────────────────────────────────────────── */
.error-msg {
	color: var(--danger);
	font-size: 0.85rem;
	margin-bottom: 1rem;
	padding: 0.4rem 0.6rem;
	background: var(--error-bg);
	border: 1px solid var(--error-border);
	border-radius: var(--radius);
}

/* ── Section Headers ───────────────────────────────────────────── */
.page-title {
	font-size: 1.1rem;
	font-weight: 700;
	margin-bottom: 1rem;
	color: var(--fg);
}
.section-title {
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--fg);
	margin: 1.5rem 0 0.75rem;
	padding-bottom: 0.25rem;
	border-bottom: 1px solid var(--border);
}

/* ── About page ────────────────────────────────────────────────── */
.about-content {
	max-width: 36rem;
	line-height: 1.65;
}
.about-content h2 {
	font-size: 1rem;
	margin: 1.5rem 0 0.5rem;
}
.about-content h3 {
	font-size: 0.95rem;
	margin: 1.25rem 0 0.4rem;
}
.about-content p { margin-bottom: 0.75rem; }
.about-content ul, .about-content ol { margin: 0.5rem 0 0.75rem 1.25rem; }
.about-content pre {
	background: var(--bg-alt);
	padding: 0.5rem 0.75rem;
	border-radius: var(--radius);
	overflow-x: auto;
	font-size: 0.8rem;
	line-height: 1.5;
	max-width: 100%;
}
.about-content code {
	font-family: var(--mono);
	font-size: 0.85em;
	background: var(--bg-alt);
	padding: 0.1rem 0.3rem;
	border-radius: 2px;
	word-break: break-word;
}
.about-content pre code {
	background: none;
	padding: 0;
}
.help-table {
	width: 100%;
	border-collapse: collapse;
	margin: 0.75rem 0;
	font-size: 0.88rem;
}
.help-table th,
.help-table td {
	text-align: left;
	padding: 0.4rem 0.6rem;
	border-bottom: 1px solid var(--border-light);
}
.help-table th {
	font-weight: 600;
	color: var(--fg-muted);
	border-bottom-color: var(--border);
}
.help-table code {
	font-family: var(--mono);
	font-size: 0.85em;
	background: var(--bg-alt);
	padding: 0.1em 0.3em;
	border-radius: 3px;
}
kbd {
	display: inline-block;
	font-family: var(--mono);
	font-size: 0.82em;
	padding: 0.15em 0.45em;
	border: 1px solid var(--border);
	border-radius: 4px;
	background: var(--bg-alt);
	box-shadow: 0 1px 0 var(--border-light);
	line-height: 1.4;
}

/* ── Search Page ───────────────────────────────────────────────── */
.search-page { max-width: 44rem; }

.search-form {
	margin-bottom: 1.25rem;
}
.search-main-row {
	display: flex;
	gap: 0.5rem;
	align-items: stretch;
}
.search-input {
	flex: 1;
	font-size: 1rem !important;
	padding: 0.5rem 0.75rem !important;
}
.search-main-row .btn {
	white-space: nowrap;
	padding: 0.5rem 1.25rem;
	font-size: 0.9rem;
}

/* ── Search Filters ───────────────────────────────────────────── */
.search-filters {
	margin-top: 0.5rem;
	font-size: 0.85rem;
}
.search-filters summary {
	cursor: pointer;
	color: var(--fg-muted);
	user-select: none;
}
.search-filters summary:hover { color: var(--primary); }
.search-filters-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
	gap: 0.5rem 0.75rem;
	margin-top: 0.5rem;
	padding: 0.75rem;
	background: var(--bg-alt);
	border: 1px solid var(--border-light);
	border-radius: var(--radius);
}
.search-filters-grid .form-group {
	margin-bottom: 0;
}
.search-filters-grid label {
	font-size: 0.75rem;
	font-weight: 500;
	margin-bottom: 0.15rem;
	color: var(--fg-muted);
}
.search-filters-grid input,
.search-filters-grid select {
	font-size: 0.8rem;
	padding: 0.3rem 0.4rem;
}

/* ── Search Results ───────────────────────────────────────────── */
.search-summary {
	font-size: 0.85rem;
	color: var(--fg-muted);
	margin-bottom: 0.75rem;
}
.search-range {
	color: var(--fg-faint);
}

.search-profile-match {
	margin-bottom: 1.25rem;
	padding: 0.75rem 1rem;
	background: var(--bg-alt);
	border: 1px solid var(--border-light);
	border-radius: var(--radius);
}
.search-profile-label {
	font-size: 0.85rem;
	color: var(--fg-muted);
	margin-bottom: 0.25rem;
}
.search-profile-match a {
	color: var(--link);
}
.search-profile-match a:visited {
	color: var(--link-visited);
}
.search-profile-match a:hover {
	color: var(--primary);
}

.search-results {
	list-style: none;
}
.search-result {
	padding: 0.6rem 0;
	border-bottom: 1px solid var(--border-light);
}
.search-result:last-child { border-bottom: none; }

.search-result-reply {
	border-left: 3px solid var(--border);
	padding-left: 0.75rem;
}
.search-result-label {
	font-size: 0.75rem;
	color: var(--fg-muted);
	margin-bottom: 0.25rem;
	font-style: italic;
}
.search-result-content .story-title {
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.3;
}
.search-result-content .story-title a { color: var(--fg); }
.search-result-content .story-title a:visited { color: var(--fg-muted); }
.search-result-content .story-title a:hover { color: var(--primary); }

.search-snippet {
	font-size: 0.85rem;
	color: var(--fg-muted);
	line-height: 1.5;
	margin: 0.3rem 0;
	overflow: hidden;
}
.search-snippet mark {
	background: var(--mark-bg);
	color: var(--fg);
	padding: 0.05rem 0.15rem;
	border-radius: 2px;
	font-weight: 500;
}

/* ── No results tips ──────────────────────────────────────────── */
.search-no-results {
	background: var(--bg-alt);
	border: 1px solid var(--border-light);
	border-radius: var(--radius);
	padding: 1rem 1.25rem;
	margin-top: 0.75rem;
	font-size: 0.85rem;
	color: var(--fg-muted);
}
.search-no-results p {
	font-weight: 600;
	margin-bottom: 0.5rem;
}
.search-no-results ul {
	margin: 0;
	padding-left: 1.25rem;
}
.search-no-results li {
	margin-bottom: 0.2rem;
}

/* ── Utility: text colors ─────────────────────────────────────── */
.text-muted { color: var(--fg-muted); }
.text-muted-sm { color: var(--fg-muted); font-size: 0.9rem; }
.text-faint { color: var(--fg-faint); }
.text-success { color: var(--success); }

/* ── Utility: common page description below headings ──────────── */
.page-desc {
	font-size: 0.9rem;
	color: var(--fg-muted);
	margin-bottom: 1rem;
}

/* ── Utility: label hint (for "optional" annotations in forms) ── */
.label-hint {
	font-weight: 400;
	color: var(--fg-muted);
}

/* ── Utility: form footer text ────────────────────────────────── */
.form-footer {
	margin-top: 1rem;
	font-size: 0.85rem;
	color: var(--fg-muted);
}

/* ── Utility: reply form actions row ──────────────────────────── */
.reply-form-actions {
	margin-top: 0.5rem;
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
}

/* ── Thread detail page ───────────────────────────────────────── */
.thread-header {
	display: flex;
	gap: 0.5rem;
	align-items: flex-start;
}
.thread-title {
	font-size: 1.15rem;
	font-weight: 700;
	line-height: 1.3;
}
.thread-body {
	margin: 0.5rem 0;
}
.thread-body img {
	max-width: 100%;
	height: auto;
	vertical-align: middle;
}
.thread-meta {
	margin-top: 0.25rem;
}
.login-prompt {
	color: var(--fg-muted);
	margin-top: 1rem;
}

/* ── Invitations page ─────────────────────────────────────────── */
.invite-summary {
	font-size: 0.85rem;
	color: var(--fg-muted);
	margin-bottom: 0.75rem;
	padding: 0.5rem 0.75rem;
	background: var(--bg-alt);
	border: 1px solid var(--border-light);
	border-radius: var(--radius);
}
.invite-form {
	margin-bottom: 1.5rem;
}
.invite-list {
	list-style: none;
}
.invite-row {
	padding: 0.3rem 0;
	font-size: 0.85rem;
}

/* ── Setup page ───────────────────────────────────────────────── */
.setup-form {
	margin-top: 1rem;
}

/* ── Tripcode (anonymous identity for public posts) ────────────── */
.tripcode {
	font-family: var(--mono);
	font-size: 0.8em;
	color: var(--accent);
	font-weight: 600;
	letter-spacing: 0.02em;
}
.comment-author.tripcode {
	color: var(--accent) !important;
}

/* ── Privacy Toggle (submit form) ──────────────────────────────── */
.privacy-toggle {
	margin-top: 0.25rem;
}
.privacy-label {
	display: flex !important;
	align-items: center;
	gap: 0.4rem;
	font-weight: 500 !important;
	cursor: pointer;
}
.privacy-label input[type="checkbox"] {
	width: auto;
}
.privacy-warning {
	margin-top: 0.5rem;
	padding: 0.5rem 0.75rem;
	background: var(--flash-bg);
	border: 1px solid var(--flash-border);
	border-radius: var(--radius);
	font-size: 0.8rem;
	line-height: 1.5;
	color: var(--flash-fg);
}

/* ── User Dropdown (header) ────────────────────────────────────── */
.user-dropdown {
	position: relative;
	display: inline-block;
}
.user-dropdown-toggle {
	cursor: pointer;
}
.user-dropdown-menu {
	display: none;
	position: absolute;
	right: 0;
	top: 100%;
	min-width: 8rem;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: 0 4px 12px rgba(0,0,0,0.1);
	z-index: 100;
	padding: 0.25rem 0;
	flex-direction: column;
}
/* Invisible bridge so hover persists between trigger and menu */
.user-dropdown::after {
	content: '';
	position: absolute;
	top: 100%;
	right: 0;
	width: 100%;
	height: 0.5rem;
	display: none;
}
.user-dropdown:hover .user-dropdown-menu,
.user-dropdown:focus-within .user-dropdown-menu,
.user-dropdown:hover::after {
	display: flex;
}
.user-dropdown:hover::after {
	display: block;
}
.user-dropdown-menu a,
.user-dropdown-menu .link-btn {
	display: block;
	width: 100%;
	padding: 0.4rem 0.75rem;
	color: var(--fg);
	text-decoration: none;
	text-align: left;
	font-size: 0.85rem;
	line-height: 1.4;
	background: none;
	border: none;
	cursor: pointer;
	font-family: inherit;
}
.user-dropdown-menu a:visited {
	color: var(--fg);
}
.user-dropdown-menu a:hover,
.user-dropdown-menu .link-btn:hover {
	background: var(--bg-subtle);
	color: var(--primary);
}

/* ── Notification badge (nav) ──────────────────────────────────── */
.notif-nav-badge {
	display: none;
	margin-left: 0.3rem;
	background: var(--danger);
	color: #fff;
	font-size: 0.65rem;
	font-weight: 700;
	line-height: 1;
	padding: 0.15em 0.4em;
	border-radius: 999px;
	vertical-align: middle;
}
.notif-nav-badge:not(:empty) { display: inline-block; }
.notif-menu-badge {
	display: none;
	margin-left: 0.25rem;
	background: var(--danger);
	color: #fff;
	font-size: 0.65rem;
	font-weight: 700;
	line-height: 1;
	padding: 0.15em 0.4em;
	border-radius: 999px;
	vertical-align: middle;
}
.notif-menu-badge:not(:empty) { display: inline-block; }

/* ── Notifications page ────────────────────────────────────────── */
.notif-header {
	display: flex;
	align-items: baseline;
	gap: 1rem;
	margin-bottom: 1.25rem;
}
.notif-list {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 0;
}
.notif-item {
	display: flex;
	align-items: flex-start;
	gap: 0.6rem;
	padding: 0.75rem 0;
	border-bottom: 1px solid var(--border-light);
}
.notif-item:last-child { border-bottom: none; }
.notif-unread { background: transparent; }
.notif-dot {
	flex-shrink: 0;
	width: 0.5rem;
	height: 0.5rem;
	border-radius: 50%;
	background: var(--primary);
	margin-top: 0.35rem;
}
.notif-dot-placeholder {
	flex-shrink: 0;
	width: 0.5rem;
	height: 0.5rem;
}
.notif-body {
	display: flex;
	flex: 1;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.4rem 0.75rem;
}
.notif-link {
	color: var(--fg);
	text-decoration: none;
	flex: 1;
	min-width: 0;
}
.notif-link:hover { color: var(--primary); }
.notif-time {
	font-size: 0.8rem;
	color: var(--fg-faint);
	white-space: nowrap;
}

/* ── Theme Picker (settings) ───────────────────────────────────── */
.theme-picker {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
}
.theme-picker label {
	display: flex;
	align-items: center;
	gap: 0.4rem;
	cursor: pointer;
	padding: 0.4rem 0.75rem;
	border: 2px solid var(--border);
	border-radius: var(--radius);
	font-size: 0.85rem;
	font-weight: 500;
	transition: border-color 0.15s;
}
.theme-picker label:has(input:checked) {
	border-color: var(--primary);
}
.theme-picker input[type="radio"] {
	width: auto;
}
.theme-swatch {
	display: inline-block;
	width: 1rem;
	height: 1rem;
	border-radius: 50%;
	border: 1px solid rgba(128,128,128,0.3);
	flex-shrink: 0;
}

/* ── Share / iOS Shortcut Setup ─────────────────────────────────── */
.share-setup-steps li {
	margin-bottom: 0.75rem;
	line-height: 1.6;
}
.share-url-example {
	display: inline-block;
	padding: 0.3rem 0.6rem;
	background: var(--bg-subtle);
	border-radius: var(--radius);
	font-size: 0.85rem;
	word-break: break-all;
}
.share-url-box {
	margin-top: 0.5rem;
	padding: 0.5rem 0.75rem;
	background: var(--bg-subtle);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	font-family: var(--mono);
	font-size: 0.85rem;
	word-break: break-all;
	line-height: 1.6;
}
.share-url-variable {
	display: inline-block;
	padding: 0.1rem 0.4rem;
	margin-left: 0.15rem;
	background: var(--primary);
	color: #fff;
	border-radius: 3px;
	font-size: 0.8rem;
	font-weight: 500;
}
.share-preview {
	margin-top: 1rem;
	padding: 1rem;
	background: var(--bg-subtle);
	border: 1px solid var(--border);
	border-radius: var(--radius);
}
.share-preview-label {
	font-size: 0.8rem;
	color: var(--fg-muted);
	margin-bottom: 0.35rem;
}
.share-preview-url {
	font-size: 0.95rem;
	word-break: break-all;
}

/* ── Mobile Hamburger + Drawer ─────────────────────────────────── */
.mobile-menu-btn {
	display: none;
	background: none;
	border: none;
	cursor: pointer;
	width: 2.5rem;
	height: 2.5rem;
	padding: 0.5rem;
	flex-shrink: 0;
	position: relative;
}
.mobile-menu-btn span,
.mobile-menu-btn span::before,
.mobile-menu-btn span::after {
	display: block;
	width: 100%;
	height: 2px;
	background: #fff;
	border-radius: 1px;
	position: absolute;
	left: 0.5rem;
	right: 0.5rem;
	width: calc(100% - 1rem);
	transition: transform 0.2s ease, opacity 0.2s ease;
}
.mobile-menu-btn span { top: 50%; transform: translateY(-50%); }
.mobile-menu-btn span::before { content: ''; top: -7px; }
.mobile-menu-btn span::after { content: ''; top: 7px; }
.mobile-drawer-backdrop {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,0.4);
	z-index: 200;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease;
}
.mobile-drawer {
	display: none;
	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(18rem, 85vw);
	background: var(--bg);
	z-index: 201;
	transform: translateX(100%);
	transition: transform 0.25s ease;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	box-shadow: -4px 0 16px rgba(0,0,0,0.15);
}
.mobile-drawer-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.75rem 1rem;
	border-bottom: 1px solid var(--border-light);
}
.mobile-drawer-title {
	font-weight: 700;
	font-size: 1rem;
	color: var(--fg);
}
.mobile-drawer-close {
	background: none;
	border: none;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	color: var(--fg-muted);
	padding: 0.25rem;
	min-width: 2.5rem;
	min-height: 2.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
}
.mobile-drawer-close:hover { color: var(--fg); }
.mobile-drawer-nav {
	display: flex;
	flex-direction: column;
	padding: 0.5rem 0;
}
.mobile-drawer-nav a,
.mobile-drawer-nav .link-btn {
	display: flex;
	align-items: center;
	padding: 0.75rem 1.25rem;
	min-height: 3rem;
	font-size: 0.95rem;
	font-weight: 500;
	color: var(--fg);
	text-decoration: none;
	border: none;
	background: none;
	cursor: pointer;
	font-family: var(--font);
	text-align: left;
	width: 100%;
}
.mobile-drawer-nav a:visited { color: var(--fg); }
.mobile-drawer-nav a:hover,
.mobile-drawer-nav .link-btn:hover {
	background: var(--bg-subtle);
	color: var(--primary);
	text-decoration: none;
}
.mobile-drawer-user {
	padding: 0.5rem 1.25rem 0.25rem;
}
.mobile-drawer-user a {
	font-weight: 700;
	font-size: 1rem;
	color: var(--primary) !important;
	padding: 0.5rem 0;
	min-height: auto;
}
.mobile-drawer-divider {
	height: 1px;
	background: var(--border-light);
	margin: 0.25rem 1rem;
}
.mobile-drawer-logout {
	display: block;
}
.notif-drawer-badge {
	display: none;
	margin-left: 0.35rem;
	background: var(--danger);
	color: #fff;
	font-size: 0.7rem;
	font-weight: 700;
	line-height: 1;
	padding: 0.2em 0.45em;
	border-radius: 999px;
	vertical-align: middle;
}
.notif-drawer-badge:not(:empty) { display: inline-block; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 600px) {
	.header-nav {
		flex-direction: row;
		flex-wrap: nowrap;
		align-items: center;
		justify-content: space-between;
		gap: 0.4rem;
	}
	.header-left {
		flex-shrink: 0;
		min-width: 0;
	}
	.site-logo { font-size: 1rem; }
	.site-tagline { display: none; }
	.header-links { display: none; }
	.mobile-menu-btn { display: block; }
	.mobile-drawer-backdrop,
	.mobile-drawer { display: block; }
	.mobile-drawer-open .mobile-drawer-backdrop { opacity: 1; pointer-events: auto; }
	.mobile-drawer-open .mobile-drawer { transform: translateX(0); }
	.clout { font-size: 0.7rem; }
	.story-rank { display: none; }
	.footer-inner { gap: 0.5rem 0.75rem; }
	.footer-copy { margin-left: 0; }
	.tag-list { flex-direction: column; }
	.search-filters-grid { grid-template-columns: 1fr; }
	.container { padding: 0 0.75rem; }
	main.container { padding: 1rem 0.75rem 2rem; }
	.about-content { max-width: 100%; }
	body { font-size: 16px; }
	.comment-body { font-size: 0.95rem; }
	.story-meta { font-size: 0.75rem; }
	.story-item .story-meta { gap: 0.08rem; }
	.story-meta-main { gap: 0.08rem 0.25rem; }
	.vote-btn {
		min-width: 2.75rem;
		min-height: 2.75rem;
	}
	.comment-children { margin-left: 0.5rem; }
}

/* ── Internal links (same-site thread/section URLs in comments) ─── */
.comment-body a.internal-link {
	display: inline-block;
	padding: 0.1em 0.35em;
	margin: 0 -0.1em;
	border-radius: var(--radius);
	background: var(--bg-alt);
	color: var(--link);
	text-decoration: none;
}
.comment-body a.internal-link:hover {
	text-decoration: underline;
	background: var(--border);
}

/* ── @mentions (profile links in comments, autocomplete dropdown) ─── */
.comment-body .mention {
	color: var(--link);
	text-decoration: none;
	font-weight: 500;
}
.comment-body .mention:hover {
	text-decoration: underline;
}

.mention-suggestions {
	display: none;
	position: fixed;
	background: var(--bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: 0 4px 12px rgba(0,0,0,0.12);
	z-index: 1000;
	max-height: 12rem;
	overflow-y: auto;
	padding: 0.25rem 0;
}
.mention-suggestions.mention-suggestions-visible {
	display: block;
}
.mention-suggestion-item {
	padding: 0.4rem 0.75rem;
	cursor: pointer;
	font-size: 0.9rem;
	max-width: 24rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.mention-suggestion-item:hover,
.mention-suggestion-item.mention-suggestion-selected {
	background: var(--bg-alt);
}

