:root {
  color-scheme: dark;
  --ink: #f8f3df;
  --muted: #9ca8c7;
  --night: #070b18;
  --navy: #0b1021;
  --panel: #11182d;
  --line: #334061;
  --acid: #ddff3f;
  --cyan: #5ff4ff;
  --pink: #ff4eb8;
  --orange: #ff9d3d;
  --shadow: #03050c;
  font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 8%, rgba(95, 244, 255, 0.09), transparent 22rem),
    radial-gradient(circle at 90% 12%, rgba(255, 78, 184, 0.08), transparent 22rem),
    var(--night);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: 0.16;
  background-image: linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 0 18px;
  display: flex;
  flex-direction: column;
}

.topbar,
.page-footer,
.stage-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.topbar {
  min-height: 52px;
  margin-bottom: 18px;
}

.wordmark {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 900;
  letter-spacing: -0.05em;
  text-decoration: none;
}

.wordmark span:not(.wordmark-mark) {
  color: var(--acid);
}

.wordmark-mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  color: var(--night);
  background: var(--acid);
  box-shadow: 4px 4px 0 var(--pink);
}

.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.language-switcher {
  display: flex;
  min-height: 36px;
  padding: 3px;
  border: 1px solid var(--line);
  align-items: center;
  background: rgba(17, 24, 45, 0.88);
}

.language-switcher button {
  min-width: 32px;
  height: 28px;
  padding: 0 5px;
  border: 0;
  color: #7f8aa7;
  font-size: 0.68rem;
  font-weight: 900;
  background: transparent;
  cursor: pointer;
}

.language-switcher button:hover,
.language-switcher button:focus-visible {
  outline: 1px solid var(--cyan);
  color: var(--cyan);
}

.language-switcher button.active {
  color: var(--night);
  background: var(--acid);
}

.day-chip,
.icon-button {
  min-height: 36px;
  border: 1px solid var(--line);
  background: rgba(17, 24, 45, 0.88);
}

.day-chip {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 0 13px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.day-chip i {
  width: 7px;
  height: 7px;
  background: var(--acid);
  box-shadow: 0 0 12px var(--acid);
}

.icon-button {
  width: 40px;
  color: var(--cyan);
  cursor: pointer;
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: var(--cyan);
  outline: none;
}

.game-stage {
  width: 100%;
  margin: auto 0;
}

.game-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid #596787;
  background: #10182f;
  box-shadow: 0 0 0 5px var(--shadow), 0 0 0 6px #2b3551, 14px 18px 0 rgba(0, 0, 0, 0.32);
  isolation: isolate;
}

.game-frame::after {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  content: "";
  opacity: 0.11;
  background: repeating-linear-gradient(to bottom, transparent 0, transparent 3px, #fff 4px);
  mix-blend-mode: overlay;
}

.game-frame:focus-within {
  outline: 1px solid rgba(95, 244, 255, 0.45);
  outline-offset: 4px;
}

canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
}

.panel {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.start-screen {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(390px, 1.08fr);
  gap: clamp(24px, 5vw, 72px);
  align-items: center;
  padding: clamp(28px, 5vw, 72px);
  background: linear-gradient(90deg, rgba(7, 11, 24, 0.92) 0%, rgba(7, 11, 24, 0.71) 48%, rgba(7, 11, 24, 0.82) 100%);
}

.eyebrow,
.role-label,
.controls-hint,
.stage-footer,
.page-footer {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--cyan);
}

.eyebrow span {
  color: var(--pink);
}

h1 {
  margin: 0;
  color: var(--ink);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(2.3rem, 5.4vw, 5.15rem);
  line-height: 0.84;
  letter-spacing: -0.045em;
  text-shadow: 4px 4px 0 #232e4d;
}

h1 em {
  color: var(--acid);
  font-style: normal;
  text-shadow: 4px 4px 0 #5f6425;
}

