/* Only the Modern map presentation; semantic faction colours are scoped below. */
body.warpi-modern {
    --modern-bg: #080a0c;
    --modern-surface: rgba(16, 19, 23, .96);
    --modern-border: #343a40;
    --modern-text: #f0f1ed;
    --modern-muted: #92999f;
    --modern-accent: #ffe600;
    background: var(--modern-bg);
    color: var(--modern-text);
    font-family: Arial, Helvetica, sans-serif;
}
body.warpi-modern::after,
body.warpi-modern .corner { display: none; }
body.warpi-modern #screen {
    background: var(--modern-bg);
    box-shadow: none;
}
body.warpi-modern header {
    top: 12px;
    text-shadow: none;
}
body.warpi-modern .subtitle {
    width: fit-content;
    max-width: calc(100% - 300px);
    margin: 0 0 0 14px;
    text-align: left;
    font-size: 10px;
    line-height: 1.5;
    letter-spacing: .06em;
    opacity: 1;
    color: var(--modern-muted);
    background: var(--modern-surface);
    padding: 5px 7px;
}
body.warpi-modern #map-controls { right: 12px; width: 250px; }
body.warpi-modern #fullscreen-btn,
body.warpi-modern #intel-close {
    border: 1px solid var(--modern-border);
    background: var(--modern-surface);
    color: var(--modern-text);
    font: 11px/1.4 Arial, Helvetica, sans-serif;
    letter-spacing: .025em;
    padding: 6px 9px;
    text-shadow: none;
    box-shadow: none;
}
body.warpi-modern #fullscreen-btn:hover,
body.warpi-modern #intel-close:hover { border-color: var(--modern-accent); }
body.warpi-modern button:focus-visible {
    outline: 2px solid var(--modern-accent);
    outline-offset: 2px;
}
body.warpi-modern #mo-target-panel,
body.warpi-modern #intel-panel {
    color: var(--modern-text);
    background: var(--modern-surface);
    border: 1px solid var(--modern-border);
    border-top: 2px solid var(--modern-accent);
    font: 12px/1.5 Arial, Helvetica, sans-serif;
    letter-spacing: 0;
    text-shadow: none;
    box-shadow: none;
}
body.warpi-modern #mo-target-panel { margin-top: 8px; }
body.warpi-modern .mo-target-title,
body.warpi-modern .mo-directive-title {
    font-size: 10px;
    letter-spacing: .06em;
    text-align: left;
    color: var(--modern-muted);
}
body.warpi-modern .mo-target-title { padding: 7px 10px; border-color: var(--modern-border); }
body.warpi-modern #mo-target-list { padding: 6px 10px; }
body.warpi-modern .mo-target-row { white-space: normal; align-items: baseline; }
body.warpi-modern #mo-directive {
    padding: 8px 10px;
    border-color: var(--modern-border);
    line-height: 1.5;
}
body.warpi-modern #mo-directive-text { opacity: 1; font-size: 12px; overflow-wrap: anywhere; }
body.warpi-modern .mo-target-marker { animation: none; }
body.warpi-modern #intel-panel { padding: 12px 14px; }
body.warpi-modern #intel-panel::before {
    padding-right: 35px;
    font-size: 10px;
    letter-spacing: .06em;
    color: var(--modern-muted);
    border-bottom: 1px solid var(--modern-border);
}
body.warpi-modern #intel-name { font-size: 18px; letter-spacing: 0; overflow-wrap: anywhere; }
body.warpi-modern .intel-key { color: var(--modern-muted); opacity: 1; }
body.warpi-modern .intel-value { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; min-width: 0; }
body.warpi-modern #intel-alert {
    color: #ffb45e;
    border-top: 1px solid var(--modern-border);
    animation: none;
}
body.warpi-modern #status,
body.warpi-modern #modern-command-status {
    left: 14px;
    bottom: 12px;
    max-width: calc(100% - 28px);
    box-sizing: border-box;
    padding: 5px 7px;
    font-size: 10px;
    line-height: 1.5;
    letter-spacing: .025em;
    opacity: 1;
    color: var(--modern-muted);
    background: var(--modern-surface);
    text-shadow: none;
    pointer-events: none;
}
body.warpi-modern #modern-map-key {
    position: absolute;
    right: 12px;
    bottom: 44px;
    display: flex !important;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px 12px;
    max-width: calc(100% - 24px);
    box-sizing: border-box;
    padding: 6px 8px;
    background: var(--modern-surface);
    color: var(--modern-muted);
    font-size: 10px;
    line-height: 1.5;
    pointer-events: none;
}
body.warpi-modern #modern-map-key > span { display: inline-flex; align-items: center; gap: 5px; }
body.warpi-modern #modern-map-key i {
    width: 8px;
    height: 8px;
    border: 1px solid var(--map-phosphor);
    border-radius: 50%;
}
body.warpi-modern #modern-map-key .key-order { border-style: dashed; }
/* Remove optical CRT effects without changing map geometry or colours. */
body.warpi-modern .planet,
body.warpi-modern .planet-label,
body.warpi-modern .campaign-ring,
body.warpi-modern .major-order-ring,
body.warpi-modern .faction-symbol { filter: none; }
body.warpi-modern .major-order-ring { animation: none; }
@media (max-width: 700px) {
    body.warpi-modern .subtitle { max-width: calc(100% - 205px); margin-left: 8px; font-size: 9px; }
    body.warpi-modern #map-controls { right: 8px; width: 180px; }
    body.warpi-modern #mo-target-panel { font-size: 11px; }
    body.warpi-modern #mo-directive-text { font-size: 11px; }
    body.warpi-modern #mo-target-list { padding: 4px 8px; }
    body.warpi-modern #mo-directive { padding: 6px 8px; }
    body.warpi-modern #modern-map-key { right: 8px; gap: 4px 10px; }
    body.warpi-modern .key-navigation { width: 100%; justify-content: flex-end; }
}

