:root {
  --phosphor: #b5b817;
  --phosphor-hot: #c5c91d;
  --phosphor-dim: #72750e;
  --screen: #111204;
  --screen-deep: #080900;
  --line: #969914;
  --phosphor-glow:
    0 0 3px rgba(197, 201, 29, 0.8),
    0 0 10px rgba(181, 184, 23, 0.5);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #050600;
  image-rendering: pixelated;
}

body {
  height: 100vh;
  height: 100dvh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 10px;
  overflow: hidden;
  color: var(--phosphor);
  background: #080900;
  font-family: "DotGothic16", "Courier New", monospace;
  text-transform: uppercase;
  -webkit-font-smoothing: none;
  font-smooth: never;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    to bottom,
    rgba(181, 184, 23, 0.045) 0,
    rgba(181, 184, 23, 0.045) 2px,
    transparent 2px,
    transparent 6px
  );
  z-index: 5;
}

.noise {
  position: fixed;
  inset: 0;
  opacity: 0.04;
  pointer-events: none;
  z-index: 6;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

@keyframes sigstrength {
  0%   {content:"100%";}
  15%  {content:"098%";}
  17%  {content:"099%";}
  22%  {content:"100%";}
  40%  {content:"091%";}
  42%  {content:"093%";}
  43%  {content:"094%";}
  44%  {content:"093%";}
  47%  {content:"099%";}
  48%  {content:"100%";}
  71%  {content:"099%";}
  74%  {content:"096%";}
  80%  {content:"098%";}
  81%  {content:"100%";}
  90%  {content:"099%";}
  91%  {content:"100%";}
  100% {content:"097%";}
}

strong.signal::after {
  content: "";
  animation: sigstrength 20s infinite step-end;
}

.terminal {
  position: relative;
  width: min(100%, 720px);
  height: min(820px, calc(100dvh - 20px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 4px solid var(--phosphor);
  border-radius: 0;
  background: var(--screen);
  box-shadow:
    0 0 10px rgba(197, 201, 29, 0.48),
    0 0 24px rgba(181, 184, 23, 0.25),
    inset 0 0 12px rgba(181, 184, 23, 0.17);
  animation: power-on 520ms steps(30) both;
}

.terminal::after {
  display: none;
}

.system-header {
  min-height: 66px;
  padding: 7px 14px;
  display: grid;
  grid-template-columns: 58px 1fr 58px;
  align-items: center;
  gap: 12px;
  border-bottom: 4px solid var(--phosphor);
  text-align: center;
}

.system-title span {
  display: block;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
}

.system-title h1 {
  margin: 1px 0 0;
  color: var(--phosphor-hot);
  font-size: clamp(1rem, 4vw, 1.55rem);
  line-height: 1;
  letter-spacing: 0;
  text-shadow: var(--phosphor-glow);
}

.unit-badge {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  justify-self: center;
  border: 4px solid var(--phosphor);
  border-radius: 0;
  font-size: 2rem;
  line-height: 1;
  box-shadow:
    0 0 8px rgba(197, 201, 29, 0.52),
    0 0 15px rgba(181, 184, 23, 0.25),
    inset 0 0 7px rgba(181, 184, 23, 0.2);
  text-shadow: var(--phosphor-glow);
}

.gauge-bank {
  display: flex;
  align-items: end;
  gap: 10px;
  justify-self: start;
}

.gauge-readout {
  width: 58px;
  height: 86px;
  display: grid;
  grid-template:
    "label value" auto
    "gauge gauge" 64px / 1fr auto;
  align-items: end;
  color: var(--phosphor);
  line-height: 1;
}

.gauge-label {
  grid-area: label;
  align-self: center;
  font-size: 0.7rem;
  text-align: left;
  text-transform: none;
  text-shadow: var(--phosphor-glow);
}

.gauge-value {
  grid-area: value;
  align-self: center;
  font-size: 0.58rem;
  text-align: right;
  text-shadow: var(--phosphor-glow);
}

.gauge {
  grid-area: gauge;
  position: relative;
  width: 44px;
  height: 64px;
  justify-self: center;
}

.gauge-bar {
  position: absolute;
  bottom: 3px;
  left: 3px;
  width: 14px;
  height: calc(100% - 11px);
}

.gauge-fill {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: var(--gauge-level, 0%);
  background: var(--phosphor-hot);
  box-shadow:
    0 0 5px rgba(197, 201, 29, 0.72),
    0 0 10px rgba(181, 184, 23, 0.42);
}

.gauge-scale {
  position: absolute;
  top: 0;
  right: 2px;
  bottom: 3px;
  width: 24px;
  border-right: 3px solid var(--phosphor);
}

.gauge-scale::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 10px;
  background: repeating-linear-gradient(
    to bottom,
    var(--phosphor) 0 3px,
    transparent 3px 10px
  );
}

.gauge-scale::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 24px;
  height: 3px;
  background: var(--phosphor);
}

.gauge::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--phosphor);
  box-shadow: 0 0 5px rgba(181, 184, 23, 0.5);
}