.intro {
  max-width: 42ch;
  margin: 22px 0 0;
  color: #c4cbe0;
  font-size: clamp(0.86rem, 1.4vw, 1rem);
  line-height: 1.55;
}

.disclaimer {
  margin: 14px 0 0;
  color: #8d98b2;
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: 0.045em;
}

.disclaimer > span:first-child {
  color: var(--orange);
}

.role-select {
  align-self: center;
}

.role-label {
  margin: 0 0 11px;
  color: var(--muted);
}

.role-grid {
  display: grid;
  gap: 8px;
}

.role-card {
  position: relative;
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 13px;
  align-items: center;
  min-height: 68px;
  padding: 8px 14px 8px 8px;
  border: 1px solid #3b4766;
  color: var(--ink);
  text-align: left;
  background: rgba(17, 24, 45, 0.92);
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.role-card:hover,
.role-card:focus-visible {
  z-index: 1;
  border-color: var(--cyan);
  outline: none;
  transform: translateX(-4px);
}

.role-card.selected {
  border-color: var(--acid);
  color: var(--night);
  background: var(--acid);
  box-shadow: 5px 5px 0 rgba(221, 255, 63, 0.22);
}

.avatar {
  position: relative;
  display: block;
  width: 52px;
  height: 52px;
  overflow: hidden;
  background: #25314f;
  image-rendering: pixelated;
}

.avatar::before,
.avatar::after,
.avatar i,
.avatar i::before,
.avatar i::after {
  position: absolute;
  content: "";
}

.avatar::before {
  top: 11px;
  left: 18px;
  width: 19px;
  height: 20px;
  background: #ffc28e;
  box-shadow: -4px 4px 0 #ffc28e, 3px 8px 0 #ea956f;
}

.avatar::after {
  bottom: -5px;
  left: 12px;
  width: 31px;
  height: 25px;
  background: var(--pink);
  box-shadow: -5px 7px 0 var(--pink), 5px 7px 0 var(--pink);
}

.avatar i {
  z-index: 2;
  top: 7px;
  left: 14px;
  width: 27px;
  height: 9px;
  background: #29213f;
  box-shadow: 4px 5px 0 #29213f;
}

.avatar-cto {
  background: #17374b;
}

.avatar-cto::after {
  background: var(--cyan);
  box-shadow: -5px 7px 0 var(--cyan), 5px 7px 0 var(--cyan);
}

.avatar-cto i {
  background: #171b32;
  box-shadow: -4px 5px 0 #171b32, 4px 5px 0 #171b32, 8px 9px 0 #171b32;
}

.avatar-cco {
  background: #48234b;
}

.avatar-cco::after {
  background: var(--orange);
  box-shadow: -5px 7px 0 var(--orange), 5px 7px 0 var(--orange);
}

.avatar-cco i {
  left: 12px;
  width: 30px;
  background: #692d61;
  box-shadow: -4px 5px 0 #692d61, 5px 5px 0 #692d61;
}

.role-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.role-copy strong {
  font-size: 1.04rem;
  letter-spacing: 0.05em;
}

.role-copy small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
}

.selected .role-copy small {
  color: #4b521a;
}

.role-key {
  color: #687593;
  font-size: 0.68rem;
}

.selected .role-key {
  color: #6a7524;
}

.start-button {
  display: flex;
  width: 100%;
  min-height: 56px;
  margin-top: 13px;
  padding: 0 10px 0 18px;
  border: 0;
  align-items: center;
  justify-content: space-between;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  background: var(--pink);
  box-shadow: 5px 5px 0 #632348;
  cursor: pointer;
}

.start-button b {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--night);
  font-size: 1.3rem;
  background: var(--ink);
}

.start-button:hover,
.start-button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 #632348;
}

.controls-hint {
  display: flex;
  gap: 7px;
  align-items: center;
  justify-content: center;
  margin: 15px 0 0;
  color: #7f8aa7;
}

