* {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

:root {
  --font-pixel: Consolas, "Courier New", monospace;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 48% 42%, rgba(255, 48, 117, 0.08), transparent 38%),
    repeating-linear-gradient(0deg, rgba(69, 245, 223, 0.035) 0 1px, transparent 1px 6px),
    #050407;
  color: #f3f6ff;
  font-family: var(--font-pixel);
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  background: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

/* Off-screen but not display:none — some browsers defer or skip autoplay on fully hidden nodes. */
.title-menu-audio {
  position: fixed;
  left: -32000px;
  top: 0;
  width: 120px;
  height: 40px;
  opacity: 0.02;
  pointer-events: none;
}

.gui-template {
  position: fixed;
  inset: 0;
  z-index: 2;
  width: 100vw;
  height: 100vh;
  object-fit: fill;
  pointer-events: none;
  -webkit-user-drag: none;
  image-rendering: pixelated;
  opacity: 0.88;
}

body.pointer-locked,
body.pointer-locked canvas {
  cursor: none;
}

body:not(.hud-game) .gui-template,
body.tutorial-active .gui-template {
  display: none !important;
}

.hud {
  position: fixed;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.title-screen,
.menu-shell {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: auto;
}

.title-screen {
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(0deg, rgba(69, 245, 223, 0.045) 0 1px, transparent 1px 6px),
    radial-gradient(circle at 50% 48%, rgba(255, 48, 117, 0.14), transparent 38%),
    rgba(5, 4, 7, 0.88);
  cursor: pointer;
  text-align: center;
}

.title-lockup {
  animation: titlePulse 2.4s ease-in-out infinite;
}

.title-kicker {
  margin: 0 0 10px;
  color: #45f5df;
  font-family: Consolas, "Courier New", monospace;
  font-size: clamp(12px, 1.1vw, 16px);
  font-weight: 900;
  letter-spacing: 0.32em;
}

.title-screen h1 {
  margin: 0;
  color: #f3f6ff;
  font-size: clamp(56px, 10vw, 154px);
  line-height: 0.85;
  text-shadow: 4px 0 #ff3075, -4px 0 #45f5df, 0 0 38px rgba(255, 48, 117, 0.42);
}

.click-continue {
  position: absolute;
  bottom: clamp(46px, 7vh, 78px);
  margin: 0;
  color: rgba(243, 246, 255, 0.58);
  font-family: Consolas, "Courier New", monospace;
  font-size: clamp(12px, 1vw, 16px);
  font-weight: 800;
  animation: continueBlink 1.25s ease-in-out infinite;
}

.title-screen.exiting {
  animation: titleExit 0.42s ease forwards;
}

.menu-shell {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: rgba(5, 4, 7, 0.64);
}

.menu-track {
  position: relative;
  display: grid;
  width: min(760px, calc(100vw - 48px));
  min-height: min(560px, calc(100vh - 80px));
}

.menu-card {
  width: 100%;
  min-height: min(560px, calc(100vh - 80px));
  margin: auto;
  padding: clamp(28px, 4vw, 54px);
  border: 1px solid rgba(69, 245, 223, 0.58);
  background: rgba(8, 8, 12, 0.9);
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.58), inset 0 0 0 1px rgba(255, 48, 117, 0.22);
  opacity: 1;
  transform: scale(1);
}

.menu-card.active {
  animation: menuEnter 0.34s ease forwards;
}

.menu-card h2 {
  margin: 0 0 30px;
  font-size: clamp(46px, 7vw, 92px);
  line-height: 0.9;
}

.menu-button {
  display: block;
  width: 100%;
  min-height: 62px;
  margin-top: 12px;
  border: 1px solid rgba(69, 245, 223, 0.46);
  background: rgba(69, 245, 223, 0.08);
  color: #f3f6ff;
  cursor: pointer;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  padding: 0 22px;
  font-size: clamp(14px, 1.1vw, 18px);
}

.menu-button:hover {
  border-color: #ff3075;
  background: rgba(255, 48, 117, 0.16);
}

.menu-button.primary-run {
  min-height: 78px;
  border-color: rgba(255, 48, 117, 0.76);
  background:
    linear-gradient(90deg, rgba(255, 48, 117, 0.24), rgba(69, 245, 223, 0.08)),
    rgba(8, 8, 12, 0.82);
  color: #ffffff;
  font-size: clamp(16px, 1.35vw, 22px);
  text-shadow: 0 0 14px rgba(255, 48, 117, 0.36);
}

.menu-button.back {
  margin-top: 20px;
  color: #ffc44b;
}

.level-buttons {
  display: grid;
  gap: 10px;
}

.menu-copy {
  color: #cbd4e8;
  line-height: 1.55;
}

@keyframes titlePulse {
  0%, 100% { transform: translateY(0) scale(1); filter: saturate(1); }
  50% { transform: translateY(-4px) scale(1.015); filter: saturate(1.25); }
}

@keyframes continueBlink {
  0%, 100% { opacity: 0.34; }
  50% { opacity: 0.84; }
}

@keyframes titleExit {
  to { opacity: 0; transform: scale(1.08); }
}

@keyframes menuEnter {
  to { opacity: 1; transform: scale(1); }
}

body.game-flicker-in canvas,
body.game-flicker-in .gui-template,
body.game-flicker-in .hud {
  animation: gameOpacityFlickerIn 0.55s steps(1, end) both;
}

@keyframes gameOpacityFlickerIn {
  0% { opacity: 0.72; }
  18% { opacity: 0.9; }
  28% { opacity: 0.78; }
  43% { opacity: 0.96; }
  55% { opacity: 0.86; }
  74% { opacity: 0.98; }
  100% { opacity: 1; }
}

.topbar {
  position: absolute;
  top: clamp(22px, 4.3vh, 40px);
  left: clamp(34px, 3.8vw, 64px);
  right: clamp(32px, 3.65vw, 70px);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9), 0 0 12px rgba(69, 245, 223, 0.24);
}

