@import "https://fonts.googleapis.com/css2?family=DM+Mono:wght@300;400&display=swap";
:root {
  color-scheme: dark;
  font-family:
    DM Mono,
    monospace;
}

* {
  box-sizing: border-box;
}

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

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: none;
  touch-action: none;
}

:root {
  --game-left: 0px;
  --game-top: 0px;
  --game-right: 0px;
  --game-bottom: 0px;
  --game-width: 100vw;
  --game-height: 100vh;
}

.orientation-prompt {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #050713f5;
  text-align: center;
}

.orientation-prompt[hidden] {
  display: none;
}

.orientation-card {
  width: min(360px, 100%);
  padding: 28px;
  border: 1px solid rgba(190, 210, 255, 0.16);
  border-radius: 16px;
  background: #090d1d;
  box-shadow: 0 24px 80px #0000006b;
}

.orientation-icon {
  margin-bottom: 12px;
  color: #7de6ee;
  font-size: 48px;
  line-height: 1;
}

.orientation-card h2 {
  margin: 0 0 10px;
  color: #f2f6fff0;
  font-size: 20px;
  font-weight: 400;
}

.orientation-card p {
  margin: 0;
  color: #d2dcf59e;
  font-size: 12px;
  line-height: 1.6;
}

.orientation-start {
  min-height: 44px;
  margin-top: 20px;
  padding: 0 20px;
  border: 1px solid rgba(125, 230, 238, 0.5);
  border-radius: 999px;
  background: #123044;
  color: #f2f6ff;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}

.name-menu {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #0406116b;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.name-menu[hidden] {
  display: none;
}

.pause-menu {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #040611b8;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  cursor: default;
}

.pause-menu[hidden] {
  display: none;
}

.pause-card {
  width: min(340px, 100%);
  padding: 28px;
  border: 1px solid rgba(190, 210, 255, 0.16);
  border-radius: 12px;
  background: #090d1df2;
  box-shadow: 0 24px 80px #00000080;
}

.pause-card h1 {
  margin-bottom: 12px;
}

.pause-message,
.pause-hint {
  color: #d2dcf59e;
  font-size: 11px;
  line-height: 1.6;
}

.pause-message {
  min-height: 36px;
  margin: 0 0 18px;
}

.pause-actions {
  display: grid;
  gap: 8px;
}

.pause-actions .pause-secondary {
  border: 1px solid rgba(190, 210, 255, 0.16);
  background: #d2e1ff0f;
  color: #dce6faa8;
}

.pause-actions .pause-secondary:hover {
  background: #d2e1ff1c;
  color: #f2f6ff;
}

.pause-hint {
  margin: 16px 0 0;
  text-align: center;
}

.name-card {
  width: min(340px, 100%);
  padding: 28px;
  border: 1px solid rgba(190, 210, 255, 0.16);
  border-radius: 12px;
  background: #090d1de0;
  box-shadow: 0 24px 80px #0000006b;
}

.eyebrow {
  margin: 0 0 20px;
  color: #bed2ff7a;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 28px;
  color: #f2f6fff0;
  font-size: 22px;
  font-weight: 400;
  letter-spacing: -0.03em;
}

label {
  display: block;
  margin-bottom: 8px;
  color: #d2dcf59e;
  font-size: 11px;
}

input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(190, 210, 255, 0.2);
  border-radius: 7px;
  outline: none;
  background: #030610ad;
  color: #f1f5ff;
  font: inherit;
  font-size: 14px;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
}

input:focus {
  border-color: #aac3ff9e;
  box-shadow: 0 0 0 3px #789bff1a;
}

input[aria-invalid="true"] {
  border-color: #ff919ba6;
}

.creator-hint {
  margin: 8px 0 0;
  color: #7de6eec2;
  font-size: 10px;
  line-height: 1.45;
}

.creator-hint[hidden] {
  display: none;
}

.input-error {
  min-height: 16px;
  margin: 6px 0 10px;
  color: #ffa0aad1;
  font-size: 10px;
}

button {
  width: 100%;
  height: 42px;
  border: 0;
  border-radius: 7px;
  background: #e1eaffeb;
  color: #0a1022;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition:
    background 0.2s,
    transform 0.2s;
}

button:hover {
  background: #fff;
}

button:active {
  transform: translateY(1px);
}

.text-button {
  height: 28px;
  margin-top: 6px;
  background: transparent;
  color: #d2dcf57a;
}

.text-button:hover {
  background: transparent;
  color: #ebf0ffcc;
}