/* Separate Modern renderer; no projection or camera transform touches #map. */
body.warpi-modern[data-modern-map-ready="true"] #map {
    visibility: hidden;
    pointer-events: none;
}
body.warpi-modern[data-modern-map-ready="true"] #intel-panel {
    display: none !important;
}
body.warpi-modern[data-modern-map-ready="true"] #modern-map-svg {
    display: block !important;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}
body.warpi-modern[data-modern-map-ready="true"] #projection-controls {
    display: flex !important;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 6px;
    pointer-events: auto;
}
body.warpi-modern #projection-controls button {
    padding: 5px 8px;
    border: 1px solid var(--modern-border);
    background: var(--modern-surface);
    color: var(--modern-muted);
    font: 10px/1.5 Arial, Helvetica, sans-serif;
    cursor: pointer;
}
body.warpi-modern #projection-controls button[aria-pressed="true"] {
    color: var(--modern-accent);
    border-color: var(--modern-accent);
}
body.warpi-modern #modern-map-svg .modern-planet-group { cursor: pointer; }
body.warpi-modern #modern-map-svg .planet-label { font-family: Arial, Helvetica, sans-serif; letter-spacing: .2px; }
body.warpi-modern #modern-intel-panel {
    position: absolute;
    top: 85px;
    right: 22px;
    width: min(320px, calc(100% - 24px));
    max-height: calc(100% - 24px);
    overflow: auto;
    box-sizing: border-box;
    padding: 12px 14px;
    z-index: 30;
    background: var(--modern-surface);
    color: var(--modern-text);
    border: 1px solid var(--modern-border);
    border-top: 2px solid var(--modern-accent);
    font: 12px/1.5 Arial, Helvetica, sans-serif;
    letter-spacing: 0;
}
body.warpi-modern[data-modern-map-ready="true"] #modern-intel-panel.open { display: block !important; }
body.warpi-modern #modern-intel-panel::before {
    content: "PLANETARY INTELLIGENCE";
    display: block;
    padding: 0 35px 8px 0;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--modern-border);
    color: var(--modern-muted);
    font-size: 10px;
    letter-spacing: .06em;
    font-weight: bold;
}
body.warpi-modern #modern-intel-close {
    position: absolute;
    right: 9px;
    top: 8px;
    padding: 3px 6px;
    background: var(--modern-surface);
    color: var(--modern-text);
    border: 1px solid var(--modern-border);
    cursor: pointer;
}
body.warpi-modern #modern-intel-name { font-size: 18px; font-weight: bold; margin-bottom: 12px; overflow-wrap: anywhere; }
body.warpi-modern #modern-intel-alert {
    margin-top: 11px;
    padding-top: 9px;
    border-top: 1px solid var(--modern-border);
    color: #ffb45e;
    font-weight: bold;
}
@media (max-width: 600px) {
    body.warpi-modern #modern-intel-panel {
        top: 110px;
        right: 12px;
        left: 12px;
        width: auto;
        max-height: calc(100% - 122px);
        z-index: 50;
        -webkit-overflow-scrolling: touch;
    }
}

/* Modern semantic palette: identity on markers, quiet steel for the chart. */
body.warpi-modern {
    --map-neutral: #87939e;
    --map-player: #d8c76b;
    --map-automaton: #c16c69;
    --map-terminid: #c8975b;
    --map-illuminate: #88adcc;
    /* These replace inherited CRT defaults only within Modern. */
    --map-phosphor: var(--map-neutral);
    --map-bright: #f0eee3;
    --map-glow: transparent;
    --map-inner-glow: transparent;
}
body.warpi-modern #modern-map-svg [data-faction] { --map-faction-colour: var(--map-neutral); }
body.warpi-modern #modern-map-svg [data-faction="super-earth"] { --map-faction-colour: var(--map-player); }
body.warpi-modern #modern-map-svg [data-faction="automatons"] { --map-faction-colour: var(--map-automaton); }
body.warpi-modern #modern-map-svg [data-faction="terminids"] { --map-faction-colour: var(--map-terminid); }
body.warpi-modern #modern-map-svg [data-faction="illuminate"] { --map-faction-colour: var(--map-illuminate); }

