@font-face {
  font-family: BarlowC;
  src: url('./assets/fonts/barlow-condensed-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: Plex;
  src: url('./assets/fonts/ibm-plex-mono-400.woff2') format('woff2');
  font-display: swap;
}
:root {
  color-scheme: dark;
  --ice: #e6f1eb;
  --sea: #99d1c1;
  --brass: #ebc481;
  --ink: #07181b;
  --mono: Plex, monospace;
  --edge: clamp(20px, 4vw, 70px);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  margin: 0;
  background: var(--ink);
  color: var(--ice);
  font:
    16px/1.45 system-ui,
    sans-serif;
}
button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}
button,
a {
  touch-action: manipulation;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.75;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 4px;
}
#dive {
  position: relative;
  height: 100vh;
  height: 100dvh;
  min-height: 280px;
  isolation: isolate;
  overflow: hidden;
  background: #06191d;
}
.cover,
.visor,
#viewport,
.damage-flash {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.cover {
  z-index: -3;
  background: #0a2e34 url('./media/undertow/wreck-cover.webp') 55% 42% / cover no-repeat;
}
#viewport {
  z-index: -2;
  opacity: 0;
  outline: 0;
  touch-action: none;
  display: block;
}
.visor {
  z-index: -1;
  background:
    linear-gradient(0deg, #021218bf 0%, transparent 40%),
    linear-gradient(90deg, #021214ba 0%, #02141835 38%, transparent 68%),
    linear-gradient(#02121850, transparent 19%);
}
.topbar {
  position: absolute;
  inset: max(21px, env(safe-area-inset-top)) var(--edge) auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 3;
  pointer-events: none;
}
.topbar > * {
  pointer-events: auto;
}
.tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  min-height: 40px;
  color: #f1f7ee;
  font: 12px var(--mono);
  text-decoration: none;
}
.toolbar {
  display: flex;
  gap: 7px;
  margin-left: auto;
}
.tool,
.secondary,
.touch-input button {
  background: #07191d9c;
  border: 1px solid #d6f4ea63;
  border-radius: 3px;
}
.tool {
  padding: 0 0.85rem;
}
.square {
  width: 42px;
  padding: 0;
}
.tool:hover,
.secondary:hover,
.touch-input button:active {
  background: #1c4144;
  border-color: #b8e5d2;
}
.speaker {
  font-size: 19px;
  line-height: 1;
  position: relative;
  width: 15px;
  display: inline-block;
  padding-right: 5px;
}
.speaker::after {
  content: '';
  position: absolute;
  right: 0;
  top: 5px;
  width: 5px;
  height: 9px;
  border-right: 1.5px solid currentColor;
  border-radius: 50%;
}
[aria-pressed='false'] .speaker::after {
  width: 16px;
  height: 1px;
  top: 10px;
  right: -2px;
  background: currentColor;
  transform: rotate(-50deg);
}
.expand-icon {
  width: 14px;
  height: 14px;
  --corner: linear-gradient(currentColor, currentColor);
  background:
    var(--corner) 0 0/5px 1px,
    var(--corner) 0 0/1px 5px,
    var(--corner) 100% 0/5px 1px,
    var(--corner) 100% 0/1px 5px,
    var(--corner) 0 100%/5px 1px,
    var(--corner) 0 100%/1px 5px,
    var(--corner) 100% 100%/5px 1px,
    var(--corner) 100% 100%/1px 5px;
  background-repeat: no-repeat;
}
.pause-icon {
  width: 10px;
  height: 13px;
  border-inline: 3px solid currentColor;
}
.briefing {
  position: absolute;
  left: clamp(24px, 7.1vw, 140px);
  bottom: clamp(100px, 16vh, 190px);
  max-width: calc(100% - 2 * var(--edge));
  text-shadow: 0 2px 24px #042728;
}
.genre,
.sound-credit,
.readout-label,
.hud-label,
.compass,
.tabular,
#ammo-status,
.transcript span {
  font-family: var(--mono);
}
.genre {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--brass);
  font-size: clamp(10px, 0.85vw, 13px);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin: 0 0 5px;
}
.genre i,
.hud-label i {
  width: 7px;
  height: 7px;
  background: currentColor;
  transform: rotate(45deg);
}
h1,
h2,
p {
  margin: 0;
}
h1 {
  font:
    700 clamp(88px, 13.2vw, 215px)/0.86 BarlowC,
    'Arial Narrow',
    sans-serif;
  letter-spacing: -0.025em;
  text-transform: uppercase;
  margin: 0 0 1.6rem;
  color: #e9f1e4;
}
#brief {
  max-width: 400px;
  color: #dbe4de;
  font-size: clamp(15px, 1.1vw, 18px);
  line-height: 1.6;
}
.menu-buttons {
  display: flex;
  gap: 0.7rem;
  margin-top: 1.65rem;
}
.primary,
.secondary {
  font:
    600 15px system-ui,
    sans-serif;
  min-height: 48px;
  padding: 0 1.4rem;
}
.primary {
  display: flex;
  align-items: center;
  gap: 1.8rem;
  color: #132623;
  background: var(--brass);
  border: 1px solid var(--brass);
  border-radius: 3px;
}
.primary:hover {
  background: #ffdd9f;
}
.primary span:last-child {
  font: 21px/1 var(--mono);
}
.text-button {
  border: 0;
  background: none;
  color: var(--ice);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 14px;
  padding: 0.75rem 0;
}
#load-status,
noscript {
  display: block;
  font: 12px/1.6 var(--mono);
  max-width: 390px;
  margin-top: 0.6rem;
  color: #fae0a8;
}
.sound-credit {
  position: absolute;
  bottom: max(22px, env(safe-area-inset-bottom));
  left: var(--edge);
  display: flex;
  align-items: center;
  gap: 10px;
  color: #c6d9d4;
  font-size: 11px;
}
.headphones {
  height: 12px;
  width: 15px;
  border: 1.5px solid currentColor;
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  position: relative;
}
.headphones:before,
.headphones:after {
  content: '';
  position: absolute;
  bottom: -2px;
  width: 3px;
  height: 6px;
  background: currentColor;
  border-radius: 2px;
}
.headphones:before {
  left: -1px;
}
.headphones:after {
  right: -1px;
}
[data-mode='playing'] #viewport,
[data-mode='paused'] #viewport,
[data-mode='won'] #viewport,
[data-mode='lost'] #viewport {
  opacity: 1;
  pointer-events: auto;
}
[data-mode='playing'] .cover,
[data-mode='paused'] .cover,
[data-mode='won'] .cover,
[data-mode='lost'] .cover {
  display: none;
}
[data-mode='playing'] .visor {
  background:
    radial-gradient(ellipse at 50% 44%, transparent 47%, #0013194d 100%),
    linear-gradient(0deg, #01121996 0%, transparent 20%);
  pointer-events: none;
}
:is([data-mode='paused'], [data-mode='won'], [data-mode='lost']) .visor {
  background: linear-gradient(90deg, #021517eb 0%, #051d21ad 50%, #0212187a);
}
:is([data-mode='paused'], [data-mode='won'], [data-mode='lost'], [data-mode='error']) h1 {
  font-size: clamp(64px, 9vw, 148px);
}
#instruments {
  pointer-events: none;
  user-select: none;
}
.hud-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: clamp(10px, 1vw, 13px);
  text-shadow: 0 1px 4px #031920;
}
.hud-label i {
  color: var(--brass);
  width: 5px;
  height: 5px;
}
.compass {
  position: absolute;
  top: 25px;
  left: 50%;
  transform: translateX(-50%);
  width: 124px;
  text-align: center;
  color: #e5f6ef;
  font-size: 11px;
  text-shadow: 0 1px 4px #031218;
}
.compass-scale {
  height: 7px;
  margin: 0 auto 5px;
  background: repeating-linear-gradient(90deg, #d0f4ea99 0 1px, transparent 1px 12px);
  mask-image: linear-gradient(90deg, transparent, #000 26% 74%, transparent);
}
#reticle {
  width: 19px;
  height: 19px;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  filter: drop-shadow(0 1px 2px #001811);
}
#reticle i {
  width: 3px;
  height: 3px;
  border-radius: 100%;
  background: #f3f8e9;
  box-shadow:
    0 -6px 0 -1px #ffffffdf,
    6px 0 0 -1px #ffffffdf,
    -6px 0 0 -1px #ffffffdf,
    0 6px 0 -1px #ffffffdf;
}
#reticle.hit:after {
  content: '×';
  position: absolute;
  font: 26px/1 var(--mono);
  color: #f6d58c;
}
#incoming {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  opacity: 0;
}
#incoming.show {
  opacity: 1;
}
#incoming i {
  position: absolute;
  top: -51px;
  left: -7px;
  border: 7px solid transparent;
  border-bottom-color: #ffaf87;
}
.damage-flash {
  z-index: 2;
  background: radial-gradient(ellipse, transparent 48%, #a43822a6);
  opacity: 0;
  transition: opacity 0.4s;
}
[data-hurt] .damage-flash {
  opacity: 1;
  transition: none;
}
.instrument {
  position: absolute;
  bottom: max(28px, env(safe-area-inset-bottom));
  text-shadow: 0 2px 6px #061b1c;
}
.suit {
  left: var(--edge);
}
.weapon {
  right: var(--edge);
  text-align: right;
}
.progress {
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}
.readout-label {
  display: block;
  color: #d4e9de;
  font-size: 11px;
  letter-spacing: 0.04em;
}
.readout b {
  font:
    700 36px/1.1 BarlowC,
    sans-serif;
  font-variant-numeric: tabular-nums;
}
.readout small {
  font: 12px var(--mono);
  margin-left: 4px;
  color: #c9dfd2;
}
.integrity-track {
  height: 3px;
  background: #acdfce45;
  min-width: 92px;
  margin-top: 5px;
}
.integrity-track i {
  display: block;
  height: 100%;
  background: var(--sea);
  transition: width 0.2s;
}
#ammo-status,
.tabular {
  display: inline-block;
  font-size: 12px;
  color: var(--brass);
}
.transcript {
  position: absolute;
  bottom: 20%;
  left: 50%;
  transform: translateX(-50%);
  max-width: 80%;
  width: max-content;
  text-align: center;
  background: #011316bd;
  padding: 8px 15px 10px;
  border-radius: 3px;
  color: #f0f4e8;
}
.transcript span {
  display: block;
  font-size: 10px;
  color: var(--brass);
  margin-bottom: 2px;
}
.transcript b {
  font-weight: 500;
}
.touch-input,
.mobile-guide {
  display: none;
}
dialog {
  max-width: min(380px, calc(100vw - 32px));
  width: 100%;
  max-height: 85dvh;
  padding: 24px;
  border: 1px solid #588381;
  border-radius: 5px;
  color: var(--ice);
  background: #0b2227;
}
dialog::backdrop {
  background: #010d12bf;
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
h2 {
  font:
    700 34px/1 BarlowC,
    sans-serif;
}
.dialog-head button {
  min-height: 36px;
  width: 36px;
  font-size: 23px;
}
dl {
  margin: 1.15rem 0;
}
dl div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #345156;
  padding: 0.49rem 0;
  font-size: 14px;
}
dd {
  margin: 0;
  color: var(--brass);
  font: 12px var(--mono);
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.check input {
  width: 16px;
  height: 16px;
  accent-color: var(--brass);
}
dialog small {
  display: block;
  font: 10px var(--mono);
  color: #b8d0c6;
  margin-top: 1.15rem;
}
@media (pointer: coarse) {
  .touch-input {
    display: block;
  }
  .desktop-guide {
    display: none;
  }
  .mobile-guide {
    display: block;
    margin: 1rem 0;
  }
  .touch-input > * {
    position: absolute;
    pointer-events: auto;
    touch-action: none;
    user-select: none;
  }
  #stick {
    bottom: max(25px, env(safe-area-inset-bottom));
    left: var(--edge);
    width: 86px;
    height: 86px;
    border-radius: 50%;
    border: 1px solid #d2f1dc70;
    background: #08272e75;
    display: grid;
    place-items: center;
  }
  #stick i {
    width: 33px;
    height: 33px;
    border-radius: 50%;
    background: #afd5c368;
    transform: translate(var(--dx, 0), var(--dy, 0));
  }
  #fire {
    right: var(--edge);
    bottom: max(26px, env(safe-area-inset-bottom));
    width: 68px;
    height: 68px;
    border-radius: 50%;
    color: var(--brass);
    border-color: #ebc481b0;
  }
  #reload {
    right: calc(var(--edge) + 76px);
    bottom: max(29px, env(safe-area-inset-bottom));
    height: 40px;
    padding: 0 10px;
    font-size: 12px;
  }
  .dive-buttons {
    display: flex;
    gap: 5px;
    left: calc(var(--edge) + 96px);
    bottom: max(29px, env(safe-area-inset-bottom));
  }
  .dive-buttons button {
    width: 35px;
    height: 38px;
    padding: 0;
  }
  .suit,
  .weapon {
    bottom: 124px;
  }
  .progress {
    top: calc(max(21px, env(safe-area-inset-top)) + 48px);
    bottom: auto;
    left: var(--edge);
    transform: none;
    text-align: left;
    display: flex;
    align-items: baseline;
    gap: 8px;
  }
  .transcript {
    bottom: 32%;
  }
}
@media (max-width: 600px) {
  .briefing {
    left: var(--edge);
    bottom: 14%;
  }
  .cover {
    background-position: 64% center;
  }
  .visor {
    background: linear-gradient(0deg, #00151aee 0%, #021517b0 31%, transparent 72%);
  }
  h1 {
    font-size: clamp(76px, 21vw, 119px);
    margin-bottom: 1rem;
  }
  .genre {
    font-size: 9px;
  }
  #brief {
    max-width: 310px;
  }
  .topbar {
    inset-inline: 16px;
  }
  .tool {
    min-height: 38px;
  }
  .square {
    width: 38px;
  }
  .toolbar {
    gap: 4px;
  }
  [data-mode='playing'] #audio-label {
    display: none;
  }
  .compass {
    width: 80px;
    top: 23px;
  }
  .sound-credit {
    font-size: 10px;
  }
}
@media (max-height: 510px) and (orientation: landscape) {
  .briefing {
    bottom: 13%;
    left: 5vw;
  }
  .genre {
    font-size: 9px;
  }
  h1 {
    font-size: clamp(60px, 15vh, 88px);
    margin-bottom: 8px;
  }
  #brief {
    font-size: 13px;
    max-width: 365px;
  }
  .menu-buttons {
    margin-top: 12px;
  }
  .primary,
  .secondary {
    min-height: 37px;
    font-size: 13px;
  }
  .topbar {
    top: max(9px, env(safe-area-inset-top));
  }
  .sound-credit {
    bottom: 9px;
  }
  .suit,
  .weapon {
    bottom: auto;
    top: 58px;
  }
  .readout b {
    font-size: 26px;
  }
  .transcript {
    bottom: 18%;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

@media (pointer: coarse) and (max-height: 510px) and (orientation: landscape) {
  .progress {
    top: auto;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
  }
}
@media (pointer: coarse) and (max-width: 360px) {
  #stick {
    width: 68px;
    height: 68px;
  }
  .dive-buttons {
    left: calc(var(--edge) + 74px);
    gap: 3px;
  }
  .dive-buttons button {
    width: 30px;
  }
  #fire {
    width: 56px;
    height: 56px;
  }
  #reload {
    right: calc(var(--edge) + 62px);
    padding: 0 6px;
  }
  .compass {
    width: 58px;
    left: 46%;
  }
}

