.hearth-app {
	--hearth-bg: #f0f2f5;
	--hearth-card: #ffffff;
	--hearth-border: #e3e8ee;
	--hearth-text: #19283a;
	--hearth-text-muted: #656d76;
	--hearth-primary: #2b2e33;
	--hearth-primary-hover: #1c1e22;
	--hearth-primary-contrast: #ffffff;
	--hearth-active-bg: #eef1f4;
	--hearth-link: #2271b1;
	--hearth-danger: #dc2626;
	--hearth-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);

	/* One radius/spacing scale, used everywhere instead of ad-hoc px values. */
	--hearth-radius-sm: 6px;
	--hearth-radius: 8px;
	--hearth-radius-lg: 12px;
	--hearth-radius-full: 999px;
	--hearth-space-1: 4px;
	--hearth-space-2: 8px;
	--hearth-space-3: 12px;
	--hearth-space-4: 16px;
	--hearth-space-5: 24px;
	--hearth-space-6: 32px;

	display: grid;
	grid-template-columns: 260px minmax(0, 1fr);
	gap: var(--hearth-space-5);
	max-width: 1160px;
	width: 100%;
	margin: 0 auto;
	color: var(--hearth-text);
	font-family: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
	position: relative;
}

/* Hearth supplies its own in-app heading, so hide the duplicate page title
   printed by common classic and block themes. The body marker keeps this
   limited to pages that actually contain a Hearth shortcode. */
.hearth-app-page .entry-title,
.hearth-app-page .page-title,
.hearth-app-page .wp-block-post-title {
	display: none;
}

.hearth-app * {
	box-sizing: border-box;
}

/* Sits before .hearth-app as a plain sibling (every template's own root div
   carries that class), so it can't read its --hearth-* custom properties —
   values here are repeated literals from the same palette instead. */
.hearth-app-nav {
	display: flex;
	gap: 8px;
	max-width: 1160px;
	width: 100%;
	margin: 0 auto 24px;
	overflow-x: auto;
	font-family: "Noto Sans TC", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}

.hearth-app-nav-item {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex: none;
	padding: 8px 14px;
	border-radius: 999px;
	background: #ffffff;
	border: 1px solid #e3e8ee;
	color: #656d76;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.hearth-app-nav-item:hover {
	background: #eef1f4;
	color: #19283a;
}

.hearth-app-nav-item.is-active {
	background: #2b2e33;
	border-color: #2b2e33;
	color: #ffffff;
}

/* Duplicate app-switcher links rendered inside community.php's category
   chip strip so a phone can merge them into one row (see .hearth-space-list
   below) — hidden here on desktop, where the standalone bar above already
   covers app-switching on its own. */
.hearth-space-list-appnav {
	display: none;
}

@media (max-width: 720px) {
	.hearth-app-nav {
		margin: 0 0 16px;
	}

	/* Only the copy that precedes the community app's own root div — the
	   other three pages (members/classroom/calendar) have no category strip
	   to merge into, so their standalone bar stays exactly as it was. */
	.hearth-app-nav:has(+ #hearth-app) {
		display: none;
	}

	.hearth-space-list-appnav {
		display: contents;
	}
}

.hearth-sidebar {
	background: var(--hearth-card);
	border: 1px solid var(--hearth-border);
	border-radius: var(--hearth-radius);
	box-shadow: var(--hearth-shadow);
	padding: var(--hearth-space-4);
	align-self: start;
	position: sticky;
	top: 16px;
}