body.warpi-modern #modern-map-svg .grid,
body.warpi-modern #modern-map-svg .ring { stroke: #64717e; }
body.warpi-modern #modern-map-svg .map-star { fill: #8996a1; }
/* Ordinary official waypoint network; attack paths retain their own semantics. */
body.warpi-modern #modern-map-svg .link,
body.warpi-modern #modern-map-svg .warp-halo-inner,
body.warpi-modern #modern-map-svg .warp-halo-outer {
    stroke: #d6efff;
    stroke-linecap: round;
    fill: none;
    pointer-events: none;
    vector-effect: non-scaling-stroke;
}
body.warpi-modern #modern-map-svg .link { stroke-width: 1.75; opacity: .78; }
body.warpi-modern #modern-map-svg .warp-halo-inner { stroke-width: 3.5; opacity: .13; }
body.warpi-modern #modern-map-svg .warp-halo-outer { stroke-width: 6; opacity: .045; }
body.warpi-modern #modern-map-svg .earth-atmosphere { pointer-events: none; }
body.warpi-modern #modern-map-svg [data-modern-layer="attacks"] > line { opacity: .6; }
body.warpi-modern #modern-map-svg .planet { fill: var(--map-faction-colour, var(--map-neutral)); }
body.warpi-modern #modern-map-svg .campaign-ring { stroke: var(--map-faction-colour, var(--map-neutral)); }
body.warpi-modern #modern-map-svg .planet-label { fill: #e4e5de; }
body.warpi-modern #modern-map-svg .planet-label.normal { fill: #a7b0b8; }
body.warpi-modern #modern-map-svg .major-order-ring,
body.warpi-modern #modern-map-svg .planet-selected-ring { stroke: var(--modern-accent); }
body.warpi-modern #modern-map-svg .dss-marker { color: var(--map-player); }
body.warpi-modern #modern-map-svg .modern-planet-group:has(.planet-selected-ring) .planet-label { fill: #fff9e6; opacity: 1; }
body.warpi-modern #modern-map-svg .planet:hover { stroke: #fff9e6; }

/* Tint existing alpha insignia; no glow, new assets or planet-specific rules. */
body.warpi-modern #modern-map-svg .faction-icon {
    filter: grayscale(1) brightness(.85);
}
body.warpi-modern #modern-map-svg [data-faction="super-earth"] .faction-icon {
    filter: brightness(0) saturate(100%) invert(83%) sepia(30%) saturate(600%) hue-rotate(4deg) brightness(94%) contrast(85%);
}
body.warpi-modern #modern-map-svg [data-faction="automatons"] .faction-icon {
    filter: brightness(0) saturate(100%) invert(57%) sepia(18%) saturate(1100%) hue-rotate(314deg) brightness(90%) contrast(86%);
}
body.warpi-modern #modern-map-svg [data-faction="terminids"] .faction-icon {
    filter: brightness(0) saturate(100%) invert(69%) sepia(33%) saturate(650%) hue-rotate(349deg) brightness(90%) contrast(87%);
}
body.warpi-modern #modern-map-svg [data-faction="illuminate"] .faction-icon {
    filter: brightness(0) saturate(100%) invert(73%) sepia(13%) saturate(700%) hue-rotate(168deg) brightness(91%) contrast(86%);
}

/* Existing hatch/stipple geometry keeps its low opacity and receives identity. */
body.warpi-modern #modern-sector-super-earth path { stroke: var(--map-player); }
body.warpi-modern #modern-sector-automaton path { stroke: var(--map-automaton); }
body.warpi-modern #modern-sector-terminid circle { fill: var(--map-terminid); }
body.warpi-modern #modern-sector-illuminate path { stroke: var(--map-illuminate); }
body.warpi-modern .mo-target-marker { border-color: var(--modern-accent); }
body.warpi-modern #modern-map-key .key-campaign { border-color: var(--map-neutral); }
body.warpi-modern #modern-map-key .key-order { border-color: var(--modern-accent); }

/* Biome surfaces keep their local texture colours; ownership lives on the rim. */
body.warpi-modern #modern-map-svg .modern-world-disc {
    pointer-events: none;
    filter: saturate(.8);
}
body.warpi-modern #modern-map-svg .modern-world-disc[data-biome-family="earth"] {
    filter: none;
}
body.warpi-modern #modern-map-svg [data-world-activity="inactive"] .modern-world-disc {
    filter: saturate(.6) brightness(.85);
}
body.warpi-modern #modern-map-svg .world-ownership-rim {
    stroke: var(--map-faction-colour, var(--map-neutral));
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
    opacity: .8;
    pointer-events: none;
}
body.warpi-modern #modern-map-svg [data-world-activity="inactive"] .world-ownership-rim {
    opacity: .45;
}