kbd {
  min-width: 23px;
  padding: 4px 5px;
  border: 1px solid #52607e;
  color: #b8c1da;
  text-align: center;
  background: #171f37;
  box-shadow: 0 2px 0 #02050c;
}

.coming-soon {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  color: var(--acid);
  background: rgba(7, 11, 24, 0.88);
}

.coming-soon[hidden] {
  display: none;
}

.game-hud {
  position: absolute;
  top: 10px;
  right: 10px;
  left: 10px;
  z-index: 4;
  display: grid;
  grid-template-columns: auto minmax(100px, 1fr) auto auto;
  gap: 9px;
  align-items: center;
  color: #f8f3df;
  pointer-events: none;
}

.hud-identity,
.hud-team,
.hud-button {
  border: 1px solid rgba(160, 178, 215, 0.42);
  background: rgba(7, 11, 24, 0.84);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(3px);
}

.hud-identity {
  display: flex;
  gap: 7px;
  min-height: 25px;
  padding: 3px 7px 3px 3px;
  align-items: center;
}

.hud-role {
  display: grid;
  min-width: 29px;
  min-height: 19px;
  padding: 0 4px;
  place-items: center;
  color: #070b18;
  font-size: 7px;
  font-weight: 900;
  background: var(--pink);
}

.hud-location {
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.route-progress {
  position: relative;
  height: 7px;
  margin: 0 10px;
  border: 1px solid rgba(160, 178, 215, 0.42);
  background: rgba(7, 11, 24, 0.82);
}

.route-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--acid));
  transition: width 180ms linear;
}

.route-office,
.route-plane {
  position: absolute;
  top: -9px;
  display: grid;
  width: 15px;
  height: 15px;
  place-items: center;
  color: var(--night);
  font-size: 8px;
  font-style: normal;
  background: var(--acid);
}

.route-office {
  left: 68%;
}

.route-plane {
  right: -7px;
  background: var(--cyan);
}

.hud-team {
  display: flex;
  gap: 5px;
  min-height: 25px;
  padding: 3px 7px;
  align-items: center;
}

.hud-team small {
  color: #9ca8c7;
  font-size: 7px;
  font-weight: 900;
}

.hud-team strong {
  color: var(--acid);
  font-size: 10px;
}

.hud-button {
  width: 27px;
  height: 27px;
  padding: 0;
  border-color: rgba(160, 178, 215, 0.42);
  color: var(--ink);
  cursor: pointer;
  pointer-events: auto;
}

.hud-button:hover,
.hud-button:focus-visible {
  border-color: var(--cyan);
  outline: none;
  color: var(--cyan);
}

.game-toast {
  position: absolute;
  top: 45px;
  left: 50%;
  z-index: 5;
  display: flex;
  gap: 7px;
  min-height: 25px;
  padding: 4px 8px 4px 4px;
  align-items: center;
  color: var(--night);
  font-size: 7px;
  background: var(--acid);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.3);
  transform: translateX(-50%);
}

.game-toast span {
  display: grid;
  width: 17px;
  height: 17px;
  place-items: center;
  color: var(--ink);
  background: var(--night);
}

.mission-banner {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 5;
  display: flex;
  min-width: 202px;
  padding: 11px 15px;
  border: 1px solid var(--acid);
  flex-direction: column;
  color: var(--ink);
  text-align: center;
  background: rgba(7, 11, 24, 0.92);
  box-shadow: 5px 5px 0 rgba(221, 255, 63, 0.34);
  transform: translate(-50%, -50%);
}

.mission-banner small {
  margin-bottom: 3px;
  color: var(--cyan);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.1em;
}

.mission-banner strong {
  font-size: 12px;
  letter-spacing: 0.05em;
}

.pause-screen,
.finish-screen {
  z-index: 7;
  display: grid;
  padding: 28px;
  place-items: center;
  background: rgba(5, 8, 19, 0.86);
  backdrop-filter: blur(4px);
}

