:root {
  color-scheme: dark;
  font-family: "Noto Sans SC", system-ui, sans-serif;
  --ink: #111821;
  --paper: #f5f3ec;
  --pink: #ff4f91;
  --cyan: #35d6dd;
  --yellow: #ffd94a;
  --edge: rgba(245, 243, 236, 0.72);
}

* {
  box-sizing: border-box;
}

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

body {
  display: grid;
  place-items: center;
  color: var(--paper);
}

button,
kbd {
  font: inherit;
}

button {
  color: inherit;
}

.game-shell,
.game-shell * {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.game-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 360px;
  overflow: hidden;
  background: var(--ink);
  isolation: isolate;
}

#game {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  background: #111821;
  outline: none;
}

.game-bar {
  position: absolute;
  z-index: 6;
  top: 0;
  left: 0;
  right: 0;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) 20px 0;
  pointer-events: none;
}

.identity {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.82);
  text-shadow: 0 2px 0 #18202b;
}

.identity-mark {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border: 2px solid var(--cyan);
  color: var(--cyan);
  font-family: "Black Ops One", sans-serif;
  font-size: 12px;
  background: rgba(17, 24, 33, 0.78);
}

.utility-actions {
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.audio-settings {
  position: relative;
}

.volume-panel {
  position: absolute;
  top: 46px;
  right: 0;
  width: 224px;
  display: grid;
  gap: 13px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  background: rgba(12, 18, 25, 0.95);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(10px);
}

.volume-panel[hidden] {
  display: none;
}

.volume-control {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 7px 12px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  font-weight: 900;
}

.volume-control output {
  color: var(--cyan);
  font: 400 12px "Black Ops One", sans-serif;
}

.volume-control input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
  height: 18px;
  margin: 0;
  accent-color: var(--cyan);
  cursor: pointer;
}

.mute-control {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.mute-control input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--pink);
}

.icon-button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 4px;
  background: rgba(17, 24, 33, 0.72);
  box-shadow: 0 3px 0 rgba(7, 10, 14, 0.45);
  font-size: 19px;
  font-weight: 900;
  cursor: pointer;
  backdrop-filter: blur(7px);
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--cyan);
  color: var(--cyan);
  outline: 2px solid rgba(53, 214, 221, 0.25);
  outline-offset: 2px;
}

.icon-button.is-active {
  border-color: var(--cyan);
  color: #08161b;
  background: var(--cyan);
  box-shadow: 0 0 0 2px rgba(53, 214, 221, 0.22), 0 3px 0 rgba(7, 10, 14, 0.45);
}

.screen-layer {
  position: absolute;
  z-index: 5;
  inset: 0;
}

.start-screen {
  display: flex;
  align-items: center;
  padding: clamp(76px, 12vh, 116px) clamp(28px, 8vw, 108px) 44px;
  background:
    linear-gradient(90deg, rgba(7, 12, 18, 0.94) 0%, rgba(7, 12, 18, 0.75) 43%, rgba(7, 12, 18, 0.06) 72%),
    linear-gradient(0deg, rgba(10, 14, 19, 0.38), transparent 35%);
}

.start-screen[hidden] {
  display: none;
}

.start-copy {
  width: min(610px, 70vw);
  transform: translateY(-10px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--cyan);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
}

h1,
h2,
p {
  text-wrap: balance;
}

h1 {
  margin: 0;
  display: flex;
  flex-direction: column;
  font-family: "Black Ops One", "Noto Sans SC", sans-serif;
  font-weight: 400;
  line-height: 0.8;
  text-shadow: 5px 5px 0 #111821, 7px 7px 0 rgba(255, 79, 145, 0.6);
}

h1 span {
  color: var(--paper);
  font-size: clamp(62px, 11vw, 138px);
}

h1 small {
  margin-top: 18px;
  color: var(--yellow);
  font-size: clamp(28px, 5vw, 58px);
}

.mission-line {
  margin: 26px 0 22px;
  font-size: clamp(15px, 1.8vw, 22px);
  font-weight: 900;
  color: rgba(255, 255, 255, 0.88);
}

.primary-action {
  min-width: 164px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 22px;
  border: 0;
  border-radius: 4px;
  background: var(--pink);
  color: white;
  box-shadow: 0 5px 0 #9b244f, 0 9px 20px rgba(0, 0, 0, 0.3);
  font-size: 15px;
  font-weight: 900;
  cursor: pointer;
}