.topbar > div:first-child {
  min-width: 0;
  width: min(38vw, 620px);
}

body:not(.hud-game) .topbar,
body.tutorial-active .topbar,
body:not(.hud-game) .run-level,
body.tutorial-active .run-level,
body:not(.hud-game) .best-distance-hud,
body.tutorial-active .best-distance-hud,
body:not(.hud-game) .startup-tutorial,
body:not(.hud-game) .keybinds,
body.tutorial-active .keybinds {
  display: none !important;
}

.topbar h1,
.panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  max-width: 100%;
  overflow: hidden;
  color: #f3f6ff;
  font-family: var(--font-pixel);
  font-size: clamp(17px, 1.55vw, 28px);
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eyebrow {
  margin: 0 0 5px;
  color: #45f5df;
  font-family: var(--font-pixel);
  font-size: clamp(9px, 0.62vw, 11px);
  font-weight: 800;
  letter-spacing: 0.18em;
}

.stats {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 0.78fr) minmax(0, 1.54fr);
  width: clamp(310px, 22vw, 440px);
  gap: clamp(10px, 0.78vw, 16px);
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
  padding-top: 2px;
}

.stats span {
  display: grid;
  min-width: 0;
  min-height: clamp(36px, 4.5vh, 50px);
  padding: clamp(12px, 1.2vh, 16px) 8px 0 clamp(18px, 1.25vw, 24px);
  align-items: start;
  justify-items: start;
  border: 0;
  background: transparent;
  color: #f3f6ff;
  font-family: var(--font-pixel);
  font-size: clamp(16px, 1.12vw, 22px);
  font-weight: 900;
  line-height: 1.05;
  overflow: hidden;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: 0 0 10px rgba(69, 245, 223, 0.34);
  white-space: nowrap;
}

#ammo {
  font-size: clamp(14px, 0.9vw, 18px);
  padding-left: clamp(18px, 1.1vw, 22px);
}

#score,
#combo {
  font-size: clamp(17px, 1.22vw, 24px);
  padding-left: clamp(20px, 1.35vw, 26px);
}

.run-level {
  position: absolute;
  top: clamp(94px, 11vh, 124px);
  left: clamp(38px, 4vw, 72px);
  min-width: 118px;
  padding: 8px 12px 9px;
  border-left: 4px solid #ff3075;
  background: linear-gradient(90deg, rgba(8, 8, 12, 0.76), rgba(8, 8, 12, 0.18));
  color: #45f5df;
  font-family: Consolas, "Courier New", monospace;
  font-size: clamp(12px, 0.95vw, 15px);
  font-weight: 950;
  letter-spacing: 0.11em;
  text-shadow: 2px 0 #ff3075, 0 0 14px rgba(69, 245, 223, 0.34);
}

.best-distance-hud {
  position: absolute;
  top: clamp(152px, 18vh, 210px);
  right: clamp(46px, 4.2vw, 82px);
  width: clamp(238px, 16vw, 330px);
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px 18px 12px 44px;
  color: #f3f6ff;
  font-family: var(--font-pixel);
  text-align: left;
  text-transform: uppercase;
  text-shadow: 0 2px 10px #000, 0 0 12px rgba(69, 245, 223, 0.22);
}

.best-distance-hud::before,
.best-distance-hud::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.best-distance-hud::before {
  inset: 0;
  border: 2px solid rgba(255, 196, 75, 0.88);
  background:
    linear-gradient(90deg, rgba(255, 196, 75, 0.2), transparent 30%),
    rgba(5, 4, 7, 0.72);
  box-shadow: 0 0 18px rgba(255, 196, 75, 0.18), inset 0 0 0 1px rgba(69, 245, 223, 0.2);
}

