:root {
  --void: #03050a;
  --ice: #7fe4ff;
  --ice-dim: rgba(127, 228, 255, 0.42);
  --amber: #ffb347;
  --alert: #ff4436;
  --glass: #0a1016;
  --ui: 'Chakra Petch', 'DIN Alternate', 'Segoe UI', system-ui, sans-serif;
}
:root:not([data-theme='light']) {
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
  }
}
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  background: var(--void);
  overflow: hidden;
  font-family: var(--ui);
  color: var(--ice);
}
canvas#c {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: var(--void);
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
#visor {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.panel {
  position: absolute;
  font-size: clamp(10px, 1.35vmin, 15px);
  letter-spacing: 0.09em;
  line-height: 1.5;
  text-shadow: 0 0 10px rgba(127, 228, 255, 0.45);
  font-weight: 500;
}
.lab {
  font-weight: 300;
  font-size: 0.72em;
  letter-spacing: 0.22em;
  color: var(--ice-dim);
}
.big {
  font-size: 2.5em;
  font-weight: 700;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}
.mid {
  font-size: 1.5em;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

#pLeft {
  left: 12%;
  top: 19%;
}
#pRight {
  right: 12%;
  top: 19%;
  text-align: right;
}
/* the one thing you press on the title screen */
#readyBtn {
  margin-top: 2.2em;
  font-family: var(--ui);
  font-size: clamp(16px, 2.6vmin, 30px);
  font-weight: 700;
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  color: var(--void);
  background: var(--ice);
  border: 0;
  padding: 0.7em 2.4em;
  cursor: pointer;
  box-shadow: 0 0 34px rgba(127, 228, 255, 0.45);
  transition:
    background 0.12s linear,
    box-shadow 0.12s linear;
}
#readyBtn:hover:not(:disabled),
#readyBtn:focus-visible:not(:disabled) {
  background: #fff;
  box-shadow: 0 0 46px rgba(127, 228, 255, 0.7);
}
#readyBtn:disabled {
  cursor: default;
  color: var(--ice-dim);
  background: transparent;
  border: 1px solid rgba(127, 228, 255, 0.28);
  box-shadow: none;
}
#readyBtn.waiting {
  color: #66ffc0;
  border-color: rgba(102, 255, 192, 0.5);
}

/* who is already in the crater, under the prompt on the title screen */
#lobby {
  display: flex;
  gap: 0.9em;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2.4em;
  min-height: 1.4em;
}
.lobbySuit {
  display: flex;
  flex-direction: column;
  gap: 0.35em;
  font-size: 0.78em;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ice-dim);
  border: 1px solid rgba(127, 228, 255, 0.22);
  padding: 0.5em 0.9em;
  min-width: 7em;
}
.lobbySuit.me {
  color: var(--ice);
  border-color: var(--ice);
}
.lobbySuit.ready {
  border-color: #66ffc0;
  box-shadow: 0 0 14px rgba(102, 255, 192, 0.25);
}
.lobbyState {
  font-size: 0.82em;
  letter-spacing: 0.16em;
  color: var(--ice-dim);
}
.lobbySuit.ready .lobbyState {
  color: #66ffc0;
}

