* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  padding: 20px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

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

.target {
  color: #888;
  font-size: 14px;
  font-weight: 500;
}

.target-value {
  color: #4a9eda;
  font-weight: bold;
}

.scores {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.boards {
  color: #4CAF50;
  font-size: 18px;
  font-weight: bold;
}

.boards.winner {
  animation: pulse 0.5s ease-in-out;
}

.current-score {
  color: #888;
  font-size: 14px;
}

.timer {
  color: #4a9eda;
  font-size: 24px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  min-width: 50px;
  text-align: center;
}

.timer.warning {
  color: #FF9800;
}

.timer.critical {
  color: #F44336;
  animation: pulse 0.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.start-btn {
  padding: 8px 20px;
  font-size: 14px;
  font-weight: bold;
  background: #4a9eda;
  color: #fff;
  border: none;
  border-radius: 20px;
  cursor: pointer;
}

.start-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

canvas {
  border-radius: 12px;
  touch-action: none;
}

.word-area {
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
}


.word-pill {
  padding: 8px 20px;
  border-radius: 24px;
  font-size: 18px;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.word-pill.visible {
  opacity: 1;
}

.word-pill.valid {
  background: #4CAF50;
  color: #fff;
}

.word-pill.invalid {
  background: #F44336;
  color: #fff;
}

.word-pill.duplicate {
  background: #FF9800;
  color: #fff;
}

.word-pill.trap {
  background: #F44336;
  color: #fff;
  animation: shake 0.5s ease-in-out;
}

.word-pill.overshoot {
  background: #F44336;
  color: #fff;
  animation: shake 0.5s ease-in-out;
}

.word-pill.win {
  background: linear-gradient(135deg, #4CAF50, #8BC34A);
  color: #fff;
  animation: pulse 0.5s ease-in-out;
}

.word-pill.solved {
  background: linear-gradient(135deg, #4CAF50, #8BC34A);
  color: #fff;
  animation: pulse 0.5s ease-in-out;
}

.word-pill.bonus {
  background: linear-gradient(135deg, #FF9800, #FFC107);
  color: #fff;
  animation: pulse 0.5s ease-in-out;
}

.word-pill.timeout {
  background: #FF9800;
  color: #fff;
}

.word-pill.selecting {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}