.best-distance-hud::after {
  left: 8px;
  top: 10px;
  bottom: 10px;
  width: 22px;
  background:
    linear-gradient(45deg, #ffc44b 25%, #08080c 25% 50%, #ffc44b 50% 75%, #08080c 75%) 0 0 / 18px 18px;
}

.best-distance-hud span,
.best-distance-hud strong {
  position: relative;
  z-index: 1;
}

.best-distance-hud span {
  color: #45f5df;
  font-size: clamp(10px, 0.72vw, 13px);
  font-weight: 900;
  letter-spacing: 0.12em;
}

.best-distance-hud strong {
  color: #ffc44b;
  font-size: clamp(22px, 1.65vw, 32px);
  line-height: 0.95;
  text-shadow: 2px 0 #ff3075, 0 0 18px rgba(255, 196, 75, 0.34);
}

.panel {
  position: absolute;
  pointer-events: auto;
  border: 1px solid rgba(255, 48, 117, 0.7);
  background: rgba(8, 8, 12, 0.86);
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.55), 0 0 34px rgba(255, 48, 117, 0.17);
  backdrop-filter: blur(14px);
}

.briefing {
  left: 50%;
  top: 50%;
  width: min(680px, calc(100vw - 34px));
  max-height: calc(100vh - 34px);
  padding: 24px;
  transform: translate(-50%, -50%);
  overflow: auto;
}

.panel h2 {
  font-size: clamp(30px, 6vw, 58px);
  line-height: 0.95;
}

.panel p {
  color: #d8ddef;
  line-height: 1.55;
}

.mask-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.mask-card {
  min-height: 156px;
  padding: 14px;
  border: 1px solid rgba(243, 246, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: #f3f6ff;
  cursor: pointer;
  text-align: left;
}

.mask-card.active {
  border-color: #45f5df;
  background: rgba(69, 245, 223, 0.12);
  box-shadow: inset 0 0 0 1px rgba(69, 245, 223, 0.24), 0 0 26px rgba(69, 245, 223, 0.16);
}

.mask-face {
  display: block;
  margin-bottom: 10px;
  color: #ff3075;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 38px;
  font-weight: 900;
}

.mask-card strong {
  display: block;
  font-size: 18px;
}

.mask-card span {
  display: block;
  margin-top: 8px;
  color: #c7cde0;
  font-size: 13px;
  line-height: 1.4;
}

.menu-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary,
.secondary {
  width: 100%;
  min-height: 48px;
  border: 0;
  cursor: pointer;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.primary {
  background: #ff3075;
  color: #08080c;
}

.secondary {
  border: 1px solid rgba(69, 245, 223, 0.72);
  background: rgba(69, 245, 223, 0.09);
  color: #f3f6ff;
  box-shadow: inset 0 0 0 1px rgba(69, 245, 223, 0.16), 0 0 20px rgba(69, 245, 223, 0.12);
}

.skill-tree {
  inset: 0;
  z-index: 9;
  padding: clamp(24px, 3vw, 42px);
  border: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(69, 245, 223, 0.08), transparent 35%),
    radial-gradient(circle at 48% 42%, rgba(255, 48, 117, 0.08), transparent 44%),
    repeating-linear-gradient(0deg, rgba(243, 246, 255, 0.025) 0 1px, transparent 1px 5px),
    #07101a;
  box-shadow: none;
  backdrop-filter: none;
  color: #f3f1ea;
  font-family: Consolas, "Courier New", monospace;
  pointer-events: auto;
}

.skill-title {
  position: absolute;
  left: clamp(28px, 3.2vw, 52px);
  top: clamp(22px, 2.7vw, 42px);
  margin: 0;
  color: #ff3b82;
  font-size: clamp(36px, 4.5vw, 74px);
  line-height: 0.9;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 4px 0 rgba(255, 48, 117, 0.22), 0 0 22px rgba(255, 48, 117, 0.38);
}

.skill-subtitle {
  position: absolute;
  left: clamp(30px, 3.4vw, 56px);
  top: clamp(82px, 7.5vw, 112px);
  margin: 0;
  color: #2ff6e8;
  font-family: Consolas, "Courier New", monospace;
  font-size: clamp(15px, 1.6vw, 24px);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 0 16px rgba(47, 246, 232, 0.36);
}

.skill-close {
  position: absolute;
  right: clamp(28px, 3vw, 46px);
  top: clamp(24px, 2.8vw, 42px);
  z-index: 3;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 48, 117, 0.75);
  background: rgba(255, 48, 117, 0.08);
  color: #ffb4ce;
  cursor: pointer;
  font-family: Consolas, "Courier New", monospace;
  font-weight: 950;
}

.broker-status {
  display: block;
  margin-top: 14px;
  color: #f3f1ea;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1;
}

.broker-status::before {
  display: inline-block;
  width: 24px;
  height: 24px;
  margin-right: 14px;
  transform: rotate(45deg) translateY(3px);
  border: 3px solid #d783ff;
  content: "";
}

.skill-side {
  position: absolute;
  z-index: 2;
  border: 1px solid rgba(255, 48, 117, 0.54);
  border-radius: 0;
  background: rgba(5, 8, 16, 0.78);
  box-shadow: inset 0 0 0 1px rgba(255, 48, 117, 0.08), 0 16px 48px rgba(0, 0, 0, 0.32);
  color: rgba(243, 241, 234, 0.86);
}

