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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
  background: #0a0a0a;
  color: white;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  line-height: 1.6;
}

.container {
  max-width: 1000px;
  width: 100%;
  background-color: #111111;
  box-shadow: 0 0 10px rgba(56, 50, 50, 0.5);
  border-radius: 20px;
  padding: 48px;
  border: 1px solid #222222;
}

.header {
  text-align: center;
  margin-bottom: 48px;
}

.title {
  font-size: 2.5rem;
  font-weight: 700;
  color: white;
  margin-bottom: 8px;
  letter-spacing: -0.02rem;
}

.subtitle {
  color: #888888;
  font-size: 1rem;
  font-weight: 400;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
  margin-bottom: 48px;
}

.stat-card {
  background: #1a1a1a;
  border: 1px solid #333333;
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
}

.stat-card:hover {
  border-color: #444444;
  transform: translateY(-2px);
}

.stat-icon {
  font-size: 1.5rem;
  color: #666666;
  margin-bottom: 12px;
  display: block;
}

.stat-value {
  font-size: 2.25rem;
  font-weight: 700;
  color: white;
  margin-bottom: 4px;
  line-height: 1;
}

.stat-label {
  font-size: 0.9rem;
  color: #888888;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  font-weight: 500;
}

.progress-container {
  margin-bottom: 32px;
}

.progress-bar {
  height: 4px;
  background-color: #222222;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: white;
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 100%;
}

.progress-text {
  font-size: 0.9rem;
  color: #666666;
  text-align: center;
}

.text-container {
  background: #333333;
  border: 1px solid #333333;
  border-radius: 12px;
  padding: 32px;
  margin-bottom: 32px;
  font-size: 1.125rem;
  line-height: 1.8;
  position: relative;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.text-content {
  width: 100%;
}

.char {
  position: relative;
  transition: all 0.125s ease;
}

.char.correct {
  color: white;
  background: rgba(34, 197, 94, 0.2);
}

.char.incorrect {
  color: #ff4d4d;
  background: rgba(255, 77, 77, 0.2);
}

.char.current {
  color: #ffcc00;
  background: rgba(255, 204, 0, 0.2);
  animation: pulse 1s infinite;
}

.char.pending {
  color: #888888;
  background: rgba(136, 136, 136, 0.2);
}

@keyframes pulse {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0.7;
  }
}

.input-section {
  margin-bottom: 32px;
}

.typing-input {
  width: 100%;
  padding: 16px 20px;
  font-size: 1.125rem;
  background: #1a1a1a;
  border: 2px solid #333333;
  border-radius: 12px;
  color: white;
  outline: none;
  transition: all 0.2s ease;
}

.typing-input:focus {
  border-color: #ffffff;
}

.typing-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.2s ease;
  text-decoration: none;
  outline: none;
  border: none;
  cursor: pointer;
}

.btn-primary {
  background: #ffffff;
  color: #0a0a0a;
}

.btn-primary:hover {
  background: #f0f0f0;
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: white;
  border: 1px solid #333333;
}

.btn-secondary:hover {
  border-color: #666666;
  background: rgba(255, 255, 255, 0.1);
}

.timer {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #1a1a1a;
  border: 1px solid #333333;
  border-radius: 8px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  font-weight: 500;
  z-index: 1000;
}

.results-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  z-index: 1001;
}

.results-modal.show {
  opacity: 1;
  visibility: visible;
}

.results-content {
  background: #111111;
  border: 1px solid #333333;
  border-radius: 16px;
  padding: 48px;
  text-align: center;
  max-width: 500px;
  width: 90%;
  transform: scale(0.9);
  transition: transform 0.3s ease;
}

.results-modal.show .results-content {
  transform: scale(1);
}

.results-title {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 32px;
  color: white;
}

.results-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 32px;
}

.results-stat {
  text-align: center;
}

.result-stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: white;
  margin-bottom: 8px;
}

.result-stat-label {
  font-size: 0.9rem;
  color: #888888;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
}

@media (max-width: 768px) {
  .container {
    padding: 32px;
    margin: 16px;
  }

  .title {
    font-size: 2rem;
  }

  .stat-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .text-container {
    font-size: 1rem;
    padding: 24px;
  }

  .typing-input {
    font-size: 1rem;
  }

  .controls {
    display: flex;
    align-items: center; /* Fixed: was 'centre' */
  }

  .btn {
    width: 100%;
    max-width: 200px;
    justify-content: center;
  }

  .timer {
    position: static;
    width: fit-content;
    margin: 0 auto 24px;
  }

  .results-content {
    padding: 32px 24px;
  }

  .results-stats {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .hidden {
    display: none;
  }
}
