@import url('../global.css');

/* =============================================================================
   Typing — game-specific styles.
   The input (.input-field--game) and the details bar (.game-details, HUD stats)
   come from the shared components/layouts.
   ========================================================================== */

/* Square play area (same footprint as the other games). "Focus" mode: the
   current word large, the preview of the next ones below, the input pinned at
   the bottom. */
.typing-area {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
  padding: var(--spacing-md);
  background: var(--background-color-light);
  border: 1px solid var(--border-color-light);
  border-radius: var(--border-radius-md);
  overflow: hidden;
}

/* Current word + preview. Mobile-first: pushed UP to stay visible above the
   touch keyboard; centered on large screens (no keyboard). */
.word-container {
  flex: 1 1 auto;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  gap: var(--spacing-lg);
  padding-top: var(--spacing-md);
  overflow: hidden;
}

@media (min-width: 768px) {
  .word-container {
    justify-content: center;
    padding-top: 0;
  }
}

/* Word to type, large. One letter per span for live coloring; long words wrap
   rather than overflow. */
.focus-word {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.02em;
  font-size: clamp(2rem, 11vw, 4rem);
  font-weight: var(--font-weight-bolder);
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.focus-letter {
  color: var(--text-color-muted);
  transition: color 0.08s ease;
}

/* Correctly typed / mistyped letter. */
.focus-letter.correct {
  color: var(--secondary-color);
}

.focus-letter.incorrect {
  color: var(--error-color);
  text-decoration: underline;
}

/* Next expected letter (visual cursor). */
.focus-letter.active {
  color: var(--text-color);
  border-bottom: 3px solid var(--primary-color);
}

/* Discreet preview of the next words. */
.upcoming {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--spacing-sm);
  max-width: 100%;
}

.upcoming-word {
  padding: var(--spacing-xs) var(--spacing-sm);
  font-size: var(--font-size-xl);
  color: var(--text-color-muted);
  background: var(--white-color);
  border: 1px solid var(--border-color-light);
  border-radius: var(--border-radius-sm);
  white-space: nowrap;
}

/* Input pinned at the bottom of the typing area, centered. */
.input-field--game {
  align-self: center;
  flex: 0 0 auto;
}