.skill-side h3 {
  margin: 0 0 18px;
  color: #f3f1ea;
  font-size: clamp(17px, 1.5vw, 25px);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.skill-side p {
  margin: 10px 0;
  font-size: clamp(13px, 1.1vw, 18px);
  line-height: 1.35;
}

.skill-terminal-button {
  min-height: 38px;
  border: 1px solid rgba(255, 196, 75, 0.68);
  background: rgba(255, 196, 75, 0.12);
  color: #ffc44b;
  cursor: pointer;
  font-family: Consolas, "Courier New", monospace;
  font-weight: 950;
  text-transform: uppercase;
}

.skill-terminal-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.prestige-result {
  color: #ffc44b;
}

.ability-terminal {
  left: clamp(28px, 3vw, 48px);
  right: auto;
  top: auto;
  bottom: clamp(24px, 3vw, 42px);
  width: min(360px, 30vw);
  max-height: min(38vh, 360px);
  overflow: auto;
  padding: 14px;
}

.ability-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.ability-list.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ability-card {
  padding: 9px;
  border: 1px solid rgba(243, 246, 255, 0.2);
  background: rgba(5, 4, 7, 0.72);
  color: #f3f6ff;
  cursor: pointer;
  font-family: Consolas, "Courier New", monospace;
  text-align: left;
}

.ability-card.equipped {
  box-shadow: 0 0 18px rgba(255, 196, 75, 0.2), inset 0 0 0 1px rgba(255, 196, 75, 0.22);
}

.ability-card strong,
.ability-card span,
.ability-card small {
  display: block;
}

.ability-card span {
  color: #ffc44b;
  font-size: 11px;
  text-transform: uppercase;
}

.ability-card small,
.empty-ability {
  color: rgba(243, 246, 255, 0.72);
  font-size: 11px;
  line-height: 1.3;
}

.skill-resources {
  right: clamp(84px, 6vw, 116px);
  top: clamp(26px, 3vw, 44px);
  display: grid;
  width: auto;
  min-width: 260px;
  gap: 8px;
  align-items: center;
  padding: 13px 18px;
}

.skill-board {
  position: absolute;
  left: clamp(48px, 5vw, 92px);
  right: clamp(390px, 28vw, 480px);
  top: clamp(132px, 14vh, 170px);
  bottom: clamp(72px, 7vh, 96px);
  min-width: 650px;
}

.branch-label {
  position: absolute;
  z-index: 2;
  margin: 0;
  font-size: clamp(14px, 1.25vw, 21px);
  font-weight: 950;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-shadow: 0 0 14px currentColor;
}

.branch-label span,
.branch-label small {
  display: block;
}

.branch-label small {
  margin-top: 5px;
  color: rgba(243, 241, 234, 0.84);
  font-size: clamp(11px, 0.95vw, 16px);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.25;
  text-transform: none;
  text-shadow: none;
}

.branch-offense {
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  color: #ff665f;
}

.branch-broker {
  left: 0;
  top: 46%;
  transform: translate(0, -50%);
  color: #cf76ff;
}

.branch-mobility {
  right: 0;
  top: 46%;
  transform: translate(67%, -50%);
  color: #36dae9;
}

.branch-defense {
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  color: #7bdd54;
}

.skill-nodes {
  position: absolute;
  inset: clamp(28px, 3vh, 44px) 0;
  overflow: visible;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.skill-links {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.skill-links line {
  stroke-width: 4;
  stroke-linecap: square;
}

.skill-links line.dim {
  stroke: rgba(108, 116, 132, 0.38);
  stroke-dasharray: 8 8;
}

.skill-links line.lit {
  filter: drop-shadow(0 0 7px currentColor);
}

.skill-links line.offense {
  stroke: #ff665f;
}

.skill-links line.mobility {
  stroke: #36dae9;
}

.skill-links line.broker {
  stroke: #cf76ff;
}

.skill-links line.defense {
  stroke: #7bdd54;
}

.skill-links line.core {
  stroke: #f3f1ea;
}

.core-rings {
  position: absolute;
  left: 50%;
  top: 50%;
  width: clamp(112px, 11vw, 152px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%) rotate(45deg);
  border: 2px solid rgba(69, 245, 223, 0.8);
  border-radius: 0;
  box-shadow: 0 0 0 18px rgba(69, 245, 223, 0.06), 0 0 42px rgba(69, 245, 223, 0.24);
  pointer-events: none;
}

.skill-card {
  position: absolute;
  z-index: 1;
  width: clamp(44px, 4.3vw, 64px);
  min-height: 0;
  aspect-ratio: 1;
  padding: 0;
  transform: translate(-50%, -50%) rotate(45deg);
  clip-path: none;
  border: 3px solid currentColor;
  border-radius: 0;
  background: rgba(7, 13, 23, 0.92);
  color: #36dae9;
  cursor: pointer;
  text-align: center;
  text-shadow: 0 0 9px currentColor;
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.55), inset 0 0 18px rgba(255, 255, 255, 0.04);
}

.skill-card::before {
  position: absolute;
  inset: 9px;
  border: 2px solid currentColor;
  content: "";
}

.skill-card.offense {
  color: #ff665f;
}

.skill-card.mobility {
  color: #36dae9;
}

.skill-card.broker {
  color: #cf76ff;
}

.skill-card.defense {
  color: #7bdd54;
}

.skill-card.core {
  color: #f3f1ea;
}

.skill-card.locked,
.skill-card.unaffordable {
  color: rgba(132, 138, 151, 0.78);
  filter: none;
}

.skill-card.available {
  color: #00e4e9;
}

.skill-card.purchased {
  color: #ff2f7a;
}

.skill-card.maxed {
  color: #e6fff7;
  box-shadow: 0 0 0 7px rgba(230, 255, 247, 0.1), 0 0 22px rgba(230, 255, 247, 0.3);
}

.skill-card.selected,
.skill-card:hover,
.skill-card:focus-visible {
  color: #ffd84a !important;
  outline: 0;
  box-shadow: 0 0 0 5px rgba(255, 216, 74, 0.12), 0 0 24px rgba(255, 216, 74, 0.42);
}

.skill-card.upgraded {
  animation: nodeUpgradeBounce 0.38s cubic-bezier(0.2, 1.45, 0.32, 1);
}

.skill-card.core-node {
  width: clamp(116px, 11vw, 156px);
  border-width: 2px;
  color: #2ff6e8;
  background: radial-gradient(circle, rgba(47, 246, 232, 0.12), rgba(7, 13, 23, 0.9) 62%);
}

.skill-card.core-node::before {
  inset: 36%;
  background: rgba(47, 246, 232, 0.85);
}

.skill-card strong,
.skill-card span,
.node-glyph {
  position: absolute;
  left: 50%;
  width: max-content;
  max-width: 140px;
  transform: translateX(-50%) rotate(-45deg);
  color: rgba(243, 241, 234, 0.9);
  font-weight: 900;
  text-transform: uppercase;
  pointer-events: none;
}

.node-glyph {
  top: 50%;
  display: grid;
  width: 48px;
  height: 20px;
  place-items: center;
  transform: translate(-50%, -50%) rotate(-45deg);
  color: currentColor;
  font-size: clamp(8px, 0.72vw, 11px);
  line-height: 1;
}

.skill-card strong {
  top: calc(100% + 8px);
  display: none;
  font-size: 11px;
  line-height: 1.1;
}

.skill-card span {
  display: none;
  top: calc(100% + 22px);
  font-size: 10px;
}

.skill-card.core-node strong,
.skill-card.core-node span,
.skill-card:hover strong,
.skill-card:hover span,
.skill-card:focus-visible strong,
.skill-card:focus-visible span {
  display: block;
}

.skill-card.core-node .node-glyph {
  width: 74px;
  height: 24px;
  color: #f3f1ea;
  font-size: clamp(13px, 1.1vw, 18px);
}

@keyframes nodeUpgradeBounce {
  0% {
    transform: translate(-50%, -50%) rotate(45deg) scale(0.82);
    filter: brightness(1.6);
  }
  55% {
    transform: translate(-50%, -50%) rotate(45deg) scale(1.18);
    filter: brightness(1.35);
  }
  100% {
    transform: translate(-50%, -50%) rotate(45deg) scale(1);
    filter: brightness(1);
  }
}

.skill-states,
.skill-controls,
.skill-howread {
  display: none;
}

.skill-states {
  right: clamp(28px, 3vw, 52px);
  top: clamp(76px, 7vh, 116px);
  width: min(300px, 22vw);
  min-width: 230px;
  padding: 18px 22px;
  border-color: rgba(255, 48, 117, 0.5);
  background: rgba(5, 8, 16, 0.78);
}

.skill-states p {
  display: flex;
  gap: 16px;
  align-items: center;
  text-transform: uppercase;
}

.state-dot {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 3px solid currentColor;
  border-radius: 0;
  transform: rotate(45deg);
  background: rgba(255, 255, 255, 0.06);
}

.state-dot.locked {
  color: #777d89;
}

.state-dot.available {
  color: #54e6ff;
}

.state-dot.selected {
  color: #ffd84a;
}

.state-dot.purchased {
  color: #ff2f7a;
}

.state-dot.maxed {
  color: #e6fff7;
  box-shadow: 0 0 0 6px rgba(230, 255, 247, 0.14);
}

.skill-details {
  right: clamp(28px, 3vw, 52px);
  top: clamp(132px, 14vh, 170px);
  width: min(350px, 25vw);
  min-width: 300px;
  min-height: 410px;
  padding: 24px 28px;
}

.skill-footer-hint {
  position: absolute;
  left: clamp(48px, 5vw, 92px);
  right: clamp(390px, 28vw, 480px);
  bottom: clamp(28px, 3vh, 42px);
  margin: 0;
  color: rgba(243, 241, 234, 0.68);
  font-family: Consolas, "Courier New", monospace;
  font-size: clamp(12px, 1vw, 16px);
  text-align: center;
}

.detail-head {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(243, 241, 234, 0.28);
}

.detail-head strong {
  color: #f3f1ea;
  font-size: clamp(18px, 1.6vw, 28px);
  text-transform: uppercase;
}

.detail-head p {
  margin: 5px 0 0;
  color: rgba(243, 241, 234, 0.74);
}

.detail-icon {
  width: 58px;
  height: 58px;
  border: 3px solid #f3f1ea;
  clip-path: polygon(50% 0, 93% 25%, 93% 75%, 50% 100%, 7% 75%, 7% 25%);
}

.detail-icon[data-branch="offense"] {
  border-color: #ff665f;
}

.detail-icon[data-branch="mobility"] {
  border-color: #36dae9;
}

.detail-icon[data-branch="broker"] {
  border-color: #cf76ff;
}

.detail-icon[data-branch="defense"] {
  border-color: #7bdd54;
}

.detail-label {
  color: #4be982;
}

.detail-label.synergy,
.detail-synergy {
  color: #cf76ff;
}

.detail-effect::before,
.detail-synergy::before {
  content: "+ ";
}

.skill-controls {
  right: clamp(28px, 3vw, 52px);
  bottom: clamp(28px, 3vw, 52px);
  width: min(350px, 25vw);
  min-width: 250px;
  padding: 20px 24px;
}

.skill-controls p {
  display: flex;
  gap: 16px;
  align-items: center;
}

.skill-controls kbd {
  display: inline-grid;
  min-width: 38px;
  min-height: 34px;
  padding: 6px;
  place-items: center;
  border: 1px solid rgba(243, 241, 234, 0.38);
  border-radius: 3px;
  background: rgba(243, 241, 234, 0.05);
  color: #f3f1ea;
  font: inherit;
}

.skill-howread {
  left: clamp(28px, 3vw, 52px);
  bottom: clamp(28px, 3vw, 52px);
  width: min(360px, 25vw);
  min-width: 280px;
  padding: 20px 24px;
}

.skill-howread h3 {
  color: #ff2f7a;
  text-align: center;
}

.howread-line {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.howread-line span,
.howread-line b {
  width: 38px;
  height: 38px;
  transform: rotate(45deg);
  border: 2px solid #cf76ff;
  box-shadow: 0 0 16px rgba(207, 118, 255, 0.28);
}

.howread-line b {
  border-color: #ffff33;
}

.howread-line span:last-child {
  border-color: #ff2f7a;
}

.howread-line i {
  width: 46px;
  border-top: 3px solid #2ff6e8;
}

.howread-labels {
  display: flex;
  justify-content: space-around;
  color: #2ff6e8;
  font-size: 13px;
  text-transform: uppercase;
}

.howread-labels em {
  color: inherit;
  font-style: normal;
}

.skill-tip {
  margin-top: 28px;
  color: rgba(243, 241, 234, 0.78);
}

.skill-tip strong {
  color: #ff2f7a;
}

.skill-title,
.skill-subtitle,
.skill-close,
.branch-label,
.skill-footer-hint {
  display: none;
}

.skill-tree {
  background:
    radial-gradient(circle at 50% 52%, rgba(69, 245, 223, 0.1), transparent 24%),
    repeating-linear-gradient(0deg, rgba(243, 246, 255, 0.025) 0 1px, transparent 1px 5px),
    #07101a;
}

.skill-resources {
  right: clamp(26px, 3vw, 52px);
  top: clamp(24px, 3vw, 42px);
  padding: 12px 18px;
  border-color: rgba(255, 48, 117, 0.62);
  background: rgba(5, 8, 16, 0.9);
}

.skill-resources h3 {
  margin: 0;
  color: #f3f1ea;
  font-size: clamp(15px, 1.25vw, 22px);
}

.broker-status {
  margin: 0;
  color: #ff3b82;
  font-size: clamp(18px, 1.6vw, 28px);
}

.broker-status::before {
  width: 13px;
  height: 13px;
  margin-right: 9px;
  border-width: 2px;
}

.skill-board {
  left: 50%;
  right: auto;
  top: 50%;
  bottom: auto;
  width: min(760px, calc(100vw - 180px));
  height: min(620px, calc(100vh - 150px));
  min-width: 0;
  transform: translate(-50%, -50%);
}

.skill-info-tab {
  right: clamp(22px, 3vw, 46px);
  top: 50%;
  width: min(310px, 24vw);
  min-width: 250px;
  min-height: 0;
  padding: 18px 20px;
  transform: translateY(-50%);
  border-color: rgba(69, 245, 223, 0.55);
  background: rgba(5, 8, 16, 0.88);
}

.skill-info-tab h3 {
  margin-bottom: 14px;
  color: #45f5df;
  font-size: clamp(14px, 1.1vw, 18px);
}

.skill-info-tab .detail-head {
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
}

.skill-info-tab .detail-head strong {
  font-size: clamp(15px, 1.25vw, 22px);
}

.skill-info-tab p {
  font-size: clamp(11px, 0.9vw, 14px);
}

.skill-info-tab .detail-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
}

.skill-nodes {
  inset: 0;
}

.skill-card strong,
.skill-card span {
  display: block;
  opacity: 0;
}

.skill-card:hover strong,
.skill-card:hover span,
.skill-card:focus-visible strong,
.skill-card:focus-visible span,
.skill-card.core-node strong,
.skill-card.core-node span {
  opacity: 1;
}

.center {
  left: 50%;
  top: 50%;
  width: min(500px, calc(100vw - 34px));
  padding: 24px;
  text-align: center;
  transform: translate(-50%, -50%);
}

#death {
  overflow: hidden;
  font-family: Consolas, "Courier New", monospace;
}

#death h2 {
  margin-bottom: 8px;
}

