:root {
    --phosphor: #78ff78;
    --bright: #b2ffb2;
    --dim: #35a835;
    --faint: #174817;
}

* {
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    margin: 0;
    overflow: hidden;
    background: #000;
}

body {
    color: var(--phosphor);
    font-family: "Courier New", Courier, monospace;
}

/* CRT DISPLAY */

#crt {
    position: relative;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    padding: 3.5vh 5vw 4.5vh;

    background:
        radial-gradient(
            ellipse at center,
            #082008 0%,
            #031003 58%,
            #000 100%
        );

    text-shadow:
        0 0 2px #55ff55,
        0 0 5px rgba(70,255,70,.28);

    animation: crtFlicker 8s infinite;
}

/* SCANLINES */

#scanlines {
    position: absolute;
    inset: 0;
    z-index: 1000;
    pointer-events: none;

    background:
        repeating-linear-gradient(
            0deg,
            rgba(0,0,0,.18) 0,
            rgba(0,0,0,.18) 1px,
            transparent 1px,
            transparent 4px
        );

    box-shadow: inset 0 0 10vw #000;
}

/* ROLLING CRT BAND */

#sweep {
    position: absolute;
    left: 0;
    right: 0;
    top: -8vh;
    height: 5vh;
    z-index: 999;
    pointer-events: none;

    background:
        linear-gradient(
            transparent,
            rgba(130,255,130,.09),
            transparent
        );

    animation: sweep 9s linear infinite;
}

/* STATIC DURING SCREEN CHANGE */

#flash {
    position: absolute;
    inset: 0;
    z-index: 900;
    pointer-events: none;
    opacity: 0;

    background:
        repeating-linear-gradient(
            0deg,
            transparent 0,
            transparent 5px,
            rgba(150,255,150,.20) 6px,
            transparent 8px
        );
}

#flash.fire {
    animation: staticBurst .22s linear;
}

/* HEADER */

header {
    height: 9vh;

    display: grid;
    grid-template-columns: 1fr 3fr 1fr;
    align-items: center;

    border-bottom: 2px solid var(--phosphor);
}

.logo {
    font-size: clamp(25px,3vw,50px);
    font-weight: bold;
    letter-spacing: .16em;
}

.header-centre {
    text-align: center;
    color: var(--dim);
    font-size: clamp(12px,1.3vw,21px);
    letter-spacing: .14em;
}

#clock {
    text-align: right;
    color: var(--dim);
    font-size: clamp(13px,1.3vw,22px);
}

/* SCREENS */

main {
    height: 78vh;
}

.screen {
    display: none;
    height: 100%;
    padding-top: 2.5vh;
}

.screen.active {
    display: block;
    animation: screenOpen .20s linear;
}

.screen-title {
    margin-bottom: 2.2vh;
    font-size: clamp(23px,2.5vw,41px);
    font-weight: bold;
    letter-spacing: .15em;
}

/* COMMON */

.box {
    border: 1px solid var(--dim);
    padding: 1.8vh 1.8vw;
    background: rgba(0,30,0,.10);
}

.label {
    color: var(--dim);
    letter-spacing: .12em;
    font-size: clamp(13px,1.25vw,21px);
}

.huge {
    margin-top: 1vh;
    font-size: clamp(55px,8vw,125px);
    font-weight: bold;
    line-height: .95;
}

.progress {
    height: 7px;
    border: 1px solid var(--faint);
    margin: .2vh 0 .55vh;
}

.progress > div {
    height: 100%;
    background: var(--phosphor);
    box-shadow: 0 0 6px var(--phosphor);
}

/* GALACTIC STATUS */

.status-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3vw;
}

.hero {
    min-height: 23vh;
}

.faction-grid {
    display: grid;
    grid-template-columns: repeat(3,1fr);
    gap: 2vw;
    margin-top: 3vh;
}

.faction-box {
    border-top: 1px solid var(--dim);
    padding-top: 1.5vh;
}

.faction-name {
    font-size: clamp(16px,1.5vw,25px);
    font-weight: bold;
}

.faction-count {
    margin-top: .5vh;
    font-size: clamp(24px,2.7vw,46px);
}

.faction-share {
    color: var(--dim);
    font-size: clamp(12px,1.1vw,18px);
}

/* ACTIVE FRONTS */

.front {
    margin-bottom: 2.3vh;
}

.front-title {
    display: flex;
    justify-content: space-between;
    margin-bottom: .5vh;
    font-size: clamp(17px,1.6vw,27px);
    font-weight: bold;
}

.planet-row {
    display: grid;
    grid-template-columns: 2.4fr .9fr .8fr .8fr;
    gap: 1vw;
    padding: .35vh 0;
    font-size: clamp(12px,1.05vw,18px);
}

.defence {
    color: var(--bright);
    font-weight: bold;
}

/* MAJOR ORDER */

.mo {
    padding: 2.4vh 2vw;
}

.briefing {
    min-height: 8vh;
    font-size: clamp(16px,1.55vw,27px);
    line-height: 1.45;
}

.mo-meta {
    display: flex;
    justify-content: space-between;
    margin: 1.5vh 0 2.5vh;
    padding: 1vh 0;
    border-top: 1px solid var(--dim);
    border-bottom: 1px solid var(--dim);
    color: var(--bright);
    font-size: clamp(14px,1.3vw,22px);
}

.mo-task {
    margin-bottom: 2.2vh;
}

.mo-task-head {
    display: flex;
    justify-content: space-between;
    font-size: clamp(15px,1.4vw,24px);
}

.mo-numbers {
    margin-top: .4vh;
    color: var(--dim);
    font-size: clamp(12px,1.1vw,19px);
}

/* DEPLOYMENT */

.deployment-head,
.deployment-row {
    display: grid;
    grid-template-columns: 2.5fr 1.2fr 1fr .7fr;
    gap: 1vw;
}

.deployment-head {
    color: var(--dim);
    padding-bottom: 1vh;
    border-bottom: 1px solid var(--dim);
    font-size: clamp(12px,1vw,17px);
}

.deployment-row {
    padding: 1.1vh 0;
    border-bottom: 1px dotted var(--faint);
    font-size: clamp(14px,1.3vw,22px);
}

.rank {
    color: var(--dim);
}

/* FOOTER */

footer {
    position: absolute;
    left: 5vw;
    right: 5vw;
    bottom: 2.2vh;

    display: grid;
    grid-template-columns: 1fr 1fr 1fr;

    border-top: 1px solid var(--dim);
    padding-top: .8vh;

    color: var(--dim);
    font-size: clamp(10px,.9vw,15px);
}

footer span:nth-child(2) {
    text-align: center;
}

footer span:nth-child(3) {
    text-align: right;
}

/* DATA RECEIVED OVERLAY */

#transmission {
    position: absolute;
    inset: 0;

    display: none;
    align-items: center;
    justify-content: center;

    z-index: 800;

    background: rgba(0,8,0,.92);

    text-align: center;
    font-size: clamp(25px,4vw,65px);
    letter-spacing: .15em;
}

#transmission.show {
    display: flex;
    animation: transmission .65s linear;
}

#transmission strong {
    font-size: 1.35em;
}

.cursor {
    animation: blink 1s steps(1) infinite;
}

/* ANIMATIONS */

@keyframes blink {
    50% { opacity: 0; }
}

@keyframes crtFlicker {
    0%,95%,97%,100% { opacity: 1; }
    96% { opacity: .94; }
    98% { opacity: .97; }
}

@keyframes sweep {
    from { top: -8vh; }
    to   { top: 108vh; }
}

@keyframes screenOpen {
    0% {
        opacity: .15;
        
        filter: brightness(3);
    }

    45% {
        opacity: .8;
        
    }

    100% {
        opacity: 1;
        
        filter: brightness(1);
    }
}

@keyframes staticBurst {
    0%   { opacity: 0; }
    25%  { opacity: .8; }
    55%  { opacity: .25; }
    75%  { opacity: .7; }
    100% { opacity: 0; }
}

@keyframes transmission {
    0% {
        opacity: 0;
        
    }

    20% {
        opacity: 1;
        
    }

    80% {
        opacity: 1;
    }

    100% {
        opacity: 0;
    }
}


/* =================================================
   WARPI WEB v1.2 - CRT TERMINAL ENHANCEMENTS
   ================================================= */


/* subtle curved-glass vignette */

#crt::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1100;
    pointer-events: none;

    background:
        radial-gradient(
            ellipse at center,
            transparent 55%,
            rgba(0,0,0,.18) 75%,
            rgba(0,0,0,.72) 100%
        );

    box-shadow:
        inset 0 0 5vw rgba(0,0,0,.85),
        inset 0 0 1.5vw rgba(80,255,80,.08);
}


/* extremely subtle phosphor texture */

#crt::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1090;
    pointer-events: none;
    opacity: .07;

    background-image:
        repeating-linear-gradient(
            90deg,
            rgba(100,255,100,.10) 0,
            rgba(100,255,100,.10) 1px,
            transparent 1px,
            transparent 3px
        );
}


/* brighter phosphor headings */

.screen-title,
.logo {
    color: var(--bright);

    text-shadow:
        0 0 2px var(--phosphor),
        0 0 5px rgba(100,255,100,.42),
        0 0 10px rgba(100,255,100,.16);
}


/* military terminal header decoration */

.header-centre::before {
    content: "[ ";
}

.header-centre::after {
    content: " ]";
}


/* slightly more terminal-like boxes */

.box {
    position: relative;
}

.box::before {
    content: "";
    position: absolute;
    width: 13px;
    height: 13px;

    top: -1px;
    left: -1px;

    border-top: 2px solid var(--bright);
    border-left: 2px solid var(--bright);
}

.box::after {
    content: "";
    position: absolute;
    width: 13px;
    height: 13px;

    right: -1px;
    bottom: -1px;

    border-right: 2px solid var(--bright);
    border-bottom: 2px solid var(--bright);
}


/* stronger defence warning */

.defence {
    animation: defencePulse 1.5s steps(2) infinite;
}


/* little phosphor pulse in progress bars */

.progress > div {
    position: relative;
    overflow: hidden;
}

.progress > div::after {
    content: "";
    position: absolute;

    top: 0;
    bottom: 0;
    width: 20%;

    background:
        linear-gradient(
            90deg,
            transparent,
            rgba(220,255,220,.75),
            transparent
        );

    animation: barSweep 3.5s linear infinite;
}


/* occasional tiny vertical picture instability */

main {
    animation: verticalHold 13s infinite;
}


/* cursor now behaves more like a terminal */

.cursor {
    display: inline-block;

    text-shadow:
        0 0 8px var(--phosphor);
}


/* CRT shutdown/open flash used during screen switch */

.screen.active {
    transform-origin: center center;
}


/* =================================================
   NEW ANIMATIONS
   ================================================= */

@keyframes defencePulse {

    0%, 70% {
        opacity: 1;
    }

    71%, 100% {
        opacity: .55;
    }
}


@keyframes barSweep {

    from {
        left: -30%;
    }

    to {
        left: 120%;
    }
}


@keyframes verticalHold {

    0%, 92%, 94%, 100% {
        transform: translateY(0);
    }

    92.5% {
        transform: translateY(1px);
    }

    93% {
        transform: translateY(-1px);
    }

    93.5% {
        transform: translateY(0);
    }
}


/* make selection look like an old terminal too */

::selection {
    background: var(--phosphor);
    color: #001000;
}


/* =================================================
   WARPI v1.2 - SCREEN TRANSITIONS / UPLINK
   ================================================= */

#crt.screen-collapse main {
    animation: terminalStutterOut .12s steps(1) forwards;
}

#crt.screen-restore main {
    animation: terminalStutterIn .14s steps(1) forwards;
}

@keyframes terminalStutterOut {
    0% {
        transform: translateX(0);
        filter: brightness(1) contrast(1);
        opacity: 1;
    }

    25% {
        transform: translateX(5px);
        filter: brightness(1.8) contrast(1.6);
        opacity: .9;
    }

    50% {
        transform: translateX(-7px);
        filter: brightness(.65) contrast(2);
        opacity: .75;
    }

    75% {
        transform: translateX(3px);
        filter: brightness(2.2) contrast(1.8);
        opacity: .95;
    }

    100% {
        transform: translateX(0);
        filter: brightness(.4) contrast(2);
        opacity: 0;
    }
}

@keyframes terminalStutterIn {
    0% {
        transform: translateX(-6px);
        filter: brightness(2.5) contrast(2);
        opacity: .45;
    }

    25% {
        transform: translateX(4px);
        filter: brightness(.7) contrast(1.8);
        opacity: .8;
    }

    50% {
        transform: translateX(-2px);
        filter: brightness(1.8) contrast(1.5);
        opacity: 1;
    }

    75% {
        transform: translateX(1px);
        filter: brightness(1.2) contrast(1.2);
        opacity: .9;
    }

    100% {
        transform: translateX(0);
        filter: none;
        opacity: 1;
    }
}


/* UPLINK STATUS */

#uplink.live {
    color: var(--bright);

    text-shadow:
        0 0 4px var(--phosphor),
        0 0 10px var(--phosphor);
}

#uplink.stale {
    opacity: .65;
    animation: staleBlink 1.2s steps(2) infinite;
}

#uplink.receiving {
    color: var(--bright);
    animation: receivePulse .25s steps(2) infinite;
}

@keyframes staleBlink {
    50% {
        opacity: .25;
    }
}

@keyframes receivePulse {
    50% {
        opacity: .35;
    }
}


/* brief interference burst */

#crt.signal-hit {
    animation: signalHit .16s linear;
}

@keyframes signalHit {
    0% {
        filter: brightness(1);
    }

    25% {
        filter: brightness(2.5) contrast(1.7);
        transform: translateX(2px);
    }

    50% {
        filter: brightness(.7) contrast(2);
        transform: translateX(-3px);
    }

    75% {
        filter: brightness(1.8);
        transform: translateX(1px);
    }

    100% {
        filter: none;
        transform: translateX(0);
    }
}


/* =================================================
   WARPI v1.2 - MAJOR ORDER TACTICAL DISPLAY
   ================================================= */

.mo {
    position: relative;
    overflow: hidden;
}

.mo::after {
    content: "PRIORITY TRANSMISSION";
    position: absolute;
    top: 1.1vh;
    right: 1.4vw;

    color: var(--dim);
    font-size: clamp(9px,.75vw,13px);
    letter-spacing: .18em;
}

.mo-header {
    border-left: 3px solid var(--bright);
    padding-left: 1.2vw;
    margin-bottom: 1.8vh;
}

.mo-classification {
    color: var(--dim);
    font-size: clamp(10px,.9vw,15px);
    letter-spacing: .18em;
    margin-bottom: .7vh;
}

.mo .briefing {
    min-height: 0;
    color: var(--bright);
    font-size: clamp(17px,1.6vw,28px);
    line-height: 1.35;
    font-weight: bold;
}

.mo-meta {
    margin: 1.4vh 0 1.8vh;
}

#moReward::before {
    content: "◆ ";
}

#moCountdown::before {
    content: "T-";
}

.mo-objectives-title {
    color: var(--dim);
    letter-spacing: .16em;
    font-size: clamp(10px,.9vw,15px);

    margin-bottom: 1vh;
}

.mo-task {
    position: relative;

    margin-bottom: 1.4vh;
    padding: 1vh 1vw;

    border-left: 1px solid var(--dim);
    border-right: 1px solid var(--faint);

    background:
        linear-gradient(
            90deg,
            rgba(70,255,70,.055),
            transparent 65%
        );
}

.mo-task.complete {
    border-left: 3px solid var(--bright);
}

.mo-task-head {
    align-items: center;
}

.mo-faction {
    font-weight: bold;
    letter-spacing: .09em;
}

.mo-percent {
    color: var(--bright);
    font-weight: bold;
    font-size: 1.15em;
}

