/* WPF-641: the campaign map (index.html #view-campaign, ui/lobby-campaign.js). One panel like Updates; the trail sits
   on WPF-877's trail map (--trail-art: public/art/campaign/trail-map.standard.svg, the LOW sheet on LOW), or on a
   placeholder nation (a drawn outline, no image) when the art cannot load. The map scales to fit its frame, width and height
   (ui/campaign-model.js campaignFit sets --map-w/--map-h): it never pans and never overflows the page. A map too small for
   its labels (a phone, a short window) is .is-compact: numbered markers on the map, the stops a list of buttons under it. */
/* The view fills the lobby panel's 1fr row and scrolls inside it, so nothing runs off the card. */
body.lobby-wide .lobby-panel > #view-campaign { grid-row: 2; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.campaign-screen { width: min(100%, 1120px); min-width: 0; margin: 0 auto; padding: 24px 0 16px; }
.campaign-head { position: relative; padding: 26px 28px 20px; border: 1px solid #354c65; border-radius: 6px 6px 0 0; background: linear-gradient(120deg, #182c40, #122031 72%); }
.campaign-head h1 { margin: 0; color: #f6d875; font: 900 30px/1.05 system-ui, sans-serif; }
.campaign-head > p:last-child { margin: 7px 0 0; color: #aec5dc; font: 500 14px/1.3 system-ui, sans-serif; }
.campaign-scroll { overflow: hidden; border: 1px solid #354c65; border-top: 0; border-radius: 0 0 6px 6px; background: #0e1b29; overscroll-behavior: contain; }
.campaign-scroll:focus-visible { outline: 3px solid #f6d875; outline-offset: -3px; }
.campaign-map { position: relative; width: var(--map-w, 100%); max-width: 100%; height: var(--map-h, auto); margin: 0 auto; aspect-ratio: var(--trail-aspect, 16 / 9); background: #10273a var(--trail-art, none) center / 100% 100% no-repeat; }
.campaign-map.is-placeholder { background: radial-gradient(ellipse at 50% 45%, #183c58, #0f2235 70%); }
.campaign-trail { position: absolute; inset: 0; width: 100%; height: 100%; }
.campaign-land { fill: #2c5a43; stroke: #8fbf86; stroke-width: 4; stroke-linejoin: round; opacity: .85; }
.campaign-leg { fill: none; stroke: #f6d875; stroke-width: 7; stroke-linecap: round; stroke-dasharray: 2 16; }
/* On the trail map the legs take the art's own dotted pink trail (build-trail-map.mjs .trail). */
.campaign-map:not(.is-placeholder) .campaign-leg { stroke: #d92a77; stroke-dasharray: 2 13; }
.campaign-stops { position: absolute; inset: 0; margin: 0; padding: 0; list-style: none; }
.campaign-stop-place { position: absolute; left: var(--stop-x); top: var(--stop-y); width: 0; height: 0; }
.campaign-stop { position: absolute; top: -18px; left: -18px; display: grid; grid-template-columns: 36px auto; grid-template-rows: auto auto; column-gap: 8px; align-items: center; min-height: 36px; padding: 0 10px 0 0; border: 0; border-radius: 18px; background: rgba(9, 22, 35, .82); color: #f0f7ff; text-align: left; cursor: pointer; white-space: nowrap; }
.anchor-end .campaign-stop { left: auto; right: -18px; grid-template-columns: auto 36px; padding: 0 0 0 10px; text-align: right; }
.anchor-end .campaign-stop-pin { grid-column: 2; }
.anchor-end .campaign-stop-name, .anchor-end .campaign-stop-status { grid-column: 1; }
.campaign-stop-pin { grid-row: 1 / span 2; display: grid; place-items: center; width: 36px; height: 36px; border: 3px solid #f6d875; border-radius: 50%; background: #1d3b57; color: #fff; font: 900 15px/1 system-ui, sans-serif; }
.campaign-stop-name { font: 800 14px/1.1 system-ui, sans-serif; }
.campaign-stop-status { color: #b9d5ee; font: 700 11px/1.2 system-ui, sans-serif; }
.campaign-stop.is-done .campaign-stop-pin { border-color: #8fd18a; background: #2d6a3a; }
.campaign-stop.is-newest .campaign-stop-pin { border-color: #ff9fc7; background: #c2457e; box-shadow: 0 0 0 6px rgba(255, 159, 199, .35); }
.campaign-stop.is-newest .campaign-stop-status { color: #ffc4dc; }
.campaign-stop:hover .campaign-stop-pin, .campaign-stop.is-selected .campaign-stop-pin { transform: scale(1.12); }
.campaign-stop:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
/* Compact: the map keeps its top --map-h for the trail and markers; the stop buttons stack under it, full width. */
.campaign-marks { position: absolute; inset: 0; display: none; pointer-events: none; }
.campaign-mark { position: absolute; left: var(--stop-x); top: var(--stop-y); display: grid; place-items: center; width: 26px; height: 26px; transform: translate(-50%, -50%); border: 2px solid #f6d875; border-radius: 50%; background: #1d3b57; color: #fff; font: 900 12px/1 system-ui, sans-serif; }
.campaign-mark.is-done { border-color: #8fd18a; background: #2d6a3a; }
.campaign-mark.is-newest { border-color: #ff9fc7; background: #c2457e; box-shadow: 0 0 0 4px rgba(255, 159, 199, .35); }
.is-compact .campaign-map { height: auto; aspect-ratio: auto; padding-top: var(--map-h); background-size: 100% var(--map-h); background-repeat: no-repeat; }
.is-compact .campaign-map.is-placeholder { background: radial-gradient(ellipse at 50% 45%, #183c58, #0f2235 70%) top / 100% var(--map-h) no-repeat; }
.is-compact .campaign-trail, .is-compact .campaign-marks { bottom: auto; height: var(--map-h); }
.is-compact .campaign-marks { display: block; }
/* One column no wider than the frame (review round 1: the implicit column took the longest name's width and clipped);
   a long name wraps instead. */
.is-compact .campaign-stops { position: static; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 12px; background: #0e1b29; }
.is-compact .campaign-stop-place { position: static; width: auto; min-width: 0; height: auto; }
.is-compact .campaign-stop { position: static; width: 100%; min-width: 0; min-height: 48px; grid-template-columns: 36px minmax(0, 1fr); padding: 6px 12px 6px 6px; border-radius: 24px; white-space: normal; }
.is-compact .campaign-stop-name, .is-compact .campaign-stop-status { min-width: 0; overflow-wrap: anywhere; }
.campaign-status { margin: 12px 0 0; color: #d7e7f6; font: 600 14px/1.3 system-ui, sans-serif; text-align: center; }
.campaign-status:empty { display: none; }
.campaign-retry-row { margin: 8px 0 0; text-align: center; }
.campaign-retry-row:has(> [hidden]) { display: none; }
/* The level's options: the Create match sheet's look (ui/quick-play.css .quick-create-form), over the map. */
.campaign-level { position: fixed; z-index: 30; top: 50%; right: max(16px, calc(50% - 540px)); display: grid; gap: 12px; width: min(340px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto; padding: 20px; transform: translateY(-50%); border: 1px solid #527494; border-radius: 5px; background: #102338; box-shadow: 0 22px 65px rgba(0, 0, 0, .55); }
.campaign-level header { position: relative; padding-right: 30px; }
.campaign-level header p { margin: 0 0 4px; color: #8fc7f6; font: 800 10px/1 system-ui, sans-serif; letter-spacing: .12em; }
.campaign-level h2 { margin: 0; color: #fff; font: 800 22px/1 system-ui, sans-serif; }
.campaign-level header button { position: absolute; top: 0; right: 0; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 3px; background: transparent; color: #cde5fc; font-size: 22px; }
.campaign-level label { display: grid; gap: 5px; color: #bcd3e8; font: 700 11px/1 system-ui, sans-serif; }
.campaign-level input:not([type="checkbox"]) { min-height: 34px; padding: 0 9px; border: 1px solid #496987; border-radius: 3px; background: #0d1e2e; color: #f0f7ff; }
.campaign-level-record { margin: 0; color: #d7e7f6; font: 600 13px/1.3 system-ui, sans-serif; }
#campaign-create-status { margin: 0; color: #ffd0a0; font: 600 12px/1.3 system-ui, sans-serif; }
#campaign-create-status:empty { display: none; }

@media (max-width: 640px) {
  .campaign-screen { padding: 12px 0 24px; }
  .campaign-head { padding: 22px 16px 16px; }
  .campaign-head h1 { font-size: 24px; }
  .campaign-level { top: auto; right: 16px; bottom: 16px; transform: none; }
}