#name-field {
  display: grid;
  width: min(335px, 100%);
  gap: 6px;
  margin-top: 18px;
}
#name-field label {
  font: 12px var(--mono);
  color: var(--ice);
}
#callsign {
  border: 1px solid #b6d6c575;
  border-radius: 3px;
  background: #062023df;
  color: var(--ice);
  padding: 0.7rem 0.85rem;
  font:
    16px/1.25 system-ui,
    sans-serif;
}
#callsign::placeholder {
  color: #b3c5bf;
}
#callsign:focus {
  border-color: var(--brass);
}
#name-field:not([hidden]) + .menu-buttons {
  margin-top: 12px;
}
.menu-buttons {
  align-items: center;
  flex-wrap: wrap;
}
.menu-buttons .text-button {
  padding: 0.6rem 0.3rem;
}
#scores-toggle {
  pointer-events: auto;
  display: block;
  margin: 4px auto 0;
  padding: 4px 8px;
  border: 1px solid #a4d5c877;
  border-radius: 3px;
  background: #082228cb;
  color: var(--ice);
  font: 11px var(--mono);
}
#scores-toggle[aria-expanded='true'] {
  border-color: var(--brass);
}
#kill-feed,
#standings,
#respawn {
  position: absolute;
  border-radius: 3px;
  background: #061b20e8;
  color: var(--ice);
}
#kill-feed {
  top: 83px;
  left: var(--edge);
  max-width: min(40vw, 350px);
  padding: 5px 9px;
  font: 12px/1.5 var(--mono);
}
#standings {
  top: 82px;
  right: var(--edge);
  width: min(306px, 80vw);
  padding: 14px 16px;
  border: 1px solid #8dc2ae70;
}
#standings header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
#standings h2 {
  font-size: 25px;
}
#standings header span,
#standings p {
  color: #b5d4c7;
  font: 10px/1.5 var(--mono);
}
#standings p {
  margin: 5px 0 10px;
}
#standings table {
  border-collapse: collapse;
  width: 100%;
  font: 12px/1.5 var(--mono);
}
#standings th,
#standings td {
  padding: 4px 3px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