.mo-numbers {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mo-state {
    letter-spacing: .12em;
}

.mo-state.complete {
    color: var(--bright);
    animation: objectiveComplete 1.2s steps(2) infinite;
}

.mo .progress {
    height: 10px;
    margin-top: .65vh;
    margin-bottom: .55vh;

    border-color: var(--dim);

    background:
        repeating-linear-gradient(
            90deg,
            transparent 0,
            transparent 9%,
            rgba(80,255,80,.10) 10%
        );
}

.mo-warning {
    margin-top: 1vh;
    padding-top: 1vh;

    border-top: 1px dotted var(--dim);

    color: var(--dim);
    text-align: center;

    font-size: clamp(9px,.8vw,14px);
    letter-spacing: .16em;
}

@keyframes objectiveComplete {
    50% {
        opacity: .45;
    }
}


/* =================================================
   WARPI v1.3 - SUPER EARTH MAJOR ORDER DISPLAY
   ================================================= */

.mo-screen {
    padding-top: 2vh;
}

.mo-layout {
    height: 100%;

    display: grid;
    grid-template-columns: 37% 63%;

    gap: 3vw;
}


/* -------------------------------------------------
   SUPER EARTH PANEL
------------------------------------------------- */

.se-panel {
    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    min-width: 0;

    border-right:
        1px solid var(--dim);

    padding-right: 3vw;

    text-align: center;
}


.se-emblem {
    position: relative;

    width: min(26vw, 360px);
    height: min(26vw, 360px);

    display: flex;
    align-items: center;
    justify-content: center;

    color: var(--bright);

    text-shadow:
        0 0 4px var(--phosphor),
        0 0 12px var(--phosphor),
        0 0 28px rgba(100,255,100,.35);
}


.se-globe {
    position: absolute;

    font-size:
        clamp(150px,17vw,280px);

    line-height: 1;

    opacity: .88;
}


.se-wings {
    position: absolute;

    font-size:
        clamp(35px,4vw,65px);

    letter-spacing: .1em;

    transform:
        scaleY(2.6);

    opacity: .8;
}


.se-stars {
    position: absolute;

    top: 7%;

    font-size:
        clamp(16px,1.5vw,24px);

    letter-spacing: .25em;
}


.se-star-bottom {
    position: absolute;

    bottom: 4%;

    font-size:
        clamp(40px,4vw,70px);
}


.se-title {
    width: 100%;

    margin-top: .5vh;

    padding-bottom: .7vh;

    border-bottom:
        2px solid var(--phosphor);

    color: var(--bright);

    font-size:
        clamp(30px,3.3vw,57px);

    font-weight: bold;

    letter-spacing: .08em;

    text-shadow:
        0 0 5px var(--phosphor),
        0 0 16px rgba(100,255,100,.5);
}


.se-motto {
    width: 100%;

    display: flex;
    justify-content: space-between;

    padding:
        1.1vh .5vw;

    border-bottom:
        1px solid var(--dim);

    font-size:
        clamp(11px,1.15vw,19px);

    letter-spacing: .08em;
}


.se-motto span {
    color: var(--dim);
}


.se-divider {
    width: 60%;

    margin:
        2.5vh 0
        1.8vh;

    border-top:
        1px solid var(--faint);
}


.se-command {
    color: var(--dim);

    font-size:
        clamp(10px,.9vw,15px);

    line-height: 1.7;

    letter-spacing: .16em;
}


/* -------------------------------------------------
   COMMAND SIDE
------------------------------------------------- */

.mo-command {
    min-width: 0;

    padding-right: 1vw;
}


.mo-titlebar {
    height: 8vh;

    display: flex;

    align-items: center;
    justify-content: space-between;

    padding:
        0 1.4vw;

    border:
        1px solid var(--phosphor);

    color: var(--bright);
}


.mo-titlebar > span {
    font-size:
        clamp(27px,3vw,50px);

    font-weight: bold;

    letter-spacing: .12em;
}


.mo-titlebar small {
    color: var(--dim);

    font-size:
        clamp(9px,.8vw,14px);

    letter-spacing: .16em;
}


.mo-directive {
    margin-top: 1.5vh;

    padding:
        1.2vh 1.2vw;

    border-left:
        5px solid var(--bright);

    background:
        linear-gradient(
            90deg,
            rgba(80,255,80,.09),
            transparent
        );
}


.mo-directive-label {
    margin-bottom: .8vh;

    color: var(--dim);

    font-size:
        clamp(10px,.9vw,15px);

    letter-spacing: .13em;
}


.mo-directive .briefing {
    min-height: 0;

    color: var(--bright);

    font-size:
        clamp(15px,1.35vw,23px);

    line-height: 1.35;

    font-weight: bold;
}


.mo-command .mo-meta {
    margin:
        1.4vh 0
        1.6vh;

    padding:
        1.1vh 1vw;

    border:
        1px solid var(--dim);

    font-size:
        clamp(12px,1.1vw,19px);
}


.mo-command .mo-task {
    margin-bottom: 1vh;

    padding:
        .8vh .8vw;
}


.mo-command .mo-task-head {
    font-size:
        clamp(13px,1.15vw,20px);
}


.mo-command .mo-numbers {
    font-size:
        clamp(10px,.9vw,16px);
}


.mo-command .progress {
    height: 9px;
}


/* hide the old generated header wrapper because
   the v1.3 page now provides the command framing */

.mo-directive .mo-header {
    border: 0;
    padding: 0;
    margin: 0;
}


.mo-directive .mo-classification {
    display: none;
}


/* -------------------------------------------------
   CRT EMBLEM INSTABILITY
------------------------------------------------- */

.se-emblem {
    animation:
        emblemPhosphor 6s infinite;
}


@keyframes emblemPhosphor {

    0%, 94%, 100% {
        opacity: 1;
        transform: translateX(0);
    }

    95% {
        opacity: .82;
        transform: translateX(1px);
    }

    96% {
        opacity: 1;
        transform: translateX(-1px);
    }

    97% {
        opacity: .9;
        transform: translateX(0);
    }
}


/* =================================================
   WARPI v1.3 - REAL SUPER EARTH EMBLEM
   ================================================= */

.se-emblem-real {
    width: 100%;
    height: auto;
    max-width: 440px;

    margin: 0 auto 1.5vh;

    animation: emblemPhosphor 6s infinite;
}

.se-emblem-real img {
    display: block;

    width: 100%;
    height: auto;

    object-fit: contain;

    filter:
        brightness(1.05)
        contrast(1.08)
        drop-shadow(0 0 5px rgba(120,255,120,.55))
        drop-shadow(0 0 15px rgba(80,255,80,.20));

    opacity: .96;
}

.se-panel .se-command {
    margin-top: 1vh;
}


/* =================================================
   WARPI v1.4 - TACTICAL NAVIGATION
   ================================================= */

#warpi-nav {
    position: absolute;

    left: 5vw;
    right: 5vw;
    bottom: 5.2vh;

    min-height: 4.5vh;

    display: grid;
    grid-template-columns:
        .45fr
        1.35fr
        1.25fr
        1.25fr
        1.15fr
        .45fr
        .65fr;

    gap: .45vw;

    align-items: stretch;

    z-index: 700;

    border-top:
        1px solid var(--dim);

    border-bottom:
        1px solid var(--dim);

    padding: .45vh 0;
}


#warpi-nav button {
    appearance: none;

    border: 0;

    background:
        transparent;

    color:
        var(--dim);

    font-family:
        "Courier New",
        Courier,
        monospace;

    font-size:
        clamp(9px,.82vw,14px);

    letter-spacing:
        .08em;

    cursor: pointer;

    text-shadow:
        0 0 5px
        rgba(80,255,80,.30);

    transition:
        color .12s,
        background .12s,
        text-shadow .12s;
}


#warpi-nav button:hover {
    color:
        var(--bright);

    background:
        rgba(80,255,80,.07);

    text-shadow:
        0 0 8px
        var(--phosphor);
}


#warpi-nav button:focus-visible {
    outline:
        1px solid
        var(--bright);

    outline-offset:
        -2px;
}


#warpi-nav .nav-page.active {
    color:
        var(--bright);

    background:
        rgba(80,255,80,.10);

    box-shadow:
        inset 0 -2px 0
        var(--phosphor);

    text-shadow:
        0 0 5px
        var(--phosphor),
        0 0 12px
        rgba(80,255,80,.45);
}


#warpi-nav .nav-arrow {
    color:
        var(--phosphor);

    font-size:
        clamp(14px,1.2vw,21px);
}


#warpi-nav #nav-auto {
    border-left:
        1px solid
        var(--faint);

    letter-spacing:
        .14em;
}


#warpi-nav #nav-auto.active {
    color:
        var(--bright);

    text-shadow:
        0 0 7px
        var(--phosphor);
}


#warpi-nav #nav-auto.active::before {
    content:
        "● ";
}


#warpi-nav #nav-auto:not(.active)::before {
    content:
        "■ ";
}


/*
   Navigation occupies some of the space
   previously available to the screens.
*/

main {
    height: 73vh;
}


footer {
    bottom: 1.5vh;
}


/* =================================================
   WARPI v1.4.1 - MOBILE NAVIGATION FIX
   ================================================= */

/* Keep navigation visibly above the footer */
#warpi-nav {
    bottom: 4.5rem;
}

/* Don't artificially shrink the display area */
main {
    height: auto;
    bottom: 8.5rem;
}


/* ---------- PHONE / NARROW DISPLAY ---------- */

@media (max-width: 700px) {

    #warpi-nav {
        left: 2vw;
        right: 2vw;
        bottom: 3.6rem;

        display: grid;

        grid-template-columns:
            42px
            repeat(4, 1fr)
            42px;

        gap: 2px;

        min-height: 42px;

        padding: 3px 0;
    }


    #warpi-nav button {
        min-height: 40px;

        padding: 2px;

        font-size: 8px;

        letter-spacing: 0;

        line-height: 1.05;
    }


    #warpi-nav .nav-arrow {
        font-size: 16px;
    }


    /*
       AUTO becomes a small floating status/control
       immediately above the navigation row.
    */

    #warpi-nav #nav-auto {
        position: absolute;

        right: 0;
        bottom: 46px;

        min-width: 74px;
        min-height: 28px;

        border:
            1px solid var(--dim);

        background:
            rgba(0,20,0,.75);

        font-size: 8px;
    }


    main {
        bottom: 8rem;
    }


    footer {
        bottom: 1rem;
        font-size: 7px;
    }
}


/* =================================================
   WARPI v1.4.2 - MOBILE NAV FINAL
   ================================================= */

@media (max-width: 700px) {

    /*
     * Navigation becomes a fixed control deck on mobile.
     * Safari safe-area support keeps it clear of the
     * Home indicator/browser chrome.
     */

    #warpi-nav {
        position: fixed !important;

        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;

        width: 100%;

        box-sizing: border-box;

        display: grid !important;
        grid-template-columns:
            38px
            repeat(4, minmax(0, 1fr))
            38px !important;

        gap: 1px;

        padding:
            4px
            4px
            calc(4px + env(safe-area-inset-bottom));

        min-height: 52px;

        background:
            rgba(0, 12, 0, .96);

        border-top:
            1px solid var(--phosphor);

        border-bottom: 0;

        z-index: 99999 !important;

        box-shadow:
            0 -4px 18px
            rgba(50,255,50,.12);
    }


    #warpi-nav button {
        display: block;

        min-width: 0;
        min-height: 44px;

        padding: 3px 1px;

        overflow: hidden;

        font-size: 7px;

        line-height: 1.1;

        white-space: normal;

        text-align: center;
    }


    #warpi-nav .nav-arrow {
        font-size: 17px;
    }


    /*
     * AUTO/MANUAL sits above the right side
     * of the navigation deck.
     */

    #warpi-nav #nav-auto {
        position: absolute !important;

        right: 5px;
        bottom: calc(56px + env(safe-area-inset-bottom));

        width: 82px;
        min-height: 30px;

        padding: 4px;

        background:
            rgba(0,15,0,.96);

        border:
            1px solid var(--phosphor);

        font-size: 8px;

        overflow: visible;
    }


    /*
     * Leave enough room that information at the
     * bottom of a WarPi screen isn't hidden by nav.
     */

    body {
        padding-bottom:
            calc(58px + env(safe-area-inset-bottom));
    }
}


/* =================================================
   WARPI v1.5 - GALACTIC UPDATE TRANSMISSION
   ================================================= */

#galactic-update {
    position: fixed;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 8vw;

    box-sizing: border-box;

    background:
        rgba(0, 10, 0, .94);

    color: var(--bright);

    opacity: 0;
    visibility: hidden;

    pointer-events: none;

    z-index: 200000;

    font-family:
        "Courier New",
        Courier,
        monospace;

    text-align: center;
}


#galactic-update.visible {
    visibility: visible;

    animation:
        galacticTransmission
        3.8s
        linear
        forwards;
}


.update-frame {
    width: min(760px, 90vw);

    padding: clamp(18px, 4vw, 42px);

    border:
        1px solid
        var(--phosphor);

    box-shadow:
        inset 0 0 35px
        rgba(80,255,80,.06),
        0 0 18px
        rgba(80,255,80,.16);

    text-shadow:
        0 0 6px
        var(--phosphor);
}


.update-classification {
    color: var(--dim);

    font-size:
        clamp(8px, 1.1vw, 13px);

    letter-spacing: .24em;

    margin-bottom: 2em;
}


.update-title {
    font-size:
        clamp(18px, 3vw, 38px);

    font-weight: bold;

    letter-spacing: .12em;

    text-shadow:
        0 0 6px
        var(--phosphor),
        0 0 18px
        rgba(80,255,80,.45);
}


.update-rule {
    width: 70%;

    height: 1px;

    margin:
        1.6em auto;

    background:
        var(--phosphor);

    box-shadow:
        0 0 8px
        var(--phosphor);
}


#update-reason {
    font-size:
        clamp(11px, 1.5vw, 18px);

    letter-spacing: .13em;
}


.update-footer {
    margin-top: 3em;

    color: var(--dim);

    font-size:
        clamp(7px, .9vw, 11px);

    letter-spacing: .16em;
}


@keyframes galacticTransmission {
    0% {
        opacity: 0;
    }

    5% {
        opacity: 1;
    }

    8% {
        opacity: .35;
    }

    11% {
        opacity: 1;
    }

    88% {
        opacity: 1;
    }

    94% {
        opacity: .7;
    }

    100% {
        opacity: 0;
    }
}

/* Mobile */

@media (max-width: 700px) {

    #galactic-update {
        padding: 20px;
    }

    .update-frame {
        width: 100%;
    }

}


/* =================================================
   WARPI v1.5.1 - CRT READABILITY PASS
   ================================================= */

/*
 * Sharper phosphor text.
 * Keep the glow, but stop it overwhelming the glyphs.
 */

body,
.screen {
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
}


/* Main information */

.screen {
    color: #baffba;
}

.screen p,
.screen li,
.screen td,
.screen .value,
.screen .stat,
.screen .campaign,
.screen .objective {
    font-weight: 600;

    text-shadow:
        0 0 2px rgba(120,255,120,.65),
        0 0 5px rgba(80,255,80,.18);
}


/* Headings stay brighter */

.screen h1,
.screen h2,
.screen h3,
.mo-titlebar,
.mo-directive {
    color: #d2ffd2;

    text-shadow:
        0 0 2px #8fff8f,
        0 0 7px rgba(80,255,80,.35);
}


/* Navigation */

#warpi-nav button {
    font-weight: 600;

    text-shadow:
        0 0 2px rgba(80,255,80,.45);
}

#warpi-nav .nav-page.active {
    color: #d2ffd2;

    text-shadow:
        0 0 3px rgba(100,255,100,.75);
}


/* Priority transmission */

.update-title {
    color: #d8ffd8;

    text-shadow:
        0 0 2px #8fff8f,
        0 0 8px rgba(80,255,80,.30);
}

#update-reason {
    color: #caffca;

    font-weight: 700;

    text-shadow:
        0 0 2px rgba(100,255,100,.55);
}

.update-classification,
.update-footer {
    color: #9ee89e;

    text-shadow:
        0 0 2px rgba(80,255,80,.25);
}


/*
 * Mobile needs slightly larger type rather than
 * simply scaling the desktop terminal down.
 */

@media (max-width: 700px) {

    .screen p,
    .screen li,
    .screen td,
    .screen .value,
    .screen .stat,
    .screen .campaign,
    .screen .objective {
        font-weight: 700;
    }

    #warpi-nav button {
        font-size: 8px;
        font-weight: 700;
    }

    .update-title {
        font-size: clamp(20px, 7vw, 30px);
    }

    #update-reason {
        font-size: clamp(13px, 4vw, 18px);
        line-height: 1.4;
    }
}


/* =================================================
   WARPI - ENEMY INTELLIGENCE DATABASE
   ================================================= */

.enemy-intel {
    width: 100%;
    max-width: 1000px;
    margin: 18px auto 0;
}

.enemy-factions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

.enemy-faction {
    background: rgba(0, 25, 0, .65);
    border: 1px solid rgba(120, 255, 120, .45);
    color: #9ee89e;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1.5px;
    padding: 8px 18px;
    cursor: pointer;

    text-shadow:
        0 0 3px rgba(80,255,80,.5);

    box-shadow:
        inset 0 0 8px rgba(50,255,50,.05);
}

.enemy-faction:hover {
    color: #d2ffd2;
    border-color: #9eff9e;
}

.enemy-faction.active {
    color: #e0ffe0;
    border-color: #baffba;

    background:
        rgba(50, 140, 50, .18);

    box-shadow:
        inset 0 0 10px rgba(80,255,80,.12),
        0 0 8px rgba(80,255,80,.15);
}

.enemy-database {
    border: 1px solid rgba(120,255,120,.42);
    background: rgba(0,20,0,.35);

    box-shadow:
        inset 0 0 20px rgba(50,255,50,.04);

    min-height: 330px;
}