.controls-hint {
  position: fixed;
  left: calc(var(--game-left) + 18px);
  bottom: calc(var(--game-bottom) + 76px);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  max-width: calc(var(--game-width) - 36px);
  gap: 10px;
  padding: 11px 14px;
  border: 1px solid rgba(190, 210, 255, 0.09);
  border-radius: 9px;
  background: #070a178a;
  color: #d2dcf585;
  font-size: 12px;
  letter-spacing: 0.04em;
  pointer-events: none;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.controls-hint[hidden] {
  display: none;
}

.key-group {
  display: flex;
  gap: 2px;
}

kbd {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border: 1px solid rgba(210, 220, 245, 0.24);
  border-radius: 4px;
  background: #d2dcf50d;
  color: #e6ecffa6;
  font: inherit;
  font-size: 10px;
}

.hint-divider {
  width: 1px;
  height: 23px;
  margin: 0 2px;
  background: #d2dcf51f;
}

.mouse-icon {
  position: relative;
  width: 18px;
  height: 25px;
  border: 1px solid rgba(230, 236, 255, 0.48);
  border-radius: 9px;
}

.mouse-icon:after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 1px;
  height: 10px;
  background: #e6ecff47;
}

.mouse-icon i {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 3px;
  height: 7px;
  border-radius: 2px;
  background: #ffda5ab8;
}

.chat {
  position: fixed;
  right: calc(var(--game-right) + 18px);
  bottom: calc(var(--game-bottom) + 16px);
  z-index: 2;
  width: min(330px, calc(var(--game-width) - 36px));
  color: #e0e9ffc7;
  font-size: 10px;
  pointer-events: none;
}

.chat[hidden],
.chat-form[hidden] {
  display: none;
}

.chat-history {
  max-height: min(42vh, 360px);
  margin-bottom: 7px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(125, 230, 238, 0.22) transparent;
  pointer-events: auto;
}

.chat-history:focus-visible {
  outline: 1px solid rgba(125, 230, 238, 0.32);
  outline-offset: 3px;
}

.chat-history-state {
  margin: 2px 0 6px;
  color: #cddcf561;
  font-size: 9px;
  text-align: center;
}

.chat-history-state[hidden] {
  display: none;
}