/* Ownership badges sit over, rather than tinting/replacing, world surfaces. */
body.warpi-modern #modern-map-svg .faction-badge {
    pointer-events: none;
}
body.warpi-modern #modern-map-svg .faction-badge-backplate {
    fill: #101317;
    fill-opacity: .94;
    stroke: var(--map-faction-colour, var(--map-neutral));
    stroke-width: .7;
}
body.warpi-modern #modern-map-svg .faction-badge[data-faction="terminids"] .faction-icon {
    filter: brightness(0) saturate(100%) invert(86%) sepia(53%) saturate(670%) hue-rotate(2deg) brightness(97%) contrast(90%);
}
body.warpi-modern #modern-map-svg .faction-badge[data-faction="illuminate"] .faction-icon {
    filter: brightness(0) saturate(100%) invert(66%) sepia(22%) saturate(820%) hue-rotate(219deg) brightness(95%) contrast(88%);
}

/* Territorial palette is separate from biome surfaces and tactical markers. */
body.warpi-modern #modern-map-svg [data-modern-layer="sectors"] {
    pointer-events: none;
    --map-faction-colour: #74808b;
}
body.warpi-modern #modern-map-svg [data-modern-layer="sectors"] [data-faction="super-earth"],
body.warpi-modern #modern-map-svg [data-modern-layer="sectors"] [data-faction="neutral"] { --map-faction-colour: #74808b; }
body.warpi-modern #modern-map-svg [data-modern-layer="sectors"] [data-faction="automatons"] { --map-faction-colour: #bd6667; }
body.warpi-modern #modern-map-svg [data-modern-layer="sectors"] [data-faction="terminids"] { --map-faction-colour: #d9c75e; }
body.warpi-modern #modern-map-svg [data-modern-layer="sectors"] [data-faction="illuminate"] { --map-faction-colour: #a58acb; }
/* Sector-contained territory sits behind the persistent galactic subdivisions. */
body.warpi-modern #modern-map-svg .territory-region {
    fill: var(--map-faction-colour);
    fill-opacity: .085;
    stroke: var(--map-faction-colour);
    stroke-opacity: 0;
    stroke-width: 1.2;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}
body.warpi-modern #modern-map-svg .territory-frontline {
    fill: none;
    stroke: var(--map-faction-colour);
    stroke-opacity: .62;
    stroke-width: 1.3;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}
body.warpi-modern #modern-map-svg .territory-region-label {
    fill: var(--map-faction-colour);
    fill-opacity: .8;
    font: 700 24px Arial, Helvetica, sans-serif;
    letter-spacing: .16em;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}
body.warpi-modern #modern-map-svg .faction-badge[data-faction="terminids"] { --map-faction-colour: #d9c75e; }
body.warpi-modern #modern-map-svg .faction-badge[data-faction="illuminate"] { --map-faction-colour: #a58acb; }

body.warpi-modern #modern-map-svg .galactic-disc {
    fill: #10151a;
    fill-opacity: .7;
    stroke: #89949e;
    stroke-opacity: .38;
    stroke-width: 1;
    vector-effect: non-scaling-stroke;
}
body.warpi-modern #modern-map-svg .sector-boundary {
    fill: none;
    stroke: #8b98a5;
    stroke-width: .8;
    vector-effect: non-scaling-stroke;
}

body.warpi-modern #modern-map-svg .sector-name {
    fill: var(--map-faction-colour, #8b98a5);
    fill-opacity: .72;
    font: 500 10px Arial, Helvetica, sans-serif;
    letter-spacing: .12em;
    text-anchor: middle;
    dominant-baseline: middle;
    pointer-events: none;
}

body.warpi-modern #modern-map-svg .orbit-pivot-marker {
    pointer-events: none;
    opacity: .55;
}
body.warpi-modern #modern-map-svg .orbit-pivot-marker path {
    fill: none;
    stroke: #c7c7ac;
    stroke-width: 1;
    stroke-linecap: square;
    vector-effect: non-scaling-stroke;
}

/* Map controls share one compact Modern treatment; no unrelated page buttons. */
body.warpi-modern #map-controls #fullscreen-btn,
body.warpi-modern #projection-controls button,
body.warpi-modern #modern-intel-close {
    padding: 5px 8px;
    border: 1px solid #414b54;
    border-radius: 2px;
    background: #151a1f;
    color: var(--modern-text);
    font: 600 10px/1.4 Arial, Helvetica, sans-serif;
    letter-spacing: .055em;
    text-shadow: none;
    box-shadow: none;
    filter: none;
    cursor: pointer;
    pointer-events: auto;
}
body.warpi-modern[data-modern-map-ready="true"] #projection-controls { gap: 3px; }
body.warpi-modern #map-controls #fullscreen-btn:hover,
body.warpi-modern #projection-controls button:hover,
body.warpi-modern #modern-intel-close:hover {
    background: #20272e;
    border-color: #74808b;
    color: var(--modern-text);
}
body.warpi-modern #projection-controls button[aria-pressed="true"],
body.warpi-modern #map-controls #fullscreen-btn:active,
body.warpi-modern #projection-controls button:active,
body.warpi-modern #modern-intel-close:active,
body.warpi-modern #screen:fullscreen #map-controls #fullscreen-btn {
    background: #26271c;
    border-color: var(--modern-accent);
    color: var(--modern-accent);
}
body.warpi-modern #map-controls #fullscreen-btn:focus-visible,
body.warpi-modern #projection-controls button:focus-visible,
body.warpi-modern #modern-intel-close:focus-visible,
body.warpi-modern #modern-dss-panel:focus-visible {
    outline: 2px solid var(--modern-accent);
    outline-offset: 2px;
}
body.warpi-modern #mo-target-panel .mo-target-title,
body.warpi-modern #mo-target-panel .mo-directive-title {
    background: #14191e;
    color: var(--modern-text);
    font: 600 10px/1.4 Arial, Helvetica, sans-serif;
    letter-spacing: .07em;
    text-shadow: none;
    box-shadow: none;
}
body.warpi-modern #mo-target-panel .mo-target-title { border-bottom: 1px solid #414b54; }
body.warpi-modern #modern-intel-panel::before {
    color: var(--modern-text);
    font: 600 10px/1.4 Arial, Helvetica, sans-serif;
    letter-spacing: .07em;
}
body.warpi-modern #modern-map-key { border: 1px solid var(--modern-border); }