.enemy-heading {
    padding: 10px 14px;

    border-bottom:
        1px solid rgba(120,255,120,.35);

    color: #d2ffd2;

    font-weight: 700;
    letter-spacing: 2px;
    text-align: center;

    text-shadow:
        0 0 2px #8fff8f,
        0 0 7px rgba(80,255,80,.30);
}

.enemy-placeholder {
    min-height: 280px;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    text-align: center;
    padding: 30px;
}

.enemy-classification {
    font-size: 12px;
    line-height: 1.7;
    letter-spacing: 1.5px;
    color: #91d991;
}

.enemy-warning {
    margin: 32px 0;

    font-size: clamp(16px, 2.5vw, 24px);
    font-weight: 700;
    letter-spacing: 2px;

    color: #d2ffd2;

    animation: enemy-pulse 2.4s ease-in-out infinite;
}

.enemy-status {
    font-size: 11px;
    letter-spacing: 2px;
    color: #86cf86;
}

@keyframes enemy-pulse {

    0%, 100% {
        opacity: .65;
    }

    50% {
        opacity: 1;
        text-shadow:
            0 0 3px #8fff8f,
            0 0 10px rgba(80,255,80,.45);
    }
}


/* Enemy Intel mobile */

@media (max-width: 700px) {

    .enemy-intel {
        margin-top: 10px;
    }

    .enemy-factions {
        gap: 6px;
        margin-bottom: 10px;
    }

    .enemy-faction {
        font-size: 9px;
        padding: 7px 9px;
        letter-spacing: .7px;
    }

    .enemy-database {
        min-height: 280px;
    }

    .enemy-heading {
        font-size: 11px;
        letter-spacing: 1px;
    }

    .enemy-placeholder {
        min-height: 230px;
        padding: 18px 12px;
    }

    .enemy-classification {
        font-size: 9px;
    }

    .enemy-status {
        font-size: 9px;
    }
}


/* =================================================
   WARPI - ENEMY UNIT BROWSER
   ================================================= */

.enemy-browser {
    display: grid;
    grid-template-columns: 230px 1fr;
    min-height: 360px;
}

.enemy-unit-index {
    padding: 16px;
    border-right: 1px solid rgba(120,255,120,.30);
}

.enemy-panel-label {
    color: #9ee89e;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
}

.enemy-unit-list {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.enemy-unit-button {
    border: 0;
    background: transparent;
    color: #8bd18b;
    font: inherit;
    font-size: 12px;
    text-align: left;
    padding: 5px 7px;
    cursor: pointer;
}

.enemy-unit-button::before {
    content: "  ";
    white-space: pre;
}

.enemy-unit-button:hover {
    color: #d2ffd2;
}

.enemy-unit-button.active {
    color: #e0ffe0;
    background: rgba(80,255,80,.08);
    text-shadow: 0 0 6px rgba(80,255,80,.5);
}

.enemy-unit-button.active::before {
    content: "> ";
}

.enemy-unit-record {
    padding: 16px 20px;
}

.enemy-record-top {
    display: flex;
    justify-content: space-between;
    color: #79bd79;
    font-size: 10px;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
}

.enemy-classified {
    opacity: .7;
}

.enemy-unit-visual {
    height: 110px;
    border: 1px solid rgba(120,255,120,.25);
    background: rgba(0,15,0,.30);

    display: flex;
    align-items: center;
    justify-content: center;

    text-align: center;
    color: #609c60;
    font-size: 10px;
    letter-spacing: 2px;

    margin-bottom: 14px;
}

.enemy-unit-name {
    color: #e0ffe0;
    font-size: clamp(20px, 3vw, 28px);
    font-weight: 700;
    letter-spacing: 3px;
    margin-bottom: 12px;

    text-shadow:
        0 0 3px #8fff8f,
        0 0 8px rgba(80,255,80,.25);
}

.enemy-properties {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 18px;
}

.enemy-properties div {
    border: 1px solid rgba(120,255,120,.20);
    padding: 8px;
}

.enemy-properties span {
    display: block;
    color: #6fae6f;
    font-size: 9px;
    letter-spacing: 1px;
}

.enemy-properties strong {
    display: block;
    margin-top: 3px;
    color: #c5f5c5;
    font-size: 11px;
    letter-spacing: 1px;
}

.enemy-info-block {
    margin-top: 14px;
    color: #a6dda6;
    font-size: 12px;
    line-height: 1.55;
}

.enemy-info-block .enemy-panel-label {
    margin-bottom: 4px;
}

.enemy-record-controls {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 18px;
}

.enemy-record-controls button {
    border: 1px solid rgba(120,255,120,.35);
    background: rgba(0,25,0,.55);
    color: #a8e5a8;
    font: inherit;
    font-size: 10px;
    letter-spacing: 1px;
    padding: 7px 12px;
    cursor: pointer;
}

.enemy-record-controls button:hover {
    color: #e0ffe0;
    border-color: #aaffaa;
}


/* Enemy browser mobile */

@media (max-width: 700px) {

    .enemy-browser {
        display: block;
    }

    .enemy-unit-index {
        border-right: 0;
        border-bottom: 1px solid rgba(120,255,120,.30);
        padding: 10px;
    }

    .enemy-unit-list {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        gap: 5px;
        padding-bottom: 4px;
    }

    .enemy-unit-button {
        flex: 0 0 auto;
        border: 1px solid rgba(120,255,120,.18);
        padding: 5px 8px;
        font-size: 9px;
    }

    .enemy-unit-button::before,
    .enemy-unit-button.active::before {
        content: "";
    }

    .enemy-unit-record {
        padding: 12px;
    }

    .enemy-unit-visual {
        height: 80px;
    }

    .enemy-properties {
        gap: 4px;
    }

    .enemy-properties div {
        padding: 6px 4px;
    }

    .enemy-info-block {
        font-size: 10px;
    }
}


/* =================================================
   WARPI - TOP NAVIGATION LAYOUT
   ================================================= */

#warpi-nav {
    position: relative;
    left: auto;
    right: auto;
    bottom: auto;

    width: min(1100px, calc(100% - 32px));
    margin: 8px auto 12px;

    display: grid;
    grid-template-columns:
        36px
        repeat(5, minmax(0, 1fr))
        36px;

    align-items: stretch;
    gap: 5px;
}

#warpi-nav .nav-page {
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 7px 4px;

    display: flex;
    align-items: center;
    justify-content: center;

    text-align: center;
    white-space: normal;
    line-height: 1.15;
}

#warpi-nav .nav-arrow {
    width: 36px;
    min-width: 36px;
    margin: 0;

    display: flex;
    align-items: center;
    justify-content: center;
}


/* Enemy Intel now has the lower display area to itself */

.enemy-intel {
    margin-bottom: 10px;
}


/* Mobile top navigation */

@media (max-width: 700px) {

    #warpi-nav {
        width: calc(100% - 12px);
        margin: 5px auto 8px;

        grid-template-columns:
            25px
            repeat(5, minmax(0, 1fr))
            25px;

        gap: 2px;
    }

    #warpi-nav .nav-arrow {
        width: 25px;
        min-width: 25px;
        padding: 4px 1px;
    }

    #warpi-nav .nav-page {
        min-width: 0;
        padding: 5px 2px;

        font-size: 7px;
        letter-spacing: 0;
        line-height: 1.1;
    }
}


/* =================================================
   WARPI - HOSTILE IDENTIFICATION IMAGERY
   ================================================= */

.enemy-identification {
    display: grid;
    grid-template-columns: 1fr 1.35fr;
    gap: 12px;
    margin-bottom: 15px;
}

.enemy-id-frame {
    min-width: 0;
}

.enemy-image-label {
    color: #75b875;
    font-size: 9px;
    letter-spacing: 1.5px;
    margin-bottom: 5px;
}

.enemy-crt-image {
    position: relative;
    height: 180px;
    overflow: hidden;

    border: 1px solid rgba(120,255,120,.30);

    background:
        radial-gradient(
            ellipse at center,
            rgba(30,80,30,.16) 0%,
            rgba(0,15,0,.55) 70%,
            rgba(0,5,0,.90) 100%
        );

    box-shadow:
        inset 0 0 22px rgba(0,0,0,.75),
        inset 0 0 8px rgba(80,255,80,.08);
}


/* Actual hostile image */

.enemy-crt-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;

    filter:
        grayscale(1)
        sepia(1)
        hue-rotate(65deg)
        saturate(4)
        contrast(1.35)
        brightness(.85);

    opacity: .88;
}


/* Phosphor glow layer */

.enemy-crt-image::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;

    background:
        radial-gradient(
            ellipse at center,
            rgba(80,255,80,.08),
            transparent 68%
        );

    mix-blend-mode: screen;
}


/* Scanlines */

.enemy-crt-image::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;

    background:
        repeating-linear-gradient(
            to bottom,
            rgba(0,0,0,0) 0px,
            rgba(0,0,0,0) 2px,
            rgba(0,0,0,.26) 3px,
            rgba(0,0,0,.26) 4px
        );

    opacity: .65;
}


/* Missing-image state */

.enemy-image-missing {
    position: absolute;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    text-align: center;

    color: #568956;
    font-size: 9px;
    line-height: 1.7;
    letter-spacing: 2px;
}


/* Image successfully loaded */

.enemy-crt-image.has-image img {
    display: block;
}

.enemy-crt-image.has-image .enemy-image-missing {
    display: none;
}


/* Mobile */

@media (max-width: 700px) {

    .enemy-identification {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .enemy-crt-image {
        height: 125px;
    }

    .enemy-image-label {
        font-size: 7px;
        letter-spacing: .7px;
    }
}


/* =================================================
   WARPI - IDENTIFICATION DETAIL CROPPING
   ================================================= */

/* Full-body/profile image */
.enemy-body-frame .enemy-crt-image img {
    object-fit: contain;
    object-position: center center;
    padding: 4px;
    box-sizing: border-box;
}


/* Identification-detail image:
   same source, enlarged and cropped */
.enemy-face-frame .enemy-crt-image img {
    object-fit: cover;
    object-position: 50% 20%;
    transform: scale(1.8);
    transform-origin: 50% 20%;
}

/* =========================================================
   MOBILE LANDSCAPE SCROLL FIX
   Allow short/mobile viewports to scroll vertically
   ========================================================= */

@media (max-height: 600px) {
    html,
    body {
        height: auto;
        min-height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #crt {
        height: auto;
        min-height: 100dvh;
        overflow: visible;
    }
}


/* =========================================================
   MOBILE PORTRAIT SCROLL FIX
   Keep bottom navigation, but allow page to scroll
   ========================================================= */

@media (max-width: 600px) and (orientation: portrait) {
    html,
    body {
        height: auto;
        min-height: 100%;
        overflow-x: hidden;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
    }

    #crt {
        height: auto !important;
        min-height: 100dvh;
        overflow: visible !important;
    }
}


/* =========================================================
   MOBILE PORTRAIT NAV AUTO/MANUAL FIX
   ========================================================= */

@media (max-width: 600px) and (orientation: portrait) {

    #warpi-nav {
        padding-bottom: 42px;
    }

    #warpi-nav #nav-auto {
        position: absolute !important;
        right: auto !important;
        left: 50% !important;
        bottom: 4px !important;
        transform: translateX(-50%);
        width: 90px;
    }
}


/* =========================================================
   MOBILE PORTRAIT NAV - NORMAL DOCUMENT FLOW
   Prevent navigation covering page content
   ========================================================= */

@media (max-width: 600px) and (orientation: portrait) {

    #warpi-nav {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        top: auto !important;

        margin-top: 20px !important;
        margin-bottom: 12px !important;
        padding-bottom: 50px;
    }

    #warpi-nav #nav-auto {
        bottom: 4px !important;
    }
}


/* =========================================================
   ANSI / BBS STYLE PREVIOUS + NEXT CONTROLS
   ========================================================= */

#warpi-nav .nav-arrow {
    border: 1px solid currentColor !important;
    border-radius: 0 !important;
    background: rgba(0, 255, 80, 0.025) !important;
    box-shadow:
        inset 0 0 5px rgba(0, 255, 80, 0.10),
        0 0 3px rgba(0, 255, 80, 0.15) !important;

    font-family: "Courier New", monospace;
    font-weight: bold;
    text-shadow: 0 0 4px currentColor;
}

/* Make them feel more like old terminal controls */
#warpi-nav .nav-arrow::before {
    content: "[";
    opacity: 0.65;
    margin-right: 1px;
}

#warpi-nav .nav-arrow::after {
    content: "]";
    opacity: 0.65;
    margin-left: 1px;
}


/* =========================================================
   TRUE ANSI-STYLE PREVIOUS / NEXT CONTROLS
   ========================================================= */

#warpi-nav .nav-arrow {
    border: none !important;
    box-shadow: none !important;
    background: transparent !important;

    position: relative;
    font-family: "Courier New", monospace;
    font-weight: bold;
    text-shadow: 0 0 4px currentColor;

    padding: 9px 2px !important;
}

/* Remove previous square brackets */
#warpi-nav .nav-arrow::before,
#warpi-nav .nav-arrow::after {
    margin: 0;
    opacity: 0.75;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    line-height: 1;
}

#warpi-nav .nav-arrow::before {
    content: "┌───┐";
    top: 0;
}

#warpi-nav .nav-arrow::after {
    content: "└───┘";
    bottom: 0;
}


/* =========================================================
   ENEMY INTEL - ASCII RECORD CONTROLS
   ========================================================= */

#enemy-prev,
#enemy-next {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    border-radius: 0 !important;

    font-family: inherit !important;
    font-weight: bold !important;
    color: inherit !important;
    text-shadow: 0 0 5px currentColor;

    position: relative;
    padding: 16px 12px !important;
    min-width: 180px;
}

/* ASCII top edge */
#enemy-prev::before,
#enemy-next::before {
    content: "+------------------+";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    white-space: pre;
    font-family: inherit;
    font-weight: bold;
    opacity: 0.8;
}

/* ASCII bottom edge */
#enemy-prev::after,
#enemy-next::after {
    content: "+------------------+";
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    white-space: pre;
    font-family: inherit;
    font-weight: bold;
    opacity: 0.8;
}


/* =========================================================
   WARPI BOOT / SPLASH SCREEN
   ========================================================= */

#boot-screen {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: #000;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#boot-screen.boot-complete {
    display: none;
}

.boot-slogans {
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    line-height: 1.35;
}

.boot-line {
    min-height: 1.4em;
    margin: 0.55em 0;
    font-size: clamp(1.5rem, 4vw, 3rem);
    text-shadow:
        0 0 4px currentColor,
        0 0 10px currentColor;
}

.boot-democracy {
    margin-top: 0.8em;
    font-size: clamp(2rem, 5.5vw, 4.5rem);
    font-weight: bold;
    letter-spacing: 0.12em;
    white-space: nowrap;
}

.boot-loading {
    position: absolute;
    right: 3vw;
    bottom: 3vh;
    text-align: right;
    font-size: clamp(0.65rem, 1.3vw, 0.95rem);
    line-height: 1.5;
    letter-spacing: 0.12em;
    opacity: 0.72;
    text-transform: uppercase;
}

/* Keep MANAGED DEMOCRACY together on narrow displays */
@media (max-width: 600px) {
    .boot-democracy {
        font-size: clamp(1.35rem, 7vw, 2.2rem);
        letter-spacing: 0.06em;
    }

    .boot-loading {
        right: 5vw;
        bottom: 3vh;
        font-size: 0.62rem;
    }
}

/* Boot screen must cover ALL WarPi interface elements */
#boot-screen {
    z-index: 99999 !important;
}

#boot-screen:not(.boot-complete) ~ header,
#boot-screen:not(.boot-complete) ~ #warpi-nav,
#boot-screen:not(.boot-complete) ~ main {
    visibility: hidden !important;
}

/* Mobile audio control - compact terminal switch */
@media (max-width: 600px) {
    #nav-audio {
        position: absolute !important;
        top: 0.65rem !important;
        right: 0.65rem !important;
        width: auto !important;
        min-width: 0 !important;
        height: auto !important;
        margin: 0 !important;
        padding: 0.35rem 0.55rem !important;

        font-size: 0.62rem !important;
        line-height: 1 !important;
        letter-spacing: 0.08em !important;

        z-index: 20;
    }
}

/* =========================================================
   HEADER SOUND CONTROL
   ========================================================= */

header #nav-audio {
    background: transparent;
    border: 0;
    color: var(--phosphor);
    font: inherit;
    letter-spacing: .10em;
    cursor: pointer;
}

/* Compact hardware-style sound switch on phones */
@media (max-width: 600px) {
    header {
        position: relative;
    }

    header #nav-audio {
        position: absolute;
        right: 0;
        bottom: -1.15rem;

        width: auto !important;
        min-width: 0 !important;
        height: auto !important;
        min-height: 0 !important;

        margin: 0 !important;
        padding: 0 !important;

        border: 0 !important;
        background: transparent !important;

        font-size: .55rem !important;
        line-height: 1 !important;
        white-space: nowrap;
    }

    header #nav-audio::before {
        content: "[ ";
    }

    header #nav-audio::after {
        content: " ]";
    }
}