.modal-card,
.finish-card {
  position: relative;
  width: min(100%, 370px);
  border: 1px solid #576585;
  background: #11182d;
  box-shadow: 7px 7px 0 var(--pink);
}

.modal-card {
  max-width: 265px;
  padding: 23px;
  text-align: center;
}

.modal-card .eyebrow {
  margin-bottom: 8px;
}

.modal-card h2,
.finish-card h2 {
  margin: 0;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  letter-spacing: -0.025em;
}

.modal-card h2 {
  color: var(--acid);
  font-size: 28px;
}

.modal-card > p:not(.eyebrow) {
  margin: 10px auto 17px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.start-button.compact {
  min-height: 39px;
  margin-top: 0;
  padding-left: 13px;
  font-size: 9px;
  box-shadow: 4px 4px 0 #632348;
}

.start-button.compact b {
  width: 27px;
  height: 27px;
  font-size: 14px;
}

.text-button {
  margin-top: 13px;
  padding: 4px;
  border: 0;
  color: #8c99b6;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.08em;
  background: transparent;
  cursor: pointer;
}

.text-button:hover,
.text-button:focus-visible {
  outline: none;
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.finish-card {
  max-width: 440px;
  padding: 22px 25px 20px;
  overflow: hidden;
  box-shadow: 8px 8px 0 var(--acid);
}

.finish-card::before {
  position: absolute;
  top: -35px;
  right: -25px;
  width: 112px;
  height: 112px;
  border: 14px solid rgba(95, 244, 255, 0.08);
  border-radius: 50%;
  content: "";
}

.finish-stamp {
  position: absolute;
  top: 14px;
  right: -22px;
  margin: 0;
  padding: 4px 28px;
  color: var(--night);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.08em;
  background: var(--acid);
  transform: rotate(9deg);
}

.finish-card .eyebrow {
  margin-bottom: 8px;
  padding-right: 82px;
  font-size: 7px;
}

.finish-card h2 {
  font-size: clamp(28px, 4.3vw, 44px);
  line-height: 0.9;
}

.finish-card h2 em {
  color: var(--cyan);
  font-style: normal;
}

.finish-stats {
  display: grid;
  grid-template-columns: 0.85fr 0.85fr 1.3fr;
  margin-top: 17px;
  border: 1px solid #334061;
}

.finish-stats div {
  min-width: 0;
  padding: 8px 9px;
}

.finish-stats div + div {
  border-left: 1px solid #334061;
}

.finish-stats small,
.finish-stats strong {
  display: block;
}

.finish-stats small {
  min-height: 16px;
  color: #7f8aa7;
  font-size: 6px;
  font-weight: 900;
  line-height: 1.25;
}

.finish-stats strong {
  overflow: hidden;
  margin-top: 3px;
  color: var(--acid);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finish-note {
  margin: 12px 0;
  color: #aab4cc;
  font-size: 8px;
  line-height: 1.5;
}

.finish-actions {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 10px;
  align-items: center;
}

.finish-actions .text-button {
  margin: 0;
}

.touch-controls {
  display: none;
  margin-top: 14px;
  align-items: center;
  justify-content: space-between;
  touch-action: none;
}

.touch-controls,
.touch-controls * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.touch-move {
  display: flex;
  gap: 10px;
}

.touch-controls button {
  display: grid;
  width: 66px;
  height: 58px;
  padding: 0;
  border: 1px solid #4b5877;
  place-items: center;
  color: var(--ink);
  font-size: 24px;
  background: #121a30;
  box-shadow: 4px 4px 0 #02050c;
  touch-action: none;
}

.touch-controls button:active,
.touch-controls button.active {
  color: var(--night);
  background: var(--acid);
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #02050c;
}

.touch-controls .touch-jump {
  grid-template-rows: 1fr auto;
  width: 82px;
  color: var(--night);
  background: var(--pink);
}

.touch-jump > span:first-child {
  margin: 0;
  font-size: 24px;
}

.touch-jump > span:last-child {
  margin-top: -12px;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.loader-pixel {
  width: 13px;
  height: 13px;
  background: var(--acid);
  box-shadow: 17px 0 0 var(--cyan), 34px 0 0 var(--pink);
  animation: pixel-blink 700ms steps(2) infinite;
}

@keyframes pixel-blink {
  50% {
    opacity: 0.3;
  }
}

.stage-footer {
  min-height: 44px;
  padding: 0 4px;
  color: #71809f;
}

.ticker {
  display: flex;
  gap: 13px;
  align-items: center;
  color: #8e9ab6;
}

.ticker i {
  color: var(--pink);
  font-size: 0.48rem;
  font-style: normal;
}

.page-footer {
  min-height: 30px;
  margin-top: 4px;
  border-top: 1px solid #202944;
  color: #515e7a;
}

.page-footer p {
  margin: 14px 0 0;
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 680px);
    padding-top: 10px;
  }

  .topbar {
    min-height: 40px;
    margin-bottom: 10px;
  }

  .day-chip {
    display: none;
  }

  .topbar-actions {
    gap: 6px;
  }

  .language-switcher {
    min-height: 34px;
    padding: 2px;
  }

  .language-switcher button {
    min-width: 28px;
    height: 28px;
    padding: 0 3px;
    font-size: 0.61rem;
  }

  .icon-button {
    width: 36px;
    min-height: 34px;
  }

  .game-frame {
    aspect-ratio: 9 / 15.6;
    min-height: min(76vh, 720px);
  }

  body.game-running .app-shell {
    min-height: 100svh;
  }

  body.game-running .game-stage {
    margin: auto 0;
  }

  body.game-running .game-frame {
    min-height: 0;
    aspect-ratio: 16 / 9;
  }

  body.game-running canvas {
    height: 100%;
  }

  body.game-running .stage-footer {
    min-height: 28px;
  }

  canvas {
    height: 42%;
  }

  .start-screen {
    grid-template-columns: 1fr;
    align-content: end;
    gap: 22px;
    padding: 26px 20px 28px;
    background: linear-gradient(to bottom, rgba(7, 11, 24, 0.1) 0, rgba(7, 11, 24, 0.7) 31%, rgba(7, 11, 24, 0.98) 48%);
  }

  h1 {
    font-size: clamp(2.6rem, 13vw, 4.2rem);
  }

  .intro {
    margin-top: 14px;
    font-size: 0.82rem;
  }

  .disclaimer {
    margin-top: 9px;
  }

  .role-card {
    grid-template-columns: 44px 1fr auto;
    min-height: 54px;
  }

  .avatar {
    width: 44px;
    height: 44px;
    transform: scale(0.84);
    transform-origin: left center;
  }

  .stage-footer > span {
    display: none;
  }

  .stage-footer {
    justify-content: center;
  }

  .ticker {
    gap: 10px;
    overflow: hidden;
  }

  .page-footer {
    display: none;
  }

  .finish-screen {
    padding: 10px;
  }

  .finish-card {
    padding: 13px 15px 12px;
  }

  .finish-card h2 {
    font-size: 25px;
  }

  .finish-stats {
    margin-top: 10px;
  }

  .finish-stats div {
    padding: 6px;
  }

  .finish-note {
    margin: 8px 0;
  }

  .finish-card .start-button.compact {
    min-height: 33px;
  }

  .finish-card .start-button.compact b {
    width: 23px;
    height: 23px;
  }
}

@media (pointer: coarse), (max-width: 760px) {
  body.game-running .touch-controls {
    display: flex;
  }
}

@media (max-height: 720px) and (min-width: 761px) {
  .app-shell {
    padding-top: 10px;
  }

  .topbar {
    min-height: 38px;
    margin-bottom: 8px;
  }

  .game-frame {
    max-height: calc(100vh - 116px);
    margin: 0 auto;
  }

  .start-screen {
    padding-block: 24px;
  }

  .role-card {
    min-height: 58px;
  }
}

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