#standings th {
  color: #c4d8cb;
  font-weight: normal;
  border-bottom: 1px solid #a4d6bb55;
}
#standings td:first-child,
#standings th:first-child {
  text-align: left;
  overflow-wrap: anywhere;
}
#standings .self {
  color: var(--brass);
}
#respawn {
  left: 50%;
  top: 48%;
  transform: translate(-50%, -50%);
  padding: 13px 22px;
  min-width: 180px;
  text-align: center;
}
#respawn strong {
  font:
    700 28px/1 BarlowC,
    sans-serif;
}
#respawn span {
  display: block;
  margin-top: 4px;
  font: 12px/1.5 var(--mono);
}
#respawn-count {
  color: var(--brass);
}
#dive[data-dead] #reticle {
  visibility: hidden;
}
@media (pointer: coarse) {
  #scores-toggle {
    margin: 0;
    min-height: 32px;
  }
  #kill-feed {
    top: 112px;
  }
}
@media (max-width: 480px) {
  #standings {
    top: 114px;
  }
  #kill-feed {
    max-width: 80%;
  }
  .menu-buttons {
    gap: 0.45rem;
  }
  .primary,
  .secondary {
    padding-inline: 0.85rem;
  }
  .primary {
    gap: 0.75rem;
  }
}
@media (max-height: 550px) and (orientation: landscape) {
  #name-field {
    width: 265px;
    gap: 3px;
    margin-top: 7px;
  }
  #callsign {
    padding: 0.4rem 0.6rem;
  }
  #name-field:not([hidden]) + .menu-buttons {
    margin-top: 6px;
  }
  #standings {
    top: 54px;
    max-height: calc(100% - 64px);
    overflow-y: auto;
    pointer-events: auto;
  }
  #kill-feed {
    top: 105px;
  }
}
@media (max-height: 420px) {
  [data-mode='menu'] .briefing {
    bottom: 10px;
  }
  [data-mode='menu'] .sound-credit {
    display: none;
  }
}

