/* Maths HQ polish: a forge that looks alive at 0/10, a loud near-miss on the next turret,
   a galaxy radar, a prominent kill count, bigger header pills and topic rank stars.
   Loaded last so these win over the older layout sheets. */

/* 1. The forge at 0/10: dimmed but alive, waiting for the player, never a dead grey slab. */
body.mission-mode .mission-power .power-rig[data-stage="offline"] .power-turret-main img {
  filter: grayscale(.35) brightness(.78) drop-shadow(0 0 14px rgba(120, 255, 90, .35));
  /* Glow only — no zoom/bob; the galactic swirl behind carries the motion. */
  animation: forge-idle 3.2s ease-in-out infinite;
}

body.mission-mode .mission-power .power-rig[data-stage="offline"] .power-turret-left,
body.mission-mode .mission-power .power-rig[data-stage="offline"] .power-turret-right {
  opacity: .38;
}

body.mission-mode .mission-power .power-rig[data-stage="offline"] .power-rank-name {
  display: block;
  font-size: clamp(.95rem, 1.1vw, 1.15rem);
  color: #b9ffa0;
  letter-spacing: .06em;
  text-shadow: 0 0 10px rgba(120, 255, 90, .55);
  animation: forge-call 1.8s ease-in-out infinite;
}

@keyframes forge-idle {
  50% { filter: grayscale(.2) brightness(.92) drop-shadow(0 0 22px rgba(120, 255, 90, .55)); }
}

@keyframes forge-call {
  50% { opacity: .65; }
}

/* 2. Near-miss: a few XP from the next turret, the promo shouts it. */
body.mission-mode #screen-home .armory-promo.armory-promo-close .armory-promo-progress-label {
  justify-content: space-between;
}

body.mission-mode #screen-home .armory-promo.armory-promo-close .armory-promo-progress-label strong {
  display: inline;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 1.5vw, 1.55rem);
  letter-spacing: .04em;
  color: #ffe14a;
  text-shadow: 0 0 12px rgba(255, 210, 60, .85), 0 2px 0 #4a2c00;
  animation: near-miss 2.2s ease-in-out infinite;
}

body.mission-mode #screen-home .armory-promo.armory-promo-close .armory-promo-fill {
  background: linear-gradient(90deg, #ffb300, #ffe14a, #fff6b8);
  box-shadow: 0 0 14px rgba(255, 210, 60, .9);
  animation: near-miss-bar 2.2s ease-in-out infinite;
}

body.mission-mode #screen-home .armory-promo.armory-promo-close .armory-promo-art img {
  animation: near-miss-turret 4.4s ease-in-out infinite;
}

@keyframes near-miss {
  50% { transform: scale(1.06); }
}

@keyframes near-miss-bar {
  50% { filter: brightness(1.35); }
}

@keyframes near-miss-turret {
  50% { transform: translateY(-3px) scale(1.04); filter: drop-shadow(0 0 18px rgba(255, 220, 80, .8)); }
}

/* 3. Radar: a faint galaxy inside the dish, and "DETECTING ALIEN HORDE" in the hub. */
body.mission-mode .inbound-radar-dish {
  isolation: isolate;
}

