:root {
  color-scheme: dark;
  --bg: #080d16;
  --panel: #0c1420;
  --line: #263441;
  --text: #e7eff2;
  --muted: #8293a5;
  --cyan: #71eff2;
  --gold: #ffbc71;
  --red: #ff7187;
  --green: #a9df9b;
  font-family: Arial, Helvetica, sans-serif;
  font-synthesis: none;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  color: var(--text);
  background: #101c29;
  padding: 12px 16px;
  transition:
    background 0.15s,
    border-color 0.15s,
    transform 0.15s;
}
button:hover:not(:disabled) {
  border-color: var(--cyan);
  background: #1b303d;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
button.primary {
  background: var(--cyan);
  color: #06151d;
  border-color: var(--cyan);
  font-weight: 800;
  letter-spacing: 0.13em;
  padding: 19px 24px;
  text-align: left;
  display: flex;
  justify-content: space-between;
  gap: 20px;
}
button.primary:hover {
  background: #c2ffff;
  color: #06151d;
  transform: translateY(-1px);
}
button.danger {
  color: var(--red);
  border-color: #743543;
}
button.small {
  padding: 8px 12px;
  font-size: 11px;
  letter-spacing: 0.06em;
}
[hidden] {
  display: none !important;
}
#game {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 400px;
  isolation: isolate;
}
canvas {
  display: block;
}
#world3d,
#world2d {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at 52% 45%,
    transparent 35%,
    #03091377 100%
  );
}
.hud-top {
  position: absolute;
  left: 30px;
  right: 30px;
  top: 26px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  z-index: 8;
  pointer-events: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  letter-spacing: 0.13em;
  font-weight: 800;
  text-shadow: 0 1px 8px #000;
}
.brand span:not(.brand-mark) {
  color: var(--cyan);
}
.brand-mark {
  font-size: 35px;
  line-height: 40px;
  color: var(--cyan);
  border-right: 1px solid #ffffff33;
  padding-right: 13px;
}
.brand small {
  display: block;
  font: 8px monospace;
  letter-spacing: 0.27em;
  color: var(--muted);
  margin-top: 5px;
}
.top-actions {
  display: flex;
  gap: 7px;
  pointer-events: auto;
}
.top-actions button {
  font: 10px monospace;
  letter-spacing: 0.08em;
  background: #07121ccc;
  padding: 10px 13px;
}
.top-actions span {
  color: var(--cyan);
  margin-left: 8px;
}
.run-timer {
  text-align: center;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.run-timer small {
  font: 10px monospace;
  letter-spacing: 0.16em;
  color: var(--cyan);
}
.run-timer strong {
  display: block;
  font: 36px monospace;
  font-weight: 600;
  letter-spacing: 0.05em;
  margin-top: 5px;
}
.run-timer > span {
  font: 9px monospace;
  letter-spacing: 0.18em;
  color: var(--muted);
}
.xp-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 3px;
  background: #122634;
  z-index: 4;
}
.xp-track > div {
  height: 100%;
  background: var(--cyan);
  width: 0;
  box-shadow: 0 0 12px #5ef1ff;
}
.xp-track > span {
  position: absolute;
  left: 30px;
  top: 83px;
  font: 10px monospace;
  letter-spacing: 0.15em;
  color: var(--cyan);
}
.status-panel {
  position: absolute;
  left: 30px;
  bottom: 95px;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 275px;
  pointer-events: none;
}
.status-panel img {
  width: 60px;
  height: 68px;
  object-fit: cover;
  border: 1px solid #335765;
  clip-path: polygon(0 0, 85% 0, 100% 15%, 100% 100%, 0 100%);
}
.status-panel > div {
  flex: 1;
}
.status-panel strong {
  font-size: 12px;
  letter-spacing: 0.16em;
}
.status-panel small {
  display: block;
  font: 8px monospace;
  color: var(--muted);
  letter-spacing: 0.16em;
  margin: 4px 0 9px;
}
.meter {
  height: 12px;
  background: #081018cc;
  border: 1px solid #58687944;
  position: relative;
  margin-top: 5px;
}
.meter i {
  position: absolute;
  inset: 0;
  right: auto;
  width: 100%;
  background: #8cbf9b;
}
.meter.shield i {
  background: #619fb7;
}
.meter span {
  position: relative;
  display: block;
  text-align: center;
  font: 8px monospace;
  color: #fff;
  line-height: 10px;
  text-shadow: 0 1px 2px #000;
}
.run-stats {
  position: absolute;
  right: 30px;
  top: 112px;
  display: flex;
  gap: 25px;
  text-align: right;
}
.run-stats small {
  font: 9px monospace;
  letter-spacing: 0.13em;
  color: var(--muted);
  display: block;
}
.run-stats b {
  font: 25px monospace;
  color: #e8f1ef;
}
.hud-bottom {
  position: absolute;
  bottom: 21px;
  left: 30px;
  right: 30px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  pointer-events: none;
}
.weapon-bar {
  display: flex;
  gap: 5px;
  position: absolute;
  left: 0;
  bottom: 8px;
}
.weapon-slot {
  width: 42px;
  height: 42px;
  border: 1px solid #284658;
  background: #091620da;
  position: relative;
  display: grid;
  place-items: center;
}
.weapon-slot small {
  position: absolute;
  right: 3px;
  bottom: 1px;
  font: 8px monospace;
  color: #fff;
}
.weapon-slot.empty {
  border-style: dashed;
  opacity: 0.4;
}
.controls-hint {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  white-space: nowrap;
  font: 8px monospace;
  letter-spacing: 0.08em;
  color: #9bacba;
}
.controls-hint span {
  margin: 0 10px;
  color: #4f6579;
}
kbd {
  border: 1px solid #61738766;
  border-radius: 2px;
  padding: 3px 4px;
  margin-right: 2px;
  font: 9px monospace;
}
.wasm-status {
  font: 8px monospace;
  letter-spacing: 0.15em;
  color: #6f8f9c;
  margin-left: auto;
}
.wasm-status:before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 4px;
  background: var(--cyan);
  border-radius: 50%;
  margin-right: 7px;
}
.entry-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: linear-gradient(
    90deg,
    #07101af7 0%,
    #07101aee 20%,
    #07101aad 41%,
    #07101a20 68%,
    transparent 100%
  );
  pointer-events: none;
  display: flex;
  align-items: center;
  padding: 110px 6vw 70px;
}
.entry-card {
  width: 470px;
  max-width: 100%;
  pointer-events: auto;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font: 9px monospace;
  letter-spacing: 0.15em;
  color: var(--cyan);
}
.signal-dot {
  width: 5px;
  height: 5px;
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 9px var(--cyan);
}
.entry-coord {
  margin-left: auto;
  color: var(--muted);
  font-size: 8px;
}
.entry-card h1 {
  font-size: clamp(46px, 5.5vw, 82px);
  font-weight: 900;
  line-height: 0.97;
  letter-spacing: -0.045em;
  margin: 29px 0 24px;
}
.entry-card h1 em {
  font-style: normal;
  color: var(--cyan);
}
.entry-card p {
  color: #9caebe;
  font-size: 14px;
  line-height: 1.85;
  margin-bottom: 29px;
}
.entry-rule {
  width: 45px;
  height: 2px;
  background: var(--cyan);
  margin: 22px 0;
}
.deployment-line {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  font: 9px monospace;
  letter-spacing: 0.1em;
  margin: 25px 0 17px;
}
.deployment-line span:first-child {
  width: 100%;
  color: var(--muted);
}
.deployment-line span:last-child {
  margin-left: auto;
  color: var(--muted);
}
.deployment-line b {
  color: #c2d7df;
}
.entry-card .primary {
  width: 100%;
  font-size: 12px;
}
.entry-note {
  display: block;
  font: 8px monospace;
  letter-spacing: 0.07em;
  color: #637e8c;
  text-align: center;
  margin-top: 15px;
}
.entry-side {
  position: absolute;
  right: 4vw;
  bottom: 23%;
  font: 9px monospace;
  letter-spacing: 0.16em;
  line-height: 1.8;
  text-align: right;
  color: #8fb3c5;
  display: flex;
  flex-direction: column;
  gap: 30px;
}
.modal {
  position: absolute;
  inset: 0;
  z-index: 12;
  background: #030913bf;
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 35px;
}
.modal-shell {
  width: min(1160px, 100%);
  max-height: calc(100dvh - 70px);
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #101c29, #080e18);
  border: 1px solid #314353;
  box-shadow: 0 20px 100px #0008;
}
.modal-shell > header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 24px 28px;
}
.modal-shell > header small {
  font: 9px monospace;
  color: var(--cyan);
  letter-spacing: 0.18em;
}
.modal-shell h2 {
  margin: 7px 0 0;
  font-size: 24px;
  letter-spacing: -0.015em;
}
.modal-shell > header button {
  border: 0;
  background: transparent;
  font-size: 18px;
  color: var(--muted);
}
#modal-body {
  overflow: auto;
  padding: 26px 28px;
  overscroll-behavior: contain;
  min-height: 0;
}
#menu-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 20px;
  gap: 4px;
  overflow: auto;
  flex-shrink: 0;
}
#menu-tabs:empty {
  display: none;
}
#menu-tabs button {
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  font: 10px monospace;
  letter-spacing: 0.1em;
  padding: 16px 12px;
  white-space: nowrap;
}
#menu-tabs button.active {
  border-color: var(--cyan);
  color: var(--cyan);
}
.section-intro {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  margin: 0 0 24px;
}
.section-intro strong {
  color: var(--text);
}
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px;
}
.card {
  border: 1px solid var(--line);
  background: #0f1a27;
  padding: 17px;
  position: relative;
  text-align: left;
  overflow: hidden;
}
.card.selected {
  border-color: var(--cyan);
  background: #152a36;
}
.card h3 {
  margin: 12px 0 6px;
  font-size: 16px;
}
.card small,
.eyetag {
  font: 9px monospace;
  letter-spacing: 0.09em;
  color: var(--muted);
}
.card p {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}
.card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  margin-bottom: 5px;
}
.card .cost {
  font: 11px monospace;
  color: var(--gold);
  margin-top: 12px;
}
.pilot-card {
  padding: 10px;
}
.pilot-card h3,
.pilot-card p,
.pilot-card small {
  margin-left: 7px;
  margin-right: 7px;
}
.pilot-card.locked {
  filter: saturate(0.35);
  opacity: 0.6;
}
.stage-grid {
  grid-template-columns: repeat(2, 1fr);
}
.stage-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 15px;
}
.stage-number {
  font: 32px monospace;
  color: var(--cyan);
}
.stage-card h3 {
  margin: 0;
}
.stage-card p {
  margin: 6px 0;
}
.stage-card small {
  font-size: 9px;
}
.stage-card:disabled {
  opacity: 0.4;
}
.actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
  align-items: center;
}
.actions .primary {
  min-width: 220px;
}
.actions label {
  font: 11px monospace;
  color: var(--muted);
}
select,
input {
  border: 1px solid #3b5163;
  border-radius: 0;
  background: #091522;
  color: var(--text);
  padding: 12px;
}
.balance-strip {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  font: 11px monospace;
  color: var(--muted);
  padding: 15px 0;
}
.balance-strip b {
  color: var(--cyan);
}
.tree-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 22px;
}
.tree-wrap {
  border: 1px solid var(--line);
  background: radial-gradient(circle, #15304255, #07101b 65%);
  overflow: auto;
  max-height: 62vh;
}
.tree-wrap svg {
  display: block;
  width: 100%;
  min-width: 470px;
  max-height: 730px;
}
.tree-node {
  cursor: pointer;
}
.tree-node circle {
  transition:
    fill 0.15s,
    stroke 0.15s;
}
.tree-node:hover circle {
  stroke: #fff;
  stroke-width: 3;
}
.tree-info {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}
.tree-info h3 {
  color: var(--text);
}
.tree-info .big-value {
  font-size: 44px;
  color: var(--cyan);
  font-weight: 700;
}
.tree-info ul {
  padding-left: 18px;
}
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.stat {
  border: 1px solid var(--line);
  padding: 10px;
  font: 10px monospace;
  color: var(--muted);
}
.stat b {
  display: block;
  color: var(--text);
  font-size: 18px;
  margin-top: 5px;
}
.loadout-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 22px;
}
.weapon-select {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.weapon-select button {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: left;
  font-size: 12px;
  padding: 10px;
}
.weapon-select button.active {
  border-color: var(--cyan);
}
.socket-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.socket {
  flex: 1;
  border: 1px dashed #476070;
  min-height: 90px;
  padding: 10px;
  text-align: center;
  font: 10px monospace;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.socket.filled {
  border-style: solid;
}
.gem-grid {
  grid-template-columns: repeat(3, 1fr);
}
.gem-card h3 {
  font-size: 13px;
  margin-top: 8px;
}
.gem-card p {
  font-size: 11px;
}
.gem-card .actions {
  gap: 5px;
  margin-top: 12px;
}
.gem-card button {
  font: 9px monospace;
  padding: 7px;
}
.gem-card.equipped {
  border-color: #496d63;
}
.gem-card.incompatible {
  opacity: 0.48;
}
.gem-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.module-icon {
  width: 26px;
  height: 24px;
  border: 3px solid var(--gem);
  border-radius: 3px;
  background:
    repeating-linear-gradient(90deg, transparent 0 4px, var(--gem) 4px 6px),
    #132434;
  box-shadow: inset 0 0 0 4px #132434;
}
.upgrade-grid {
  grid-template-columns: repeat(3, 1fr);
}
.upgrade-card {
  min-height: 215px;
}
.upgrade-card .upgrade-icon {
  margin: 7px 0 22px;
}
.upgrade-card .eyetag {
  color: var(--cyan);
}
.upgrade-card:hover {
  transform: translateY(-4px);
}
.auth-form {
  max-width: 420px;
  margin: 5px auto 25px;
}
.auth-form label {
  display: block;
  font: 10px monospace;
  color: var(--muted);
  letter-spacing: 0.1em;
  margin-top: 20px;
}
.auth-form input {
  width: 100%;
  margin-top: 7px;
}
.auth-form .primary {
  width: 100%;
  margin-top: 25px;
  font-size: 11px;
}
.auth-form p {
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}
.auth-form .text-button {
  border: 0;
  background: transparent;
  color: var(--cyan);
  font-size: 12px;
  padding: 9px 0;
}
.error {
  color: var(--red) !important;
}
.summary-title {
  font-size: 40px;
  margin: 4px 0 15px;
  letter-spacing: -0.025em;
}
.summary-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 22px 0;
}
.summary-stats div {
  border: 1px solid var(--line);
  padding: 18px;
}
.summary-stats small {
  font: 9px monospace;
  color: var(--muted);
}
.summary-stats b {
  display: block;
  font: 30px monospace;
  color: var(--cyan);
  margin-top: 8px;
}
.codex {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}
.codex h3 {
  color: var(--text);
  margin-top: 28px;
}
.codex code {
  color: var(--cyan);
  font: 12px monospace;
}
.codex a {
  color: var(--cyan);
}
.codex table {
  border-collapse: collapse;
  width: 100%;
  font-size: 11px;
}
.codex td,
.codex th {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 10px;
}
.codex th {
  color: var(--text);
}
#toast {
  position: absolute;
  z-index: 25;
  bottom: 85px;
  left: 50%;
  transform: translateX(-50%);
  max-width: min(90vw, 650px);
  padding: 14px 20px;
  background: #132b37;
  border: 1px solid #56828a;
  font-size: 12px;
  box-shadow: 0 8px 30px #000a;
}
#boot-error {
  position: absolute;
  inset: 30%;
  z-index: 30;
  border: 1px solid var(--red);
  background: var(--panel);
  padding: 25px;
  color: var(--red);
  font-size: 14px;
  line-height: 1.6;
}
#boss {
  position: absolute;
  top: 128px;
  left: 50%;
  transform: translateX(-50%);
  width: min(400px, 65vw);
  text-align: center;
}
#boss small {
  font: 10px monospace;
  letter-spacing: 0.2em;
  color: var(--red);
}
#boss > div {
  height: 5px;
  background: #361a24;
  margin-top: 8px;
}
#boss i {
  display: block;
  background: var(--red);
  height: 100%;
  width: 100%;
}
#joystick {
  display: none;
  position: absolute;
  bottom: 120px;
  left: 26px;
  width: 110px;
  height: 110px;
  border: 1px solid #8bdeec66;
  border-radius: 50%;
  background: #2d6d8315;
  touch-action: none;
  z-index: 4;
}
#joystick > div {
  position: absolute;
  left: 36px;
  top: 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #89deef44;
  border: 1px solid #a8eaff66;
}
.empty-state {
  padding: 30px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.danger-note {
  font-size: 11px;
  color: var(--gold);
  line-height: 1.6;
}
.loadout-stats {
  font: 11px monospace;
  color: var(--cyan);
  line-height: 1.8;
}
.tree-svg-text {
  font-family: monospace;
  font-size: 9px;
  fill: #a6bcc7;
}
.pause-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
}
.paused-title {
  font-size: 52px;
  margin: 20px 0 12px;
}
.pause-grid p {
  color: var(--muted);
  line-height: 1.7;
  font-size: 13px;
}
.runs-note {
  font: 10px monospace;
  letter-spacing: 0.07em;
  color: var(--gold);
}
.league-entry {
  display: grid;
  gap: 7px;
  margin: 16px 0;
  padding-left: 12px;
  border-left: 2px solid var(--cyan);
  font: 10px monospace;
  letter-spacing: 0.05em;
}
.league-entry strong {
  color: var(--cyan);
}
.league-entry small {
  color: var(--muted);
  line-height: 1.5;
}
.league-entry button {
  justify-self: start;
}
.league-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 18px 0;
}
.league-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.league-card.selected {
  border-color: var(--cyan);
}
.league-card h3 {
  font-size: 28px;
  margin: 5px 0;
}
.league-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.league-card .league-progress {
  color: var(--gold);
  font: 12px monospace;
}
.league-card button {
  margin-top: auto;
  width: 100%;
}
.league-transfer-note {
  border-left: 2px solid var(--gold);
  padding: 12px 16px;
  color: var(--gold);
  background: #ffbc7108;
  font-size: 12px;
  line-height: 1.7;
}
.ladder-heading {
  display: flex;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 28px;
}
.ladder-heading h3 {
  margin-right: auto;
}
.ladder-heading label {
  color: var(--muted);
  font: 11px monospace;
}
.ladder-heading select {
  background: var(--panel);
  color: var(--text);
  padding: 9px;
  border: 1px solid var(--line);
}
.ladder-heading select:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 3px;
}
.ladder-disclaimer {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}
.ladder-summary {
  font: 12px monospace;
  color: var(--cyan);
  line-height: 1.8;
}
.ladder-scroll {
  overflow-x: auto;
}
.ladder-table {
  width: 100%;
  min-width: 540px;
  border-collapse: collapse;
  font: 12px monospace;
}
.ladder-table th,
.ladder-table td {
  text-align: left;
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
}
.ladder-table th {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.06em;
}
.ladder-table .own-rank {
  color: var(--cyan);
  background: #71eff210;
}
.ladder-empty {
  padding: 28px;
  border: 1px dashed var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}