.death-run-stats {
  display: grid;
  gap: 4px;
  margin: 18px auto;
  padding: 14px;
  border: 1px solid rgba(69, 245, 223, 0.34);
  background: rgba(69, 245, 223, 0.06);
}

.death-run-stats span,
.death-distance-head {
  color: rgba(243, 246, 255, 0.72);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.death-run-stats strong {
  color: #f3f6ff;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 0.95;
  text-shadow: 3px 0 #ff3075, -3px 0 #45f5df, 0 0 24px rgba(69, 245, 223, 0.24);
}

.death-distance {
  margin-top: 14px;
}

.death-distance-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 9px;
}

.death-distance-track {
  position: relative;
  height: 18px;
  overflow: hidden;
  border: 1px solid rgba(243, 246, 255, 0.22);
  background:
    repeating-linear-gradient(90deg, rgba(243, 246, 255, 0.08) 0 2px, transparent 2px 16px),
    rgba(5, 4, 7, 0.78);
}

.death-distance-fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #45f5df, #ffc44b);
  box-shadow: 0 0 18px rgba(69, 245, 223, 0.48);
  transition: width 0.72s cubic-bezier(0.16, 0.84, 0.22, 1);
}

.death-distance-marker {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 3px;
  background: #f3f6ff;
  box-shadow: 0 0 12px #f3f6ff;
  transform: translateX(-50%);
  transition: left 0.72s cubic-bezier(0.16, 0.84, 0.22, 1);
}

