:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: #111318;
  color: #f7f3e8;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(148, 53, 66, 0.16), transparent 30rem),
    linear-gradient(135deg, #101217 0%, #1d2422 48%, #0b0d11 100%);
  touch-action: none;
}

.game-shell {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #07090d;
  overflow: hidden;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: crisp-edges;
}

.hud {
  position: absolute;
  inset: 14px 14px auto 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  pointer-events: none;
  font-size: clamp(12px, 1.5vw, 15px);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.65);
}

.hud__group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.hud__pill {
  padding: 7px 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(12, 15, 20, 0.72);
  backdrop-filter: blur(8px);
  white-space: nowrap;
}

.health {
  width: min(34vw, 230px);
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.34);
  overflow: hidden;
}

.health__fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #4fd36a, #f2cf4a, #d84b4b);
  transform-origin: left center;
}

.message {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(8, 10, 13, 0.78);
  text-align: center;
}

.message__box {
  max-width: 620px;
}

.message h1 {
  margin: 0 0 10px;
  font-size: clamp(34px, 7vw, 74px);
  line-height: 0.95;
  letter-spacing: 0;
}

.message p {
  margin: 0;
  color: #efe5c9;
  font-size: clamp(15px, 2.2vw, 20px);
}

.is-hidden {
  display: none;
}

.lobby {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: minmax(54px, 12vh) minmax(0, 1fr) auto;
  justify-items: center;
  align-items: center;
  padding: clamp(18px, 4vh, 38px);
  overflow: hidden;
  background:
    linear-gradient(rgba(7, 9, 13, 0.28), rgba(7, 9, 13, 0.72)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 32px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.028) 0 1px, transparent 1px 32px),
    linear-gradient(135deg, #20272a 0%, #151816 54%, #080a0d 100%);
  z-index: 10;
}

.lobby__topline {
  align-self: start;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(8, 10, 13, 0.64);
  color: #f7eac4;
  font-size: clamp(18px, 3vw, 34px);
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.lobby__character {
  width: min(48vw, 42vh, 340px);
  aspect-ratio: 1;
  background-image: url("./assets/main-character.png");
  background-repeat: no-repeat;
  background-size: 400% 400%;
  background-position: 100% 0%;
  image-rendering: pixelated;
  filter: drop-shadow(0 22px 28px rgba(0, 0, 0, 0.62));
}

.lobby__form {
  width: min(92vw, 560px);
  display: grid;
  gap: 10px;
  margin-bottom: clamp(10px, 3vh, 28px);
}

.lobby__fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, 0.32fr);
  gap: 10px;
}

.lobby__field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.lobby__label {
  color: #efe5c9;
  font-size: clamp(14px, 2vw, 18px);
  font-weight: 700;
}

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

.lobby__input,
.lobby__button {
  min-height: 52px;
  border-radius: 8px;
  font: inherit;
  font-size: clamp(16px, 2.4vw, 20px);
}

.lobby__input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(9, 12, 16, 0.82);
  color: #fff7df;
  padding: 0 14px;
  outline: none;
}

.lobby__input:focus {
  border-color: #f2cf4a;
  box-shadow: 0 0 0 3px rgba(242, 207, 74, 0.2);
}

.lobby__button {
  border: 0;
  background: #f2cf4a;
  color: #17140a;
  padding: 0 24px;
  font-weight: 800;
  cursor: pointer;
}

.lobby__button:hover,
.lobby__button:focus-visible {
  background: #ffe179;
}

.lobby.is-hidden {
  display: none;
}

@media (max-width: 560px) {
  .lobby {
    grid-template-rows: minmax(46px, 10vh) minmax(0, 1fr) auto;
    padding: 16px;
  }

  .lobby__character {
    width: min(72vw, 38vh);
  }

  .lobby__fields,
  .lobby__controls {
    grid-template-columns: 1fr;
  }
}