/* Mobile AUTO control - compact terminal switch */
@media (max-width: 600px) {
    #warpi-nav #nav-auto {
        position: absolute !important;
        left: auto !important;
        right: 8px !important;
        bottom: 8px !important;
        transform: none !important;

        width: auto !important;
        min-width: 0 !important;
        height: auto !important;
        min-height: 0 !important;

        margin: 0 !important;
        padding: 5px 8px !important;

        font-size: .58rem !important;
        line-height: 1 !important;
        letter-spacing: .10em !important;

        background: transparent !important;
        border: 0 !important;
    }

    #warpi-nav #nav-auto::before {
        content: "[ ";
    }

    #warpi-nav #nav-auto::after {
        content: " ]";
    }
}

/* =========================================================
   FINAL AUDIO / MOBILE NAV LAYOUT
   ========================================================= */

/* Desktop: keep audio clear of header separator */
@media (min-width: 601px) {
    header #nav-audio {
        position: absolute;
        left: 2.5rem;
        bottom: 0.55rem;

        width: auto;
        padding: 0;
        margin: 0;

        background: transparent;
        border: 0;
        line-height: 1;
        z-index: 10;
    }
}

/* Mobile: compact navigation panel */
@media (max-width: 600px) {
    #warpi-nav {
        min-height: 0 !important;
        height: 145px !important;
        padding-bottom: 0 !important;
    }

    #warpi-nav #nav-auto {
        right: 8px !important;
        bottom: 8px !important;
    }
}

/* Desktop sound control - fixed visible position in header */
@media (min-width: 601px) {
    header #nav-audio {
        position: absolute !important;
        left: 1.5rem !important;
        top: 3.15rem !important;
        bottom: auto !important;

        display: block !important;
        width: auto !important;
        height: auto !important;

        padding: 0 !important;
        margin: 0 !important;

        background: #001006 !important;
        border: 0 !important;

        font-size: 0.72rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;

        z-index: 100 !important;
    }

    header #nav-audio::before {
        content: "[ ";
    }

    header #nav-audio::after {
        content: " ]";
    }
}

/* =========================================================
   FINAL HEADER LAYOUT
   Remove legacy WARPI branding and use space for audio
   ========================================================= */

/* Legacy WARPI title is no longer required */
#brand {
    display: none !important;
}

/* Slightly increase the Super Earth network title */
#network-title {
    font-size: 110% !important;
}

/* Desktop header:
   AUDIO left / network title centre / clock right */
@media (min-width: 601px) {

    header {
        position: relative !important;
    }

    header #nav-audio {
        position: absolute !important;
        left: 0 !important;
        top: 50% !important;
        bottom: auto !important;
        transform: translateY(-50%) !important;

        display: block !important;
        width: auto !important;
        height: auto !important;

        margin: 0 !important;
        padding: 0 !important;

        background: transparent !important;
        border: 0 !important;

        font-size: 0.72rem !important;
        line-height: 1 !important;
        letter-spacing: 0.10em !important;
        white-space: nowrap !important;

        z-index: 100 !important;
    }

    header #nav-audio::before {
        content: "[ ";
    }

    header #nav-audio::after {
        content: " ]";
    }

    #network-title {
        position: absolute !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;

        width: auto !important;
        margin: 0 !important;

        text-align: center !important;
        white-space: nowrap !important;
    }

    #clock {
        position: absolute !important;
        right: 0 !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
}

/* Correct header selectors */
.logo {
    display: none !important;
}

.header-centre {
    font-size: 110% !important;
}

/* Desktop: audio left, title centred, clock right */
@media (min-width: 601px) {
    header {
        position: relative !important;
    }

    header #nav-audio {
        position: absolute !important;
        left: 0 !important;
        top: 50% !important;
        bottom: auto !important;
        transform: translateY(-50%) !important;

        background: transparent !important;
        border: 0 !important;
        padding: 0 !important;
        margin: 0 !important;

        font-size: 0.72rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }

    .header-centre {
        position: absolute !important;
        left: 50% !important;
        top: 50% !important;
        transform: translate(-50%, -50%) !important;

        width: auto !important;
        margin: 0 !important;
        white-space: nowrap !important;
        text-align: center !important;
    }

    #clock {
        position: absolute !important;
        right: 0 !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }
}

/* =========================================================
   DEFINITIVE MOBILE HEADER
   ========================================================= */
@media (max-width: 600px) {

    /* Remove legacy WARPI branding */
    header .logo {
        display: none !important;
    }

    header {
        position: relative !important;
        height: 62px !important;
        min-height: 62px !important;
        padding: 0 !important;
    }

    /* Super Earth title */
    header .header-centre {
        position: absolute !important;
        top: 8px !important;
        left: 50% !important;
        right: auto !important;
        bottom: auto !important;

        transform: translateX(-50%) !important;

        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;

        font-size: 0.72rem !important;
        line-height: 1 !important;
        letter-spacing: 0.06em !important;

        white-space: nowrap !important;
        text-align: center !important;
    }

    /* Sound bottom-left */
    header #nav-audio {
        position: absolute !important;
        left: 8px !important;
        right: auto !important;
        top: auto !important;
        bottom: 8px !important;

        transform: none !important;

        width: auto !important;
        min-width: 0 !important;
        height: auto !important;
        min-height: 0 !important;

        margin: 0 !important;
        padding: 0 !important;

        border: 0 !important;
        background: transparent !important;

        font-size: 0.58rem !important;
        line-height: 1 !important;
        letter-spacing: 0.08em !important;
        white-space: nowrap !important;
    }

    /* Clock bottom-right */
    header #clock {
        position: absolute !important;
        right: 8px !important;
        left: auto !important;
        top: auto !important;
        bottom: 8px !important;

        transform: none !important;

        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;

        font-size: 0.58rem !important;
        line-height: 1 !important;
        white-space: nowrap !important;
    }
}

/* =========================================================
   MOBILE NAV - remove redundant previous/next controls
   ========================================================= */
@media (max-width: 600px) {

    #nav-prev,
    #nav-next {
        display: none !important;
    }

    #warpi-nav {
        height: 92px !important;
        min-height: 0 !important;
        padding-left: 6px !important;
        padding-right: 6px !important;
    }
}

/* AUTO is implicit. Selecting a page stops the carousel. */
#nav-auto {
    display: none !important;
}

@media (max-width: 600px) {
    #warpi-nav {
        height: 58px !important;
        min-height: 58px !important;
        padding-bottom: 0 !important;
    }
}

/* =========================================================
   MAJOR ORDER - SUPER EARTH CRT LOGO
   ========================================================= */

.se-emblem-real img {
    filter:
        grayscale(1)
        sepia(1)
        saturate(7)
        hue-rotate(70deg)
        brightness(1.15)
        contrast(1.55)
        drop-shadow(0 0 3px currentColor)
        drop-shadow(0 0 7px rgba(90,255,120,.45));

    object-fit: cover;
    object-position: center;

    /* Slight CRT phosphor softness */
    opacity: 0.92;
}

/* Major Order logo - 10% larger */
.se-emblem-real img {
    transform: scale(1.10) !important;
    transform-origin: center center !important;
}

/* =========================================================
   SUPER EARTH HEADER EMBLEMS
   ========================================================= */

.header-centre {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 20px !important;
}

.header-centre::before,
.header-centre::after {
    content: "" !important;
    display: block !important;

    width: 70px !important;
    height: 70px !important;
    flex: 0 0 70px !important;

    background-image: url('/assets/super-earth-logo-header.png') !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    background-size: contain !important;

    filter:
        grayscale(1)
        sepia(1)
        saturate(8)
        hue-rotate(70deg)
        brightness(1.35)
        contrast(1.65)
        drop-shadow(0 0 3px rgba(90,255,120,.65));

    opacity: .9;
}

/* Keep them a little smaller on phones */
@media (max-width: 600px) {
    .header-centre {
        gap: 6px !important;
    }

    .header-centre::before,
    .header-centre::after {
        width: 18px !important;
        height: 18px !important;
        flex-basis: 18px !important;
    }
}

/* Major Order predicted outcome - sane terminal-sized text */
#campaignCount {
    font-size: 20% !important;
    line-height: 1.25 !important;
    letter-spacing: 0.08em !important;
}

/* Major Order prediction - readable status size */
#campaignCount {
    font-size: 2rem !important;
    line-height: 1.15 !important;
    letter-spacing: 0.06em !important;
}

/* =========================================================
   AMBER CRT PHOSPHOR MODE
   ========================================================= */

body.phosphor-amber {
    --phosphor: #ffb000;
    --bright: #ffd36a;
    --dim: #b87800;
    --faint: #5c3b00;
}

body.phosphor-amber #screen {
    filter: sepia(1) saturate(3) hue-rotate(355deg);
}

#nav-phosphor {
    font: inherit;
    color: var(--phosphor);
    background: transparent;
    border: 1px solid var(--dim);
    cursor: pointer;
}

#nav-phosphor:hover,
#nav-phosphor.active {
    color: var(--bright);
    border-color: var(--phosphor);
    text-shadow: 0 0 6px var(--phosphor);
}

/* Header control positioning */
#nav-audio {
    left: 0 !important;
}

#nav-phosphor {
    position: absolute !important;
    left: 134px !important;
    top: 0 !important;
    width: auto !important;
    min-width: 150px;
    height: 100%;
    padding: 0 10px;
}

/* Mobile phosphor control */
@media (max-width: 600px) {
    #nav-phosphor {
        display: block !important;
        position: absolute !important;
        top: 0 !important;
        left: 78px !important;
        min-width: 0 !important;
        width: auto !important;
        height: 100% !important;
        padding: 0 6px !important;
        white-space: nowrap !important;
        z-index: 50 !important;
    }
}

/* Compact mobile phosphor button */
@media (max-width: 600px) {
    #nav-phosphor {
        height: 24px !important;
        line-height: 22px !important;
        padding: 0 6px !important;
        min-width: 0 !important;
        width: auto !important;
        top: 4px !important;
    }
}

/* Mobile phosphor button - place beside audio control */
@media (max-width: 600px) {
    #nav-phosphor {
        top: 40px !important;
        left: 175px !important;
        height: 20px !important;
        line-height: 18px !important;
        padding: 0 5px !important;
        font-size: 10px !important;
        white-space: nowrap !important;
    }
}

/* Final mobile phosphor positioning - match AUDIO control */
@media (max-width: 600px) {
    #nav-phosphor {
        display: block !important;
        position: absolute !important;

        /* Same row as AUDIO */
        top: 40px !important;
        left: 155px !important;

        /* Match AUDIO appearance */
        width: auto !important;
        min-width: 0 !important;
        height: auto !important;
        line-height: inherit !important;
        padding: 0 !important;

        border: 0 !important;
        background: transparent !important;
        font: inherit !important;
        font-size: inherit !important;
        color: var(--phosphor) !important;
        text-shadow: inherit !important;

        white-space: nowrap !important;
        z-index: 50 !important;
    }
}

/* Mobile CRT control - match AUDIO status styling */
@media (max-width: 600px) {
    #nav-phosphor {
        top: 40px !important;
        left: 155px !important;
        border: 0 !important;
        background: transparent !important;
        padding: 0 !important;
        font: inherit !important;
        color: var(--phosphor) !important;
    }

    #nav-phosphor::before {
        content: "[ ";
    }

    #nav-phosphor::after {
        content: " ]";
    }
}

/* Mobile status controls - AUDIO and CRT side by side */
@media (max-width: 600px) {
    #nav-phosphor {
        top: 40px !important;
        left: 118px !important;

        font-family: inherit !important;
        font-size: inherit !important;
        font-weight: inherit !important;
        line-height: inherit !important;

        width: auto !important;
        min-width: 0 !important;
        height: auto !important;
        padding: 0 !important;
        margin: 0 !important;

        border: 0 !important;
        background: transparent !important;
        white-space: nowrap !important;
    }
}

/* Final mobile CRT vertical alignment */
@media (max-width: 600px) {
    #nav-phosphor {
        top: 43px !important;
    }
}

/* Larger main Galactic War Network masthead */
.header-centre {
    font-size: 1.3em !important;
}

/* =========================================================
   ENEMY INTELLIGENCE - AMBER PHOSPHOR OVERRIDE
   ========================================================= */

body.phosphor-amber .enemy-intel,
body.phosphor-amber .enemy-intel * {
    color: var(--phosphor) !important;
    border-color: var(--dim) !important;
    text-shadow: 0 0 5px rgba(255, 176, 0, 0.35);
}

body.phosphor-amber .enemy-faction,
body.phosphor-amber .enemy-unit-button,
body.phosphor-amber .enemy-record-controls button {
    color: var(--phosphor) !important;
    border-color: var(--dim) !important;
    background-color: transparent !important;
}

body.phosphor-amber .enemy-faction.active,
body.phosphor-amber .enemy-unit-button.active,
body.phosphor-amber .enemy-unit-button:hover,
body.phosphor-amber .enemy-record-controls button:hover {
    color: var(--bright) !important;
    border-color: var(--phosphor) !important;
    background-color: rgba(255, 176, 0, 0.08) !important;
    text-shadow: 0 0 7px rgba(255, 176, 0, 0.65) !important;
}

/* Recolour CRT enemy photographs from green to amber */
body.phosphor-amber .enemy-crt-image {
    filter: sepia(1) saturate(4) hue-rotate(355deg) !important;
}

/* =========================================================
   GALACTIC STATUS - AMBER PHOSPHOR OVERRIDE
   ========================================================= */

/* Main deployed total + prediction */
body.phosphor-amber #totalPlayers,
body.phosphor-amber #campaignCount {
    color: var(--bright) !important;
    text-shadow:
        0 0 4px var(--phosphor),
        0 0 10px rgba(255, 176, 0, 0.45) !important;
}

/* Dynamically generated faction summary */
body.phosphor-amber #factionSummary,
body.phosphor-amber #factionSummary * {
    color: var(--phosphor) !important;
    border-color: var(--dim) !important;
}

/* Make prominent faction figures slightly brighter */
body.phosphor-amber #factionSummary strong,
body.phosphor-amber #factionSummary .stat,
body.phosphor-amber #factionSummary .value {
    color: var(--bright) !important;
    text-shadow: 0 0 5px rgba(255, 176, 0, 0.45) !important;
}

/* =========================================================
   ACTIVE FRONTS - AMBER PHOSPHOR OVERRIDE
   ========================================================= */

body.phosphor-amber #fronts,
body.phosphor-amber #fronts * {
    color: var(--phosphor) !important;
    border-color: var(--dim) !important;
}

/* Brighter front headings / Helldiver totals */
body.phosphor-amber #fronts strong,
body.phosphor-amber #fronts .front-title,
body.phosphor-amber #fronts .front-total {
    color: var(--bright) !important;
    text-shadow: 0 0 5px rgba(255, 176, 0, 0.45) !important;
}

/* Progress bars */
body.phosphor-amber #fronts progress,
body.phosphor-amber #fronts .bar,
body.phosphor-amber #fronts .bar-fill {
    accent-color: var(--phosphor) !important;
    border-color: var(--dim) !important;
}

/* Catch dynamically styled bar fills */
body.phosphor-amber #fronts .bar-fill {
    background: var(--phosphor) !important;
    box-shadow: 0 0 6px rgba(255, 176, 0, 0.55) !important;
}

/* =========================================================
   MAJOR ORDER - AMBER PHOSPHOR OVERRIDE
   ========================================================= */

body.phosphor-amber .mo-screen,
body.phosphor-amber .mo-screen * {
    color: var(--phosphor) !important;
    border-color: var(--dim) !important;
}

/* Major headings / important values */
body.phosphor-amber .mo-screen strong,
body.phosphor-amber .mo-screen .mo-title,
body.phosphor-amber .mo-screen .mo-value {
    color: var(--bright) !important;
    text-shadow: 0 0 5px rgba(255, 176, 0, 0.45) !important;
}

/* Progress bars */
body.phosphor-amber .mo-screen progress,
body.phosphor-amber .mo-screen .bar,
body.phosphor-amber .mo-screen .bar-fill {
    accent-color: var(--phosphor) !important;
    border-color: var(--dim) !important;
}

body.phosphor-amber .mo-screen .bar-fill {
    background: var(--phosphor) !important;
    box-shadow: 0 0 6px rgba(255, 176, 0, 0.55) !important;
}

/* Recolour images/emblems inside Major Order */
body.phosphor-amber .mo-screen img {
    filter: sepia(1) saturate(4) hue-rotate(355deg) !important;
}

/* =========================================================
   HELLDIVER DEPLOYMENT - AMBER PHOSPHOR OVERRIDE
   ========================================================= */

