/**
 * Chilli Fortnite Database — interactive map styles.
 *
 * Everything is scoped to .cfd-map-* so the host theme is never touched.
 * No bare element selectors (body, button, h1) are used anywhere.
 */

.cfd-map-page,
.cfd-map-app,
.cfd-map-compare,
.cfd-map-history,
.cfd-map-list,
.cfd-map-unavailable {
	--cfd-map-bg: #0d1220;
	--cfd-map-panel: #151c2e;
	--cfd-map-panel-2: #1c2438;
	--cfd-map-border: #2a3450;
	--cfd-map-text: #e8ecf7;
	--cfd-map-muted: #9aa6c2;
	--cfd-map-accent: #22d3ee;
	--cfd-map-accent-2: #7c5cff;
	--cfd-map-radius: 12px;
	--cfd-map-height: 680px;
	--cfd-map-height-mobile: 460px;
	box-sizing: border-box;
	color: var(--cfd-map-text);
	font-size: 15px;
	line-height: 1.5;
}

.cfd-map-app *,
.cfd-map-compare *,
.cfd-map-history *,
.cfd-map-list * {
	box-sizing: border-box;
}

.cfd-map-app--light,
.cfd-map-compare.cfd-map-app--light {
	--cfd-map-bg: #f4f6fb;
	--cfd-map-panel: #ffffff;
	--cfd-map-panel-2: #eef1f8;
	--cfd-map-border: #d6dced;
	--cfd-map-text: #16203a;
	--cfd-map-muted: #5a6786;
}

@media (prefers-color-scheme: light) {
	.cfd-map-app--auto {
		--cfd-map-bg: #f4f6fb;
		--cfd-map-panel: #ffffff;
		--cfd-map-panel-2: #eef1f8;
		--cfd-map-border: #d6dced;
		--cfd-map-text: #16203a;
		--cfd-map-muted: #5a6786;
	}
}

/* ---------------------------------------------------------------- Header */

.cfd-map-header {
	margin-bottom: 12px;
}

.cfd-map-title {
	color: var(--cfd-map-text);
	font-size: 1.4rem;
	line-height: 1.25;
	margin: 0;
}

.cfd-map-subtitle {
	color: var(--cfd-map-muted);
	font-size: 0.85rem;
	margin: 4px 0 0;
}

/* ---------------------------------------------------------------- Layout */

.cfd-map-layout {
	background: var(--cfd-map-bg);
	border: 1px solid var(--cfd-map-border);
	border-radius: var(--cfd-map-radius);
	display: grid;
	gap: 0;
	grid-template-columns: 280px 1fr;
	overflow: hidden;
}

.cfd-map-sidebar {
	background: var(--cfd-map-panel);
	border-right: 1px solid var(--cfd-map-border);
	max-height: var(--cfd-map-height);
	overflow-y: auto;
}

.cfd-map-sidebar-inner {
	padding: 16px;
}

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

.cfd-map-sidebar-title {
	font-size: 0.78rem;
	letter-spacing: 0.08em;
	margin: 0;
	text-transform: uppercase;
}

.cfd-map-sidebar-close {
	background: none;
	border: 0;
	color: var(--cfd-map-muted);
	cursor: pointer;
	display: none;
	font-size: 1.4rem;
	line-height: 1;
	padding: 4px 8px;
}

.cfd-map-stage {
	position: relative;
}

/* ---------------------------------------------------------------- Canvas */

.cfd-map-canvas {
	background: var(--cfd-map-bg);
	height: var(--cfd-map-height);
	width: 100%;
}

.cfd-map-canvas:focus-visible {
	outline: 3px solid var(--cfd-map-accent);
	outline-offset: -3px;
}

.cfd-map-loading {
	color: var(--cfd-map-muted);
	padding: 24px;
	text-align: center;
}

.cfd-map-status {
	bottom: 8px;
	color: var(--cfd-map-muted);
	font-size: 0.75rem;
	left: 12px;
	margin: 0;
	position: absolute;
	z-index: 500;
}

