:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #07090d;
  color: #f6f0e3;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  cursor: auto;
}

body {
  background: #07090d;
}

.shell {
  position: fixed;
  inset: 0;
  cursor: auto;
}

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

button,
select,
input {
  cursor: pointer;
}

input {
  cursor: text;
}

.focus {
  position: fixed;
  left: var(--focus-x, 50%);
  top: var(--focus-y, 50%);
  z-index: 3;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.focus::before,
.focus::after {
  position: absolute;
  left: 50%;
  top: 50%;
  content: "";
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.48);
  transform: translate(-50%, -50%);
}

.focus::before {
  width: 2px;
  height: 18px;
}

.focus::after {
  width: 18px;
  height: 2px;
}

.focus[hidden] {
  display: none;
}

.menu-cursor {
  display: none !important;
}

.menu-cursor::before {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  border-top: 18px solid #f6f0e3;
  border-right: 10px solid transparent;
  content: "";
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.55));
}

.menu-cursor::after {
  position: absolute;
  left: 3px;
  top: 3px;
  width: 0;
  height: 0;
  border-top: 9px solid #2e88b8;
  border-right: 5px solid transparent;
  content: "";
}

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

.menu {
  position: fixed;
  inset: 0;
  z-index: 6;
  display: grid;
  place-content: center;
  gap: 18px;
  overflow: hidden;
  background: rgba(7, 9, 13, 0.42);
  backdrop-filter: blur(4px);
  text-align: center;
  cursor: auto;
}

.menu * {
  position: relative;
  z-index: 1;
}

.menu::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 78% 14%, rgba(255, 221, 116, 0.95) 0 5%, rgba(255, 221, 116, 0.18) 6% 13%, transparent 14%),
    linear-gradient(180deg, rgba(85, 181, 224, 0.95) 0 26%, rgba(161, 211, 226, 0.82) 26% 38%, rgba(231, 199, 118, 0.85) 38% 45%, rgba(45, 110, 84, 0.92) 45% 58%, rgba(19, 24, 26, 0.98) 58% 100%),
    linear-gradient(112deg, transparent 0 41%, rgba(236, 232, 210, 0.86) 41.4% 42.2%, transparent 42.7% 57%, rgba(236, 232, 210, 0.86) 57.5% 58.3%, transparent 58.8% 100%),
    linear-gradient(88deg, rgba(15, 20, 26, 0.82) 0 8%, transparent 8% 14%, rgba(17, 23, 29, 0.78) 14% 21%, transparent 21% 28%, rgba(17, 23, 29, 0.72) 28% 35%, transparent 35% 65%, rgba(17, 23, 29, 0.72) 65% 72%, transparent 72% 79%, rgba(17, 23, 29, 0.78) 79% 86%, transparent 86% 92%, rgba(15, 20, 26, 0.82) 92% 100%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.13) 0 2px, transparent 2px 26px);
  background-blend-mode: screen, normal, screen, multiply, overlay;
  filter: saturate(1.15) contrast(1.05);
}

.menu::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(66deg, transparent 0 24%, rgba(10, 13, 16, 0.9) 24.5% 38%, rgba(230, 226, 205, 0.82) 38.4% 39.1%, rgba(10, 13, 16, 0.92) 39.5% 60.5%, rgba(230, 226, 205, 0.82) 60.9% 61.6%, rgba(10, 13, 16, 0.9) 62% 75.5%, transparent 76% 100%),
    linear-gradient(90deg, rgba(4, 7, 10, 0.36), transparent 18% 82%, rgba(4, 7, 10, 0.36)),
    linear-gradient(180deg, transparent 0 18%, rgba(0, 0, 0, 0.18) 18% 100%);
}

.menu[hidden] {
  display: none;
}

