/* ========== English Typing Page Styles ========== */

.typing-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem 1rem 2.5rem;
}

.typing-container {
  background: var(--card-bg-light);
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 16px;
  padding: 1.2rem;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

body.dark .typing-container {
  background: var(--card-bg-dark);
  border-color: #1f2937;
}

.typing-top-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.language-select,
.time-select {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.language-select label,
.time-select label {
  color: #475569;
  font-weight: 500;
}

body.dark .language-select label,
body.dark .time-select label {
  color: #cbd5f5;
}

.lang-badge {
  padding: 0.25rem 0.6rem;
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
  font-weight: 600;
  font-size: 0.8rem;
}

.time-select select {
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: #f9fafb;
  color: #0f172a;
  font-size: 0.85rem;
  font-weight: 500;
}

body.dark .time-select select {
  background: #0b1220;
  color: #e5e7eb;
  border-color: #334155;
}

.typing-stats-mini {
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.mini-stat {
  border-radius: 10px;
  padding: 0.35rem 0.6rem;
  background: #f9fafb;
  border: 1px solid rgba(148, 163, 184, 0.4);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 70px;
}

body.dark .mini-stat {
  background: #020617;
  border-color: #1e293b;
}

.mini-label {
  font-size: 0.7rem;
  color: #6b7280;
}

body.dark .mini-label {
  color: #9ca3af;
}

.mini-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
}

body.dark .mini-value {
  color: #e5e7eb;
}

.typing-text-box {
  padding: 1.2rem 1rem;
  border-radius: 12px;
  background: #0f172a;
  color: #e5e7eb;
  font-family: "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 1rem;
  line-height: 1.7;
  min-height: 300px;
  max-height: 500px;
  overflow-y: auto;
  position: relative;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: none;
}

.typing-text-box .char {
  position: relative;
}

.typing-text-box .char.correct {
  color: #22c55e;
}

.typing-text-box .char.incorrect {
  color: #f87171;
  text-decoration: underline;
}

.typing-text-box .char.current {
  background: rgba(34, 197, 94, 0.25);
  border-radius: 4px;
}

.typing-text-box .char.current::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: #22c55e;
}

.typing-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.typing-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

.result-box {
  margin-top: 1.2rem;
  padding: 1rem;
  border-radius: 14px;
  background: #f9fafb;
  border: 1px solid rgba(148, 163, 184, 0.5);
  text-align: center;
}

body.dark .result-box {
  background: #020617;
  border-color: #1e293b;
}

.result-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.9rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
  margin-bottom: 1rem;
}

@media (min-width: 600px) {
  .result-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.result-card {
  border-radius: 10px;
  padding: 0.7rem 0.6rem;
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.4);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

body.dark .result-card {
  background: #0b1220;
  border-color: #334155;
}

.result-label {
  font-size: 0.75rem;
  color: #6b7280;
}

body.dark .result-label {
  color: #9ca3af;
}

.result-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
}

body.dark .result-value {
  color: #e5e7eb;
}

.typing-note {
  margin-top: 0.8rem;
  font-size: 0.8rem;
  color: #6b7280;
}

body.dark .typing-note {
  color: #9ca3af;
}

@media (max-width: 600px) {
  .typing-page {
    padding: 1rem 0.6rem 2rem;
  }

  .typing-container {
    padding: 0.9rem 0.7rem;
  }

  .typing-text-box {
    font-size: 0.85rem;
  }

  .typing-top-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .language-select,
  .time-select {
    justify-content: space-between;
  }

  .typing-controls {
    justify-content: stretch;
  }

  .typing-controls .btn {
    flex: 1 1 auto;
    text-align: center;
  }
}