/* Official DSS location overlay: no extra map layout row. */
body.warpi-modern #modern-dss-panel {
    position: absolute;
    left: 14px;
    top: 54px;
    z-index: 22;
    width: min(220px, calc(100% - 28px));
    box-sizing: border-box;
    padding: 9px 10px;
    border: 1px solid #414b54;
    border-left: 2px solid var(--modern-accent);
    border-radius: 2px;
    background: var(--modern-surface);
    color: var(--modern-text);
    font: 11px/1.4 Arial, Helvetica, sans-serif;
    text-align: left;
    text-shadow: none;
    box-shadow: none;
    overflow-wrap: anywhere;
    cursor: pointer;
    pointer-events: auto;
}
body.warpi-modern[data-modern-map-ready="true"] #modern-dss-panel { display: grid !important; gap: 2px; }
body.warpi-modern #modern-dss-panel .dss-title { color: var(--modern-accent); font-size: 9px; font-weight: 600; letter-spacing: .06em; }
body.warpi-modern #modern-dss-panel .dss-label { margin-top: 4px; color: var(--modern-muted); font-size: 8px; letter-spacing: .08em; }
body.warpi-modern #modern-dss-panel .dss-location { font-size: 12px; font-weight: 600; }
body.warpi-modern #modern-dss-panel .dss-sector { color: var(--modern-muted); font-size: 10px; }
body.warpi-modern #modern-dss-panel .dss-sector[hidden] { display: none; }
body.warpi-modern #modern-dss-panel:hover:not(:disabled) { border-color: var(--modern-accent); background: #1b2025; }
body.warpi-modern #modern-dss-panel:disabled { cursor: default; }
body.warpi-modern #modern-dss-panel:disabled .dss-location { color: var(--modern-muted); font-size: 10px; }
@media (max-width: 700px) {
    body.warpi-modern #modern-dss-panel { left: 8px; top: 52px; width: min(180px, calc(100% - 204px)); padding: 7px 8px; }
    body.warpi-modern #modern-dss-panel .dss-title { font-size: 8px; }
    body.warpi-modern #modern-dss-panel .dss-location { font-size: 11px; }
}

@media (max-width: 400px) {
    body.warpi-modern #modern-dss-panel { top: 68px; }
}

body.warpi-modern #modern-pivot-status {
    width: 100%;
    text-align: right;
    color: var(--modern-muted);
    font: 500 9px/1.4 Arial, Helvetica, sans-serif;
    letter-spacing: .06em;
    padding-top: 3px;
    pointer-events: none;
}
body.warpi-modern #modern-pivot-status[hidden] { display: none; }