.primary-action:hover,
.primary-action:focus-visible {
  transform: translateY(-2px);
  background: #ff6ba2;
  outline: 2px solid var(--paper);
  outline-offset: 3px;
}

.primary-action:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #9b244f;
}

.asset-load-status {
  width: min(310px, 78vw);
  height: 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  margin-top: 15px;
  color: rgba(255, 255, 255, 0.66);
  font: 400 9px "Black Ops One", monospace;
}

.asset-load-status[hidden] {
  display: none;
}

.asset-load-status progress {
  width: 100%;
  height: 5px;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.13);
}

.asset-load-status progress::-webkit-progress-bar {
  background: rgba(255, 255, 255, 0.13);
}

.asset-load-status progress::-webkit-progress-value {
  background: var(--cyan);
}

.asset-load-status progress::-moz-progress-bar {
  background: var(--cyan);
}

.key-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 25px;
}

.key-strip span {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(12, 18, 25, 0.74);
}

kbd {
  min-width: 23px;
  color: var(--paper);
  font-family: "Black Ops One", monospace;
  font-size: 11px;
  text-align: center;
}

.key-strip i {
  width: 18px;
  color: var(--yellow);
  font-style: normal;
  font-weight: 900;
  text-align: center;
}

.grenade-symbol {
  position: relative;
  display: inline-block;
  width: 15px;
  height: 17px;
  border: 2px solid currentColor;
  border-radius: 50% 50% 42% 42%;
  color: var(--yellow);
}

.grenade-symbol::before {
  content: "";
  position: absolute;
  left: 4px;
  top: -7px;
  width: 6px;
  height: 5px;
  border: 2px solid currentColor;
  border-bottom: 0;
}

.start-stamp {
  position: absolute;
  right: clamp(30px, 8vw, 120px);
  bottom: clamp(40px, 9vh, 92px);
  width: 154px;
  height: 154px;
  display: grid;
  place-content: center;
  border: 4px double rgba(255, 217, 74, 0.62);
  color: var(--yellow);
  text-align: center;
  transform: rotate(-7deg);
  opacity: 0.88;
}

.start-stamp b,
.start-stamp span {
  font-size: 12px;
  letter-spacing: 0;
}

.start-stamp strong {
  font-family: "Black Ops One", sans-serif;
  font-size: 64px;
  line-height: 0.9;
}

.result-screen {
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 28px;
  background: rgba(8, 13, 19, 0.84);
  text-align: center;
  backdrop-filter: blur(3px);
}

.result-screen[hidden] {
  display: none;
}

.result-screen h2 {
  margin: 0 0 26px;
  font-family: "Black Ops One", "Noto Sans SC", sans-serif;
  font-size: clamp(44px, 8vw, 94px);
  font-weight: 400;
  color: var(--yellow);
  text-shadow: 5px 5px 0 #111821;
}

.result-stats {
  display: flex;
  gap: 28px;
  margin-bottom: 28px;
}

.result-stats span {
  display: grid;
  gap: 4px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 10px;
  font-weight: 900;
}

.result-stats b {
  color: var(--paper);
  font-family: "Black Ops One", monospace;
  font-size: 20px;
  font-weight: 400;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.result-actions [hidden] {
  display: none;
}

.secondary-action {
  min-height: 48px;
  padding: 0 22px;
  border: 2px solid rgba(255, 255, 255, 0.28);
  background: rgba(10, 18, 25, 0.72);
  color: var(--paper);
  font: 900 13px "Noto Sans SC", sans-serif;
  cursor: pointer;
}

.secondary-action:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.pause-label {
  position: absolute;
  z-index: 7;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(8, 13, 19, 0.58);
  color: var(--paper);
  pointer-events: auto;
}

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

.pause-panel {
  display: grid;
  place-items: center;
  gap: 28px;
}

.pause-panel strong {
  font-family: "Black Ops One", sans-serif;
  font-size: clamp(48px, 10vw, 108px);
  font-weight: 400;
  line-height: 0.9;
  text-shadow: 6px 6px 0 #111821;
}

.pause-resume {
  min-width: 174px;
  pointer-events: auto;
}

.pause-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.pause-restart {
  min-width: 148px;
  pointer-events: auto;
}

.touch-controls {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  bottom: max(20px, env(safe-area-inset-bottom));
  display: none;
  align-items: end;
  justify-content: space-between;
  padding: 0 max(20px, env(safe-area-inset-left)) 0 max(20px, env(safe-area-inset-right));
  pointer-events: none;
  touch-action: none;
}

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

.touch-controls button {
  width: 72px;
  height: 72px;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-radius: 50%;
  background: rgba(17, 24, 33, 0.58);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.45);
  font-size: 27px;
  font-weight: 900;
  pointer-events: auto;
  touch-action: none;
  backdrop-filter: blur(4px);
}