.hearth-habit-card {
	background: linear-gradient(135deg, #17202c 0%, #2b3544 100%);
	color: #fff;
	border-radius: var(--hearth-radius-lg);
	padding: 20px;
	margin-bottom: 16px;
	box-shadow: var(--hearth-shadow);
}

.hearth-habit-card h3 {
	margin: 4px 0 6px;
	font-size: 20px;
	color: #fff;
}

.hearth-habit-card p {
	margin: 0;
	color: #cbd5e1;
	font-size: 13px;
}

.hearth-habit-kicker {
	color: #93c5fd;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
}

.hearth-habit-fields {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
	margin: 16px 0 12px;
}

.hearth-habit-fields label {
	display: flex;
	flex-direction: column;
	gap: 5px;
	font-size: 12px;
	font-weight: 600;
}
.hearth-habit-step { display: block; margin-bottom: 3px; color: #93c5fd; font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.hearth-habit-collapsed { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.hearth-habit-collapsed strong { display: block; margin-top: 3px; }

.hearth-habit-fields input,
.hearth-habit-response textarea {
	width: 100%;
	border: 1px solid rgba(255,255,255,.2);
	border-radius: var(--hearth-radius-sm);
	background: rgba(255,255,255,.1);
	color: #fff;
	padding: 9px 10px;
	font: inherit;
}

.hearth-habit-fields input::placeholder,
.hearth-habit-response textarea::placeholder {
	color: #94a3b8;
}

.hearth-habit-reminder {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px 16px;
	margin: 0 0 12px;
	padding: 11px 12px;
	border: 1px solid rgba(255,255,255,.16);
	border-radius: var(--hearth-radius-sm);
	background: rgba(255,255,255,.06);
	font-size: 12px;
}

.hearth-habit-reminder label { display: inline-flex; align-items: center; gap: 7px; }
.hearth-habit-reminder select { border-radius: 5px; padding: 4px 7px; }
.hearth-habit-reminder .description { flex-basis: 100%; }

.hearth-habit-heading {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	align-items: flex-start;
}

.hearth-habit-stats {
	display: grid;
	grid-template-columns: auto auto;
	gap: 0 6px;
	align-items: baseline;
	white-space: nowrap;
}

.hearth-habit-stats strong { font-size: 20px; text-align: right; }
.hearth-habit-stats span { font-size: 11px; color: #cbd5e1; }
.hearth-habit-response { margin-top: 14px; }
.hearth-habit-response textarea { min-height: 62px; resize: vertical; }
.hearth-habit-value-check { display: block; margin: 9px 0; font-size: 12px; color: #dbeafe; }
.hearth-habit-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hearth-habit-card .hearth-btn:not(.hearth-btn-primary) { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.25); color: #fff; }
.hearth-habit-card .hearth-link-btn { color: #bfdbfe; }
.hearth-habit-done { margin-top: 14px; padding: 12px; border-radius: var(--hearth-radius-sm); background: rgba(34,197,94,.15); color: #dcfce7; font-size: 13px; }
.hearth-habit-loading { color: #cbd5e1; font-size: 13px; }

@media (max-width: 720px) {
	.hearth-habit-fields { grid-template-columns: 1fr; }
	.hearth-habit-heading { flex-direction: column; }
	.hearth-habit-collapsed { align-items: flex-start; flex-direction: column; }
}

.hearth-sidebar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.hearth-sidebar-header h3 {
	margin: 0;
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--hearth-text-muted);
}

.hearth-space-list {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.hearth-space-item {
	display: flex;
	align-items: center;
	gap: 6px;
	padding: 8px 10px;
	border-radius: var(--hearth-radius);
	cursor: pointer;
	font-size: 14px;
	border-left: 3px solid transparent;
}

.hearth-space-item:hover {
	background: var(--hearth-active-bg);
}

.hearth-space-item.is-active {
	background: var(--hearth-active-bg);
	color: var(--hearth-text);
	font-weight: 600;
	border-left-color: var(--hearth-primary);
}

.hearth-space-member-count {
	margin-left: auto;
	font-size: 12px;
	opacity: 0.7;
}

.hearth-space-new-dot {
	color: var(--hearth-primary);
	font-size: 8px;
	line-height: 1;
}

.hearth-space-lock-badge {
	font-size: 11px;
	opacity: 0.75;
	white-space: nowrap;
}

.hearth-main {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: var(--hearth-space-4);
}

.hearth-topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.hearth-topbar-title {
	display: flex;
	align-items: center;
	gap: 12px;
}

.hearth-topbar h2 {
	margin: 0;
	font-size: 20px;
}

.hearth-btn-sm {
	padding: 4px 12px;
	font-size: 13px;
}

.hearth-icon-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 4px;
	background: var(--hearth-card);
	border: 1px solid var(--hearth-border);
	border-radius: var(--hearth-radius);
	width: 36px;
	height: 36px;
	cursor: pointer;
	font-size: 13px;
	color: var(--hearth-text);
	transition: background 0.12s ease, border-color 0.12s ease;
}

.hearth-icon {
	display: inline-block;
	vertical-align: middle;
	flex-shrink: 0;
}

[data-hearth-el="new-space-btn"] {
	font-size: 20px;
	font-weight: 400;
	line-height: 1;
}

.hearth-icon-btn:hover {
	background: var(--hearth-active-bg);
	border-color: #d4dbe3;
}

.hearth-badge {
	position: absolute;
	top: -6px;
	right: -6px;
	background: var(--hearth-danger);
	color: #fff;
	border-radius: var(--hearth-radius-full);
	font-size: 11px;
	padding: 1px 5px;
	line-height: 1.4;
}

.hearth-points-toast {
	position: fixed;
	bottom: 28px;
	left: 50%;
	transform: translateX(-50%) translateY(12px);
	background: var(--hearth-primary);
	color: var(--hearth-primary-contrast);
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 10px 20px;
	border-radius: var(--hearth-radius-full);
	font-size: 14px;
	font-weight: 600;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease, transform 0.25s ease;
	z-index: 3000;
}

.hearth-points-toast .hearth-icon {
	fill: currentColor;
}

.hearth-points-toast.is-visible {
	opacity: 1;
	transform: translateX(-50%) translateY(0);
}

.hearth-composer,
.hearth-post {
	background: var(--hearth-card);
	border: 1px solid var(--hearth-border);
	border-radius: var(--hearth-radius);
	box-shadow: var(--hearth-shadow);
	padding: var(--hearth-space-4);
}

/* Landing here from a notification/email link with nothing marking which
   post it was about is as good as landing nowhere — this fades in instantly
   then transitions back out, so the eye catches it without a distracting
   blink animation. */
.hearth-post-highlighted {
	border-color: var(--hearth-link);
	box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.25);
	transition: border-color 1.2s ease, box-shadow 1.2s ease;
}

@media (prefers-reduced-motion: reduce) {
	.hearth-post-highlighted {
		transition: none;
	}
}

.hearth-composer-prompts {
	display: flex;
	flex-wrap: wrap;
	gap: var(--hearth-space-2);
	margin-bottom: var(--hearth-space-3);
}

.hearth-prompt-chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--hearth-bg);
	border: 1px solid var(--hearth-border);
	border-radius: var(--hearth-radius-full);
	padding: 6px 14px;
	font-size: 13px;
	color: var(--hearth-text-muted);
	cursor: pointer;
	transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.hearth-prompt-chip:hover {
	background: var(--hearth-active-bg);
	border-color: #d4dbe3;
	color: var(--hearth-text);
}

.hearth-composer textarea {
	width: 100%;
	min-height: 72px;
	border: none;
	resize: vertical;
	font-size: 15px;
	font-family: inherit;
	outline: none;
}

.hearth-composer-actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 8px;
}

.hearth-btn {
	border: 1px solid var(--hearth-border);
	background: var(--hearth-card);
	border-radius: var(--hearth-radius);
	padding: 8px 16px;
	font-size: 14px;
	cursor: pointer;
	transition: background 0.12s ease, border-color 0.12s ease;
}

.hearth-btn:hover {
	background: var(--hearth-active-bg);
}

.hearth-btn-primary {
	background: var(--hearth-primary);
	border-color: var(--hearth-primary);
	color: var(--hearth-primary-contrast);
	font-weight: 600;
}

.hearth-btn-primary:hover {
	background: var(--hearth-primary-hover);
	border-color: var(--hearth-primary-hover);
}

.hearth-btn-primary:disabled {
	opacity: 0.5;
	cursor: default;
}

.hearth-link-btn {
	background: none;
	border: none;
	color: var(--hearth-link);
	cursor: pointer;
	font-size: 13px;
	padding: 0;
}

.hearth-composer-locked-note {
	text-align: center;
	color: var(--hearth-text-muted);
	font-size: 14px;
	background: var(--hearth-card);
	border: 1px dashed var(--hearth-border);
	border-radius: var(--hearth-radius);
	padding: var(--hearth-space-4);
	margin: 0;
}

.hearth-welcome-banner {
	display: flex;
	align-items: flex-start;
	gap: var(--hearth-space-3);
	background: #eef6ff;
	border: 1px solid #cfe4fb;
	border-radius: var(--hearth-radius);
	padding: var(--hearth-space-4);
	margin-bottom: var(--hearth-space-4);
	animation: hearth-welcome-in 0.25s ease;
}

.hearth-welcome-icon {
	flex: none;
	width: 36px;
	height: 36px;
	border-radius: var(--hearth-radius-full);
	background: var(--hearth-link);
	color: #fff;
	display: flex;
	align-items: center;
	justify-content: center;
}

.hearth-welcome-icon .hearth-icon {
	fill: currentColor;
}

.hearth-welcome-body {
	flex: 1;
	min-width: 0;
}

.hearth-welcome-body strong {
	display: block;
	margin-bottom: 2px;
	font-size: 15px;
	color: var(--hearth-text);
}

.hearth-welcome-body p {
	margin: 0;
	color: var(--hearth-text-muted);
	font-size: 14px;
	line-height: 1.5;
}

.hearth-welcome-banner .hearth-btn {
	flex: none;
	align-self: center;
	white-space: nowrap;
}

.hearth-welcome-dismiss {
	flex: none;
	align-self: flex-start;
}

@keyframes hearth-welcome-in {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.hearth-welcome-banner {
		animation: none;
	}
}

@media (max-width: 480px) {
	.hearth-welcome-banner {
		flex-wrap: wrap;
	}

	.hearth-welcome-banner .hearth-btn {
		margin-left: 48px;
	}
}

.hearth-feed {
	display: flex;
	flex-direction: column;
	gap: var(--hearth-space-3);
}

.hearth-feed-empty {
	text-align: center;
	color: var(--hearth-text-muted);
	padding: 24px 0;
}

.hearth-skeleton-post {
	display: flex;
	gap: var(--hearth-space-3);
	padding: var(--hearth-space-4);
	background: var(--hearth-card);
	border: 1px solid var(--hearth-border);
	border-radius: var(--hearth-radius);
	box-shadow: var(--hearth-shadow);
	margin-bottom: var(--hearth-space-3);
}

.hearth-skeleton-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--hearth-bg);
	flex-shrink: 0;
	animation: hearth-shimmer 1.4s ease-in-out infinite;
}

.hearth-skeleton-lines {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 8px;
	justify-content: center;
}

.hearth-skeleton-line {
	height: 10px;
	border-radius: 4px;
	background: var(--hearth-bg);
	animation: hearth-shimmer 1.4s ease-in-out infinite;
}

@keyframes hearth-shimmer {
	0%, 100% {
		opacity: 0.6;
	}

	50% {
		opacity: 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.hearth-skeleton-avatar,
	.hearth-skeleton-line {
		animation: none;
	}
}

.hearth-post-header {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 10px;
}

.hearth-post-header-main {
	flex: 1;
	min-width: 0;
}

.hearth-post-admin-actions {
	display: flex;
	gap: 4px;
	flex-shrink: 0;
}

.hearth-btn-xs {
	width: 28px;
	height: 28px;
	font-size: 13px;
	padding: 0;
}

.hearth-pinned-badge {
	font-size: 12px;
}

.hearth-post-media,
.hearth-comment-media {
	margin-top: 10px;
}

.hearth-media-attachment,
.hearth-media-preview-item {
	max-width: 100%;
	max-height: 360px;
	border-radius: var(--hearth-radius);
	display: block;
}

.hearth-composer-media-preview {
	margin-top: 10px;
	position: relative;
	display: inline-block;
}

.hearth-media-remove-btn {
	display: block;
	margin-top: 4px;
	background: none;
	border: none;
	color: var(--hearth-danger);
	cursor: pointer;
	font-size: 12px;
	padding: 0;
}

.hearth-file-btn {
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.hearth-broadcast-toggle {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: var(--hearth-text-muted);
	margin-right: auto;
	margin-left: 8px;
	cursor: pointer;
}

.hearth-email-pref {
	display: flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: var(--hearth-text-muted);
	padding: 10px 0 0;
	border-top: 1px solid var(--hearth-border);
	margin-top: 10px;
	cursor: pointer;
}

.hearth-banned-badge {
	font-size: 11px;
	color: var(--hearth-danger);
	border: 1px solid var(--hearth-danger);
	border-radius: var(--hearth-radius-full);
	padding: 1px 8px;
}

.hearth-ban-btn {
	color: var(--hearth-danger);
	border-color: var(--hearth-danger);
}

.hearth-avatar {
	width: 40px;
	height: 40px;
	border-radius: 50%;
	object-fit: cover;
}

.hearth-avatar-sm {
	width: 28px;
	height: 28px;
}

.hearth-post-author-row,
.hearth-comment-author-row {
	display: flex;
	align-items: center;
	gap: 6px;
}

.hearth-post-author {
	font-weight: 600;
	font-size: 14px;
}

.hearth-post-time {
	font-size: 12px;
	color: var(--hearth-text-muted);
}

.hearth-post-content {
	font-size: 15px;
	line-height: 1.5;
	word-wrap: break-word;
}

.hearth-post-edit textarea {
	width: 100%;
	min-height: 72px;
	resize: vertical;
	font-size: 15px;
	font-family: inherit;
	border: 1px solid var(--hearth-border);
	border-radius: var(--hearth-radius-sm);
	padding: 8px 10px;
}

.hearth-post-edit-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 6px;
}

.hearth-post-footer {
	display: flex;
	gap: 16px;
	margin-top: 12px;
}

.hearth-reaction-btn,
.hearth-comment-toggle-btn {
	background: none;
	border: none;
	cursor: pointer;
	color: var(--hearth-text-muted);
	font-size: 13px;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 8px;
	border-radius: var(--hearth-radius-sm);
}

.hearth-reaction-btn:hover,
.hearth-comment-toggle-btn:hover {
	background: var(--hearth-bg);
}

.hearth-reaction-btn.is-active {
	color: var(--hearth-danger);
}

.hearth-reaction-btn.is-active .hearth-icon {
	fill: currentColor;
}

.hearth-comments {
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid var(--hearth-border);
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.hearth-comment-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.hearth-comment {
	display: flex;
	gap: 8px;
}

.hearth-comment-body {
	background: var(--hearth-bg);
	border-radius: var(--hearth-radius);
	padding: 8px 12px;
	flex: 1;
}

.hearth-comment-author {
	font-weight: 600;
	font-size: 13px;
}

.hearth-comment-content {
	font-size: 14px;
}

.hearth-comment-composer {
	display: flex;
	gap: 8px;
	margin-top: 8px;
}

.hearth-comment-composer input {
	flex: 1;
	border: 1px solid var(--hearth-border);
	border-radius: var(--hearth-radius);
	padding: 8px 10px;
	font-size: 14px;
}

.hearth-sort-tabs {
	display: flex;
	gap: 4px;
	margin-bottom: 4px;
}

.hearth-sort-tab {
	border: none;
	background: none;
	padding: 6px 12px;
	font-size: 14px;
	font-weight: 600;
	color: var(--hearth-text-muted);
	cursor: pointer;
	border-radius: var(--hearth-radius);
}

.hearth-sort-tab:hover {
	background: var(--hearth-active-bg);
}

.hearth-sort-tab.is-active {
	color: var(--hearth-primary);
	background: var(--hearth-active-bg);
}

.hearth-comment-footer-row {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 4px;
}

.hearth-reply-composer {
	display: flex;
	gap: 8px;
	margin-top: 8px;
	align-items: flex-start;
}

.hearth-reply-composer textarea {
	flex: 1;
	border: 1px solid var(--hearth-border);
	border-radius: var(--hearth-radius);
	padding: 8px 10px;
	font-size: 13px;
	font-family: inherit;
	min-height: 40px;
	resize: vertical;
}

.hearth-comment-replies {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 8px;
	padding-left: 16px;
	border-left: 2px solid var(--hearth-border);
}

.hearth-comment-replies:empty {
	margin: 0;
	border: none;
}

.hearth-profile-trigger {
	cursor: pointer;
}

.hearth-post-author.hearth-profile-trigger:hover,
.hearth-comment-author.hearth-profile-trigger:hover {
	text-decoration: underline;
}

a.hearth-mention {
	color: var(--hearth-link);
	font-weight: 600;
	text-decoration: none;
}

a.hearth-mention:hover {
	text-decoration: underline;
}

.hearth-space-icon {
	margin-right: 4px;
}

.hearth-space-cover-preview {
	position: relative;
	margin-top: 6px;
	max-width: 220px;
}

.hearth-space-cover-preview img {
	width: 100%;
	border-radius: var(--hearth-radius);
	display: block;
}

.hearth-space-cover-preview .hearth-icon-btn {
	position: absolute;
	top: 4px;
	right: 4px;
	background: rgba(0, 0, 0, 0.5);
	color: #fff;
	border-radius: 50%;
}

.hearth-file-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	margin-top: 6px;
	width: fit-content;
}

.hearth-load-more {
	align-self: center;
}

.hearth-notifications-panel {
	position: fixed;
	top: 0;
	right: 0;
	height: 100vh;
	width: 320px;
	background: var(--hearth-card);
	border-left: 1px solid var(--hearth-border);
	box-shadow: -4px 0 16px rgba(0, 0, 0, 0.08);
	padding: 16px;
	overflow-y: auto;
	z-index: 1000;
}

.hearth-panel-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.hearth-panel-actions {
	margin: 8px 0 12px;
}

.hearth-notification {
	display: flex;
	gap: 8px;
	padding: 10px 0;
	border-bottom: 1px solid var(--hearth-border);
}

.hearth-notification.is-unread {
	background: #eef4ff;
}

.hearth-notification-message {
	font-size: 13px;
}

.hearth-notification-time {
	font-size: 11px;
	color: var(--hearth-text-muted);
}

.hearth-pending-actions {
	display: flex;
	gap: 8px;
	margin-top: 6px;
}

.hearth-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2000;
}

.hearth-modal {
	background: var(--hearth-card);
	border-radius: var(--hearth-radius);
	padding: 20px;
	width: 90%;
	max-width: 420px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.hearth-field-label {
	font-size: 13px;
	font-weight: 600;
	margin-top: 10px;
}

.hearth-modal input[type="text"],
.hearth-modal textarea,
.hearth-modal select {
	border: 1px solid var(--hearth-border);
	border-radius: var(--hearth-radius);
	padding: 8px 10px;
	font-size: 14px;
	font-family: inherit;
	width: 100%;
}

.hearth-modal textarea {
	min-height: 60px;
	resize: vertical;
}

.hearth-modal-actions {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: var(--hearth-space-3);
	margin-top: 14px;
}

.hearth-danger-link {
	margin-right: auto;
	color: var(--hearth-danger);
	font-size: 13px;
}

.hearth-space-edit-btn {
	width: 24px;
	height: 24px;
	flex-shrink: 0;
}

.hearth-field-error {
	color: var(--hearth-danger);
	font-size: 13px;
	margin: 4px 0 0;
}

.hearth-profile-modal {
	max-width: 440px;
	position: relative;
	gap: 10px;
}

.hearth-modal-close {
	position: absolute;
	top: 10px;
	right: 10px;
}

.hearth-profile-modal-header {
	display: flex;
	align-items: center;
	gap: 14px;
}

.hearth-avatar-lg {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	object-fit: cover;
}

.hearth-profile-modal-name {
	font-size: 18px;
	font-weight: 700;
}

.hearth-profile-modal-meta {
	font-size: 13px;
	color: var(--hearth-text-muted);
	margin-top: 2px;
}

.hearth-profile-modal-bio-row {
	display: flex;
	align-items: flex-start;
	gap: 6px;
}

.hearth-profile-modal-bio {
	flex: 1;
	font-size: 14px;
	color: var(--hearth-text);
	white-space: pre-wrap;
}

.hearth-profile-modal-bio:empty::before {
	content: "未填寫簡介。";
	color: var(--hearth-text-muted);
	font-style: italic;
}

.hearth-profile-bio-edit textarea {
	width: 100%;
	min-height: 64px;
	resize: vertical;
	font-size: 14px;
	font-family: inherit;
	border: 1px solid var(--hearth-border);
	border-radius: var(--hearth-radius-sm);
	padding: 8px 10px;
}

.hearth-profile-bio-edit-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	margin-top: 6px;
}

.hearth-profile-modal h4 {
	font-size: 13px;
	color: var(--hearth-text-muted);
	margin: 4px 0 0;
}

.hearth-profile-modal-posts {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 240px;
	overflow-y: auto;
}

.hearth-profile-modal-post {
	background: var(--hearth-bg);
	border-radius: var(--hearth-radius);
	padding: 8px 10px;
	font-size: 13px;
}

.is-hidden {
	display: none !important;
}

.hearth-app.hearth-login-app {
	display: block;
	max-width: 480px;
}

.hearth-login-prompt {
	text-align: center;
	background: var(--hearth-card);
	border: 1px solid var(--hearth-border);
	border-radius: var(--hearth-radius-lg);
	box-shadow: var(--hearth-shadow);
	padding: var(--hearth-space-6) var(--hearth-space-5);
	margin: var(--hearth-space-6) auto;
}

.hearth-login-avatars {
	display: flex;
	justify-content: center;
	margin-bottom: var(--hearth-space-4);
}

.hearth-login-avatars .hearth-avatar {
	width: 44px;
	height: 44px;
	margin-left: -12px;
	border: 2px solid var(--hearth-card);
	box-shadow: 0 0 0 1px var(--hearth-border);
}

.hearth-login-avatars .hearth-avatar:first-child {
	margin-left: 0;
}

.hearth-login-prompt h2 {
	margin: 0 0 8px;
	font-size: 22px;
}

.hearth-login-subtitle {
	color: var(--hearth-text-muted);
	font-size: 14px;
	margin: 0 0 var(--hearth-space-5);
}

.hearth-login-actions {
	display: flex;
	justify-content: center;
	gap: var(--hearth-space-2);
}

@media (max-width: 720px) {
	.hearth-app {
		grid-template-columns: 1fr;
	}

	/* Categories need to be visible at a glance, not buried below the whole
	   feed — a full vertical list did that, so on mobile it collapses into a
	   compact horizontal scroll strip and moves back above the feed. */
	.hearth-sidebar {
		order: 0;
		position: static;
		padding: var(--hearth-space-3);
		/* A grid item's default min-width is its content's natural width, so
		   without this the sidebar itself grows to fit every chip instead of
		   respecting the grid column — which stretches the whole page into a
		   horizontal scroll instead of containing it inside the chip strip. */
		min-width: 0;
	}

	.hearth-main {
		order: 1;
	}

	.hearth-sidebar-header {
		margin-bottom: 8px;
	}

	.hearth-space-list {
		flex-direction: row;
		overflow-x: auto;
		gap: 8px;
		padding-bottom: 2px;
		-webkit-overflow-scrolling: touch;
		min-width: 0;
	}

	.hearth-space-item {
		flex: none;
		white-space: nowrap;
		border-radius: var(--hearth-radius-full);
		border-left: none;
		background: var(--hearth-bg);
	}

	.hearth-space-item.is-active {
		background: var(--hearth-primary);
		color: var(--hearth-primary-contrast);
	}

	.hearth-space-member-count {
		margin-left: 2px;
	}

	.hearth-composer-actions {
		flex-wrap: wrap;
	}

	.hearth-broadcast-toggle {
		order: 3;
		flex-basis: 100%;
		margin-left: 0;
		margin-top: 4px;
	}

	.hearth-composer-actions .hearth-btn-primary {
		margin-left: auto;
	}
}

/* ---- Members / leaderboard page --------------------------------------- */

.hearth-members-app {
	grid-template-columns: 1fr;
	max-width: 860px;
}

.hearth-members-main {
	gap: 24px;
}

.hearth-leaderboard-card,
.hearth-members-card {
	background: var(--hearth-card);
	border: 1px solid var(--hearth-border);
	border-radius: var(--hearth-radius);
	padding: 20px;
}

.hearth-my-progress-card {
	display: flex;
	align-items: center;
	gap: 16px;
	background: var(--hearth-card);
	border: 1px solid var(--hearth-border);
	border-radius: var(--hearth-radius);
	padding: 16px 20px;
}

.hearth-my-progress-body {
	flex: 1;
	min-width: 0;
}

.hearth-my-progress-header {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
}

.hearth-my-progress-points {
	font-weight: 700;
	font-size: 15px;
}

.hearth-leaderboard-header,
.hearth-members-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 16px;
}