.death-highscore {
  display: block;
  margin-top: 18px;
  color: #ffc44b;
  font-size: clamp(22px, 4.8vw, 44px);
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 3px 0 #ff3075, -3px 0 #fff2a6, 0 0 26px rgba(255, 196, 75, 0.72);
  animation: deathHighscorePop 0.92s steps(2, end) infinite;
}

#death.highscore {
  border-color: rgba(255, 196, 75, 0.88);
  box-shadow: 0 20px 90px rgba(0, 0, 0, 0.62), 0 0 42px rgba(255, 196, 75, 0.28);
}

.death-confetti {
  position: absolute;
  left: 50%;
  top: 45%;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.death-confetti i {
  position: absolute;
  width: 6px;
  height: 10px;
  background: var(--c);
  box-shadow: 0 0 10px var(--c);
  animation: deathConfetti var(--dur) cubic-bezier(0.11, 0.74, 0.28, 1) var(--delay) both;
}

@keyframes deathHighscorePop {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.045); filter: brightness(1.3); }
}

@keyframes deathConfetti {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.2) rotate(0deg); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(1) rotate(var(--r)); }
}

.toast {
  position: absolute;
  left: 50%;
  bottom: clamp(28px, 4.3vh, 48px);
  width: min(360px, calc(100vw - 48px));
  min-height: 44px;
  padding: 12px 18px;
  transform: translateX(-50%);
  border: 0;
  background: transparent;
  color: #f3f6ff;
  font-family: var(--font-pixel);
  font-weight: 800;
  text-align: center;
  text-shadow: 0 2px 12px #000, 0 0 10px rgba(255, 48, 117, 0.22);
}

