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

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 10%, rgba(43, 175, 255, 0.16), transparent 32rem),
    linear-gradient(145deg, #090b10 0%, #131720 52%, #07080d 100%);
}

.back-link {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid rgba(94, 210, 255, 0.34);
  border-radius: 999px;
  background: rgba(9, 13, 22, 0.88);
  color: #f5f7fb;
  text-decoration: none;
  font-weight: 800;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.26);
}

.back-link:hover {
  border-color: #ffc542;
  color: #ffc542;
}

.game-shell {
  width: min(94vw, 760px);
  display: grid;
  gap: 14px;
  justify-items: center;
  padding: 18px;
}

.player-panel {
  width: min(100%, 672px);
  min-height: 58px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(255, 197, 66, 0.34);
  border-radius: 8px;
  background: rgba(9, 13, 22, 0.86);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.28);
}

.player-panel.is-hidden {
  display: none;
}

.player-panel label {
  color: #f5f7fb;
  font-weight: 800;
}

.player-panel input {
  width: 100%;
  min-width: 0;
  height: 42px;
  border: 1px solid rgba(94, 210, 255, 0.34);
  border-radius: 8px;
  padding: 0 12px;
  background: #050711;
  color: #f5f7fb;
  font: inherit;
  font-weight: 700;
  outline: none;
}

.player-panel input:focus {
  border-color: #ffc542;
}

.hud {
  width: min(100%, 672px);
  min-height: 58px;
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(94, 210, 255, 0.28);
  border-radius: 8px;
  background: rgba(9, 13, 22, 0.78);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.32);
}

.hud div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.hud span {
  color: #9aa6b8;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.hud strong {
  font-size: 1.25rem;
  line-height: 1;
}

button {
  height: 42px;
  min-width: 42px;
  border: 0;
  border-radius: 8px;
  background: #ffc542;
  color: #151005;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22);
}

button:active {
  transform: translateY(1px);
}

#restart {
  padding: 0 14px;
}

canvas {
  width: min(100%, 672px);
  aspect-ratio: 672 / 744;
  border-radius: 8px;
  border: 1px solid rgba(94, 210, 255, 0.34);
  background: #03050a;
  box-shadow: 0 22px 58px rgba(0, 0, 0, 0.44);
}

.touch-controls {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.touch-controls div {
  display: flex;
  gap: 8px;
}

.touch-controls button {
  font-size: 1rem;
}

@media (max-width: 720px) {
  body {
    align-items: start;
  }

  .game-shell {
    width: 100vw;
    padding: 10px;
    gap: 10px;
  }

  .player-panel {
    grid-template-columns: 1fr;
  }

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

  #restart {
    grid-column: 1 / -1;
    width: 100%;
  }

}