/* Column headings */
body.phosphor-amber .deployment-head,
body.phosphor-amber .deployment-head * {
    color: var(--phosphor) !important;
    border-color: var(--dim) !important;
}

/* Dynamically generated deployment rows */
body.phosphor-amber #deployments,
body.phosphor-amber #deployments * {
    color: var(--phosphor) !important;
    border-color: var(--dim) !important;
}

/* Brighter important values if present */
body.phosphor-amber #deployments strong,
body.phosphor-amber #deployments .value {
    color: var(--bright) !important;
    text-shadow: 0 0 5px rgba(255, 176, 0, 0.45) !important;
}

/* =========================================================
   AMBER CRT - REMOVE GREEN BACKGROUND CAST
   ========================================================= */

body.phosphor-amber #crt {
    background:
        radial-gradient(
            ellipse at center,
            #201500 0%,
            #100900 58%,
            #000000 100%
        ) !important;

    text-shadow:
        0 0 9px rgba(255,176,0,.45) !important;
}

/* Curved glass / phosphor glow */
body.phosphor-amber #crt::before {
    box-shadow:
        inset 0 0 5vw rgba(0,0,0,.85),
        inset 0 0 1.5vw rgba(255,176,0,.08) !important;
}

/* CRT glass/scanline tint */
body.phosphor-amber #crt::after {
    background-image:
        repeating-linear-gradient(
            0deg,
            rgba(255,176,0,.07) 0,
            rgba(255,176,0,.07) 1px,
            transparent 1px,
            transparent 3px
        ) !important;
}

/* =========================================================
   HEADER LOGOS - FOLLOW CRT PHOSPHOR COLOUR
   ========================================================= */

/* Green phosphor */
.header-centre::before,
.header-centre::after {
    filter:
        sepia(1)
        saturate(5)
        hue-rotate(70deg)
        brightness(1.15)
        drop-shadow(0 0 5px rgba(80,255,80,.45));
}

/* Amber phosphor */
body.phosphor-amber .header-centre::before,
body.phosphor-amber .header-centre::after {
    filter:
        sepia(1)
        saturate(6)
        hue-rotate(355deg)
        brightness(1.15)
        drop-shadow(0 0 5px rgba(255,176,0,.45)) !important;
}

/* =========================================================
   AMBER CRT - ROLLING SWEEP BAND
   ========================================================= */

body.phosphor-amber #sweep {
    background:
        linear-gradient(
            transparent,
            rgba(255,176,0,.09),
            transparent
        ) !important;
}

/* =========================================================
   AMBER CRT - NAVIGATION BUTTON BACKGROUNDS
   ========================================================= */

/* Active navigation tab */
body.phosphor-amber .nav-item.active,
body.phosphor-amber nav button.active,
body.phosphor-amber .nav-button.active {
    background: rgba(255,176,0,.10) !important;
    color: var(--bright) !important;
    border-color: var(--phosphor) !important;
    box-shadow:
        inset 0 0 12px rgba(255,176,0,.05),
        0 0 5px rgba(255,176,0,.12) !important;
}

/* Hovered navigation tab */
body.phosphor-amber .nav-item:hover,
body.phosphor-amber nav button:hover,
body.phosphor-amber .nav-button:hover {
    background: rgba(255,176,0,.07) !important;
}

/* =========================================================
   AMBER CRT - MAJOR ORDER PANEL BACKGROUNDS
   ========================================================= */

/* Priority directive panel */
body.phosphor-amber .mo-directive {
    background: rgba(255,176,0,.055) !important;
    border-color: var(--dim) !important;
}

/* Terminids / Automatons / Illuminate objective panels */
body.phosphor-amber .mo-command .mo-task {
    background: rgba(255,176,0,.035) !important;
    border-color: var(--dim) !important;
}

/* Completed objective, if one appears */
body.phosphor-amber .mo-command .mo-task.complete {
    background: rgba(255,176,0,.075) !important;
}

/* =========================================================
   AMBER CRT - THREAT DATABASE BACKGROUNDS
   ========================================================= */

/* Main Enemy Intelligence panel */
body.phosphor-amber .enemy-intel {
    background: rgba(32, 18, 0, .65) !important;
}

/* Threat Database inner panel */
body.phosphor-amber .enemy-database {
    background: rgba(28, 15, 0, .35) !important;
}

/* Enemy image / visual area */
body.phosphor-amber .enemy-unit-visual {
    background: rgba(24, 13, 0, .30) !important;
}

/* Previous / Next controls */
body.phosphor-amber .enemy-record-controls button {
    background: rgba(255,176,0,.045) !important;
}

/* =========================================================
   AMBER CRT - SCREEN TRANSITION STATIC
   ========================================================= */

body.phosphor-amber #flash {
    background:
        repeating-linear-gradient(
            0deg,
            transparent 0,
            transparent 5px,
            rgba(255,176,0,.20) 6px,
            transparent 8px
        ) !important;
}

/* =========================================================
   BOOT SCREEN - SUPER EARTH IDENT
   ========================================================= */

.boot-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 18px 0 10px;
}

.boot-logo img {
    width: 120px;
    height: 120px;
    object-fit: contain;

    filter:
        sepia(1)
        saturate(5)
        hue-rotate(70deg)
        brightness(1.15)
        drop-shadow(0 0 8px rgba(80,255,80,.55));
}

.boot-skip {
    margin: 4px 0 12px;
    text-align: center;
    color: var(--dim);
    font-size: .72em;
    letter-spacing: .12em;
    opacity: .7;
    cursor: pointer;
}

/* Amber boot logo */
body.phosphor-amber .boot-logo img {
    filter:
        sepia(1)
        saturate(6)
        hue-rotate(355deg)
        brightness(1.15)
        drop-shadow(0 0 8px rgba(255,176,0,.55)) !important;
}

body.phosphor-amber .boot-skip {
    color: var(--dim);
}

/* Make it obvious the whole boot screen can be skipped */
#boot-screen:not(.boot-complete) {
    cursor: pointer;
}

@media (max-width: 600px) {
    .boot-logo img {
        width: 95px;
        height: 95px;
    }

    .boot-logo {
        margin: 12px 0 8px;
    }

    .boot-skip {
        font-size: .62em;
    }
}

/* =========================================================
   BOOT SCREEN - FIXED SUPER EARTH BACKGROUND WATERMARK
   ========================================================= */

#boot-screen {
    position: fixed;
}

/* Remove logo from document flow */
.boot-logo {
    position: absolute !important;
    inset: 0 !important;
    margin: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    pointer-events: none !important;
    z-index: 0 !important;
}

.boot-logo img {
    width: min(46vw, 430px) !important;
    height: min(46vw, 430px) !important;
    object-fit: contain !important;
    opacity: 0.11 !important;

    filter:
        sepia(1)
        saturate(5)
        hue-rotate(70deg)
        brightness(1.15)
        drop-shadow(0 0 18px rgba(80,255,80,.35)) !important;
}

/* Keep all boot information above the watermark */
#boot-screen > *:not(.boot-logo) {
    position: relative;
    z-index: 1;
}

/* Amber version of background watermark */
body.phosphor-amber .boot-logo img {
    filter:
        sepia(1)
        saturate(6)
        hue-rotate(355deg)
        brightness(1.15)
        drop-shadow(0 0 18px rgba(255,176,0,.35)) !important;
}

/* Mobile sizing */
@media (max-width: 600px) {
    .boot-logo img {
        width: min(75vw, 320px) !important;
        height: min(75vw, 320px) !important;
    }
}

/* Restore original boot element positioning.
   Logo remains an independent background watermark. */
#boot-screen > *:not(.boot-logo) {
    position: revert;
    z-index: auto;
}

.boot-logo {
    z-index: 0 !important;
}

.boot-loading,
.boot-skip,
#boot-liberty,
#boot-freedom,
#boot-democracy {
    z-index: 1;
}

/* =========================================================
   BOOT SCREEN - RESTORE LOADING POSITION
   ========================================================= */

#boot-screen .boot-loading {
    position: absolute !important;
    right: 4vw !important;
    bottom: 4vh !important;
    left: auto !important;
    top: auto !important;

    width: auto !important;
    margin: 0 !important;

    text-align: right !important;
    z-index: 2 !important;
}

/* Keep skip instruction centred, independent of loading */
#boot-screen .boot-skip {
    position: absolute !important;
    left: 50% !important;
    bottom: 4vh !important;
    transform: translateX(-50%) !important;

    margin: 0 !important;
    width: max-content !important;
    z-index: 2 !important;
}

/* =========================================================
   MOBILE - GALACTIC STATUS HERO BOXES
   ========================================================= */

@media (max-width: 600px) {

    /* Stack HELLDIVERS DEPLOYED and PREDICTED OUTCOME */
    .status-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        gap: 10px !important;
    }

    .status-grid .box.hero {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    /* Prevent long prediction text forcing the box wider */
    #campaignCount {
        max-width: 100% !important;
        overflow-wrap: anywhere !important;
        word-break: normal !important;
        white-space: normal !important;
    }
}

/* =========================================================
   MOBILE - COMPACT GALACTIC STATUS HERO BOXES
   ========================================================= */

@media (max-width: 600px) {

    .status-grid {
        gap: 5px !important;
    }

    .status-grid .box.hero {
        min-height: 0 !important;
        height: auto !important;
        padding-top: 6px !important;
        padding-bottom: 6px !important;
    }

    .status-grid .box.hero .label {
        margin-top: 0 !important;
        margin-bottom: 2px !important;
        line-height: 1.05 !important;
    }

    .status-grid .box.hero .huge {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        padding: 0 !important;
        line-height: 1 !important;
    }

    #totalPlayers,
    #campaignCount {
        min-height: 0 !important;
    }
}

/* =========================================================
   AMBER CRT - NAVIGATION DECK BACKGROUND
   ========================================================= */

body.phosphor-amber #warpi-nav {
    background: rgba(32, 18, 0, .32) !important;
}

/* Keep inactive buttons transparent over the amber deck */
body.phosphor-amber #warpi-nav .nav-page {
    background-color: transparent !important;
}

/* Active page gets subtle amber illumination */
body.phosphor-amber #warpi-nav .nav-page.active {
    background: rgba(255,176,0,.10) !important;
    color: var(--bright) !important;
}

/* =========================================================
   GALACTIC UPDATE OVERLAY - PERMANENTLY DISABLED
   Data continues to refresh silently.
   ========================================================= */

#galactic-update,
#galactic-update.visible {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* =========================================================
   MAJOR ORDER - OBJECTIVE ETA
   ========================================================= */

.mo-eta {
    margin-top: 5px;
    font-size: 0.78em;
    letter-spacing: 0.08em;
    color: var(--dim);
    text-align: right;
}

body.phosphor-amber .mo-eta {
    color: var(--dim) !important;
    text-shadow: 0 0 4px rgba(255,176,0,.25);
}

@media (max-width: 600px) {
    .mo-eta {
        margin-top: 3px;
        font-size: 0.70em;
    }
}

/* =========================================================
   MOBILE - LARGER SECTION NAVIGATION BUTTONS
   ========================================================= */

@media (max-width: 600px) {

    #warpi-nav .nav-page {
        font-size: 0.78em !important;
        line-height: 1.15 !important;

        min-height: 42px !important;
        padding: 7px 3px !important;

        display: flex !important;
        align-items: center !important;
        justify-content: center !important;

        box-sizing: border-box !important;
    }
}

/* MOBILE NAV - retain larger touch targets without oversized text */
@media (max-width: 600px) {

    #warpi-nav .nav-page {
        min-height: 42px !important;
        padding: 6px 2px !important;

        font-size: 0.62em !important;
        line-height: 1.15 !important;
        letter-spacing: 0 !important;

        min-width: 0 !important;
        overflow: hidden !important;
        white-space: normal !important;
        text-align: center !important;
    }
}

/* MOBILE NAV - give GALACTIC STATUS a little more room */
@media (max-width: 600px) {

    #warpi-nav .nav-page:first-child {
        flex-grow: 1.28 !important;
        flex-shrink: 0 !important;
    }

    #warpi-nav .nav-page:not(:first-child) {
        flex-grow: 1 !important;
        min-width: 0 !important;
    }
}

/* MOBILE NAV - wider GALACTIC STATUS */
@media (max-width: 600px) {

    #warpi-nav .nav-page:first-child {
        flex: 1.65 1 0 !important;
        min-width: 82px !important;
    }

    #warpi-nav .nav-page:not(:first-child) {
        flex: 1 1 0 !important;
        min-width: 0 !important;
    }
}

/* MOBILE NAV - final GALACTIC STATUS width adjustment */
@media (max-width: 600px) {

    #warpi-nav .nav-page:first-child {
        flex: 1.9 1 0 !important;
        min-width: 94px !important;
        padding-left: 4px !important;
        padding-right: 4px !important;
        overflow: visible !important;
        text-align: center !important;
        justify-content: center !important;
    }

    #warpi-nav .nav-page:not(:first-child) {
        flex: 1 1 0 !important;
        min-width: 0 !important;
    }
}

/* =========================================================
   MOBILE NAV - FINAL CLEAN WIDTH DISTRIBUTION
   ========================================================= */

@media (max-width: 600px) {

    #warpi-nav .nav-page {
        min-width: 0 !important;
        overflow: visible !important;
        padding: 6px 2px !important;
        box-sizing: border-box !important;
    }

    /* GALACTIC STATUS */
    #warpi-nav .nav-page:nth-of-type(1) {
        flex: 1.45 1 0 !important;
        width: auto !important;
    }

    /* Remaining four tabs */
    #warpi-nav .nav-page:nth-of-type(n+2) {
        flex: 1 1 0 !important;
        width: auto !important;
    }
}

/* MOBILE NAV - centre the section button group */
@media (max-width: 600px) {

    #warpi-nav {
        justify-content: center !important;
    }

    #warpi-nav .nav-pages {
        margin-left: auto !important;
        margin-right: auto !important;
        justify-content: center !important;
    }
}

/* =========================================================
   MOBILE NAV - CENTRE COMPLETE BUTTON BANK
   ========================================================= */

@media (max-width: 600px) {

    #warpi-nav .nav-pages {
        width: 94% !important;
        max-width: 94% !important;

        margin-left: auto !important;
        margin-right: auto !important;

        flex: none !important;
        justify-content: center !important;
    }
}

/* =========================================================
   DATA RECEIVED / UPLINK OVERLAY - PERMANENTLY DISABLED
   Background API updates continue normally.
   ========================================================= */

#data-received,
.data-received,
#data-overlay,
.data-received-overlay {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* =========================================================
   GALACTIC UPLINK / DATA RECEIVED OVERLAY - DISABLED
   ========================================================= */

#transmission {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* =========================================================
   ILLUMINATE / SQUID FONT
   ========================================================= */

@font-face {
    font-family: "Illuminate WarPi";
    src: url("/assets/Illuminate-WarPi.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

.illuminate-font {
    font-family: "Illuminate WarPi", monospace !important;
}

/* =========================================================
   SQUID MODE — ILLUMINATE CRT
   ========================================================= */

body.phosphor-squid {
    --phosphor: #69d9ff;
    --bright: #d7c4ff;
    --dim: #7770d9;
    --faint: #29265f;
}

/* Main CRT glass */
body.phosphor-squid #crt {
    background:
        radial-gradient(
            ellipse at center,
            #10152d 0%,
            #09091c 58%,
            #000000 100%
        ) !important;

    text-shadow:
        0 0 4px rgba(105,217,255,.75),
        0 0 10px rgba(135,92,255,.45) !important;

    animation: squid-crt-shift 7s ease-in-out infinite alternate;
}

/* Edge glow */
body.phosphor-squid #crt::before {
    box-shadow:
        inset 0 0 5vw rgba(0,0,0,.85),
        inset 0 0 2vw rgba(105,217,255,.12),
        inset 0 0 4vw rgba(140,70,255,.08) !important;
}

/* Scanlines */
body.phosphor-squid #crt::after {
    background-image:
        repeating-linear-gradient(
            0deg,
            rgba(105,217,255,.055) 0,
            rgba(105,217,255,.055) 1px,
            transparent 1px,
            transparent 3px
        ) !important;
}

/* Rolling CRT sweep */
body.phosphor-squid #sweep {
    background:
        linear-gradient(
            transparent,
            rgba(135,92,255,.13),
            rgba(105,217,255,.09),
            transparent
        ) !important;
}

/* Screen-change static */
body.phosphor-squid #flash {
    background:
        repeating-linear-gradient(
            0deg,
            transparent 0,
            transparent 5px,
            rgba(105,217,255,.18) 6px,
            rgba(145,80,255,.12) 7px,
            transparent 9px
        ) !important;
}

/* Navigation */
body.phosphor-squid #warpi-nav {
    background: rgba(18,12,48,.38) !important;
}