.chat-messages {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.chat-message {
  max-width: 100%;
  padding: 5px 8px;
  border: 1px solid rgba(190, 210, 255, 0.08);
  border-radius: 7px;
  background: #060a1794;
  overflow-wrap: anywhere;
  text-align: right;
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.chat-message strong {
  color: #7de6eeb8;
  font-weight: 400;
}

.chat-message strong:after {
  content: " · ";
  color: #d2dcf54d;
}

.chat-form {
  display: grid;
  gap: 4px;
  padding: 7px;
  border: 1px solid rgba(125, 230, 238, 0.17);
  border-radius: 9px;
  background: #070c19d1;
  pointer-events: auto;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.chat-form input {
  height: 34px;
  font-size: 11px;
}

.chat-form span {
  color: #cddcf566;
  font-size: 8px;
  text-align: right;
}

.voice-control {
  position: fixed;
  left: 50%;
  bottom: calc(var(--game-bottom) + 72px);
  z-index: 1;
  transform: translate(-50%);
  color: #d2dcf59e;
  font-size: 13px;
}

.voice-control[hidden],
.voice-prompt[hidden],
.voice-panel[hidden],
.voice-error[hidden] {
  display: none;
}

.voice-prompt,
.voice-panel {
  width: auto;
  min-height: 46px;
  height: auto;
  padding: 11px 16px;
  border: 1px solid rgba(125, 230, 238, 0.15);
  border-radius: 999px;
  background: #070c19ad;
  color: #cde4f0b8;
  font-size: 13px;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.voice-prompt {
  display: flex;
  align-items: center;
  gap: 7px;
}

.voice-prompt kbd {
  width: auto;
  padding: 0 5px;
}

.voice-prompt:focus-visible {
  outline: 1px solid rgba(125, 230, 238, 0.72);
  outline-offset: 3px;
}

.voice-prompt:hover {
  background: #0c1426db;
  color: #e1f5fae6;
}

.voice-panel {
  display: flex;
  align-items: center;
  gap: 8px;
}

.voice-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #72dfe5;
  box-shadow: 0 0 10px #5ae1eb8c;
}

.voice-panel.is-muted .voice-dot {
  background: #7b8193;
  box-shadow: none;
}

.voice-action {
  width: auto;
  height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(190, 210, 255, 0.12);
  background: #d2e1ff0f;
  color: #dce6faa8;
  font-size: 11px;
}

.voice-error {
  max-width: 280px;
  margin: 5px 0 0;
  color: #ffafb4c7;
  text-align: center;
}

.mobile-controls {
  position: fixed;
  top: var(--game-top);
  left: var(--game-left);
  width: var(--game-width);
  height: var(--game-height);
  z-index: 3;
  pointer-events: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.mobile-controls[hidden] {
  display: none;
}

.mobile-cover-mode .mobile-controls {
  inset: 0;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

.mobile-quick-actions {
  position: absolute;
  left: max(14px, env(safe-area-inset-left));
  bottom: calc(164px + env(safe-area-inset-bottom));
  display: flex;
  gap: 7px;
}

.mobile-quick-actions button {
  width: auto;
  height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(150, 205, 238, 0.18);
  border-radius: 999px;
  background: #070d1db8;
  color: #dcebfac7;
  font-size: 10px;
  pointer-events: auto;
  touch-action: manipulation;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.mobile-game-controls {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  left: max(14px, env(safe-area-inset-left));
  display: flex;
  align-items: end;
  justify-content: space-between;
}

.mobile-joystick {
  position: absolute;
  z-index: 1;
  width: 120px;
  height: 120px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.mobile-joystick[hidden] {
  display: none;
}

.mobile-joystick-base,
.mobile-joystick-stick {
  position: absolute;
  top: 50%;
  left: 50%;
  border: 1px solid rgba(160, 205, 235, 0.32);
  border-radius: 50%;
  background: #070d1d8f;
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.mobile-joystick-base {
  width: 100%;
  height: 100%;
  transform: translate(-50%, -50%);
}

.mobile-joystick-stick {
  width: 48px;
  height: 48px;
  border-color: rgba(125, 230, 238, 0.62);
  background: #50afcd78;
  box-shadow: 0 0 18px #50afcd33;
  transform: translate(
    calc(-50% + var(--stick-x, 0px)),
    calc(-50% + var(--stick-y, 0px))
  );
}

.mobile-control {
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(160, 205, 235, 0.22);
  border-radius: 13px;
  background: #070d1db8;
  color: #e1eefcc7;
  font-size: 21px;
  pointer-events: auto;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
}

.mobile-control.is-active {
  background: #50afcd57;
  border-color: #7de6ee94;
  transform: scale(0.96);
}

.mobile-weapons {
  display: flex;
  align-items: end;
  margin-left: auto;
  gap: 12px;
}

.mobile-weapons .mobile-control {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  color: #ffe47d;
  font-size: 23px;
}

.mobile-weapons .mobile-control span {
  margin-top: -13px;
  color: #e6eefc9e;
  font-size: 8px;
}

.mobile-weapons .mobile-missile {
  width: 58px;
  height: 58px;
  border-color: #ffaa4147;
  color: #ffb55d;
}

.mobile-mode .controls-hint {
  display: none;
}

.mobile-mode .chat {
  bottom: calc(var(--game-bottom) + 190px + env(safe-area-inset-bottom));
  width: min(300px, calc(var(--game-width) - 28px));
}

.mobile-mode .chat-history {
  max-height: min(30vh, 230px);
}

.mobile-mode .voice-control {
  top: calc(var(--game-top) + max(12px, env(safe-area-inset-top)));
  bottom: auto;
}

.mobile-mode .name-card button {
  min-height: 44px;
}

@media (max-height: 520px) and (orientation: landscape) {
  .mobile-quick-actions {
    bottom: calc(116px + env(safe-area-inset-bottom));
  }

  .mobile-game-controls {
    align-items: center;
  }

  .mobile-control {
    width: 45px;
    height: 45px;
  }

  .mobile-weapons .mobile-control {
    width: 62px;
    height: 62px;
  }

  .mobile-weapons .mobile-missile {
    width: 52px;
    height: 52px;
  }

  .mobile-mode .chat {
    bottom: calc(125px + env(safe-area-inset-bottom));
  }
}

.loss-message {
  position: fixed;
  left: 50%;
  top: 46%;
  pointer-events: none;
  color: #f5f7fff0;
  font-size: clamp(24px, 4vw, 42px);
  letter-spacing: -0.04em;
  text-shadow: 0 0 28px rgba(160, 185, 255, 0.45);
  animation: loss-beat 1.05s cubic-bezier(0.22, 0.8, 0.3, 1) both;
}

.loss-message[hidden] {
  display: none;
}

@keyframes loss-beat {
  0% {
    opacity: 0;
    transform: translate(-50%, -42%) scale(0.88);
    filter: blur(5px);
  }

  22%,
  62% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    filter: blur(0);
  }

  to {
    opacity: 0;
    transform: translate(-50%, -58%) scale(1.04);
    filter: blur(2px);
  }
}