.touch-controls button.is-held,
.touch-controls button:active {
  transform: translateY(2px);
  border-color: var(--cyan);
  background: rgba(53, 214, 221, 0.32);
}

.touch-joystick {
  width: 142px;
  height: 142px;
  position: relative;
  flex: 0 0 142px;
  border-radius: 50%;
  pointer-events: auto;
  touch-action: none;
}

.touch-joystick-ring {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.42);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(53, 214, 221, 0.14) 0 18%, transparent 19%),
    rgba(17, 24, 33, 0.55);
  box-shadow: inset 0 0 0 12px rgba(255, 255, 255, 0.025), 0 4px 0 rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(4px);
}

.touch-joystick-ring::before,
.touch-joystick-ring::after {
  content: "";
  position: absolute;
  inset: 20px 68px;
  background: rgba(255, 255, 255, 0.12);
}

.touch-joystick-ring::after {
  inset: 68px 20px;
}

.touch-joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62px;
  height: 62px;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background: rgba(53, 214, 221, 0.52);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.42), inset 0 0 0 8px rgba(8, 22, 27, 0.2);
  transform: translate(-50%, -50%);
  will-change: transform;
}

.touch-joystick.is-active .touch-joystick-knob {
  border-color: #fff;
  background: rgba(53, 214, 221, 0.72);
}

.touch-actions {
  display: flex;
  align-items: end;
  gap: 12px;
}

.touch-actions .action-fire {
  width: 94px;
  height: 94px;
  color: var(--pink);
  border-color: rgba(255, 79, 145, 0.72);
}

.touch-actions .action-jump {
  width: 82px;
  height: 82px;
  color: var(--cyan);
}

.touch-actions .action-grenade {
  width: 70px;
  height: 70px;
}

@media (hover: none), (pointer: coarse) {
  .touch-controls {
    display: flex;
  }

  .key-strip {
    display: none;
  }
}

html.force-touch-controls .touch-controls {
  display: flex;
}

html.force-touch-controls .touch-controls[hidden] {
  display: none;
}

@media (max-width: 720px) {
  .game-shell {
    min-height: 280px;
  }

  .touch-controls {
    display: flex;
  }

  .game-bar {
    height: 50px;
    padding-inline: 12px;
  }

  .identity {
    font-size: 9px;
  }

  .identity-mark {
    width: 24px;
    height: 24px;
  }

  .icon-button {
    width: 34px;
    height: 34px;
    font-size: 16px;
  }

  .start-screen {
    align-items: start;
    padding: 70px 24px 24px;
  }

  .start-copy {
    width: min(520px, 92vw);
  }

  h1 span {
    font-size: clamp(50px, 19vw, 88px);
  }

  h1 small {
    font-size: clamp(23px, 8vw, 40px);
  }

  .mission-line {
    margin-block: 20px 18px;
    font-size: 14px;
  }

  .start-stamp {
    display: none;
  }

  .result-stats {
    gap: 16px;
  }
}

@media (max-height: 480px) {
  .start-screen {
    align-items: center;
    padding: 60px 24px 18px;
  }

  .eyebrow {
    margin-bottom: 7px;
    font-size: 9px;
  }

  h1 span {
    font-size: clamp(48px, 13vh, 70px);
  }

  h1 small {
    margin-top: 12px;
    font-size: clamp(22px, 7vh, 34px);
  }

  .mission-line {
    margin: 15px 0 14px;
    font-size: 13px;
  }

  .primary-action {
    height: 42px;
  }

  .key-strip {
    margin-top: 14px;
  }

  .touch-controls {
    bottom: max(10px, env(safe-area-inset-bottom));
    padding-inline: max(12px, env(safe-area-inset-left));
  }

  .touch-joystick {
    width: 124px;
    height: 124px;
    flex-basis: 124px;
  }

  .touch-joystick-knob {
    width: 56px;
    height: 56px;
  }

  .touch-actions {
    gap: 9px;
  }

  .touch-actions .action-fire {
    width: 84px;
    height: 84px;
  }

  .touch-actions .action-jump {
    width: 74px;
    height: 74px;
  }

  .touch-actions .action-grenade {
    width: 64px;
    height: 64px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .primary-action,
  .touch-controls button {
    transition: none;
  }
}
