/* Map manager (ui/maps.js). Same palette and controls as the controls editor. */
#maps { display: grid; grid-template-rows: auto auto auto 1fr; gap: 12px; }
#maps .mm-hint { margin: 0; color: var(--haze); flex: 1 1 14em; }
#maps .mm-tools, #maps .mm-bar, #maps .mm-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#maps .mm-search { flex: 1 1 16em; max-width: 40em; padding: 8px 11px; }

#maps .mm-shots { display: flex; align-items: center; gap: 7px; color: var(--haze); cursor: pointer; }
#maps .mm-list { overflow-y: auto; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 14px; grid-auto-rows: max-content; align-content: start; padding: 2px 6px 2px 2px; }
.mm-card { display: grid; grid-template-rows: auto 1fr auto; min-width: 0; background: var(--card); border: 1px solid rgb(147 166 192 / .22); border-radius: 4px; overflow: hidden; }
.mm-card.is-installed { border-color: rgb(127 214 127 / .55); }
.mm-shot { position: relative; width: 100%; padding: 0 !important; border: 0 !important; border-radius: 0 !important; overflow: hidden; aspect-ratio: 16 / 9; background: #070d18; display: grid; place-items: center; color: var(--line); font-size: 12px; }
.mm-shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mm-have { position: absolute; left: 8px; top: 8px; padding: 1px 8px; border-radius: 2px; background: #7fd67f; color: #04130a; font-size: 12px; font-weight: 700; }
.mm-text { display: grid; gap: 3px; align-content: start; padding: 10px 12px 4px; min-width: 0; }
.mm-text :is(h3, p) { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-text h3 { font-size: 15px; font-weight: 700; }
.mm-text p { color: var(--haze); font-size: 12px; }
.mm-text .mm-error { color: var(--sun); white-space: normal; }
.mm-types { display: flex; flex-wrap: wrap; gap: 4px; list-style: none; margin: 4px 0 0; padding: 0; }
.mm-types li { padding: 0 6px; border: 1px solid rgb(147 166 192 / .3); border-radius: 2px; color: var(--haze); font-size: 11px; cursor: default; }
.mm-card footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 12px 10px; }
.mm-meta { color: var(--haze); font-size: 12px; font-variant-numeric: tabular-nums; }
.mm-actions { justify-content: flex-end; margin-left: auto; }
.mm-actions button { padding: 4px 12px !important; }
.mm-play { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mm-progress { color: var(--limb); font-variant-numeric: tabular-nums; }
.mm-empty { grid-column: 1 / -1; margin: 0; padding: 16px 4px; color: var(--haze); }
button.mm-shot img { transition: transform .25s; }
button.mm-shot:hover img { transform: scale(1.04); }
@media (prefers-reduced-motion: reduce) { button.mm-shot img { transition: none; } }
/* details of one pack: takes the place of the list */
#maps.has-detail :is(.mm-bar, .mm-status, .mm-list) { display: none; }
#maps:not(.has-detail) .mm-detail { display: none; } /* empty, it would still take a row and its gap */
#maps .mm-detail { grid-row: 2 / -1; overflow-y: auto; min-height: 0; display: grid; gap: 14px; align-content: start; padding: 2px; }
.mm-detail-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(16px, 3vw, 36px); align-items: start; }
.mm-detail-shot { display: grid; gap: 10px; position: sticky; top: 0; }
.mm-detail-shot .mm-shot { border-radius: 4px !important; border: 1px solid rgb(147 166 192 / .22) !important; box-sizing: border-box; }
.mm-frames { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 6px; }
.mm-frames button { position: relative; padding: 0 !important; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 3px !important; background: #070d18 !important; opacity: .7; }
.mm-frames button:hover, .mm-frames button:focus-visible, .mm-frames .is-current { opacity: 1; }
.mm-frames .is-current { border-color: var(--limb) !important; box-shadow: 0 0 0 1px var(--limb); }
.mm-frames img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mm-which { display: flex; flex-wrap: wrap; gap: 6px; }
.mm-which button { padding: 3px 10px !important; font-size: 12px !important; }
.mm-which .is-current { background: rgb(109 180 242 / .3) !important; border-color: var(--limb) !important; }
.mm-detail-text { display: grid; gap: 10px; align-content: start; min-width: 0; max-width: 62ch; }
.mm-detail-text h3 { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }
.mm-detail-text p { margin: 0; }
.mm-by, .mm-quiet { color: var(--haze); }
.mm-about { font-size: 15px; line-height: 1.5; }
.mm-detail-text .mm-error { color: var(--sun); }
.mm-detail-act { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 4px 0 6px; }
.mm-detail-act .mm-actions { margin-left: 0; justify-content: flex-start; }
.mm-detail-act .mm-actions button { padding: 7px 18px !important; }
.mm-detail dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 16px; margin: 0; }
.mm-detail dt { color: var(--haze); }
.mm-detail dd { margin: 0; overflow-wrap: anywhere; }
.mm-things { display: grid; gap: 8px; margin-top: 4px; }
.mm-things h4 { margin: 8px 0 0; font-size: 13px; font-weight: 400; color: var(--haze); }
.mm-things ul { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.mm-things li { padding: 2px 9px; border: 1px solid rgb(147 166 192 / .3); border-radius: 3px; font-size: 13px; }
.mm-things li { display: inline-flex; align-items: center; gap: 6px; }
.mm-things .mm-count { color: var(--limb); font-variant-numeric: tabular-nums; margin-left: -2px; }
.mm-things .mm-icon { font-size: 18px; }
@media (max-width: 760px) { .mm-detail-body { grid-template-columns: minmax(0, 1fr); } .mm-detail-shot { position: static; } }
@font-face { font-family: 'Xonotic map icons'; src: url('maps-icons.woff') format('woff'); font-display: block; }
.mm-icon { font: 400 1.15em/1 'Xonotic map icons'; speak: never; -webkit-font-smoothing: antialiased; }
.mm-types li { display: inline-flex; align-items: center; gap: 4px; }
.mm-typelist { display: flex; flex-wrap: wrap; gap: 4px 14px; list-style: none; margin: 0; padding: 0; }
.mm-typelist li { display: inline-flex; align-items: center; gap: 6px; }
.mm-typelist .mm-icon { color: var(--limb); font-size: 17px; }
.mm-detail-top { display: flex; flex-wrap: wrap; gap: 8px; }
.mm-text .mm-arms { display: flex; flex-wrap: wrap; gap: 3px 7px; margin-top: 5px; font-size: 15px; overflow: visible; white-space: normal; }
.mm-arms .mm-icon { cursor: default; }
.mm-flags { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.mm-flags .mm-icon { font-size: 17px; }
/* not installed yet: Play (install and start) leads, Install alone is the quieter choice */
#maps .mm-play + .mm-install { background: transparent; color: var(--cloud); font-weight: 400; border-color: rgb(234 242 251 / .35); } /* beside Play, Install is the quiet one */
#maps .mm-play + .mm-install:hover:not(:disabled) { background: rgb(234 242 251 / .12); }
/* small screens (a phone either way up): the filters fold behind one button, and the list gets the room */
.mm-filters { display: contents; }
#maps .mm-more { display: none; }
@media (max-width: 700px), (max-height: 520px) {
	#maps { gap: 8px; }
	#maps .mm-more { display: block; }
	#maps .mm-more[aria-expanded=true] { background: rgb(109 180 242 / .3); border-color: var(--limb); }
	.mm-filters { display: none; }
	#maps.is-filtering .mm-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
	#maps .mm-search { flex: 1 1 8em; }
	/* the list is the page: the count moves into the search box, and both rows of controls stay short */
	#maps .mm-hint { display: none; }
}
}
@media (pointer: coarse) { #maps :is(.mm-bar, .mm-tools) :is(button, select, input[type=search]) { min-height: 40px; font-size: 16px; } #maps .mm-detail-top button { min-height: 36px; } #maps .mm-actions button { min-height: 36px; } }
/* a phone held upright: rows, not cards, so several packs fit on the screen (picture left, the rest beside it) */
@media (max-width: 560px) {
	#maps .mm-list { gap: 8px; }
	.mm-card { grid-template-columns: 128px minmax(0, 1fr); grid-template-rows: auto auto; }
	.mm-card > .mm-shot { grid-row: 1 / 3; align-self: start; }
	.mm-text { padding: 7px 10px 0; gap: 1px; }
	.mm-text h3 { font-size: 14px; }
	.mm-text :is(.mm-contents, .mm-arms) { display: none; }
	.mm-types { margin-top: 2px; flex-wrap: nowrap; overflow: hidden; -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent); }
	.mm-card footer { padding: 4px 10px 8px; gap: 4px 8px; }
	.mm-have { left: 4px; top: 4px; font-size: 10px; padding: 0 5px; }
}
/* a phone: the three buttons over a pack's details stay one row */
@media (max-width: 700px) { .mm-detail-top { gap: 6px; } #maps .mm-detail-top button { flex: 1 1 auto; padding: 6px 8px; font-size: 13px; } }
#maps .mm-count { grid-column: 1 / -1; text-align: center; } #maps .mm-count:empty { display: none; }
