/* Galactic campaign map (public /campaign page and the portal's Campaign page). See public/js/campaign-map.js. */
.cm-root {
  --cm-held: #4da3ff;
  --cm-contested: #f2d06b;
  --cm-enemy: #f26b3a;
  --cm-next: #f2a541;
  --cm-panel: var(--panel, #111a2b);
  --cm-line: var(--line-2, #22304a);
  --cm-text: var(--bone, #e6edf7);
  --cm-mute: var(--mute, #93a4bf);
  color: var(--cm-text);
}
.cm-root .st-held { --c: var(--cm-held); }
.cm-root .st-contested { --c: var(--cm-contested); }
.cm-root .st-enemy { --c: var(--cm-enemy); }
.cm-muted { color: var(--cm-mute); }
.cm-eyebrow { display: block; font-family: var(--font-mono, monospace); font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--cm-mute); }

/* Status glyphs: shape as well as colour. Held = filled circle, contested = half-filled circle, enemy = diamond. */
.cm-glyph { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.st-contested .cm-glyph { background: linear-gradient(90deg, var(--c) 50%, transparent 50%); box-shadow: inset 0 0 0 1.5px var(--c); }
.st-enemy .cm-glyph { border-radius: 1px; transform: rotate(45deg) scale(.85); }

/* ---------- header ---------- */
.cm-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 20px 32px; margin-bottom: 24px; }
.cm-head h1 { margin: 6px 0 8px; }
.cm-head p { margin: 0; color: var(--cm-mute); max-width: 60ch; }
.cm-chips { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.cm-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--cm-line); border-radius: 999px; background: color-mix(in srgb, var(--c) 10%, transparent); font-size: .85rem; }
.cm-chip b { font-family: var(--font-display, inherit); font-size: 1.05rem; }

.cm-drop { min-width: 260px; max-width: 360px; border: 1px solid color-mix(in srgb, var(--cm-next) 45%, var(--cm-line)); border-left: 3px solid var(--cm-next); background: var(--cm-panel); border-radius: 8px; padding: 14px 18px; }
.cm-drop .cm-eyebrow { color: var(--cm-next); }
.cm-drop-when { font-family: var(--font-display, inherit); font-size: 1.35rem; font-weight: 700; margin: 4px 0 2px; }
.cm-drop-target { margin: 0; color: var(--cm-mute); }
.cm-drop-target b { color: var(--cm-text); }
.cm-drop .cm-link { margin-top: 8px; }

/* ---------- map + panel ---------- */
.cm-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
@media (max-width: 960px) { .cm-layout { grid-template-columns: 1fr; } }
.cm-map { position: relative; border: 1px solid var(--cm-line); border-radius: 12px; overflow: hidden; background: #05070c; line-height: 0; }
.cm-stage { position: relative; } /* markers are positioned against the image only */
.cm-img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.cm-layer { position: absolute; inset: 0; }

.cm-sector {
  position: absolute; transform: translate(-50%, -22px); /* the dot's centre sits on the coordinate */
  min-width: 44px; min-height: 44px; padding: 0; border: 0; background: none; cursor: pointer; color: var(--cm-text);
  display: flex; flex-direction: column; align-items: center; line-height: 1; z-index: 1;
}
.cm-sector:hover, .cm-sector:focus-visible, .cm-sector.is-sel { z-index: 3; }
.cm-ring {
  width: 28px; height: 28px; margin-top: 8px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid color-mix(in srgb, var(--c) 70%, transparent); background: rgba(5, 8, 14, .55);
  box-shadow: 0 0 14px color-mix(in srgb, var(--c) 55%, transparent); transition: transform .15s ease, box-shadow .15s ease;
}
.cm-ring .cm-glyph { width: 12px; height: 12px; box-shadow: 0 0 10px var(--c); }
.st-contested .cm-ring .cm-glyph { box-shadow: inset 0 0 0 1.5px var(--c), 0 0 10px var(--c); }
.cm-sector.is-next .cm-ring { outline: 2px dashed var(--cm-next); outline-offset: 4px; }
.cm-sector.is-sel .cm-ring { transform: scale(1.3); border-color: #f4f7fb; box-shadow: 0 0 0 3px rgba(244, 247, 251, .25), 0 0 18px color-mix(in srgb, var(--c) 70%, transparent); }
.cm-sector:hover .cm-ring { transform: scale(1.15); }
.cm-sector.is-sel:hover .cm-ring { transform: scale(1.3); }
.cm-sector:focus-visible { outline: none; }
.cm-sector:focus-visible .cm-ring { box-shadow: 0 0 0 3px var(--cm-next), 0 0 18px var(--c); }
.cm-label {
  margin-top: 6px; padding: 3px 6px; border-radius: 4px; background: rgba(6, 9, 16, .86); border: 1px solid rgba(255, 255, 255, .08);
  font-family: var(--font-mono, monospace); font-size: .68rem; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
}
.cm-sector.is-sel .cm-label { border-color: rgba(244, 247, 251, .45); }
@media (max-width: 560px) { .cm-label { font-size: .58rem; padding: 2px 4px; } .cm-ring { width: 22px; height: 22px; } .cm-ring .cm-glyph { width: 9px; height: 9px; } }

.cm-legend {
  position: absolute; right: 10px; bottom: 10px; display: grid; gap: 6px; padding: 10px 12px; line-height: 1;
  background: rgba(6, 9, 16, .86); border: 1px solid var(--cm-line); border-radius: 8px; font-size: .75rem; z-index: 4;
}
.cm-legend span { display: flex; align-items: center; gap: 8px; }
.cm-legend .lg-next i { width: 12px; height: 12px; border-radius: 50%; border: 2px dashed var(--cm-next); }

.cm-map.is-placing { cursor: crosshair; outline: 2px dashed var(--cm-next); outline-offset: -2px; }
.cm-map.is-placing .cm-sector { pointer-events: none; opacity: .6; }
.cm-place-hint:empty { display: none; }
.cm-place-hint { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); padding: 8px 14px; border-radius: 6px; line-height: 1.3; background: var(--cm-next); color: #1a1205; font-weight: 600; font-size: .85rem; z-index: 5; pointer-events: none; text-align: center; }

.cm-panel { background: var(--cm-panel); border: 1px solid var(--cm-line); border-radius: 12px; padding: 20px; position: sticky; top: 90px; }
@media (max-width: 960px) { .cm-panel { position: static; } }
.cm-panel h2 { margin: 4px 0 10px; font-size: 1.8rem; }
.cm-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cm-badge { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; border: 1px solid color-mix(in srgb, var(--c) 60%, transparent); background: color-mix(in srgb, var(--c) 14%, transparent); }
.cm-badge.is-next { --c: var(--cm-next); border-style: dashed; color: var(--cm-next); }
.cm-facts { margin: 16px 0 0; display: grid; gap: 10px; }
.cm-facts div { display: grid; grid-template-columns: 90px 1fr; gap: 10px; }
.cm-facts dt { color: var(--cm-mute); font-size: .85rem; }
.cm-facts dd { margin: 0; }
.cm-note { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--cm-line); }
.cm-note p { margin: 6px 0 0; white-space: pre-line; }
.cm-link { display: inline-block; margin-top: 14px; color: var(--cm-next); font-weight: 600; text-decoration: none; }
.cm-link:hover { text-decoration: underline; }
.cm-panel-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--cm-line); }

/* ---------- campaign log ---------- */
.cm-log { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--cm-line); }
.cm-log li { display: grid; grid-template-columns: 110px minmax(0, 1fr) auto auto; gap: 6px 16px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--cm-line); }
.cm-log time { color: var(--cm-mute); font-family: var(--font-mono, monospace); font-size: .8rem; padding-top: 3px; }
.cm-log-main b { margin-right: 10px; }
.cm-log-main p { margin: 4px 0 0; color: var(--cm-mute); font-size: .92rem; }
.cm-log-main .cm-link { margin-top: 4px; font-size: .85rem; }
.cm-result { justify-self: end; padding: 3px 10px; border-radius: 4px; font-family: var(--font-mono, monospace); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 60%, transparent); background: color-mix(in srgb, var(--c) 12%, transparent); }
.cm-result.r-held { --c: var(--cm-held); }
.cm-result.r-contested { --c: var(--cm-contested); }
.cm-result.r-enemy { --c: var(--cm-enemy); }
.cm-result.r-withdrawn { --c: var(--cm-mute); }
@media (max-width: 640px) { .cm-log li { grid-template-columns: minmax(0, 1fr) auto; } .cm-log time { grid-column: 1 / -1; } }
.cm-log-title { margin: 56px 0 16px; }
/* Small screens: the legend moves under the map so it never covers a sector. */
@media (max-width: 640px) {
  .cm-legend { position: static; display: flex; flex-wrap: wrap; gap: 8px 14px; border: 0; border-top: 1px solid var(--cm-line); border-radius: 0; background: rgba(6, 9, 16, .95); }
}
