:root {
  --bg: #050505;
  --text: #f4f4f4;
  --muted: #8a8a8a;
  --red: #e82127;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overflow: hidden;
}

.snake-app {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: 16px 20px 18px;
  gap: 12px;
}

.snake-app > header {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.snake-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  flex-wrap: wrap;
}

.back-link,
.snake-top h1 {
  font-size: 28px;
  font-weight: 600;
}

.back-link {
  color: #fff;
  text-decoration: none;
  padding: 8px 16px;
  border: 2px solid #fff;
  border-radius: 999px;
  white-space: nowrap;
}

.back-link:active {
  background: #fff;
  color: #000;
}

.scores {
  display: flex;
  gap: 20px;
  font-size: 22px;
  color: var(--muted);
  white-space: nowrap;
}

.scores b {
  color: #fff;
  font-weight: 600;
}

.snake-main {
  min-height: 0;
  display: block;
  touch-action: none;
}

.board-wrap {
  min-width: 0;
  min-height: 0;
  height: 100%;
  position: relative;
  background: #0b0b0b;
  border-radius: 20px;
  overflow: hidden;
  touch-action: none;
}

#board {
  width: 100%;
  height: 100%;
  display: block;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.45);
}

.overlay.hidden {
  display: none;
}

#overlay-text {
  font-size: 36px;
  font-weight: 600;
}
