:root {
  --background-color: #faf8ef;
  --grid-color: #bbada0;
  --tile-empty-color: #cdc1b4;
  --text-color: #776e65;
  --button-color: #8f7a66;
  --button-text-color: #f9f6f2;
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: 'Clear Sans', 'Helvetica Neue', Arial, sans-serif;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  max-width: 500px;
  width: 100%;
}

.header {
  display: flex;
  justify-content: space-between;
  width: 100%;
  align-items: center;
}

h1 {
  font-size: 60px;
  font-weight: 700;
  margin: 0;
  line-height: 0.8;
}

.infinite {
  font-size: 30px;
  vertical-align: super;
  color: #edc22e;
}

.scores {
  display: flex;
  gap: 0.5rem;
}

.score-box {
  background: #bbada0;
  padding: 10px 20px;
  font-size: 20px;
  height: auto;
  min-width: 50px;
  font-weight: bold;
  border-radius: 3px;
  color: white;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.score-box .label {
  text-transform: uppercase;
  font-size: 11px;
  line-height: 13px;
  color: #eee4da;
  margin-bottom: 2px;
}

.game-container {
  position: relative;
  background: var(--grid-color);
  border-radius: 6px;
  padding: 10px;
  cursor: default;
  touch-action: none;
  width: fit-content;
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

canvas {
  display: block;
  border-radius: 3px;
}

.controls {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
}

button {
  background: var(--button-color);
  border-radius: 3px;
  padding: 0 20px;
  text-decoration: none;
  color: var(--button-text-color);
  height: 40px;
  line-height: 40px;
  cursor: pointer;
  border: none;
  font-weight: bold;
  font-size: 16px;
  transition: background 0.2s;
}

button:hover {
  background-color: #9f8b77;
}

button:active {
  transform: translateY(1px);
}

.settings {
  display: flex;
  gap: 15px;
  margin-top: 10px;
  flex-wrap: wrap;
  justify-content: center;
  font-size: 14px;
}

.setting-group {
  display: flex;
  align-items: center;
  gap: 5px;
}

select {
  padding: 5px;
  border-radius: 3px;
  border: 1px solid #ccc;
  background: #fff;
  font-family: inherit;
  font-size: 14px;
}

@media (max-width: 500px) {
  h1 { font-size: 40px; }
  .infinite { font-size: 20px; }
  .score-box { padding: 5px 10px; font-size: 16px; }
  canvas { max-width: 100%; height: auto !important; }
}
