* { 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, #4a9eda 0%, #2171b5 100%);
  padding: 12px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  overflow: hidden;
}

.game-container {
  display: flex;
  flex-direction: column;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
}

.timer {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 28px;
  font-weight: bold;
  width: 100px;
  flex-shrink: 0;
}

.timer-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.timer-display {
  font-variant-numeric: tabular-nums;
  width: 60px;
}

.score {
  color: #fff;
  font-size: 36px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  width: 80px;
  text-align: center;
  flex-shrink: 0;
}

.start-btn {
  padding: 10px 20px;
  font-size: 16px;
  font-weight: bold;
  background: rgba(255,255,255,0.25);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.word-area {
  background: rgba(0,0,0,0.15);
  border-radius: 12px;
  margin: 0 4px 8px 4px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.word-pill {
  position: absolute;
  padding: 10px 24px;
  border-radius: 25px;
  font-weight: bold;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.word-pill.valid {
  display: flex;
  align-items: baseline;
  gap: 4px;
  background: linear-gradient(180deg, #ffb347 0%, #f5942e 100%);
  box-shadow: 0 3px 8px rgba(0,0,0,0.2);
  opacity: 1;
}

.word-pill.invalid {
  background: linear-gradient(180deg, #ef5350 0%, #c62828 100%);
  box-shadow: 0 3px 8px rgba(0,0,0,0.2);
  opacity: 1;
}

.word-text {
  font-size: 24px;
}

.word-score {
  font-size: 16px;
  position: relative;
  top: -6px;
}

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

/* Game over overlay */
.game-over-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.game-over-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.game-over-text {
  color: #fff;
  font-size: 32px;
  font-weight: bold;
  margin-bottom: 8px;
}

.final-score {
  color: #ffb347;
  font-size: 48px;
  font-weight: bold;
}

.score.flash {
  animation: scoreFlash 0.5s ease-out;
}

@keyframes scoreFlash {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); color: #ffb347; }
  100% { transform: scale(1); }
}