.operator-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 122px;
  gap: 12px;
  align-items: center;
  padding: 9px 14px;
  border-bottom: 4px solid var(--line);
}

.portrait {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 3px solid var(--line);
  background:
    linear-gradient(
      90deg,
      transparent calc(50% - 2px),
      var(--phosphor-dim) calc(50% - 2px),
      var(--phosphor-dim) calc(50% + 2px),
      transparent calc(50% + 2px)
    ),
    linear-gradient(
      transparent calc(50% - 2px),
      var(--phosphor-dim) calc(50% - 2px),
      var(--phosphor-dim) calc(50% + 2px),
      transparent calc(50% + 2px)
    );
  font-size: 2rem;
  text-shadow: var(--phosphor-glow);
}

.reticle {
  position: absolute;
  inset: 17%;
  border: 3px solid var(--line);
  border-radius: 0;
}

.reticle::before,
.reticle::after {
  content: "";
  position: absolute;
  background: var(--phosphor);
}

.reticle::before {
  width: 12px;
  height: 3px;
  top: calc(50% - 2px);
  left: -8px;
  box-shadow: 72px 0 var(--phosphor);
}

.reticle::after {
  width: 3px;
  height: 12px;
  top: -8px;
  left: calc(50% - 2px);
  box-shadow: 0 72px var(--phosphor);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--phosphor-dim);
  font-size: 0.78rem;
  letter-spacing: 0;
}

.identity h2 {
  margin: 0;
  color: var(--phosphor-hot);
  font-size: clamp(1.55rem, 5vw, 2.2rem);
  line-height: 0.95;
  text-shadow: var(--phosphor-glow);
}

.status {
  margin: 5px 0 0;
  font-size: 0.82rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  display: inline-block;
  margin-right: 5px;
  border-radius: 0;
  background: var(--phosphor-hot);
  box-shadow:
    0 0 6px rgba(197, 201, 29, 0.9),
    0 0 13px rgba(181, 184, 23, 0.65);
  animation: blink 1.2s steps(1) infinite;
}

.bio {
  max-width: 34ch;
  margin: 4px 0 0;
  color: rgba(181, 184, 23, 0.72);
  font-size: 0.84rem;
  line-height: 1.35;
  text-transform: none;
}

.telemetry {
  align-self: stretch;
  display: grid;
  border-left: 3px solid var(--line);
}

.telemetry div {
  padding: 2px 0 2px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-bottom: 3px solid var(--phosphor-dim);
}

.telemetry div:last-child {
  border-bottom: 0;
}

.telemetry span {
  color: var(--phosphor-dim);
  font-size: 0.68rem;
}

.telemetry strong {
  color: var(--phosphor-hot);
  font-size: 1.05rem;
  font-weight: 400;
  text-shadow: var(--phosphor-glow);
}

