:root {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  background: #08101f;
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
  color: #edf3ff;
}

.game-shell {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
  background: #0b1c2c;
}

.hud {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  min-width: min(96vw, 720px);
  padding: 10px 16px;
  border-radius: 12px;
  background: rgba(7, 10, 20, 0.65);
  border: 1px solid rgba(154, 189, 255, 0.4);
  backdrop-filter: blur(6px);
  text-align: center;
  pointer-events: none;
}

.score-line {
  font-weight: 700;
  font-size: 1.35rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sub-line,
.controls-line {
  margin-top: 4px;
  display: flex;
  justify-content: space-around;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(3, 5, 12, 0.65);
  z-index: 4;
}

.hidden {
  display: none !important;
}

.panel {
  width: min(92vw, 460px);
  background: rgba(10, 18, 34, 0.95);
  border: 1px solid #5d82c2;
  border-radius: 14px;
  padding: 18px;
}

.panel h1 {
  margin: 0 0 8px;
}

.menu-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.btn {
  border: 1px solid #7ea6ed;
  background: #122746;
  color: #eff6ff;
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}

.btn.primary {
  background: #2a5ca8;
}

.help-text {
  margin: 10px 0 0;
  color: #bad3ff;
  font-size: 0.9rem;
}

.touch-controls {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  justify-content: space-between;
  padding: 10px;
  z-index: 3;
}

.left-pad,
.right-pad {
  display: grid;
  gap: 8px;
}

.left-pad {
  grid-template-columns: repeat(3, 54px);
  grid-template-areas:
    '. up .'
    'left down right';
}

.left-pad button[data-key='w'] { grid-area: up; }
.left-pad button[data-key='a'] { grid-area: left; }
.left-pad button[data-key='s'] { grid-area: down; }
.left-pad button[data-key='d'] { grid-area: right; }

.touch-controls button {
  border: 1px solid rgba(162, 191, 255, 0.7);
  border-radius: 12px;
  width: 54px;
  height: 54px;
  background: rgba(12, 24, 48, 0.72);
  color: #fff;
  font-weight: 700;
}

.right-pad button {
  width: 92px;
}

@media (max-width: 720px) {
  .hud {
    top: 5px;
    padding: 8px 10px;
  }

  .score-line {
    font-size: 1.1rem;
  }

  .controls-line {
    display: none;
  }
}


.network-panel {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(126, 166, 237, 0.35);
}

.network-panel h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: #d9e8ff;
}

.network-panel input {
  flex: 1;
  min-width: 180px;
  border: 1px solid #648ccf;
  background: #0d1d38;
  color: #eff6ff;
  border-radius: 8px;
  padding: 8px 10px;
}

.network-panel .menu-row {
  flex-wrap: wrap;
}