/* Phone presentation only: desktop rules and the legacy map remain untouched. */
@media (max-width: 700px) {
    body.warpi-modern #screen {
        --mobile-top: max(8px, env(safe-area-inset-top));
        --mobile-left: max(8px, env(safe-area-inset-left));
        --mobile-right: max(8px, env(safe-area-inset-right));
        --mobile-bottom: max(8px, env(safe-area-inset-bottom));
        --mobile-second: calc(var(--mobile-top) + 52px);
    }
    body.warpi-modern #screen[data-mobile-custom-pivot="true"] { --mobile-second: calc(var(--mobile-top) + 68px); }
    body.warpi-modern header { top: var(--mobile-top); }
    body.warpi-modern header .subtitle { display: none; }
    body.warpi-modern #map-controls {
        left: var(--mobile-left); right: var(--mobile-right); width: auto;
        display: grid; grid-template-columns: minmax(0, 1fr) 44px; gap: 6px;
    }
    body.warpi-modern #projection-controls {
        grid-column: 1; grid-row: 1; display: grid !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 44px;
        gap: 6px; margin: 0; pointer-events: auto;
    }
    body.warpi-modern #projection-controls button { min-width: 0; min-height: 44px; padding: 6px; font-size: 10px; }
    body.warpi-modern #map-controls #fullscreen-btn {
        grid-column: 2; grid-row: 1; width: 44px; min-height: 44px; margin: 0; padding: 0; font-size: 0;
    }
    body.warpi-modern #fullscreen-btn::after { content: '⛶'; font-size: 23px; }
    body.warpi-modern #projection-controls #modern-reset-pivot { font-size: 0; }
    body.warpi-modern #modern-reset-pivot::after { content: '↺'; font-size: 22px; }
    body.warpi-modern #modern-pivot-status { display: none; }
    body.warpi-modern #screen[data-mobile-custom-pivot="true"] #modern-pivot-status {
        display: block; grid-column: 1 / -1; padding: 0; font-size: 9px; line-height: 10px;
    }
    body.warpi-modern #modern-dss-panel {
        left: var(--mobile-left); top: var(--mobile-second); width: calc(100% - var(--mobile-left) - var(--mobile-right) - 112px);
        box-sizing: border-box; min-height: 44px; padding: 7px 9px; align-items: center; text-align: left;
    }
    body.warpi-modern[data-modern-map-ready="true"] #modern-dss-panel { display: flex !important; gap: 6px; }
    body.warpi-modern #modern-dss-panel::before { content: 'DSS //'; flex: none; color: var(--modern-accent); font-size: 10px; font-weight: 600; }
    body.warpi-modern #modern-dss-panel .dss-title,
    body.warpi-modern #modern-dss-panel .dss-label,
    body.warpi-modern #modern-dss-panel .dss-sector { display: none; }
    body.warpi-modern #modern-dss-panel .dss-location { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
    body.warpi-modern #modern-mobile-mo,
    body.warpi-modern #modern-mobile-help {
        position: absolute; z-index: 24; min-height: 44px; padding: 8px;
        border: 1px solid #414b54; border-radius: 2px; background: #151a1f; color: #e7e7df;
        font: 600 10px/1.2 system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
        letter-spacing: .04em; cursor: pointer;
    }
    body.warpi-modern #modern-mobile-mo { box-sizing: border-box; right: var(--mobile-right); top: var(--mobile-second); width: 104px; }
    body.warpi-modern #modern-mobile-help { right: var(--mobile-right); bottom: calc(var(--mobile-bottom) + 26px); }
    body.warpi-modern #modern-mobile-mo[aria-expanded="true"],
    body.warpi-modern #modern-mobile-help[aria-expanded="true"] { color: var(--modern-accent); border-color: var(--modern-accent); }
    body.warpi-modern #modern-mobile-mo:focus-visible,
    body.warpi-modern #modern-mobile-help:focus-visible { outline: 2px solid var(--modern-accent); outline-offset: 2px; }
    body.warpi-modern #mo-target-panel { display: none !important; }
    body.warpi-modern #screen.modern-mobile-mo-open #mo-target-panel {
        display: block !important; position: absolute; top: calc(var(--mobile-second) - var(--mobile-top) + 44px);
        left: 0; right: auto; width: calc(100dvw - var(--mobile-left) - var(--mobile-right)); margin-top: 8px; z-index: 40;
        max-height: min(50vh, calc(100dvh - 180px - env(safe-area-inset-bottom)));
        overflow-y: auto; overscroll-behavior: contain; pointer-events: auto; touch-action: pan-y;
    }
    body.warpi-modern #modern-map-key,
    body.warpi-modern #status,
    body.warpi-modern[data-modern-map-ready=true] #screen #modern-command-status { display: none !important; }
    body.warpi-modern #modern-mobile-help-panel {
        display: none; position: absolute; z-index: 25; right: var(--mobile-right);
        bottom: calc(var(--mobile-bottom) + 78px); width: min(300px, calc(100% - var(--mobile-left) - var(--mobile-right)));
        box-sizing: border-box; padding: 12px; border: 1px solid #414b54; background: #151a1f;
        color: #d6d9dc; font: 11px/1.7 system-ui, sans-serif;
    }
    body.warpi-modern #screen.modern-mobile-help-open #modern-mobile-help-panel { display: block; }
    body.warpi-modern #modern-mobile-status {
        position: absolute; z-index: 20; left: var(--mobile-left); right: var(--mobile-right); bottom: var(--mobile-bottom);
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap; pointer-events: none;
        color: #a1aab2; font: 9px/18px system-ui, sans-serif;
    }
    body.warpi-modern #modern-map-svg .planet-label { display: none; }
    body.warpi-modern #modern-map-svg .planet-label[data-mobile-visible="true"] { display: block; }
}

/* Phone-only decluttering; existing tablet/desktop rules remain intact. */
@media (max-width: 600px) {
    body.warpi-modern #modern-map-svg .territory-region-label { display: none !important; }
    body.warpi-modern header .title { display: none; }
    body.warpi-modern #map-controls {
        right: auto; width: 252px; max-width: calc(100% - var(--mobile-left) - var(--mobile-right));
        grid-template-columns: minmax(0, 1fr) 44px; gap: 3px;
    }
    body.warpi-modern #projection-controls { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) 44px; gap: 3px; }
    body.warpi-modern #projection-controls button { padding: 3px; font-size: 9px; min-height: 44px; }
    body.warpi-modern #projection-controls #modern-reset-pivot { font-size: 0; }
    body.warpi-modern #modern-dss-panel { z-index: 26; }
    body.warpi-modern #modern-map-svg .planet-label { font-size: 17px; }
}