.section-label {
  min-height: 28px;
  padding: 3px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 4px solid var(--line);
  color: var(--screen);
  background: var(--phosphor);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.link-bank {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.link-bank nav {
  min-height: 0;
  display: grid;
  grid-template-rows: repeat(9, minmax(0, 1fr));
}

.target-link {
  position: relative;
  min-height: 0;
  display: grid;
  grid-template-columns: 50px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 3px 14px;
  border-bottom: 3px solid var(--phosphor-dim);
  color: inherit;
  text-decoration: none;
  transition: none;
}

.target-link::before {
  content: "";
  position: absolute;
  top: 12px;
  left: -3.5px;
  width: 0;
  height: 0;
  width: 10px;
  height: 16px;
  border: 0;
  background: var(--screen-deep);
  opacity: 0;
  transform: translateX(8px);
}

.target-link:hover,
.target-link:focus-visible,
.target-link.is-selected {
  color: var(--screen-deep);
  outline: none;
  background: var(--phosphor-hot);
}

.target-link:hover::before,
.target-link:focus-visible::before,
.target-link.is-selected::before {
  content: ">";
  background: var(--phosphor-hot);
  opacity: 1;
}

.target-index {
  padding-right: 12px;
  border-right: 3px solid currentColor;
  font-size: 1.25rem;
}

.target-copy {
  min-width: 0;
}

.target-copy strong,
.target-copy small {
  display: block;
}

.target-copy strong {
  font-size: 1.22rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-shadow: var(--phosphor-glow);
}

.target-copy small {
  margin-top: 0;
  color: var(--phosphor-dim);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
}

.target-link:hover small,
.target-link:focus-visible small,
.target-link.is-selected small {
  color: rgba(8, 9, 0, 0.7);
}

.target-link:hover strong,
.target-link:focus-visible strong,
.target-link.is-selected strong {
  text-shadow: none;
}

.target-state {
  padding: 4px 7px;
  border: 3px solid currentColor;
  font-size: 0.72rem;
}

.system-footer {
  min-height: 30px;
  padding: 3px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--phosphor-dim);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

@keyframes blink {
  0%,
  91% {
    opacity: 1;
  }
  92%,
  100% {
    opacity: 0.2;
  }
}

@keyframes power-on {
  0% {
    opacity: 0;
    transform: scaleY(0.03);
    filter: brightness(5);
  }
  15% {
    opacity: 0.25;
    transform: scaleY(0.06);
    filter: brightness(5);
  }

  50% {
    opacity: 1;
    transform: scaleY(1);
    filter: brightness(1.6);
  }
  100% {
    filter: brightness(1);
  }
}

@media (max-width: 620px) {
  body {
    place-items: center;
  }

  .system-header {
    min-height: 56px;
    grid-template-columns: 36px 1fr 36px;
    gap: 6px;
    padding-block: 4px;
    padding-inline: 8px;
  }

  .unit-badge {
    width: 32px;
    height: 32px;
    font-size: 1.25rem;
  }

  .gauge-bank {
    gap: 6px;
  }

  .gauge-readout {
    width: 46px;
    height: 64px;
    grid-template:
      "label value" auto
      "gauge gauge" 45px / 1fr auto;
  }

  .gauge-label {
    font-size: 0.56rem;
  }

  .gauge-value {
    font-size: 0.48rem;
  }

  .gauge {
    width: 36px;
    height: 45px;
  }

  .gauge-bar {
    width: 11px;
  }

  .operator-panel {
    grid-template-columns: auto minmax(0, 1fr);
    gap: 9px;
    padding: 7px 9px;
  }

  .telemetry {
    display: none;
  }

  .target-link {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 7px;
    padding: 2px 8px;
  }

  .target-index {
    padding-right: 6px;
    font-size: 1rem;
  }

  .target-state {
    display: none;
  }

  .target-copy strong {
    font-size: 0.98rem;
    letter-spacing: 0.03em;
  }

  .target-copy small {
    font-size: 0.64rem;
    letter-spacing: 0;
  }

  .system-footer {
    padding-inline: 8px;
    font-size: 0.62rem;
  }
}

@media (max-height: 600px) {
  .bio,
  .target-copy small {
    display: none;
  }

  .operator-panel {
    grid-template-columns: auto minmax(0, 1fr) 108px;
    padding-block: 5px;
  }

  .gauge-readout {
    width: 46px;
    height: 58px;
    grid-template:
      "label value" auto
      "gauge gauge" 40px / 1fr auto;
  }

  .gauge {
    height: 40px;
  }

  .system-header {
    min-height: 52px;
  }
}

@media (max-width: 620px) and (max-height: 600px) {
  .operator-panel {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .gauge-readout {
    width: 42px;
  }

  .eyebrow {
    display: none;
  }
}

#iff::after {
  content: "IFF: FRIENDLY"
}
#iff:hover::after {
  content:"IFF: NUKE THE PLANET FROM ORBIT. IT'S THE ONLY WAY TO BE SURE"
}


@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