.startup-tutorial {
  position: absolute;
  left: 50%;
  bottom: clamp(86px, 11vh, 132px);
  width: min(680px, calc(100vw - 92px));
  min-height: 96px;
  padding: 24px 30px 26px;
  transform: translateX(-50%);
  border: 1px solid rgba(69, 245, 223, 0.45);
  background:
    linear-gradient(135deg, rgba(69, 245, 223, 0.05), transparent 40%),
    rgba(7, 10, 18, 0.88);
  backdrop-filter: blur(14px);
  color: #f3f6ff;
  font-family: var(--font-pixel);
  pointer-events: none;
  text-shadow: 0 2px 10px #000, 0 0 12px rgba(69, 245, 223, 0.2);
  box-shadow: 
    0 30px 60px rgba(0, 0, 0, 0.7),
    inset 0 0 0 1px rgba(255, 48, 117, 0.15),
    0 0 20px rgba(69, 245, 223, 0.08);
  border-radius: 4px;
}

.startup-tutorial::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, #ff3075, #45f5df, #ff3075);
  background-size: 200% 100%;
  animation: neonFlow 3s linear infinite;
}

@keyframes neonFlow {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.startup-tutorial::after {
  content: "";
  display: inline-block;
  width: 10px;
  height: 20px;
  margin-left: 8px;
  vertical-align: -4px;
  background: #ffc44b;
  box-shadow: 0 0 10px #ffc44b;
  animation: continueBlink 0.78s steps(1, end) infinite;
}

.startup-tutorial p {
  margin: 0;
}

.startup-tutorial .eyebrow {
  margin-bottom: 8px;
  font-size: 10px;
  opacity: 0.9;
}

.startup-tutorial #startupTutorialText {
  min-height: 44px;
  font-size: clamp(16px, 1.1vw, 22px);
  font-weight: 900;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

.keybinds {
  position: absolute;
  left: clamp(52px, 4vw, 78px);
  bottom: clamp(60px, 8.2vh, 92px);
  display: grid;
  grid-template-columns: repeat(2, max-content);
  max-width: min(420px, 34vw);
  gap: 5px 14px;
  align-items: center;
  justify-content: flex-start;
  color: rgba(216, 224, 240, 0.82);
  font-family: var(--font-pixel);
  font-size: clamp(9px, 0.64vw, 12px);
  font-weight: 900;
  line-height: 1.15;
  text-align: left;
  text-shadow: 0 2px 10px #000, 0 0 8px rgba(69, 245, 223, 0.2);
}

.keybinds span {
  white-space: nowrap;
}

.hidden {
  display: none;
}

@media (max-width: 640px) {
  .topbar {
    left: 20px;
    right: 20px;
    top: 18px;
  }

  .stats {
    width: min(46vw, 240px);
    grid-template-columns: 1fr 0.78fr;
    gap: 5px;
  }

  .stats span {
    padding: 8px 8px 0 10px;
    font-size: 10px;
  }

  #ammo {
    grid-column: 1 / -1;
    font-size: 9px;
  }

  .keybinds {
    left: 18px;
    bottom: 22px;
    max-width: 190px;
    grid-template-columns: 1fr;
    font-size: 8px;
  }

  .briefing {
    padding: 18px;
  }

  .mask-grid {
    grid-template-columns: 1fr;
  }
}

