/* Phase 9: word-based typing workflow */
.typing-notice {
  margin: 0 0 12px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 14px;
  line-height: 1.55;
}

.typing-area .sample {
  display: block;
  padding: 18px;
  line-height: 2;
  word-spacing: 0;
  scroll-behavior: smooth;
}

.typing-word {
  display: inline-flex;
  align-items: baseline;
  min-height: 34px;
  margin: 2px 8px 2px 0;
  padding: 2px 4px;
  border-radius: 7px;
  color: rgba(255, 255, 255, 0.72);
  transition:
    color 120ms ease,
    background 120ms ease,
    box-shadow 120ms ease,
    transform 120ms ease;
}

.typing-word.current {
  color: #ffffff;
  background: rgba(0, 255, 136, 0.13);
  box-shadow:
    0 0 0 1px rgba(0, 255, 136, 0.62),
    0 0 18px rgba(0, 255, 136, 0.13);
}

.typing-word.completed-correct {
  color: #00ff88;
}

.typing-word.completed-incorrect {
  color: #ff6b6b;
  text-decoration: underline;
  text-decoration-color: rgba(255, 107, 107, 0.88);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.typing-word.current-error {
  background: rgba(255, 77, 77, 0.14);
  box-shadow:
    0 0 0 1px rgba(255, 77, 77, 0.82),
    0 0 18px rgba(255, 77, 77, 0.15);
  animation: typingErrorBlink 260ms ease;
}

.typing-char.correct {
  color: #00ff88;
}

.typing-char.incorrect,
.typing-char.extra {
  color: #ff4d4d;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

.typing-char.pending {
  color: rgba(255, 255, 255, 0.76);
}

@keyframes typingErrorBlink {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1px); }
}

.typing-area .input {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  caret-color: transparent !important;
}

.stats.results-pending .stat-value {
  color: rgba(255, 255, 255, 0.58);
  text-shadow: none;
}

.typing-result-hero {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.typing-result-primary {
  padding: 16px 12px;
  border: 1px solid rgba(0, 255, 136, 0.23);
  border-radius: 14px;
  background: rgba(0, 255, 136, 0.055);
}

.typing-result-primary strong {
  display: block;
  color: #00ff88;
  font-size: 44px;
  line-height: 1.1;
}

.typing-result-primary span {
  display: block;
  margin-top: 7px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.typing-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.typing-result-grid .stat-box {
  min-width: 0;
  padding: 14px 10px;
}

.typing-result-grid .stat-value {
  font-size: 28px !important;
}

@media (max-width: 520px) {
  .typing-word {
    min-height: 30px;
    margin-right: 6px;
  }

  .typing-result-hero,
  .typing-result-grid {
    grid-template-columns: 1fr;
  }

  .typing-result-primary strong {
    font-size: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .typing-area .sample {
    scroll-behavior: auto;
  }

  .typing-word.current-error {
    animation: none;
  }
}