.hearth-leaderboard-header h2,
.hearth-members-header h2 {
	margin: 0;
	font-size: 18px;
}

.hearth-range-tabs {
	display: flex;
	gap: 4px;
	background: var(--hearth-bg);
	border-radius: var(--hearth-radius);
	padding: 4px;
}

.hearth-range-tab {
	border: none;
	background: none;
	padding: 6px 12px;
	border-radius: var(--hearth-radius-sm);
	font-size: 13px;
	cursor: pointer;
	color: var(--hearth-text-muted);
}

.hearth-range-tab.is-active {
	background: var(--hearth-card);
	color: var(--hearth-text);
	font-weight: 600;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.hearth-leaderboard-list,
.hearth-members-list {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.hearth-leaderboard-row,
.hearth-member-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 8px;
	border-radius: var(--hearth-radius);
}

.hearth-leaderboard-row:hover,
.hearth-member-row:hover {
	background: var(--hearth-bg);
}

.hearth-leaderboard-row.is-self,
.hearth-member-row.is-self {
	background: var(--hearth-active-bg);
	box-shadow: inset 2px 0 0 var(--hearth-link);
}

.hearth-rank {
	width: 32px;
	font-weight: 700;
	color: var(--hearth-text-muted);
	font-size: 13px;
}

.hearth-rank-1 .hearth-rank {
	color: #d4af37;
}

.hearth-rank-2 .hearth-rank {
	color: #9aa0a6;
}

.hearth-rank-3 .hearth-rank {
	color: #b08d57;
}

.hearth-member-name {
	flex: 1;
	font-weight: 600;
	font-size: 14px;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.hearth-member-info {
	flex: 1;
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}

.hearth-member-info .hearth-member-name {
	flex: initial;
}

.hearth-points {
	font-size: 13px;
	color: var(--hearth-text-muted);
	white-space: nowrap;
}

.hearth-level-badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 26px;
	height: 20px;
	padding: 0 6px;
	border-radius: var(--hearth-radius-full);
	font-size: 11px;
	font-weight: 700;
	color: #fff;
	background: #9aa0a6;
}

.hearth-level-1 { background: #9aa0a6; }
.hearth-level-2 { background: #6b9fd4; }
.hearth-level-3 { background: #4c8bf5; }
.hearth-level-4 { background: #34a853; }
.hearth-level-5 { background: #f4b400; }
.hearth-level-6 { background: #f68c1f; }
.hearth-level-7 { background: #e05d44; }
.hearth-level-8 { background: #b23a9c; }
.hearth-level-9 { background: #7c3aed; }

.hearth-members-controls {
	display: flex;
	gap: 8px;
}

.hearth-members-controls input,
.hearth-members-controls select {
	border: 1px solid var(--hearth-border);
	border-radius: var(--hearth-radius);
	padding: 6px 10px;
	font-size: 13px;
	font-family: inherit;
}

/* ---- Classroom --------------------------------------------------------- */

.hearth-classroom-app {
	grid-template-columns: 1fr;
	max-width: 1100px;
}

.hearth-course-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 16px;
}

.hearth-course-card {
	background: var(--hearth-card);
	border: 1px solid var(--hearth-border);
	border-radius: var(--hearth-radius);
	overflow: hidden;
	cursor: pointer;
	transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.hearth-course-card:hover {
	transform: translateY(-2px);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.hearth-course-cover {
	height: 120px;
	background: linear-gradient(135deg, #4c8bf5, #7c3aed);
	background-size: cover;
	background-position: center;
}

.hearth-course-card-body {
	padding: 14px;
}

.hearth-course-card-title {
	margin: 0 0 4px;
	font-size: 15px;
}

.hearth-course-card-excerpt {
	margin: 0 0 10px;
	font-size: 13px;
	color: var(--hearth-text-muted);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.hearth-progress-bar {
	height: 6px;
	background: var(--hearth-bg);
	border-radius: var(--hearth-radius-full);
	overflow: hidden;
	margin-bottom: 6px;
}

.hearth-progress-bar-fill {
	height: 100%;
	background: var(--hearth-primary);
	border-radius: var(--hearth-radius-full);
}

.hearth-progress-label {
	font-size: 12px;
	color: var(--hearth-text-muted);
}

.hearth-back-btn {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-bottom: 16px;
}

.hearth-course-detail-layout {
	display: grid;
	grid-template-columns: 240px minmax(0, 1fr);
	gap: 20px;
}

.hearth-lesson-sidebar {
	background: var(--hearth-card);
	border: 1px solid var(--hearth-border);
	border-radius: var(--hearth-radius);
	padding: 16px;
	align-self: start;
}

.hearth-lesson-sidebar h3 {
	margin: 0 0 12px;
	font-size: 15px;
}

.hearth-lesson-list {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.hearth-lesson-item {
	display: flex;
	align-items: center;
	gap: 8px;
	text-align: left;
	background: none;
	border: none;
	border-radius: var(--hearth-radius);
	padding: 8px;
	font-size: 13px;
	cursor: pointer;
	color: var(--hearth-text);
}

.hearth-lesson-item:hover {
	background: var(--hearth-bg);
}

.hearth-lesson-item.is-active {
	background: var(--hearth-bg);
	font-weight: 600;
}

.hearth-lesson-item.is-completed .hearth-lesson-check {
	color: #16a34a;
}

.hearth-lesson-viewer {
	background: var(--hearth-card);
	border: 1px solid var(--hearth-border);
	border-radius: var(--hearth-radius);
	padding: 20px;
}

.hearth-lesson-viewer-title {
	margin: 0 0 16px;
	font-size: 20px;
}

.hearth-lesson-video {
	position: relative;
	width: 100%;
	padding-top: 56.25%;
	margin-bottom: 16px;
	border-radius: var(--hearth-radius);
	overflow: hidden;
	background: #000;
}

.hearth-lesson-video iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: none;
}

.hearth-lesson-content {
	font-size: 15px;
	line-height: 1.6;
	margin-bottom: 20px;
}

.hearth-complete-btn.is-completed {
	background: #16a34a;
	border-color: #16a34a;
}

@media (max-width: 720px) {
	.hearth-course-detail-layout {
		grid-template-columns: 1fr;
	}
}

/* ---- Calendar ----------------------------------------------------------- */

.hearth-calendar-app {
	grid-template-columns: 360px minmax(0, 1fr);
	max-width: 1100px;
	align-items: start;
}

.hearth-calendar-card,
.hearth-events-card {
	background: var(--hearth-card);
	border: 1px solid var(--hearth-border);
	border-radius: var(--hearth-radius);
	padding: 16px;
}

.hearth-calendar-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.hearth-calendar-header h2 {
	margin: 0;
	font-size: 15px;
}

.hearth-calendar-weekdays,
.hearth-calendar-grid {
	display: grid;
	grid-template-columns: repeat(7, 1fr);
	gap: 4px;
	text-align: center;
}

.hearth-calendar-weekdays {
	font-size: 11px;
	color: var(--hearth-text-muted);
	margin-bottom: 6px;
}

.hearth-calendar-day {
	position: relative;
	aspect-ratio: 1;
	border: none;
	background: none;
	border-radius: var(--hearth-radius);
	font-size: 13px;
	cursor: pointer;
	color: var(--hearth-text);
}

.hearth-calendar-day.is-empty {
	cursor: default;
}

.hearth-calendar-day:not(.is-empty):hover {
	background: var(--hearth-bg);
}

.hearth-calendar-day.is-today {
	font-weight: 700;
	color: var(--hearth-primary);
}

.hearth-calendar-day.is-selected {
	background: var(--hearth-primary);
	color: var(--hearth-primary-contrast);
}

.hearth-calendar-day.has-event::after {
	content: '';
	position: absolute;
	bottom: 4px;
	left: 50%;
	transform: translateX(-50%);
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background: var(--hearth-primary);
}

.hearth-calendar-day.is-selected.has-event::after {
	background: var(--hearth-primary-contrast);
}

.hearth-events-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 12px;
}

.hearth-events-header h2 {
	margin: 0;
	font-size: 16px;
}

.hearth-events-list {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.hearth-event-card {
	display: flex;
	gap: 14px;
	align-items: center;
	border: 1px solid var(--hearth-border);
	border-radius: var(--hearth-radius);
	padding: 12px;
}

.hearth-event-date-block {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	flex-shrink: 0;
	border-radius: var(--hearth-radius);
	background: var(--hearth-bg);
}

.hearth-event-date-month {
	font-size: 10px;
	font-weight: 700;
	color: var(--hearth-primary);
}

.hearth-event-date-day {
	font-size: 18px;
	font-weight: 700;
}

.hearth-event-body {
	flex: 1;
	min-width: 0;
}

.hearth-event-title {
	margin: 0 0 2px;
	font-size: 15px;
}

.hearth-event-time,
.hearth-event-location {
	font-size: 12px;
	color: var(--hearth-text-muted);
}

.hearth-event-excerpt {
	margin: 6px 0 0;
	font-size: 13px;
	color: var(--hearth-text-muted);
}

.hearth-event-actions {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
	flex-shrink: 0;
}

.hearth-event-going-count {
	font-size: 11px;
	color: var(--hearth-text-muted);
}

.hearth-rsvp-btn.is-going {
	background: #16a34a;
	border-color: #16a34a;
	color: #fff;
}

@media (max-width: 720px) {
	.hearth-calendar-app {
		grid-template-columns: 1fr;
	}

	.hearth-event-card {
		flex-wrap: wrap;
	}

	.hearth-event-actions {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		margin-left: 66px;
	}
}
