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

* {
  box-sizing: border-box;
}

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

body {
  background: #090d12;
}

button {
  border: 0;
  font: inherit;
}

input {
  font: inherit;
}

#game {
  position: fixed;
  inset: 0;
}

#game canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(6, 9, 14, 0.92), rgba(6, 9, 14, 0.5)),
    radial-gradient(circle at 70% 38%, rgba(239, 68, 68, 0.2), transparent 34%),
    radial-gradient(circle at 28% 72%, rgba(20, 184, 166, 0.16), transparent 34%);
}

.overlay.hidden {
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
}

.panel {
  width: min(520px, 100%);
}

.kicker {
  margin: 0 0 8px;
  color: #2dd4bf;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 24px;
  font-size: clamp(3rem, 11vw, 7rem);
  line-height: 0.9;
  letter-spacing: 0;
  text-transform: uppercase;
}

#startButton {
  width: min(260px, 100%);
  height: 56px;
  cursor: pointer;
  border-radius: 8px;
  background: #f5f7fb;
  color: #0a0f16;
  font-weight: 900;
  text-transform: uppercase;
  box-shadow: 0 16px 44px rgba(245, 247, 251, 0.2);
}

.multiplayer-box {
  width: min(420px, 100%);
  margin: 0 0 14px;
}

.multiplayer-box.compact {
  width: 100%;
}

.room-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 74px minmax(0, 1fr);
  gap: 8px;
}

.room-actions button,
.room-actions input {
  height: 42px;
  border-radius: 8px;
  font-weight: 900;
}

.room-actions button {
  cursor: pointer;
  background: #2dd4bf;
  color: #061014;
}

.room-actions button:hover {
  background: #f5f7fb;
}

.room-actions button:disabled {
  cursor: not-allowed;
  background: #334155;
  color: #94a3b8;
}

.room-actions input {
  min-width: 0;
  border: 1px solid rgba(245, 247, 251, 0.18);
  padding: 0 8px;
  outline: 0;
  background: rgba(5, 8, 12, 0.72);
  color: #f8fafc;
  text-align: center;
}

.multiplayer-box p {
  min-height: 18px;
  margin: 8px 0 0;
  color: #c6d0dd;
  font-size: 0.8rem;
  font-weight: 800;
}

.multiplayer-box .room-hint {
  margin: 0 0 8px;
  color: #94a3b8;
}

.name-field {
  display: block;
  width: min(260px, 100%);
  margin: 0 0 14px;
}

.name-field.compact {
  width: 100%;
}

.name-field span {
  display: block;
  margin-bottom: 6px;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.name-field input {
  width: 100%;
  height: 46px;
  border: 1px solid rgba(245, 247, 251, 0.18);
  border-radius: 8px;
  padding: 0 12px;
  outline: 0;
  background: rgba(5, 8, 12, 0.72);
  color: #f8fafc;
  font-weight: 900;
}

.name-field input:focus {
  border-color: #2dd4bf;
}

#startButton:hover {
  background: #2dd4bf;
}

.settings-panel {
  width: min(430px, 100%);
  border: 1px solid rgba(245, 247, 251, 0.14);
  border-radius: 8px;
  padding: 22px;
  background: rgba(5, 8, 12, 0.82);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(14px);
}

.settings-panel h2 {
  margin: 0 0 22px;
  font-size: clamp(1.8rem, 7vw, 3rem);
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
}

.setting-row,
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: #dbe7f3;
  font-weight: 800;
}

.setting-row strong {
  color: #2dd4bf;
}

#sensitivity {
  width: 100%;
  margin: 12px 0 22px;
  accent-color: #2dd4bf;
}

.toggle-row {
  justify-content: flex-start;
  margin-bottom: 22px;
}

.toggle-row input {
  width: 20px;
  height: 20px;
  accent-color: #2dd4bf;
}

#resumeButton {
  width: 100%;
  height: 52px;
  cursor: pointer;
  border-radius: 8px;
  background: #2dd4bf;
  color: #061014;
  font-weight: 900;
  text-transform: uppercase;
}

#resumeButton:hover {
  background: #f5f7fb;
}

.keys {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.keys span {
  min-width: 54px;
  border: 1px solid rgba(245, 247, 251, 0.24);
  border-radius: 6px;
  padding: 8px 10px;
  color: #c6d0dd;
  font-size: 0.8rem;
  text-align: center;
  background: rgba(245, 247, 251, 0.06);
}

#hud {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(6, minmax(72px, 1fr));
  gap: 8px;
  width: min(680px, calc(100vw - 32px));
}

.stat {
  min-height: 54px;
  border: 1px solid rgba(245, 247, 251, 0.12);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(5, 8, 12, 0.64);
  backdrop-filter: blur(10px);
}

.stat span,
.stat strong {
  display: block;
}

.stat span {
  color: #94a3b8;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stat strong {
  margin-top: 2px;
  color: #f8fafc;
  font-size: clamp(1rem, 3vw, 1.35rem);
  line-height: 1;
}

.stat b {
  font-weight: inherit;
}

#crosshair,
#hitMarker {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 2;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

#crosshair::before,
#crosshair::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: rgba(245, 247, 251, 0.92);
  transform: translate(-50%, -50%);
}

#crosshair::before {
  width: 24px;
  height: 2px;
}

#crosshair::after {
  width: 2px;
  height: 24px;
}

#hitMarker {
  width: 36px;
  height: 36px;
  border: 2px solid #ef4444;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 90ms ease;
}

#hitMarker.visible {
  opacity: 1;
}

#message {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 4;
  width: min(560px, calc(100vw - 32px));
  min-height: 28px;
  color: #f8fafc;
  font-size: clamp(0.9rem, 3vw, 1.05rem);
  font-weight: 800;
  text-align: center;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.85);
  transform: translateX(-50%);
}

#fpsCounter {
  position: fixed;
  top: 82px;
  right: 16px;
  z-index: 4;
  min-width: 84px;
  border: 1px solid rgba(45, 212, 191, 0.34);
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(5, 8, 12, 0.68);
  color: #2dd4bf;
  font-size: 0.9rem;
  font-weight: 900;
  text-align: center;
  backdrop-filter: blur(10px);
}

.hidden {
  display: none !important;
}

@media (max-width: 560px) {
  #hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .panel {
    align-self: end;
    padding-bottom: 48px;
  }
}