body.mission-mode .inbound-radar-galaxy {
  position: absolute;
  inset: 3%;
  z-index: 1;
  border-radius: 50%;
  opacity: .7;
  mix-blend-mode: screen;
  /* The radar is tinted red for the alien side; this cancels the tint so the galaxy keeps its colours. */
  filter: hue-rotate(125deg) saturate(1.1);
  background:
    radial-gradient(2px 2px at 18% 30%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 72% 22%, #fff 50%, transparent 51%),
    radial-gradient(2.4px 2.4px at 60% 68%, #ffe9c4 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 30% 78%, #cfe3ff 50%, transparent 51%),
    radial-gradient(2px 2px at 84% 54%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 44% 14%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 12% 58%, #ffd6f2 50%, transparent 51%),
    radial-gradient(2.4px 2.4px at 52% 42%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 66% 86%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 24% 46%, #e6f0ff 50%, transparent 51%),
    radial-gradient(2px 2px at 78% 38%, #fff6d8 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 38% 62%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 90% 70%, #ffd6f2 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 8% 40%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 48% 90%, #cfe3ff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 58% 8%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 34% 24%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 70% 52%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 20% 86%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 86% 16%, #fff 50%, transparent 51%),
    /* a bright spiral band through the middle, a glowing core and coloured nebula clouds */
    radial-gradient(ellipse 58% 13% at 50% 50%, rgba(255, 235, 255, .12), transparent 72%),
    radial-gradient(ellipse 74% 24% at 50% 50%, rgba(175, 105, 255, .38), transparent 72%),
    radial-gradient(ellipse 11% 11% at 50% 50%, rgba(255, 240, 220, .15), transparent 100%),
    radial-gradient(ellipse 38% 46% at 28% 32%, rgba(70, 150, 255, .4), transparent 70%),
    radial-gradient(ellipse 40% 32% at 72% 68%, rgba(255, 80, 170, .36), transparent 70%),
    radial-gradient(ellipse 30% 24% at 70% 24%, rgba(80, 235, 220, .2), transparent 70%),
    radial-gradient(ellipse 26% 30% at 26% 74%, rgba(255, 160, 80, .16), transparent 70%);
  transform: rotate(-24deg);
  animation: radar-galaxy 90s linear infinite;
  pointer-events: none;
}

body.mission-mode .inbound-radar-grid {
  z-index: 2;
  opacity: 1;
  background:
    repeating-radial-gradient(
      circle at 50% 50%,
      transparent 0,
      transparent 18px,
      rgba(93, 255, 138, .32) 18px,
      rgba(93, 255, 138, .32) 19px
    );
  pointer-events: none;
}

/* Planets and a comet inside the radar, shown as faint red radar shapes. They orbit slowly and stay clear of the centre text.
   The radar's -125deg hue tint is applied after these filters, so red here is written as hue-rotate(90deg). */
body.mission-mode .inbound-radar-planets {
  position: absolute;
  inset: 3%;
  z-index: 1;
  border-radius: 50%;
  overflow: hidden;
  opacity: .5;
  filter: grayscale(1) sepia(1) saturate(3) hue-rotate(90deg) brightness(.85);
  animation: radar-orbit 160s linear infinite;
  pointer-events: none;
}

/* Contacts sit still so each one can flash into full colour exactly as the sweep's bright edge passes it. */
body.mission-mode .inbound-radar-contacts {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

body.mission-mode .radar-contact {
  position: absolute;
  width: 9%;
  height: auto;
  transform: translate(-50%, -50%);
  opacity: .4;
  filter: grayscale(1) sepia(1) saturate(3) hue-rotate(90deg) brightness(.8);
  animation: radar-contact-ping var(--sweep-speed, 3.6s) linear infinite;
  animation-delay: calc(var(--sweep-speed, 3.6s) * (var(--sweep-at, 0) - 1));
}

@keyframes radar-contact-ping {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.12);
    filter: grayscale(0) sepia(0) saturate(1) hue-rotate(125deg) brightness(1.15);
  }
  10% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    filter: grayscale(0) sepia(0) saturate(1) hue-rotate(125deg) brightness(1);
  }
  45%, 100% {
    opacity: .4;
    transform: translate(-50%, -50%) scale(1);
    filter: grayscale(1) sepia(1) saturate(3) hue-rotate(90deg) brightness(.8);
  }
}

body.mission-mode .radar-planet {
  position: absolute;
  border-radius: 50%;
  animation: planet-counter 160s linear infinite;
}

/* Ringed gas giant, upper left. */
body.mission-mode .radar-planet--ringed {
  left: 16%;
  top: 18%;
  width: 8%;
  height: 8%;
  background: radial-gradient(circle at 35% 30%, #ffe9b0, #e8a24a 45%, #8a4a1a 80%, #3a1a08);
  box-shadow: inset -2px -2px 4px rgba(0, 0, 0, .55), 0 0 5px rgba(255, 190, 100, .25);
}

body.mission-mode .radar-planet--ringed::before {
  content: '';
  position: absolute;
  left: -45%;
  top: 38%;
  width: 190%;
  height: 26%;
  border-radius: 50%;
  border: 1px solid rgba(255, 225, 170, .6);
  border-top-color: transparent;
  transform: rotate(-18deg);
}

/* Blue planet with a little moon, lower right. */
body.mission-mode .radar-planet--blue {
  right: 16%;
  bottom: 20%;
  width: 7%;
  height: 7%;
  background: radial-gradient(circle at 35% 30%, #c8f4ff, #3aa0ff 45%, #1a3a9a 80%, #0a1438);
  box-shadow: inset -2px -2px 4px rgba(0, 0, 0, .55), 0 0 5px rgba(80, 170, 255, .3);
}

body.mission-mode .radar-moon {
  position: absolute;
  right: -45%;
  top: -20%;
  width: 34%;
  height: 34%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, #aab 60%, #556);
  animation: moon-bob 6s ease-in-out infinite;
}

/* Small red planet, lower left. */
body.mission-mode .radar-planet--red {
  left: 22%;
  bottom: 16%;
  width: 4.5%;
  height: 4.5%;
  background: radial-gradient(circle at 35% 30%, #ffc4a8, #e2503a 50%, #7a1a12 85%);
  box-shadow: inset -1px -1px 3px rgba(0, 0, 0, .55), 0 0 4px rgba(255, 90, 60, .3);
}

/* Tiny ice world, upper right. */
body.mission-mode .radar-planet--ice {
  right: 22%;
  top: 14%;
  width: 3.5%;
  height: 3.5%;
  background: radial-gradient(circle at 35% 30%, #ffffff, #b9fff4 45%, #3a9a9a 85%);
  box-shadow: inset -1px -1px 2px rgba(0, 0, 0, .5), 0 0 4px rgba(160, 255, 240, .3);
}

/* A comet that streaks across now and then. */
body.mission-mode .radar-comet {
  position: absolute;
  left: -20%;
  top: 30%;
  width: 22%;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, rgba(200, 230, 255, .2) 40%, #fff);
  box-shadow: 0 0 6px rgba(200, 230, 255, .9);
  opacity: 0;
  transform: rotate(18deg);
  animation: radar-comet 9s ease-in 2s infinite;
}

@keyframes radar-orbit {
  to { transform: rotate(360deg); }
}

/* Planets turn the other way as they orbit, so the ringed planet's rings stay level. */
@keyframes planet-counter {
  to { transform: rotate(-360deg); }
}

@keyframes moon-bob {
  50% { transform: translate(-3px, 3px); }
}

@keyframes radar-comet {
  0% { opacity: 0; left: -20%; top: 22%; }
  4% { opacity: 1; }
  14% { opacity: 0; left: 105%; top: 62%; }
  100% { opacity: 0; left: 105%; top: 62%; }
}

/* A second, slower layer of stars that twinkles over the first. */
body.mission-mode .inbound-radar-galaxy::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(1.8px 1.8px at 26% 18%, #fff 50%, transparent 51%),
    radial-gradient(1.8px 1.8px at 80% 30%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 42% 74%, #fff 50%, transparent 51%),
    radial-gradient(1.8px 1.8px at 14% 66%, #fff 50%, transparent 51%),
    radial-gradient(1.8px 1.8px at 64% 58%, #fff 50%, transparent 51%);
  animation: radar-twinkle 2.6s ease-in-out infinite;
}

@keyframes radar-twinkle {
  50% { opacity: .2; }
}

@keyframes radar-galaxy {
  to { transform: rotate(336deg); }
}

body.mission-mode .inbound-radar-hub-scan {
  gap: 1px;
  z-index: 3;
  padding: 8px 12px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(8, 4, 14, .78), rgba(8, 4, 14, .45) 70%, transparent);
}

body.mission-mode .inbound-radar-hub-scan span {
  text-shadow: 0 1px 3px rgba(0, 0, 0, .95), 0 0 10px rgba(0, 0, 0, .8);
}

body.mission-mode .inbound-radar-scan {
  font-family: var(--font-display);
  font-size: clamp(.95rem, 1.2vw, 1.25rem);
  letter-spacing: .08em;
  color: #ffd0a8;
  text-shadow: 0 0 10px rgba(255, 120, 60, .8);
  animation: radar-scan 1.4s ease-in-out infinite;
}

body.mission-mode .inbound-radar-hub-scan .inbound-radar-unit {
  font-size: .62rem;
  font-weight: 900;
  letter-spacing: .16em;
}

@keyframes radar-scan {
  50% { opacity: .45; }
}

/* 4. Blueprint: the kill count is the satisfying bit, so it gets the spotlight. */
body.mission-mode .threat-dossier-kills {
  margin-top: 6px;
  padding: 5px 8px;
  border: 1px solid rgba(93, 255, 138, .55) !important;
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(25, 80, 40, .55), rgba(10, 40, 20, .55));
  font-size: .8rem;
  letter-spacing: .12em;
  box-shadow: 0 0 12px rgba(93, 255, 138, .25);
}

body.mission-mode .threat-dossier-kills-count {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.9vw, 2rem);
  line-height: 1;
  color: #eaffef;
  text-shadow: 0 0 14px rgba(93, 255, 138, .8);
}

/* Forge XP under the greeting: the medallion and a big gold total. It flares and counts up when XP is earned,
   and opens the Armory to spend it. */
body.mission-mode .mission-xp {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0 auto;
  padding: 4px 20px 4px 5px;
  border: 1px solid rgba(255, 200, 70, .45);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(74, 46, 10, .75), rgba(26, 16, 6, .85));
  box-shadow: 0 0 18px rgba(255, 170, 40, .22), inset 0 1px 0 rgba(255, 230, 150, .18);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

body.mission-mode .mission-xp:hover {
  transform: translateY(-2px);
  border-color: rgba(255, 215, 100, .85);
  box-shadow: 0 0 24px rgba(255, 180, 50, .45), inset 0 1px 0 rgba(255, 230, 150, .25);
}

body.mission-mode .mission-xp-emblem {
  display: block;
  width: 56px;
  height: auto;
  filter: drop-shadow(0 0 10px rgba(255, 180, 40, .55));
  animation: xp-emblem-idle 3.2s ease-in-out infinite;
}

body.mission-mode .mission-xp-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}

body.mission-mode .mission-xp-value {
  font-family: var(--font-display);
  font-size: 2.05rem;
  letter-spacing: .03em;
  color: #ffd84a;
  text-shadow: 0 2px 0 #6a3a00, 0 0 14px rgba(255, 190, 50, .55);
  font-variant-numeric: tabular-nums;
}

body.mission-mode .mission-xp-label {
  margin-top: 2px;
  font-size: .7rem;
  font-weight: 900;
  letter-spacing: .2em;
  color: rgba(255, 225, 160, .8);
}

body.mission-mode .mission-xp.is-gaining {
  border-color: #ffd65a;
  box-shadow: 0 0 30px rgba(255, 190, 50, .7), inset 0 1px 0 rgba(255, 240, 180, .3);
}

body.mission-mode .mission-xp.is-gaining .mission-xp-emblem {
  animation: xp-emblem-gain .38s ease-in-out infinite alternate;
}

body.mission-mode .mission-xp.is-gaining .mission-xp-value {
  color: #fff4b8;
}

@keyframes xp-emblem-idle {
  0%, 100% { transform: rotate(-4deg); filter: drop-shadow(0 0 8px rgba(255, 180, 40, .45)); }
  50% { transform: rotate(4deg); filter: drop-shadow(0 0 16px rgba(255, 200, 60, .8)); }
}

@keyframes xp-emblem-gain {
  from { transform: scale(1) rotate(-8deg); filter: drop-shadow(0 0 12px rgba(255, 200, 60, .8)) brightness(1.05); }
  to { transform: scale(1.18) rotate(8deg); filter: drop-shadow(0 0 26px rgba(255, 220, 90, 1)) brightness(1.3); }
}

/* Contact: the radar's centre becomes the big red launch button. The radar section is tinted red by
   a -125deg hue filter, so the button and the lit contacts rotate back by 125deg to keep true colours. */
body.mission-mode .radar-launch,
body.mission-mode .radar-launch-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

body.mission-mode .radar-launch {
  z-index: 3;
  display: grid;
  place-items: center;
  padding: 0;
  border: 3px solid #ffd27a;
  background: radial-gradient(circle at 35% 28%, #ff9a88 0%, #ec2a1e 42%, #8e0a08 100%);
  box-shadow:
    0 6px 0 #5a0604,
    0 0 24px rgba(255, 60, 40, .85),
    inset 0 -6px 12px rgba(0, 0, 0, .35),
    inset 0 5px 9px rgba(255, 255, 255, .35);
  color: #fff;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1.7vw, 1.4rem);
  line-height: .95;
  letter-spacing: .04em;
  text-shadow: 0 2px 0 #5a0604;
  filter: hue-rotate(125deg);
  cursor: pointer;
  animation: radar-launch-throb 1.3s ease-in-out infinite;
  transition: transform .08s ease, box-shadow .08s ease;
}

body.mission-mode .radar-launch:hover {
  filter: hue-rotate(125deg) brightness(1.12);
}

body.mission-mode .radar-launch:active {
  animation: none;
  transform: translate(-50%, -46%);
  box-shadow: 0 2px 0 #5a0604, 0 0 30px rgba(255, 80, 50, 1), inset 0 -4px 10px rgba(0, 0, 0, .4), inset 0 5px 9px rgba(255, 255, 255, .3);
}

body.mission-mode .radar-launch-ring {
  z-index: 2;
  border: 3px solid rgba(255, 80, 60, .85);
  filter: hue-rotate(125deg);
  pointer-events: none;
  animation: radar-launch-ring 1.3s ease-out infinite;
}

@keyframes radar-launch-throb {
  50% { transform: translate(-50%, -50%) scale(1.05); }
}

/* Alarm: the button pulses white-hot, wiggles for attention, and drops in when it first appears.
   scale/rotate are separate from transform so they stack with the centring translate. */
body.mission-mode .radar-launch {
  /* Pop + glow only — no wiggle/shake. */
  animation: radar-launch-alarm 1s ease-in-out infinite;
}

body.mission-mode .radar-launch.is-arriving {
  animation:
    radar-launch-arrive .75s cubic-bezier(.2, 1.6, .4, 1),
    radar-launch-alarm 1s ease-in-out .75s infinite;
}

body.mission-mode .radar-launch-ring--late {
  animation-delay: .65s;
}

@keyframes radar-launch-arrive {
  0% { scale: 0; filter: hue-rotate(125deg) brightness(3); }
  60% { scale: 1.25; filter: hue-rotate(125deg) brightness(2); }
  100% { scale: 1; filter: hue-rotate(125deg) brightness(1); }
}

@keyframes radar-launch-alarm {
  0%, 100% {
    scale: 1;
    box-shadow: 0 6px 0 #5a0604, 0 0 22px rgba(255, 60, 40, .8), inset 0 -6px 12px rgba(0, 0, 0, .35), inset 0 5px 9px rgba(255, 255, 255, .35);
  }
  50% {
    scale: 1.1;
    box-shadow: 0 6px 0 #5a0604, 0 0 46px rgba(255, 230, 200, 1), 0 0 80px rgba(255, 60, 40, .9), inset 0 -6px 12px rgba(0, 0, 0, .25), inset 0 5px 14px rgba(255, 255, 255, .6);
  }
}

@keyframes radar-launch-wiggle {
  0%, 82%, 100% { rotate: 0deg; }
  85% { rotate: -9deg; }
  88% { rotate: 8deg; }
  91% { rotate: -6deg; }
  94% { rotate: 4deg; }
}

@keyframes radar-launch-ring {
  from { transform: translate(-50%, -50%) scale(1); opacity: .9; }
  to { transform: translate(-50%, -50%) scale(2); opacity: 0; }
}

/* The dish's alert ring is written in the radar's own green so the red tint turns it red, like the rest
   of the radar (a red ring here would come out blue). With the button as the centrepiece the dish
   gives up a little size, which keeps the face-off and the blueprint on screen. */
body.mission-mode .mission-control-radar .inbound-radar-dish-alert {
  border-color: rgba(110, 255, 150, .9);
  animation: radar-dish-contact 1.3s ease-in-out infinite;
}

body.mission-mode .mission-control-radar .inbound-radar-sweep-fast {
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    rgba(110, 255, 150, .6) 14deg,
    rgba(110, 255, 150, .12) 38deg,
    transparent 50deg
  );
}

@keyframes radar-dish-contact {
  0%, 100% { box-shadow: inset 0 0 40px rgba(0, 0, 0, .6), 0 0 18px rgba(93, 255, 138, .25); }
  50% { box-shadow: inset 0 0 40px rgba(0, 0, 0, .6), 0 0 34px rgba(93, 255, 138, .55); }
}

@media (min-width: 1321px) and (min-height: 600px) {
  body.mission-mode .mission-control-radar .inbound-radar-contact .inbound-radar-dish {
    width: min(228px, 16vw, 25.5dvh);
  }
}

body.mission-mode .inbound-radar-dish-alert .radar-contact {
  animation: none;
  opacity: .9;
  filter: hue-rotate(125deg);
}

/* Contact: horde vs war chest. Labels on row 1; VS sits on row 2 between ×N and the chest. */
body.mission-mode .horde-faceoff {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) auto minmax(0, 1fr);
  grid-template-areas:
    "hl . cl"
    "troops vs chest"
    "actions actions actions";
  align-items: center;
  justify-items: center;
  gap: 2px 8px;
  padding: 7px 12px 6px;
  border: 2px solid transparent;
  border-radius: 12px;
  background:
    linear-gradient(180deg, #2c2443, #161122) padding-box,
    linear-gradient(180deg, #ffe39a, #d29a35 40%, #8a5a16) border-box;
  box-shadow: inset 0 -3px 6px rgba(0, 0, 0, .45), 0 2px 8px rgba(0, 0, 0, .5);
}

body.mission-mode .horde-faceoff .faceoff-label-horde { grid-area: hl; }
body.mission-mode .horde-faceoff .faceoff-label-chest { grid-area: cl; }
body.mission-mode .horde-faceoff .faceoff-troops { grid-area: troops; }
body.mission-mode .horde-faceoff .faceoff-vs { grid-area: vs; }
body.mission-mode .horde-faceoff .faceoff-chest { grid-area: chest; }
body.mission-mode .horde-faceoff .faceoff-actions { grid-area: actions; }

/* Under-quiz faceoff: compact card, big horde + chest art, louder type. */
body.mission-mode .invasion-briefing.is-open .horde-faceoff {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 6px 12px;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 2px 0 0;
}

body.mission-mode .invasion-briefing.is-open .faceoff-label {
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.8vw, 1.45rem);
  font-weight: 400;
  letter-spacing: 0.08em;
}

body.mission-mode .invasion-briefing.is-open .faceoff-troops,
body.mission-mode .invasion-briefing.is-open .faceoff-chest {
  justify-self: center;
}

body.mission-mode .invasion-briefing.is-open .faceoff-vs {
  justify-self: center;
  align-self: center;
}

body.mission-mode .invasion-briefing.is-open .faceoff-troop img {
  width: clamp(72px, 12vw, 104px);
  height: clamp(72px, 12vw, 104px);
  filter: drop-shadow(0 0 12px rgba(255, 80, 60, 0.75));
}

body.mission-mode .invasion-briefing.is-open .faceoff-troop b {
  font-size: clamp(2.1rem, 4.5vw, 2.8rem);
}

body.mission-mode .invasion-briefing.is-open .faceoff-vs {
  font-size: clamp(1.6rem, 3.2vw, 2rem);
}

body.mission-mode .invasion-briefing.is-open .faceoff-zapped {
  font-size: 1.25rem;
}

body.mission-mode .invasion-briefing.is-open .faceoff-chest {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 4px;
  min-height: 128px;
  width: min(100%, 11.5rem);
  padding: 10px 16px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(70, 48, 18, 0.55), rgba(28, 16, 6, 0.7));
  box-shadow: inset 0 0 0 1px rgba(255, 210, 100, 0.35);
}

body.mission-mode .invasion-briefing.is-open .faceoff-chest-row {
  flex-direction: column;
  gap: 2px;
}

body.mission-mode .invasion-briefing.is-open .faceoff-chest-art {
  width: clamp(72px, 11vw, 96px);
  height: auto;
  filter: drop-shadow(0 0 12px rgba(255, 200, 80, 0.75));
}

body.mission-mode .invasion-briefing.is-open .faceoff-coins {
  font-size: clamp(2.4rem, 6vw, 3.1rem);
  line-height: 0.95;
}

body.mission-mode .invasion-briefing.is-open .faceoff-coins-label {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 400;
  letter-spacing: 0.1em;
}

body.mission-mode .invasion-briefing.is-open .faceoff-actions {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  width: 100%;
}

body.mission-mode .invasion-briefing.is-open .faceoff-zap {
  flex-wrap: wrap;
  min-height: 48px;
  margin-top: 0;
  padding: 10px 14px 12px;
  white-space: normal;
  gap: 2px 10px;
}

body.mission-mode .invasion-briefing.is-open .faceoff-zap strong {
  font-size: 1.55rem;
}

body.mission-mode .invasion-briefing.is-open .faceoff-zap span {
  flex: 1 1 100%;
  max-width: none;
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  white-space: normal;
  text-align: center;
}

body.mission-mode .faceoff-label {
  font-size: .58rem;
  font-weight: 900;
  letter-spacing: .14em;
  color: rgba(255, 225, 160, .75);
}

body.mission-mode .faceoff-label-horde {
  color: #ff8a6a;
}

body.mission-mode .faceoff-troops {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

body.mission-mode .faceoff-troop {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 3px;
  line-height: 1;
}

body.mission-mode .faceoff-troop img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  filter: drop-shadow(0 0 5px rgba(255, 80, 60, .55));
}

body.mission-mode .faceoff-troop b {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 400;
  color: #ff9a7a;
  text-shadow: 0 2px 0 #3a0a04;
}

body.mission-mode .faceoff-troop span {
  grid-column: 1 / -1;
  justify-self: center;
  margin-top: 1px;
  font-size: .55rem;
  font-weight: 800;
  color: rgba(255, 200, 185, .75);
}

body.mission-mode .faceoff-troops.is-many .faceoff-troop span {
  display: none;
}

body.mission-mode .faceoff-zapped {
  align-self: center;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(60, 200, 110, .2);
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: .04em;
  color: #7dffb0;
}

/* Every activity has its own Home button, so Mission Control's copy gives its room to the face-off. */
body.mission-mode .mission-control-inner:has(.horde-faceoff) .mission-control-home {
  display: none;
}

body.mission-mode .faceoff-vs {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: #ffd84a;
  text-shadow: 0 2px 0 #4a2c00;
}

body.mission-mode .faceoff-chest {
  display: grid;
  justify-items: center;
  gap: 2px;
  min-width: 0;
}

body.mission-mode .faceoff-chest-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

body.mission-mode .faceoff-chest-art {
  width: 34px;
  height: auto;
  filter: drop-shadow(0 0 6px rgba(255, 200, 80, .5));
}

body.mission-mode .faceoff-coins {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1;
  color: #ffd84a;
  text-shadow: 0 2px 0 #4a2c00;
}

body.mission-mode .faceoff-coins-label {
  font-size: .58rem;
  font-weight: 900;
  letter-spacing: .12em;
  color: rgba(255, 225, 160, .8);
}

body.mission-mode .faceoff-zap {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin-top: 5px;
  padding: 4px 10px 5px;
  white-space: nowrap;
  border: 1px solid rgba(140, 255, 180, .55);
  border-radius: 999px;
  background: linear-gradient(180deg, #2fbf6a, #157a3e);
  box-shadow: 0 3px 0 #0b4a25, 0 0 12px rgba(90, 255, 150, .35);
  color: #effff4;
  font: inherit;
  cursor: pointer;
  transition: transform .1s ease, filter .15s ease;
}

body.mission-mode .faceoff-zap:hover {
  filter: brightness(1.1);
}

body.mission-mode .faceoff-zap:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #0b4a25, 0 0 12px rgba(90, 255, 150, .35);
}

body.mission-mode .faceoff-zap strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 400;
  letter-spacing: .06em;
  text-shadow: 0 2px 0 #0b4a25;
}

body.mission-mode .faceoff-zap span {
  font-size: .6rem;
  font-weight: 800;
  color: rgba(225, 255, 235, .9);
}

body.mission-mode .faceoff-tip {
  grid-column: 1 / -1;
  margin: 4px 0 0;
  text-align: center;
  font-size: .66rem;
  font-weight: 800;
  color: #bfe9c9;
}

/* 5. Header counters: the same gold-bevelled slate as the sound, how-to and GB buttons, the same
   height, and the same gold numbers. Colour comes only from the painted icon; a state that wants
   attention (an upgrade to buy, a streak or challenge still to do) glows rather than changing frame. */
body .topbar-stats .core-pill,
body .topbar-stats .streak-pill,
body .topbar-stats .daily-pill {
  --plate-glow: rgba(255, 200, 80, 0);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px 0 10px;
  border: 2px solid transparent;
  border-radius: 12px;
  background:
    linear-gradient(180deg, #2c2443, #161122) padding-box,
    linear-gradient(180deg, #ffe39a, #d29a35 40%, #8a5a16) border-box;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .08),
    inset 0 -3px 6px rgba(0, 0, 0, .45),
    0 2px 6px rgba(0, 0, 0, .55),
    0 0 14px var(--plate-glow);
  color: #ffd84a;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 400;
  letter-spacing: .04em;
  line-height: 1;
  text-shadow: 0 2px 0 #4a2c00;
  transition: transform .15s ease, filter .15s ease;
}

/* One gap between every header item, and the rank stands free as the header's emblem. */
body .topbar-hud .topbar-stats,
body .topbar-hud .topbar-actions {
  gap: 8px;
}

body .topbar-hud .rank-badge {
  background: none;
}

body .topbar-hud .rank-badge-name,
body .topbar-hud .rank-badge-title {
  text-shadow: 0 2px 0 #3a2400, 0 0 6px #000, 0 0 10px #000;
}

body .topbar-stats .core-pill:hover,
body .topbar-stats .streak-pill:hover,
body .topbar-stats .daily-pill:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

body .topbar-stats strong {
  font-weight: 400;
}

body .topbar-stats .core-pill .core-gem {
  --gem-size: 28px;
  vertical-align: middle;
}

body .topbar-stats .streak-flame,
body .topbar-stats .daily-dart {
  display: block;
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .6));
}

/* Not done today: the flame is unlit until the streak is safe. */
body .topbar-stats .streak-pill:not(.is-lit) .streak-flame {
  filter: grayscale(1) brightness(.75) drop-shadow(0 1px 2px rgba(0, 0, 0, .6));
}

body .topbar-stats .streak-pill.is-new strong {
  font-size: 1.05rem;
  letter-spacing: .1em;
}

body .topbar-stats .core-pill.core-pill--ready,
body .topbar-stats .streak-pill.is-waiting,
body .topbar-stats .streak-pill.is-new,
body .topbar-stats .daily-pill.is-pending {
  animation: plate-attention 2.2s ease-in-out infinite;
}

body .topbar-stats .core-pill.core-pill--ready { --plate-glow-on: rgba(110, 255, 170, .65); }
body .topbar-stats .streak-pill.is-waiting,
body .topbar-stats .streak-pill.is-new { --plate-glow-on: rgba(255, 150, 50, .6); }
body .topbar-stats .daily-pill.is-pending { --plate-glow-on: rgba(255, 210, 90, .55); }

body .topbar-stats .streak-pill.is-lit,
body .topbar-stats .daily-pill.is-complete {
  --plate-glow: rgba(255, 190, 60, .4);
}

@keyframes plate-attention {
  50% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), inset 0 -3px 6px rgba(0, 0, 0, .45), 0 2px 6px rgba(0, 0, 0, .55), 0 0 18px var(--plate-glow-on); }
}

@media (max-width: 640px) {
  body .topbar-stats .core-pill,
  body .topbar-stats .streak-pill,
  body .topbar-stats .daily-pill {
    gap: 6px;
    height: 38px;
    padding: 0 12px 0 8px;
    font-size: 1.2rem;
  }

  body .topbar-stats .core-pill .core-gem { --gem-size: 24px; }

  body .topbar-stats .streak-flame,
  body .topbar-stats .daily-dart {
    width: 24px;
    height: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.mission-mode .mission-power .power-rig[data-stage="offline"] *,
  body.mission-mode #screen-home .armory-promo.armory-promo-close *,
  body.mission-mode .inbound-radar-galaxy,
  body.mission-mode .inbound-radar-galaxy::after,
  body.mission-mode .inbound-radar-planets,
  body.mission-mode .inbound-radar-planets *,
  body.mission-mode .radar-contact,
  body.mission-mode .mission-xp-emblem,
  body.mission-mode .radar-launch,
  body.mission-mode .radar-launch.is-arriving,
  body.mission-mode .radar-launch-ring,
  body.mission-mode .inbound-radar-scan,
  body .topbar-stats .streak-pill.is-new .streak-flame,
  body .topbar-stats .daily-pill.is-pending {
    animation: none !important;
  }
}
