.typing-page {
  background: radial-gradient(circle at top right, #e0f2fe, #f8fafc 45%, #f5f7fb);
}

.typing-board {
  display: grid;
  gap: 1rem;
  max-width: 980px;
  margin: 0 auto;
}

/* Este proyecto no tiene una regla .hidden global. */
.typing-board .hidden {
  display: none;
}

.typing-screen {
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 18px;
  padding: clamp(1rem, 2vw, 1.4rem);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.08);
}

.typing-title {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.05;
  color: #0c4a6e;
}

.typing-subtitle {
  margin: 0.65rem 0 0;
  color: var(--muted);
  max-width: 62ch;
}

.typing-section-label {
  margin: 1.2rem 0 0.8rem;
  font-size: 1rem;
}

/* ── Intro ───────────────────────────────────────────────────────────────── */
.typing-modes {
  list-style: none;
  margin: 1.2rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.typing-modes li {
  display: grid;
  gap: 0.25rem;
  padding: 0.85rem 0.95rem;
  border-radius: 14px;
  border: 1px solid rgba(14, 165, 233, 0.25);
  background: #e0f2fe;
}

.typing-modes-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.typing-modes strong {
  color: #0c4a6e;
}

.typing-modes span:last-child {
  color: #475569;
  font-size: 0.9rem;
  line-height: 1.35;
}

.typing-level-grid {
  display: grid;
  gap: 0.8rem;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.typing-level-btn {
  display: grid;
  gap: 0.3rem;
  text-align: left;
  padding: 0.95rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: linear-gradient(180deg, #ffffff 0%, #f6f9ff 100%);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform 140ms ease, border-color 140ms ease;
}

.typing-level-btn:hover {
  transform: translateY(-2px);
  border-color: #0ea5e9;
}

.typing-level-btn strong {
  font-size: 1.02rem;
  color: #0c4a6e;
}

.typing-level-btn small {
  color: var(--muted);
  line-height: 1.35;
}

/* ── HUD ─────────────────────────────────────────────────────────────────── */
.typing-hud {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}

.typing-stat {
  border: 1px solid rgba(148, 163, 184, 0.24);
  border-radius: 14px;
  padding: 0.6rem 0.75rem;
  background: rgba(255, 255, 255, 0.9);
  text-align: center;
}

.typing-stat span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-bottom: 0.2rem;
}

.typing-stat strong {
  font-size: 1.15rem;
  color: #0c4a6e;
}

/* ── Tarjeta de juego ────────────────────────────────────────────────────── */
.typing-card {
  display: grid;
  gap: 0.8rem;
}

.typing-question {
  margin: 0;
  border-radius: 14px;
  padding: 0.7rem 1rem;
  background: #e0f2fe;
  border: 1px solid rgba(14, 165, 233, 0.25);
  color: #0c4a6e;
  font-weight: 800;
  text-align: center;
}

.typing-target {
  margin: 0;
  padding: 1rem 1.1rem;
  border-radius: 14px;
  border: 2px dashed #7dd3fc;
  background: #ffffff;
  font-family: "Courier New", monospace;
  font-size: clamp(1.15rem, 3vw, 1.7rem);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #334155;
}

.typing-char {
  border-radius: 3px;
}

.typing-char.is-correct {
  color: #15803d;
  background: #dcfce7;
}

.typing-char.is-wrong {
  color: #b91c1c;
  background: #fee2e2;
}

.typing-char.is-current {
  background: #fde68a;
  box-shadow: 0 2px 0 #f59e0b;
}

.typing-input-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--muted);
}

.typing-input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.8rem 1rem;
  border-radius: 14px;
  border: 2px solid #94a3b8;
  font-family: "Courier New", monospace;
  font-size: clamp(1.1rem, 3vw, 1.6rem);
  line-height: 1.5;
  resize: none;
}

.typing-input:focus {
  outline: none;
  border-color: #0ea5e9;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.25);
}

.typing-input:disabled {
  background: #f1f5f9;
}

.typing-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.typing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

.typing-board .typing-card + .typing-keyboard,
.typing-board .typing-keyboard + .typing-actions,
.typing-board .typing-card + .typing-actions {
  margin-top: 0.9rem;
}

/* ── Estrellas ───────────────────────────────────────────────────────────── */
.typing-round-result,
.typing-summary {
  display: grid;
  gap: 0.6rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(245, 158, 11, 0.35);
  background: #fffbeb;
}

.typing-star-row {
  display: grid;
  grid-template-columns: 6rem auto 1fr;
  align-items: center;
  gap: 0.6rem;
}

.typing-star-label {
  font-weight: 800;
  color: #0c4a6e;
}

.typing-star-detail {
  color: #475569;
  font-size: 0.9rem;
}

.typing-stars {
  display: inline-flex;
  gap: 0.1rem;
  font-size: 1.6rem;
  line-height: 1;
}

.typing-stars--big {
  font-size: 2.2rem;
}

.typing-star {
  color: #cbd5e1;
}

.typing-star.is-on {
  color: #f59e0b;
  text-shadow: 0 1px 0 #b45309;
}

/* ── Teclado de referencia ───────────────────────────────────────────────── */
.typing-keyboard {
  display: grid;
  gap: 0.35rem;
  padding: 0.8rem;
  border-radius: 14px;
  background: #e2e8f0;
  user-select: none;
}

.typing-key-row {
  display: flex;
  justify-content: center;
  gap: 0.35rem;
}

.typing-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(1.7rem, 6vw, 2.8rem);
  height: clamp(2rem, 6vw, 2.8rem);
  padding: 0 0.4rem;
  border-radius: 8px;
  border: 1px solid #94a3b8;
  border-bottom-width: 3px;
  background: #ffffff;
  color: #334155;
  font-size: clamp(0.8rem, 2.4vw, 1.05rem);
  font-weight: 800;
}

.typing-key--space {
  min-width: min(60%, 22rem);
}

.typing-key--backspace,
.typing-key--shift {
  min-width: clamp(2.6rem, 9vw, 4rem);
  background: #f1f5f9;
}

.typing-key.is-next {
  background: #fde68a;
  border-color: #f59e0b;
  color: #78350f;
}

.typing-key.is-pressed {
  transform: translateY(2px);
  background: #bae6fd;
  border-color: #0ea5e9;
}

/* ── Resultado ───────────────────────────────────────────────────────────── */
.typing-result-card {
  display: grid;
  gap: 1rem;
}

.typing-result-card h2 {
  margin: 0;
  color: #0c4a6e;
}

.typing-table {
  width: 100%;
  border-collapse: collapse;
}

.typing-table th,
.typing-table td {
  padding: 0.5rem 0.6rem;
  text-align: left;
  border-bottom: 1px solid rgba(148, 163, 184, 0.35);
}

.typing-table .typing-stars {
  font-size: 1.1rem;
}

.typing-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.typing-error {
  margin: 0;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  background: #fee2e2;
  color: #991b1b;
  font-weight: 700;
}

@media (max-width: 600px) {
  .typing-star-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}
