/* The map list (/maps) and the map editor (/maps/new, /maps/{id}/edit), on site.css's variables; no inline styles. */

.maps-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.button.primary-link { background: var(--accent); color: #08121a; border-color: var(--accent); font-weight: 700; padding: 10px 18px; }

.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.map-card { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: flex; flex-direction: column; min-width: 0; }
.map-card img { width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: contain; background: #05070b; border-radius: 8px; display: block; }
.map-card h3 { margin: 10px 0 2px; overflow-wrap: anywhere; }
.map-card p { margin: 2px 0; }
.map-card .row { margin-top: auto; padding-top: 8px; }
.map-author { font-size: 0.88rem; }
.map-description { font-size: 0.9rem; overflow-wrap: anywhere; }
.map-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--muted); font-size: 0.85rem; align-items: center; }
.badge.live { background: #1f3a24; color: var(--good); }
.maps-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 10px; }
.maps-head h2 { margin: 0; }
.maps-sort { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 0.88rem; }
.chip { padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); }
.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip.active { background: var(--accent); border-color: var(--accent); color: #08121a; font-weight: 700; }
.chip.heart.active { background: #4a1d2c; border-color: #ff6b8b; color: #ffd0da; }
.map-stars { color: var(--accent-2); }
.map-hearts { color: #ff8fa6; }
.map-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.map-actions .small { font-size: 0.82rem; }
button.heart { padding: 5px 10px; font-size: 0.88rem; }
button.heart.on { border-color: #ff6b8b; color: #ffd0da; background: #3a1824; }
.stars { display: inline-flex; gap: 1px; }
.stars button.star { padding: 0 3px; border: none; background: none; font-size: 1.35rem; line-height: 1.2; color: #5b6478; }
.stars button.star.on { color: var(--accent-2); }
.stars:hover button.star:not(:disabled) { color: var(--accent-2); }
.stars button.star:hover:not(:disabled) ~ button.star { color: #5b6478; }
.stars button.star:disabled { opacity: 0.4; }
.rate-note { width: 100%; }

main:has(.map-editor) { max-width: 1880px; }
.me-head h1 { margin-bottom: 4px; }
.me-head h1 small { font-size: 1rem; font-weight: 400; }
.me-head p { margin: 4px 0 10px; }
.me-all { margin-left: 8px; }
.me-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.me-work { min-width: 0; }
.me-toolbar { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-bottom: 8px; }
.me-group { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding-right: 10px; border-right: 1px solid var(--line); }
.me-group:last-child { border-right: none; padding-right: 0; }
.me-toolbar button { padding: 6px 11px; font-size: 0.9rem; }
.me-toolbar button.active { background: var(--accent); color: #08121a; border-color: var(--accent); font-weight: 700; }
.me-zoom { min-width: 3.4em; text-align: center; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 0.88rem; }
.me-grid { display: flex; align-items: center; gap: 6px; margin: 0 0 0 4px; }
.me-grid select { display: inline-block; width: auto; margin: 0; padding: 5px 8px; }
.me-stage { position: relative; }
#me-canvas { width: 100%; height: auto; aspect-ratio: 16 / 9; display: block; border-radius: var(--radius); border: 1px solid var(--line); background: #05070b; touch-action: none; cursor: crosshair; outline: none; }
#me-canvas:focus-visible { border-color: var(--accent); }
.me-help { position: absolute; top: 10px; right: 10px; width: min(580px, calc(100% - 20px)); max-height: calc(100% - 20px); overflow-y: auto;
    background: rgba(13, 16, 24, 0.96); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.5); }
.me-help[hidden] { display: none; }
.me-help-head { display: flex; justify-content: space-between; align-items: center; }
.me-help h3 { margin: 0; }
.me-help dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 8px 0 0; font-size: 0.84rem; line-height: 1.35; }
.me-help dt { color: var(--text, #e6e9ef); white-space: nowrap; }
.me-help dd { margin: 0; color: var(--muted); }
.me-help kbd, .me-desktop-note kbd { display: inline-block; min-width: 1.4em; padding: 0 5px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px;
    background: var(--panel-2); font: 600 0.78rem/1.5 ui-monospace, monospace; text-align: center; }
.me-desktop-note { display: none; margin: 8px 0 0; padding: 8px 12px; border-left: 4px solid var(--accent-2); background: var(--panel-2); border-radius: 6px; font-size: 0.88rem; }
.me-hint, .me-status, .me-counts { margin: 6px 0 0; font-size: 0.88rem; }
.me-hint.warn { color: var(--accent-2); font-weight: 600; }
.me-status { font-variant-numeric: tabular-nums; min-height: 1.3em; }
.me-counts { display: flex; flex-wrap: wrap; gap: 5px; }
.me-count { padding: 2px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-variant-numeric: tabular-nums; white-space: nowrap; }
.me-count.full { border-color: var(--accent-2); color: var(--accent-2); }
.me-count.over { border-color: var(--bad); color: #ffb4b4; }
.me-count.world { border-style: dashed; }
.me-panel h3 { margin-top: 16px; }
.me-form label { margin-bottom: 8px; }
.me-label { display: block; color: var(--muted); font-size: 0.92rem; margin-bottom: 4px; }
.me-swatch-group { margin-bottom: 10px; }
.me-swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; }
.me-swatch { height: 30px; padding: 0; border-radius: 6px; border: 2px solid var(--line); }
.me-swatch.active { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2); }
.me-actions form { display: inline-flex; gap: 8px; margin: 0; }
.me-check-state { margin: 0 0 6px; font-size: 0.9rem; }
.me-check-state.ok { color: var(--good); }
.me-issues { list-style: none; padding: 0; margin: 0 0 12px; max-height: 320px; overflow-y: auto; }
.me-issues li { padding: 6px 8px 6px 10px; border-left: 3px solid var(--accent-2); background: var(--panel-2); border-radius: 4px; margin-bottom: 5px; font-size: 0.88rem; cursor: pointer; overflow-wrap: anywhere; }
.me-issues li.hard { border-left-color: var(--bad); }
.me-issues li.note { border-left-color: var(--line); color: var(--muted); }
.me-issues li:hover { background: var(--line); }

@media (max-width: 1000px) {
    .me-main { grid-template-columns: 1fr; }
    .me-swatches { grid-template-columns: repeat(8, minmax(28px, 1fr)); }
}

/* A phone: the page scrolls over the canvas until it is zoomed in, the shortcuts stay out of the way, editing is best on desktop. */
@media (max-width: 760px) {
    .me-desktop-note { display: block; }
    #me-canvas { touch-action: pan-y; }
    #me-canvas.zoomed { touch-action: none; }
    .me-group { border-right: none; padding-right: 0; }
    .me-toolbar button { padding: 6px 9px; font-size: 0.85rem; }
    #me-help-toggle, .me-status { display: none; }
}
.me-form label.me-check { display: flex; gap: 8px; align-items: center; color: var(--text); }
.me-form label.me-check input { display: inline-block; width: auto; margin: 0; }
.map-credit { font-size: 0.85rem; margin: 2px 0 4px; }
.badge.remix { background: #23304d; color: var(--accent-2); }

.me-arrange { position: relative; display: inline-block; }
.me-arrange > summary { list-style: none; cursor: pointer; padding: 6px 11px; font-size: 0.9rem; color: var(--text); border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); }
.me-arrange > summary::-webkit-details-marker { display: none; }
.me-arrange[open] > summary { border-color: var(--accent); }
.me-arrange-menu { position: absolute; z-index: 5; top: calc(100% + 4px); left: 0; display: grid; grid-template-columns: repeat(2, minmax(12em, 1fr)); gap: 4px; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); }
.me-arrange-menu button { text-align: left; font-size: 0.86rem; white-space: nowrap; }
.me-arrange-menu button kbd { float: right; margin-left: 8px; opacity: 0.7; white-space: nowrap; }
.me-arrange-menu .wide { grid-column: 1 / -1; }
.me-confirm { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 8px; padding: 8px 12px; border: 1px solid var(--accent-2); border-radius: 6px; background: var(--panel-2); }
.me-confirm[hidden] { display: none; }
.me-confirm span { flex: 1 1 18em; }

/* The properties box of the selected moving platform, door or water level (wwwroot/js/mapeditor.js showProps). */
.me-props { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; align-items: center; margin: 0.4rem 0; padding: 0.5rem 0.75rem;
    border: 1px solid rgba(79, 195, 247, 0.35); border-radius: 8px; background: rgba(8, 18, 26, 0.6); font-size: 0.9rem; }
.me-props[hidden] { display: none; }
.me-prop { display: flex; align-items: center; gap: 0.4rem; }
.me-prop input[type="number"] { width: 5.5rem; }