/* Phone uses the existing Flat camera; keep Reset and Fullscreen accessible. */
@media (max-width: 600px) {
    body.warpi-modern #projection-controls [data-projection-mode] { display: none !important; }
    body.warpi-modern #map-controls { width: 91px; }
    body.warpi-modern #projection-controls { grid-template-columns: 44px; }
}

/* Planet-level Gloom only: shared radial SVG paint, no blur/particles/animation.
   Static haze also respects reduced-motion preferences and phone GPU budgets. */
body.warpi-modern #modern-map-svg .gloom-indicator{pointer-events:none}
body.warpi-modern #modern-map-svg .gloom-badge{fill:#242c22;stroke:#bac88b;stroke-width:1.3}
body.warpi-modern #modern-map-svg [data-gloom-stale=true] .gloom-indicator{opacity:.45}
body.warpi-modern #modern-map-svg [data-gloom-stale=true] .gloom-badge{stroke-dasharray:2 1}
body.warpi-modern #modern-intel-gloom{margin-top:10px;padding-top:8px;border-top:1px solid var(--modern-border);font-size:10px;line-height:1.5;color:#c0cc9a;overflow-wrap:anywhere}
body.warpi-modern #modern-intel-gloom strong{display:block;font-size:11px}
body.warpi-modern #modern-intel-gloom time{display:block;margin-top:4px;font-size:9px;color:var(--modern-muted)}
body.warpi-modern #modern-intel-gloom[data-stale=true] time{color:#d0b47e}

/* Fixed procedural deep-space backdrop; all map and UI layers remain above it. */
body.warpi-modern[data-modern-map-ready="true"] #modern-starfield{display:block!important;position:absolute;inset:0;width:100%;height:100%;z-index:0;pointer-events:none;overflow:hidden}
body.warpi-modern #modern-starfield .map-star{fill:#c1cbd2;pointer-events:none}
body.warpi-modern[data-modern-map-ready="true"] #modern-map-svg{z-index:1}
body.warpi-modern #modern-map-svg [data-modern-layer=gloom]{pointer-events:none}
body.warpi-modern #modern-map-svg [data-modern-layer=gloom][data-gloom-stale=true]{opacity:.45}
body.warpi-modern #modern-map-svg .gloom-cloud-lobe{pointer-events:none}
body.warpi-modern .gloom-cloud-key{color:#c4b36c}
body.warpi-modern #modern-intel-gloom small{display:block;margin-top:5px;font-size:9px;color:var(--modern-muted)}

/* Vector lettering printed on the same canonical plane as the disc. */
body.warpi-modern #modern-map-svg [data-modern-layer=faction-labels],
body.warpi-modern #modern-map-svg [data-modern-layer=faction-labels] * { pointer-events: none; user-select: none; }
body.warpi-modern #modern-map-svg .faction-world-ink { font: 700 56px Arial,Helvetica,sans-serif; letter-spacing: 4.4px; text-anchor: middle; fill-opacity: .88; paint-order: stroke fill; stroke: #10151a; stroke-width: 4px; stroke-linejoin: round; }
body.warpi-modern #modern-map-svg .faction-world-ink[data-faction=automatons] { fill: #bd6667; }
body.warpi-modern #modern-map-svg .faction-world-ink[data-faction=terminids] { fill: #d9c75e; }
body.warpi-modern #modern-map-svg .faction-world-ink[data-faction=illuminate] { fill: #a58acb; }

/* Modern-only content sizing overrides the injected shell's old 160px cap. */
body.warpi-modern #screen #map-controls #mo-target-panel {
    box-sizing: border-box; height: auto; max-height: none; overflow: visible;
    pointer-events: auto; overflow-wrap: anywhere;
}
body.warpi-modern #screen #mo-target-panel[data-mo-fit] .mo-target-title { padding: 4px 7px; }
body.warpi-modern #screen #mo-target-panel[data-mo-fit] #mo-target-list { padding: 3px 7px; }
body.warpi-modern #screen #mo-target-panel[data-mo-fit] .mo-target-row { padding: 1px 0; }
body.warpi-modern #screen #mo-target-panel[data-mo-fit] #mo-directive { padding: 5px 7px; margin-top: 2px; }
body.warpi-modern #screen #mo-target-panel[data-mo-fit] .mo-directive-title { margin-bottom: 3px; }
body.warpi-modern #screen #mo-target-panel:is([data-mo-fit=dense],[data-mo-fit=scroll]) #mo-directive-text { font-size: 11px; line-height: 1.35; }
body.warpi-modern #screen #map-controls #mo-target-panel[data-mo-fit=scroll] {
    max-height: var(--modern-mo-space); overflow-y: auto; overflow-x: hidden;
    overscroll-behavior: contain; touch-action: pan-y;
}
body.warpi-modern[data-modern-map-ready=true] #status { visibility: hidden; }
body.warpi-modern #modern-command-status { position: absolute; z-index: 10; pointer-events: none; }
body.warpi-modern[data-modern-map-ready=true] #modern-command-status { display: block !important; }
body.warpi-v2-map.warpi-modern #modern-command-status { font-size: 8px; left: 12px; bottom: 9px; max-width: calc(100% - 24px); letter-spacing: .035em; }

