.community-panel {
	--chart-height: 13.5rem;
	--chart-baseline: 2rem;
	--heat-color: #b54c15;
}

:root[data-theme='light'] .community-panel { --heat-color: #ffaa62; }

.community-source { color: var(--muted); font-size: .84rem; line-height: 1.5; }
.community-note { margin-top: .8rem; color: var(--muted); font-size: .9rem; line-height: 1.55; }
.community-state { padding: 1.35rem 0; color: var(--muted); line-height: 1.55; }
.community-distribution-notes { display: grid; gap: .25rem; margin-top: 1rem; }
.community-distribution-notes .community-note { margin: 0; }

.community-modes, .community-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: end;
	gap: .5rem;
	margin-top: 1rem;
}

.community-modes { padding-bottom: .85rem; border-bottom: 1px solid var(--line); }
.community-modes button {
	padding: .54rem .75rem;
	font-size: .88rem;
}

.community-modes button[aria-pressed='true'] {
	background: color-mix(in srgb, var(--accent) 14%, var(--surface));
	color: var(--accent);
	border-color: color-mix(in srgb, var(--accent) 70%, var(--line));
}

.community-field { display: grid; gap: .3rem; min-width: min(100%, 13rem); }
.community-field span { color: var(--muted); font-size: .88rem; font-weight: 650; }
.community-field select { padding: .52rem .65rem; width: 100%; font-size: .92rem; }
.community-panel :is(button, select, summary, [tabindex]):focus-visible { outline-offset: 2px; }
.community-table:focus-visible, .community-heatmap-scroll:focus-visible, .community-plot-scroll:focus-visible {
	outline: 2px solid var(--accent);
}

.community-table table { min-width: 33rem; }
.community-table :is(th, td) { padding-inline: .65rem; white-space: nowrap; }
.community-table :is(th, td):is(:nth-child(2), :nth-child(3)) { text-align: left; }
.community-table tbody tr:hover { background: var(--soft); }
.community-table tbody tr.community-ranking-match {
	background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}
.community-table tbody td:last-child { color: var(--accent); font-weight: 750; }
/* 랭킹 캐릭터 셀의 위아래에 여백을 더해 행 간격을 넓힌다. */
.community-table tbody td:has(> .community-ranked-character) { padding-block: .75rem; }
.community-ranked-character { display: inline-flex; align-items: center; gap: .45rem; vertical-align: middle; }
.community-ranked-portrait { width: 4.125rem; height: 4.125rem; flex: none; }
.community-ranked-portrait img { display: block; width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.community-profile-link {
	padding: .15rem .15rem .15rem 0;
	border: 0;
	background: transparent;
	color: var(--text);
	text-align: left;
}
.community-profile-link:hover { color: var(--accent); text-decoration: underline; }
.community-item { display: inline-flex; gap: .38rem; align-items: center; vertical-align: middle; }
.community-item img { margin-right: 0; width: 1.85rem; height: 1.85rem; flex: none; }
/* 집계 시각은 사냥·보스 버튼 오른쪽에 놓고 좁으면 다음 줄로 보낸다. */
.community-ranking-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .5rem 1rem;
	padding-bottom: .85rem;
	border-bottom: 1px solid var(--line);
}
.community-ranking-header > .community-modes { margin: 0; padding: 0; border: 0; }
.community-ranking-header > .community-source { margin-inline-start: auto; text-align: end; }
.community-ranking-search { display: flex; gap: .4rem; max-width: 100%; }
.community-ranking-search :is(input, button) { padding: .52rem .65rem; font-size: .92rem; }
.community-ranking-search button { flex: none; }
.community-ranking-search input { width: min(10rem, 100%); }
.community-ranking-search-status { flex: 1 0 100%; color: var(--muted); font-size: .88rem; }
.community-ranking-search-status:empty { display: none; }
.community-filters:has(.community-ranking-search) + .community-table { margin-top: .65rem; }

