/* Shared page style for Snake, Blocks and Pong: a dark arcade cabinet around a canvas */

body {
  margin: 0;
  min-height: 100vh;
  box-sizing: border-box;
  padding: 16px 16px 40px;
  background: #05050d;
  color: #e6e9ff;
  font-family: system-ui, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

h1 {
  margin: 0;
  font: 22px/1.3 "Press Start 2P", monospace;
  color: var(--accent, #ffff00);
  text-shadow: 3px 3px 0 #2121de;
  text-align: center;
}

.back-link {
  align-self: flex-start;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: inherit;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 14px;
}

.toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar [hidden] {
  display: none !important;
}

.toolbar select,
.toolbar button,
.touch-pad button {
  min-height: 44px;
  padding: 8px 14px;
  border: 2px solid #3b4290;
  border-radius: 10px;
  background: #0d1030;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.toolbar button:hover,
.toolbar select:hover {
  border-color: var(--accent, #ffff00);
}

button:focus-visible,
select:focus-visible,
a:focus-visible,
canvas:focus-visible {
  outline: 3px solid var(--accent, #ffff00);
  outline-offset: 2px;
}

.screen {
  position: relative;
  display: flex;
  justify-content: center;
}

.screen canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border: 2px solid #1d2150;
  border-radius: 8px;
  background: #000000;
  touch-action: none;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 22px;
  font: 12px/1.6 "Press Start 2P", monospace;
}

.stats strong {
  color: var(--accent, #ffff00);
}

/* On-screen buttons for touch screens */
.touch-pad {
  display: none;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  user-select: none;
  -webkit-user-select: none;
}

.touch-pad button {
  min-width: 64px;
  min-height: 56px;
  font-size: 20px;
  touch-action: manipulation;
}

body.touch .touch-pad {
  display: flex;
}

@media (any-pointer: coarse) {
  .touch-pad {
    display: flex;
  }
}

.help {
  max-width: 560px;
  margin: 0;
  color: #bbbbbb;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

/* "How to play" box under each game: the goal, how it works, then the controls */
.rules {
  width: min(100%, 640px);
  color: #c3c8ee;
  font-size: 15px;
  line-height: 1.55;
}

.rules summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
}

.rules ul {
  margin: 0;
  padding-left: 20px;
}

.rules .goal {
  margin: 0 0 8px;
  color: #ffffff;
}

.rules h3 {
  margin: 12px 0 4px;
  font-size: 15px;
  color: var(--accent, #ffff00);
}

.board-scores {
  width: min(100%, 420px);
  font-size: 14px;
}

.board-scores h2 {
  margin: 0 0 6px;
  font: 12px "Press Start 2P", monospace;
  color: var(--accent, #ffff00);
  text-align: center;
}

.board-scores ol {
  margin: 0;
  padding-left: 28px;
  color: #c3c8ee;
}

.board-scores li.me {
  color: var(--accent, #ffff00);
  font-weight: 700;
}
