* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: #070912;
  color: #f6f8ff;
  font-family: Arial, Helvetica, sans-serif;
}

.game-shell {
  width: min(100%, 920px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  align-content: center;
  gap: 16px;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.game-header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 2.8rem);
  line-height: 1;
  text-align: right;
}

.game-header p {
  margin: 6px 0 0;
  color: #aeb8d4;
  text-align: right;
}

.back-link {
  color: #8fe8ff;
  text-decoration: none;
  font-weight: 700;
}

.back-link:focus,
.back-link:hover {
  color: #ffffff;
}

.game-panel {
  padding: 12px;
  background: #0d1220;
  border: 1px solid #24314f;
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

canvas {
  display: block;
  width: 100%;
  max-width: 800px;
  aspect-ratio: 4 / 3;
  margin: 0 auto;
  background: #02040a;
  border: 1px solid #33415f;
  border-radius: 6px;
  touch-action: none;
}

.touch-controls {
  display: none;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  max-width: 800px;
  margin: 12px auto 0;
}

.touch-controls button {
  min-height: 52px;
  border: 1px solid #3f5076;
  border-radius: 6px;
  background: #121a2d;
  color: #ffffff;
  font-size: 1rem;
  font-weight: 700;
  touch-action: none;
}

.touch-controls button:active {
  background: #1e3158;
}

@media (hover: none), (max-width: 720px) {
  .game-shell {
    min-height: 100svh;
    padding: 12px;
  }

  .game-header {
    align-items: flex-start;
  }

  .touch-controls {
    display: grid;
  }
}
