body {
  margin: 0;
  min-height: 100vh;
  box-sizing: border-box;
  padding: 12px 0 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #14161c;
  color: #e8e8e8;
  font-family: system-ui, sans-serif;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

h1 {
  margin: 0 0 8px;
  font-size: 1.4rem;
}

h2 {
  margin: 12px 0 6px;
  font-size: 1.05rem;
}

#info {
  margin-bottom: 8px;
  font-size: 1rem;
}

canvas {
  background: #1d2029;
  border: 2px solid #3a3f4f;
  border-radius: 8px;
  max-width: 95vw;
  height: auto;
  touch-action: none;
}

/* On-screen arrow buttons: only on touch devices */
#pad {
  display: none;
  grid-template-columns: repeat(3, 64px);
  grid-template-rows: repeat(2, 64px);
  gap: 8px;
  margin-top: 8px;
}

#pad button {
  font-size: 1.5rem;
  border: 2px solid #3a3f4f;
  border-radius: 12px;
  background: #1d2029;
  color: #e8e8e8;
  touch-action: none;
}

#pad button:active { background: #3a3f4f; }
#pad button[aria-label="Up"]    { grid-column: 2; grid-row: 1; }
#pad button[aria-label="Left"]  { grid-column: 1; grid-row: 2; }
#pad button[aria-label="Down"]  { grid-column: 2; grid-row: 2; }
#pad button[aria-label="Right"] { grid-column: 3; grid-row: 2; }

#buttons {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

#buttons button {
  padding: 6px 12px;
  font-size: 0.85rem;
  border: 2px solid #3a3f4f;
  border-radius: 8px;
  background: #1d2029;
  color: #e8e8e8;
  cursor: pointer;
}

#buttons button:hover:not(:disabled) { background: #2a2e3a; }

#settings {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
}

#settings label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;
  color: #9aa;
}

select {
  padding: 6px 8px;
  font-size: 0.9rem;
  border: 2px solid #3a3f4f;
  border-radius: 8px;
  background: #1d2029;
  color: #e8e8e8;
}

button:disabled,
select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#scores {
  margin: 0;
  padding-left: 1.4rem;
  min-width: 230px;
  font-size: 0.9rem;
}

#scores li { margin: 2px 0; }
#scores li.new { color: #ffd700; font-weight: bold; }
#scores li.empty { list-style: none; margin-left: -1.4rem; color: #9aa; }

p {
  max-width: 420px;
  margin: 10px 12px 0;
  text-align: center;
  color: #9aa;
  font-size: 0.85rem;
}