/* -------------------------------------------------------------- Controls */

.cfd-map-controls {
	display: flex;
	flex-direction: column;
	gap: 6px;
	position: absolute;
	right: 12px;
	top: 12px;
	z-index: 600;
}

.cfd-map-control {
	align-items: center;
	background: var(--cfd-map-panel);
	border: 1px solid var(--cfd-map-border);
	border-radius: 8px;
	color: var(--cfd-map-text);
	cursor: pointer;
	display: flex;
	font-size: 1.05rem;
	height: 38px;
	justify-content: center;
	line-height: 1;
	transition: background-color 0.15s ease, transform 0.15s ease;
	width: 38px;
}

.cfd-map-control:hover {
	background: var(--cfd-map-panel-2);
}

.cfd-map-control:focus-visible {
	outline: 3px solid var(--cfd-map-accent);
	outline-offset: 2px;
}

.cfd-map-btn {
	background: var(--cfd-map-panel-2);
	border: 1px solid var(--cfd-map-border);
	border-radius: 8px;
	color: var(--cfd-map-text);
	cursor: pointer;
	display: inline-block;
	font-size: 0.82rem;
	padding: 8px 12px;
	text-align: center;
	text-decoration: none;
}

.cfd-map-btn:hover {
	border-color: var(--cfd-map-accent);
	color: var(--cfd-map-text);
}

.cfd-map-btn:focus-visible {
	outline: 3px solid var(--cfd-map-accent);
	outline-offset: 2px;
}

.cfd-map-btn--primary {
	background: linear-gradient(135deg, var(--cfd-map-accent), var(--cfd-map-accent-2));
	border-color: transparent;
	color: #08111f;
	font-weight: 600;
}

/* ---------------------------------------------------------------- Search */

.cfd-map-search {
	margin-bottom: 14px;
	position: relative;
}

.cfd-map-search-input {
	background: var(--cfd-map-panel-2);
	border: 1px solid var(--cfd-map-border);
	border-radius: 8px;
	color: var(--cfd-map-text);
	font-size: 0.9rem;
	padding: 9px 12px;
	width: 100%;
}

.cfd-map-search-input:focus-visible {
	border-color: var(--cfd-map-accent);
	outline: 2px solid var(--cfd-map-accent);
}

.cfd-map-search-results {
	display: none;
	list-style: none;
	margin: 6px 0 0;
	max-height: 220px;
	overflow-y: auto;
	padding: 0;
}

.cfd-map-search-results.is-open {
	display: block;
}

.cfd-map-search-result {
	align-items: center;
	background: none;
	border: 0;
	border-radius: 6px;
	color: var(--cfd-map-text);
	cursor: pointer;
	display: flex;
	gap: 8px;
	padding: 7px 8px;
	text-align: left;
	width: 100%;
}

.cfd-map-search-result:hover {
	background: var(--cfd-map-panel-2);
}

.cfd-map-search-empty {
	color: var(--cfd-map-muted);
	font-size: 0.82rem;
	padding: 8px;
}

/* --------------------------------------------------------------- Filters */

.cfd-map-filter-actions {
	display: flex;
	gap: 6px;
	margin-bottom: 10px;
}

.cfd-map-filter-actions .cfd-map-btn {
	flex: 1 1 auto;
}

.cfd-map-filter-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.cfd-map-filter-label {
	align-items: center;
	border-radius: 6px;
	cursor: pointer;
	display: flex;
	gap: 8px;
	padding: 6px 6px;
}

.cfd-map-filter-label:hover {
	background: var(--cfd-map-panel-2);
}

.cfd-map-filter-input:focus-visible {
	outline: 3px solid var(--cfd-map-accent);
	outline-offset: 2px;
}

.cfd-map-filter-name {
	flex: 1 1 auto;
	font-size: 0.87rem;
}

.cfd-map-filter-count {
	color: var(--cfd-map-muted);
	font-size: 0.75rem;
}