body.phosphor-squid #warpi-nav .nav-page.active {
    background: rgba(120,80,255,.13) !important;
    color: var(--bright) !important;
}

/* Super Earth logos become compromised too */
body.phosphor-squid .header-centre::before,
body.phosphor-squid .header-centre::after {
    filter:
        sepia(1)
        saturate(6)
        hue-rotate(150deg)
        brightness(1.35)
        drop-shadow(0 0 5px rgba(105,217,255,.7))
        drop-shadow(0 0 10px rgba(140,70,255,.45)) !important;
}

/* Subtle colour instability */
@keyframes squid-crt-shift {
    0% {
        color: #69d9ff;
        filter: hue-rotate(0deg);
    }

    35% {
        color: #8abaff;
        filter: hue-rotate(12deg);
    }

    70% {
        color: #a58cff;
        filter: hue-rotate(28deg);
    }

    100% {
        color: #cf80ff;
        filter: hue-rotate(42deg);
    }
}

/* TEMP: prove Illuminate font works in Squid mode */
body.phosphor-squid .header-centre {
    font-family: "Illuminate WarPi", monospace !important;
}

/* SQUID LANGUAGE CORRUPTION */
body.phosphor-squid .squid-corrupt {
    font-family: "Illuminate WarPi", monospace !important;
    color: #d7c4ff !important;
    text-shadow:
        0 0 4px #69d9ff,
        0 0 9px #895cff,
        0 0 14px rgba(180,100,255,.55) !important;
    animation: squid-glyph-flicker .22s steps(2,end) infinite;
}

@keyframes squid-glyph-flicker {
    0%, 100% {
        opacity: 1;
        transform: translate(0,0);
    }
    35% {
        opacity: .82;
        transform: translate(.4px,0);
    }
    65% {
        opacity: .94;
        transform: translate(-.4px,.2px);
    }
}

/* Cancel the temporary header-wide font test */
body.phosphor-squid .header-centre {
    font-family: inherit !important;
}

/* =========================================================
   SQUID MODE — COMPROMISED THREAT DATABASE
   ========================================================= */

/* Invisible in normal Green/Amber operation */
.squid-threat-database {
    display: none;
}

/* Squids replace our database with theirs */
body.phosphor-squid .enemy-intel > .enemy-database,
body.phosphor-squid .enemy-intel > .enemy-factions {
    display: none !important;
}

body.phosphor-squid .squid-threat-database {
    display: block !important;
    padding: 14px;
    border: 1px solid var(--dim);
    background:
        linear-gradient(
            135deg,
            rgba(50,40,110,.20),
            rgba(20,100,140,.12)
        );
    box-shadow:
        inset 0 0 20px rgba(105,217,255,.06),
        0 0 10px rgba(130,80,255,.10);
}

.squid-threat-warning {
    text-align: center;
    color: #cf80ff;
    font-weight: bold;
    letter-spacing: .15em;
    margin-bottom: 10px;
    animation: squid-warning 1.4s steps(2,end) infinite;
}

.squid-threat-heading {
    text-align: center;
    color: var(--bright);
    border-top: 1px solid var(--dim);
    border-bottom: 1px solid var(--dim);
    padding: 8px;
    margin-bottom: 12px;
    letter-spacing: .12em;
}

.squid-threat-record {
    max-width: 760px;
    margin: 0 auto;
}

.squid-threat-classified {
    text-align: right;
    color: #cf80ff;
    margin-bottom: 8px;
}

.squid-helldiver-image {
    width: min(280px, 70vw);
    aspect-ratio: 4 / 3;
    margin: 10px auto;
    border: 1px solid var(--phosphor);
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        repeating-linear-gradient(
            0deg,
            rgba(105,217,255,.035) 0,
            rgba(105,217,255,.035) 1px,
            transparent 1px,
            transparent 4px
        ),
        rgba(70,40,120,.10);
    box-shadow:
        inset 0 0 25px rgba(105,217,255,.10),
        0 0 12px rgba(130,80,255,.18);
}

.squid-image-placeholder {
    text-align: center;
    color: var(--dim);
    line-height: 1.6;
}

.squid-threat-name {
    text-align: center;
    font-size: 1.5em;
    color: var(--bright);
    margin: 10px 0;
    text-shadow:
        0 0 5px #69d9ff,
        0 0 12px #895cff;
}

.squid-threat-properties {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin: 12px 0;
}

.squid-threat-properties > div {
    border: 1px solid var(--dim);
    padding: 8px;
    text-align: center;
}

.squid-threat-properties span,
.squid-threat-properties strong {
    display: block;
}

.squid-threat-properties span {
    color: var(--dim);
    margin-bottom: 4px;
}

.squid-threat-properties strong {
    color: var(--bright);
}

.squid-threat-section {
    border-top: 1px solid var(--dim);
    padding: 10px 4px;
    line-height: 1.6;
}

.squid-threat-label {
    color: var(--bright);
    margin-bottom: 5px;
    letter-spacing: .1em;
}

@keyframes squid-warning {
    0%, 89%, 100% { opacity: 1; }
    90%, 94%      { opacity: .25; }
}

@media (max-width: 600px) {
    .squid-threat-database {
        padding: 8px !important;
    }

    .squid-threat-properties {
        grid-template-columns: 1fr !important;
        gap: 4px !important;
    }

    .squid-threat-properties > div {
        padding: 5px !important;
    }

    .squid-helldiver-image {
        width: min(230px, 72vw);
    }
}

/* =========================================================
   SQUID THREAT DATABASE — MOBILE SCROLL FIX
   ========================================================= */

@media (max-width: 600px) {

    body.phosphor-squid .enemy-intel {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;

        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
    }

    body.phosphor-squid .squid-threat-database {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        padding-bottom: 80px !important;
    }
}

/* =========================================================
   SQUID THREAT DATABASE — ACTUAL MOBILE SCROLL CONTAINER
   ========================================================= */

@media (max-width: 600px) {

    body.phosphor-squid .screen.enemy-intel,
    body.phosphor-squid .enemy-intel.screen,
    body.phosphor-squid .enemy-intel {
        height: 100% !important;
        min-height: 0 !important;

        overflow-y: auto !important;
        overflow-x: hidden !important;

        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain;

        padding-bottom: 100px !important;
        box-sizing: border-box !important;
    }

    body.phosphor-squid .squid-threat-database {
        height: auto !important;
        min-height: min-content !important;
        max-height: none !important;
        overflow: visible !important;
    }
}

/* =========================================================
   SQUID THREAT DATABASE — MOBILE DOCUMENT SCROLL
   ========================================================= */

@media (max-width: 600px) {

    html:has(body.phosphor-squid) {
        height: auto !important;
        min-height: 100% !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    body.phosphor-squid {
        height: auto !important;
        min-height: 100dvh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
    }

    body.phosphor-squid #crt {
        height: auto !important;
        min-height: 100dvh !important;
        overflow: visible !important;
    }

    body.phosphor-squid main {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    body.phosphor-squid .screen.active {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    body.phosphor-squid .squid-threat-database {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        margin-bottom: 80px !important;
    }
}

/* =========================================================
   SQUID THREAT DATABASE — DESKTOP SCROLL
   Keep CRT/header/navigation fixed; scroll the database.
   ========================================================= */

@media (min-width: 601px) {

    body.phosphor-squid .screen.enemy-intel,
    body.phosphor-squid .enemy-intel.screen,
    body.phosphor-squid .enemy-intel {
        height: 100% !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        scrollbar-width: thin;
        scrollbar-color: var(--dim) transparent;
        padding-bottom: 60px !important;
        box-sizing: border-box !important;
    }

    body.phosphor-squid .squid-threat-database {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        margin-bottom: 40px !important;
    }

    body.phosphor-squid .enemy-intel::-webkit-scrollbar {
        width: 8px;
    }

    body.phosphor-squid .enemy-intel::-webkit-scrollbar-track {
        background: transparent;
    }

    body.phosphor-squid .enemy-intel::-webkit-scrollbar-thumb {
        background: var(--dim);
        border: 1px solid var(--phosphor);
    }
}

/* =========================================================
   SQUID MODE — FINAL DESKTOP SCROLL FIX
   Allow tall compromised pages to extend beyond viewport.
   ========================================================= */

@media (min-width: 601px) {

    html:has(body.phosphor-squid) {
        height: auto !important;
        min-height: 100% !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    body.phosphor-squid {
        height: auto !important;
        min-height: 100vh !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    body.phosphor-squid #crt {
        height: auto !important;
        min-height: 100vh !important;
        overflow: visible !important;
    }

    body.phosphor-squid main {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    body.phosphor-squid .screen.active {
        height: auto !important;
        min-height: 0 !important;
        overflow: visible !important;
    }

    body.phosphor-squid .enemy-intel {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
    }

    body.phosphor-squid .squid-threat-database {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        margin-bottom: 100px !important;
    }
}

/* =========================================================
   SQUID DATABASE — HELLDIVER IDENTIFICATION IMAGE
   ========================================================= */

body.phosphor-squid .squid-helldiver-image {
    position: relative;
    overflow: hidden !important;
    background: #050414 !important;
}

body.phosphor-squid .squid-helldiver-photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;

    filter:
        grayscale(.75)
        contrast(1.25)
        brightness(.75)
        sepia(.25)
        hue-rotate(175deg)
        saturate(2.4);

    opacity: .88;
}

/* Blue/purple surveillance tint */
body.phosphor-squid .squid-helldiver-image::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;

    background:
        linear-gradient(
            135deg,
            rgba(105,217,255,.14),
            rgba(130,70,255,.22)
        );

    mix-blend-mode: screen;
}

/* Local scanlines over photograph */
body.phosphor-squid .squid-helldiver-image::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;

    background:
        repeating-linear-gradient(
            0deg,
            rgba(105,217,255,.08) 0,
            rgba(105,217,255,.08) 1px,
            transparent 1px,
            transparent 4px
        );

    box-shadow:
        inset 0 0 28px rgba(105,217,255,.20),
        inset 0 0 45px rgba(125,65,255,.16);
}

/* WARPI PLANET FRONT CARDS */

.front-planets {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 12px;
    margin-bottom: 20px;
}

.front-planet-card {
    min-width: 0;
    text-align: center;
    border: 1px dashed currentColor;
    padding: 10px;
    box-sizing: border-box;
}

.planet-visual {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 8px;
}

.planet-image {
    display: block;
    max-width: 120px;
    max-height: 120px;
    width: auto;
    height: auto;
    object-fit: contain;

    filter:
        grayscale(1)
        sepia(1)
        hue-rotate(70deg)
        saturate(5)
        brightness(1.1);
}

.planet-placeholder {
    font-size: 90px;
    line-height: 1;
    opacity: 0.75;

    text-shadow:
        0 0 5px currentColor,
        0 0 12px currentColor;
}

.planet-card-name {
    font-weight: bold;
    font-size: 1.15em;
    margin-bottom: 4px;
}

.planet-card-force {
    font-size: 0.8em;
    opacity: 0.8;
    margin-bottom: 7px;
}

.planet-card-status {
    font-size: 0.85em;
    margin-bottom: 5px;
}

.planet-modifiers {
    border-top: 1px dashed currentColor;
    margin-top: 9px;
    padding-top: 8px;
    min-height: 2.5em;
    font-size: 0.75em;
    line-height: 1.4;
    opacity: 0.85;
}


/* MOBILE */

@media (max-width: 700px) {

    .front-planets {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .front-planet-card {
        display: grid;
        grid-template-columns: 90px 1fr;
        grid-template-rows: auto auto auto auto;
        text-align: left;
        column-gap: 12px;
        align-items: center;
    }

    .planet-visual {
        grid-row: 1 / 5;
        height: 90px;
        margin: 0;
    }

    .planet-image {
        max-width: 85px;
        max-height: 85px;
    }

    .planet-placeholder {
        font-size: 65px;
    }

    .planet-card-name {
        font-size: 1.05em;
    }

    .planet-modifiers {
        margin-top: 5px;
        padding-top: 5px;
        min-height: 0;
    }
}

/* WARPI COMPACT PLANET CARDS */

/*
   Override the first planet-card design.
   PLANET | TACTICAL DATA
*/

.front-planets {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 8px;
    margin-bottom: 14px;
}

.front-planet-card {
    display: grid;
    grid-template-columns: 40% 60%;
    grid-template-rows: auto auto auto auto;
    column-gap: 0;

    min-width: 0;
    min-height: 125px;

    padding: 7px;
    box-sizing: border-box;

    border: 1px dashed currentColor;
    text-align: left;
}


/* LEFT SIDE - PLANET */

.planet-visual {
    grid-column: 1;
    grid-row: 1 / 5;

    height: auto;
    min-height: 108px;

    display: flex;
    align-items: center;
    justify-content: center;

    margin: 0;
    padding: 5px 8px 5px 2px;

    border-right: 1px dashed currentColor;

    overflow: hidden;
}

.planet-image {
    display: block;

    width: 90px;
    height: 90px;

    max-width: 100%;
    max-height: 100%;

    object-fit: contain;

    filter:
        grayscale(1)
        sepia(1)
        hue-rotate(70deg)
        saturate(5)
        brightness(1.1);
}

.planet-placeholder {
    font-size: 72px;
    line-height: 1;

    opacity: 0.75;

    text-shadow:
        0 0 5px currentColor,
        0 0 10px currentColor;
}


/* RIGHT SIDE - PLANET INFORMATION */

.planet-card-name,
.planet-card-force,
.planet-card-status,
.planet-modifiers {

    grid-column: 2;

    margin-left: 10px;
    min-width: 0;
}

.planet-card-name {
    grid-row: 1;

    font-weight: bold;
    font-size: 1em;

    margin-bottom: 2px;
}

.planet-card-force {
    grid-row: 2;

    font-size: 0.72em;
    opacity: 0.8;

    margin-bottom: 3px;
}

.planet-card-status {
    grid-row: 3;

    font-size: 0.75em;

    margin-bottom: 3px;
}


/*
   Existing progress bar needs to live on
   the information side as well.
*/

.front-planet-card > .progress {
    grid-column: 2;
    grid-row: 4;

    margin-left: 10px;
    margin-right: 4px;
    align-self: start;
}


/* Modifier text below status information */

.planet-modifiers {
    grid-row: 5;

    border-top: 1px dashed currentColor;

    margin-top: 6px;
    padding-top: 5px;

    min-height: 0;

    font-size: 0.67em;
    line-height: 1.3;
    opacity: 0.85;
}


/* Let left planet area span modifier row too */

.planet-visual {
    grid-row: 1 / 6;
}


/* PHONE */

@media (max-width: 700px) {

    .front-planets {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .front-planet-card {
        grid-template-columns: 34% 66%;
        min-height: 105px;
        padding: 6px;
    }

    .planet-visual {
        min-height: 92px;
        padding-right: 6px;
    }

    .planet-image {
        width: 76px;
        height: 76px;
    }

    .planet-placeholder {
        font-size: 58px;
    }

    .planet-card-name,
    .planet-card-force,
    .planet-card-status,
    .planet-modifiers,
    .front-planet-card > .progress {
        margin-left: 8px;
    }
}


/* WARPI THEME-AWARE PLANET HOLOGRAMS */

/*
 * Preserve the monochrome CRT aesthetic while allowing
 * planet holograms to follow the selected phosphor mode.
 */

/* GREEN CRT */
body.phosphor-green .planet-image {
    filter:
        grayscale(1)
        sepia(1)
        hue-rotate(70deg)
        saturate(5)
        brightness(1.15)
        contrast(1.08) !important;
}

/* AMBER CRT */
body.phosphor-amber .planet-image {
    filter:
        grayscale(1)
        sepia(1)
        saturate(7)
        hue-rotate(350deg)
        brightness(1.12)
        contrast(1.08) !important;
}

/* SQUID / ILLUMINATE CRT */
body.phosphor-squid .planet-image {
    filter:
        grayscale(1)
        sepia(1)
        saturate(7)
        hue-rotate(135deg)
        brightness(1.20)
        contrast(1.10) !important;
}

@keyframes subfaction-alert {
    0%, 70% {
        opacity: 1;
    }

    71%, 100% {
        opacity: 0.72;
    }
}

/* ==========================================================
   ACTIVE FRONTS — allow expanded campaign list to scroll
   ========================================================== */

#fronts.screen.active {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
}

body:has(#fronts.screen.active) {
    height: auto !important;
    min-height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

body:has(#fronts.screen.active) #crt {
    height: auto !important;
    min-height: 100vh !important;
    overflow: visible !important;
}

body:has(#fronts.screen.active) main {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
}

/* ==========================================================
   WARPI EXPANDED SCREEN SCROLLING
   Active screens may now contain more than one viewport.
   ========================================================== */

html {
    height: auto !important;
    min-height: 100% !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

body {
    height: auto !important;
    min-height: 100vh !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

#crt {
    height: auto !important;
    min-height: 100vh !important;
    max-height: none !important;
    overflow: visible !important;
}

main {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
}

.screen.active {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
}

/* ==========================================================
   SUBFACTION — proper compact-card grid placement
   NAME
   SUBFACTION
   HELLDIVERS
   STATUS
   PROGRESS
   MODIFIERS
   ========================================================== */

.front-planet-card {
    grid-template-rows: auto auto auto auto auto auto !important;
}

/* Planet name */
.planet-card-name {
    display: block !important;
    grid-column: 2 !important;
    grid-row: 1 !important;
}

/* Existing information moves down one row */
.planet-card-force {
    grid-column: 2 !important;
    grid-row: 3 !important;
}

.planet-card-status {
    grid-column: 2 !important;
    grid-row: 4 !important;
}

.front-planet-card > .progress {
    grid-column: 2 !important;
    grid-row: 5 !important;
}

/* Biome / weather */
.planet-modifiers {
    grid-column: 2 !important;
    grid-row: 6 !important;
}

/* Planet image spans the complete card */
.planet-visual {
    grid-column: 1 !important;
    grid-row: 1 / 7 !important;
}

/* ==========================================================
   PLANET NAME + SUBFACTION
   ========================================================== */

.planet-card-name > div:first-child {
    display: block !important;
}

.planet-card-name .planet-card-subfaction {
    display: block !important;
    visibility: visible !important;
    height: auto !important;
    max-height: none !important;
    margin: 2px 0 1px 0 !important;
    padding: 0 !important;
    overflow: visible !important;

    font-size: 0.79em !important;
    line-height: 1.15 !important;
    font-weight: bold !important;
    letter-spacing: 0.08em !important;
    text-transform: uppercase !important;

    opacity: 1 !important;
    text-shadow:
        0 0 3px currentColor,
        0 0 7px currentColor !important;

    animation: subfaction-brightness-flash 1.4s steps(2, end) infinite !important;
}

@keyframes subfaction-brightness-flash {
    0%, 64% {
        filter: brightness(1);
        text-shadow:
            0 0 3px currentColor,
            0 0 7px currentColor;
    }

    65%, 78% {
        filter: brightness(0.35);
        text-shadow: none;
    }

    79%, 100% {
        filter: brightness(1);
        text-shadow:
            0 0 3px currentColor,
            0 0 7px currentColor;
    }
}

@media (prefers-reduced-motion: reduce) {
    .planet-card-name .planet-card-subfaction {
        animation: none !important;
    }
}

/* ==========================================================
   ACTIVE FRONTS — close gap beneath subfaction designation
   Move following card information upward without touching
   the working subfaction element.
   ========================================================== */

.front-planet-card:has(.planet-card-subfaction) .planet-card-force {
    transform: translateY(-8px);
}

.front-planet-card:has(.planet-card-subfaction) .planet-card-status {
    transform: translateY(-8px);
}

.front-planet-card:has(.planet-card-subfaction) > .progress {
    transform: translateY(-8px);
}

.front-planet-card:has(.planet-card-subfaction) .planet-modifiers {
    transform: translateY(-8px);
}

/* =========================================================
   AUTOMATON RED CRT
   ========================================================= */

body.phosphor-red {
    --phosphor: #ff3030;
    --bright: #ff6868;
    --dim: #8f1818;
    --faint: #4a0c0c;
}

/* Main CRT */
body.phosphor-red #crt {
    background:
        radial-gradient(
            ellipse at center,
            #200000 0%,
            #100000 58%,
            #000000 100%
        ) !important;

    color: var(--phosphor) !important;
    text-shadow: 0 0 9px rgba(255,48,48,.48) !important;
}

/* Force terminal text/borders into Automaton phosphor */
body.phosphor-red #crt,
body.phosphor-red #crt * {
    border-color: var(--dim);
}

body.phosphor-red #crt::before {
    box-shadow:
        inset 0 0 5vw rgba(0,0,0,.88),
        inset 0 0 1.5vw rgba(255,32,32,.10) !important;
}

body.phosphor-red #crt::after {
    background-image:
        repeating-linear-gradient(
            0deg,
            rgba(255,32,32,.075) 0,
            rgba(255,32,32,.075) 1px,
            transparent 1px,
            transparent 3px
        ) !important;
}

