:root {
  --cell-size: 30px;
}

body {
  margin: 0;
  font-family: 'Arial', sans-serif;
  padding: calc(env(safe-area-inset-top) + 1rem) clamp(1rem, 4vw, 2rem) calc(env(safe-area-inset-bottom) + 1rem);
  background: linear-gradient(135deg, #f0f4ff, #d9e4ff);
  color: #333;
  text-align: center;
  min-height: var(--app-height, 100vh);
  box-sizing: border-box;
}

h1 {
  font-size: 0.75rem;
  margin: 0.25rem 0;
}

#instructions {
  font-size: 0.4rem;
  margin: 0.1rem 0;
}

.controls {
  margin-bottom: 0.5rem;
}

select,
button {
  padding: 0.25rem 0.5rem;
  font-size: 0.5rem;
  border: none;
  border-radius: 4px;
  margin: 0 0.25rem;
  background: #4a90e2;
  color: #fff;
  cursor: pointer;
}

.timer {
  margin-left: 0.25rem;
  font-size: 0.5rem;
  font-weight: bold;
}

.game-container {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
}

.grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-size), var(--cell-size));
  grid-auto-rows: var(--cell-size);
  gap: 2px;
  background: #fff;
  border: 2px solid #4a90e2;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  max-width: 100%;
  touch-action: none;
}

.cell {
  width: var(--cell-size);
  height: var(--cell-size);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #ccc;
  font-weight: bold;
  user-select: none;
  text-transform: uppercase;
  transition: background 0.2s;
  border-radius: 4px;
  touch-action: none;
}

.cell.selected {
  background: #ffd54f;
}

.cell.found {
  background: #ffe0e0;
  color: red;
  text-decoration: line-through;
  text-decoration-color: red;
}


/*
 * Display the word list in a horizontal row that wraps as needed.
 * Fonts and line height stay tiny to keep the list compact.
 */
.word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  font-size: 0.5rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.8);
  padding: 1rem;
  border-radius: 8px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  justify-content: center;
}

.word-list .word {
  text-transform: uppercase;
}

.word-list .found {
  text-decoration: line-through;
  text-decoration-color: red;
  color: red;
}

.category-title {
  font-weight: bold;
  margin-top: 8px;
}