.community-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .4rem;
	margin-top: .55rem;
	padding: .9rem 0 .15rem;
	border-top: 1px solid var(--line);
	font-size: .88rem;
	font-variant-numeric: tabular-nums;
}
.community-pagination button.secondary {
	display: grid;
	place-items: center;
	width: 2rem;
	height: 2.4rem;
	padding: 0;
	border: 0;
	background: transparent;
	font-size: 1.55rem;
	font-weight: 500;
	line-height: 1;
}
.community-pagination button:not(:disabled):hover { background: var(--soft); }
.community-page-index, .community-page-size select { height: 2.4rem; font-weight: 650; }
.community-page-index { width: 6.2rem; padding: .4rem .7rem; }
.community-page-count { white-space: nowrap; }
.community-page-size { position: relative; }
.community-page-size select { appearance: none; padding: .4rem 1.75rem .4rem .72rem; background: var(--soft); }
.community-page-size::before, .community-page-size::after {
	position: absolute;
	right: .76rem;
	width: .28rem;
	height: .28rem;
	border: solid var(--muted);
	border-width: 1px 1px 0 0;
	content: '';
	pointer-events: none;
}
.community-page-size::before { top: calc(50% - .3rem); transform: rotate(-45deg); }
.community-page-size::after { bottom: calc(50% - .3rem); transform: rotate(135deg); }

.community-axis-labels {
	display: flex;
	flex-wrap: wrap;
	gap: .25rem 1rem;
	margin: 1rem 0 .55rem;
	color: var(--muted);
	font-size: .85rem;
	line-height: 1.5;
}
.community-axis-labels strong { color: var(--text); }
.community-filters + :is(.community-histogram, .community-heatmap-scroll) { margin-top: .95rem; }
.community-chart { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .6rem; padding: 0 .45rem; }
.community-axis {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	flex-direction: column;
	height: calc(var(--chart-height) + 1em);
	font-size: .78rem;
	line-height: 1;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}

.community-plot-scroll { overflow-x: auto; padding-top: .4rem; }
.community-plot {
	position: relative;
	height: var(--chart-height);
	margin-bottom: var(--chart-baseline);
	border-bottom: 1px solid var(--line);
	background: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px 25%);
}

.community-column { display: flex; position: absolute; inset-block: 0; align-items: end; justify-content: center; }
.community-bar {
	display: block;
	width: min(75%, 3rem);
	border-radius: .25rem .25rem 0 0;
	background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 62%, var(--action)));
}
.community-column:hover .community-bar { filter: brightness(1.2); }
.community-tick-label {
	position: absolute;
	top: calc(100% + .35rem);
	color: var(--muted);
	font-size: .78rem;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}
.community-chart-data { margin-top: .8rem; }
.community-chart-data .community-table table { min-width: 17rem; }

.community-frequency { display: grid; gap: .6rem; margin: 0; padding: 0; list-style: none; }
.community-frequency li {
	display: grid;
	grid-template-columns: minmax(8rem, 1.2fr) minmax(2rem, 3fr) minmax(7rem, 1fr);
	align-items: center;
	gap: .8rem;
	margin: 0;
	padding: .28rem 0;
	font-size: .9rem;
}
.community-frequency-track, .community-frequency-track span { display: block; height: .57rem; border-radius: 1rem; }
.community-frequency-track { background: var(--soft); }
.community-frequency-track span { background: var(--accent); }
.community-frequency-value { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }

.community-heatmap-scroll { overflow: auto; border: 1px solid var(--line); border-radius: .55rem; }
.community-heatmap { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .88rem; }
.community-heatmap :is(th, td) {
	border-bottom: 1px solid var(--line);
	border-right: 1px solid var(--line);
	padding: .55rem .64rem;
	text-align: right;
	white-space: nowrap;
}
.community-heatmap tr > :first-child { position: sticky; left: 0; text-align: start; background: var(--surface); }
.community-heatmap :is(thead th, thead th:first-child) { background: var(--soft); }
.community-heatmap tr > :last-child { border-right: 0; }
.community-heatmap tbody tr:last-child > * { border-bottom: 0; }
.community-heatmap td {
	background: color-mix(in srgb, var(--heat-color) var(--heat-intensity), var(--surface));
	font-variant-numeric: tabular-nums;
}
.community-heatmap small { display: block; color: var(--muted); font-size: .75rem; margin-top: .13rem; }

@media (max-width: 36rem) {
	.community-frequency li { grid-template-columns: minmax(5.7rem, 1.5fr) minmax(1.5rem, 2fr) max-content; gap: .4rem; }
	.community-field { flex: 1 1 10rem; }
	.community-chart { padding: 0; }
	.community-page-index { width: 4.3rem; }
	.community-pagination button.secondary { width: 1.7rem; }
}