/* Header emblems - temporary red treatment until Automaton art is installed */
body.phosphor-red .header-centre::before,
body.phosphor-red .header-centre::after {
    filter:
        sepia(1)
        saturate(9)
        hue-rotate(305deg)
        brightness(1.1)
        drop-shadow(0 0 6px rgba(255,32,32,.55)) !important;
}

/* Rolling CRT sweep */
body.phosphor-red #sweep {
    background:
        linear-gradient(
            transparent,
            rgba(255,32,32,.10),
            transparent
        ) !important;
}

/* Navigation */
body.phosphor-red .nav-item.active,
body.phosphor-red nav button.active,
body.phosphor-red .nav-button.active {
    background: rgba(255,32,32,.11) !important;
    color: var(--bright) !important;
    border-color: var(--phosphor) !important;
    box-shadow:
        inset 0 0 12px rgba(255,32,32,.06),
        0 0 6px rgba(255,32,32,.16) !important;
}

body.phosphor-red .nav-item:hover,
body.phosphor-red nav button:hover,
body.phosphor-red .nav-button:hover {
    background: rgba(255,32,32,.075) !important;
}

/* Major Order */
body.phosphor-red .mo-directive {
    background: rgba(255,32,32,.06) !important;
    border-color: var(--dim) !important;
}

body.phosphor-red .mo-command .mo-task {
    background: rgba(255,32,32,.04) !important;
    border-color: var(--dim) !important;
}

body.phosphor-red .mo-command .mo-task.complete {
    background: rgba(255,32,32,.08) !important;
}

/* Threat database */
body.phosphor-red .enemy-intel {
    background: rgba(32,0,0,.65) !important;
}

body.phosphor-red .enemy-database {
    background: rgba(28,0,0,.38) !important;
}

body.phosphor-red .enemy-unit-visual {
    background: rgba(24,0,0,.32) !important;
}

body.phosphor-red .enemy-record-controls button {
    background: rgba(255,32,32,.05) !important;
}

/* Deployment rows */
body.phosphor-red .deployment-head,
body.phosphor-red .deployment-head *,
body.phosphor-red #deployments,
body.phosphor-red #deployments * {
    color: var(--phosphor) !important;
    border-color: var(--dim) !important;
}

body.phosphor-red #deployments strong,
body.phosphor-red #deployments .value {
    color: var(--bright) !important;
    text-shadow: 0 0 5px rgba(255,32,32,.48) !important;
}

/* Screen transition */
body.phosphor-red #flash {
    background:
        repeating-linear-gradient(
            0deg,
            transparent 0,
            transparent 5px,
            rgba(255,32,32,.22) 6px,
            transparent 8px
        ) !important;
}


/* =========================================================
   AUTOMATON RED CRT — COMPLETE PHOSPHOR OVERRIDE
   Keep RED mode genuinely monochrome red.
   ========================================================= */

/* All normal terminal text */
body.phosphor-red #crt,
body.phosphor-red #crt * {
    color: var(--phosphor) !important;
    border-color: var(--dim) !important;
    text-shadow: 0 0 6px rgba(255,48,48,.42) !important;
}

/* Important / bright text */
body.phosphor-red #crt h1,
body.phosphor-red #crt h2,
body.phosphor-red #crt h3,
body.phosphor-red #crt strong,
body.phosphor-red #crt .value,
body.phosphor-red #crt .big-number,
body.phosphor-red #crt .stat-value,
body.phosphor-red #crt .prediction,
body.phosphor-red #crt #prediction,
body.phosphor-red #crt #predictionText {
    color: var(--bright) !important;
    text-shadow:
        0 0 4px rgba(255,80,80,.75),
        0 0 10px rgba(255,32,32,.35) !important;
}

/* Inputs/buttons/nav can otherwise retain old phosphor colours */
body.phosphor-red #crt button,
body.phosphor-red #crt input,
body.phosphor-red #crt select,
body.phosphor-red #crt option {
    color: var(--phosphor) !important;
    border-color: var(--dim) !important;
}

/* Links */
body.phosphor-red #crt a,
body.phosphor-red #crt a:visited {
    color: var(--phosphor) !important;
}

/* SVG graphics that inherit theme colours */
body.phosphor-red #crt svg {
    color: var(--phosphor) !important;
}

body.phosphor-red #crt svg [stroke]:not([stroke="none"]) {
    stroke: currentColor !important;
}

body.phosphor-red #crt svg [fill]:not([fill="none"]) {
    fill: currentColor !important;
}

/* Red selection/highlight rather than inherited green */
body.phosphor-red #crt ::selection {
    background: var(--phosphor);
    color: #120000 !important;
    text-shadow: none !important;
}

/* Preserve black/dark panel backgrounds */
body.phosphor-red #crt .panel,
body.phosphor-red #crt .stat-box,
body.phosphor-red #crt .screen-panel {
    background-color: rgba(20,0,0,.22) !important;
}


/* =========================================================
   AUTOMATON RED CRT — IMAGE PHOSPHOR
   ========================================================= */

/* Active Front planet imagery */
body.phosphor-red .planet-image {
    filter:
        grayscale(1)
        sepia(1)
        saturate(10)
        hue-rotate(315deg)
        brightness(.85)
        contrast(1.7)
        drop-shadow(0 0 4px rgba(255,40,40,.55))
        !important;
}

/* Major Order central Super Earth emblem.
   This remains the SE emblem for now, but displayed through
   the Automaton red CRT phosphor. */
body.phosphor-red .se-emblem-real img {
    filter:
        grayscale(1)
        sepia(1)
        saturate(10)
        hue-rotate(315deg)
        brightness(1.05)
        contrast(1.7)
        drop-shadow(0 0 4px rgba(255,40,40,.65))
        drop-shadow(0 0 9px rgba(255,20,20,.30))
        !important;
}



/* =========================================================
   AUTOMATON RED CRT — REUSE SQUID ENEMY INTEL VIEW
   ========================================================= */

body.phosphor-red .header-centre::before,
body.phosphor-red .header-centre::after {
    filter:
        sepia(1)
        saturate(6)
        hue-rotate(150deg)
        brightness(1.35)
        drop-shadow(0 0 5px rgba(105,217,255,.7))
        drop-shadow(0 0 10px rgba(140,70,255,.45)) !important;
}

body.phosphor-red .squid-corrupt {
    font-family: "Illuminate WarPi", monospace !important;
    color: #d7c4ff !important;
    text-shadow:
        0 0 4px #69d9ff,
        0 0 9px #895cff,
        0 0 14px rgba(180,100,255,.55) !important;
    animation: squid-glyph-flicker .22s steps(2,end) infinite;
}

body.phosphor-red .enemy-intel > .enemy-database,
body.phosphor-red .enemy-intel > .enemy-factions {
    display: none !important;
}

body.phosphor-red .squid-threat-database {
    display: block !important;
    padding: 14px;
    border: 1px solid var(--dim);
    background:
        linear-gradient(
            135deg,
            rgba(50,40,110,.20),
            rgba(20,100,140,.12)
        );
    box-shadow:
        inset 0 0 20px rgba(105,217,255,.06),
        0 0 10px rgba(130,80,255,.10);
}

body.phosphor-red .enemy-intel {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;

        height: auto !important;
        max-height: none !important;
        min-height: 0 !important;
    }

body.phosphor-red .squid-threat-database {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        padding-bottom: 80px !important;
    }

body.phosphor-red .screen.enemy-intel,
    body.phosphor-red .enemy-intel.screen,
    body.phosphor-red .enemy-intel {
        height: 100% !important;
        min-height: 0 !important;

        overflow-y: auto !important;
        overflow-x: hidden !important;

        -webkit-overflow-scrolling: touch !important;
        overscroll-behavior: contain;

        padding-bottom: 100px !important;
        box-sizing: border-box !important;
    }

body.phosphor-red .squid-threat-database {
        height: auto !important;
        min-height: min-content !important;
        max-height: none !important;
        overflow: visible !important;
    }

body.phosphor-red .squid-threat-database {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        margin-bottom: 80px !important;
    }

body.phosphor-red .screen.enemy-intel,
    body.phosphor-red .enemy-intel.screen,
    body.phosphor-red .enemy-intel {
        height: 100% !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        scrollbar-width: thin;
        scrollbar-color: var(--dim) transparent;
        padding-bottom: 60px !important;
        box-sizing: border-box !important;
    }

body.phosphor-red .squid-threat-database {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        margin-bottom: 40px !important;
    }

body.phosphor-red .enemy-intel::-webkit-scrollbar {
        width: 8px;
    }

body.phosphor-red .enemy-intel::-webkit-scrollbar-track {
        background: transparent;
    }

body.phosphor-red .enemy-intel::-webkit-scrollbar-thumb {
        background: var(--dim);
        border: 1px solid var(--phosphor);
    }

body.phosphor-red .enemy-intel {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
    }

body.phosphor-red .squid-threat-database {
        height: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        overflow: visible !important;
        margin-bottom: 100px !important;
    }

body.phosphor-red .squid-helldiver-image {
    position: relative;
    overflow: hidden !important;
    background: #050414 !important;
}

body.phosphor-red .squid-helldiver-photo {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;

    filter:
        grayscale(.75)
        contrast(1.25)
        brightness(.75)
        sepia(.25)
        hue-rotate(175deg)
        saturate(2.4);

    opacity: .88;
}

body.phosphor-red .squid-helldiver-image::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;

    background:
        linear-gradient(
            135deg,
            rgba(105,217,255,.14),
            rgba(130,70,255,.22)
        );

    mix-blend-mode: screen;
}

body.phosphor-red .squid-helldiver-image::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;

    background:
        repeating-linear-gradient(
            0deg,
            rgba(105,217,255,.08) 0,
            rgba(105,217,255,.08) 1px,
            transparent 1px,
            transparent 4px
        );

    box-shadow:
        inset 0 0 28px rgba(105,217,255,.20),
        inset 0 0 45px rgba(125,65,255,.16);
}

/* RED must win over any purple/blue filters inherited from SQUID Intel */
body.phosphor-red .enemy-intel img,
body.phosphor-red .enemy-database img,
body.phosphor-red .enemy-unit-visual img {
    filter:
        grayscale(1)
        sepia(1)
        saturate(10)
        hue-rotate(315deg)
        brightness(.95)
        contrast(1.65)
        drop-shadow(0 0 5px rgba(255,40,40,.55))
        !important;
}


/* =========================================================
   AUTOMATON RED — HELLDIVER INTEL COLOUR CORRECTION
   ========================================================= */

body.phosphor-red .squid-helldiver-image {
    background: #120000 !important;
}

body.phosphor-red .squid-helldiver-photo {
    filter:
        grayscale(1)
        sepia(1)
        saturate(9)
        hue-rotate(315deg)
        brightness(.78)
        contrast(1.45)
        !important;

    opacity: .90 !important;
}

body.phosphor-red .squid-helldiver-image::before {
    background:
        linear-gradient(
            135deg,
            rgba(255,35,35,.10),
            rgba(150,0,0,.22)
        ) !important;

    mix-blend-mode: screen;
}

body.phosphor-red .squid-helldiver-image::after {
    background:
        repeating-linear-gradient(
            0deg,
            rgba(255,45,45,.08) 0,
            rgba(255,45,45,.08) 1px,
            transparent 1px,
            transparent 4px
        ) !important;

    box-shadow:
        inset 0 0 28px rgba(255,35,35,.20),
        inset 0 0 45px rgba(140,0,0,.18)
        !important;
}


/* =========================================================
   AUTOMATON RED — CYBORG THREAT DATABASE
   RED terminal considers Helldivers the cyborg threat.
   ========================================================= */

body.phosphor-red .squid-threat-heading {
    font-size: 0 !important;
}

/* Preserve the existing heading layout, but replace its wording */
body.phosphor-red .squid-threat-heading::after {
    content: "CYBORG THREAT DATABASE";
    font-size: 1.25rem;
    color: var(--bright) !important;
    text-shadow:
        0 0 4px rgba(255,80,80,.75),
        0 0 10px rgba(255,32,32,.35) !important;
}

/* If the normal enemy database is ever visible while RED is active,
   give it the same Automaton-perspective title. */
body.phosphor-red .enemy-heading {
    font-size: 0 !important;
}

body.phosphor-red .enemy-heading::after {
    content: "CYBORG THREAT DATABASE";
    font-size: 1.25rem;
    color: var(--bright) !important;
    text-shadow:
        0 0 4px rgba(255,80,80,.75),
        0 0 10px rgba(255,32,32,.35) !important;
}



/* ============================================================
   AUTOMATON LANGUAGE — RED CRT
   ============================================================ */