.transfer-stash {
  margin-top: 32px;
  border-top: 1px solid var(--line);
  padding-top: 15px;
}
.transfer-stash > p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

@media (max-width: 1050px) {
  .brand {
    font-size: 13px;
  }
  .brand-mark {
    font-size: 28px;
  }
  .top-actions button {
    font-size: 9px;
    padding: 10px;
  }
  .run-timer strong {
    font-size: 28px;
  }
  .hud-top {
    left: 20px;
    right: 20px;
  }
  .run-timer small {
    font-size: 8px;
  }
  .top-actions #sound-button {
    display: none;
  }
  .controls-hint {
    font-size: 7px;
    bottom: 0;
  }
  .entry-card {
    width: 420px;
  }
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .stage-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .gem-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .upgrade-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 700px) {
  .hud-top {
    top: 20px;
    left: 15px;
    right: 15px;
    gap: 8px;
  }
  .brand {
    font-size: 10px;
    letter-spacing: 0.04em;
    gap: 7px;
  }
  .brand small {
    font-size: 6px;
  }
  .brand-mark {
    font-size: 23px;
    padding-right: 7px;
  }
  .top-actions button {
    font-size: 8px;
    padding: 8px;
  }
  .top-actions #mode-button span {
    display: none;
  }
  .run-timer {
    top: 54px;
  }
  .run-timer strong {
    font-size: 25px;
  }
  .run-stats {
    top: 105px;
    right: 15px;
    gap: 15px;
  }
  .run-stats b {
    font-size: 18px;
  }
  .run-stats small {
    font-size: 7px;
  }
  .xp-track > span {
    top: 75px;
    left: 15px;
    font-size: 8px;
  }
  .entry-overlay {
    padding: 150px 25px 100px;
    background: linear-gradient(90deg, #07101af2, #07101a9f);
    align-items: center;
  }
  .entry-card h1 {
    font-size: clamp(40px, 11vw, 65px);
    margin: 20px 0;
  }
  .entry-card p {
    font-size: 12px;
    margin-bottom: 16px;
  }
  .entry-side {
    display: none;
  }
  .entry-coord {
    font-size: 7px;
  }
  .entry-rule {
    margin: 15px 0;
  }
  .deployment-line {
    margin: 18px 0 12px;
  }
  .entry-card .primary {
    padding: 17px 20px;
  }
  .status-panel {
    left: 15px;
    bottom: 74px;
    width: 215px;
    gap: 7px;
  }
  .status-panel img {
    width: 45px;
    height: 55px;
  }
  .status-panel strong {
    font-size: 10px;
  }
  .status-panel small {
    font-size: 7px;
    margin-bottom: 5px;
  }
  .hud-bottom {
    left: 15px;
    right: 15px;
    bottom: 16px;
  }
  .weapon-bar {
    bottom: 0;
  }
  .weapon-slot {
    width: 33px;
    height: 33px;
  }
  .weapon-slot svg {
    width: 23px;
    height: 23px;
  }
  .controls-hint {
    display: none;
  }
  .wasm-status {
    font-size: 6px;
    max-width: 100px;
    text-align: right;
  }
  .modal {
    padding: 10px;
  }
  .modal-shell {
    max-height: calc(100dvh - 20px);
  }
  .modal-shell > header {
    padding: 17px;
  }
  .modal-shell h2 {
    font-size: 21px;
  }
  #modal-body {
    padding: 17px;
  }
  #menu-tabs {
    padding: 0 6px;
  }
  #menu-tabs button {
    padding: 13px 10px;
    font-size: 9px;
  }
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
  }
  .card {
    padding: 12px;
  }
  .card h3 {
    font-size: 14px;
  }
  .stage-grid {
    grid-template-columns: 1fr;
  }
  .tree-layout {
    grid-template-columns: 1fr;
  }
  .tree-info {
    order: -1;
  }
  .tree-info .stats-grid {
    display: none;
  }
  .tree-info ul {
    display: none;
  }
  .tree-info h3 {
    margin: 0;
  }
  .tree-info .big-value {
    font-size: 28px;
  }
  .tree-wrap {
    max-height: 45vh;
  }
  .loadout-layout {
    grid-template-columns: 1fr;
  }
  .weapon-select {
    flex-direction: row;
    overflow: auto;
  }
  .weapon-select button {
    flex-shrink: 0;
    font-size: 10px;
  }
  .weapon-select button svg {
    width: 20px;
  }
  .gem-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .socket-row {
    gap: 5px;
  }
  .socket {
    font-size: 8px;
    padding: 7px;
    min-height: 75px;
  }
  .upgrade-grid {
    grid-template-columns: 1fr;
  }
  .upgrade-card {
    min-height: 120px;
    display: grid;
    grid-template-columns: 45px 1fr;
    gap: 12px;
  }
  .upgrade-card .upgrade-icon {
    grid-row: span 3;
    margin: 0;
  }
  .upgrade-card h3,
  .upgrade-card p {
    margin: 0;
  }
  .summary-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .summary-stats b {
    font-size: 24px;
  }
  .pause-grid {
    grid-template-columns: 1fr;
  }
  .paused-title {
    font-size: 36px;
    margin: 0;
  }
  .balance-strip {
    gap: 10px;
    font-size: 10px;
  }
  .codex table {
    font-size: 9px;
  }
  .codex td {
    padding: 7px;
  }
  .actions .primary {
    min-width: 180px;
    font-size: 10px;
  }
  .entry-note {
    font-size: 7px;
  }
  .eyebrow {
    font-size: 8px;
  }
}
@media (pointer: coarse) {
  #joystick {
    display: block;
  }
  .status-panel {
    bottom: 24px;
    left: auto;
    right: 15px;
  }
  .weapon-bar {
    bottom: 65px;
    left: auto;
    right: 0;
  }
  .wasm-status {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
@media (max-width: 700px) {
  .league-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .league-card h3 {
    font-size: 23px;
  }
  .league-entry {
    font-size: 9px;
    margin: 12px 0;
  }
  .top-actions {
    gap: 4px;
  }
  .top-actions #league-button {
    max-width: 76px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .ladder-heading {
    gap: 8px;
  }
  .ladder-heading h3 {
    flex-basis: 100%;
    margin-bottom: 0;
  }
}
.attachment-xp {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  background: var(--cyan);
}