.menu-actions {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.menu button,
.menu select,
.menu input {
  justify-self: center;
  min-width: 150px;
  height: 48px;
  border: 1px solid rgba(246, 240, 227, 0.28);
  border-radius: 8px;
  background: #f6f0e3;
  color: #111317;
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
}

.menu input {
  width: min(260px, calc(100vw - 48px));
  padding: 0 14px;
  background: rgba(246, 240, 227, 0.94);
  text-align: center;
}

.name-panel,
.settings-panel {
  display: grid;
  justify-items: center;
  gap: 8px;
  color: #f6f0e3;
  font-size: 15px;
  font-weight: 800;
  text-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.name-panel[hidden],
.settings-panel[hidden] {
  display: none;
}

.settings-panel h2 {
  margin: 0 0 4px;
  font-size: 24px;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(260px, calc(100vw - 48px));
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(246, 240, 227, 0.28);
  border-radius: 8px;
  background: rgba(246, 240, 227, 0.94);
  color: #111317;
  font-size: 16px;
  font-weight: 900;
  text-shadow: none;
}

.setting-row input {
  width: 22px;
  height: 22px;
}

.name-panel small {
  color: rgba(255, 235, 190, 0.92);
  font-size: 13px;
  font-weight: 800;
}

.menu select,
.name-panel select {
  padding: 0 14px;
}

.name-panel select {
  width: min(260px, calc(100vw - 48px));
  text-align: center;
}

.hud {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.hud-top {
  top: max(14px, env(safe-area-inset-top));
  right: auto;
  flex-direction: column;
  align-items: flex-start;
}

.hud-top > div,
.hud-bottom {
  border: 1px solid rgba(246, 240, 227, 0.16);
  background: rgba(6, 8, 12, 0.62);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
}

.hud-top > div {
  min-width: 150px;
  padding: 9px 12px 10px;
  border-radius: 8px;
}

.status-bar {
  width: 170px;
}

.bar-track {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 1px solid rgba(246, 240, 227, 0.18);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.38);
}

.bar-fill {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  transform-origin: left center;
  transition: transform 120ms linear;
}

.health-fill {
  background: linear-gradient(90deg, #19b957, #77f05e);
  box-shadow: 0 0 14px rgba(49, 229, 87, 0.46);
}

.energy-fill {
  background: linear-gradient(90deg, #f0c94d, #65df8a);
  box-shadow: 0 0 14px rgba(240, 201, 77, 0.38);
}

.speedometer {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(max(14px, env(safe-area-inset-bottom)) + 66px);
  z-index: 2;
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 116px;
  padding: 10px 13px;
  border: 1px solid rgba(246, 240, 227, 0.16);
  border-radius: 8px;
  background: rgba(6, 8, 12, 0.62);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
  pointer-events: none;
}

.speedometer strong {
  font-size: 32px;
}

.speedometer span {
  color: rgba(246, 240, 227, 0.68);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.kill-counter,
.timer-counter,
.money-counter {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 104px;
  padding: 10px 13px;
  border: 1px solid rgba(246, 240, 227, 0.16);
  border-radius: 8px;
  background: rgba(6, 8, 12, 0.62);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
  pointer-events: none;
}

.timer-counter {
  top: calc(max(14px, env(safe-area-inset-top)) + 58px);
}

.money-counter {
  top: calc(max(14px, env(safe-area-inset-top)) + 116px);
}

.kill-counter span,
.timer-counter span,
.money-counter span {
  color: rgba(246, 240, 227, 0.68);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.kill-counter strong,
.timer-counter strong,
.money-counter strong {
  color: #f6f0e3;
  font-size: 26px;
  line-height: 1;
}

.minimap {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  bottom: calc(max(14px, env(safe-area-inset-bottom)) + 66px);
  z-index: 2;
  width: 170px;
  height: 170px;
  border: 1px solid rgba(246, 240, 227, 0.16);
  border-radius: 8px;
  background: rgba(6, 8, 12, 0.62);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
  pointer-events: none;
}

.shop-overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 5, 8, 0.48);
  backdrop-filter: blur(3px);
  pointer-events: auto;
}

.shop-overlay[hidden] {
  display: none;
}

.shop-panel,
.result-panel {
  width: min(390px, calc(100vw - 36px));
  border: 1px solid rgba(246, 240, 227, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(35, 38, 39, 0.96), rgba(10, 12, 15, 0.96)),
    repeating-linear-gradient(90deg, transparent 0 18px, rgba(255, 255, 255, 0.035) 18px 19px);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.58);
  padding: 20px;
  text-align: left;
}

.shop-kicker,
.result-kicker {
  color: #f5c84b;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.shop-panel h2,
.result-panel h2 {
  margin: 6px 0 4px;
  font-size: 28px;
  line-height: 1.05;
}

.shop-panel p,
.result-panel p {
  margin: 0;
  color: rgba(246, 240, 227, 0.76);
  font-weight: 750;
}

.shop-offer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(246, 240, 227, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.065);
}

.shop-offer span {
  color: rgba(246, 240, 227, 0.68);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.shop-offer strong {
  color: #f5c84b;
  font-size: 24px;
}

.shop-message {
  min-height: 42px;
  padding-top: 12px;
  font-size: 14px;
}

.shop-message.warning {
  color: #ffcf80;
}

.shop-actions,
.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.shop-actions button,
.result-actions button {
  height: 46px;
  border: 1px solid rgba(246, 240, 227, 0.2);
  border-radius: 8px;
  background: #f6f0e3;
  color: #111317;
  font-size: 15px;
  font-weight: 900;
}

.shop-actions button:last-child,
.result-actions button:last-child {
  background: rgba(246, 240, 227, 0.12);
  color: #f6f0e3;
}

.result-overlay {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 5, 8, 0.56);
  backdrop-filter: blur(4px);
  pointer-events: auto;
}

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

.result-panel {
  text-align: center;
}

.label {
  display: block;
  margin-bottom: 2px;
  color: rgba(246, 240, 227, 0.6);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

strong {
  font-size: 21px;
  line-height: 1;
}

.hud-bottom {
  bottom: max(14px, env(safe-area-inset-bottom));
  min-height: 50px;
  padding: 7px;
  border-radius: 8px;
}

.hud-bottom p {
  flex: 1;
  min-width: 0;
  margin: 0 8px;
  color: rgba(246, 240, 227, 0.78);
  font-size: 14px;
  line-height: 1.25;
  text-align: center;
}

button {
  width: 44px;
  min-width: 44px;
  height: 36px;
  border: 1px solid rgba(246, 240, 227, 0.22);
  border-radius: 6px;
  background: #f6f0e3;
  color: #101318;
  font: inherit;
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
  pointer-events: auto;
}

#restart {
  width: auto;
  min-width: 78px;
  padding: 0 12px;
  font-size: 13px;
}

#menuBack,
#nameBack {
  width: auto;
  min-width: 64px;
  padding: 0 12px;
  font-size: 13px;
}

button:hover {
  background: #ffffff;
}

noscript {
  position: fixed;
  inset: auto 16px 16px;
  z-index: 3;
  color: #ffffff;
}

@media (max-width: 640px) {
  .hud-top {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hud-top > div {
    min-width: 0;
  }

  .hud-bottom {
    align-items: stretch;
    gap: 6px;
  }

  .hud-bottom p {
    order: -1;
    flex-basis: 100%;
    font-size: 12px;
  }

  #restart {
    min-width: 68px;
    padding: 0 8px;
  }

  .speedometer {
    bottom: calc(max(14px, env(safe-area-inset-bottom)) + 86px);
    min-width: 94px;
    padding: 8px 10px;
  }

  .speedometer strong {
    font-size: 26px;
  }

  .minimap {
    bottom: calc(max(14px, env(safe-area-inset-bottom)) + 86px);
    width: 120px;
    height: 120px;
  }
}