@font-face {
    font-family: "AutomatonWarPi";
    src: url("assets/Automaton-WarPi.ttf") format("truetype");
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/*
 * The corruption engine already wraps random words in
 * .squid-corrupt. In RED mode, render those same temporary
 * spans using the Automaton alphabet instead.
 */
body.phosphor-red .squid-corrupt {
    font-family: "AutomatonWarPi", monospace !important;
    color: var(--bright) !important;

    text-shadow:
        0 0 3px rgba(255,80,80,.95),
        0 0 7px rgba(255,40,40,.70),
        0 0 14px rgba(180,0,0,.45) !important;
}


/* ============================================================
   RED CRT — SUPER EARTH / AUTOMATON LOGO FLICKER FIX
   ============================================================ */

/* Keep the real header IMG visible in RED so JS can swap its src. */
body.phosphor-red .se-header-logo {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;

    filter:
        grayscale(1)
        sepia(1)
        saturate(10)
        hue-rotate(315deg)
        brightness(1.05)
        contrast(1.7)
        drop-shadow(0 0 4px rgba(255,40,40,.65))
        drop-shadow(0 0 9px rgba(255,20,20,.30))
        !important;
}

/* Suppress any theme-generated replacement sitting over header logos. */
body.phosphor-red .se-header-logo-wrap::before,
body.phosphor-red .se-header-logo-wrap::after {
    display: none !important;
    content: none !important;
}

/* Normal Super Earth emblem on Major Order must also be RED. */
body.phosphor-red .se-emblem-real img {
    filter:
        grayscale(1)
        sepia(1)
        saturate(10)
        hue-rotate(315deg)
        brightness(1.05)
        contrast(1.7)
        drop-shadow(0 0 4px rgba(255,40,40,.65))
        drop-shadow(0 0 9px rgba(255,20,20,.30))
        !important;
}

/*
 * When JS swaps in the actual Automaton artwork, don't recolour it.
 * It's already red and we want its original appearance.
 */
body.phosphor-red img.automaton-logo-interference {
    filter:
        drop-shadow(0 0 5px rgba(255,40,40,.80))
        drop-shadow(0 0 12px rgba(255,20,20,.40))
        !important;
}


/* ============================================================
   RED CRT — HEADER AUTOMATON STAR INTERFERENCE
   The two header emblems are CSS-generated rather than IMG tags.
   ============================================================ */

body.phosphor-red .se-header-logo-wrap::after {
    content: "" !important;
    display: block !important;

    position: absolute;
    inset: 0;

    background:
        url("assets/automaton-star.png")
        center / contain
        no-repeat !important;

    opacity: 0;

    filter:
        drop-shadow(0 0 4px rgba(255,45,45,.85))
        drop-shadow(0 0 10px rgba(255,20,20,.45));

    pointer-events: none;

    animation: automatonHeaderInterference 8.3s steps(1,end) infinite;
}

/* Offset the right-hand emblem so they don't change together. */
body.phosphor-red .se-header-logo-wrap:nth-of-type(even)::after {
    animation-delay: -4.1s;
}

@keyframes automatonHeaderInterference {
    0%, 68% {
        opacity: 0;
    }

    69%, 72% {
        opacity: 1;
    }

    73%, 77% {
        opacity: 0;
    }

    78%, 88% {
        opacity: 1;
    }

    89%, 100% {
        opacity: 0;
    }
}


/* ============================================================
   RED CRT — ACTUAL HEADER EMBLEM INTERFERENCE
   Header emblems are .header-centre::before / ::after
   ============================================================ */

body.phosphor-red .header-centre::before {
    animation: automatonHeaderLeft 8.7s steps(1, end) infinite !important;
}

body.phosphor-red .header-centre::after {
    animation: automatonHeaderRight 10.3s steps(1, end) infinite !important;
}

/* LEFT EMBLEM */
@keyframes automatonHeaderLeft {
    0%, 64% {
        background-image: url('/assets/super-earth-logo-header.png');
    }

    65%, 78% {
        background-image: url('/assets/automaton-star.png');
    }

    79%, 100% {
        background-image: url('/assets/super-earth-logo-header.png');
    }
}

/* RIGHT EMBLEM — deliberately different timing */
@keyframes automatonHeaderRight {
    0%, 37% {
        background-image: url('/assets/super-earth-logo-header.png');
    }

    38%, 49% {
        background-image: url('/assets/automaton-star.png');
    }

    50%, 87% {
        background-image: url('/assets/super-earth-logo-header.png');
    }

    88%, 96% {
        background-image: url('/assets/automaton-star.png');
    }

    97%, 100% {
        background-image: url('/assets/super-earth-logo-header.png');
    }
}

/*
 * RED treatment for both states.
 * The Automaton artwork is already red, while this also prevents
 * the old green header filter surviving in RED mode.
 */
body.phosphor-red .header-centre::before,
body.phosphor-red .header-centre::after {
    filter:
        grayscale(1)
        sepia(1)
        saturate(10)
        hue-rotate(315deg)
        brightness(1.05)
        contrast(1.7)
        drop-shadow(0 0 4px rgba(255,40,40,.70))
        drop-shadow(0 0 9px rgba(255,20,20,.35))
        !important;
}


/* ============================================================
   RED CRT — HEADER EMBLEM FLICKER !IMPORTANT FIX
   Original header background-image is itself !important.
   ============================================================ */

@keyframes automatonHeaderLeft {
    0%, 64%, 79%, 100% {
        background-image: url('/assets/super-earth-logo-header.png') !important;
    }

    65%, 78% {
        background-image: url('/assets/automaton-star.png') !important;
    }
}

@keyframes automatonHeaderRight {
    0%, 37%, 50%, 87%, 97%, 100% {
        background-image: url('/assets/super-earth-logo-header.png') !important;
    }

    38%, 49%, 88%, 96% {
        background-image: url('/assets/automaton-star.png') !important;
    }
}


/* ============================================================
   RED CRT — REAL HEADER AUTOMATON STAR FLICKER
   ============================================================ */

/* Hidden completely outside RED mode. */
.automaton-header-star {
    display: none;
}

/* RED: position stars directly over the existing pseudo logos. */
body.phosphor-red .header-centre {
    position: relative;
}

body.phosphor-red .automaton-header-star {
    display: block;
    position: absolute;

    width: 52px;
    height: 52px;
    object-fit: contain;

    top: 50%;
    transform: translateY(-50%);

    opacity: 0;
    z-index: 20;

    filter:
        drop-shadow(0 0 4px rgba(255,45,45,.90))
        drop-shadow(0 0 10px rgba(255,20,20,.55));

    pointer-events: none;
}

/* Match the positions of the existing ::before / ::after logos. */
body.phosphor-red .automaton-header-star-left {
    left: -76px;
    animation: realAutomatonLeft 8.7s steps(1,end) infinite;
}

body.phosphor-red .automaton-header-star-right {
    right: -76px;
    animation: realAutomatonRight 10.3s steps(1,end) infinite;
}


/* LEFT: star appears; Super Earth logo disappears simultaneously. */
@keyframes realAutomatonLeft {
    0%, 64%, 79%, 100% { opacity: 0; }
    65%, 78%           { opacity: 1; }
}

body.phosphor-red .header-centre::before {
    animation: realSuperEarthLeft 8.7s steps(1,end) infinite !important;
}

@keyframes realSuperEarthLeft {
    0%, 64%, 79%, 100% { opacity: 1; }
    65%, 78%           { opacity: 0; }
}


/* RIGHT: deliberately different cycle. */
@keyframes realAutomatonRight {
    0%, 37%, 50%, 87%, 97%, 100% { opacity: 0; }
    38%, 49%, 88%, 96%           { opacity: 1; }
}

body.phosphor-red .header-centre::after {
    animation: realSuperEarthRight 10.3s steps(1,end) infinite !important;
}

@keyframes realSuperEarthRight {
    0%, 37%, 50%, 87%, 97%, 100% { opacity: 1; }
    38%, 49%, 88%, 96%           { opacity: 0; }
}


/* Super Earth header emblems should be RED, not amber/yellow. */
body.phosphor-red .header-centre::before,
body.phosphor-red .header-centre::after {
    filter:
        grayscale(1)
        sepia(1)
        saturate(12)
        hue-rotate(315deg)
        brightness(.85)
        contrast(1.8)
        drop-shadow(0 0 4px rgba(255,35,35,.75))
        !important;
}


/* ============================================================
   RED CRT — FORCE HEADER SUPER EARTH EMBLEMS PURE RED
   ============================================================ */

body.phosphor-red .header-centre::before,
body.phosphor-red .header-centre::after {
    filter:
        grayscale(1)
        sepia(1)
        saturate(100)
        hue-rotate(300deg)
        brightness(.80)
        contrast(1.8)
        drop-shadow(0 0 4px rgba(255,35,35,.85))
        drop-shadow(0 0 9px rgba(255,15,15,.45))
        !important;
}


/* ============================================================
   MAJOR ORDER — INFORMATION HIERARCHY
   ============================================================ */

.mo-directive-label {
    margin-top: 10px;
    margin-bottom: 5px;

    font-size: .72rem;
    letter-spacing: .16em;

    color: var(--dim);
}

#moBriefing {
    font-size: 1.12rem;
    font-weight: bold;
    line-height: 1.35;

    margin-bottom: 18px;

    color: var(--bright);
    text-shadow: 0 0 7px currentColor;
}

.mo-status-heading {
    margin-top: 20px;
    margin-bottom: 10px;

    padding-top: 10px;

    border-top: 1px dashed var(--dim);

    font-size: .76rem;
    letter-spacing: .16em;

    color: var(--dim);
}

/* Detailed objective blocks are secondary to the directive. */
#moTasks {
    font-size: .90rem;
}

#moTasks .mo-task {
    margin-bottom: 12px;
}

#moTasks .mo-numbers,
#moTasks .mo-eta {
    font-size: .82rem;
}


/* Keep the hierarchy compact on phones. */
@media (max-width: 600px) {

    #moBriefing {
        font-size: .96rem;
        line-height: 1.25;
        margin-bottom: 12px;
    }

    .mo-status-heading {
        margin-top: 12px;
        margin-bottom: 6px;
    }

    #moTasks .mo-task {
        margin-bottom: 8px;
    }
}

/* Major Order directive — terminal-style uppercase */
#moBriefing {
    text-transform: uppercase !important;
}

/* Major Order directive — 40% larger */
#moBriefing {
    font-size: 1.57rem !important;
}

/* Keep it sensible on mobile */
@media (max-width: 600px) {
    #moBriefing {
        font-size: 1.34rem !important;
    }
}

/* ============================================================
   MAJOR ORDER — FULL BRIEFING
   ============================================================ */

.mo-full-briefing-section {
    margin-top: 24px;
    padding-top: 14px;
    border-top: 1px dashed var(--dim);
}

.mo-full-briefing-heading {
    margin-bottom: 9px;
    font-size: .76rem;
    letter-spacing: .16em;
    color: var(--dim);
}

#moFullBriefing {
    font-size: .90rem;
    line-height: 1.5;
    color: var(--phosphor);
    opacity: .88;
}

#moFullBriefing:empty::after {
    content: "FULL MINISTRY BRIEFING NOT PRESENT IN CURRENT GALACTIC WAR DATA.";
    color: var(--dim);
}

@media (max-width: 600px) {
    .mo-full-briefing-section {
        margin-top: 16px;
        padding-top: 10px;
    }

    #moFullBriefing {
        font-size: .84rem;
        line-height: 1.4;
    }
}

/* ============================================================
   AMBER CRT — MAJOR ORDER COLOUR CORRECTION
   Prevent legacy green styling leaking into MO headings.
   ============================================================ */

body.phosphor-amber .mo-command h1,
body.phosphor-amber .mo-command h2,
body.phosphor-amber .mo-command h3,
body.phosphor-amber .mo-directive-label,
body.phosphor-amber .mo-status-heading,
body.phosphor-amber .mo-full-briefing-heading {
    color: var(--bright) !important;
    border-color: var(--dim) !important;
    text-shadow:
        0 0 4px rgba(255,176,0,.75),
        0 0 9px rgba(255,140,0,.35) !important;
}

body.phosphor-amber #moBriefing {
    color: var(--bright) !important;
    text-shadow:
        0 0 5px rgba(255,176,0,.70),
        0 0 10px rgba(255,140,0,.30) !important;
}

/* ============================================================
   AMBER CRT — MAJOR ORDER COLOUR CORRECTION
   Prevent legacy green styling leaking into MO headings.
   ============================================================ */

body.phosphor-amber .mo-command h1,
body.phosphor-amber .mo-command h2,
body.phosphor-amber .mo-command h3,
body.phosphor-amber .mo-directive-label,
body.phosphor-amber .mo-status-heading,
body.phosphor-amber .mo-full-briefing-heading {
    color: var(--bright) !important;
    border-color: var(--dim) !important;
    text-shadow:
        0 0 4px rgba(255,176,0,.75),
        0 0 9px rgba(255,140,0,.35) !important;
}

body.phosphor-amber #moBriefing {
    color: var(--bright) !important;
    text-shadow:
        0 0 5px rgba(255,176,0,.70),
        0 0 10px rgba(255,140,0,.30) !important;
}

/* ============================================================
   MOBILE MAJOR ORDER — FULL WIDTH
   Hide Super Earth emblem panel and give briefing full width.
   Desktop layout is unaffected.
   ============================================================ */
@media (max-width: 600px) {

    .mo-layout {
        grid-template-columns: 1fr !important;
        display: grid !important;
        width: 100% !important;
    }

    .mo-layout .se-panel {
        display: none !important;
    }

    .mo-layout .mo-command {
        width: 100% !important;
        max-width: none !important;
        min-width: 0 !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin: 0 !important;
    }
}


/* Hide manual previous/next controls.
   Keep them in the DOM because warpi.js expects them to exist. */
#nav-prev,
#nav-next {
    display: none !important;
}

/* Hide carousel arrow controls visually.
   Leave elements present for warpi.js. */
#warpi-nav .nav-arrow {
    display: none !important;
}

/* Active nav highlight: compact background rather than full-height block */
#warpi-nav .nav-page {
    position: relative;
    background: transparent !important;
}

#warpi-nav .nav-page.active {
    background: transparent !important;
    box-shadow: none !important;
    z-index: 1;
}

#warpi-nav .nav-page.active::before {
    content: "";
    position: absolute;

    /* Small, consistent margin around the active label */
    top: 4px;
    bottom: 4px;
    left: 4px;
    right: 4px;

    background: rgba(80,255,80,.10);

    box-shadow:
        inset 0 -2px 0 var(--phosphor);

    pointer-events: none;
    z-index: -1;
}

/* =========================================================
   GALACTIC MAP — CAROUSEL SCREEN
   ========================================================= */

.galaxy-map-screen {
    overflow: hidden;
}

.galaxy-map-frame {
    width: 100%;
    height: calc(100vh - 225px);
    min-height: 500px;
    overflow: hidden;
}

.galaxy-map-frame iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: #000;
}

@media (max-width: 700px) {
    .galaxy-map-frame {
        height: calc(100dvh - 205px);
        min-height: 420px;
    }
}

/* =========================================================
   HEADER NAV — EQUAL SPACING
   ========================================================= */

#warpi-nav {
    display: grid !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    width: 100% !important;
    gap: 0 !important;
    align-items: stretch;
}

#warpi-nav .nav-page {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding-left: 8px !important;
    padding-right: 8px !important;

    display: flex !important;
    align-items: center;
    justify-content: center;

    text-align: center;
    box-sizing: border-box;
}


/* ============================================================
   MAJOR ORDER — VARIABLE OBJECTIVE COUNT
   Allow large multi-planet orders to scroll without clipping.
   No visual change while the content fits normally.
   ============================================================ */

.mo-command {
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ============================================================
   MAJOR ORDER — PLANET REGIONS / CITIES
   ============================================================ */

#moTasks .mo-regions {
    margin: 12px 0 4px 18px;
    padding-left: 14px;
    border-left: 1px dashed currentColor;
}

#moTasks .mo-region {
    margin: 10px 0 14px;
}

#moTasks .mo-region-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.9em;
    font-weight: bold;
    letter-spacing: 0.05em;
}

#moTasks .mo-region-head span:first-child::before {
    content: "> ";
}

#moTasks .mo-region-type {
    margin-top: 2px;
    font-size: 0.68em;
    opacity: 0.72;
    letter-spacing: 0.08em;
}

#moTasks .mo-region-progress {
    height: 7px;
    margin: 5px 0 3px;
}

#moTasks .mo-region-status {
    font-size: 0.66em;
    opacity: 0.75;
    letter-spacing: 0.05em;
}

/* Keep the nested region bars compact on phones */
@media (max-width: 700px) {
    #moTasks .mo-regions {
        margin-left: 8px;
        padding-left: 9px;
    }

    #moTasks .mo-region {
        margin: 8px 0 11px;
    }

    #moTasks .mo-region-head {
        font-size: 0.82em;
    }

    #moTasks .mo-region-progress {
        height: 6px;
    }
}