.cfd-map-filter-empty {
	color: var(--cfd-map-muted);
	font-size: 0.82rem;
}

.cfd-map-swatch {
	background: var(--cfd-map-swatch, #22d3ee);
	border-radius: 50%;
	display: inline-block;
	flex: 0 0 auto;
	height: 12px;
	width: 12px;
}

.cfd-map-sidebar-links {
	border-top: 1px solid var(--cfd-map-border);
	display: flex;
	gap: 6px;
	margin-top: 14px;
	padding-top: 14px;
}

.cfd-map-sidebar-links .cfd-map-btn {
	flex: 1 1 auto;
}

/* --------------------------------------------------------------- Markers */

.cfd-map-pin {
	background: var(--cfd-map-pin, #22d3ee);
	border: 2px solid rgba(255, 255, 255, 0.85);
	border-radius: 50%;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
	display: block;
	height: 18px;
	margin: 2px;
	width: 18px;
}

.cfd-map-cluster {
	align-items: center;
	background: linear-gradient(135deg, var(--cfd-map-accent), var(--cfd-map-accent-2));
	border-radius: 50%;
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
	color: #08111f;
	display: flex;
	font-size: 0.8rem;
	font-weight: 700;
	height: 38px;
	justify-content: center;
	width: 38px;
}

.cfd-map-popup {
	max-width: 260px;
}

.cfd-map-popup-title {
	font-size: 0.98rem;
	margin: 0 0 6px;
}

.cfd-map-popup-image {
	border-radius: 8px;
	display: block;
	height: auto;
	margin-bottom: 6px;
	max-width: 100%;
}

.cfd-map-popup-desc {
	margin: 0 0 6px;
}

.cfd-map-popup-meta {
	font-size: 0.8rem;
	list-style: none;
	margin: 0 0 6px;
	padding: 0;
}

.cfd-map-popup-link {
	font-size: 0.82rem;
	font-weight: 600;
}

/* ------------------------------------------------------------- Mobile UI */

.cfd-map-mobilebar {
	display: none;
}

.cfd-map-mobilebar-btn {
	background: var(--cfd-map-panel);
	border: 1px solid var(--cfd-map-border);
	border-radius: 8px;
	color: var(--cfd-map-text);
	cursor: pointer;
	flex: 1 1 auto;
	font-size: 0.82rem;
	padding: 10px 6px;
}

.cfd-map-mobilebar-btn:focus-visible {
	outline: 3px solid var(--cfd-map-accent);
	outline-offset: 2px;
}

/* ----------------------------------------------------------- Fullscreen */

.cfd-map-app.is-pseudo-fullscreen {
	background: var(--cfd-map-bg);
	bottom: 0;
	left: 0;
	margin: 0;
	padding: 12px;
	position: fixed;
	right: 0;
	top: 0;
	z-index: 99999;
}

.cfd-map-app.is-pseudo-fullscreen .cfd-map-canvas,
.cfd-map-app:fullscreen .cfd-map-canvas,
.cfd-map-app.is-pseudo-fullscreen .cfd-map-sidebar,
.cfd-map-app:fullscreen .cfd-map-sidebar {
	height: calc(100vh - 90px);
	max-height: calc(100vh - 90px);
}

/* ------------------------------------------------------------- History */

.cfd-map-history-head {
	margin-bottom: 16px;
}

.cfd-map-history-title {
	font-size: 1.5rem;
	margin: 0;
}

.cfd-map-history-intro {
	color: var(--cfd-map-muted);
	margin: 6px 0 0;
}

.cfd-map-timeline {
	background: var(--cfd-map-panel);
	border: 1px solid var(--cfd-map-border);
	border-radius: var(--cfd-map-radius);
	margin-bottom: 18px;
	max-height: 320px;
	overflow-y: auto;
	padding: 14px 16px;
}

.cfd-map-timeline-chapter + .cfd-map-timeline-chapter {
	border-top: 1px solid var(--cfd-map-border);
	margin-top: 14px;
	padding-top: 14px;
}

.cfd-map-timeline-chapter-title {
	font-size: 0.8rem;
	letter-spacing: 0.08em;
	margin: 0 0 8px;
	text-transform: uppercase;
}

.cfd-map-timeline-seasons {
	list-style: none;
	margin: 0;
	padding: 0;
}

.cfd-map-timeline-season {
	align-items: baseline;
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	padding: 5px 0;
}

.cfd-map-timeline-season-label {
	color: var(--cfd-map-muted);
	flex: 0 0 110px;
	font-size: 0.82rem;
}

.cfd-map-timeline-patches {
	display: flex;
	flex: 1 1 auto;
	flex-wrap: wrap;
	gap: 6px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.cfd-map-timeline-patch {
	background: var(--cfd-map-panel-2);
	border: 1px solid var(--cfd-map-border);
	border-radius: 999px;
	color: var(--cfd-map-text);
	display: inline-block;
	font-size: 0.78rem;
	padding: 5px 11px;
	text-decoration: none;
}

.cfd-map-timeline-patch:hover,
.cfd-map-timeline-patch.is-active {
	background: linear-gradient(135deg, var(--cfd-map-accent), var(--cfd-map-accent-2));
	border-color: transparent;
	color: #08111f;
}

.cfd-map-timeline-patch:focus-visible {
	outline: 3px solid var(--cfd-map-accent);
	outline-offset: 2px;
}

/* ------------------------------------------------------------ Comparison */

.cfd-map-compare-picker {
	align-items: flex-end;
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-bottom: 14px;
}

.cfd-map-compare-field {
	display: flex;
	flex: 1 1 220px;
	flex-direction: column;
	font-size: 0.8rem;
	gap: 4px;
}

.cfd-map-compare-field select {
	background: var(--cfd-map-panel-2);
	border: 1px solid var(--cfd-map-border);
	border-radius: 8px;
	color: var(--cfd-map-text);
	max-width: 100%;
	padding: 8px 10px;
}

.cfd-map-compare-vs {
	color: var(--cfd-map-muted);
	font-weight: 700;
	padding-bottom: 10px;
}

.cfd-map-compare-stage {
	border: 1px solid var(--cfd-map-border);
	border-radius: var(--cfd-map-radius);
	height: var(--cfd-map-height);
	overflow: hidden;
	position: relative;
}

.cfd-map-compare-pane {
	inset: 0;
	position: absolute;
}

.cfd-map-compare-pane .cfd-map-canvas {
	height: 100%;
}

.cfd-map-compare-badge {
	background: rgba(8, 17, 31, 0.78);
	border-radius: 6px;
	color: #e8ecf7;
	font-size: 0.75rem;
	padding: 5px 9px;
	position: absolute;
	top: 10px;
	z-index: 700;
}

.cfd-map-compare-badge--old {
	left: 10px;
}

.cfd-map-compare-badge--new {
	right: 10px;
}

.cfd-map-compare-handle {
	cursor: ew-resize;
	height: 100%;
	left: 50%;
	position: absolute;
	top: 0;
	touch-action: none;
	transform: translateX(-50%);
	width: 44px;
	z-index: 800;
}

.cfd-map-compare-grip {
	background: var(--cfd-map-accent);
	box-shadow: 0 0 12px rgba(34, 211, 238, 0.5);
	height: 100%;
	left: 50%;
	position: absolute;
	top: 0;
	transform: translateX(-50%);
	width: 3px;
}

.cfd-map-compare-range {
	cursor: ew-resize;
	height: 100%;
	opacity: 0;
	width: 100%;
}

.cfd-map-compare-range:focus-visible + .cfd-map-compare-grip {
	box-shadow: 0 0 0 3px var(--cfd-map-accent);
}

.cfd-map-compare-hint {
	color: var(--cfd-map-muted);
	font-size: 0.8rem;
	margin: 8px 0 0;
}

/* ------------------------------------------------------------- Map list */

.cfd-map-list-title {
	font-size: 1.3rem;
	margin: 0 0 12px;
}

.cfd-map-list-grid {
	display: grid;
	gap: 14px;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.cfd-map-list-link {
	background: var(--cfd-map-panel);
	border: 1px solid var(--cfd-map-border);
	border-radius: var(--cfd-map-radius);
	color: var(--cfd-map-text);
	display: block;
	overflow: hidden;
	padding-bottom: 10px;
	text-decoration: none;
}

.cfd-map-list-link:hover {
	border-color: var(--cfd-map-accent);
}

.cfd-map-list-thumb {
	aspect-ratio: 1 / 1;
	display: block;
	object-fit: cover;
	width: 100%;
}

.cfd-map-list-thumb--empty {
	background: var(--cfd-map-panel-2);
}

.cfd-map-list-name {
	display: block;
	font-size: 0.9rem;
	font-weight: 600;
	padding: 10px 12px 0;
}

.cfd-map-list-date {
	color: var(--cfd-map-muted);
	display: block;
	font-size: 0.76rem;
	padding: 2px 12px 0;
}

/* ----------------------------------------------------------- Unavailable */

.cfd-map-unavailable {
	background: var(--cfd-map-panel);
	border: 1px dashed var(--cfd-map-border);
	border-radius: var(--cfd-map-radius);
	color: var(--cfd-map-muted);
	padding: 28px 20px;
	text-align: center;
}

/* --------------------------------------------------------- Breadcrumbs */

.cfd-map-breadcrumbs {
	color: var(--cfd-map-muted);
	font-size: 0.8rem;
	list-style: none;
	margin: 0 0 12px;
	padding: 0;
}

.cfd-map-breadcrumbs li {
	display: inline;
}

.cfd-map-breadcrumbs li + li::before {
	content: " / ";
}

/* ------------------------------------------------------------ Responsive */

@media (max-width: 1200px) {
	.cfd-map-layout {
		grid-template-columns: 240px 1fr;
	}
}

@media (max-width: 960px) {
	.cfd-map-layout {
		grid-template-columns: 1fr;
	}

	.cfd-map-sidebar {
		background: var(--cfd-map-panel);
		border-right: 0;
		bottom: 0;
		left: 0;
		max-height: none;
		position: fixed;
		top: 0;
		transform: translateX(-102%);
		transition: transform 0.2s ease;
		width: min(320px, 86vw);
		z-index: 100000;
	}

	.cfd-map-app.is-panel-open .cfd-map-sidebar {
		box-shadow: 0 0 40px rgba(0, 0, 0, 0.55);
		transform: translateX(0);
	}

	.cfd-map-sidebar-close {
		display: block;
	}

	.cfd-map-canvas {
		height: var(--cfd-map-height-mobile);
	}

	.cfd-map-compare-stage {
		height: var(--cfd-map-height-mobile);
	}

	.cfd-map-mobilebar {
		background: var(--cfd-map-panel);
		border-top: 1px solid var(--cfd-map-border);
		display: flex;
		gap: 6px;
		padding: 8px;
	}

	.cfd-map-controls {
		right: 8px;
		top: 8px;
	}

	.cfd-map-control {
		height: 34px;
		width: 34px;
	}

	.cfd-map-status {
		bottom: 62px;
	}

	.cfd-map-timeline-season-label {
		flex: 0 0 100%;
	}
}

@media (max-width: 400px) {
	.cfd-map-title {
		font-size: 1.15rem;
	}

	.cfd-map-mobilebar-btn {
		font-size: 0.76rem;
		padding: 9px 4px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cfd-map-sidebar,
	.cfd-map-control {
		transition: none;
	}
}

/* ------------------------------------------------------------ Page shell */

.cfd-map-page-header {
	margin-bottom: 16px;
}

.cfd-map-page-title {
	font-size: 1.7rem;
	margin: 0;
}

.cfd-map-page-intro {
	color: var(--cfd-map-muted);
	margin: 6px 0 0;
	max-width: 70ch;
}

.cfd-map-page-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 14px;
}