/* the crew, top centre: the corners are yours and the middle is everyone's */
#pCrew {
  left: 50%;
  top: 4.5%;
  transform: translateX(-50%);
  display: flex;
  gap: 1.6em;
  align-items: center;
}
.crew {
  display: flex;
  align-items: center;
  gap: 0.5em;
  opacity: 0.72;
}
.crew.me {
  opacity: 1;
}
.crewName {
  font-weight: 300;
  font-size: 0.78em;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ice-dim);
}
.crew.me .crewName {
  color: var(--ice);
}
.crewBar {
  width: 6vmin;
  height: 3px;
  background: rgba(127, 228, 255, 0.14);
  position: relative;
  overflow: hidden;
  display: inline-block;
}
.crewBar i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: var(--ice);
  box-shadow: 0 0 9px var(--ice);
}
.crewBar i.warn {
  background: var(--alert);
  box-shadow: 0 0 9px var(--alert);
}
.crewState {
  font-size: 0.72em;
  letter-spacing: 0.14em;
  color: var(--ice-dim);
  min-width: 4.2em;
}
.crewState.warn {
  color: var(--alert);
}
#pBotL {
  left: 13%;
  bottom: 18%;
}
#pBotR {
  right: 13%;
  bottom: 18%;
  text-align: right;
}
#frost {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.2s ease-out;
  background-size: 100% 100%;
  mix-blend-mode: screen;
}
#statik {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.18s;
  background-size: 280px 280px;
  mix-blend-mode: screen;
}
#rollbar {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.25s;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(150, 220, 255, 0.1) 42%,
    rgba(190, 240, 255, 0.22) 50%,
    rgba(150, 220, 255, 0.1) 58%,
    transparent 100%
  );
  background-size: 100% 26%;
  background-repeat: no-repeat;
  animation: roll 2.6s linear infinite;
}
@keyframes roll {
  from {
    background-position: 0 -30%;
  }
  to {
    background-position: 0 130%;
  }
}
#breath {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 34%;
  opacity: 0.5;
  background: radial-gradient(
    ellipse at 50% 120%,
    rgba(198, 232, 248, 0.3),
    rgba(198, 232, 248, 0) 68%
  );
  animation: breathe 5.2s ease-in-out infinite;
}
#breath.fast {
  animation-duration: 2.4s;
}
#breath.fast {
  background: radial-gradient(
    ellipse at 50% 120%,
    rgba(210, 238, 252, 0.46),
    rgba(198, 232, 248, 0) 72%
  );
}
@keyframes breathe {
  0%,
  100% {
    opacity: 0.26;
    transform: translateY(6%);
  }
  50% {
    opacity: 0.62;
    transform: translateY(0);
  }
}
#cracks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#cracks path {
  fill: none;
  stroke: rgba(226, 244, 255, 0.55);
  stroke-linecap: round;
  filter: drop-shadow(0 0 2px rgba(150, 210, 255, 0.5));
}
#bootline {
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  top: 0;
  opacity: 0;
  background: linear-gradient(90deg, transparent, rgba(127, 228, 255, 0.9), transparent);
}
#hud.boot #bootline {
  animation: sweep 1.5s ease-in-out 1;
}
#hud.boot .panel {
  animation: panelIn 0.75s cubic-bezier(0.2, 0.8, 0.3, 1) 1;
}
#hud.boot #radar {
  animation: panelIn 0.95s cubic-bezier(0.2, 0.8, 0.3, 1) 1;
}
@keyframes sweep {
  0% {
    opacity: 0;
    top: 6%;
  }
  15% {
    opacity: 1;
  }
  85% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    top: 94%;
  }
}
@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.96);
  }
  to {
    opacity: 1;
  }
}

#radar {
  position: absolute;
  left: 50%;
  bottom: 8.5%;
  transform: translateX(-50%);
  width: 15vmin;
  height: 15vmin;
  opacity: 0.92;
}

.edge {
  position: absolute;
  opacity: 0;
  transition: opacity 0.16s linear;
}
#edgeL {
  left: 0;
  top: 0;
  bottom: 0;
  width: 27%;
  background: linear-gradient(90deg, rgba(255, 140, 60, 0.55), rgba(255, 140, 60, 0) 72%);
}
#edgeR {
  right: 0;
  top: 0;
  bottom: 0;
  width: 27%;
  background: linear-gradient(270deg, rgba(255, 140, 60, 0.55), rgba(255, 140, 60, 0) 72%);
}
#edgeB {
  left: 0;
  right: 0;
  bottom: 0;
  height: 26%;
  background: linear-gradient(0deg, rgba(255, 90, 60, 0.6), rgba(255, 90, 60, 0) 76%);
}

#arcs {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 38.5vmin;
  height: 38.5vmin;
  transform: translate(-50%, -50%);
  overflow: visible;
}
#arcs path {
  fill: none;
  stroke: #ff4436;
  stroke-width: 9;
  stroke-linecap: round;
  opacity: 0;
}

.bar {
  width: 15vmin;
  height: 3px;
  background: rgba(127, 228, 255, 0.14);
  margin-top: 0.55em;
  position: relative;
  overflow: hidden;
}
#relayRow.hit,
#relayTxt.hit {
  color: var(--alert);
  text-shadow: 0 0 12px rgba(255, 68, 54, 0.75);
}
#relayBar.hit i {
  background: var(--alert) !important;
  box-shadow: 0 0 14px var(--alert) !important;
  animation: relayPulse 0.32s linear infinite;
}
#relayRow.hit {
  animation: relayPulse 0.32s linear infinite;
}
#relayRow.heal,
#relayTxt.heal {
  color: #66ffc0;
  text-shadow: 0 0 12px rgba(102, 255, 192, 0.6);
}
#relayBar.heal i {
  background: #66ffc0 !important;
  box-shadow: 0 0 14px rgba(102, 255, 192, 0.8) !important;
  animation: relayPulse 0.62s linear infinite;
}
#relayRow.heal {
  animation: relayPulse 0.62s linear infinite;
}
@keyframes relayPulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.32;
  }
}
.krow {
  font-size: 0.78em;
  letter-spacing: 0.1em;
  font-weight: 300;
  color: var(--ice-dim);
  line-height: 1.85;
}
.krow b {
  display: inline-block;
  /* wide enough for the longest label, so the descriptions stay in a column */
  min-width: 7.2em;
  color: var(--ice);
  font-weight: 500;
  letter-spacing: 0.14em;
  margin-right: 0.7em;
}
#pBotR .bar {
  margin-left: auto;
}
.bar i {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 100%;
  background: var(--ice);
  box-shadow: 0 0 9px var(--ice);
  transform-origin: left;
  transition: transform 0.12s linear;
}
#hpBar i {
  background: var(--ice);
}
.warn i {
  background: var(--alert) !important;
  box-shadow: 0 0 12px var(--alert) !important;
}
.warn {
  color: var(--alert);
  text-shadow: 0 0 12px rgba(255, 68, 54, 0.6);
}

