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

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

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

body {
  background: #111610;
}

canvas#game {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: crosshair;
  touch-action: none;
}

.hidden {
  display: none !important;
}

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

.status-panel {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
  width: min(310px, calc(100vw - 28px));
  padding: 12px;
  border: 1px solid rgba(246, 226, 174, 0.18);
  background: rgba(24, 29, 18, 0.72);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.bar-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  color: #f8e9c6;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.bar {
  overflow: hidden;
  width: 100%;
  height: 15px;
  margin-bottom: 7px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.34);
  border-radius: 4px;
}

.bar i {
  display: block;
  width: 100%;
  height: 100%;
  transform-origin: left center;
  transition: transform 90ms linear;
}

.health i {
  background: linear-gradient(90deg, #b62c2d, #f0603f, #efb85d);
}

.stamina {
  height: 9px;
}

.stamina i {
  background: linear-gradient(90deg, #3da76d, #8ed28a);
}

.weapon-info {
  color: #e7d6a8;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.leaderboard {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: max(14px, env(safe-area-inset-right));
  min-width: 180px;
  padding: 10px 12px;
  border: 1px solid rgba(246, 226, 174, 0.17);
  background: rgba(22, 25, 20, 0.68);
  backdrop-filter: blur(8px);
  border-radius: 8px;
  color: #efe3c2;
  font-size: 12px;
  line-height: 1.7;
}

.leaderboard strong {
  display: block;
  margin-bottom: 3px;
  color: #f7d77f;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.minimap {
  position: fixed;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(14px, env(safe-area-inset-bottom));
  width: 148px;
  height: 148px;
  border: 1px solid rgba(246, 226, 174, 0.22);
  background: rgba(16, 22, 18, 0.72);
  border-radius: 8px;
}

.banner {
  position: fixed;
  top: 21%;
  left: 50%;
  transform: translateX(-50%);
  color: #fff1bd;
  font-size: clamp(18px, 3vw, 44px);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.8);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22%;
  transform: translateX(-50%);
  max-width: min(520px, 90vw);
  color: #f6e2ae;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.75);
  white-space: pre-line;
}

.icon-button {
  position: fixed;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: max(18px, env(safe-area-inset-left));
  width: 42px;
  height: 42px;
  border: 1px solid rgba(246, 226, 174, 0.25);
  background: rgba(22, 25, 20, 0.72);
  color: #f6e2ae;
  border-radius: 8px;
  pointer-events: auto;
  font-weight: 900;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background:
    radial-gradient(circle at 50% 46%, rgba(82, 95, 55, 0.3), transparent 36%),
    linear-gradient(rgba(10, 13, 9, 0.42), rgba(10, 13, 9, 0.78));
}

.menu-panel {
  width: min(620px, 94vw);
  max-height: calc(100vh - 44px);
  overflow-y: auto;
  padding: 26px;
  border: 1px solid rgba(247, 221, 150, 0.24);
  background: rgba(23, 29, 18, 0.82);
  backdrop-filter: blur(12px);
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.44);
}

.menu-panel h1 {
  margin: 0;
  color: #f8d373;
  font-size: clamp(42px, 9vw, 86px);
  line-height: 0.92;
  letter-spacing: 0;
}

.menu-panel p {
  margin: 12px 0 20px;
  color: #f4eddc;
  font-size: 18px;
  font-weight: 800;
}

.menu-panel input {
  width: min(320px, 100%);
  height: 42px;
  padding: 0 13px;
  border: 1px solid rgba(246, 226, 174, 0.22);
  background: rgba(7, 10, 7, 0.48);
  color: #f7efd9;
  border-radius: 6px;
  font: inherit;
  text-align: center;
  pointer-events: auto;
}

.difficulty {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin: 16px 0;
}

button {
  border: 0;
  font: inherit;
  text-transform: uppercase;
  cursor: pointer;
}

.difficulty button,
.primary,
.overlay .secondary {
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid rgba(246, 226, 174, 0.22);
  background: rgba(9, 11, 8, 0.5);
  color: #f1e5c8;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.difficulty .selected,
.primary {
  background: #d69334;
  color: #1e1409;
}

.records {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 13px;
  margin-top: 18px;
  color: #d8c9a5;
  font-size: 12px;
  font-weight: 700;
}

.instructions {
  margin-top: 20px;
  padding-top: 17px;
  border-top: 1px solid rgba(246, 226, 174, 0.16);
  text-align: left;
}

.instructions-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 13px;
}

.instructions h2 {
  margin: 0;
  color: #f0d890;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.instructions .instructions-heading p,
.instructions .mobile-instructions {
  margin: 0;
  color: #cfc3a4;
  font-size: 12px;
  font-weight: 600;
}

.instruction-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.instruction-grid div {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  border: 1px solid rgba(246, 226, 174, 0.12);
  background: rgba(7, 10, 7, 0.28);
  border-radius: 5px;
}

.instruction-grid kbd {
  color: #f8d373;
  font: 800 11px/1.2 inherit;
  white-space: nowrap;
}

.instruction-grid span {
  color: #e9dfc8;
  font-size: 11px;
  font-weight: 700;
}

.instructions .mobile-instructions {
  display: none;
  margin-top: 10px;
}

.records {
  color: #f0d890;
}

.mobile-controls {
  position: fixed;
  inset: auto 0 0 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 18px max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  pointer-events: none;
}

.joystick {
  position: relative;
  width: 112px;
  height: 112px;
  border: 1px solid rgba(255, 238, 183, 0.24);
  background: rgba(18, 21, 16, 0.42);
  border-radius: 50%;
  pointer-events: auto;
}

.joystick i {
  position: absolute;
  left: 36px;
  top: 36px;
  width: 40px;
  height: 40px;
  background: rgba(246, 226, 174, 0.75);
  border-radius: 50%;
}

.mobile-actions {
  display: grid;
  grid-template-columns: repeat(2, 70px);
  gap: 10px;
  pointer-events: auto;
}

.mobile-actions button {
  height: 58px;
  border: 1px solid rgba(255, 238, 183, 0.24);
  background: rgba(18, 21, 16, 0.6);
  color: #f6e2ae;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 900;
}

@media (max-width: 740px), (pointer: coarse) {
  .menu-panel {
    padding: 20px;
  }

  .menu-panel h1 {
    font-size: clamp(38px, 13vw, 64px);
  }

  .instructions-heading {
    display: block;
  }

  .instructions-heading p {
    margin-top: 5px !important;
  }

  .instruction-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .instructions .mobile-instructions {
    display: block;
  }

  .leaderboard {
    top: auto;
    bottom: calc(158px + env(safe-area-inset-bottom));
    right: 12px;
    min-width: 144px;
  }

  .minimap {
    width: 118px;
    height: 118px;
  }

  .status-panel {
    width: min(260px, calc(100vw - 28px));
  }

  .mobile-controls {
    display: flex;
  }
}
