:root {
  --brain-tile-text-solid: #214f70;
  --brain-tile-bg-solid: #e9f3fa;
}

.game-board.playing-board {
  --number-tile-edge: #b7d2e2;
}

.game-setup {
  gap: 10px;
}

.game-setup .prepare-best-row {
  margin-bottom: 4px;
}

.setup-color-block {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.setup-color-block .setup-label {
  margin: 0;
  min-width: 3.4em;
  white-space: nowrap;
}

.setup-color-block .choice-buttons {
  flex-wrap: nowrap;
}

.grid-board {
  display: grid;
  gap: 0.45rem;
  width: 100%;
  max-width: min(96vw, 420px);
  margin: 0 auto;
}

.tap-order-grid {
  touch-action: none;
  -ms-touch-action: none;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

.tap-order-grid .grid-cell {
  aspect-ratio: 1;
  min-height: 0;
  width: 100%;
  border: 2px solid var(--number-tile-edge);
  border-radius: 10px;
  background: var(--brain-tile-bg-solid);
  box-shadow: 0 1px 3px rgba(37, 78, 103, 0.07);
  transition: transform 120ms ease, border-color 120ms ease;
  cursor: pointer;
  font-size: clamp(1rem, 4.6vw, 1.35rem);
  font-weight: 800;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

.tap-order-grid .grid-cell:disabled {
  cursor: default;
}

.tap-order-grid .grid-cell:active:not(:disabled) {
  transform: scale(0.97);
  border-color: #6d9fbd;
}

.game-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 140px;
}

.game-area .prompt {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  text-align: center;
}

.game-area.game-tap125 .grid-cell {
  color: var(--brain-tile-text-solid);
  background: var(--brain-tile-bg-solid);
}

@media (prefers-reduced-motion: reduce) {
  .tap-order-grid .grid-cell { transition: none; }
}

@media (max-width: 320px) {
  .setup-color-block .choice-buttons { flex-wrap: wrap; }
}

@media (max-width: 430px) {
  .tap-order-grid {
    gap: 0.32rem;
    max-width: 100%;
  }
  .tap-order-grid .grid-cell {
    font-size: clamp(0.9rem, 5vw, 1.15rem);
    border-width: 1px;
    border-radius: 8px;
    min-height: 44px;
  }
}

@media (max-height: 760px) and (min-width: 431px) {
  .tap-order-grid {
    max-width: min(50vh, 360px);
    gap: 0.3rem;
  }
  .game-area .prompt {
    font-size: 0.9rem;
  }
}