/* ── FPS Cap Slider ─────────────────────────────────────────────────────── */
.fps-cap-row {
  width: 100%;
  margin: 18px 0 4px;
}

.fps-cap-label {
  display: block;
  margin-bottom: 10px;
  color: #a8d4f5;
  font-family: var(--font-pixel);
  font-size: clamp(13px, 1vw, 16px);
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

#fpsCapDisplay,
#fpsCapDisplayPause {
  color: #45f5df;
  text-shadow: 0 0 10px rgba(69, 245, 223, 0.6);
  transition: color 0.2s, text-shadow 0.2s;
}

#fpsCapDisplay.unlimited,
#fpsCapDisplayPause.unlimited {
  color: #ff3075;
  text-shadow: 0 0 14px rgba(255, 48, 117, 0.7);
}

.fps-cap-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, rgba(69, 245, 223, 0.55), rgba(255, 48, 117, 0.42));
  border: 1px solid rgba(69, 245, 223, 0.28);
  outline: none;
  cursor: pointer;
  border-radius: 0;
}

.fps-cap-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 24px;
  background: #45f5df;
  border: 2px solid #08080c;
  box-shadow: 0 0 12px rgba(69, 245, 223, 0.75), 0 0 24px rgba(69, 245, 223, 0.35);
  cursor: pointer;
  border-radius: 0;
  transition: background 0.2s, box-shadow 0.2s;
}

.fps-cap-slider::-moz-range-thumb {
  width: 18px;
  height: 24px;
  background: #45f5df;
  border: 2px solid #08080c;
  box-shadow: 0 0 12px rgba(69, 245, 223, 0.75);
  cursor: pointer;
  border-radius: 0;
  transition: background 0.2s, box-shadow 0.2s;
}

.fps-cap-slider.unlimited-mode::-webkit-slider-thumb {
  background: #ff3075;
  box-shadow: 0 0 14px rgba(255, 48, 117, 0.8), 0 0 28px rgba(255, 48, 117, 0.4);
}

.fps-cap-slider.unlimited-mode::-moz-range-thumb {
  background: #ff3075;
  box-shadow: 0 0 14px rgba(255, 48, 117, 0.8);
}

.fps-cap-hint {
  margin: 8px 0 0;
  color: rgba(168, 212, 245, 0.48);
  font-family: var(--font-pixel);
  font-size: clamp(10px, 0.72vw, 12px);
  letter-spacing: 0.06em;
}

/* ── Shader Selection ─────────────────────────────────────────────────── */
.shader-select.active {
  border-color: #ff3075;
  background: rgba(255, 48, 117, 0.16);
  box-shadow: 0 0 14px rgba(255, 48, 117, 0.35);
}

.shader-select::before {
  content: "[\2002]";
  margin-right: 8px;
  color: rgba(69, 245, 223, 0.4);
}

.shader-select.active::before {
  content: "[X]";
  color: #ff3075;
}

#glCanvas {
  background: #000;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none !important;
}

.css-shader-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  display: none;
  background: 
    radial-gradient(circle at center, transparent 40%, rgba(0, 0, 0, 0.45) 100%),
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0, 0, 0, 0.15) 2px, rgba(0, 0, 0, 0.15) 4px);
}

body.shader-crt .css-shader-overlay {
  display: block;
}