/* The separate Super Earth backdrop alone breathes; emblem and names stay static. */
body.warpi-modern #modern-map-svg .super-earth-radiance,
body.warpi-modern #modern-map-svg .super-earth-radiance * { pointer-events:none; user-select:none; }
body.warpi-modern #modern-map-svg .super-earth-outer-glow { animation:super-earth-command-breathe var(--super-earth-pulse-speed,24s) ease-in-out infinite; }
@keyframes super-earth-command-breathe { 0%,100% { opacity:.78; } 50% { opacity:1; } }
@media(prefers-reduced-motion:reduce) {
 body.warpi-modern #modern-map-svg .super-earth-outer-glow { animation:none; }
}

/* Modern owns a separate SVG. Remove the unseen legacy scene from layout,
   and pause its CSS effects; deleting the ready flag restores CRT unchanged. */
body.warpi-modern[data-modern-map-ready="true"] #map { display:none !important; }
body.warpi-modern[data-modern-map-ready="true"] #map,
body.warpi-modern[data-modern-map-ready="true"] #map * { animation-play-state:paused !important; }

/* Void monitor: decorative billboards only; no regional boundary or animation. */
body.warpi-modern #modern-intel-void{border-top:1px solid rgba(182,139,232,.2);margin-top:12px;padding-top:10px;font-size:11px;line-height:1.6}
body.warpi-modern #modern-intel-void strong,body.warpi-modern #modern-intel-void time,body.warpi-modern #modern-intel-void small{display:block}
body.warpi-modern #modern-intel-void[data-state=current] strong{color:#b68be8}
body.warpi-modern #modern-intel-void small,body.warpi-modern #modern-intel-void time{opacity:.65;font-size:9px}
body.warpi-modern .void-indicator{pointer-events:none}

/* Small procedural billboard bodies; no post-processing or frame-time geometry. */
body.warpi-modern #modern-map-svg [data-world-activity] .celestial-body{filter:none;pointer-events:none}
body.warpi-modern #modern-intel-celestial{border-top:1px solid var(--modern-border);margin-top:10px;padding-top:8px;font-size:10px;line-height:1.5;overflow-wrap:anywhere}
body.warpi-modern #modern-intel-celestial strong{display:block;color:#c5b796;font-size:10px}
body.warpi-modern #modern-intel-celestial p{margin:5px 0 0;color:var(--modern-muted)}
body.warpi-modern .celestial-shard-spin{animation:celestial-spin 120s linear infinite;transform-origin:0 0}
body.warpi-modern .celestial-lensing{animation:celestial-lens 24s ease-in-out infinite;transform-origin:0 0}
@keyframes celestial-spin{to{transform:rotate(360deg)}}
@keyframes celestial-lens{0%,100%{transform:rotate(-3deg) scale(1);opacity:.25}50%{transform:rotate(3deg) scale(1.025);opacity:.5}}
@media(prefers-reduced-motion:reduce),(max-width:600px){body.warpi-modern .celestial-shard-spin,body.warpi-modern .celestial-lensing{animation:none}}
body.warpi-modern:not([data-modern-map-ready=true]) .celestial-body *{animation-play-state:paused}

/* Historical Sol object has no API statistics or anomaly/strategic assessment. */
body.warpi-modern #modern-intel-panel[data-special-object] .intel-row,
body.warpi-modern #modern-intel-panel[data-special-object] #modern-intel-alert{display:none}
body.warpi-modern .modern-special-object-group{cursor:pointer}
body.warpi-modern .modern-special-object-group:focus-visible .planet-hit{stroke:#d3b860;stroke-width:1;outline:none}

/* Existing billboard SVG label; light outline avoids costly blur filters. */
body.warpi-modern #modern-map-svg .super-earth-label{paint-order:stroke fill;stroke:#080c11;stroke-width:3px;stroke-linejoin:round;fill:#e4e5de;opacity:1;text-anchor:middle}

/* Mars stays a small scorched sphere; a neutral warm limb makes it legible in dense terrain. */
body.warpi-modern #modern-map-svg [data-special-object="special:mars"] .celestial-scorched-sphere{stroke:#ab8062;stroke-width:.8px}
body.warpi-modern #modern-map-svg [data-special-object="special:mars"] .planet-label{opacity:1;fill:#e2cbb6;font-size:12px;paint-order:stroke fill;stroke:#080c11;stroke-width:2.5px;stroke-linejoin:round}
@media(max-width:600px){body.warpi-modern #modern-map-svg [data-special-object="special:mars"] .planet-label{font-size:17px}}