@media (pointer: coarse) {
  .maneuver-buttons {
    right: calc(var(--edge) + 76px);
    bottom: max(75px, env(safe-area-inset-bottom));
    display: flex;
    gap: 5px;
  }
  .maneuver-buttons button {
    min-width: 48px;
    height: 38px;
    padding: 0 6px;
    font-size: 12px;
  }
  .maneuver-buttons button:disabled {
    cursor: default;
    opacity: 0.65;
  }
}
@media (pointer: coarse) and (max-width: 360px) {
  .maneuver-buttons {
    right: calc(var(--edge) + 62px);
  }
}

.minimap {
  position: absolute;
  top: max(72px, calc(env(safe-area-inset-top) + 56px));
  right: var(--edge);
  width: clamp(84px, 9vw, 112px);
  padding: 6px 8px;
  background: #042125df;
  border: 1px solid #96cbc357;
  border-radius: 4px;
  font: 10px/1.4 var(--mono);
  color: #daefe7;
}
.minimap header, .sonar-key { display: flex; justify-content: space-between; }
.minimap header { text-transform: uppercase; letter-spacing: .1em; }
#sonar-plot {
  position: relative;
  width: 78%;
  aspect-ratio: 36 / 60;
  margin: 5px auto;
  border: 1px solid #c1f5e04d;
  background-image: linear-gradient(#92d6ba26 1px, transparent 1px), linear-gradient(90deg, #92d6ba26 1px, transparent 1px);
  background-size: 33.333% 20%;
}
#sonar-plot i { position: absolute; transform: translate(-50%, -50%); }
.sonar-self { background: white; width: 9px; height: 11px; clip-path: polygon(50% 0, 100% 100%, 50% 76%, 0 100%); z-index: 2; }
.sonar-diver { width: 7px; height: 7px; border-radius: 50%; background: #6df8ff; z-index: 1; }
.sonar-zombie { width: 7px; height: 7px; clip-path: polygon(50% 0,100% 50%,50% 100%,0 50%); background: #ff9b75; }
.sonar-key { font: 9px/1.4 sans-serif; }
.diver-key { color: #6df8ff; }
.zombie-key { color: #ff9b75; }
@media (max-height: 510px), (max-width: 500px) {
  .minimap { top: max(56px, calc(env(safe-area-inset-top) + 45px)); width: 80px; padding: 3px 5px; }
  #sonar-plot { width: 60%; }
}