#reticle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 40px;
  height: 40px;
  transform: translate(-50%, -50%);
  opacity: 0.9;
}
#reticle b {
  position: absolute;
  background: var(--ice);
  box-shadow: 0 0 6px var(--ice);
}
#reticle .v {
  width: 1.5px;
  height: 7px;
  left: 19.25px;
}
#reticle .h {
  height: 1.5px;
  width: 7px;
  top: 19.25px;
}
#rN {
  top: 2px;
}
#rS {
  bottom: 2px;
}
#rW {
  left: 2px;
}
#rE {
  right: 2px;
}
#rDot {
  width: 2px;
  height: 2px;
  left: 19px;
  top: 19px;
  border-radius: 50%;
  opacity: 0.8;
}
#hitmark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  transform: translate(-50%, -50%) rotate(45deg) scale(0.6);
  opacity: 0;
}
#hitmark b {
  position: absolute;
  background: #fff;
  box-shadow: 0 0 8px #fff;
}
#hitmark .v {
  width: 2px;
  height: 8px;
  left: 12px;
}
#hitmark .h {
  height: 2px;
  width: 8px;
  top: 12px;
}
#hitmark.on {
  animation: hm 0.26s ease-out;
}
@keyframes hm {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(45deg) scale(0.55);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(45deg) scale(1.25);
  }
}

#dmg {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(160, 18, 10, 0.85) 100%);
  transition: opacity 0.22s ease-out;
}
#flash {
  position: absolute;
  inset: 0;
  background: rgba(190, 230, 255, 0.1);
  opacity: 0;
  transition: opacity 0.09s;
}

#msg {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translateX(-50%);
  text-align: center;
  font-size: clamp(14px, 2.3vmin, 24px);
  letter-spacing: 0.3em;
  font-weight: 500;
  opacity: 0;
  text-shadow: 0 0 18px rgba(127, 228, 255, 0.6);
  transition: opacity 0.4s;
}
#msg.on {
  opacity: 1;
}
#msg small {
  display: block;
  font-size: 0.55em;
  letter-spacing: 0.18em;
  font-weight: 300;
  color: var(--ice-dim);
  margin-top: 0.7em;
}

#screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: radial-gradient(ellipse at 50% 46%, rgba(10, 22, 34, 0.5), rgba(2, 3, 7, 0.94) 70%);
  text-align: center;
  padding: 6vmin;
  z-index: 5;
}
#screen.hide {
  display: none;
}
#screen h1 {
  font-size: clamp(38px, 11vmin, 120px);
  font-weight: 700;
  letter-spacing: 0.24em;
  margin-right: -0.24em;
  text-shadow: 0 0 44px rgba(127, 228, 255, 0.32);
  line-height: 1;
}
#screen .sub {
  margin-top: 1.4em;
  font-weight: 300;
  font-size: clamp(12px, 1.75vmin, 17px);
  letter-spacing: 0.14em;
  color: rgba(200, 228, 242, 0.72);
  max-width: 46ch;
  line-height: 1.8;
}
#screen .go {
  margin-top: 3em;
  font-size: clamp(12px, 1.7vmin, 18px);
  letter-spacing: 0.34em;
  color: var(--amber);
  text-shadow: 0 0 16px rgba(255, 179, 71, 0.5);
  animation: pulse 2.1s ease-in-out infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}
#screen .stats {
  margin-top: 2em;
  display: flex;
  gap: 3.4em;
  justify-content: center;
  flex-wrap: wrap;
}
#screen .stats div {
  font-size: clamp(11px, 1.4vmin, 15px);
  letter-spacing: 0.14em;
  color: var(--ice-dim);
  font-weight: 300;
}
#screen .stats b {
  display: block;
  font-size: 2.6em;
  font-weight: 700;
  color: var(--ice);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.1em;
}
#screen.dead h1 {
  color: var(--alert);
  text-shadow: 0 0 44px rgba(255, 68, 54, 0.35);
}
@media (prefers-reduced-motion: reduce) {
  #screen .go {
    animation: none;
    opacity: 0.9;
  }
}

/* ------------------------------------------------------------------ *
 *  Classes the Preact components introduced
 *
 *  The old markup carried these as inline styles on individual elements.
 *  Naming them keeps the components free of layout numbers.
 * ------------------------------------------------------------------ */
.lab.gap {
  margin-top: 1.1em;
}
.big .unit {
  font-size: 0.38em;
  letter-spacing: 0.2em;
}
.mid .sub {
  font-size: 0.55em;
}
#hpTxt .sub,
#relayTxt .sub {
  font-size: 0.5em;
}
#hud.menu .panel,
#hud.menu #radar,
#hud.menu #reticle {
  display: none;
}
